Socket
Socket
Sign inDemoInstall

satori

Package Overview
Dependencies
Maintainers
2
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

satori - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

8

dist/esm/index.js

@@ -1,5 +0,5 @@

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,Ht=Ne?new Intl.Segmenter(gt,{granularity:"grapheme"}):null,ye=[32,160,4961,65792,65793,4153,4241,10].map(e=>String.fromCodePoint(e)),Yt=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):[...Ht.segment(e)].map(t=>t.segment):n==="word"?Yt(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 He(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 Ye(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=He(t.transformOrigin,o));for(let a in t){let r=t[a];if(a==="lineHeight")typeof r=="string"&&(r=t[a]=Ye(r,o,n,{percentage:!0})/o);else if(typeof r=="string"){let i=Ye(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"?Ye(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 Tt({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(A=>le(A,"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:T,filter:M,_inheritedBackgroundClipTextPath:W}=o,N=o.fontSize,S=i.getEngine(N,T,o),Y=d?l.filter(A=>!S.check(A)):[];yield Y,Y.length&&(S=i.getEngine(N,T,o));let w=[],k=[],X=[],q=[],Q=new Map,R=A=>{let O=0;for(let F of A){if(Q.has(F)){O+=Q.get(F);continue}let H=S.measure(F,o);Q.set(F,H),O+=H}return O},$=0,v=[],p=0;for(let A of l){let O=!1,F=c&&c[A];_==="pre"?O=A[0]===`
`:_!=="nowrap"&&(F||ye.includes(A[0]))&&(O=!0),O?(_==="nowrap"?p+=R(v)+o.fontSize:($=Math.max($,R(v)),F&&($=Math.max($,o.fontSize))),v=[]):(!ye.includes(A[0])||!v.length)&&v.push(A===`
`?" ":A)}$=Math.max($,R(v)+p);let E=r.getMinWidth(),I=r.getMaxWidth(),Z=r.getWidth();isNaN(Z.value)&&(isNaN(E.value)||E.unit===1&&E.value>$)&&(isNaN(I.value)||I.unit===1&&($=Math.min($,I.value)),r.setMinWidth($)),typeof o.flexShrink=="undefined"&&r.setFlexShrink(1);let he=_==="pre-wrap"||_==="pre";u.setMeasureFunc(A=>{let O=0,F="",H=0,U=0,z=0,j=-1,ie=0,P=0,oe=0;w=[],X=[0];for(let re=0;re<l.length;re++){let D=l[re];if(!he&&ye.includes(D[0]))F||(F=" "),H=R([F]),q[re]=null;else{let ae=he&&D===`
`,V=ae?0:c&&c[D]?o.fontSize:R([D]);U||(F="",H=0);let B=H||",.!?:-@)>]}%#".indexOf(D[0])<0,J=!U||!!H;if(ae||re&&B&&U+H+V>A&&_!=="nowrap"&&_!=="pre")w.push(U),k.push(oe),O++,ie+=P,U=V,P=V?S.glyphHeight(D):0,oe=V?S.baseline(D):0,X.push(1),j=-1,ae||(z=Math.max(z,A));else{U+=H+V;let me=S.glyphHeight(D);me>P&&(P=me,oe=S.baseline(D)),J&&X[X.length-1]++}F="",H=0,J&&j++,z=Math.max(z,U),q[re]={y:ie,x:U-V,width:V,line:O,lineIndex:j}}}return U&&(O++,w.push(U),k.push(oe),ie+=P),{width:z,height:ie}});let[kt,It]=yield,Oe="",Se="",ne=a._inheritedClipPathId,{left:rt,top:it,width:Te,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:we}=Tt({left:rt,top:it,width:Te,height:ot,isInheritingTransform:f},o),be="";o.textShadowOffset&&(be=ce({width:Te,height:ot,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let Re="",ve="",at="",$e=-1,st=y==="ellipsis"?R(["\u2026"]):0,At=y==="ellipsis"?R([" "]):0,Ce={};for(let A=0;A<l.length;A++){if(!q[A])continue;let O=q[A],F=l[A],H=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(w.length>1){let B=Te-w[P];if(b==="right"||b==="end")j+=B;else if(b==="center")j+=B/2;else if(b==="justify"&&P<w.length-1){let J=X[P];j+=(J>1?B/(J-1):0)*O.lineIndex,oe=!0}}if(Ce[P]||(Ce[P]=[j,oe?Te:w[P]]),y==="ellipsis"&&w[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=k[P],D=S.baseline(F),ae=S.glyphHeight(F),V=re-D;if(U?z+=0:g?(H=S.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[A+1])==null?void 0:lt.line)||$e===P)){let B=Ce[P];B&&!B[2]&&(Re+=ze({left:de+B[0],top:pe+ae*+P,width:B[1],ascender:S.baseline(F),clipPathId:ne},o),B[2]=1)}if(H!==null)ve+=H+" ";else{let[B,J]=Ue({content:F,filter:be,id:s,left:de+j,top:pe+z,width:ie,height:ae,matrix:ee,opacity:we,image:U,clipPathId:ne,debug:m,shape:!!W,decorationShape:Re},o);Oe+=B,Se+=J,Re=""}}if(ve){let A=o.color!=="transparent"&&we!==0?x("path",{fill:o.color,d:ve,transform:ee||void 0,opacity:we!==1?we: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+=(be?`${be}<g filter="url(#satori_s-${s})">`:"")+A+Re+(be?"</g>":"")+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 T(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,I){return s(E,function(Z){var he=I();return he&&($(e.comma)||t("Missing comma before color stops")),{type:p,orientation:he,colorStops:T(M)}})}function s(p,E){var I=$(p);if(I){$(e.startCall)||t("Missing (");var Z=E(I);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(),I;return E&&(p=[],p.push(E),I=n,$(e.comma)&&(E=d(),E?p.push(E):n=I)),p}function d(){var p=h()||l();if(p)p.at=b();else{var E=u();if(E){p=E;var I=b();I&&(p.at=I)}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 T(p){var E=p(),I=[];if(E)for(I.push(E);$(e.comma);)E=p(),E?I.push(E):t("One extra comma");return I}function M(){var p=W();return p||t("Expected color definition"),p.length=X(),p}function W(){return S()||w()||Y()||N()}function N(){return R("literal",e.literalColor,0)}function S(){return R("hex",e.hexColor,1)}function Y(){return s(e.rgbColor,function(){return{type:"rgb",value:T(k)}})}function w(){return s(e.rgbaColor,function(){return{type:"rgba",value:T(k)}})}function k(){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,I){var Z=$(E);if(Z)return{type:p,value:Z[I]}}function $(p){var E,I;return I=/^[\n\r\t\s]+/.exec(n),I&&v(I[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 wt(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=wt(a,{x:n,y:t,defaultX:n,defaultY:t}),g=wt(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),T=Math.sin(y);d=0,h=0,l=_,u=T,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),T=`satori_radial_${e}`,M=`satori_pattern_${e}`,W={},N=Math.max(Math.abs(h-b),Math.abs(b)),S=Math.max(Math.abs(l-y),Math.abs(y));if(u==="circle")W.r=Math.sqrt(N*N+S*S);else if(u==="ellipse"){let k=S!==0?N/S:1;W.ry=Math.sqrt(N*N+S*S*k*k)/k,W.rx=W.ry*k}let Y=x("pattern",{id:M,x:g[0],y:g[1],width:s?h:"100%",height:f?l:"100%",patternUnits:"userSpaceOnUse"},x("radialGradient",{id:T},_.map(k=>x("stop",{offset:k.offset,"stop-color":k.color})).join(""))+x(u,se(G({cx:b,cy:y,width:h,height:l},W),{fill:`url(#${T})`})));return[M,Y]}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 Y=s.backgroundImage.map((w,k)=>qe({id:e+"_"+k,width:o,height:a},w)).filter(Boolean);for(let w of Y)h.push(`url(#${w[0]})`),d+=w[1],w[2]&&(b+=w[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),T=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":T?`url(#${T})`:void 0})),h.length||h.push("transparent");let{backgroundClip:W,filter:N}=s,S=h.map((Y,w)=>{if(Y==="transparent"&&!(w===h.length-1&&g))return"";let k=w===h.length-1&&g&&W!=="text";return x(f,{x:n,y:t,width:o,height:a,fill:Y,stroke:k?m:void 0,"stroke-width":k?g:void 0,d:y||void 0,transform:c||void 0,"clip-path":W==="text"?`url(#satori_bct-${e})`:T?`url(#${T})`:void 0,style:N?`filter:${N}`:void 0})}).join("");return W==="text"&&g&&(S=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":T?`url(#${T})`:void 0})+S),(d?`<defs>${d}</defs>`:"")+_+(M?`${M}<g filter="url(#satori_s-${e})">`:"")+(l!==1?`<g opacity="${l}">`:"")+(b||S)+(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 T=typeof l=="undefined"?[]:[].concat(l),M=[],W=0,N=[];for(let v of T){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[S,Y]=yield;b.position==="absolute"&&u.calculateLayout();let{left:w,top:k,width:X,height:q}=u.getComputedLayout();w+=S,k+=Y;let Q="",R="",$="";c==="img"?R=et({id:o,left:w,top:k,width:X,height:q,src:d.src,isInheritingTransform:_,debug:s},b):R=Qe({id:o,left:w,top:k,width:X,height:q,isInheritingTransform:_,debug:s},b);for(let v of M)Q+=v.next([w,k]).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((_,T)=>!!_.charToGlyphIndex(l)||u&&T===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),_=b-y,T=h.glyphHeight(l,u),M=(T-_)/2,{yMax:W,yMin:N}=u.tables.head,S=W/(W-N);return M+S*T},glyphHeight:(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 console.log(e,n),n;return console.log(e),"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};
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 Tt({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(A=>le(A,"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:L,filter:M,_inheritedBackgroundClipTextPath:W}=o,N=o.fontSize,S=i.getEngine(N,L,o),H=d?l.filter(A=>!S.check(A)):[];yield H,H.length&&(S=i.getEngine(N,L,o));let T=[],k=[],X=[],q=[],Q=new Map,w=A=>{let O=0;for(let F of A){if(Q.has(F)){O+=Q.get(F);continue}let Y=S.measure(F,o);Q.set(F,Y),O+=Y}return O},$=0,R=[],p=0;for(let A of l){let O=!1,F=c&&c[A];_==="pre"?O=A[0]===`
`:_!=="nowrap"&&(F||ye.includes(A[0]))&&(O=!0),O?(_==="nowrap"?p+=w(R)+o.fontSize:($=Math.max($,w(R)),F&&($=Math.max($,o.fontSize))),R=[]):(!ye.includes(A[0])||!R.length)&&R.push(A===`
`?" ":A)}$=Math.max($,w(R)+p);let E=r.getMinWidth(),I=r.getMaxWidth(),Z=r.getWidth();isNaN(Z.value)&&(isNaN(E.value)||E.unit===1&&E.value>$)&&(isNaN(I.value)||I.unit===1&&($=Math.min($,I.value)),r.setMinWidth($)),typeof o.flexShrink=="undefined"&&r.setFlexShrink(1);let he=_==="pre-wrap"||_==="pre";u.setMeasureFunc(A=>{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=w([F]),q[re]=null;else{let ae=he&&D===`
`,V=ae?0:c&&c[D]?o.fontSize:w([D]);U||(F="",Y=0);let B=Y||",.!?:-@)>]}%#".indexOf(D[0])<0,J=!U||!!Y;if(ae||re&&B&&U+Y+V>A&&_!=="nowrap"&&_!=="pre")T.push(U),k.push(oe),O++,ie+=P,U=V,P=V?S.height(D):0,oe=V?S.baseline(D):0,X.push(1),j=-1,ae||(z=Math.max(z,A));else{U+=Y+V;let me=S.height(D);me>P&&(P=me,oe=S.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),k.push(oe),ie+=P),{width:z,height:ie}});let[kt,It]=yield,Oe="",Se="",ne=a._inheritedClipPathId,{left:rt,top:it,width:Te,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:we}=Tt({left:rt,top:it,width:Te,height:ot,isInheritingTransform:f},o),be="";o.textShadowOffset&&(be=ce({width:Te,height:ot,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let Re="",ve="",at="",$e=-1,st=y==="ellipsis"?w(["\u2026"]):0,At=y==="ellipsis"?w([" "]):0,Ce={};for(let A=0;A<l.length;A++){if(!q[A])continue;let O=q[A],F=l[A],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=Te-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?Te: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+w([J+ft]);if(J&&ut+st>Fe)break;J+=ft,me=ut}F=J+"\u2026",$e=P,Ce[P][1]=me}let re=k[P],D=S.baseline(F),ae=S.height(F),V=re-D;if(U?z+=0:g?(Y=S.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[A+1])==null?void 0:lt.line)||$e===P)){let B=Ce[P];B&&!B[2]&&(Re+=ze({left:de+B[0],top:pe+ae*+P,width:B[1],ascender:S.baseline(F),clipPathId:ne},o),B[2]=1)}if(Y!==null)ve+=Y+" ";else{let[B,J]=Ue({content:F,filter:be,id:s,left:de+j,top:pe+z,width:ie,height:ae,matrix:ee,opacity:we,image:U,clipPathId:ne,debug:m,shape:!!W,decorationShape:Re},o);Oe+=B,Se+=J,Re=""}}if(ve){let A=o.color!=="transparent"&&we!==0?x("path",{fill:o.color,d:ve,transform:ee||void 0,opacity:we!==1?we: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+=(be?`${be}<g filter="url(#satori_s-${s})">`:"")+A+Re+(be?"</g>":"")+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 L(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,I){return s(E,function(Z){var he=I();return he&&($(e.comma)||t("Missing comma before color stops")),{type:p,orientation:he,colorStops:L(M)}})}function s(p,E){var I=$(p);if(I){$(e.startCall)||t("Missing (");var Z=E(I);return $(e.endCall)||t("Missing )"),Z}}function f(){return m()||g()}function m(){return w("directional",e.sideOrCorner,1)}function g(){return w("angular",e.angleValue,1)}function c(){var p,E=d(),I;return E&&(p=[],p.push(E),I=n,$(e.comma)&&(E=d(),E?p.push(E):n=I)),p}function d(){var p=h()||l();if(p)p.at=b();else{var E=u();if(E){p=E;var I=b();I&&(p.at=I)}else{var Z=y();Z&&(p={type:"default-radial",at:Z})}}return p}function h(){var p=w("shape",/^(circle)/i,0);return p&&(p.style=Q()||u()),p}function l(){var p=w("shape",/^(ellipse)/i,0);return p&&(p.style=X()||u()),p}function u(){return w("extent-keyword",e.extentKeywords,1)}function b(){if(w("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 L(p){var E=p(),I=[];if(E)for(I.push(E);$(e.comma);)E=p(),E?I.push(E):t("One extra comma");return I}function M(){var p=W();return p||t("Expected color definition"),p.length=X(),p}function W(){return S()||T()||H()||N()}function N(){return w("literal",e.literalColor,0)}function S(){return w("hex",e.hexColor,1)}function H(){return s(e.rgbColor,function(){return{type:"rgb",value:L(k)}})}function T(){return s(e.rgbaColor,function(){return{type:"rgba",value:L(k)}})}function k(){return $(e.number)[1]}function X(){return w("%",e.percentageValue,1)||q()||Q()}function q(){return w("position-keyword",e.positionKeywords,1)}function Q(){return w("px",e.pixelValue,1)||w("em",e.emValue,1)}function w(p,E,I){var Z=$(E);if(Z)return{type:p,value:Z[I]}}function $(p){var E,I;return I=/^[\n\r\t\s]+/.exec(n),I&&R(I[0].length),E=p.exec(n),E&&R(E[0].length),E}function R(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 wt(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=wt(a,{x:n,y:t,defaultX:n,defaultY:t}),g=wt(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),L=Math.sin(y);d=0,h=0,l=_,u=L,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),L=`satori_radial_${e}`,M=`satori_pattern_${e}`,W={},N=Math.max(Math.abs(h-b),Math.abs(b)),S=Math.max(Math.abs(l-y),Math.abs(y));if(u==="circle")W.r=Math.sqrt(N*N+S*S);else if(u==="ellipse"){let k=S!==0?N/S:1;W.ry=Math.sqrt(N*N+S*S*k*k)/k,W.rx=W.ry*k}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:L},_.map(k=>x("stop",{offset:k.offset,"stop-color":k.color})).join(""))+x(u,se(G({cx:b,cy:y,width:h,height:l},W),{fill:`url(#${L})`})));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,k)=>qe({id:e+"_"+k,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),L=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":L?`url(#${L})`:void 0})),h.length||h.push("transparent");let{backgroundClip:W,filter:N}=s,S=h.map((H,T)=>{if(H==="transparent"&&!(T===h.length-1&&g))return"";let k=T===h.length-1&&g&&W!=="text";return x(f,{x:n,y:t,width:o,height:a,fill:H,stroke:k?m:void 0,"stroke-width":k?g:void 0,d:y||void 0,transform:c||void 0,"clip-path":W==="text"?`url(#satori_bct-${e})`:L?`url(#${L})`:void 0,style:N?`filter:${N}`:void 0})}).join("");return W==="text"&&g&&(S=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":L?`url(#${L})`:void 0})+S),(d?`<defs>${d}</defs>`:"")+_+(M?`${M}<g filter="url(#satori_s-${e})">`:"")+(l!==1?`<g opacity="${l}">`:"")+(b||S)+(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 R;if(!We(e))R=Ve(String(e),n),yield R.next().value;else{if(mt(e.type))throw new Error("Class component is not supported.");R=_e(e.type(e.props),n),yield R.next().value}R.next();let p=yield;return R.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 R={value:""};y._inheritedBackgroundClipTextPath=R,b._inheritedBackgroundClipTextPath=R}let L=typeof l=="undefined"?[]:[].concat(l),M=[],W=0,N=[];for(let R of L){let p=_e(R,{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 R of M)R.next();let[S,H]=yield;b.position==="absolute"&&u.calculateLayout();let{left:T,top:k,width:X,height:q}=u.getComputedLayout();T+=S,k+=H;let Q="",w="",$="";c==="img"?w=et({id:o,left:T,top:k,width:X,height:q,src:d.src,isInheritingTransform:_,debug:s},b):w=Qe({id:o,left:T,top:k,width:X,height:q,isInheritingTransform:_,debug:s},b);for(let R of M)Q+=R.next([T,k]).value;return b._inheritedBackgroundClipTextPath&&($+=x("clipPath",{id:`satori_bct-${o}`,"clip-path":b._inheritedClipPathId?`url(#${b._inheritedClipPathId})`:void 0},b._inheritedBackgroundClipTextPath.value)),$+w+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((_,L)=>!!_.charToGlyphIndex(l)||u&&L===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),_=b-y,M=h.height(l,u)-_,{yMax:W,yMin:N}=u.tables.head,S=W/(W-N);return M+S*_},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 console.log(e,n),n;return console.log(e),"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};
//# sourceMappingURL=index.js.map

@@ -1,5 +0,5 @@

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));var pt={};var Pe;Pe=pt.default;function Nt(e){Pe=e}function te(){return Pe}import{LineBreaker as Mt}from"css-line-break";import{splitGraphemes as Gt}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",Dt=Ne?new Intl.Segmenter(gt,{granularity:"word"}):null,Bt=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=Mt(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"?[...Dt.segment(e)].map(t=>t.segment):[...Bt.segment(e)].map(t=>t.segment):n==="word"?Ht(e):Gt(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 Yt=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)Yt.has(t)&&(n[t]=e[t]);return n}import{getPropertyName as rn,getStylesForProperty as on}from"css-to-react-native";import{parseElementStyle as an}from"css-background-parser";var xe=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),Xt=xe((e,n)=>{n.exports=["em","ex","ch","rem","vh","vw","vmin","vmax","px","mm","cm","in","pt","pc","mozmm"]}),Ut=xe((e,n)=>{n.exports=["deg","grad","rad","turn"]}),zt=xe((e,n)=>{n.exports=["dpi","dpcm","dppx"]}),jt=xe((e,n)=>{n.exports=["Hz","kHz"]}),Vt=xe((e,n)=>{n.exports=["s","ms"]}),Jt=Xt(),bt=Ut(),yt=zt(),xt=jt(),Et=Vt();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(Kt(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=Zt(e);if(!n){this.type="number",this.value=Ge(e);return}this.type=en(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 Kt(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 qt=[].concat(bt,xt,Jt,yt,Et);function Zt(e){var n=e.match(/\D+$/),t=n&&n[0];if(t&&qt.indexOf(t)===-1)throw new Error("Invalid unit: "+t);return t}var Qt=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 en(e){return Qt[e]||"length"}import tn from"postcss-value-parser";function nn(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=nn(e,n);return o.absolute?{[t?"xAbsolute":"yAbsolute"]:o.absolute}:o.relative?{[t?"xRelative":"yRelative"]:o.relative}:{}}}function He(e,n){if(typeof e=="number")return{xAbsolute:e};let t;try{t=tn(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 sn=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),ln=new Set(["lineHeight"]),_t=[1,0,0,1,0,0];function fn(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"?sn.has(e)?ln.has(e)?n:String(n):n+"px":n}function un(e,n){return e==="lineHeight"?{lineHeight:St(e,n)}:e==="fontFamily"?{fontFamily:n.split(",").map(t=>t.trim().replace(/(^['"])|(['"]$)/g,"").toLocaleLowerCase())}:null}function Ye(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=rn(a);Object.assign(t,un(r,e[a])||fn(r,on(r,St(r,e[a]),!0),e[a],e.color||n.color))}if(t.backgroundImage){let{backgrounds:a}=an(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=He(t.transformOrigin,o));for(let a in t){let r=t[a];if(a==="lineHeight")typeof r=="string"&&(r=t[a]=Ye(r,o,n,{percentage:!0})/o);else if(typeof r=="string"){let i=Ye(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"?Ye(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 Tt({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(A=>le(A,"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:T,filter:M,_inheritedBackgroundClipTextPath:W}=o,N=o.fontSize,S=i.getEngine(N,T,o),Y=d?l.filter(A=>!S.check(A)):[];yield Y,Y.length&&(S=i.getEngine(N,T,o));let w=[],k=[],X=[],q=[],Q=new Map,R=A=>{let O=0;for(let F of A){if(Q.has(F)){O+=Q.get(F);continue}let H=S.measure(F,o);Q.set(F,H),O+=H}return O},$=0,v=[],p=0;for(let A of l){let O=!1,F=c&&c[A];_==="pre"?O=A[0]===`
`:_!=="nowrap"&&(F||ye.includes(A[0]))&&(O=!0),O?(_==="nowrap"?p+=R(v)+o.fontSize:($=Math.max($,R(v)),F&&($=Math.max($,o.fontSize))),v=[]):(!ye.includes(A[0])||!v.length)&&v.push(A===`
`?" ":A)}$=Math.max($,R(v)+p);let E=r.getMinWidth(),I=r.getMaxWidth(),Z=r.getWidth();isNaN(Z.value)&&(isNaN(E.value)||E.unit===1&&E.value>$)&&(isNaN(I.value)||I.unit===1&&($=Math.min($,I.value)),r.setMinWidth($)),typeof o.flexShrink=="undefined"&&r.setFlexShrink(1);let he=_==="pre-wrap"||_==="pre";u.setMeasureFunc(A=>{let O=0,F="",H=0,U=0,z=0,j=-1,ie=0,P=0,oe=0;w=[],X=[0];for(let re=0;re<l.length;re++){let D=l[re];if(!he&&ye.includes(D[0]))F||(F=" "),H=R([F]),q[re]=null;else{let ae=he&&D===`
`,V=ae?0:c&&c[D]?o.fontSize:R([D]);U||(F="",H=0);let B=H||",.!?:-@)>]}%#".indexOf(D[0])<0,J=!U||!!H;if(ae||re&&B&&U+H+V>A&&_!=="nowrap"&&_!=="pre")w.push(U),k.push(oe),O++,ie+=P,U=V,P=V?S.glyphHeight(D):0,oe=V?S.baseline(D):0,X.push(1),j=-1,ae||(z=Math.max(z,A));else{U+=H+V;let me=S.glyphHeight(D);me>P&&(P=me,oe=S.baseline(D)),J&&X[X.length-1]++}F="",H=0,J&&j++,z=Math.max(z,U),q[re]={y:ie,x:U-V,width:V,line:O,lineIndex:j}}}return U&&(O++,w.push(U),k.push(oe),ie+=P),{width:z,height:ie}});let[kt,It]=yield,Oe="",Se="",ne=a._inheritedClipPathId,{left:rt,top:it,width:Te,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:we}=Tt({left:rt,top:it,width:Te,height:ot,isInheritingTransform:f},o),be="";o.textShadowOffset&&(be=ce({width:Te,height:ot,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let Re="",ve="",at="",$e=-1,st=y==="ellipsis"?R(["\u2026"]):0,At=y==="ellipsis"?R([" "]):0,Ce={};for(let A=0;A<l.length;A++){if(!q[A])continue;let O=q[A],F=l[A],H=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(w.length>1){let B=Te-w[P];if(b==="right"||b==="end")j+=B;else if(b==="center")j+=B/2;else if(b==="justify"&&P<w.length-1){let J=X[P];j+=(J>1?B/(J-1):0)*O.lineIndex,oe=!0}}if(Ce[P]||(Ce[P]=[j,oe?Te:w[P]]),y==="ellipsis"&&w[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=k[P],D=S.baseline(F),ae=S.glyphHeight(F),V=re-D;if(U?z+=0:g?(H=S.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[A+1])==null?void 0:lt.line)||$e===P)){let B=Ce[P];B&&!B[2]&&(Re+=ze({left:de+B[0],top:pe+ae*+P,width:B[1],ascender:S.baseline(F),clipPathId:ne},o),B[2]=1)}if(H!==null)ve+=H+" ";else{let[B,J]=Ue({content:F,filter:be,id:s,left:de+j,top:pe+z,width:ie,height:ae,matrix:ee,opacity:we,image:U,clipPathId:ne,debug:m,shape:!!W,decorationShape:Re},o);Oe+=B,Se+=J,Re=""}}if(ve){let A=o.color!=="transparent"&&we!==0?x("path",{fill:o.color,d:ve,transform:ee||void 0,opacity:we!==1?we: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+=(be?`${be}<g filter="url(#satori_s-${s})">`:"")+A+Re+(be?"</g>":"")+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 T(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,I){return s(E,function(Z){var he=I();return he&&($(e.comma)||t("Missing comma before color stops")),{type:p,orientation:he,colorStops:T(M)}})}function s(p,E){var I=$(p);if(I){$(e.startCall)||t("Missing (");var Z=E(I);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(),I;return E&&(p=[],p.push(E),I=n,$(e.comma)&&(E=d(),E?p.push(E):n=I)),p}function d(){var p=h()||l();if(p)p.at=b();else{var E=u();if(E){p=E;var I=b();I&&(p.at=I)}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 T(p){var E=p(),I=[];if(E)for(I.push(E);$(e.comma);)E=p(),E?I.push(E):t("One extra comma");return I}function M(){var p=W();return p||t("Expected color definition"),p.length=X(),p}function W(){return S()||w()||Y()||N()}function N(){return R("literal",e.literalColor,0)}function S(){return R("hex",e.hexColor,1)}function Y(){return s(e.rgbColor,function(){return{type:"rgb",value:T(k)}})}function w(){return s(e.rgbaColor,function(){return{type:"rgba",value:T(k)}})}function k(){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,I){var Z=$(E);if(Z)return{type:p,value:Z[I]}}function $(p){var E,I;return I=/^[\n\r\t\s]+/.exec(n),I&&v(I[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 cn(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 dn(e,n){return typeof e=="string"&&e.endsWith("%")?n*parseFloat(e)/100:+e}function wt(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)=>dn(r,[n,t][i]))}function Rt(e,n){let t=[];for(let i of n){let s=cn(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=wt(a,{x:n,y:t,defaultX:n,defaultY:t}),g=wt(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),T=Math.sin(y);d=0,h=0,l=_,u=T,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),T=`satori_radial_${e}`,M=`satori_pattern_${e}`,W={},N=Math.max(Math.abs(h-b),Math.abs(b)),S=Math.max(Math.abs(l-y),Math.abs(y));if(u==="circle")W.r=Math.sqrt(N*N+S*S);else if(u==="ellipse"){let k=S!==0?N/S:1;W.ry=Math.sqrt(N*N+S*S*k*k)/k,W.rx=W.ry*k}let Y=x("pattern",{id:M,x:g[0],y:g[1],width:s?h:"100%",height:f?l:"100%",patternUnits:"userSpaceOnUse"},x("radialGradient",{id:T},_.map(k=>x("stop",{offset:k.offset,"stop-color":k.color})).join(""))+x(u,se(G({cx:b,cy:y,width:h,height:l},W),{fill:`url(#${T})`})));return[M,Y]}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 Y=s.backgroundImage.map((w,k)=>qe({id:e+"_"+k,width:o,height:a},w)).filter(Boolean);for(let w of Y)h.push(`url(#${w[0]})`),d+=w[1],w[2]&&(b+=w[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),T=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":T?`url(#${T})`:void 0})),h.length||h.push("transparent");let{backgroundClip:W,filter:N}=s,S=h.map((Y,w)=>{if(Y==="transparent"&&!(w===h.length-1&&g))return"";let k=w===h.length-1&&g&&W!=="text";return x(f,{x:n,y:t,width:o,height:a,fill:Y,stroke:k?m:void 0,"stroke-width":k?g:void 0,d:y||void 0,transform:c||void 0,"clip-path":W==="text"?`url(#satori_bct-${e})`:T?`url(#${T})`:void 0,style:N?`filter:${N}`:void 0})}).join("");return W==="text"&&g&&(S=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":T?`url(#${T})`:void 0})+S),(d?`<defs>${d}</defs>`:"")+_+(M?`${M}<g filter="url(#satori_s-${e})">`:"")+(l!==1?`<g opacity="${l}">`:"")+(b||S)+(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 T=typeof l=="undefined"?[]:[].concat(l),M=[],W=0,N=[];for(let v of T){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[S,Y]=yield;b.position==="absolute"&&u.calculateLayout();let{left:w,top:k,width:X,height:q}=u.getComputedLayout();w+=S,k+=Y;let Q="",R="",$="";c==="img"?R=et({id:o,left:w,top:k,width:X,height:q,src:d.src,isInheritingTransform:_,debug:s},b):R=Qe({id:o,left:w,top:k,width:X,height:q,isInheritingTransform:_,debug:s},b);for(let v of M)Q+=v.next([w,k]).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 pn from"@shuding/opentype.js";function mn(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];mn(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=pn.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((_,T)=>!!_.charToGlyphIndex(l)||u&&T===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),_=b-y,T=h.glyphHeight(l,u),M=(T-_)/2,{yMax:W,yMin:N}=u.tables.head,S=W/(W-N);return M+S*T},glyphHeight:(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 console.log(e,n),n;return console.log(e),"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,Nt as init};
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));var pt={};var Pe;Pe=pt.default;function Nt(e){Pe=e}function te(){return Pe}import{LineBreaker as Mt}from"css-line-break";import{splitGraphemes as Gt}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",Dt=Ne?new Intl.Segmenter(gt,{granularity:"word"}):null,Bt=Ne?new Intl.Segmenter(gt,{granularity:"grapheme"}):null,ye=[32,160,4961,65792,65793,4153,4241,10].map(e=>String.fromCodePoint(e)),Yt=e=>{let n=Mt(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"?[...Dt.segment(e)].map(t=>t.segment):[...Bt.segment(e)].map(t=>t.segment):n==="word"?Yt(e):Gt(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 Ht=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)Ht.has(t)&&(n[t]=e[t]);return n}import{getPropertyName as rn,getStylesForProperty as on}from"css-to-react-native";import{parseElementStyle as an}from"css-background-parser";var xe=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),Xt=xe((e,n)=>{n.exports=["em","ex","ch","rem","vh","vw","vmin","vmax","px","mm","cm","in","pt","pc","mozmm"]}),Ut=xe((e,n)=>{n.exports=["deg","grad","rad","turn"]}),zt=xe((e,n)=>{n.exports=["dpi","dpcm","dppx"]}),jt=xe((e,n)=>{n.exports=["Hz","kHz"]}),Vt=xe((e,n)=>{n.exports=["s","ms"]}),Jt=Xt(),bt=Ut(),yt=zt(),xt=jt(),Et=Vt();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(Kt(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=Zt(e);if(!n){this.type="number",this.value=Ge(e);return}this.type=en(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 Kt(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 qt=[].concat(bt,xt,Jt,yt,Et);function Zt(e){var n=e.match(/\D+$/),t=n&&n[0];if(t&&qt.indexOf(t)===-1)throw new Error("Invalid unit: "+t);return t}var Qt=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 en(e){return Qt[e]||"length"}import tn from"postcss-value-parser";function nn(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=nn(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=tn(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 sn=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),ln=new Set(["lineHeight"]),_t=[1,0,0,1,0,0];function fn(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"?sn.has(e)?ln.has(e)?n:String(n):n+"px":n}function un(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=rn(a);Object.assign(t,un(r,e[a])||fn(r,on(r,St(r,e[a]),!0),e[a],e.color||n.color))}if(t.backgroundImage){let{backgrounds:a}=an(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 Tt({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(A=>le(A,"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:L,filter:M,_inheritedBackgroundClipTextPath:W}=o,N=o.fontSize,S=i.getEngine(N,L,o),H=d?l.filter(A=>!S.check(A)):[];yield H,H.length&&(S=i.getEngine(N,L,o));let T=[],k=[],X=[],q=[],Q=new Map,w=A=>{let O=0;for(let F of A){if(Q.has(F)){O+=Q.get(F);continue}let Y=S.measure(F,o);Q.set(F,Y),O+=Y}return O},$=0,R=[],p=0;for(let A of l){let O=!1,F=c&&c[A];_==="pre"?O=A[0]===`
`:_!=="nowrap"&&(F||ye.includes(A[0]))&&(O=!0),O?(_==="nowrap"?p+=w(R)+o.fontSize:($=Math.max($,w(R)),F&&($=Math.max($,o.fontSize))),R=[]):(!ye.includes(A[0])||!R.length)&&R.push(A===`
`?" ":A)}$=Math.max($,w(R)+p);let E=r.getMinWidth(),I=r.getMaxWidth(),Z=r.getWidth();isNaN(Z.value)&&(isNaN(E.value)||E.unit===1&&E.value>$)&&(isNaN(I.value)||I.unit===1&&($=Math.min($,I.value)),r.setMinWidth($)),typeof o.flexShrink=="undefined"&&r.setFlexShrink(1);let he=_==="pre-wrap"||_==="pre";u.setMeasureFunc(A=>{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=w([F]),q[re]=null;else{let ae=he&&D===`
`,V=ae?0:c&&c[D]?o.fontSize:w([D]);U||(F="",Y=0);let B=Y||",.!?:-@)>]}%#".indexOf(D[0])<0,J=!U||!!Y;if(ae||re&&B&&U+Y+V>A&&_!=="nowrap"&&_!=="pre")T.push(U),k.push(oe),O++,ie+=P,U=V,P=V?S.height(D):0,oe=V?S.baseline(D):0,X.push(1),j=-1,ae||(z=Math.max(z,A));else{U+=Y+V;let me=S.height(D);me>P&&(P=me,oe=S.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),k.push(oe),ie+=P),{width:z,height:ie}});let[kt,It]=yield,Oe="",Se="",ne=a._inheritedClipPathId,{left:rt,top:it,width:Te,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:we}=Tt({left:rt,top:it,width:Te,height:ot,isInheritingTransform:f},o),be="";o.textShadowOffset&&(be=ce({width:Te,height:ot,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let Re="",ve="",at="",$e=-1,st=y==="ellipsis"?w(["\u2026"]):0,At=y==="ellipsis"?w([" "]):0,Ce={};for(let A=0;A<l.length;A++){if(!q[A])continue;let O=q[A],F=l[A],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=Te-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?Te: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+w([J+ft]);if(J&&ut+st>Fe)break;J+=ft,me=ut}F=J+"\u2026",$e=P,Ce[P][1]=me}let re=k[P],D=S.baseline(F),ae=S.height(F),V=re-D;if(U?z+=0:g?(Y=S.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[A+1])==null?void 0:lt.line)||$e===P)){let B=Ce[P];B&&!B[2]&&(Re+=ze({left:de+B[0],top:pe+ae*+P,width:B[1],ascender:S.baseline(F),clipPathId:ne},o),B[2]=1)}if(Y!==null)ve+=Y+" ";else{let[B,J]=Ue({content:F,filter:be,id:s,left:de+j,top:pe+z,width:ie,height:ae,matrix:ee,opacity:we,image:U,clipPathId:ne,debug:m,shape:!!W,decorationShape:Re},o);Oe+=B,Se+=J,Re=""}}if(ve){let A=o.color!=="transparent"&&we!==0?x("path",{fill:o.color,d:ve,transform:ee||void 0,opacity:we!==1?we: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+=(be?`${be}<g filter="url(#satori_s-${s})">`:"")+A+Re+(be?"</g>":"")+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 L(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,I){return s(E,function(Z){var he=I();return he&&($(e.comma)||t("Missing comma before color stops")),{type:p,orientation:he,colorStops:L(M)}})}function s(p,E){var I=$(p);if(I){$(e.startCall)||t("Missing (");var Z=E(I);return $(e.endCall)||t("Missing )"),Z}}function f(){return m()||g()}function m(){return w("directional",e.sideOrCorner,1)}function g(){return w("angular",e.angleValue,1)}function c(){var p,E=d(),I;return E&&(p=[],p.push(E),I=n,$(e.comma)&&(E=d(),E?p.push(E):n=I)),p}function d(){var p=h()||l();if(p)p.at=b();else{var E=u();if(E){p=E;var I=b();I&&(p.at=I)}else{var Z=y();Z&&(p={type:"default-radial",at:Z})}}return p}function h(){var p=w("shape",/^(circle)/i,0);return p&&(p.style=Q()||u()),p}function l(){var p=w("shape",/^(ellipse)/i,0);return p&&(p.style=X()||u()),p}function u(){return w("extent-keyword",e.extentKeywords,1)}function b(){if(w("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 L(p){var E=p(),I=[];if(E)for(I.push(E);$(e.comma);)E=p(),E?I.push(E):t("One extra comma");return I}function M(){var p=W();return p||t("Expected color definition"),p.length=X(),p}function W(){return S()||T()||H()||N()}function N(){return w("literal",e.literalColor,0)}function S(){return w("hex",e.hexColor,1)}function H(){return s(e.rgbColor,function(){return{type:"rgb",value:L(k)}})}function T(){return s(e.rgbaColor,function(){return{type:"rgba",value:L(k)}})}function k(){return $(e.number)[1]}function X(){return w("%",e.percentageValue,1)||q()||Q()}function q(){return w("position-keyword",e.positionKeywords,1)}function Q(){return w("px",e.pixelValue,1)||w("em",e.emValue,1)}function w(p,E,I){var Z=$(E);if(Z)return{type:p,value:Z[I]}}function $(p){var E,I;return I=/^[\n\r\t\s]+/.exec(n),I&&R(I[0].length),E=p.exec(n),E&&R(E[0].length),E}function R(p){n=n.substr(p)}return function(p){return n=p.toString(),o()}}();var Ke=Je;function cn(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 dn(e,n){return typeof e=="string"&&e.endsWith("%")?n*parseFloat(e)/100:+e}function wt(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)=>dn(r,[n,t][i]))}function Rt(e,n){let t=[];for(let i of n){let s=cn(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=wt(a,{x:n,y:t,defaultX:n,defaultY:t}),g=wt(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),L=Math.sin(y);d=0,h=0,l=_,u=L,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),L=`satori_radial_${e}`,M=`satori_pattern_${e}`,W={},N=Math.max(Math.abs(h-b),Math.abs(b)),S=Math.max(Math.abs(l-y),Math.abs(y));if(u==="circle")W.r=Math.sqrt(N*N+S*S);else if(u==="ellipse"){let k=S!==0?N/S:1;W.ry=Math.sqrt(N*N+S*S*k*k)/k,W.rx=W.ry*k}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:L},_.map(k=>x("stop",{offset:k.offset,"stop-color":k.color})).join(""))+x(u,se(G({cx:b,cy:y,width:h,height:l},W),{fill:`url(#${L})`})));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,k)=>qe({id:e+"_"+k,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),L=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":L?`url(#${L})`:void 0})),h.length||h.push("transparent");let{backgroundClip:W,filter:N}=s,S=h.map((H,T)=>{if(H==="transparent"&&!(T===h.length-1&&g))return"";let k=T===h.length-1&&g&&W!=="text";return x(f,{x:n,y:t,width:o,height:a,fill:H,stroke:k?m:void 0,"stroke-width":k?g:void 0,d:y||void 0,transform:c||void 0,"clip-path":W==="text"?`url(#satori_bct-${e})`:L?`url(#${L})`:void 0,style:N?`filter:${N}`:void 0})}).join("");return W==="text"&&g&&(S=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":L?`url(#${L})`:void 0})+S),(d?`<defs>${d}</defs>`:"")+_+(M?`${M}<g filter="url(#satori_s-${e})">`:"")+(l!==1?`<g opacity="${l}">`:"")+(b||S)+(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 R;if(!We(e))R=Ve(String(e),n),yield R.next().value;else{if(mt(e.type))throw new Error("Class component is not supported.");R=_e(e.type(e.props),n),yield R.next().value}R.next();let p=yield;return R.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 R={value:""};y._inheritedBackgroundClipTextPath=R,b._inheritedBackgroundClipTextPath=R}let L=typeof l=="undefined"?[]:[].concat(l),M=[],W=0,N=[];for(let R of L){let p=_e(R,{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 R of M)R.next();let[S,H]=yield;b.position==="absolute"&&u.calculateLayout();let{left:T,top:k,width:X,height:q}=u.getComputedLayout();T+=S,k+=H;let Q="",w="",$="";c==="img"?w=et({id:o,left:T,top:k,width:X,height:q,src:d.src,isInheritingTransform:_,debug:s},b):w=Qe({id:o,left:T,top:k,width:X,height:q,isInheritingTransform:_,debug:s},b);for(let R of M)Q+=R.next([T,k]).value;return b._inheritedBackgroundClipTextPath&&($+=x("clipPath",{id:`satori_bct-${o}`,"clip-path":b._inheritedClipPathId?`url(#${b._inheritedClipPathId})`:void 0},b._inheritedBackgroundClipTextPath.value)),$+w+Q}import pn from"@shuding/opentype.js";function mn(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];mn(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=pn.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((_,L)=>!!_.charToGlyphIndex(l)||u&&L===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),_=b-y,M=h.height(l,u)-_,{yMax:W,yMin:N}=u.tables.head,S=W/(W-N);return M+S*_},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 console.log(e,n),n;return console.log(e),"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,Nt as init};
//# sourceMappingURL=index.wasm.js.map

@@ -27,3 +27,2 @@ import { ReactNode } from 'react';

graphemeImages?: Record<string, string>;
detectLanguage?: (segment: string) => Promise<string> | string;
loadAdditionalAsset?: (languageCode: string, segment: string) => Promise<FontOptions | string | undefined>;

@@ -30,0 +29,0 @@ }

{
"name": "satori",
"version": "0.0.22",
"version": "0.0.23",
"description": "Satori converts HTML JSX to SVG string.",

@@ -42,3 +42,3 @@ "module": "./dist/esm/index.js",

"devDependencies": {
"@types/node": "^17.0.13",
"@types/node": "^16",
"@types/opentype.js": "^1.3.3",

@@ -45,0 +45,0 @@ "@types/react": "^17.0.38",

@@ -7,3 +7,3 @@ <h1 align="center">

Satori translates the layout and styles of HTML & CSS based elements into an SVG image.
Satori converts HTML and CSS into SVG.

@@ -27,5 +27,6 @@ ```jsx

],
embedFont: true, // Embed the font in SVG as path data. Optional, default: true.
debug: false, // Show the bounding box for debugging. Optional, default: false.
graphemeImages: {} // Custom grapheme images. Optional, default: empty.
embedFont: true, // Embed the font in SVG as path data. Optional, default: true.
debug: false, // Show the bounding box for debugging. Optional, default: false.
graphemeImages: {}, // Custom grapheme images, see "Emojis". Optional, default: empty.
loadAdditionalAsset, // See "Dynamically Load Emojis and Fonts" below. Optional.
},

@@ -97,4 +98,6 @@ )

### CSS Properties
### CSS
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:
| Property | Supported Values |

@@ -162,2 +165,32 @@ | --- | --- |

#### Fonts
Satori currently supports three font formats: TTF, OTF and WOFF. Note that WOFF2 is not supported at the moment. You must specify the font if any text is rendered with Satori, and pass the font data as ArrayBuffer (web) or Buffer (Node.js):
```js
await satori(
<div style={{ fontFamily: 'Inter' }}>Hello</div>,
{
width: 600,
height: 400,
fonts: [
{
name: 'Inter',
data: inter,
weight: 400,
style: 'normal',
},
{
name: 'Inter',
data: interBold,
weight: 700,
style: 'normal',
},
],
}
)
```
Multiple fonts can be passed to Satori and used in `fontFamily`.
#### Emojis

@@ -183,3 +216,3 @@

Satori supports an option to dynamically load emoji images (grapheme pictures) and fonts when they're used but missing:
Satori supports dynamically loading emoji images (grapheme pictures) and fonts. The `loadAdditionalAsset` function will be called when a text segment is rendered but missing the image or font:

@@ -193,4 +226,6 @@ ```jsx

loadAdditionalAsset: async (code: string, segment: string) => {
// if segment is an emoji
return `data:image/svg+xml;base64,...`
if (code === 'emoji') {
// if segment is an emoji
return `data:image/svg+xml;base64,...`
}

@@ -204,2 +239,18 @@ // if segment is normal text

### Runtime and WASM
Satori can be used in browser, Node.js (>= 16), and Web Workers.
By default, Satori depends on asm.js for the browser runtime, and native module in Node.js. However, you can optionally load WASM instead by importing `satori/wasm` and provide the initialized WASM module instance of Yoga to Satori:
```js
import satori, { init } from 'satori/wasm'
import initYoga from 'yoga-wasm-web'
const yoga = initYoga(await fetch('/yoga.wasm').then(res => res.arrayBuffer()))
init(yoga)
await satori(...)
```
## Contribute

@@ -206,0 +257,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc