satori 0.0.24 → 0.0.27

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 CHANGED
@@ -97,53 +97,143 @@ If you want to render the generated SVG to another image format such as PNG, it
97
97
 
98
98
  Satori uses the same Flexbox [layout engine](https://yogalayout.com) as React Native, and it’s **not** a complete CSS implementation. However, it supports a subset of the spec that covers most common CSS features:
99
99
 
100
- | Property | Supported Values |
101
- | --- | --- |
102
- | `display` | `none`, `flex` |
103
- | `position` | `relative`, `absolute` |
104
- | `margin`, `padding` | Supported |
105
- | `top`, `right`, `bottom`, `left` | Supported |
106
- | `width`, `height` | Supported |
107
- | `max-width`, `max-height` | Supported |
108
- | `min-width`, `min-height` | Supported |
109
- | `border` | Supported |
110
- | `flex-direction` | Supported |
111
- | `flex-wrap` | Supported |
112
- | `flex-grow` | Supported |
113
- | `flex-shrink` | Supported |
114
- | `flex-basis` | Supported except for `auto` |
115
- | `align-items` | Supported |
116
- | `align-content` | Supported |
117
- | `align-self` | Supported |
118
- | `justify-content` | Supported |
119
- | `font-family` | Supported |
120
- | `font-size` | Supported |
121
- | `font-weight` | Supported |
122
- | `font-style` | Supported |
123
- | `text-align` | Supported |
124
- | `letter-spacing` | Supported |
125
- | `box-shadow` | All supported except `spread-radius` and `inset` (works like `drop-shadow`) |
126
- | `border-radius` | Supported |
127
- | `overflow` | `visible`, `hidden` |
128
- | `color` | Supported |
129
- | `transform` | Support absolute values |
130
- | `transform-origin` | Support one-value and two-value syntax (both relative and absolute values) |
131
- | `object-fit` | `contain`, `cover`, `none` |
132
- | `opacity` | Supported |
133
- | `background-color` | Supported |
134
- | `background-image` | Support `linear-gradient`, `radial-gradient`, `url` |
135
- | `word-break` | Supported |
136
- | `text-shadow` | Supported |
137
- | `text-transform` | Support `lowercase`, `uppercase`, `capitalize` |
138
- | `background-position` | Supported |
139
- | `background-size` | Support two-value size string such as `10px 20%` |
140
- | `white-space` | Support `normal`, `pre`, `pre-wrap` and `nowrap` |
141
- | `text-overflow` | Support `clip` and `ellipsis` |
142
- | `text-decoration` | Support line types `underline` and `line-through`, and styles `dotted`, `dashed`, `solid` |
143
- | `line-height` | Supported |
144
- | `background-clip` | Support `border-box` and `text` |
145
- | `background-repeat` | Supported |
146
- | `filter` | Supported |
100
+ <table>
101
+ <thead>
102
+ <tr>
103
+ <th>Property</th>
104
+ <th>Property Expanded</th>
105
+ <th>Supported Values</th>
106
+ </tr>
107
+ </thead>
108
+ <tbody>
109
+
110
+ <tr>
111
+ <td colspan="2"><code>display</code></td>
112
+ <td><code>none</code> and <code>flex</code>, default to <code>flex</code></td>
113
+ </tr>
114
+
115
+ <tr>
116
+ <td colspan="2"><code>position</code></td>
117
+ <td><code>relative</code> and <code>absolute</code>, default to <code>relative</code></td>
118
+ </tr>
119
+
120
+ <tr>
121
+ <td colspan="2"><code>color</code></td>
122
+ <td>Supported</td>
123
+ </tr>
124
+
125
+ <tr><td rowspan="5"><code>margin</code></td></tr>
126
+ <tr><td><code>marginTop</code></td><td>Supported</td></tr>
127
+ <tr><td><code>marginRight</code></td><td>Supported</td></tr>
128
+ <tr><td><code>marginBottom</code></td><td>Supported</td></tr>
129
+ <tr><td><code>marginLeft</code></td><td>Supported</td></tr>
130
+
131
+ <tr><td rowspan="5">Position</td></tr>
132
+ <tr><td><code>top</code></td><td>Supported</td></tr>
133
+ <tr><td><code>right</code></td><td>Supported</td></tr>
134
+ <tr><td><code>bottom</code></td><td>Supported</td></tr>
135
+ <tr><td><code>left</code></td><td>Supported</td></tr>
136
+
137
+ <tr><td rowspan="3">Size</td></tr>
138
+ <tr><td><code>width</code></td><td>Supported</td></tr>
139
+ <tr><td><code>height</code></td><td>Supported</td></tr>
140
+
141
+ <tr><td rowspan="5">Min & max size</td></tr>
142
+ <tr><td><code>min-width</code></td><td>Supported</td></tr>
143
+ <tr><td><code>min-height</code></td><td>Supported</td></tr>
144
+ <tr><td><code>max-width</code></td><td>Supported</td></tr>
145
+ <tr><td><code>max-height</code></td><td>Supported</td></tr>
146
+
147
+ <tr><td rowspan="5"><code>border</code></td></tr>
148
+ <tr><td><code>borderWidth</code></td><td>Supported</td></tr>
149
+ <tr><td><code>borderStyle</code></td><td><code>solid</code> and <code>dashed</code>, default to <code>solid</code></td></tr>
150
+ <tr><td><code>borderColor</code></td><td>Supported</td></tr>
151
+ <tr><td>
152
+ Shorthand</td><td>Supported, i.e. <code>1px solid gray</code><br/>
153
+ Note that it isn't supported to set border width/style/color for individual directions.
154
+ </td></tr>
155
+
156
+ <tr><td rowspan="6"><code>borderRadius</code></td></tr>
157
+ <tr><td><code>borderTopLeftRadius</code></td><td>Supported</td></tr>
158
+ <tr><td><code>borderTopRightRadius</code></td><td>Supported</td></tr>
159
+ <tr><td><code>borderBottomLeftRadius</code></td><td>Supported</td></tr>
160
+ <tr><td><code>borderBottomRightRadius</code></td><td>Supported</td></tr>
161
+ <tr><td>Shorthand</td><td>Supported, i.e. <code>5px</code></td></tr>
162
+
163
+ <tr><td rowspan="10">Flex</td></tr>
164
+ <tr><td><code>flexDirection</code></td><td><code>column</code>, <code>row</code>, <code>row-reverse</code>, <code>column-reverse</code>, default to <code>row</code></td></tr>
165
+ <tr><td><code>flexWrap</code></td><td><code>wrap</code>, <code>nowrap</code>, <code>wrap-reverse</code>, default to <code>wrap</code></td></tr>
166
+ <tr><td><code>flexGrow</code></td><td>Supported</td></tr>
167
+ <tr><td><code>flexShrink</code></td><td>Supported</td></tr>
168
+ <tr><td><code>flexBasis</code></td><td>Supported except for <code>auto</code></td></tr>
169
+ <tr><td><code>alignItems</code></td><td>Supported</td></tr>
170
+ <tr><td><code>alignContent</code></td><td>Supported</td></tr>
171
+ <tr><td><code>alignSelf</code></td><td>Supported</td></tr>
172
+ <tr><td><code>justifyContent</code></td><td>Supported</td></tr>
173
+
174
+ <tr><td rowspan="5">Font</td></tr>
175
+ <tr><td><code>fontFamily</code></td><td>Supported</td></tr>
176
+ <tr><td><code>fontSize</code></td><td>Supported</td></tr>
177
+ <tr><td><code>fontWeight</code></td><td>Supported</td></tr>
178
+ <tr><td><code>fontStyle</code></td><td>Supported</td></tr>
179
+
180
+ <tr><td rowspan="10">Text</td></tr>
181
+ <tr><td><code>textAlign</code></td><td><code>start</code>, <code>end</code>, <code>left</code>, <code>right</code>, <code>center</code>, <code>justify</code>, default to <code>start</code></td></tr>
182
+ <tr><td><code>textTransform</code></td><td><code>none</code>, <code>lowercase</code>, <code>uppercase</code>, <code>capitalize</code>, defaults to <code>none</code></td></tr>
183
+ <tr><td><code>textOverflow</code></td><td><code>clip</code>, <code>ellipsis</code>, defaults to <code>clip</code></td></tr>
184
+ <tr><td><code>textDecoration</code></td><td>Support line types <code>underline</code> and <code>line-through</code>, and styles <code>dotted</code>, <code>dashed</code>, <code>solid</code></td></tr>
185
+ <tr><td><code>textShadow</code></td><td>Support single shadow</td></tr>
186
+ <tr><td><code>lineHeight</code></td><td>Supported</td></tr>
187
+ <tr><td><code>letterSpacing</code></td><td>Supported</td></tr>
188
+ <tr><td><code>whiteSpace</code></td><td><code>normal</code>, <code>pre</code>, <code>pre-wrap</code>, <code>nowrap</code>, defaults to <code>normal</code></td></tr>
189
+ <tr><td><code>wordBreak</code></td><td><code>normal</code>, <code>break-all</code>, <code>break-word</code>, <code>keep-all</code>, defaults to <code>normal</code></td></tr>
190
+
191
+ <tr><td rowspan="7">Background</td></tr>
192
+ <tr><td><code>backgroundColor</code></td><td>Supported, single value</td></tr>
193
+ <tr><td><code>backgroundImage</code></td><td><code>linear-gradient</code>, <code>radial-gradient</code>, <code>url</code>, single value</td></tr>
194
+ <tr><td><code>backgroundPosition</code></td><td>Support single value</td></tr>
195
+ <tr><td><code>backgroundSize</code></td><td>Support two-value size i.e. `10px 20%`</td></tr>
196
+ <tr><td><code>backgroundClip</code></td><td><code>border-box</code>, <code>text</code></td></tr>
197
+ <tr><td><code>backgroundRepeat</code></td><td><code>repeat</code>, <code>repeat-x</code>, <code>repeat-y</code>, <code>no-repeat</code>, defaults to <code>repeat</code></td></tr>
198
+
199
+ <tr><td rowspan="5"><code>transform</code></td></tr>
200
+ <tr><td>Translate (<code>translate</code>, <code>translateX</code>, <code>translateY</code>)</td><td>Support absolute values only</td></tr>
201
+ <tr><td>Rotate</td><td>Supported</td></tr>
202
+ <tr><td>Scale (<code>scale</code>, <code>scaleX</code>, <code>scaleY</code>)</td><td>Supported</td></tr>
203
+ <tr><td>Skew (<code>skew</code>, <code>skewX</code>, <code>skewY</code>)</td><td>Supported</td></tr>
204
+
205
+ <tr>
206
+ <td colspan="2"><code>transformOrigin</code></td>
207
+ <td>Support one-value and two-value syntax (both relative and absolute values)</td>
208
+ </tr>
209
+
210
+ <tr>
211
+ <td colspan="2"><code>objectFit</code></td>
212
+ <td><code>contain</code>, <code>cover</code>, <code>none</code>, default to <code>node</code></td>
213
+ </tr>
214
+
215
+ <tr>
216
+ <td colspan="2"><code>opacity</code></td>
217
+ <td>Supported</td>
218
+ </tr>
219
+
220
+ <tr>
221
+ <td colspan="2"><code>boxShadow</code></td>
222
+ <td>Supported except spread radius and inset shadow.<br/>Note: this property works similar to <code>drop-shadow</code> in CSS.</td>
223
+ </tr>
224
+
225
+ <tr>
226
+ <td colspan="2"><code>overflow</code></td>
227
+ <td><code>visible</code> and <code>hidden</code>, default to <code>visible</code></td>
228
+ </tr>
229
+
230
+ <tr>
231
+ <td colspan="2"><code>filter</code></td>
232
+ <td>Supported</td>
233
+ </tr>
234
+
235
+ </tbody>
236
+ </table>
147
237
 
148
238
  Note:
149
239
 
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
- var Ot=Object.defineProperty,Ft=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var ct=Object.getOwnPropertySymbols;var Pt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var dt=(e,n,t)=>n in e?Ot(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,G=(e,n)=>{for(var t in n||(n={}))Pt.call(n,t)&&dt(e,t,n[t]);if(ct)for(var t of ct(n))Wt.call(n,t)&&dt(e,t,n[t]);return e},se=(e,n)=>Ft(e,$t(n));import*as Nt from"yoga-layout-prebuilt";var pt=Nt;var Pe;Pe=pt.default;function Mt(e){Pe=e}function te(){return Pe}import{LineBreaker as Gt}from"css-line-break";import{splitGraphemes as Dt}from"text-segmentation";function We(e){let n=typeof e;return!(n==="number"||n==="bigint"||n==="string"||n==="boolean")}function mt(e){return/^class\s/.test(Function.prototype.toString.call(e))}function ge(e,n){return[e[0]*n[0]+e[2]*n[1],e[1]*n[0]+e[3]*n[1],e[0]*n[2]+e[2]*n[3],e[1]*n[2]+e[3]*n[3],e[0]*n[4]+e[2]*n[5]+e[4],e[1]*n[4]+e[3]*n[5]+e[5]]}function K(e,n,t){let o=n[e];return typeof o=="undefined"?t:o}var gt=void 0,Ne=typeof Intl!="undefined"&&"Segmenter"in Intl&&process.env.NODE_ENV!=="test",Bt=Ne?new Intl.Segmenter(gt,{granularity:"word"}):null,Yt=Ne?new Intl.Segmenter(gt,{granularity:"grapheme"}):null,ye=[32,160,4961,65792,65793,4153,4241,10].map(e=>String.fromCodePoint(e)),Ht=e=>{let n=Gt(e,{lineBreak:"strict",wordBreak:"normal"}),t=[],o;for(;!(o=n.next()).done;)if(o.value){let a=o.value.slice(),r="";for(let i=0;i<a.length;i++){let s=a[i];ye.includes(s)?(r.length&&t.push(r),t.push(s),r=""):r+=s}r.length&&t.push(r)}return t};function le(e,n){return Ne?n==="word"?[...Bt.segment(e)].map(t=>t.segment):[...Yt.segment(e)].map(t=>t.segment):n==="word"?Ht(e):Dt(e)}function x(e,n,t){let o="";for(let[a,r]of Object.entries(n))typeof r!="undefined"&&(o+=` ${a}="${r}"`);return t?`<${e}${o}>${t}</${e}>`:`<${e}${o}/>`}var ht={p:{display:"block",marginTop:"1em",marginBottom:"1em"},div:{display:"block"},blockquote:{display:"block",marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40},center:{display:"block",textAlign:"center"},hr:{display:"block",marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,borderStyle:"inset"},h1:{display:"block",fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h2:{display:"block",fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold"},h3:{display:"block",fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold"},h4:{display:"block",marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},h5:{display:"block",fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h6:{display:"block",fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},u:{textDecoration:"underline"},strong:{fontWeight:"bold"},b:{fontWeight:"bold"},i:{fontStyle:"italic"},em:{fontStyle:"italic"},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{display:"block",fontFamily:"monospace",whiteSpace:"pre",marginTop:"1em",marginBottom:"1em"},mark:{backgroundColor:"yellow",color:"black"},big:{fontSize:"larger"},small:{fontSize:"smaller"},s:{textDecoration:"line-through"}};var Xt=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","textAlign","textTransform","textShadowOffset","textShadowColor","textShadowRadius","textDecorationLine","textDecorationStyle","textDecorationColor","whiteSpace","transform","wordBreak","opacity","filter","_viewportWidth","_viewportHeight","_inheritedClipPathId","_inheritedBackgroundClipTextPath"]);function Me(e){let n={};for(let t in e)Xt.has(t)&&(n[t]=e[t]);return n}import{getPropertyName as on,getStylesForProperty as an}from"css-to-react-native";import{parseElementStyle as sn}from"css-background-parser";var xe=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),Ut=xe((e,n)=>{n.exports=["em","ex","ch","rem","vh","vw","vmin","vmax","px","mm","cm","in","pt","pc","mozmm"]}),zt=xe((e,n)=>{n.exports=["deg","grad","rad","turn"]}),jt=xe((e,n)=>{n.exports=["dpi","dpcm","dppx"]}),Vt=xe((e,n)=>{n.exports=["Hz","kHz"]}),Jt=xe((e,n)=>{n.exports=["s","ms"]}),Kt=Ut(),bt=zt(),yt=jt(),xt=Vt(),Et=Jt();function De(e){if(/\.\D?$/.test(e))throw new Error("The dot should be followed by a number");if(/^[+-]{2}/.test(e))throw new Error("Only one leading +/- is allowed");if(qt(e)>1)throw new Error("Only one dot is allowed");if(/%$/.test(e)){this.type="percentage",this.value=Ge(e),this.unit="%";return}var n=Qt(e);if(!n){this.type="number",this.value=Ge(e);return}this.type=tn(n),this.value=Ge(e.substr(0,e.length-n.length)),this.unit=n}De.prototype.valueOf=function(){return this.value};De.prototype.toString=function(){return this.value+(this.unit||"")};function fe(e){return new De(e)}function qt(e){var n=e.match(/\./g);return n?n.length:0}function Ge(e){var n=parseFloat(e);if(isNaN(n))throw new Error("Invalid number: "+e);return n}var Zt=[].concat(bt,xt,Kt,yt,Et);function Qt(e){var n=e.match(/\D+$/),t=n&&n[0];if(t&&Zt.indexOf(t)===-1)throw new Error("Invalid unit: "+t);return t}var en=Object.assign(Le(bt,"angle"),Le(xt,"frequency"),Le(yt,"resolution"),Le(Et,"time"));function Le(e,n){return Object.fromEntries(e.map(t=>[t,n]))}function tn(e){return en[e]||"length"}import nn from"postcss-value-parser";function rn(e,n){try{let t=new fe(e);switch(t.unit){case"px":return{absolute:t.value};case"em":return{absolute:t.value*n};case"rem":return{absolute:t.value*16};case"%":return{relative:t.value};default:return{}}}catch{return{}}}function Be(e,n,t){switch(e){case"top":return{yRelative:0};case"left":return{xRelative:0};case"right":return{xRelative:100};case"bottom":return{yRelative:100};case"center":return{};default:let o=rn(e,n);return o.absolute?{[t?"xAbsolute":"yAbsolute"]:o.absolute}:o.relative?{[t?"xRelative":"yRelative"]:o.relative}:{}}}function Ye(e,n){if(typeof e=="number")return{xAbsolute:e};let t;try{t=nn(e).nodes.filter(o=>o.type==="word").map(o=>o.value)}catch{return{}}return t.length===1?Be(t[0],n,!0):t.length===2?((t[0]==="top"||t[0]==="bottom"||t[1]==="left"||t[1]==="right")&&t.reverse(),G(G({},Be(t[0],n,!0)),Be(t[1],n,!1))):{}}var ln=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),fn=new Set(["lineHeight"]),_t=[1,0,0,1,0,0];function un(e,n,t,o){return e==="border"&&!t.includes(n.borderColor)?n.borderColor=o:e==="textDecoration"&&!t.includes(n.textDecorationColor)&&(n.textDecorationColor=o),n}function St(e,n){return typeof n=="number"?ln.has(e)?fn.has(e)?n:String(n):n+"px":n}function cn(e,n){return e==="lineHeight"?{lineHeight:St(e,n)}:e==="fontFamily"?{fontFamily:n.split(",").map(t=>t.trim().replace(/(^['"])|(['"]$)/g,"").toLocaleLowerCase())}:null}function He(e,n,t,{percentage:o}={percentage:!1}){if(typeof e=="number")return e;try{let a=new fe(e);if(a.type==="length")switch(a.unit){case"em":return a.value*n;case"rem":return a.value*16;case"vw":return~~(a.value*t._viewportWidth/100);case"vh":return~~(a.value*t._viewportHeight/100);default:return a.value}else if(a.type==="angle")switch(a.unit){case"deg":return a.value;case"rad":return a.value*180/Math.PI;default:return a.value}else if(a.type==="percentage"&&o)return a.value/100*n}catch{}}function ke(e,n){let t={};for(let a in e){if(a.startsWith("_")){t[a]=e[a];continue}let r=on(a);Object.assign(t,cn(r,e[a])||un(r,an(r,St(r,e[a]),!0),e[a],e.color||n.color))}if(t.backgroundImage){let{backgrounds:a}=sn(t);t.backgroundImage=a}let o=t.fontSize||n.fontSize;if(typeof o=="string")try{let a=new fe(o);switch(a.unit){case"em":o=a.value*n.fontSize;break;case"rem":o=a.value*16;break}}catch{o=16}typeof t.fontSize!="undefined"&&(t.fontSize=o),t.transformOrigin&&(t.transformOrigin=Ye(t.transformOrigin,o));for(let a in t){let r=t[a];if(a==="lineHeight")typeof r=="string"&&(r=t[a]=He(r,o,n,{percentage:!0})/o);else if(typeof r=="string"){let i=He(r,o,n);typeof i!="undefined"&&(t[a]=i),r=t[a]}if(a==="opacity"&&(r=t[a]=r*n.opacity),a==="transform"){let i=[..._t],s=r;for(let f of s){let m=Object.keys(f)[0],g=f[m],c=typeof g=="string"?He(g,o,n):g,d=[..._t];switch(m){case"translateX":d[4]=c;break;case"translateY":d[5]=c;break;case"scale":d[0]=c,d[3]=c;break;case"scaleX":d[0]=c;break;case"scaleY":d[3]=c;break;case"rotate":let h=c*Math.PI/180,l=Math.cos(h),u=Math.sin(h);d[0]=l,d[1]=u,d[2]=-u,d[3]=l;break;case"skewX":d[2]=Math.tan(c*Math.PI/180);break;case"skewY":d[1]=Math.tan(c*Math.PI/180);break}i=ge(d,i)}t.transform=i}}return t}function Xe(e,n,t,o,a){let r=te(),i=G(G(G({},t),ke(ht[n],t)),ke(o,t));if(n==="img"){let s=parseInt(a.width),m=parseInt(a.height)/s;i.width||(i.width=s),i.height||(i.height=m*i.width)}return e.setDisplay(K(i.display,{flex:r.DISPLAY_FLEX,none:r.DISPLAY_NONE},r.DISPLAY_FLEX)),e.setAlignContent(K(i.alignContent,{stretch:r.ALIGN_STRETCH,center:r.ALIGN_CENTER,"flex-start":r.ALIGN_FLEX_START,"flex-end":r.ALIGN_FLEX_END,"space-between":r.ALIGN_SPACE_BETWEEN,"space-around":r.ALIGN_SPACE_AROUND,baseline:r.ALIGN_BASELINE,normal:r.ALIGN_AUTO},r.ALIGN_AUTO)),e.setAlignItems(K(i.alignItems,{stretch:r.ALIGN_STRETCH,center:r.ALIGN_CENTER,"flex-start":r.ALIGN_FLEX_START,"flex-end":r.ALIGN_FLEX_END,baseline:r.ALIGN_BASELINE,normal:r.ALIGN_AUTO},r.ALIGN_FLEX_START)),e.setAlignSelf(K(i.alignSelf,{stretch:r.ALIGN_STRETCH,center:r.ALIGN_CENTER,"flex-start":r.ALIGN_FLEX_START,"flex-end":r.ALIGN_FLEX_END,baseline:r.ALIGN_BASELINE,normal:r.ALIGN_AUTO},r.ALIGN_AUTO)),e.setJustifyContent(K(i.justifyContent,{center:r.JUSTIFY_CENTER,"flex-start":r.JUSTIFY_FLEX_START,"flex-end":r.JUSTIFY_FLEX_END,"space-between":r.JUSTIFY_SPACE_BETWEEN,"space-around":r.JUSTIFY_SPACE_AROUND},r.JUSTIFY_FLEX_START)),e.setFlexDirection(K(i.flexDirection,{row:r.FLEX_DIRECTION_ROW,column:r.FLEX_DIRECTION_COLUMN,"row-reverse":r.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":r.FLEX_DIRECTION_COLUMN_REVERSE},r.FLEX_DIRECTION_ROW)),e.setFlexWrap(K(i.flexWrap,{wrap:r.WRAP_WRAP,nowrap:r.WRAP_NO_WRAP,"wrap-reverse":r.WRAP_WRAP_REVERSE},r.WRAP_WRAP)),typeof i.flexBasis!="undefined"&&e.setFlexBasis(i.flexBasis),e.setFlexGrow(typeof i.flexGrow=="undefined"?0:i.flexGrow),e.setFlexShrink(typeof i.flexShrink=="undefined"?0:i.flexShrink),typeof i.maxHeight!="undefined"&&e.setMaxHeight(i.maxHeight),typeof i.maxWidth!="undefined"&&e.setMaxWidth(i.maxWidth),typeof i.minHeight!="undefined"&&e.setMinHeight(i.minHeight),typeof i.minWidth!="undefined"&&e.setMinWidth(i.minWidth),e.setOverflow(K(i.overflow,{visible:r.OVERFLOW_VISIBLE,hidden:r.OVERFLOW_HIDDEN},r.OVERFLOW_VISIBLE)),e.setMargin(r.EDGE_TOP,i.marginTop||0),e.setMargin(r.EDGE_BOTTOM,i.marginBottom||0),e.setMargin(r.EDGE_LEFT,i.marginLeft||0),e.setMargin(r.EDGE_RIGHT,i.marginRight||0),e.setBorder(r.EDGE_TOP,i.borderWidth||0),e.setBorder(r.EDGE_BOTTOM,i.borderWidth||0),e.setBorder(r.EDGE_LEFT,i.borderWidth||0),e.setBorder(r.EDGE_RIGHT,i.borderWidth||0),e.setPadding(r.EDGE_TOP,i.paddingTop||0),e.setPadding(r.EDGE_BOTTOM,i.paddingBottom||0),e.setPadding(r.EDGE_LEFT,i.paddingLeft||0),e.setPadding(r.EDGE_RIGHT,i.paddingRight||0),e.setPositionType(K(i.position,{absolute:r.POSITION_TYPE_ABSOLUTE,relative:r.POSITION_TYPE_RELATIVE},r.POSITION_TYPE_RELATIVE)),typeof i.top!="undefined"&&e.setPosition(r.EDGE_TOP,i.top),typeof i.bottom!="undefined"&&e.setPosition(r.EDGE_BOTTOM,i.bottom),typeof i.left!="undefined"&&e.setPosition(r.EDGE_LEFT,i.left),typeof i.right!="undefined"&&e.setPosition(r.EDGE_RIGHT,i.right),typeof i.height!="undefined"?e.setHeight(i.height):e.setHeightAuto(),typeof i.width!="undefined"?e.setWidth(i.width):e.setWidthAuto(),[i,Me(i)]}function ue({left:e,top:n,width:t,height:o},a,r,i){var f,m,g,c;let s;if(r)s=a;else{let d=(m=i==null?void 0:i.xAbsolute)!=null?m:((f=i==null?void 0:i.xRelative)!=null?f:50)*t/100,h=(c=i==null?void 0:i.yAbsolute)!=null?c:((g=i==null?void 0:i.yRelative)!=null?g:50)*o/100,l=e+d,u=n+h;s=ge([1,0,0,1,l,u],ge(a,[1,0,0,1,-l,-u])),a.__parent&&(s=ge(a.__parent,s)),a.splice(0,6,...s)}return`matrix(${s.map(d=>d.toFixed(2)).join(",")})`}function wt({left:e,top:n,width:t,height:o,isInheritingTransform:a},r){let i="",s=1;return r.transform&&(i=ue({left:e,top:n,width:t,height:o},r.transform,a,r.transformOrigin)),r.opacity&&(s=+r.opacity),{matrix:i,opacity:s}}function Ue({id:e,content:n,filter:t,left:o,top:a,width:r,height:i,matrix:s,opacity:f,image:m,clipPathId:g,debug:c,shape:d,decorationShape:h},l){let u="";if(c&&(u=x("rect",{x:o,y:a-i,width:r,height:i,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0})),m){let y={href:m,x:o,y:a,width:r,height:i,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(t?`${t}<g filter="url(#satori_s-${e})">`:"")+x("image",se(G({},y),{opacity:f!==1?f:void 0}))+(h||"")+(t?"</g>":"")+u,""]}let b={x:o,y:a,width:r,height:i,"font-weight":l.fontWeight,"font-style":l.fontStyle,"font-size":l.fontSize,"font-family":l.fontFamily,"letter-spacing":l.letterSpacing||void 0,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(t?`${t}<g filter="url(#satori_s-${e})">`:"")+x("text",se(G({},b),{fill:l.color,opacity:f!==1?f:void 0}),n)+(h||"")+(t?"</g>":"")+u,d?x("text",b,n):""]}function ce({id:e,width:n,height:t},o){if(!o.shadowColor||!o.shadowOffset||typeof o.shadowRadius=="undefined")return"";let a=o.shadowRadius*o.shadowRadius/4,r=Math.min(o.shadowOffset.width-a,0),i=Math.max(o.shadowOffset.width+a+n,n),s=Math.min(o.shadowOffset.height-a,0),f=Math.max(o.shadowOffset.height+a+t,t);return`<defs><filter id="satori_s-${e}" x="${r/n*100}%" y="${s/t*100}%" width="${(i-r)/n*100}%" height="${(f-s)/t*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius/2}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function ze({width:e,left:n,top:t,ascender:o,clipPathId:a},r){let{textDecorationColor:i,textDecorationStyle:s,textDecorationLine:f,fontSize:m}=r;if(!f||f==="none")return"";let g=Math.max(1,m*.1),c=f==="line-through"?t+o*.5:f==="underline"?t+o*1.1:t,d=s==="dashed"?`${g*1.2} ${g*2}`:s==="dotted"?`0 ${g*2}`:void 0;return x("line",{x1:n,y1:c,x2:n+e,y2:c,stroke:i,"stroke-width":g,"stroke-dasharray":d,"stroke-linecap":s==="dotted"?"round":"square","clip-path":a?`url(#${a})`:void 0})}var je=void 0;function*Ve(e,n){var lt;let t=te(),{parentStyle:o,inheritedStyle:a,parent:r,font:i,id:s,isInheritingTransform:f,debug:m,embedFont:g,graphemeImages:c,canLoadAdditionalAssets:d}=n;o.textTransform==="uppercase"?e=e.toLocaleUpperCase(je):o.textTransform==="lowercase"?e=e.toLocaleLowerCase(je):o.textTransform==="capitalize"&&(e=le(e,"word").map(C=>le(C,"grapheme").map((O,F)=>F===0?O.toLocaleUpperCase(je):O).join("")).join(""));let h=K(o.wordBreak,{normal:"word","break-all":"grapheme","break-word":"grapheme","keep-all":"word"},"word"),l=le(e,h),u=t.Node.create();u.setAlignItems(t.ALIGN_BASELINE),o.textAlign==="left"?u.setJustifyContent(t.JUSTIFY_FLEX_START):o.textAlign==="center"?u.setJustifyContent(t.JUSTIFY_CENTER):o.textAlign==="right"?u.setJustifyContent(t.JUSTIFY_FLEX_END):o.textAlign==="justify"&&u.setJustifyContent(t.JUSTIFY_SPACE_BETWEEN),r.insertChild(u,r.getChildCount());let{textAlign:b,textOverflow:y,whiteSpace:_,lineHeight:S,filter:M,_inheritedBackgroundClipTextPath:W}=o,N=o.fontSize,w=i.getEngine(N,S,o),H=d?l.filter(C=>!w.check(C)):[];yield H,H.length&&(w=i.getEngine(N,S,o));let T=[],I=[],X=[],q=[],Q=new Map,R=C=>{let O=0;for(let F of C){if(Q.has(F)){O+=Q.get(F);continue}let Y=w.measure(F,o);Q.set(F,Y),O+=Y}return O},$=0,v=[],p=0;for(let C of l){let O=!1,F=c&&c[C];_==="pre"?O=C[0]===`
2
- `:_!=="nowrap"&&(F||ye.includes(C[0]))&&(O=!0),O?(_==="nowrap"?p+=R(v)+o.fontSize:($=Math.max($,R(v)),F&&($=Math.max($,o.fontSize))),v=[]):(!ye.includes(C[0])||!v.length)&&v.push(C===`
3
- `?" ":C)}$=Math.max($,R(v)+p);let E=r.getMinWidth(),A=r.getMaxWidth(),Z=r.getWidth();isNaN(Z.value)&&(isNaN(E.value)||E.unit===1&&E.value>$)&&(isNaN(A.value)||A.unit===1&&($=Math.min($,A.value)),r.setMinWidth($)),typeof o.flexShrink=="undefined"&&r.setFlexShrink(1);let he=_==="pre-wrap"||_==="pre";u.setMeasureFunc(C=>{let O=0,F="",Y=0,U=0,z=0,j=-1,ie=0,P=0,oe=0;T=[],X=[0];for(let re=0;re<l.length;re++){let D=l[re];if(!he&&ye.includes(D[0]))F||(F=" "),Y=R([F]),q[re]=null;else{let ae=he&&D===`
4
- `,V=ae?0:c&&c[D]?o.fontSize:R([D]);U||(F="",Y=0);let B=Y||",.!?:-@)>]}%#".indexOf(D[0])<0,J=!U||!!Y;if(ae||re&&B&&U+Y+V>C&&_!=="nowrap"&&_!=="pre")T.push(U),I.push(oe),O++,ie+=P,U=V,P=V?w.height(D):0,oe=V?w.baseline(D):0,X.push(1),j=-1,ae||(z=Math.max(z,C));else{U+=Y+V;let me=w.height(D);me>P&&(P=me,oe=w.baseline(D)),J&&X[X.length-1]++}F="",Y=0,J&&j++,z=Math.max(z,U),q[re]={y:ie,x:U-V,width:V,line:O,lineIndex:j}}}return U&&(O++,T.push(U),I.push(oe),ie+=P),{width:z,height:ie}});let[kt,It]=yield,Oe="",Se="",ne=a._inheritedClipPathId,{left:rt,top:it,width:we,height:ot}=u.getComputedLayout(),Fe=r.getComputedWidth()-r.getComputedPadding(t.EDGE_LEFT)-r.getComputedPadding(t.EDGE_RIGHT)-r.getComputedBorder(t.EDGE_LEFT)-r.getComputedBorder(t.EDGE_RIGHT),de=kt+rt,pe=It+it,{matrix:ee,opacity:Te}=wt({left:rt,top:it,width:we,height:ot,isInheritingTransform:f},o),Re="";o.textShadowOffset&&(Re=ce({width:we,height:ot,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let be="",ve="",at="",$e=-1,st=y==="ellipsis"?R(["\u2026"]):0,At=y==="ellipsis"?R([" "]):0,Ce={};for(let C=0;C<l.length;C++){if(!q[C])continue;let O=q[C],F=l[C],Y=null,U=c?c[F]:null,z=O.y,j=O.x,ie=O.width,P=O.line;if(P===$e)continue;let oe=!1;if(T.length>1){let B=we-T[P];if(b==="right"||b==="end")j+=B;else if(b==="center")j+=B/2;else if(b==="justify"&&P<T.length-1){let J=X[P];j+=(J>1?B/(J-1):0)*O.lineIndex,oe=!0}}if(Ce[P]||(Ce[P]=[j,oe?we:T[P]]),y==="ellipsis"&&T[P]>Fe&&O.x+ie+st+At>Fe){let B=le(F,"grapheme"),J="",me=0;for(let ft of B){let ut=O.x+R([J+ft]);if(J&&ut+st>Fe)break;J+=ft,me=ut}F=J+"\u2026",$e=P,Ce[P][1]=me}let re=I[P],D=w.baseline(F),ae=w.height(F),V=re-D;if(U?z+=0:g?(Y=w.getSVG(F,se(G({},o),{left:de+j,top:pe+z+D+V,letterSpacing:o.letterSpacing})),m&&(at+=x("rect",{x:de+j,y:pe+z+V,width:O.width,height:ae,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:ee||void 0,"clip-path":ne?`url(#${ne})`:void 0})+x("line",{x1:de+j,x2:de+j+O.width,y1:pe+z+V+D,y2:pe+z+V+D,stroke:"#14c000","stroke-width":1,transform:ee||void 0,"clip-path":ne?`url(#${ne})`:void 0}))):z+=D+V,o.textDecorationLine&&(P!==((lt=q[C+1])==null?void 0:lt.line)||$e===P)){let B=Ce[P];B&&!B[2]&&(be+=ze({left:de+B[0],top:pe+ae*+P,width:B[1],ascender:w.baseline(F),clipPathId:ne},o),B[2]=1)}if(Y!==null)ve+=Y+" ";else{let[B,J]=Ue({content:F,filter:Re,id:s,left:de+j,top:pe+z,width:ie,height:ae,matrix:ee,opacity:Te,image:U,clipPathId:ne,debug:m,shape:!!W,decorationShape:be},o);Oe+=B,Se+=J,be=""}}if(ve){let C=o.color!=="transparent"&&Te!==0?x("path",{fill:o.color,d:ve,transform:ee||void 0,opacity:Te!==1?Te:void 0,"clip-path":ne?`url(#${ne})`:void 0,style:M?`filter:${M}`:void 0}):"";W&&(Se=x("path",{d:ve,transform:ee||void 0})),Oe+=(Re?Re+x("g",{filter:`url(#satori_s-${s})`},C+be):C+be)+at}return Se&&(o._inheritedBackgroundClipTextPath.value+=Se),Oe}var Je=Je||{};Je.parse=function(){var e={linearGradient:/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,repeatingLinearGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,radialGradient:/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,repeatingRadialGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},n="";function t(p){var E=new Error(n+": "+p);throw E.source=n,E}function o(){var p=a();return n.length>0&&t("Invalid input not EOF"),p}function a(){return S(r)}function r(){return i("linear-gradient",e.linearGradient,f)||i("repeating-linear-gradient",e.repeatingLinearGradient,f)||i("radial-gradient",e.radialGradient,c)||i("repeating-radial-gradient",e.repeatingRadialGradient,c)}function i(p,E,A){return s(E,function(Z){var he=A();return he&&($(e.comma)||t("Missing comma before color stops")),{type:p,orientation:he,colorStops:S(M)}})}function s(p,E){var A=$(p);if(A){$(e.startCall)||t("Missing (");var Z=E(A);return $(e.endCall)||t("Missing )"),Z}}function f(){return m()||g()}function m(){return R("directional",e.sideOrCorner,1)}function g(){return R("angular",e.angleValue,1)}function c(){var p,E=d(),A;return E&&(p=[],p.push(E),A=n,$(e.comma)&&(E=d(),E?p.push(E):n=A)),p}function d(){var p=h()||l();if(p)p.at=b();else{var E=u();if(E){p=E;var A=b();A&&(p.at=A)}else{var Z=y();Z&&(p={type:"default-radial",at:Z})}}return p}function h(){var p=R("shape",/^(circle)/i,0);return p&&(p.style=Q()||u()),p}function l(){var p=R("shape",/^(ellipse)/i,0);return p&&(p.style=X()||u()),p}function u(){return R("extent-keyword",e.extentKeywords,1)}function b(){if(R("position",/^at/,0)){var p=y();return p||t("Missing positioning value"),p}}function y(){var p=_();if(p.x||p.y)return{type:"position",value:p}}function _(){return{x:X(),y:X()}}function S(p){var E=p(),A=[];if(E)for(A.push(E);$(e.comma);)E=p(),E?A.push(E):t("One extra comma");return A}function M(){var p=W();return p||t("Expected color definition"),p.length=X(),p}function W(){return w()||T()||H()||N()}function N(){return R("literal",e.literalColor,0)}function w(){return R("hex",e.hexColor,1)}function H(){return s(e.rgbColor,function(){return{type:"rgb",value:S(I)}})}function T(){return s(e.rgbaColor,function(){return{type:"rgba",value:S(I)}})}function I(){return $(e.number)[1]}function X(){return R("%",e.percentageValue,1)||q()||Q()}function q(){return R("position-keyword",e.positionKeywords,1)}function Q(){return R("px",e.pixelValue,1)||R("em",e.emValue,1)}function R(p,E,A){var Z=$(E);if(Z)return{type:p,value:Z[A]}}function $(p){var E,A;return A=/^[\n\r\t\s]+/.exec(n),A&&v(A[0].length),E=p.exec(n),E&&v(E[0].length),E}function v(p){n=n.substr(p)}return function(p){return n=p.toString(),o()}}();var Ke=Je;function dn(e){return e.type==="literal"?e.value:e.type==="hex"?`#${e.value}`:e.type==="rgb"?`rgb(${e.value.join(",")})`:e.type==="rgba"?`rgba(${e.value.join(",")})`:"transparent"}function pn(e,n){return typeof e=="string"&&e.endsWith("%")?n*parseFloat(e)/100:+e}function Tt(e,{x:n,y:t,defaultX:o,defaultY:a}){return(e?e.split(" ").map(r=>{try{let i=new fe(r);return i.type==="length"||i.type==="number"?i.value:i.value+i.unit}catch{return null}}).filter(r=>r!==null):[o,a]).map((r,i)=>pn(r,[n,t][i]))}function Rt(e,n){let t=[];for(let i of n){let s=dn(i);if(!t.length&&(t.push({offset:0,color:s}),typeof i.length=="undefined"||i.length.value==="0"))continue;let f=typeof i.length=="undefined"?void 0:i.length.type==="%"?i.length.value/100:i.length.value/e;t.push({offset:f,color:s})}t.length||t.push({offset:0,color:"transparent"});let o=t[t.length-1];o.offset!==1&&(typeof o.offset=="undefined"?o.offset=1:t.push({offset:1,color:o.color}));let a=0,r=1;for(let i=0;i<t.length;i++)if(typeof t[i].offset=="undefined"){for(r<i&&(r=i);typeof t[r].offset=="undefined";)r++;t[i].offset=(t[r].offset-t[a].offset)/(r-a)*(i-a)+t[a].offset}else a=i;return t}function qe({id:e,width:n,height:t},{image:o,size:a,position:r,repeat:i}){i=i||"repeat";let s=i==="repeat-x"||i==="repeat",f=i==="repeat-y"||i==="repeat",m=Tt(a,{x:n,y:t,defaultX:n,defaultY:t}),g=Tt(r,{x:n,y:t,defaultX:0,defaultY:0});if(o.startsWith("linear-gradient(")){let c=Ke.parse(o)[0],d,h,l,u;if(c.orientation.type==="directional")[d,h,l,u]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[c.orientation.value];else if(c.orientation.type==="angular"){let y=+c.orientation.value/180*Math.PI-Math.PI/2,_=Math.cos(y),S=Math.sin(y);d=0,h=0,l=_,u=S,l<0&&(d-=l,l=0),u<0&&(h-=u,u=0)}let b=Rt(n,c.colorStops);return[`satori_bi${e}`,`<linearGradient id="satori_bi${e}" x1="${d}" y1="${h}" x2="${l}" y2="${u}">${b.map(y=>`<stop offset="${y.offset*100}%" stop-color="${y.color}"/>`).join("")}</linearGradient>`]}if(o.startsWith("radial-gradient(")){let c=Ke.parse(o)[0],d=c.orientation[0],[h,l]=m,u="circle",b=h/2,y=l/2;if(d.type==="shape"){if(u=d.value,d.at)if(d.at.type==="position")b=d.at.value.x.value,y=d.at.value.y.value;else throw new Error("orientation.at.type not implemented: "+d.at.type)}else throw new Error("orientation.type not implemented: "+d.type);let _=Rt(n,c.colorStops),S=`satori_radial_${e}`,M=`satori_pattern_${e}`,W={},N=Math.max(Math.abs(h-b),Math.abs(b)),w=Math.max(Math.abs(l-y),Math.abs(y));if(u==="circle")W.r=Math.sqrt(N*N+w*w);else if(u==="ellipse"){let I=w!==0?N/w:1;W.ry=Math.sqrt(N*N+w*w*I*I)/I,W.rx=W.ry*I}let H=x("pattern",{id:M,x:g[0],y:g[1],width:s?h:"100%",height:f?l:"100%",patternUnits:"userSpaceOnUse"},x("radialGradient",{id:S},_.map(I=>x("stop",{offset:I.offset,"stop-color":I.color})).join(""))+x(u,se(G({cx:b,cy:y,width:h,height:l},W),{fill:`url(#${S})`})));return[M,H]}if(o.startsWith("url(")){let c=o.slice(4,-1);return[`satori_bi${e}`,x("pattern",{id:`satori_bi${e}`,patternContentUnits:"userSpaceOnUse",patternUnits:"userSpaceOnUse",x:g[0],y:g[1],width:s?m[0]:"100%",height:f?m[1]:"100%"},x("image",{x:0,y:0,width:m[0],height:m[1],href:c}))]}}function Ie(e,n,t){return t<e+n&&(t/2<e&&t/2<n?e=n=t/2:t/2<e?e=t-n:t/2<n&&(n=t-e)),[e,n]}function Ee({left:e,top:n,width:t,height:o},a){let{borderTopLeftRadius:r,borderTopRightRadius:i,borderBottomLeftRadius:s,borderBottomRightRadius:f}=a;return r=Math.min(r||0,t,o),i=Math.min(i||0,t,o),s=Math.min(s||0,t,o),f=Math.min(f||0,t,o),!r&&!i&&!s&&!f?"":([r,i]=Ie(r,i,t),[r,s]=Ie(r,s,o),[i,f]=Ie(i,f,o),[s,f]=Ie(s,f,t),`M${e+r},${n} h${t-r-i} a${i},${i} 0 0 1 ${i},${i} v${o-i-f} a${f},${f} 0 0 1 ${-f},${f} h${f+s-t} a${s},${s} 0 0 1 ${-s},${-s} v${s+r-o} a${r},${r} 0 0 1 ${r},${-r}`)}function Ze({left:e,top:n,width:t,height:o,path:a,id:r},i){return i.overflow!=="hidden"?"":a?x("clipPath",{id:`satori_cp-${r}`,"clip-path":i._inheritedClipPathId?`url(#${i._inheritedClipPathId})`:void 0},x("path",{x:e,y:n,width:t,height:o,d:a})):x("clipPath",{id:`satori_cp-${r}`,"clip-path":i._inheritedClipPathId?`url(#${i._inheritedClipPathId})`:void 0},x("rect",{x:e,y:n,width:t,height:o}))}function Qe({id:e,left:n,top:t,width:o,height:a,isInheritingTransform:r,debug:i},s){if(s.display==="none")return"";let f="rect",m="transparent",g=0,c="",d="",h=[],l=1,u="";s.backgroundColor&&h.push(s.backgroundColor),s.borderWidth&&(g=s.borderWidth,m=s.borderColor),s.opacity&&(l=+s.opacity),s.transform&&(c=ue({left:n,top:t,width:o,height:a},s.transform,r,s.transformOrigin));let b="";if(s.backgroundImage){let H=s.backgroundImage.map((T,I)=>qe({id:e+"_"+I,width:o,height:a},T)).filter(Boolean);for(let T of H)h.push(`url(#${T[0]})`),d+=T[1],T[2]&&(b+=T[2])}let y=Ee({left:n,top:t,width:o,height:a},s);y&&(f="path");let _=Ze({left:n,top:t,width:o,height:a,path:y,id:e},s),S=s._inheritedClipPathId,M=ce({width:o,height:a,id:e},s);i&&(u=x("rect",{x:n,y:t,width:o,height:a,fill:"transparent",stroke:"#ff5757","stroke-width":1,transform:c||void 0,"clip-path":S?`url(#${S})`:void 0})),h.length||h.push("transparent");let{backgroundClip:W,filter:N}=s,w=h.map((H,T)=>{if(H==="transparent"&&!(T===h.length-1&&g))return"";let I=T===h.length-1&&g&&W!=="text";return x(f,{x:n,y:t,width:o,height:a,fill:H,stroke:I?m:void 0,"stroke-width":I?g:void 0,d:y||void 0,transform:c||void 0,"clip-path":W==="text"?`url(#satori_bct-${e})`:S?`url(#${S})`:void 0,style:N?`filter:${N}`:void 0})}).join("");return W==="text"&&g&&(w=x(f,{x:n,y:t,width:o,height:a,fill:"transparent",stroke:m,"stroke-width":g,d:y||void 0,transform:c||void 0,"clip-path":S?`url(#${S})`:void 0})+w),(d?`<defs>${d}</defs>`:"")+_+(M?`${M}<g filter="url(#satori_s-${e})">`:"")+(l!==1?`<g opacity="${l}">`:"")+(b||w)+(l!==1?"</g>":"")+(M?"</g>":"")+u}function et({id:e,left:n,top:t,width:o,height:a,src:r,debug:i,isInheritingTransform:s},f){if(f.display==="none")return"";let m="",g=1,c="",d=f.objectFit==="contain"?"xMidYMid":f.objectFit==="cover"?"xMidYMid slice":"none",h=Ee({left:n,top:t,width:o,height:a},f),l=f._inheritedClipPathId;h&&(m=x("clipPath",{id:`satori_c-${e}`,"clip-path":l?`url(#${l})`:void 0},x("path",{x:n,y:t,width:o,height:a,d:h}))),f.opacity&&(g=+f.opacity);let u=ce({width:o,height:a,id:e},f);return f.transform&&(c=ue({left:n,top:t,width:o,height:a},f.transform,s,f.transformOrigin)),u+(u?`<g filter="url(#satori_s-${e})">`:"")+m+x("image",{x:n,y:t,width:o,height:a,href:r,preserveAspectRatio:d,transform:c||void 0,"clip-path":m?`url(#satori_c-${e})`:l?`url(#${l})`:void 0})+(u?"</g>":"")}function*_e(e,n){let t=te(),{id:o,inheritedStyle:a,parent:r,font:i,debug:s,embedFont:f=!0,graphemeImages:m,canLoadAdditionalAssets:g}=n;if(e===null||typeof e=="undefined")return yield,yield,"";if(!We(e)||typeof e.type=="function"){let v;if(!We(e))v=Ve(String(e),n),yield v.next().value;else{if(mt(e.type))throw new Error("Class component is not supported.");v=_e(e.type(e.props),n),yield v.next().value}v.next();let p=yield;return v.next(p).value}let{type:c,props:d}=e,{style:h,children:l}=d,u=t.Node.create();r.insertChild(u,r.getChildCount());let[b,y]=Xe(u,c,a,h,d),_=b.transform===a.transform;if(_||(b.transform.__parent=a.transform),b.overflow==="hidden"&&(y._inheritedClipPathId=`satori_cp-${o}`),b.backgroundClip==="text"){let v={value:""};y._inheritedBackgroundClipTextPath=v,b._inheritedBackgroundClipTextPath=v}let S=typeof l=="undefined"?[]:[].concat(l),M=[],W=0,N=[];for(let v of S){let p=_e(v,{id:o+"-"+W++,parentStyle:b,inheritedStyle:y,isInheritingTransform:!0,parent:u,font:i,embedFont:f,debug:s,graphemeImages:m,canLoadAdditionalAssets:g});g?N.push(...p.next().value||[]):p.next(),M.push(p)}yield N;for(let v of M)v.next();let[w,H]=yield;b.position==="absolute"&&u.calculateLayout();let{left:T,top:I,width:X,height:q}=u.getComputedLayout();T+=w,I+=H;let Q="",R="",$="";c==="img"?R=et({id:o,left:T,top:I,width:X,height:q,src:d.src,isInheritingTransform:_,debug:s},b):R=Qe({id:o,left:T,top:I,width:X,height:q,isInheritingTransform:_,debug:s},b);for(let v of M)Q+=v.next([T,I]).value;return b._inheritedBackgroundClipTextPath&&($+=x("clipPath",{id:`satori_bct-${o}`,"clip-path":b._inheritedClipPathId?`url(#${b._inheritedClipPathId})`:void 0},b._inheritedBackgroundClipTextPath.value)),$+R+Q}import mn from"@shuding/opentype.js";function gn(e,n,[t,o],[a,r]){if(t!==a)return t?!a||t===e?-1:a===e?1:e===400&&t===500||e===500&&t===400?-1:e===400&&a===500||e===500&&a===400?1:e<400?t<e&&a<e?a-t:t<e?-1:a<e?1:t-a:e<t&&e<a?t-a:e<t?-1:e<a?1:a-t:1;if(o!==r){if(o===n)return-1;if(r===n)return 1}return-1}var Ae=class{constructor(n){this.fonts=new Map;this.addFonts(n)}get({name:n,weight:t,style:o}){if(!this.fonts.has(n))return null;t==="normal"&&(t=400),t==="bold"&&(t=700);let a=[...this.fonts.get(n)],r=a[0];for(let i=1;i<a.length;i++){let[,s,f]=r,[,m,g]=a[i];gn(t,o,[s,f],[m,g])>0&&(r=a[i])}return r[0]}addFonts(n){for(let t of n){let o=t.data,a=mn.parse("buffer"in o?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o,{lowMemory:!0}),r=a.charToGlyphIndex;a.charToGlyphIndex=s=>{let f=r.call(a,s);return f===0&&a._trackBrokenChars&&a._trackBrokenChars.push(s),f},this.defaultFont||(this.defaultFont=a);let i=t.name.toLowerCase();this.fonts.has(i)||this.fonts.set(i,[]),this.fonts.get(i).push([a,t.weight,t.style])}}getEngine(n=16,t=1.2,{fontFamily:o,fontWeight:a=400,fontStyle:r="normal"}){o=Array.isArray(o)?o:[o];let i=o.map(l=>this.get({name:l,weight:a,style:r})).filter(Boolean),s=Array.from(this.fonts.keys());for(let l of s)o.includes(l)||i.push(this.get({name:l,weight:a,style:r}));let f=new Map,m=(l,u=!0)=>{let b=l.charCodeAt(0);if(f.has(b))return f.get(b);let y=i.find((_,S)=>!!_.charToGlyphIndex(l)||u&&S===i.length-1);return y&&f.set(b,y),y},g=(l,u=!1)=>{var y,_;return((u?(_=(y=l.tables)==null?void 0:y.os2)==null?void 0:_.sTypoAscender:0)||l.ascender)/l.unitsPerEm*n},c=(l,u=!1)=>{var y,_;return((u?(_=(y=l.tables)==null?void 0:y.os2)==null?void 0:_.sTypoDescender:0)||l.descender)/l.unitsPerEm*n},d=l=>m(l,!1),h={check:l=>{let u=d(l);return u?(u._trackBrokenChars=[],u.stringToGlyphs(l),u._trackBrokenChars.length?(u._trackBrokenChars=void 0,!1):!0):!1},baseline:(l,u=typeof l=="undefined"?i[0]:m(l))=>{let b=g(u,!0),y=c(u,!0),_=h.height(l,u),{yMax:S,yMin:M}=u.tables.head,W=b-y,N=(S/(S-M)-1)*W;return _*((1.2/t+1)/2)+N},height:(l,u=typeof l=="undefined"?i[0]:m(l))=>(g(u)-c(u))*(t/1.2),measure:(l,u)=>this.measure(m,l,u),getSVG:(l,u)=>this.getSVG(m,l,u)};return h}patchFontFallbackResolver(n,t){let o=[];n._trackBrokenChars=o;let a=n.stringToGlyphs;return n.stringToGlyphs=(r,...i)=>{let s=a.call(n,r,...i);for(let f=0;f<s.length;f++)if(s[f].unicode===void 0){let m=o.shift(),g=t(m);g!==n&&(s[f]=g.charToGlyph(m))}return s},()=>{n.stringToGlyphs=a,n._trackBrokenChars=void 0}}measure(n,t,{fontSize:o,letterSpacing:a=0}){let r=n(t),i=this.patchFontFallbackResolver(r,n);try{return r.getAdvanceWidth(t,o,{letterSpacing:a/o})}finally{i()}}getSVG(n,t,{fontSize:o,top:a,left:r,letterSpacing:i=0}){let s=n(t),f=this.patchFontFallbackResolver(s,n);try{return s.getPath(t,r,a,o,{letterSpacing:i/o}).toPathData(1)}finally{f()}}};function tt({width:e,height:n,content:t}){return x("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,xmlns:"http://www.w3.org/2000/svg"},t)}var vt={emoji:/\p{Emoji_Presentation}/u,ja:/\p{scx=Hira}|\p{scx=Kana}|[,;:]/u,ko:/\p{scx=Hangul}/u,zh:/\p{scx=Han}/u,th:/\p{scx=Thai}/u,ar:/\p{scx=Arabic}/u,ta:/\p{scx=Tamil}/u,ml:/\p{scx=Malayalam}/u,he:/\p{scx=Hebrew}/u,te:/\p{scx=Telugu}/u,devanagari:/\p{scx=Devanagari}/u};function Ct(e){for(let n in vt)if(vt[n].test(e))return n;return"unknown"}var nt=new WeakMap;async function Lt(e,n){let t=te();if(!t)throw new Error("Satori is not initialized.");let o;nt.has(n.fonts)?o=nt.get(n.fonts):nt.set(n.fonts,o=new Ae(n.fonts));let a=t.Node.create();a.setWidth(n.width),a.setHeight(n.height),a.setFlexDirection(t.FLEX_DIRECTION_ROW),a.setFlexWrap(t.WRAP_WRAP),a.setAlignContent(t.ALIGN_AUTO),a.setAlignItems(t.ALIGN_FLEX_START),a.setJustifyContent(t.JUSTIFY_FLEX_START),a.setOverflow(t.OVERFLOW_HIDDEN);let r=G({},n.graphemeImages),i=_e(e,{id:"id",parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1,whiteSpace:"normal",_viewportWidth:n.width,_viewportHeight:n.height},parent:a,font:o,embedFont:n.embedFont,debug:n.debug,graphemeImages:r,canLoadAdditionalAssets:!!n.loadAdditionalAsset}),s=i.next().value;if(n.loadAdditionalAsset&&s.length){s=Array.from(new Set(le(s.join(""),"grapheme")));let m={};s.forEach(d=>{let h=Ct(d);m[h]=m[h]||[],h==="emoji"?m[h].push(d):m[h][0]=(m[h][0]||"")+d});let g=[],c={};await Promise.all(Object.entries(m).flatMap(([d,h])=>h.map(l=>n.loadAdditionalAsset(d,l).then(u=>{typeof u=="string"?c[l]=u:u&&g.push(u)})))),o.addFonts(g),Object.assign(r,c)}i.next(),a.calculateLayout(n.width,n.height,t.DIRECTION_LTR);let f=i.next([0,0]).value;return a.freeRecursive(),tt({width:n.width,height:n.height,content:f})}export{Lt as default,Mt as init};
1
+ var Bt=Object.defineProperty,Ut=Object.defineProperties;var Yt=Object.getOwnPropertyDescriptors;var _e=Object.getOwnPropertySymbols;var ht=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable;var mt=(e,t,n)=>t in e?Bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D=(e,t)=>{for(var n in t||(t={}))ht.call(t,n)&&mt(e,n,t[n]);if(_e)for(var n of _e(t))bt.call(t,n)&&mt(e,n,t[n]);return e},se=(e,t)=>Ut(e,Yt(t));var yt=(e,t)=>{var n={};for(var r in e)ht.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_e)for(var r of _e(e))t.indexOf(r)<0&&bt.call(e,r)&&(n[r]=e[r]);return n};import*as zt from"yoga-layout-prebuilt";var xt=zt;var Ne;Ne=xt.default;function Ht(e){Ne=e}function te(){return Ne}function De(e){let t=typeof e;return!(t==="number"||t==="bigint"||t==="string"||t==="boolean")}function wt(e){return/^class\s/.test(Function.prototype.toString.call(e))}function me(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Z(e,t,n){let r=t[e];return typeof r=="undefined"?n:r}var Et=void 0,Be=typeof Intl!="undefined"&&"Segmenter"in Intl;if(!Be)throw new Error("Intl.Segmenter does not exist, please use import a polyfill.");var Xt=Be?new Intl.Segmenter(Et,{granularity:"word"}):null,jt=Be?new Intl.Segmenter(Et,{granularity:"grapheme"}):null,Ce=[32,160,4961,65792,65793,4153,4241,10].map(e=>String.fromCodePoint(e));function le(e,t){return t==="word"?[...Xt.segment(e)].map(n=>n.segment):[...jt.segment(e)].map(n=>n.segment)}function y(e,t,n){let r="";for(let[a,o]of Object.entries(t))typeof o!="undefined"&&(r+=` ${a}="${o}"`);return n?`<${e}${r}>${n}</${e}>`:`<${e}${r}/>`}function vt(e=20){let t=new Map;function n(a,o){if(t.size>=e){let i=t.keys().next().value;t.delete(i)}t.set(a,o)}function r(a){if(!t.has(a))return;let i=t.get(a);return t.delete(a),t.set(a,i),i}return{set:n,get:r}}var Vt={accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",allowReorder:"allowreorder",arabicForm:"arabic-form",attributeName:"attributename",attributeType:"attributetype",autoReverse:"autoreverse",baseFrequency:"basefrequency",baseProfile:"baseprofile",baselineShift:"baseline-shift",calcMode:"calcmode",capHeight:"cap-height",clipPath:"clip-path",clipPathUnits:"clippathunits",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",contentScriptType:"contentscripttype",contentStyleType:"contentstyletype",diffuseConstant:"diffuseconstant",dominantBaseline:"dominant-baseline",edgeMode:"edgemode",enableBackground:"enable-background",externalResourcesRequired:"externalresourcesrequired",fillOpacity:"fill-opacity",fillRule:"fill-rule",filterRes:"filterres",filterUnits:"filterunits",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",glyphRef:"glyphref",gradientTransform:"gradienttransform",gradientUnits:"gradientunits",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",imageRendering:"image-rendering",kernelMatrix:"kernelmatrix",kernelUnitLength:"kernelunitlength",keyPoints:"keypoints",keySplines:"keysplines",keyTimes:"keytimes",lengthAdjust:"lengthadjust",letterSpacing:"letter-spacing",lightingColor:"lighting-color",limitingConeAngle:"limitingconeangle",markerEnd:"marker-end",markerHeight:"markerheight",markerMid:"marker-mid",markerStart:"marker-start",markerUnits:"markerunits",markerWidth:"markerwidth",maskContentUnits:"maskcontentunits",maskUnits:"maskunits",numOctaves:"numoctaves",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pathLength:"pathlength",patternContentUnits:"patterncontentunits",patternTransform:"patterntransform",patternUnits:"patternunits",pointerEvents:"pointer-events",pointsAtX:"pointsatx",pointsAtY:"pointsaty",pointsAtZ:"pointsatz",preserveAlpha:"preservealpha",preserveAspectRatio:"preserveaspectratio",primitiveUnits:"primitiveunits",refX:"refx",refY:"refy",renderingIntent:"rendering-intent",repeatCount:"repeatcount",repeatDur:"repeatdur",requiredExtensions:"requiredextensions",requiredFeatures:"requiredfeatures",shapeRendering:"shape-rendering",specularConstant:"specularconstant",specularExponent:"specularexponent",spreadMethod:"spreadmethod",startOffset:"startoffset",stdDeviation:"stddeviation",stitchTiles:"stitchtiles",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",suppressContentEditableWarning:"suppresscontenteditablewarning",suppressHydrationWarning:"suppresshydrationwarning",surfaceScale:"surfacescale",systemLanguage:"systemlanguage",tableValues:"tablevalues",targetX:"targetx",targetY:"targety",textAnchor:"text-anchor",textDecoration:"text-decoration",textLength:"textlength",textRendering:"text-rendering",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",viewBox:"viewbox",viewTarget:"viewtarget",wordSpacing:"word-spacing",writingMode:"writing-mode",xChannelSelector:"xchannelselector",xHeight:"x-height",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlLang:"xml:lang",xmlSpace:"xmlspace",xmlnsXlink:"xmlns:xlink",yChannelSelector:"ychannelselector",zoomAndPan:"zoomandpan"},Jt=/[\r\n%#()<>?[\\\]^`{|}"']/g;function Ge(e){if(!e)return"";if(Array.isArray(e))return e.map(Ge).join("");if(typeof e!="object")return String(e);let t=e.type;if(t==="text")throw new Error("<text> nodes are not currently supported, please convert them to <path>");let a=e.props||{},{children:n}=a,r=yt(a,["children"]);return`<${t}${Object.entries(r).map(([o,i])=>` ${Vt[o]||o}="${i}"`).join("")}>${Ge(n)}</${t}>`}function kt(e){let t=e.props.viewBox||e.props.viewbox,n=t.split(" ").map(o=>parseInt(o,10)),r=e.props.width||n[2]||0,a=e.props.height||n[3]||0;return`data:image/svg+xml;utf8,${`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${a}" viewBox="${t}">${Ge(e.props.children)}</svg>`.replace(Jt,encodeURIComponent)}`}var St={p:{display:"block",marginTop:"1em",marginBottom:"1em"},div:{display:"block"},blockquote:{display:"block",marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40},center:{display:"block",textAlign:"center"},hr:{display:"block",marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,borderStyle:"inset"},h1:{display:"block",fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h2:{display:"block",fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold"},h3:{display:"block",fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold"},h4:{display:"block",marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},h5:{display:"block",fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h6:{display:"block",fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},u:{textDecoration:"underline"},strong:{fontWeight:"bold"},b:{fontWeight:"bold"},i:{fontStyle:"italic"},em:{fontStyle:"italic"},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{display:"block",fontFamily:"monospace",whiteSpace:"pre",marginTop:"1em",marginBottom:"1em"},mark:{backgroundColor:"yellow",color:"black"},big:{fontSize:"larger"},small:{fontSize:"smaller"},s:{textDecoration:"line-through"}};var qt=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","textAlign","textTransform","textShadowOffset","textShadowColor","textShadowRadius","textDecorationLine","textDecorationStyle","textDecorationColor","whiteSpace","transform","wordBreak","opacity","filter","_viewportWidth","_viewportHeight","_inheritedClipPathId","_inheritedBackgroundClipTextPath"]);function Ue(e){let t={};for(let n in e)qt.has(n)&&(t[n]=e[n]);return t}import{getPropertyName as cn,getStylesForProperty as dn}from"css-to-react-native";import{parseElementStyle as pn}from"css-background-parser";var ye=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Kt=ye((e,t)=>{t.exports=["em","ex","ch","rem","vh","vw","vmin","vmax","px","mm","cm","in","pt","pc","mozmm"]}),Zt=ye((e,t)=>{t.exports=["deg","grad","rad","turn"]}),Qt=ye((e,t)=>{t.exports=["dpi","dpcm","dppx"]}),en=ye((e,t)=>{t.exports=["Hz","kHz"]}),tn=ye((e,t)=>{t.exports=["s","ms"]}),nn=Kt(),Tt=Zt(),Rt=Qt(),_t=en(),Ct=tn();function ze(e){if(/\.\D?$/.test(e))throw new Error("The dot should be followed by a number");if(/^[+-]{2}/.test(e))throw new Error("Only one leading +/- is allowed");if(rn(e)>1)throw new Error("Only one dot is allowed");if(/%$/.test(e)){this.type="percentage",this.value=Ye(e),this.unit="%";return}var t=an(e);if(!t){this.type="number",this.value=Ye(e);return}this.type=ln(t),this.value=Ye(e.substr(0,e.length-t.length)),this.unit=t}ze.prototype.valueOf=function(){return this.value};ze.prototype.toString=function(){return this.value+(this.unit||"")};function ue(e){return new ze(e)}function rn(e){var t=e.match(/\./g);return t?t.length:0}function Ye(e){var t=parseFloat(e);if(isNaN(t))throw new Error("Invalid number: "+e);return t}var on=[].concat(Tt,_t,nn,Rt,Ct);function an(e){var t=e.match(/\D+$/),n=t&&t[0];if(n&&on.indexOf(n)===-1)throw new Error("Invalid unit: "+n);return n}var sn=Object.assign(Ie(Tt,"angle"),Ie(_t,"frequency"),Ie(Rt,"resolution"),Ie(Ct,"time"));function Ie(e,t){return Object.fromEntries(e.map(n=>[n,t]))}function ln(e){return sn[e]||"length"}import un from"postcss-value-parser";function fn(e,t){try{let n=new ue(e);switch(n.unit){case"px":return{absolute:n.value};case"em":return{absolute:n.value*t};case"rem":return{absolute:n.value*16};case"%":return{relative:n.value};default:return{}}}catch{return{}}}function He(e,t,n){switch(e){case"top":return{yRelative:0};case"left":return{xRelative:0};case"right":return{xRelative:100};case"bottom":return{yRelative:100};case"center":return{};default:let r=fn(e,t);return r.absolute?{[n?"xAbsolute":"yAbsolute"]:r.absolute}:r.relative?{[n?"xRelative":"yRelative"]:r.relative}:{}}}function Xe(e,t){if(typeof e=="number")return{xAbsolute:e};let n;try{n=un(e).nodes.filter(r=>r.type==="word").map(r=>r.value)}catch{return{}}return n.length===1?He(n[0],t,!0):n.length===2?((n[0]==="top"||n[0]==="bottom"||n[1]==="left"||n[1]==="right")&&n.reverse(),D(D({},He(n[0],t,!0)),He(n[1],t,!1))):{}}var gn=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),mn=new Set(["lineHeight"]),It=[1,0,0,1,0,0];function hn(e,t,n,r){return e==="border"&&!n.includes(t.borderColor)?t.borderColor=r:e==="borderColor"?t.borderColor=t.borderTopColor:e==="textDecoration"&&!n.includes(t.textDecorationColor)&&(t.textDecorationColor=r),t}function Lt(e,t){return typeof t=="number"?gn.has(e)?mn.has(e)?t:String(t):t+"px":t}function bn(e,t){return e==="lineHeight"?{lineHeight:Lt(e,t)}:e==="fontFamily"?{fontFamily:t.split(",").map(n=>n.trim().replace(/(^['"])|(['"]$)/g,"").toLocaleLowerCase())}:null}function je(e,t,n,{percentage:r}={percentage:!1}){if(typeof e=="number")return e;try{let a=new ue(e);if(a.type==="length")switch(a.unit){case"em":return a.value*t;case"rem":return a.value*16;case"vw":return~~(a.value*n._viewportWidth/100);case"vh":return~~(a.value*n._viewportHeight/100);default:return a.value}else if(a.type==="angle")switch(a.unit){case"deg":return a.value;case"rad":return a.value*180/Math.PI;default:return a.value}else if(a.type==="percentage"&&r)return a.value/100*t}catch{}}function Le(e,t){let n={};for(let a in e){if(a.startsWith("_")){n[a]=e[a];continue}let o=cn(a);Object.assign(n,bn(o,e[a])||hn(o,dn(o,Lt(o,e[a]),!0),e[a],e.color||t.color))}if(n.backgroundImage){let{backgrounds:a}=pn(n);n.backgroundImage=a}let r=n.fontSize||t.fontSize;if(typeof r=="string")try{let a=new ue(r);switch(a.unit){case"em":r=a.value*t.fontSize;break;case"rem":r=a.value*16;break}}catch{r=16}typeof n.fontSize!="undefined"&&(n.fontSize=r),n.transformOrigin&&(n.transformOrigin=Xe(n.transformOrigin,r));for(let a in n){let o=n[a];if(a==="lineHeight")typeof o=="string"&&(o=n[a]=je(o,r,t,{percentage:!0})/r);else if(typeof o=="string"){let i=je(o,r,t);typeof i!="undefined"&&(n[a]=i),o=n[a]}if(a==="opacity"&&(o=n[a]=o*t.opacity),a==="transform"){let i=[...It],s=o;for(let u of s){let g=Object.keys(u)[0],m=u[g],d=typeof m=="string"?je(m,r,t):m,p=[...It];switch(g){case"translateX":p[4]=d;break;case"translateY":p[5]=d;break;case"scale":p[0]=d,p[3]=d;break;case"scaleX":p[0]=d;break;case"scaleY":p[3]=d;break;case"rotate":let h=d*Math.PI/180,l=Math.cos(h),f=Math.sin(h);p[0]=l,p[1]=f,p[2]=-f,p[3]=l;break;case"skewX":p[2]=Math.tan(d*Math.PI/180);break;case"skewY":p[1]=Math.tan(d*Math.PI/180);break}i=me(p,i)}n.transform=i}}return n}function Ve(e,t,n,r,a){let o=te(),i=D(D(D({},n),Le(St[t],n)),Le(r,n));if(t==="img"){let s=parseInt(a.width),g=parseInt(a.height)/s;i.width||(i.width=s),i.height||(i.height=g*i.width)}if(t==="svg"){let u=(a.viewBox||a.viewbox).split(" ").map(d=>parseInt(d,10)),g=a.width||u[2]||0,m=a.height||u[3]||0;i.width||(i.width=g),i.height||(i.height=m)}return e.setDisplay(Z(i.display,{flex:o.DISPLAY_FLEX,none:o.DISPLAY_NONE},o.DISPLAY_FLEX)),e.setAlignContent(Z(i.alignContent,{stretch:o.ALIGN_STRETCH,center:o.ALIGN_CENTER,"flex-start":o.ALIGN_FLEX_START,"flex-end":o.ALIGN_FLEX_END,"space-between":o.ALIGN_SPACE_BETWEEN,"space-around":o.ALIGN_SPACE_AROUND,baseline:o.ALIGN_BASELINE,normal:o.ALIGN_AUTO},o.ALIGN_AUTO)),e.setAlignItems(Z(i.alignItems,{stretch:o.ALIGN_STRETCH,center:o.ALIGN_CENTER,"flex-start":o.ALIGN_FLEX_START,"flex-end":o.ALIGN_FLEX_END,baseline:o.ALIGN_BASELINE,normal:o.ALIGN_AUTO},o.ALIGN_FLEX_START)),e.setAlignSelf(Z(i.alignSelf,{stretch:o.ALIGN_STRETCH,center:o.ALIGN_CENTER,"flex-start":o.ALIGN_FLEX_START,"flex-end":o.ALIGN_FLEX_END,baseline:o.ALIGN_BASELINE,normal:o.ALIGN_AUTO},o.ALIGN_AUTO)),e.setJustifyContent(Z(i.justifyContent,{center:o.JUSTIFY_CENTER,"flex-start":o.JUSTIFY_FLEX_START,"flex-end":o.JUSTIFY_FLEX_END,"space-between":o.JUSTIFY_SPACE_BETWEEN,"space-around":o.JUSTIFY_SPACE_AROUND},o.JUSTIFY_FLEX_START)),e.setFlexDirection(Z(i.flexDirection,{row:o.FLEX_DIRECTION_ROW,column:o.FLEX_DIRECTION_COLUMN,"row-reverse":o.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":o.FLEX_DIRECTION_COLUMN_REVERSE},o.FLEX_DIRECTION_ROW)),e.setFlexWrap(Z(i.flexWrap,{wrap:o.WRAP_WRAP,nowrap:o.WRAP_NO_WRAP,"wrap-reverse":o.WRAP_WRAP_REVERSE},o.WRAP_WRAP)),typeof i.flexBasis!="undefined"&&e.setFlexBasis(i.flexBasis),e.setFlexGrow(typeof i.flexGrow=="undefined"?0:i.flexGrow),e.setFlexShrink(typeof i.flexShrink=="undefined"?0:i.flexShrink),typeof i.maxHeight!="undefined"&&e.setMaxHeight(i.maxHeight),typeof i.maxWidth!="undefined"&&e.setMaxWidth(i.maxWidth),typeof i.minHeight!="undefined"&&e.setMinHeight(i.minHeight),typeof i.minWidth!="undefined"&&e.setMinWidth(i.minWidth),e.setOverflow(Z(i.overflow,{visible:o.OVERFLOW_VISIBLE,hidden:o.OVERFLOW_HIDDEN},o.OVERFLOW_VISIBLE)),e.setMargin(o.EDGE_TOP,i.marginTop||0),e.setMargin(o.EDGE_BOTTOM,i.marginBottom||0),e.setMargin(o.EDGE_LEFT,i.marginLeft||0),e.setMargin(o.EDGE_RIGHT,i.marginRight||0),e.setBorder(o.EDGE_TOP,i.borderWidth||0),e.setBorder(o.EDGE_BOTTOM,i.borderWidth||0),e.setBorder(o.EDGE_LEFT,i.borderWidth||0),e.setBorder(o.EDGE_RIGHT,i.borderWidth||0),e.setPadding(o.EDGE_TOP,i.paddingTop||0),e.setPadding(o.EDGE_BOTTOM,i.paddingBottom||0),e.setPadding(o.EDGE_LEFT,i.paddingLeft||0),e.setPadding(o.EDGE_RIGHT,i.paddingRight||0),e.setPositionType(Z(i.position,{absolute:o.POSITION_TYPE_ABSOLUTE,relative:o.POSITION_TYPE_RELATIVE},o.POSITION_TYPE_RELATIVE)),typeof i.top!="undefined"&&e.setPosition(o.EDGE_TOP,i.top),typeof i.bottom!="undefined"&&e.setPosition(o.EDGE_BOTTOM,i.bottom),typeof i.left!="undefined"&&e.setPosition(o.EDGE_LEFT,i.left),typeof i.right!="undefined"&&e.setPosition(o.EDGE_RIGHT,i.right),typeof i.height!="undefined"?e.setHeight(i.height):e.setHeightAuto(),typeof i.width!="undefined"?e.setWidth(i.width):e.setWidthAuto(),[i,Ue(i)]}function fe({left:e,top:t,width:n,height:r},a,o,i){var u,g,m,d;let s;if(o)s=a;else{let p=(g=i==null?void 0:i.xAbsolute)!=null?g:((u=i==null?void 0:i.xRelative)!=null?u:50)*n/100,h=(d=i==null?void 0:i.yAbsolute)!=null?d:((m=i==null?void 0:i.yRelative)!=null?m:50)*r/100,l=e+p,f=t+h;s=me([1,0,0,1,l,f],me(a,[1,0,0,1,-l,-f])),a.__parent&&(s=me(a.__parent,s)),a.splice(0,6,...s)}return`matrix(${s.map(p=>p.toFixed(2)).join(",")})`}function At({left:e,top:t,width:n,height:r,isInheritingTransform:a},o){let i="",s=1;return o.transform&&(i=fe({left:e,top:t,width:n,height:r},o.transform,a,o.transformOrigin)),o.opacity&&(s=+o.opacity),{matrix:i,opacity:s}}function Je({id:e,content:t,filter:n,left:r,top:a,width:o,height:i,matrix:s,opacity:u,image:g,clipPathId:m,debug:d,shape:p,decorationShape:h},l){let f="";if(d&&(f=y("rect",{x:r,y:a-i,width:o,height:i,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:s||void 0,"clip-path":m?`url(#${m})`:void 0})),g){let x={href:g,x:r,y:a,width:o,height:i,transform:s||void 0,"clip-path":m?`url(#${m})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(n?`${n}<g filter="url(#satori_s-${e})">`:"")+y("image",se(D({},x),{opacity:u!==1?u:void 0}))+(h||"")+(n?"</g>":"")+f,""]}let b={x:r,y:a,width:o,height:i,"font-weight":l.fontWeight,"font-style":l.fontStyle,"font-size":l.fontSize,"font-family":l.fontFamily,"letter-spacing":l.letterSpacing||void 0,transform:s||void 0,"clip-path":m?`url(#${m})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(n?`${n}<g filter="url(#satori_s-${e})">`:"")+y("text",se(D({},b),{fill:l.color,opacity:u!==1?u:void 0}),t)+(h||"")+(n?"</g>":"")+f,p?y("text",b,t):""]}function ce({id:e,width:t,height:n},r){if(!r.shadowColor||!r.shadowOffset||typeof r.shadowRadius=="undefined")return"";let a=r.shadowRadius*r.shadowRadius/4,o=Math.min(r.shadowOffset.width-a,0),i=Math.max(r.shadowOffset.width+a+t,t),s=Math.min(r.shadowOffset.height-a,0),u=Math.max(r.shadowOffset.height+a+n,n);return`<defs><filter id="satori_s-${e}" x="${o/t*100}%" y="${s/n*100}%" width="${(i-o)/t*100}%" height="${(u-s)/n*100}%"><feDropShadow dx="${r.shadowOffset.width}" dy="${r.shadowOffset.height}" stdDeviation="${r.shadowRadius/2}" flood-color="${r.shadowColor}" flood-opacity="1"/></filter></defs>`}function qe({width:e,left:t,top:n,ascender:r,clipPathId:a},o){let{textDecorationColor:i,textDecorationStyle:s,textDecorationLine:u,fontSize:g}=o;if(!u||u==="none")return"";let m=Math.max(1,g*.1),d=u==="line-through"?n+r*.5:u==="underline"?n+r*1.1:n,p=s==="dashed"?`${m*1.2} ${m*2}`:s==="dotted"?`0 ${m*2}`:void 0;return y("line",{x1:t,y1:d,x2:t+e,y2:d,stroke:i,"stroke-width":m,"stroke-dasharray":p,"stroke-linecap":s==="dotted"?"round":"square","clip-path":a?`url(#${a})`:void 0})}var Ke=void 0;async function*Ze(e,t){var dt;let n=te(),{parentStyle:r,inheritedStyle:a,parent:o,font:i,id:s,isInheritingTransform:u,debug:g,embedFont:m,graphemeImages:d,canLoadAdditionalAssets:p}=t;r.textTransform==="uppercase"?e=e.toLocaleUpperCase(Ke):r.textTransform==="lowercase"?e=e.toLocaleLowerCase(Ke):r.textTransform==="capitalize"&&(e=le(e,"word").map(_=>le(_,"grapheme").map((I,L)=>L===0?I.toLocaleUpperCase(Ke):I).join("")).join(""));let h=Z(r.wordBreak,{normal:"word","break-all":"grapheme","break-word":"grapheme","keep-all":"word"},"word"),l=le(e,h),f=n.Node.create();f.setAlignItems(n.ALIGN_BASELINE),r.textAlign==="left"?f.setJustifyContent(n.JUSTIFY_FLEX_START):r.textAlign==="center"?f.setJustifyContent(n.JUSTIFY_CENTER):r.textAlign==="right"?f.setJustifyContent(n.JUSTIFY_FLEX_END):r.textAlign==="justify"&&f.setJustifyContent(n.JUSTIFY_SPACE_BETWEEN),o.insertChild(f,o.getChildCount());let{textAlign:b,textOverflow:x,whiteSpace:E,lineHeight:F,filter:P,_inheritedBackgroundClipTextPath:N}=r,W=r.fontSize,R=i.getEngine(W,F,r),J=p?l.filter(_=>!R.check(_)):[];yield J,J.length&&(R=i.getEngine(W,F,r));let A=[],v=[],M=[],G=[],z=new Map,k=_=>{let I=0;for(let L of _){if(z.has(L)){I+=z.get(L);continue}let Y=R.measure(L,r);z.set(L,Y),I+=Y}return I},O=0,q=[],c=0;for(let _ of l){let I=!1,L=d&&d[_];E==="pre"?I=_[0]===`
2
+ `:E!=="nowrap"&&(L||Ce.includes(_[0]))&&(I=!0),I?(E==="nowrap"?c+=k(q)+r.fontSize:(O=Math.max(O,k(q)),L&&(O=Math.max(O,r.fontSize))),q=[]):(!Ce.includes(_[0])||!q.length)&&q.push(_===`
3
+ `?" ":_)}O=Math.max(O,k(q)+c);let w=o.getMinWidth(),C=o.getMaxWidth(),Q=o.getWidth();isNaN(Q.value)&&(isNaN(w.value)||w.unit===1&&w.value>O)&&(isNaN(C.value)||C.unit===1&&(O=Math.min(O,C.value)),o.setMinWidth(O)),typeof r.flexShrink=="undefined"&&o.setFlexShrink(1);let he=E==="pre-wrap"||E==="pre";f.setMeasureFunc(_=>{let I=0,L="",Y=0,H=0,X=0,j=-1,ie=0,$=0,oe=0;A=[],M=[0];for(let re=0;re<l.length;re++){let B=l[re];if(!he&&Ce.includes(B[0]))L||(L=" "),Y=k([L]),G[re]=null;else{let ae=he&&B===`
4
+ `,V=ae?0:d&&d[B]?r.fontSize:k([B]);H||(L="",Y=0);let U=Y||",.!?:-@)>]}%#".indexOf(B[0])<0,K=!H||!!Y;if(ae||re&&U&&H+Y+V>_&&E!=="nowrap"&&E!=="pre")A.push(H),v.push(oe),I++,ie+=$,H=V,$=V?R.height(B):0,oe=V?R.baseline(B):0,M.push(1),j=-1,ae||(X=Math.max(X,_));else{H+=Y+V;let ge=R.height(B);ge>$&&($=ge,oe=R.baseline(B)),K&&M[M.length-1]++}L="",Y=0,K&&j++,X=Math.max(X,H),G[re]={y:ie,x:H-V,width:V,line:I,lineIndex:j}}}return H&&(I++,A.push(H),v.push(oe),ie+=$),{width:X,height:ie}});let[Nt,Gt]=yield,Pe="",Ee="",ne=a._inheritedClipPathId,{left:st,top:lt,width:ve,height:ut}=f.getComputedLayout(),Me=o.getComputedWidth()-o.getComputedPadding(n.EDGE_LEFT)-o.getComputedPadding(n.EDGE_RIGHT)-o.getComputedBorder(n.EDGE_LEFT)-o.getComputedBorder(n.EDGE_RIGHT),de=Nt+st,pe=Gt+lt,{matrix:ee,opacity:ke}=At({left:st,top:lt,width:ve,height:ut,isInheritingTransform:u},r),Se="";r.textShadowOffset&&(Se=ce({width:ve,height:ut,id:s},{shadowColor:r.textShadowColor,shadowOffset:r.textShadowOffset,shadowRadius:r.textShadowRadius}));let be="",Te="",ft="",We=-1,ct=x==="ellipsis"?k(["\u2026"]):0,Dt=x==="ellipsis"?k([" "]):0,Re={};for(let _=0;_<l.length;_++){if(!G[_])continue;let I=G[_],L=l[_],Y=null,H=d?d[L]:null,X=I.y,j=I.x,ie=I.width,$=I.line;if($===We)continue;let oe=!1;if(A.length>1){let U=ve-A[$];if(b==="right"||b==="end")j+=U;else if(b==="center")j+=U/2;else if(b==="justify"&&$<A.length-1){let K=M[$];j+=(K>1?U/(K-1):0)*I.lineIndex,oe=!0}}if(Re[$]||(Re[$]=[j,oe?ve:A[$]]),x==="ellipsis"&&A[$]>Me&&I.x+ie+ct+Dt>Me){let U=le(L,"grapheme"),K="",ge=0;for(let pt of U){let gt=I.x+k([K+pt]);if(K&&gt+ct>Me)break;K+=pt,ge=gt}L=K+"\u2026",We=$,Re[$][1]=ge}let re=v[$],B=R.baseline(L),ae=R.height(L),V=re-B;if(H?X+=0:m?(Y=R.getSVG(L,se(D({},r),{left:de+j,top:pe+X+B+V,letterSpacing:r.letterSpacing})),g&&(ft+=y("rect",{x:de+j,y:pe+X+V,width:I.width,height:ae,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:ee||void 0,"clip-path":ne?`url(#${ne})`:void 0})+y("line",{x1:de+j,x2:de+j+I.width,y1:pe+X+V+B,y2:pe+X+V+B,stroke:"#14c000","stroke-width":1,transform:ee||void 0,"clip-path":ne?`url(#${ne})`:void 0}))):X+=B+V,r.textDecorationLine&&($!==((dt=G[_+1])==null?void 0:dt.line)||We===$)){let U=Re[$];U&&!U[2]&&(be+=qe({left:de+U[0],top:pe+ae*+$,width:U[1],ascender:R.baseline(L),clipPathId:ne},r),U[2]=1)}if(Y!==null)Te+=Y+" ";else{let[U,K]=Je({content:L,filter:Se,id:s,left:de+j,top:pe+X,width:ie,height:ae,matrix:ee,opacity:ke,image:H,clipPathId:ne,debug:g,shape:!!N,decorationShape:be},r);Pe+=U,Ee+=K,be=""}}if(Te){let _=r.color!=="transparent"&&ke!==0?y("path",{fill:r.color,d:Te,transform:ee||void 0,opacity:ke!==1?ke:void 0,"clip-path":ne?`url(#${ne})`:void 0,style:P?`filter:${P}`:void 0}):"";N&&(Ee=y("path",{d:Te,transform:ee||void 0})),Pe+=(Se?Se+y("g",{filter:`url(#satori_s-${s})`},_+be):_+be)+ft}return Ee&&(r._inheritedBackgroundClipTextPath.value+=Ee),Pe}var Qe=Qe||{};Qe.parse=function(){var e={linearGradient:/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,repeatingLinearGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,radialGradient:/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,repeatingRadialGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},t="";function n(c){var w=new Error(t+": "+c);throw w.source=t,w}function r(){var c=a();return t.length>0&&n("Invalid input not EOF"),c}function a(){return F(o)}function o(){return i("linear-gradient",e.linearGradient,u)||i("repeating-linear-gradient",e.repeatingLinearGradient,u)||i("radial-gradient",e.radialGradient,d)||i("repeating-radial-gradient",e.repeatingRadialGradient,d)}function i(c,w,C){return s(w,function(Q){var he=C();return he&&(O(e.comma)||n("Missing comma before color stops")),{type:c,orientation:he,colorStops:F(P)}})}function s(c,w){var C=O(c);if(C){O(e.startCall)||n("Missing (");var Q=w(C);return O(e.endCall)||n("Missing )"),Q}}function u(){return g()||m()}function g(){return k("directional",e.sideOrCorner,1)}function m(){return k("angular",e.angleValue,1)}function d(){var c,w=p(),C;return w&&(c=[],c.push(w),C=t,O(e.comma)&&(w=p(),w?c.push(w):t=C)),c}function p(){var c=h()||l();if(c)c.at=b();else{var w=f();if(w){c=w;var C=b();C&&(c.at=C)}else{var Q=x();Q&&(c={type:"default-radial",at:Q})}}return c}function h(){var c=k("shape",/^(circle)/i,0);return c&&(c.style=z()||f()),c}function l(){var c=k("shape",/^(ellipse)/i,0);return c&&(c.style=M()||f()),c}function f(){return k("extent-keyword",e.extentKeywords,1)}function b(){if(k("position",/^at/,0)){var c=x();return c||n("Missing positioning value"),c}}function x(){var c=E();if(c.x||c.y)return{type:"position",value:c}}function E(){return{x:M(),y:M()}}function F(c){var w=c(),C=[];if(w)for(C.push(w);O(e.comma);)w=c(),w?C.push(w):n("One extra comma");return C}function P(){var c=N();return c||n("Expected color definition"),c.length=M(),c}function N(){return R()||A()||J()||W()}function W(){return k("literal",e.literalColor,0)}function R(){return k("hex",e.hexColor,1)}function J(){return s(e.rgbColor,function(){return{type:"rgb",value:F(v)}})}function A(){return s(e.rgbaColor,function(){return{type:"rgba",value:F(v)}})}function v(){return O(e.number)[1]}function M(){return k("%",e.percentageValue,1)||G()||z()}function G(){return k("position-keyword",e.positionKeywords,1)}function z(){return k("px",e.pixelValue,1)||k("em",e.emValue,1)}function k(c,w,C){var Q=O(w);if(Q)return{type:c,value:Q[C]}}function O(c){var w,C;return C=/^[\n\r\t\s]+/.exec(t),C&&q(C[0].length),w=c.exec(t),w&&q(w[0].length),w}function q(c){t=t.substr(c)}return function(c){return t=c.toString(),r()}}();var et=Qe;var Ot=vt(100),tt=new Map,yn=["image/png","image/jpeg","image/gif","image/svg+xml"];function xn(e){let t="",n=new Uint8Array(e);for(let r=0;r<n.byteLength;r++)t+=String.fromCharCode(n[r]);return btoa(t)}async function Ae(e){if(e.startsWith("data:"))return e;if(!globalThis.fetch)throw new Error("`fetch` is required to be polyfilled to load images.");if(tt.has(e))return tt.get(e);let t=Ot.get(e);if(t)return t;let n=new Promise((r,a)=>{let o;fetch(e).then(i=>{if(o=i.headers.get("content-type").toLowerCase(),!yn.includes(o))throw new Error(`Unsupported image type: ${o}`);return i.arrayBuffer()}).then(i=>{let s=`data:${o};base64,${xn(i)}`;Ot.set(e,s),r(s)}).catch(a)});return tt.set(e,n),n}function wn(e){return e.type==="literal"?e.value:e.type==="hex"?`#${e.value}`:e.type==="rgb"?`rgb(${e.value.join(",")})`:e.type==="rgba"?`rgba(${e.value.join(",")})`:"transparent"}function En(e,t){return typeof e=="string"&&e.endsWith("%")?t*parseFloat(e)/100:+e}function Ft(e,{x:t,y:n,defaultX:r,defaultY:a}){return(e?e.split(" ").map(o=>{try{let i=new ue(o);return i.type==="length"||i.type==="number"?i.value:i.value+i.unit}catch{return null}}).filter(o=>o!==null):[r,a]).map((o,i)=>En(o,[t,n][i]))}function $t(e,t){let n=[];for(let i of t){let s=wn(i);if(!n.length&&(n.push({offset:0,color:s}),typeof i.length=="undefined"||i.length.value==="0"))continue;let u=typeof i.length=="undefined"?void 0:i.length.type==="%"?i.length.value/100:i.length.value/e;n.push({offset:u,color:s})}n.length||n.push({offset:0,color:"transparent"});let r=n[n.length-1];r.offset!==1&&(typeof r.offset=="undefined"?r.offset=1:n.push({offset:1,color:r.color}));let a=0,o=1;for(let i=0;i<n.length;i++)if(typeof n[i].offset=="undefined"){for(o<i&&(o=i);typeof n[o].offset=="undefined";)o++;n[i].offset=(n[o].offset-n[a].offset)/(o-a)*(i-a)+n[a].offset}else a=i;return n}async function nt({id:e,width:t,height:n},{image:r,size:a,position:o,repeat:i}){i=i||"repeat";let s=i==="repeat-x"||i==="repeat",u=i==="repeat-y"||i==="repeat",g=Ft(a,{x:t,y:n,defaultX:t,defaultY:n}),m=Ft(o,{x:t,y:n,defaultX:0,defaultY:0});if(r.startsWith("linear-gradient(")){let d=et.parse(r)[0],p,h,l,f;if(d.orientation.type==="directional")[p,h,l,f]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[d.orientation.value];else if(d.orientation.type==="angular"){let x=+d.orientation.value/180*Math.PI-Math.PI/2,E=Math.cos(x),F=Math.sin(x);p=0,h=0,l=E,f=F,l<0&&(p-=l,l=0),f<0&&(h-=f,f=0)}let b=$t(t,d.colorStops);return[`satori_bi${e}`,`<linearGradient id="satori_bi${e}" x1="${p}" y1="${h}" x2="${l}" y2="${f}">${b.map(x=>`<stop offset="${x.offset*100}%" stop-color="${x.color}"/>`).join("")}</linearGradient>`]}if(r.startsWith("radial-gradient(")){let d=et.parse(r)[0],p=d.orientation[0],[h,l]=g,f="circle",b=h/2,x=l/2;if(p.type==="shape"){if(f=p.value,p.at)if(p.at.type==="position")b=p.at.value.x.value,x=p.at.value.y.value;else throw new Error("orientation.at.type not implemented: "+p.at.type)}else throw new Error("orientation.type not implemented: "+p.type);let E=$t(t,d.colorStops),F=`satori_radial_${e}`,P=`satori_pattern_${e}`,N={},W=Math.max(Math.abs(h-b),Math.abs(b)),R=Math.max(Math.abs(l-x),Math.abs(x));if(f==="circle")N.r=Math.sqrt(W*W+R*R);else if(f==="ellipse"){let v=R!==0?W/R:1;N.ry=Math.sqrt(W*W+R*R*v*v)/v,N.rx=N.ry*v}let J=y("pattern",{id:P,x:m[0],y:m[1],width:s?h:"100%",height:u?l:"100%",patternUnits:"userSpaceOnUse"},y("radialGradient",{id:F},E.map(v=>y("stop",{offset:v.offset,"stop-color":v.color})).join(""))+y(f,se(D({cx:b,cy:x,width:h,height:l},N),{fill:`url(#${F})`})));return[P,J]}if(r.startsWith("url(")){let d=await Ae(r.slice(4,-1));return[`satori_bi${e}`,y("pattern",{id:`satori_bi${e}`,patternContentUnits:"userSpaceOnUse",patternUnits:"userSpaceOnUse",x:m[0],y:m[1],width:s?g[0]:"100%",height:u?g[1]:"100%"},y("image",{x:0,y:0,width:g[0],height:g[1],href:d}))]}}function Oe(e,t,n){return n<e+t&&(n/2<e&&n/2<t?e=t=n/2:n/2<e?e=n-t:n/2<t&&(t=n-e)),[e,t]}function xe({left:e,top:t,width:n,height:r},a){let{borderTopLeftRadius:o,borderTopRightRadius:i,borderBottomLeftRadius:s,borderBottomRightRadius:u}=a;return o=Math.min(o||0,n,r),i=Math.min(i||0,n,r),s=Math.min(s||0,n,r),u=Math.min(u||0,n,r),!o&&!i&&!s&&!u?"":([o,i]=Oe(o,i,n),[o,s]=Oe(o,s,r),[i,u]=Oe(i,u,r),[s,u]=Oe(s,u,n),`M${e+o},${t} h${n-o-i} a${i},${i} 0 0 1 ${i},${i} v${r-i-u} a${u},${u} 0 0 1 ${-u},${u} h${u+s-n} a${s},${s} 0 0 1 ${-s},${-s} v${s+o-r} a${o},${o} 0 0 1 ${o},${-o}`)}function rt({left:e,top:t,width:n,height:r,path:a,id:o},i){return i.overflow!=="hidden"?"":a?y("clipPath",{id:`satori_cp-${o}`,"clip-path":i._inheritedClipPathId?`url(#${i._inheritedClipPathId})`:void 0},y("path",{x:e,y:t,width:n,height:r,d:a})):y("clipPath",{id:`satori_cp-${o}`,"clip-path":i._inheritedClipPathId?`url(#${i._inheritedClipPathId})`:void 0},y("rect",{x:e,y:t,width:n,height:r}))}async function it({id:e,left:t,top:n,width:r,height:a,isInheritingTransform:o,debug:i},s){if(s.display==="none")return"";let u="rect",g="transparent",m="",d=0,p="",h="",l=[],f=1,b="";s.backgroundColor&&l.push(s.backgroundColor),s.borderWidth&&(d=s.borderWidth,g=s.borderColor,s.borderStyle==="dashed"&&(m=d*2+" "+d)),s.opacity&&(f=+s.opacity),s.transform&&(p=fe({left:t,top:n,width:r,height:a},s.transform,o,s.transformOrigin));let x="";if(s.backgroundImage){let A=[];for(let v=0;v<s.backgroundImage.length;v++){let M=s.backgroundImage[v],G=await nt({id:e+"_"+v,width:r,height:a},M);G&&A.push(G)}for(let v of A)l.push(`url(#${v[0]})`),h+=v[1],v[2]&&(x+=v[2])}let E=xe({left:t,top:n,width:r,height:a},s);E&&(u="path");let F=rt({left:t,top:n,width:r,height:a,path:E,id:e},s),P=s._inheritedClipPathId,N=ce({width:r,height:a,id:e},s);i&&(b=y("rect",{x:t,y:n,width:r,height:a,fill:"transparent",stroke:"#ff5757","stroke-width":1,"stroke-dasharray":m||void 0,transform:p||void 0,"clip-path":P?`url(#${P})`:void 0})),l.length||l.push("transparent");let{backgroundClip:W,filter:R}=s,J=l.map((A,v)=>{if(A==="transparent"&&!(v===l.length-1&&d))return"";let M=!!d,G=v===l.length-1&&M&&W!=="text",z=W==="text"?`url(#satori_bct-${e})`:P?`url(#${P})`:void 0;return G&&(h+=y("clipPath",{id:`satori_bc-${e}`,"clip-path":z},y(u,{x:t,y:n,width:r,height:a,d:E||void 0})),z=`url(#satori_bc-${e})`),y(u,{x:t,y:n,width:r,height:a,fill:A,stroke:G||M?g:void 0,"stroke-width":G?d*2:M?1:void 0,"stroke-dasharray":m||void 0,d:E||void 0,transform:p||void 0,"clip-path":z,style:R?`filter:${R}`:void 0})}).join("");return W==="text"&&d&&(J=y(u,{x:t,y:n,width:r,height:a,fill:"transparent",stroke:g,"stroke-width":d*2,"stroke-dasharray":m||void 0,d:E||void 0,transform:p||void 0,"clip-path":P?`url(#${P})`:void 0})+J),(h?`<defs>${h}</defs>`:"")+F+(N?`${N}<g filter="url(#satori_s-${e})">`:"")+(f!==1?`<g opacity="${f}">`:"")+(x||J)+(f!==1?"</g>":"")+(N?"</g>":"")+b}function Fe({id:e,left:t,top:n,width:r,height:a,src:o,debug:i,isInheritingTransform:s},u){if(u.display==="none")return"";let g="",m=1,d="",p=u.objectFit==="contain"?"xMidYMid":u.objectFit==="cover"?"xMidYMid slice":"none",h=xe({left:t,top:n,width:r,height:a},u),l=u._inheritedClipPathId;h&&(g=y("clipPath",{id:`satori_c-${e}`,"clip-path":l?`url(#${l})`:void 0},y("path",{x:t,y:n,width:r,height:a,d:h}))),u.opacity&&(m=+u.opacity);let f=ce({width:r,height:a,id:e},u);return u.transform&&(d=fe({left:t,top:n,width:r,height:a},u.transform,s,u.transformOrigin)),f+(f?`<g filter="url(#satori_s-${e})">`:"")+g+y("image",{x:t,y:n,width:r,height:a,href:o,preserveAspectRatio:p,transform:d||void 0,"clip-path":g?`url(#satori_c-${e})`:l?`url(#${l})`:void 0})+(f?"</g>":"")}async function*we(e,t){var q;let n=te(),{id:r,inheritedStyle:a,parent:o,font:i,debug:s,embedFont:u=!0,graphemeImages:g,canLoadAdditionalAssets:m}=t;if(e===null||typeof e=="undefined")return yield,yield,"";if(!De(e)||typeof e.type=="function"){let c;if(!De(e))c=Ze(String(e),t),yield(await c.next()).value;else{if(wt(e.type))throw new Error("Class component is not supported.");c=we(e.type(e.props),t),yield(await c.next()).value}await c.next();let w=yield;return(await c.next(w)).value}let{type:d,props:p}=e,{style:h,children:l}=p||{},f=n.Node.create();o.insertChild(f,o.getChildCount());let[b,x]=Ve(f,d,a,h,p),E=b.transform===a.transform;if(E||(b.transform.__parent=a.transform),b.overflow==="hidden"&&(x._inheritedClipPathId=`satori_cp-${r}`),b.backgroundClip==="text"){let c={value:""};x._inheritedBackgroundClipTextPath=c,b._inheritedBackgroundClipTextPath=c}let F=typeof l=="undefined"?[]:[].concat(l).flat(1/0),P=[],N=0,W=[];for(let c of F){let w=we(c,{id:r+"-"+N++,parentStyle:b,inheritedStyle:x,isInheritingTransform:!0,parent:f,font:i,embedFont:u,debug:s,graphemeImages:g,canLoadAdditionalAssets:m});m?W.push(...(await w.next()).value||[]):await w.next(),P.push(w)}yield W;for(let c of P)await c.next();let[R,J]=yield,{left:A,top:v,width:M,height:G}=f.getComputedLayout();A+=R,v+=J;let z="",k="",O="";if(d==="img"){let c=await Ae(p.src);k=Fe({id:r,left:A,top:v,width:M,height:G,src:c,isInheritingTransform:E,debug:s},b)}else if(d==="svg"){let c=kt(e);k=Fe({id:r,left:A,top:v,width:M,height:G,src:c,isInheritingTransform:E,debug:s},b)}else{let c=(q=h==null?void 0:h.display)!=null?q:"block";if(d==="div"&&l&&typeof l!="string"&&c!=="flex"&&c!=="none")throw new Error(`Expected <div> to have style={{display: 'flex'}} but received style={{display: '${c}'}}`);k=await it({id:r,left:A,top:v,width:M,height:G,isInheritingTransform:E,debug:s},b)}for(let c of P)z+=(await c.next([A,v])).value;return b._inheritedBackgroundClipTextPath&&(O+=y("clipPath",{id:`satori_bct-${r}`,"clip-path":b._inheritedClipPathId?`url(#${b._inheritedClipPathId})`:void 0},b._inheritedBackgroundClipTextPath.value)),O+k+z}import vn from"@shuding/opentype.js";function kn(e,t,[n,r],[a,o]){if(n!==a)return n?!a||n===e?-1:a===e?1:e===400&&n===500||e===500&&n===400?-1:e===400&&a===500||e===500&&a===400?1:e<400?n<e&&a<e?a-n:n<e?-1:a<e?1:n-a:e<n&&e<a?n-a:e<n?-1:e<a?1:a-n:1;if(r!==o){if(r===t)return-1;if(o===t)return 1}return-1}var $e=class{constructor(t){this.fonts=new Map;this.addFonts(t)}get({name:t,weight:n,style:r}){if(!this.fonts.has(t))return null;n==="normal"&&(n=400),n==="bold"&&(n=700);let a=[...this.fonts.get(t)],o=a[0];for(let i=1;i<a.length;i++){let[,s,u]=o,[,g,m]=a[i];kn(n,r,[s,u],[g,m])>0&&(o=a[i])}return o[0]}addFonts(t){for(let n of t){let r=n.data,a=vn.parse("buffer"in r?r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength):r,{lowMemory:!0}),o=a.charToGlyphIndex;a.charToGlyphIndex=s=>{let u=o.call(a,s);return u===0&&a._trackBrokenChars&&a._trackBrokenChars.push(s),u},this.defaultFont||(this.defaultFont=a);let i=n.name.toLowerCase();this.fonts.has(i)||this.fonts.set(i,[]),this.fonts.get(i).push([a,n.weight,n.style])}}getEngine(t=16,n=1.2,{fontFamily:r,fontWeight:a=400,fontStyle:o="normal"}){r=Array.isArray(r)?r:[r];let i=r.map(l=>this.get({name:l,weight:a,style:o})).filter(Boolean),s=Array.from(this.fonts.keys());for(let l of s)r.includes(l)||i.push(this.get({name:l,weight:a,style:o}));let u=new Map,g=(l,f=!0)=>{let b=l.charCodeAt(0);if(u.has(b))return u.get(b);let x=i.find((E,F)=>!!E.charToGlyphIndex(l)||f&&F===i.length-1);return x&&u.set(b,x),x},m=(l,f=!1)=>{var x,E;return((f?(E=(x=l.tables)==null?void 0:x.os2)==null?void 0:E.sTypoAscender:0)||l.ascender)/l.unitsPerEm*t},d=(l,f=!1)=>{var x,E;return((f?(E=(x=l.tables)==null?void 0:x.os2)==null?void 0:E.sTypoDescender:0)||l.descender)/l.unitsPerEm*t},p=l=>g(l,!1),h={check:l=>{let f=p(l);return f?(f._trackBrokenChars=[],f.stringToGlyphs(l),f._trackBrokenChars.length?(f._trackBrokenChars=void 0,!1):!0):!1},baseline:(l,f=typeof l=="undefined"?i[0]:g(l))=>{let b=m(f,!0),x=d(f,!0),E=h.height(l,f),{yMax:F,yMin:P}=f.tables.head,N=b-x,W=(F/(F-P)-1)*N;return E*((1.2/n+1)/2)+W},height:(l,f=typeof l=="undefined"?i[0]:g(l))=>(m(f)-d(f))*(n/1.2),measure:(l,f)=>this.measure(g,l,f),getSVG:(l,f)=>this.getSVG(g,l,f)};return h}patchFontFallbackResolver(t,n){let r=[];t._trackBrokenChars=r;let a=t.stringToGlyphs;return t.stringToGlyphs=(o,...i)=>{let s=a.call(t,o,...i);for(let u=0;u<s.length;u++)if(s[u].unicode===void 0){let g=r.shift(),m=n(g);m!==t&&(s[u]=m.charToGlyph(g))}return s},()=>{t.stringToGlyphs=a,t._trackBrokenChars=void 0}}measure(t,n,{fontSize:r,letterSpacing:a=0}){let o=t(n),i=this.patchFontFallbackResolver(o,t);try{return o.getAdvanceWidth(n,r,{letterSpacing:a/r})}finally{i()}}getSVG(t,n,{fontSize:r,top:a,left:o,letterSpacing:i=0}){let s=t(n),u=this.patchFontFallbackResolver(s,t);try{return s.getPath(n,o,a,r,{letterSpacing:i/r}).toPathData(1)}finally{u()}}};function ot({width:e,height:t,content:n}){return y("svg",{width:e,height:t,viewBox:`0 0 ${e} ${t}`,xmlns:"http://www.w3.org/2000/svg"},n)}var Pt={emoji:/\p{RI}\p{RI}|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?(\u{200D}\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?)+|\p{EPres}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})/u,ja:/\p{scx=Hira}|\p{scx=Kana}|[,;:]/u,ko:/\p{scx=Hangul}/u,zh:/\p{scx=Han}/u,th:/\p{scx=Thai}/u,bn:/\p{scx=Bengali}/u,ar:/\p{scx=Arabic}/u,ta:/\p{scx=Tamil}/u,ml:/\p{scx=Malayalam}/u,he:/\p{scx=Hebrew}/u,te:/\p{scx=Telugu}/u,devanagari:/\p{scx=Devanagari}/u};function Mt(e){for(let t in Pt)if(Pt[t].test(e))return t;return"unknown"}var at=new WeakMap;async function Wt(e,t){let n=te();if(!n)throw new Error("Satori is not initialized.");let r;at.has(t.fonts)?r=at.get(t.fonts):at.set(t.fonts,r=new $e(t.fonts));let a=n.Node.create();a.setWidth(t.width),a.setHeight(t.height),a.setFlexDirection(n.FLEX_DIRECTION_ROW),a.setFlexWrap(n.WRAP_WRAP),a.setAlignContent(n.ALIGN_AUTO),a.setAlignItems(n.ALIGN_FLEX_START),a.setJustifyContent(n.JUSTIFY_FLEX_START),a.setOverflow(n.OVERFLOW_HIDDEN);let o=D({},t.graphemeImages),i=we(e,{id:"id",parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1,whiteSpace:"normal",_viewportWidth:t.width,_viewportHeight:t.height},parent:a,font:r,embedFont:t.embedFont,debug:t.debug,graphemeImages:o,canLoadAdditionalAssets:!!t.loadAdditionalAsset}),s=(await i.next()).value;if(t.loadAdditionalAsset&&s.length){s=Array.from(new Set(le(s.join(""),"grapheme")));let g={};s.forEach(p=>{let h=Mt(p);g[h]=g[h]||[],h==="emoji"?g[h].push(p):g[h][0]=(g[h][0]||"")+p});let m=[],d={};await Promise.all(Object.entries(g).flatMap(([p,h])=>h.map(l=>t.loadAdditionalAsset(p,l).then(f=>{typeof f=="string"?d[l]=f:f&&m.push(f)})))),r.addFonts(m),Object.assign(o,d)}await i.next(),a.calculateLayout(t.width,t.height,n.DIRECTION_LTR);let u=(await i.next([0,0])).value;return a.freeRecursive(),ot({width:t.width,height:t.height,content:u})}export{Wt as default,Ht as init};
5
5
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * https://github.com/gilmoreorless/css-background-parser
3
+ * Copyright © 2015 Gilmore Davidson under the MIT license: http://gilmoreorless.mit-license.org/
4
+ */
5
+ /*! https://mths.be/codepointat v0.2.0 by @mathias */