@svgsketch/cli 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,156 @@
1
+ #!/usr/bin/env node
2
+ var fN=Object.create;var qc=Object.defineProperty;var pN=Object.getOwnPropertyDescriptor;var hN=Object.getOwnPropertyNames;var mN=Object.getPrototypeOf,gN=Object.prototype.hasOwnProperty;var Yl=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},yN=(e,t)=>{for(var r in t)qc(e,r,{get:t[r],enumerable:!0})},vN=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hN(t))!gN.call(e,i)&&i!==r&&qc(e,i,{get:()=>t[i],enumerable:!(n=pN(t,i))||n.enumerable});return e};var bN=(e,t,r)=>(r=e!=null?fN(mN(e)):{},vN(t||!e||!e.__esModule?qc(r,"default",{value:e,enumerable:!0}):r,e));var fg=Yl(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.CHAR=`
3
+ \r -\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}`;bt.S=` \r
4
+ `;bt.NAME_START_CHAR=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";bt.NAME_CHAR="-"+bt.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";bt.CHAR_RE=new RegExp("^["+bt.CHAR+"]$","u");bt.S_RE=new RegExp("^["+bt.S+"]+$","u");bt.NAME_START_CHAR_RE=new RegExp("^["+bt.NAME_START_CHAR+"]$","u");bt.NAME_CHAR_RE=new RegExp("^["+bt.NAME_CHAR+"]$","u");bt.NAME_RE=new RegExp("^["+bt.NAME_START_CHAR+"]["+bt.NAME_CHAR+"]*$","u");bt.NMTOKEN_RE=new RegExp("^["+bt.NAME_CHAR+"]+$","u");var Yc=9,Kc=10,Zc=13,Jc=32;bt.S_LIST=[Jc,Kc,Zc,Yc];function xN(e){return e>=Jc&&e<=55295||e===Kc||e===Zc||e===Yc||e>=57344&&e<=65533||e>=65536&&e<=1114111}bt.isChar=xN;function wN(e){return e===Jc||e===Kc||e===Zc||e===Yc}bt.isS=wN;function cg(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}bt.isNameStartChar=cg;function IN(e){return cg(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}bt.isNameChar=IN});var vg=Yl(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.CHAR="-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}";nt.RESTRICTED_CHAR="-\b\v\f-\x7F-\x84\x86-\x9F";nt.S=` \r
5
+ `;nt.NAME_START_CHAR=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";nt.NAME_CHAR="-"+nt.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";nt.CHAR_RE=new RegExp("^["+nt.CHAR+"]$","u");nt.RESTRICTED_CHAR_RE=new RegExp("^["+nt.RESTRICTED_CHAR+"]$","u");nt.S_RE=new RegExp("^["+nt.S+"]+$","u");nt.NAME_START_CHAR_RE=new RegExp("^["+nt.NAME_START_CHAR+"]$","u");nt.NAME_CHAR_RE=new RegExp("^["+nt.NAME_CHAR+"]$","u");nt.NAME_RE=new RegExp("^["+nt.NAME_START_CHAR+"]["+nt.NAME_CHAR+"]*$","u");nt.NMTOKEN_RE=new RegExp("^["+nt.NAME_CHAR+"]+$","u");var pg=9,hg=10,mg=13,gg=32;nt.S_LIST=[gg,hg,mg,pg];function kN(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}nt.isChar=kN;function SN(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}nt.isRestrictedChar=SN;function $N(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}nt.isCharAndNotRestricted=$N;function NN(e){return e===gg||e===hg||e===mg||e===pg}nt.isS=NN;function yg(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}nt.isNameStartChar=yg;function MN(e){return yg(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}nt.isNameChar=MN});var xg=Yl(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.NC_NAME_START_CHAR="A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";Rr.NC_NAME_CHAR="-"+Rr.NC_NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";Rr.NC_NAME_START_CHAR_RE=new RegExp("^["+Rr.NC_NAME_START_CHAR+"]$","u");Rr.NC_NAME_CHAR_RE=new RegExp("^["+Rr.NC_NAME_CHAR+"]$","u");Rr.NC_NAME_RE=new RegExp("^["+Rr.NC_NAME_START_CHAR+"]["+Rr.NC_NAME_CHAR+"]*$","u");function bg(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}Rr.isNCNameStartChar=bg;function AN(e){return bg(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}Rr.isNCNameChar=AN});var Lg=Yl(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.SaxesParser=Wa.EVENTS=void 0;var Xa=fg(),CN=vg(),pf=xg(),_r=Xa.isS,ON=Xa.isChar,ys=Xa.isNameStartChar,wg=Xa.isNameChar,Eg=Xa.S_LIST,TN=Xa.NAME_RE,PN=CN.isChar,DN=pf.isNCNameStartChar,jN=pf.isNCNameChar,EN=pf.NC_NAME_RE,tu="http://www.w3.org/XML/1998/namespace",Ga="http://www.w3.org/2000/xmlns/",zN={__proto__:null,xml:tu,xmlns:Ga},RN={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},kt=-1,jn=-2,Ig=0,_N=1,Qc=2,FN=3,Ba=4,LN=5,BN=6,VN=7,ef=8,UN=9,GN=10,WN=11,XN=12,Or=13,Kl=14,tf=15,HN=16,rf=17,qN=18,YN=19,nf=20,KN=21,ZN=22,JN=23,kg=24,af=25,Zl=26,Sg=27,QN=28,eM=29,$g=30,tM=31,rM=32,Ji=33,nM=34,of=35,vs=36,sf=37,iM=38,Ng=39,Mg=40,aM=41,Ag=42,oM=43,sM=44,lf=9,yn=10,uf=13,Cg=32,Og=33,zg=34,bs=38,Rg=39,Jl=45,Ql=47,lM=59,Ii=60,Va=61,tr=62,fr=63,_g=91,Ua=93,Tg=133,Pg=8232,eu=e=>e===zg||e===Rg,Fg=[zg,Rg],uM=[...Fg,_g,tr],dM=[...Fg,Ii,Ua],cM=[Va,fr,...Eg],fM=[...Eg,tr,bs,Ii];function cf(e,t,r){switch(t){case"xml":r!==tu&&e.fail(`xml prefix must be bound to ${tu}.`);break;case"xmlns":r!==Ga&&e.fail(`xmlns prefix must be bound to ${Ga}.`);break;default:}switch(r){case Ga:e.fail(t===""?`the default namespace may not be set to ${r}.`:`may not assign a prefix (even "xmlns") to the URI ${Ga}.`);break;case tu:switch(t){case"xml":break;case"":e.fail(`the default namespace may not be set to ${r}.`);break;default:e.fail("may not assign the xml namespace to another prefix.")}break;default:}}function pM(e,t){for(let r of Object.keys(t))cf(e,r,t[r])}var hM=e=>EN.test(e),mM=e=>TN.test(e),Qi=0,Dg=1,df=2;Wa.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var jg={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"},ff=class{constructor(t){this.opt=t??{},this.fragmentOpt=!!this.opt.fragment;let r=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,r){this.nameStartCheck=DN,this.nameCheck=jN,this.isName=hM,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},zN);let n=this.opt.additionalNamespaces;n!=null&&(pM(this,n),Object.assign(this.ns,n))}else this.nameStartCheck=ys,this.nameCheck=wg,this.isName=mM,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}get closed(){return this._closed}_init(){var t;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=Qi,this.attribList=[];let{fragmentOpt:r}=this;this.state=r?Or:Ig,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=r,this.xmlDeclPossible=!r,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");n="1.0"}this.setXMLVersion(n),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(RN),(t=this.readyHandler)===null||t===void 0||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,r){this[jg[t]]=r}off(t){this[jg[t]]=void 0}makeError(t){var r;let n=(r=this.fileName)!==null&&r!==void 0?r:"";return this.trackPosition&&(n.length>0&&(n+=":"),n+=`${this.line}:${this.column}`),n.length>0&&(n+=": "),new Error(n+t)}fail(t){let r=this.makeError(t),n=this.errorHandler;if(n===void 0)throw r;return n(r),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let r=!1;t===null?(r=!0,t=""):typeof t=="object"&&(t=t.toString()),this.carriedFromPrevious!==void 0&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let n=t.length,i=t.charCodeAt(n-1);!r&&(i===uf||i>=55296&&i<=56319)&&(this.carriedFromPrevious=t[n-1],n--,t=t.slice(0,n));let{stateTable:a}=this;for(this.chunk=t,this.i=0;this.i<n;)a[this.state].call(this);return this.chunkPosition+=n,r?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:t,i:r}=this;if(this.prevI=r,this.i=r+1,r>=t.length)return kt;let n=t.charCodeAt(r);if(this.column++,n<55296){if(n>=Cg||n===lf)return n;switch(n){case yn:return this.line++,this.column=0,this.positionAtNewLine=this.position,yn;case uf:return t.charCodeAt(r+1)===yn&&(this.i=r+2),this.line++,this.column=0,this.positionAtNewLine=this.position,jn;default:return this.fail("disallowed character."),n}}if(n>56319)return n>=57344&&n<=65533||this.fail("disallowed character."),n;let i=65536+(n-55296)*1024+(t.charCodeAt(r+1)-56320);return this.i=r+2,i>1114111&&this.fail("disallowed character."),i}getCode11(){let{chunk:t,i:r}=this;if(this.prevI=r,this.i=r+1,r>=t.length)return kt;let n=t.charCodeAt(r);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==Pg||n===lf)return n;switch(n){case yn:return this.line++,this.column=0,this.positionAtNewLine=this.position,yn;case uf:{let a=t.charCodeAt(r+1);(a===yn||a===Tg)&&(this.i=r+2)}case Tg:case Pg:return this.line++,this.column=0,this.positionAtNewLine=this.position,jn;default:return this.fail("disallowed character."),n}}if(n>56319)return n>=57344&&n<=65533||this.fail("disallowed character."),n;let i=65536+(n-55296)*1024+(t.charCodeAt(r+1)-56320);return this.i=r+2,i>1114111&&this.fail("disallowed character."),i}getCodeNorm(){let t=this.getCode();return t===jn?yn:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:r}=this,{chunk:n}=this;for(;;){let i=this.getCode(),a=i===jn,o=a?yn:i;if(o===kt||t.includes(o))return this.text+=n.slice(r,this.prevI),o;a&&(this.text+=`${n.slice(r,this.prevI)}
6
+ `,r=this.i)}}captureToChar(t){let{i:r}=this,{chunk:n}=this;for(;;){let i=this.getCode();switch(i){case jn:this.text+=`${n.slice(r,this.prevI)}
7
+ `,r=this.i,i=yn;break;case kt:return this.text+=n.slice(r),!1;default:}if(i===t)return this.text+=n.slice(r,this.prevI),!0}}captureNameChars(){let{chunk:t,i:r}=this;for(;;){let n=this.getCode();if(n===kt)return this.name+=t.slice(r),kt;if(!wg(n))return this.name+=t.slice(r,this.prevI),n===jn?yn:n}}skipSpaces(){for(;;){let t=this.getCodeNorm();if(t===kt||!_r(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,t==="1.0"?(this.isChar=ON,this.getCode=this.getCode10):(this.isChar=PN,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=_N}sBeginWhitespace(){let t=this.i,r=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),r){case Ii:if(this.state=tf,this.text.length!==0)throw new Error("no-empty text at start");break;case kt:break;default:this.unget(),this.state=Or,this.xmlDeclPossible=!1}}sDoctype(){var t;let r=this.captureTo(uM);switch(r){case tr:{(t=this.doctypeHandler)===null||t===void 0||t.call(this,this.text),this.text="",this.state=Or,this.doctype=!0;break}case kt:break;default:this.text+=String.fromCodePoint(r),r===_g?this.state=Ba:eu(r)&&(this.state=FN,this.q=r)}}sDoctypeQuote(){let t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=Qc)}sDTD(){let t=this.captureTo(dM);t!==kt&&(this.text+=String.fromCodePoint(t),t===Ua?this.state=Qc:t===Ii?this.state=BN:eu(t)&&(this.state=LN,this.q=t))}sDTDQuoted(){let t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=Ba,this.q=null)}sDTDOpenWaka(){let t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case Og:this.state=VN,this.openWakaBang="";break;case fr:this.state=WN;break;default:this.state=Ba}}sDTDOpenWakaBang(){let t=String.fromCodePoint(this.getCodeNorm()),r=this.openWakaBang+=t;this.text+=t,r!=="-"&&(this.state=r==="--"?ef:Ba,this.openWakaBang="")}sDTDComment(){this.captureToChar(Jl)&&(this.text+="-",this.state=UN)}sDTDCommentEnding(){let t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=t===Jl?GN:ef}sDTDCommentEnded(){let t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===tr?this.state=Ba:(this.fail("malformed comment."),this.state=ef)}sDTDPI(){this.captureToChar(fr)&&(this.text+="?",this.state=XN)}sDTDPIEnding(){let t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===tr&&(this.state=Ba)}sText(){this.tags.length!==0?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this,{chunk:r}=this;e:for(;;)switch(this.getCode()){case jn:this.entity+=`${r.slice(t,this.prevI)}
8
+ `,t=this.i;break;case lM:{let{entityReturnState:n}=this,i=this.entity+r.slice(t,this.prevI);this.state=n;let a;i===""?(this.fail("empty entity name."),a="&;"):(a=this.parseEntity(i),this.entity=""),(n!==Or||this.textHandler!==void 0)&&(this.text+=a);break e}case kt:this.entity+=r.slice(t);break e;default:}}sOpenWaka(){let t=this.getCode();if(ys(t))this.state=nM,this.unget(),this.xmlDeclPossible=!1;else switch(t){case Ql:this.state=oM,this.xmlDeclPossible=!1;break;case Og:this.state=HN,this.openWakaBang="",this.xmlDeclPossible=!1;break;case fr:this.state=JN;break;default:this.fail("disallowed character in tag name"),this.state=Or,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=nf,this.openWakaBang="";break;case"--":this.state=rf,this.openWakaBang="";break;case"DOCTYPE":this.state=Qc,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(Jl)&&(this.state=qN)}sCommentEnding(){var t;let r=this.getCodeNorm();r===Jl?(this.state=YN,(t=this.commentHandler)===null||t===void 0||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(r)}`,this.state=rf)}sCommentEnded(){let t=this.getCodeNorm();t!==tr?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=rf):this.state=Or}sCData(){this.captureToChar(Ua)&&(this.state=KN)}sCDataEnding(){let t=this.getCodeNorm();t===Ua?this.state=ZN:(this.text+=`]${String.fromCodePoint(t)}`,this.state=nf)}sCDataEnding2(){var t;let r=this.getCodeNorm();switch(r){case tr:{(t=this.cdataHandler)===null||t===void 0||t.call(this,this.text),this.text="",this.state=Or;break}case Ua:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(r)}`,this.state=nf}}sPIFirstChar(){let t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=kg):t===fr||_r(t)?(this.fail("processing instruction without a target."),this.state=t===fr?Zl:af):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=kg)}sPIRest(){let{chunk:t,i:r}=this;for(;;){let n=this.getCodeNorm();if(n===kt){this.piTarget+=t.slice(r);return}if(!this.nameCheck(n)){this.piTarget+=t.slice(r,this.prevI);let i=n===fr;i||_r(n)?this.piTarget==="xml"?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=i?Ji:Sg):this.state=i?Zl:af:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let t=this.getCodeNorm();t===fr?this.state=Zl:_r(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(fr)&&(this.state=Zl)}sPIEnding(){var t;let r=this.getCodeNorm();if(r===tr){let{piTarget:n}=this;n.toLowerCase()==="xml"&&this.fail("the XML declaration must appear at the start of the document."),(t=this.piHandler)===null||t===void 0||t.call(this,{target:n,body:this.text}),this.piTarget=this.text="",this.state=Or}else r===fr?this.text+="?":(this.text+=`?${String.fromCodePoint(r)}`,this.state=af);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let t=this.skipSpaces();if(t===fr){this.state=Ji;return}t!==kt&&(this.state=QN,this.name=String.fromCodePoint(t))}sXMLDeclName(){let t=this.captureTo(cM);if(t===fr){this.state=Ji,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(_r(t)||t===Va){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=t===Va?$g:eM}}sXMLDeclEq(){let t=this.getCodeNorm();if(t===fr){this.state=Ji,this.fail("XML declaration is incomplete.");return}_r(t)||(t!==Va&&this.fail("value required."),this.state=$g)}sXMLDeclValueStart(){let t=this.getCodeNorm();if(t===fr){this.state=Ji,this.fail("XML declaration is incomplete.");return}_r(t)||(eu(t)?this.q=t:(this.fail("value must be quoted."),this.q=Cg),this.state=tM)}sXMLDeclValue(){let t=this.captureTo([this.q,fr]);if(t===fr){this.state=Ji,this.text="",this.fail("XML declaration is incomplete.");return}if(t===kt)return;let r=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let n=r;this.xmlDecl.version=n,/^1\.[0-9]+$/.test(n)?this.opt.forceXMLVersion||this.setXMLVersion(n):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(r)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=r;break;case"standalone":r!=="yes"&&r!=="no"&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=r;break;default:}this.name="",this.state=rM}sXMLDeclSeparator(){let t=this.getCodeNorm();if(t===fr){this.state=Ji;return}_r(t)||(this.fail("whitespace required."),this.unget()),this.state=Sg}sXMLDeclEnding(){var t;this.getCodeNorm()===tr?(this.piTarget!=="xml"?this.fail("processing instructions are not allowed before root."):this.name!=="version"&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),(t=this.xmldeclHandler)===null||t===void 0||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=Or):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;let r=this.captureNameChars();if(r===kt)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(t=this.openTagStartHandler)===null||t===void 0||t.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),r){case tr:this.openTag();break;case Ql:this.state=of;break;default:_r(r)||this.fail("disallowed character in tag name."),this.state=vs}}sOpenTagSlash(){this.getCode()===tr?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=vs)}sAttrib(){let t=this.skipSpaces();t!==kt&&(ys(t)?(this.unget(),this.state=sf):t===tr?this.openTag():t===Ql?this.state=of:this.fail("disallowed character in attribute name."))}sAttribName(){let t=this.captureNameChars();t===Va?this.state=Ng:_r(t)?this.state=iM:t===tr?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==kt&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){let t=this.skipSpaces();switch(t){case kt:return;case Va:this.state=Ng;break;default:this.fail("attribute without value."),this.text="",this.name="",t===tr?this.openTag():ys(t)?(this.unget(),this.state=sf):(this.fail("disallowed character in attribute name."),this.state=vs)}}sAttribValue(){let t=this.getCodeNorm();eu(t)?(this.q=t,this.state=Mg):_r(t)||(this.fail("unquoted attribute value."),this.state=Ag,this.unget())}sAttribValueQuoted(){let{q:t,chunk:r}=this,{i:n}=this;for(;;)switch(this.getCode()){case t:this.pushAttrib(this.name,this.text+r.slice(n,this.prevI)),this.name=this.text="",this.q=null,this.state=aM;return;case bs:this.text+=r.slice(n,this.prevI),this.state=Kl,this.entityReturnState=Mg;return;case yn:case jn:case lf:this.text+=`${r.slice(n,this.prevI)} `,n=this.i;break;case Ii:this.text+=r.slice(n,this.prevI),this.fail("disallowed character.");return;case kt:this.text+=r.slice(n);return;default:}}sAttribValueClosed(){let t=this.getCodeNorm();_r(t)?this.state=vs:t===tr?this.openTag():t===Ql?this.state=of:ys(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=sf):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){let t=this.captureTo(fM);switch(t){case bs:this.state=Kl,this.entityReturnState=Ag;break;case Ii:this.fail("disallowed character.");break;case kt:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===tr?this.openTag():this.state=vs}}sCloseTag(){let t=this.captureNameChars();t===tr?this.closeTag():_r(t)?this.state=sM:t!==kt&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case tr:this.closeTag();break;case kt:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:r}=this,{chunk:n,textHandler:i}=this;e:for(;;)switch(this.getCode()){case Ii:{if(this.state=tf,i!==void 0){let{text:a}=this,o=n.slice(t,this.prevI);a.length!==0?(i(a+o),this.text=""):o.length!==0&&i(o)}r=Qi;break e}case bs:this.state=Kl,this.entityReturnState=Or,i!==void 0&&(this.text+=n.slice(t,this.prevI)),r=Qi;break e;case Ua:switch(r){case Qi:r=Dg;break;case Dg:r=df;break;case df:break;default:throw new Error("impossible state")}break;case tr:r===df&&this.fail('the string "]]>" is disallowed in char data.'),r=Qi;break;case jn:i!==void 0&&(this.text+=`${n.slice(t,this.prevI)}
9
+ `),t=this.i,r=Qi;break;case kt:i!==void 0&&(this.text+=n.slice(t));break e;default:r=Qi}this.forbiddenState=r}handleTextOutsideRoot(){let{i:t}=this,{chunk:r,textHandler:n}=this,i=!1;e:for(;;){let a=this.getCode();switch(a){case Ii:{if(this.state=tf,n!==void 0){let{text:o}=this,s=r.slice(t,this.prevI);o.length!==0?(n(o+s),this.text=""):s.length!==0&&n(s)}break e}case bs:this.state=Kl,this.entityReturnState=Or,n!==void 0&&(this.text+=r.slice(t,this.prevI)),i=!0;break e;case jn:n!==void 0&&(this.text+=`${r.slice(t,this.prevI)}
10
+ `),t=this.i;break;case kt:n!==void 0&&(this.text+=r.slice(t));break e;default:_r(a)||(i=!0)}}i&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(t,r){var n;let{prefix:i,local:a}=this.qname(t),o={name:t,prefix:i,local:a,value:r};if(this.attribList.push(o),(n=this.attributeHandler)===null||n===void 0||n.call(this,o),i==="xmlns"){let s=r.trim();this.currentXMLVersion==="1.0"&&s===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[a]=s,cf(this,a,s)}else if(t==="xmlns"){let s=r.trim();this.topNS[""]=s,cf(this,"",s)}}pushAttribPlain(t,r){var n;let i={name:t,value:r};this.attribList.push(i),(n=this.attributeHandler)===null||n===void 0||n.call(this,i)}end(){var t,r;this.sawRoot||this.fail("document must contain a root element.");let{tags:n}=this;for(;n.length>0;){let a=n.pop();this.fail(`unclosed tag: ${a.name}`)}this.state!==Ig&&this.state!==Or&&this.fail("unexpected end.");let{text:i}=this;return i.length!==0&&((t=this.textHandler)===null||t===void 0||t.call(this,i),this.text=""),this._closed=!0,(r=this.endHandler)===null||r===void 0||r.call(this),this._init(),this}resolve(t){var r,n;let i=this.topNS[t];if(i!==void 0)return i;let{tags:a}=this;for(let o=a.length-1;o>=0;o--)if(i=a[o].ns[t],i!==void 0)return i;return i=this.ns[t],i!==void 0?i:(n=(r=this.opt).resolvePrefix)===null||n===void 0?void 0:n.call(r,t)}qname(t){let r=t.indexOf(":");if(r===-1)return{prefix:"",local:t};let n=t.slice(r+1),i=t.slice(0,r);return(i===""||n===""||n.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:i,local:n}}processAttribsNS(){var t;let{attribList:r}=this,n=this.tag;{let{prefix:o,local:s}=this.qname(n.name);n.prefix=o,n.local=s;let l=n.uri=(t=this.resolve(o))!==null&&t!==void 0?t:"";o!==""&&(o==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),l===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(o)}.`),n.uri=o))}if(r.length===0)return;let{attributes:i}=n,a=new Set;for(let o of r){let{name:s,prefix:l,local:u}=o,d,c;l===""?(d=s==="xmlns"?Ga:"",c=s):(d=this.resolve(l),d===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(l)}.`),d=l),c=`{${d}}${u}`),a.has(c)&&this.fail(`duplicate attribute: ${c}.`),a.add(c),o.uri=d,i[s]=o}this.attribList=[]}processAttribsPlain(){let{attribList:t}=this,r=this.tag.attributes;for(let{name:n,value:i}of t)r[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),r[n]=i;this.attribList=[]}openTag(){var t;this.processAttribs();let{tags:r}=this,n=this.tag;n.isSelfClosing=!1,(t=this.openTagHandler)===null||t===void 0||t.call(this,n),r.push(n),this.state=Or,this.name=""}openSelfClosingTag(){var t,r,n;this.processAttribs();let{tags:i}=this,a=this.tag;a.isSelfClosing=!0,(t=this.openTagHandler)===null||t===void 0||t.call(this,a),(r=this.closeTagHandler)===null||r===void 0||r.call(this,a),(this.tag=(n=i[i.length-1])!==null&&n!==void 0?n:null)===null&&(this.closedRoot=!0),this.state=Or,this.name=""}closeTag(){let{tags:t,name:r}=this;if(this.state=Or,this.name="",r===""){this.fail("weird empty close tag."),this.text+="</>";return}let n=this.closeTagHandler,i=t.length;for(;i-- >0;){let a=this.tag=t.pop();if(this.topNS=a.ns,n?.(a),a.name===r)break;this.fail("unexpected close tag.")}i===0?this.closedRoot=!0:i<0&&(this.fail(`unmatched closing tag: ${r}.`),this.text+=`</${r}>`)}parseEntity(t){if(t[0]!=="#"){let n=this.ENTITIES[t];return n!==void 0?n:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let r=NaN;return t[1]==="x"&&/^#x[0-9a-f]+$/i.test(t)?r=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(r=parseInt(t.slice(1),10)),this.isChar(r)?String.fromCodePoint(r):(this.fail("malformed character entity."),`&${t};`)}};Wa.SaxesParser=ff});import{Command as PX,InvalidArgumentError as Vl}from"commander";import{readFile as L$,writeFile as Gl,access as B$}from"fs/promises";import{createRequire as DX}from"module";import{basename as Ul,resolve as Ra,extname as V$}from"path";var Hx=bN(Lg(),1);function vn(){return!0}function lt(){return!1}var he;(function(e){e.Attribute="attribute",e.Pseudo="pseudo",e.PseudoElement="pseudo-element",e.Tag="tag",e.Universal="universal",e.Adjacent="adjacent",e.Child="child",e.Descendant="descendant",e.Parent="parent",e.Sibling="sibling",e.ColumnCombinator="column-combinator"})(he||(he={}));var xt;(function(e){e.Any="any",e.Element="element",e.End="end",e.Equals="equals",e.Exists="exists",e.Hyphen="hyphen",e.Not="not",e.Start="start"})(xt||(xt={}));var Bg=/^[^#\\]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\u00B0-\uFFFF-])+/,gM=/\\([\da-f]{1,6}\s?|(\s)|.)/gi,Se;(function(e){e[e.LeftParenthesis=40]="LeftParenthesis",e[e.RightParenthesis=41]="RightParenthesis",e[e.LeftSquareBracket=91]="LeftSquareBracket",e[e.RightSquareBracket=93]="RightSquareBracket",e[e.Comma=44]="Comma",e[e.Period=46]="Period",e[e.Colon=58]="Colon",e[e.SingleQuote=39]="SingleQuote",e[e.DoubleQuote=34]="DoubleQuote",e[e.Plus=43]="Plus",e[e.Tilde=126]="Tilde",e[e.QuestionMark=63]="QuestionMark",e[e.ExclamationMark=33]="ExclamationMark",e[e.Slash=47]="Slash",e[e.Equal=61]="Equal",e[e.Dollar=36]="Dollar",e[e.Pipe=124]="Pipe",e[e.Circumflex=94]="Circumflex",e[e.Asterisk=42]="Asterisk",e[e.GreaterThan=62]="GreaterThan",e[e.LessThan=60]="LessThan",e[e.Hash=35]="Hash",e[e.LowerI=105]="LowerI",e[e.LowerS=115]="LowerS",e[e.BackSlash=92]="BackSlash",e[e.Space=32]="Space",e[e.Tab=9]="Tab",e[e.NewLine=10]="NewLine",e[e.FormFeed=12]="FormFeed",e[e.CarriageReturn=13]="CarriageReturn"})(Se||(Se={}));var yM=new Map([[Se.Tilde,xt.Element],[Se.Circumflex,xt.Start],[Se.Dollar,xt.End],[Se.Asterisk,xt.Any],[Se.ExclamationMark,xt.Not],[Se.Pipe,xt.Hyphen]]),vM=new Set(["has","not","matches","is","where","host","host-context"]),bM=new Set(["before","after","first-line","first-letter"]);function ru(e){switch(e.type){case he.Adjacent:case he.Child:case he.Descendant:case he.Parent:case he.Sibling:case he.ColumnCombinator:return!0;case he.Attribute:case he.Pseudo:case he.PseudoElement:case he.Tag:case he.Universal:return!1}}var xM=new Set(["contains","icontains"]);function wM(e,t,r){let n=Number.parseInt(t,16)-65536;return Number.isNaN(n)||r?t:n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,n&1023|56320)}function xs(e){return e.replace(gM,wM)}function hf(e){return e===Se.SingleQuote||e===Se.DoubleQuote}function Vg(e){return e===Se.Space||e===Se.Tab||e===Se.NewLine||e===Se.FormFeed||e===Se.CarriageReturn}function En(e){let t=[],r=Ug(t,`${e}`,0);if(r<e.length)throw new Error(`Unmatched selector: ${e.slice(r)}`);return t}function Ug(e,t,r){let n=[];function i(c){let f=t.slice(r+c).match(Bg);if(!f)throw new Error(`Expected name, found ${t.slice(r)}`);let[p]=f;return r+=c+p.length,xs(p)}function a(c){for(r+=c;r<t.length&&Vg(t.charCodeAt(r));)r++}function o(){r+=1;let c=r;for(let f=1;r<t.length;r++)switch(t.charCodeAt(r)){case Se.BackSlash:{r+=1;break}case Se.LeftParenthesis:{f+=1;break}case Se.RightParenthesis:{if(f-=1,f===0)return xs(t.slice(c,r++));break}}throw new Error("Parenthesis not matched")}function s(){if(n.length>0&&ru(n[n.length-1]))throw new Error("Did not expect successive traversals.")}function l(c){if(n.length>0&&n[n.length-1].type===he.Descendant){n[n.length-1].type=c;return}s(),n.push({type:c})}function u(c,f){n.push({type:he.Attribute,name:c,action:f,value:i(1),namespace:null,ignoreCase:"quirks"})}function d(){if(n.length>0&&n[n.length-1].type===he.Descendant&&n.pop(),n.length===0)throw new Error("Empty sub-selector");e.push(n)}if(a(0),t.length===r)return r;e:for(;r<t.length;){let c=t.charCodeAt(r);switch(c){case Se.Space:case Se.Tab:case Se.NewLine:case Se.FormFeed:case Se.CarriageReturn:{(n.length===0||n[0].type!==he.Descendant)&&(s(),n.push({type:he.Descendant})),a(1);break}case Se.GreaterThan:{l(he.Child),a(1);break}case Se.LessThan:{l(he.Parent),a(1);break}case Se.Tilde:{l(he.Sibling),a(1);break}case Se.Plus:{l(he.Adjacent),a(1);break}case Se.Period:{u("class",xt.Element);break}case Se.Hash:{u("id",xt.Equals);break}case Se.LeftSquareBracket:{a(1);let f,p=null;t.charCodeAt(r)===Se.Pipe?f=i(1):t.startsWith("*|",r)?(p="*",f=i(2)):(f=i(0),t.charCodeAt(r)===Se.Pipe&&t.charCodeAt(r+1)!==Se.Equal&&(p=f,f=i(1))),a(0);let h=xt.Exists,m=yM.get(t.charCodeAt(r));if(m){if(h=m,t.charCodeAt(r+1)!==Se.Equal)throw new Error("Expected `=`");a(2)}else t.charCodeAt(r)===Se.Equal&&(h=xt.Equals,a(1));let g="",v=null;if(h!=="exists"){if(hf(t.charCodeAt(r))){let y=t.charCodeAt(r);r+=1;let I=r;for(;r<t.length&&t.charCodeAt(r)!==y;)r+=t.charCodeAt(r)===Se.BackSlash?2:1;if(t.charCodeAt(r)!==y)throw new Error("Attribute value didn't end");g=xs(t.slice(I,r)),r+=1}else{let y=r;for(;r<t.length&&!Vg(t.charCodeAt(r))&&t.charCodeAt(r)!==Se.RightSquareBracket;)r+=t.charCodeAt(r)===Se.BackSlash?2:1;g=xs(t.slice(y,r))}switch(a(0),t.charCodeAt(r)|32){case Se.LowerI:{v=!0,a(1);break}case Se.LowerS:{v=!1,a(1);break}}}if(t.charCodeAt(r)!==Se.RightSquareBracket)throw new Error("Attribute selector didn't terminate");r+=1;let b={type:he.Attribute,name:f,action:h,value:g,namespace:p,ignoreCase:v};n.push(b);break}case Se.Colon:{if(t.charCodeAt(r+1)===Se.Colon){n.push({type:he.PseudoElement,name:i(2).toLowerCase(),data:t.charCodeAt(r)===Se.LeftParenthesis?o():null});break}let f=i(1).toLowerCase();if(bM.has(f)){n.push({type:he.PseudoElement,name:f,data:null});break}let p=null;if(t.charCodeAt(r)===Se.LeftParenthesis)if(vM.has(f)){if(hf(t.charCodeAt(r+1)))throw new Error(`Pseudo-selector ${f} cannot be quoted`);if(p=[],r=Ug(p,t,r+1),t.charCodeAt(r)!==Se.RightParenthesis)throw new Error(`Missing closing parenthesis in :${f} (${t})`);r+=1}else{if(p=o(),xM.has(f)){let h=p.charCodeAt(0);h===p.charCodeAt(p.length-1)&&hf(h)&&(p=p.slice(1,-1))}p=xs(p)}n.push({type:he.Pseudo,name:f,data:p});break}case Se.Comma:{d(),n=[],a(1);break}default:{if(t.startsWith("/*",r)){let h=t.indexOf("*/",r+2);if(h===-1)throw new Error("Comment was not terminated");r=h+2,n.length===0&&a(0);break}let f=null,p;if(c===Se.Asterisk)r+=1,p="*";else if(c===Se.Pipe){if(p="",t.charCodeAt(r+1)===Se.Pipe){l(he.ColumnCombinator),a(2);break}}else if(Bg.test(t.slice(r)))p=i(0);else break e;t.charCodeAt(r)===Se.Pipe&&t.charCodeAt(r+1)!==Se.Pipe&&(f=p,t.charCodeAt(r+1)===Se.Asterisk?(p="*",r+=2):p=i(1)),n.push(p==="*"?{type:he.Universal,namespace:f}:{type:he.Tag,name:p,namespace:f})}}}return d(),r}var Wt;(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(Wt||(Wt={}));function Gg(e){return e.type===Wt.Tag||e.type===Wt.Script||e.type===Wt.Style}var Wg=Wt.Root,Xg=Wt.Text,Hg=Wt.Directive,qg=Wt.Comment,Yg=Wt.Script,Kg=Wt.Style,Zg=Wt.Tag,Jg=Wt.CDATA,JX=Wt.Doctype;function pr(e){return Gg(e)}function mf(e){return e.type===Wt.CDATA}function ea(e){return e.type===Wt.Text}function Qg(e){return e.type===Wt.Comment}function Fr(e){return Object.hasOwn(e,"children")}var wf={};yN(wf,{DocumentPosition:()=>tn,append:()=>JM,appendChild:()=>ZM,compareDocumentPosition:()=>my,existsOne:()=>ty,filter:()=>qa,find:()=>ey,findAll:()=>kM,findOne:()=>nu,getAttributeValue:()=>rA,getChildren:()=>gy,getElementById:()=>MM,getElements:()=>NM,getElementsByClassName:()=>AM,getElementsByTagName:()=>ta,getElementsByTagType:()=>CM,getFeed:()=>VM,getInnerHTML:()=>BM,getName:()=>iA,getOuterHTML:()=>py,getParent:()=>yy,getSiblings:()=>tA,getText:()=>ou,hasAttrib:()=>nA,innerText:()=>xf,nextElementSibling:()=>aA,prepend:()=>eA,prependChild:()=>QM,prevElementSibling:()=>oA,removeElement:()=>Is,removeSubsets:()=>qM,replaceElement:()=>KM,testElement:()=>$M,textContent:()=>ws,uniqueSort:()=>YM});function qa(e,t,r=!0,n=Number.POSITIVE_INFINITY){return ey(e,Array.isArray(t)?t:[t],r,n)}function ey(e,t,r,n){let i=[],a=[Array.isArray(t)?t:[t]],o=[0];for(;;){if(o[0]>=a[0].length){if(o.length===1)return i;a.shift(),o.shift();continue}let s=a[0][o[0]++];if(e(s)&&(i.push(s),--n<=0))return i;r&&Fr(s)&&s.children.length>0&&(o.unshift(0),a.unshift(s.children))}}function nu(e,t,r=!0){let n=Array.isArray(t)?t:[t];for(let i of n){if(pr(i)&&e(i))return i;if(r&&Fr(i)&&i.children.length>0){let a=nu(e,i.children,!0);if(a)return a}}return null}function ty(e,t){return(Array.isArray(t)?t:[t]).some(r=>pr(r)&&e(r)||Fr(r)&&ty(e,r.children))}function kM(e,t){let r=[],n=[Array.isArray(t)?t:[t]],i=[0];for(;;){if(i[0]>=n[0].length){if(n.length===1)return r;n.shift(),i.shift();continue}let a=n[0][i[0]++];pr(a)&&e(a)&&r.push(a),Fr(a)&&a.children.length>0&&(i.unshift(0),n.unshift(a.children))}}var iu={tag_name(e){return typeof e=="function"?t=>pr(t)&&e(t.name):e==="*"?pr:t=>pr(t)&&t.name===e},tag_type(e){return typeof e=="function"?t=>e(t.type):t=>t.type===e},tag_contains(e){return typeof e=="function"?t=>ea(t)&&e(t.data):t=>ea(t)&&t.data===e}};function gf(e,t){return typeof t=="function"?r=>pr(r)&&t(r.attribs[e]):r=>pr(r)&&r.attribs[e]===t}function SM(e,t){return r=>e(r)||t(r)}function ry(e){let t=Object.keys(e).map(r=>{let n=e[r];return Object.hasOwn(iu,r)?iu[r](n):gf(r,n)});return t.length===0?null:t.reduce(SM)}function $M(e,t){let r=ry(e);return r?r(t):!0}function NM(e,t,r,n=Number.POSITIVE_INFINITY){let i=ry(e);return i?qa(i,t,r,n):[]}function MM(e,t,r=!0){return Array.isArray(t)||(t=[t]),nu(gf("id",e),t,r)}function ta(e,t,r=!0,n=Number.POSITIVE_INFINITY){return qa(iu.tag_name(e),t,r,n)}function AM(e,t,r=!0,n=Number.POSITIVE_INFINITY){return qa(gf("class",e),t,r,n)}function CM(e,t,r=!0,n=Number.POSITIVE_INFINITY){return qa(iu.tag_type(e),t,r,n)}function iy(e){return e===34?"&quot;":e===38?"&amp;":e===39?"&apos;":e===60?"&lt;":e===62?"&gt;":"&nbsp;"}var OM=1342177476,yf=/["&'<>\u0080-\uFFFF]/g;function ny(e){return e>=128||e>=32&&e<64&&(OM>>>e&1)===1}function au(e){let{length:t}=e,r,n=0,i=0;for(;i<t;){let a=e.charCodeAt(i);if(!ny(a)){let s=Math.min(i+32,t),l=i+1;for(;l<s&&!ny(e.charCodeAt(l));)l++;if(l<s){i=l;continue}if(l>=t||(yf.lastIndex=l,!yf.test(e)))break;i=yf.lastIndex-1;continue}if(r===void 0?r=e.substring(0,i):n!==i&&(r+=e.substring(n,i)),a<64){r+=iy(a),n=i+=1;continue}let o=e.codePointAt(i);r+=`&#x${o.toString(16)};`,o!==a&&i++,n=i+=1}return r===void 0?e:(n<t&&(r+=e.substr(n)),r)}function ay(e,t){if(e.lastIndex=0,!e.test(t))return t;let r="",n=0;do{let i=e.lastIndex-1;n!==i&&(r+=t.substring(n,i));let a=t.charCodeAt(i);r+=iy(a),n=i+1}while(e.test(t));return r+t.substring(n)}var TM=/["&\u{A0}]/gu;function vf(e){return ay(TM,e)}var PM=/[&<>\u{A0}]/gu;function bf(e){return ay(PM,e)}var oy;(function(e){e[e.XML=0]="XML",e[e.HTML=1]="HTML"})(oy||(oy={}));var sy;(function(e){e[e.UTF8=0]="UTF8",e[e.ASCII=1]="ASCII",e[e.Extensive=2]="Extensive",e[e.Attribute=3]="Attribute",e[e.Text=4]="Text"})(sy||(sy={}));var ly=new Map("altGlyph altGlyphDef altGlyphItem animateColor animateMotion animateTransform clipPath feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence foreignObject glyphRef linearGradient radialGradient textPath".split(" ").map(e=>[e.toLowerCase(),e])),uy=new Map("definitionURL attributeName attributeType baseFrequency baseProfile calcMode clipPathUnits diffuseConstant edgeMode filterUnits glyphRef gradientTransform gradientUnits kernelMatrix kernelUnitLength keyPoints keySplines keyTimes lengthAdjust limitingConeAngle markerHeight markerUnits markerWidth maskContentUnits maskUnits numOctaves pathLength patternContentUnits patternTransform patternUnits pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits refX refY repeatCount repeatDur requiredExtensions requiredFeatures specularConstant specularExponent spreadMethod startOffset stdDeviation stitchTiles surfaceScale systemLanguage tableValues targetX targetY textLength viewBox viewTarget xChannelSelector yChannelSelector zoomAndPan".split(" ").map(e=>[e.toLowerCase(),e]));var DM=new Set("style script xmp iframe noembed noframes plaintext noscript".split(" ")),jM=new Set("area base basefont br col command embed frame hr img input isindex keygen link meta param source track wbr".split(" ")),EM=new Set(["svg","math"]),zM=new Set("mi mo mn ms mtext annotation-xml foreignObject desc title".split(" "));function RM(e,t={}){let r="length"in e?e:[e],n=t.xmlMode??!1,i="";for(let a=0;a<r.length;a++)i+=fy(r[a],t,n);return i}var dy=RM;function cy(e,t,r){let n="";for(let i=0;i<e.length;i++)n+=fy(e[i],t,r);return n}function fy(e,t,r){switch(e.type){case Wg:return cy(e.children,t,r);case Hg:return`<${e.data}>`;case qg:return`<!--${e.data}-->`;case Jg:return`<![CDATA[${e.children[0].data}]]>`;case Yg:case Kg:case Zg:return _M(e,t,r);case Xg:{let n=e,i=n.data||"";return(t.encodeEntities??t.decodeEntities)!==!1&&!(!r&&n.parent&&DM.has(n.parent.name))?r||t.encodeEntities!=="utf8"?au(i):bf(i):i}}}function _M(e,t,r){r==="foreign"&&(e.name=ly.get(e.name)??e.name,e.parent&&zM.has(e.parent.name)&&(r=!1)),!r&&EM.has(e.name)&&(r="foreign");let{name:n,children:i}=e,a=!r&&jM.has(n),o=`<${n}${LM(e.attribs,t,r)}`;return i.length===0&&(r?t.selfClosingTags!==!1:t.selfClosingTags&&a)?o+=r?"/>":" />":(o+=">",i.length>0&&(o+=cy(i,t,r)),a||(o+=`</${n}>`)),o}function FM(e){return e.replaceAll('"',"&quot;")}function LM(e,t,r){if(!e)return"";let n=(t.encodeEntities??t.decodeEntities)===!1?FM:r||t.encodeEntities!=="utf8"?au:vf,i=r==="foreign",a=!!(t.emptyAttrs??r),o="";for(let s in e){if(!Object.hasOwn(e,s))continue;let l=e[s],u=i?uy.get(s)??s:s;o+=!a&&(l==null||l==="")?` ${u}`:` ${u}="${n(l==null?"":String(l))}"`}return o}function py(e,t){return dy(e,t)}function BM(e,t){return Fr(e)?e.children.map(r=>py(r,t)).join(""):""}function ou(e){return Array.isArray(e)?e.map(ou).join(""):pr(e)?e.name==="br"?`
11
+ `:ou(e.children):mf(e)?ou(e.children):ea(e)?e.data:""}function ws(e){return Array.isArray(e)?e.map(ws).join(""):Fr(e)&&!Qg(e)?ws(e.children):ea(e)?e.data:""}function xf(e){return Array.isArray(e)?e.map(xf).join(""):Fr(e)&&(e.type===Wt.Tag||mf(e))?xf(e.children):ea(e)?e.data:""}function VM(e){let t=su(HM,e);return t?t.name==="feed"?UM(t):GM(t):null}function UM(e){let t=e.children,r={type:"atom",items:ta("entry",t).map(a=>{let{children:o}=a,s={media:hy(o)};Lr(s,"id","id",o),Lr(s,"title","title",o);let l=su("link",o)?.attribs.href;l&&(s.link=l);let u=ki("summary",o)||ki("content",o);u&&(s.description=u);let d=ki("updated",o);return d&&(s.pubDate=new Date(d)),s})};Lr(r,"id","id",t),Lr(r,"title","title",t);let n=su("link",t)?.attribs.href;n&&(r.link=n),Lr(r,"description","subtitle",t);let i=ki("updated",t);return i&&(r.updated=new Date(i)),Lr(r,"author","email",t,!0),r}function GM(e){let t=su("channel",e.children)?.children??[],r={type:e.name.substr(0,3),id:"",items:ta("item",e.children).map(i=>{let{children:a}=i,o={media:hy(a)};Lr(o,"id","guid",a),Lr(o,"title","title",a),Lr(o,"link","link",a),Lr(o,"description","description",a);let s=ki("pubDate",a)||ki("dc:date",a);return s&&(o.pubDate=new Date(s)),o})};Lr(r,"title","title",t),Lr(r,"link","link",t),Lr(r,"description","description",t);let n=ki("lastBuildDate",t);return n&&(r.updated=new Date(n)),Lr(r,"author","managingEditor",t,!0),r}var WM=["url","type","lang"],XM=["fileSize","bitrate","framerate","samplingrate","channels","duration","height","width"];function hy(e){return ta("media:content",e).map(t=>{let{attribs:r}=t,n={medium:r.medium,isDefault:!!r.isDefault};for(let i of WM)r[i]&&(n[i]=r[i]);for(let i of XM)r[i]&&(n[i]=Number.parseInt(r[i],10));return r.expression&&(n.expression=r.expression),n})}function su(e,t){return ta(e,t,!0,1)[0]}function ki(e,t,r=!1){return ws(ta(e,t,r,1)).trim()}function Lr(e,t,r,n,i=!1){let a=ki(r,n,i);a&&(e[t]=a)}function HM(e){return e==="rss"||e==="feed"||e==="rdf:RDF"}function qM(e){let t=e.length;for(;--t>=0;){let r=e[t];if(t>0&&e.lastIndexOf(r,t-1)>=0){e.splice(t,1);continue}for(let n=r.parent;n;n=n.parent)if(e.includes(n)){e.splice(t,1);break}}return e}var tn;(function(e){e[e.DISCONNECTED=1]="DISCONNECTED",e[e.PRECEDING=2]="PRECEDING",e[e.FOLLOWING=4]="FOLLOWING",e[e.CONTAINS=8]="CONTAINS",e[e.CONTAINED_BY=16]="CONTAINED_BY"})(tn||(tn={}));function my(e,t){let r=[],n=[];if(e===t)return 0;let i=Fr(e)?e:e.parent;for(;i;)r.unshift(i),i=i.parent;for(i=Fr(t)?t:t.parent;i;)n.unshift(i),i=i.parent;let a=Math.min(r.length,n.length),o=0;for(;o<a&&r[o]===n[o];)o++;if(o===0)return tn.DISCONNECTED;let s=r[o-1],l=s.children,u=r[o],d=n[o];return l.indexOf(u)>l.indexOf(d)?s===t?tn.FOLLOWING|tn.CONTAINED_BY:tn.FOLLOWING:s===e?tn.PRECEDING|tn.CONTAINS:tn.PRECEDING}function YM(e){return e=e.filter((t,r,n)=>!n.includes(t,r+1)),e.sort((t,r)=>{let n=my(t,r);return n&tn.PRECEDING?-1:n&tn.FOLLOWING?1:0}),e}function Is(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){let t=e.parent.children,r=t.lastIndexOf(e);r!==-1&&t.splice(r,1)}e.next=null,e.prev=null,e.parent=null}function KM(e,t){if(t.prev=e.prev,t.prev&&(t.prev.next=t),t.next=e.next,t.next&&(t.next.prev=t),t.parent=e.parent,t.parent){let{children:r}=t.parent,n=r.lastIndexOf(e);if(n===-1)return;r[n]=t,e.parent=null}}function ZM(e,t){if(Is(t),t.next=null,t.parent=e,e.children.push(t)>1){let r=e.children[e.children.length-2];r.next=t,t.prev=r}else t.prev=null}function JM(e,t){Is(t);let{parent:r}=e,n=e.next;if(t.next=n,t.prev=e,e.next=t,t.parent=r,n){if(n.prev=t,r){let i=r.children;i.splice(i.lastIndexOf(n),0,t)}}else r&&r.children.push(t)}function QM(e,t){if(Is(t),t.parent=e,t.prev=null,e.children.unshift(t)===1)t.next=null;else{let r=e.children[1];r.prev=t,t.next=r}}function eA(e,t){Is(t);let{parent:r}=e;if(r){let n=r.children;n.splice(n.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=r,t.prev=e.prev,t.next=e,e.prev=t}function gy(e){return Fr(e)?e.children:[]}function yy(e){return e.parent||null}function tA(e){let t=yy(e);if(t!=null)return gy(t);let r=[e],{prev:n,next:i}=e;for(;n!=null;)r.unshift(n),{prev:n}=n;for(;i!=null;)r.push(i),{next:i}=i;return r}function rA(e,t){let{attribs:r}=e;return r?.[t]}function nA(e,t){let{attribs:r}=e;return r!=null&&Object.hasOwn(r,t)&&r[t]!=null}function iA(e){return e.name}function aA(e){let{next:t}=e;for(;t!==null&&!pr(t);)({next:t}=t);return t}function oA(e){let{prev:t}=e;for(;t!==null&&!pr(t);)({prev:t}=t);return t}var sA=/[-[\]{}()*+?.,\\^$|#\s]/g,lA=/\s/;function vy(e){return e.replace(sA,"\\$&")}var uA=new Set(["accept","accept-charset","align","alink","axis","bgcolor","charset","checked","clear","codetype","color","compact","declare","defer","dir","direction","disabled","enctype","face","frame","hreflang","http-equiv","lang","language","link","media","method","multiple","nohref","noresize","noshade","nowrap","readonly","rel","rev","rules","scope","scrolling","selected","shape","target","text","type","valign","valuetype","vlink"]);function ra(e,t){return typeof e.ignoreCase=="boolean"?e.ignoreCase:e.ignoreCase==="quirks"?!!t.quirksMode:!t.xmlMode&&uA.has(e.name)}var by={equals(e,t,r){let{adapter:n}=r,{name:i}=t,{value:a}=t;return ra(t,r)?(a=a.toLowerCase(),o=>{let s=n.getAttributeValue(o,i);return s!=null&&s.length===a.length&&s.toLowerCase()===a&&e(o)}):o=>n.getAttributeValue(o,i)===a&&e(o)},hyphen(e,t,r){let{adapter:n}=r,{name:i}=t,{value:a}=t,{length:o}=a;return ra(t,r)?(a=a.toLowerCase(),function(l){let u=n.getAttributeValue(l,i);return u!=null&&(u.length===o||u.charAt(o)==="-")&&u.substr(0,o).toLowerCase()===a&&e(l)}):function(l){let u=n.getAttributeValue(l,i);return u!=null&&(u.length===o||u.charAt(o)==="-")&&u.substr(0,o)===a&&e(l)}},element(e,t,r){let{adapter:n}=r,{name:i,value:a}=t;if(lA.test(a))return lt;let o=new RegExp(`(?:^|\\s)${vy(a)}(?:$|\\s)`,ra(t,r)?"i":"");return function(l){let u=n.getAttributeValue(l,i);return u!=null&&u.length>=a.length&&o.test(u)&&e(l)}},exists(e,{name:t},{adapter:r}){return n=>r.hasAttrib(n,t)&&e(n)},start(e,t,r){let{adapter:n}=r,{name:i}=t,{value:a}=t,{length:o}=a;return o===0?lt:ra(t,r)?(a=a.toLowerCase(),s=>{let l=n.getAttributeValue(s,i);return l!=null&&l.length>=o&&l.substr(0,o).toLowerCase()===a&&e(s)}):s=>!!n.getAttributeValue(s,i)?.startsWith(a)&&e(s)},end(e,t,r){let{adapter:n}=r,{name:i}=t,{value:a}=t,o=-a.length;return o===0?lt:ra(t,r)?(a=a.toLowerCase(),s=>n.getAttributeValue(s,i)?.substr(o).toLowerCase()===a&&e(s)):s=>!!n.getAttributeValue(s,i)?.endsWith(a)&&e(s)},any(e,t,r){let{adapter:n}=r,{name:i,value:a}=t;if(a==="")return lt;if(ra(t,r)){let o=new RegExp(vy(a),"i");return function(l){let u=n.getAttributeValue(l,i);return u!=null&&u.length>=a.length&&o.test(u)&&e(l)}}return o=>!!n.getAttributeValue(o,i)?.includes(a)&&e(o)},not(e,t,r){let{adapter:n}=r,{name:i}=t,{value:a}=t;return a===""?o=>!!n.getAttributeValue(o,i)&&e(o):ra(t,r)?(a=a.toLowerCase(),o=>{let s=n.getAttributeValue(o,i);return(s==null||s.length!==a.length||s.toLowerCase()!==a)&&e(o)}):o=>n.getAttributeValue(o,i)!==a&&e(o)}};function xy(e,t,r){let{adapter:n,xmlMode:i=!1}=r,a=[],o=[t],s=[0];for(;;){if(s[0]>=o[0].length){if(o.length===1)return a;o.shift(),s.shift();continue}let l=o[0][s[0]++];if(n.isTag(l)&&(e(l)&&a.push(l),i||n.getName(l)!=="template")){let u=n.getChildren(l);u.length>0&&(o.unshift(u),s.unshift(0))}}}function Ya(e,t,r){let{adapter:n,xmlMode:i=!1}=r,a=[t],o=[0];for(;;){if(o[0]>=a[0].length){if(a.length===1)return null;a.shift(),o.shift();continue}let s=a[0][o[0]++];if(n.isTag(s)){if(e(s))return s;if(i||n.getName(s)!=="template"){let l=n.getChildren(s);l.length>0&&(a.unshift(l),o.unshift(0))}}}}function lu(e,t){let r=t.getSiblings(e);if(r.length<=1)return[];let n=r.indexOf(e);return n===-1||n===r.length-1?[]:r.slice(n+1).filter(t.isTag)}function rn(e,t){let r=t.getParent(e);return r!=null&&t.isTag(r)?r:null}var wy="input:is([type=text i],[type=search i],[type=url i],[type=tel i],[type=email i],[type=password i],[type=date i],[type=month i],[type=week i],[type=time i],[type=datetime-local i],[type=number i])",Iy={"any-link":":is(a, area, link)[href]",link:":any-link:not(:visited)",disabled:`:is(
12
+ :is(button, input, select, textarea, optgroup, option)[disabled],
13
+ optgroup[disabled] > option,
14
+ fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
15
+ )`,enabled:":is(button, input, select, textarea, optgroup, option, fieldset):not(:disabled)",checked:":is(:is(input[type=radio], input[type=checkbox])[checked], :selected)",required:":is(input, select, textarea)[required]",optional:":is(input, select, textarea):not([required])","read-only":`[readonly]:is(textarea, ${wy})`,"read-write":`:not([readonly]):is(textarea, ${wy})`,selected:"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",checkbox:"[type=checkbox]",file:"[type=file]",password:"[type=password]",radio:"[type=radio]",reset:"[type=reset]",image:"[type=image]",submit:"[type=submit]",parent:":not(:empty)",header:":is(h1, h2, h3, h4, h5, h6)",button:":is(button, input[type=button])",input:":is(input, textarea, select, button)",text:"input:is(:not([type!='']), [type=text])"};function ky(e){let t=e[0],r=e[1]-1;if(r<0&&t<=0)return lt;if(t===-1)return a=>a<=r;if(t===0)return a=>a===r;if(t===1)return r<0?vn:a=>a>=r;let n=Math.abs(t),i=(r%n+n)%n;return t>1?a=>a>=r&&a%n===i:a=>a<=r&&a%n===i}var dA=new Set([9,10,12,13,32]),Sy=48,cA=57;function $y(e){switch(e=e.trim().toLowerCase(),e){case"even":return[2,0];case"odd":return[2,1]}let t=0,r=0,n=a(),i=o();if(t<e.length&&e.charAt(t)==="n"&&(t++,r=n*(i??1),s(),t<e.length?(n=a(),s(),i=o()):n=i=0),i===null||t<e.length)throw new Error(`n-th rule couldn't be parsed ('${e}')`);return[r,n*i];function a(){switch(e.charAt(t)){case"-":return t++,-1;case"+":{t++;break}}return 1}function o(){let l=t,u=0;for(;t<e.length&&e.charCodeAt(t)>=Sy&&e.charCodeAt(t)<=cA;)u=u*10+(e.charCodeAt(t)-Sy),t++;return t===l?null:u}function s(){for(;t<e.length&&dA.has(e.charCodeAt(t));)t++}}function If(e){return ky($y(e))}function Ka(e,{adapter:t,cacheResults:r},n){if(r===!1||typeof WeakMap>"u")return o=>e(o)&&n(o);let i=new WeakMap;function a(o){let s=n(o);return i.set(o,s),s}return function(s){if(!e(s))return!1;if(i.has(s))return i.get(s)??!1;let l=s;do{let u=rn(l,t);if(u===null)return a(s);l=u}while(!i.has(l));return i.get(l)?a(s):!1}}function Za(e){let{context:t,rootFunc:r,...n}=e;return n}function fA(e,t){if(t[0]!=="*"&&t[0]!==e[0])return!1;let r=1;for(let n=1;n<t.length;n++)if(t[n]!=="*"){for(;r<e.length&&e[r]!==t[n];)if(e[r++].length<=1)return!1;if(r>=e.length)return!1;r++}return!0}var pA=/^(.+?)\s+of\s+(.+)$/is;function uu(e,t){return function(n,i,a,o,s){let{adapter:l,equals:u}=a,d=t?null:i.match(pA),c=If(d?d[1].trim():i);if(c===lt)return lt;let f=d&&s?s(En(d[2].trim()),Za(a),o):void 0;if(f===lt)return lt;if(c===vn&&!f)return h=>rn(h,l)!==null&&n(h);let p=f?(h,m)=>f(m):t?(h,m)=>l.getName(m)===l.getName(h):vn;return e?function(m){if(f&&!f(m))return!1;let g=l.getSiblings(m),v=0;for(let b=g.length-1;b>=0;b--){let y=g[b];if(u(m,y))break;l.isTag(y)&&p(m,y)&&v++}return c(v)&&n(m)}:function(m){if(f&&!f(m))return!1;let g=l.getSiblings(m),v=0;for(let b of g){if(u(m,b))break;l.isTag(b)&&p(m,b)&&v++}return c(v)&&n(m)}}}var du={contains(e,t,r){let{getText:n}=r.adapter;return Ka(e,r,i=>n(i).includes(t))},icontains(e,t,r){let n=t.toLowerCase(),{getText:i}=r.adapter;return Ka(e,r,a=>i(a).toLowerCase().includes(n))},"nth-child":uu(!1,!1),"nth-last-child":uu(!0,!1),"nth-of-type":uu(!1,!0),"nth-last-of-type":uu(!0,!0),root(e,t,{adapter:r}){return n=>rn(n,r)===null&&e(n)},scope(e,t,r,n){let{equals:i}=r;return!n||n.length===0?du.root(e,t,r):n.length===1?a=>i(n[0],a)&&e(a):a=>n.includes(a)&&e(a)},lang(e,t,{adapter:r}){let n=t.split(",").map(i=>i.trim()).filter(i=>i.length>0).map(i=>i.replace(/^['"]|['"]$/g,"").toLowerCase().split("-"));return function(a){let o=a;for(;o!=null;){let s=r.getAttributeValue(o,"xml:lang")??r.getAttributeValue(o,"lang");if(s!=null){if(!s)return n.some(d=>d[0]==="")&&e(a);let u=s.toLowerCase().split("-");return n.some(d=>fA(u,d))&&e(a)}let l=r.getParent(o);o=l!=null&&r.isTag(l)?l:null}return n.some(s=>s[0]==="")&&e(a)}},hover:kf("isHovered"),visited:kf("isVisited"),active:kf("isActive")};function kf(e){return function(r,n,{adapter:i}){let a=i[e];return typeof a!="function"?lt:function(s){return a(s)&&r(s)}}}var hA=/^[ \t\r\n]*$/,Sf={empty(e,{adapter:t}){let r=t.getChildren(e);return r.every(n=>!t.isTag(n))&&r.every(n=>hA.test(t.getText(n)))},"first-child"(e,{adapter:t,equals:r}){if(t.prevElementSibling)return t.prevElementSibling(e)==null;let n=t.getSiblings(e).find(i=>t.isTag(i));return n!=null&&r(e,n)},"last-child"(e,{adapter:t,equals:r}){let n=t.getSiblings(e);for(let i=n.length-1;i>=0;i--){if(r(e,n[i]))return!0;if(t.isTag(n[i]))break}return!1},"first-of-type"(e,{adapter:t,equals:r}){let n=t.getSiblings(e),i=t.getName(e);for(let a of n){if(r(e,a))return!0;if(t.isTag(a)&&t.getName(a)===i)break}return!1},"last-of-type"(e,{adapter:t,equals:r}){let n=t.getSiblings(e),i=t.getName(e);for(let a=n.length-1;a>=0;a--){let o=n[a];if(r(e,o))return!0;if(t.isTag(o)&&t.getName(o)===i)break}return!1},"only-of-type"(e,{adapter:t,equals:r}){let n=t.getName(e);return t.getSiblings(e).every(i=>r(e,i)||!t.isTag(i)||t.getName(i)!==n)},"only-child"(e,{adapter:t,equals:r}){return t.getSiblings(e).every(n=>r(e,n)||!t.isTag(n))}};function $f(e,t,r,n){if(r===null){if(e.length>n)throw new Error(`Pseudo-class :${t} requires an argument`)}else if(e.length===n)throw new Error(`Pseudo-class :${t} doesn't have any arguments`)}function Ja(e){return e.type==="_flexibleDescendant"||ru(e)}function Ny(e){let t=e.map(cu);for(let r=1;r<e.length;r++){let n=t[r];if(!(n<0))for(let i=r;i>0&&n<t[i-1];i--){let a=e[i];e[i]=e[i-1],e[i-1]=a,t[i]=t[i-1],t[i-1]=n}}}function mA(e){switch(e.action){case xt.Exists:return 10;case xt.Equals:return e.name==="id"?9:8;case xt.Not:return 7;case xt.Start:return 6;case xt.End:return 6;case xt.Any:return 5;case xt.Hyphen:return 4;case xt.Element:return 3}}function cu(e){switch(e.type){case he.Universal:return 50;case he.Tag:return 30;case he.Attribute:return Math.floor(mA(e)/(e.ignoreCase?2:1));case he.Pseudo:return e.data?e.name==="has"||e.name==="contains"||e.name==="icontains"?0:Array.isArray(e.data)?Math.max(0,Math.min(...e.data.map(t=>Math.min(...t.map(cu))))):2:3;default:return-1}}function ks(e){return e.type===he.Pseudo&&(e.name==="scope"||Array.isArray(e.data)&&e.data.some(t=>t.some(ks)))}var Mf={};function gA(e){return e.some(t=>t.length>0&&(Ja(t[0])||t.some(ks)))}var Nf=(e,t,r,n,i)=>{let a=i(t,Za(r),n);return a===vn?e:a===lt?lt:o=>a(o)&&e(o)},fu={is:Nf,matches:Nf,where:Nf,not(e,t,r,n,i){let a=i(t,Za(r),n);return a===lt?e:a===vn?lt:o=>!a(o)&&e(o)},has(e,t,r,n,i){let{adapter:a}=r,o=Za(r);o.relativeSelector=!0;let s=t.some(c=>c.some(Ja))?[Mf]:void 0,l=gA(t),u=i(t,o,s);if(u===lt)return lt;if(s&&u!==vn)return l?c=>{if(!e(c))return!1;s[0]=c;let f=a.getChildren(c);return Ya(u,u.shouldTestNextSiblings?[...f,...lu(c,a)]:f,r)!==null}:Ka(e,r,c=>(s[0]=c,Ya(u,a.getChildren(c),r)!==null));let d=c=>Ya(u,a.getChildren(c),r)!==null;return l?c=>e(c)&&d(c):Ka(e,r,d)}};function My(e,t,r,n,i){let{name:a,data:o}=t;if(Array.isArray(o)){if(!(a in fu))throw new Error(`Unknown pseudo-class :${a}(${o})`);return fu[a](e,o,r,n,i)}let s=r.pseudos?.[a],l=typeof s=="string"?s:Iy[a];if(typeof l=="string"){if(o!=null)throw new Error(`Pseudo ${a} doesn't have any arguments`);let u=En(l);return fu.is(e,u,r,n,i)}if(typeof s=="function")return $f(s,a,o,1),u=>s(u,o)&&e(u);if(a in du)return du[a](e,o,r,n,i);if(a in Sf){let u=Sf[a];return $f(u,a,o,2),d=>u(d,r,o)&&e(d)}throw new Error(`Unknown pseudo-class :${a}`)}function Ay(e,t,r,n,i,a){let{adapter:o,equals:s,cacheResults:l}=r;switch(t.type){case he.PseudoElement:throw new Error("Pseudo-elements are not supported by css-select");case he.ColumnCombinator:throw new Error("Column combinators are not yet supported by css-select");case he.Attribute:{if(t.namespace!=null)throw new Error("Namespaced attributes are not yet supported by css-select");return(!r.xmlMode||r.lowerCaseAttributeNames)&&(t.name=t.name.toLowerCase()),by[t.action](e,t,r)}case he.Pseudo:return My(e,t,r,n,i);case he.Tag:{if(t.namespace!=null)throw new Error("Namespaced tag names are not yet supported by css-select");let{name:u}=t;return(!r.xmlMode||r.lowerCaseTags)&&(u=u.toLowerCase()),function(c){return o.getName(c)===u&&e(c)}}case he.Descendant:{if(!a||l===!1||typeof WeakMap>"u")return function(c){let f=c;for(;f=rn(f,o);)if(e(f))return!0;return!1};let u=new WeakMap;return function(c){let f=c,p;for(;f=rn(f,o);){let h=u.get(f);if(h===void 0){if(p??={matches:!1},p.matches=e(f),u.set(f,p),p.matches)return!0}else return p&&(p.matches=h.matches),h.matches}return!1}}case"_flexibleDescendant":return function(d){let c=d;do{if(e(c))return!0;c=rn(c,o)}while(c);return!1};case he.Parent:return function(d){return o.getChildren(d).some(c=>o.isTag(c)&&e(c))};case he.Child:return function(d){let c=rn(d,o);return c!==null&&e(c)};case he.Sibling:return function(d){let c=o.getSiblings(d);for(let f of c){if(s(d,f))break;if(o.isTag(f)&&e(f))return!0}return!1};case he.Adjacent:return o.prevElementSibling?function(d){let c=o.prevElementSibling(d);return c!=null&&e(c)}:function(d){let c=o.getSiblings(d),f;for(let p of c){if(s(d,p))break;o.isTag(p)&&(f=p)}return!!f&&e(f)};case he.Universal:{if(t.namespace!=null&&t.namespace!=="*")throw new Error("Namespaced universal selectors are not yet supported by css-select");return e}}}var yA={type:he.Descendant},vA={type:"_flexibleDescendant"},bA={type:he.Pseudo,name:"scope",data:null};function xA(e,{adapter:t},r){let n=!!r?.every(i=>i===Mf||t.isTag(i)&&rn(i,t)!==null);for(let i of e){if(!(i.length>0&&Ja(i[0])&&i[0].type!==he.Descendant))if(n&&!i.some(ks))i.unshift(yA);else continue;i.unshift(bA)}}function Af(e,t,r){for(let u of e)Ny(u);let{context:n=r,rootFunc:i=vn}=t,a=Array.isArray(n),o=n&&(Array.isArray(n)?n:[n]);if(t.relativeSelector!==!1)xA(e,t,o);else if(e.some(u=>u.length>0&&Ja(u[0])))throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");let s=!1,l=lt;e:for(let u of e){if(u.length>=2){let[f,p]=u;f.type!==he.Pseudo||f.name!=="scope"||(a&&p.type===he.Descendant?u[1]=vA:(p.type===he.Adjacent||p.type===he.Sibling)&&(s=!0))}let d=i,c=!1;for(let f of u)if(d=Ay(d,f,t,o,Af,c),cu(f)===0&&(c=!0),d===lt)continue e;if(d===i)return i;l=l===lt?d:wA(l,d)}return l.shouldTestNextSiblings=s,l}function wA(e,t){return r=>e(r)||t(r)}var Oy=(e,t)=>e===t,Cy={adapter:{...wf,isTag:pr},equals:Oy};function Cf(e){let t=e??Cy;return t.adapter??=Cy.adapter,t.equals??=t.adapter?.equals??Oy,t}function Ty(e,t,r){let n=Cf(t),i=Py(e,n,r);return i===lt?lt:a=>n.adapter.isTag(a)&&i(a)}function Py(e,t,r){return Af(typeof e=="string"?En(e):e,Cf(t),r)}function Dy(e){return function(r,n,i){let a=Cf(i);typeof r!="function"&&(r=Py(r,a,n));let o=IA(n,a.adapter,r.shouldTestNextSiblings);return e(r,o,a)}}function IA(e,t,r=!1){return r&&(e=kA(e,t)),Array.isArray(e)?t.removeSubsets(e):t.getChildren(e)}function kA(e,t){let r=Array.isArray(e)?[...e]:[e],n=r.length;for(let i=0;i<n;i++){let a=lu(r[i],t);r.push(...a)}return r}var M7=Dy((e,t,r)=>e===lt||!t||t.length===0?[]:xy(e,t,r)),A7=Dy((e,t,r)=>e===lt||!t||t.length===0?null:Ya(e,t,r));import{generate as wD,lexer as ID,parse as pw}from"css-tree";var SA=(e=>(e.LINEAR="linear",e.EASE="ease",e.EASE_IN="ease-in",e.EASE_OUT="ease-out",e.EASE_IN_OUT="ease-in-out",e.EASE_IN_QUAD="ease-in-quad",e.EASE_OUT_QUAD="ease-out-quad",e.EASE_IN_OUT_QUAD="ease-in-out-quad",e.EASE_IN_CUBIC="ease-in-cubic",e.EASE_OUT_CUBIC="ease-out-cubic",e.EASE_IN_OUT_CUBIC="ease-in-out-cubic",e.EASE_IN_QUART="ease-in-quart",e.EASE_OUT_QUART="ease-out-quart",e.EASE_IN_OUT_QUART="ease-in-out-quart",e.EASE_IN_SINE="ease-in-sine",e.EASE_OUT_SINE="ease-out-sine",e.EASE_IN_OUT_SINE="ease-in-out-sine",e.EASE_IN_QUINT="ease-in-quint",e.EASE_OUT_QUINT="ease-out-quint",e.EASE_IN_OUT_QUINT="ease-in-out-quint",e.EASE_IN_EXPO="ease-in-expo",e.EASE_OUT_EXPO="ease-out-expo",e.EASE_IN_OUT_EXPO="ease-in-out-expo",e.EASE_IN_CIRC="ease-in-circ",e.EASE_OUT_CIRC="ease-out-circ",e.EASE_IN_OUT_CIRC="ease-in-out-circ",e.EASE_IN_BACK="ease-in-back",e.EASE_OUT_BACK="ease-out-back",e.EASE_IN_OUT_BACK="ease-in-out-back",e.CUSTOM_BEZIER="custom-bezier",e.LINEAR_FUNCTION="linear-function",e.STEPS="steps",e))(SA||{}),Od={linear:null,ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1],"ease-in-quad":[.55,.085,.68,.53],"ease-out-quad":[.25,.46,.45,.94],"ease-in-out-quad":[.455,.03,.515,.955],"ease-in-cubic":[.55,.055,.675,.19],"ease-out-cubic":[.215,.61,.355,1],"ease-in-out-cubic":[.645,.045,.355,1],"ease-in-quart":[.895,.03,.685,.22],"ease-out-quart":[.165,.84,.44,1],"ease-in-out-quart":[.77,0,.175,1],"ease-in-sine":[.47,0,.745,.715],"ease-out-sine":[.39,.575,.565,1],"ease-in-out-sine":[.445,.05,.55,.95],"ease-in-quint":[.755,.05,.855,.06],"ease-out-quint":[.23,1,.32,1],"ease-in-out-quint":[.86,0,.07,1],"ease-in-expo":[.95,.05,.795,.035],"ease-out-expo":[.19,1,.22,1],"ease-in-out-expo":[1,0,0,1],"ease-in-circ":[.6,.04,.98,.335],"ease-out-circ":[.075,.82,.165,1],"ease-in-out-circ":[.785,.135,.15,.86],"ease-in-back":[.6,-.28,.735,.045],"ease-out-back":[.175,.885,.32,1.275],"ease-in-out-back":[.68,-.55,.265,1.55],"custom-bezier":null,"linear-function":null,steps:null};function Td(e){return`definition:${e.definitionId}${e.nodeId?`/${e.nodeId}`:""}`}var $A=new Set(["pathMorph","textPathMorph"]);var O7=new Set([...$A,"polylinePoints"]);var NA=(e=>(e.LINEAR="linear",e.QUADRATIC="quadratic",e.CUBIC="cubic",e.CATMULL_ROM="catmull-rom",e.ARC="arc",e.BASIS="basis",e.MIXED="mixed",e))(NA||{}),MA=(e=>(e.SMOOTH="smooth",e.CORNER="corner",e.SYMMETRIC="symmetric",e))(MA||{});var AA={symbol:!0,marker:!0,"linear-gradient":!0,"radial-gradient":!0,pattern:!0,filter:!0,"appearance-style":!0},T7=Object.keys(AA),CA=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform","layerName","leadingComments","fillColor","borderColor","borderWidth","opacity","fillOpacity","strokeOpacity","locked","visible","fillType","fillGradient","strokeType","strokeGradient","fillRule","strokeLinejoin","strokeLinecap","strokeMiterlimit","lineStyle","dashLength","gapLength","dashOffset","strokeDasharray","colorInterpolation","filters","filterColorInterpolation","filterUnits","primitiveUnits","filterX","filterY","filterWidth","filterHeight","metadata","cssClipPath","cssMaskProperties","structural","displayMode","definitionOrder","definitionContainerId","display","visibility","inheritFill","inheritStroke","preserveOpacity","preserveFillOpacity","preserveStrokeOpacity","fillLibraryId","strokeLibraryId","authoredFillPaint","authoredStrokePaint","filterLibraryIds","appearance","graphicStyleId","paintOrder","vectorEffect","transformBox","pathLength","markerStart","markerMid","markerEnd","blendMode","shapeRendering","textRendering","imageRendering","colorRendering","systemLanguage","requiredExtensions","presentationChannels","inlineStyle","authoredAttributes","bindings","scripts","lastSolidFillColor","lastSolidStrokeColor","connectionPoints","isRootSvg","x","y","width","height","rx","ry","cornerRadius","cornerShape","cornerMode","cornerRadiusTL","cornerRadiusTR","cornerRadiusBL","cornerRadiusBR","cornerShapeTL","cornerShapeTR","cornerShapeBL","cornerShapeBR","size","radius","cx","cy","shiftAngle","x1","y1","x2","y2","startEndpoint","endEndpoint","routingMode","sourceRef","targetRef","sourcePoint","targetPoint","waypoints","label","labelPosition","labelOffset","mermaidEdgeStyle","textX","textY","authoredTextPosition","textSpanTree","fontSize","text","fontFamily","fontWeight","fontStyle","fontStretch","fontSizeAdjust","fontVariant","fontVariantLigatures","fontVariantPosition","fontVariantCaps","fontVariantNumeric","fontVariantEastAsian","textDecoration","textTransform","baselineShift","dominantBaseline","alignmentBaseline","writingMode","textAnchor","letterSpacing","wordSpacing","lineHeight","inlineSize","overflowWrap","whiteSpace","textDirection","unicodeBidi","useRichText","richTextRuns","charOffsets","fontVariationSettings","linePositions","textLength","lengthAdjust","shapeInsideRef","shapeInsideImportRefId","shapePadding","isTextPath","textPathPoints","textPathStartOffset","textPathStartOffsetUnit","textPathSide","textPathMethod","textPathSpacing","textPathLengthAdjust","textPathLength","textPathLengthUnit","textPathPathLength","textPathCurveType","textPathInlineFormat","textPathReference","textPathImportReference","href","originalWidth","originalHeight","preserveAspectRatio","specPreserveAspectRatio","imageOpacity","pathPoints","pathArcParams","pathControlBounds","pathCurveType","pathClosed","pathTension","polylinePoints","polylineClosed","sides","arms","innerRadiusPercent","armWidthPercent","turns","thicknessPercent","spiralDirection","teeth","toothDepthPercent","holeRadiusPercent","headWidthPercent","headLengthPercent","shaftWidthPercent","tailAngleDeg","tailLengthPercent","tailWidthPercent","lobeRadiusPercent","cleftDepthPercent","boltSegments","boltJaggednessPercent","boltWidthPercent","cloudBumps","cloudPuffinessPercent","slantPercent","topWidthPercent","capHeightPercent","waveAmplitudePercent","symbolId","authoredUseGeometry","symbolOverrides","variantKey","instancePresentation","scaleContentToViewport","groupData","mediaKind","mediaMimeType","naturalDuration","begin","trimStart","trimEnd","volume","muted","loop","playbackRate","mediaOpacity","fadeInDuration","fadeOutDuration","posterHref","sourceRect","foreignContent","hrefXlink","linkTarget","linkRel","linkDownload","linkPing","linkHreflang","linkType","linkReferrerPolicy","containerPresentation","targetShapeId","offsetX","offsetY","targetWidth","targetHeight","broken","switchSystemLanguage","switchRequiredExtensions","svgX","svgY","svgWidth","svgHeight","svgViewBoxX","svgViewBoxY","svgViewBoxWidth","svgViewBoxHeight","authoredRootDimensions","svgPreserveAspectRatio","viewBoxX","viewBoxY","viewBoxWidth","viewBoxHeight","viewName","viewPreserveAspectRatio","viewZoomAndPan","viewTarget","children"],wn=29,OA=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform"],Hb=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY"],TA={transformMatrix:null,translateX:0,translateY:0,rotation:0,skewX:0,skewY:0,customPivot:null,rawTransform:null},oi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Pd=oi.length,si=oi[0],jy=oi[Pd-1],qb=oi[Math.floor(Pd/2)],mp=97,PA=122;function Oo(e){let t=oi.indexOf(e);if(t===-1)throw new Error(`order-key: invalid digit '${e}'`);return t}function DA(e){let t=e.charCodeAt(0);if(t<mp||t>PA)throw new Error(`order-key: invalid head '${e}'`);return t-mp+1}function ji(e){if(e<1||e>26)throw new Error(`order-key: integer length ${e} out of range`);return String.fromCharCode(mp+e-1)}function Ks(e){let t=DA(e[0]);if(e.length<1+t)throw new Error(`order-key: '${e}' shorter than its integer part`);let r=e.slice(1,1+t),n=e.slice(1+t);for(let i of r)Oo(i);for(let i of n)Oo(i);return{integer:r,fraction:n}}function ed(e){for(let t of e)if(t!==si)return!1;return!0}function jA(e){if(e.length===0)return!1;try{let{integer:t,fraction:r}=Ks(e);return!(r.endsWith(si)||ed(t)&&r.length===0||t.length>1&&t[0]===si)}catch{return!1}}function Ey(e,t){if(!jA(e))throw new Error(`order-key: invalid ${t} '${e}'`)}function Yb(e,t){return e<t?-1:e>t?1:0}function EA(e){let t=e.split("");for(let r=t.length-1;r>=0;r--){let n=Oo(t[r]);if(n<Pd-1){t[r]=oi[n+1];for(let i=r+1;i<t.length;i++)t[i]=si;return t.join("")}}return null}function gp(e){let{integer:t}=Ks(e),r=EA(t);if(r!==null)return ji(t.length)+r;let n="1"+si.repeat(t.length);return ji(n.length)+n}function zA(e){let t=e.split("");for(let r=t.length-1;r>=0;r--){let n=Oo(t[r]);if(n>0){t[r]=oi[n-1];for(let i=r+1;i<t.length;i++)t[i]=jy;return t.join("")}t[r]=jy}throw new Error(`order-key: cannot decrement zero integer '${e}'`)}function RA(e){let t=0;for(;t<e.length-1&&e[t]===si;)t++;return e.slice(t)}function _A(e){let{integer:t,fraction:r}=Ks(e);if(!ed(t)){let n=zA(t);if(!ed(n)){let i=RA(n);return ji(i.length)+i}return ji(1)+si+qb}return ji(1)+si+Zs("",r)}function Zs(e,t){if(t!==null){if(t.length===0||e>=t)throw new Error(`order-key: fraction bounds out of order ('${e}' >= '${t}')`);let i=0;for(;i<t.length&&(e[i]??si)===t[i];)i++;if(i>0)return t.slice(0,i)+Zs(e.slice(i),t.slice(i))}let r=e.length>0?Oo(e[0]):0,n=t!==null?Oo(t[0]):Pd;return n-r>1?oi[Math.floor((r+n)/2)]:oi[r]+Zs(e.slice(1),null)}function FA(e,t){if(e!==null&&Ey(e,"lower bound"),t!==null&&Ey(t,"upper bound"),e!==null&&t!==null&&e>=t)throw new Error(`order-key: bounds out of order ('${e}' >= '${t}')`);if(e===null&&t===null)return ji(1)+"1";if(e===null)return _A(t);if(t===null)return gp(e);let r=Ks(e),n=Ks(t),i=ji(r.integer.length)+r.integer,a=ji(n.integer.length)+n.integer;if(i===a)return i+Zs(r.fraction,n.fraction);let o=gp(i+(ed(r.integer)?qb:""));return Yb(o,t)<0?o:i+Zs(r.fraction,null)}function LA(e){if(e<=0)return[];let t=[],r=FA(null,null);t.push(r);for(let n=1;n<e;n++)r=gp(r),t.push(r);return t}var BA="fill-0",VA="stroke-0";function UA(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string")return;let t=e.trim();if(!/^[+-]?(\d+\.?\d*|\.\d+)$/.test(t))return;let r=Number.parseFloat(t);return Number.isFinite(r)?r:void 0}function zy(e){let t={id:BA,kind:"fill"};return e.fillColor!==void 0&&(t.color=e.fillColor),e.fillType!==void 0&&(t.paintType=e.fillType),e.fillGradient!==void 0&&(t.gradient=e.fillGradient),e.fillLibraryId!==void 0&&(t.libraryId=e.fillLibraryId),e.fillOpacity!==void 0&&(t.opacity=e.fillOpacity),e.authoredFillPaint!==void 0&&(t.authoredPaint=e.authoredFillPaint),t}function Ry(e){let t={id:VA,kind:"stroke"};e.borderColor!==void 0&&(t.color=e.borderColor),e.strokeType!==void 0&&(t.paintType=e.strokeType),e.strokeGradient!==void 0&&(t.gradient=e.strokeGradient),e.strokeLibraryId!==void 0&&(t.libraryId=e.strokeLibraryId),e.strokeOpacity!==void 0&&(t.opacity=e.strokeOpacity);let r=UA(e.borderWidth);return r!==void 0&&(t.width=r),e.strokeLinejoin!==void 0&&(t.linejoin=e.strokeLinejoin),e.strokeLinecap!==void 0&&(t.linecap=e.strokeLinecap),e.strokeMiterlimit!==void 0&&(t.miterlimit=e.strokeMiterlimit),e.strokeDasharray!==void 0&&(t.dasharray=e.strokeDasharray),e.dashOffset!==void 0&&(t.dashoffset=e.dashOffset),e.authoredStrokePaint!==void 0&&(t.authoredPaint=e.authoredStrokePaint),t}function GA(e,t){if(!t||!e)return;let r;if(typeof e=="function")r=e(t);else if(e instanceof Map)r=e.get(t);else for(let n of e)if(n.id===t){r=n;break}return r?.kind==="appearance-style"?r:void 0}function Kb(e,t){return GA(t,e.graphicStyleId)}function Zb(e,t){let r=Kb(e,t)?.layers??e.appearance;if(!Array.isArray(r)||r.length===0)return[zy(e),Ry(e)];let n=!1,i=!1;return r.map(a=>a.kind==="fill"&&!n?(n=!0,{...zy(e),..._y(a)}):a.kind==="stroke"&&!i?(i=!0,{...Ry(e),..._y(a)}):a)}function _y(e){let t={id:e.id};return e.enabled!==void 0&&(t.enabled=e.enabled),e.filterLibraryIds!==void 0&&(t.filterLibraryIds=e.filterLibraryIds),t}function WA(e){return e.enabled===!1?!1:e.paintType!=="none"}function XA(e,t){return Zb(e,t).filter(WA)}function HA(e){if(e.length!==2)return!0;let[t,r]=e;return t.kind!=="fill"||r.kind!=="stroke"?!0:e.some(n=>n.enabled===!1||(n.filterLibraryIds?.length??0)>0)}function Jb(e,t){let r=e?.appearance;if(!Array.isArray(r))return;let n=i=>{typeof i=="string"&&i&&t(i)};for(let i of r){if(!i||typeof i!="object")continue;let a=i;n(a.libraryId),n(a.gradient?.id);let o=a.filterLibraryIds;if(Array.isArray(o))for(let s of o)n(s)}}function qA(e,t){Jb({appearance:e.layers},t)}var Fy=Object.freeze({linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"});function YA(e,t,r,n,i=1e-4){if(Math.abs(e)<i&&Math.abs(t)<i&&Math.abs(r-1)<i&&Math.abs(n-1)<i)return"linear";for(let[a,o]of Object.entries(Od))if(o&&Math.abs(e-o[0])<i&&Math.abs(t-o[1])<i&&Math.abs(r-o[2])<i&&Math.abs(n-o[3])<i)return a;return null}function Qb(e,t,r,n){let i=YA(e,t,r,n);return i===null?{easing:"custom-bezier",customBezier:[e,t,r,n]}:{easing:i}}function KA(e){let t=[],r=0,n="";for(let i of e)i==="("?r++:i===")"&&r--,i===","&&r===0?(t.push(n.trim()),n=""):n+=i;return(n.trim()!==""||t.length>0)&&t.push(n.trim()),t}function ZA(e){switch(e){case"jump-start":case"start":return"jump-start";case"jump-end":case"end":return"jump-end";case"jump-none":return"jump-none";case"jump-both":return"jump-both";default:return null}}function JA(e){let t=[];for(let i of e)i.positions.length===0?t.push({value:i.value,position:null}):(t.push({value:i.value,position:i.positions[0]}),i.positions.length===2&&t.push({value:i.value,position:i.positions[1]}));if(t.length<2)return null;t[0].position===null&&(t[0].position=0),t[t.length-1].position===null&&(t[t.length-1].position=1);let r=0;for(;r<t.length;){if(t[r].position!==null){r++;continue}let i=r;for(;i<t.length&&t[i].position===null;)i++;let a=t[r-1].position,o=t[i]?.position??1,s=i-r+1;for(let l=0;l<i-r;l++)t[r+l].position=a+(o-a)*(l+1)/s;r=i}let n=t[0].position;return t.map(i=>{let a=Math.max(n,i.position);return n=a,{value:i.value,position:a}})}function Dd(e){let t=e.trim().toLowerCase();if(!t)return null;if(t==="step-start")return{kind:"steps",count:1,position:"jump-start"};if(t==="step-end")return{kind:"steps",count:1,position:"jump-end"};if(t in Fy)return{kind:"keyword",easing:Fy[t]};let r=/^cubic-bezier\s*\(([^)]*)\)$/u.exec(t);if(r){let l=r[1].split(",").map(p=>Number(p.trim()));if(l.length!==4||l.some(p=>!Number.isFinite(p)))return null;let[u,d,c,f]=l;return u<0||u>1||c<0||c>1?null:{kind:"cubic-bezier",points:[u,d,c,f]}}let n=/^steps\s*\(([^)]*)\)$/u.exec(t);if(n){let l=n[1].split(",").map(c=>c.trim());if(l.length<1||l.length>2||!/^\d+$/u.test(l[0]))return null;let u=Number(l[0]);if(!Number.isInteger(u)||u<1)return null;let d=ZA(l[1]??"jump-end");return!d||d==="jump-none"&&u<2?null:{kind:"steps",count:u,position:d}}let i=/^linear\s*\(([\s\S]*)\)$/u.exec(t);if(!i)return null;let a=KA(i[1]);if(a.length===0)return null;let o=[];for(let l of a){let u=l.split(/\s+/u).filter(Boolean);if(u.length===0)return null;let d=Number(u[0]);if(!Number.isFinite(d))return null;let c=[];for(let f of u.slice(1)){if(!f.endsWith("%"))return null;let p=Number(f.slice(0,-1));if(!Number.isFinite(p))return null;c.push(p/100)}if(c.length>2)return null;o.push({value:d,positions:c})}let s=JA(o);return s&&s.length>=2?{kind:"linear",points:s}:null}function QA(e,t){switch(delete e.customBezier,delete e.linearPoints,delete e.stepsParams,t.kind){case"keyword":e.easing=t.easing;return;case"cubic-bezier":{let r=Qb(...t.points);e.easing=r.easing,r.customBezier&&(e.customBezier=r.customBezier);return}case"steps":e.easing="steps",e.stepsParams={count:t.count,position:t.position};return;case"linear":e.easing="linear-function",e.linearPoints=[...t.points]}}function Ly(e,t,r){let n=1-e;return 3*n*n*e*t+3*n*e*e*r+e*e*e}function By(e,t){let r=Math.max(0,Math.min(1,e)),n=0,i=1,a=r;for(let o=0;o<24;o++){let s=Ly(a,t[0],t[2]);if(Math.abs(s-r)<=1e-8)break;s<r?n=a:i=a,a=(n+i)/2}return Ly(a,t[1],t[3])}function eC(e,t){let r=Math.max(0,Math.min(1,t));if(!e)return r;switch(e.kind){case"keyword":{let n=Od[e.easing];return n?By(r,n):r}case"cubic-bezier":return By(r,e.points);case"steps":{let{count:n,position:i}=e,a=Math.floor(r*n);(i==="jump-start"||i==="jump-both")&&a++;let o=i==="jump-none"?n-1:i==="jump-both"?n+1:n;return Math.max(0,Math.min(1,(a+(i==="jump-none"?-1:0))/o))}case"linear":{let n=e.points;if(r<=n[0].position)return n[0].value;for(let i=1;i<n.length;i++){if(r>n[i].position)continue;let a=n[i-1],o=n[i],s=o.position-a.position;return s<=0?o.value:a.value+(o.value-a.value)*(r-a.position)/s}return n.at(-1).value}}}function ri(e){let t=e.trim(),r=/^(\d+):(\d{2}):(\d{2}(?:\.\d+)?)$/u.exec(t);if(r)return Number(r[1])*3600+Number(r[2])*60+Number(r[3]);let n=/^(\d{2}):(\d{2}(?:\.\d+)?)$/u.exec(t);if(n)return Number(n[1])*60+Number(n[2]);let i=/^([+-]?\d+(?:\.\d+)?)\s*(h|min|ms|s)?$/u.exec(t);if(i){let o=Number(i[1]);switch(i[2]??"s"){case"h":return o*3600;case"min":return o*60;case"ms":return o/1e3;default:return o}}let a=Number.parseFloat(t);return Number.isNaN(a)?0:a}function yp(e,t,r,n,i){if(e===t&&r===n)return i;let a=1e-6,o=8,s=p=>(((1-3*r+3*e)*p+(3*r-6*e))*p+3*e)*p,l=p=>(((1-3*n+3*t)*p+(3*n-6*t))*p+3*t)*p,u=p=>(3*(1-3*r+3*e)*p+2*(3*r-6*e))*p+3*e,d=i;for(let p=0;p<o;p++){let h=s(d)-i;if(Math.abs(h)<a)return l(d);let m=u(d);if(Math.abs(m)<a)break;d-=h/m}let c=0,f=1;for(d=i;c<f;){let p=s(d);if(Math.abs(p-i)<a)return l(d);i>p?c=d:f=d;let h=(f-c)*.5+c;if(h===d)break;d=h}return l(d)}function tC(e,t){let{count:r,position:n}=t;if(r<1)return e;let i=Math.floor(e*r);(n==="jump-start"||n==="jump-both")&&(i+=1),e>=0&&i<0&&(i=0);let a;switch(n){case"jump-start":case"jump-end":a=r;break;case"jump-none":a=r-1;break;case"jump-both":a=r+1;break}return i>a&&(i=a),i/a}function rC(e,t){if(!e||e.length===0)return t;if(e.length===1||t<=e[0].position)return e[0].value;if(t>=e[e.length-1].position)return e[e.length-1].value;let r=0;for(let o=1;o<e.length&&e[o].position<=t;o++)r=o;let n=r+1;if(n>=e.length)return e[r].value;let i=e[n].position-e[r].position;if(i===0)return e[n].value;let a=(t-e[r].position)/i;return e[r].value+a*(e[n].value-e[r].value)}function nC(e,t,r,n,i){let a=Math.max(0,Math.min(1,e));if(t==="linear")return a;if(t==="linear-function"&&n)return rC(n,a);if(t==="steps"&&i)return tC(a,i);if(t==="custom-bezier"&&r)return yp(r[0],r[1],r[2],r[3],a);let o=Od[t];return o?yp(o[0],o[1],o[2],o[3],a):a}function iC(e,t){return nC(t,e.easing,e.customBezier,e.linearPoints,e.stepsParams)}var aC={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ex(e){let t=aC[e.trim().toLowerCase()];return t===void 0?null:{r:t>>16&255,g:t>>8&255,b:t&255}}var oC={color:"css-rgba",angle:"linear"};function sC(e){let t=e.trim().toLowerCase();if(t==="transparent"||t==="none")return{r:0,g:0,b:0,a:0};if(e.startsWith("#")){let i=e.slice(1);if(i.length===3)return{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:1};if(i.length===6)return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:1};if(i.length===8)return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:parseInt(i.slice(6,8),16)/255}}let r=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?/);if(r)return{r:parseInt(r[1],10),g:parseInt(r[2],10),b:parseInt(r[3],10),a:r[4]!==void 0?parseFloat(r[4]):1};let n=ex(t);return n?{...n,a:1}:null}function lC(e){if(!e)return null;let t=e.trim();if(t.startsWith("#")){if(t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1};if(t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}}let r=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?{r:parseInt(r[1],10),g:parseInt(r[2],10),b:parseInt(r[3],10),a:1}:null}function uC(e,t=oC.color){return t==="css-rgba"?sC(e):lC(e)}var vp="[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?",P7=new RegExp(`^\\s*${vp}(?:[\\s,]+${vp})*\\s*$`,"u"),D7=new RegExp(vp,"gu");function dC(e,t){switch(e){case"reverse":return!0;case"alternate":return t%2===1;case"alternate-reverse":return t%2===0;default:return!1}}function cC(e){if(e.cycleDuration!==void 0)return Math.max(0,e.cycleDuration);if(e.keyframes.length<2)return 0;let t=e.keyframes[0]?.time??0,r=e.keyframes[e.keyframes.length-1]?.time??t;return Math.max(0,r-t)}function fC(e){let t=e.keyframes[0]?.time??0;if(!e.beginTrigger)return t;if(e.beginTrigger.type!=="time")return null;let r=Number.parseFloat(e.beginTrigger.value);return Number.isFinite(r)?r:null}function pC(e){if(e.cycleInfinite||e.simpleDuration==="indefinite")return null;let t=fC(e);return t===null?null:t+cC(e)*Math.max(0,e.cycleRepeats??1)}function hC(e){if(!e.fillBackwards||e.keyframes.length===0)return null;let t=e.keyframes[0].time,r=e.beginTrigger?.type==="time"?Number.parseFloat(e.beginTrigger.value):Number.NaN,n=Number.isFinite(r)?Math.max(0,r):t;if(!(n>0))return null;let i=dC(e.cycleBehavior??"restart",0)?e.keyframes.at(-1):e.keyframes[0],a=Array.isArray(i.value)?[...i.value]:i.value;return{...e,id:`${e.id}:backwards-fill`,keyframes:[{time:0,value:a,easing:"linear"},{time:n,value:a,easing:"linear"}],beginTrigger:void 0,endTrigger:void 0,cycleDuration:n,simpleDuration:void 0,cycleRepeats:void 0,cycleInfinite:!1,cycleBehavior:"restart",fill:"remove",fillBackwards:!1,sourceSmilId:void 0,template:void 0,sourceCssAnimationId:void 0}}function bp(e){if(Array.isArray(e))return e.map(bp);if(e===null||typeof e!="object")return e;let t={};for(let r of Object.keys(e).sort()){let n=e[r];n!==void 0&&(t[r]=bp(n))}return t}function ah(e){let t=JSON.stringify(bp(e)),r=2166136261;for(let n=0;n<t.length;n++)r^=t.charCodeAt(n),r=Math.imul(r,16777619);return`fnv1a32:${(r>>>0).toString(16).padStart(8,"0")}:${t.length}`}var mC=/^(?:-(?:webkit|moz|o|ms)-)?animation(?:-[a-z-]+)?$/i;function oh(e){return mC.test(e.trim())}function tx(e){if(!e)return;let t=Object.fromEntries(Object.entries(e).filter(([r])=>!oh(r)));return Object.keys(t).length>0?t:void 0}function gC(e){if(!e)return;let t=Object.fromEntries(Object.entries(e).filter(([r])=>oh(r)).sort(([r],[n])=>r.localeCompare(n)));return Object.keys(t).length>0?t:void 0}function rx(e){let t=new Map,r=n=>{let i=gC(n.state.inlineStyle);i&&t.set(n.id,i);let a=n.state.children;for(let o of a??[])r(o)};for(let n of e??[])r(n);return ah([...t].sort(([n],[i])=>n.localeCompare(i)).map(([n,i])=>({shapeId:n,declarations:i})))}function nx(e){return ah(e??[])}function ix(e){let{id:t,locked:r,sourceCssAnimationId:n,keyframes:i,...a}=e;return ah({...a,keyframes:i.map(({id:o,...s})=>s)})}var yC=new Set(["ease","ease-in","ease-out","ease-in-out","linear","step-start","step-end"]),vC=new Set(["normal","reverse","alternate","alternate-reverse"]),bC=new Set(["none","forwards","backwards","both"]),xC=new Set(["running","paused"]),sh="(?:\\d+(?:\\.\\d+)?|\\.\\d+)",ax=`[+-]?${sh}`,wC=new RegExp(`^${sh}(?:s|ms)$`,"u"),IC=new RegExp(`^${ax}(?:s|ms)$`,"u"),kC=new RegExp(`^${sh}$`,"u");function ox(e){switch(e.kind){case"keyword":return e.easing;case"cubic-bezier":return"custom-bezier";case"steps":return"steps";case"linear":return"linear-function"}}function lh(e){if(!e)return[];let t=[],r=0,n=null,i=!1,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(i){i=!1;continue}if(s==="\\"){i=!0;continue}if(n){s===n&&(n=null);continue}if(s==='"'||s==="'"){n=s;continue}s==="("?r++:s===")"?r=Math.max(0,r-1):s===","&&r===0&&(t.push(e.slice(a,o).trim()),a=o+1)}return t.push(e.slice(a).trim()),t}function uh(e,t){let r=lh(e);return r.length===0?"":r[t%r.length]}function Vy(e){let t=e.trim().replace(/\w+\([^)]*\)/gu,f=>f.replace(/\s+/gu,"")).split(/\s+/u).filter(Boolean);if(t.length===0)return null;let r=0,n=0,i="ease",a={kind:"keyword",easing:"ease"},o="normal",s="1",l="none",u="",d=!1,c=!1;for(let f of t){if(!d&&wC.test(f)){r=f.endsWith("ms")?Number(f.slice(0,-2))/1e3:Number(f.slice(0,-1)),d=!0;continue}if(d&&!c&&IC.test(f)){n=f.endsWith("ms")?Number(f.slice(0,-2))/1e3:Number(f.slice(0,-1)),c=!0;continue}if(/^(?:cubic-bezier|steps|linear)\(/u.test(f)||yC.has(f)){let p=Dd(f);p&&(a=p,i=ox(p));continue}if(vC.has(f)){o=f;continue}if(f==="infinite"){s=f;continue}if(kC.test(f)){s=f;continue}if(bC.has(f)){l=f;continue}xC.has(f)||u||(u=f)}return!u||r<=0?null:{name:u,duration:r,delay:n,easing:i,parsedEasing:a,direction:o,iterationCount:s,fillMode:l}}function Uy(e){let t=new RegExp(`^(${ax})\\s*(s|ms)$`,"iu").exec(e.trim());if(!t)return null;let r=Number(t[1]);return t[2].toLowerCase()==="ms"?r/1e3:r}function SC(e,t,r){let n=c=>uh(t[c],r),i=Uy(n("animation-delay"));i!==null&&(e.delay=i);let a=Uy(n("animation-duration"));a!==null&&a>0&&(e.duration=a);let o=Dd(n("animation-timing-function"));o&&(e.parsedEasing=o,e.easing=ox(o));let s=n("animation-direction");s&&(e.direction=s);let l=n("animation-iteration-count");l&&(e.iterationCount=l);let u=n("animation-fill-mode");u&&(e.fillMode=u);let d=n("animation-name");d&&d!=="none"&&(e.name=d)}function $C(e){let t=lh(e["animation-name"]);if(t.length===0||t.every(n=>!n||n==="none"))return"";let r=["animation-duration","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","animation-fill-mode","animation-play-state"];return t.map((n,i)=>{let a=r.map(o=>uh(e[o],i)).filter(Boolean);return a.push(n),a.join(" ")}).join(", ")}function NC(e){let t=e.fillMode==="forwards"||e.fillMode==="both",r=e.fillMode==="backwards"||e.fillMode==="both";return{...t?{}:{fill:"remove"},...r?{fillBackwards:!0}:{}}}function jd(e){return/[\t\n\f\r ]/u.test(e??"")}function Js(e,t){if(e[t]!=="/"||e[t+1]!=="*")return t;let r=e.indexOf("*/",t+2);return r<0?e.length:r+2}function pu(e,t){let r=t;for(;r<e.length;){if(jd(e[r])){r++;continue}let n=Js(e,r);if(n===r)break;r=n}return r}function td(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n!=="\\"){t+=n;continue}r++;let i=e[r];if(i===void 0)return null;if(i===`
16
+ `||i==="\r"||i==="\f"){i==="\r"&&e[r+1]===`
17
+ `&&r++;continue}if(/[0-9a-f]/iu.test(i)){let a=i;for(;a.length<6&&/[0-9a-f]/iu.test(e[r+1]??"");)a+=e[++r];jd(e[r+1])&&r++;let o=Number.parseInt(a,16);t+=o===0||o>1114111||o>=55296&&o<=57343?"\uFFFD":String.fromCodePoint(o);continue}t+=i}return t}function Qs(e,t,r=!1){let n=[],i=0,a=null,o=!1,s=0;for(let l=0;l<e.length;l++){let u=e[l];if(a){o?o=!1:u==="\\"?o=!0:u===a&&(a=null);continue}if(u==="/"&&e[l+1]==="*"){l=Math.max(l,Js(e,l)-1);continue}if(u==='"'||u==="'"){a=u;continue}if(u==="("||u==="["||u==="{")s++;else if(u===")"||u==="]"||u==="}")s=Math.max(0,s-1);else if(u===t&&s===0&&(n.push(Object.freeze({start:i,end:l})),i=l+1,r))break}return n.push(Object.freeze({start:i,end:e.length})),n}function ha(e,t){return Qs(e,t,t===":").map(r=>e.slice(r.start,r.end))}function MC(e){return!!(e&&(/[-_a-z]/iu.test(e)||e==="\\"))}function AC(e){return!!(e&&(/[-_a-z0-9]/iu.test(e)||e==="\\"))}function CC(e,t){let r=t;for(;r<e.length;){let n=e[r];if(n!=="\\"){if(!AC(n))break;r++;continue}r++;let i=e[r];if(i===void 0||i===`
18
+ `||i==="\r"||i==="\f")break;if(!/[0-9a-f]/iu.test(i)){r++;continue}let a=0;for(;a<6&&/[0-9a-f]/iu.test(e[r]??"");)a++,r++;jd(e[r])&&r++}return r}function Lo(e){let t=[],r=null,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(r){n?n=!1:a==="\\"?n=!0:a===r&&(r=null);continue}if(a==="/"&&e[i+1]==="*"){i=Math.max(i,Js(e,i)-1);continue}if(a==='"'||a==="'"){r=a;continue}if(!MC(a))continue;let o=i,s=CC(e,i);if(e[s]!=="("){i=s-1;continue}let l=s+1,u=1,d=null,c=!1,f=l;for(;f<e.length;f++){let p=e[f];if(d){c?c=!1:p==="\\"?c=!0:p===d&&(d=null);continue}if(p==="/"&&e[f+1]==="*"){f=Math.max(f,Js(e,f)-1);continue}if(p==='"'||p==="'"){d=p;continue}if(p==="(")u++;else if(p===")"&&--u===0)break}if(u!==0){i=s;continue}t.push(Object.freeze({name:td(e.slice(o,s))?.toLowerCase()??e.slice(o,s).toLowerCase(),tokenStart:o,tokenEnd:f+1,argumentsStart:l,argumentsEnd:f})),i=f}return Object.freeze(t)}function OC(e,t){if(e.slice(t,t+3).toLowerCase()!=="url"||e[t+3]!=="(")return!1;let r=e[t-1];return!r||!/[-_a-z0-9]/iu.test(r)}function sl(e){let t=[],r=null,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(r){n?n=!1:a==="\\"?n=!0:a===r&&(r=null);continue}if(a==="/"&&e[i+1]==="*"){i=Math.max(i,Js(e,i)-1);continue}if(a==='"'||a==="'"){r=a;continue}if(!OC(e,i))continue;let o=i,s=pu(e,i+4),l=e[s]==='"'||e[s]==="'"?e[s++]:null;if(s=pu(e,s),e[s]!=="#")continue;s++;let u=s,d=s,c=!1,f=!1;for(;s<e.length;s++){let h=e[s];if(f){f=!1,d=s+1;continue}if(h==="\\"){f=!0,d=s+1;continue}if(l){if(h===l){s=pu(e,s+1),c=e[s]===")";break}d=s+1;continue}if(h===")"){c=!0;break}if(jd(h)||h==="/"&&e[s+1]==="*"){s=pu(e,s),c=e[s]===")";break}d=s+1}if(!c||d<=u)continue;let p=td(e.slice(u,d));p&&(t.push(Object.freeze({targetAuthoredId:p,tokenStart:o,tokenEnd:s+1,targetStart:u,targetEnd:d})),i=s)}return Object.freeze(t)}var sx=String.raw`[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?`,lx="px|pt|pc|in|cm|mm|q|em|rem|%|ex|ch|vw|vh|vmin|vmax",TC=new RegExp(String.raw`^(${sx})\s*(${lx})?$`,"i");var Gy=new RegExp(`(${sx})(${lx})?`,"gi");function jr(e){if(e===null||e.trim().length===0)return null;let t=TC.exec(e.trim());if(!t)return null;let r=Number(t[1]);return Number.isFinite(r)?Object.freeze({value:r,unit:(t[2]??"").toLowerCase()}):null}function Ed(e){if(!e)return Object.freeze([]);Gy.lastIndex=0;let t=[],r;for(;(r=Gy.exec(e))!==null;){let n=Number(r[1]);Number.isFinite(n)&&t.push(Object.freeze({value:n,unit:(r[2]??"").toLowerCase()}))}return Object.freeze(t)}function Sa(e,t){let r=e.value;if(Number.isFinite(r))switch(e.unit.toLowerCase()){case"%":return t.percentBasis===void 0?void 0:r*t.percentBasis/100;case"vw":return t.viewportWidth===void 0?void 0:r*t.viewportWidth/100;case"vh":return t.viewportHeight===void 0?void 0:r*t.viewportHeight/100;case"vmin":return t.viewportWidth===void 0||t.viewportHeight===void 0?void 0:r*Math.min(t.viewportWidth,t.viewportHeight)/100;case"vmax":return t.viewportWidth===void 0||t.viewportHeight===void 0?void 0:r*Math.max(t.viewportWidth,t.viewportHeight)/100;case"em":return t.fontSize===void 0?void 0:r*t.fontSize;case"rem":return t.rootFontSize===void 0?void 0:r*t.rootFontSize;case"ex":return t.xHeight!==void 0?r*t.xHeight:t.fontSize===void 0?void 0:r*.5*t.fontSize;case"ch":return t.chWidth!==void 0?r*t.chWidth:t.fontSize===void 0?void 0:r*.5*t.fontSize;case"":case"px":return r;case"pt":return r*(4/3);case"pc":return r*16;case"in":return r*96;case"cm":return r*(96/2.54);case"mm":return r*(96/25.4);case"q":return r*(96/101.6);default:return}}function at(e,t){let r=jr(e);return r?Sa(r,t):void 0}function li(e){let t=jr(e);if(!(!t||["em","rem","%","ex","ch","vw","vh","vmin","vmax"].includes(t.unit)))return Sa(t,{})}var Pt=Object.freeze([1,0,0,1,0,0]);function Qr(e,t,r,n,i,a){return[e,t,r,n,i,a]}function rd(e){return Qr(e[0]??1,e[1]??0,e[2]??0,e[3]??1,e[4]??0,e[5]??0)}function Zr(e){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function To(e){return Array.isArray(e)&&e.length>=6&&e.slice(0,6).every(Number.isFinite)}function dn(e,t=1e-9){return Math.abs((e[0]??1)-1)<=t&&Math.abs(e[1]??0)<=t&&Math.abs(e[2]??0)<=t&&Math.abs((e[3]??1)-1)<=t&&Math.abs(e[4]??0)<=t&&Math.abs(e[5]??0)<=t}function Re(e,t){return Qr(e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5])}function Lt(e,t){return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}}function Wy(e,t){return{x:e[0]*t.x+e[2]*t.y,y:e[1]*t.x+e[3]*t.y}}function Yt(e,t=0){return Qr(1,0,0,1,e,t)}function zd(e,t=e){return Qr(e,0,0,t,0,0)}function nd(e){let t=e*Math.PI/180,r=Math.cos(t),n=Math.sin(t);return Qr(r,n,-n,r,0,0)}function dh(e){return Qr(1,0,Math.tan(e*Math.PI/180),1,0,0)}function ch(e){return Qr(1,Math.tan(e*Math.PI/180),0,1,0,0)}function fh(e,t){return Re(Re(Yt(e.x,e.y),t),Yt(-e.x,-e.y))}var PC=9,DC=10,jC=12,EC=13,zC=32,Xy=43,RC=44,Hy=45,_C=46,FC=48,LC=57,BC=40,VC=41,UC=69,GC=101,WC=0,XC=1,ux=2,HC=new Map([["matrix",[6]],["translate",[1,2]],["scale",[1,2]],["rotate",[1,3]],["skewX",[1]],["skewY",[1]]]);function qC(e){return e===zC||e===PC||e===DC||e===EC||e===jC}function Gu(e){return e>=FC&&e<=LC}function YC(e){let t=e>=65&&e<=90,r=e>=97&&e<=122;return t||r||Gu(e)}function $o(e){for(;e.pos<e.src.length&&qC(e.src.charCodeAt(e.pos));)e.pos++}function dx(e){let t=e.pos;return $o(e),e.src.charCodeAt(e.pos)===RC?(e.pos++,$o(e),ux):e.pos>t?XC:WC}function qy(e){let t=e.src,r=e.pos,n=r,i=t.charCodeAt(n);(i===Xy||i===Hy)&&n++;let a=!1;for(;n<t.length&&Gu(t.charCodeAt(n));)n++,a=!0;if(t.charCodeAt(n)===_C){let l=n+1;for(;l<t.length&&Gu(t.charCodeAt(l));)l++;l>n+1&&(n=l,a=!0)}if(!a)return null;let o=t.charCodeAt(n);if(o===GC||o===UC){let l=n+1,u=t.charCodeAt(l);(u===Xy||u===Hy)&&l++;let d=l;for(;d<t.length&&Gu(t.charCodeAt(d));)d++;d>l&&(n=d)}let s=Number(t.slice(r,n));return Number.isFinite(s)?(e.pos=n,s):null}function KC(e,t){switch(e){case"matrix":return rd(t);case"translate":return Yt(t[0],t[1]??0);case"scale":return zd(t[0],t[1]??t[0]);case"rotate":return t.length===3?fh({x:t[1],y:t[2]},nd(t[0])):nd(t[0]);case"skewX":return dh(t[0]);case"skewY":return ch(t[0]);default:return null}}function ZC(e){let t=e.src,r=e.pos;for(;e.pos<t.length&&YC(t.charCodeAt(e.pos));)e.pos++;if(e.pos===r)return null;let n=t.slice(r,e.pos),i=HC.get(n);if(!i||($o(e),t.charCodeAt(e.pos)!==BC))return null;e.pos++,$o(e);let a=i[i.length-1],o=qy(e);if(o===null)return null;let s=[o];for(;;){let l=e.pos;dx(e);let u=qy(e);if(u===null){e.pos=l;break}if(s.push(u),s.length>a)return null}return $o(e),t.charCodeAt(e.pos)!==VC||(e.pos++,!i.includes(s.length))?null:KC(n,s)}function JC(e){let t={src:e,pos:0};if($o(t),t.pos>=e.length)return Pt;let r=Pt;for(;;){let n=ZC(t);if(n===null)return null;r=Re(r,n);let i=dx(t);if(t.pos>=e.length)return i===ux?null:r}}var QC=2048,Ss=new Map;function _i(e){if(!e)return Pt;let t=Ss.get(e);if(t!==void 0)return t;let r=JC(e),n=r===null?null:Object.freeze(r);if(Ss.size>=QC){let i=Ss.keys().next().value;i!==void 0&&Ss.delete(i)}return Ss.set(e,n),n}function Fi(e){return _i(e)??Pt}function xp(e){let t=e[0],r=e[1],n=e[2],i=e[3],a=Math.sqrt(t*t+r*r);if(a<1e-12)return{rotation:0,scaleX:0,scaleY:Math.sqrt(n*n+i*i),skewX:0};let o=Math.atan2(r,t),s=(t*i-r*n)/a,l=s!==0?(t*n+r*i)/(a*a):0,u=Math.atan(l),d=180/Math.PI;return{rotation:o*d,scaleX:a,scaleY:s,skewX:u*d}}function cx(e){return!To(e)||dn(e)?null:`matrix(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]})`}function fx(e,t){let r=e.translateX??0,n=e.translateY??0,i=typeof e.rawTransform=="string"?e.rawTransform:"",a=e.rotation??0,o=e.skewX??0,s=e.skewY??0,l=e.scaleX??1,u=e.scaleY??1,d=Yt(r,n);if(i)return Re(d,Fi(i));if(a===0&&o===0&&s===0&&l===1&&u===1)return d;let c=e.customPivot??t;if(!c)return d;let f=Re(Re(Re(nd(a),zd(l,u)),dh(o)),ch(s));return Re(d,fh(c,f))}function ln(e,t){return cx(ni(e,t))}function ni(e,t){let r=e.transformMatrix;return To(r)&&!dn(r)?rd(r):fx(e,t)}function eO(e,t){let r=e.ancestorTransform;if(!To(r)){delete e.ancestorTransform;return}if(dn(r)){delete e.ancestorTransform;return}let n=To(e.transformMatrix)?rd(e.transformMatrix):fx(e,t);e.transformMatrix=Zr(Re(rd(r),n)),delete e.ancestorTransform}function tO(e,t,r){let n=ln(e,{x:t,y:r});return n?`${n} translate(${t}, ${r})`:`translate(${t}, ${r})`}var rO=Object.freeze({left:0,center:50,right:100}),nO=Object.freeze({top:0,center:50,bottom:100});function Mi(e,t,r){let n=jr(e);return!n||n.unit===""&&n.value!==0?null:Sa(n,{...r,percentBasis:t==="x"?r.boxWidth:t==="y"?r.boxHeight:void 0})??null}function Yy(e,t,r){let n=e.trim().toLowerCase(),i=t==="horizontal"?rO:nO;if(Object.hasOwn(i,n))return{kind:"percentage",value:i[n]};let a=jr(n);if(!a||a.unit===""&&a.value!==0)return null;if(a.unit==="%")return{kind:"percentage",value:a.value};let o=Sa(a,r);return o===void 0?null:{kind:"length",value:o}}function Ky(e,t,r){return e.kind==="length"?t+e.value:r===void 0?null:t+e.value*r/100}function px(e,t={}){let r=e.trim().split(/\s+/u).filter(Boolean);if(r.length===0||r.length>3)return null;let n=0;if(r.length===3){let d=Mi(r[2],"z",t);if(d===null||r[2].includes("%"))return null;n=d}let i,a;if(r.length===1){let d=r[0].toLowerCase();d==="top"||d==="bottom"?(i="center",a=r[0]):(i=r[0],a="center")}else{i=r[0],a=r[1];let d=i.toLowerCase(),c=a.toLowerCase(),f=d==="top"||d==="bottom",p=c==="left"||c==="right";f&&(p||c==="center")?[i,a]=[a,i]:d==="center"&&p&&([i,a]=[a,i])}let o=Yy(i,"horizontal",t),s=Yy(a,"vertical",t);if(!o||!s)return null;let l=Ky(o,t.boxX??0,t.boxWidth),u=Ky(s,t.boxY??0,t.boxHeight);return l===null||u===null?null:Object.freeze(n===0?{x:l,y:u}:{x:l,y:u,z:n})}var Rd=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),iO=new Set(["matrix3d","perspective","rotate3d","rotatex","rotatey","rotatez","scale3d","scalez","translate3d","translatez"]),aO=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*(deg|grad|rad|turn)?$/iu;function Zy(e){return e.replace(/\/\*[\s\S]*?\*\//gu,"").trim()===""}function oO(e){let t=[],r="",n=0,i=null,a=!1,o=!1,s=()=>{let l=r.trim();return r="",l?(t.push(l),!0):!1};for(let l=0;l<e.length;l++){let u=e[l];if(i){r+=u,a?a=!1:u==="\\"?a=!0:u===i&&(i=null);continue}if(u==='"'||u==="'"){i=u,r+=u;continue}if(u==="/"&&e[l+1]==="*"){let d=e.indexOf("*/",l+2);if(d<0)return null;r+=" ",l=d+1;continue}if(u==="("){n++,r+=u;continue}if(u===")"){if(n===0)return null;n--,r+=u;continue}if(n===0&&u===","){if(!s())return null;o=!0;continue}if(n===0&&/\s/u.test(u)&&!o){r.trim()&&s();continue}r+=u}return n!==0||i||r.trim()===""&&o||r.trim()&&!s()?null:Object.freeze(t)}function hx(e){if(e.trim().toLowerCase()==="none")return Object.freeze([]);let t=Lo(e);if(t.length===0)return null;let r=[],n=0;for(let i of t){if(!Zy(e.slice(n,i.tokenStart)))return null;let a=oO(e.slice(i.argumentsStart,i.argumentsEnd));if(!a)return null;r.push(Object.freeze({name:i.name,args:a})),n=i.tokenEnd}return Zy(e.slice(n))?Object.freeze(r):null}function xn(e){if(e===void 0||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}function on(e){if(e===void 0)return null;let t=aO.exec(e.trim());if(!t)return null;let r=Number(t[1]);if(!Number.isFinite(r)||!t[2]&&r!==0)return null;switch(t[2]?.toLowerCase()){case"grad":return r*Math.PI/200;case"rad":return r;case"turn":return r*2*Math.PI;default:return r*Math.PI/180}}function ma(e,t){let r=new Array(16).fill(0);for(let n=0;n<4;n++)for(let i=0;i<4;i++)for(let a=0;a<4;a++)r[n*4+i]+=e[n*4+a]*t[a*4+i];return r}function ga(e,t,r){return[1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1]}function Es(e,t,r){return[e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1]}function Ti(e,t,r,n){let i=Math.hypot(e,t,r);if(i===0)return n===0?Rd:null;e/=i,t/=i,r/=i;let a=Math.cos(n),o=Math.sin(n),s=1-a;return[e*e*s+a,e*t*s-r*o,e*r*s+t*o,0,t*e*s+r*o,t*t*s+a,t*r*s-e*o,0,r*e*s-t*o,r*t*s+e*o,r*r*s+a,0,0,0,0,1]}function Xr(e,...t){return t.includes(e.length)}function _d(e,t){let r=e.args;switch(e.name){case"translate":{if(!Xr(r,1,2))return null;let n=Mi(r[0],"x",t),i=Mi(r[1]??"0","y",t);return n===null||i===null?null:ga(n,i,0)}case"translatex":case"translatey":case"translatez":{if(!Xr(r,1))return null;let n=e.name.at(-1),i=Mi(r[0],n,t);return i===null?null:ga(n==="x"?i:0,n==="y"?i:0,n==="z"?i:0)}case"translate3d":{if(!Xr(r,3))return null;let n=Mi(r[0],"x",t),i=Mi(r[1],"y",t),a=Mi(r[2],"z",t);return n===null||i===null||a===null?null:ga(n,i,a)}case"scale":{if(!Xr(r,1,2))return null;let n=xn(r[0]),i=r.length===1?n:xn(r[1]);return n===null||i===null?null:Es(n,i,1)}case"scalex":case"scaley":case"scalez":{if(!Xr(r,1))return null;let n=xn(r[0]);return n===null?null:Es(e.name==="scalex"?n:1,e.name==="scaley"?n:1,e.name==="scalez"?n:1)}case"scale3d":{if(!Xr(r,3))return null;let n=r.map(xn);return n.some(i=>i===null)?null:Es(n[0],n[1],n[2])}case"rotate":case"rotatex":case"rotatey":case"rotatez":{if(!Xr(r,1))return null;let n=on(r[0]);return n===null?null:e.name==="rotatex"?Ti(1,0,0,n):e.name==="rotatey"?Ti(0,1,0,n):Ti(0,0,1,n)}case"rotate3d":{if(!Xr(r,4))return null;let n=xn(r[0]),i=xn(r[1]),a=xn(r[2]),o=on(r[3]);return n===null||i===null||a===null||o===null?null:Ti(n,i,a,o)}case"skew":{if(!Xr(r,1,2))return null;let n=on(r[0]),i=on(r[1]??"0deg");return n===null||i===null?null:[1,Math.tan(n),0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1]}case"skewx":case"skewy":{if(!Xr(r,1))return null;let n=on(r[0]);return n===null?null:e.name==="skewx"?[1,Math.tan(n),0,0,0,1,0,0,0,0,1,0,0,0,0,1]:[1,0,0,0,Math.tan(n),1,0,0,0,0,1,0,0,0,0,1]}case"matrix":{if(!Xr(r,6))return null;let n=r.map(xn);return n.some(i=>i===null)?null:[n[0],n[2],0,n[4],n[1],n[3],0,n[5],0,0,1,0,0,0,0,1]}case"matrix3d":{if(!Xr(r,16))return null;let n=r.map(xn);if(n.some(a=>a===null))return null;let i=[n[0],n[4],n[8],n[12],n[1],n[5],n[9],n[13],n[2],n[6],n[10],n[14],n[3],n[7],n[11],n[15]];return i[12]===0&&i[13]===0&&i[14]===0&&i[15]===1?i:"perspective"}case"perspective":return Xr(r,1)&&Mi(r[0],"z",t)!==null?"perspective":null;default:return null}}function mx(e,t){let r=Rd;for(let n of e){let i=_d(n,t);if(!i||i==="perspective")return i;r=ma(r,i)}return r}function sO(e){let t=hx(e);if(!t)return"invalid";let r=mx(t,{boxWidth:100,boxHeight:100,viewportWidth:100,viewportHeight:100,fontSize:16,rootFontSize:16,xHeight:8,chWidth:8});return r==="perspective"?"unsupported-perspective":r===null?"invalid":null}function id(e){return e.startsWith("translate")?"translate":e.startsWith("scale")?"scale":e.startsWith("rotate")?"rotate":e.startsWith("skew")?"skew":"matrix"}function Jy(e){let t=e.name;return t==="perspective"?null:t.startsWith("translate")?Object.freeze({name:t,args:Object.freeze(e.args.map(()=>"0px"))}):t.startsWith("scale")?Object.freeze({name:t,args:Object.freeze(e.args.map(()=>"1"))}):t==="rotate3d"?Object.freeze({name:t,args:Object.freeze(["0","0","1","0deg"])}):t.startsWith("rotate")||t.startsWith("skew")?Object.freeze({name:t,args:Object.freeze(e.args.map(()=>"0deg"))}):t==="matrix"?Object.freeze({name:t,args:Object.freeze(["1","0","0","1","0","0"])}):t==="matrix3d"?Object.freeze({name:t,args:Object.freeze(Rd.map(String))}):null}function lO(e,t){let r=[...e],n=[...t],i=Math.max(r.length,n.length);for(let a=0;a<i;a++){if(!r[a]&&n[a]){let o=Jy(n[a]);if(!o)return null;r[a]=o}if(!n[a]&&r[a]){let o=Jy(r[a]);if(!o)return null;n[a]=o}}return[r,n]}function Qy(e,t){let r=_d(e,t);return!r||r==="perspective"?null:[r[3],r[7],r[11]]}function e0(e){let t=_d(e,{});return!t||t==="perspective"?null:[t[0],t[5],t[10]]}function qt(e,t,r){return e+(t-e)*r}function uO(e,t,r,n){let i=id(e.name);if(i!==id(t.name))return null;if(i==="translate"){let a=Qy(e,n),o=Qy(t,n);return a&&o?ga(qt(a[0],o[0],r),qt(a[1],o[1],r),qt(a[2],o[2],r)):null}if(i==="scale"){let a=e0(e),o=e0(t);return a&&o?Es(qt(a[0],o[0],r),qt(a[1],o[1],r),qt(a[2],o[2],r)):null}if(i==="rotate"&&e.name===t.name){if(e.name==="rotate3d"){let l=e.args.slice(0,3).map(xn),u=t.args.slice(0,3).map(xn),d=on(e.args[3]),c=on(t.args[3]);if(l.some(v=>v===null)||u.some(v=>v===null)||d===null||c===null)return null;let f=Math.hypot(l[0],l[1],l[2]),p=Math.hypot(u[0],u[1],u[2]);if(f===0||p===0)return null;let h=[l[0]/f,l[1]/f,l[2]/f],m=[u[0]/p,u[1]/p,u[2]/p],g=h[0]*m[0]+h[1]*m[1]+h[2]*m[2];return Math.abs(Math.abs(g)-1)>1e-10?null:Ti(h[0],h[1],h[2],qt(d,g<0?-c:c,r))}let a=on(e.args[0]),o=on(t.args[0]);if(a===null||o===null)return null;let s=qt(a,o,r);return e.name==="rotatex"?Ti(1,0,0,s):e.name==="rotatey"?Ti(0,1,0,s):Ti(0,0,1,s)}if(i==="skew"&&e.name===t.name&&e.args.length===t.args.length){let a=e.args.map(on),o=t.args.map(on);return a.some(s=>s===null)||o.some(s=>s===null)?null:_d({name:e.name,args:a.map((s,l)=>`${qt(s,o[l],r)}rad`)},n)}return null}function dO(e,t,r,n){let i=lO(e,t);if(!i)return null;let a=Rd;for(let o=0;o<i[0].length;o++){let s=uO(i[0][o],i[1][o],r,n);if(!s)return null;a=ma(a,s)}return a}function ad(e){return Math.abs(e[12])>1e-10||Math.abs(e[13])>1e-10||Math.abs(e[14])>1e-10||Math.abs(e[15]-1)>1e-10?null:Qr(e[0],e[4],e[1],e[5],e[3],e[7])}function cO(e){return[e[0],e[2],0,e[4],e[1],e[3],0,e[5],0,0,1,0,0,0,0,1]}function hu(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Of(e){return Math.hypot(e[0],e[1],e[2])}function na(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Tf(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]}function fO(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function pO(e,t,r){let n=e[0],i=t[0],a=r[0],o=e[1],s=t[1],l=r[1],u=e[2],d=t[2],c=r[2],f=n+s+c,p,h,m,g;if(f>0){let b=Math.sqrt(f+1)*2;g=b/4,p=(d-l)/b,h=(a-u)/b,m=(o-i)/b}else if(n>s&&n>c){let b=Math.sqrt(1+n-s-c)*2;g=(d-l)/b,p=b/4,h=(i+o)/b,m=(a+u)/b}else if(s>c){let b=Math.sqrt(1+s-n-c)*2;g=(a-u)/b,p=(i+o)/b,h=b/4,m=(l+d)/b}else{let b=Math.sqrt(1+c-n-s)*2;g=(o-i)/b,p=(a+u)/b,h=(l+d)/b,m=b/4}let v=Math.hypot(p,h,m,g);return[p/v,h/v,m/v,g/v]}function t0(e){if(Math.abs(e[12])>1e-10||Math.abs(e[13])>1e-10||Math.abs(e[14])>1e-10||Math.abs(e[15]-1)>1e-10)return null;let t=[e[0],e[4],e[8]],r=[e[1],e[5],e[9]],n=[e[2],e[6],e[10]],i=Of(t);if(i<1e-12)return null;t=na(t,1/i);let a=hu(t,r);r=Tf(r,na(t,a));let o=Of(r);if(o<1e-12)return null;r=na(r,1/o),a/=o;let s=hu(t,n);n=Tf(n,na(t,s));let l=hu(r,n);n=Tf(n,na(r,l));let u=Of(n);return u<1e-12?null:(n=na(n,1/u),s/=u,l/=u,hu(t,fO(r,n))<0&&(i=-i,t=na(t,-1)),{translate:[e[3],e[7],e[11]],scale:[i,o,u],skew:[a,s,l],quaternion:pO(t,r,n)})}function hO(e,t,r){let n=[...t],i=e.reduce((u,d,c)=>u+d*n[c],0);if(i<0&&(n=n.map(u=>-u),i=-i),i>.9995){let u=e.map((c,f)=>qt(c,n[f],r)),d=Math.hypot(...u);return u.map(c=>c/d)}let a=Math.acos(Math.max(-1,Math.min(1,i))),o=Math.sin(a),s=Math.sin((1-r)*a)/o,l=Math.sin(r*a)/o;return e.map((u,d)=>u*s+n[d]*l)}function mO(e){let[t,r,n,i]=e;return[1-2*(r*r+n*n),2*(t*r-n*i),2*(t*n+r*i),0,2*(t*r+n*i),1-2*(t*t+n*n),2*(r*n-t*i),0,2*(t*n-r*i),2*(r*n+t*i),1-2*(t*t+r*r),0,0,0,0,1]}function gO(e,t,r){let n=t0(e),i=t0(t);if(!n||!i)return null;let a=n.translate.map((d,c)=>qt(d,i.translate[c],r)),o=n.scale.map((d,c)=>qt(d,i.scale[c],r)),s=n.skew.map((d,c)=>qt(d,i.skew[c],r)),l=mO(hO(n.quaternion,i.quaternion,r)),u=[1,s[0],s[1],0,0,1,s[2],0,0,0,1,0,0,0,0,1];return ma(ma(ga(a[0],a[1],a[2]),ma(l,u)),Es(o[0],o[1],o[2]))}function r0(e){return Math.abs(e[2])<1e-10&&Math.abs(e[6])<1e-10&&Math.abs(e[8])<1e-10&&Math.abs(e[9])<1e-10&&Math.abs(e[10]-1)<1e-10&&Math.abs(e[11])<1e-10}function yO(e,t,r){let n=ad(e),i=ad(t);if(!n||!i)return null;let a=xp(n),o=xp(i),s=o.rotation;for(;s-a.rotation>180;)s-=360;for(;s-a.rotation<-180;)s+=360;let l=qt(a.rotation,s,r)*Math.PI/180,u=qt(a.skewX,o.skewX,r)*Math.PI/180,d=qt(a.scaleX,o.scaleX,r),c=qt(a.scaleY,o.scaleY,r),f=Math.cos(l),p=Math.sin(l),h=Math.tan(u);return cO(Qr(f*d,p*d,f*d*h-p*c,p*d*h+f*c,qt(n[4],i[4],r),qt(n[5],i[5],r)))}function vO(e,t,r,n,i,a){return dO(e,t,i,a)||(r0(r)&&r0(n)?yO(r,n,i):gO(r,n,i))}function n0(e,t){return ma(ma(ga(t.x,t.y,t.z??0),e),ga(-t.x,-t.y,-(t.z??0)))}function Si(e){return!Number.isFinite(e)||Math.abs(e)<1e-9?0:Number(e.toFixed(10))}function bO(e){return e.every(t=>t.length===1&&(t[0].name==="rotate"||t[0].name==="rotatez"))}function xO(e,t,r){let n=new Set;for(let i of e)for(let a of i)a.name.startsWith("translate")?(a.name!=="translatey"&&a.name!=="translatez"&&n.add("translateX"),a.name!=="translatex"&&a.name!=="translatez"&&n.add("translateY")):a.name.startsWith("scale")?(a.name!=="scaley"&&a.name!=="scalez"&&n.add("scaleX"),a.name!=="scalex"&&a.name!=="scalez"&&n.add("scaleY")):a.name.startsWith("rotate")?n.add("rotation"):a.name==="skew"||a.name==="skewx"?n.add("skewX"):a.name==="skewy"?n.add("skewY"):(a.name==="matrix"||a.name==="matrix3d")&&(n.add("translateX"),n.add("translateY"),n.add("scaleX"),n.add("scaleY"),n.add("rotation"),n.add("skewX"));return t&&(n.add("translateX"),n.add("translateY"),n.add("scaleX"),n.add("scaleY"),n.add("rotation")),r.some(i=>i.skewX!==0)&&n.add("skewX"),Object.freeze([...n])}function gx(e,t={},r=16){if(e.length===0||!Number.isInteger(r)||r<1)return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let n=e.map(m=>hx(m.transform));if(n.some(m=>m===null))return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let i=n.map(m=>mx(m,t));if(i.some(m=>m==="perspective"))return Object.freeze({status:"unsupported-perspective",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});if(i.some(m=>m===null))return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let a=n,o=i,s=t.transformOrigin,l=bO(a),u=t.retainPureRotationOrigin===!0&&l,d=l?a.map(m=>on(m[0].args[0])*180/Math.PI):null,c=a.some(m=>m.some(g=>iO.has(g.name)))||s!==void 0&&!u&&l||a.some((m,g)=>g>0&&m.length!==a[g-1].length)||a.some((m,g)=>g>0&&m.some((v,b)=>id(v.name)!==id(a[g-1][b]?.name??"matrix"))),f=[];for(let m=0;m<e.length;m++){let g=s&&!u?n0(o[m],s):o[m],v=ad(g);if(!v)return Object.freeze({status:"unsupported-perspective",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});f.push({offset:e[m].offset,matrix:v,...d?{rotation:d[m]}:{}});let b=e[m+1];if(!(!b||!c))for(let y=1;y<r;y++){let I=y/r,x=Math.max(0,Math.min(1,t.progressForInterval?.(m,I)??I)),k=vO(a[m],a[m+1],o[m],o[m+1],x,t);if(!k)return Object.freeze({status:"invalid",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});let $=s&&!u?n0(k,s):k,A=ad($);if(!A)return Object.freeze({status:"unsupported-perspective",stops:Object.freeze([]),sampled:!1,pureRotation:!1,channels:Object.freeze([])});f.push({offset:e[m].offset+(b.offset-e[m].offset)*I,matrix:A,...d?{rotation:qt(d[m],d[m+1],x)}:{}})}}let p=null,h=f.sort((m,g)=>m.offset-g.offset).map(({offset:m,matrix:g,rotation:v})=>{let b=xp(g),y=v??b.rotation;if(v===void 0&&p!==null){for(;y-p>180;)y-=360;for(;y-p<-180;)y+=360}p=y;let I=Qr(...g.map(Si));return Object.freeze({offset:Si(m),matrix:I,translateX:Si(I[4]),translateY:Si(I[5]),rotation:Si(y),scaleX:Si(b.scaleX),scaleY:Si(b.scaleY),skewX:Si(b.skewX),skewY:0})});return Object.freeze({status:"projected",stops:Object.freeze(h),sampled:c,pureRotation:u,channels:xO(a,c,h)})}var mr=Object.freeze({cx:0,cy:0,radius:50,cornerRadius:0,shiftAngle:-90}),_n=Object.freeze({x:0,y:0,width:100,height:60}),pt=Object.freeze({triangle:Object.freeze({...mr}),ngon:Object.freeze({...mr,sides:6}),star:Object.freeze({...mr,arms:5,innerRadiusPercent:50}),cross:Object.freeze({...mr,armWidthPercent:40}),ring:Object.freeze({...mr,innerRadiusPercent:50}),spiral:Object.freeze({...mr,turns:3,thicknessPercent:15,spiralDirection:1}),gear:Object.freeze({...mr,teeth:8,toothDepthPercent:25,holeRadiusPercent:25}),arrow:Object.freeze({...mr,headWidthPercent:100,headLengthPercent:40,shaftWidthPercent:40}),speechBubble:Object.freeze({...mr,tailAngleDeg:45,tailLengthPercent:40,tailWidthPercent:25}),heart:Object.freeze({...mr,lobeRadiusPercent:50,cleftDepthPercent:25}),lightning:Object.freeze({...mr,boltSegments:3,boltJaggednessPercent:40,boltWidthPercent:30}),cloud:Object.freeze({...mr,cloudBumps:5,cloudPuffinessPercent:60}),diamond:Object.freeze({..._n}),parallelogram:Object.freeze({..._n,slantPercent:20}),trapezoid:Object.freeze({..._n,topWidthPercent:70}),terminator:Object.freeze({..._n}),cylinder:Object.freeze({..._n,capHeightPercent:15}),"document-shape":Object.freeze({..._n,waveAmplitudePercent:15})});function i0(e,t,r=-90){let n=[],i=r*Math.PI/180;for(let a=0;a<e;a++){let o=i+a*2*Math.PI/e;n.push({x:t*Math.cos(o),y:t*Math.sin(o)})}return n}function wO(e,t,r,n=-90){let i=[],a=t*(r/100),o=n*Math.PI/180;for(let s=0;s<e*2;s++){let l=o+s*Math.PI/e,u=s%2===0?t:a;i.push({x:u*Math.cos(l),y:u*Math.sin(l)})}return i}function IO(e,t,r=0){let n=e*(t/100)/2,i=[{x:-n,y:-e},{x:n,y:-e},{x:n,y:-n},{x:e,y:-n},{x:e,y:n},{x:n,y:n},{x:n,y:e},{x:-n,y:e},{x:-n,y:n},{x:-e,y:n},{x:-e,y:-n},{x:-n,y:-n}];if(r===0)return i;let a=Math.cos(r*Math.PI/180),o=Math.sin(r*Math.PI/180);return i.map(s=>({x:s.x*a-s.y*o,y:s.x*o+s.y*a}))}function kO(e,t,r,n,i=-90){let a=e*2*(r/100),o=e*(t/100),s=o*(n/100),l=[{x:e,y:0},{x:e-a,y:-o/2},{x:e-a,y:-s/2},{x:-e,y:-s/2},{x:-e,y:s/2},{x:e-a,y:s/2},{x:e-a,y:o/2}];if(i===0)return l;let u=Math.cos(i*Math.PI/180),d=Math.sin(i*Math.PI/180);return l.map(c=>({x:c.x*u-c.y*d,y:c.x*d+c.y*u}))}function SO(e,t,r,n,i=0){let a=e,o=a*(r/100),s=a*(n/100),l=s/2,u=t*Math.PI/180,d=Math.cos(u),c=Math.sin(u),f=Math.abs(d),p=Math.abs(c),h=Math.max(f,p)||1,m={x:d*(a/h),y:c*(a/h)},g={x:m.x+d*o,y:m.y+c*o},v=Math.min(s,a-l),b=-a+l+v,y=a-l-v,I={x:-a,y:-a},x={x:a,y:-a},k={x:a,y:a},$={x:-a,y:a},A;if(f>=p&&d>0){let T=Math.max(b,Math.min(y,m.y)),E={x:a,y:T-l},C={x:a,y:T+l};A=[I,x,E,g,C,k,$]}else if(f>=p&&d<=0){let T=Math.max(b,Math.min(y,m.y)),E={x:-a,y:T+l},C={x:-a,y:T-l};A=[I,x,k,$,E,g,C]}else if(c<0){let T=Math.max(b,Math.min(y,m.x)),E={x:T-l,y:-a},C={x:T+l,y:-a};A=[I,E,g,C,x,k,$]}else{let T=Math.max(b,Math.min(y,m.x)),E={x:T+l,y:a},C={x:T-l,y:a};A=[I,x,k,E,g,C,$]}if(i===0)return A;let S=Math.cos(i*Math.PI/180),M=Math.sin(i*Math.PI/180);return A.map(T=>({x:T.x*S-T.y*M,y:T.x*M+T.y*S}))}function $O(e,t,r,n,i=0){let a=Math.max(2,Math.round(t)),o=e*(r/100),s=e*(n/100)/2,l=a+1,u=[];for(let m=0;m<l;m++){let g=m/(l-1),v=-e+g*2*e,b=0;m>0&&m<l-1&&(b=m%2===1?o:-o),u.push({x:b,y:v})}let d=[],c=[];for(let m=0;m<l;m++){if(m===0||m===l-1){d.push({...u[m]}),c.push({...u[m]});continue}let g=u[m-1],v=u[m],b=u[m+1],y=v.x-g.x,I=v.y-g.y,x=Math.hypot(y,I)||1,k=y/x,$=I/x,A=b.x-v.x,S=b.y-v.y,M=Math.hypot(A,S)||1,T=A/M,E=S/M,C=(k+T)/2,O=($+E)/2,z=Math.hypot(C,O),R,U;z<1e-6?(R=-$,U=k):(R=-O/z,U=C/z),d.push({x:v.x-R*s,y:v.y-U*s}),c.push({x:v.x+R*s,y:v.y+U*s})}let f=[];f.push(d[0]);for(let m=1;m<l-1;m++)f.push(c[m]);f.push(d[l-1]);for(let m=l-2;m>=1;m--)f.push(d[m]);if(i===0)return f;let p=Math.cos(i*Math.PI/180),h=Math.sin(i*Math.PI/180);return f.map(m=>({x:m.x*p-m.y*h,y:m.x*h+m.y*p}))}function NO(e,t,r,n=0){let i=e,a=Math.max(.3,Math.min(.9,t/100)),o=-i*(r/100),s={x:0,y:i},l={x:0,y:o},u={x:-i*a,y:i*.4},d={x:-i*a,y:-i},c={x:i*a,y:-i},f={x:i*a,y:i*.4},p=[s,u,d,l,c,f,s],h=n===0?p:(()=>{let x=Math.cos(n*Math.PI/180),k=Math.sin(n*Math.PI/180);return p.map($=>({x:$.x*x-$.y*k,y:$.x*k+$.y*x}))})(),[m,g,v,b,y,I]=h;return`M ${m.x} ${m.y} C ${g.x} ${g.y} ${v.x} ${v.y} ${b.x} ${b.y} C ${y.x} ${y.y} ${I.x} ${I.y} ${m.x} ${m.y} Z`}function MO(e,t,r,n=0){let i=Math.max(3,Math.round(t)),a=Math.max(.3,Math.min(1,r/100)),o=e,s=o*1.7,l=o*1.15,u=[];for(let $=0;$<i;$++){let A=(90+$/i*360)*Math.PI/180;u.push({x:s/2*Math.cos(A),y:-(l/2)*Math.sin(A)})}let d=.15,c=0;for(let $=0;$<i;$++){let A=u[$],S=u[($+1)%i];c=Math.max(c,Math.hypot(S.x-A.x,S.y-A.y))}let f=c/(2*(1-d))+.001,p=Math.max(f,c*(.68+a*.35)),h=u.map($=>{let A=$.y/(l/2);return p*(1-d*A)});function m($){let A=u[$],S=u[($+1)%i],M=h[$],T=h[($+1)%i],E=S.x-A.x,C=S.y-A.y,O=Math.hypot(E,C)||1,z=(M*M-T*T+O*O)/(2*O),R=Math.sqrt(Math.max(0,M*M-z*z)),U=A.x+z/O*E,V=A.y+z/O*C,Y=-C/O,G=E/O,H={x:U+Y*R,y:V+G*R},X={x:U-Y*R,y:V-G*R};return H.x*H.x+H.y*H.y>X.x*X.x+X.y*X.y?H:X}let g=[];for(let $=0;$<i;$++)g.push(m($));let v=14,b=[];for(let $=0;$<i;$++){let A=u[$],S=h[$],M=g[($-1+i)%i],T=g[$],E=Math.atan2(M.y-A.y,M.x-A.x),C=Math.atan2(T.y-A.y,T.x-A.x)-E;C<=0&&(C+=2*Math.PI);let O=2*Math.PI-C,z=E+C/2,R=E-O/2,U={x:A.x+S*Math.cos(z),y:A.y+S*Math.sin(z)},V={x:A.x+S*Math.cos(R),y:A.y+S*Math.sin(R)},Y=U.x*U.x+U.y*U.y>V.x*V.x+V.y*V.y?C:-O;for(let G=0;G<v;G++){let H=G/v,X=E+H*Y;b.push({x:A.x+S*Math.cos(X),y:A.y+S*Math.sin(X)})}}let y=0;for(let $ of b){let A=Math.max(Math.abs($.x),Math.abs($.y));A>y&&(y=A)}if(y>0&&y!==o){let $=o/y;for(let A of b)A.x*=$,A.y*=$}let I=$=>{if(n===0)return $;let A=Math.cos(n*Math.PI/180),S=Math.sin(n*Math.PI/180);return{x:$.x*A-$.y*S,y:$.x*S+$.y*A}},x=b.map(I),k=`M ${x[0].x} ${x[0].y}`;for(let $=1;$<x.length;$++)k+=` L ${x[$].x} ${x[$].y}`;return k+=" Z",k}function Ai(e,t=0,r=0){if(e.length<3)return"";if(t<=0)return e.map((a,o)=>(o===0?"M":"L")+`${a.x},${a.y}`).join(" ")+" Z";let n=Math.min(t,r*.4),i="";for(let a=0;a<e.length;a++){let o=e[(a-1+e.length)%e.length],s=e[a],l=e[(a+1)%e.length],u={x:o.x-s.x,y:o.y-s.y},d=Math.hypot(u.x,u.y);u.x/=d,u.y/=d;let c={x:l.x-s.x,y:l.y-s.y},f=Math.hypot(c.x,c.y);c.x/=f,c.y/=f;let p=Math.min(n,d/2),h=Math.min(n,f/2),m={x:s.x+u.x*p,y:s.y+u.y*p},g={x:s.x+c.x*h,y:s.y+c.y*h};i+=a===0?`M${m.x},${m.y}`:` L${m.x},${m.y}`,i+=` Q${s.x},${s.y} ${g.x},${g.y}`}return i+" Z"}function AO(e,t,r="evenodd"){let n=e*(t/100),i=r==="nonzero"?1:0;return`M ${e} 0 A ${e} ${e} 0 1 1 ${-e} 0 A ${e} ${e} 0 1 1 ${e} 0 Z M ${n} 0 A ${n} ${n} 0 1 ${i} ${-n} 0 A ${n} ${n} 0 1 ${i} ${n} 0 Z`}function CO(e,t,r,n=1,i=0){let a=e*(r/100),o=Math.round(t*36),s=t*2*Math.PI,l=(e-a/2)/s,u=i*Math.PI/180,d=[],c=[];for(let h=0;h<=o;h++){let m=h/o,g=m*s*n+u,v=l*(m*s)+a/2,b=a/2;d.push({x:(v+b*.3)*Math.cos(g),y:(v+b*.3)*Math.sin(g)}),c.push({x:Math.max(0,v-b*.3)*Math.cos(g),y:Math.max(0,v-b*.3)*Math.sin(g)})}let f=`M ${d[0].x} ${d[0].y}`;for(let h=1;h<d.length;h++)f+=` L ${d[h].x} ${d[h].y}`;let p=c[c.length-1];f+=` L ${p.x} ${p.y}`;for(let h=c.length-2;h>=0;h--)f+=` L ${c[h].x} ${c[h].y}`;return f+=" Z",f}var OO=.2;function TO(e,t,r,n=0){let i=t*(r/100),a=t,o=t-i,s=2*Math.PI/e,l=s*OO/2,u=s/4,d=n*Math.PI/180,c=[];for(let f=0;f<e;f++){let p=d+f*s;c.push({x:o*Math.cos(p),y:o*Math.sin(p)}),c.push({x:a*Math.cos(p+u-l),y:a*Math.sin(p+u-l)}),c.push({x:a*Math.cos(p+u+l),y:a*Math.sin(p+u+l)}),c.push({x:o*Math.cos(p+s/2),y:o*Math.sin(p+s/2)})}return c}function PO(e,t,r,n=0,i=0,a="evenodd",o=0){let s=TO(e,t,r,o),l=Math.min(n,t*.1),u=Ai(s,l,t);if(i>0){let d=t*(i/100),c=a==="nonzero"?1:0;u+=` M ${d} 0 A ${d} ${d} 0 1 ${c} ${-d} 0 A ${d} ${d} 0 1 ${c} ${d} 0 Z`}return u}function DO(e,t,r,n,i,a="round",o="uniform",s){let l=Math.min(r,n)/2,u,d,c,f,p,h,m,g;if(o==="non-uniform"&&s?(u=Math.min(s.radiusTL??i,l),d=Math.min(s.radiusTR??i,l),c=Math.min(s.radiusBR??i,l),f=Math.min(s.radiusBL??i,l),p=s.shapeTL??a,h=s.shapeTR??a,m=s.shapeBR??a,g=s.shapeBL??a):(u=d=c=f=Math.min(i,l),p=h=m=g=a),!(a!=="round"||o==="non-uniform"||u>0&&p!=="round"||d>0&&h!=="round"||c>0&&m!=="round"||f>0&&g!=="round")&&u===d&&d===c&&c===f)return null;let v=`M${e+u},${t}`;return v+=` L${e+r-d},${t}`,v+=mu(h,d,e+r,t,"tr"),v+=` L${e+r},${t+n-c}`,v+=mu(m,c,e+r,t+n,"br"),v+=` L${e+f},${t+n}`,v+=mu(g,f,e,t+n,"bl"),v+=` L${e},${t+u}`,v+=mu(p,u,e,t,"tl"),v+=" Z",v}function mu(e,t,r,n,i){if(t<=0)return"";switch(e){case"round":switch(i){case"tr":return` A${t},${t} 0 0 1 ${r},${n+t}`;case"br":return` A${t},${t} 0 0 1 ${r-t},${n}`;case"bl":return` A${t},${t} 0 0 1 ${r},${n-t}`;case"tl":return` A${t},${t} 0 0 1 ${r+t},${n}`}break;case"scoop":switch(i){case"tr":return` A${t},${t} 0 0 0 ${r},${n+t}`;case"br":return` A${t},${t} 0 0 0 ${r-t},${n}`;case"bl":return` A${t},${t} 0 0 0 ${r},${n-t}`;case"tl":return` A${t},${t} 0 0 0 ${r+t},${n}`}break;case"bevel":switch(i){case"tr":return` L${r},${n+t}`;case"br":return` L${r-t},${n}`;case"bl":return` L${r},${n-t}`;case"tl":return` L${r+t},${n}`}break;case"notch":switch(i){case"tr":return` L${r-t},${n+t} L${r},${n+t}`;case"br":return` L${r-t},${n-t} L${r-t},${n}`;case"bl":return` L${r+t},${n-t} L${r},${n-t}`;case"tl":return` L${r+t},${n+t} L${r+t},${n}`}break}return""}function jO(e,t,r,n,i,a={}){let o=t+n/2,s=r+i/2;switch(e){case"diamond":return`M${o},${r} L${t+n},${s} L${o},${r+i} L${t},${s} Z`;case"parallelogram":{let l=(a.slantPercent??pt.parallelogram.slantPercent)/100*n;return`M${t+l},${r} L${t+n},${r} L${t+n-l},${r+i} L${t},${r+i} Z`}case"trapezoid":{let l=(a.topWidthPercent??pt.trapezoid.topWidthPercent)/100*n,u=(n-l)/2;return`M${t+u},${r} L${t+u+l},${r} L${t+n},${r+i} L${t},${r+i} Z`}case"terminator":{let l=i/2;return`M${t+l},${r} L${t+n-l},${r} A${l},${l} 0 0 1 ${t+n-l},${r+i} L${t+l},${r+i} A${l},${l} 0 0 1 ${t+l},${r} Z`}case"cylinder":{let l=n/2,u=Math.min((a.capHeightPercent??pt.cylinder.capHeightPercent)/100*i,i/2);return`M${t},${r+u} A${l},${u} 0 0 1 ${t+n},${r+u} A${l},${u} 0 0 1 ${t},${r+u} L${t},${r+i-u} A${l},${u} 0 0 0 ${t+n},${r+i-u} L${t+n},${r+u} M${o-l},${r+u} A${l},${u} 0 0 0 ${o+l},${r+u}`}case"document-shape":{let l=(a.waveAmplitudePercent??pt["document-shape"].waveAmplitudePercent)/100*i;return`M${t},${r} L${t+n},${r} L${t+n},${r+i} C${t+n*.75},${r+i-l*2} ${o+n*.25},${r+i+l} ${o},${r+i} C${o-n*.25},${r+i-l} ${t+n*.25},${r+i+l*.5} ${t},${r+i} Z`}}}function ph(e,t,r=!1,n=.5,i,a="preserve"){if(e.length<2)return e.length===1?`M ${e[0].x} ${e[0].y}`:"";switch(t){case"CATMULL_ROM":case"catmull-rom":return FO(e,r,n);case"BASIS":case"basis":return LO(e,r);case"ARC":case"arc":return i&&i.length>0?EO(e,r,i):$s(e,r,"CUBIC",a);case"LINEAR":case"linear":return $s(e,r,"LINEAR",a);case"QUADRATIC":case"quadratic":return $s(e,r,"QUADRATIC",a);case"CUBIC":case"cubic":return $s(e,r,"CUBIC",a);default:return $s(e,r,void 0,a)}}function EO(e,t,r){let n=`M ${e[0].x} ${e[0].y}`,i=0,a={rx:50,ry:50,rotation:0,largeArc:!1,sweep:!0};for(let o=0;o<e.length-1;o++){let s=e[o+1];if(s.isSubpathStart){if(t&&o-i>=1){let u=e[i],d=r?.[o]??a;n+=` A ${d.rx} ${d.ry} ${d.rotation} ${d.largeArc?1:0} ${d.sweep?1:0} ${u.x} ${u.y} Z`}n+=` M ${s.x} ${s.y}`,i=o+1;continue}let l=r?.[o]??a;n+=` A ${l.rx} ${l.ry} ${l.rotation} ${l.largeArc?1:0} ${l.sweep?1:0} ${s.x} ${s.y}`}if(t&&e.length-i>1){let o=e[i],s=r?.[e.length-1]??a;n+=` A ${s.rx} ${s.ry} ${s.rotation} ${s.largeArc?1:0} ${s.sweep?1:0} ${o.x} ${o.y} Z`}return n}function hh(e){return e.map(({type:t,params:r})=>r.length?`${t} ${r.join(" ")}`:t).join(" ")}function zO(e,t,r=!1,n){if(e.length<2)return e.length?[{type:"M",params:[e[0].x,e[0].y]}]:[];switch(t){case"CATMULL_ROM":case"catmull-rom":case"BASIS":case"basis":return null;case"ARC":case"arc":return n?.length?null:ho(e,r,"CUBIC");case"LINEAR":case"linear":return ho(e,r,"LINEAR");case"QUADRATIC":case"quadratic":return ho(e,r,"QUADRATIC");case"CUBIC":case"cubic":return ho(e,r,"CUBIC");default:return ho(e,r)}}function $s(e,t,r,n="preserve"){return hh(ho(e,t,r,n))}function ho(e,t,r,n="preserve"){let i=[o0(e[0],{x:0,y:0})],a=0,o=null,s=null,l=u=>e[u].subpathClosed??t;for(let u=0;u<e.length-1;u++){let d=e[u],c=e[u+1];if(c.isSubpathStart){if(l(a)&&u-a>=1){let h=e[a],m=a0(d,h,o,s,r);m&&i.push(m),i.push({type:"Z",params:[]})}let p=l(a)?e[a]:d;i.push(o0(c,p)),a=u+1,o=null,s=null;continue}i.push(yx(d,c,c.segmentType,o,s,r,n));let f=_O(c.segmentType??r,d,c);o=f,f==="quad"?s=d.handleOut??null:s=null}if(l(a)&&e.length-a>1){let u=e[e.length-1],d=e[a],c=a0(u,d,o,s,r,n);c&&i.push(c),i.push({type:"Z",params:[]})}return i}function a0(e,t,r,n,i,a="preserve"){let o=(t.segmentType??(e.handleOut||t.handleIn?i??"CUBIC":"LINEAR")).toUpperCase();return o==="LINEAR"||o==="HORIZONTAL"||o==="VERTICAL"?null:yx(e,t,t.segmentType,r,n,i,a)}var RO=.001;function Qa(e,t){return Math.abs(e-t)<RO}function o0(e,t){return e.moveRelative?{type:"m",params:[e.x-t.x,e.y-t.y]}:{type:"M",params:[e.x,e.y]}}function _O(e,t,r){let n=(e??(t.handleOut||r.handleIn?"CUBIC":"LINEAR")).toUpperCase();return n==="CUBIC"||n==="SMOOTH_CUBIC"?"cubic":n==="QUADRATIC"||n==="SMOOTH_QUADRATIC"?"quad":null}function yx(e,t,r,n,i,a,o="preserve"){let s=(r??a??(e.handleOut||t.handleIn?"CUBIC":"LINEAR")).toUpperCase(),l=t.segmentRelative===!0,u=h=>l?h.toLowerCase():h,d=h=>l?h-e.x:h,c=h=>l?h-e.y:h;if(s==="LINEAR"||s==="HORIZONTAL"||s==="VERTICAL"){if(o==="preserve"){if((s==="HORIZONTAL"||s==="LINEAR")&&Qa(e.y,t.y))return{type:u("H"),params:[d(t.x)]};if((s==="VERTICAL"||s==="LINEAR")&&Qa(e.x,t.x))return{type:u("V"),params:[c(t.y)]}}return{type:u("L"),params:[d(t.x),c(t.y)]}}if(s==="ARC"){let h=t.arcParams;return h?{type:u("A"),params:[h.rx,h.ry,h.rotation,h.largeArc?1:0,h.sweep?1:0,d(t.x),c(t.y)]}:{type:u("L"),params:[d(t.x),c(t.y)]}}if(s==="QUADRATIC"||s==="SMOOTH_QUADRATIC"){let h=e.handleOut??{x:(e.x+t.x)/2,y:(e.y+t.y)/2};return o==="preserve"&&s==="SMOOTH_QUADRATIC"&&n==="quad"&&i&&Qa(h.x,2*e.x-i.x)&&Qa(h.y,2*e.y-i.y)?{type:u("T"),params:[d(t.x),c(t.y)]}:{type:u("Q"),params:[d(h.x),c(h.y),d(t.x),c(t.y)]}}let f=e.handleOut??{x:e.x,y:e.y},p=t.handleIn??{x:t.x,y:t.y};return o==="preserve"&&s==="SMOOTH_CUBIC"&&n==="cubic"&&e.handleIn&&e.handleOut&&Qa(e.handleOut.x,2*e.x-e.handleIn.x)&&Qa(e.handleOut.y,2*e.y-e.handleIn.y)?{type:u("S"),params:[d(p.x),c(p.y),d(t.x),c(t.y)]}:{type:u("C"),params:[d(f.x),c(f.y),d(p.x),c(p.y),d(t.x),c(t.y)]}}function FO(e,t,r){if(e.length<2)return e.length===1?`M ${e[0].x} ${e[0].y}`:"";let n=r,i=t?[e[e.length-1],...e,e[0],e[1]]:[e[0],...e,e[e.length-1]],a=`M ${e[0].x} ${e[0].y}`,o=t?e.length:e.length-1;for(let s=0;s<o;s++){let l=i[s],u=i[s+1],d=i[s+2],c=i[s+3],f=Math.hypot(d.x-u.x,d.y-u.y),p=Math.hypot(u.x-l.x,u.y-l.y),h=Math.hypot(c.x-d.x,c.y-d.y),m=Math.pow(p,n),g=Math.pow(f,n),v=Math.pow(h,n),b=Math.pow(p,2*n),y=Math.pow(f,2*n),I=Math.pow(h,2*n),x,k,$,A;p<1e-8?(x=u.x,k=u.y):(x=(b*d.x-y*l.x+(2*b+3*m*g+y)*u.x)/(3*m*(m+g)),k=(b*d.y-y*l.y+(2*b+3*m*g+y)*u.y)/(3*m*(m+g))),h<1e-8?($=d.x,A=d.y):($=(I*u.x-y*c.x+(2*I+3*v*g+y)*d.x)/(3*v*(v+g)),A=(I*u.y-y*c.y+(2*I+3*v*g+y)*d.y)/(3*v*(v+g))),a+=` C ${x} ${k} ${$} ${A} ${d.x} ${d.y}`}return t&&(a+=" Z"),a}function LO(e,t){let r=e.length;if(r<2)return r===1?`M ${e[0].x} ${e[0].y}`:"";if(r===2)return`M ${e[0].x} ${e[0].y} L ${e[1].x} ${e[1].y}`;if(t){let a=(e[0].x+4*e[1].x+e[2].x)/6,o=(e[0].y+4*e[1].y+e[2].y)/6,s=`M ${a} ${o}`;for(let l=0;l<r;l++){let u=e[(l+1)%r],d=e[(l+2)%r],c=e[(l+3)%r];s+=Pf(u,d,c)}return s+=" Z",s}let n=e,i=`M ${n[0].x} ${n[0].y}`;i+=` L ${(5*n[0].x+n[1].x)/6} ${(5*n[0].y+n[1].y)/6}`;for(let a=0;a<=r-3;a++)i+=Pf(n[a],n[a+1],n[a+2]);return i+=Pf(n[r-2],n[r-1],n[r-1]),i+=` L ${n[r-1].x} ${n[r-1].y}`,i}function Pf(e,t,r){return` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3} ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3} ${(e.x+4*t.x+r.x)/6} ${(e.y+4*t.y+r.y)/6}`}function BO(e,t,r){let n=Number.isFinite(t)?Math.max(1,t):8,i=Number.isFinite(r)?Math.max(1,r):4;switch(e){case"dashed":case"dotted":case"custom":return`${n} ${i}`;default:return null}}var vx={M:["number","number"],m:["number","number"],L:["number","number"],l:["number","number"],H:["number"],h:["number"],V:["number"],v:["number"],C:["number","number","number","number","number","number"],c:["number","number","number","number","number","number"],S:["number","number","number","number"],s:["number","number","number","number"],Q:["number","number","number","number"],q:["number","number","number","number"],T:["number","number"],t:["number","number"],A:["number","number","number","flag","flag","number","number"],a:["number","number","number","flag","flag","number","number"],Z:[],z:[]},VO=new Set(Object.keys(vx));function UO(e){return e===32||e===9||e===10||e===12||e===13}function Wu(e){return e>=48&&e<=57}function bx(e){return e>=65&&e<=90||e>=97&&e<=122}var GO=class{constructor(e){this.source=e}source;position=0;get length(){return this.source.length}skipWhitespace(){for(;this.position<this.length&&UO(this.source.charCodeAt(this.position));)this.position++}skipOptionalCommaWhitespace(){this.skipWhitespace(),this.source.charCodeAt(this.position)===44&&(this.position++,this.skipWhitespace())}readNumber(){let e=this.position,t=e,r=this.source.charCodeAt(t);(r===43||r===45)&&t++;let n=0;for(;t<this.length&&Wu(this.source.charCodeAt(t));)t++,n++;if(this.source.charCodeAt(t)===46){let o=t;t++;let s=0;for(;t<this.length&&Wu(this.source.charCodeAt(t));)t++,s++;if(s===0){if(n===0)return null;t=o}}else if(n===0)return null;let i=this.source.charCodeAt(t);if(i===101||i===69){let o=t;t++;let s=this.source.charCodeAt(t);(s===43||s===45)&&t++;let l=0;for(;t<this.length&&Wu(this.source.charCodeAt(t));)t++,l++;l===0&&(t=o)}let a=Number(this.source.slice(e,t));return Number.isFinite(a)?(this.position=t,a):null}readFlag(){let e=this.source[this.position];return e!=="0"&&e!=="1"?null:(this.position++,e==="1"?1:0)}};function xx(e,t){return VO.has(e)||(e==="B"||e==="b")&&t.bearing?!0:(e==="R"||e==="r")&&t.catmullRom===!0}function WO(e){if(!e)return!1;let t=e.charCodeAt(0);return Wu(t)||e==="+"||e==="-"||e==="."||e===","}function XO(e,t,r,n){return{code:e,offset:t.position,command:r,message:n}}function Df(e,t,r){let n=[];for(let i=0;i<t.length;i++){i>0||r?e.skipOptionalCommaWhitespace():e.skipWhitespace();let a=t[i]==="flag"?e.readFlag():e.readNumber();if(a===null)return null;n.push(a)}return n}function gu(e,t){if(e.skipWhitespace(),e.position>=e.length)return"end";let r=e.source[e.position];return xx(r,t)?"command":WO(r)?"parameter":bx(r.charCodeAt(0))?"unsupported-command":"unexpected"}function Fd(e,t={}){let r=new GO(e),n=t.extensions??{},i=[],a=!0,o=(s,l,u)=>({commands:i,error:XO(s,r,l,u)});for(;;){if(r.skipWhitespace(),r.position>=r.length)return{commands:i,error:null};let s=r.position,l=r.source[r.position];if(!xx(l,n)){let f=bx(l.charCodeAt(0))?"unsupported-command":"unexpected-content";return o(f,null,`Unexpected path content '${l}'`)}r.position++;let u=l;if(a&&u!=="M"&&u!=="m")return o("initial-moveto-required",u,"Path data must begin with moveto");if(a=!1,u==="Z"||u==="z"){i.push({type:u,params:[],offset:s});let f=gu(r,n);if(f==="end"||f==="command")continue;return o(f==="unsupported-command"?"unsupported-command":"unexpected-content",u,"Closepath cannot be implicitly repeated")}if(u==="B"||u==="b"){let f=[];for(;;){let p=Df(r,["number"],f.length>0);if(!p){if(f.length===0)return o("missing-parameter",u,"Bearing requires at least one angle");break}f.push(p[0]);let h=gu(r,n);if(h!=="parameter"){if(h==="end"||h==="command")break;return i.push({type:u,params:f,offset:s}),o(h==="unsupported-command"?"unsupported-command":"unexpected-content",u,"Invalid bearing command content")}}i.push({type:u,params:f,offset:s});continue}if(u==="R"||u==="r"){let f=[];for(;;){let p=Df(r,["number","number"],f.length>0);if(!p)return o("missing-parameter",u,"Catmull-Rom requires complete coordinate pairs");f.push(...p);let h=gu(r,n);if(h!=="parameter"){if(h==="end"||h==="command")break;return o(h==="unsupported-command"?"unsupported-command":"unexpected-content",u,"Invalid Catmull-Rom command content")}}if(f.length<6)return o("missing-parameter",u,`R/r: needs at least 3 coordinate pairs, got ${f.length/2}`);i.push({type:u,params:f,offset:s});continue}let d=vx[u],c=0;for(;;){let f=Df(r,d,c>0);if(!f)return o("missing-parameter",u,`Incomplete ${u} command parameters`);let p=c>0&&(u==="M"||u==="m")?u==="M"?"L":"l":u;i.push({type:p,params:f,offset:s}),c++;let h=gu(r,n);if(h==="end"||h==="command")break;if(h!=="parameter")return o(h==="unsupported-command"?"unsupported-command":"unexpected-content",u,`Unexpected content in ${u} command`)}}}var go=Math.PI*2;function HO(e,t,r,n){let i=t*t-4*e*r;if(!(i>=0))return;let a=Math.sqrt(i),o=-.5*(t+(t>=0?a:-a));if(e!==0){let s=o/e;s>0&&s<1&&n.push(s)}if(o!==0){let s=r/o;s>0&&s<1&&n.push(s)}}function qO(e,t,r,n,i){let a=1-i;return a*a*a*e+3*a*a*i*t+3*a*i*i*r+i*i*i*n}function YO(e,t,r,n){let i=1-n;return i*i*e+2*i*n*t+n*n*r}function s0(e,t,r,n){let i=e<n?e:n,a=e>n?e:n,o=-e+3*t-3*r+n,s=2*(e-2*t+r),l=t-e,u=[];HO(o,s,l,u);for(let d of u){let c=qO(e,t,r,n,d);c<i&&(i=c),c>a&&(a=c)}return{min:i,max:a}}function l0(e,t,r){let n=e<r?e:r,i=e>r?e:r,a=e-2*t+r;if(a!==0){let o=(e-t)/a;if(o>0&&o<1){let s=YO(e,t,r,o);s<n&&(n=s),s>i&&(i=s)}}return{min:n,max:i}}function u0(e,t,r,n){let i=e*n-t*r>=0?1:-1,a=Math.sqrt((e*e+t*t)*(r*r+n*n));if(a===0)return 0;let o=(e*r+t*n)/a;return o<-1?o=-1:o>1&&(o=1),i*Math.acos(o)}function wx(e,t,r,n,i,a,o,s,l){if(e===s&&t===l||r===0||n===0)return null;let u=Math.abs(r),d=Math.abs(n),c=i%360*Math.PI/180,f=Math.cos(c),p=Math.sin(c),h=(e-s)/2,m=(t-l)/2,g=f*h+p*m,v=-p*h+f*m,b=g*g,y=v*v,I=u*u,x=d*d,k=b/I+y/x;if(k>1){let G=Math.sqrt(k);u*=G,d*=G,I=u*u,x=d*d}let $=I*y+x*b;if($===0)return null;let A=(I*x-$)/$;A<0&&(A=0);let S=Math.sqrt(A);a===o&&(S=-S);let M=S*(u*v/d),T=S*(-(d*g)/u),E=f*M-p*T+(e+s)/2,C=p*M+f*T+(t+l)/2,O=(g-M)/u,z=(v-T)/d,R=(-g-M)/u,U=(-v-T)/d,V=u0(1,0,O,z),Y=u0(O,z,R,U);return!o&&Y>0?Y-=go:o&&Y<0&&(Y+=go),{cx:E,cy:C,rx:u,ry:d,phi:c,theta1:V,deltaTheta:Y}}function KO(e,t){let r=Math.cos(e.phi),n=Math.sin(e.phi),i=t?Lt(t,{x:e.cx,y:e.cy}):{x:e.cx,y:e.cy},a=t?Wy(t,{x:e.rx*r,y:e.rx*n}):{x:e.rx*r,y:e.rx*n},o=t?Wy(t,{x:-e.ry*n,y:e.ry*r}):{x:-e.ry*n,y:e.ry*r};return{cx:i.x,cy:i.y,ux:a.x,uy:a.y,vx:o.x,vy:o.y}}function ZO(e,t){let r=Math.cos(t),n=Math.sin(t);return{x:e.cx+e.ux*r+e.vx*n,y:e.cy+e.uy*r+e.vy*n}}function JO(e,t,r){if(r>=0){let i=(e-t)%go;return i<0&&(i+=go),i<=r}let n=(t-e)%go;return n<0&&(n+=go),n<=-r}function QO(e,t,r,n,i,a,o,s,l,u){let d=u?Lt(u,{x:e,y:t}):{x:e,y:t},c=u?Lt(u,{x:s,y:l}):{x:s,y:l},f={minX:Math.min(d.x,c.x),minY:Math.min(d.y,c.y),maxX:Math.max(d.x,c.x),maxY:Math.max(d.y,c.y)},p=wx(e,t,r,n,i,a,o,s,l);if(!p)return f;let h=KO(p,u),m=Math.atan2(h.vx,h.ux),g=Math.atan2(h.vy,h.uy),v=[m,m+Math.PI,g,g+Math.PI];for(let b of v){if(!JO(b,p.theta1,p.deltaTheta))continue;let y=ZO(h,b);y.x<f.minX&&(f.minX=y.x),y.x>f.maxX&&(f.maxX=y.x),y.y<f.minY&&(f.minY=y.y),y.y>f.maxY&&(f.maxY=y.y)}return f}var eT=class{constructor(e){this.params=e}params;index=0;readNumber(){return this.params[this.index++]??null}readFlag(){let e=this.readNumber();return e===null?null:e===1}};function yu(e,t,r,n){let i=n?Lt(n,{x:t,y:r}):{x:t,y:r};i.x<e.minX&&(e.minX=i.x),i.x>e.maxX&&(e.maxX=i.x),i.y<e.minY&&(e.minY=i.y),i.y>e.maxY&&(e.maxY=i.y),e.any=!0}function mh(e,t){t.minX<e.minX&&(e.minX=t.minX),t.maxX>e.maxX&&(e.maxX=t.maxX),t.minY<e.minY&&(e.minY=t.minY),t.maxY>e.maxY&&(e.maxY=t.maxY),e.any=!0}function d0(e,t,r,n,i,a,o,s,l,u){let d=u?Lt(u,{x:t,y:r}):{x:t,y:r},c=u?Lt(u,{x:n,y:i}):{x:n,y:i},f=u?Lt(u,{x:a,y:o}):{x:a,y:o},p=u?Lt(u,{x:s,y:l}):{x:s,y:l},h=s0(d.x,c.x,f.x,p.x),m=s0(d.y,c.y,f.y,p.y);mh(e,{minX:h.min,maxX:h.max,minY:m.min,maxY:m.max})}function c0(e,t,r,n,i,a,o,s){let l=s?Lt(s,{x:t,y:r}):{x:t,y:r},u=s?Lt(s,{x:n,y:i}):{x:n,y:i},d=s?Lt(s,{x:a,y:o}):{x:a,y:o},c=l0(l.x,u.x,d.x),f=l0(l.y,u.y,d.y);mh(e,{minX:c.min,maxX:c.max,minY:f.min,maxY:f.max})}function Po(e,t){if(!e)return null;let r=Fd(e);return Ix(r.commands,t)}function tT(e,t){return e.some(r=>r.params.some(n=>!Number.isFinite(n)))?Po(hh(e),t):Ix(e,t)}function Ix(e,t){let r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,any:!1},n=0,i=0,a=0,o=0,s=0,l=0,u=null,d="",c=()=>r.any?{minX:r.minX,minY:r.minY,maxX:r.maxX,maxY:r.maxY}:null;for(let f of e){d=f.type;let p=new eT(f.params),h=d>="a"&&d<="z";switch(d){case"M":case"m":{let m=p.readNumber(),g=p.readNumber();if(m===null||g===null)return c();n=h?n+m:m,i=h?i+g:g,a=n,o=i,yu(r,n,i,t),u=null,d=h?"l":"L";break}case"L":case"l":{let m=p.readNumber(),g=p.readNumber();if(m===null||g===null)return c();n=h?n+m:m,i=h?i+g:g,yu(r,n,i,t),u=null;break}case"H":case"h":{let m=p.readNumber();if(m===null)return c();n=h?n+m:m,yu(r,n,i,t),u=null;break}case"V":case"v":{let m=p.readNumber();if(m===null)return c();i=h?i+m:m,yu(r,n,i,t),u=null;break}case"C":case"c":{let m=p.readNumber(),g=p.readNumber(),v=p.readNumber(),b=p.readNumber(),y=p.readNumber(),I=p.readNumber();if(m===null||g===null||v===null||b===null||y===null||I===null)return c();let x=h?n+m:m,k=h?i+g:g,$=h?n+v:v,A=h?i+b:b,S=h?n+y:y,M=h?i+I:I;d0(r,n,i,x,k,$,A,S,M,t),s=$,l=A,u="cubic",n=S,i=M;break}case"S":case"s":{let m=p.readNumber(),g=p.readNumber(),v=p.readNumber(),b=p.readNumber();if(m===null||g===null||v===null||b===null)return c();let y=u==="cubic"?2*n-s:n,I=u==="cubic"?2*i-l:i,x=h?n+m:m,k=h?i+g:g,$=h?n+v:v,A=h?i+b:b;d0(r,n,i,y,I,x,k,$,A,t),s=x,l=k,u="cubic",n=$,i=A;break}case"Q":case"q":{let m=p.readNumber(),g=p.readNumber(),v=p.readNumber(),b=p.readNumber();if(m===null||g===null||v===null||b===null)return c();let y=h?n+m:m,I=h?i+g:g,x=h?n+v:v,k=h?i+b:b;c0(r,n,i,y,I,x,k,t),s=y,l=I,u="quad",n=x,i=k;break}case"T":case"t":{let m=p.readNumber(),g=p.readNumber();if(m===null||g===null)return c();let v=u==="quad"?2*n-s:n,b=u==="quad"?2*i-l:i,y=h?n+m:m,I=h?i+g:g;c0(r,n,i,v,b,y,I,t),s=v,l=b,u="quad",n=y,i=I;break}case"A":case"a":{let m=p.readNumber(),g=p.readNumber(),v=p.readNumber(),b=p.readFlag(),y=p.readFlag(),I=p.readNumber(),x=p.readNumber();if(m===null||g===null||v===null||b===null||y===null||I===null||x===null)return c();let k=h?n+I:I,$=h?i+x:x;mh(r,QO(n,i,m,g,v,b,y,k,$,t)),n=k,i=$,u=null;break}case"Z":case"z":{n=a,i=o,u=null;break}default:return c()}}return c()}function kx(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_")}function rT(e){let t=e.state.symbolOverrides;return!!t&&Object.keys(t).length>0}function wp(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(wp).join(",")}]`:`{${Object.entries(e).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${JSON.stringify(t)}:${wp(r)}`).join(",")}}`}function nT(e){let t=new Map,r=n=>{for(let i of n)t.set(i.id,(t.get(i.id)??0)+1),Array.isArray(i.state.children)&&r(i.state.children)};return r(e),t}function Sx(e,t,r){return e.map(n=>{let i=r.has(n.id)?t[n.id]:void 0,a=i?{...n.state,...i}:{...n.state},o=a.children;return Array.isArray(o)&&(a.children=Sx(o,t,r)),i!==void 0||a.children!==n.state.children?{...n,state:a}:n})}function $x(e,t){let r=String(t.state.variantKey??""),n=r?e.variants?.[r]:void 0,i=n?r:"",a=n??e.shapes,o=[];r&&!n&&o.push({code:"unknown-symbol-variant",shapeId:t.id,message:`Symbol instance ${t.id} requests unknown variant ${r} from ${e.id}; the base definition is used.`});let s=t.state.symbolOverrides??{},l=Object.entries(s),u=a;if(l.length>0){let p=nT(a),h=new Set;for(let[m]of l){let g=p.get(m)??0;g===1?h.add(m):o.push({code:g>1?"ambiguous-symbol-override-target":"unresolved-symbol-override-target",shapeId:t.id,message:g>1?`Symbol instance ${t.id} override target ${m} is ambiguous in ${e.id}.`:`Symbol instance ${t.id} override target ${m} is absent from ${e.id}.`})}u=Sx(a,s,h)}let d=i!==""||l.length>0,c=l.length>0?`${e.id}--ovr-${t.id}`:i?`${e.id}--${kx(i)}`:e.id,f=`${e.id}\0${i}\0${wp(s)}`;return{shapes:u,requestedVariantKey:r,effectiveVariantKey:i,candidateTargetId:c,materializationKey:f,materialized:d,diagnostics:o}}function Nx(e,t=!1){let r=e.state.symbolId??"",n=e.state.variantKey??"";return t||rT(e)?`${r}--ovr-${e.id}`:n?`${r}--${kx(n)}`:r}function iT(e,t,r,n,i=0){let a=r!==void 0&&r>=0?r:void 0,o=n!==void 0&&n>=0?n:void 0,s=Math.max(0,i),l=a??o??s,u=a??l,d=o??l,c=a===0&&o===void 0?void 0:a,f=o===0&&a===void 0?void 0:o;return{rx:Math.min(Math.max(0,u),Math.max(0,e)/2),ry:Math.min(Math.max(0,d),Math.max(0,t)/2),authoredRx:c??(a===void 0&&o===void 0&&s>0?s:void 0),authoredRy:f??(a===void 0&&o===void 0&&s>0?s:void 0)}}function Ge(e,t,r){return Object.freeze({type:e,renderer:t,resolve:r})}function aT(e){let t=e.state,r=t.x??0,n=t.y??0;return{kind:"circle",shapeType:"circle",cx:r,cy:n,r:t.radius??50,defaultPivot:{x:r,y:n}}}function oT(e){let t=e.state,r=t.x??t.cx??0,n=t.y??t.cy??0;return{kind:"ellipse",shapeType:"ellipse",cx:r,cy:n,rx:t.rx??50,ry:t.ry??30,pathLength:t.pathLength,defaultPivot:{x:r,y:n}}}function f0(e){let t=e.state,r=t,n=t.x??0,i=t.y??0,a=e.type==="square"?t.size:void 0,o=a??t.width??100,s=a??t.height??100,l=t.cornerRadius??0,u=iT(o,s,t.rx,t.ry,l),d=r.cornerShape??"round",c=r.cornerMode??"uniform",f=null;return(d!=="round"||c==="non-uniform")&&(f=DO(n,i,o,s,l,d,c,c==="non-uniform"?{radiusTL:r.cornerRadiusTL,radiusTR:r.cornerRadiusTR,radiusBR:r.cornerRadiusBR,radiusBL:r.cornerRadiusBL,shapeTL:r.cornerShapeTL,shapeTR:r.cornerShapeTR,shapeBR:r.cornerShapeBR,shapeBL:r.cornerShapeBL}:void 0)||null),{kind:"rectangle",shapeType:e.type,x:n,y:i,width:o,height:s,rx:u.rx,ry:u.ry,authoredRx:u.authoredRx,authoredRy:u.authoredRy,pathData:f,defaultPivot:{x:n+o/2,y:i+s/2}}}function sT(e){let t=e.state,r=t.x1??0,n=t.y1??0,i=t.x2??0,a=t.y2??0;return{kind:"line",shapeType:"line",x1:r,y1:n,x2:i,y2:a,boundsPolicy:t.sourceRef||t.targetRef||t.routingMode?"linked-line":"analytic",defaultPivot:{x:(r+i)/2,y:(n+a)/2}}}function lT(e){let t=e.state.textX??e.state.x??0,r=e.state.textY??e.state.y??0;return{kind:"text",shapeType:"text",x:t,y:r,boundsPolicy:"measure-text",defaultPivot:{x:t,y:r}}}var Ip=new WeakMap;function Mx(e,t){let r=Ip.get(e);return r?tT(r,t):Po(e.d,t)}function uT(e){let t=e.state,r=t.pathPoints??[],n=t.pathCurveType??"CUBIC",i=t.pathClosed??!1,a=t.pathArcParams,o=zO(r,n,i,a),s=o?void 0:ph(r,n,i,t.pathTension??.5,a),l=r.length>0?t.customPivot??{x:r[0].x,y:r[0].y}:null,u={kind:"path",shapeType:"path",role:"spline",boundsPolicy:r.length<2?"empty":"analytic",get d(){return s??=hh(o)},set d(d){s=d,Ip.delete(u)},placement:null,fillRule:null,defaultPivot:l};return o&&Ip.set(u,o),u}function dT(e){let t=e.state,r=t.polylinePoints??[];return{kind:"polyline",shapeType:"polyline",points:r,closed:t.polylineClosed??!1,defaultPivot:r.length>0?t.customPivot??{x:r[0].x,y:r[0].y}:null}}function vu(e,t,r,n){let i=e.state,a=i.x??0,o=i.y??0,s=i.width??r,l=i.height??n;return{kind:"positioning-rect",shapeType:e.type,role:t,x:a,y:o,width:s,height:l,defaultPivot:{x:a+s/2,y:o+l/2}}}function nn(e,t,r=!1){let n=e.state,i=n.cx??mr.cx,a=n.cy??mr.cy,o={radius:n.radius??mr.radius,cornerRadius:n.cornerRadius??mr.cornerRadius,shiftAngle:n.shiftAngle??mr.shiftAngle,fillRule:n.fillRule??"nonzero"};return{kind:"path",shapeType:e.type,role:"polygon",boundsPolicy:"analytic",d:t(n,o),placement:{x:i,y:a},fillRule:r&&n.fillRule==null?o.fillRule:null,defaultPivot:{x:i,y:a}}}function eo(e,t){let r=e.state,n=r.x??_n.x,i=r.y??_n.y,a=r.width??_n.width,o=r.height??_n.height;return{kind:"path",shapeType:t,role:"flowchart",boundsPolicy:"analytic",d:jO(t,n,i,a,o,{slantPercent:r.slantPercent,topWidthPercent:r.topWidthPercent,capHeightPercent:r.capHeightPercent,waveAmplitudePercent:r.waveAmplitudePercent}),placement:null,fillRule:null,defaultPivot:{x:n+a/2,y:i+o/2}}}function bu(e,t){return{kind:"container",shapeType:e.type,role:t,boundsPolicy:"children",defaultPivot:null}}function cT(e){let t=e.state;return{kind:"embedded-svg",shapeType:"svg",x:t.svgX,y:t.svgY,width:t.svgWidth,height:t.svgHeight,viewBoxX:t.svgViewBoxX,viewBoxY:t.svgViewBoxY,viewBoxWidth:t.svgViewBoxWidth,viewBoxHeight:t.svgViewBoxHeight,preserveAspectRatio:t.svgPreserveAspectRatio,boundsPolicy:"children",defaultPivot:null}}function fT(e){let t=e.state;return{kind:"view",shapeType:"view",viewBoxX:t.viewBoxX,viewBoxY:t.viewBoxY,viewBoxWidth:t.viewBoxWidth,viewBoxHeight:t.viewBoxHeight,preserveAspectRatio:t.viewPreserveAspectRatio,boundsPolicy:"none",defaultPivot:null}}function pT(e){let t=e.state;return{kind:"shape-reference",shapeType:"shape-reference",targetShapeId:t.targetShapeId,offsetX:t.offsetX??0,offsetY:t.offsetY??0,width:t.width,height:t.height,boundsPolicy:"reference",defaultPivot:null}}function hT(e){let t=e.state;return{kind:"symbol-instance",shapeType:"symbol-instance",symbolId:t.symbolId??"",targetId:Nx(e),x:t.x??0,y:t.y??0,width:t.width??100,height:t.height??100,boundsPolicy:"symbol",defaultPivot:null}}var Ax=Object.freeze({rectangle:Ge("rectangle","rectangle",f0),square:Ge("square","rectangle",f0),circle:Ge("circle","circle",aT),ellipse:Ge("ellipse","ellipse",oT),line:Ge("line","line",sT),text:Ge("text","text",lT),image:Ge("image","image",e=>vu(e,"image",100,100)),path:Ge("path","path",uT),polyline:Ge("polyline","polyline",dT),triangle:Ge("triangle","polygon",e=>nn(e,(t,r)=>Ai(i0(3,r.radius,r.shiftAngle),r.cornerRadius,r.radius))),ngon:Ge("ngon","polygon",e=>nn(e,(t,r)=>Ai(i0(t.sides??pt.ngon.sides,r.radius,r.shiftAngle),r.cornerRadius,r.radius))),star:Ge("star","polygon",e=>nn(e,(t,r)=>Ai(wO(t.arms??pt.star.arms,r.radius,t.innerRadiusPercent??pt.star.innerRadiusPercent,r.shiftAngle),r.cornerRadius,r.radius))),cross:Ge("cross","polygon",e=>nn(e,(t,r)=>Ai(IO(r.radius,t.armWidthPercent??pt.cross.armWidthPercent,r.shiftAngle),r.cornerRadius,r.radius))),ring:Ge("ring","polygon",e=>nn(e,(t,r)=>AO(r.radius,t.innerRadiusPercent??pt.ring.innerRadiusPercent,r.fillRule),!0)),spiral:Ge("spiral","polygon",e=>nn(e,(t,r)=>CO(r.radius,t.turns??pt.spiral.turns,t.thicknessPercent??pt.spiral.thicknessPercent,t.spiralDirection??pt.spiral.spiralDirection,r.shiftAngle))),gear:Ge("gear","polygon",e=>nn(e,(t,r)=>PO(t.teeth??pt.gear.teeth,r.radius,t.toothDepthPercent??pt.gear.toothDepthPercent,r.cornerRadius,t.holeRadiusPercent??pt.gear.holeRadiusPercent,r.fillRule,r.shiftAngle),!0)),arrow:Ge("arrow","polygon",e=>nn(e,(t,r)=>Ai(kO(r.radius,t.headWidthPercent??pt.arrow.headWidthPercent,t.headLengthPercent??pt.arrow.headLengthPercent,t.shaftWidthPercent??pt.arrow.shaftWidthPercent,r.shiftAngle),r.cornerRadius,r.radius))),"symbol-instance":Ge("symbol-instance","symbol-instance",hT),group:Ge("group","container",e=>bu(e,"group")),container:Ge("container","container",e=>bu(e,"group")),cloud:Ge("cloud","polygon",e=>nn(e,(t,r)=>MO(r.radius,t.cloudBumps??pt.cloud.cloudBumps,t.cloudPuffinessPercent??pt.cloud.cloudPuffinessPercent,r.shiftAngle))),heart:Ge("heart","polygon",e=>nn(e,(t,r)=>NO(r.radius,t.lobeRadiusPercent??pt.heart.lobeRadiusPercent,t.cleftDepthPercent??pt.heart.cleftDepthPercent,r.shiftAngle))),lightning:Ge("lightning","polygon",e=>nn(e,(t,r)=>Ai($O(r.radius,t.boltSegments??pt.lightning.boltSegments,t.boltJaggednessPercent??pt.lightning.boltJaggednessPercent,t.boltWidthPercent??pt.lightning.boltWidthPercent,r.shiftAngle),r.cornerRadius,r.radius))),speechBubble:Ge("speechBubble","polygon",e=>nn(e,(t,r)=>Ai(SO(r.radius,t.tailAngleDeg??pt.speechBubble.tailAngleDeg,t.tailLengthPercent??pt.speechBubble.tailLengthPercent,t.tailWidthPercent??pt.speechBubble.tailWidthPercent,r.shiftAngle),r.cornerRadius,r.radius))),diamond:Ge("diamond","flowchart",e=>eo(e,"diamond")),parallelogram:Ge("parallelogram","flowchart",e=>eo(e,"parallelogram")),trapezoid:Ge("trapezoid","flowchart",e=>eo(e,"trapezoid")),terminator:Ge("terminator","flowchart",e=>eo(e,"terminator")),cylinder:Ge("cylinder","flowchart",e=>eo(e,"cylinder")),"document-shape":Ge("document-shape","flowchart",e=>eo(e,"document-shape")),hyperlink:Ge("hyperlink","hyperlink",e=>bu(e,"hyperlink")),switch:Ge("switch","switch",e=>bu(e,"switch")),svg:Ge("svg","svg",cT),view:Ge("view","view",fT),"shape-reference":Ge("shape-reference","shape-reference",pT),video:Ge("video","media",e=>vu(e,"video",320,180)),audio:Ge("audio","media",e=>vu(e,"audio",320,180)),"foreign-object":Ge("foreign-object","foreign-object",e=>vu(e,"foreign-object",100,100))}),j7=Object.freeze(Object.keys(Ax));function gh(e){return Ax[e]}function Bo(e){return gh(e.type)?.resolve(e)??null}function p0(e,t,r,n){return r<0||n<0?null:{minX:e,minY:t,maxX:e+r,maxY:t+n}}function mT(e){if(e.length===0)return{minX:0,minY:0,maxX:0,maxY:0};let t=e[0].x,r=e[0].y,n=e[0].x,i=e[0].y;for(let a=1;a<e.length;a++){let o=e[a];o.x<t&&(t=o.x),o.x>n&&(n=o.x),o.y<r&&(r=o.y),o.y>i&&(i=o.y)}return{minX:t,minY:r,maxX:n,maxY:i}}function Cx(e,t){let r=Bo(e);if(!r)return null;switch(r.kind){case"circle":return r.r<0?null:{minX:r.cx-r.r,minY:r.cy-r.r,maxX:r.cx+r.r,maxY:r.cy+r.r};case"ellipse":return r.rx<0||r.ry<0?null:{minX:r.cx-r.rx,minY:r.cy-r.ry,maxX:r.cx+r.rx,maxY:r.cy+r.ry};case"rectangle":return r.pathData?Po(r.pathData):p0(r.x,r.y,r.width,r.height);case"line":return r.boundsPolicy==="linked-line"?null:{minX:Math.min(r.x1,r.x2),minY:Math.min(r.y1,r.y2),maxX:Math.max(r.x1,r.x2),maxY:Math.max(r.y1,r.y2)};case"text":return t?.measureText?.(e,r)??null;case"path":return r.boundsPolicy==="empty"?null:Mx(r,r.placement?Yt(r.placement.x,r.placement.y):void 0);case"polyline":return mT(r.points);case"positioning-rect":return p0(r.x,r.y,r.width,r.height);case"container":case"embedded-svg":case"view":case"shape-reference":case"symbol-instance":return null}}function gT(e,t){let r=Cx(e,t);return r?{x:(r.minX+r.maxX)/2,y:(r.minY+r.maxY)/2}:null}var Ox=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/u,yT=/[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?/gu;function od(e){return(e.match(yT)??[]).map(Number).filter(Number.isFinite)}function vT(e){let t=od(e),r=t.length-t.length%2,n=[];for(let i=0;i<r;i+=2)n.push(`${t[i]},${t[i+1]}`);return n.join(" ")}function xu(e,t){let r=od(e),n=od(t),i=r.length-r.length%2,a=n.length-n.length%2;if(i!==a)return null;if(i===0)return"";let o=[];for(let s=0;s<i;s+=2)o.push(`${r[s]+n[s]},${r[s+1]+n[s+1]}`);return o.join(" ")}function Tx(e){return e.additive==="sum"||e.values==null&&e.from==null&&e.to==null&&e.by!=null?"sum":"replace"}function ll(e,t,r="number"){if(r==="points"){let n=s=>vT(s.trim()),i=Tx(e)==="sum",a=t===void 0?void 0:n(t),o=s=>{if(!i||a===void 0)return[...s];let l=s.map(u=>xu(a,u));return l.every(u=>u!==null)?l:null};if(e.values){let s=e.values.split(";").map(l=>l.trim()).filter(Boolean).map(n);return s.length===0?null:o(s)}if(e.from!=null&&e.to!=null)return o([n(e.from),n(e.to)]);if(e.from!=null&&e.by!=null){let s=n(e.from),l=xu(s,n(e.by));return l===null?null:o([s,l])}if(e.to!=null&&a!==void 0){let s=n(e.to);if(!i)return[a,s];let l=xu(a,s);return l===null?null:[a,l]}if(e.by!=null&&a!==void 0){let s=xu(a,n(e.by));return s===null?null:[a,s]}return null}if(e.values){let n=e.values.split(";").map(i=>i.trim()).filter(Boolean);return n.length===0?null:n}if(e.from!=null&&e.to!=null)return[e.from.trim(),e.to.trim()];if(e.from!=null&&e.by!=null){let n=Number(e.from),i=Number(e.by);return Number.isFinite(n)&&Number.isFinite(i)?[String(n),String(n+i)]:null}if(e.to!=null&&t!==void 0)return[t.trim(),e.to.trim()];if(e.by!=null){let n=Number(e.by);return Number.isFinite(n)?["0",String(n)]:null}return null}function Px(e){let t=e.dur?.trim();return!t||t==="indefinite"||t==="media"?0:ri(t)}function Vo(e,t,r=e.calcMode??"linear"){if(e.keyTimes){let n=e.keyTimes.split(";").map(i=>i.trim());if(n.length===t&&n.every(i=>Ox.test(i)))return n.map(Number)}return t<=1?t===1?[0]:[]:r==="discrete"?Array.from({length:t},(n,i)=>i/t):Array.from({length:t},(n,i)=>i/(t-1))}function Uo(e){return e.keySplines?e.keySplines.split(";").map(t=>t.trim()).filter(Boolean).map(t=>{let r=od(t);return[r[0]??0,r[1]??0,r[2]??0,r[3]??0]}):[]}function bT(e){if(e.repeatCount==="indefinite")return{cycleInfinite:!0};if(e.repeatCount&&Ox.test(e.repeatCount.trim())){let t=Number(e.repeatCount);if(t>1)return{cycleRepeats:Math.round(t)}}if(e.repeatDur==="indefinite")return{cycleInfinite:!0};if(e.repeatDur){let t=ri(e.repeatDur),r=Px(e);if(t>0&&r>0){let n=Math.max(1,Math.ceil(t/r));if(n>1)return{cycleRepeats:n}}}return{}}function xT(e){return e.fill==="freeze"?{}:{fill:"remove"}}function Fn(e,t,r,n,i,a){let o=[];for(let s=0;s<e.length&&s<t.length;s++){let l=e[s].trim(),u=a==="color"||a==="path"||a==="points"||a==="numberList"||a==="discrete",d=Number(l),c={time:t[s]*n,value:u||!Number.isFinite(d)?l:d,easing:"linear"};if(s>0&&i==="spline"&&r[s-1]){let f=Qb(...r[s-1]);c.easing=f.easing,f.customBezier&&(c.customBezier=f.customBezier)}else s>0&&i==="discrete"&&(c.easing="steps",c.stepsParams={count:1,position:"jump-end"});o.push(c)}return o}var fe="all-svg-elements",Dx=[["alignment-baseline",!1,"auto",fe],["baseline-shift",!1,"0",fe],["clip",!1,"auto",fe],["clip-path",!1,"none",fe],["clip-rule",!0,"nonzero",fe],["color",!0,"black",fe],["color-interpolation",!0,"sRGB",fe],["color-interpolation-filters",!0,"linearRGB",fe],["color-rendering",!0,"auto",fe],["cursor",!0,"auto",fe],["direction",!0,"ltr",fe],["display",!1,"inline",fe],["dominant-baseline",!0,"auto",fe],["fill",!0,"black",fe],["fill-opacity",!0,"1",fe],["fill-rule",!0,"nonzero",fe],["filter",!1,"none",fe],["flood-color",!1,"black",fe],["flood-opacity",!1,"1",fe],["font-family",!0,"serif",fe],["font-feature-settings",!0,"normal",fe],["font-kerning",!0,"auto",fe],["font-size",!0,"medium",fe],["font-size-adjust",!0,"none",fe],["font-stretch",!0,"normal",fe],["font-style",!0,"normal",fe],["font-variant",!0,"normal",fe],["font-variant-caps",!0,"normal",fe],["font-variant-east-asian",!0,"normal",fe],["font-variant-ligatures",!0,"normal",fe],["font-variant-numeric",!0,"normal",fe],["font-variant-position",!0,"normal",fe],["font-weight",!0,"normal",fe],["image-rendering",!0,"auto",fe],["letter-spacing",!0,"normal",fe],["lighting-color",!1,"white",fe],["line-height",!0,"normal",fe],["marker-end",!0,"none",fe],["marker-mid",!0,"none",fe],["marker-start",!0,"none",fe],["mask",!1,"none",fe],["mask-image",!1,"none",fe],["opacity",!1,"1",fe],["overflow",!1,"visible",fe],["paint-order",!0,"normal",fe],["pointer-events",!0,"auto",fe],["shape-rendering",!0,"auto",fe],["stop-color",!1,"black",fe],["stop-opacity",!1,"1",fe],["stroke",!0,"none",fe],["stroke-dasharray",!0,"none",fe],["stroke-dashoffset",!0,"0",fe],["stroke-linecap",!0,"butt",fe],["stroke-linejoin",!0,"miter",fe],["stroke-miterlimit",!0,"4",fe],["stroke-opacity",!0,"1",fe],["stroke-width",!0,"1px",fe],["text-anchor",!0,"start",fe],["text-decoration",!1,"none",fe],["text-rendering",!0,"auto",fe],["text-transform",!0,"none","none"],["transform",!1,"none",fe],["transform-box",!1,"view-box","none"],["transform-origin",!1,"50% 50%",fe],["unicode-bidi",!1,"normal",fe],["vector-effect",!1,"none",fe],["visibility",!0,"visible",fe],["word-spacing",!0,"normal",fe],["writing-mode",!0,"horizontal-tb",fe]],wT=new Map(Dx.map(([e,t,r,n="none"])=>[e,Object.freeze({name:e,inherited:t,initialValue:r,presentationAttribute:n})])),jx=Object.freeze(Dx.filter(e=>(e[3]??"none")!=="none").map(e=>e[0]));function el(e){return wT.get(e.toLowerCase())??null}function ul(e){return(el(e)?.presentationAttribute??"none")!=="none"}var Ex=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:h|min|s|ms)?$/iu,zx=/^([A-Za-z_][\w.-]*)\.repeat\((\d+)\)\s*([+-]\s*\S+)?$/u,Rx=/^([A-Za-z_][\w.-]*)\.(begin|end)\s*([+-]\s*\S+)?$/u,IT=class{bySourceId=new Map;beginCache=new Map;resolving=new Set;constructor(e){for(let t of e)t.sourceAnimationId&&!this.bySourceId.has(t.sourceAnimationId)&&this.bySourceId.set(t.sourceAnimationId,t)}activations(e){let t=(e.attributes.begin??"0s").split(";").map(a=>a.trim()).filter(Boolean),r=t.flatMap(a=>{let o=this.resolveEntry(a);return o!==null&&Number.isFinite(o)?[{entry:a,time:o}]:[]}),n=new Map;for(let a of r){let o=n.get(a.time)??[];o.push(a.entry),n.set(a.time,o)}let i=t.length>1&&e.kind!=="discard"&&e.additive!=="sum"&&n.size>1?[...n.entries()].map(([a,o])=>({entries:o,time:a})).sort((a,o)=>a.time-o.time):r.length>0?[{entries:n.get(r[0].time)??[r[0].entry],time:r[0].time}]:[null];return Object.freeze(i.map(a=>{let o=Object.freeze({...e.attributes,...a!==null?{begin:a.entries.join(";")}:{}}),s=a?.time??null,l=e.attributes.end?.split(";")[0]?.trim(),u=l?this.resolveEntry(l):null,d=e.duration;if(e.attributes.values?.split(";").map(c=>c.trim()).filter(Boolean)?.length===1&&s!==null&&e.attributes.end){let c=this.resolveEntry(e.attributes.end.split(";")[0].trim());c!==null&&Number.isFinite(c)&&c>=s&&(d=c-s)}return Object.freeze({...e,attributes:o,duration:d,...s!==null?{resolvedBeginOffset:s}:{},...u!==null&&Number.isFinite(u)?{resolvedEndOffset:u}:{}})}))}resolveCandidateBegin(e){let t=this.beginCache.get(e.animationId);if(t!==void 0)return t;if(this.resolving.has(e.animationId))return null;this.resolving.add(e.animationId);let r=e.attributes.begin?.split(";")[0]?.trim()||"0s",n=this.resolveEntry(r);return this.resolving.delete(e.animationId),n!==null&&this.beginCache.set(e.animationId,n),n}resolveEntry(e){if(!e||e==="0")return 0;if(e==="indefinite")return Number.POSITIVE_INFINITY;if(Ex.test(e))return ri(e);let t=e.match(zx);if(t){let n=this.bySourceId.get(t[1]);if(!n)return null;let i=this.resolveCandidateBegin(n);if(i===null||!Number.isFinite(i))return i;let a=Number(t[2]),o=this.repeatEventTime(n,i,a);return o===null||!Number.isFinite(o)?o:o+this.offset(t[3])}let r=e.match(Rx);if(r){let n=this.bySourceId.get(r[1]);if(!n)return null;let i=this.resolveCandidateBegin(n);if(i===null||!Number.isFinite(i))return i;let a=this.activeDuration(n),o=r[2]==="end"?a!==null?i+a:null:i;return o===null?null:o+this.offset(r[3])}return null}offset(e){return e?ri(e.replace(/\s+/gu,"")):0}repeatEventTime(e,t,r){if(r<1||e.duration<=0)return Number.POSITIVE_INFINITY;let n=this.activeDuration(e);return n===null||r*e.duration>=n?Number.POSITIVE_INFINITY:t+r*e.duration}activeDuration(e){if(e.duration<=0)return null;let t=e.attributes.repeatCount,r=e.attributes.repeatDur,n=e.duration,i=!1;if(t==="indefinite"&&(n=Number.POSITIVE_INFINITY,i=!0),t&&t!=="indefinite"){let a=Number(t);Number.isFinite(a)&&a>0&&(n=a*e.duration,i=!0)}if(r==="indefinite")i||(n=Number.POSITIVE_INFINITY);else if(r){let a=ri(r);Number.isFinite(a)&&a>=0&&(n=i?Math.min(n,a):a)}return n}},kT=Object.freeze({property:"referenceTargetShapeId",valueType:"discrete",stateKey:"targetShapeId"}),_x=Object.freeze({property:"textPathMorph",valueType:"path",stateKey:"textPathMorph"}),sd=Object.freeze({cx:{property:"x",valueType:"number",stateKey:"x",cssLengthAxis:"x"},cy:{property:"y",valueType:"number",stateKey:"y",cssLengthAxis:"y"},d:{property:"pathMorph",valueType:"path",stateKey:"d"},display:{property:"display",valueType:"discrete",stateKey:"display"},fill:{property:"fillColor",valueType:"color",stateKey:"fillColor"},"fill-opacity":{property:"fillOpacity",valueType:"number",stateKey:"fillOpacity"},height:{property:"height",valueType:"number",stateKey:"height",cssLengthAxis:"y"},opacity:{property:"opacity",valueType:"number",stateKey:"opacity"},points:{property:"polylinePoints",valueType:"points",stateKey:"points"},r:{property:"radius",valueType:"number",stateKey:"radius",cssLengthAxis:"radius"},rx:{property:"rx",valueType:"number",stateKey:"rx",cssLengthAxis:"x"},ry:{property:"ry",valueType:"number",stateKey:"ry",cssLengthAxis:"y"},stroke:{property:"strokeColor",valueType:"color",stateKey:"borderColor"},target:{property:"linkTarget",valueType:"discrete",stateKey:"linkTarget"},href:{property:"href",valueType:"discrete",stateKey:"href"},"xlink:href":{property:"hrefXlink",valueType:"discrete",stateKey:"hrefXlink"},preserveaspectratio:{property:"svgPreserveAspectRatio",valueType:"discrete",stateKey:"svgPreserveAspectRatio"},clippathunits:{property:"clipPathUnits",valueType:"discrete",stateKey:"clipPathUnits"},spreadmethod:{property:"spreadMethod",valueType:"discrete",stateKey:"spreadMethod"},"stroke-dasharray":{property:"strokeDasharray",valueType:"numberList",stateKey:"strokeDasharray"},"stroke-dashoffset":{property:"strokeDashoffset",valueType:"number",stateKey:"strokeDashoffset"},"stroke-linecap":{property:"strokeLinecap",valueType:"discrete",stateKey:"strokeLinecap"},"stroke-linejoin":{property:"strokeLinejoin",valueType:"discrete",stateKey:"strokeLinejoin"},"stroke-miterlimit":{property:"strokeMiterlimit",valueType:"number",stateKey:"strokeMiterlimit"},"stroke-opacity":{property:"strokeOpacity",valueType:"number",stateKey:"strokeOpacity"},"stroke-width":{property:"strokeWidth",valueType:"number",stateKey:"borderWidth"},startoffset:{property:"textPathStartOffset",valueType:"number",stateKey:"textPathStartOffset"},visibility:{property:"visibility",valueType:"discrete",stateKey:"visibility"},width:{property:"width",valueType:"number",stateKey:"width",cssLengthAxis:"x"},x:{property:"x",valueType:"number",stateKey:"x",cssLengthAxis:"x"},x1:{property:"x1",valueType:"number",stateKey:"x1"},x2:{property:"x2",valueType:"number",stateKey:"x2"},y:{property:"y",valueType:"number",stateKey:"y",cssLengthAxis:"y"},y1:{property:"y1",valueType:"number",stateKey:"y1"},y2:{property:"y2",valueType:"number",stateKey:"y2"}}),ST=Object.freeze({...sd,"font-size":{property:"fontSize",valueType:"number",stateKey:"fontSize"}}),$T=/[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?/gu;function Fx(e){return(e.match($T)??[]).map(Number).filter(Number.isFinite)}function Lx(e,t){let r=e?.[t];if(r!=null)return Array.isArray(r)?r.join(" "):String(r)}function NT(e){switch(e.property){case"visibility":return"visible";case"display":return"inline";case"opacity":case"fillOpacity":case"strokeOpacity":return"1";default:return}}function Bx(e){let t=e.match(zx);if(t)return{kind:"repeat",sourceAnimationId:t[1],iteration:Number(t[2]),offset:t[3]?ri(t[3].replace(/\s+/gu,"")):0};let r=e.match(Rx);return r?{kind:"syncbase",sourceAnimationId:r[1],event:r[2],offset:r[3]?ri(r[3].replace(/\s+/gu,"")):0}:null}function $n(e){let t=e.attributes.begin?.split(";").map(i=>i.trim()).filter(Boolean),r=t?.[0];if(!r||r==="0"||r==="0s")return{offset:0};if(/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:h|min|s|ms)?$/iu.test(r))return{offset:ri(r)};let n=t?.map(Bx)??[];return n.length>0&&n.every(i=>i!==null)&&Number.isFinite(e.resolvedBeginOffset)?{offset:0,beginTrigger:{type:"time",value:String(e.resolvedBeginOffset),smilRelations:Object.freeze(n)}}:/^[A-Za-z_][\w.-]*(?:\.[A-Za-z_][\w.-]*)?(?:[+-].+)?$/u.test(r)?{offset:0,beginTrigger:{type:"event",value:r}}:{offset:0,beginTrigger:{type:"expression",value:r}}}function yh(e){let t=e.attributes.end?.split(";").map(i=>i.trim()).filter(Boolean),r=t?.[0];if(!r)return;if(Ex.test(r))return{type:"time",value:String(ri(r))};let n=t?.map(Bx)??[];return n.length>0&&n.every(i=>i!==null)&&Number.isFinite(e.resolvedEndOffset)?{type:"time",value:String(e.resolvedEndOffset),smilRelations:Object.freeze(n)}:/^[A-Za-z_][\w.-]*(?:\.[A-Za-z_][\w.-]*)?(?:[+-].+)?$/u.test(r)?{type:"event",value:r}:{type:"expression",value:r}}function Go(e){let t=bT(e.attributes),r=$n(e),n=yh(e);return{enabled:!0,cycleBehavior:"restart",...e.duration>0?{cycleDuration:e.duration}:{},...dl(e)?{simpleDuration:"indefinite"}:{},...e.additive==="sum"?{additive:"sum"}:{},...e.attributes.accumulate?.trim().toLowerCase()==="sum"?{accumulate:"sum"}:{},...t,...xT(e.attributes),...r.beginTrigger?{beginTrigger:r.beginTrigger}:{},...n?{endTrigger:n}:{}}}function dl(e){if(e.kind==="set"||e.kind==="discard")return!1;let t=e.attributes.dur?.trim().toLowerCase();return t===void 0||t===""||t==="indefinite"}function cl(e,t){return e.map(r=>({...r,time:r.time+t}))}function Vx(e,t){return e?t==="fillColor"?e.inheritFill===!0:t==="borderColor"?e.inheritStroke===!0:!1:!1}function ya(e,t,r,n,i){let a=e.attributeName?.toLowerCase();if(!a)return null;let o=i?.projection??sd[a]??{property:a,valueType:"discrete",stateKey:a},s=e.attributes,l=i?.underlying??(Vx(r,o.stateKey)?void 0:Lx(r,o.stateKey))??NT(o),u=l??i?.cascadeUnderlying,d=e.kind==="set"?"discrete":s.calcMode??"linear",c=e.duration,f=$n(e),p=yh(e);if(e.kind==="set"){let b=s.to?.trim();if(!b)return null;let y=Fn([b],[0],[],0,"discrete",o.valueType)[0]?.value;if(y===void 0)return null;let I=[{time:f.offset,value:y,easing:"linear"}];if(c>0&&e.fill==="remove"&&l!==void 0){let x=Fn([l],[0],[],0,"discrete",o.valueType)[0]?.value;if(x===void 0)return null;I.push({time:f.offset+c,value:x,easing:"linear"})}return{id:`svg-animation-${n}`,shapeId:t,property:o.property,enabled:!0,...c>0?{cycleDuration:c}:{},cycleBehavior:"restart",fill:e.fill,calcMode:"discrete",sourceSmilElement:"set",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},...f.beginTrigger?{beginTrigger:f.beginTrigger}:{},...p?{endTrigger:p}:{},keyframes:I}}let h=ll(s,u,o.valueType);if(!h||h.length===0)return null;if(h.length===1){let b=Fn(h,[0],[],c,"discrete",o.valueType)[0]?.value;if(b===void 0)return null;let y=[{time:f.offset,value:b,easing:"linear"}];if(c>0&&e.fill==="remove"&&l!==void 0){let I=Fn([l],[0],[],c,"discrete",o.valueType)[0]?.value;I!==void 0&&y.push({time:f.offset+c,value:I,easing:"linear"})}return{id:`svg-animation-${n}`,shapeId:t,property:o.property,enabled:!0,...c>0?{cycleDuration:c}:{},cycleBehavior:"restart",calcMode:"discrete",sourceSmilElement:"animate",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},...f.beginTrigger?{beginTrigger:f.beginTrigger}:{},...p?{endTrigger:p}:{},keyframes:y}}let m=Vo(s,h.length,d),g=Uo(s),v=cl(Fn(h,m,g,c,d,o.valueType),f.offset);return v.length<2?null:{id:`svg-animation-${n}`,shapeId:t,property:o.property,...Go(e),...d!=="linear"?{calcMode:d}:{},sourceSmilElement:"animate",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},keyframes:v}}var MT=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(%)?$/u;function AT(e){let t={...e.attributes},r=[],n=a=>{let o=MT.exec(a.trim());return o?(r.push(o[2]?"%":"user"),o[1]):null};if(t.values!==void 0){let a=t.values.split(";").map(n);if(a.some(o=>o===null))return null;t.values=a.join(";")}for(let a of["from","to","by"]){let o=t[a];if(o===void 0)continue;let s=n(o);if(s===null)return null;t[a]=s}if(r.length===0)return null;let i=r[0];return r.some(a=>a!==i)?null:{candidate:{...e,attributes:Object.freeze(t)},unit:i}}var CT=Object.freeze({"stop-color":{suffix:"Color",valueType:"color"},"stop-opacity":{suffix:"Opacity",valueType:"number"},offset:{suffix:"Offset",valueType:"number"}});function OT(e,t){return t==="stop-color"?e.color:String(t==="stop-opacity"?e.opacity:e.offset)}function TT(e,t,r,n){let i=e.attributeName?.toLowerCase(),a=e.targetSourceNodeId;if(!t||!i||!a)return[];let o=CT[i];if(!o||e.kind!=="animate"&&e.kind!=="set")return[];let s=[],l=new Set;for(let u of t.candidates)u.stops.forEach((d,c)=>{if(!(d.sourceNodeId!==a&&d.correspondingSourceNodeId!==a)){for(let f of t.bindings)if(!(f.gradientSourceNodeId!==u.sourceNodeId||f.propertyName!=="fill"&&f.propertyName!=="stroke"))for(let p of vh(f.occurrenceId,r)){let h=`${f.propertyName}GradientStop${c}${o.suffix}`,m=`${p.shapeId}|${h}`;if(l.has(m))continue;l.add(m);let g=ya(e,p.shapeId,p.state,n+s.length,{projection:{property:h,valueType:o.valueType,stateKey:h},underlying:OT(d,i)});g&&s.push(g)}}});return s}function vh(e,t){let r=t.textSpanBindingForOccurrence?.(e);if(r)return[r];let n=t.shapeBindingsForOccurrence?.(e);if(n&&n.length>0)return n;let i=t.shapeIdForOccurrence(e);return i?[{shapeId:i,shapeType:"unknown",state:t.shapeStateForOccurrence(e)}]:[]}function kp(e,t,r){return t.textSpanId&&r?{...e,textSpanTarget:{spanIds:[t.textSpanId],attributeName:r}}:e}function PT(e,t){if(e.targetStatus!=="resolved"||!e.targetOccurrenceId)return[];let r=vh(e.targetOccurrenceId,t);if(!r.some(i=>i.shapeType==="group")||e.kind==="animateTransform"||e.kind==="animateMotion"||e.kind==="discard"||ul(e.attributeName?.toLowerCase()??""))return r;let n=t.descendantShapeBindingsForOccurrence?.(e.targetOccurrenceId);return n&&n.length>0?n:r}function jf(e,t){if(e!==void 0)return t.shapeIdForLocalReference?.(e.trim())??e.trim()}function DT(e,t,r,n){let i=e.attributeName?.toLowerCase();if(t.shapeType!=="shape-reference"||i!=="href"&&i!=="xlink:href")return null;let a={...e.attributes,...e.attributes.from!==void 0?{from:jf(e.attributes.from,r)}:{},...e.attributes.to!==void 0?{to:jf(e.attributes.to,r)}:{},...e.attributes.values!==void 0?{values:e.attributes.values.split(";").map(o=>jf(o,r)??"").join(";")}:{}};return ya({...e,attributes:a},t.shapeId,t.state,n,{projection:kT,underlying:String(t.state?.targetShapeId??"")})}function jT(e,t,r){if(e.kind!=="animate"||e.attributeName?.toLowerCase()!=="viewbox")return[];let n=t.shapeType==="svg"?"svgViewBox":t.shapeType==="view"?"viewBox":null;if(!n||e.duration<=0&&!dl(e))return[];let i=ll(e.attributes,void 0,"numberList");if(!i||i.length<2)return[];let a=i.map(Fx);if(a.some(d=>d.length<4))return[];let o=e.attributes.calcMode??"linear",s=Vo(e.attributes,a.length,o),l=Uo(e.attributes),u=$n(e);return["X","Y","Width","Height"].map((d,c)=>({id:`svg-animation-${r+c}`,shapeId:t.shapeId,property:`${n}${d}`,...Go(e),...o!=="linear"?{calcMode:o}:{},sourceSmilElement:"animate",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},keyframes:cl(Fn(a.map(f=>String(f[c])),s,l,e.duration,o,"number"),u.offset)}))}var ET=Object.freeze({property:"className",valueType:"discrete",stateKey:"metadata"});function yo(e){return e.trim().split(/[\t\n\f\r ]+/u).filter(Boolean).join(" ")}function zT(e){if(e.className!==void 0)return yo(e.className);let t=e.state?.metadata;return t?.classes?yo(t.classes.join(" ")):""}function RT(e,t,r){if(!e.targetOccurrenceId||e.attributeName?.toLowerCase()!=="class")return[];let n=zT(t);if(e.kind==="set"){let o=e.attributes.to;if(o===void 0)return[];let s=$n(e),l=yh(e),u=[{time:s.offset,value:yo(o),easing:"linear"}];return e.duration>0&&e.fill==="remove"&&u.push({time:s.offset+e.duration,value:n,easing:"linear"}),[kp({id:`svg-animation-${r}`,shapeId:t.shapeId,property:"className",enabled:!0,...e.duration>0?{cycleDuration:e.duration}:{},cycleBehavior:"restart",fill:e.fill,calcMode:"discrete",sourceSmilElement:"set",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},...s.beginTrigger?{beginTrigger:s.beginTrigger}:{},...l?{endTrigger:l}:{},keyframes:u},t,"class")]}let i={...e.attributes,...e.attributes.values!==void 0?{values:e.attributes.values.split(";").map(yo).filter(Boolean).join(";")}:{},...e.attributes.from!==void 0?{from:yo(e.attributes.from)}:{},...e.attributes.to!==void 0?{to:yo(e.attributes.to)}:{},calcMode:"discrete"},a=ya({...e,attributes:i},t.shapeId,t.state,r,{projection:ET,underlying:n});return a?[kp(a,t,"class")]:[]}function _T(e,t,r,n){let i=t.shapeId,a=e.attributes.type?.trim().toLowerCase();if(!a)return[];let o=e.attributes,s=ll(o,void 0,"numberList");if(!s||s.length<2)return[];let l=o.calcMode??"linear",u=Vo(o,s.length,l),d=Uo(o),c=$n(e),f=Go(e),p=s.map(Fx),h=(m,g,v,b,y)=>{let I=Fn(s.map((x,k)=>{let $=g(p[k]);return Array.isArray($)?$.join(" "):String($)}),u,d,e.duration,l,m==="transformMatrix"?"numberList":"number").map((x,k)=>({...x,time:x.time+c.offset,value:m==="transformMatrix"?p[k].slice(0,6):x.value}));return{id:`svg-animation-${n+v}`,shapeId:i,property:m,...f,additive:e.additive,...e.additive==="replace"&&e.replacesCarrierBase?{replacesCarrierBase:!0}:{},...b?{transformOrigin:b}:{},...y?{targetTransformOrigin:y}:{},...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},keyframes:I}};if(a==="translate")return[h("translateX",m=>m[0]??0,0),h("translateY",m=>m[1]??0,1)];if(a==="scale")return[h("scaleX",m=>m[0]??1,0),h("scaleY",m=>m[1]??m[0]??1,1)];if(a==="rotate"){let m=p.find(y=>y.length>=3),g=t.state?.customPivot,v=e.targetOccurrenceId?r.style(e.targetOccurrenceId)?.cascadedValues["transform-origin"]!==void 0:!1,b=m?{x:m[1]+(g?.x??0),y:m[2]+(g?.y??0)}:g??{x:0,y:0};return[h("rotation",y=>y[0]??0,0,b,v&&g?g:void 0)]}return a==="skewx"||a==="skewy"?[h(a==="skewx"?"skewX":"skewY",m=>m[0]??0,0)]:a==="matrix"&&p.every(m=>m.length>=6)?[h("transformMatrix",m=>m.slice(0,6),0)]:[]}function Ux(e,t,r,n){if(!e.motionPathData||e.duration<=0&&!dl(e))return null;let i=e.attributes.keyPoints?.split(";").map(Number).filter(Number.isFinite),a=i&&i.length>=2?i:[0,1],o=e.attributes.calcMode??"paced",s=Vo(e.attributes,a.length,o),l=Uo(e.attributes),u=$n(e),d=e.attributes.rotate?.trim(),c=d===void 0?Number.NaN:Number(d),f=e.motionPathSourceNodeId?r.shapeIdForSourceNode(e.motionPathSourceNodeId):null,p=e.motionPathElementSourceNodeId?r.elementIdForSourceNode?.(e.motionPathElementSourceNodeId)??e.sourceMpathId:null;return{id:`svg-animation-${n}`,shapeId:t,property:"pathMotion",...Go(e),motionPath:e.motionPathData,...f?{motionPathRef:{shapeId:f,mode:"curveTemplate"}}:{},...p?{sourceMpathId:p}:{},...d==="auto"||d==="auto-reverse"?{motionRotate:d}:Number.isFinite(c)?{motionRotate:c}:{},...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},...o!=="linear"?{calcMode:o}:{},keyframes:cl(Fn(a.map(String),s,l,e.duration,o,"number"),u.offset)}}var FT=new Set(["cx","cy","r","rx","ry","x","y","x1","y1","x2","y2","width","height","opacity","fill-opacity","stroke-opacity","stop-opacity","stroke-width","stroke-dashoffset","stroke-miterlimit","offset","pathlength","startoffset","fr"]),LT=new Set(["fill","stroke","stop-color","flood-color","lighting-color"]);function Un(e){let t={definitionId:e.definitionId,...e.nodeId?{nodeId:e.nodeId}:{}};return{shapeId:Td(t),definitionTarget:t}}function BT(e,t,r,n){let i=Ux(e,Un(t).shapeId,r,n);return i?{...i,property:"targetTransformStack",additive:e.additive,...Un(t),transformFunction:"translate",transformStackIndex:0,transformBaseValue:t.baseTransform}:null}function VT(e,t,r,n){let i=e.attributes.type?.trim();if(i!=="translate"&&i!=="scale"&&i!=="rotate"&&i!=="skewX"&&i!=="skewY"&&i!=="matrix")return null;let a=ll(e.attributes,void 0,"discrete");if(!a||a.length<2||e.duration<=0&&!dl(e))return null;let o=e.attributes.calcMode??"linear",s=Vo(e.attributes,a.length,o),l=Uo(e.attributes),u=$n(e);return{id:`svg-animation-${r}`,...Un(t),property:"targetTransformStack",...Go(e),additive:e.additive,...o!=="linear"?{calcMode:o}:{},sourceSmilElement:"animateTransform",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},transformFunction:i,transformStackIndex:n,transformBaseValue:t.baseTransform,keyframes:cl(Fn(a,s,l,e.duration,o,"discrete"),u.offset)}}function UT(e,t,r){let n=e.attributeName;if(!n||e.kind!=="animate"&&e.kind!=="set")return null;let i=n.toLowerCase(),a=t.baseAttributes[n]??t.baseAttributes[i]??"",o=e.kind==="animate"&&(i==="display"||i==="visibility"),s=e.kind==="set"?"string":FT.has(i)?"number":LT.has(i)?"color":"string";if(e.kind==="set"){let m=e.attributes.to?.trim();if(m===void 0)return null;let g=$n(e),v=[{time:g.offset,value:m,easing:"linear"}];return e.duration>0&&e.fill==="remove"&&v.push({time:g.offset+e.duration,value:a,easing:"linear"}),{id:`svg-animation-${r}`,...Un(t),property:sd[i]?.property??i,enabled:!0,...e.duration>0?{cycleDuration:e.duration}:{},cycleBehavior:"restart",calcMode:"discrete",sourceSmilElement:"set",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},targetAttribute:n,targetAttributeValueType:"string",transformBaseValue:a,keyframes:v}}let l=o||s==="string"?"discrete":s,u=ll(e.attributes,a,l);if(!u||u.length===0||e.duration<=0&&!dl(e))return null;let d=o?"discrete":e.attributes.calcMode??"linear",c=Vo(e.attributes,u.length,d),f=Uo(e.attributes),p=$n(e),h=o?i==="display"?"targetDisplay":"targetVisibility":sd[i]?.property??i;return{id:`svg-animation-${r}`,...Un(t),property:h,...Go(e),calcMode:d,sourceSmilElement:"animate",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},targetAttribute:n,targetAttributeValueType:s,transformBaseValue:a,keyframes:cl(Fn(u,c,f,e.duration,d,l),p.offset)}}function GT(e,t,r,n,i){if(e.kind==="animateMotion")return BT(e,t,r,n);if(e.kind==="animateTransform")return VT(e,t,n,i);if(e.kind==="discard"){let a=$n(e);return{id:`svg-animation-${n}`,...Un(t),property:"discard",enabled:!0,sourceSmilElement:"discard",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},transformBaseValue:t.baseAttributes.display??"",keyframes:[{time:a.offset,value:1,easing:"linear"}]}}return UT(e,t,n)}function WT(e,t,r){return e.kind!=="animate"&&e.kind!=="set"||e.attributeName?.toLowerCase()!=="d"?null:ya(e,t.binding.shapeId,t.binding.state,r,{projection:_x,underlying:t.baseData})}function XT(e,t,r){let n=e.attributeName?.toLowerCase();if(n!=="fill"&&n!=="stroke"||!Vx(t,n==="fill"?"fillColor":"borderColor")||!e.targetOccurrenceId)return;let i=r.style(e.targetOccurrenceId)?.resolvedValues[n];return i?{cascadeUnderlying:i}:void 0}function HT(e,t,r,n,i){let a=PT(e,r);if(a.length===0&&e.targetOccurrenceId){let l=r.textPathGeometryTargetForOccurrence?.(e.targetOccurrenceId);if(l){let c=WT(e,l,n);return c?[c]:[]}let u=r.definitionTargetForOccurrence?.(e.targetOccurrenceId),d=u?GT(e,u,r,n,i):null;return d?[d]:[]}let o=[];for(let l of a){if(e.kind==="animateTransform"){o.push(..._T(e,l,t,n+o.length));continue}if(e.kind==="animateMotion"){let p=Ux(e,l.shapeId,r,n+o.length);p&&o.push(p);continue}if(e.kind==="discard"){let p=$n(e);o.push({id:`svg-animation-${n+o.length}`,shapeId:l.shapeId,property:"discard",enabled:!0,sourceSmilElement:"discard",...e.sourceAnimationId?{sourceSmilId:e.sourceAnimationId}:{},keyframes:[{time:p.offset,value:1,easing:"linear"}]});continue}let u=jT(e,l,n+o.length);if(u.length>0){o.push(...u);continue}let d=RT(e,l,n+o.length);if(d.length>0){o.push(...d);continue}let c=DT(e,l,r,n+o.length);if(c){o.push(c);continue}if(e.attributeName?.toLowerCase()==="path"&&l.shapeType==="text"&&l.state?.isTextPath===!0){let p=ya(e,l.shapeId,l.state,n+o.length,{projection:_x,underlying:e.targetOccurrenceId?r.textPathAuthoredDataForOccurrence?.(e.targetOccurrenceId)??"":""});p&&o.push(p);continue}if(e.attributeName?.toLowerCase()==="startoffset"&&l.shapeType==="text"){let p=AT(e);if(!p)continue;let h=ya(p.candidate,l.shapeId,l.state,n+o.length);h&&o.push({...h,textPathStartOffsetUnit:p.unit});continue}let f=ya(e,l.shapeId,l.state,n+o.length,XT(e,l.state,t));f&&o.push(kp(f,l,e.attributeName))}let s=e.targetOccurrenceId?vh(e.targetOccurrenceId,r):[];return e.sourceSmilPlacement==="document"&&s.length===1&&o.every(l=>l.shapeId===s[0].shapeId&&!l.property.startsWith("textPath"))?o.map(l=>({...l,sourceSmilPlacement:"document",...e.sourceSmilParentTarget?{sourceSmilParentTarget:!0}:{}})):o}function zs(e){let t=e.animation,r=Number(t.iterationCount);return{enabled:!0,sourceCssAnimationId:e.animationId,cycleDuration:t.duration,cycleBehavior:t.direction==="reverse"||t.direction==="alternate"||t.direction==="alternate-reverse"?t.direction:"restart",...t.iterationCount==="infinite"?{cycleInfinite:!0}:Number.isFinite(r)&&r>=0&&r!==1?{cycleRepeats:r}:{},...NC(t)}}var qT=Object.freeze([["translateX",0],["translateY",0],["scaleX",1],["scaleY",1],["rotation",0],["skewX",0],["skewY",0]]);function YT(e,t,r,n){let i=r.shapeIdForOccurrence(e.occurrenceId),a=i?null:r.definitionTargetForOccurrence?.(e.occurrenceId),o=i??(a?Un(a).shapeId:null);if(!o)return[];let s=t.value(e.occurrenceId,"transform-box")??"view-box",l=r.cssTransformContextForOccurrence?.(e.occurrenceId,s),u=r.shapeBindingsForOccurrence?.(e.occurrenceId)[0],d=(s==="fill-box"||s==="content-box")&&u?.state?Cx({id:u.shapeId,type:u.shapeType,state:u.state}):null,c={...d?{boxX:d.minX,boxY:d.minY,boxWidth:d.maxX-d.minX,boxHeight:d.maxY-d.minY}:{},...l??{}},f=e.keyframes.stops.flatMap(y=>{let I=y.properties.transform??y.properties["-webkit-transform"]??y.properties["-moz-transform"];return I===void 0?[]:[{offset:y.offset,raw:I,timing:y.properties["animation-timing-function"]}]});if(f.length===0)return[];let p=t.value(e.occurrenceId,"transform")??"none";f[0].offset>0&&f.unshift({offset:0,raw:p,timing:void 0}),f.at(-1).offset<1&&f.push({offset:1,raw:p,timing:void 0});let h=t.style(e.occurrenceId)?.cascadedValues["transform-origin"]?px(t.value(e.occurrenceId,"transform-origin")??"0 0",c):{x:0,y:0},m=gx(f.map(({offset:y,raw:I})=>({offset:y,transform:I})),{...c,...h?{transformOrigin:h}:{},retainPureRotationOrigin:!a,progressForInterval:(y,I)=>{let x=f[y]?.timing;return eC(x?Dd(x):e.animation.parsedEasing,I)}});if(m.status!=="projected")return[];if(a)return[{id:`svg-animation-${n}`,...Un(a),property:"targetTransformStack",...zs(e),additive:"replace",replacesCarrierBase:!0,transformFunction:"matrix",transformStackIndex:0,transformBaseValue:a.baseTransform,template:{name:e.animation.name},keyframes:m.stops.map(y=>Rs(y.offset,y.matrix.join(" "),e.animation,m.sampled?"linear":f.findLast(I=>I.offset<y.offset)?.timing))}];if(!m.pureRotation)return[{id:`svg-animation-${n}`,shapeId:o,property:"transformMatrix",...zs(e),additive:"replace",replacesCarrierBase:!0,template:{name:e.animation.name},keyframes:m.stops.map(y=>Rs(y.offset,y.matrix.join(" "),e.animation,m.sampled?"linear":f.findLast(I=>I.offset<y.offset)?.timing))}];let g=m.stops.map(y=>({offset:y.offset,channels:y})),v=new Set(m.channels),b=[];for(let[y,I]of qT){if(!v.has(y))continue;let x=g.flatMap(({offset:k,channels:$})=>{if(!$)return[];let A=$[y]??I,S=f.findLastIndex(M=>M.offset<k);return[Rs(k,A,e.animation,m.sampled?"linear":f[Math.max(0,S)]?.timing)]});x.length<2||b.push({id:`svg-animation-${n+b.length}`,shapeId:o,property:y,...zs(e),additive:y==="translateX"||y==="translateY"?"sum":"replace",replacesCarrierBase:!0,...y==="rotation"&&h&&(m.pureRotation||h.x===0&&h.y===0&&(h.z??0)===0)?{transformOrigin:{x:h.x,y:h.y}}:{},template:{name:e.animation.name},keyframes:x})}return b}function KT(e,t,r){let n=jr(e);if(!n)return null;if(n.unit==="")return n.value;let i=r?.viewportWidth,a=r?.viewportHeight,o=t==="x"?i:t==="y"?a:i!==void 0&&a!==void 0?Math.hypot(i,a)/Math.SQRT2:void 0;return Sa(n,{...r??{},percentBasis:o})??null}function h0(e,t,r,n=null){let i=e.trim();if(t!=="number")return i;if(r)return KT(i,r,n);let a=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(?:px)?$/iu.exec(i);if(!a)return null;let o=Number(a[1]);return Number.isFinite(o)?o:null}function Rs(e,t,r,n){let i={time:e*r.duration+r.delay,value:t,easing:r.easing},a=n?Dd(n):r.parsedEasing;return a&&QA(i,a),i}function ZT(e,t){if(e.length!==0){if(e[0].offset>0){let r=t();r&&e.unshift({...r,offset:0})}if(e.at(-1).offset<1){let r=t();r&&e.push({...r,offset:1})}}}function JT(e,t,r,n){let i=r.shapeIdForOccurrence(e.occurrenceId),a=i?null:r.definitionTargetForOccurrence?.(e.occurrenceId),o=i??(a?Un(a).shapeId:null);if(!o)return[];let s=r.shapeStateForOccurrence(e.occurrenceId),l=r.cssTransformContextForOccurrence?.(e.occurrenceId,"view-box")??null,u=new Set(e.keyframes.stops.flatMap(c=>Object.keys(c.properties)));u.delete("animation-timing-function"),u.delete("transform"),u.delete("-webkit-transform"),u.delete("-moz-transform");let d=[];for(let c of u){let f=ST[c];if(!f)continue;let p=e.keyframes.stops.flatMap(m=>{let g=m.properties[c];if(g===void 0)return[];let v=h0(g,f.valueType,f.cssLengthAxis,l);return v===null?[]:[{offset:m.offset,value:v,timing:m.properties["animation-timing-function"]}]}),h=t.value(e.occurrenceId,c)??Lx(s,f.stateKey)??a?.baseAttributes[c];if(ZT(p,()=>{if(h==null)return null;let m=h0(h,f.valueType,f.cssLengthAxis,l);return m===null?null:{offset:0,value:m,timing:void 0}}),!(p.length<2)){if(a){d.push({id:`svg-animation-${n+d.length}`,...Un(a),property:f.property,targetAttribute:c,targetAttributeValueType:f.valueType==="number"?"number":f.valueType==="color"?"color":"string",...zs(e),template:{name:e.animation.name},keyframes:p.map((m,g)=>Rs(m.offset,m.value,e.animation,g===0?void 0:p[g-1].timing))});continue}d.push({id:`svg-animation-${n+d.length}`,shapeId:o,property:f.property,...zs(e),template:{name:e.animation.name},keyframes:p.map((m,g)=>Rs(m.offset,m.value,e.animation,g===0?void 0:p[g-1].timing))})}}return d}function QT(e){let t=Math.max(0,...e.keyframes.map(r=>r.time));return pC(e)??t}function Sp(e,t,r,n,i={}){let a=new IT(e.smil),o=i.smil??e.smil,s=i.css??e.css,l=[],u=[],d=[],c=[],f=[],p=new Map,h=new Map;for(let y of o){let I=0;if(y.kind==="animateTransform"&&y.targetOccurrenceId){let x=`${y.targetOccurrenceId}|${y.sourceNodeId}`,k=p.get(x);k!==void 0?I=k:(I=h.get(y.targetOccurrenceId)??0,p.set(x,I),h.set(y.targetOccurrenceId,I+1))}for(let x of a.activations(y)){let k=TT(x,n,r,1),$=(k.length>0?k:HT(x,t,r,1,I)).map(A=>({...A,sourceSmilOrder:y.sourceElementOrder,...y.sourceSmilPlacement==="defs"&&A.property!=="textPathMorph"?{sourceSmilPlacement:"defs",sourceSmilDefinitionOrder:r.definitionOrderForSourceNode?.(y.sourceNodeId),sourceSmilDefinitionContainerId:r.definitionContainerIdForSourceNode?.(y.sourceNodeId)}:{}}));y.kind==="animateTransform"?l.push(...$):y.kind==="animateMotion"?u.push(...$):y.kind==="set"?c.push(...$):y.kind==="discard"?f.push(...$):d.push(...$)}}let m=[],g=[];for(let y of s)m.push(...YT(y,t,r,1)),g.push(...JT(y,t,r,1));let v=[...l,...u,...d,...c,...f,...m,...g].map((y,I)=>{let x=`svg-animation-${I+1}`;return{...y,id:x,keyframes:y.keyframes.map((k,$)=>({...k,id:k.id??`${x}-kf-${$+1}`}))}});if(v.length===0)return null;let b=s.flatMap(y=>{let I=v.filter(k=>k.sourceCssAnimationId===y.animationId)[0]?.id;if(!I)return[];v=v.map(k=>k.sourceCssAnimationId===y.animationId?{...k,sourceCssAnimationId:I}:k);let x=v.filter(k=>k.sourceCssAnimationId===I);return[{id:I,trackIds:x.map(k=>k.id),trackFingerprints:x.map(ix)}]});return{duration:Math.max(...v.map(QT)),loop:v.some(y=>y.cycleInfinite===!0),playbackSpeed:1,tracks:v,...b.length>0?{cssAnimationSources:b}:{}}}function eP(e,t){return Sp(e.animations,e.styles,t,e.gradients)}var Ln=e=>({status:"supported",by:e}),tl=(e,t)=>({status:"diagnosed-unsupported",by:e,reason:t}),to=(e,t)=>({status:"diagnosed-lossy",by:e,reason:t}),gt=e=>({status:"exempt",reason:e}),tP="plugin SVG result diagnostic collector",bh="pattern fragment diagnostic collector",xh="vectorized SVG result diagnostic collector",Ef="foreign document transcoder diagnostic collector",m0="ingest node decoration keyed by authored id (ingest/plan-decoration.ts)";function ft(e,t={}){let r=t.authored??Ln(e);return{"native-document-open":Ln("native snapshot parse and canonical restore"),"full-snapshot-restore":Ln("canonical full-snapshot restore"),"svg-document-import":r,"external-svg-paste":r,"internal-clipboard-paste":Ln("closed clipboard subgraph materializer"),"plugin-svg-fragment":t.plugin??Ln("plugin fragment plan materializer"),"pattern-fragment":t.pattern??tl(bh,"Pattern fragments retain only capabilities enrolled by the pattern tile contract."),"vectorized-svg-fragment":t.vectorized??tl(xh,"Vectorized ingestion intentionally accepts path-oriented geometry only."),"illustrator-document-import":t.foreign??r,"pdf-document-import":t.foreign??r}}var wu=e=>tl(tP,e),$i=e=>tl(bh,e),g0=e=>tl(xh,e),Hr=e=>Ln(e),zf=e=>Ln(e),rP={geometry:ft("SVG shape element parser",{pattern:Hr("fragment-scoped pattern shape parser"),vectorized:zf("vectorized path geometry parser")}),containers:ft("SVG structural container planner",{pattern:Hr("fragment-scoped pattern hierarchy parser")}),"source-order":ft("source document order index and SceneGraph placement",{pattern:Hr("pattern source-order materializer"),vectorized:zf("vectorized path document-order traversal")}),hierarchy:ft("source DOM hierarchy planner and SceneGraph placement",{pattern:Hr("fragment-scoped pattern hierarchy materializer")}),"root-viewport-frame":ft("root SVG frame parser and application policy",{plugin:gt("Plugin fragment framing is consumed only for bounds scaling."),pattern:gt("Pattern fragments use the explicit tile width and height as their local frame."),vectorized:to(xh,"Vectorized source framing is consumed only to scale path geometry into target bounds.")}),"common-presentation":ft("shared SVG presentation parser",{pattern:Hr("pattern shape presentation parser"),vectorized:zf("vectorized path presentation parser")}),"conditional-processing":ft("SVG switch and conditional-processing attribute parser",{pattern:Hr("pattern shape conditional-processing parser"),vectorized:g0("Vectorized ingestion does not preserve SVG conditional-processing branches."),foreign:gt("Transcoded SVG has no switch or conditional-processing attributes.")}),"authored-attributes":ft("authored-attribute preservation parser",{pattern:Hr("pattern authored-attribute preservation parser")}),gradients:ft("gradient parser and library reference materializer",{pattern:Hr("fragment-scoped pattern gradient resolver"),foreign:to(Ef,"Axial and radial shadings import as gradients; mesh shadings are rasterized into embedded images.")}),patterns:ft("pattern parser and library reference materializer",{pattern:Hr("fragment-scoped nested-pattern resolver"),foreign:to(Ef,"Tiling patterns import in a fixed pattern space; cells larger than their step are clipped.")}),filters:ft("filter parser and reference materializer",{foreign:gt("PDF content has no filter primitives; effects arrive flattened.")}),"paint-server-definitions":ft("paint-server definition collector and materializer",{pattern:Hr("fragment-scoped pattern paint-server collector")}),markers:ft("marker definition parser and reference materializer",{foreign:gt("PDF content has no marker vocabulary; arrowheads arrive as geometry.")}),symbols:ft("symbol definition and instance materializer"),"use-and-linked-references":ft("use resolver and stable reference-edge materializer",{pattern:Hr("fragment-scoped linked-reference resolver")}),"clip-definitions":ft("clip definition parser and materializer",{pattern:$i("Pattern editing omits document clip definitions.")}),"mask-definitions":ft("mask definition parser and materializer",{pattern:$i("Pattern editing omits document mask definitions.")}),"clip-mask-membership":ft("clip and mask membership materializer",{pattern:$i("Pattern editing omits document clip and mask membership.")}),"smil-animation":ft("SMIL parser and animation-track materializer, including text-path geometry binding to textPathMorph",{pattern:$i("Pattern editing materializes a static tile without SMIL tracks."),foreign:gt("Transcoded documents are static; PDF carries no SMIL animation.")}),"css-animation":ft("CSS keyframe parser and animation-track materializer",{pattern:$i("Pattern editing materializes a static tile without CSS animation tracks."),foreign:gt("Transcoded documents are static; PDF carries no CSS animation.")}),metadata:ft("document metadata parser and field policy",{plugin:wu("Plugin fragments preserve host document metadata."),pattern:gt("Pattern fragments have no document metadata scope."),vectorized:gt("Vectorized fragments have no document metadata scope.")}),scripts:ft("inert script partitioner and document script materializer",{authored:to("inert script partitioner and document script materializer","Script content is preserved verbatim and re-emitted on export, but never executed, so script-driven animation and interactivity are inert inside the editor."),plugin:Ln("inert plugin fragment script data materializer"),pattern:$i("Pattern fragments do not execute or adopt scripts."),vectorized:g0("Vectorized fragments do not execute or adopt scripts."),foreign:gt("Transcoded SVG carries no scripts; PDF scripting is never imported.")}),styles:ft("preserved CSS style collector and materializer",{pattern:Hr("fragment-scoped pattern style resolver"),foreign:gt("Transcoded SVG uses presentation attributes and no author stylesheet.")}),"custom-properties":ft("CSS custom-property collector and materializer",{pattern:Hr("fragment-scoped pattern variable resolver"),foreign:gt("Transcoded SVG declares no CSS custom properties.")}),views:ft("SVG view parser and SceneGraph materializer",{plugin:wu("Plugin fragments do not alter document navigation views."),pattern:gt("Pattern fragments have no document navigation view scope."),vectorized:gt("Vectorized fragments have no document navigation view scope.")}),"embedded-svg":ft("embedded SVG container parser and materializer",{pattern:to(bh,"Pattern editing flattens nested SVG content into the local tile frame."),foreign:gt("Transcoded documents place pages as views, never as nested SVG.")}),fonts:ft("declared font-consent effect and approved loader",{plugin:wu("Plugin fragments do not start an implicit external font consent flow."),pattern:$i("Pattern fragments do not start an implicit font consent flow."),vectorized:gt("Path-only vectorized fragments do not consume font resources."),foreign:to(Ef,"PDF font programs are subsets keyed by private-use code points, so text keeps its mapped family name and resolves through the font consent flow, local fonts or outlines.")}),"external-assets":ft("declared external-asset resolver with proxy policy",{plugin:wu("Plugin fragments diagnose assets outside the enrolled security policy."),pattern:$i("Pattern fragments diagnose external assets instead of fetching them."),vectorized:gt("Path-only vectorized fragments do not consume external assets."),foreign:gt("Transcoded documents embed every image as a data URL and fetch nothing.")}),"foreign-structure":{"native-document-open":gt("Native documents restore layer names, lock and visibility canonically."),"full-snapshot-restore":gt("Snapshot restore carries layer names, lock and visibility as fields."),"svg-document-import":gt("Authored SVG has no vocabulary for editor lock state or panel names."),"external-svg-paste":gt("Authored SVG has no vocabulary for editor lock state or panel names."),"internal-clipboard-paste":gt("Internal clipboard subgraphs carry layer names and lock as serialized state."),"plugin-svg-fragment":gt("Plugin fragments name their groups through descriptors."),"pattern-fragment":gt("Pattern tiles carry no editor structure sidecar."),"vectorized-svg-fragment":gt("Vectorized fragments carry no editor structure sidecar."),"illustrator-document-import":Ln(m0),"pdf-document-import":Ln(m0)}};function nP(e,t){return rP[e][t]}var va={schemaVersion:{serialization:{kind:"verbatim"},precision:"opaque",required:!1,collab:{exempt:"Format version of the document envelope, not content. The reducer never rewrites it; it is stamped by the serializer and consumed by migrateSnapshot."},rendered:{renderToSvg:{exempt:"Format-envelope version consumed by migrateSnapshot before renderToSvg sees the snapshot; it has no output representation."},codegen:{exempt:"Format-envelope version consumed while normalizing codegen input; it is not content in an embeddable component."},dxf:{exempt:"Format-envelope version is consumed before the editor constructs DXF shape inputs and has no DXF entity representation."},mermaid:{exempt:"Format-envelope version is consumed before Mermaid receives shapes and has no graph-syntax representation."},pdf:{exempt:"Format-envelope version is consumed during document migration before the PDF export surface receives its SVG page input."},"editor-dom":{exempt:"Format-envelope version is consumed during document migration before the live editor DOM is projected."}}},shapes:{serialization:{kind:"shape-array"},precision:"shape-trees",required:!0,collab:{ops:["shape:add","shape:update","shape:remove","text:format"]},rendered:{renderToSvg:{by:"svg-renderer main loop via renderShape; motionOnly shapes become origin-normalized <path> defs for <mpath>"},codegen:{by:"buildRenderPlan supplies the normalized visible-shape entries and defs consumed by every component backend"},dxf:{by:"apps/editor/src/export/dxf-exporter.ts converts supported geometry and accounts for unsupported shape inputs"},mermaid:{by:"apps/editor/src/export/mermaid-exporter.ts maps flowchart nodes and connectors into graph syntax with skip accounting"},pdf:{by:"ExportPanel.generatePdfBlob converts rendered SVG shape markup through svg2pdf and warns before unsupported textPath expansion"},"editor-dom":{by:"SceneGraph and scene-graph-dom-projector drive registered Shape renderers for the live canvas projection"}}},viewboxes:{serialization:{kind:"id-sorted-array"},precision:"numeric-leaves",required:!0,collab:{exempt:"DERIVED, not stored. `DocumentRootManager.getViewboxes()` projects it from the `<view>` shapes on every read, and the editor host installs no-op setters after View unification. Editing a view is a `shape:update`, which is on the wire; the array regenerates from the shapes on the next serialize."},rendered:{renderToSvg:{by:"viewboxes[0] drives the root width, height, and viewBox in svg-renderer sizing"},codegen:{by:"buildRenderPlan.frame supplies the shared width, height, and viewBox used by every component backend"},dxf:{exempt:"DXF writes model-space geometry and unit metadata, not an SVG viewport or page framing rectangle."},mermaid:{exempt:"Mermaid computes graph layout from topology and has no authored viewport or viewBox capability."},pdf:{by:"ExportPanel PDF page generation uses the selected source bounds and page settings to establish the PDF frame and placement"},"editor-dom":{by:"DocumentRootManager projects view shapes and the active view onto the live root SVG viewport"}}},guides:{serialization:{kind:"id-sorted-array"},precision:"numeric-leaves",required:!1,collab:{ops:["guides:set","guide:upsert","guide:remove","guide:move"]},rendered:{renderToSvg:{exempt:"Editor-only authoring aids (alignment guides); SVG document output has no representation for them by design."},codegen:{exempt:"Alignment guides are editor-only authoring aids and do not belong in an embeddable generated component."},dxf:{exempt:"Alignment guides are editor-only authoring aids rather than drawing geometry and do not become DXF entities."},mermaid:{exempt:"Alignment guides are editor-only authoring aids rather than graph nodes or edges and do not enter Mermaid syntax."},pdf:{exempt:"Alignment guides are editor-only authoring aids and are excluded from the rendered SVG page supplied to PDF conversion."},"editor-dom":{by:"GuideManager projects persisted guides into the editor authoring overlay"}}},measurements:{serialization:{kind:"id-sorted-array"},precision:"numeric-leaves",required:!1,collab:{ops:["measurements:set","measurement:upsert","measurement:remove","measurement:move"]},rendered:{renderToSvg:{exempt:"Editor measurement aids have no SVG document representation; the editor SVG export omits it by design."},codegen:{exempt:"Measurements are editor-only authoring aids and do not belong in an embeddable generated component."},dxf:{exempt:"Editor measurement annotations are not drawing geometry and do not become DXF entities in this exporter."},mermaid:{exempt:"Editor measurement annotations are not graph nodes or edges and do not enter Mermaid syntax."},pdf:{exempt:"Editor measurement annotations are authoring aids and are excluded from the rendered SVG page supplied to PDF conversion."},"editor-dom":{by:"MeasureManager projects persisted measurements into the editor authoring overlay"}}},sceneTree:{serialization:{kind:"id-sorted-array"},precision:"opaque",required:!1,collab:{ops:["scene:move","scene:place"]},rendered:{renderToSvg:{exempt:"Structure authority whose render projection is inline state.children; renderToSvg consumes that projection instead of the tree."},codegen:{exempt:"Component backends consume buildRenderPlan over inline state.children, the canonical render projection of sceneTree."},dxf:{exempt:"DXF receives shape trees whose inline children are the render projection; it does not replay sceneTree independently."},mermaid:{exempt:"Mermaid receives serialized shapes and connector references rather than replaying the editor sceneTree."},pdf:{exempt:"PDF receives the rendered SVG hierarchy produced from inline children and does not independently replay sceneTree placements."},"editor-dom":{by:"SceneGraph structure and scene-graph-dom-projector reconcile sceneTree placements into the live DOM hierarchy"}}},clipMaskGroups:{serialization:{kind:"id-sorted-array"},precision:"opaque",required:!1,collab:{ops:["clipMask:upsert","clipMask:remove"]},rendered:{renderToSvg:{by:"renderer/clip-mask-defs.ts emits clipPath and mask defs plus content wrapping while suppressing clip shapes from the visible tree"},codegen:{by:"buildRenderPlan clip-mask runs and defs are consumed by every component backend without re-deriving membership"},dxf:{exempt:"DXF is a geometry exchange target with no SVG clipPath or mask model; shape conversion operates on authored geometry."},mermaid:{exempt:"Mermaid graph syntax has no clipping or masking vocabulary; export is defined over flowchart topology and labels."},pdf:{by:"The rendered SVG page carries reachable clipPath and mask definitions into the svg2pdf conversion boundary"},"editor-dom":{by:"ClipMaskManager and ClipMaskHandler project definitions and content wrappers into the live canvas DOM"}}},documentMetadata:{serialization:{kind:"deep-sorted-object"},precision:"opaque",required:!1,collab:{ops:["metadata:set","metadata:patch"]},rendered:{renderToSvg:{by:"renderer/document-metadata.ts emits xml:lang on the root plus title, description, metadata, and raw HTML metadata as first children"},codegen:{exempt:"Embeddable component backends omit document-artifact identity because the host application owns title, description, and RDF metadata."},dxf:{exempt:"The DXF exporter writes drawing entities and units only; SVG document identity metadata is outside its interchange contract."},mermaid:{exempt:"Mermaid export represents graph topology and labels; SVG document identity metadata has no graph-syntax equivalent."},pdf:{exempt:"SVG title, description, and RDF blocks are not mapped to PDF document information by the current export workflow."},"editor-dom":{by:"DocumentMetadataManager owns metadata and projects language and descriptive elements onto the live document DOM"}}},documentExtensions:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["documentExtensions:set","documentExtension:upsert","documentExtension:remove"]},rendered:{renderToSvg:{by:"renderer/document-extensions.ts serializes namespace-aware extension value trees into their canonical root or defs placement"},codegen:{exempt:"Embeddable component backends represent painted editor shapes and deliberately omit non-rendering application-specific document extension elements."},dxf:{exempt:"DXF has no XML namespace or application-extension element vocabulary and consumes only canonical drawing geometry."},mermaid:{exempt:"Mermaid graph syntax has no XML namespace or application-extension element vocabulary and consumes only canonical graph topology."},pdf:{by:"The rendered SVG page carries structured extension elements through the SVG-to-PDF conversion boundary without treating them as painting geometry"},"editor-dom":{exempt:"These foreign application elements are inert document state; like document scripts, they remain outside the interactive canvas DOM and render from the canonical model."}}},definitionContainers:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["definitionContainers:set"]},rendered:{renderToSvg:{by:"renderer/svg-renderer.ts emits each authored definition container with its canonical identity and ordered definition entries"},codegen:{exempt:"Component backends consume canonical definition entries but do not reproduce authored outer defs container identities."},dxf:{exempt:"DXF has no definition-container element and consumes referenced canonical geometry rather than SVG document structure."},mermaid:{exempt:"Mermaid has no SVG definition-container vocabulary and consumes graph topology rather than SVG document structure."},pdf:{by:"The rendered SVG page carries authored definition containers through the SVG-to-PDF conversion boundary"},"editor-dom":{exempt:"The editor uses one interaction-oriented resource projection while the canonical aggregate retains authored defs container identity for export."}}},documentScripts:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["documentScripts:set","documentScript:upsert","documentScript:remove"]},rendered:{renderToSvg:{by:"renderer/document-scripts.ts emits script elements at the end of the SVG when RenderOptions.includeScripts is enabled"},codegen:{exempt:"Embeddable component backends never inject authored executable scripts; behavior in the host application belongs to consumer code."},dxf:{exempt:"DXF drawing output cannot carry executable SVG document scripts and the exporter never evaluates them."},mermaid:{exempt:"Mermaid graph output cannot carry executable SVG document scripts and the exporter never evaluates them."},pdf:{exempt:"PDF conversion never executes or embeds authored SVG scripts; executable document behavior is outside the static export contract."},"editor-dom":{exempt:"DocumentScriptManager keeps scripts inert and never inserts them into the live SVG because dynamically appended script elements execute."}}},documentStyles:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["documentStyles:set","documentStyle:upsert","documentStyle:remove"]},rendered:{renderToSvg:{by:"renderer/document-styles.ts emits style elements as last children with animation declarations stripped because SMIL owns playback"},codegen:{by:"buildRenderPlan.documentStyles supplies normalized style markup to every component backend"},dxf:{exempt:"CSS rules style SVG presentation rather than DXF geometry entities and are outside the DXF export contract."},mermaid:{exempt:"Authored SVG CSS cannot be represented in Mermaid graph syntax; Mermaid styling is generated from its own vocabulary."},pdf:{by:"The rendered SVG page carries authored style elements and computed presentation into the svg2pdf conversion boundary"},"editor-dom":{by:"DocumentStylesManager projects ordered authored styles into the live SVG and keeps the cascade synchronized"}}},templateVariables:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["templateVariables:set","templateVariable:upsert","templateVariable:remove"]},rendered:{renderToSvg:{exempt:"Template variables are substituted upstream by CLI, Action, and SDK entry points; in-renderer substitution would double-apply them."},codegen:{exempt:"Template variables are substituted while normalizing the codegen document input, before any component backend receives a plan."},dxf:{exempt:"Template variables are document-input preprocessing; the DXF exporter receives already-materialized live shape values."},mermaid:{exempt:"Template variables are document-input preprocessing; the Mermaid exporter receives already-materialized labels and references."},pdf:{exempt:"Template variables are resolved before the editor renders the SVG page that is supplied to PDF conversion."},"editor-dom":{by:"VariableManager resolves template variables and maintains their safe live style projection for shape renderers"}}},animationTimeline:{serialization:{kind:"deep-sorted-object"},precision:"animation-timeline",required:!1,collab:{ops:["animation:set","animation:config","animation:clear","animationTrack:upsert","animationTrack:remove","animationKeyframe:upsert","animationKeyframe:remove"]},rendered:{renderToSvg:{by:"renderAnimationElements projects target-owned SMIL children and document-owned SMIL references through smil-kernel"},codegen:{by:"buildRenderPlan attaches the same SMIL output to shape and document-root markup consumed by every component backend"},dxf:{exempt:"DXF output is a static geometry snapshot and has no SVG SMIL timeline representation in the supported file version."},mermaid:{exempt:"Mermaid export is a static graph description and has no SVG SMIL timeline representation."},pdf:{exempt:"PDF output is a static page snapshot and has no time-based SMIL timeline representation in the export contract."},"editor-dom":{by:"AnimationManager composes ephemeral overlays and the SMIL export kernel projects authored timelines for document output"}}},library:{serialization:{kind:"id-sorted-array"},precision:"shape-trees",required:!1,collab:{ops:["library:set","library:upsert","library:remove"]},rendered:{renderToSvg:{by:"renderLibraryDefs emits reference-filtered gradients, patterns, filters, markers, and symbols into defs"},codegen:{by:"buildRenderPlan library-def channels are emitted by every component backend with shared reference reachability"},dxf:{exempt:"The DXF exporter converts flattened shape geometry and text; SVG visual library definitions have no entity equivalent."},mermaid:{exempt:"Mermaid represents graph nodes and connectors, not reusable SVG paint, filter, marker, or symbol definitions."},pdf:{by:"The rendered SVG page carries reachable library definitions and their references into the svg2pdf conversion boundary"},"editor-dom":{by:"LibraryRegistry plus gradient, filter, marker, pattern, and symbol managers project reachable definitions into live defs"}}},paintServerDefs:{serialization:{kind:"id-sorted-array"},precision:"opaque",required:!1,collab:{ops:["paintServerDefs:set","paintServerDef:upsert","paintServerDef:remove"]},rendered:{renderToSvg:{by:"renderer/paint-server-defs.ts emits verbatim markup in defs when transitively referenced or marked passthrough"},codegen:{by:"buildRenderPlan paint-server channels carry reachable typed definitions to every component backend"},dxf:{exempt:"Typed SVG paint-server definitions have no DXF entity representation; the exporter operates on shape geometry."},mermaid:{exempt:"Typed SVG paint-server definitions have no Mermaid syntax representation; export operates on graph topology and labels."},pdf:{by:"The rendered SVG page carries reachable typed paint-server definitions into the svg2pdf conversion boundary"},"editor-dom":{by:"PaintServerDef state and definition managers project reachable typed definition markup into live defs"}}},colorGlyphLibrary:{serialization:{kind:"deep-sorted-object"},precision:"opaque",required:!1,collab:{ops:["colorGlyphLibrary:set"]},rendered:{renderToSvg:{exempt:"Font-foundry assets are consumed when emitting an OpenType font binary and have no SVG document representation."},codegen:{exempt:"Font-foundry assets do not belong in embeddable SVG components; generated code references ordinary text and font resources."},dxf:{exempt:"Font-foundry color-glyph assets have no DXF entity representation in the geometry and MTEXT exporter."},mermaid:{exempt:"Font-foundry color-glyph assets have no Mermaid graph-syntax representation and are not graph content."},pdf:{exempt:"Color-glyph source assets back font generation rather than PDF page conversion; rendered text uses the resolved font face."},"editor-dom":{exempt:"Color glyph assets back font-binary generation rather than the editor DOM; text rendering uses the resolved font face."}}},exportItems:{serialization:{kind:"ordered-array"},precision:"opaque",required:!1,collab:{ops:["exportItems:set","exportItem:upsert","exportItem:remove"]},rendered:{renderToSvg:{exempt:"Export profiles are instructions about filenames, formats, and settings, not renderable SVG document content."},codegen:{exempt:"Export profiles configure how code generation is invoked and are not content emitted into a generated component."},dxf:{exempt:"Export profiles configure the editor export workflow; the selected DXF profile is input to invocation, not a DXF entity."},mermaid:{exempt:"Export profiles configure the editor export workflow and are not nodes, connectors, or directives in Mermaid output."},pdf:{exempt:"The selected export profile configures PDF invocation and page settings; it is not content embedded in the PDF page."},"editor-dom":{exempt:"Export profiles configure the export workflow and are intentionally not projected into the live canvas SVG."}}},unknownFields:{serialization:{kind:"unknown-bag"},precision:"opaque",required:!1,collab:{exempt:"Forward-compat quarantine from newer writers; has no ops by definition \u2014 a current client cannot edit a field it does not understand, the DocumentRoom stores raw JSON so the bag rides the seed snapshot, and future clients (the only writers of these fields) carry real ops for them."},rendered:{renderToSvg:{exempt:"Contents are by definition not understood by this build; preservation is pass-through only and rendering them would be a guess."},codegen:{exempt:"Contents are by definition not understood by this build; component generation preserves rather than interprets unknown fields."},dxf:{exempt:"Contents are by definition not understood by this build; DXF conversion cannot safely infer geometry from unknown fields."},mermaid:{exempt:"Contents are by definition not understood by this build; Mermaid export cannot safely infer graph semantics from them."},pdf:{exempt:"Contents are by definition not understood by this build; PDF conversion cannot safely invent a page representation for them."},"editor-dom":{exempt:"Contents are by definition not understood by this build; the editor preserves them without inventing a DOM projection."}}}},iP=["schemaVersion","documentMetadata","documentExtensions","definitionContainers","documentScripts","documentStyles","templateVariables","exportItems","viewboxes","guides","measurements","sceneTree","clipMaskGroups","library","colorGlyphLibrary","paintServerDefs","animationTimeline","unknownFields","shapes"];function wh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function aP(e){let t=e,r=t.unknownFields;if(!wh(r))return delete t.unknownFields,e;for(let[n,i]of Object.entries(r))n!=="unknownFields"&&(n in t||(t[n]=i));return delete t.unknownFields,e}function oP(e){let t=e,r=wh(t.unknownFields)?t.unknownFields:void 0;for(let n of Object.keys(t)){if(n==="unknownFields"||n in va)continue;let i=t[n];delete t[n],i!==void 0&&((r??={})[n]=i)}return r&&Object.keys(r).length>0?t.unknownFields=r:delete t.unknownFields,e}function sP(e){let t=e,r,n=t.unknownFields;if(wh(n))for(let[i,a]of Object.entries(n))i==="unknownFields"||i in va||a===void 0||((r??={})[i]=a);for(let i of Object.keys(t)){if(i==="unknownFields"||i in va)continue;let a=t[i];a!==void 0&&((r??={})[i]=a)}return r}var _=(e,t)=>({action:e,by:t}),rr=e=>e,it="DocumentSerializer canonical snapshot restore",ue="policy-driven SVG plan materializer",hr="policy-driven clipboard plan materializer",Fe="policy-driven fragment plan materializer",Xt="SceneGraph hierarchy and source-order projection",E7={schemaVersion:rr({"native-document-open":_("derived","parseDocument migration and schema stamping"),"full-snapshot-restore":_("derived","snapshot migration and schema stamping"),"svg-document-import":_("preserve-host",ue),"illustrator-document-import":_("preserve-host",ue),"pdf-document-import":_("preserve-host",ue),"external-svg-paste":_("preserve-host",ue),"internal-clipboard-paste":_("preserve-host",hr),"plugin-svg-fragment":_("preserve-host",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),shapes:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("append",ue),"illustrator-document-import":_("append",ue),"pdf-document-import":_("append",ue),"external-svg-paste":_("append",ue),"internal-clipboard-paste":_("append",hr),"plugin-svg-fragment":_("append",Fe),"pattern-fragment":_("append","fragment-scoped pattern materializer"),"vectorized-svg-fragment":_("append","path-only vectorized materializer")}),viewboxes:rr({"native-document-open":_("derived",Xt),"full-snapshot-restore":_("derived",Xt),"svg-document-import":_("derived",Xt),"illustrator-document-import":_("derived",Xt),"pdf-document-import":_("derived",Xt),"external-svg-paste":_("derived",Xt),"internal-clipboard-paste":_("derived",Xt),"plugin-svg-fragment":_("derived",Xt),"pattern-fragment":_("derived",Xt),"vectorized-svg-fragment":_("derived",Xt)}),guides:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("preserve-host",ue),"illustrator-document-import":_("preserve-host",ue),"pdf-document-import":_("preserve-host",ue),"external-svg-paste":_("preserve-host",ue),"internal-clipboard-paste":_("preserve-host",hr),"plugin-svg-fragment":_("preserve-host",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),measurements:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("preserve-host",ue),"illustrator-document-import":_("preserve-host",ue),"pdf-document-import":_("preserve-host",ue),"external-svg-paste":_("preserve-host",ue),"internal-clipboard-paste":_("preserve-host",hr),"plugin-svg-fragment":_("preserve-host",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),sceneTree:rr({"native-document-open":_("derived",Xt),"full-snapshot-restore":_("derived",Xt),"svg-document-import":_("derived",Xt),"illustrator-document-import":_("derived",Xt),"pdf-document-import":_("derived",Xt),"external-svg-paste":_("derived",Xt),"internal-clipboard-paste":_("derived",Xt),"plugin-svg-fragment":_("derived",Xt),"pattern-fragment":_("derived",Xt),"vectorized-svg-fragment":_("derived",Xt)}),clipMaskGroups:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("append",ue),"illustrator-document-import":_("append",ue),"pdf-document-import":_("append",ue),"external-svg-paste":_("append",ue),"internal-clipboard-paste":_("append",hr),"plugin-svg-fragment":_("append",Fe),"pattern-fragment":_("preserve-host","fragment-scoped pattern materializer"),"vectorized-svg-fragment":_("preserve-host","path-only vectorized materializer")}),documentMetadata:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("replace",ue),"illustrator-document-import":_("replace",ue),"pdf-document-import":_("replace",ue),"external-svg-paste":_("merge",ue),"internal-clipboard-paste":_("preserve-host",hr),"plugin-svg-fragment":_("preserve-host",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),documentExtensions:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("replace",ue),"illustrator-document-import":_("replace",ue),"pdf-document-import":_("replace",ue),"external-svg-paste":_("append",ue),"internal-clipboard-paste":_("append",hr),"plugin-svg-fragment":_("append",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),definitionContainers:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("append",ue),"illustrator-document-import":_("append",ue),"pdf-document-import":_("append",ue),"external-svg-paste":_("append",ue),"internal-clipboard-paste":_("append",hr),"plugin-svg-fragment":_("append",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),documentScripts:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("replace",ue),"illustrator-document-import":_("replace",ue),"pdf-document-import":_("replace",ue),"external-svg-paste":_("append",ue),"internal-clipboard-paste":_("append",hr),"plugin-svg-fragment":_("append",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),documentStyles:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("replace",ue),"illustrator-document-import":_("replace",ue),"pdf-document-import":_("replace",ue),"external-svg-paste":_("merge",ue),"internal-clipboard-paste":_("append",hr),"plugin-svg-fragment":_("append",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),templateVariables:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("replace",ue),"illustrator-document-import":_("replace",ue),"pdf-document-import":_("replace",ue),"external-svg-paste":_("merge",ue),"internal-clipboard-paste":_("append",hr),"plugin-svg-fragment":_("append",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),animationTimeline:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("append",ue),"illustrator-document-import":_("append",ue),"pdf-document-import":_("append",ue),"external-svg-paste":_("append",ue),"internal-clipboard-paste":_("append",hr),"plugin-svg-fragment":_("append",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),library:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("append",ue),"illustrator-document-import":_("append",ue),"pdf-document-import":_("append",ue),"external-svg-paste":_("append",ue),"internal-clipboard-paste":_("append",hr),"plugin-svg-fragment":_("append",Fe),"pattern-fragment":_("preserve-host","fragment-scoped pattern materializer"),"vectorized-svg-fragment":_("preserve-host","path-only vectorized materializer")}),paintServerDefs:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("append",ue),"illustrator-document-import":_("append",ue),"pdf-document-import":_("append",ue),"external-svg-paste":_("append",ue),"internal-clipboard-paste":_("append",hr),"plugin-svg-fragment":_("append",Fe),"pattern-fragment":_("preserve-host","fragment-scoped pattern materializer"),"vectorized-svg-fragment":_("preserve-host","path-only vectorized materializer")}),colorGlyphLibrary:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("preserve-host",ue),"illustrator-document-import":_("preserve-host",ue),"pdf-document-import":_("preserve-host",ue),"external-svg-paste":_("preserve-host",ue),"internal-clipboard-paste":_("preserve-host",hr),"plugin-svg-fragment":_("preserve-host",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),exportItems:rr({"native-document-open":_("replace",it),"full-snapshot-restore":_("replace",it),"svg-document-import":_("preserve-host",ue),"illustrator-document-import":_("preserve-host",ue),"pdf-document-import":_("preserve-host",ue),"external-svg-paste":_("preserve-host",ue),"internal-clipboard-paste":_("preserve-host",hr),"plugin-svg-fragment":_("preserve-host",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)}),unknownFields:rr({"native-document-open":_("replace","forward-compatible quarantine restore"),"full-snapshot-restore":_("replace","forward-compatible quarantine restore"),"svg-document-import":_("preserve-host",ue),"illustrator-document-import":_("preserve-host",ue),"pdf-document-import":_("preserve-host",ue),"external-svg-paste":_("preserve-host",ue),"internal-clipboard-paste":_("preserve-host",hr),"plugin-svg-fragment":_("preserve-host",Fe),"pattern-fragment":_("preserve-host",Fe),"vectorized-svg-fragment":_("preserve-host",Fe)})};function lP(e){if(e instanceof Map)return e;let t=new Map;for(let r of e)t.set(r.id,r);return t}function uP(e){if(e.kind==="marker")return e.shapes;if(e.kind!=="symbol")return[];if(!e.variants)return e.shapes;let t=[...e.shapes];for(let r of Object.values(e.variants))t.push(...r);return t}function Gx(e,t,r,n){let i=lP(r),a=new Set,o=[],s=[],l=c=>{if(typeof c!="string"||!c||a.has(c))return;let f=i.get(c);f&&(f.kind!=="symbol"&&f.kind!=="marker"||(a.add(c),o.push(f)))},u=c=>{s.push(c)},d=c=>{let f=c.state;if(!f)return;l(f.symbolId),l(f.markerStart),l(f.markerMid),l(f.markerEnd);let p=f.textPathReference;p&&typeof p=="object"&&!Array.isArray(p)&&p.kind==="definition"&&l(p.targetId);let h=f.children;if(Array.isArray(h))for(let g of h)u(g);let m=f.symbolOverrides;if(m&&typeof m=="object"&&!Array.isArray(m))for(let[g,v]of Object.entries(m))!v||typeof v!="object"||Array.isArray(v)||u({id:g,type:"symbol-override",state:v})};for(let c of e)u(c);for(let c of t)l(c);for(;;){let c=s.shift();if(c){n(c),d(c);continue}let f=o.shift();if(!f)break;if(f.kind==="symbol")for(let p of f.definitionContentOrder??[])p.kind==="definition"&&l(p.id);for(let p of uP(f))u(p)}}var dP=[],cP=[];function Wx(e,t,r){Gx(e,cP,t,r)}function fP(e,t,r){Gx(dP,e,t,r)}function Xx(e,t=[]){let r=new Set,n=new Set;return Wx(e,t,i=>{let a=i.state;if(!a)return;typeof a.markerStart=="string"&&a.markerStart&&r.add(a.markerStart),typeof a.markerMid=="string"&&a.markerMid&&r.add(a.markerMid),typeof a.markerEnd=="string"&&a.markerEnd&&r.add(a.markerEnd);let o=a.startEndpoint,s=a.endEndpoint;typeof o=="string"&&o&&o!=="none"&&!a.markerStart&&n.add(o),typeof s=="string"&&s&&s!=="none"&&!a.markerEnd&&n.add(s)}),{ids:r,legacyEndpoints:n}}var ye="http://www.w3.org/2000/svg",y0=class extends Error{constructor(e,t,r){super(t),this.hostId=e,this.name="SvgXmlParserHostError",this.cause=r}hostId;cause};function Rf(e,t){let r=null;for(let n=t;n<e.length;n++){let i=e[n];if(r){i===r&&(r=null);continue}if(i==='"'||i==="'")r=i;else if(i===">")return n+1}return e.length}function pP(e){let t=0,r=e.toLowerCase(),n=[];for(;t<e.length;){let o=e.indexOf("<",t);if(o<0)break;if(e.startsWith("<!--",o)){let p=e.indexOf("-->",o+4);if(p<0)break;t=p+3;continue}if(e.startsWith("<![CDATA[",o)){let p=e.indexOf("]]>",o+9);if(p<0)break;t=p+3;continue}if(e.startsWith("<?",o)){let p=e.indexOf("?>",o+2);if(p<0)break;t=p+2;continue}let s=Rf(e,o+1),l=/^<\s*([^\s/>]+)/.exec(e.slice(o,s))?.[1]??"";if(l.split(":").at(-1)?.toLowerCase()!=="style"||e.slice(o,s).startsWith("</")){t=s;continue}let u=`</${l.toLowerCase()}`,d=r.indexOf(u,s);if(d<0)break;let c=e.slice(s,d);if(!c.includes("<")||c.includes("<![CDATA[")){t=Rf(e,d+2);continue}let f=`<![CDATA[${c.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;n.push({start:s,end:d,value:f}),t=Rf(e,d+2)}if(n.length===0)return e;let i="",a=0;for(let o of n)i+=e.slice(a,o.start),i+=o.value,a=o.end;return i+e.slice(a)}var hP=256,mP=64*1024,gP=32*1024*1024,Ih=String.raw`[\p{L}_:][\p{L}\p{N}\p{M}_.:\-]*`,yP=new RegExp(`^${Ih}$`,"u"),vP="http://www.w3.org/1999/xlink",bP=/url\(\s*(['"]?)#([^'")\s]+)\1\s*\)/gu,xP=/(?:^|;)\s*([^\s;]+?)\.(?:begin|end|repeat\(\d+\))/gu,wP=new Set(["aria-labelledby","aria-describedby"]),IP=new RegExp(String.raw`<!ENTITY\s+(?!%)(${Ih})\s+(?:"([^"]*)"|'([^']*)')\s*>`,"gu"),v0=new RegExp(String.raw`&(#x[0-9A-Fa-f]+|#[0-9]+|${Ih});`,"gu"),kP=Object.freeze({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});function SP(e){let t=e.startsWith("#x")?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===13||t>=32&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111?String.fromCodePoint(t):null}function $P(e,t,r){let n=new Map;for(let s of t.matchAll(IP)){if(n.size>=hP)return;n.set(s[1],s[2]??s[3]??"")}let i=new Map,a=(s,l)=>{let u=kP[s];if(u!==void 0)return u;let d=i.get(s);if(d!==void 0)return d;let c=n.get(s);if(c===void 0||l.has(s))return null;let f=new Set(l);f.add(s);let p=!0,h=c.replace(v0,(m,g)=>{let v=g.startsWith("#")?SP(g):a(g,f);return v===null?(p=!1,""):v});return!p||h.length>mP?null:(i.set(s,h),h)};for(let s of n.keys())a(s,new Set);let o=0;for(let s of r.matchAll(v0)){let l=i.get(s[1]);if(l!==void 0&&(o+=l.length,o>gP))return}for(let[s,l]of i)e.ENTITIES[s]=l}function qx(e){return e&&e.length>0?e:null}function NP(e,t){return{name:e.name,localName:e.local,prefix:e.prefix.length>0?e.prefix:null,namespaceUri:qx(e.uri),value:e.value,span:t}}var Yx={id:"saxes",parse(e){let t=[],r=[],n=[],i=0,a=[],o=0,s=0,l=new Hx.SaxesParser({xmlns:!0,position:!0}),u=c=>{let f=r.at(-1);f?f.children.push(c):t.push(c)};l.on("error",c=>{n.push(c.message)}),l.on("opentagstart",()=>{i=e.lastIndexOf("<",Math.max(0,l.position-1)),a=[],o=l.position;let c=r.at(-1);c?c.contentOffset=i:s=i}),l.on("attribute",c=>{let f=e.indexOf(c.name,o),p=f>=0&&f<l.position?f:o;a.push({start:p,end:l.position}),o=l.position}),l.on("opentag",c=>{let f=Object.values(c.attributes).map((h,m)=>NP(h,a[m]??{start:i,end:l.position})),p={kind:"element",name:c.name,localName:c.local,prefix:c.prefix.length>0?c.prefix:null,namespaceUri:qx(c.uri),attributes:f,children:[],span:{start:i,end:l.position},startOffset:i,contentOffset:l.position};u(p),r.push(p)}),l.on("closetag",()=>{let c=r.pop();if(!c)return;c.rawXml=e.slice(c.startOffset,l.position),c.span.end=l.position;let f=r.at(-1);f?f.contentOffset=l.position:s=l.position});let d=(c,f,p,h)=>{u({kind:c,value:f,span:{start:p,end:h}});let m=r.at(-1);m?m.contentOffset=h:s=h};l.on("text",c=>{let f=r.at(-1)?.contentOffset??s,p=e.lastIndexOf("<",Math.max(0,l.position-1)),h=p>=f?p:l.position;d("text",c,f,h)}),l.on("comment",c=>{let f=e.lastIndexOf("<!--",l.position),p=e.indexOf("-->",Math.max(0,f));d("comment",c,Math.max(0,f),p>=0?p+3:l.position)}),l.on("cdata",c=>{let f=e.lastIndexOf("<![CDATA[",l.position),p=e.indexOf("]]>",Math.max(0,f));d("cdata",c,Math.max(0,f),p>=0?p+3:l.position)}),l.on("processinginstruction",({target:c,body:f})=>{let p=e.lastIndexOf("<?",l.position),h=e.indexOf("?>",Math.max(0,p));d("processing-instruction",f.length>0?`${c} ${f}`:c,Math.max(0,p),h>=0?h+2:l.position)}),l.on("doctype",c=>{$P(l,c,e);let f=e.lastIndexOf("<!DOCTYPE",l.position),p=e.indexOf(">",Math.max(0,f));d("doctype",c,Math.max(0,f),p>=0?p+1:l.position)});try{l.write(e).close()}catch(c){n.push(c instanceof Error?c.message:String(c))}return n.length>0?{error:n[0]}:{nodes:t}}};function b0(e,t,r){return{severity:"error",code:t,source:e.source,entrypoint:e.entrypoint,message:r,documentPath:"/",elementName:"svg"}}function _f(e,t,r,n){return{severity:"warning",code:t,source:e.source,entrypoint:e.entrypoint,message:r,capability:"source-envelope",...n}}function $p(e,t,r){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===r)??null}function vr(e){let t=$p(e,"href",null);if(t)return{value:t.value,namespace:"svg2"};let r=$p(e,"href",vP);return r?{value:r.value,namespace:"xlink"}:null}var MP="http://www.w3.org/XML/1998/namespace";function AP(e,t,r){let n=r.indexOf(":");if(n<0)return{namespaceUri:null,localName:r};let i=r.slice(0,n),a=r.slice(n+1);if(i.length===0||a.length===0)return null;if(i==="xml")return{namespaceUri:MP,localName:a};let o=t;for(;o;){let s=o.attributes.find(l=>l.prefix==="xmlns"&&l.localName===i);if(s)return s.value.length>0?{namespaceUri:s.value,localName:a}:null;o=e.index.parent(o.sourceNodeId)}return null}function Kx(e,t){let r=e.index.parent(t.sourceNodeId);for(;r;){if(r.namespaceUri!==ye||r.localName.toLowerCase()==="foreignobject")return!0;r=e.index.parent(r.sourceNodeId)}return!1}function CP(e){let t=[...e.children].reverse(),r="";for(;t.length>0;){let n=t.pop();n.kind==="text"||n.kind==="cdata"?r+=n.value:n.kind==="element"&&t.push(...[...n.children].reverse())}return r}function OP(e,t){let r=t.filter(h=>h.kind==="element"),n=new Map(r.map(h=>[h.sourceNodeId,h])),i=new Map,a=new Map,o=new Map,s=(h,m)=>{o.set(h.sourceNodeId,m);let g=h.children.filter(b=>b.kind==="element");a.set(h.sourceNodeId,Object.freeze(g));let v=new Map;for(let b of g){i.set(b.sourceNodeId,h);let y=(v.get(b.name)??0)+1;v.set(b.name,y),s(b,`${m}/${b.name}[${y}]`)}};s(e,`/${e.name}[1]`);let l=new Map,u=[];for(let h of r){let m=$p(h,"id",null)?.value;if(m===void 0)continue;let g=l.get(m)??[],v=Object.freeze({authoredId:m,sourceNodeId:h.sourceNodeId,elementOrder:h.elementOrder,occurrenceIndex:g.length,primary:g.length===0,validXmlId:m.length>0&&!/\s/u.test(m)&&yP.test(m)});g.push(v),l.set(m,g),u.push(v)}let d=[],c=new Map,f=(h,m,g,v,b)=>{let y=l.get(v)??[],I=Object.freeze({sourceReferenceId:`reference:${d.length}`,fromSourceNodeId:h.sourceNodeId,channel:m,...b!==void 0?{attributeName:b}:{},authoredValue:g,targetAuthoredId:v,targetSourceNodeId:y[0]?.sourceNodeId??null,resolution:y.length===0?"missing":y.length===1?"resolved":"ambiguous-first"});d.push(I);let x=c.get(h.sourceNodeId)??[];x.push(I),c.set(h.sourceNodeId,x)},p=(h,m,g,v)=>{for(let b of g.matchAll(bP))f(h,m,g,b[2],v)};for(let h of r){let m=vr(h);m?.value.startsWith("#")&&m.value.length>1&&f(h,m.namespace==="svg2"?"href":"xlink-href",m.value,m.value.slice(1),m.namespace==="svg2"?"href":"xlink:href"),h.localName.toLowerCase()==="style"&&p(h,"stylesheet-url",CP(h));for(let g of h.attributes)if(g.namespaceUri===null){if(g.localName==="style"?p(h,"inline-style-url",g.value,g.name):g.value.includes("url(")&&p(h,"presentation-url",g.value,g.name),g.localName==="begin"||g.localName==="end")for(let v of g.value.matchAll(xP))f(h,"smil-syncbase",g.value,v[1],g.name);if(wP.has(g.localName))for(let v of g.value.trim().split(/\s+/u).filter(Boolean))f(h,"idref-list",g.value,v,g.name)}}for(let h of l.values())Object.freeze(h);for(let h of c.values())Object.freeze(h);return Object.freeze(r),Object.freeze(u),Object.freeze(d),Object.freeze({elements:r,idOccurrences:u,localReferences:d,element(h){return n.get(h)??null},parent(h){return i.get(h)??null},children(h){return a.get(h)??Object.freeze([])},sourcePath(h){return o.get(h)??"/"},occurrences(h){return l.get(h)??Object.freeze([])},resolveAuthoredId(h){return l.get(h)?.[0]??null},referencesFrom(h){return c.get(h)??Object.freeze([])}})}function TP(e){let t=r=>{if(!(r===null||typeof r!="object"||Object.isFrozen(r))){for(let n of Object.values(r))t(n);Object.freeze(r)}};return t(e),e}function Ld(e,t,r=Yx){let n=pP(e),i;try{i=r.parse(n)}catch(b){throw new y0(r.id,`SVG XML parser host ${r.id} failed.`,b)}if(i===null||typeof i!="object"||!("error"in i)&&!("nodes"in i))throw new y0(r.id,`SVG XML parser host ${r.id} returned no result.`);if("error"in i)return{value:null,diagnostics:[b0(t,"malformed-source",`SVG XML parsing failed: ${i.error}`)]};let a=i.nodes.find(b=>b.kind==="element"),o=a?.namespaceUri===ye||a?.namespaceUri===null;if(!a||a.localName!=="svg"||!o)return{value:null,diagnostics:[b0(t,"missing-svg-root","The XML document element is not an SVG root in the SVG namespace.")]};let s=a.namespaceUri===null,l=[],u=0,d=0,c=b=>{let y=u++,I=`source:${y}`;if(b.kind!=="element"){let A={kind:b.kind,sourceNodeId:I,documentOrder:y,value:b.value,span:b.span};return l.push(A),A}let x=d++,k=[],$={kind:"element",sourceNodeId:I,documentOrder:y,elementOrder:x,name:b.name,localName:b.localName,prefix:b.prefix,namespaceUri:s&&b.namespaceUri===null?ye:b.namespaceUri,attributes:b.attributes.map(A=>({...A})),children:k,span:b.span,...b.rawXml!==void 0?{rawXml:b.rawXml}:{}};return l.push($),k.push(...b.children.map(c)),$},f=null,p=i.nodes.map(b=>{let y=c(b);return b===a&&(f=y),y});if(!f)throw new Error("The validated SVG document element was not projected.");let h=OP(f,l),m=new Map;for(let b of h.idOccurrences){let y=m.get(b.authoredId)??[];y.push(b.sourceNodeId),m.set(b.authoredId,y)}let g=Object.freeze(Object.fromEntries([...m].map(([b,y])=>[b,Object.freeze(y)]))),v=[];s&&v.push(_f(t,"missing-svg-namespace","The namespace-less SVG root and its unnamespaced descendants were adopted into the SVG namespace as compatibility input; authored SVG should declare the SVG namespace.",{documentPath:"/svg[1]",elementName:"svg"}));for(let[b,y]of m){let I=h.occurrences(b);if(I.length>1&&v.push(_f(t,"duplicate-svg-id",`SVG id ${JSON.stringify(b)} occurs ${y.length} times; references resolve to the first element-order occurrence.`,{documentPath:I.map(x=>h.sourcePath(x.sourceNodeId)).join(", "),elementName:h.element(I[0].sourceNodeId)?.name??"svg",sourceId:b})),I.some(x=>!x.validXmlId)){let x=I.find(k=>!k.validXmlId);v.push(_f(t,"invalid-svg-attribute",`SVG id ${JSON.stringify(b)} is not a non-empty XML Name without whitespace; it remains available for exact first-element reference processing.`,{documentPath:h.sourcePath(x.sourceNodeId),elementName:h.element(x.sourceNodeId)?.name??"svg",sourceId:b}))}}return{value:TP({root:f,documentNodes:p,nodes:l,idIndex:g,index:h,rawSource:e,parserSource:n}),diagnostics:v}}function j(e,t){return e.attributes.find(r=>r.namespaceUri===null&&r.localName===t)?.value??null}function Ri(e,t){return e.attributes.some(r=>r.namespaceUri===null&&r.localName===t)}var Xu=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="SvgSourceDecodingError"}cause},Zx=/^<\?xml\s+[\s\S]*?\?>/i,Jx=/\sencoding\s*=\s*(['"])([^'"]+)\1/i;function PP(){let e=globalThis.TextDecoder;if(!e)throw new Xu("The current platform does not provide the Encoding Standard TextDecoder API.");return e}function DP(e){return e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191?"utf-8":e.length>=2&&e[0]===255&&e[1]===254?"utf-16le":e.length>=2&&e[0]===254&&e[1]===255?"utf-16be":e.length>=4&&e[0]===60&&e[1]===0&&e[2]===63&&e[3]===0?"utf-16le":e.length>=4&&e[0]===0&&e[1]===60&&e[2]===0&&e[3]===63?"utf-16be":null}function jP(e){let t="",r=Math.min(e.length,512);for(let n=0;n<r;n++){let i=e[n];if(i>127)break;t+=String.fromCharCode(i)}return t.match(Zx)?.[0]?.match(Jx)?.[2].trim().toLowerCase()??null}function EP(e){return e.match(Zx)?.[0]?.match(Jx)?.[2].trim().toLowerCase()??null}function zP(e,t){let r=e.toLowerCase(),n=t.toLowerCase();return r===n||n==="utf-16"&&(r==="utf-16le"||r==="utf-16be")}function RP(e){let t=DP(e)??jP(e)??"utf-8",r=PP(),n;try{n=new r(t,{fatal:!0,ignoreBOM:!1})}catch(o){throw new Xu(`Unsupported SVG XML encoding "${t}".`,o)}let i;try{i=n.decode(e)}catch(o){throw new Xu(`The SVG byte stream is not valid ${n.encoding} text.`,o)}i.charCodeAt(0)===65279&&(i=i.slice(1));let a=EP(i);if(a&&!zP(n.encoding,a))throw new Xu(`The SVG XML declaration specifies "${a}" but the byte stream is ${n.encoding}.`);return{text:i,encoding:n.encoding}}var Iu="[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?",_P=new RegExp(`^\\s*(${Iu})(?:\\s*,\\s*|\\s+)(${Iu})(?:\\s*,\\s*|\\s+)(${Iu})(?:\\s*,\\s*|\\s+)(${Iu})\\s*$`);function Nn(e){let t=_P.exec(e);if(!t)return null;let[r,n,i,a]=t.slice(1).map(Number);return[r,n,i,a].every(Number.isFinite)?{x:r,y:n,width:i,height:a}:null}function FP(e){return e==="none"||/^x(Min|Mid|Max)Y(Min|Mid|Max)$/.test(e)}function kh(e){if(e==null)return{align:"xMidYMid",meetOrSlice:"meet"};let t=e.trim().split(/\s+/).filter(Boolean);return t.length<1||t.length>2||!FP(t[0])||t.length===2&&t[1]!=="meet"&&t[1]!=="slice"?{align:"xMidYMid",meetOrSlice:"meet"}:{align:t[0],meetOrSlice:t[1]==="slice"?"slice":"meet"}}function x0(e,t){return e==="none"?0:t==="x"?e.includes("xMax")?1:e.includes("xMid")?.5:0:e.includes("YMax")?1:e.includes("YMid")?.5:0}function w0(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function I0(e,t,r,n){return e==null?t??null:!Number.isFinite(e)||e<0?(n.push({code:"invalid-viewport-length",message:`Nested SVG ${r} ${String(e)} is invalid and falls back to auto (100%).`}),t??null):e}function LP(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0}function BP(e){let t=["viewBoxX","viewBoxY","viewBoxWidth","viewBoxHeight"],r=t.filter(n=>LP(e,n));return r.length===0?"absent":r.length!==t.length||!t.map(n=>e[n]).every(n=>typeof n=="number"&&Number.isFinite(n))?"partial":e.viewBoxWidth<0||e.viewBoxHeight<0?"negative-invalid":e.viewBoxWidth===0||e.viewBoxHeight===0?"zero-disabled":"valid"}function VP(e,t,r){let{align:n,meetOrSlice:i}=kh(r),a=e.width/t.viewBoxWidth,o=e.height/t.viewBoxHeight,s=e.x-t.viewBoxX*a,l=e.y-t.viewBoxY*o;if(n!=="none"){let u=i==="slice"?Math.max(a,o):Math.min(a,o),d=t.viewBoxWidth*u,c=t.viewBoxHeight*u;a=u,o=u,s=e.x+(e.width-d)*x0(n,"x")-t.viewBoxX*u,l=e.y+(e.height-c)*x0(n,"y")-t.viewBoxY*u}return Qr(a,0,0,o,s,l)}function Np(e,t){let r=[],n=w0(e.x,0),i=w0(e.y,0),a=I0(e.width,t?.width,"width",r),o=I0(e.height,t?.height,"height",r),s=a===null||o===null?null:{x:n,y:i,width:a,height:o},l=BP(e);if((a===0||o===0)&&(l="zero-disabled"),l==="zero-disabled")return{status:l,renders:!1,frame:s,contentMatrix:null,childPercentBasis:null,diagnostics:r};if(l==="partial"?r.push({code:"invalid-viewbox",message:"Nested SVG viewBox is partial or non-finite and is ignored."}):l==="negative-invalid"&&r.push({code:"invalid-viewbox",message:"Nested SVG viewBox has a negative dimension and is ignored."}),l!=="valid")return{status:l,renders:!0,frame:s,contentMatrix:Qr(1,0,0,1,n,i),childPercentBasis:s?{width:s.width,height:s.height}:null,diagnostics:r};if(!s)return r.push({code:"unresolved-viewport-size",message:"Nested SVG with a valid viewBox needs a parent viewport to resolve auto dimensions."}),{status:l,renders:!1,frame:null,contentMatrix:null,childPercentBasis:null,diagnostics:r};let u={viewBoxX:e.viewBoxX,viewBoxY:e.viewBoxY,viewBoxWidth:e.viewBoxWidth,viewBoxHeight:e.viewBoxHeight};return{status:l,renders:!0,frame:s,contentMatrix:VP(s,u,e.preserveAspectRatio),childPercentBasis:{width:u.viewBoxWidth,height:u.viewBoxHeight},diagnostics:r}}var UP=new Set(["animate","animatetransform","animatemotion","set"]),GP="http://www.w3.org/1999/xlink";function k0(e,t){let r=j(e,"style");if(r){let n=r.replace(/\/\*[\s\S]*?\*\//g,""),i=new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]*)`,"gi"),a=null,o;for(;(o=i.exec(n))!==null;)a=o[1];if(a!==null){let s=a.replace(/\s*!\s*important\s*$/i,"").trim(),l=jr(s);if(l&&l.value>=0&&(l.unit!==""||l.value===0))return s}}return j(e,t)}function WP(e,t){return{severity:"warning",code:"invalid-svg-attribute",source:e.source,entrypoint:e.entrypoint,message:t,documentPath:"/svg[1]/@viewBox",elementName:"svg",capability:"root-viewport-frame"}}function Qx(e){for(let t of e.children)if(t.kind==="element"&&(t.localName.toLowerCase()==="view"||Qx(t)))return!0;return!1}function XP(e,t){let r=e.attributes.find(i=>i.localName==="href"&&(i.namespaceUri===null||i.namespaceUri===GP))?.value;if(r===void 0)return!0;let n=j(t,"id");return n!==null&&r===`#${n}`}function HP(e,t){let r=[],n=k0(e,"width"),i=k0(e,"height"),a=n===null?null:jr(n),o=i===null?null:jr(i),s=a&&a.value>=0?n.trim():void 0,l=o&&o.value>=0?i.trim():void 0,u=li(n),d=li(i),c=u!==void 0&&u>=0?u:void 0,f=d!==void 0&&d>=0?d:void 0,p=j(e,"preserveAspectRatio"),h=p&&p.trim().length>0?p.trim():void 0,m=Ri(e,"viewBox"),g=j(e,"viewBox"),v=g!==null?Nn(g):null,b=v!==null&&v.width>=0&&v.height>=0?v:null;m&&!b&&r.push(WP(t,`Root SVG viewBox ${JSON.stringify(g)} is invalid per SVG 2 section 8.6 and was ignored.`));let y=e.children.some(S=>S.kind==="element"&&UP.has(S.localName.toLowerCase())&&XP(S,e)),I=b!==null||y||Qx(e);if(b)return{value:{viewBoxX:b.x,viewBoxY:b.y,viewBoxWidth:b.width,viewBoxHeight:b.height,...c!==void 0?{width:c}:{},...f!==void 0?{height:f}:{},...s!==void 0?{authoredWidth:s}:{},...l!==void 0?{authoredHeight:l}:{},...h!==void 0?{preserveAspectRatio:h}:{},sizingMode:"explicit",targetedPasteWrapper:I},diagnostics:r};let x=c!==void 0,k=f!==void 0,$=x?c:300,A=k?f:150;return{value:{viewBoxX:0,viewBoxY:0,viewBoxWidth:$,viewBoxHeight:A,...x||k?{width:$,height:A}:{},...s!==void 0?{authoredWidth:s}:{},...l!==void 0?{authoredHeight:l}:{},...h!==void 0?{preserveAspectRatio:h}:{},sizingMode:x||k?"sized":"implicit",targetedPasteWrapper:I},diagnostics:r}}function qP(e){let t=e.viewBoxWidth??300,r=e.viewBoxHeight??150,n=e.width??(e.height!==void 0&&r>0?e.height*t/r:t),i=e.height??(e.width!==void 0&&t>0?e.width*r/t:r);return{width:n,height:i}}function YP(e){return e.localName.toLowerCase()==="view"&&e.namespaceUri===ye}function KP(e,t,r,n){let i=j(t,"id");return{severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,message:`SVG viewBox ${JSON.stringify(n)} is invalid per SVG 2 section 8.6 and the view was ignored.`,documentPath:`${e.index.sourcePath(t.sourceNodeId)}/@viewBox`,elementName:"view",...i?{sourceId:i}:{},sourceNodeId:t.sourceNodeId,capability:"views"}}function ZP(e){return Object.freeze(e.state),Object.freeze(e)}function JP(e,t){let r=[],n=[];for(let i of e.index.elements){if(!YP(i))continue;let a=j(i,"viewBox");if(a===null||a.trim().length===0)continue;let o=Nn(a);if(!o||o.width<0||o.height<0){n.push(KP(e,i,t,a));continue}let s={viewName:j(i,"id")??"",viewBoxX:o.x,viewBoxY:o.y,viewBoxWidth:o.width,viewBoxHeight:o.height},l=j(i,"preserveAspectRatio");l&&(s.viewPreserveAspectRatio=l);let u=j(i,"zoomAndPan");(u==="disable"||u==="magnify")&&(s.viewZoomAndPan=u);let d=j(i,"viewTarget");d&&(s.viewTarget=d),r.push(ZP({sourceNodeId:i.sourceNodeId,elementOrder:i.elementOrder,parentSourceNodeId:e.index.parent(i.sourceNodeId)?.sourceNodeId??null,state:s}))}return{value:Object.freeze(r),diagnostics:Object.freeze(n.map(i=>Object.freeze(i)))}}function QP(e){return e.localName.toLowerCase()==="svg"&&e.namespaceUri===ye}function e2(e,t){let r=j(e,"style");if(!r)return null;let n=null;for(let i of ha(r,";")){let[a,...o]=ha(i,":");if(a?.trim().toLowerCase()!==t.toLowerCase())continue;let s=o.join(":").trim(),l=/\s*!\s*important\s*$/iu.test(s),u=s.replace(/\s*!\s*important\s*$/iu,"").trim();(!n||l||!n.important)&&(n={value:u,important:l})}return n}function t2(e,t){let r=e.index.parent(t.sourceNodeId);for(;r;){let n=li(e2(r,"font-size")?.value??null);if(n!==void 0)return n;let i=li(j(r,"font-size"));if(i!==void 0)return i;r=e.index.parent(r.sourceNodeId)}return 16}function ew(e,t,r,n,i){let a=j(t,"id");return{severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,message:`Embedded SVG ${n} ${JSON.stringify(i)} is invalid and was ignored.`,documentPath:`${e.index.sourcePath(t.sourceNodeId)}/@${n}`,elementName:"svg",...a?{sourceId:a}:{},sourceNodeId:t.sourceNodeId,capability:"embedded-svg"}}function ku(e,t,r,n,i,a){if(!Ri(t,r))return;let o=j(t,r)??"",s={percentBasis:r==="x"||r==="width"?n.width:n.height,viewportWidth:n.width,viewportHeight:n.height,fontSize:t2(e,t),rootFontSize:16},l=at(o,s),u=(r==="width"||r==="height")&&(l??0)<0;if(l===void 0||u){a.push(ew(e,t,i,r,o));return}return l}function r2(e,t,r,n){let i=[],a=[];for(let o of e.index.elements){if(!QP(o)||o.sourceNodeId===e.root.sourceNodeId)continue;let s=t.direct(o.sourceNodeId);if(!s)throw new Error(`Embedded SVG ${o.sourceNodeId} has no occurrence.`);let l=r.viewport(s.occurrenceId);if(!l)throw new Error(`Embedded SVG ${o.sourceNodeId} has no viewport context.`);let u={},d=ku(e,o,"x",l,n,a),c=ku(e,o,"y",l,n,a),f=ku(e,o,"width",l,n,a),p=ku(e,o,"height",l,n,a);d!==void 0&&(u.svgX=d),c!==void 0&&(u.svgY=c),f!==void 0&&(u.svgWidth=f),p!==void 0&&(u.svgHeight=p);let h=j(o,"viewBox"),m=h===null?null:Nn(h),g=m&&m.width>=0&&m.height>=0?m:null;h!==null&&!g&&a.push(ew(e,o,n,"viewBox",h)),g&&(u.svgViewBoxX=g.x,u.svgViewBoxY=g.y,u.svgViewBoxWidth=g.width,u.svgViewBoxHeight=g.height),Ri(o,"preserveAspectRatio")&&(u.svgPreserveAspectRatio=j(o,"preserveAspectRatio")??""),Object.freeze(u),i.push(Object.freeze({sourceNodeId:o.sourceNodeId,elementOrder:o.elementOrder,parentSourceNodeId:e.index.parent(o.sourceNodeId)?.sourceNodeId??null,state:u}))}return{value:Object.freeze(i),diagnostics:Object.freeze(a.map(o=>Object.freeze(o)))}}function n2(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let i=e[n]-t[n];if(i!==0)return i}return e.length-t.length}function Ff(e,t){return n2(e.orderKey,t.orderKey)||e.productIndex-t.productIndex||e.occurrenceId.localeCompare(t.occurrenceId)}function i2(e,t,r){if(r.namespaceUri!==ye||Kx(e,r))return null;let n=r.localName.toLowerCase();return n==="g"?"group":n==="a"?"hyperlink":n==="switch"?"switch":n!=="svg"||t.usePath.length===0&&r.sourceNodeId===e.root.sourceNodeId?null:"embedded-svg"}function S0(e,t,r,n,i,a){return Object.freeze({severity:"warning",code:i,source:n.source,entrypoint:n.entrypoint,capability:i==="empty-hyperlink-dropped"?"containers":"hierarchy",sourceId:j(r,"id")??void 0,sourceNodeId:r.sourceNodeId,occurrenceId:t.occurrenceId,elementName:r.name,documentPath:e.index.sourcePath(r.sourceNodeId),message:a})}function a2(e,t,r){let n=new Map(t.occurrences.map(g=>[g.occurrenceId,g])),i=new Map,a=new Map;for(let g of t.occurrences){let v=e.index.element(g.correspondingSourceNodeId);if(!v)throw new Error(`SVG occurrence ${g.occurrenceId} has no source element.`);i.set(g.occurrenceId,v);let b=i2(e,g,v);b&&a.set(g.occurrenceId,b)}let o=[],s=new Set;for(let g of r.materializedOccurrenceIds){if(s.has(g))continue;s.add(g);let v=n.get(g);if(!v)throw new Error(`Unknown materialized SVG occurrence ${g}.`);if(v.role==="definition")throw new Error(`Definition occurrence ${g} cannot be materialized in the scene.`);o.push(v)}o.sort(Ff);for(let g of o){let v=g.parentOccurrenceId,b=new Set;for(;v;){if(b.has(v))throw new Error(`SVG occurrence ancestry contains a cycle at ${v}.`);b.add(v);let y=n.get(v);if(!y)throw new Error(`SVG occurrence ${g.occurrenceId} has unknown parent ${v}.`);y.role==="use-carrier"&&a.set(v,"group"),v=y.parentOccurrenceId}}let l=new Set;for(let g of t.occurrences)a.get(g.occurrenceId)==="group"&&l.add(g.occurrenceId);for(let g of o){let v=g.parentOccurrenceId,b=new Set;for(;v;){if(b.has(v))throw new Error(`SVG occurrence ancestry contains a cycle at ${v}.`);b.add(v);let y=n.get(v);if(!y)throw new Error(`SVG occurrence ${g.occurrenceId} has unknown parent ${v}.`);a.has(v)&&l.add(v),v=y.parentOccurrenceId}}let u=[],d=new Set,c=[...l].map(g=>n.get(g)).sort(Ff),f=g=>{let v=g.parentOccurrenceId,b=new Set;for(;v;){if(b.has(v))return!1;b.add(v);let y=n.get(v);if(!y)return!1;if(a.get(v)==="hyperlink")return!0;v=y.parentOccurrenceId}return!1};for(let g of c){if(a.get(g.occurrenceId)==="hyperlink"&&f(g)){let v=i.get(g.occurrenceId);u.push(S0(e,g,v,r,"nested-hyperlink-flattened","Nested SVG hyperlinks are invalid; the inner hyperlink was flattened."));continue}d.add(g.occurrenceId)}for(let g of t.occurrences){if(a.get(g.occurrenceId)!=="hyperlink"||l.has(g.occurrenceId)||f(g))continue;let v=i.get(g.occurrenceId);u.push(S0(e,g,v,r,"empty-hyperlink-dropped","The SVG hyperlink has no materializable content and was dropped."))}let p=g=>{let v=g.parentOccurrenceId,b=new Set;for(;v;){if(b.has(v))throw new Error(`SVG occurrence ancestry contains a cycle at ${v}.`);if(b.add(v),d.has(v))return v;let y=n.get(v);if(!y)throw new Error(`SVG occurrence ${g.occurrenceId} has unknown parent ${v}.`);v=y.parentOccurrenceId}return null},h=c.filter(g=>d.has(g.occurrenceId)).map(g=>Object.freeze({occurrenceId:g.occurrenceId,sourceNodeId:g.correspondingSourceNodeId,kind:a.get(g.occurrenceId),parentContainerOccurrenceId:p(g),orderKey:Object.freeze([...g.orderKey])})),m=o.map(g=>Object.freeze({occurrenceId:g.occurrenceId,sourceNodeId:g.correspondingSourceNodeId,parentContainerOccurrenceId:p(g),orderKey:Object.freeze([...g.orderKey])}));return u.sort((g,v)=>{let b=g.occurrenceId?n.get(g.occurrenceId):void 0,y=v.occurrenceId?n.get(v.occurrenceId):void 0;return!b||!y?0:Ff(b,y)}),Object.freeze({value:Object.freeze({containers:Object.freeze(h),placements:Object.freeze(m)}),diagnostics:Object.freeze(u)})}var o2="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",s2="http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd",l2="http://www.inkscape.org/namespaces/inkscape",u2="https://boxy-svg.com";function Su(e){if(e===void 0)return null;let t=Number(e);return Number.isFinite(t)?t:null}var d2=["cx","cy","rx","ry"];function c2(e){if(e.get("type")!=="arc"||e.has("start")||e.has("end"))return null;let t=Su(e.get("cx")),r=Su(e.get("cy")),n=Su(e.get("rx")),i=Su(e.get("ry"));return t===null||r===null||n===null||i===null||n<=0||i<=0?null:{x:t,y:r,rx:n,ry:i}}function f2(e){let t=c2(e);return t?{type:"ellipse",state:{...t},consumes:d2}:null}function p2(e,t){if(e.get("type")!=="arc")return[];let r=s=>{let l=t(s);return typeof l=="number"&&Number.isFinite(l)?l:null},n=r("x"),i=r("y"),a=r("rx"),o=r("ry");return n===null||i===null||a===null||o===null?[]:[{name:"sodipodi:cx",value:String(n)},{name:"sodipodi:cy",value:String(i)},{name:"sodipodi:rx",value:String(a)},{name:"sodipodi:ry",value:String(o)}]}function $0(e,t,...r){return Object.freeze({id:e,prefix:t,namespaceUris:r,extensionUris:Object.freeze([]),project:()=>null,emit:()=>[]})}var N0=Object.freeze([Object.freeze({id:"sodipodi",prefix:"sodipodi",namespaceUris:[o2,s2],extensionUris:Object.freeze([]),project:f2,emit:p2}),$0("inkscape","inkscape",l2),$0("boxy","bx",u2)]),M0=[];function Sh(){return M0.length===0?N0:[...M0,...N0]}function h2(){return Sh()}function Mp(e){if(e===null)return null;for(let t of Sh())if(t.namespaceUris.includes(e))return t;return null}function tw(e){let t=new Set;for(let r of e){let n=Mp(r.namespaceUri);if(!n||t.has(n))continue;let i=new Map;for(let o of e)Mp(o.namespaceUri)===n&&i.set(o.localName,o.value);let a=n.project(i);if(!a){t.add(n);continue}if(a.consumes.length===0)throw new Error(`Namespace vocabulary ${n.id} projected canonical state without consuming any attribute, so nothing would regenerate it on export.`);return{vocabulary:n,projection:a}}return null}function m2(){return Object.freeze(Sh().flatMap(e=>[...e.extensionUris]))}var g2="http://www.w3.org/1999/xhtml",y2="http://www.w3.org/1998/Math/MathML",z7=Object.freeze([g2,y2,...m2()]),v2=Object.freeze(["systemLanguage","requiredExtensions","requiredFeatures"]);function Lf(e,t){return j(e,t)}function b2(e){if(e.namespaceUri!==ye)return null;let t=Lf(e,"systemLanguage"),r=Lf(e,"requiredExtensions"),n=Lf(e,"requiredFeatures");return t===null&&r===null&&n===null?null:Object.freeze({sourceNodeId:e.sourceNodeId,elementName:e.localName,systemLanguage:t,requiredExtensions:r,requiredFeatures:n})}function x2(e,t,r){return Object.freeze({severity:"warning",code:"required-features-dropped",source:r.source,entrypoint:r.entrypoint,capability:"conditional-processing",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:"Dropped requiredFeatures because SVG 2 removed the feature test."})}function w2(e,t){let r=[],n=[];for(let s of e.index.elements){let l=b2(s);l&&(r.push(l),l.requiredFeatures!==null&&n.push(x2(e,s,t)))}let i=Object.freeze(r),a=new Map(i.map(s=>[s.sourceNodeId,s])),o=Object.freeze({candidates:i,condition:s=>a.get(s)??null});return Object.freeze({value:o,diagnostics:Object.freeze(n)})}var I2=new Set(["clippath","mask","lineargradient","radialgradient","pattern","filter","marker","symbol","view"]),k2=new Set(["clippath","mask","lineargradient","radialgradient","pattern","filter","marker","symbol"]),S2=/url\(\s*(['"]?)#([^'")\s]+)\1\s*\)/gu;function A0(e){let t=e.trim();return/^-?[_A-Za-z][\w:.-]*$/u.test(t)?t:t.replace(/[^\w:.-]+/gu,"_").replace(/^[^_A-Za-z]+/u,"")||"svg-resource"}function $2(e,t){let r=1;for(;t.has(`${e}-${r}`);)r++;let n=`${e}-${r}`;return t.add(n),n}function Bf(e,t,r){let n=e.trim(),i=n.length>0?A0(n):A0(t);return e===i&&!r.has(i)||!r.has(i)?(r.add(i),i):$2(i,r)}function C0(e,t){return e.replace(S2,(r,n,i)=>{let a=t.get(i);return!a||a===i?r:`url(${n}#${a}${n})`})}function N2(e){let t=[...e.children].reverse(),r="";for(;t.length>0;){let n=t.pop();n.kind==="text"||n.kind==="cdata"?r+=n.value:n.kind==="element"&&t.push(...[...n.children].reverse())}return r}function O0(e,t){switch(e.localName.toLowerCase()){case"clippath":return"clipPath";case"mask":return"mask";case"lineargradient":return"linearGradient";case"radialgradient":return"radialGradient";case"pattern":return"pattern";case"filter":return"filter";case"marker":return"marker";case"symbol":return"symbol";case"view":return"view";default:return t?"hrefTarget":"other"}}function M2(e){for(let t of e.elementIds)Object.freeze(t);for(let t of e.resourceIds)Object.freeze(t);for(let t of e.generatedIds)Object.freeze(t);for(let t of e.rewrites)Object.freeze(t);return Object.freeze(e.elementOrder),Object.freeze(e.elementIds),Object.freeze(e.resourceIds),Object.freeze(e.generatedIds),Object.freeze(e.rewrites),Object.freeze(e)}function A2(e,t={}){let r=e.index.elements,n=g=>{let v=e.index.parent(g.sourceNodeId);for(;v;){if(v.localName.toLowerCase()==="defs")return!0;v=e.index.parent(v.sourceNodeId)}return!1},i=new Set;for(let g of r)j(g,"id")!==null&&(I2.has(g.localName.toLowerCase())||n(g))&&i.add(g.sourceNodeId);for(let g of e.index.localReferences)g.channel!=="href"&&g.channel!=="xlink-href"||g.targetSourceNodeId&&i.add(g.targetSourceNodeId);let a=new Set(t.claimedIds??[]),o=new Map,s=new Map,l=[];for(let g of r){let v=j(g,"id");if(v===null)continue;let b=O0(g,n(g)),y=Bf(v,b,a);o.has(v)||o.set(v,y),s.set(g.sourceNodeId,y),l.push({sourceNodeId:g.sourceNodeId,authoredId:v,liveId:y})}let u=[];for(let g of r){if(!i.has(g.sourceNodeId))continue;let v=j(g,"id");if(v===null)continue;let b=O0(g,n(g)),y=s.get(g.sourceNodeId);y&&u.push({sourceNodeId:g.sourceNodeId,authoredId:v,sourceId:v.length>0?v:y,liveId:y,kind:b,restoreSourceId:y!==v&&k2.has(g.localName.toLowerCase())})}let d=[],c=new Set,f=0;for(let g of r){if(g.namespaceUri!=="http://www.w3.org/2000/svg")continue;let v=g.localName.toLowerCase();if(!["animate","animatemotion","animatetransform","discard","set"].includes(v)||vr(g))continue;let b=e.index.parent(g.sourceNodeId);if(!b||c.has(b.sourceNodeId))continue;let y=b,I=!1;for(;y;){if(y.namespaceUri==="http://www.w3.org/2000/svg"&&["clippath","mask"].includes(y.localName.toLowerCase())){I=!0;break}y=e.index.parent(y.sourceNodeId)}if(!I||j(b,"id"))continue;let x=`svgsketch-smil-target-${f++}`,k=Bf(x,"other",a);c.add(b.sourceNodeId),d.push({sourceNodeId:b.sourceNodeId,liveId:k,reason:"clip-mask-animation-target"})}let p=0,h=new Set(t.cssAnimationTargetSourceNodeIds??[]);for(let g of r){if(!h.has(g.sourceNodeId)||c.has(g.sourceNodeId)||j(g,"id"))continue;let v=`svgsketch-css-animation-target-${p++}`,b=Bf(v,"other",a);c.add(g.sourceNodeId),d.push({sourceNodeId:g.sourceNodeId,liveId:b,reason:"clip-mask-css-animation-target"})}let m=[];for(let g of r){if(g.localName.toLowerCase()==="style"){let b=N2(g),y=C0(b,o);y!==b&&m.push({sourceNodeId:g.sourceNodeId,target:"text-content",value:y})}let v=vr(g);for(let b of g.attributes){if(b.localName==="id"&&b.namespaceUri===null||b.name==="data-source-id")continue;let y=b.value;if((v?.namespace==="svg2"?b.localName==="href"&&b.namespaceUri===null:v?.namespace==="xlink"&&b.localName==="href"&&b.namespaceUri!==null)&&y.startsWith("#")){let I=o.get(y.slice(1));I&&I!==y.slice(1)&&(y=`#${I}`)}else b.namespaceUri===null&&y.includes("url(")&&(y=C0(y,o));y!==b.value&&m.push({sourceNodeId:g.sourceNodeId,target:"attribute",name:b.name,value:y})}}return M2({elementOrder:r.map(g=>g.sourceNodeId),elementIds:l,resourceIds:u,generatedIds:d,rewrites:m,liveIdForSourceId(g){return o.get(g)},liveIdForSourceNodeId(g){return s.get(g)}})}var ut=e=>({authority:"core",by:e}),R7={geometry:ut("ingest/svg-leaf-geometry.ts"),containers:ut("ingest/svg-container-hierarchy.ts"),"source-order":ut("ingest/svg-source.ts and ingest/svg-use-occurrences.ts"),hierarchy:ut("ingest/svg-container-hierarchy.ts"),"root-viewport-frame":ut("ingest/root-frame.ts"),"common-presentation":ut("ingest/svg-style-cascade.ts and svg-property-semantics.ts"),"conditional-processing":ut("ingest/svg-conditional-processing.ts"),"authored-attributes":ut("ingest/svg-authored-attributes.ts"),gradients:ut("ingest/svg-gradients.ts"),patterns:ut("ingest/svg-patterns.ts"),filters:ut("ingest/svg-filters.ts"),"paint-server-definitions":ut("ingest/svg-paint-server-definitions.ts"),markers:ut("ingest/svg-markers.ts"),symbols:ut("ingest/svg-symbol-uses.ts"),"use-and-linked-references":ut("ingest/svg-use-occurrences.ts and ingest/svg-symbol-uses.ts"),"clip-definitions":ut("ingest/svg-clip-masks.ts"),"mask-definitions":ut("ingest/svg-clip-masks.ts"),"clip-mask-membership":ut("ingest/svg-clip-masks.ts"),"smil-animation":ut("ingest/svg-animations.ts and smil-value-syntax.ts"),"css-animation":ut("ingest/svg-animations.ts and css-animation-syntax.ts"),metadata:ut("ingest/svg-metadata.ts"),scripts:ut("ingest/svg-scripts.ts"),styles:ut("ingest/svg-style-cascade.ts"),"custom-properties":ut("ingest/svg-style-cascade.ts custom-property environments"),views:ut("ingest/svg-views.ts"),"embedded-svg":ut("ingest/svg-embedded-frames.ts"),fonts:ut("ingest/svg-external-effects.ts"),"external-assets":ut("ingest/svg-external-effects.ts"),"foreign-structure":ut("ingest/plan-decoration.ts")};var C2=64,O2=1e5,Bd="http://www.w3.org/2000/svg",T2=new Set(["circle","ellipse","line","path","polygon","polyline","rect","text"]);function T0(e,t){return e===void 0||!Number.isFinite(e)?t:Math.max(1,Math.floor(e))}var Ap=new Set(["defs","clippath","mask","marker","pattern","lineargradient","radialgradient","filter","symbol"]);function P2(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let i=e[n]-t[n];if(i!==0)return i}return e.length-t.length}function D2(e,t){return P2(e.orderKey,t.orderKey)||e.productIndex-t.productIndex||e.occurrenceId.localeCompare(t.occurrenceId)}function P0(e,t,r){let n=t.map(i=>i.sourceReferenceId).join("/");return`occurrence:${n?`${n}/`:""}${e}:${r}`}function j2(e,t){let r=vr(t);if(!r?.value.startsWith("#")||r.value.length<=1)return null;let n=r.namespace==="svg2"?"href":"xlink-href";return e.index.referencesFrom(t.sourceNodeId).find(i=>i.channel===n&&i.authoredValue===r.value)??null}function E2(e,t){let r=vr(t);if(!r||r.value.length===0||r.value==="#")return Object.freeze({useSourceNodeId:t.sourceNodeId,sourceReferenceId:null,targetSourceNodeId:null,status:"empty"});if(!r.value.startsWith("#"))return Object.freeze({useSourceNodeId:t.sourceNodeId,sourceReferenceId:null,targetSourceNodeId:null,status:"external"});let n=j2(e,t),i=n?.targetSourceNodeId?e.index.element(n.targetSourceNodeId):null;return!n||!i?Object.freeze({useSourceNodeId:t.sourceNodeId,sourceReferenceId:n?.sourceReferenceId??null,targetSourceNodeId:null,status:"missing"}):i.namespaceUri!==Bd?Object.freeze({useSourceNodeId:t.sourceNodeId,sourceReferenceId:n.sourceReferenceId,targetSourceNodeId:i.sourceNodeId,status:"invalid"}):Object.freeze({useSourceNodeId:t.sourceNodeId,sourceReferenceId:n.sourceReferenceId,targetSourceNodeId:i.sourceNodeId,status:"resolved"})}function z2(e,t){let r=t;for(;r&&r!==e.root;){if(Ap.has(r.localName.toLowerCase()))return!0;r=e.index.parent(r.sourceNodeId)}return!1}function ro(e){return e.namespaceUri===Bd&&e.localName.toLowerCase()==="use"}function R2(e,t){let r=new Map;for(let y of e.index.idOccurrences){let I=e.index.element(y.sourceNodeId);I&&r.set(I.sourceNodeId,I)}let n=new Map;for(let y of r.keys())n.set(y,new Set);for(let y of e.index.elements){if(y.namespaceUri!==Bd||y.localName.toLowerCase()!=="use")continue;let I=t.get(y.sourceNodeId);if(I?.status!=="resolved"||!I.targetSourceNodeId||!r.has(I.targetSourceNodeId))continue;let x=y;for(;x;)r.has(x.sourceNodeId)&&n.get(x.sourceNodeId)?.add(I.targetSourceNodeId),x=e.index.parent(x.sourceNodeId)}let i=(y,I)=>(r.get(y)?.elementOrder??0)-(r.get(I)?.elementOrder??0),a=[...r.keys()].sort(i),o=new Map(a.map(y=>[y,[...n.get(y)??[]].sort(i)])),s=new Map(a.map(y=>[y,[]]));for(let[y,I]of o)for(let x of I)s.get(x)?.push(y);for(let y of s.values())y.sort(i);let l=[],u=new Set;for(let y of a){if(u.has(y))continue;u.add(y);let I=[{sourceNodeId:y,targetIndex:0}];for(;I.length>0;){let x=I[I.length-1],k=(o.get(x.sourceNodeId)??[])[x.targetIndex];if(k!==void 0){x.targetIndex++,u.has(k)||(u.add(k),I.push({sourceNodeId:k,targetIndex:0}));continue}l.push(x.sourceNodeId),I.pop()}}let d=[],c=new Set;for(let y=l.length-1;y>=0;y--){let I=l[y];if(c.has(I))continue;let x=[],k=[I];for(c.add(I);k.length>0;){let $=k.pop();x.push($);let A=s.get($)??[];for(let S=A.length-1;S>=0;S--){let M=A[S];c.has(M)||(c.add(M),k.push(M))}}x.sort(i),d.push(x)}let f=new Map;d.forEach((y,I)=>{y.forEach(x=>f.set(x,I))});let p=d.map(()=>new Set);for(let[y,I]of n){let x=f.get(y);for(let k of I){let $=f.get(k);x!==$&&p[x].add($)}}let h=d.map(y=>r.get(y[0])?.elementOrder??Number.MAX_SAFE_INTEGER),m=(y,I)=>h[y]-h[I],g=d.map((y,I)=>I).sort(m),v=[],b=new Set;for(let y of g){if(b.has(y))continue;b.add(y);let I=[{componentIndex:y,dependencyIndex:0,dependencies:[...p[y]].sort(m)}];for(;I.length>0;){let x=I[I.length-1],k=x.dependencies[x.dependencyIndex];if(k!==void 0){x.dependencyIndex++,b.has(k)||(b.add(k),I.push({componentIndex:k,dependencyIndex:0,dependencies:[...p[k]].sort(m)}));continue}v.push(x.componentIndex),I.pop()}}return v.map(y=>{let I=d[y],x=I.length>1||(n.get(I[0])?.has(I[0])??!1);return Object.freeze({componentId:`definition-component:${I[0]}`,memberSourceNodeIds:Object.freeze([...I]),circular:x})})}function no(e,t,r,n,i){return Object.freeze({severity:"warning",code:t,source:e.source,entrypoint:e.entrypoint,capability:"use-and-linked-references",sourceId:j(n,"id")??void 0,sourceNodeId:n.sourceNodeId,occurrenceId:i,elementName:n.name,message:r})}function _2(e,t){let r=T0(t.maxDepth,C2),n=T0(t.maxOccurrences,O2),i=e.index.elements.filter(S=>S.namespaceUri===Bd&&S.localName.toLowerCase()==="use").map(S=>E2(e,S)),a=new Map(i.map(S=>[S.useSourceNodeId,S])),o=[],s=new Map,l=new Map,u=[],d=[],c=[],f=new Map,p=new Set;for(let S of t.resourceRoots??[]){let M=`${S.capability}\0${S.sourceNodeId}`;if(p.has(M))continue;p.add(M);let T=e.index.element(S.sourceNodeId),E=[];if(T&&S.capability==="clip-path")for(let O of e.index.children(T.sourceNodeId)){if(!ro(O))continue;let z=a.get(O.sourceNodeId),R=z?.targetSourceNodeId?e.index.element(z.targetSourceNodeId):null;(z?.status!=="resolved"||!R||!T2.has(R.localName.toLowerCase()))&&(E.push(O.sourceNodeId),d.push(Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:t.source,entrypoint:t.entrypoint,capability:"clip-definitions",sourceId:j(T,"id")??void 0,sourceNodeId:O.sourceNodeId,elementName:O.name,documentPath:e.index.sourcePath(O.sourceNodeId),message:"A clipPath child use must directly reference a path, text, or basic shape. The clipPath is ignored."})))}let C=Object.freeze({resourceRootSourceNodeId:S.sourceNodeId,capability:S.capability,status:E.length===0?"valid":"invalid",invalidUseSourceNodeIds:Object.freeze(E)});c.push(C),f.has(S.sourceNodeId)||f.set(S.sourceNodeId,C)}let h=new Set,m=0,g=!1,v=(S,M,T,E,C)=>{let O=P0(S.sourceNodeId,M,0),z=s.get(O);if(z)return z;let R=Object.freeze({occurrenceId:O,correspondingSourceNodeId:S.sourceNodeId,usePath:Object.freeze(M.map(U=>Object.freeze({...U}))),role:C,parentOccurrenceId:T,orderKey:Object.freeze([...E]),productIndex:0});return o.push(R),s.set(O,R),M.length===0?l.set(S.sourceNodeId,R):m++,R};for(let S of e.index.elements){let M=e.index.parent(S.sourceNodeId),T=M?P0(M.sourceNodeId,[],0):null,E=ro(S)?"use-carrier":z2(e,S)?"definition":"source";v(S,[],T,[S.elementOrder],E)}let b=(S,M)=>{g||(g=!0,d.push(no(t,"use-expansion-limit-exceeded",`SVG use expansion exceeded depth ${r} or ${n} shadow occurrences.`,S,M.occurrenceId)))},y=(S,M,T)=>{if(h.has(M.occurrenceId))return;h.add(M.occurrenceId);let E=vr(S),C=a.get(S.sourceNodeId);if(!C||C.status==="empty"){u.push({useOccurrenceId:M.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:null,status:"empty"}),d.push(no(t,"unresolved-reference","The SVG use element has no local target.",S,M.occurrenceId));return}if(C.status==="external"){u.push({useOccurrenceId:M.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:null,status:"external"}),d.push(no(t,"unresolved-reference",`External SVG use target "${E?.value??""}" is not materialized by local import.`,S,M.occurrenceId));return}if(C.status==="missing"){u.push({useOccurrenceId:M.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:null,status:"missing"}),d.push(no(t,"unresolved-reference",`SVG use target "${E?.value??""}" does not exist.`,S,M.occurrenceId));return}if(C.status==="invalid"){u.push({useOccurrenceId:M.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:C.targetSourceNodeId,status:"invalid"}),d.push(no(t,"unresolved-reference",`SVG use target "${E?.value??""}" is outside the SVG namespace.`,S,M.occurrenceId));return}let O=C.targetSourceNodeId?e.index.element(C.targetSourceNodeId):null;if(!O||!C.sourceReferenceId)return;let z={sourceReferenceId:C.sourceReferenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:O.sourceNodeId},R=[...M.usePath,z];if(T.has(O.sourceNodeId)){u.push({useOccurrenceId:M.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:O.sourceNodeId,status:"circular"}),d.push(no(t,"circular-use-reference",`SVG use target "${E?.value??""}" closes a circular shadow-tree reference.`,S,M.occurrenceId));return}if(R.length>r||m>=n){u.push({useOccurrenceId:M.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:O.sourceNodeId,status:"limit"}),b(S,M);return}let U={useOccurrenceId:M.occurrenceId,useSourceNodeId:S.sourceNodeId,targetSourceNodeId:O.sourceNodeId,status:"resolved"};u.push(U);let V=()=>{U.status="limit",b(S,M)},Y=new Set(T),G=(H,X,B)=>{if(m>=n){V();return}Y.add(H.sourceNodeId);let ae=ro(H)?"use-carrier":"shadow-instance",K=v(H,R,X,B,ae);if(ro(H))y(H,K,Y);else if(!Ap.has(H.localName.toLowerCase())||H.localName.toLowerCase()==="symbol"){for(let W of e.index.children(H.sourceNodeId))if(G(W,K.occurrenceId,[...B,W.elementOrder]),m>=n){V();break}}Y.delete(H.sourceNodeId)};G(O,M.occurrenceId,[...M.orderKey,O.elementOrder])},I=(S,M)=>{if(Ap.has(S.localName.toLowerCase()))return;let T=new Set(M);T.add(S.sourceNodeId);let E=l.get(S.sourceNodeId);if(ro(S)){y(S,E,M);return}for(let C of e.index.children(S.sourceNodeId))I(C,T)};I(e.root,new Set);let x=(S,M)=>{let T=new Set(M);T.add(S.sourceNodeId);let E=l.get(S.sourceNodeId);if(ro(S)){y(S,E,M);return}for(let C of e.index.children(S.sourceNodeId))x(C,T)};for(let S of t.resourceRoots??[]){if(f.get(S.sourceNodeId)?.status==="invalid")continue;let M=e.index.element(S.sourceNodeId);if(!M)continue;let T=new Set,E=e.index.parent(M.sourceNodeId);for(;E;)T.add(E.sourceNodeId),E=e.index.parent(E.sourceNodeId);x(M,T)}let k=new Set(i.flatMap(S=>S.status==="resolved"&&S.targetSourceNodeId?[S.targetSourceNodeId]:[]));for(let S of i){if(S.status==="resolved")continue;let M=e.index.element(S.useSourceNodeId);if(!M)continue;let T=e.index.parent(M.sourceNodeId);for(;T&&T.localName.toLowerCase()!=="symbol";)T=e.index.parent(T.sourceNodeId);if(!T||k.has(T.sourceNodeId))continue;let E=new Set,C=e.index.parent(M.sourceNodeId);for(;C;)E.add(C.sourceNodeId),C=e.index.parent(C.sourceNodeId);let O=l.get(M.sourceNodeId);O&&y(M,O,E)}o.sort(D2);let $=u.map(S=>Object.freeze({...S})),A=R2(e,a);return Object.freeze(i),Object.freeze(o),Object.freeze($),Object.freeze(A),Object.freeze(c),Object.freeze(d),Object.freeze({occurrences:o,sourceResolutions:i,resolutions:$,definitionComponents:A,resourcePolicies:c,diagnostics:d,occurrence(S){return s.get(S)??null},direct(S){return l.get(S)??null},sourceResolution(S){return a.get(S)??null},resourcePolicy(S){return f.get(S)??null}})}function rw(e,t){return e.index.parent(t.sourceNodeId)===e.root?"document":"defs"}var Vd=new Set(["circle","ellipse","foreignobject","image","line","path","polygon","polyline","rect","text"]),F2=new Set([...Vd,"a","g","use"]),L2=new Set(["clippath","defs","filter","lineargradient","marker","mask","pattern","radialgradient","symbol"]),B2=new Set(["clippath","filter","marker","mask","pattern"]),V2=new Set(["defs"]),D0=new Set([...L2,"flowregion"]),U2=new Set(["data-shape-id","height","href","id","style","transform","width","x","xlink:href","xmlns","xmlns:xlink","y"]),G2=["animation","transition","-moz-animation","-moz-transition","-o-animation","-o-transition","-webkit-animation","-webkit-transition"],W2=new Set(["height","id","preserveaspectratio","refx","refy","viewbox","width","x","y"]);function Kr(e){return e.localName.toLowerCase()}function nw(e,t){let r=[],n=new Set,i=e.index.parent(t.sourceNodeId);for(;i&&!n.has(i.sourceNodeId);)n.add(i.sourceNodeId),r.push(i),i=e.index.parent(i.sourceNodeId);return r}function ld(e,t,r){return nw(e,t).some(n=>r.has(Kr(n)))}function j0(e,t){let r=Kr(t);return r==="symbol"?!0:ld(e,t,V2)?r==="g"||r==="use"||Vd.has(r):!1}function E0(e){let t=e.toLowerCase();return G2.some(r=>t===r||t.startsWith(`${r}-`))}function X2(e){let t={};for(let r of["x","y","width","height"])Ri(e,r)&&(t[r]=j(e,r)??"");return Object.keys(t).length===0?null:Object.freeze(t)}function H2(e,t,r,n){let i=t;for(;i&&Kr(i)!=="svg";)i=e.index.parent(i.sourceNodeId);let a=i?Nn(j(i,"viewBox")??""):null,o=i?at(j(i,"width"),{}):void 0,s=i?at(j(i,"height"),{}):void 0,l=a?.width??o,u=a?.height??s,d=at(r.value(n,"font-size"),{viewportWidth:l,viewportHeight:u,percentBasis:16,fontSize:16,rootFontSize:16});return{viewportWidth:l,viewportHeight:u,fontSize:d??16,rootFontSize:16}}function q2(e,t){for(let r of nw(e,t))switch(Kr(r)){case"pattern":return j(r,"patternContentUnits")==="objectBoundingBox";case"clippath":return j(r,"clipPathUnits")==="objectBoundingBox";case"mask":return j(r,"maskContentUnits")==="objectBoundingBox";default:break}return!1}function $u(e,t){if(e===null||e.trim()===""||e.trim().toLowerCase()==="auto")return t;let r=jr(e);return r?r.unit==="%"?r.value/100:r.unit===""?r.value:t:t}function Y2(e,t,r,n){let i=q2(e,t),a=H2(e,t,n,r),o=j(t,"x"),s=j(t,"y"),l=i?$u(o,0):at(o,{...a,percentBasis:a.viewportWidth})??0,u=i?$u(s,0):at(s,{...a,percentBasis:a.viewportHeight})??0,d=j(t,"width"),c=j(t,"height"),f=d===null||d.trim()===""||d.trim().toLowerCase()==="auto"?null:i?$u(d,0):at(d,{...a,percentBasis:a.viewportWidth})??null,p=c===null||c.trim()===""||c.trim().toLowerCase()==="auto"?null:i?$u(c,0):at(c,{...a,percentBasis:a.viewportHeight})??null;return Object.freeze({authored:X2(t),x:l,y:u,width:f,height:p})}function K2(e,t,r){let n=j(e,"transform"),i=r.style(t)?.cascadedValues.transform?.value??null,a=n??i;if(a===null||a.trim()===""||a.trim().toLowerCase()==="none")return Object.freeze({authored:a,matrix:Qr(1,0,0,1,0,0),valid:!0,pureTranslation:!0});let o=_i(a),s=o!==null&&Math.abs(o[0]-1)<1e-6&&Math.abs(o[1])<1e-6&&Math.abs(o[2])<1e-6&&Math.abs(o[3]-1)<1e-6;return Object.freeze({authored:a,matrix:o,valid:o!==null,pureTranslation:s})}function Z2(e,t,r){let n={};for(let o of e.attributes){let s=o.name;U2.has(s)||o.value===""||E0(s)||(n[s]=o.value)}let i=r.style(t.occurrenceId);for(let[o,s]of Object.entries(i?.cascadedValues??{}))o==="transform"||E0(o)||(n[o]=s.value);let a=t.parentOccurrenceId?r.style(t.parentOccurrenceId):null;for(let[o,s]of Object.entries(i?.resolvedValues??{}))n[o]!==void 0||!el(o)?.inherited||a?.resolvedValues[o]!==s||a.cascadedValues[o]&&(n[o]=s);return Object.freeze(n)}function J2(e){let t={};for(let r of e.attributes)r.name==="xmlns"||r.prefix==="xmlns"||r.namespaceUri===null&&W2.has(r.localName.toLowerCase())||(t[r.name]=r.value);return Object.freeze(t)}function iw(e){let t=J2(e),r=Kr(e);return r==="g"||r==="symbol"?t:t.transform===void 0?Object.freeze({}):Object.freeze({transform:t.transform})}function aw(e,t){return e.find(r=>r.memberSourceNodeIds.includes(t))??null}function Q2(e,t,r,n,i,a){let o=i.get(`${r.occurrenceId}\0${n.sourceNodeId}`);if(!o)return null;let s=aw(t.definitionComponents,n.sourceNodeId),l=a(o.occurrenceId),u=j(n,"viewBox");return Object.freeze({sourceNodeId:n.sourceNodeId,sourceId:j(n,"id"),defKind:Kr(n)==="symbol"?"symbol":Kr(n)==="use"||Vd.has(Kr(n))?"shape":"group",definitionPlacement:rw(e,n),productKey:`symbol-product:${n.sourceNodeId}:${r.occurrenceId}`,productUseOccurrenceId:r.occurrenceId,productRootOccurrenceId:o.occurrenceId,contentOccurrenceIds:Object.freeze(l),componentId:s?.componentId??null,circular:s?.circular??!1,viewBox:u,parsedViewBox:u===null?null:Nn(u),preserveAspectRatio:j(n,"preserveAspectRatio"),x:j(n,"x"),y:j(n,"y"),width:j(n,"width"),height:j(n,"height"),refX:j(n,"refX"),refY:j(n,"refY"),rootAttributes:iw(n)})}function eD(e,t,r,n,i){let a=aw(t.definitionComponents,r.sourceNodeId),o=j(r,"viewBox");return Object.freeze({sourceNodeId:r.sourceNodeId,sourceId:j(r,"id"),defKind:Kr(r)==="symbol"?"symbol":Kr(r)==="use"||Vd.has(Kr(r))?"shape":"group",definitionPlacement:rw(e,r),productKey:`symbol-definition:${r.sourceNodeId}`,productUseOccurrenceId:n.occurrenceId,productRootOccurrenceId:n.occurrenceId,contentOccurrenceIds:Object.freeze(i(n.occurrenceId)),componentId:a?.componentId??null,circular:a?.circular??!1,viewBox:o,parsedViewBox:o===null?null:Nn(o),preserveAspectRatio:j(r,"preserveAspectRatio"),x:j(r,"x"),y:j(r,"y"),width:j(r,"width"),height:j(r,"height"),refX:j(r,"refX"),refY:j(r,"refY"),rootAttributes:iw(r)})}function z0(e,t,r,n,i,a){return!(n.usePath.length!==0||!i.valid||!F2.has(Kr(r))||ld(e,t,D0)||ld(e,r,D0)&&!a.has(r.sourceNodeId))}function tD(e,t,r,n){let i=n.nativeDefinitionSourceNodeIds??new Set,a=n.privateGeometrySourceNodeIds??new Set,o=new Map,s=new Map;for(let y of t.occurrences){if(!y.parentOccurrenceId)continue;let I=`${y.parentOccurrenceId}\0${y.correspondingSourceNodeId}`;o.has(I)||o.set(I,y);let x=s.get(y.parentOccurrenceId)??[];x.push(y),s.set(y.parentOccurrenceId,x)}let l=new Map,u=y=>{let I=l.get(y);if(I)return I;let x=[],k=[...s.get(y)??[]].reverse(),$=new Set;for(;k.length>0;){let S=k.pop();if($.has(S.occurrenceId))continue;$.add(S.occurrenceId),x.push(S.occurrenceId);let M=s.get(S.occurrenceId)??[];for(let T=M.length-1;T>=0;T--)k.push(M[T])}let A=Object.freeze(x);return l.set(y,A),A},d=[],c=[],f=new Map,p=new Map;for(let y of t.resolutions){let I=t.occurrence(y.useOccurrenceId),x=e.index.element(y.useSourceNodeId);if(!I||!x||x.namespaceUri!==ye)continue;let k=y.targetSourceNodeId?e.index.element(y.targetSourceNodeId):null,$=Y2(e,x,I.occurrenceId,r),A=K2(x,I.occurrenceId,r),S=Z2(x,I,r),M=y.status==="resolved"?"flattened":y.status,T=null;if(y.status==="resolved"&&k){let C=ld(e,x,B2);if(i.has(k.sourceNodeId)&&z0(e,x,k,I,A,i))M="linked-reference";else if(j0(e,k)){let O=Q2(e,t,I,k,o,u);O&&(d.push(O),f.set(O.productKey,O),C||(T=O.productKey,M="symbol-instance"))}else!C&&z0(e,x,k,I,A,i)&&(M="linked-reference")}let E=Object.freeze({useOccurrenceId:I.occurrenceId,useSourceNodeId:x.sourceNodeId,targetSourceNodeId:k?.sourceNodeId??null,targetElementName:k?.name??null,status:M,definitionProductKey:T,geometry:$,presentation:S,transform:A,orderKey:Object.freeze([...I.orderKey])});c.push(E),p.set(E.useOccurrenceId,E)}let h=new Set(d.map(y=>y.sourceNodeId));for(let y of e.index.elements){let I=e.index.parent(y.sourceNodeId),x=j(y,"id"),k=Kr(y),$=I?.localName.toLowerCase()==="defs",A=k==="symbol";if(!x||i.has(y.sourceNodeId)||a.has(y.sourceNodeId)||!$&&!A||!j0(e,y)||h.has(y.sourceNodeId)&&!A)continue;let S=t.direct(y.sourceNodeId);if(!S)continue;let M=eD(e,t,y,S,u),T=d.findIndex(E=>E.sourceNodeId===y.sourceNodeId);T===-1?d.push(M):d.splice(T,0,M),f.set(M.productKey,M),h.add(M.sourceNodeId)}let m=new Map;for(let y of d){let I=m.get(y.sourceNodeId)??[];I.push(y),m.set(y.sourceNodeId,I)}let g=new Map;for(let[y,I]of m){let x=I.find(k=>k.productKey.startsWith("symbol-definition:"));g.set(y,x??I[0])}let v=d.map(y=>{let I=s.get(y.productRootOccurrenceId)??[],x=[],k=new Set;for(let $ of I){let A=g.get($.correspondingSourceNodeId),S=e.index.parent($.correspondingSourceNodeId)?.sourceNodeId===y.sourceNodeId;if(A&&A.productKey!==y.productKey&&S){x.push({kind:"definition",productKey:A.productKey}),k.add($.occurrenceId);for(let M of u($.occurrenceId))k.add(M)}else x.push({kind:"occurrence",occurrenceId:$.occurrenceId})}return x.some($=>$.kind==="definition")?Object.freeze({...y,contentOccurrenceIds:Object.freeze(y.contentOccurrenceIds.filter($=>!k.has($))),definitionContentOrder:Object.freeze(x.map($=>Object.freeze($)))}):y});f.clear();for(let y of v)f.set(y.productKey,y);Object.freeze(v),Object.freeze(c);let b=Object.freeze([]);return Object.freeze({definitions:v,uses:c,diagnostics:b,definition(y){return f.get(y)??null},use(y){return p.get(y)??null}})}var rD=new Map([["lineargradient","gradient"],["radialgradient","gradient"],["pattern","pattern"],["filter","filter"],["marker","marker"],["clippath","clip-path"],["mask","mask"]]),ow=new Map([["clip-path","clip-path"],["mask","mask-image"],["mask-image","mask-image"],["filter","filter"],["fill","paint"],["stroke","paint"],["marker","marker"],["marker-start","marker"],["marker-mid","marker"],["marker-end","marker"]]),nD=new Set(["animate","set"]),iD=new Set(["clippath","defs","desc","lineargradient","marker","mask","metadata","pattern","radialgradient","script","style","symbol","title"]);function sw(e){return!e||e.namespaceUri!==ye?null:rD.get(e.localName.toLowerCase())??null}function lw(e,t,r){if(!r||r.namespaceUri!==ye)return!1;let n=r.localName.toLowerCase();return e==="paint"||e==="smil-animated-resource"&&["fill","stroke"].includes(t??"")?n==="lineargradient"||n==="radialgradient"||n==="pattern":e==="filter"||e==="smil-animated-resource"&&t==="filter"?n==="filter":e==="marker"||e==="smil-animated-resource"&&t?.startsWith("marker")?n==="marker":e==="clip-path"||e==="smil-animated-resource"&&t==="clip-path"?n==="clippath":e==="mask-image"||e==="smil-animated-resource"&&(t==="mask"||t==="mask-image")?n==="mask":e==="gradient-template"?n==="lineargradient"||n==="radialgradient":e==="pattern-template"?n==="pattern":e==="filter-image"}function aD(e){let t=[...e.children].reverse(),r="";for(;t.length>0;){let n=t.pop();n.kind==="text"||n.kind==="cdata"?r+=n.value:n.kind==="element"&&t.push(...[...n.children].reverse())}return r}function uw(e,t){let r=t;for(;r;){if(sw(r))return r;r=e.index.parent(r.sourceNodeId)}return null}function dw(e,t,r){if(!r)return"consumer";if(t.sourceNodeId===r.sourceNodeId)return"resource-product";let n=t;for(;n&&n.sourceNodeId!==r.sourceNodeId;){if(iD.has(n.localName.toLowerCase()))return"parked";n=e.index.parent(n.sourceNodeId)}return n?"resource-product":"parked"}function oD(e){let t=[];for(let r of Qs(e,";")){let n=e.slice(r.start,r.end),i=Qs(n,":",!0);if(i.length<2)continue;let a=n.slice(i[0].start,i[0].end).trim().toLowerCase();if(!a)continue;let o=r.start+i[1].start,s=r.end;for(;o<s&&/\s/u.test(e[o]);)o++;for(;s>o&&/\s/u.test(e[s-1]);)s--;o!==s&&t.push({propertyName:a,valueStart:o,valueEnd:s})}return t}function cw(e,t,r,n,i,a){let o=e.index.referencesFrom(t.sourceNodeId).find(s=>a.has(s.sourceReferenceId)||s.targetAuthoredId!==r||s.authoredValue!==n?!1:i===null||s.attributeName===i);return o&&a.add(o.sourceReferenceId),o??null}function sD(e,t,r){return(e.get(t)?.elementOrder??Number.MAX_SAFE_INTEGER)-(e.get(r)?.elementOrder??Number.MAX_SAFE_INTEGER)}function lD(e,t,r){let n=(b,y)=>sD(r,b,y),i=[...e].sort(n),a=new Map(i.map(b=>[b,[...t.get(b)??[]].sort(n)])),o=new Map(i.map(b=>[b,[]]));for(let[b,y]of a)for(let I of y)o.get(I)?.push(b);for(let b of o.values())b.sort(n);let s=[],l=new Set;for(let b of i){if(l.has(b))continue;l.add(b);let y=[{nodeId:b,targetIndex:0}];for(;y.length>0;){let I=y[y.length-1],x=a.get(I.nodeId)?.[I.targetIndex];x!==void 0?(I.targetIndex++,l.has(x)||(l.add(x),y.push({nodeId:x,targetIndex:0}))):(s.push(I.nodeId),y.pop())}}let u=[],d=new Set;for(let b=s.length-1;b>=0;b--){let y=s[b];if(d.has(y))continue;let I=[],x=[y];for(d.add(y);x.length>0;){let k=x.pop();I.push(k);let $=o.get(k)??[];for(let A=$.length-1;A>=0;A--){let S=$[A];d.has(S)||(d.add(S),x.push(S))}}I.sort(n),u.push(I)}let c=new Map;u.forEach((b,y)=>{b.forEach(I=>c.set(I,y))});let f=u.map(()=>new Set);for(let[b,y]of t){let I=c.get(b);if(I!==void 0)for(let x of y){let k=c.get(x);k!==void 0&&I!==k&&f[I].add(k)}}let p=u.map(b=>r.get(b[0])?.elementOrder??Number.MAX_SAFE_INTEGER),h=(b,y)=>p[b]-p[y],m=u.map((b,y)=>y).sort(h),g=[],v=new Set;for(let b of m){if(v.has(b))continue;v.add(b);let y=[{component:b,dependencyIndex:0,dependencies:[...f[b]].sort(h)}];for(;y.length>0;){let I=y[y.length-1],x=I.dependencies[I.dependencyIndex];x!==void 0?(I.dependencyIndex++,v.has(x)||(v.add(x),y.push({component:x,dependencyIndex:0,dependencies:[...f[x]].sort(h)}))):(g.push(I.component),y.pop())}}return g.map(b=>{let y=u[b];return Object.freeze({componentId:`resource-component:${y[0]}`,memberSourceNodeIds:Object.freeze([...y]),circular:y.length>1||(t.get(y[0])?.has(y[0])??!1)})})}function fw(e,t){let r=e.index.occurrences(t),n=r[0]?.sourceNodeId??null;return{targetSourceNodeId:n,target:n?e.index.element(n):null,resolution:r.length===0?"missing":r.length===1?"resolved":"ambiguous-first"}}function Hu(e,t,r,n,i,a,o,s,l,u=r.length,d=null){let c=l??ow.get(n);if(!c)return[];let f=uw(e,t);return sl(r.slice(o,u)).map((p,h)=>{let m=fw(e,p.targetAuthoredId);return{sourceReferenceId:(i==="authored-direct"?cw(e,t,p.targetAuthoredId,r,a,s):null)?.sourceReferenceId??null,fromSourceNodeId:t.sourceNodeId,occurrenceId:d,containingResourceSourceNodeId:f?.sourceNodeId??null,participation:dw(e,t,f),binding:i,kind:c,propertyName:n,attributeName:a,authoredValue:r,propertyValue:r.slice(o,u),tokenIndex:h,tokenStart:o+p.targetStart,tokenEnd:o+p.targetEnd,targetAuthoredId:p.targetAuthoredId,targetSourceNodeId:m.targetSourceNodeId,targetElementName:m.target?.localName??null,resolution:m.resolution,validity:m.resolution==="missing"?"missing":lw(c,n,m.target)?"valid":"invalid-target",componentId:null}})}function Vf(e,t,r,n){let i=vr(t);if(!i||!i.value.startsWith("#")||i.value.length<=1)return null;let a=i.value.slice(1),o=fw(e,a),s=i.namespace==="svg2"?"href":"xlink:href",l=cw(e,t,a,i.value,s,n),u=uw(e,t);return{sourceReferenceId:l?.sourceReferenceId??null,fromSourceNodeId:t.sourceNodeId,occurrenceId:null,containingResourceSourceNodeId:u?.sourceNodeId??null,participation:dw(e,t,u),binding:"authored-direct",kind:r,propertyName:null,attributeName:s,authoredValue:i.value,propertyValue:i.value,tokenIndex:0,tokenStart:1,tokenEnd:i.value.length,targetAuthoredId:a,targetSourceNodeId:o.targetSourceNodeId,targetElementName:o.target?.localName??null,resolution:o.resolution,validity:o.resolution==="missing"?"missing":lw(r,null,o.target)?"valid":"invalid-target",componentId:null}}function Uf(e){let t=e.trim().toLowerCase();return ow.has(t)?t:null}function uD(e,t){let r=[];for(let n of e.index.elements){if(n.namespaceUri!==ye)continue;let i=n.localName.toLowerCase();if(i==="lineargradient"||i==="radialgradient"){let a=Vf(e,n,"gradient-template",t);a&&r.push(a)}else if(i==="pattern"){let a=Vf(e,n,"pattern-template",t);a&&r.push(a)}else if(i==="feimage"){let a=Vf(e,n,"filter-image",t);a&&r.push(a)}if(nD.has(i)){let a=Uf(j(n,"attributeName")??"");if(a)for(let o of["values","from","to","by"]){let s=n.attributes.find(l=>l.namespaceUri===null&&l.localName===o);s&&r.push(...Hu(e,n,s.value,a,"authored-direct",s.name,0,t,"smil-animated-resource"))}continue}for(let a of n.attributes){if(a.namespaceUri!==null)continue;if(a.localName==="style"){for(let s of oD(a.value)){let l=Uf(s.propertyName);l&&r.push(...Hu(e,n,a.value,l,"authored-direct",a.name,s.valueStart,t,void 0,s.valueEnd))}continue}let o=Uf(a.localName);o&&r.push(...Hu(e,n,a.value,o,"authored-direct",a.name,0,t))}}return r}function dD(e,t,r){return t.flatMap(n=>{let i=e.index.element(n.fromSourceNodeId);if(!i)throw new Error(`Applied SVG resource declaration references unknown source node ${n.fromSourceNodeId}.`);return Hu(e,i,n.value,n.propertyName,"applied-css",null,0,r,void 0,n.value.length,n.occurrenceId??null)})}function cD(e){let t=[];for(let r of e.index.elements){if(r.namespaceUri!==ye||r.localName.toLowerCase()!=="style")continue;let n=aD(r);sl(n).forEach((i,a)=>{t.push(Object.freeze({styleSourceNodeId:r.sourceNodeId,authoredValue:n,tokenIndex:a,tokenStart:i.targetStart,tokenEnd:i.targetEnd,targetAuthoredId:i.targetAuthoredId}))})}return t}function fD(e,t,r){if(e.validity==="valid")return null;let n=e.validity==="circular",i=e.validity==="missing";return Object.freeze({severity:"warning",code:n?"circular-resource-reference":"unresolved-reference",source:t.source,entrypoint:t.entrypoint,capability:e.kind,sourceNodeId:e.fromSourceNodeId,sourceId:r?j(r,"id")??void 0:void 0,elementName:r?.name,message:n?`Circular ${e.kind} reference to #${e.targetAuthoredId} is invalid.`:i?`${e.kind} reference #${e.targetAuthoredId} is unresolved.`:`${e.kind} reference #${e.targetAuthoredId} targets an invalid ${e.targetElementName??"element"}.`})}function pD(e,t){let r=new Map(e.index.elements.map(I=>[I.sourceNodeId,I])),n=e.index.elements.flatMap(I=>{let x=sw(I);return x?[Object.freeze({sourceNodeId:I.sourceNodeId,kind:x,authoredId:j(I,"id")})]:[]}),i=new Set(n.map(I=>I.sourceNodeId)),a=new Set,o=[...uD(e,a),...dD(e,t.appliedDeclarations??[],a)],s=new Map(n.map(I=>[I.sourceNodeId,new Set]));for(let I of o)I.validity==="valid"&&I.participation==="resource-product"&&I.containingResourceSourceNodeId&&I.targetSourceNodeId&&i.has(I.targetSourceNodeId)&&s.get(I.containingResourceSourceNodeId)?.add(I.targetSourceNodeId);let l=lD(n.map(I=>I.sourceNodeId),s,r),u=new Map;for(let I of l)for(let x of I.memberSourceNodeIds)u.set(x,I);let d=o.map((I,x)=>{let k=I.containingResourceSourceNodeId?u.get(I.containingResourceSourceNodeId):void 0,$=I.targetSourceNodeId?u.get(I.targetSourceNodeId):void 0,A=!!(I.validity==="valid"&&k?.circular&&k===$);return Object.freeze({resourceReferenceId:`resource-reference:${x}`,...I,validity:A?"circular":I.validity,componentId:k?.componentId??null})}),c=new Map;for(let I of d){let x=c.get(I.fromSourceNodeId)??[];x.push(I),c.set(I.fromSourceNodeId,x)}let f=d.flatMap(I=>{let x=fD(I,t,r.get(I.fromSourceNodeId)??null);return x?[x]:[]}),p=new Map;for(let I of f){if(!I.sourceNodeId)continue;let x=p.get(I.sourceNodeId)??[];x.push(I),p.set(I.sourceNodeId,x)}let h=new Map(d.map(I=>[I.resourceReferenceId,I])),m=new Map;for(let I of d){if(!I.containingResourceSourceNodeId||I.participation!=="resource-product")continue;let x=m.get(I.containingResourceSourceNodeId)??[];x.push(I),m.set(I.containingResourceSourceNodeId,x)}let g=I=>I.validity==="valid"||I.validity==="circular",v=I=>Object.freeze([...new Set(I.flatMap(x=>p.get(x.fromSourceNodeId)??[]))]),b=I=>{let x=I.map(B=>{let ae=h.get(B.resourceReferenceId);if(!ae)throw new Error(`SVG resource edge ${B.resourceReferenceId} does not belong to this dependency plan.`);return ae}),k=new Set,$=new Set,A=new Set,S=new Map,M=[],T=[],E=new Map,C=B=>{if(k.add(B.resourceReferenceId),!(!g(B)||!B.targetSourceNodeId)){if(i.has(B.targetSourceNodeId)){if($.has(B.targetSourceNodeId))return;$.add(B.targetSourceNodeId),S.set(B.targetSourceNodeId,B.resourceReferenceId),M.push(B.targetSourceNodeId);return}B.kind!=="filter-image"||A.has(B.targetSourceNodeId)||(A.add(B.targetSourceNodeId),S.set(B.targetSourceNodeId,B.resourceReferenceId),T.push(B.targetSourceNodeId))}};for(x.forEach(C);M.length>0||T.length>0;){for(;M.length>0;){let B=M.shift();for(let ae of m.get(B)??[])C(ae)}for(;T.length>0;){let B=T.shift(),ae=[],K=[B],W=new Set;for(;K.length>0;){let J=K.pop();if(!W.has(J)){W.add(J);for(let Q of c.get(J)??[])Q.containingResourceSourceNodeId===null&&(ae.push(Q),C(Q));K.push(...e.index.children(J).map(Q=>Q.sourceNodeId))}}E.set(B,ae)}}let O=[],z=new Set,R=new Set,U=B=>{!g(B)||!B.targetSourceNodeId||($.has(B.targetSourceNodeId)?V(B.targetSourceNodeId):A.has(B.targetSourceNodeId)&&Y(B.targetSourceNodeId))},V=B=>{let ae=`resource:${B}`;if(!(z.has(ae)||R.has(ae))){R.add(ae);for(let K of m.get(B)??[])U(K);R.delete(ae),z.add(ae),O.push(Object.freeze({sourceNodeId:B,role:"resource",viaResourceReferenceId:S.get(B)??null}))}},Y=B=>{let ae=`fragment:${B}`;if(!(z.has(ae)||R.has(ae))){R.add(ae);for(let K of E.get(B)??[])U(K);R.delete(ae),z.add(ae),O.push(Object.freeze({sourceNodeId:B,role:"referenced-fragment",viaResourceReferenceId:S.get(B)??null}))}};for(let B of x)U(B);let G=d.filter(B=>k.has(B.resourceReferenceId)),H=O.flatMap(B=>B.role==="resource"?[B.sourceNodeId]:[]),X=l.filter(B=>B.memberSourceNodeIds.some(ae=>$.has(ae)));return Object.freeze({edges:Object.freeze(G),components:Object.freeze(X),resourceSourceNodeIds:Object.freeze(H),materializations:Object.freeze(O),diagnostics:v(G)})};for(let I of c.values())Object.freeze(I);Object.freeze(n),Object.freeze(d),Object.freeze(l),Object.freeze(f);let y=Object.freeze(cD(e));return Object.freeze({resources:n,edges:d,unboundStylesheetReferences:y,components:l,diagnostics:f,direct(I){return c.get(I)??Object.freeze([])},closureFromEdges(I){return b(I)},resolvePropertyValue(I,x,k){return Object.freeze((c.get(I)??[]).filter($=>$.propertyName===x&&$.propertyValue===k))},templateChain(I){let x=[],k=new Set,$=I;for(;$&&!k.has($);){k.add($);let A=(c.get($)??[]).find(S=>S.fromSourceNodeId===$&&(S.kind==="gradient-template"||S.kind==="pattern-template"));if(!A||(x.push(A),!A.targetSourceNodeId||!i.has(A.targetSourceNodeId)||A.validity==="missing"||A.validity==="invalid-target"))break;$=A.targetSourceNodeId}return Object.freeze(x)},closure(I){let x=I.map(z=>r.get(z)).filter(z=>!!z),k=new Set(x.filter(z=>i.has(z.sourceNodeId)).map(z=>z.sourceNodeId)),$=new Set;for(let z of x){let R=[z];for(;R.length>0;){let U=R.pop();$.has(U.sourceNodeId)||($.add(U.sourceNodeId),R.push(...e.index.children(U.sourceNodeId)))}}let A=new Set;for(let z of $){i.has(z)&&!k.has(z)&&A.add(z);for(let R of c.get(z)??[])R.validity==="valid"&&R.targetSourceNodeId&&i.has(R.targetSourceNodeId)&&!k.has(R.targetSourceNodeId)&&A.add(R.targetSourceNodeId)}let S=[...k,...A];for(;S.length>0;){let z=S.pop();for(let R of s.get(z)??[])k.has(R)||A.has(R)||(A.add(R),S.push(R))}let M=l.filter(z=>z.memberSourceNodeIds.some(R=>A.has(R))),T=M.flatMap(z=>z.memberSourceNodeIds.filter(R=>A.has(R))),E=new Set([...k,...A]),C=d.filter(z=>$.has(z.fromSourceNodeId)||z.containingResourceSourceNodeId!==null&&E.has(z.containingResourceSourceNodeId)),O=[...new Set(C.flatMap(z=>p.get(z.fromSourceNodeId)??[]))];return Object.freeze({edges:Object.freeze(C),components:Object.freeze(M),resourceSourceNodeIds:Object.freeze(T),materializations:Object.freeze(T.map(z=>Object.freeze({sourceNodeId:z,role:"resource",viaResourceReferenceId:null}))),diagnostics:Object.freeze(O)})}})}var hD="http://www.w3.org/2000/xmlns/",mD="http://www.w3.org/XML/1998/namespace",R0="http://www.w3.org/1999/xlink",gD=new Set(["class","id","lang","role","tabindex","xml:base","xml:lang","xml:space"]),yD=new Set(["cx","cy","d","dx","dy","height","inline-size","pathlength","points","r","rx","ry","shape-inside","textlength","width","x","x1","x2","y","y1","y2"]),vD=new Set(["crossorigin","decoding","href","preserveaspectratio","refx","refy","requiredextensions","requiredfeatures","systemlanguage","target","type","viewbox","zoomandpan"]);function bD(e,t,r,n){let i=t.toLowerCase(),a=r.toLowerCase();return n===hD||i==="xmlns"||i.startsWith("xmlns:")?"namespace":n!==null&&n!==mD&&n!==R0||e!==ye&&e!==null?"foreign":gD.has(i)?"metadata":i.startsWith("aria-")?"aria":i.startsWith("data-")?"data":/^on[a-z]/u.test(i)?"event-handler":v2.some(o=>o.toLowerCase()===i)?"conditional":i==="style"?"style":n===null&&ul(i)?"presentation":n===null&&yD.has(a)?"geometry":n===R0||n===null&&vD.has(a)?"element-specific":"passthrough"}function xD(e){let t=e.index.elements.flatMap(i=>i.attributes.map((a,o)=>Object.freeze({sourceNodeId:i.sourceNodeId,attributeOrder:o,name:a.name,localName:a.localName,prefix:a.prefix,namespaceUri:a.namespaceUri,value:a.value,span:a.span,classification:bD(i.namespaceUri,a.name,a.localName,a.namespaceUri)}))),r=Object.freeze(t),n=new Map;for(let i of r){let a=n.get(i.sourceNodeId)??[];a.push(i),n.set(i.sourceNodeId,a)}for(let[i,a]of n)n.set(i,Object.freeze(a));return Object.freeze({attributes:r,forElement:i=>n.get(i)??Object.freeze([])})}var hw="\0svgsketch-element-namespace",Cp="\0svgsketch-attribute-namespace\0",kD=new Set(["clip-path","mask","mask-image","filter","fill","stroke","marker","marker-start","marker-mid","marker-end"]),Op=new Set(["inherit","initial","unset","revert","revert-layer"]),No=Object.freeze({a:0,b:0,c:0});function Bn(e){return e?.children?.toArray()??[]}function Pi(e){return typeof e=="string"?e:e?wD(e):""}function Tp(e,t){let r=Math.max(e.length,t.length);for(let n=0;n<r;n++){let i=(e[n]??-1)-(t[n]??-1);if(i!==0)return i}return 0}function mw(e,t){return e.a-t.a||e.b-t.b||e.c-t.c}function io(e,t){return{a:e.a+t.a,b:e.b+t.b,c:e.c+t.c}}function _s(e){return e.reduce((t,r)=>mw(r,t)>0?r:t,No)}function Pp(e){let t=No;for(let r of e){if(r.type===he.Tag||r.type===he.PseudoElement){t=io(t,{a:0,b:0,c:1});continue}if(r.type===he.Attribute){let i=r.name==="id"&&r.action===xt.Equals&&r.ignoreCase==="quirks";t=io(t,i?{a:1,b:0,c:0}:{a:0,b:1,c:0});continue}if(r.type!==he.Pseudo)continue;let n=r.name.toLowerCase();if(n!=="where"){if((n==="is"||n==="not"||n==="has")&&Array.isArray(r.data)){t=io(t,_s(r.data.map(i=>Pp(i))));continue}if((n==="nth-child"||n==="nth-last-child")&&typeof r.data=="string"){let i=No,a=/\bof\s+(.+)$/iu.exec(r.data);if(a)try{i=_s(En(a[1]).map(Pp))}catch{i=No}t=io(io(t,{a:0,b:1,c:0}),i);continue}t=io(t,{a:0,b:1,c:0})}}return t}function SD(e){return{type:he.Attribute,name:hw,action:xt.Equals,value:e,namespace:null,ignoreCase:!1}}function _0(e,t){if(e==="")return"";let r=t.get(e);if(r===void 0)throw new Error(`Unknown CSS namespace prefix ${e}.`);return r}function gw(e,t){let r=[];for(let n of e){if(n.type===he.Tag||n.type===he.Universal){let i={...n,namespace:null};r.push(i);let a=n.namespace??(t.has("")?"":null);a!==null&&a!=="*"&&r.push(SD(_0(a,t)));continue}if(n.type===he.Attribute&&n.namespace!==null){if(n.namespace==="*")throw new Error("Wildcard attribute namespaces require an explicit namespace prefix.");let i=_0(n.namespace,t);r.push({...n,name:`${Cp}${i}\0${n.name}`,namespace:null});continue}if(n.type===he.Pseudo&&Array.isArray(n.data)&&["is","where","not","has"].includes(n.name.toLowerCase())){r.push({...n,data:n.data.map(i=>gw(i,t))});continue}r.push({...n})}return r}function $D(e){return e.children.filter(t=>t.kind!=="element").map(t=>t.value).join("")}function ND(e,t){let r=new Map;for(let a of t.occurrences){let o=e.index.element(a.correspondingSourceNodeId);o&&r.set(a.occurrenceId,{kind:"element",occurrence:a,element:o,parent:null,children:[]})}let n=[];for(let a of r.values()){let o=a.occurrence.parentOccurrenceId?r.get(a.occurrence.parentOccurrenceId)??null:null;a.parent=o,o?o.children.push(a):n.push(a);for(let s of a.element.children)s.kind!=="element"&&a.children.push({kind:"text",value:s.value,parent:a})}let i=(a,o)=>a.kind==="text"||o.kind==="text"?a.kind===o.kind?0:a.kind==="text"?1:-1:Tp(a.occurrence.orderKey,o.occurrence.orderKey);for(let a of r.values())a.children.sort(i);return n.sort((a,o)=>Tp(a.occurrence.orderKey,o.occurrence.orderKey)),{roots:Object.freeze(n),byOccurrenceId:r}}function yw(e){return e.kind==="text"?e.value:e.children.map(yw).join("")}function MD(e){let t=new Set(e);return e.filter(r=>{let n=r.parent;for(;n;){if(t.has(n))return!1;n=n.parent}return!0})}function F0(e,t){if(t===hw)return e.element.namespaceUri??"";if(t.startsWith(Cp)){let[r,n]=t.slice(Cp.length).split("\0");return e.element.attributes.find(i=>(i.namespaceUri??"")===r&&i.localName===n)?.value}return e.attributeOverrides&&Object.prototype.hasOwnProperty.call(e.attributeOverrides,t)?e.attributeOverrides?.[t]??void 0:e.element.attributes.find(r=>r.namespaceUri===null&&r.localName===t)?.value}function AD(e){return{adapter:{isTag:t=>t.kind==="element",getAttributeValue:F0,getChildren:t=>t.kind==="element"?t.children:[],getName:t=>t.element.localName,getParent:t=>t.parent,getSiblings:t=>t.parent?.children??[t],prevElementSibling:t=>{let r=t.parent?.children??[],n=r.indexOf(t);for(let i=n-1;i>=0;i--)if(r[i].kind==="element")return r[i];return null},getText:yw,hasAttrib:(t,r)=>F0(t,r)!==void 0,removeSubsets:MD,equals:(t,r)=>t===r,isHovered:t=>e.evaluateStatefulPseudo?.(t.occurrence.occurrenceId,"hover")===!0,isVisited:t=>e.evaluateStatefulPseudo?.(t.occurrence.occurrenceId,"visited")===!0,isActive:t=>e.evaluateStatefulPseudo?.(t.occurrence.occurrenceId,"active")===!0},xmlMode:!0,lowerCaseAttributeNames:!1,lowerCaseTags:!1,cacheResults:!0}}function CD(e,t,r){try{let n=En(e).map(i=>{let a=gw(i,t),o=Ty([a],r);return Object.freeze({matches:s=>o(s),specificity:Object.freeze(Pp(i))})});return Object.freeze(n)}catch{return null}}function OD(e){let t=[],r=0,n=null,i=!1,a=0,o=s=>{let l=e.slice(r,s).trim();l&&t.push(l)};for(let s=0;s<e.length;s++){let l=e[s];if(n){i?i=!1:l==="\\"?i=!0:l===n&&(n=null);continue}if(l==='"'||l==="'"){n=l;continue}l==="("?a++:l===")"?a=Math.max(0,a-1):a===0&&(/[\t\n\f\r ]/u.test(l)||l==="/")&&(o(s),l==="/"&&t.push("/"),r=s+1)}return o(e.length),t}function TD(e){let t=OD(e),r=/^(?:xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|larger|smaller|(?:\d*\.)?\d+(?:%|[a-z]+))$/iu,n=t.findIndex(c=>r.test(c));if(n<0)return null;let i="normal",a="normal",o="normal",s="normal";for(let c of t.slice(0,n)){let f=c.toLowerCase();f==="italic"||f==="oblique"?i=c:f==="small-caps"?a=c:f==="bold"||f==="bolder"||f==="lighter"||/^\d{1,4}$/u.test(f)?o=c:/^(?:ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded)$/u.test(f)&&(s=c)}let l=n+1,u="normal";t[l]==="/"&&(u=t[l+1]??"normal",l+=2);let d=t.slice(l).join(" ").trim();return d?Object.freeze({"font-style":i,"font-variant":a,"font-weight":o,"font-stretch":s,"font-size":t[n],"line-height":u,"font-family":d}):null}function PD(e){let t=e.propertyName;if(t==="marker")return["marker-start","marker-mid","marker-end"].map(r=>({...e,propertyName:r}));if(t==="font"){let r=TD(e.value);return r?Object.entries(r).map(([n,i])=>({...e,propertyName:n,value:i,authoredValue:i})):[]}return t==="all"&&Op.has(e.value.toLowerCase())?jx.map(r=>({...e,propertyName:r})):[e]}var DD=new Set(["cx","cy","r","rx","ry","x","y","width","height"]);function jD(e,t){let r=t.trim().toLowerCase();if(DD.has(e))return Op.has(r)||(e==="rx"||e==="ry"||e==="width"||e==="height")&&r==="auto"?!0:jr(t)!==null;if(e==="color-rendering")return r==="auto"||r==="optimizespeed"||r==="optimizequality";if(e==="color-interpolation")return r==="auto"||r==="srgb"||r==="linearrgb";if(e!=="clip-path")return!1;if(Op.has(r)||r==="none")return!0;let n="(?:fill-box|stroke-box|view-box|content-box|border-box|margin-box|padding-box)",i="(?:inset|circle|ellipse|polygon|path|shape|rect|xywh)\\([\\s\\S]*\\)";return new RegExp(`^(?:url\\([\\s\\S]*\\)|${i}(?:\\s+${n})?|${n}(?:\\s+${i})?)$`,"iu").test(t.trim())}function vw(e){let t;try{t=pw(e,{context:"declarationList",positions:!0})}catch{return{declarations:Object.freeze([]),raw:Object.freeze({})}}let r=[],n={};for(let[i,a]of Bn(t).entries()){if(a.type!=="Declaration"||typeof a.property!="string"||!a.value)continue;let o=a.property,s=o.startsWith("--")?o:o.toLowerCase(),l=typeof a.value!="string"&&a.value.loc?e.slice(a.value.loc.start.offset,a.value.loc.end.offset).trim():Pi(a.value).trim();n[s]=l;let u=s.startsWith("--"),d=/(?:^|[^-_a-z0-9])var\(/iu.test(l);if(!(u||d||ID.matchProperty(s,a.value).matched||jD(s,l)))continue;let c={propertyName:s,authoredPropertyName:o,value:l,authoredValue:l,important:!!a.important,order:i};r.push(...PD(c))}return{declarations:Object.freeze(r),raw:Object.freeze(n)}}function Ns(e,t){let r=vw(e),n=r.declarations.map((i,a)=>Object.freeze({...i,declarationId:`${t.ruleId??t.sourceNodeId}:${t.origin}:${i.order}:${a}`,sourceNodeId:t.sourceNodeId,origin:t.origin,sourceOrder:Object.freeze([...t.sourceOrder,i.order,a]),ruleId:t.ruleId,layerRank:t.layerRank}));return{templates:Object.freeze(n),raw:r.raw}}function ED(e){let t=e.trim().split(/\s+/u).filter(Boolean);if(t.length===0||t.length>3)return null;let r=!1,n=t.map(i=>{let a=jr(i);return!a||a.unit!==""||a.value===0?i:(r=!0,`${a.value}px`)});return r?n.join(" "):null}function Gf(e,t,r){return Object.freeze({declarationId:e.declarationId,sourceNodeId:e.sourceNodeId,occurrenceId:t,propertyName:e.propertyName,authoredPropertyName:e.authoredPropertyName,value:e.value,authoredValue:e.authoredValue,important:e.important,origin:e.origin,specificity:Object.freeze({...r}),sourceOrder:e.sourceOrder,ruleId:e.ruleId})}function zD(e){let t=Bn(e.prelude);if(t.length===0)return null;let r=t[t.length-1],n=(r.type==="Url"||r.type==="String")&&typeof r.value=="string"?r.value:null;if(n===null)return null;let i=t[0];return{prefix:t.length>1&&i.type==="Identifier"&&typeof i.name=="string"?i.name:"",uri:n}}function RD(e){return Pi(e.prelude).split(",").map(t=>t.trim()).filter(Boolean)}var _D=new Set(["default","inherit","initial","none","revert","revert-layer","unset"]);function FD(e){let t=Bn(e.prelude);if(t.length!==1)return null;let r=t[0];return r.type==="String"&&typeof r.value=="string"?r.value===""?null:r.value:r.type!=="Identifier"||typeof r.name!="string"||_D.has(r.name.toLowerCase())?null:r.name}function LD(e){let t=e.trim().toLowerCase();if(t==="from")return 0;if(t==="to")return 1;let r=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)%$/iu.exec(t);if(!r)return null;let n=Number(r[1]);return Number.isFinite(n)&&n>=0&&n<=100?n/100:null}function BD(e){return e.important?!1:e.propertyName==="animation-timing-function"||e.propertyName!=="animation"&&!e.propertyName.startsWith("animation-")}function VD(e,t,r){let n=FD(e);if(!n||!e.block)return null;let i=`${t.sourceNodeId}:keyframes:${r}`,a=new Map;for(let[s,l]of Bn(e.block).entries()){if(l.type!=="Rule"||!l.prelude||!l.block)continue;let u=Pi(l.prelude).split(",").map(LD).filter(f=>f!==null);if(u.length===0)continue;let d=Bn(l.block).filter(f=>f.type==="Declaration").map(f=>Pi(f)).join(";"),c=vw(d).declarations.filter(BD);for(let f of u){let p=a.get(f)??new Map;for(let[h,m]of c.entries())p.set(m.propertyName,Object.freeze({declarationId:`${i}:${s}:${m.order}:${h}`,propertyName:m.propertyName,authoredPropertyName:m.authoredPropertyName,value:m.value,authoredValue:m.authoredValue,sourceOrder:Object.freeze([r,s,m.order,h])}));a.set(f,p)}}let o=[...a.entries()].sort(([s],[l])=>s-l).map(([s,l])=>Object.freeze({offset:s,declarations:Object.freeze([...l.values()]),properties:Dp([...l].map(([u,d])=>[u,d.value]))}));return Object.freeze({keyframesId:i,stylesheetSourceNodeId:t.sourceNodeId,name:n,sourceOrder:r,stops:Object.freeze(o)})}function UD(e,t,r,n){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:e.source,entrypoint:e.entrypoint,capability:"styles",sourceNodeId:t.sourceNodeId,sourceId:j(t,"id")??void 0,elementName:t.name,documentPath:r.index.sourcePath(t.sourceNodeId),message:n})}function L0(e,t){return e.matchesMedia(t)===!0}function GD(e,t){return e.supportsCondition(t)===!0}function B0(e,t,r){let n=Number(e.declaration.important)-Number(t.declaration.important);if(n!==0)return n;let i=s=>s.declaration.important?s.layerRank===null?-1:r-s.layerRank:s.layerRank===null?r+1:s.layerRank,a=i(e)-i(t);if(a!==0)return a;let o=e.originRank-t.originRank;return o!==0?o:mw(e.declaration.specificity,t.declaration.specificity)||Tp(e.declaration.sourceOrder,t.declaration.sourceOrder)}function WD(e){let t=null,r=!1,n=0;for(let i=0;i<e.length;i++){let a=e[i];if(t){r?r=!1:a==="\\"?r=!0:a===t&&(t=null);continue}if(a==='"'||a==="'")t=a;else if(a==="(")n++;else if(a===")")n=Math.max(0,n-1);else if(a===","&&n===0)return i}return-1}function Oi(e,t,r=new Set){let n=Lo(e);if(n.length===0)return e.trim();let i=e;for(let a of[...n].reverse()){let o=e.slice(a.argumentsStart,a.argumentsEnd),s;if(a.name==="var"){let l=WD(o),u=(l<0?o:o.slice(0,l)).trim(),d=l<0?null:o.slice(l+1).trim();if(!u.startsWith("--")||r.has(u))s=d?Oi(d,t,r):null;else{let c=t[u];if(c===void 0)s=d?Oi(d,t,r):null;else{let f=new Set(r);f.add(u),s=Oi(c,t,f),s===null&&d&&(s=Oi(d,t,r))}}}else{let l=Oi(o,t,r);s=l===null?null:`${e.slice(a.tokenStart,a.argumentsStart)}${l})`}if(s===null)return null;i=`${i.slice(0,a.tokenStart)}${s}${i.slice(a.tokenEnd)}`}return i.trim()}function Dp(e){return Object.freeze(Object.fromEntries(e))}function XD(e,t,r){let n=[],i=ND(e,t),a=AD(r.environment),o=[],s=[],l=[],u=[],d=new Map,c=0,f=0,p=0,h=S=>{let M=d.get(S);if(M!==void 0)return M;let T=d.size;return d.set(S,T),T},m=(S,M,T,E)=>{for(let C of S){if(C.type==="Atrule"){let X=C.name?.toLowerCase();if(X==="keyframes"){let B=VD(C,M,p++);B&&(l.push(B),M.keyframesIds.push(B.keyframesId));continue}if(X==="namespace"){let B=zD(C);B&&T.set(B.prefix,B.uri);continue}if(X==="layer"){let B=RD(C);if(!C.block){for(let W of B)h(W);continue}let ae=B[0]??`__anonymous_${c++}`,K=E?`${E}.${ae}`:ae;h(K),m(Bn(C.block),M,new Map(T),K);continue}if(X==="media"){let B=Pi(C.prelude).trim();C.block&&L0(r.environment,B)&&m(Bn(C.block),M,new Map(T),E);continue}if(X==="supports"){let B=Pi(C.prelude).trim();C.block&&GD(r.environment,B)&&m(Bn(C.block),M,new Map(T),E);continue}continue}if(C.type!=="Rule"||!C.prelude||!C.block)continue;let O=Pi(C.prelude).trim(),z=CD(O,T,a);if(!z)continue;let R=`${M.sourceNodeId}:rule:${f}`,U=Bn(C.block).filter(X=>X.type==="Declaration").map(X=>Pi(X)).join(";"),V=E===null?null:h(E),Y=Ns(U,{sourceNodeId:M.sourceNodeId,origin:"stylesheet",ruleId:R,sourceOrder:[M.sourceNodeId===e.root.sourceNodeId?-1:f,f],layerRank:V}),G=Y.templates.map(X=>Gf(X,"",_s(z.map(B=>B.specificity)))),H=Object.freeze({ruleId:R,stylesheetSourceNodeId:M.sourceNodeId,selectorText:O,specificities:Object.freeze(z.map(X=>X.specificity)),layer:E,declarations:Object.freeze(G)});s.push(H),u.push(Object.freeze({plan:H,selectors:z,templates:Y.templates})),M.ruleIds.push(R),f++}};for(let S of e.index.elements){if(S.namespaceUri!==ye||S.localName.toLowerCase()!=="style")continue;let M=$D(S),T=j(S,"type"),E=j(S,"media"),C=T===null||T.trim()===""||T.trim().toLowerCase()==="text/css",O=E===null||E.trim()===""||L0(r.environment,E),z=[],R=[],U=e.index.parent(S.sourceNodeId),V="root";for(;U;){if(U.localName.toLowerCase()==="defs"){V="defs";break}U=e.index.parent(U.sourceNodeId)}let Y={sourceNodeId:S.sourceNodeId,placement:V,authoredText:M,id:j(S,"id"),type:T,media:E,title:j(S,"title"),applicable:C&&O,ruleIds:z,keyframesIds:R};if(o.push(Y),!Y.applicable){Object.freeze(z),Object.freeze(R),Object.freeze(Y);continue}try{let G=pw(M,{positions:!0});m(Bn(G),Y,new Map,null)}catch{n.push(UD(r,S,e,"The SVG style element contains malformed CSS."))}Object.freeze(z),Object.freeze(R),Object.freeze(Y)}let g=new Map;for(let S of l)g.set(S.name,S);let v=new Map,b=new Map,y=S=>{let M=v.get(S.occurrence.occurrenceId);if(M)return M;let T=S.parent?y(S.parent):null,E=new Map,C=[],O=[],z=(K,W,J)=>{let Q=Gf(K,S.occurrence.occurrenceId,W);C.push(Q);let Z=E.get(Q.propertyName)??[];Z.push({declaration:Q,layerRank:K.layerRank,originRank:J}),E.set(Q.propertyName,Z)},R=S.element.namespaceUri===ye;for(let[K,W]of S.element.attributes.entries()){if(!R)break;if(W.namespaceUri!==null||!el(W.localName))continue;let J={sourceNodeId:S.element.sourceNodeId,origin:"presentation",ruleId:null,sourceOrder:[S.element.elementOrder,-2,K],layerRank:null},Q=Ns(`${W.localName}:${W.value}`,J).templates,Z=W.localName==="font-size"?jr(W.value):null;Q.length===0&&Z?.unit===""&&Z.value>=0&&(Q=Ns(`font-size:${Z.value}px`,J).templates.map(Ie=>Object.freeze({...Ie,value:W.value,authoredValue:W.value})));let Ae=W.localName==="transform-origin"?ED(W.value):null;Q.length===0&&Ae&&(Q=Ns(`transform-origin:${Ae}`,J).templates.map(Ie=>Object.freeze({...Ie,authoredValue:W.value})));for(let Ie of Q)Ie.important||z(Ie,No,0)}for(let K of u){let W=K.selectors.filter(Q=>Q.matches(S));if(W.length===0)continue;O.push(K.plan.ruleId);let J=_s(W.map(Q=>Q.specificity));for(let Q of K.templates)z(Q,J,1)}let U=j(S.element,"style");if(U!==null){let K=Ns(U,{sourceNodeId:S.element.sourceNodeId,origin:"style-attribute",ruleId:null,sourceOrder:[S.element.elementOrder,Number.MAX_SAFE_INTEGER],layerRank:null});b.set(S.occurrence.occurrenceId,K.raw);for(let W of K.templates)z(W,No,2)}let V=new Map,Y=new Map;for(let[K,W]of E){W.sort((Q,Z)=>B0(Q,Z,d.size)),V.set(K,W[W.length-1].declaration);let J=W.filter(Q=>Q.declaration.origin==="stylesheet");J.length>0&&Y.set(K,J[J.length-1].declaration)}let G={...T?.customProperties??{}};for(let[K,W]of V){if(!K.startsWith("--"))continue;let J=W.value.trim().toLowerCase();J==="inherit"||J==="unset"?T?.customProperties[K]===void 0?delete G[K]:G[K]=T.customProperties[K]:J==="initial"||J==="revert"||J==="revert-layer"?delete G[K]:G[K]=W.value}let H={},X={},B=new Set([...jx,...[...V.keys()].filter(K=>!K.startsWith("--"))]);for(let K of B){let W=el(K),J=V.get(K),Q=T?.resolvedValues[K],Z=W?.initialValue,Ae;if(J){let Xe=J.value.trim().toLowerCase();Xe==="inherit"?Ae=Q??Z:Xe==="initial"||Xe==="revert"||Xe==="revert-layer"?Ae=Z:Xe==="unset"?Ae=W?.inherited?Q??Z:Z:Ae=J.value}else W?.inherited?Ae=Q??Z:Ae=Z;if(Ae===void 0)continue;H[K]=Ae;let Ie=Oi(Ae,G);Ie===null&&(Ie=W?.inherited?Q??Z??null:Z??null),Ie!==null&&(Ie.trim().toLowerCase()==="currentcolor"&&(Ie=K==="color"?T?.resolvedValues.color??"black":X.color??T?.resolvedValues.color??"black"),X[K]=Ie)}let ae=Object.freeze({occurrenceId:S.occurrence.occurrenceId,correspondingSourceNodeId:S.occurrence.correspondingSourceNodeId,matchedRuleIds:Object.freeze(O),declarations:Object.freeze(C),cascadedValues:Dp(V),stylesheetCascadedValues:Dp(Y),specifiedValues:Object.freeze(H),resolvedValues:Object.freeze(X),customProperties:Object.freeze(G),inlineDeclarations:b.get(S.occurrence.occurrenceId)??Object.freeze({})});return v.set(S.occurrence.occurrenceId,ae),ae};for(let S of i.byOccurrenceId.values())y(S);let I=Object.freeze(t.occurrences.map(S=>v.get(S.occurrenceId)).filter(S=>S!==void 0)),x=new Map;for(let S of t.occurrences){if(S.usePath.length!==0)continue;let M=v.get(S.occurrenceId);M&&x.set(S.correspondingSourceNodeId,M)}let k=[];for(let S of I)for(let[M,T]of Object.entries(S.resolvedValues)){if(!kD.has(M)||!T.toLowerCase().includes("url("))continue;let E=S.cascadedValues[M];k.push(Object.freeze({fromSourceNodeId:S.correspondingSourceNodeId,occurrenceId:S.occurrenceId,propertyName:M,value:T,origin:E?E.origin==="style-attribute"?"inline-style":"matched-stylesheet":"inherited-stylesheet"}))}let $=(S,M)=>{let T=i.byOccurrenceId.get(S);if(!T)return Object.freeze({});let E={...T,attributeOverrides:Object.freeze({class:M})},C=new Map;for(let G of u){let H=G.selectors.filter(B=>B.matches(E));if(H.length===0)continue;let X=_s(H.map(B=>B.specificity));for(let B of G.templates){let ae=Gf(B,S,X),K=C.get(ae.propertyName)??[];K.push({declaration:ae,layerRank:B.layerRank,originRank:1}),C.set(ae.propertyName,K)}}let O=new Map;for(let[G,H]of C)H.sort((X,B)=>B0(X,B,d.size)),O.set(G,H[H.length-1].declaration);let z=T.parent?v.get(T.parent.occurrence.occurrenceId):null,R={...z?.customProperties??{}};for(let[G,H]of O){if(!G.startsWith("--"))continue;let X=H.value.trim().toLowerCase();if(X==="inherit"||X==="unset"){let B=z?.customProperties[G];B===void 0?delete R[G]:R[G]=B}else X==="initial"||X==="revert"||X==="revert-layer"?delete R[G]:R[G]=H.value}let U={},V=O.get("color"),Y=V?Oi(V.value,R):z?.resolvedValues.color??"black";for(let[G,H]of O){if(G.startsWith("--"))continue;let X=Oi(H.value,R);X!==null&&(X.trim().toLowerCase()==="currentcolor"&&(X=Y??"black"),U[G]=X)}return Object.freeze(U)},A=Object.freeze({stylesheets:Object.freeze(o),rules:Object.freeze(s),keyframes:Object.freeze(l),elements:I,appliedResourceDeclarations:Object.freeze(k),keyframesRule:S=>g.get(S)??null,ownStyle:S=>x.get(S)??null,style:S=>v.get(S)??null,value:(S,M)=>v.get(S)?.resolvedValues[M.toLowerCase()]??null,stylesheetValuesWithClass:$});return Object.freeze({value:A,diagnostics:Object.freeze(n)})}function bw(e,t,r,n,i,a){if(r<=0||n<=0)return null;if(i<=0||a<=0)return`M${e},${t}h${r}v${n}h${-r}Z`;let o=e+r,s=t+n;return`M${e+i},${t}H${o-i}A${i},${a} 0 0 1 ${o},${t+a}V${s-a}A${i},${a} 0 0 1 ${o-i},${s}H${e+i}A${i},${a} 0 0 1 ${e},${s-a}V${t+a}A${i},${a} 0 0 1 ${e+i},${t}Z`}function V0(e,t,r,n){return r<=0||n<=0?null:`M${e+r},${t}A${r},${n} 0 0 1 ${e},${t+n}A${r},${n} 0 0 1 ${e-r},${t}A${r},${n} 0 0 1 ${e},${t-n}A${r},${n} 0 0 1 ${e+r},${t}Z`}function xw(e){let t=e.state;if(typeof t.d=="string")return t.d;let r=Bo(e);if(!r)return null;switch(r.kind){case"path":return r.d||null;case"rectangle":return r.pathData??bw(r.x,r.y,r.width,r.height,r.rx,r.ry);case"circle":return V0(r.cx,r.cy,r.r,r.r);case"ellipse":return V0(r.cx,r.cy,r.rx,r.ry);case"line":return`M${r.x1},${r.y1}L${r.x2},${r.y2}`;case"polyline":{if(r.points.length<2||r.points.some(i=>!Number.isFinite(i.x)||!Number.isFinite(i.y)))return null;let n=r.points.map((i,a)=>`${a===0?"M":"L"}${i.x},${i.y}`).join("");return r.closed?`${n}Z`:n}default:return null}}var HD="http://www.w3.org/1999/xlink";function qD(e,t){let r=j(t,"attributeName");if(r===null)return null;let n=AP(e,t,r);return n?n.namespaceUri===null||n.namespaceUri===ye?n.localName:n.namespaceUri===HD&&n.localName==="href"?"href":null:null}var YD=new Map([["animate","animate"],["animatetransform","animateTransform"],["animatemotion","animateMotion"],["set","set"],["discard","discard"]]);function KD(e){return Object.freeze(Object.fromEntries(e.attributes.map(t=>[t.name,t.value])))}function ZD(e,t){return e.usePath.length!==t.usePath.length?!1:e.usePath.every((r,n)=>r.sourceReferenceId===t.usePath[n]?.sourceReferenceId)}function JD(e,t,r){return e.occurrences.find(n=>n.correspondingSourceNodeId===r&&ZD(n,t))??e.direct(r)}function QD(e,t,r,n){let i=vr(r);if(!i)return null;if(i.value===""||i.value==="#")return{status:"empty",sourceNodeId:null,occurrenceId:null};if(!i.value.startsWith("#"))return{status:"external",sourceNodeId:null,occurrenceId:null};let a=i.value.slice(1),o=e.index.resolveAuthoredId(a);if(!o)return{status:"missing",sourceNodeId:null,occurrenceId:null};let s=e.index.element(o.sourceNodeId);if(!s||s.namespaceUri!==ye)return{status:"invalid",sourceNodeId:o.sourceNodeId,occurrenceId:null};let l=JD(t,n,s.sourceNodeId);return{status:l?"resolved":"missing",sourceNodeId:s.sourceNodeId,occurrenceId:l?.occurrenceId??null}}function ej(e,t,r){let n=r.parentOccurrenceId?t.occurrence(r.parentOccurrenceId):null,i=n?e.index.element(n.correspondingSourceNodeId):null;return i?.localName.toLowerCase()==="textpath"&&n?.parentOccurrenceId&&(n=t.occurrence(n.parentOccurrenceId),i=n?e.index.element(n.correspondingSourceNodeId):null),i&&n?{status:"resolved",sourceNodeId:i.sourceNodeId,occurrenceId:n.occurrenceId}:{status:"missing",sourceNodeId:null,occurrenceId:null}}function tj(e,t,r,n){let i=e.index.children(r.sourceNodeId).find(f=>f.namespaceUri===ye&&f.localName.toLowerCase()==="mpath");if(!i)return{sourceNodeId:null,elementSourceNodeId:null,elementId:null,data:j(r,"path")};let a=j(i,"id"),o=vr(i);if(!o?.value.startsWith("#")||o.value.length<=1)return{sourceNodeId:null,elementSourceNodeId:i.sourceNodeId,elementId:a,data:null};let s=e.index.resolveAuthoredId(o.value.slice(1)),l=s?e.index.element(s.sourceNodeId):null;if(!l)return{sourceNodeId:s?.sourceNodeId??null,elementSourceNodeId:i.sourceNodeId,elementId:a,data:null};if(l.localName.toLowerCase()==="path")return{sourceNodeId:l.sourceNodeId,elementSourceNodeId:i.sourceNodeId,elementId:a,data:j(l,"d")};let u=t.direct(l.sourceNodeId),d=u?n?.candidate(u.occurrenceId):null;if(!d||d.status!=="materialized"||!d.canonicalType)return{sourceNodeId:l.sourceNodeId,elementSourceNodeId:i.sourceNodeId,elementId:a,data:null};let c={id:d.occurrenceId,type:d.canonicalType,state:d.state};return{sourceNodeId:l.sourceNodeId,elementSourceNodeId:i.sourceNodeId,elementId:a,data:xw(c)}}function rj(e,t,r,n){let i=[];for(let a of t.occurrences){let o=e.index.element(a.correspondingSourceNodeId);if(!o||o.namespaceUri!==ye)continue;let s=YD.get(o.localName.toLowerCase());if(!s)continue;let l=vr(o),u=a.usePath.length===0?e.index.parent(o.sourceNodeId):null,d=QD(e,t,o,a)??ej(e,t,a),c=KD(o),f={values:c.values,from:c.from,to:c.to,by:c.by,additive:c.additive,accumulate:c.accumulate,dur:c.dur,keyTimes:c.keyTimes,calcMode:c.calcMode,keySplines:c.keySplines,repeatCount:c.repeatCount,repeatDur:c.repeatDur,fill:c.fill},p=s==="animateMotion"?tj(e,t,o,n):null,h=d.sourceNodeId?e.index.element(d.sourceNodeId):null,m=(d.occurrenceId?r.style(d.occurrenceId)?.cascadedValues.transform?.value:void 0)??(h?j(h,"transform"):null),g=Tx(f);i.push(Object.freeze({animationId:`smil:${a.occurrenceId}`,sourceNodeId:o.sourceNodeId,sourceElementOrder:o.elementOrder,occurrenceId:a.occurrenceId,kind:s,sourceAnimationId:j(o,"id"),sourceSmilPlacement:u?.sourceNodeId===e.root.sourceNodeId?"document":l&&u?.localName.toLowerCase()==="defs"?"defs":"target",sourceSmilParentTarget:!l,targetStatus:d.status,targetSourceNodeId:d.sourceNodeId,targetOccurrenceId:d.occurrenceId,attributeName:qD(e,o),attributes:c,duration:Px(f),additive:g,...s==="animateTransform"&&g==="replace"&&m!==null&&m.trim().toLowerCase()!=="none"?{replacesCarrierBase:!0}:{},fill:c.fill==="freeze"?"freeze":"remove",motionPathSourceNodeId:p?.sourceNodeId??null,motionPathElementSourceNodeId:p?.elementSourceNodeId??null,sourceMpathId:p?.elementId??null,motionPathData:p?.data??null}))}return Object.freeze(i)}function nj(e){let t=e.parsedEasing?Object.freeze({...e.parsedEasing,..."points"in e.parsedEasing?{points:Object.freeze([...e.parsedEasing.points])}:{}}):null;return Object.freeze({...e,parsedEasing:t})}function ij(e){let t=[];for(let r of e.elements){let n=r.resolvedValues,i=n.animation||$C(n);if(i)for(let[a,o]of lh(i).entries()){let s=Vy(o);if(!s){let u=uh(n["animation-name"],a);u&&u!=="none"&&(s=Vy(`${o} ${u}`))}if(!s)continue;SC(s,n,a);let l=e.keyframesRule(s.name);!l||l.stops.length===0||t.push(Object.freeze({animationId:`css:${r.occurrenceId}:${a}`,sourceNodeId:r.correspondingSourceNodeId,occurrenceId:r.occurrenceId,animationIndex:a,animation:nj(s),keyframes:l}))}}return Object.freeze(t)}function U0(e){let t=new Map;for(let r of e){let n=t.get(r.occurrenceId)??[];n.push(r),t.set(r.occurrenceId,n)}for(let r of t.values())Object.freeze(r);return t}function aj(e,t,r,n){let i=rj(e,t,r,n.leafGeometry),a=ij(r),o=i.filter(d=>d.targetStatus!=="resolved").map(d=>{let c=e.index.element(d.sourceNodeId);return Object.freeze({severity:"warning",code:"unresolved-reference",source:n.source,entrypoint:n.entrypoint,capability:"smil-animation",sourceId:d.sourceAnimationId??void 0,sourceNodeId:d.sourceNodeId,occurrenceId:d.occurrenceId,elementName:c?.name,documentPath:e.index.sourcePath(d.sourceNodeId),message:`The SVG animation target is ${d.targetStatus} and cannot be materialized.`})});for(let d of i){if(d.attributeName!==null)continue;let c=e.index.element(d.sourceNodeId);!c||j(c,"attributeName")===null||o.push(Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"smil-animation",sourceId:d.sourceAnimationId??void 0,sourceNodeId:d.sourceNodeId,occurrenceId:d.occurrenceId,elementName:c.name,documentPath:e.index.sourcePath(d.sourceNodeId),message:`The animation target attribute ${j(c,"attributeName")} has no namespace binding in scope or names a foreign attribute, so it animates nothing.`}))}for(let d of i){if(d.targetStatus!=="resolved"||!d.targetSourceNodeId||!n.leafGeometry?.privateTextPathOwner(d.targetSourceNodeId)||(d.kind==="animate"||d.kind==="set")&&d.attributeName?.toLowerCase()==="d")continue;let c=e.index.element(d.sourceNodeId);o.push(Object.freeze({severity:"warning",code:"unsupported-ingest-capability",source:n.source,entrypoint:n.entrypoint,capability:"smil-animation",sourceId:d.sourceAnimationId??void 0,sourceNodeId:d.sourceNodeId,occurrenceId:d.occurrenceId,elementName:c?.name,documentPath:e.index.sourcePath(d.sourceNodeId),message:"The animation targets the private path of a text on a path; only that path's d can animate (as the text's textPathMorph), so this animation was dropped."}))}for(let d of a)for(let c of d.keyframes.stops){let f=c.properties.transform??c.properties["-webkit-transform"]??c.properties["-moz-transform"];if(f===void 0)continue;let p=sO(f);p&&o.push(Object.freeze({severity:"warning",code:p==="unsupported-perspective"?"unsupported-ingest-capability":"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"css-animation",sourceNodeId:d.sourceNodeId,occurrenceId:d.occurrenceId,documentPath:e.index.sourcePath(d.sourceNodeId),message:p==="unsupported-perspective"?"A projective CSS transform cannot be represented by the native affine timeline.":"A CSS transform keyframe has invalid function syntax and was not materialized."}))}let s=U0(i),l=U0(a),u=Object.freeze({smil:i,css:a,smilForOccurrence:d=>s.get(d)??Object.freeze([]),cssForOccurrence:d=>l.get(d)??Object.freeze([])});return Object.freeze({value:u,diagnostics:Object.freeze(o)})}var Ud=Object.freeze({fontFamily:"Arial",fontSize:16,fontWeight:"normal",fontStyle:"normal",fontStretch:"normal",fontSizeAdjust:"none",fontVariant:"",fontVariantLigatures:"",fontVariantPosition:"",fontVariantCaps:"",fontVariantNumeric:"",fontVariantEastAsian:"",textDecoration:Object.freeze({underline:!1,strikethrough:!1,overline:!1}),textTransform:"none",baselineShift:"baseline",dominantBaseline:"auto",alignmentBaseline:"auto",writingMode:"horizontal-tb",whiteSpace:"pre-wrap",direction:"ltr",unicodeBidi:"normal",textAnchor:"start",letterSpacing:0,wordSpacing:0,lineHeight:1.2,fontVariationSettings:Object.freeze({}),fill:"#000000",fillOpacity:1,stroke:"none",strokeWidth:0,strokeOpacity:1}),Gd=Object.keys(Ud);function $a(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bn(e){return typeof e=="string"?e:void 0}function Pr(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string"&&e.trim()!==""){let t=Number.parseFloat(e);return Number.isFinite(t)?t:void 0}}function Zn(e){return t=>typeof t=="string"&&e.includes(t)?t:void 0}function oj(e){if(e==="normal"||e==="bold"||e==="bolder"||e==="lighter")return e;let t=Pr(e);return t===400?"normal":t===700?"bold":t}function sj(e){return e==="baseline"||e==="super"||e==="sub"?e:Pr(e)}function ww(e){if(typeof e=="string"){let r=e.toLowerCase();return{underline:r.includes("underline"),strikethrough:r.includes("line-through")||r.includes("strikethrough"),overline:r.includes("overline")}}if(!$a(e))return;let t={};return typeof e.underline=="boolean"&&(t.underline=e.underline),typeof e.strikethrough=="boolean"&&(t.strikethrough=e.strikethrough),typeof e.overline=="boolean"&&(t.overline=e.overline),t}function Iw(e){if(!$a(e))return;let t={};for(let[r,n]of Object.entries(e)){let i=Pr(n);i!==void 0&&(t[r]=i)}return t}var kw={fontFamily:bn,fontSize:Pr,fontWeight:oj,fontStyle:Zn(["normal","italic","oblique"]),fontStretch:bn,fontSizeAdjust:bn,fontVariant:bn,fontVariantLigatures:bn,fontVariantPosition:bn,fontVariantCaps:bn,fontVariantNumeric:bn,fontVariantEastAsian:bn,textTransform:Zn(["none","capitalize","uppercase","lowercase"]),baselineShift:sj,dominantBaseline:Zn(["auto","alphabetic","central","middle","hanging","ideographic","mathematical","text-top","text-bottom"]),alignmentBaseline:Zn(["auto","baseline","text-bottom","alphabetic","ideographic","middle","central","mathematical","hanging","text-top"]),writingMode:Zn(["horizontal-tb","vertical-rl","vertical-lr"]),whiteSpace:Zn(["normal","nowrap","pre","pre-wrap","pre-line","break-spaces"]),direction:Zn(["ltr","rtl"]),unicodeBidi:Zn(["normal","embed","bidi-override","isolate","isolate-override","plaintext"]),textAnchor:Zn(["start","middle","end"]),letterSpacing:Pr,wordSpacing:Pr,lineHeight:Pr,fill:bn,fillOpacity:Pr,stroke:bn,strokeWidth:Pr,strokeOpacity:Pr};function ud(e,t){return{...e,...t,textDecoration:{...e.textDecoration,...t.textDecoration??{}},fontVariationSettings:{...t.fontVariationSettings??e.fontVariationSettings}}}function $h(e,t){let r=Object.keys(e);return r.length!==Object.keys(t).length?!1:r.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&e[n]===t[n])}function Ia(e,t){for(let r of Gd)if(r==="textDecoration"){if(e.textDecoration.underline!==t.textDecoration.underline||e.textDecoration.strikethrough!==t.textDecoration.strikethrough||e.textDecoration.overline!==t.textDecoration.overline)return!1}else if(r==="fontVariationSettings"){if(!$h(e.fontVariationSettings,t.fontVariationSettings))return!1}else if(e[r]!==t[r])return!1;return!0}function lj(e,t){let r=Object.keys(e).sort(),n=Object.keys(t).sort();if(r.length!==n.length||r.some((i,a)=>i!==n[a]))return!1;for(let i of r)if(i==="textDecoration"){let a=e.textDecoration??{},o=t.textDecoration??{},s=new Set([...Object.keys(a),...Object.keys(o)]);for(let l of s){let u=l;if(a[u]!==o[u])return!1}}else if(i==="fontVariationSettings"){if(!$h(e.fontVariationSettings??{},t.fontVariationSettings??{}))return!1}else{let a=i;if(e[a]!==t[a])return!1}return!0}function G0(e,t){let r={};for(let i of Gd)i==="textDecoration"||i==="fontVariationSettings"||e[i]!==t[i]&&(r[i]=e[i]);let n={};return e.textDecoration.underline!==t.textDecoration.underline&&(n.underline=e.textDecoration.underline),e.textDecoration.strikethrough!==t.textDecoration.strikethrough&&(n.strikethrough=e.textDecoration.strikethrough),e.textDecoration.overline!==t.textDecoration.overline&&(n.overline=e.textDecoration.overline),Object.keys(n).length>0&&(r.textDecoration=n),$h(e.fontVariationSettings,t.fontVariationSettings)||(r.fontVariationSettings={...e.fontVariationSettings}),r}function Fs(e,t=Ud){let r=$a(e)?e:{},n={...t};for(let i of Gd){if(i==="textDecoration"||i==="fontVariationSettings")continue;let a=kw[i](r[i]);a!==void 0&&(n[i]=a)}return n.textDecoration={...t.textDecoration,...ww(r.textDecoration)??{}},n.fontVariationSettings={...Iw(r.fontVariationSettings)??t.fontVariationSettings},n}function uj(e){let t=$a(e)?e:{},r={};for(let n of Gd){if(n==="textDecoration"||n==="fontVariationSettings"||t[n]===void 0)continue;let i=kw[n](t[n]);i!==void 0&&(r[n]=i)}if(t.textDecoration!==void 0){let n=ww(t.textDecoration);n&&Object.keys(n).length>0&&(r.textDecoration=n)}if(t.fontVariationSettings!==void 0){let n=Iw(t.fontVariationSettings);n&&(r.fontVariationSettings=n)}return r}function dj(e){let t=[],r=0;for(;;){let n=e.indexOf(`
19
+ `,r);if(n===-1)return t.push({text:e.slice(r),start:r,end:e.length}),t;t.push({text:e.slice(r,n),start:r,end:n}),r=n+1}}function cj(e,t,r){return e.start===e.end?r&&e.start===t:e.start<=t&&t<e.end}function W0(e,t,r,n){let i=e;for(let a of t)cj(a,r,n)&&(i=ud(i,a.style));return i===e?ud(e,{}):i}function fj(e,t=Ud){let r=$a(e)?e:{},n=Fs(r.baseStyle,t),i=typeof r.text=="string"?r.text:"";return{text:i,runs:Sw(r.runs,i.length),baseStyle:n,lineHeight:Pr(r.lineHeight)??n.lineHeight}}function Sw(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!$a(n))continue;let i=Pr(n.start),a=Pr(n.end);if(i===void 0||a===void 0)continue;let o=Math.min(Math.max(Math.trunc(i),0),t),s=Math.min(Math.max(Math.trunc(a),0),t);o>s||r.push({start:o,end:s,style:uj(n.style)})}return r}function $w(e){let t=typeof e.text=="string"?e.text:"",r=Fs(e.baseStyle),n=Sw(e.runs,t.length),i=Pr(e.lineHeight)??r.lineHeight;return{lines:dj(t).map(a=>{if(a.text.length===0)return{segments:[{text:"",style:W0(r,n,a.start,!0)}]};let o=new Set([a.start,a.end]);for(let u of n)u.start!==u.end&&(u.start>a.start&&u.start<a.end&&o.add(u.start),u.end>a.start&&u.end<a.end&&o.add(u.end));let s=[...o].sort((u,d)=>u-d),l=[];for(let u=0;u<s.length-1;u++){let d=s[u],c=s[u+1],f=W0(r,n,d,!1),p=l[l.length-1];p&&Ia(p.style,f)?p.text+=t.slice(d,c):l.push({text:t.slice(d,c),style:f})}return{segments:l}}),baseStyle:r,lineHeight:i}}function Nh(e){let t=Fs(e?.baseStyle),r=Pr(e?.lineHeight)??t.lineHeight,n=Array.isArray(e?.lines)?e.lines:[],i=n.length>0?n:[{segments:[]}],a=[],o=[],s=0;for(let d=0;d<i.length;d++){d>0&&(a.push(`
20
+ `),s+=1);let c=i[d]?.segments,f=Array.isArray(c)?c:[],p=s;for(let h of f){let m=typeof h?.text=="string"?h.text:"";if(m.length===0)continue;let g=Fs(h?.style,t),v=G0(g,t);Object.keys(v).length>0&&o.push({start:s,end:s+m.length,style:v}),a.push(m),s+=m.length}if(s===p){let h=Fs(f[0]?.style,t),m=G0(h,t);Object.keys(m).length>0&&o.push({start:p,end:p,style:m})}}let l=a.join(""),u=[];for(let d of o){let c=u[u.length-1];c!==void 0&&c.start!==c.end&&d.start!==d.end&&(c.end===d.start||c.end+1===d.start&&l.charAt(c.end)===`
21
+ `)&&lj(c.style,d.style)&&c?c.end=d.end:u.push({start:d.start,end:d.end,style:d.style})}return{text:l,runs:u,baseStyle:t,lineHeight:r}}function Nw(e){let t=e.richTextRuns;return $a(t)?fj(t):null}function pj(e){let t=[],r=0,n=0;for(let i of e)t.push({textOffset:r,glyphIndex:n,character:i}),r+=i.length,n+=1;return t}function Mw(e){let t=pj(e.text),r=new Array(t.length).fill(0),n=(a,o,s)=>{if(!s||s.length===0)return;let l=0;for(let u of t)u.textOffset<a||u.textOffset>=o||u.character===`
22
+ `||(r[u.glyphIndex]=s[Math.min(l,s.length-1)],l+=1)},i=a=>{for(let o of a)n(o.start,o.end,o.rotate),i(o.children)};return n(0,e.text.length,e.rotate),i(e.spans),r}function hj(e){let t=new Map,r=n=>{for(let i of n)i.rotate&&i.rotate.length>0&&t.set(i.spanId,i.rotate),r(i.children)};return r(e.spans),t}function mj(e,t){let r=[],n=0;for(let o of e){let s=t[n]?.rotate??0;n+=1,o!==`
23
+ `&&r.push(s)}if(r.length===0)return r;let i=r.length-1,a=r[i];for(;i>0&&r[i-1]===a;)i-=1;return i===0&&a===0?[]:r.slice(0,i+1)}function gj(e,t){let r=hj(e),n=(e.rotate?.length??0)>0||r.size>0;if(!t)return{mode:"authored-scopes",root:e.rotate??[],spans:r};let i=Mw(e),a=i.length===t.length&&i.every((o,s)=>o===t[s].rotate);return n&&a?{mode:"authored-scopes",root:e.rotate??[],spans:r}:{mode:"flattened-glyphs",root:mj(e.text,t),spans:new Map}}var jp="text-path-";function yj(e){return`${jp}${e}`}function vj(e){return e.length>jp.length&&e.startsWith(jp)}function bj(e,t){let r=e.index.element(t.correspondingSourceNodeId);if(!r||r.namespaceUri!==ye)return!1;let n=r.localName.toLowerCase();return n==="svg"||n==="symbol"}function Wf(e,t){return Object.freeze({width:e,height:t})}function Aw(e,t,r,n){let i=Wf(n.viewport.width,n.viewport.height),a=new Map(t.occurrences.map(g=>[g.occurrenceId,g])),o=new Map,s=new Map,l=new Map,u=new Set,d=g=>{let v=o.get(g.occurrenceId);if(v)return v;let b=g.parentOccurrenceId?a.get(g.parentOccurrenceId):void 0,y=b?p(b):i;return o.set(g.occurrenceId,y),y},c=g=>{let v=l.get(g.occurrenceId);if(v!==void 0)return v;let b=g.parentOccurrenceId?a.get(g.parentOccurrenceId):void 0,y=b?c(b):n.rootFontSize,I=r.value(g.occurrenceId,"font-size"),x=d(g),k=!I||I==="medium"?y:at(I,{percentBasis:y,viewportWidth:x.width,viewportHeight:x.height,fontSize:y,rootFontSize:n.rootFontSize}),$=k!==void 0&&k>=0?k:y;return l.set(g.occurrenceId,$),$},f=(g,v,b)=>{let y=e.index.element(g.correspondingSourceNodeId);if(!y)return v==="width"?b.width:b.height;let I=j(y,v),x=g.usePath.at(-1);if(x?.targetSourceNodeId===g.correspondingSourceNodeId){let A=e.index.element(x.useSourceNodeId),S=A?j(A,v):null;S!==null&&(I=S)}if(I===null||I.trim().toLowerCase()==="auto")return v==="width"?b.width:b.height;let k=c(g),$=at(I,{percentBasis:v==="width"?b.width:b.height,viewportWidth:b.width,viewportHeight:b.height,fontSize:k,rootFontSize:n.rootFontSize});return $!==void 0&&$>=0?$:v==="width"?b.width:b.height},p=g=>{let v=s.get(g.occurrenceId);if(v)return v;let b=d(g);if(!bj(e,g))return s.set(g.occurrenceId,b),b;if(u.has(g.occurrenceId))throw new Error(`Circular SVG viewport context at ${g.occurrenceId}.`);u.add(g.occurrenceId);let y=e.index.element(g.correspondingSourceNodeId);if(g.usePath.length===0&&g.correspondingSourceNodeId===e.root.sourceNodeId)return u.delete(g.occurrenceId),s.set(g.occurrenceId,i),i;let I=j(y,"viewBox"),x=I===null?null:Nn(I),k=x&&x.width>=0&&x.height>=0?Wf(x.width,x.height):Wf(f(g,"width",b),f(g,"height",b));return u.delete(g.occurrenceId),s.set(g.occurrenceId,k),k},h=t.occurrences.map(g=>Object.freeze({occurrenceId:g.occurrenceId,sourceNodeId:g.correspondingSourceNodeId,viewport:d(g),childViewport:p(g)})),m=new Map(h.map(g=>[g.occurrenceId,g]));return Object.freeze({contexts:Object.freeze(h),viewport(g){return m.get(g)?.viewport??null},childViewport(g){return m.get(g)?.childViewport??null},fontSize(g){let v=a.get(g);return v?c(v):null}})}function Cw(e,t){for(let r of e){if(r.sourceNodeId===t)return r.sourceNodeId;let n=Cw(r.children,t);if(n)return n}return null}function xj(e,t,r){let n=e.occurrence(r);for(;n;){if(n.occurrenceId===t)return!0;n=n.parentOccurrenceId?e.occurrence(n.parentOccurrenceId):null}return!1}function X0(e,t,r){let n=t.occurrence(r);if(!n)return null;for(let i of e.candidates){if(i.canonicalType!=="text"||!i.textSpanTree||!xj(t,i.occurrenceId,r))continue;let a=Cw(i.textSpanTree.spans,n.correspondingSourceNodeId);if(a)return Object.freeze({textOccurrenceId:i.occurrenceId,spanId:a})}return null}var wj=new Set(["circle","ellipse","flowroot","foreignobject","image","line","path","polygon","polyline","rect","text"]),Ij=Object.freeze({});function dd(e){if(Array.isArray(e))return Object.freeze(e.map(dd));if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=dd(n);return Object.freeze(t)}return e}function Ow(e){return dd(e)}function kj(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let i=e[n]-t[n];if(i!==0)return i}return e.length-t.length}function Sj(e,t){return kj(e.orderKey,t.orderKey)||e.productIndex-t.productIndex||e.occurrenceId.localeCompare(t.occurrenceId)}function $j(e,t,r,n,i){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"geometry",sourceId:j(r,"id")??void 0,sourceNodeId:r.sourceNodeId,occurrenceId:t.occurrenceId,elementName:r.name,documentPath:e.index.sourcePath(r.sourceNodeId),message:i})}function Nt(e,t,r,n,i={},a){return Object.freeze({occurrenceId:e.occurrenceId,sourceNodeId:t.sourceNodeId,sourceId:j(t,"id"),elementName:t.localName,canonicalType:r,status:n,state:Object.keys(i).length===0?Ij:Ow(i),...a?{textSpanTree:dd(a)}:{}})}function Os(e,t,r,n){let i=e.style(t.occurrenceId);return i?.cascadedValues[n]?i.resolvedValues[n]??i.specifiedValues[n]??null:j(r,n)}function Nj(e,t,r){let n=e.value(t.occurrenceId,"font-size");if(!n||n==="medium")return r.rootFontSize;let i=at(n,{percentBasis:r.rootFontSize,viewportWidth:r.viewport.width,viewportHeight:r.viewport.height,fontSize:r.rootFontSize,rootFontSize:r.rootFontSize});return i!==void 0&&i>=0?i:r.rootFontSize}function Ep(e,t,r){return{percentBasis:e==="x"?r.viewport.width:e==="y"?r.viewport.height:Math.hypot(r.viewport.width,r.viewport.height)/Math.SQRT2,viewportWidth:r.viewport.width,viewportHeight:r.viewport.height,fontSize:t,rootFontSize:r.rootFontSize}}function zp(e){if(e===null)return null;let t=/\S+/.exec(e.trim());return t?t[0].replace(/,$/,""):null}function H0(e,t,r,n,i,a,o){return at(zp(Os(e,t,r,n)),Ep(i,a,o))}function Ts(e){if(e===null||e.trim()==="")return;let t=Number(e.trim());return Number.isFinite(t)?t:void 0}function Mj(e){if(!e)return{points:[],odd:!1};let t=(e.match(/[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?/g)??[]).map(Number).filter(Number.isFinite),r=t.length%2!==0,n=[];for(let i=0;i+1<t.length;i+=2)n.push({x:t[i],y:t[i+1]});return{points:n,odd:r}}function Aj(e){let t=j(e,"transform");if(!t||t.trim()==="")return{rotation:0};let r=Fi(t);return dn(r)?{rotation:0}:{transformMatrix:Zr(r)}}function zn(e,t,r,n){let i=e.type===e.type.toLowerCase();return[e.params[t]+(i?r:0),e.params[t+1]+(i?n:0)]}function Tw(e){let t=[],r=0,n=0,i=0,a=0,o=0,s=0,l="",u=!1,d=0,c=new Set;for(let m of e){let g=m.type.toUpperCase(),v=m.type===m.type.toLowerCase(),b=l.toUpperCase()==="Z",y=t.length;if(!(g==="B"||g==="R")){if(g==="Z"){r=i,n=a,u=!0,c.add(d),l=m.type;continue}if(g==="M"){let[I,x]=zn(m,0,r,n),k={x:I,y:x,pointType:"corner",...v?{moveRelative:!0}:{}};t.length>0&&(k.isSubpathStart=!0),t.push(k),d=t.length-1,r=i=I,n=a=x,l=m.type;continue}if(g==="H")r=m.params[0]+(v?r:0),t.push({x:r,y:n,pointType:"corner",segmentType:"HORIZONTAL"});else if(g==="V")n=m.params[0]+(v?n:0),t.push({x:r,y:n,pointType:"corner",segmentType:"VERTICAL"});else if(g==="L")[r,n]=zn(m,0,r,n),t.push({x:r,y:n,pointType:"corner",segmentType:"LINEAR"});else if(g==="C"){let I=r,x=n,[k,$]=zn(m,0,I,x),[A,S]=zn(m,2,I,x),[M,T]=zn(m,4,I,x),E=t.at(-1);E&&(E.pointType="smooth",E.handleOut={x:k,y:$}),t.push({x:M,y:T,handleIn:{x:A,y:S},pointType:"smooth",segmentType:"CUBIC"}),r=M,n=T,o=A,s=S}else if(g==="S"){let I=r,x=n,[k,$]=zn(m,0,I,x),[A,S]=zn(m,2,I,x),M=t.at(-1);M&&(M.pointType="smooth",M.handleOut=/^[CcSs]$/.test(l)?{x:2*I-o,y:2*x-s}:{x:I,y:x}),t.push({x:A,y:S,handleIn:{x:k,y:$},pointType:"smooth",segmentType:"SMOOTH_CUBIC"}),r=A,n=S,o=k,s=$}else if(g==="Q"||g==="T"){let I=r,x=n,k=g==="T",[$,A]=k?/^[QqTt]$/.test(l)?[2*I-o,2*x-s]:[I,x]:zn(m,0,I,x),[S,M]=zn(m,k?0:2,I,x),T=t.at(-1);T&&(T.pointType="smooth",T.handleOut={x:$,y:A});let E={x:S,y:M,pointType:"smooth",segmentType:k?"SMOOTH_QUADRATIC":"QUADRATIC"};t.push(E),r=S,n=M,o=$,s=A}else if(g==="A"){let I=r,x=n,[k,$]=zn(m,5,I,x),A=Math.abs(m.params[0]),S=Math.abs(m.params[1]),M={x:k,y:$,pointType:"corner"};A!==0&&S!==0&&(k!==r||$!==n)&&(M.segmentType="ARC",M.arcParams={rx:A,ry:S,rotation:m.params[2],largeArc:m.params[3]===1,sweep:m.params[4]===1}),(k!==r||$!==n)&&t.push(M),r=k,n=$}v&&t.length>y&&(t[t.length-1].segmentRelative=!0),b&&t.length>y&&(t[y].isSubpathStart=!0,d=y),l=m.type}}let f=t.map((m,g)=>g===0||m.isSubpathStart?g:-1).filter(m=>m>=0),p=f.some(m=>c.has(m)),h=f.some(m=>!c.has(m));if(p&&h)for(let m of f)t[m].subpathClosed=c.has(m);return{points:t,closed:u}}function Cj(e){return e.replace(/[\t\n\r ]+/g," ").trim()}function Pw(e){let t=[];for(let r of e.children)if(r.kind==="text"||r.kind==="cdata"){let n=Cj(r.value);n&&t.push(n)}else if(r.kind==="element"){let n=Pw(r);n&&t.push(n)}return t.join(" ")}function Oj(e,t){return e.usePath.length!==t.usePath.length?!1:e.usePath.every((r,n)=>r.sourceReferenceId===t.usePath[n]?.sourceReferenceId)}function Dw(e,t,r){return e.occurrences.find(n=>n.correspondingSourceNodeId===r&&Oj(n,t))??e.direct(r)}function Tj(e,t){let r=t;for(;r;){let n=r.attributes.find(i=>i.prefix==="xml"&&i.localName==="space")?.value;if(n)return n;r=e.index.parent(r.sourceNodeId)}return null}function Pj(e,t,r,n){let i=n.style(r.occurrenceId)?.cascadedValues["white-space"]?n.value(r.occurrenceId,"white-space"):null;return i==="pre"||i==="pre-wrap"||i==="break-spaces"?{mode:"preserve-xml-space",authored:i}:i==="pre-line"?{mode:"preserve-newlines",authored:i}:Tj(e,t)==="preserve"?{mode:"preserve-xml-space",authored:"pre"}:{mode:"collapse",authored:i==="normal"?"normal":null}}function Wo(e,t){return t==="preserve-newlines"||t==="preserve-xml-space"?e.replace(/\r\n?/g,`
24
+ `):t==="preserve-spaces"?e.replace(/\r?\n[ \t\r]*/g,""):e.replace(/[ \t\r\n]+/g," ")}function Do(e,t){return e.children.map(r=>r.kind==="text"||r.kind==="cdata"?Wo(r.value,t):r.kind==="element"?Do(r,t):"").join("")}function Dj(e,t,r,n){if(n==="preserve-newlines")return;let i="",a=h=>{let m=[];for(let g of h.children){if(g.kind==="text"||g.kind==="cdata"){i+=Wo(g.value,n);continue}if(g.kind!=="element"||g.localName.toLowerCase()!=="tspan")continue;let v=i.length,b=a(g);m.push({start:v,end:i.length,sourceNodeId:g.sourceNodeId,...Ps(j(g,"rotate")).length>0?{rotate:Ps(j(g,"rotate"))}:{},children:b})}return m},o=a(t);if(o.length===0)return;let s=new Map;if(r.lines.forEach((h,m)=>{if(!h.sourceNodeId)return;let g=e.index.element(h.sourceNodeId),v=h.sourceNodeId;for(;g&&g.sourceNodeId!==t.sourceNodeId;)Wd(g,"sodipodi","role")==="line"&&(v=g.sourceNodeId),g=e.index.parent(g.sourceNodeId);s.set(v,m)}),n==="preserve-xml-space"){let h=g=>{let v=s.get(g.sourceNodeId);return{start:g.start,end:g.end,sourceNodeId:g.sourceNodeId,...v===void 0?{}:{lineIndex:v},...g.rotate?{rotate:g.rotate}:{},children:g.children.map(h)}},m=Ps(j(t,"rotate"));return{text:i,...m.length>0?{rotate:m}:{},spans:o.map(h)}}let l=r.text.replaceAll(`
25
+ `,""),u=new Array(i.length+1).fill(0),d=0;for(let h=0;h<i.length;h++){let m=i[h];if(m===" "&&n==="collapse")l[d]===" "&&(d+=1);else{if(m!==l[d])return;d+=1}u[h+1]=d}if(d!==l.length)return;let c=(h,m)=>{let g=0;for(let v=0;v<r.text.length;v++){if(g===h){if(m==="end")return v;for(;r.text[v]===`
26
+ `;)v+=1;return v}r.text[v]!==`
27
+ `&&(g+=1)}return r.text.length},f=h=>{let m=s.get(h.sourceNodeId);return{start:c(u[h.start]??0,"start"),end:c(u[h.end]??l.length,"end"),sourceNodeId:h.sourceNodeId,...m===void 0?{}:{lineIndex:m},...h.rotate?{rotate:h.rotate}:{},children:h.children.map(f)}},p=Ps(j(t,"rotate"));return{text:r.text,...p.length>0?{rotate:p}:{},spans:o.map(f)}}function Wd(e,t,r){return e.attributes.find(n=>n.prefix===t&&n.localName===r)?.value??null}function Tt(e,t,r,n,i,a=n*.5){let o=Ed(e).at(0);if(o)return Sa(o,{percentBasis:t==="x"?r.width:r.height,viewportWidth:r.width,viewportHeight:r.height,fontSize:n,rootFontSize:i,xHeight:a})}function jj(e,t,r,n,i,a){let o=e.children.filter(b=>b.kind==="element"&&b.localName.toLowerCase()==="tspan"),s=b=>Wo(b,t);if(o.length===0){let b=s(Do(e,t));t==="collapse"&&(b=b.replace(/ {2,}/g," ").replace(/^ +| +$/g,""));let y=b.split(`
28
+ `).map(I=>({text:I,x:0,dy:0,y:null,sourceNodeId:null}));return{text:b,lines:y,linePositions:null}}let l=.001,u=Tt(j(e,"x"),"x",r,n,i,a)??0,d=Tt(j(e,"y"),"y",r,n,i,a)??null,c=[],f=!1,p=(b,y,I)=>{if(t!=="collapse")return b;let x=b.replace(/ {2,}/g," ");return y&&(x=x.replace(/^ +/,"")),I?x.replace(/ +$/,""):x},h=(b,y,I,x,k,$,A,S,M)=>{if(!b)return;let T=x===null?0:(Tt(x,"x",r,n,i,a)??u)-u,E=t==="preserve-newlines"?b.split(`
29
+ `):[b];for(let C=0;C<E.length;C++){let O=E[C],z=C>0,R=C===0&&y||z;if(!(!O&&!z)){if(R&&f){if(I){let ae=c.at(-1);ae&&(ae.trimEnd=!0)}let U=C===0?T:0,V=C===0?k:0,Y=C===0?A:null,G=C===0&&x!==null?Tt(x,"x",r,n,i,a):void 0,H=C===0&&$!==null?Tt($,"y",r,n,i,a):void 0,X=C===0&&S!==null?Tt(S,"y",r,n,i,a):void 0,B={...G!==void 0&&U===G-u?{x:{raw:x,resolved:G}}:{},...H!==void 0&&V===H?{dy:{raw:$,resolved:H}}:{},...X!==void 0&&Y===X?{y:{raw:S,resolved:X}}:{}};c.push({text:O,x:U,dy:V,y:Y,...Object.keys(B).length>0?{authored:B}:{},sourceNodeId:C===0?M:null})}else if(f)c[c.length-1].text+=O;else{let U=C===0?T:0,V=C===0?A:null,Y=C===0&&x!==null?Tt(x,"x",r,n,i,a):void 0,G=C===0&&S!==null?Tt(S,"y",r,n,i,a):void 0,H={...Y!==void 0&&U===Y-u?{x:{raw:x,resolved:Y}}:{},...G!==void 0&&V===G?{y:{raw:S,resolved:G}}:{}};c.push({text:O,x:U,dy:0,y:V,...Object.keys(H).length>0?{authored:H}:{},sourceNodeId:C===0?M:null})}O&&(f=!0)}}},m=b=>{let y=j(b,"x");if(Wd(b,"sodipodi","role")==="line"){let k=Tt(j(b,"y"),"y",r,n,i,a),$=k!==void 0&&d!==null&&Math.abs(k-d)>.5?k-d:0;return{brk:!0,x:y,dy:$,dyRaw:null,y:k??null,yRaw:j(b,"y"),trimPreviousLine:!0}}let I=j(b,"dy");if(I!==null){let k=Tt(I,"y",r,n,i,a)??0;if(k>l||k<-l&&y!==null)return{brk:!0,x:y,dy:k,dyRaw:I,y:null,yRaw:null,trimPreviousLine:!1}}let x=Tt(j(b,"y"),"y",r,n,i,a);if(x!==void 0&&!f)return{brk:!0,x:y,dy:0,dyRaw:null,y:x,yRaw:j(b,"y"),trimPreviousLine:!1};if(x!==void 0&&d!==null&&Math.abs(x-d)>.5)return{brk:!0,x:y,dy:x-d,dyRaw:null,y:x,yRaw:j(b,"y"),trimPreviousLine:!1};if(y!==null&&f){let k=Tt(y,"x",r,n,i,a);if(k!==void 0&&k<=u+.5)return{brk:!0,x:y,dy:0,dyRaw:null,y:null,yRaw:null,trimPreviousLine:!1}}return{brk:!1,x:null,dy:0,dyRaw:null,y:null,yRaw:null,trimPreviousLine:!1}},g=(b,y)=>{let I=!1;for(let x of b.children){if(x.kind==="text"||x.kind==="cdata"){let M=s(x.value);if(!M)continue;if(t!=="preserve-newlines"&&/^ +$/.test(M)){if(f&&c.length>0){let E=c[c.length-1].text;t==="collapse"?E.endsWith(" ")||(c[c.length-1].text+=" "):c[c.length-1].text+=M}continue}let T=y.active&&!I;h(M,T,T?y.trimPreviousLine:!1,T?y.x:null,T?y.dy:0,T?y.dyRaw:null,T?y.y:null,T?y.yRaw:null,T?y.sourceNodeId:null),I=!0;continue}if(x.kind!=="element"||x.localName.toLowerCase()!=="tspan")continue;let k=m(x),$=Tt(j(x,"y"),"y",r,n,i,a);$!==void 0&&(d=$);let A=k.brk&&!(y.active&&!I),S={active:y.active&&!I||A,trimPreviousLine:A?k.trimPreviousLine:y.active&&!I?y.trimPreviousLine:!1,x:A?k.x:y.active&&!I?y.x:null,dy:A?k.dy:y.active&&!I?y.dy:0,dyRaw:A?k.dyRaw:y.active&&!I?y.dyRaw:null,y:A?k.y:y.active&&!I?y.y:null,yRaw:A?k.yRaw:y.active&&!I?y.yRaw:null,sourceNodeId:A?x.sourceNodeId:f?y.active&&!I?y.sourceNodeId:null:y.sourceNodeId??x.sourceNodeId};x.children.some(M=>M.kind==="element"&&M.localName.toLowerCase()==="tspan")?g(x,S):h(s(Do(x,t)),S.active,S.trimPreviousLine,S.x,S.dy,S.dyRaw,S.y,S.yRaw,S.sourceNodeId),I=!0}};g(e,{active:!1,trimPreviousLine:!1,x:null,dy:0,dyRaw:null,y:null,yRaw:null,sourceNodeId:null});for(let b=0;b<c.length;b++)c[b].text=p(c[b].text,b===0,b===c.length-1||c[b].trimEnd===!0);let v=c.some((b,y)=>b.sourceNodeId!==null||y>0&&Math.abs(b.dy)>l||Math.abs(b.x)>l)?c.map(b=>({x:b.x,dy:b.dy,...b.y===null?{}:{y:b.y},...b.authored?{authored:b.authored}:{},sourceNodeId:b.sourceNodeId})):null;return{text:c.map(b=>b.text).join(`
30
+ `),lines:c,linePositions:v}}function jw(e){return e&&e.split(",").map(t=>t.trim().replace(/^['"]|['"]$/g,"").trim()).filter(Boolean).join(", ")||null}function Ej(e,t,r,n,i,a){let o=vo(e,t,r,"font-size"),s=li(o);return s!==void 0&&s>=0?s:n}function q0(e,t,r,n){let i=r;for(;i;){if(e.style(i.occurrenceId)?.cascadedValues[n])return!0;i=i.parentOccurrenceId?t.occurrence(i.parentOccurrenceId)??void 0:void 0}return!1}function vo(e,t,r,n){let i=j(r,n),a=e.style(t.occurrenceId),o=a?.cascadedValues[n];return o?a?.specifiedValues[n]??o.value:i!==null?i:a?.resolvedValues[n]??null}function Ew(e){if(!e)return 400;if(e==="normal"||e==="bold"||e==="bolder"||e==="lighter")return e;let t=Number(e);return Number.isFinite(t)?t:400}function zj(e){let t=Ew(e);return t===400||t==="normal"?"normal":t===700||t==="bold"?"bold":t}function cd(e,t,r){let n=M=>t?e.value(t.occurrenceId,M):null,i=n("text-decoration")?.toLowerCase()??"",a=jw(n("font-family"))??"Arial",o=n("font-style"),s=o==="italic"||o==="oblique"?o:"normal",l=n("line-height"),u=l?Number(l):NaN,d=n("fill"),c=(M,T)=>li(n(M))??T,f=n("font-variant")??"",p=n("baseline-shift"),h=p?li(p):void 0,m=p==="baseline"||p==="super"||p==="sub"?p:h??"baseline",g=n("dominant-baseline"),v=new Set(["auto","alphabetic","central","middle","hanging","ideographic","mathematical","text-top","text-bottom"]),b=n("writing-mode"),y=b==="tb"||b==="tb-rl"?"vertical-rl":b==="lr"||b==="lr-tb"||b==="rl"||b==="rl-tb"?"horizontal-tb":b,I=n("direction"),x=n("unicode-bidi"),k=n("text-anchor"),$=n("text-transform"),A=n("alignment-baseline"),S=new Set(["auto","baseline","text-bottom","alphabetic","ideographic","middle","central","mathematical","hanging","text-top"]);return{...Ud,textDecoration:{underline:i.includes("underline"),strikethrough:i.includes("line-through"),overline:i.includes("overline")},fontVariationSettings:{},fontFamily:a,fontSize:r,fontWeight:zj(n("font-weight")),fontStyle:s,fontStretch:n("font-stretch")??"normal",fontSizeAdjust:n("font-size-adjust")??"none",fontVariant:f,fontVariantLigatures:n("font-variant-ligatures")??"",fontVariantPosition:n("font-variant-position")??"",fontVariantCaps:n("font-variant-caps")??"",fontVariantNumeric:n("font-variant-numeric")??"",fontVariantEastAsian:n("font-variant-east-asian")??"",fill:!d||d.toLowerCase()==="black"?"#000000":d,stroke:n("stroke")??"none",lineHeight:Number.isFinite(u)?u:1.2,textTransform:$==="capitalize"||$==="uppercase"||$==="lowercase"?$:"none",baselineShift:m,dominantBaseline:v.has(g)?g:"auto",alignmentBaseline:S.has(A)?A:"auto",writingMode:y==="vertical-rl"||y==="vertical-lr"?y:"horizontal-tb",whiteSpace:n("white-space")==="pre"||n("white-space")==="pre-wrap"||n("white-space")==="pre-line"||n("white-space")==="nowrap"||n("white-space")==="break-spaces"?n("white-space"):"normal",direction:I==="rtl"?"rtl":"ltr",unicodeBidi:x==="embed"||x==="bidi-override"||x==="isolate"||x==="isolate-override"||x==="plaintext"?x:"normal",textAnchor:k==="middle"||k==="end"?k:"start",letterSpacing:c("letter-spacing",0),wordSpacing:c("word-spacing",0),fillOpacity:Number(n("fill-opacity")??1),strokeWidth:c("stroke-width",0),strokeOpacity:Number(n("stroke-opacity")??1)}}function zw(e,t,r,n,i,a){let o=e.style(t.occurrenceId)?.cascadedValues["font-size"];if(!o)return r;let s=o.value.trim().toLowerCase();if(s==="inherit"||s==="unset")return r;if(s==="initial"||s==="revert"||s==="revert-layer"||s==="medium")return a;let l=e.value(t.occurrenceId,"font-size"),u=at(l,{percentBasis:r,viewportWidth:i.width,viewportHeight:i.height,fontSize:r,rootFontSize:a,xHeight:n});return u!==void 0&&u>=0?u:r}function Rw(e,t,r,n,i){let a=i?.measureXHeight(e.fontFamily,t);return a!==void 0&&Number.isFinite(a)&&a>=0?a:r>0?n*(t/r):t*.5}function Rj(e){return Rp(e).filter(t=>t.localName.toLowerCase()==="tspan"&&!t.children.some(r=>r.kind==="element"&&r.localName.toLowerCase()==="tspan"))}function Nu(e,t,r,n,i,a){return e?Ed(e).map(o=>({value:Sa(o,{percentBasis:t==="x"?r.width:r.height,viewportWidth:r.width,viewportHeight:r.height,fontSize:n,rootFontSize:i,xHeight:a})??null,raw:o.unit===""||o.unit==="px"?null:`${o.value}${o.unit}`})):[]}function Ps(e){if(!e)return[];let t=e.trim().split(/[\s,]+/).filter(Boolean),r=/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?$/;return t.every(n=>r.test(n))?t.map(Number):[]}function _j(e,t,r,n,i,a,o,s){let l=Rj(e),u=l.length>0?l:[e],d=Array.from(t,()=>({x:null,y:null,dx:0,dy:0,rotate:0})),c=0,f=!1;for(let p of u){let h=Wo(Do(p,r),r),m=l.length>0?Math.max(c,t.indexOf(h,c)):0,g=Nu(j(p,"dx"),"x",n,i,a,o),v=Nu(j(p,"dy"),"y",n,i,a,o),b=Nu(j(p,"x"),"x",n,i,a,o),y=Nu(j(p,"y"),"y",n,i,a,o),I=Ps(j(p,"rotate")),x=I.at(-1)??0,k=g.length>1||v.length>1||b.length>1||y.length>1||I.length>1,$=Wd(p,"sodipodi","role")==="line",A=v[0]?.value,S=l.length>0&&!k&&($||A!=null&&(A>.001||A<-.001&&j(p,"x")!==null));for(let M=0;M<h.length&&m+M<d.length;M++){let T=d[m+M],E=l.length===0,C=S?null:E?M>0?b[M]?.value??null:null:k?b[M]?.value??null:M===0?b[0]?.value??null:null,O=S?null:E?M>0?y[M]?.value??null:null:k?y[M]?.value??null:M===0?y[0]?.value??null:null,z=S?0:k?g[M]?.value??0:M===0?g[0]?.value??0:0,R=S?0:k?v[M]?.value??0:M===0?v[0]?.value??0:0,U=I[M]??x;Object.assign(T,{x:C,y:O,dx:z,dy:R,rotate:U});let V={},Y=!S&&!(E&&M===0)&&(k?M<b.length:M===0&&b.length>0),G=!S&&!(E&&M===0)&&(k?M<y.length:M===0&&y.length>0),H=!S&&(k?M<g.length:M===0&&g.length>0),X=!S&&(k?M<v.length:M===0&&v.length>0);Y&&(V.x=!0),G&&(V.y=!0),H&&(V.dx=!0),X&&(V.dy=!0),!S&&M<I.length&&(V.rotate=!0),Object.keys(V).length>0&&(T.authored=V);let B={},ae=E&&M===0?null:k?b[M]?.raw:M===0?b[0]?.raw:null,K=E&&M===0?null:k?y[M]?.raw:M===0?y[0]?.raw:null,W=k?g[M]?.raw:M===0?g[0]?.raw:null,J=k?v[M]?.raw:M===0?v[0]?.raw:null;!S&&ae&&(B.x=ae),!S&&K&&(B.y=K),!S&&W&&(B.dx=W),!S&&J&&(B.dy=J),Object.keys(B).length>0&&(T.raw=B),(C!==null||O!==null||z!==0||R!==0||U!==0||Object.keys(V).length>0)&&(f=!0)}c=Math.max(c,m+h.length)}if(s){let p=x=>({spanId:x.sourceNodeId,start:x.start,end:x.end,...x.rotate?{rotate:[...x.rotate]}:{},children:x.children.map(p)}),h={text:s.text,...s.rotate?{rotate:[...s.rotate]}:{},spans:s.spans.map(p)},m=Mw(h);d.forEach((x,k)=>{x.rotate=m[k]??0;let $=x.authored;$&&(delete $.rotate,Object.keys($).length===0&&delete x.authored)});let g=[],v=0,b=0;for(let x of h.text)g.push({textOffset:v,glyphIndex:b,character:x}),v+=x.length,b+=1;let y=(x,k,$)=>{if(!$||$.length===0)return;let A=0;for(let S of g){if(S.textOffset<x||S.textOffset>=k||S.character===`
31
+ `)continue;if(A>=$.length)break;let M=d[S.glyphIndex];M.authored={...M.authored??{},rotate:!0},A+=1}f=!0},I=x=>{for(let k of x)y(k.start,k.end,k.rotate),I(k.children)};y(0,h.text.length,h.rotate),I(h.spans)}return f?d:null}function _w(e,t){let r=j(t,"path");if(r)return{data:r,referenced:null,reference:null,inline:!0};let n=vr(t),i=n?.value,a="href";if(n===null){let l=t.children.find(u=>u.kind==="element"&&u.localName.toLowerCase()==="mpath");i=l?vr(l)?.value:void 0,l&&(a="mpath")}if(!i?.startsWith("#"))return{data:null,referenced:null,reference:null,inline:!1};let o=e.index.resolveAuthoredId(i.slice(1)),s=o?e.index.element(o.sourceNodeId):null;return{data:s?j(s,"d"):null,referenced:s,reference:o?{targetSourceNodeId:o.sourceNodeId,element:a}:null,inline:!1}}function Y0(e,t){let r=t.children.find(n=>n.kind==="element"&&n.localName.toLowerCase()==="textpath");return r?_w(e,r).data:null}function Fj(e,t,r){let n=t.children.find(g=>g.kind==="element"&&g.localName.toLowerCase()==="textpath");if(!n)return{isTextPath:!1};let i={isTextPath:!1},a=j(n,"side");a==="right"&&(i.textPathSide=a);let o=j(n,"method");(o==="align"||o==="stretch")&&(i.textPathMethod=o);let s=j(n,"spacing");(s==="auto"||s==="exact")&&(i.textPathSpacing=s);let l=j(n,"startOffset");if(l){let g=Number.parseFloat(l);Number.isFinite(g)&&(i.textPathStartOffset=g,i.textPathStartOffsetUnit=l.trim().endsWith("%")?"%":"user")}let u=j(n,"lengthAdjust");(u==="spacing"||u==="spacingAndGlyphs")&&(i.textPathLengthAdjust=u);let d=j(n,"textLength");if(d){let g=Number.parseFloat(d);Number.isFinite(g)&&g>=0&&(i.textPathLength=g,i.textPathLengthUnit=d.trim().endsWith("%")?"%":"user")}let c=_w(e,n);c.inline&&(i.textPathInlineFormat="path-attr"),c.reference&&(i.textPathImportReference=c.reference);let{data:f,referenced:p}=c;if(!f)return i;let h=Tw(Fd(f).commands);if(h.points.length<2)return i;i.isTextPath=!0,i.textPathPoints=h.points;let m=Ts(p?j(p,"pathLength"):null);return m!==void 0&&m>=0&&(i.textPathPathLength=m),i.x=-r/2,i.y=-r/2,i}function Lj(e,t,r,n,i,a,o,s,l,u,d){let c=b=>({...b,whiteSpace:"pre"}),f=c(cd(n,t,a)),p=[{segments:[]}],h=!1,m=(b,y)=>{Wo(b,"preserve-xml-space").split(`
32
+ `).forEach((I,x)=>{x>0&&p.push({segments:[]}),I.length>0&&p[p.length-1].segments.push({text:I,style:y})})},g=(b,y,I,x)=>{for(let k of b.children){if(k.kind==="text"||k.kind==="cdata"){m(k.value,y);continue}if(k.kind!=="element"||k.localName.toLowerCase()!=="tspan")continue;let $=Dw(r,t,k.sourceNodeId),A=$?zw(n,$,I,x,s,l):I,S=c($?cd(n,$,A):y),M=Rw(S,A,I,x,d);Ia(S,f)||(h=!0),g(k,S,A,M)}};g(e,f,a,u);let v=p.map(b=>b.segments.map(y=>y.text).join("")).join(`
33
+ `);return!h||v!==i?null:{lines:p,baseStyle:f,lineHeight:o}}function Bj(e,t,r,n,i,a,o,s,l,u,d,c){if(!e.children.some(k=>k.kind==="element"&&k.localName.toLowerCase()==="tspan"))return null;if(a==="preserve-xml-space")return Lj(e,t,r,n,i,o,s,l,u,d,c);let f=cd(n,t,o),p=[{segments:[]}],h=!1,m=!1,g=Tt(j(e,"y"),"y",l,o,u,d)??null,v=Tt(j(e,"x"),"x",l,o,u,d)??0,b=k=>Wo(k,a),y=(k,$,A,S)=>{if(!k)return;let M=a==="preserve-newlines"?k.split(`
34
+ `):[k];for(let T=0;T<M.length;T++){let E=M[T],C=T>0;if(!E&&!C)continue;let O={text:E,style:ud(f,$)};(T===0&&A||C)&&h?(S&&(p[p.length-1].trimEnd=!0),p.push({segments:[O]})):p[p.length-1].segments.push(O),E&&(h=!0),Ia($,f)||(m=!0)}},I=(k,$,A)=>{if(Wd(k,"sodipodi","role")==="line")return{starts:!0,trimPrevious:!0};let S=j(k,"x"),M=j(k,"dy");if(M!==null){let E=Tt(M,"y",l,$,u,A)??0;if(E>.001||E<-.001&&S!==null)return{starts:!0,trimPrevious:!1}}let T=Tt(j(k,"y"),"y",l,$,u,A);if(T!==void 0&&g!==null&&Math.abs(T-g)>.5)return{starts:!0,trimPrevious:!1};if(S!==null&&h){let E=Tt(S,"x",l,$,u,A);if(E!==void 0&&E<=v+.5)return{starts:!0,trimPrevious:!1}}return{starts:!1,trimPrevious:!1}},x=(k,$,A,S,M,T)=>{let E=!1;for(let C of k.children){if(C.kind==="text"||C.kind==="cdata"){let X=b(C.value);if(!X)continue;if(a!=="preserve-newlines"&&/^ +$/.test(X)){if(h){let B=p.at(-1)?.segments.at(-1),ae=a==="collapse"?B?.text.endsWith(" ")?"":" ":X;if(ae){let K=ud(f,$);B&&Ia(B.style,K)?B.text+=ae:p[p.length-1].segments.push({text:ae,style:K})}}continue}y(X,$,A&&!E,A&&!E&&S),E=!0;continue}if(C.kind!=="element"||C.localName.toLowerCase()!=="tspan")continue;let O=Dw(r,t,C.sourceNodeId),z=O?zw(n,O,M,T,l,u):M,R=O?cd(n,O,z):$,U=Rw(R,z,M,T,c),V=I(C,z,U),Y=Tt(j(C,"y"),"y",l,z,u,U);Y!==void 0&&(g=Y);let G=A&&!E||V.starts,H=V.starts?V.trimPrevious:A&&!E?S:!1;C.children.some(X=>X.kind==="element"&&X.localName.toLowerCase()==="tspan")?x(C,R,G,H,z,U):y(b(Do(C,a)),R,G,H),E=!0}};if(x(e,f,!1,!1,o,d),a==="collapse")for(let k=0;k<p.length;k++){let $=p[k],A=!1;for(let M of $.segments)M.text=M.text.replace(/ {2,}/g," "),A&&M.text.startsWith(" ")&&(M.text=M.text.slice(1)),A=M.text.endsWith(" ");if(k===0){let M=$.segments.find(T=>T.text.length>0);M&&(M.text=M.text.replace(/^ +/,""))}let S=[...$.segments].reverse().find(M=>M.text.length>0);(k===p.length-1||$.trimEnd===!0)&&S&&(S.text=S.text.replace(/ +$/,"")),$.segments=$.segments.filter(M=>M.text.length>0)}return!m||p.map(k=>k.segments.map($=>$.text).join("")).join(`
35
+ `)!==i?null:{lines:p,baseStyle:f,lineHeight:s}}function Rp(e){let t=[],r=n=>{for(let i of n)i.kind==="element"&&(t.push(i),r(i.children))};return r(e.children),t}function Vj(e,t){let r=tw(e.attributes);return r?Object.freeze({...t,canonicalType:r.projection.type,state:Ow({...t.state,...r.projection.state})}):t}function Uj(e,t){let r=e.index.parent(t.sourceNodeId);for(;r;){if(r.localName.toLowerCase()==="flowroot")return!0;r=e.index.parent(r.sourceNodeId)}return!1}var Gj=[["fontVariant","font-variant"],["fontVariantLigatures","font-variant-ligatures"],["fontVariantPosition","font-variant-position"],["fontVariantCaps","font-variant-caps"],["fontVariantNumeric","font-variant-numeric"],["fontVariantEastAsian","font-variant-east-asian"]];function Wj(e,t,r){let n={},i=S=>vo(e,t,r,S);for(let[S,M]of Gj){let T=i(M);T&&T.trim()&&(n[S]=T.trim())}let a=i("text-decoration")??i("text-decoration-line");if(a&&a!=="none"){let S=a.toLowerCase();n.textDecoration={underline:S.includes("underline"),strikethrough:S.includes("line-through"),overline:S.includes("overline")}}let o=i("text-anchor"),s=i("text-align");o==="middle"||o==="end"?n.textAnchor=o:s==="center"?n.textAnchor="middle":s==="end"||s==="right"?n.textAnchor="end":(s==="justify"||o==="start")&&(n.textAnchor="start");let l=S=>{let M=i(S);if(M!=="normal")return li(M)},u=l("letter-spacing");u!==void 0&&(n.letterSpacing=u);let d=l("word-spacing");d!==void 0&&(n.wordSpacing=d);let c=i("text-transform");c&&(n.textTransform=c.trim());let f=i("baseline-shift");f&&(n.baselineShift=f.trim());let p=i("dominant-baseline");p&&(n.dominantBaseline=p.trim());let h=i("alignment-baseline");h&&(n.alignmentBaseline=h.trim());let m=i("font-stretch");m&&(n.fontStretch=m.trim());let g=i("font-size-adjust");g&&(n.fontSizeAdjust=g.trim());let v=i("writing-mode");v&&(n.writingMode=v==="tb"||v==="tb-rl"?"vertical-rl":v==="vertical-lr"?"vertical-lr":"horizontal-tb");let b=Number.parseFloat(i("inline-size")??"");Number.isFinite(b)&&b>0&&(n.inlineSize=b);let y=i("shape-inside")?.match(/url\(\s*#([^)]+)\s*\)/)?.[1];y&&(n.shapeInsideImportRefId=y);let I=Number.parseFloat(i("shape-padding")??"");Number.isFinite(I)&&I>0&&(n.shapePadding=I);let x=i("overflow-wrap");(x==="break-word"||x==="anywhere")&&(n.overflowWrap=x);let k=i("direction");(k==="ltr"||k==="rtl")&&(n.textDirection=k);let $=i("unicode-bidi");($==="normal"||$==="embed"||$==="bidi-override"||$==="isolate"||$==="isolate-override"||$==="plaintext")&&(n.unicodeBidi=$);let A=i("font-variation-settings");if(A&&A!=="normal"){let S={};for(let M of A.split(",")){let T=M.trim().match(/^['"](\w{4})['"]\s+([\d.eE+-]+)$/);if(!T)continue;let E=Number(T[2]);Number.isFinite(E)&&(S[T[1]]=E)}Object.keys(S).length>0&&(n.fontVariationSettings=S)}return n}function Xj(e,t,r,n,i,a,o){let s={...a,viewport:a.viewportPlan?.viewport(t.occurrenceId)??a.viewport},l=r.localName.toLowerCase(),u=Nj(i,t,s),d=(m,g)=>H0(i,t,r,m,g,u,s),c=m=>{o.push($j(e,t,r,s,m))},f=Aj(r),p=Ts(j(r,"pathLength")),h=m=>(p===void 0||(p<0?c("Path length must not be negative."):m.pathLength=p),m);if(l==="rect"){let m=d("x","x")??0,g=d("y","y")??0,v=d("width","x")??0,b=d("height","y")??0;if(v<0||b<0)return c("Rectangle width and height must not be negative."),Nt(t,r,null,"invalid");let y=d("rx","x"),I=d("ry","y");(y!==void 0&&y<0||I!==void 0&&I<0)&&c("Rectangle corner radii must not be negative.");let x=y!==void 0&&y>=0,k=I!==void 0&&I>=0,$=Math.min(x?y:k?I:0,v/2),A=Math.min(k?I:x?y:0,b/2),S=h({x:m,y:g,width:v,height:b,...x?{rx:y}:{},...k?{ry:I}:{},cornerRadius:0});Object.assign(S,f);let M=r.children.some(E=>E.kind==="element"&&["animate","set"].includes(E.localName.toLowerCase())&&["x","y","width","height","rx","ry"].includes(j(E,"attributeName")??"")),T=Math.abs(v-b)<=1e-6&&Math.abs($-A)<=1e-6&&!M?"square":"rectangle";return Nt(t,r,T,"materialized",S)}if(l==="circle"){let m=d("cx","x")??0,g=d("cy","y")??0,v=d("r","radius")??0;return v<0?(c("Circle radius must not be negative."),Nt(t,r,null,"invalid")):Nt(t,r,"circle","materialized",h({x:m,y:g,radius:v,...f}))}if(l==="ellipse"){let m=d("cx","x")??0,g=d("cy","y")??0,v=d("rx","x"),b=d("ry","y");(v!==void 0&&v<0||b!==void 0&&b<0)&&c("Ellipse radii must not be negative.");let y=v!==void 0&&v>=0,I=b!==void 0&&b>=0,x=y?v:I?b:0,k=I?b:y?v:0;return x===0||k===0?Nt(t,r,"ellipse","materialized",h({x:m,y:g,rx:x,ry:k,...f})):Math.abs(x-k)<=1e-6?Nt(t,r,"circle","materialized",h({x:m,y:g,radius:x,...f})):Nt(t,r,"ellipse","materialized",h({x:m,y:g,rx:x,ry:k,...f}))}if(l==="line"){let m={x1:d("x1","x")??0,y1:d("y1","y")??0,x2:d("x2","x")??0,y2:d("y2","y")??0};return h(m),Object.assign(m,f),Nt(t,r,"line","materialized",m)}if(l==="polyline"||l==="polygon"){let m=Mj(j(r,"points"));if(m.odd&&c("The final unpaired polygon coordinate was ignored."),m.points.length===0)return Nt(t,r,"polyline","materialized",h({x:0,y:0,width:0,height:0,polylinePoints:[],polylineClosed:l==="polygon",...f}));let g=m.points.map(I=>I.x),v=m.points.map(I=>I.y),b=Math.min(...g),y=Math.min(...v);return Nt(t,r,"polyline","materialized",h({x:b,y,width:Math.max(...g)-b,height:Math.max(...v)-y,polylinePoints:m.points,polylineClosed:l==="polygon",...f}))}if(l==="path"){let m=Os(i,t,r,"d")??"",g=/^path\(\s*(["'])([\s\S]*)\1\s*\)$/i.exec(m.trim()),v=g?g[2]:m;if(!v||v.trim().toLowerCase()==="none"){let M=r.children.find(T=>T.kind==="element"&&["animate","set"].includes(T.localName.toLowerCase())&&j(T,"attributeName")==="d");M&&(v=j(M,"from")??j(M,"to")??"")}let b=Fd(v);b.error&&c(`Invalid path data: ${b.error.message}.`);let y=Tw(b.commands),I=Po(v),x=y.points.map(M=>M.x),k=y.points.map(M=>M.y),$=I?.minX??(x.length>0?Math.min(...x):0),A=I?.minY??(k.length>0?Math.min(...k):0),S={x:$,y:A,width:I?I.maxX-I.minX:0,height:I?I.maxY-I.minY:0};return h(S),S.pathPoints=y.points,S.pathClosed=y.closed,S.pathCurveType=y.points.some(M=>M.segmentType)?"mixed":y.points.some(M=>M.handleIn||M.handleOut)?"cubic":"linear",S.pathTension=.5,Object.assign(S,f),Nt(t,r,"path","materialized",S)}if(l==="text"){let m=s.viewport,g=Pj(e,r,t,i),v=Ej(i,t,r,u,m,s.rootFontSize),b=q0(i,n,t,"font-family")?jw(vo(i,t,r,"font-family"))??"Inter, sans-serif":"Inter, sans-serif",y=s.textMetricsHost?.measureXHeight(b,v),I=y!==void 0&&Number.isFinite(y)&&y>=0?y:v*.5,x=jj(r,g.mode==="preserve-xml-space"?"preserve-spaces":g.mode,m,v,s.rootFontSize,I),k=g.mode==="preserve-xml-space"?Do(r,"preserve-xml-space"):x.text,$=q0(i,n,t,"font-weight")?Ew(vo(i,t,r,"font-weight")):400,A=vo(i,t,r,"font-style")??"normal",S=vo(i,t,r,"line-height"),M=S?li(S)??Number(S):NaN,T=Number.isFinite(M)?M:1.2,E=Tt(zp(Os(i,t,r,"x")),"x",m,v,s.rootFontSize,I)??0,C=Tt(zp(Os(i,t,r,"y")),"y",m,v,s.rootFontSize,I)??0,O={};for(let[H,X]of[["x",E],["y",C]]){let B=j(r,H),ae=Os(i,t,r,H),K=Ed(B);B===null||ae?.trim()!==B.trim()||K.length!==1||Tt(B,H,m,v,s.rootFontSize,I)===X&&(O[H]={raw:B,resolved:X})}let z={x:E,y:C,textX:E,textY:C,text:k,fontSize:v,fontFamily:b,fontWeight:$,fontStyle:A,lineHeight:T,useRichText:!1,isTextPath:!1};Object.keys(O).length>0&&(z.authoredTextPosition=O),Object.assign(z,Wj(i,t,r)),x.linePositions&&(z.linePositions=x.linePositions),z.whiteSpace=g.authored??"normal";let R=Dj(e,r,x,g.mode),U=_j(r,k,g.mode,m,v,s.rootFontSize,I,R);U&&(z.charOffsets=U);let V=Bj(r,t,n,i,k,g.mode,v,T,m,s.rootFontSize,I,s.textMetricsHost);V&&(z.useRichText=!0,z.richTextRuns=Nh(V));let Y=H0(i,t,r,"textLength","x",u,s);Y!==void 0&&Y>=0&&(z.textLength=Y);let G=j(r,"lengthAdjust");return(G==="spacing"||G==="spacingAndGlyphs")&&(z.lengthAdjust=G),Object.assign(z,Fj(e,r,v)),Object.assign(z,f),Nt(t,r,"text","materialized",z,R)}if(l==="flowroot"){let m=Rp(r).filter(y=>y.localName.toLowerCase()==="flowpara").map(Pw);if(m.every(y=>y.length===0))return Nt(t,r,null,"empty");let g=Rp(r).find(y=>["rect","circle","ellipse","path"].includes(y.localName.toLowerCase())),v=0,b=0;return g?.localName.toLowerCase()==="rect"&&(v=at(j(g,"x"),Ep("x",u,s))??0,b=at(j(g,"y"),Ep("y",u,s))??0),Nt(t,r,"text","materialized",{x:v,y:b+u,text:m.join(`
36
+ `),fontSize:u,fontFamily:"Inter, sans-serif",fontWeight:400,fontStyle:"normal",lineHeight:1.2,useRichText:!1,isTextPath:!1,...f})}if(l==="image"){let m=d("x","x")??0,g=d("y","y")??0,v=d("width","x"),b=d("height","y"),y=vr(r)?.value??"";if(!y||v===void 0||b===void 0)return Nt(t,r,null,"empty");if(v<0||b<0)return c("Image width and height must not be negative."),Nt(t,r,null,"invalid");if(v===0||b===0)return Nt(t,r,null,"empty");let I={x:m,y:g,width:v,height:b,...f};I.preserveAspectRatio=j(r,"data-preserve-aspect-ratio")!=="false";let x=j(r,"preserveAspectRatio")?.trim();return x&&x!=="none"&&(I.specPreserveAspectRatio=x),I.href=y,Nt(t,r,"image","materialized",I)}if(l==="foreignobject"){let m=d("x","x")??0,g=d("y","y")??0,v=d("width","x")??0,b=d("height","y")??0;if(v<0||b<0)return c("Foreign-object width and height must not be negative."),Nt(t,r,null,"invalid");if(v===0||b===0)return Nt(t,r,null,"empty");let y=j(r,"data-shape-type")??j(r,"data-media-kind"),I=y==="audio"||y==="video"?y:null;if(I){let x=r.children.find(T=>T.kind==="element"&&T.localName.toLowerCase()===I),k={x:m,y:g,width:v,height:b,mediaKind:I,href:x?j(x,"src")??"":"",...f},$=[["begin","data-begin"],["trimStart","data-trim-start"],["trimEnd","data-trim-end"],["volume","data-volume"],["playbackRate","data-playback-rate"],["naturalDuration","data-natural-duration"],["originalWidth","data-media-original-width"],["originalHeight","data-media-original-height"],["fadeInDuration","data-fade-in"],["fadeOutDuration","data-fade-out"]];for(let[T,E]of $){let C=Ts(j(r,E));C!==void 0&&(k[T]=C)}if(k.originalWidth===void 0){let T=Ts(j(r,"data-original-width"));T!==void 0&&(k.originalWidth=T)}if(k.originalHeight===void 0){let T=Ts(j(r,"data-original-height"));T!==void 0&&(k.originalHeight=T)}let A=x?j(x,"type"):null;A&&(k.mediaMimeType=A);let S=j(r,"data-poster")??(I==="video"&&x?j(x,"poster"):null);S&&(k.posterHref=S);let M=(j(r,"data-source-rect")??"").trim().split(/[\s,]+/u).map(Number);return M.length===4&&M.every(Number.isFinite)&&(k.sourceRect={x:M[0],y:M[1],width:M[2],height:M[3]}),j(r,"data-loop")==="true"&&(k.loop=!0),j(r,"data-muted")==="true"&&(k.muted=!0),Nt(t,r,I,"materialized",k)}return Nt(t,r,"foreign-object","materialized",{x:m,y:g,width:v,height:b,...f})}return Nt(t,r,null,"deferred")}function Hj(e,t,r,n){let i=n.viewportPlan??Aw(e,t,r,{viewport:n.viewport,rootFontSize:n.rootFontSize}),a={...n,viewportPlan:i},o=[],s=[],l=new Set,u=[...t.occurrences].sort(Sj);for(let h of u){if(l.has(h.occurrenceId))throw new Error(`Duplicate SVG geometry occurrence ${h.occurrenceId}.`);l.add(h.occurrenceId);let m=e.index.element(h.correspondingSourceNodeId);if(!m)throw new Error(`SVG occurrence ${h.occurrenceId} has no source element.`);if(m.namespaceUri!==ye||Kx(e,m))continue;let g=m.localName.toLowerCase();wj.has(g)&&(g!=="flowroot"&&Uj(e,m)||s.push(Vj(m,Xj(e,h,m,t,r,a,o))))}let d=new Map(s.map(h=>[h.occurrenceId,h])),c=qj(e,t,s),f=new Map(c.map(h=>[h.pathSourceNodeId,h])),p=Object.freeze({candidates:Object.freeze(s),candidate(h){return d.get(h)??null},privateTextPathGeometry:Object.freeze(c),privateTextPathOwner(h){return f.get(h)??null}});return Object.freeze({value:p,diagnostics:Object.freeze(o)})}function qj(e,t,r){let n=new Map;for(let o of e.index.localReferences){if(o.resolution!=="resolved"||!o.targetSourceNodeId)continue;let s=n.get(o.targetSourceNodeId)??[];s.push(o),n.set(o.targetSourceNodeId,s)}let i=[],a=new Set;for(let o of r){if(o.canonicalType!=="text"||o.state.isTextPath!==!0)continue;let s=o.state.textPathImportReference;if(!s||typeof s.targetSourceNodeId!="string"||s.element!=="href")continue;let l=s.targetSourceNodeId;if(a.has(l))continue;let u=t.occurrence(o.occurrenceId);if(!u||u.usePath.length>0)continue;let d=e.index.element(l);if(!d||d.namespaceUri!==ye||d.localName.toLowerCase()!=="path")continue;let c=j(d,"id");if(!c||!vj(c)||e.index.parent(l)?.localName.toLowerCase()!=="defs"||!t.direct(l))continue;let f=n.get(l)??[];if(f.length!==1)continue;let[p]=f;if(p.channel!=="href"&&p.channel!=="xlink-href")continue;let h=e.index.element(p.fromSourceNodeId);!h||h.localName.toLowerCase()!=="textpath"||e.index.parent(h.sourceNodeId)?.sourceNodeId===o.sourceNodeId&&(a.add(l),i.push(Object.freeze({pathSourceNodeId:l,textSourceNodeId:o.sourceNodeId,textOccurrenceId:o.occurrenceId})))}return i}function Yj(e,t,r,n,i,a,o,s){if(e!=="mask"||t||r!=="userSpaceOnUse"||n.length!==1||!dn(o))return!1;let l=n[0],u=i.candidate(l.occurrenceId);if(!u||u.status!=="materialized"||u.canonicalType!=="rectangle"&&u.canonicalType!=="square")return!1;let d=u.state;if(d.transformMatrix!==void 0||d.rawTransform!==void 0)return!1;let c=uC(a.value(l.occurrenceId,"fill")??"black");if(!c||c.r!==255||c.g!==255||c.b!==255||c.a!==1)return!1;let f=Number(a.value(l.occurrenceId,"fill-opacity")??1),p=Number(a.value(l.occurrenceId,"opacity")??1);if(f!==1||p!==1)return!1;let h=Number(d.x??0),m=Number(d.y??0),g=Number(d.width??d.size),v=Number(d.height??d.size),b=(y,I)=>Math.abs(y-I)<=1e-9;return b(h,0)&&b(m,0)&&b(g,s.viewport.width)&&b(v,s.viewport.height)}var Mh=new Set(["animate","animatemotion","animatetransform","discard","set"]),Kj=new Set(["mpath"]),Xd=new Set(["clippath","defs","filter","lineargradient","marker","mask","pattern","radialgradient","symbol"]),Fw=new Set(["a","g","switch","use"]),Ah=new Set(["desc","metadata","title"]),Zj=new Set([...Mh,...Ah,"circle","ellipse","line","path","polygon","polyline","rect","text","use"]);function Ls(e){if(!e||typeof e!="object"&&typeof e!="function"||Object.isFrozen(e))return e;for(let t of Object.values(e))Ls(t);return Object.freeze(e)}function Lw(e){if(e.namespaceUri!==ye)return null;let t=e.localName.toLowerCase();return t==="clippath"?"clip":t==="mask"?"mask":null}function fl(e,t,r,n,i){let a=Lw(t)??"clip";return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:a==="clip"?"clip-definitions":"mask-definitions",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:`${t.name} ${n} value ${i} is invalid and uses its initial value.`})}function Xf(e,t,r,n,i,a){let o=j(t,i);return o===null||o===""?a:o==="userSpaceOnUse"||o==="objectBoundingBox"?o:(n.push(fl(e,t,r,i,o)),a)}function Hf(e,t,r,n,i,a,o,s,l){let u=n.value(r.occurrenceId,o)??j(t,o);if(u===null||u.trim()==="")return l;let d=u.trim();return s.includes(d)?d:(a.push(fl(e,t,i,o,u)),l)}function Jj(e,t,r,n){let i={x:j(t,"x"),y:j(t,"y"),width:j(t,"width"),height:j(t,"height")},{x:a,y:o,width:s,height:l}=i;if([a,o,s,l].every(c=>c===null))return null;let u={x:"-10%",y:"-10%",width:"120%",height:"120%"},d=Object.fromEntries(Object.entries(i).map(([c,f])=>f===null?[c,u[c]]:jr(f)?[c,f]:(n.push(fl(e,t,r,c,f)),[c,u[c]])));return Object.freeze({x:d.x,y:d.y,width:d.width,height:d.height})}function K0(e){let t=jr(e);return!!(t&&t.value<=0)}function Bw(e,t,r){let n=e.parentOccurrenceId,i=new Set;for(;n;){if(n===t.occurrenceId)return!0;if(i.has(n))return!1;i.add(n),n=r.get(n)?.parentOccurrenceId??null}return!1}function Vw(e,t,r){let n=e.index.parent(t);for(;n&&n.sourceNodeId!==r;){if(Xd.has(n.localName.toLowerCase()))return!0;n=e.index.parent(n.sourceNodeId)}return n===null}function Ch(e,t,r){let n=new Map(r.map(i=>[i.occurrenceId,i]));return r.filter(i=>Bw(i,t,n)?!(i.usePath.length===0&&Vw(e,i.correspondingSourceNodeId,t.correspondingSourceNodeId)):!1)}function Oh(e,t,r,n){let i=e,a=new Set;for(;i&&i.occurrenceId!==t.occurrenceId;){if(a.has(i.occurrenceId)||(a.add(i.occurrenceId),n.value(i.occurrenceId,"display")==="none"))return!1;let o=n.value(i.occurrenceId,"visibility");if(o==="hidden"||o==="collapse")return!1;i=i.parentOccurrenceId?r.get(i.parentOccurrenceId):void 0}return i?.occurrenceId===t.occurrenceId}function Qj(e,t,r,n,i){let a=r.occurrences,o=new Map(n.candidates.map(u=>[u.occurrenceId,u])),s=new Set(r.resolutions.map(u=>u.useOccurrenceId)),l=new Map(a.map(u=>[u.occurrenceId,u]));for(let u of Ch(e,t,a)){if(!Oh(u,t,l,i)){if(u.occurrenceId!==t.occurrenceId)return!0;continue}let d=e.index.element(u.correspondingSourceNodeId);if(!d)return!0;let c=d.localName.toLowerCase();if(Mh.has(c)||Kj.has(c))continue;if(c==="style"||c==="script"||["clip-path","mask","filter"].some(p=>(i.value(u.occurrenceId,p)??"").includes("url(")))return!0;if(Ah.has(c))continue;if(Fw.has(c)){if(c!=="use")continue;return s.has(u.occurrenceId),!0}if(Xd.has(c)){if(u.usePath.length>0)return!0;continue}let f=o.get(u.occurrenceId);if(!f||f.status==="deferred")return!0}return!1}function eE(e,t,r,n,i){let a=new Map(n.candidates.map(u=>[u.occurrenceId,u])),o=new Set(r.resolutions.map(u=>u.useOccurrenceId)),s=new Map(r.occurrences.map(u=>[u.occurrenceId,u])),l=!1;for(let u of Ch(e,t,r.occurrences)){if(!Oh(u,t,s,i))continue;let d=e.index.element(u.correspondingSourceNodeId);if(!d)return!1;let c=d.localName.toLowerCase();if(Ah.has(c))continue;if(Mh.has(c)||c==="style"||c==="script"||["clip-path","mask","filter"].some(p=>(i.value(u.occurrenceId,p)??"").includes("url(")))return!1;if(c==="use"){if(u.parentOccurrenceId!==t.occurrenceId||u.usePath.length>0||j(d,"id")!==null||!o.has(u.occurrenceId))return!1;l=!0;continue}if(Fw.has(c)||Xd.has(c))return!1;let f=a.get(u.occurrenceId);if(!f||f.status!=="materialized")return!1}return l}function tE(e,t,r,n){let i=j(t,"transform");return i?_i(i)||(n.push(fl(e,t,r,"transform",i)),Pt):Pt}function rE(e,t,r,n,i,a,o){let s=Lw(t);if(!s)return null;let l=r.direct(t.sourceNodeId);if(!l)throw new Error(`SVG ${t.name} ${t.sourceNodeId} has no occurrence.`);let u=new Map(r.occurrences.map(E=>[E.occurrenceId,E])),d=i.candidates.flatMap(E=>{let C=u.get(E.occurrenceId);return!C||!Bw(C,l,u)||C.usePath.length===0&&Vw(e,E.sourceNodeId,t.sourceNodeId)||!Oh(C,l,u,n)?[]:E.status==="materialized"?[C]:[]}),c=s==="clip"&&r.resourcePolicy(t.sourceNodeId)?.status==="invalid",f=s==="clip"&&e.index.children(t.sourceNodeId).some(E=>!Zj.has(E.localName.toLowerCase()));if(f&&o.push(Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:a.source,entrypoint:a.entrypoint,capability:"clip-definitions",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:"A clipPath may directly contain only paths, text, basic shapes, use, animation, and descriptive elements."})),e.index.elements.some(E=>{if(E.namespaceUri!==ye||E.localName.toLowerCase()!=="use")return!1;let C=e.index.parent(E.sourceNodeId);for(;C&&C.sourceNodeId!==t.sourceNodeId;){if(Xd.has(C.localName.toLowerCase()))return!1;C=e.index.parent(C.sourceNodeId)}return C?.sourceNodeId===t.sourceNodeId})&&r.resourcePolicy(t.sourceNodeId)===null)throw new Error(`SVG ${t.name} ${t.sourceNodeId} requires a matching use resource-root plan.`);let p=s==="mask"?Jj(e,t,a,o):null,h=!!(p&&(K0(p.width)||K0(p.height))),m=Qj(e,l,r,i,n),g=m&&!eE(e,l,r,i,n)?[]:d,v=c||f?"invalid":h||!m&&d.length===0?"empty":"materialized",b=s==="clip"?Xf(e,t,a,o,"clipPathUnits","userSpaceOnUse"):null,y=s==="clip"?Hf(e,t,l,n,a,o,"clip-rule",["nonzero","evenodd"],"nonzero"):null,I=y==="evenodd"||n.style(l.occurrenceId)?.cascadedValues["clip-rule"]!==void 0?y:null,x=s==="mask"?Xf(e,t,a,o,"maskUnits","objectBoundingBox"):null,k=s==="mask"?Xf(e,t,a,o,"maskContentUnits","userSpaceOnUse"):null,$=s==="mask"?Hf(e,t,l,n,a,o,"mask-type",["luminance","alpha"],"luminance"):null,A=tE(e,t,a,o),S=Ls({sourceNodeId:t.sourceNodeId,sourceId:j(t,"id"),type:s,definitionPlacement:e.index.parent(t.sourceNodeId)===e.root?"document":"defs",status:v,representation:m?"raw":"decomposed",identity:Yj(s,m,k,d,i,n,A,a),clipPathUnits:b,clipRule:I,maskUnits:x,maskContentUnits:k,maskType:$,region:p,geometrySourceNodeIds:Object.freeze(m?[]:d.map(E=>E.correspondingSourceNodeId)),rawDefinition:m?t.rawXml??"":null}),M=new Map,T=new Map;for(let E of Ch(e,l,r.occurrences)){let C=e.index.element(E.correspondingSourceNodeId);if(C){if(!M.has(C.sourceNodeId)){let O=j(C,"transform");if(!O)M.set(C.sourceNodeId,Pt);else{let z=_i(O);z?M.set(C.sourceNodeId,z):(o.push(fl(e,C,a,"transform",O)),M.set(C.sourceNodeId,Pt))}}s==="clip"&&T.set(E.occurrenceId,Hf(e,C,E,n,a,o,"clip-rule",["nonzero","evenodd"],S.clipRule??"nonzero"))}}return Object.freeze({definition:S,element:t,occurrence:l,rootTransform:A,transformBySourceNodeId:M,clipRuleByOccurrenceId:T,geometryOccurrences:Object.freeze(g)})}function nE(e){return e.edges.filter(t=>t.binding==="applied-css"&&t.participation==="consumer"&&(t.kind==="clip-path"&&t.propertyName==="clip-path"||t.kind==="mask-image"&&(t.propertyName==="mask"||t.propertyName==="mask-image")))}function iE(e,t,r){let n=e.occurrenceId??t.direct(e.fromSourceNodeId)?.occurrenceId;if(!n)return null;let i=e.propertyName==="clip-path"?"clip":"mask",a=e.targetSourceNodeId?r.get(e.targetSourceNodeId):void 0,o=e.validity==="valid"&&a?.definition.type===i&&a.definition.status!=="invalid";return Object.freeze({bindingId:`clip-mask-binding:${e.resourceReferenceId}:${n}`,resourceReferenceId:e.resourceReferenceId,consumerOccurrenceId:n,consumerSourceNodeId:e.fromSourceNodeId,propertyName:e.propertyName==="clip-path"?"clip-path":"mask",authoredValue:e.propertyValue,targetAuthoredId:e.targetAuthoredId,targetSourceNodeId:e.targetSourceNodeId,definitionSourceNodeId:o?e.targetSourceNodeId??null:null,status:o?"materialized":"invalid-reference"})}function aE(e){return Re(Yt(e.x,e.y),zd(e.width,e.height))}function oE(e,t){let r=(e.definition.type==="clip"?e.definition.clipPathUnits:e.definition.maskContentUnits)==="objectBoundingBox"?aE(t):Pt;return Re(r,e.rootTransform)}function Mu(e,t,r,n,i){let a=r==="x"||r==="width",o=a?n.width:n.height,s=r==="x"?n.x:r==="y"?n.y:0;if(!jr(e))return null;if(t==="objectBoundingBox"){let u=at(e,{percentBasis:1,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize,fontSize:i.rootFontSize});return u===void 0?null:s+u*o}let l=at(e,{percentBasis:a?i.viewport.width:i.viewport.height,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize,fontSize:i.rootFontSize});return l===void 0?null:l}function sE(e,t,r){if(!e.region||!e.maskUnits)return null;let n=Mu(e.region.x,e.maskUnits,"x",t,r),i=Mu(e.region.y,e.maskUnits,"y",t,r),a=Mu(e.region.width,e.maskUnits,"width",t,r),o=Mu(e.region.height,e.maskUnits,"height",t,r);return n===null||i===null||a===null||o===null?null:Object.freeze({x:n,y:i,width:a,height:o})}function lE(e,t,r,n,i){let a=new Map(n.occurrences.map(c=>[c.occurrenceId,c])),o=[],s=r.parentOccurrenceId,l=new Set;for(;s&&s!==t.occurrence.occurrenceId&&!l.has(s);){l.add(s);let c=a.get(s);if(!c)break;o.push(c),s=c.parentOccurrenceId}let u=Pt,d=t.definition.type==="clip"?t.definition.clipPathUnits:t.definition.maskContentUnits;for(let c of o.reverse()){let f=e.index.element(c.correspondingSourceNodeId);if(f&&(u=Re(u,t.transformBySourceNodeId.get(f.sourceNodeId)??Pt),f.localName.toLowerCase()==="use")){let p=d==="objectBoundingBox"?1:i.viewport.width,h=d==="objectBoundingBox"?1:i.viewport.height,m=at(j(f,"x"),{percentBasis:p,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize})??0,g=at(j(f,"y"),{percentBasis:h,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,rootFontSize:i.rootFontSize})??0;u=Re(u,Yt(m,g))}}return u}function uE(e,t,r,n,i,a){let o=[],s=e.index.elements.flatMap(m=>{let g=rE(e,m,t,r,i,a,o);return g?[g]:[]}),l=new Map(s.map(m=>[m.definition.sourceNodeId,m])),u=nE(n).flatMap(m=>{let g=iE(m,t,l);return g?[g]:[]}),d=new Map;for(let m of u){let g=`${m.consumerOccurrenceId}\0${m.propertyName}`,v=d.get(g)??[];v.push(m),d.set(g,v)}let c=new Map([...d].map(([m,g])=>[m,Object.freeze(g)])),f=Object.freeze(s.map(m=>m.definition)),p=Object.freeze(u),h=Ls({definitions:f,bindings:p,definition(m){return l.get(m)?.definition??null},bindingsFor(m,g){return c.get(`${m}\0${g}`)??[]},binding(m,g,v){let b=c.get(`${m}\0${g}`)??[];return v===void 0?b[0]??null:b.find(y=>y.resourceReferenceId===v)??null},resolve(m,g){let v=m.definitionSourceNodeId?l.get(m.definitionSourceNodeId):void 0;if(!v||m.status!=="materialized")return Ls({status:"invalid-reference",contentMatrix:null,region:null,geometrySourceNodeIds:[],geometryPlacements:[],rawDefinition:null});let b=oE(v,g.consumerObjectBounds),y=(v.definition.clipPathUnits==="objectBoundingBox"||v.definition.maskContentUnits==="objectBoundingBox"||v.definition.maskUnits==="objectBoundingBox")&&(g.consumerObjectBounds.width===0||g.consumerObjectBounds.height===0),I=v.definition.status==="empty"||y,x=(I?[]:v.geometryOccurrences).map(k=>{let $=lE(e,v,k,t,a),A=Re(v.rootTransform,$);return Object.freeze({occurrenceId:k.occurrenceId,sourceNodeId:k.correspondingSourceNodeId,definitionMatrix:A,matrix:Re(b,$),clipRule:v.definition.type==="clip"?v.clipRuleByOccurrenceId.get(k.occurrenceId)??v.definition.clipRule??"nonzero":null})});return Ls({status:I?"empty":m.status,contentMatrix:b,region:sE(v.definition,g.consumerObjectBounds,a),geometrySourceNodeIds:I?[]:v.definition.geometrySourceNodeIds,geometryPlacements:x,rawDefinition:v.definition.rawDefinition})}});return Object.freeze({value:h,diagnostics:Object.freeze(o)})}var dE=new Set(["id","viewbox","preserveaspectratio","refx","refy","markerwidth","markerheight","markerunits","orient"]),cE=new Set(["a","circle","ellipse","foreignobject","g","image","line","path","polygon","polyline","rect","svg","switch","text","use"]),fE=new Set(["animate","animatemotion","animatetransform","set"]),pE="[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?",hE=new RegExp(`^(${pE})(deg|grad|rad|turn)?$`,"i");function mE(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let i=e[n]-t[n];if(i!==0)return i}return e.length-t.length}function gE(e,t){return mE(e.orderKey,t.orderKey)||e.productIndex-t.productIndex||e.occurrenceId.localeCompare(t.occurrenceId)}function ao(e,t,r,n,i,a){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:"markers",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:`Marker ${n} value ${i} ${a}.`})}function yE(e){let t=hE.exec(e.trim());if(!t)return null;let r=Number(t[1]);if(!Number.isFinite(r))return null;switch((t[2]??"deg").toLowerCase()){case"deg":return r;case"grad":return r*.9;case"rad":return r*180/Math.PI;case"turn":return r*360;default:return null}}function vE(e){let t=e.trim().split(/\s+/).filter(Boolean);if(t.length<1||t.length>2)return!1;let r=kh(e);return t[0]!==r.align?!1:t.length===1||t[1]==="meet"||t[1]==="slice"}function bE(e,t){let r=j(t,"data-ssk-marker-name");if(r!==null)return r;let n=e??"marker";return n.replace(/^marker[-_]?/i,"").replace(/[-_]/g," ")||n}function xE(e){let t={};for(let r of e.attributes)r.name==="xmlns"||r.prefix==="xmlns"||r.namespaceUri===null&&dE.has(r.localName.toLowerCase())||(t[r.name]=r.value);return Object.freeze(t)}function wE(e,t,r){let n=e.parentOccurrenceId,i=new Set;for(;n;){if(n===t)return!0;if(i.has(n))return!1;i.add(n),n=r.get(n)?.parentOccurrenceId??null}return!1}function IE(e,t,r){let n=new Map(t.occurrences.map(d=>[d.occurrenceId,d])),i=t.occurrences.filter(d=>wE(d,r.occurrenceId,n)).sort(gE),a=new Set,o=[],s=[],l=d=>{let c=d.parentOccurrenceId;for(;c&&c!==r.occurrenceId&&!a.has(c);)c=n.get(c)?.parentOccurrenceId??null;return c===r.occurrenceId?null:c},u=d=>{if(d.usePath.length>0)return!1;let c=d.parentOccurrenceId;for(;c&&c!==r.occurrenceId;){let f=n.get(c);if(!f)return!1;if(e.index.element(f.correspondingSourceNodeId)?.localName.toLowerCase()==="defs")return!0;c=f.parentOccurrenceId}return!1};for(let d of i){let c=e.index.element(d.correspondingSourceNodeId);if(!c||c.namespaceUri!==ye)continue;let f=c.localName.toLowerCase();if(fE.has(f)){s.push(Object.freeze({occurrenceId:d.occurrenceId,sourceNodeId:d.correspondingSourceNodeId,parentOccurrenceId:l(d),elementName:c.name,orderKey:Object.freeze([...d.orderKey])}));continue}if(!cE.has(f)||u(d))continue;let p=l(d);a.add(d.occurrenceId),o.push(Object.freeze({occurrenceId:d.occurrenceId,sourceNodeId:d.correspondingSourceNodeId,parentOccurrenceId:p,elementName:c.name,orderKey:Object.freeze([...d.orderKey])}))}return{content:Object.freeze(o),animations:Object.freeze(s)}}function kE(e,t,r,n,i){let a=[],o=new Map,s=[],l=n.resources.filter(d=>d.kind==="marker").sort((d,c)=>{let f=e.index.element(d.sourceNodeId)?.elementOrder??0,p=e.index.element(c.sourceNodeId)?.elementOrder??0;return f-p});for(let d of l){let c=e.index.element(d.sourceNodeId);if(!c||c.namespaceUri!==ye)continue;let f=t.occurrences.find(W=>W.correspondingSourceNodeId===d.sourceNodeId&&W.usePath.length===0);if(!f)continue;let p=j(c,"id"),h=r.style(f.occurrenceId),m=at(h?.resolvedValues["font-size"]??null,{fontSize:i.rootFontSize,rootFontSize:i.rootFontSize,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height}),g=m&&m>0?m:i.rootFontSize,v=j(c,"viewBox"),b=v===null?null:Nn(v),y=!1,I=!1;v!==null&&(!b||b.width<0||b.height<0?(y=!0,a.push(ao(e,c,i,"viewBox",v,"is not a valid four-number viewBox with non-negative dimensions"))):(b.width===0||b.height===0)&&(I=!0));let x=j(c,"preserveAspectRatio");x!==null&&!vE(x)&&(y=!0,a.push(ao(e,c,i,"preserveAspectRatio",x,"does not match the SVG preserveAspectRatio grammar")));let k={},$=W=>{let J=j(c,W);return J!==null&&(k[W]=J),J},A=$("markerWidth"),S=$("markerHeight"),M=W=>({percentBasis:W==="width"?i.viewport.width:i.viewport.height,viewportWidth:i.viewport.width,viewportHeight:i.viewport.height,fontSize:g,rootFontSize:i.rootFontSize}),T=(W,J,Q)=>{if(J===null)return 3;let Z=at(J,M(Q));return Z===void 0||Z<0?(y=!0,a.push(ao(e,c,i,W,J,Z===void 0?"is not a resolvable length":"must not be negative")),3):(Z===0&&(I=!0),Z)},E=T("markerWidth",A,"width"),C=T("markerHeight",S,"height"),O={width:b?.width??E,height:b?.height??C},z=W=>{let J=$(W);if(J===null)return 0;let Q=J.trim(),Z=W==="refX"?O.width:O.height;if(W==="refX"){if(Q==="left")return 0;if(Q==="center")return Z/2;if(Q==="right")return Z}else{if(Q==="top")return 0;if(Q==="center")return Z/2;if(Q==="bottom")return Z}let Ae=at(J,{...M(W==="refX"?"width":"height"),percentBasis:Z});return Ae!==void 0?Ae:(y=!0,a.push(ao(e,c,i,W,J,"is not a valid marker reference length or keyword")),0)},R=z("refX"),U=z("refY"),V=$("markerUnits"),Y="strokeWidth";V==="userSpaceOnUse"?Y="userSpaceOnUse":V!==null&&V!=="strokeWidth"&&(y=!0,a.push(ao(e,c,i,"markerUnits",V,"must be strokeWidth or userSpaceOnUse")));let G=$("orient"),H=0;if(G==="auto"||G==="auto-start-reverse")H=G;else if(G!==null){let W=yE(G);W===null?(y=!0,a.push(ao(e,c,i,"orient",G,"is not an orientation keyword, number, or angle"))):H=W}let X=j(c,"overflow"),B=X==="visible"||X==="hidden"?X:void 0,ae=IE(e,t,f),K=Object.freeze({sourceNodeId:c.sourceNodeId,sourceId:p,name:bE(p,c),status:y?"invalid":I?"empty":"materialized",...v!==null?{viewBox:v}:{},...x!==null?{preserveAspectRatio:x}:{},refX:R,refY:U,markerWidth:E,markerHeight:C,markerUnits:Y,orient:H,...B?{overflow:B}:{},authoredGeometry:Object.freeze(k),rootAttributes:xE(c),content:ae.content,animations:ae.animations});o.set(K.sourceNodeId,K),s.push(K)}let u=Object.freeze({candidates:Object.freeze(s),candidate:d=>o.get(d)??null});return Object.freeze({value:u,diagnostics:Object.freeze(a)})}var Uw=["x1","y1","x2","y2"],SE=["cx","cy","r","fx","fy","fr"],Z0=Object.freeze({x1:0,y1:0,x2:1,y2:0});function pl(e){return e.namespaceUri!==ye?null:e.localName.toLowerCase()==="lineargradient"?"linear-gradient":e.localName.toLowerCase()==="radialgradient"?"radial-gradient":null}function Ci(e,t,r,n,i,a){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:"gradients",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:`Gradient ${n} value ${i} ${a}.`})}function $E(e,t,r){let n=[r],i=new Set([r.sourceNodeId]);for(let a of t.templateChain(r.sourceNodeId)){if(a.validity!=="valid"||!a.targetSourceNodeId||i.has(a.targetSourceNodeId))break;let o=e.index.element(a.targetSourceNodeId);if(!o||!pl(o))break;i.add(o.sourceNodeId),n.push(o)}return n}function J0(e,t,r){for(let n of e){if(r&&pl(n)!==r)continue;let i=j(n,t);if(i!==null)return i}return null}function Q0(e,t,r){for(let n of e){if(r&&pl(n)!==r)continue;let i=j(n,t);if(i!==null)return Object.freeze({raw:i,ownerSourceNodeId:n.sourceNodeId})}return null}function NE(e,t,r,n){let i=e.direct(r.sourceNodeId);return i?t.value(i.occurrenceId,n):null}function Gw(e,t,r,n){let i=e.direct(r.sourceNodeId),a=i?t.style(i.occurrenceId):null;return a?.cascadedValues[n]?a.resolvedValues[n]??a.specifiedValues[n]??null:j(r,n)}function _p(e){let t=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*(%)?$/u.exec(e.trim());if(!t)return null;let r=Number(t[1]);return Number.isFinite(r)?t[2]?r/100:r:null}function ev(e,t,r,n){let i=NE(e,t,r,"font-size"),a=at(i,{percentBasis:n.rootFontSize,viewportWidth:n.viewport.width,viewportHeight:n.viewport.height,fontSize:n.rootFontSize,rootFontSize:n.rootFontSize});return a!==void 0&&a>0?a:n.rootFontSize}function Bs(e,t,r,n){if(t==="objectBoundingBox")return _p(e);let i=r==="x"?n.viewport.width:r==="y"?n.viewport.height:Math.hypot(n.viewport.width,n.viewport.height)/Math.SQRT2;return at(e,{percentBasis:i,viewportWidth:n.viewport.width,viewportHeight:n.viewport.height,fontSize:n.fontSize,rootFontSize:n.rootFontSize})??null}function Vs(e){return e==="r"||e==="fr"?"radius":e.endsWith("x")||e==="x1"||e==="x2"||e==="cx"||e==="fx"?"x":"y"}function Ww(e,t){let r={};if(e.type==="linear-gradient"){for(let i of Uw){let a=e.authoredGeometry[i];r[i]=a===void 0?Z0[i]:Bs(a,e.gradientUnits,Vs(i),t)??Z0[i]}return Object.freeze(r)}let n=Object.freeze({cx:.5,cy:.5,r:.5,fr:0});for(let i of["cx","cy","r","fr"]){let a=e.authoredGeometry[i];r[i]=a===void 0?n[i]:Bs(a,e.gradientUnits,Vs(i),t)??n[i]}for(let i of["fx","fy"]){let a=e.authoredGeometry[i],o=i==="fx"?r.cx:r.cy;r[i]=a===void 0?o:Bs(a,e.gradientUnits,Vs(i),t)??o}return Object.freeze(r)}function tv(e){return e.children.filter(t=>t.kind==="element"&&t.namespaceUri===ye&&t.localName.toLowerCase()==="stop")}function ME(e,t,r,n,i,a){let o=t.find(p=>tv(p).length>0)??null,s=o?tv(o):[],l=[],u=0,d=t[0],c=r.direct(d.sourceNodeId),f=c?n.value(c.occurrenceId,"color"):null;for(let p of s){let h=j(p,"offset")??"0",m=_p(h);m===null&&a.push(Ci(e,p,i,"offset",h,"is not a number or percentage"));let g=Math.min(1,Math.max(0,m??0)),v=Math.max(u,g);u=v;let b=r.direct(p.sourceNodeId),y=b?n.style(b.occurrenceId):null,I=(y?.cascadedValues["stop-color"]?y.specifiedValues["stop-color"]??y.resolvedValues["stop-color"]:j(p,"stop-color"))??"black",x=I.trim().toLowerCase(),k=/(?:^|[^-_a-z0-9])var\(/iu.test(I),$=x==="currentcolor"?f??"black":k?I:y?.resolvedValues["stop-color"]??I,A=Gw(r,n,p,"stop-opacity")??"1",S=_p(A);S===null&&a.push(Ci(e,p,i,"stop-opacity",A,"is not a number or percentage"));let M=Math.min(1,Math.max(0,S??1));$.trim().toLowerCase()==="transparent"&&($="black",M=0),l.push(Object.freeze({occurrenceId:o?.sourceNodeId===d.sourceNodeId&&b?b.occurrenceId:`gradient-stop:${c?.occurrenceId??d.sourceNodeId}:${p.sourceNodeId}`,sourceNodeId:p.sourceNodeId,correspondingSourceNodeId:p.sourceNodeId,hostGradientSourceNodeId:d.sourceNodeId,offsetAuthored:j(p,"offset"),offset:v,color:$,opacity:M}))}return Object.freeze(l)}function AE(e,t,r,n,i,a,o){let s=pl(t),l=$E(e,i,t),u=j(t,"id"),d=r.direct(t.sourceNodeId)?.occurrenceId??t.sourceNodeId,c=e.index.parent(t.sourceNodeId)===e.root?"document":"defs",f=J0(l,"gradientUnits"),p=!1,h="objectBoundingBox";f==="userSpaceOnUse"?h="userSpaceOnUse":f!==null&&f!=="objectBoundingBox"&&o.push(Ci(e,t,a,"gradientUnits",f,"must be objectBoundingBox or userSpaceOnUse"));let m=J0(l,"spreadMethod"),g="pad";m==="reflect"||m==="repeat"?g=m:m!==null&&m!=="pad"&&o.push(Ci(e,t,a,"spreadMethod",m,"must be pad, reflect, or repeat"));let v=Gw(r,n,t,"color-interpolation"),b="sRGB";v==="auto"||v==="linearRGB"?b=v:v!==null&&v!=="sRGB"&&o.push(Ci(e,t,a,"color-interpolation",v,"must be auto, sRGB, or linearRGB"));let y={},I={},x=s==="linear-gradient"?Uw:SE;for(let E of x){let C=Q0(l,E,s);if(!C)continue;y[E]=C.raw;let O=Bs(C.raw,h,Vs(E),{viewport:a.viewport,fontSize:ev(r,n,t,a),rootFontSize:a.rootFontSize});I[E]=Object.freeze({...C,validity:O===null?"invalid":"valid"})}let k=Q0(l,"gradientTransform"),$=k?.raw??null,A=_i($??"");k&&(y.gradientTransform=k.raw,I.gradientTransform=Object.freeze({...k,validity:A===null?"invalid":"valid"}),A===null&&o.push(Ci(e,t,a,"gradientTransform",k.raw,"does not match the SVG transform-list grammar")));for(let[E,C]of Object.entries(I))E==="gradientTransform"||C.validity==="valid"||o.push(Ci(e,t,a,E,C.raw,"is not a valid gradient coordinate"));if(s==="radial-gradient")for(let E of["r","fr"]){let C=I[E];if(!C||C.validity!=="valid")continue;let O=Bs(C.raw,h,Vs(E),{viewport:a.viewport,fontSize:ev(r,n,t,a),rootFontSize:a.rootFontSize});O!==null&&O<0&&(p=!0,o.push(Ci(e,t,a,E,C.raw,"must not be negative")))}let S=ME(e,l,r,n,a,o),M=Object.freeze(Zr(A??[1,0,0,1,0,0])),T=I.gradientTransform??null;return Object.freeze({occurrenceId:d,sourceNodeId:t.sourceNodeId,sourceId:u,definitionPlacement:c,type:s,status:p?"invalid":S.length===0?"empty":"materialized",gradientUnits:h,spreadMethod:g,colorInterpolation:b,authoredGeometry:Object.freeze(y),geometryValues:Object.freeze(I),transform:Object.freeze({authored:T,matrix:M}),stops:S,templateSourceNodeIds:Object.freeze(l.map(E=>E.sourceNodeId))})}function CE(e,t){let r=e.edges.flatMap(n=>{if(n.binding!=="applied-css"||!n.occurrenceId||n.propertyName!=="fill"&&n.propertyName!=="stroke")return[];let i=n.targetSourceNodeId?t.get(n.targetSourceNodeId):void 0,a=sl(n.propertyValue)[n.tokenIndex],o=a?n.propertyValue.slice(a.tokenEnd).trim():"",s=a?!o||o.toLowerCase()==="none"?Object.freeze({kind:"none"}):Object.freeze({kind:"color",value:o}):Object.freeze({kind:"unresolved",authoredValue:n.propertyValue}),l=i?i.status:n.validity==="missing"||n.validity==="invalid-target"?"invalid-reference":"other-paint-server";return[Object.freeze({resourceReferenceId:n.resourceReferenceId,occurrenceId:n.occurrenceId,sourceNodeId:n.fromSourceNodeId,correspondingSourceNodeId:n.fromSourceNodeId,propertyName:n.propertyName,authoredValue:n.propertyValue,gradientSourceNodeId:i?.sourceNodeId??null,status:l,fallback:s})]});return Object.freeze(r)}function OE(e,t,r,n,i){let a=[],o=n.resources.filter(c=>c.kind==="gradient").map(c=>e.index.element(c.sourceNodeId)).filter(c=>!!(c&&pl(c))).sort((c,f)=>c.elementOrder-f.elementOrder).map(c=>AE(e,c,t,r,n,i,a)),s=new Map(o.map(c=>[c.sourceNodeId,c])),l=CE(n,s),u=new Map;for(let c of l){let f=u.get(c.occurrenceId)??[];f.push(c),u.set(c.occurrenceId,f)}for(let c of u.values())Object.freeze(c);let d=Object.freeze({candidates:Object.freeze(o),bindings:l,candidate:c=>s.get(c)??null,bindingsFor:c=>u.get(c)??Object.freeze([]),binding:(c,f,p)=>(u.get(c)??[]).find(h=>h.propertyName===f&&(p===void 0||h.resourceReferenceId===p))??null,resolveGeometry:(c,f)=>{let p=c.gradientSourceNodeId?s.get(c.gradientSourceNodeId):null;return p?Ww(p,f):null}});return Object.freeze({value:d,diagnostics:Object.freeze(a)})}var TE=["x","y","width","height"],PE=new Set(["desc","metadata","title"]),DE=new Set(["defs","lineargradient","marker","mask","metadata","pattern","radialgradient","script","style","symbol","title"]),jE=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)\s*(%)?$/u,EE=/^(?:none|x(?:Min|Mid|Max)Y(?:Min|Mid|Max))(?:\s+(?:meet|slice))?$/u;function Xw(e){return!!(e&&e.namespaceUri===ye&&e.localName.toLowerCase()==="pattern")}function Hw(e){let t=jE.exec(e.trim());if(!t)return null;let r=Number(t[1]);return Number.isFinite(r)?t[2]?r/100:r:null}function zE(e){if(e===null)return Object.freeze({value:"xMidYMid meet",valid:!0});let t=e.trim().replace(/\s+/gu," "),r=EE.test(t),n=kh(r?t:null);return Object.freeze({value:`${n.align}${n.align==="none"&&!t.includes(" ")?"":` ${n.meetOrSlice}`}`,valid:r})}function ia(e,t,r,n,i,a){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,capability:"patterns",sourceId:j(t,"id")??void 0,sourceNodeId:t.sourceNodeId,elementName:t.name,documentPath:e.index.sourcePath(t.sourceNodeId),message:`Pattern ${n} value ${i} ${a}.`})}function RE(e,t,r){let n=[r],i=new Set([r.sourceNodeId]);for(let a of t.templateChain(r.sourceNodeId)){if(a.validity!=="valid"||!a.targetSourceNodeId||i.has(a.targetSourceNodeId))break;let o=e.index.element(a.targetSourceNodeId);if(!Xw(o))break;i.add(o.sourceNodeId),n.push(o)}return Object.freeze(n)}function oo(e,t){for(let r of e){let n=j(r,t);if(n!==null)return Object.freeze({raw:n,ownerSourceNodeId:r.sourceNodeId})}return null}function _E(e){return e.children.filter(t=>t.kind==="element"&&!PE.has(t.localName.toLowerCase()))}function FE(e){return e.find(t=>_E(t).length>0)??null}function LE(e,t,r){let n=e;for(;n;){if(n.occurrenceId===t)return!0;n=n.parentOccurrenceId?r.get(n.parentOccurrenceId):void 0}return!1}function BE(e,t,r,n){let i=t;for(;i&&i.correspondingSourceNodeId!==r;){let a=e.index.element(i.correspondingSourceNodeId);if(a&&DE.has(a.localName.toLowerCase())&&!(a.localName.toLowerCase()==="symbol"&&i.usePath.length>0))return!1;i=i.parentOccurrenceId?n.get(i.parentOccurrenceId):void 0}return!!i}function VE(e,t,r,n){if(!n)return Object.freeze([]);let i=t.direct(n.sourceNodeId);if(!i)return Object.freeze([]);let a=new Map(t.occurrences.map(u=>[u.occurrenceId,u])),o=t.occurrences.filter(u=>u.occurrenceId!==i.occurrenceId&&LE(u,i.occurrenceId,a)&&BE(e,u,n.sourceNodeId,a)),s=new Set(o.map(u=>u.occurrenceId)),l=new Map(o.map(u=>[u.occurrenceId,`pattern-content:${r.sourceNodeId}:${u.occurrenceId}`]));return Object.freeze(o.map(u=>Object.freeze({occurrenceId:l.get(u.occurrenceId),sourceOccurrenceId:u.occurrenceId,sourceNodeId:u.correspondingSourceNodeId,correspondingSourceNodeId:u.correspondingSourceNodeId,hostPatternSourceNodeId:r.sourceNodeId,parentOccurrenceId:u.parentOccurrenceId&&s.has(u.parentOccurrenceId)?l.get(u.parentOccurrenceId)??null:null,role:u.role,shadow:u.usePath.length>0,orderKey:Object.freeze([...u.orderKey])})))}function UE(e,t,r){if(!t)return Object.freeze([]);let n=new Set(r.map(a=>a.sourceOccurrenceId)),i=new Set(r.map(a=>a.correspondingSourceNodeId));return Object.freeze(e.edges.filter(a=>a.participation==="resource-product"&&a.containingResourceSourceNodeId===t.sourceNodeId&&(a.occurrenceId!==null&&n.has(a.occurrenceId)||i.has(a.fromSourceNodeId))&&a.kind!=="pattern-template"))}function GE(e,t){if(t.length===0)return Object.freeze([]);let r=new Map(e.resources.map(n=>[n.sourceNodeId,n]));return Object.freeze(e.closureFromEdges(t).materializations.map(n=>{let i=r.get(n.sourceNodeId);return Object.freeze({sourceNodeId:n.sourceNodeId,sourceId:i?.authoredId??null,kind:i?.kind??"referenced-fragment",viaResourceReferenceId:n.viaResourceReferenceId})}))}function WE(e,t,r,n){return t==="objectBoundingBox"?Hw(e)===null?"invalid":"valid":at(e,{percentBasis:r==="x"?n.viewport.width:n.viewport.height,viewportWidth:n.viewport.width,viewportHeight:n.viewport.height,fontSize:n.rootFontSize,rootFontSize:n.rootFontSize})===void 0?"invalid":"valid"}function bo(e,t,r,n,i){return e===void 0?i:t==="objectBoundingBox"?Hw(e)??i:at(e,{percentBasis:r==="x"?n.viewport.width:n.viewport.height,viewportWidth:n.viewport.width,viewportHeight:n.viewport.height,fontSize:n.fontSize,rootFontSize:n.rootFontSize})??i}function XE(e,t){if(e.status!=="materialized")return null;let r=bo(e.values.x?.raw,e.patternUnits,"x",t,0),n=bo(e.values.y?.raw,e.patternUnits,"y",t,0),i=bo(e.values.width?.raw,e.patternUnits,"x",t,0),a=bo(e.values.height?.raw,e.patternUnits,"y",t,0);return e.patternUnits==="userSpaceOnUse"?Object.freeze({x:r,y:n,width:i,height:a}):Object.freeze({x:t.objectBounds.x+r*t.objectBounds.width,y:t.objectBounds.y+n*t.objectBounds.height,width:i*t.objectBounds.width,height:a*t.objectBounds.height})}function HE(e,t,r,n,i,a){let o=RE(e,n,t),s=j(t,"id"),l=r.direct(t.sourceNodeId)?.occurrenceId??t.sourceNodeId,u=oo(o,"patternUnits"),d="objectBoundingBox";u?.raw==="userSpaceOnUse"?d="userSpaceOnUse":u&&u.raw!=="objectBoundingBox"&&a.push(ia(e,t,i,"patternUnits",u.raw,"must be objectBoundingBox or userSpaceOnUse"));let c=oo(o,"patternContentUnits"),f="userSpaceOnUse";c?.raw==="objectBoundingBox"?f="objectBoundingBox":c&&c.raw!=="userSpaceOnUse"&&a.push(ia(e,t,i,"patternContentUnits",c.raw,"must be objectBoundingBox or userSpaceOnUse"));let p=!1,h={};for(let G of TE){let H=oo(o,G);if(!H)continue;let X=WE(H.raw,d,G==="x"||G==="width"?"x":"y",i);h[G]=Object.freeze({...H,validity:X}),X==="invalid"&&a.push(ia(e,t,i,G,H.raw,"is not a valid pattern coordinate"))}let m={viewport:i.viewport,objectBounds:{x:0,y:0,width:1,height:1},fontSize:i.rootFontSize,rootFontSize:i.rootFontSize},g=bo(h.width?.raw,d,"x",m,0),v=bo(h.height?.raw,d,"y",m,0);for(let[G,H]of[["width",g],["height",v]])h[G]?.validity==="valid"&&H<0&&(p=!0,a.push(ia(e,t,i,G,h[G].raw,"must not be negative")));let b=oo(o,"patternTransform"),y=b?_i(b.raw):[1,0,0,1,0,0],I=y===null?"invalid":"valid";b&&I==="invalid"&&a.push(ia(e,t,i,"patternTransform",b.raw,"does not match the SVG transform-list grammar"));let x=Object.freeze({raw:b?.raw??null,ownerSourceNodeId:b?.ownerSourceNodeId??null,matrix:Object.freeze(Zr(y??[1,0,0,1,0,0])),validity:I}),k=oo(o,"viewBox"),$=k?Nn(k.raw):null,A="valid";k&&(!$||$.width<0||$.height<0)&&(A="invalid",a.push(ia(e,t,i,"viewBox",k.raw,"must be four numbers with non-negative width and height")));let S=k?Object.freeze({...k,validity:A}):null,M=$&&A==="valid"?Object.freeze([$.x,$.y,$.width,$.height]):null,T=oo(o,"preserveAspectRatio"),E=zE(T?.raw??null);T&&!E.valid&&a.push(ia(e,t,i,"preserveAspectRatio",T.raw,"does not match the preserveAspectRatio grammar"));let C=T?Object.freeze({...T,validity:E.valid?"valid":"invalid"}):null,O=FE(o),z=VE(e,r,t,O),R=UE(n,O,z),U=GE(n,R),V=!!(M&&(M[2]===0||M[3]===0)),Y=p?"invalid":!O||g===0||v===0||V?"empty":"materialized";return Object.freeze({occurrenceId:l,sourceNodeId:t.sourceNodeId,sourceId:s,status:Y,patternUnits:d,patternContentUnits:f,values:Object.freeze(h),transform:x,viewBox:M,viewBoxAuthored:S,preserveAspectRatio:E.value,preserveAspectRatioAuthored:C,templateSourceNodeIds:Object.freeze(o.map(G=>G.sourceNodeId)),contentProviderSourceNodeId:O?.sourceNodeId??null,contentOccurrences:z,contentOccurrenceIds:Object.freeze(z.map(G=>G.occurrenceId)),resources:U})}function qE(e,t){return Object.freeze(e.edges.flatMap(r=>{if(r.binding!=="applied-css"||!r.occurrenceId||r.propertyName!=="fill"&&r.propertyName!=="stroke")return[];let n=r.targetSourceNodeId?t.get(r.targetSourceNodeId):void 0,i=sl(r.propertyValue)[r.tokenIndex],a=i?r.propertyValue.slice(i.tokenEnd).trim():"",o=i?!a||a.toLowerCase()==="none"?Object.freeze({kind:"none"}):Object.freeze({kind:"color",value:a}):Object.freeze({kind:"unresolved",authoredValue:r.propertyValue}),s=r.validity==="missing"||r.validity==="invalid-target"?"invalid-reference":n?n.status:"other-paint-server";return[Object.freeze({resourceReferenceId:r.resourceReferenceId,consumerOccurrenceId:r.occurrenceId,occurrenceId:r.occurrenceId,sourceNodeId:r.fromSourceNodeId,correspondingSourceNodeId:r.fromSourceNodeId,propertyName:r.propertyName,authoredValue:r.propertyValue,patternSourceNodeId:n?.sourceNodeId??null,status:s,fallback:o})]}))}function YE(e,t,r,n,i){let a=[],o=n.resources.filter(c=>c.kind==="pattern").map(c=>e.index.element(c.sourceNodeId)).filter(Xw).sort((c,f)=>c.elementOrder-f.elementOrder).map(c=>HE(e,c,t,n,i,a)),s=new Map(o.map(c=>[c.sourceNodeId,c])),l=qE(n,s),u=new Map;for(let c of l){let f=u.get(c.occurrenceId)??[];f.push(c),u.set(c.occurrenceId,f)}for(let c of u.values())Object.freeze(c);let d=Object.freeze({candidates:Object.freeze(o),bindings:l,candidate:c=>s.get(c)??null,bindingsFor:c=>u.get(c)??Object.freeze([]),binding:(c,f,p)=>(u.get(c)??[]).find(h=>h.propertyName===f&&(p===void 0||h.resourceReferenceId===p))??null,resolveTile:(c,f)=>{let p=c.patternSourceNodeId?s.get(c.patternSourceNodeId):null;return p?XE(p,f):null}});return Object.freeze({value:d,diagnostics:Object.freeze(a)})}var qw=new Map([["clippath","clipPath"],["filter","filter"],["lineargradient","linearGradient"],["mask","mask"],["pattern","pattern"],["radialgradient","radialGradient"],["symbol","symbol"]]),KE=new Set(["clipPathUnits","filterUnits","gradientUnits","maskContentUnits","maskUnits","patternContentUnits","patternUnits","primitiveUnits","spreadMethod"]);function rv(e,t){let r=e.index.parent(t.sourceNodeId);if(!r)return;let n=0;for(let i of r.children)if(i.kind==="element"){if(i.sourceNodeId===t.sourceNodeId)return n;n++}}function nv(e,t){let r=t;for(;r;){let n=e.index.parent(r.sourceNodeId);if(n?.sourceNodeId===e.root.sourceNodeId){if(r.namespaceUri!==ye||r.localName.toLowerCase()!=="defs")return;let i=0;for(let a of e.root.children)if(!(a.kind!=="element"||a.namespaceUri!==ye||a.localName.toLowerCase()!=="defs")&&(i++,a.sourceNodeId===r.sourceNodeId))return`svg-definition-container-${i}`;return}r=n}}function iv(e,t){let r=new Set(t.attributes.filter(a=>a.prefix==="xmlns").map(a=>a.name)),n=new Map,i=e.index.parent(t.sourceNodeId);for(;i;){for(let a of i.attributes)a.prefix==="xmlns"&&(r.has(a.name)||n.has(a.name)||n.set(a.name,a));i=e.index.parent(i.sourceNodeId)}return Object.freeze([...n.values()])}function Th(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Au(e){return Th(e).replaceAll('"',"&quot;")}function ZE(e){switch(e.kind){case"text":return Th(e.value);case"comment":return`<!--${e.value}-->`;case"cdata":return`<![CDATA[${e.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;case"processing-instruction":return`<?${e.value}?>`;case"doctype":return`<!DOCTYPE ${e.value}>`}}function Fp(e,t,r=[],n=!1){if(e.namespaceUri===ye&&e.localName.toLowerCase()==="script"||n&&e.namespaceUri===ye&&["animate","animatemotion","animatetransform","discard","set"].includes(e.localName.toLowerCase())&&!vr(e))return"";let i=t.identifierBySourceNodeId.get(e.sourceNodeId),a=t.generatedIdBySourceNodeId.get(e.sourceNodeId),o=t.attributeRewrites.get(e.sourceNodeId),s=[],l=!1,u=!1;for(let h of r)s.push(`${h.name}="${Au(h.value)}"`);for(let h of e.attributes){if(/^on/iu.test(h.name))continue;h.name==="data-source-id"&&(l=!0),h.localName==="id"&&h.namespaceUri===null&&(u=!0);let m=h.localName==="id"&&h.namespaceUri===null&&i?i.liveId:h.localName==="id"&&h.namespaceUri===null&&a?a:o?.get(h.name)??h.value;m===""&&KE.has(h.name)||s.push(`${h.name}="${Au(m)}"`)}i?.restoreSourceId&&!l&&s.push(`data-source-id="${Au(i.sourceId)}"`),a&&!u&&s.push(`id="${Au(a)}"`);let d=`<${e.name}${s.length>0?` ${s.join(" ")}`:""}`,c=t.textRewrites.get(e.sourceNodeId),f=c!==void 0?Th(c):e.children.map(h=>h.kind==="element"?Fp(h,t,[],n):ZE(h)).join(""),p=/\/\s*>\s*$/u.test(e.rawXml??"");return f.length===0&&p?`${d}/>`:`${d}>${f}</${e.name}>`}function JE(e){let t=new Map(e.resourceIds.map(i=>[i.sourceNodeId,i])),r=new Map,n=new Map;for(let i of e.rewrites){if(i.target==="text-content"){n.set(i.sourceNodeId,i.value);continue}if(!i.name)continue;let a=r.get(i.sourceNodeId)??new Map;a.set(i.name,i.value),r.set(i.sourceNodeId,a)}return{identifierBySourceNodeId:t,attributeRewrites:new Map([...r].map(([i,a])=>[i,a])),textRewrites:n,generatedIdBySourceNodeId:new Map(e.generatedIds.map(({sourceNodeId:i,liveId:a})=>[i,a]))}}function Yw(e,t){let r=e.index.parent(t);for(;r;){if(r.namespaceUri===ye&&r.localName.toLowerCase()==="defs")return!0;r=e.index.parent(r.sourceNodeId)}return!1}function QE(e){return e.definition.definitionChildIds&&Object.freeze(e.definition.definitionChildIds),e.definition.sourceDefinitionChildIds&&Object.freeze(e.definition.sourceDefinitionChildIds),Object.freeze(e.definition),Object.freeze(e)}function Kw(e,t,r){if(t.namespaceUri!==ye||t.localName.toLowerCase()!=="g"||!Yw(e,t.sourceNodeId))return null;let n=t.children.filter(a=>a.kind==="element");if(n.length===0)return null;let i=[];for(let a of n){if(a.namespaceUri!==ye)return null;let o=qw.get(a.localName.toLowerCase()),s=Kw(e,a,r);if(!o&&!s)return null;let l=r.identifierBySourceNodeId.get(a.sourceNodeId);if(!l)return null;i.push({sourceId:l.liveId,destinationId:l.liveId})}return i}function ez(e,t,r){let n=[],i=JE(t),a=[];for(let u of e.index.elements){if(u.namespaceUri!==ye)continue;let d=qw.get(u.localName.toLowerCase()),c=Kw(e,u,i);if(!d&&!c)continue;let f=j(u,"id");if(!f)continue;let p=i.identifierBySourceNodeId.get(u.sourceNodeId);if(!p){n.push({severity:"warning",code:"invalid-svg-attribute",source:r.source,entrypoint:r.entrypoint,message:`Definition ${f} has no destination identifier assignment.`,documentPath:e.index.sourcePath(u.sourceNodeId),elementName:u.name,sourceId:f,sourceNodeId:u.sourceNodeId,capability:"paint-server-definitions"});continue}let h={id:p.liveId,sourceId:p.liveId,type:d??u.localName,...rv(e,u)!==void 0?{definitionOrder:rv(e,u)}:{},...nv(e,u)?{definitionContainerId:nv(e,u)}:{},...c?{role:"referenced-fragment",definitionChildIds:c.map(m=>m.destinationId),sourceDefinitionChildIds:c.map(m=>m.sourceId)}:{},markup:Fp(u,i,iv(e,u),d==="clipPath"||d==="mask"),passthrough:!0};a.push(QE({sourceNodeId:u.sourceNodeId,sourceId:f,destinationId:p.liveId,type:d??u.localName,insideDefs:Yw(e,u.sourceNodeId),definition:h}))}let o=Object.freeze(a),s=new Map(o.map(u=>[u.sourceNodeId,u])),l=Object.freeze({candidates:o,candidate:u=>s.get(u)??null,definitionForSourceNode(u,d="referenced-fragment"){let c=s.get(u);if(c)return c.definition;let f=e.index.element(u);if(!f||f.namespaceUri!==ye)return null;let p=i.identifierBySourceNodeId.get(u),h=j(f,"id"),m=p?.liveId??h;return m?Object.freeze({id:m,sourceId:m,type:f.localName,role:d,markup:Fp(f,i,iv(e,f)),passthrough:!0}):null},definitions:(u=new Set)=>Object.freeze(o.filter(d=>!u.has(d.sourceNodeId)).map(d=>d.definition))});return Object.freeze({value:l,diagnostics:Object.freeze(n)})}var Cu=Object.freeze({x:"-10%",y:"-10%",width:"120%",height:"120%"}),tz=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,rz=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(%)?$/u,nz=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(deg|grad|rad|turn)?$/iu,iz=new Set(["animate","animatemotion","animatetransform","set"]),az=new Set(["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]);function ba(e){if(!e||typeof e!="object"&&typeof e!="function"||Object.isFrozen(e))return e;for(let t of Object.values(e))ba(t);return Object.freeze(e)}function Ei(e){return e.children.filter(t=>t.kind==="element")}function av(e){let t="",r=[...e.children].reverse();for(;r.length>0;){let n=r.pop();n.kind==="text"||n.kind==="cdata"?t+=n.value:n.kind==="element"&&r.push(...[...n.children].reverse())}return t}function oz(e){return(e.rawXml??"").replace(/\s+xmlns="http:\/\/www\.w3\.org\/2000\/svg"/gu,"").replace(/\s+xmlns=""/gu,"")}function Qn(e){if(e===null||!tz.test(e.trim()))return;let t=Number(e.trim());return Number.isFinite(t)?t:void 0}function aa(e,t){let r=j(e,t);return r===null?void 0:r}function Hd(e,t,r=""){return`${e}:${t}${r}`}function qu(e,t,r,n){return Object.freeze({severity:"warning",code:"invalid-svg-attribute",source:e.source,entrypoint:e.entrypoint,capability:"filters",sourceNodeId:r.sourceNodeId,sourceId:j(r,"id")??void 0,occurrenceId:n,elementName:r.name,message:t})}function sz(e){let t=[...Ei(e)];for(;t.length>0;){let r=t.pop();if(r.namespaceUri===ye&&r.localName.toLowerCase()==="script")return!0;t.push(...Ei(r))}return!1}function ov(e,t,r){let n=t.direct(e.sourceNodeId);return n?r.value(n.occurrenceId,"display"):j(e,"display")}function lz(e,t,r,n){if(ov(t,r,n)?.trim().toLowerCase()==="none")return!0;let i=e.index.parent(t.sourceNodeId);for(;i;){if(i.namespaceUri===ye&&i.localName.toLowerCase()==="defs"&&ov(i,r,n)?.trim().toLowerCase()==="none")return!0;i=e.index.parent(i.sourceNodeId)}return!1}function uz(e,t,r){let n=t.direct(e.sourceNodeId),i=n?r.value(n.occurrenceId,"color-interpolation-filters"):j(e,"color-interpolation-filters"),a=j(e,"filterUnits"),o=j(e,"primitiveUnits");return{colorInterpolation:i==="auto"||i==="sRGB"||i==="linearRGB"?i:"linearRGB",filterUnits:a==="userSpaceOnUse"||a==="objectBoundingBox"?a:"objectBoundingBox",primitiveUnits:o==="userSpaceOnUse"||o==="objectBoundingBox"?o:"userSpaceOnUse",region:Object.freeze({x:j(e,"x")??Cu.x,y:j(e,"y")??Cu.y,width:j(e,"width")??Cu.width,height:j(e,"height")??Cu.height})}}function Zw(e,t){let r=aa(t,"x"),n=aa(t,"y"),i=aa(t,"width"),a=aa(t,"height");r!==void 0&&(e.x=r),n!==void 0&&(e.y=n),i!==void 0&&(e.width=i),a!==void 0&&(e.height=a);let o=j(t,"filterUnits");(o==="userSpaceOnUse"||o==="objectBoundingBox")&&(e.filterUnits=o);let s=j(t,"primitiveUnits");(s==="userSpaceOnUse"||s==="objectBoundingBox")&&(e.primitiveUnits=s);let l=j(t,"color-interpolation-filters");(l==="auto"||l==="sRGB"||l==="linearRGB")&&(e.type==="raw-svg"?e.colorInterpolationFilters=l:e.filterColorInterpolation=l);let u=aa(t,"flood-color"),d=aa(t,"flood-opacity"),c=aa(t,"lighting-color");u!==void 0&&(e.floodColor=u),d!==void 0&&(e.floodOpacity=d),c!==void 0&&(e.lightingColor=c)}function kr(e,t,r){let n={id:Hd(t,e.sourceNodeId),type:t};for(let s of["in","result","x","y","width","height"]){let l=j(e,s);l!==null&&(n[s]=l)}let i=j(e,"color-interpolation-filters");(i==="auto"||i==="sRGB"||i==="linearRGB")&&(n.colorInterpolationFilters=i);let a=new Set(["in","result","x","y","width","height","color-interpolation-filters"]),o={};for(let s of e.attributes)a.has(s.name)||r.has(s.name)||(o[s.name]=s.value);return Object.keys(o).length>0&&(n.unknownAttrs=o),n}function dz(e){let t=j(e,"type");if(t==="identity")return{type:t};if(t==="table"||t==="discrete"){let r=(j(e,"tableValues")??"").trim().split(/[\s,]+/u).filter(Boolean).map(n=>Qn(n));return r.some(n=>n===void 0)?void 0:{type:t,tableValues:r}}if(t==="linear"){let r={type:t},n=Qn(j(e,"slope")),i=Qn(j(e,"intercept"));return n!==void 0&&(r.slope=n),i!==void 0&&(r.intercept=i),r}if(t==="gamma"){let r={type:t},n=Qn(j(e,"amplitude")),i=Qn(j(e,"exponent")),a=Qn(j(e,"offset"));return n!==void 0&&(r.amplitude=n),i!==void 0&&(r.exponent=i),a!==void 0&&(r.offset=a),r}}function cz(e){let t={},r=e.localName.toLowerCase(),n=r==="fedistantlight"?["azimuth","elevation"]:r==="fepointlight"?["x","y","z"]:r==="fespotlight"?["x","y","z","pointsAtX","pointsAtY","pointsAtZ","specularExponent","limitingConeAngle"]:null;if(n){for(let i of n){let a=Qn(j(e,i));a!==void 0&&(t[i]=a)}return r==="fedistantlight"?{kind:"feDistantLight",...t}:r==="fepointlight"?{kind:"fePointLight",...t}:{kind:"feSpotLight",...t}}}function qr(e,t,r,n=r){let i=Qn(j(t,r));i!==void 0&&(e[n]=i)}function lr(e,t,r,n=r){let i=j(t,r);i!==null&&(e[n]=i)}function Jw(e){let t=e.localName.toLowerCase();switch(t){case"feblend":{let r=kr(e,"feBlend",new Set(["in2","mode","no-composite"]));lr(r,e,"in2");let n=j(e,"mode");return n&&az.has(n)&&(r.mode=n),Ri(e,"no-composite")&&(r.noComposite=!0),r}case"fecolormatrix":{let r=kr(e,"feColorMatrix",new Set(["type","values"])),n=j(e,"type");return(n==="matrix"||n==="saturate"||n==="hueRotate"||n==="luminanceToAlpha")&&(r.matrixType=n),lr(r,e,"values"),r}case"fecomponenttransfer":{let r=kr(e,"feComponentTransfer",new Set);for(let n of Ei(e)){let i=dz(n),a=n.localName.toLowerCase();a==="fefuncr"&&i?r.funcR=i:a==="fefuncg"&&i?r.funcG=i:a==="fefuncb"&&i?r.funcB=i:a==="fefunca"&&i&&(r.funcA=i)}return r}case"fecomposite":{let r=kr(e,"feComposite",new Set(["in2","operator","k1","k2","k3","k4"]));lr(r,e,"in2");let n=j(e,"operator");(n==="over"||n==="in"||n==="out"||n==="atop"||n==="xor"||n==="lighter"||n==="arithmetic")&&(r.operator=n);for(let i of["k1","k2","k3","k4"])qr(r,e,i);return r}case"feconvolvematrix":{let r=kr(e,"feConvolveMatrix",new Set(["order","kernelMatrix","divisor","bias","targetX","targetY","edgeMode","kernelUnitLength","preserveAlpha"]));lr(r,e,"order"),lr(r,e,"kernelMatrix");for(let a of["divisor","bias","targetX","targetY"])qr(r,e,a);let n=j(e,"edgeMode");(n==="duplicate"||n==="wrap"||n==="none")&&(r.edgeMode=n),lr(r,e,"kernelUnitLength");let i=j(e,"preserveAlpha");return i!==null&&(r.preserveAlpha=i==="true"),r}case"fediffuselighting":case"fespecularlighting":{let r=t==="fediffuselighting",n=kr(e,r?"feDiffuseLighting":"feSpecularLighting",new Set(["surfaceScale","diffuseConstant","specularConstant","specularExponent","kernelUnitLength","lighting-color"]));qr(n,e,"surfaceScale"),r?qr(n,e,"diffuseConstant"):(qr(n,e,"specularConstant"),qr(n,e,"specularExponent")),lr(n,e,"kernelUnitLength"),lr(n,e,"lighting-color","lightingColor");for(let i of Ei(e)){let a=cz(i);if(a){n.lightSource=a;break}}return n}case"fedisplacementmap":{let r=kr(e,"feDisplacementMap",new Set(["in2","scale","xChannelSelector","yChannelSelector"]));lr(r,e,"in2"),qr(r,e,"scale");for(let n of["xChannelSelector","yChannelSelector"]){let i=j(e,n);(i==="R"||i==="G"||i==="B"||i==="A")&&(r[n]=i)}return r}case"fedropshadow":{let r=kr(e,"feDropShadow",new Set(["dx","dy","stdDeviation","flood-color","flood-opacity"]));return qr(r,e,"dx"),qr(r,e,"dy"),lr(r,e,"stdDeviation"),lr(r,e,"flood-color","floodColor"),lr(r,e,"flood-opacity","floodOpacity"),r}case"feflood":{let r=kr(e,"feFlood",new Set(["flood-color","flood-opacity"]));return lr(r,e,"flood-color","floodColor"),lr(r,e,"flood-opacity","floodOpacity"),r}case"fegaussianblur":{let r=kr(e,"feGaussianBlur",new Set(["stdDeviation","edgeMode"]));lr(r,e,"stdDeviation");let n=j(e,"edgeMode");return(n==="duplicate"||n==="wrap"||n==="none")&&(r.edgeMode=n),r}case"feimage":{let r=kr(e,"feImage",new Set(["href","xlink:href","preserveAspectRatio","crossorigin"])),n=vr(e);n?.namespace==="svg2"?r.href=n.value:n?.namespace==="xlink"&&(r.xlinkHref=n.value),lr(r,e,"preserveAspectRatio");let i=j(e,"crossorigin");return(i==="anonymous"||i==="use-credentials")&&(r.crossorigin=i),r}case"femerge":{let r=kr(e,"feMerge",new Set);return r.nodes=Ei(e).filter(n=>n.localName.toLowerCase()==="femergenode").map(n=>{let i=j(n,"in");return i===null?{}:{in:i}}),r}case"femorphology":{let r=kr(e,"feMorphology",new Set(["operator","radius"])),n=j(e,"operator");return(n==="erode"||n==="dilate")&&(r.operator=n),lr(r,e,"radius"),r}case"feoffset":{let r=kr(e,"feOffset",new Set(["dx","dy"]));return qr(r,e,"dx"),qr(r,e,"dy"),r}case"fetile":return kr(e,"feTile",new Set);case"feturbulence":{let r=kr(e,"feTurbulence",new Set(["baseFrequency","numOctaves","seed","stitchTiles","type"]));lr(r,e,"baseFrequency"),qr(r,e,"numOctaves"),qr(r,e,"seed");let n=j(e,"stitchTiles");(n==="stitch"||n==="noStitch")&&(r.stitchTiles=n);let i=j(e,"type");return(i==="fractalNoise"||i==="turbulence")&&(r.turbulenceType=i),r}default:return null}}function fz(e){let t=[],r="",n=0;for(let i of e)i==="("?n++:i===")"&&n--,/\s/u.test(i)&&n===0?(r&&t.push(r),r=""):r+=i;return r&&t.push(r),t}function an(e,t){return(e===void 0?void 0:Qn(e))??t}function pz(e,t){let r=fz(e);if(r.length<2)return null;let n=r[0],i=r[1]==="1",a={id:Hd(n,t,":preset"),enabled:i};switch(n){case"hue-rotate":return{...a,type:n,angle:an(r[2],0)};case"sepia":case"grayscale":case"saturate":case"invert":case"brightness":case"contrast":return{...a,type:n,amount:an(r[2],1)};case"duotone":return{...a,type:n,shadowColor:r[2]??"#000000",highlightColor:r[3]??"#ffffff"};case"inner-shadow":return{...a,type:n,offsetX:an(r[2],0),offsetY:an(r[3],0),blurRadius:an(r[4],0),choke:an(r[5],0),color:r[6]??"rgba(0,0,0,0.5)",opacity:1};case"drop-shadow":return{...a,type:n,offsetX:an(r[2],0),offsetY:an(r[3],0),blurRadius:an(r[4],0),spread:an(r[5],0),color:r[6]??"rgba(0,0,0,0.5)",opacity:1};case"gaussian-blur":{let o=an(r[2],0);return{...a,type:n,blurX:o,blurY:an(r[3],o),linked:r[3]===void 0,quality:"normal"}}default:return null}}function hz(e,t){let r={id:Hd("raw-svg",e.sourceNodeId),type:"raw-svg",enabled:!0,svgContent:Ei(e).map(oz).filter(Boolean).join(`
37
+ `)};return Zw(r,e),t&&(r.display="none"),r}function mz(e){let t={id:Hd("svg-primitive-chain",e.sourceNodeId),type:"svg-primitive-chain",enabled:!0,primitives:[]};Zw(t,e);for(let r of Ei(e)){let n=r.localName.toLowerCase();if(n==="title")t.filterTitle=av(r);else if(n==="desc")t.filterDescription=av(r);else{if(iz.has(n))continue;{let i=Jw(r);i&&t.primitives.push(i)}}}return t}function gz(e,t,r,n,i,a){let o=uz(t,r,n),s=t.attributes.find(m=>m.localName==="preset"&&m.prefix==="bx")?.value,l=lz(e,t,r,n),u=j(t,"filterUnits"),d=j(t,"primitiveUnits"),c=j(t,"color-interpolation-filters");u!==null&&u!=="userSpaceOnUse"&&u!=="objectBoundingBox"&&a.push(qu(i,`Invalid filterUnits value "${u}" uses its initial value.`,t)),d!==null&&d!=="userSpaceOnUse"&&d!=="objectBoundingBox"&&a.push(qu(i,`Invalid primitiveUnits value "${d}" uses its initial value.`,t)),c!==null&&c!=="auto"&&c!=="sRGB"&&c!=="linearRGB"&&a.push(qu(i,`Invalid color-interpolation-filters value "${c}" uses its initial value.`,t));let f=s?pz(s,t.sourceNodeId):l||sz(t)?hz(t,l):mz(t),p=Object.freeze(f?[f]:[]),h=f?.type==="svg-primitive-chain"&&f.primitives.length===0;return ba({sourceNodeId:t.sourceNodeId,sourceId:j(t,"id"),definitionPlacement:e.index.parent(t.sourceNodeId)===e.root?"document":"defs",status:f?h?"empty":"materialized":"invalid",filters:p,...o})}function yz(e,t){let r=rz.exec(e.trim());if(!r)return null;let n=Number(r[1]);return!Number.isFinite(n)||n<0?null:r[2]?n/100:n}function vz(e){let t=nz.exec(e.trim());if(!t)return null;let r=Number(t[1]);if(!Number.isFinite(r))return null;switch((t[2]??"deg").toLowerCase()){case"turn":return r*360;case"rad":return r*180/Math.PI;case"grad":return r*.9;default:return r}}function bz(e){let t=[],r="",n=null,i=!1,a=0;for(let o of e){if(n){r+=o,i?i=!1:o==="\\"?i=!0:o===n&&(n=null);continue}o==='"'||o==="'"?(n=o,r+=o):o==="("?(a++,r+=o):o===")"?(a--,r+=o):/\s/u.test(o)&&a===0?(r&&t.push(r),r=""):r+=o}return r&&t.push(r),t}function xz(e,t){if(e.toLowerCase()==="currentcolor")return t??"#000000";if(/^#[\da-f]{3,8}$/iu.test(e)||/^rgba?\(/iu.test(e))return e;let r=ex(e);return r?`rgb(${r.r}, ${r.g}, ${r.b})`:null}function wz(e,t,r,n,i,a){if(e==="brightness"||e==="contrast"||e==="grayscale"||e==="invert"||e==="opacity"||e==="saturate"||e==="sepia"){let l=yz(t,1);return l===null?null:{id:r,type:e,enabled:!0,amount:l}}if(e==="hue-rotate"){let l=vz(t);return l===null?null:{id:r,type:e,enabled:!0,angle:l}}if(e==="blur"){let l=at(t.trim(),{fontSize:i,rootFontSize:a.rootFontSize??16,viewportWidth:a.viewport?.width,viewportHeight:a.viewport?.height});return l===void 0||l<0||t.trim().endsWith("%")?null:{id:r,type:"gaussian-blur",enabled:!0,blurX:l,blurY:l,linked:!0,quality:"normal"}}if(e!=="drop-shadow")return null;let o=[],s=null;for(let l of bz(t.trim())){let u=at(l,{fontSize:i,rootFontSize:a.rootFontSize??16,viewportWidth:a.viewport?.width,viewportHeight:a.viewport?.height});if(u!==void 0&&!l.endsWith("%"))o.push(u);else{let d=xz(l,n);if(!d||s!==null)return null;s=d}}return o.length<2||o.length>3||(o[2]??0)<0?null:{id:r,type:"drop-shadow",enabled:!0,offsetX:o[0],offsetY:o[1],blurRadius:o[2]??0,spread:0,color:s??n??"#000000",opacity:1}}function Iz(e,t,r){let n=e.resolvePropertyValue(t.correspondingSourceNodeId,"filter",r),i=n.filter(a=>a.occurrenceId===t.occurrenceId);return i.length>0?i:n.filter(a=>a.occurrenceId===null)}function kz(e){let t=e.trim();return t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1).trim()),t.startsWith("#")&&t.length>1?t.slice(1):null}function Sz(e,t){let r=0;for(let n of t){if(e.slice(r,n.tokenStart).replace(/\/\*[\s\S]*?\*\//gu,"").trim())return!1;r=n.tokenEnd}return e.slice(r).replace(/\/\*[\s\S]*?\*\//gu,"").trim().length===0}function $z(e,t,r,n,i,a,o,s){let l=[],u=Iz(n,e,t),d=0,c=!1,f=at(r.value(e.occurrenceId,"font-size"),{fontSize:a.rootFontSize??16,rootFontSize:a.rootFontSize??16,viewportWidth:a.viewport?.width,viewportHeight:a.viewport?.height})??a.rootFontSize??16,p=r.value(e.occurrenceId,"color"),h=Lo(t);Sz(t,h)||(c=!0);for(let[g,v]of h.entries()){let b=`filter-operation:${e.occurrenceId}:${g}`,y=t.slice(v.tokenStart,v.tokenEnd);if(v.name!=="url"){let $=wz(v.name,t.slice(v.argumentsStart,v.argumentsEnd),b,p,f,a),A=$?"materialized":"invalid-reference";$||(c=!0,o.push(qu(a,`Invalid or unsupported CSS filter function "${y}".`,s,e.occurrenceId))),l.push(Object.freeze({operationId:b,kind:"function",authoredValue:y,filter:$,filterSourceNodeId:null,status:A}));continue}let I=kz(t.slice(v.argumentsStart,v.argumentsEnd))===null?void 0:u[d++],x=I?.targetSourceNodeId?i.get(I.targetSourceNodeId):null,k=I?.validity==="valid"&&x?x.status==="empty"?"empty":x.status==="materialized"?"materialized":"invalid-reference":"invalid-reference";k==="invalid-reference"&&(c=!0),l.push(ba({operationId:b,kind:"reference",authoredValue:y,filter:k==="materialized"?x?.filters[0]??null:null,filterSourceNodeId:I?.targetSourceNodeId??null,status:k}))}let m=t.trim().toLowerCase()==="none"?"none":c||l.length===0?"invalid-reference":"materialized";return ba({consumerOccurrenceId:e.occurrenceId,consumerSourceNodeId:e.correspondingSourceNodeId,authoredValue:t,status:m,operations:Object.freeze(l)})}function Nz(e,t,r,n,i){let a=[],o=n.resources.filter(f=>f.kind==="filter").map(f=>e.index.element(f.sourceNodeId)).filter(f=>!!f).map(f=>gz(e,f,t,r,i,a)),s=new Map(o.map(f=>[f.sourceNodeId,f])),l=new Map;for(let f of o){let p=e.index.element(f.sourceNodeId);if(p)for(let h of Ei(p)){let m=Jw(h);m&&l.set(h.sourceNodeId,m.id)}}let u=[];for(let f of t.occurrences){let p=e.index.element(f.correspondingSourceNodeId);if(!p)continue;let h=r.value(f.occurrenceId,"filter");h&&u.push($z(f,h,r,n,s,i,a,p))}let d=new Map(u.map(f=>[f.consumerOccurrenceId,f]));ba(o),ba(u),ba(a);let c=Object.freeze({candidates:o,bindings:u,diagnostics:a,candidate(f){return s.get(f)??null},primitiveId(f){return l.get(f)??null},binding(f){return d.get(f)??null}});return Object.freeze({value:c,diagnostics:a})}var Mz=[{generator:"svgator",tokens:["__SVGATOR_PLAYER__","cdn.svgator.com","svgator.com/ply"]},{generator:"lottie",tokens:["bodymovin","lottie.loadAnimation"]},{generator:"vivus",tokens:["new Vivus(","Vivus("]},{generator:"gsap",tokens:["gsap.","TweenMax","TweenLite","TimelineMax","TimelineLite"]},{generator:"anime",tokens:["anime.timeline","anime({"]},{generator:"snap",tokens:["Snap("]}],Az=["requestAnimationFrame","setInterval(","setTimeout("],Cz=["setAttribute",".style.","setAttributeNS","classList"];function qf(e,t){return t.some(r=>e.includes(r))}function Oz(e){return`${e.content}
38
+ ${e.href??""}`}function Tz(e){return e?"project-id"in e&&"export-id"in e:!1}function Pz(e,t){for(let n of Mz){let i=e.findIndex(o=>qf(Oz(o),n.tokens));if(i<0)continue;if(n.generator!=="svgator")return{generator:n.generator,scriptIndex:i,convertible:!1};let a=Dz(e[i].content);return{generator:"svgator",scriptIndex:i,convertible:a!==null,...a?.version?{version:a.version}:{}}}let r=e.findIndex(n=>{let i=n.content;return qf(i,Az)&&qf(i,Cz)});return r>=0?{generator:"unknown",scriptIndex:r,convertible:!1}:Tz(t)?{generator:"svgator",scriptIndex:-1,convertible:!1}:null}function Dz(e){let t=jz(e);if(t===null)return null;try{let r=JSON.parse(t);if(!r||typeof r!="object")return null;let n=r;return typeof n.root!="string"||!Array.isArray(n.animations)?null:typeof n.version=="string"?{version:n.version}:{}}catch{return null}}function jz(e){let t=e.search(/\}\)\(\s*'[^']*'\s*,\s*\{/);if(t<0)return null;let r=e.indexOf("{",e.indexOf(",",t));if(r<0)return null;let n=0,i=!1,a=!1;for(let o=r;o<e.length;o+=1){let s=e[o];if(a){a=!1;continue}if(i){s==="\\"?a=!0:s==='"'&&(i=!1);continue}if(s==='"')i=!0;else if(s==="{")n+=1;else if(s==="}"&&(n-=1,n===0))return e.slice(r,o+1)}return null}var Ez="application/ecmascript",zz="http://www.w3.org/1999/xlink",Rz=Object.freeze([]);function _z(e){let t="",r=[...e.children].reverse();for(;r.length>0;){let n=r.pop();n.kind==="text"||n.kind==="cdata"?t+=n.value:n.kind==="element"&&r.push(...[...n.children].reverse())}return t}function Fz(e,t){let r=e.attributes[t];return r.namespaceUri===zz&&r.localName==="href"?!0:r.namespaceUri!==null?!1:["id","type","href","crossorigin","async","defer"].includes(r.localName)}function Lz(e){let t=e.attributes.filter((r,n)=>!Fz(e,n)).map(r=>[r.name,r.value]);return t.length>0?Object.freeze(Object.fromEntries(t)):void 0}function Bz(e,t){return!t||t.sourceNodeId===e.root.sourceNodeId||t.namespaceUri===ye&&["defs","metadata"].includes(t.localName.toLowerCase())?"document":"element"}function Vz(e){let t=vr(e)?.value,r=t!==void 0&&t.length>0,n=j(e,"type")||Ez,i=j(e,"crossorigin"),a=j(e,"id")||void 0,o=Lz(e);return Object.freeze({id:`script:${e.sourceNodeId}`,...a?{svgId:a}:{},source:r?"external":"inline",content:r?"":_z(e),...r?{href:t}:{},type:n,...i==="anonymous"||i==="use-credentials"?{crossorigin:i}:{},...Ri(e,"async")?{async:!0}:{},...Ri(e,"defer")?{defer:!0}:{},...o?{customAttrs:o}:{}})}function Uz(e){return Object.freeze(Object.fromEntries(e.root.attributes.map(t=>[t.name,t.value])))}function Gz(e,t,r){return Object.freeze({severity:"warning",code:"script-behavior-inert",source:t.source,entrypoint:t.entrypoint,capability:"scripts",sourceNodeId:e.root.sourceNodeId,elementName:"script",message:r?`Preserved script content drives this document's animation (${r.generator}); the editor never executes scripts, so the animation is inert here.`:"Preserved script content is never executed by the editor, so any script-driven behavior is inert here."})}function Wz(e,t){let r=[],n=e.index.elements.filter(d=>d.namespaceUri===ye&&d.localName.toLowerCase()==="script").map(d=>{let c=e.index.parent(d.sourceNodeId);return Object.freeze({sourceNodeId:d.sourceNodeId,parentSourceNodeId:c?.sourceNodeId??null,scope:Bz(e,c),script:Vz(d)})}),i=Object.freeze(n.filter(d=>d.scope==="document")),a=Object.freeze(n.filter(d=>d.scope==="element")),o=new Map(n.map(d=>[d.sourceNodeId,d])),s=new Map;for(let d of a){if(!d.parentSourceNodeId)continue;let c=s.get(d.parentSourceNodeId)??[];s.set(d.parentSourceNodeId,Object.freeze([...c,d]))}let l=Pz(n.map(d=>({content:d.script.content,...d.script.href?{href:d.script.href}:{}})),Uz(e));n.length>0&&nP("scripts",t.entrypoint).status==="diagnosed-lossy"&&r.push(Gz(e,t,l)),Object.freeze(n),Object.freeze(r);let u=Object.freeze({candidates:n,documentScripts:i,elementScripts:a,animationSource:l,candidate(d){return o.get(d)??null},forParent(d){return s.get(d)??Rz}});return Object.freeze({value:u,diagnostics:r})}var Xz=new Set(["id","href","x1","y1","x2","y2","cx","cy","fx","fy","r","fr","gradientunits","gradienttransform","spreadmethod","color-interpolation"]);function qd(e){let t=e.toLowerCase();return/^[A-Za-z_][\w:.-]*$/u.test(e)&&!/^on/iu.test(e)&&t!=="xmlns"&&!t.startsWith("xmlns:")&&t!=="data-source-id"&&!Xz.has(t)}var Hz=new Set(["id","href","xlink:href","x","y","width","height","patternunits","patterncontentunits","patterntransform","viewbox","preserveaspectratio"]);function Yd(e){let t=e.toLowerCase();return/^[A-Za-z_][\w:.-]*$/u.test(e)&&!/^on/iu.test(e)&&t!=="xmlns"&&!t.startsWith("xmlns:")&&t!=="data-source-id"&&!Hz.has(t)}function Qw(e){if(e.authoredGeometry?.gradientTransform!==void 0)return e.authoredGeometry.gradientTransform;if(e.gradientTransform!==void 0)return cx(e.gradientTransform)??void 0;let t=e.r;if(t===void 0)return;let r=e.ry??t,n=e.rotation??0;if(r===t&&n===0)return;let i=e.cx??.5,a=e.cy??.5,o=[`translate(${i}, ${a})`];return n&&o.push(`rotate(${n})`),r!==t&&t!==0&&o.push(`scale(1, ${r/t})`),o.push(`translate(${-i}, ${-a})`),o.join(" ")}function qz(e,t,r,n){let i=n?.strokeWidth!=null?Math.max(.5,t*n.strokeWidth):Math.max(1,t/10);switch(e){case"stripes":return[{tag:"rect",attrs:{width:n?.strokeWidth!=null?Math.max(.01,Math.min(1,n.strokeWidth))*t:t/2,height:t,fill:r}}];case"dots":{let a=n?.dotRadius!=null?Math.max(.05,Math.min(.45,n.dotRadius)):.25;return[{tag:"circle",attrs:{cx:t/2,cy:t/2,r:t*a,fill:r}}]}case"grid":return[{tag:"path",attrs:{d:`M ${t} 0 L 0 0 0 ${t}`,fill:"none",stroke:r,"stroke-width":i}}];case"checkerboard":return[{tag:"rect",attrs:{width:t/2,height:t/2,fill:r}},{tag:"rect",attrs:{x:t/2,y:t/2,width:t/2,height:t/2,fill:r}}];case"diagonal":{let a=n?.strokeWidth!=null?Math.max(.5,t*n.strokeWidth):Math.max(1,t/5);return[{tag:"path",attrs:{d:`M 0 ${t} L ${t} 0`,stroke:r,"stroke-width":a}}]}case"crosshatch":return[{tag:"path",attrs:{d:`M 0 ${t} L ${t} 0 M 0 0 L ${t} ${t}`,stroke:r,"stroke-width":i}}];case"zigzag":{let a=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,o=t*a;return[{tag:"path",attrs:{d:`M 0 ${o} L ${t/4} 0 L ${t/2} ${o} L ${t*3/4} 0 L ${t} ${o}`,fill:"none",stroke:r,"stroke-width":i}}]}case"waves":{let a=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,o=t*a,s=t/2;return[{tag:"path",attrs:{d:`M 0 ${s} Q ${t/4} ${s-o} ${t/2} ${s} T ${t} ${s}`,fill:"none",stroke:r,"stroke-width":i}}]}case"triangles":{let a=t*.866;return[{tag:"path",attrs:{d:`M ${t/2} 0 L ${t} ${a} L 0 ${a} Z`,fill:"none",stroke:r,"stroke-width":i}}]}case"hexagons":{let a=t*.866;return[{tag:"path",attrs:{d:`M ${t*.25} 0 L ${t*.75} 0 L ${t} ${a*.5} L ${t*.75} ${a} L ${t*.25} ${a} L 0 ${a*.5} Z`,fill:"none",stroke:r,"stroke-width":i}}]}case"diamonds":return[{tag:"path",attrs:{d:`M ${t/2} 0 L ${t} ${t/2} L ${t/2} ${t} L 0 ${t/2} Z`,fill:"none",stroke:r,"stroke-width":i}}];case"circles":return[{tag:"circle",attrs:{cx:t/2,cy:t/2,r:t/3,fill:"none",stroke:r,"stroke-width":i}}];case"bricks":{let a=n?.strokeWidth!=null?Math.max(.5,t*n.strokeWidth):Math.max(1,t/15);return[{tag:"rect",attrs:{x:0,y:0,width:t,height:t/2,fill:"none",stroke:r,"stroke-width":a}},{tag:"rect",attrs:{x:-t/2,y:t/2,width:t,height:t/2,fill:"none",stroke:r,"stroke-width":a}},{tag:"rect",attrs:{x:t/2,y:t/2,width:t,height:t/2,fill:"none",stroke:r,"stroke-width":a}}]}case"herringbone":return[{tag:"path",attrs:{d:`M 0 0 L ${t/2} ${t/2} L 0 ${t} M ${t/2} ${t/2} L ${t} 0 M ${t/2} ${t/2} L ${t} ${t}`,fill:"none",stroke:r,"stroke-width":i}}];default:return[]}}function Oe(e,t,r){r==null||r===""||e.push([t,r])}function eI(e){return(e.stops??[]).map(t=>{let r=[...t.id?[["id",t.id]]:[],["offset",`${t.offset*100}%`],["stop-color",t.color]];return t.opacity!==void 0&&t.opacity<1&&r.push(["stop-opacity",t.opacity]),{attributes:r}})}function tI(e,t){for(let[r,n]of Object.entries(t.rootAttributes??{}))qd(r)&&e.push([r,n])}function Yz(e,t){let r=t.gradientUnits==="userSpaceOnUse",n=o=>r?String(o):`${o*100}%`,i=t.authoredGeometry??{},a=[["id",e]];return tI(a,t),t.templateId&&Oe(a,"href",`#${t.templateId}`),t.gradientUnits!==void 0&&Oe(a,"gradientUnits",t.gradientUnits),(i.x1!==void 0||t.x1!==void 0)&&Oe(a,"x1",i.x1??n(t.x1)),(i.y1!==void 0||t.y1!==void 0)&&Oe(a,"y1",i.y1??n(t.y1)),(i.x2!==void 0||t.x2!==void 0)&&Oe(a,"x2",i.x2??n(t.x2)),(i.y2!==void 0||t.y2!==void 0)&&Oe(a,"y2",i.y2??n(t.y2)),Oe(a,"spreadMethod",t.spreadMethod),t.colorInterpolation&&t.colorInterpolation!=="sRGB"&&Oe(a,"color-interpolation",t.colorInterpolation),Oe(a,"gradientTransform",Qw(t)),{element:"linearGradient",attributes:a,stops:eI(t)}}function Kz(e,t){let r=t.gradientUnits==="userSpaceOnUse",n=o=>r?String(o):`${o*100}%`,i=t.authoredGeometry??{},a=[["id",e]];tI(a,t),t.templateId&&Oe(a,"href",`#${t.templateId}`),t.gradientUnits!==void 0&&Oe(a,"gradientUnits",t.gradientUnits);for(let o of["cx","cy","fx","fy","r"]){let s=t[o];(i[o]!==void 0||s!==void 0)&&Oe(a,o,i[o]??n(s))}return(i.fr!==void 0||t.fr!==void 0)&&Oe(a,"fr",i.fr??n(t.fr)),Oe(a,"spreadMethod",t.spreadMethod),t.colorInterpolation&&t.colorInterpolation!=="sRGB"&&Oe(a,"color-interpolation",t.colorInterpolation),Oe(a,"gradientTransform",Qw(t)),{element:"radialGradient",attributes:a,stops:eI(t)}}function Zz(e){let t=Object.entries(e.attrs).map(([r,n])=>` ${r}="${Ne(String(n))}"`).join("");return`<${e.tag}${t}/>`}function Jz(e,t){let r=[["id",e]];for(let[l,u]of Object.entries(t.rootAttributes??{}))Yd(l)&&r.push([l,u]);if(t.templateId&&Oe(r,"href",`#${t.templateId}`),t.svgContent!=null||t.patternType==="custom"||t.templateId){let l=t.authoredGeometry??{};return Oe(r,"patternUnits",t.patternUnits),Oe(r,"patternContentUnits",t.patternContentUnits),Oe(r,"x",l.x??t.x),Oe(r,"y",l.y??t.y),Oe(r,"width",l.width??t.width),Oe(r,"height",l.height??t.height),Oe(r,"viewBox",t.viewBox),Oe(r,"preserveAspectRatio",t.preserveAspectRatio),Oe(r,"patternTransform",t.patternTransform),{attributes:r,content:t.svgContent??""}}let n=10*(t.scale??1),i=t.color||"#000000",a=t.backgroundColor||"#ffffff";Oe(r,"patternUnits","userSpaceOnUse"),Oe(r,"width",n),Oe(r,"height",n),t.rotation&&Oe(r,"patternTransform",`rotate(${t.rotation})`);let o=`<rect width="${Ne(String(n))}" height="${Ne(String(n))}" fill="${Ne(a)}"/>`,s=qz(t.patternType,n,i).map(Zz).join("");return{attributes:r,content:`${o}${s}`}}function Qz(e){return e.some(t=>t.type==="gaussian-blur"||t.type==="motion-blur"||t.type==="drop-shadow"||t.type==="inner-shadow"||t.type==="glow"||t.type==="inner-glow"||t.type==="outline"||t.type==="morphology"||t.type==="warp"||t.type==="svg-primitive-chain"&&t.primitives.some(r=>r.type==="feGaussianBlur"||r.type==="feDropShadow"||r.type==="feOffset"||r.type==="feMorphology"||r.type==="feDisplacementMap"||r.type==="feTurbulence"))}function eR(e,t,r={}){let n=t.filter(f=>f.enabled);if(n.length===0)return null;let i=n.find(f=>f.type==="raw-svg");if(i){let f=[["id",e]];return Oe(f,"x",r.x??i.x),Oe(f,"y",r.y??i.y),Oe(f,"width",r.width??i.width),Oe(f,"height",r.height??i.height),Oe(f,"filterUnits",r.filterUnits??i.filterUnits),Oe(f,"primitiveUnits",r.primitiveUnits??i.primitiveUnits),Oe(f,"color-interpolation-filters",r.colorInterpolation&&r.colorInterpolation!=="auto"?r.colorInterpolation:i.colorInterpolationFilters),Oe(f,"flood-color",i.floodColor),Oe(f,"flood-opacity",i.floodOpacity),Oe(f,"lighting-color",i.lightingColor),Oe(f,"display",i.display),{kind:"raw",attributes:f,content:i.svgContent}}let a=n.find(f=>f.type==="svg-primitive-chain");if(a)return{kind:"primitive-chain",attributes:[],chain:{...a,x:r.x??a.x,y:r.y??a.y,width:r.width??a.width,height:r.height??a.height,filterUnits:r.filterUnits??a.filterUnits,primitiveUnits:r.primitiveUnits??a.primitiveUnits,filterColorInterpolation:r.colorInterpolation&&r.colorInterpolation!=="auto"?r.colorInterpolation:a.filterColorInterpolation}};let o=n.some(f=>f.type==="gaussian-blur"&&f.quality==="high"||f.type==="motion-blur"&&f.quality==="high"),s=Qz(n),l=s?o?"-200%":"-100%":"-10%",u=s?o?"500%":"300%":"120%",d=r.primitiveUnits??"userSpaceOnUse",c=[["id",e]];return Oe(c,"x",r.x??l),Oe(c,"y",r.y??l),Oe(c,"width",r.width??u),Oe(c,"height",r.height??u),Oe(c,"filterUnits",r.filterUnits??"objectBoundingBox"),Oe(c,"primitiveUnits",d),r.colorInterpolation&&r.colorInterpolation!=="auto"&&Oe(c,"color-interpolation-filters",r.colorInterpolation),{kind:"generated",attributes:c,filters:n,primitiveUnits:d}}function w(e,t){return t==null||t===""?"":` ${e}="${Ne(String(t))}"`}function fd(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16)/255,g:parseInt(t[2],16)/255,b:parseInt(t[3],16)/255}:{r:0,g:0,b:0}}function tR(e,t,r){let{offsetX:n,offsetY:i,blurRadius:a,spread:o,color:s,opacity:l}=e,u="";if(o===0)u+=`<feDropShadow${w("in",t)}${w("dx",n)}${w("dy",i)}${w("stdDeviation",a/2)}${w("flood-color",s)}${w("flood-opacity",l)}${w("result",`${r}_shadow`)}/>`,u+=`<feMerge${w("result",r)}><feMergeNode${w("in",`${r}_shadow`)}/><feMergeNode${w("in",t)}/></feMerge>`;else{u+=`<feColorMatrix${w("in",t)}${w("type","matrix")}${w("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${w("result",`${r}_alpha`)}/>`;let d=o>0?"dilate":"erode",c=Math.abs(o);u+=`<feMorphology${w("in",`${r}_alpha`)}${w("operator",d)}${w("radius",c)}${w("result",`${r}_spread`)}/>`,u+=`<feGaussianBlur${w("in",`${r}_spread`)}${w("stdDeviation",a/2)}${w("result",`${r}_blur`)}/>`,u+=`<feOffset${w("in",`${r}_blur`)}${w("dx",n)}${w("dy",i)}${w("result",`${r}_offset`)}/>`,u+=`<feFlood${w("flood-color",s)}${w("flood-opacity",l)}${w("result",`${r}_color`)}/>`,u+=`<feComposite${w("in",`${r}_color`)}${w("in2",`${r}_offset`)}${w("operator","in")}${w("result",`${r}_shadow`)}/>`,u+=`<feMerge${w("result",r)}><feMergeNode${w("in",`${r}_shadow`)}/><feMergeNode${w("in",t)}/></feMerge>`}return u}function rR(e,t,r){let{offsetX:n,offsetY:i,blurRadius:a,choke:o,color:s,opacity:l}=e,u=a*(1-o/100),d="";return d+=`<feColorMatrix${w("in",t)}${w("type","matrix")}${w("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${w("result",`${r}_alpha`)}/>`,d+=`<feComponentTransfer${w("in",`${r}_alpha`)}${w("result",`${r}_inverted`)}><feFuncA${w("type","table")}${w("tableValues","1 0")}/></feComponentTransfer>`,d+=`<feGaussianBlur${w("in",`${r}_inverted`)}${w("stdDeviation",u/2)}${w("result",`${r}_blur`)}/>`,d+=`<feOffset${w("in",`${r}_blur`)}${w("dx",n)}${w("dy",i)}${w("result",`${r}_offset`)}/>`,d+=`<feFlood${w("flood-color",s)}${w("flood-opacity",l)}${w("result",`${r}_color`)}/>`,d+=`<feComposite${w("in",`${r}_color`)}${w("in2",`${r}_offset`)}${w("operator","in")}${w("result",`${r}_coloredShadow`)}/>`,d+=`<feComposite${w("in",`${r}_coloredShadow`)}${w("in2",`${r}_alpha`)}${w("operator","in")}${w("result",`${r}_innerShadow`)}/>`,d+=`<feComposite${w("in",`${r}_innerShadow`)}${w("in2",t)}${w("operator","over")}${w("result",r)}/>`,d}function nR(e,t,r){let{blurX:n,blurY:i}=e;return n===0&&i===0?ot(t,r):`<feGaussianBlur${w("in",t)}${w("stdDeviation",`${n/2} ${i/2}`)}${w("result",r)}/>`}function iR(e,t,r){let{distance:n,angle:i}=e;if(n===0)return ot(t,r);let a=i*Math.PI/180,o=Math.abs(Math.cos(a)*n),s=Math.abs(Math.sin(a)*n);return`<feGaussianBlur${w("in",t)}${w("stdDeviation",`${o/2} ${s/2}`)}${w("result",r)}/>`}function aR(e,t,r){let{x:n,y:i,z:a,color:o,surfaceScale:s,diffuseConstant:l,specularConstant:u,specularExponent:d}=e,c="";return c+=`<feDiffuseLighting${w("in","SourceAlpha")}${w("surfaceScale",s)}${w("diffuseConstant",l)}${w("lighting-color",o)}${w("result",`${r}_diffuse`)}>`,c+=`<fePointLight${w("x",n)}${w("y",i)}${w("z",a)}/>`,c+="</feDiffuseLighting>",c+=`<feSpecularLighting${w("in","SourceAlpha")}${w("surfaceScale",s)}${w("specularConstant",u)}${w("specularExponent",d)}${w("lighting-color",o)}${w("result",`${r}_specular`)}>`,c+=`<fePointLight${w("x",n)}${w("y",i)}${w("z",a)}/>`,c+="</feSpecularLighting>",c+=`<feComposite${w("in",t)}${w("in2",`${r}_diffuse`)}${w("operator","arithmetic")}${w("k1",1)}${w("k2",0)}${w("k3",0)}${w("k4",0)}${w("result",`${r}_lit`)}/>`,c+=`<feComposite${w("in",`${r}_specular`)}${w("in2",`${r}_lit`)}${w("operator","arithmetic")}${w("k1",0)}${w("k2",1)}${w("k3",1)}${w("k4",0)}${w("result",r)}/>`,c}function oR(e,t,r){let{x:n,y:i,z:a,pointsAtX:o,pointsAtY:s,pointsAtZ:l,coneAngle:u,color:d,surfaceScale:c,specularConstant:f,specularExponent:p}=e,h="";return h+=`<feSpecularLighting${w("in","SourceAlpha")}${w("surfaceScale",c)}${w("specularConstant",f)}${w("specularExponent",p)}${w("lighting-color",d)}${w("result",`${r}_specular`)}>`,h+=`<feSpotLight${w("x",n)}${w("y",i)}${w("z",a)}${w("pointsAtX",o)}${w("pointsAtY",s)}${w("pointsAtZ",l)}${w("limitingConeAngle",u)}/>`,h+="</feSpecularLighting>",h+=`<feComposite${w("in",`${r}_specular`)}${w("in2","SourceAlpha")}${w("operator","in")}${w("result",`${r}_clipped`)}/>`,h+=`<feComposite${w("in",`${r}_clipped`)}${w("in2",t)}${w("operator","arithmetic")}${w("k1",0)}${w("k2",1)}${w("k3",1)}${w("k4",0)}${w("result",r)}/>`,h}function rI(e){switch(e.kind){case"point":return`<fePointLight${w("x",e.x)}${w("y",e.y)}${w("z",e.z)}/>`;case"spot":{let t=`<feSpotLight${w("x",e.x)}${w("y",e.y)}${w("z",e.z)}${w("pointsAtX",e.pointsAtX)}${w("pointsAtY",e.pointsAtY)}${w("pointsAtZ",e.pointsAtZ)}`;return e.limitingConeAngle!==void 0&&(t+=w("limitingConeAngle",e.limitingConeAngle)),e.specularExponent!==void 0&&(t+=w("specularExponent",e.specularExponent)),t+"/>"}case"distant":return`<feDistantLight${w("azimuth",e.azimuth)}${w("elevation",e.elevation)}/>`}}function sR(e,t,r){return`<feDiffuseLighting${w("in",t)}${w("surfaceScale",e.surfaceScale)}${w("diffuseConstant",e.diffuseConstant)}${w("lighting-color",e.color)}${w("result",r)}>`+rI(e.lightSource)+"</feDiffuseLighting>"}function lR(e,t,r){return`<feSpecularLighting${w("in",t)}${w("surfaceScale",e.surfaceScale)}${w("specularConstant",e.specularConstant)}${w("specularExponent",e.specularExponent)}${w("lighting-color",e.color)}${w("result",r)}>`+rI(e.lightSource)+"</feSpecularLighting>"}function uR(e,t,r){let{width:n,color:i,opacity:a,position:o}=e,s="";if(o==="inside")s+=`<feMorphology${w("in","SourceAlpha")}${w("operator","erode")}${w("radius",n)}${w("result",`${r}_eroded`)}/>`,s+=`<feComposite${w("in","SourceAlpha")}${w("in2",`${r}_eroded`)}${w("operator","out")}${w("result",`${r}_outlineAlpha`)}/>`,s+=`<feFlood${w("flood-color",i)}${w("flood-opacity",a)}${w("result",`${r}_color`)}/>`,s+=`<feComposite${w("in",`${r}_color`)}${w("in2",`${r}_outlineAlpha`)}${w("operator","in")}${w("result",`${r}_outline`)}/>`,s+=`<feComposite${w("in",`${r}_outline`)}${w("in2",t)}${w("operator","over")}${w("result",r)}/>`;else{let l=o==="outside"?n:n/2;s+=`<feMorphology${w("in","SourceAlpha")}${w("operator","dilate")}${w("radius",l)}${w("result",`${r}_dilated`)}/>`,s+=`<feComposite${w("in",`${r}_dilated`)}${w("in2","SourceAlpha")}${w("operator","out")}${w("result",`${r}_outlineAlpha`)}/>`,s+=`<feFlood${w("flood-color",i)}${w("flood-opacity",a)}${w("result",`${r}_color`)}/>`,s+=`<feComposite${w("in",`${r}_color`)}${w("in2",`${r}_outlineAlpha`)}${w("operator","in")}${w("result",`${r}_outline`)}/>`,s+=`<feMerge${w("result",r)}><feMergeNode${w("in",`${r}_outline`)}/><feMergeNode${w("in",t)}/></feMerge>`}return s}function dR(e,t,r){let{amount:n}=e;if(n===0)return ot(t,r);let i=1+4*n,a=-n,o=[0,a,0,a,i,a,0,a,0].join(" ");return`<feConvolveMatrix${w("in",t)}${w("order","3")}${w("kernelMatrix",o)}${w("divisor","1")}${w("bias","0")}${w("preserveAlpha","true")}${w("edgeMode","duplicate")}${w("result",r)}/>`}function cR(e,t,r){let{blockSize:n}=e;if(n<=1)return ot(t,r);let i=n/2,a="";return a+=`<feMorphology${w("in",t)}${w("operator","erode")}${w("radius",i)}${w("result",`${r}_eroded`)}/>`,a+=`<feMorphology${w("in",`${r}_eroded`)}${w("operator","dilate")}${w("radius",i)}${w("result",r)}/>`,a}function fR(e,t,r){let{scale:n,frequency:i,octaves:a,warpType:o}=e;if(n===0)return ot(t,r);let s="";return s+=`<feTurbulence${w("type",o)}${w("baseFrequency",i)}${w("numOctaves",a)}${w("seed",0)}${w("result",`${r}_turbulence`)}/>`,s+=`<feDisplacementMap${w("in",t)}${w("in2",`${r}_turbulence`)}${w("scale",n)}${w("xChannelSelector","R")}${w("yChannelSelector","G")}${w("result",r)}/>`,s}function pR(e,t,r){let{operator:n,radiusX:i,radiusY:a}=e;return i===0&&a===0?ot(t,r):`<feMorphology${w("in",t)}${w("operator",n)}${w("radius",`${i} ${a}`)}${w("result",r)}/>`}function hR(e,t,r){let{levels:n}=e;if(n<2)return ot(t,r);let i=[];for(let s=0;s<n;s++)i.push(s/(n-1));let a=i.join(" "),o=`<feComponentTransfer${w("in",t)}${w("result",r)}>`;return o+=`<feFuncR${w("type","discrete")}${w("tableValues",a)}/>`,o+=`<feFuncG${w("type","discrete")}${w("tableValues",a)}/>`,o+=`<feFuncB${w("type","discrete")}${w("tableValues",a)}/>`,o+="</feComponentTransfer>",o}function mR(e,t,r){let{levels:n,contrast:i}=e;if(n<2)return ot(t,r);let a=[];for(let l=0;l<n;l++){let u=l/(n-1),d=u;i!==1&&(d=.5+(u-.5)*i,d=Math.max(0,Math.min(1,d))),a.push(d)}let o=a.join(" "),s=`<feComponentTransfer${w("in",t)}${w("result",r)}>`;return s+=`<feFuncR${w("type","table")}${w("tableValues",o)}/>`,s+=`<feFuncG${w("type","table")}${w("tableValues",o)}/>`,s+=`<feFuncB${w("type","table")}${w("tableValues",o)}/>`,s+="</feComponentTransfer>",s}function gR(e,t,r){let{radius:n}=e;if(n===0)return ot(t,r);let i="";return i+=`<feGaussianBlur${w("in","SourceAlpha")}${w("stdDeviation",n)}${w("result",`${r}_blurredAlpha`)}/>`,i+=`<feComponentTransfer${w("in",`${r}_blurredAlpha`)}${w("result",`${r}_thresholdAlpha`)}><feFuncA${w("type","linear")}${w("slope",20)}${w("intercept",-9)}/></feComponentTransfer>`,i+=`<feComposite${w("in",t)}${w("in2",`${r}_thresholdAlpha`)}${w("operator","in")}${w("result",r)}/>`,i}function yR(e,t,r){let{amount:n}=e;if(n===0)return ot(t,r);let i=1-n;return`<feColorMatrix${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("type","saturate")}${w("values",i)}${w("result",r)}/>`}function vR(e,t,r){let{red:n,green:i,blue:a}=e;if(n===1&&i===1&&a===1)return ot(t,r);let o=`<feComponentTransfer${w("in",t)}${w("result",r)}>`;return o+=`<feFuncR${w("type","linear")}${w("slope",n)}${w("intercept",0)}/>`,o+=`<feFuncG${w("type","linear")}${w("slope",i)}${w("intercept",0)}/>`,o+=`<feFuncB${w("type","linear")}${w("slope",a)}${w("intercept",0)}/>`,o+="</feComponentTransfer>",o}function bR(e,t,r){let{amount:n}=e;if(n===1)return ot(t,r);let i=`<feComponentTransfer${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("result",r)}>`;return i+=`<feFuncR${w("type","linear")}${w("slope",n)}${w("intercept",0)}/>`,i+=`<feFuncG${w("type","linear")}${w("slope",n)}${w("intercept",0)}/>`,i+=`<feFuncB${w("type","linear")}${w("slope",n)}${w("intercept",0)}/>`,i+="</feComponentTransfer>",i}function xR(e,t,r){let{amount:n}=e;if(n===1)return ot(t,r);let i=.5*(1-n),a=`<feComponentTransfer${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("result",r)}>`;return a+=`<feFuncR${w("type","linear")}${w("slope",n)}${w("intercept",i)}/>`,a+=`<feFuncG${w("type","linear")}${w("slope",n)}${w("intercept",i)}/>`,a+=`<feFuncB${w("type","linear")}${w("slope",n)}${w("intercept",i)}/>`,a+="</feComponentTransfer>",a}function wR(e,t,r){let{amount:n}=e;if(n===1)return ot(t,r);let i=`<feComponentTransfer${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("result",r)}>`;return i+=`<feFuncA${w("type","linear")}${w("slope",n)}${w("intercept",0)}/>`,i+="</feComponentTransfer>",i}function IR(e,t,r){let{amount:n}=e;if(n===0)return ot(t,r);let i=n,a=1-n,o=`${i} ${a}`,s=`<feComponentTransfer${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("result",r)}>`;return s+=`<feFuncR${w("type","table")}${w("tableValues",o)}/>`,s+=`<feFuncG${w("type","table")}${w("tableValues",o)}/>`,s+=`<feFuncB${w("type","table")}${w("tableValues",o)}/>`,s+="</feComponentTransfer>",s}function kR(e,t,r){let{angle:n}=e;return n===0||n===360?ot(t,r):`<feColorMatrix${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("type","hueRotate")}${w("values",n)}${w("result",r)}/>`}function SR(e,t,r){let{amount:n}=e;return n===1?ot(t,r):`<feColorMatrix${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("type","saturate")}${w("values",n)}${w("result",r)}/>`}function $R(e,t,r){let{threshold:n}=e,i="";if(i+=`<feColorMatrix${w("in",t)}${w("type","saturate")}${w("values",0)}${w("result",`${r}_gray`)}/>`,n===.5)i+=`<feComponentTransfer${w("in",`${r}_gray`)}${w("result",r)}>`,i+=`<feFuncR${w("type","discrete")}${w("tableValues","0 1")}/>`,i+=`<feFuncG${w("type","discrete")}${w("tableValues","0 1")}/>`,i+=`<feFuncB${w("type","discrete")}${w("tableValues","0 1")}/>`,i+="</feComponentTransfer>";else{let a=[];for(let s=0;s<256;s++)a.push(s/255<n?0:1);let o=a.join(" ");i+=`<feComponentTransfer${w("in",`${r}_gray`)}${w("result",r)}>`,i+=`<feFuncR${w("type","table")}${w("tableValues",o)}/>`,i+=`<feFuncG${w("type","table")}${w("tableValues",o)}/>`,i+=`<feFuncB${w("type","table")}${w("tableValues",o)}/>`,i+="</feComponentTransfer>"}return i}function NR(e,t,r){let{amount:n}=e;if(n===0)return ot(t,r);let i=[.393,.769,.189,0,0],a=[.349,.686,.168,0,0],o=[.272,.534,.131,0,0],s=[1,0,0,0,0],l=[0,1,0,0,0],u=[0,0,1,0,0],d=(m,g)=>m.map((v,b)=>v*(1-n)+g[b]*n),c=d(s,i),f=d(l,a),p=d(u,o),h=[...c,...f,...p,0,0,0,1,0].join(" ");return`<feColorMatrix${w("color-interpolation-filters","sRGB")}${w("in",t)}${w("type","matrix")}${w("values",h)}${w("result",r)}/>`}function MR(e,t,r){let{shadowColor:n,highlightColor:i}=e,a=fd(n),o=fd(i),s="";return s+=`<feColorMatrix${w("in",t)}${w("type","saturate")}${w("values",0)}${w("result",`${r}_gray`)}/>`,s+=`<feComponentTransfer${w("in",`${r}_gray`)}${w("result",r)}>`,s+=`<feFuncR${w("type","table")}${w("tableValues",`${a.r} ${o.r}`)}/>`,s+=`<feFuncG${w("type","table")}${w("tableValues",`${a.g} ${o.g}`)}/>`,s+=`<feFuncB${w("type","table")}${w("tableValues",`${a.b} ${o.b}`)}/>`,s+="</feComponentTransfer>",s}function AR(e,t,r){let{intensity:n}=e;if(n===0)return ot(t,r);let i="";i+=`<feComponentTransfer${w("in",t)}${w("result",`${r}_invert`)}>`,i+=`<feFuncR${w("type","table")}${w("tableValues","1 0")}/>`,i+=`<feFuncG${w("type","table")}${w("tableValues","1 0")}/>`,i+=`<feFuncB${w("type","table")}${w("tableValues","1 0")}/>`,i+="</feComponentTransfer>",i+=`<feColorMatrix${w("in",`${r}_invert`)}${w("type","saturate")}${w("values",0)}${w("result",`${r}_gray`)}/>`;let a=[.1,.1,.1,0,0],o=[.3,.4,.3,0,0],s=[.5,.5,.8,0,0],l=[1,0,0,0,0],u=[0,1,0,0,0],d=[0,0,1,0,0],c=(g,v)=>g.map((b,y)=>b*(1-n)+v[y]*n),f=c(l,a),p=c(u,o),h=c(d,s),m=[...f,...p,...h,0,0,0,1,0].join(" ");return i+=`<feColorMatrix${w("in",`${r}_gray`)}${w("type","matrix")}${w("values",m)}${w("result",r)}/>`,i}function CR(e,t,r){let{amount:n,scale:i}=e;if(n===0)return ot(t,r);let a=1/i,o="";return o+=`<feTurbulence${w("type","fractalNoise")}${w("baseFrequency",a)}${w("numOctaves",3)}${w("seed",0)}${w("result",`${r}_noise`)}/>`,o+=`<feColorMatrix${w("in",`${r}_noise`)}${w("type","saturate")}${w("values",0)}${w("result",`${r}_noiseGray`)}/>`,o+=`<feBlend${w("in",t)}${w("in2",`${r}_noiseGray`)}${w("mode","overlay")}${w("result",`${r}_blended`)}/>`,o+=`<feComposite${w("in",`${r}_blended`)}${w("in2",t)}${w("operator","arithmetic")}${w("k1",0)}${w("k2",n)}${w("k3",1-n)}${w("k4",0)}${w("result",`${r}_amt`)}/>`,o+=`<feComposite${w("in",`${r}_amt`)}${w("in2",t)}${w("operator","in")}${w("result",r)}/>`,o}function OR(e,t,r){let{strength:n,angle:i}=e;if(n===0)return ot(t,r);let a=i*Math.PI/180,o=Math.cos(a),s=Math.sin(a),l=n,u=[-(l*(o+s)),-(l*s),l*(-o+s),-(l*o),1,l*o,l*(o-s),l*s,l*(o+s)].join(" ");return`<feConvolveMatrix${w("in",t)}${w("order","3 3")}${w("kernelMatrix",u)}${w("divisor",1)}${w("bias",.5)}${w("preserveAlpha","true")}${w("result",r)}/>`}function TR(e,t,r){let{amount:n,size:i}=e;if(n===0)return ot(t,r);let a=.5/i,o="";return o+=`<feTurbulence${w("type","fractalNoise")}${w("baseFrequency",`${a} ${a}`)}${w("numOctaves",5)}${w("seed",0)}${w("stitchTiles","stitch")}${w("result",`${r}_grain`)}/>`,o+=`<feColorMatrix${w("in",`${r}_grain`)}${w("type","saturate")}${w("values",0)}${w("result",`${r}_grainGray`)}/>`,o+=`<feBlend${w("in",t)}${w("in2",`${r}_grainGray`)}${w("mode","soft-light")}${w("result",`${r}_blended`)}/>`,o+=`<feComposite${w("in",`${r}_blended`)}${w("in2",t)}${w("operator","arithmetic")}${w("k1",0)}${w("k2",n)}${w("k3",1-n)}${w("k4",0)}${w("result",`${r}_amt`)}/>`,o+=`<feComposite${w("in",`${r}_amt`)}${w("in2",t)}${w("operator","in")}${w("result",r)}/>`,o}function PR(e,t,r){let{wetness:n,turbulence:i}=e;if(n===0&&i===0)return ot(t,r);let a="";return a+=`<feTurbulence${w("type","fractalNoise")}${w("baseFrequency",.02+i*.03)}${w("numOctaves",4)}${w("seed",42)}${w("result",`${r}_turb`)}/>`,a+=`<feDisplacementMap${w("in",t)}${w("in2",`${r}_turb`)}${w("scale",n*15)}${w("xChannelSelector","R")}${w("yChannelSelector","G")}${w("result",`${r}_disp`)}/>`,a+=`<feGaussianBlur${w("in",`${r}_disp`)}${w("stdDeviation",n*2)}${w("result",`${r}_blur`)}/>`,a+=`<feBlend${w("in",`${r}_blur`)}${w("in2",t)}${w("mode","multiply")}${w("result",r)}/>`,a}function DR(e,t,r){let{thickness:n,texture:i}=e;if(n===0&&i===0)return ot(t,r);let a="";a+=`<feTurbulence${w("type","turbulence")}${w("baseFrequency",.03+i*.02)}${w("numOctaves",3)}${w("seed",1e3)}${w("result",`${r}_brush`)}/>`;let o=Math.max(3,8-Math.floor(n*5)),s=Array.from({length:o+1},(l,u)=>u/o).join(" ");a+=`<feComponentTransfer${w("in",t)}${w("result",`${r}_poster`)}>`;for(let l of["R","G","B"])a+=`<feFunc${l}${w("type","discrete")}${w("tableValues",s)}/>`;return a+="</feComponentTransfer>",a+=`<feDisplacementMap${w("in",`${r}_poster`)}${w("in2",`${r}_brush`)}${w("scale",i*4)}${w("xChannelSelector","R")}${w("yChannelSelector","G")}${w("result",`${r}_disp`)}/>`,a+=`<feMorphology${w("in",`${r}_disp`)}${w("operator","dilate")}${w("radius",n*.5)}${w("result",`${r}_thick`)}/>`,a+=`<feComposite${w("in",`${r}_thick`)}${w("in2",t)}${w("operator","in")}${w("result",r)}/>`,a}function jR(e,t,r){let{spread:n,edges:i}=e;if(n===0&&i===0)return ot(t,r);let a="";return a+=`<feTurbulence${w("type","fractalNoise")}${w("baseFrequency",.01+i*.02)}${w("numOctaves",5)}${w("seed",1100)}${w("result",`${r}_ink`)}/>`,a+=`<feMorphology${w("in",t)}${w("operator","dilate")}${w("radius",n*3)}${w("result",`${r}_dilate`)}/>`,a+=`<feDisplacementMap${w("in",`${r}_dilate`)}${w("in2",`${r}_ink`)}${w("scale",i*10)}${w("xChannelSelector","R")}${w("yChannelSelector","G")}${w("result",`${r}_disp`)}/>`,a+=`<feGaussianBlur${w("in",`${r}_disp`)}${w("stdDeviation",n*.5)}${w("result",r)}/>`,a}function ER(e,t,r){let{wrinkles:n,shine:i}=e;if(n===0&&i===0)return ot(t,r);let a="";return a+=`<feTurbulence${w("type","turbulence")}${w("baseFrequency",.02)}${w("numOctaves",4)}${w("seed",1200)}${w("result",`${r}_wrinkle`)}/>`,a+=`<feDisplacementMap${w("in",t)}${w("in2",`${r}_wrinkle`)}${w("scale",n*15)}${w("xChannelSelector","R")}${w("yChannelSelector","G")}${w("result",`${r}_disp`)}/>`,a+=`<feSpecularLighting${w("in",`${r}_wrinkle`)}${w("surfaceScale",n*2)}${w("specularConstant",i*1.5)}${w("specularExponent",20)}${w("result",`${r}_sheen`)}>`,a+=`<feDistantLight${w("azimuth",45)}${w("elevation",60)}/>`,a+="</feSpecularLighting>",a+=`<feBlend${w("in",`${r}_disp`)}${w("in2",`${r}_sheen`)}${w("mode","screen")}${w("result",`${r}_blend`)}/>`,a+=`<feComposite${w("in",`${r}_blend`)}${w("in2",t)}${w("operator","in")}${w("result",r)}/>`,a}function zR(e,t,r){let{density:n,size:i}=e;if(n===0)return ot(t,r);let a="",o=1-n;a+=`<feTurbulence${w("type","turbulence")}${w("baseFrequency",.1/i)}${w("numOctaves",1)}${w("seed",1400)}${w("result",`${r}_hole`)}/>`,a+=`<feComponentTransfer${w("in",`${r}_hole`)}${w("result",`${r}_thresh`)}>`;for(let s of["R","G","B","A"])a+=`<feFunc${s}${w("type","linear")}${w("slope",10)}${w("intercept",-o*10+5)}/>`;a+="</feComponentTransfer>",a+=`<feComponentTransfer${w("in",`${r}_thresh`)}${w("result",`${r}_clamp`)}>`;for(let s of["R","G","B","A"])a+=`<feFunc${s}${w("type","table")}${w("tableValues","0 0 1 1")}/>`;return a+="</feComponentTransfer>",a+=`<feComposite${w("in",t)}${w("in2",`${r}_clamp`)}${w("operator","in")}${w("result",r)}/>`,a}function RR(e,t,r){let{color:n,radius:i,intensity:a}=e;if(a===0||i===0)return ot(t,r);let{r:o,g:s,b:l}=fd(n),u="";return u+=`<feColorMatrix${w("in",t)}${w("type","matrix")}${w("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${w("result",`${r}_alpha`)}/>`,u+=`<feGaussianBlur${w("in",`${r}_alpha`)}${w("stdDeviation",i/2)}${w("result",`${r}_blur`)}/>`,u+=`<feColorMatrix${w("in",`${r}_blur`)}${w("type","matrix")}${w("values",`0 0 0 0 ${o} 0 0 0 0 ${s} 0 0 0 0 ${l} 0 0 0 ${a} 0`)}${w("result",`${r}_color`)}/>`,u+=`<feMerge${w("result",r)}><feMergeNode${w("in",`${r}_color`)}/><feMergeNode${w("in",t)}/></feMerge>`,u}function _R(e,t,r){let{color:n,radius:i,intensity:a}=e;if(a===0||i===0)return ot(t,r);let{r:o,g:s,b:l}=fd(n),u="";return u+=`<feColorMatrix${w("in",t)}${w("type","matrix")}${w("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${w("result",`${r}_alpha`)}/>`,u+=`<feMorphology${w("in",`${r}_alpha`)}${w("operator","erode")}${w("radius",i/4)}${w("result",`${r}_erode`)}/>`,u+=`<feComposite${w("in",`${r}_alpha`)}${w("in2",`${r}_erode`)}${w("operator","out")}${w("result",`${r}_edge`)}/>`,u+=`<feGaussianBlur${w("in",`${r}_edge`)}${w("stdDeviation",i/3)}${w("result",`${r}_blur`)}/>`,u+=`<feColorMatrix${w("in",`${r}_blur`)}${w("type","matrix")}${w("values",`0 0 0 0 ${o} 0 0 0 0 ${s} 0 0 0 0 ${l} 0 0 0 ${a*2} 0`)}${w("result",`${r}_color`)}/>`,u+=`<feComposite${w("in",`${r}_color`)}${w("in2",`${r}_alpha`)}${w("operator","in")}${w("result",`${r}_clipped`)}/>`,u+=`<feComposite${w("in",`${r}_clipped`)}${w("in2",t)}${w("operator","over")}${w("result",r)}/>`,u}function ot(e,t){return`<feMerge${w("result",t)}><feMergeNode${w("in",e)}/></feMerge>`}function nI(e,t=[]){switch(e.type){case"feBlend":return FR(e,t);case"feColorMatrix":return LR(e,t);case"feComponentTransfer":return BR(e,t);case"feComposite":return VR(e,t);case"feConvolveMatrix":return UR(e,t);case"feDiffuseLighting":return GR(e,t);case"feSpecularLighting":return WR(e,t);case"feDisplacementMap":return XR(e,t);case"feDropShadow":return HR(e,t);case"feFlood":return qR(e,t);case"feGaussianBlur":return YR(e,t);case"feImage":return KR(e,t);case"feMerge":return ZR(e,t);case"feMorphology":return JR(e,t);case"feOffset":return QR(e,t);case"feTile":return e_(e,t);case"feTurbulence":return t_(e,t)}}function br(e){let t="";if(t+=w("in",e.in),t+=w("x",e.x),t+=w("y",e.y),t+=w("width",e.width),t+=w("height",e.height),t+=w("color-interpolation-filters",e.colorInterpolationFilters),t+=w("result",e.result),e.unknownAttrs){let r=Object.keys(e.unknownAttrs).sort();for(let n of r)t+=w(n,e.unknownAttrs[n])}return t}function xr(e){return e.join("")}function FR(e,t){let r=`<feBlend${br(e)}${w("in2",e.in2)}${w("mode",e.mode)}`;e.noComposite&&(r+=' no-composite="no-composite"');let n=xr(t);return n?`${r}>${n}</feBlend>`:`${r}/>`}function LR(e,t){let r=`<feColorMatrix${br(e)}${w("type",e.matrixType)}${w("values",e.values)}`,n=xr(t);return n?`${r}>${n}</feColorMatrix>`:`${r}/>`}function Ou(e,t){if(!t)return"";let r=`feFunc${e}`;switch(t.type){case"identity":return`<${r} type="identity"/>`;case"table":case"discrete":return`<${r} type="${t.type}"${w("tableValues",t.tableValues.join(" "))}/>`;case"linear":return`<${r} type="linear"${w("slope",t.slope)}${w("intercept",t.intercept)}/>`;case"gamma":return`<${r} type="gamma"${w("amplitude",t.amplitude)}${w("exponent",t.exponent)}${w("offset",t.offset)}/>`}}function BR(e,t){let r="";return r+=Ou("R",e.funcR),r+=Ou("G",e.funcG),r+=Ou("B",e.funcB),r+=Ou("A",e.funcA),r+=xr(t),`<feComponentTransfer${br(e)}>${r}</feComponentTransfer>`}function VR(e,t){let r=`<feComposite${br(e)}${w("in2",e.in2)}${w("operator",e.operator)}`;e.operator==="arithmetic"&&(r+=w("k1",e.k1),r+=w("k2",e.k2),r+=w("k3",e.k3),r+=w("k4",e.k4));let n=xr(t);return n?`${r}>${n}</feComposite>`:`${r}/>`}function UR(e,t){let r=`<feConvolveMatrix${br(e)}`;r+=w("order",e.order),r+=w("kernelMatrix",e.kernelMatrix),r+=w("divisor",e.divisor),r+=w("bias",e.bias),r+=w("targetX",e.targetX),r+=w("targetY",e.targetY),r+=w("edgeMode",e.edgeMode),r+=w("kernelUnitLength",e.kernelUnitLength),e.preserveAlpha!==void 0&&(r+=w("preserveAlpha",e.preserveAlpha?"true":"false"));let n=xr(t);return n?`${r}>${n}</feConvolveMatrix>`:`${r}/>`}function iI(e){switch(e.kind){case"feDistantLight":return`<feDistantLight${w("azimuth",e.azimuth)}${w("elevation",e.elevation)}/>`;case"fePointLight":return`<fePointLight${w("x",e.x)}${w("y",e.y)}${w("z",e.z)}/>`;case"feSpotLight":{let t=`<feSpotLight${w("x",e.x)}${w("y",e.y)}${w("z",e.z)}${w("pointsAtX",e.pointsAtX)}${w("pointsAtY",e.pointsAtY)}${w("pointsAtZ",e.pointsAtZ)}`;return t+=w("specularExponent",e.specularExponent),t+=w("limitingConeAngle",e.limitingConeAngle),t+"/>"}}}function GR(e,t){let r=`<feDiffuseLighting${br(e)}`;r+=w("surfaceScale",e.surfaceScale),r+=w("diffuseConstant",e.diffuseConstant),r+=w("kernelUnitLength",e.kernelUnitLength),r+=w("lighting-color",e.lightingColor);let n="";return e.lightSource&&(n+=iI(e.lightSource)),n+=xr(t),`${r}>${n}</feDiffuseLighting>`}function WR(e,t){let r=`<feSpecularLighting${br(e)}`;r+=w("surfaceScale",e.surfaceScale),r+=w("specularConstant",e.specularConstant),r+=w("specularExponent",e.specularExponent),r+=w("kernelUnitLength",e.kernelUnitLength),r+=w("lighting-color",e.lightingColor);let n="";return e.lightSource&&(n+=iI(e.lightSource)),n+=xr(t),`${r}>${n}</feSpecularLighting>`}function XR(e,t){let r=`<feDisplacementMap${br(e)}`;r+=w("in2",e.in2),r+=w("scale",e.scale),r+=w("xChannelSelector",e.xChannelSelector),r+=w("yChannelSelector",e.yChannelSelector);let n=xr(t);return n?`${r}>${n}</feDisplacementMap>`:`${r}/>`}function HR(e,t){let r=`<feDropShadow${br(e)}`;r+=w("dx",e.dx),r+=w("dy",e.dy),r+=w("stdDeviation",e.stdDeviation),r+=w("flood-color",e.floodColor),r+=w("flood-opacity",e.floodOpacity);let n=xr(t);return n?`${r}>${n}</feDropShadow>`:`${r}/>`}function qR(e,t){let r=`<feFlood${br(e)}${w("flood-color",e.floodColor)}${w("flood-opacity",e.floodOpacity)}`,n=xr(t);return n?`${r}>${n}</feFlood>`:`${r}/>`}function YR(e,t){let r=`<feGaussianBlur${br(e)}${w("stdDeviation",e.stdDeviation)}${w("edgeMode",e.edgeMode)}`,n=xr(t);return n?`${r}>${n}</feGaussianBlur>`:`${r}/>`}function KR(e,t){let r=`<feImage${br(e)}`;e.href!==void 0?r+=w("href",e.href):e.xlinkHref!==void 0&&(r+=w("xlink:href",e.xlinkHref)),r+=w("preserveAspectRatio",e.preserveAspectRatio),r+=w("crossorigin",e.crossorigin);let n=xr(t);return n?`${r}>${n}</feImage>`:`${r}/>`}function ZR(e,t){let r="";for(let n of e.nodes)r+=`<feMergeNode${w("in",n.in)}/>`;return r+=xr(t),`<feMerge${br(e)}>${r}</feMerge>`}function JR(e,t){let r=`<feMorphology${br(e)}${w("operator",e.operator)}${w("radius",e.radius)}`,n=xr(t);return n?`${r}>${n}</feMorphology>`:`${r}/>`}function QR(e,t){let r=`<feOffset${br(e)}${w("dx",e.dx)}${w("dy",e.dy)}`,n=xr(t);return n?`${r}>${n}</feOffset>`:`${r}/>`}function e_(e,t){let r=`<feTile${br(e)}`,n=xr(t);return n?`${r}>${n}</feTile>`:`${r}/>`}function t_(e,t){let r=`<feTurbulence${br(e)}`;r+=w("baseFrequency",e.baseFrequency),r+=w("numOctaves",e.numOctaves),r+=w("seed",e.seed),r+=w("stitchTiles",e.stitchTiles),r+=w("type",e.turbulenceType);let n=xr(t);return n?`${r}>${n}</feTurbulence>`:`${r}/>`}function r_(e,t,r={}){let n=`<filter${w("id",e)}`;n+=w("x",t.x),n+=w("y",t.y),n+=w("width",t.width),n+=w("height",t.height),n+=w("filterUnits",t.filterUnits),n+=w("primitiveUnits",t.primitiveUnits),t.filterColorInterpolation&&t.filterColorInterpolation!=="auto"&&(n+=w("color-interpolation-filters",t.filterColorInterpolation)),n+=w("flood-color",t.floodColor),n+=w("flood-opacity",t.floodOpacity),n+=w("lighting-color",t.lightingColor),n+=">",t.filterTitle&&(n+=`<title>${Ne(t.filterTitle)}</title>`),t.filterDescription&&(n+=`<desc>${Ne(t.filterDescription)}</desc>`);for(let i of r.root??[])n+=i;for(let i of t.primitives)n+=nI(i,r.primitive?.(i.id)??[]);return n+="</filter>",n}function n_(e,t,r,n){switch(e.type){case"drop-shadow":return tR(e,t,r);case"inner-shadow":return rR(e,t,r);case"gaussian-blur":return nR(e,t,r);case"motion-blur":return iR(e,t,r);case"point-light":{let i=e;return aR(n?{...i,x:i.x+n.x,y:i.y+n.y}:i,t,r)}case"spot-light":{let i=e;return oR(n?{...i,x:i.x+n.x,y:i.y+n.y,pointsAtX:i.pointsAtX+n.x,pointsAtY:i.pointsAtY+n.y}:i,t,r)}case"diffuse-lighting":return sR(e,t,r);case"specular-lighting":return lR(e,t,r);case"outline":return uR(e,t,r);case"sharpen":return dR(e,t,r);case"pixelate":return cR(e,t,r);case"warp":return fR(e,t,r);case"morphology":return pR(e,t,r);case"contouring-discrete":return hR(e,t,r);case"contouring-table":return mR(e,t,r);case"round-edges":return gR(e,t,r);case"grayscale":return yR(e,t,r);case"channel-painter":return vR(e,t,r);case"brightness":return bR(e,t,r);case"contrast":return xR(e,t,r);case"opacity":return wR(e,t,r);case"invert":return IR(e,t,r);case"hue-rotate":return kR(e,t,r);case"saturate":return SR(e,t,r);case"black-and-white":return $R(e,t,r);case"sepia":return NR(e,t,r);case"duotone":return MR(e,t,r);case"xray":return AR(e,t,r);case"noise":return CR(e,t,r);case"emboss":return OR(e,t,r);case"film-grain":return TR(e,t,r);case"watercolor":return PR(e,t,r);case"gouache":return DR(e,t,r);case"ink-blot":return jR(e,t,r);case"crumpled-plastic":return ER(e,t,r);case"riddled":return zR(e,t,r);case"glow":return RR(e,t,r);case"inner-glow":return _R(e,t,r);case"raw-svg":return e.svgContent;case"svg-primitive-chain":return e.primitives.map(i=>nI(i)).join("");default:return ot(t,r)}}function i_(e,t,r={},n={}){let i=eR(e,t,r);if(!i)return"";if(i.kind==="primitive-chain")return r_(e,i.chain,n);let a=i.attributes.map(([u,d])=>w(u,d)).join("");if(i.kind==="raw")return`<filter${a}>${(n.root??[]).join("")}${i.content}</filter>`;let o=(n.root??[]).join(""),s="SourceGraphic",l=0;for(let u of i.filters){let d=`result${l++}`;o+=n_(u,s,d),s=d}return`<filter${a}>${o}</filter>`}function a_(e,t,r){return!t||t.length===0||t.filter(n=>n.enabled).length===0?null:Array.isArray(r)&&r.length>0?r.map(n=>`url(#${Ne(n)})`).join(" "):`url(#filter-${Ne(e)})`}var Pe=(e,t,r={})=>({channel:"attribute",name:e,value:t,...r}),Tu=/^[A-Za-z_][\w:.-]*$/,Pu=(e,t)=>({channel:"style",name:e,value:t});function mt(e){return typeof e=="string"?e:null}function Di(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function aI(e){return mt(e("fillType"))??"solid"}function Ph(e){return e("fillGradient")}function oI(e){if(!e||typeof e!="object")return;let t=e.id;return typeof t=="string"&&t.length>0?t:void 0}function o_(e){let t=mt(e("fillLibraryId"))??oI(Ph(e));return t?`url(#${t})`:"none"}function s_(e){let t=mt(e("strokeLibraryId"))??oI(e("strokeGradient"));return t?`url(#${t})`:"none"}function sv(e,t){let r=mt(e(`${t}Type`))??(t==="fill"?aI(e):"solid"),n=t==="fill"?Ph(e):e("strokeGradient"),i=Di(e(`${t}Opacity`)),a=e(t==="fill"?"preserveFillOpacity":"preserveStrokeOpacity")===!0;if(e(t==="fill"?"inheritFill":"inheritStroke")===!0&&r==="solid"&&!n&&i===null&&!a||r==="none")return null;let o=i??1,s=n&&typeof n=="object"?Di(n.opacity)??1:1,l=o*s;return l<1?l:a?1:null}function l_(e){return mt(e("strokeDasharray"))||BO(mt(e("lineStyle"))??"solid",Di(e("dashLength"))??8,Di(e("gapLength"))??4)}function lv(e){if(!mt(e("strokeDasharray"))&&mt(e("lineStyle"))==="dotted")return"round";let t=mt(e("strokeLinecap"));return t&&t!=="butt"?t:null}function uv(e,t){let r=e(t);return!r||typeof r!="object"||Array.isArray(r)?null:mt(r.value)}function Du(e,t,r={}){if(!e||typeof e!="object"||Array.isArray(e))return[];let n=[];for(let[i,a]of Object.entries(e))typeof a=="string"&&(t==="attribute"&&!/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(i)||n.push({channel:t,name:i,value:a,...r}));return n}var Xo=[{id:"fill",keys:["fillColor","fillType","fillGradient","fillLibraryId","inheritFill","authoredFillPaint"],project:(e,t)=>{let r=uv(e,"authoredFillPaint");if(r)return[Pe("fill",r)];let n=aI(e);return e("inheritFill")===!0&&n==="solid"&&!Ph(e)?[Pe("fill",null)]:n==="none"?[Pe("fill","none")]:n==="linear-gradient"||n==="radial-gradient"||n==="pattern"?[Pe("fill",o_(e))]:[Pe("fill",mt(e("fillColor"))??"#000000")]}},{id:"element-opacity",keys:["opacity","preserveOpacity"],project:e=>{let t=Di(e("opacity")),r=e("preserveOpacity")===!0;return[Pe("opacity",t!==null&&(t<1||r)?t:null)]}},{id:"fill-opacity",keys:["fillOpacity","preserveFillOpacity","fillType","fillGradient","inheritFill"],project:e=>[Pe("fill-opacity",sv(e,"fill"))]},{id:"fill-rule",keys:["fillRule"],project:e=>{let t=mt(e("fillRule"));return[Pe("fill-rule",t&&t!=="nonzero"?t:null)]}},{id:"stroke",keys:["borderColor","strokeType","strokeGradient","strokeLibraryId","inheritStroke","authoredStrokePaint"],project:(e,t)=>{let r=uv(e,"authoredStrokePaint");if(r)return[Pe("stroke",r)];let n=mt(e("strokeType"))??"solid";return e("inheritStroke")===!0&&n==="solid"&&!e("strokeGradient")?[Pe("stroke",null)]:n==="none"?[Pe("stroke","none")]:n==="linear-gradient"||n==="radial-gradient"||n==="pattern"?[Pe("stroke",s_(e))]:[Pe("stroke",mt(e("borderColor"))??"none")]}},{id:"stroke-width",keys:["borderWidth"],project:e=>{let t=e("borderWidth");return[Pe("stroke-width",typeof t=="number"||typeof t=="string"?t:null)]}},{id:"stroke-opacity",keys:["strokeOpacity","preserveStrokeOpacity","strokeType","strokeGradient","inheritStroke"],project:e=>[Pe("stroke-opacity",sv(e,"stroke"))]},{id:"blend-mode",keys:["blendMode"],project:e=>{let t=mt(e("blendMode"));return[Pu("mix-blend-mode",t&&t!=="normal"?t:null)]}},{id:"paint-order",keys:["paintOrder"],project:e=>{let t=mt(e("paintOrder"));return[Pe("paint-order",t&&t!=="normal"?t:null)]}},{id:"inline-style",keys:["inlineStyle"],project:(e,t)=>Du(t.retainCssAnimationDeclarations===!1?tx(e("inlineStyle")):e("inlineStyle"),"style")},{id:"markers",keys:["markerStart","markerMid","markerEnd"],project:e=>[["marker-start",e("markerStart")],["marker-mid",e("markerMid")],["marker-end",e("markerEnd")]].map(([t,r])=>Pe(String(t),typeof r=="string"&&r?`url(#${r})`:null))},{id:"stroke-linejoin",keys:["strokeLinejoin"],project:e=>{let t=mt(e("strokeLinejoin"));return[Pe("stroke-linejoin",t&&t!=="miter"?t:null)]}},{id:"stroke-linecap",keys:["strokeLinecap"],project:e=>[Pe("stroke-linecap",lv(e))]},{id:"stroke-miterlimit",keys:["strokeMiterlimit"],project:e=>{let t=Di(e("strokeMiterlimit"));return[Pe("stroke-miterlimit",t!==null&&t!==4?t:null)]}},{id:"stroke-dasharray",keys:["lineStyle","dashLength","gapLength","strokeDasharray","strokeLinecap"],project:e=>[Pe("stroke-dasharray",l_(e)),Pe("stroke-linecap",lv(e))]},{id:"stroke-dashoffset",keys:["dashOffset"],project:e=>{let t=Di(e("dashOffset"));return[Pe("stroke-dashoffset",t!==null&&t!==0?t:null)]}},{id:"shape-rendering",keys:["shapeRendering"],project:e=>{let t=mt(e("shapeRendering"));return[Pe("shape-rendering",t&&t!=="auto"?t:null)]}},{id:"text-rendering",keys:["textRendering"],project:e=>{let t=mt(e("textRendering"));return[Pe("text-rendering",t&&t!=="auto"?t:null)]}},{id:"image-rendering",keys:["imageRendering"],project:e=>{let t=mt(e("imageRendering"));return[Pe("image-rendering",t&&t!=="auto"?t:null)]}},{id:"color-rendering",keys:["colorRendering"],project:e=>{let t=mt(e("colorRendering"));return[Pe("color-rendering",t&&t!=="auto"?t:null)]}},{id:"color-interpolation",keys:["colorInterpolation"],project:e=>{let t=mt(e("colorInterpolation"));return[Pe("color-interpolation",t&&t!=="sRGB"?t:null)]}},{id:"filter",keys:["filters","filterLibraryIds"],project:(e,t)=>[Pe("filter",a_(t.shapeId,e("filters"),e("filterLibraryIds")))]},{id:"system-language",keys:["systemLanguage"],project:e=>{let t=e("systemLanguage");return[Pe("systemLanguage",typeof t=="string"?t:null,{allowEmpty:!0})]}},{id:"required-extensions",keys:["requiredExtensions"],project:e=>{let t=e("requiredExtensions");return[Pe("requiredExtensions",typeof t=="string"?t:null,{allowEmpty:!0})]}},{id:"vector-effect",keys:["vectorEffect"],project:e=>{let t=mt(e("vectorEffect"));return[Pe("vector-effect",t&&t!=="none"?t:null)]}},{id:"visibility",keys:["visibility"],project:e=>{let t=mt(e("visibility"));return[Pe("visibility",t&&t!=="visible"?t:null)]}},{id:"display",keys:["displayAttr"],project:e=>{let t=mt(e("displayAttr"));return[Pe("display",t&&t!=="inline"?t:null)]}},{id:"visible",keys:["visible"],project:e=>[Pu("display",e("visible")===!1?"none":null)]},{id:"path-length",keys:["pathLength"],project:e=>{let t=Di(e("pathLength"));return[Pe("pathLength",t!==null&&t>=0?t:null)]}},{id:"transform-box",keys:["transformBox"],project:e=>{let t=mt(e("transformBox"));return[Pu("transform-box",t&&t!=="view-box"?t:null)]}},{id:"transform",keys:["rotation","transformMatrix","translateX","translateY","skewX","skewY","scaleX","scaleY","customPivot","rawTransform"],project:()=>[]},{id:"locked",keys:["locked"],project:()=>[]},{id:"metadata",keys:["metadata"],project:e=>{let t=e("metadata"),r=[],n=t?.name?wa(t.name):"";if(r.push(Pe("id",n||null)),r.push(Pe("class",t?.classes&&t.classes.length>0?t.classes.join(" "):null)),r.push(Pe("role",t?.role??null)),r.push(Pe("aria-label",t?.ariaLabel??null)),t?.aria)for(let[i,a]of Object.entries(t.aria))i!=="aria-label"&&Tu.test(i)&&r.push(Pe(i,a));if(r.push(Pe("xml:lang",t?.lang??null)),typeof t?.tabindex=="number"&&Number.isFinite(t.tabindex)&&r.push(Pe("tabindex",String(Math.trunc(t.tabindex)))),t?.autofocus&&r.push(Pe("autofocus","",{allowEmpty:!0})),r.push(Pe("xml:space",t?.xmlSpace??null)),t?.customData)for(let[i,a]of Object.entries(t.customData)){let o=`data-${i}`;Tu.test(o)&&r.push(Pe(o,a))}if(t?.foreignAttrs){for(let i of t.foreignAttrs)Tu.test(i.name)&&r.push(Pe(i.name,i.value));for(let i of h2()){let a=new Map;for(let o of t.foreignAttrs)Mp(o.namespaceURI??null)===i&&a.set(o.name.split(":").at(-1)??o.name,o.value);if(a.size!==0)for(let o of i.emit(a,e))Tu.test(o.name)&&r.push(Pe(o.name,o.value))}}return r}},{id:"css-clip-path",keys:["cssClipPath"],project:e=>[Pu("clip-path",mt(e("cssClipPath")))]},{id:"css-mask-properties",keys:["cssMaskProperties"],project:e=>Du(e("cssMaskProperties"),"style")},{id:"container-presentation",keys:["containerPresentation"],project:(e,t)=>t.includeContainerPresentation?Du(e("containerPresentation"),"attribute",{ifAbsent:!0}):[]},{id:"authored-attributes",keys:["authoredAttributes"],project:(e,t)=>t.includeAuthoredAttributes?Du(e("authoredAttributes"),"attribute",{ifAbsent:!0}):[]}];function hl(e,t,r){let n=t("presentationChannels"),i=n&&typeof n=="object"&&!Array.isArray(n)?n:null;return e.project(t,r).flatMap(a=>{let o=i?.[a.name];return o==="stylesheet-dynamic"?[]:o==="stylesheet-static"?r.projectStaticStylesheetValues?[{...a,channel:"style",ifAbsent:void 0}]:[]:a.channel==="attribute"&&o==="style"?[{...a,channel:"style",ifAbsent:void 0}]:[a]})}function sI(e,t){return Xo.flatMap(r=>hl(r,e,t))}function Ho(e){let t=e;return r=>r==="displayAttr"?e.display:t[r]}var u_=[["fontVariant","font-variant"],["fontVariantLigatures","font-variant-ligatures"],["fontVariantPosition","font-variant-position"],["fontVariantCaps","font-variant-caps"],["fontVariantNumeric","font-variant-numeric"],["fontVariantEastAsian","font-variant-east-asian"]];function Ne(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function lI(e){let t=new Map,r=new Map,n=e.state,i=n;switch(e.type){case"circle":t.set("cx",String(n.x??0)),t.set("cy",String(n.y??0)),t.set("r",String(n.radius??50));break;case"ellipse":t.set("cx",String(n.cx??0)),t.set("cy",String(n.cy??0)),t.set("rx",String(n.rx??50)),t.set("ry",String(n.ry??30));break;case"rectangle":case"square":t.set("x",String(n.x??0)),t.set("y",String(n.y??0)),t.set("width",String(n.width??100)),t.set("height",String(n.height??100));{let l=n.rx??n.cornerRadius??0,u=n.ry??n.cornerRadius??0;(l>0||u>0)&&(t.set("rx",String(l)),t.set("ry",String(u)))}break;case"line":t.set("x1",String(n.x1??0)),t.set("y1",String(n.y1??0)),t.set("x2",String(n.x2??0)),t.set("y2",String(n.y2??0));break;case"text":t.set("x",String(n.x??0)),t.set("y",String(n.y??0)),n.fontSize&&t.set("font-size",String(n.fontSize)),n.fontFamily&&t.set("font-family",n.fontFamily),n.fontWeight&&t.set("font-weight",String(n.fontWeight)),n.fontStyle&&t.set("font-style",n.fontStyle),n.textAnchor&&t.set("text-anchor",n.textAnchor),n.letterSpacing&&t.set("letter-spacing",String(n.letterSpacing));for(let[l,u]of u_){let d=typeof n[l]=="string"?String(n[l]).trim():"";d&&r.set(u,d)}break;case"image":t.set("x",String(n.x??0)),t.set("y",String(n.y??0)),t.set("width",String(n.width??100)),t.set("height",String(n.height??100)),i.href&&t.set("href",String(i.href));break}for(let l of sI(Ho(n),{shapeId:e.id,includeAuthoredAttributes:!0})){if(l.channel==="style"){r.delete(l.name),l.value!==null&&l.value!==""&&r.set(l.name,String(l.value));continue}l.ifAbsent&&t.has(l.name)||(t.delete(l.name),!(l.value===null||l.value===""&&!l.allowEmpty)&&t.set(l.name,String(l.value)))}r.size>0&&t.set("style",[...r].map(([l,u])=>`${l}: ${u}`).join("; "));let a=c_(i);a&&t.set("transform",a);let o=i.startEndpoint,s=i.endEndpoint;return o&&o!=="none"&&t.set("marker-start",`url(#line-marker-${o})`),s&&s!=="none"&&t.set("marker-end",`url(#line-marker-${s})`),t}function d_(e){switch(e.type){case"circle":return"circle";case"ellipse":return"ellipse";case"rectangle":case"square":return"rect";case"line":return"line";case"text":return"text";case"image":return"image";case"path":case"polyline":case"triangle":case"ngon":case"star":case"cross":case"ring":case"spiral":case"gear":case"arrow":return"path";default:return"g"}}function c_(e){return ln(e)}function f_(e,t){let r=e.viewboxes?.[0];return{width:t.width??r?.width??800,height:t.height??r?.height??600}}var rl="https://svgsketch.com/ns/metadata",pd="http://www.w3.org/1999/02/22-rdf-syntax-ns#",kn="http://purl.org/dc/elements/1.1/",ml="http://creativecommons.org/ns#";var uI={rdf:pd,rdfs:"http://www.w3.org/2000/01/rdf-schema#",owl:"http://www.w3.org/2002/07/owl#",xsd:"http://www.w3.org/2001/XMLSchema#",dc:kn,dcterms:"http://purl.org/dc/terms/",cc:ml,xmp:"http://ns.adobe.com/xap/1.0/",xmpRights:"http://ns.adobe.com/xap/1.0/rights/",xmpMM:"http://ns.adobe.com/xap/1.0/mm/",photoshop:"http://ns.adobe.com/photoshop/1.0/",illustrator:"http://ns.adobe.com/AdobeIllustrator/10.0/",exif:"http://ns.adobe.com/exif/1.0/",tiff:"http://ns.adobe.com/tiff/1.0/",foaf:"http://xmlns.com/foaf/0.1/",schema:"http://schema.org/",og:"https://ogp.me/ns#",inkscape:"http://www.inkscape.org/namespaces/inkscape",sodipodi:"http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd",prism:"http://prismstandard.org/namespaces/basic/3.0/",svgsketch:rl},dI=new Set([`${kn}|creator`,`${kn}|subject`,`${kn}|rights`,`${kn}|description`,`${ml}|license`]);function cI(e){let t=e.indexOf(":");if(t<=0||t===e.length-1)return null;let r=e.slice(0,t),n=e.slice(t+1);if(!/^[A-Za-z_][\w.-]*$/.test(n))return null;let i=uI[r];return i?{ns:i,local:n,prefix:r}:null}var p_={cc0:"https://creativecommons.org/publicdomain/zero/1.0/","cc-by":"https://creativecommons.org/licenses/by/4.0/","cc-by-sa":"https://creativecommons.org/licenses/by-sa/4.0/","cc-by-nc":"https://creativecommons.org/licenses/by-nc/4.0/","cc-by-nc-sa":"https://creativecommons.org/licenses/by-nc-sa/4.0/","cc-by-nd":"https://creativecommons.org/licenses/by-nd/4.0/","cc-by-nc-nd":"https://creativecommons.org/licenses/by-nc-nd/4.0/",mit:"https://opensource.org/licenses/MIT","apache-2.0":"https://www.apache.org/licenses/LICENSE-2.0"},h_={cc0:"CC0 1.0 Universal (Public Domain)","cc-by":"Creative Commons Attribution 4.0","cc-by-sa":"Creative Commons Attribution-ShareAlike 4.0","cc-by-nc":"Creative Commons Attribution-NonCommercial 4.0","cc-by-nc-sa":"Creative Commons Attribution-NonCommercial-ShareAlike 4.0","cc-by-nd":"Creative Commons Attribution-NoDerivatives 4.0","cc-by-nc-nd":"Creative Commons Attribution-NonCommercial-NoDerivatives 4.0",mit:"MIT License","apache-2.0":"Apache License 2.0",custom:"Custom License"};function m_(e,t){return e==="custom"?t||"":p_[e]||""}function g_(e){return h_[e]||e}function dv(e){return!!(e.author||e.keywords&&e.keywords.length>0||e.license||e.customMetadata&&Object.keys(e.customMetadata).length>0)}function fI(e){let t=[];if(e.author&&t.push(`<dc:creator>${Ne(e.author)}</dc:creator>`),e.keywords&&e.keywords.length>0&&t.push(`<dc:subject>${Ne(e.keywords.join(", "))}</dc:subject>`),e.license){let r=m_(e.license,e.licenseUrl);r&&t.push(`<cc:license rdf:resource="${Ne(r)}"/>`),t.push(`<dc:rights>${Ne(g_(e.license))}</dc:rights>`)}if(e.customMetadata)for(let[r,n]of Object.entries(e.customMetadata)){let i=cI(r);if(i){if(dI.has(`${i.ns}|${i.local}`))continue;t.push(`<${i.prefix}:${i.local}>${Ne(n??"")}</${i.prefix}:${i.local}>`)}else t.push(`<svgsketch:custom key="${Ne(r)}" value="${Ne(n??"")}"/>`)}return t.join(`
39
+ `)}function y_(e){let t=fI(e);return t.length>0?`<rdf:Description svgsketch:managed="true">
40
+ ${t}
41
+ </rdf:Description>`:`<rdf:Description svgsketch:managed="true">
42
+ </rdf:Description>`}function cv(e){let t={rdf:pd,dc:kn,cc:ml,svgsketch:rl};if(e.customMetadata)for(let r of Object.keys(e.customMetadata)){let n=cI(r);n&&!(n.prefix in t)&&(t[n.prefix]=n.ns)}return`<metadata>
43
+ <rdf:RDF ${Object.entries(t).map(([r,n])=>`xmlns:${r}="${n}"`).join(" ")}>
44
+ `+y_(e)+`
45
+ </rdf:RDF>
46
+ </metadata>`}var v_=["dc:creator","dc:subject","dc:rights","dc:description","cc:license","svgsketch:custom"];function b_(e){let t=e;for(let r of v_)t=t.replace(new RegExp(`<${r}\\b[^>]*/>\\s*`,"g"),""),t=t.replace(new RegExp(`<${r}\\b[^>]*>[\\s\\S]*?</${r}>\\s*`,"g"),"");return t}function x_(e,t){let r=e.match(/<rdf:Description\b/g);if(!r||r.length!==1||!/<rdf:RDF\b/.test(e))return null;let n=/<rdf:Description\b((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/.exec(e);if(!n)return null;let[i,a,o]=[n[0],n[1],n[2]],s=n.index,l=fI(t),u=`<rdf:Description svgsketch:managed="true"${a}>`,d;if(o==="/")d=e.slice(0,s)+`${u}
47
+ ${l}
48
+ </rdf:Description>`+e.slice(s+i.length);else{let f=e.lastIndexOf("</rdf:Description>");if(f<=s)return null;let p=b_(e.slice(s+i.length,f));d=e.slice(0,s)+u+p+`${l}
49
+ `+e.slice(f)}let c=[["svgsketch",rl],["dc",kn],["cc",ml]];return d=d.replace(/<rdf:RDF\b((?:[^>"']|"[^"]*"|'[^']*')*?)>/,(f,p)=>{let h="";for(let[m,g]of c)d.includes(`xmlns:${m}=`)||(h+=` xmlns:${m}="${g}"`);return h?`<rdf:RDF${p}${h}>`:f}),d}function pI(e){return e.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g,"$1").replace(/<[^>]*>/g,"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&").trim()}function w_(e){if(!e)return"";let t="";if(e.language&&(t+=` xml:lang="${Ne(e.language)}"`),e.role&&(t+=` role="${Ne(e.role)}"`),e.ariaLabel&&(t+=` aria-label="${Ne(e.ariaLabel)}"`),e.aria)for(let[r,n]of Object.entries(e.aria))r==="aria-label"||!/^aria-[A-Za-z0-9_.:-]+$/u.test(r)||(t+=` ${r}="${Ne(n)}"`);return t}function Yf(e,t,r){let n=r?` xml:lang="${Ne(r)}"`:"";return`<${e}${n}>${Ne(t)}</${e}>`}function hI(e){let t=e.descriptiveElements;if(!t)return null;let r={title:!1,desc:!1},n=[];for(let i of t){let a=!r[i.kind];if(r[i.kind]=!0,!a){n.push(i.rawXml);continue}let o=i.kind==="title"?e.title:e.description;(o??"").trim()===i.text.trim()?n.push(i.rawXml):o&&n.push(Yf(i.kind,o,i.language))}return!r.title&&e.title&&n.unshift(Yf("title",e.title,null)),!r.desc&&e.description&&n.push(Yf("desc",e.description,null)),n.join("")}function Kd(e){if(!e)return"";let t="",r=hI(e);if(r!==null)t+=r;else if(e.title&&(t+=`<title>${Ne(e.title)}</title>`),e.description||e.rawDescription){let n=pI(e.rawDescription??""),i=(e.description??"").trim();t+=e.rawDescription&&n===i?`<desc>${e.rawDescription}</desc>`:`<desc>${Ne(e.description??"")}</desc>`}return e.rawMetadata&&(t+=e.rawMetadata),t}function I_(e,t){if(!e)return"";let r="",n=hI(e);if(n!==null)r+=n;else if(e.title&&(r+=`<title>${Ne(e.title)}</title>`),e.description||e.rawDescription){let i=pI(e.rawDescription??""),a=(e.description??"").trim();e.rawDescription&&i===a?r+=`<desc>${e.rawDescription}</desc>`:r+=`<desc>${Ne(e.description)}</desc>`}if(t?.includeMetadata===!1)return r;if(e.rawMetadata)if(!e.rawMetadataAuthoritative&&dv(e)&&!e.rawMetadata.includes("svgsketch:managed")){let i=x_(e.rawMetadata,e);r+=i??cv(e)+e.rawMetadata}else r+=e.rawMetadata;else dv(e)&&(r+=cv(e));return e.rawHtmlMetadata&&(r+=e.rawHtmlMetadata),r}var Lp="http://www.w3.org/1999/xhtml",Dh="http://www.w3.org/XML/1998/namespace",k_="http://www.w3.org/1999/xlink",Yu="http://www.w3.org/2000/xmlns/",S_=new Set([ye,Dh,k_,Lp,Yu]),$_=new Set(["data-shape-id","data-locked","data-hidden","data-cx","data-cy","data-radius","data-corner-radius","data-shift-angle","data-sides","data-arms","data-inner-radius-percent","data-arm-width-percent","data-turns","data-thickness-percent","data-direction","data-teeth","data-tooth-depth-percent","data-hole-radius-percent","data-head-width-percent","data-head-length-percent","data-shaft-width-percent","data-line-style","data-dash-length","data-gap-length","data-start-endpoint","data-end-endpoint","data-original-width","data-original-height","data-preserve-aspect-ratio"]),N_=Object.freeze(Object.fromEntries(Object.entries(uI).map(([e,t])=>[t,e])));function jh(e,t,r){return e.attributes.find(n=>n.localName===t&&n.namespaceUri===r)??null}function Eh(e){let t=jh(e,"lang",Dh);return t?t.value:j(e,"lang")}function sa(e){let t="",r=[...e.children].reverse();for(;r.length>0;){let n=r.pop();n.kind==="text"||n.kind==="cdata"?t+=n.value:n.kind==="element"&&r.push(...[...n.children].reverse())}return t}function mI(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function M_(e){return mI(e).replaceAll('"',"&quot;")}function A_(e){switch(e.kind){case"text":return mI(e.value);case"comment":return`<!--${e.value}-->`;case"cdata":return`<![CDATA[${e.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`;case"processing-instruction":return`<?${e.value}?>`;case"doctype":return`<!DOCTYPE ${e.value}>`}}function C_(e){let t=new Set,r=!1,n=[e];for(;n.length>0;){let i=n.pop();i.prefix&&i.prefix!=="xml"?t.add(i.prefix):!i.prefix&&i.namespaceUri&&(r=!0);for(let a of i.attributes)a.prefix&&a.prefix!=="xmlns"&&a.prefix!=="xml"&&t.add(a.prefix);for(let a of i.children)a.kind==="element"&&n.push(a)}return{prefixes:t,defaultNamespace:r}}function O_(e){let t=[e];for(;t.length>0;){let r=t.pop();if(!r.prefix&&r.namespaceUri)return r.namespaceUri;for(let n of r.children)n.kind==="element"&&t.push(n)}return null}function T_(e,t){let r=C_(t),n=new Map;for(let a of t.attributes)(a.namespaceUri===Yu||a.name==="xmlns")&&n.set(a.name,a);let i=e.index.parent(t.sourceNodeId);for(;i;){for(let a of i.attributes)!(a.namespaceUri===Yu||a.name==="xmlns")||n.has(a.name)||(a.name==="xmlns"&&r.defaultNamespace||a.prefix==="xmlns"&&r.prefixes.has(a.localName))&&n.set(a.name,a);i=e.index.parent(i.sourceNodeId)}if(r.defaultNamespace&&!n.has("xmlns")){let a=O_(t);a&&n.set("xmlns",{name:"xmlns",localName:"xmlns",prefix:null,namespaceUri:Yu,value:a,span:t.span})}return Object.freeze([...n.values()].filter(a=>!t.attributes.some(o=>o.name===a.name)))}function gI(e,t=[]){let r=[...t,...e.attributes].map(o=>`${o.name}="${M_(o.value)}"`),n=`<${e.name}${r.length>0?` ${r.join(" ")}`:""}`,i=e.children.map(yI).join(""),a=/\/\s*>\s*$/u.test(e.rawXml??"");return i.length===0&&a?`${n}/>`:`${n}>${i}</${e.name}>`}function yI(e){return e.kind==="element"?gI(e):A_(e)}function nl(e,t){return gI(t,T_(e,t))}function zh(e,t){return e.children.map(r=>r.kind!=="element"||!t?yI(r):nl(t,r)).join("")}function vI(e,t){return e.children.filter(r=>r.kind==="element"&&r.namespaceUri===ye&&r.localName.toLowerCase()===t)}function bI(e,t){return Object.freeze(t.children.filter(r=>r.kind==="element"&&r.namespaceUri===ye&&(r.localName.toLowerCase()==="title"||r.localName.toLowerCase()==="desc")).map(r=>Object.freeze({kind:r.localName.toLowerCase(),sourceNodeId:r.sourceNodeId,language:Eh(r),text:sa(r).trim(),rawInnerXml:zh(r),rawXml:nl(e,r)})))}function xI(e){return e.map(({kind:t,language:r,text:n,rawXml:i})=>({kind:t,language:r,text:n,rawXml:i}))}function wI(e){return e.children.some(t=>t.kind==="element")}function P_(e){if(e.classes&&Object.freeze(e.classes),e.aria&&Object.freeze(e.aria),e.customData&&Object.freeze(e.customData),e.foreignAttrs){for(let t of e.foreignAttrs)Object.freeze(t);Object.freeze(e.foreignAttrs)}if(e.descriptiveElements){for(let t of e.descriptiveElements)Object.freeze(t);Object.freeze(e.descriptiveElements)}return Object.freeze(e)}function D_(e,t,r,n,i){let a={};r.length>0&&(a.descriptiveElements=xI(r));let o=j(t,"id");o&&(a.name=o);let s=(j(t,"class")??"").split(/\s+/u).filter(Boolean);s.length>0&&(a.classes=s);let l=r.find(y=>y.kind==="title"),u=r.find(y=>y.kind==="desc");if(l?.text&&(a.title=l.text),u?.text&&(a.description=u.text),u){let y=e.index.element(u.sourceNodeId);y&&wI(y)&&(a.rawDescription=zh(y,e))}let d=j(t,"role");d&&(a.role=d);let c=j(t,"aria-label");c&&(a.ariaLabel=c);let f={},p={};for(let y of t.attributes)y.namespaceUri===null&&(y.name.startsWith("aria-")&&y.name!=="aria-label"&&y.value&&(f[y.name]=y.value),y.name.startsWith("data-")&&!$_.has(y.name)&&(p[y.name.slice(5)]=y.value));Object.keys(f).length>0&&(a.aria=f),Object.keys(p).length>0&&(a.customData=p);let h=Eh(t);h!==null&&(a.lang=h);let m=j(t,"tabindex");if(m!==null){if(/^[+-]?\d+$/u.test(m.trim())){let y=Number(m);Number.isSafeInteger(y)&&(a.tabindex=y)}a.tabindex===void 0&&i.push({severity:"warning",code:"invalid-svg-attribute",source:n.source,entrypoint:n.entrypoint,capability:"metadata",documentPath:e.index.sourcePath(t.sourceNodeId),elementName:t.name,...o?{sourceId:o}:{},sourceNodeId:t.sourceNodeId,message:`Invalid tabindex value "${m}" was ignored.`})}if(Ri(t,"autofocus")&&(a.autofocus=!0),!["text","tspan","flowroot"].includes(t.localName.toLowerCase())){let y=jh(t,"space",Dh)?.value;(y==="default"||y==="preserve")&&(a.xmlSpace=y)}let g=tw(t.attributes),v=t.attributes.filter(y=>y.namespaceUri!==null&&!S_.has(y.namespaceUri)).filter(y=>!(g&&y.namespaceUri!==null&&g.vocabulary.namespaceUris.includes(y.namespaceUri)&&g.projection.consumes.includes(y.localName))).map(y=>({name:y.name,namespaceURI:y.namespaceUri,value:y.value}));v.length>0&&(a.foreignAttrs=v);let b=vI(t,"metadata").map(y=>nl(e,y)).join(`
50
+ `);return b&&(a.rawMetadata=b),P_(a)}function fv(e){let t=[],r=[...e.children].reverse();for(;r.length>0;){let n=r.pop();n.kind==="element"&&(t.push(n),r.push(...[...n.children].reverse()))}return t}function pv(e,t,r){return jh(e,t,r)?.value??null}function j_(e){let t=e.toLowerCase();return t.includes("publicdomain")||t.includes("cc0")?"cc0":t.includes("by-nc-nd")?"cc-by-nc-nd":t.includes("by-nc-sa")?"cc-by-nc-sa":t.includes("by-nc")?"cc-by-nc":t.includes("by-nd")?"cc-by-nd":t.includes("by-sa")?"cc-by-sa":t.includes("/by/")||t.includes("attribution")?"cc-by":t.includes("mit")?"mit":t.includes("apache")?"apache-2.0":"custom"}function E_(e){let t=e.flatMap(f=>fv(f).filter(p=>p.namespaceUri===pd&&p.localName==="Description")),r=t.find(f=>pv(f,"managed",rl)==="true")??t[0];if(!r)return{};let n={},i=fv(r),a=i.find(f=>f.namespaceUri===kn&&f.localName==="creator");a?.children.length&&(n.author=sa(a).trim());let o=i.find(f=>f.namespaceUri===kn&&f.localName==="subject");if(o){let f=sa(o).split(",").map(p=>p.trim()).filter(Boolean);f.length>0&&(n.keywords=f)}let s=i.find(f=>f.namespaceUri===ml&&f.localName==="license"),l=i.find(f=>f.namespaceUri===kn&&f.localName==="rights"),u=s?pv(s,"resource",pd)??sa(s).trim():l?sa(l).trim():"";u&&(n.license=j_(u),n.license==="custom"&&(n.licenseUrl=u));let d={},c=r.children.filter(f=>f.kind==="element");for(let f of c){if(f.namespaceUri===rl&&f.localName==="custom"){let g=j(f,"key");g!==null&&(d[g]=j(f,"value")??"");continue}let p=f.namespaceUri??"";if(dI.has(`${p}|${f.localName}`))continue;let h=N_[p];if(!h)continue;let m=`${h}:${f.localName}`;m in d||(d[m]=sa(f).trim())}if(Object.keys(d).length===0)for(let f of c){if(f.namespaceUri!==kn||f.localName!=="description")continue;let p=sa(f),h=p.indexOf(":");if(h<=0)continue;let m=p.slice(0,h).trim();m&&(d[m]=p.slice(h+1).trim())}return Object.keys(d).length>0&&(n.customMetadata=d),n}function z_(e){let t=e.root,r=bI(e,t),n=vI(t,"metadata"),i=E_(n);r.length>0&&(i.descriptiveElements=xI(r));let a=Eh(t);a!==null&&(i.language=a);let o=j(t,"role");o&&(i.role=o);let s=j(t,"aria-label");s&&(i.ariaLabel=s);let l={};for(let h of t.attributes)h.namespaceUri===null&&h.name.startsWith("aria-")&&h.name!=="aria-label"&&h.value&&(l[h.name]=h.value);Object.keys(l).length>0&&(i.aria=l);let u=r.find(h=>h.kind==="title"),d=r.find(h=>h.kind==="desc");if(u?.text&&(i.title=u.text),d?.text&&(i.description=d.text),d){let h=e.index.element(d.sourceNodeId);h&&wI(h)&&(i.rawDescription=zh(h,e))}let c=n.map(h=>nl(e,h)).join(`
51
+ `);c&&(i.rawMetadata=c,i.rawMetadataAuthoritative=!0);let f=Object.freeze(t.children.filter(h=>h.kind==="element"&&h.namespaceUri===Lp&&["base","link","meta"].includes(h.localName.toLowerCase())).map(h=>Object.freeze({sourceNodeId:h.sourceNodeId,localName:h.localName.toLowerCase(),namespaceUri:Lp,rawXml:nl(e,h)})));f.length>0&&(i.rawHtmlMetadata=f.map(h=>h.rawXml).join(`
52
+ `));let p=[];for(let h=t.children.length-1;h>=0;h--){let m=t.children[h];if(m.kind==="comment"){p.unshift(m.value);continue}if(!(m.kind==="text"&&!m.value.trim()))break}if(p.length>0&&(i.trailingComments=p),i.keywords&&Object.freeze(i.keywords),i.customMetadata&&Object.freeze(i.customMetadata),i.aria&&Object.freeze(i.aria),i.trailingComments&&Object.freeze(i.trailingComments),i.descriptiveElements){for(let h of i.descriptiveElements)Object.freeze(h);Object.freeze(i.descriptiveElements)}return Object.freeze({sourceNodeId:t.sourceNodeId,metadata:Object.freeze(i),descriptiveElements:r,htmlMetadata:f})}function R_(e,t){let r=e.index.parent(t.sourceNodeId);if(!r)return Object.freeze([]);let n=r.children.findIndex(a=>a.kind==="element"&&a.sourceNodeId===t.sourceNodeId);if(n<0)return Object.freeze([]);let i=[];for(let a=n-1;a>=0;a--){let o=r.children[a];if(o.kind==="comment"){i.unshift(o.value);continue}if(!(o.kind==="text"&&o.value.trim().length===0))break}return Object.freeze(i)}function __(e,t){let r=[],n=[];for(let o of e.index.elements){if(o===e.root||o.namespaceUri!==ye)continue;let s=bI(e,o),l=D_(e,o,s,t,r),u=R_(e,o);Object.keys(l).length===0&&s.length===0&&u.length===0||n.push(Object.freeze({sourceNodeId:o.sourceNodeId,metadata:l,descriptiveElements:s,leadingComments:u}))}let i=Object.freeze(n),a=new Map(i.map(o=>[o.sourceNodeId,o]));return{value:Object.freeze({document:z_(e),candidates:i,candidate(o){return a.get(o)??null}}),diagnostics:Object.freeze(r)}}var F_="http://www.w3.org/1999/xhtml",II="http://www.w3.org/2000/xmlns/",L_=new Set(["font-face","hatch","solidcolor"]),B_=new Set(["title","desc"]);function kI(e,t){return{name:e.name,localName:e.localName,prefix:e.prefix,namespaceUri:e.namespaceUri,value:t}}function Rh(e,t){if(e.kind==="doctype")return null;if(e.kind!=="element")return{kind:e.kind,value:e.value};let r=t.attributeRewrites.get(e.sourceNodeId),n=t.textRewrites.get(e.sourceNodeId);return{kind:"element",name:e.name,localName:e.localName,prefix:e.prefix,namespaceUri:e.namespaceUri,attributes:e.attributes.filter(i=>i.namespaceUri!==II).map(i=>{let a=i.localName==="id"&&i.namespaceUri===null?t.identifiers?.liveIdForSourceNodeId(e.sourceNodeId):void 0;return kI(i,a??r?.get(i.name)??i.value)}),children:n===void 0?e.children.flatMap(i=>{let a=Rh(i,t);return a?[a]:[]}):[{kind:"text",value:n}]}}function _h(e){let t=new Map,r=new Map;for(let n of e?.rewrites??[]){if(n.target==="text-content"){r.set(n.sourceNodeId,n.value);continue}if(!n.name)continue;let i=t.get(n.sourceNodeId);i||(i=new Map,t.set(n.sourceNodeId,i)),i.set(n.name,n.value)}return{identifiers:e,attributeRewrites:t,textRewrites:r}}function V_(e,t){let r=_h(t),n=r.attributeRewrites.get(e.sourceNodeId);return Object.freeze(e.attributes.filter(i=>i.namespaceUri!==II).map(i=>{let a=i.localName==="id"&&i.namespaceUri===null?r.identifiers?.liveIdForSourceNodeId(e.sourceNodeId):void 0;return kI(i,a??n?.get(i.name)??i.value)}))}function SI(e,t){let r=_h(t);return Object.freeze(e.flatMap(n=>{let i=Rh(n,r);return i?[i]:[]}))}function U_(e){return e.namespaceUri!==null&&(e.namespaceUri!==ye&&e.namespaceUri!==F_||e.namespaceUri===ye&&L_.has(e.localName.toLowerCase()))}function G_(e,t){return e.kind!=="element"?!1:U_(e)?!0:t==="defs"&&e.namespaceUri===ye&&B_.has(e.localName.toLowerCase())}function W_(e,t){let r=[],n=_h(t),i=1,a=(s,l,u)=>{let d=0,c=0;for(let f of s){if(f.kind!=="element")continue;let p=c++;if(!G_(f,l))continue;let h=d++,m=Rh(f,n);!m||m.kind!=="element"||r.push({id:`document-extension-${i++}`,placement:l,order:h,...l==="defs"?{definitionOrder:p,definitionContainerId:u}:{},element:m})}};a(e.root.children,"root");let o=0;for(let s of e.root.children)s.kind==="element"&&s.namespaceUri===ye&&s.localName.toLowerCase()==="defs"&&a(s.children,"defs",`svg-definition-container-${++o}`);return Object.freeze(r.map(s=>Object.freeze(s)))}function ca(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Li(e,t,r=""){if(!ca(e))return;t.onShape?.(e,r);let n=e.state;if(!ca(n))return;let i=n.children;if(Array.isArray(i)&&i.forEach((a,o)=>{Li(a,t,`${r}.state.children[${o}]`)}),t.onState){let a=n.symbolOverrides;if(ca(a))for(let[o,s]of Object.entries(a))ca(s)&&t.onState(s,`${r}.state.symbolOverrides[${o}]`);t.onState(n,`${r}.state`)}}function ju(e,t,r){Array.isArray(e)&&e.forEach((n,i)=>Li(n,t,`${r}[${i}]`))}function ar(e,t){ca(e)&&(ju(e.shapes,t,"shapes"),Array.isArray(e.library)&&e.library.forEach((r,n)=>{if(ca(r))if(r.kind==="symbol"){if(ju(r.shapes,t,`library[${n}].shapes`),ca(r.variants))for(let[i,a]of Object.entries(r.variants))ju(a,t,`library[${n}].variants[${i}]`)}else r.kind==="marker"&&ju(r.shapes,t,`library[${n}].shapes`)}))}var $I=new Set(["cursive","emoji","fangsong","fantasy","math","monospace","sans-serif","serif","system-ui","ui-monospace","ui-rounded","ui-sans-serif","ui-serif"]),X_=new Set(["inherit","initial","unset","revert","revert-layer"]);function NI(e){return e.trim().replace(/^["']|["']$/g,"").trim()}function Fh(e){return $I.has(NI(e).toLowerCase())}function H_(e){let t=NI(e).toLowerCase();return t.length===0?!0:$I.has(t)||X_.has(t)}function q_(e){let t=[],r="",n=null;for(let a=0;a<e.length;a++){let o=e[a];if(n){o==="\\"&&a+1<e.length?r+=e[++a]:o===n?n=null:r+=o;continue}if(o==='"'||o==="'"){n=o;continue}if(o===","){let s=r.trim();s&&t.push(s),r="";continue}r+=o}let i=r.trim();return i&&t.push(i),t}function Y_(e){let t=q_(e);return t.length===0?!0:t.every(H_)}var Bp=400;function MI(e,t=Bp){if(e===void 0)return t;let r=e.trim().toLowerCase();if(r===""||r==="normal")return 400;if(r==="bold")return 700;if(r==="bolder")return t<100||t<350?400:t<550?700:t<900?900:t;if(r==="lighter")return t<100?t:t<550?100:t<750?400:700;let n=Number.parseFloat(r);return Number.isFinite(n)?Math.min(1e3,Math.max(1,n)):t}function AI(e){if(e===void 0)return"normal";let t=e.trim().toLowerCase();return t==="italic"||t.startsWith("oblique")?"italic":"normal"}function K_(e){return`${e.family}\0${e.weight}\0${e.style}`}function Z_(e){let t=new Set,r=[];for(let n of e){let i=K_(n);t.has(i)||(t.add(i),r.push(n))}return r}var J_="https://boxy-svg.com";function hv(e){return/[\t\n\f\r ]/u.test(e??"")}function hd(e,t){if(e[t]!=="/"||e[t+1]!=="*")return t;let r=e.indexOf("*/",t+2);return r<0?e.length:r+2}function Q_(e,t){let r=1,n=null,i=!1;for(let a=t+1;a<e.length;a++){let o=e[a];if(n){i?i=!1:o==="\\"?i=!0:o===n&&(n=null);continue}if(o==="/"&&e[a+1]==="*"){a=Math.max(a,hd(e,a)-1);continue}if(o==='"'||o==="'"){n=o;continue}if(o==="{")r++;else if(o==="}"&&--r===0)return a}return e.length-1}function Lh(e){let t=[],r=null,n=!1;for(let i=0;i<e.length;i++){let a=e[i];if(r){n?n=!1:a==="\\"?n=!0:a===r&&(r=null);continue}if(a==="/"&&e[i+1]==="*"){i=Math.max(i,hd(e,i)-1);continue}if(a==='"'||a==="'"){r=a;continue}if(a!=="@")continue;let o=i,s=i+1;for(;/[-_a-z0-9]/iu.test(e[s]??"");)s++;let l=e.slice(i+1,s).toLowerCase(),u=s,d=null,c=!1,f=0;for(;u<e.length;u++){let h=e[u];if(d){c?c=!1:h==="\\"?c=!0:h===d&&(d=null);continue}if(h==="/"&&e[u+1]==="*"){u=Math.max(u,hd(e,u)-1);continue}if(h==='"'||h==="'"){d=h;continue}if(h==="(")f++;else if(h===")")f=Math.max(0,f-1);else if(f===0&&(h===";"||h==="{"))break}if(u>=e.length)continue;if(e[u]===";"){t.push(Object.freeze({name:l,start:o,end:u+1,preludeStart:s,preludeEnd:u,blockStart:null,blockEnd:null})),i=u;continue}let p=Q_(e,u);t.push(Object.freeze({name:l,start:o,end:Math.min(e.length,p+1),preludeStart:s,preludeEnd:u,blockStart:u+1,blockEnd:p}))}return Object.freeze(t)}function Zd(e){let t=e.trim();if(t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))){let r=t.slice(1,-1);return td(r)??r}return td(t)??t}function Bh(e){let t=Lo(e).find(n=>n.name==="url");if(t)return Zd(e.slice(t.argumentsStart,t.argumentsEnd));let r=e.trim();if(r.startsWith('"')||r.startsWith("'")){let n=r[0],i=r.indexOf(n,1);return i>0?r.slice(1,i):null}return null}function CI(e,t=0){let r=[];for(let n of Lo(e)){if(n.name==="url"){r.push(Object.freeze({rawUrl:Zd(e.slice(n.argumentsStart,n.argumentsEnd)),tokenStart:t+n.tokenStart,tokenEnd:t+n.tokenEnd}));continue}r.push(...CI(e.slice(n.argumentsStart,n.argumentsEnd),t+n.argumentsStart))}return Object.freeze(r)}function eF(e){let t=Lh(e),r=t.filter(a=>a.name==="font-face"||a.name==="import"),n=[],i=0;for(let a of t){if(a.name!=="import")continue;let o=Bh(e.slice(a.preludeStart,a.preludeEnd));o!==null&&n.push(Object.freeze({url:o,channel:"css-import",tokenIndex:i})),i++}for(let a of CI(e))r.some(o=>a.tokenStart>=o.start&&a.tokenEnd<=o.end)||(n.push(Object.freeze({url:a.rawUrl,channel:"css-url",tokenIndex:i})),i++);return Object.freeze(n)}function Vh(e){let t=e.trim();if(!t)return Object.freeze({status:"empty",requestUrl:null});if(/^data:/iu.test(t))return Object.freeze({status:"data",requestUrl:null});let r=Uh(t);return Object.freeze(r?{status:"external",requestUrl:r.href}:{status:"blocked",requestUrl:null})}function Uh(e){let t=/^(https?):\/\/([^/?#\s\\]+)([^\s\\]*)$/iu.exec(e);if(!t)return null;let r=t[1].toLowerCase(),n=t[2],i=n.lastIndexOf("@"),a=i>=0?n.slice(0,i+1):"",o=n.slice(i+1);if(!o)return null;let s=o.startsWith("[")?o.slice(0,Math.max(0,o.indexOf("]")+1)).toLowerCase():o.split(":")[0].toLowerCase();if(!s)return null;let l=t[3]||"/",u=l.indexOf("?"),d=l.indexOf("#",Math.max(0,u)),c=u<0?"":l.slice(u+1,d<0?void 0:d);return Object.freeze({href:`${r}://${a}${o.toLowerCase()}${l}`,hostname:s,query:c})}function mv(e){try{return decodeURIComponent(e.replace(/\+/gu," "))}catch{return e.replace(/\+/gu," ")}}function OI(e){let t=[],r=0,n=null,i=!1,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(n){i?i=!1:s==="\\"?i=!0:s===n&&(n=null);continue}if(s==="/"&&e[o+1]==="*"){o=Math.max(o,hd(e,o)-1);continue}s==='"'||s==="'"?n=s:s==="("||s==="["?a++:s===")"||s==="]"?a=Math.max(0,a-1):s===","&&a===0&&(t.push(e.slice(r,o).trim()),r=o+1)}return t.push(e.slice(r).trim()),Object.freeze(t.filter(Boolean))}function tF(e){let t=[],r=0;for(;r<e.length;){for(;r<e.length&&(hv(e[r])||e[r]===",");)r++;if(r>=e.length)break;let n=r;for(;r<e.length&&!hv(e[r]);)r++;let i=e.slice(n,r);if(i.endsWith(",")){i=i.replace(/,+$/u,""),i&&t.push(i);continue}i&&t.push(i);let a=0;for(;r<e.length;){let o=e[r++];if(o==="(")a++;else if(o===")")a=Math.max(0,a-1);else if(o===","&&a===0)break}}return Object.freeze(t)}function TI(e){if(typeof e!="string")return null;let t=Zd(OI(e)[0]??"").trim();return!t||Fh(t)?null:t}function rF(e){let t=[];for(let r of Qs(e,";")){let n=e.slice(r.start,r.end),i=Qs(n,":",!0)[0]?.end??n.length;if(i>=n.length)continue;let a=n.slice(0,i).trim().toLowerCase(),o=n.slice(i+1).trim();a&&t.push(Object.freeze({property:a,value:o}))}return Object.freeze(t)}function nF(e){let t=Lo(e).find(r=>r.name==="format");return t&&Zd(e.slice(t.argumentsStart,t.argumentsEnd))||null}var iF=Object.freeze({"font-style":"style","font-weight":"weight","font-stretch":"stretch","font-display":"display","unicode-range":"unicodeRange","font-feature-settings":"featureSettings","font-variation-settings":"variationSettings","ascent-override":"ascentOverride","descent-override":"descentOverride","line-gap-override":"lineGapOverride","size-adjust":"sizeAdjust"});function aF(e){let t={};for(let r of e){let n=iF[r.property];n&&r.value&&(t[n]=r.value)}return Object.keys(t).length>0?Object.freeze(t):void 0}function oF(e){let t=[];for(let r of Lh(e)){if(r.name!=="font-face"||r.blockStart===null||r.blockEnd===null)continue;let n=rF(e.slice(r.blockStart,r.blockEnd)),i=TI(n.find(s=>s.property==="font-family")?.value),a=n.find(s=>s.property==="src")?.value;if(!i||!a)continue;let o=aF(n);for(let s of OI(a)){let l=Bh(s);if(l===null)continue;let u=Vh(l);u.status!=="external"||!u.requestUrl||t.push(Object.freeze({family:i,url:u.requestUrl,format:nF(s),...o?{descriptors:o}:{}}))}}return Object.freeze(t)}function sF(e){let t=[];for(let r of Lh(e)){if(r.name!=="import")continue;let n=Bh(e.slice(r.preludeStart,r.preludeEnd));if(n===null)continue;let i=Vh(n);if(i.status!=="external"||!i.requestUrl)continue;let a=Uh(i.requestUrl);if(!a||a.hostname!=="fonts.googleapis.com")continue;let o=a.query.split("&").map(s=>s.split("=",2)).filter(([s])=>mv(s).toLowerCase()==="family").map(([,s])=>mv(s??""));for(let s of o)for(let l of s.split("|")){let u=l.split(":")[0].trim();u&&!Fh(u)&&t.push(u)}}return Object.freeze(t)}function lF(e,t,r){let n=[];for(let i of t.stylesheets)if(i.applicable){for(let a of sF(i.authoredText))n.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"google-font-import",family:a}));for(let a of oF(i.authoredText))n.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"external-font-face",family:a.family,url:a.url,format:a.format,...a.descriptors?{descriptors:a.descriptors}:{}}))}for(let i of e.index.elements)for(let a of i.attributes)if(!(a.namespaceUri!==J_||a.localName!=="fonts"))for(let o of a.value.split(",")){let s=o.replace(/\+/gu," ").trim();!s||s.includes("/")||Fh(s)||n.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:null,origin:"boxy-fonts",family:s}))}for(let i of r.candidates){if(i.canonicalType!=="text"||i.status!=="materialized")continue;let a=s=>{let l=TI(s);l&&n.push(Object.freeze({sourceNodeId:i.sourceNodeId,occurrenceId:i.occurrenceId,origin:"text-font-family",family:l}))};a(i.state.fontFamily);let o=Nw(i.state);if(o){a(o.baseStyle.fontFamily);for(let s of o.runs)a(s.style.fontFamily)}}return Object.freeze(n)}function sn(e,t){return e.attributes.find(r=>r.namespaceUri===null&&r.localName.toLowerCase()===t.toLowerCase())?.value??null}function uF(e){return e.children.map(t=>t.kind==="text"||t.kind==="cdata"?t.value:"").join("")}function PI(e,t){let r=[],n=[...e.index.children(t)].reverse();for(;n.length>0;){let i=n.pop();r.push(i),n.push(...[...e.index.children(i.sourceNodeId)].reverse())}return Object.freeze(r)}function jo(e,t){let r=Vh(t.href);e.push(Object.freeze({...t,...r}))}function md(e,t,r,n=new Set(["css-import","css-url"]),i=()=>!0){for(let a of eF(t))!n.has(a.channel)||!i(a)||a.url.trim().startsWith("#")||jo(e,{...r,occurrenceId:`${r.occurrenceId}:css:${a.tokenIndex}`,channel:a.channel,href:a.url,hrefNamespace:null})}function dF(e,t,r,n){for(let i of PI(t,r.sourceNodeId)){let a=i.localName.toLowerCase(),o=sn(i,"id"),s={sourceNodeId:i.sourceNodeId,occurrenceId:`${n}:foreign:${i.sourceNodeId}`,sourceId:o,elementName:i.localName},l=[{attributeName:"src",channel:"html-src",applies:["img","video","audio","source","track","iframe","embed"].includes(a)||a==="input"&&sn(i,"type")?.toLowerCase()==="image"},{attributeName:"poster",channel:"html-poster",applies:a==="video"},{attributeName:"data",channel:"html-data",applies:a==="object"},{attributeName:"href",channel:"html-src",applies:a==="link"&&(sn(i,"rel")??"").split(/\s+/u).some(c=>c.toLowerCase()==="stylesheet")}];for(let c of l){if(!c.applies)continue;let f=sn(i,c.attributeName);f!==null&&jo(e,{...s,occurrenceId:`${s.occurrenceId}:${c.attributeName}`,attributeName:c.attributeName,channel:c.channel,href:f,hrefNamespace:null})}let u=sn(i,"srcset");if(u!==null&&(a==="img"||a==="source"))for(let[c,f]of tF(u).entries())jo(e,{...s,occurrenceId:`${s.occurrenceId}:srcset:${c}`,attributeName:"srcset",channel:"html-srcset",href:f,hrefNamespace:null});let d=sn(i,"style");d!==null&&md(e,d,{...s,attributeName:"style"}),a==="style"&&md(e,uF(i),{...s,attributeName:"textContent"})}}function cF(e,t,r,n){let i=sn(r,"data-shape-type")?.toLowerCase();if(i==="video"||i==="audio"){let a=PI(t,r.sourceNodeId).find(o=>o.localName.toLowerCase()===i);if(a){let o=sn(a,"src")??"";if(jo(e,{sourceNodeId:a.sourceNodeId,occurrenceId:`${n}:media:src`,sourceId:sn(a,"id"),elementName:i,attributeName:"src",channel:"html-src",href:o,hrefNamespace:null}),i==="video"){let s=sn(r,"data-poster")??sn(a,"poster");s!==null&&jo(e,{sourceNodeId:r.sourceNodeId,occurrenceId:`${n}:media:poster`,sourceId:sn(r,"id"),elementName:"video",attributeName:"poster",channel:"html-poster",href:s,hrefNamespace:null})}}return}dF(e,t,r,n)}function fF(e,t,r){let n=[];for(let i of t.occurrences){let a=e.index.element(i.correspondingSourceNodeId);if(!a||a.namespaceUri!==ye)continue;let o=a.localName.toLowerCase();if(o==="image"||o==="feimage"){let s=vr(a)??{value:"",namespace:"svg2"};jo(n,{sourceNodeId:a.sourceNodeId,occurrenceId:i.occurrenceId,sourceId:j(a,"id"),elementName:o==="feimage"?"feImage":"image",attributeName:"href",channel:"svg-href",href:s.value,hrefNamespace:s.namespace})}else o==="foreignobject"&&cF(n,e,a,i.occurrenceId)}for(let i of r.stylesheets)i.applicable&&md(n,i.authoredText,{sourceNodeId:i.sourceNodeId,occurrenceId:`style:${i.sourceNodeId}`,sourceId:i.id,elementName:"style",attributeName:"textContent"},new Set(["css-import"]),a=>Uh(a.url)?.hostname!=="fonts.googleapis.com");for(let i of r.elements){let a=e.index.element(i.correspondingSourceNodeId);if(!(!a||a.namespaceUri!==ye))for(let o of Object.values(i.cascadedValues))md(n,o.value,{sourceNodeId:o.sourceNodeId,occurrenceId:`style:${i.occurrenceId}:${o.propertyName}`,sourceId:null,elementName:"style-declaration",attributeName:o.propertyName})}return Object.freeze(n)}function pF(e,t,r){let n=[...new Set(e.filter(d=>d.origin==="google-font-import"||d.origin==="boxy-fonts").map(d=>d.family))].sort(),i=[],a=new Set;for(let d of e){if(d.origin!=="external-font-face"||!d.url)continue;let c=`${d.family}\0${d.url}\0${d.format??""}\0${JSON.stringify(d.descriptors??{})}`;a.has(c)||(a.add(c),i.push(Object.freeze({family:d.family,url:d.url,format:d.format??null,...d.descriptors?{descriptors:d.descriptors}:{}})))}i.sort((d,c)=>d.family.localeCompare(c.family)||d.url.localeCompare(c.url)||(d.format??"").localeCompare(c.format??""));let o=[...new Set([...n,...i.map(d=>d.family)])].sort(),s=[...new Set(t.filter(d=>d.status==="external"&&d.requestUrl).map(d=>d.requestUrl))].sort(),l=[];o.length>0&&l.push(Object.freeze({kind:"font-consent",families:o,googleFamilies:n,...i.length>0?{externalSources:i}:{}})),s.length>0&&l.push(Object.freeze({kind:"external-asset-resolution",urls:s})),Object.freeze(o),Object.freeze(n),Object.freeze(i),Object.freeze(s),Object.freeze(l);let u=Object.freeze({fontCandidates:e,assetCandidates:t,effects:l});return Object.freeze({value:u,diagnostics:r})}function hF(e,t,r,n,i){return pF(lF(e,r,n),fF(e,t,r),Object.freeze([]))}function mF(e,t,r){let n=new Set,i=a=>{let o=a;for(;o;){let s=o.localName.toLowerCase();if(s==="clippath"||s==="mask")return!0;o=e.index.parent(o.sourceNodeId)}return!1};for(let a of r.css){let o=t.occurrence(a.occurrenceId);if(!o)continue;let s=e.index.element(o.correspondingSourceNodeId);s&&i(s)&&n.add(s.sourceNodeId)}return e.index.elements.filter(a=>n.has(a.sourceNodeId)).map(a=>a.sourceNodeId)}var gF=Object.freeze({matchesMedia(e){let t=e.trim().toLowerCase();return t===""||t==="all"||t==="screen"},supportsCondition(){return!1}}),yF=new Map([["clippath","clip-path"],["marker","marker"],["mask","mask"],["pattern","pattern"]]);function vF(e){return Object.freeze(e.index.elements.flatMap(t=>{let r=yF.get(t.localName.toLowerCase());return r?[Object.freeze({sourceNodeId:t.sourceNodeId,capability:r})]:[]}))}function bF(e,t,r){let n=new Map(e.occurrences.map(i=>[i.occurrenceId,i]));return Object.freeze([...t.candidates.filter(i=>i.status==="materialized").map(i=>i.occurrenceId),...r.uses.filter(i=>["symbol-instance","linked-reference"].includes(i.status)).map(i=>i.useOccurrenceId)].filter(i=>n.get(i)?.role!=="definition"))}function xF(e,t={}){let r={source:t.source??"svg",entrypoint:t.entrypoint??"svg-document-import"},n=Ld(e,r,t.xmlHost);if(!n.value)return Object.freeze({value:null,diagnostics:n.diagnostics});let i=n.value,a=HP(i.root,r),o=Object.freeze({width:a.value.viewBoxWidth??300,height:a.value.viewBoxHeight??150}),s=t.rootFontSize??16,l=Object.freeze({viewport:Object.freeze({x:a.value.viewBoxX??0,y:a.value.viewBoxY??0,...o}),rootFontSize:s}),u=w2(i,r),d=u.value.condition(i.root.sourceNodeId),c=Wz(i,r),f=__(i,r),p=_2(i,{...r,resourceRoots:vF(i),...t.maxUseDepth!==void 0?{maxDepth:t.maxUseDepth}:{},...t.maxUseOccurrences!==void 0?{maxOccurrences:t.maxUseOccurrences}:{}}),h=XD(i,p,{...r,environment:t.styleEnvironment??gF}),m=Aw(i,p,h.value,{viewport:o,rootFontSize:s}),g=Hj(i,p,h.value,{...r,viewport:o,rootFontSize:s,viewportPlan:m,...t.textMetricsHost?{textMetricsHost:t.textMetricsHost}:{}}),v=aj(i,p,h.value,{...r,leafGeometry:g.value}),b=A2(i,{...t.claimedIds?{claimedIds:t.claimedIds}:{},cssAnimationTargetSourceNodeIds:mF(i,p,v.value)}),y=b.liveIdForSourceNodeId(i.root.sourceNodeId),I=Object.freeze({...a.value,...y?{svgId:y}:{},...d?.systemLanguage!==null&&d?.systemLanguage!==void 0?{systemLanguage:d.systemLanguage}:{},...d?.requiredExtensions!==null&&d?.requiredExtensions!==void 0?{requiredExtensions:d.requiredExtensions}:{}}),x=W_(i,b),k=pD(i,{...r,appliedDeclarations:h.value.appliedResourceDeclarations}),$=uE(i,p,h.value,k,g.value,{...r,viewport:o,rootFontSize:s}),A=new Set;for(let X of $.value.definitions)if(X.representation==="decomposed")for(let B of X.geometrySourceNodeIds)A.add(B);for(let X of v.value.smil)X.motionPathSourceNodeId&&A.add(X.motionPathSourceNodeId);let S=tD(i,p,h.value,{...r,nativeDefinitionSourceNodeIds:A,privateGeometrySourceNodeIds:new Set(g.value.privateTextPathGeometry.map(X=>X.pathSourceNodeId))}),M=Nz(i,p,h.value,k,{...r,viewport:o,rootFontSize:s}),T=kE(i,p,h.value,k,{...r,viewport:o,rootFontSize:s}),E=OE(i,p,h.value,k,{...r,viewport:o,rootFontSize:s}),C=YE(i,p,h.value,k,{...r,viewport:o,rootFontSize:s}),O=ez(i,b,r),z=JP(i,r),R=r2(i,p,m,r),U=xD(i),V=hF(i,p,h.value,g.value,r),Y=a2(i,p,{...r,materializedOccurrenceIds:bF(p,g.value,S)}),G=[...n.diagnostics,...a.diagnostics,...u.diagnostics,...c.diagnostics,...f.diagnostics,...p.diagnostics,...h.diagnostics,...v.diagnostics,...S.diagnostics,...g.diagnostics,...k.diagnostics,...$.diagnostics,...M.diagnostics,...T.diagnostics,...E.diagnostics,...C.diagnostics,...O.diagnostics,...z.diagnostics,...R.diagnostics,...V.diagnostics,...Y.diagnostics],H=Object.freeze({projectionContext:l,sourceDocument:i,rootFrame:I,identifiers:b,conditionalProcessing:u.value,scripts:c.value,metadata:f.value,documentExtensions:x,useOccurrences:p,styles:h.value,viewportContexts:m,animations:v.value,symbolUses:S,leafGeometry:g.value,resourceDependencies:k,clipMasks:$.value,filters:M.value,markers:T.value,gradients:E.value,patterns:C.value,paintServerDefinitions:O.value,views:z.value,embeddedFrames:R.value,authoredAttributes:U,externalEffects:V.value,hierarchy:Y.value});return Object.freeze({value:H,diagnostics:Object.freeze(G)})}function wF(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function IF(e={}){let t={schemaVersion:wn,shapes:e.shapes?e.shapes.map(r=>({...r})):[],viewboxes:e.viewboxes?e.viewboxes.map(r=>({...r})):[]};return e.metadata&&(t.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...e.metadata}),t}function kF(e,t,r,n,i){return{id:i??wF(),x:e,y:t,width:r,height:n}}var SF=class{schemas=new Map;register(e,t){this.schemas.set(e,t)}get(e){return this.schemas.get(e)}typeIds(){return[...this.schemas.keys()]}getDefaults(e){let t=this.schemas.get(e);if(!t)return{};let r={};for(let n of Object.keys(t))r[n]=t[n].default;return r}validate(e,t,r){let n=this.schemas.get(e);if(!n)return r;let i=n[t];return i?.validate?i.validate(r):r}},ze=e=>Math.max(0,e),Mo=e=>Math.max(0,Math.min(1,e)),Kt=e=>Math.max(0,Math.min(100,e)),$F=e=>Math.max(1,e),NF=e=>Math.max(3,Math.min(100,Math.floor(e))),MF=e=>Math.max(3,Math.min(50,Math.floor(e))),AF=e=>Math.max(3,Math.min(30,Math.floor(e))),CF=e=>Math.max(1,Math.min(10,e)),OF=e=>!e||typeof e!="object"||Array.isArray(e)||e.kind!=="shape"&&e.kind!=="definition"||typeof e.targetId!="string"||e.targetId.length===0||e.element!=="href"&&e.element!=="mpath"?null:{kind:e.kind,targetId:e.targetId,element:e.element};function TF(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{default:r}]))}var PF=TF(TA),Bt={layerName:{default:null},fillColor:{default:"#ffffff"},borderColor:{default:"#000000"},borderWidth:{default:1},opacity:{default:1,validate:Mo},fillOpacity:{default:1,validate:Mo},strokeOpacity:{default:1,validate:Mo},...PF,locked:{default:!1},visible:{default:!0},fillType:{default:"solid"},fillGradient:{default:null},strokeType:{default:"solid"},strokeGradient:{default:null},fillRule:{default:"nonzero"},strokeLinejoin:{default:"miter"},strokeLinecap:{default:"butt"},strokeMiterlimit:{default:4,validate:$F},lineStyle:{default:"solid"},dashLength:{default:8},gapLength:{default:4},dashOffset:{default:0},strokeDasharray:{default:null},colorInterpolation:{default:null},filters:{default:[]},filterColorInterpolation:{default:null},filterUnits:{default:null},primitiveUnits:{default:null},filterX:{default:null},filterY:{default:null},filterWidth:{default:null},filterHeight:{default:null},metadata:{default:null},cssClipPath:{default:null},cssMaskProperties:{default:null}},cn={...Bt,cx:{default:0},cy:{default:0},radius:{default:50,validate:ze},cornerRadius:{default:0,validate:ze},shiftAngle:{default:0}},qo={...Bt,x:{default:0},y:{default:0},width:{default:100,validate:ze},height:{default:60,validate:ze}},DI={...Bt,x:{default:0},y:{default:0},width:{default:0,validate:ze},height:{default:0,validate:ze},href:{default:""},mediaMimeType:{default:""},originalWidth:{default:0},originalHeight:{default:0},naturalDuration:{default:0},preserveAspectRatio:{default:!0},begin:{default:0},trimStart:{default:0},volume:{default:1,validate:Mo},muted:{default:!1},loop:{default:!1},playbackRate:{default:1},mediaOpacity:{default:1,validate:Mo},fadeInDuration:{default:0,validate:ze},fadeOutDuration:{default:0,validate:ze},posterHref:{default:""},sourceRect:{default:null}},Le=new SF;Le.register("rectangle",{...Bt,x:{default:0},y:{default:0},width:{default:100,validate:ze},height:{default:100,validate:ze},rx:{default:0,validate:ze},ry:{default:0,validate:ze},cornerRadius:{default:0,validate:ze},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:ze},cornerRadiusTR:{default:0,validate:ze},cornerRadiusBL:{default:0,validate:ze},cornerRadiusBR:{default:0,validate:ze},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});Le.register("square",{...Bt,x:{default:0},y:{default:0},size:{default:100,validate:ze},width:{default:100,validate:ze},height:{default:100,validate:ze},rx:{default:0,validate:ze},ry:{default:0,validate:ze},cornerRadius:{default:0,validate:ze},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:ze},cornerRadiusTR:{default:0,validate:ze},cornerRadiusBL:{default:0,validate:ze},cornerRadiusBR:{default:0,validate:ze},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});Le.register("circle",{...Bt,x:{default:0},y:{default:0},radius:{default:50,validate:ze}});Le.register("ellipse",{...Bt,x:{default:0},y:{default:0},rx:{default:50,validate:ze},ry:{default:30,validate:ze}});Le.register("line",{...Bt,fillType:{default:"none"},x1:{default:0},y1:{default:0},x2:{default:100},y2:{default:0},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});Le.register("text",{...Bt,x:{default:0},y:{default:0},width:{default:0,validate:ze},height:{default:0,validate:ze},textX:{default:0},textY:{default:0},fontSize:{default:24},text:{default:""},fontFamily:{default:"Arial"},fontWeight:{default:"normal"},fontStyle:{default:"normal"},fontStretch:{default:"normal"},fontSizeAdjust:{default:"none"},fontVariant:{default:""},fontVariantLigatures:{default:""},fontVariantPosition:{default:""},fontVariantCaps:{default:""},fontVariantNumeric:{default:""},fontVariantEastAsian:{default:""},textDecoration:{default:{}},textTransform:{default:"none"},baselineShift:{default:"baseline"},dominantBaseline:{default:"auto"},alignmentBaseline:{default:"auto"},writingMode:{default:"horizontal-tb"},textAnchor:{default:"start"},letterSpacing:{default:0},wordSpacing:{default:0},lineHeight:{default:1.2},inlineSize:{default:0},overflowWrap:{default:"normal"},whiteSpace:{default:"pre-wrap"},textDirection:{default:"ltr"},unicodeBidi:{default:"normal"},scaleX:{default:1},scaleY:{default:1},scaleAnchor:{default:null},useRichText:{default:!1},richTextRuns:{default:null},charOffsets:{default:null},fontVariationSettings:{default:{}},isTextPath:{default:!1},textPathPoints:{default:null},textPathStartOffset:{default:0},textPathSide:{default:"left"},textPathReference:{default:null,validate:OF},shapeInsideRef:{default:null},shapePadding:{default:0}});Le.register("image",{...Bt,x:{default:0},y:{default:0},width:{default:100,validate:ze},height:{default:100,validate:ze},href:{default:""},originalWidth:{default:0},originalHeight:{default:0},preserveAspectRatio:{default:!0},imageOpacity:{default:1,validate:Mo}});Le.register("path",{...Bt,x:{default:0},y:{default:0},width:{default:0,validate:ze},height:{default:0,validate:ze},pathPoints:{default:[]},pathArcParams:{default:[]},pathControlBounds:{default:null},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});Le.register("polyline",{...Bt,x:{default:0},y:{default:0},width:{default:0,validate:ze},height:{default:0,validate:ze},polylinePoints:{default:[]},polylineClosed:{default:!1}});Le.register("triangle",{...cn,sides:{default:3}});Le.register("ngon",{...cn,sides:{default:6,validate:NF}});Le.register("star",{...cn,arms:{default:5,validate:MF},innerRadiusPercent:{default:40,validate:Kt}});Le.register("cross",{...cn,armWidthPercent:{default:30,validate:Kt}});Le.register("ring",{...cn,innerRadiusPercent:{default:50,validate:Kt}});Le.register("spiral",{...cn,turns:{default:3,validate:CF},thicknessPercent:{default:15,validate:Kt},spiralDirection:{default:1}});Le.register("gear",{...cn,teeth:{default:8,validate:AF},toothDepthPercent:{default:25,validate:Kt},holeRadiusPercent:{default:20,validate:Kt}});Le.register("arrow",{...cn,headWidthPercent:{default:100,validate:Kt},headLengthPercent:{default:40,validate:Kt},shaftWidthPercent:{default:40,validate:Kt}});Le.register("symbol-instance",{...Bt,x:{default:0},y:{default:0},width:{default:100,validate:ze},height:{default:100,validate:ze},symbolId:{default:""}});Le.register("group",{...Bt});Le.register("container",{...Bt});Le.register("cloud",{...cn,cloudBumps:{default:5},cloudPuffinessPercent:{default:60,validate:Kt}});Le.register("heart",{...cn,lobeRadiusPercent:{default:50,validate:Kt},cleftDepthPercent:{default:25,validate:Kt}});Le.register("lightning",{...cn,boltSegments:{default:3},boltWidthPercent:{default:30,validate:Kt},boltJaggednessPercent:{default:40,validate:Kt}});Le.register("speechBubble",{...cn,tailAngleDeg:{default:45},tailLengthPercent:{default:40,validate:Kt},tailWidthPercent:{default:25,validate:Kt}});Le.register("diamond",{...qo});Le.register("parallelogram",{...qo,slantPercent:{default:20,validate:Kt}});Le.register("trapezoid",{...qo,topWidthPercent:{default:70,validate:Kt}});Le.register("terminator",{...qo});Le.register("cylinder",{...qo,capHeightPercent:{default:15,validate:Kt}});Le.register("document-shape",{...qo,waveAmplitudePercent:{default:15,validate:Kt}});Le.register("hyperlink",{...Bt,href:{default:""},hrefXlink:{default:""},linkTarget:{default:""},linkPing:{default:""},linkRel:{default:""},linkHreflang:{default:""},linkType:{default:""},linkReferrerPolicy:{default:""}});Le.register("switch",{...Bt,switchSystemLanguage:{default:null},switchRequiredExtensions:{default:null}});Le.register("svg",{...Bt});Le.register("view",{...Bt,viewBoxX:{default:0},viewBoxY:{default:0},viewBoxWidth:{default:0,validate:ze},viewBoxHeight:{default:0,validate:ze},viewName:{default:""},viewPreserveAspectRatio:{default:""},viewTarget:{default:""}});Le.register("shape-reference",{...Bt,targetShapeId:{default:""},offsetX:{default:0},offsetY:{default:0},targetWidth:{default:0,validate:ze},targetHeight:{default:0,validate:ze},broken:{default:!1}});Le.register("foreign-object",{...Bt,x:{default:0},y:{default:0},width:{default:0,validate:ze},height:{default:0,validate:ze},foreignContent:{default:[]}});Le.register("video",{...DI,mediaKind:{default:"video"}});Le.register("audio",{...DI,mediaKind:{default:"audio"}});Le.register("document",{});function Kf(e){let t=new Set;for(let r of e??[])Li(r,{onShape:n=>{n.id&&t.add(n.id)}});return t}function da(e){let t=Kf(e.shapes),r=new Map;for(let i of e.library??[]){let a=new Set([i.id]);if(i.kind==="symbol"||i.kind==="marker")for(let o of Kf(i.shapes))a.add(o);if(i.kind==="symbol")for(let o of Object.values(i.variants??{}))for(let s of Kf(o))a.add(s);for(let o of a){let s=r.get(o)??new Set;s.add(i.id),r.set(o,s)}}let n=new Map;for(let[i,a]of r)n.set(i,Object.freeze([...a].sort()));return{documentParentIds:t,definitionIdsByParentId:n,resolve(i){if(i.parentDefinitionId!==void 0)return(n.get(i.parentId)??[]).includes(i.parentDefinitionId)?{kind:"library",definitionId:i.parentDefinitionId}:{kind:"missing"};if(t.has(i.parentId))return{kind:"document"};let a=n.get(i.parentId)??[];return a.length===1?{kind:"library",definitionId:a[0]}:a.length>1?{kind:"ambiguous",definitionIds:a}:{kind:"missing"}}}}var DF;function jF(){return DF??=new Set([...Le.typeIds().filter(e=>e!=="document"),"spline"])}function gl(e){let t=[],r=[];if(e==null||typeof e!="object")return t.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:t,warnings:r};let n=e;for(let a of Object.keys(n))a in va||r.push({path:a,message:`Unknown top-level field "${a}" (likely written by a newer version); it is preserved in the unknownFields quarantine on save`,severity:"warning"});let i={doc:n,errors:t,warnings:r};for(let a of Object.keys(va)){let o=n[a];o===void 0&&!va[a].required||WF[a](o,i)}return RF(n,t),{valid:t.length===0,errors:t,warnings:r}}function de(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function EF(e){let t=new Map,r=n=>{if(Array.isArray(n)){for(let i of n)if(!(!de(i)||!de(i.state))){if(typeof i.id=="string"&&i.type==="text"){let a=new Map,o=i.state.textSpanTree,s=l=>{if(Array.isArray(l))for(let u of l)de(u)&&(typeof u.spanId=="string"&&u.spanId.length>0&&a.set(u.spanId,{start:u.start,end:u.end}),s(u.children))};de(o)&&s(o.spans),t.set(i.id,a)}r(i.state.children)}}};return r(e),t}function nr(e,t,r){return Array.isArray(e)?!0:(r.push({path:t,message:`${t} must be an array`,severity:"error"}),!1)}function Eo(e,t,r){e!==void 0&&(typeof e!="number"||!Number.isInteger(e)||e<0)&&r.push({path:t,message:"Definition order must be a non-negative integer",severity:"error"})}function zo(e,t,r){e!==void 0&&(typeof e!="string"||e.length===0)&&r.push({path:t,message:"Definition container id must be a non-empty string",severity:"error"})}function zF(e,t,r,n){if(e===void 0||!nr(e,t,n))return;let i=new Set;e.forEach((a,o)=>{let s=`${t}[${o}]`;if(!de(a)){n.push({path:s,message:"Animation track must be an object",severity:"error"});return}if(typeof a.id!="string"||a.id.length===0?n.push({path:`${s}.id`,message:"Animation track id must be a non-empty string",severity:"error"}):i.has(a.id)?n.push({path:`${s}.id`,message:`Duplicate animation track id: "${a.id}"`,severity:"error"}):i.add(a.id),(typeof a.shapeId!="string"||!r.has(a.shapeId))&&n.push({path:`${s}.shapeId`,message:"Definition animation must target a shape owned by the definition",severity:"error"}),!Array.isArray(a.keyframes)){n.push({path:`${s}.keyframes`,message:"Animation track keyframes must be an array",severity:"error"});return}let l=new Set;a.keyframes.forEach((u,d)=>{let c=`${s}.keyframes[${d}].id`;!de(u)||typeof u.id!="string"||!u.id?n.push({path:c,message:"Animation keyframe id must be a non-empty string",severity:"error"}):l.has(u.id)?n.push({path:c,message:`Duplicate animation keyframe id: "${u.id}"`,severity:"error"}):l.add(u.id)})})}function RF(e,t){let r=new Set(Array.isArray(e.definitionContainers)?e.definitionContainers.flatMap(o=>de(o)&&typeof o.id=="string"?[o.id]:[]):[]),n=(o,s)=>{!de(o)||o.definitionContainerId===void 0||typeof o.definitionContainerId!="string"||o.definitionContainerId.length===0||r.has(o.definitionContainerId)||t.push({path:`${s}.definitionContainerId`,message:`Definition container "${o.definitionContainerId}" does not exist`,severity:"error"})};for(let[o,s]of[["documentExtensions",e.documentExtensions],["documentStyles",e.documentStyles],["library",e.library],["paintServerDefs",e.paintServerDefs],["clipMaskGroups",e.clipMaskGroups]])Array.isArray(s)&&s.forEach((l,u)=>n(l,`${o}[${u}]`));de(e.animationTimeline)&&Array.isArray(e.animationTimeline.tracks)&&e.animationTimeline.tracks.forEach((o,s)=>{if(!de(o)||o.sourceSmilDefinitionContainerId===void 0)return;let l=o.sourceSmilDefinitionContainerId;typeof l!="string"||l.length===0||r.has(l)||t.push({path:`animationTimeline.tracks[${s}].sourceSmilDefinitionContainerId`,message:`Definition container "${l}" does not exist`,severity:"error"})});let i=new Set(Array.isArray(e.library)?e.library.flatMap(o=>de(o)&&typeof o.id=="string"?[o.id]:[]):[]);Array.isArray(e.documentStyles)&&e.documentStyles.forEach((o,s)=>{!de(o)||o.scopeDefinitionId===void 0||typeof o.scopeDefinitionId!="string"||o.scopeDefinitionId.length===0||i.has(o.scopeDefinitionId)||t.push({path:`documentStyles[${s}].scopeDefinitionId`,message:`Scoped definition "${o.scopeDefinitionId}" does not exist`,severity:"error"})});let a=(o,s)=>{Array.isArray(o)&&o.forEach((l,u)=>{let d=`${s}[${u}]`;!de(l)||!de(l.state)||(n(l.state,`${d}.state`),a(l.state.children,`${d}.state.children`))})};a(e.shapes,"shapes"),Array.isArray(e.library)&&e.library.forEach((o,s)=>{de(o)&&a(o.shapes,`library[${s}].shapes`)})}var _F=new Set(["text","comment","cdata","processing-instruction"]);function jI(e,t,r){if(!de(e)){r.push({path:t,message:"Document extension attribute must be a plain object",severity:"error"});return}for(let n of["name","localName","value"])typeof e[n]!="string"&&r.push({path:`${t}.${n}`,message:`${n} must be a string`,severity:"error"});for(let n of["prefix","namespaceUri"])e[n]!==null&&typeof e[n]!="string"&&r.push({path:`${t}.${n}`,message:`${n} must be a string or null`,severity:"error"})}function EI(e,t,r){let n=[{node:e,path:t,depth:0}];for(;n.length>0;){let i=n.pop();if(i.depth>64){r.push({path:i.path,message:"Document extension nesting exceeds 64 levels",severity:"error"});continue}if(!de(i.node)){r.push({path:i.path,message:"Document extension node must be a plain object",severity:"error"});continue}let a=i.node;if(a.kind==="element"){for(let o of["name","localName"])(typeof a[o]!="string"||a[o].length===0)&&r.push({path:`${i.path}.${o}`,message:`${o} must be a non-empty string`,severity:"error"});for(let o of["prefix","namespaceUri"])a[o]!==null&&typeof a[o]!="string"&&r.push({path:`${i.path}.${o}`,message:`${o} must be a string or null`,severity:"error"});nr(a.attributes,`${i.path}.attributes`,r)&&a.attributes.forEach((o,s)=>jI(o,`${i.path}.attributes[${s}]`,r)),nr(a.children,`${i.path}.children`,r)&&a.children.forEach((o,s)=>n.push({node:o,path:`${i.path}.children[${s}]`,depth:i.depth+1}));continue}_F.has(String(a.kind))||r.push({path:`${i.path}.kind`,message:"Unsupported document extension node kind",severity:"error"}),typeof a.value!="string"&&r.push({path:`${i.path}.value`,message:"Document extension character value must be a string",severity:"error"})}}function FF(e,t,r,n){if(!de(e)){r.push({path:t,message:"Document extension must be a plain object",severity:"error"});return}typeof e.id!="string"||e.id.length===0?r.push({path:`${t}.id`,message:"Document extension id must be a non-empty string",severity:"error"}):n.has(e.id)?r.push({path:`${t}.id`,message:`Duplicate document extension id: "${e.id}"`,severity:"error"}):n.add(e.id),e.placement!=="root"&&e.placement!=="defs"&&r.push({path:`${t}.placement`,message:"Document extension placement must be root or defs",severity:"error"}),(typeof e.order!="number"||!Number.isInteger(e.order)||e.order<0)&&r.push({path:`${t}.order`,message:"Document extension order must be a non-negative integer",severity:"error"}),Eo(e.definitionOrder,`${t}.definitionOrder`,r),zo(e.definitionContainerId,`${t}.definitionContainerId`,r),EI(e.element,`${t}.element`,r)}var LF=new Set(["x1","y1","x2","y2","gradientTransform"]),BF=new Set(["cx","cy","fx","fy","r","fr","gradientTransform"]),VF=new Set(["x","y","width","height"]);function Tr(e,t,r){e.push({path:t,message:r,severity:"error"})}function UF(e,t,r,n){if(!de(e)){Tr(n,t,"Gradient must be a plain object");return}if(e.templateId!==void 0&&typeof e.templateId!="string"&&Tr(n,`${t}.templateId`,"templateId must be a string"),e.rootAttributes!==void 0)if(!de(e.rootAttributes))Tr(n,`${t}.rootAttributes`,"Gradient rootAttributes must be a plain object");else for(let[a,o]of Object.entries(e.rootAttributes))qd(a)||Tr(n,`${t}.rootAttributes.${a}`,"Gradient root attributes must be safe non-typed attributes"),typeof o!="string"&&Tr(n,`${t}.rootAttributes.${a}`,"Gradient root attribute values must be strings");let i=r==="linear-gradient"?["x1","y1","x2","y2","opacity"]:["cx","cy","fx","fy","r","ry","rotation","opacity"];for(let a of i)e[a]!==void 0&&(typeof e[a]!="number"||!Number.isFinite(e[a]))&&Tr(n,`${t}.${a}`,`${a} must be a finite number`);if(e.fr!==void 0&&(typeof e.fr!="number"||!Number.isFinite(e.fr))&&Tr(n,`${t}.fr`,"fr must be a finite number"),e.authoredGeometry!==void 0)if(!de(e.authoredGeometry))Tr(n,`${t}.authoredGeometry`,"Gradient authoredGeometry must be a plain object");else{let a=r==="linear-gradient"?LF:BF;for(let[o,s]of Object.entries(e.authoredGeometry))a.has(o)?typeof s!="string"&&Tr(n,`${t}.authoredGeometry.${o}`,"Authored gradient geometry declarations must be strings"):Tr(n,`${t}.authoredGeometry.${o}`,"is not a supported authored gradient geometry field")}e.gradientTransform!==void 0&&(!Array.isArray(e.gradientTransform)||e.gradientTransform.length!==6||!e.gradientTransform.every(a=>typeof a=="number"&&Number.isFinite(a)))&&Tr(n,`${t}.gradientTransform`,"gradientTransform must be a 6-element finite affine matrix"),Array.isArray(e.stops)?e.stops.forEach((a,o)=>{if(!de(a)){Tr(n,`${t}.stops[${o}]`,"Gradient stop must be an object");return}a.id!==void 0&&(typeof a.id!="string"||a.id.length===0)&&Tr(n,`${t}.stops[${o}].id`,"id must be a nonempty string");for(let s of["offset","opacity"])a[s]!==void 0&&(typeof a[s]!="number"||!Number.isFinite(a[s]))&&Tr(n,`${t}.stops[${o}].${s}`,`${s} must be a finite number`)}):Tr(n,`${t}.stops`,"Gradient stops must be an array")}function GF(e,t,r){if(!de(e)){r.push({path:t,message:"Pattern must be a plain object",severity:"error"});return}if(e.templateId!==void 0&&typeof e.templateId!="string"&&r.push({path:`${t}.templateId`,message:"templateId must be a string",severity:"error"}),e.rootAttributes!==void 0)if(!de(e.rootAttributes))r.push({path:`${t}.rootAttributes`,message:"Pattern rootAttributes must be a plain object",severity:"error"});else for(let[n,i]of Object.entries(e.rootAttributes))Yd(n)||r.push({path:`${t}.rootAttributes.${n}`,message:"Pattern root attributes must be safe non-typed attributes",severity:"error"}),typeof i!="string"&&r.push({path:`${t}.rootAttributes.${n}`,message:"Pattern root attribute values must be strings",severity:"error"});for(let n of["x","y","width","height","scale","rotation","opacity"])e[n]!==void 0&&(typeof e[n]!="number"||!Number.isFinite(e[n]))&&r.push({path:`${t}.${n}`,message:`${n} must be a finite number`,severity:"error"});e.patternUnits!==void 0&&e.patternUnits!=="userSpaceOnUse"&&e.patternUnits!=="objectBoundingBox"&&r.push({path:`${t}.patternUnits`,message:"patternUnits must be userSpaceOnUse or objectBoundingBox",severity:"error"}),e.patternContentUnits!==void 0&&e.patternContentUnits!=="userSpaceOnUse"&&e.patternContentUnits!=="objectBoundingBox"&&r.push({path:`${t}.patternContentUnits`,message:"patternContentUnits must be userSpaceOnUse or objectBoundingBox",severity:"error"});for(let n of["svgContent","patternTransform","viewBox","preserveAspectRatio"])e[n]!==void 0&&typeof e[n]!="string"&&r.push({path:`${t}.${n}`,message:`${n} must be a string`,severity:"error"});if(e.authoredGeometry!==void 0)if(!de(e.authoredGeometry))r.push({path:`${t}.authoredGeometry`,message:"Pattern authoredGeometry must be a plain object",severity:"error"});else for(let[n,i]of Object.entries(e.authoredGeometry))VF.has(n)?typeof i!="string"&&r.push({path:`${t}.authoredGeometry.${n}`,message:"Authored pattern geometry declarations must be strings",severity:"error"}):r.push({path:`${t}.authoredGeometry.${n}`,message:"is not a supported authored pattern geometry field",severity:"error"})}var WF={schemaVersion:(e,{errors:t,warnings:r})=>{typeof e!="number"||!Number.isInteger(e)?t.push({path:"schemaVersion",message:"schemaVersion must be an integer",severity:"error"}):e>wn&&r.push({path:"schemaVersion",message:`schemaVersion ${e} is newer than supported (${wn})`,severity:"warning"})},shapes:(e,{errors:t,warnings:r})=>{if(!nr(e,"shapes",t))return;let n=new Set;e.forEach((i,a)=>{Jf(i,`shapes[${a}]`,t,r,n)})},viewboxes:(e,{errors:t})=>{if(!nr(e,"viewboxes",t))return;let r=new Set;e.forEach((n,i)=>{QF(n,`viewboxes[${i}]`,t,r)})},guides:(e,{errors:t})=>{nr(e,"guides",t)&&e.forEach((r,n)=>{eL(r,`guides[${n}]`,t)})},measurements:(e,{errors:t})=>{nr(e,"measurements",t)&&e.forEach((r,n)=>{let i=`measurements[${n}]`;if(!de(r)){t.push({path:i,message:"Measurement must be a non-null object",severity:"error"});return}(typeof r.id!="string"||r.id.length===0)&&t.push({path:`${i}.id`,message:"Measurement id must be a non-empty string",severity:"error"})})},sceneTree:(e,{doc:t,errors:r,warnings:n})=>{if(!nr(e,"sceneTree",r))return;let i=Zf(t.shapes),a=new Set;e.forEach((o,s)=>{XF(o,`sceneTree[${s}]`,r,n,i,a)})},clipMaskGroups:(e,{doc:t,errors:r,warnings:n})=>{if(!nr(e,"clipMaskGroups",r))return;let i=Zf(t.shapes),a=da(t);e.forEach((o,s)=>{tL(o,`clipMaskGroups[${s}]`,r,n,i,a)})},documentMetadata:(e,{errors:t})=>{de(e)||t.push({path:"documentMetadata",message:"documentMetadata must be a plain object",severity:"error"})},documentExtensions:(e,{errors:t})=>{if(!nr(e,"documentExtensions",t))return;let r=new Set;e.forEach((n,i)=>FF(n,`documentExtensions[${i}]`,t,r))},definitionContainers:(e,{doc:t,errors:r})=>{if(!nr(e,"definitionContainers",r))return;let n=new Set,i=new Set,a=da(t);e.forEach((o,s)=>{let l=`definitionContainers[${s}]`;if(!de(o)){r.push({path:l,message:"Definition container must be a plain object",severity:"error"});return}typeof o.id!="string"||o.id.length===0?r.push({path:`${l}.id`,message:"Definition container id must be a non-empty string",severity:"error"}):n.has(o.id)?r.push({path:`${l}.id`,message:`Duplicate definition container id: "${o.id}"`,severity:"error"}):n.add(o.id),o.svgId!==void 0&&(typeof o.svgId!="string"||o.svgId.length===0)&&r.push({path:`${l}.svgId`,message:"Definition container svgId must be a non-empty string",severity:"error"}),typeof o.order!="number"||!Number.isInteger(o.order)||o.order<0?r.push({path:`${l}.order`,message:"Definition container order must be a non-negative integer",severity:"error"}):i.has(o.order)?r.push({path:`${l}.order`,message:`Duplicate definition container order: ${o.order}`,severity:"error"}):i.add(o.order),Us(o.authoredPlacement,`${l}.authoredPlacement`,r,a,"Definition container"),o.attributes!==void 0&&nr(o.attributes,`${l}.attributes`,r)&&o.attributes.forEach((u,d)=>{let c=`${l}.attributes[${d}]`;jI(u,c,r),de(u)&&u.localName==="id"&&u.namespaceUri===null&&r.push({path:c,message:"Definition container attributes must not duplicate svgId authority",severity:"error"})})})},documentScripts:(e,{errors:t})=>{nr(e,"documentScripts",t)&&e.forEach((r,n)=>{let i=`documentScripts[${n}]`;if(!de(r)){t.push({path:i,message:"Document script must be a non-null object",severity:"error"});return}(typeof r.id!="string"||r.id.length===0)&&t.push({path:`${i}.id`,message:"Document script id must be a non-empty string",severity:"error"})})},documentStyles:(e,{doc:t,errors:r})=>{if(!nr(e,"documentStyles",r))return;let n=da(t);e.forEach((i,a)=>{let o=`documentStyles[${a}]`;if(!de(i)){r.push({path:o,message:"Document style must be a non-null object",severity:"error"});return}(typeof i.id!="string"||i.id.length===0)&&r.push({path:`${o}.id`,message:"Document style id must be a non-empty string",severity:"error"}),typeof i.css!="string"&&r.push({path:`${o}.css`,message:"Document style css must be a string",severity:"error"}),i.placement!=="root"&&i.placement!=="defs"&&r.push({path:`${o}.placement`,message:'Document style placement must be "root" or "defs"',severity:"error"}),Eo(i.definitionOrder,`${o}.definitionOrder`,r),zo(i.definitionContainerId,`${o}.definitionContainerId`,r),Us(i.authoredPlacement,`${o}.authoredPlacement`,r,n,"Document style"),i.scopeDefinitionId!==void 0&&(typeof i.scopeDefinitionId!="string"||i.scopeDefinitionId.length===0)&&r.push({path:`${o}.scopeDefinitionId`,message:"Document style scopeDefinitionId must be a non-empty string",severity:"error"}),i.scopeDefinitionId!==void 0&&i.placement!=="defs"&&r.push({path:`${o}.scopeDefinitionId`,message:"A definition-scoped document style must use defs placement",severity:"error"})})},templateVariables:(e,{errors:t})=>{nr(e,"templateVariables",t)&&e.forEach((r,n)=>{let i=`templateVariables[${n}]`;if(!de(r)){t.push({path:i,message:"Template variable must be a non-null object",severity:"error"});return}(typeof r.name!="string"||r.name.length===0)&&t.push({path:`${i}.name`,message:"Template variable name must be a non-empty string",severity:"error"})})},animationTimeline:(e,{doc:t,errors:r})=>{if(!de(e)){r.push({path:"animationTimeline",message:"animationTimeline must be a plain object",severity:"error"});return}if(e.tracks!==void 0&&!Array.isArray(e.tracks)){r.push({path:"animationTimeline.tracks",message:"animationTimeline.tracks must be an array",severity:"error"});return}if(e.cssAnimationDocumentStylesFingerprint!==void 0&&(typeof e.cssAnimationDocumentStylesFingerprint!="string"||e.cssAnimationDocumentStylesFingerprint.length===0)&&r.push({path:"animationTimeline.cssAnimationDocumentStylesFingerprint",message:"CSS animation document-style fingerprint must be a non-empty string",severity:"error"}),e.cssAnimationInlineStylesFingerprint!==void 0&&(typeof e.cssAnimationInlineStylesFingerprint!="string"||e.cssAnimationInlineStylesFingerprint.length===0)&&r.push({path:"animationTimeline.cssAnimationInlineStylesFingerprint",message:"CSS animation inline-style fingerprint must be a non-empty string",severity:"error"}),e.cssAnimationSources!==void 0)if(!Array.isArray(e.cssAnimationSources))r.push({path:"animationTimeline.cssAnimationSources",message:"CSS animation sources must be an array",severity:"error"});else{let n=new Set,i=new Set;e.cssAnimationSources.forEach((a,o)=>{let s=`animationTimeline.cssAnimationSources[${o}]`;if(!de(a)){r.push({path:s,message:"CSS animation source must be an object",severity:"error"});return}if(typeof a.id!="string"||a.id.length===0?r.push({path:`${s}.id`,message:"CSS animation source id must be a non-empty string",severity:"error"}):n.has(a.id)?r.push({path:`${s}.id`,message:`Duplicate CSS animation source id: "${a.id}"`,severity:"error"}):n.add(a.id),!Array.isArray(a.trackIds)||!Array.isArray(a.trackFingerprints)){r.push({path:s,message:"CSS animation source track ids and fingerprints must be arrays",severity:"error"});return}a.trackIds.length!==a.trackFingerprints.length&&r.push({path:s,message:"CSS animation source track ids and fingerprints must have equal lengths",severity:"error"}),a.trackIds.forEach((l,u)=>{typeof l!="string"||l.length===0?r.push({path:`${s}.trackIds[${u}]`,message:"CSS animation source track id must be a non-empty string",severity:"error"}):i.has(l)?r.push({path:`${s}.trackIds[${u}]`,message:`Duplicate CSS animation source track id: "${l}"`,severity:"error"}):i.add(l)}),a.trackFingerprints.forEach((l,u)=>{(typeof l!="string"||l.length===0)&&r.push({path:`${s}.trackFingerprints[${u}]`,message:"CSS animation track fingerprint must be a non-empty string",severity:"error"})})})}if(Array.isArray(e.tracks)&&Number(t.schemaVersion)>=11){let n=EF(t.shapes);e.tracks.forEach((i,a)=>{if(!de(i)||!Array.isArray(i.keyframes))return;if(i.sourceCssAnimationId!==void 0&&(typeof i.sourceCssAnimationId!="string"||!i.sourceCssAnimationId)&&r.push({path:`animationTimeline.tracks[${a}].sourceCssAnimationId`,message:"CSS animation source id must be a non-empty string",severity:"error"}),i.definitionTarget!==void 0){let s=`animationTimeline.tracks[${a}].definitionTarget`;if(!de(i.definitionTarget))r.push({path:s,message:"must be an object",severity:"error"});else{let l=i.definitionTarget.definitionId,u=i.definitionTarget.nodeId;if((typeof l!="string"||l.length===0)&&r.push({path:`${s}.definitionId`,message:"must be a non-empty string",severity:"error"}),u!==void 0&&(typeof u!="string"||u.length===0)&&r.push({path:`${s}.nodeId`,message:"must be a non-empty string when present",severity:"error"}),typeof l=="string"&&l.length>0){let d=`definition:${l}${typeof u=="string"&&u.length>0?`/${u}`:""}`;i.shapeId!==d&&r.push({path:`animationTimeline.tracks[${a}].shapeId`,message:`definition target tracks must use ${d}`,severity:"error"})}}}if(i.simpleDuration!==void 0&&i.simpleDuration!=="indefinite"&&r.push({path:`animationTimeline.tracks[${a}].simpleDuration`,message:'SMIL simple duration must be "indefinite" when present',severity:"error"}),i.simpleDuration==="indefinite"&&i.cycleDuration!==void 0&&r.push({path:`animationTimeline.tracks[${a}].cycleDuration`,message:"Finite and indefinite SMIL simple durations are mutually exclusive",severity:"error"}),i.sourceSmilPlacement!==void 0&&i.sourceSmilPlacement!=="document"&&i.sourceSmilPlacement!=="defs"&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilPlacement`,message:'SMIL source placement must be "document" or "defs" when present',severity:"error"}),i.sourceSmilParentTarget!==void 0&&i.sourceSmilParentTarget!==!0&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilParentTarget`,message:"SMIL implicit parent target must be true when present",severity:"error"}),i.sourceSmilParentTarget===!0&&i.sourceSmilPlacement!=="document"&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilPlacement`,message:"SMIL implicit parent target requires document placement",severity:"error"}),i.sourceSmilOrder!==void 0&&(!Number.isInteger(i.sourceSmilOrder)||Number(i.sourceSmilOrder)<0)&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilOrder`,message:"SMIL source order must be a non-negative integer when present",severity:"error"}),i.sourceSmilDefinitionOrder!==void 0&&(!Number.isInteger(i.sourceSmilDefinitionOrder)||Number(i.sourceSmilDefinitionOrder)<0)&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilDefinitionOrder`,message:"SMIL definition order must be a non-negative integer when present",severity:"error"}),i.sourceSmilDefinitionContainerId!==void 0&&(typeof i.sourceSmilDefinitionContainerId!="string"||i.sourceSmilDefinitionContainerId.length===0)&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilDefinitionContainerId`,message:"SMIL definition container id must be a non-empty string when present",severity:"error"}),(i.sourceSmilDefinitionOrder!==void 0||i.sourceSmilDefinitionContainerId!==void 0)&&i.sourceSmilPlacement!=="defs"&&r.push({path:`animationTimeline.tracks[${a}].sourceSmilPlacement`,message:'SMIL definition placement fields require sourceSmilPlacement "defs"',severity:"error"}),i.textPathStartOffsetUnit!==void 0&&i.textPathStartOffsetUnit!=="%"&&i.textPathStartOffsetUnit!=="user"&&r.push({path:`animationTimeline.tracks[${a}].textPathStartOffsetUnit`,message:'Text path start-offset unit must be "%" or "user" when present',severity:"error"}),i.textSpanTarget!==void 0){let s=`animationTimeline.tracks[${a}].textSpanTarget`;if(!de(i.textSpanTarget))r.push({path:s,message:"Text span target must be a plain object",severity:"error"});else{let l=i.textSpanTarget;if((typeof l.attributeName!="string"||l.attributeName.length===0)&&r.push({path:`${s}.attributeName`,message:"Text span target attribute name must be a non-empty string",severity:"error"}),!Array.isArray(l.spanIds)||l.spanIds.length===0||l.spanIds.some(u=>typeof u!="string"||u.length===0)||new Set(l.spanIds).size!==l.spanIds.length)r.push({path:`${s}.spanIds`,message:"Text span target ids must be unique non-empty strings",severity:"error"});else{let u=typeof i.shapeId=="string"?n.get(i.shapeId):void 0;if(!u)r.push({path:s,message:"Text span animation must target a canonical text shape",severity:"error"});else{l.spanIds.forEach((c,f)=>{u.has(c)||r.push({path:`${s}.spanIds[${f}]`,message:`Text span animation target "${c}" does not exist on shape "${i.shapeId}"`,severity:"error"})});let d=l.spanIds.map(c=>u.get(c));if(d.every(c=>c&&typeof c.start=="number"&&Number.isInteger(c.start)&&typeof c.end=="number"&&Number.isInteger(c.end))){let c=d[0].end;d.slice(1).every(f=>{let p=f;return p.start!==c?!1:(c=p.end,!0)})||r.push({path:`${s}.spanIds`,message:"Text span animation target ids must describe one ordered contiguous range",severity:"error"})}}}}}let o=new Set;i.keyframes.forEach((s,l)=>{let u=`animationTimeline.tracks[${a}].keyframes[${l}].id`;if(!de(s)||typeof s.id!="string"||!s.id){r.push({path:u,message:"Animation keyframe id must be a non-empty string",severity:"error"});return}if(o.has(s.id)){r.push({path:u,message:`Duplicate animation keyframe id: "${s.id}"`,severity:"error"});return}o.add(s.id)})})}},library:(e,{doc:t,errors:r,warnings:n})=>{if(!nr(e,"library",r))return;let i=new Set,a=da(t);e.forEach((l,u)=>{let d=`library[${u}]`;if(!de(l)){r.push({path:d,message:"Library def must be a non-null object",severity:"error"});return}if(typeof l.id!="string"||l.id.length===0?r.push({path:`${d}.id`,message:"Library def id must be a non-empty string",severity:"error"}):i.has(l.id)?r.push({path:`${d}.id`,message:`Duplicate library def id: "${l.id}"`,severity:"error"}):i.add(l.id),(typeof l.kind!="string"||l.kind.length===0)&&r.push({path:`${d}.kind`,message:"Library def kind must be a non-empty string",severity:"error"}),l.definitionPlacement!==void 0&&!["defs","document"].includes(String(l.definitionPlacement))&&r.push({path:`${d}.definitionPlacement`,message:"Library definitionPlacement must be defs or document",severity:"error"}),Eo(l.definitionOrder,`${d}.definitionOrder`,r),zo(l.definitionContainerId,`${d}.definitionContainerId`,r),Us(l.authoredPlacement,`${d}.authoredPlacement`,r,a,"Library"),l.kind==="symbol"||l.kind==="marker"){let c=Zf(l.shapes);if(typeof l.id=="string"&&l.id.length>0&&c.add(l.id),zF(l.animations,`${d}.animations`,c,r),l.kind==="symbol"){let f=typeof t.schemaVersion=="number"&&t.schemaVersion>=8;if(l.defKind!==void 0&&!["symbol","group","shape"].includes(String(l.defKind))&&r.push({path:`${d}.defKind`,message:"Symbol defKind must be symbol, group, or shape",severity:"error"}),l.definitionPlacement==="document"&&(l.defKind??"symbol")!=="symbol"&&r.push({path:`${d}.definitionPlacement`,message:"Only symbol roots may use document definition placement",severity:"error"}),l.defKind==="shape"&&(!Array.isArray(l.shapes)||l.shapes.length!==1)&&r.push({path:`${d}.shapes`,message:"Native shape definitions must contain exactly one root shape",severity:"error"}),f)for(let p of["wrapperAttrs","groups","overflow"])l[p]!==void 0&&r.push({path:`${d}.${p}`,message:`Symbol ${p} is schema-v7 migration input only`,severity:"error"});for(let p of["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"])l[p]!==void 0&&typeof l[p]!="string"&&r.push({path:`${d}.${p}`,message:`Symbol ${p} must be a string when present`,severity:"error"});if(l.rootAttributes!==void 0)if(!de(l.rootAttributes))r.push({path:`${d}.rootAttributes`,message:"Symbol rootAttributes must be a plain object",severity:"error"});else for(let[p,h]of Object.entries(l.rootAttributes))f&&["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(p)&&r.push({path:`${d}.rootAttributes.${p}`,message:`Symbol ${p} must use its typed root field`,severity:"error"}),typeof h!="string"&&r.push({path:`${d}.rootAttributes.${p}`,message:"Symbol root attribute values must be strings",severity:"error"});if(l.definitionContentOrder!==void 0)if(!Array.isArray(l.definitionContentOrder))r.push({path:`${d}.definitionContentOrder`,message:"Symbol definitionContentOrder must be an array",severity:"error"});else{let p=new Set(Array.isArray(l.shapes)?l.shapes.filter(m=>de(m)).map(m=>m.id).filter(m=>typeof m=="string"&&m.length>0):[]),h=new Set;l.definitionContentOrder.forEach((m,g)=>{let v=`${d}.definitionContentOrder[${g}]`;if(!de(m)){r.push({path:v,message:"Definition content entry must be a plain object",severity:"error"});return}if(m.kind!=="shape"&&m.kind!=="definition"&&r.push({path:`${v}.kind`,message:"Definition content kind must be shape or definition",severity:"error"}),typeof m.id!="string"||m.id.length===0){r.push({path:`${v}.id`,message:"Definition content id must be a non-empty string",severity:"error"});return}let b=`${String(m.kind)}\0${m.id}`;h.has(b)&&r.push({path:v,message:`Duplicate definition content entry: ${String(m.kind)} "${m.id}"`,severity:"error"}),h.add(b),m.kind==="shape"&&!p.has(m.id)&&r.push({path:`${v}.id`,message:`Definition content shape "${m.id}" is not a root shape of this definition`,severity:"error"})})}}if(l.kind==="marker"){for(let f of["viewBox","preserveAspectRatio"])l[f]!==void 0&&typeof l[f]!="string"&&r.push({path:`${d}.${f}`,message:`Marker ${f} must be a string when present`,severity:"error"});if(l.authoredGeometry!==void 0)if(!de(l.authoredGeometry))r.push({path:`${d}.authoredGeometry`,message:"Marker authoredGeometry must be a plain object",severity:"error"});else for(let[f,p]of Object.entries(l.authoredGeometry))typeof p!="string"&&r.push({path:`${d}.authoredGeometry.${f}`,message:"Marker authored geometry declarations must be strings",severity:"error"});if(l.rootAttributes!==void 0)if(!de(l.rootAttributes))r.push({path:`${d}.rootAttributes`,message:"Marker rootAttributes must be a plain object",severity:"error"});else for(let[f,p]of Object.entries(l.rootAttributes))["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"].includes(f)&&r.push({path:`${d}.rootAttributes.${f}`,message:`Marker ${f} must use its typed root field`,severity:"error"}),typeof p!="string"&&r.push({path:`${d}.rootAttributes.${f}`,message:"Marker root attribute values must be strings",severity:"error"})}if(Array.isArray(l.shapes)){let f=new Set;l.shapes.forEach((p,h)=>{Jf(p,`${d}.shapes[${h}]`,r,n,f)})}if(l.kind==="symbol"&&de(l.variants))for(let[f,p]of Object.entries(l.variants)){if(!Array.isArray(p))continue;let h=new Set;p.forEach((m,g)=>{Jf(m,`${d}.variants[${f}][${g}]`,r,n,h)})}}(l.kind==="linear-gradient"||l.kind==="radial-gradient")&&UF(l.gradient,`${d}.gradient`,l.kind,r),l.kind==="pattern"&&GF(l.pattern,`${d}.pattern`,r),l.kind==="appearance-style"&&qF(l.layers,`${d}.layers`,r)});let o=new Map;e.forEach((l,u)=>{de(l)&&l.kind==="symbol"&&typeof l.id=="string"&&l.id.length>0&&o.set(l.id,{def:l,index:u})});let s=new Map;for(let[l,{def:u,index:d}]of o)Array.isArray(u.definitionContentOrder)&&u.definitionContentOrder.forEach((c,f)=>{if(!de(c)||c.kind!=="definition"||typeof c.id!="string")return;let p=`library[${d}].definitionContentOrder[${f}].id`;if(c.id===l){r.push({path:p,message:`Symbol definition "${l}" cannot contain itself`,severity:"error"});return}if(!o.has(c.id)){r.push({path:p,message:`Nested symbol definition "${c.id}" does not exist`,severity:"error"});return}let h=s.get(c.id);if(h&&h!==l){r.push({path:p,message:`Nested symbol definition "${c.id}" already belongs to "${h}"`,severity:"error"});return}s.set(c.id,l)});for(let l of o.keys()){let u=new Set,d=l;for(;d!==void 0;){if(u.has(d)){let c=o.get(l);r.push({path:`library[${c?.index??0}].definitionContentOrder`,message:`Symbol definition forest contains a cycle through "${d}"`,severity:"error"});break}u.add(d),d=s.get(d)}}},paintServerDefs:(e,{doc:t,errors:r})=>{if(!nr(e,"paintServerDefs",r))return;let n=new Set,i=da(t);e.forEach((a,o)=>{YF(a,`paintServerDefs[${o}]`,r,n,i)})},colorGlyphLibrary:(e,{errors:t})=>{if(!de(e)){t.push({path:"colorGlyphLibrary",message:"colorGlyphLibrary must be a plain object",severity:"error"});return}e.version!==void 0&&!Number.isInteger(e.version)&&t.push({path:"colorGlyphLibrary.version",message:"colorGlyphLibrary.version must be an integer",severity:"error"}),e.entries!==void 0&&!Array.isArray(e.entries)&&t.push({path:"colorGlyphLibrary.entries",message:"colorGlyphLibrary.entries must be an array",severity:"error"})},exportItems:(e,{errors:t})=>{nr(e,"exportItems",t)&&e.forEach((r,n)=>{let i=`exportItems[${n}]`;if(!de(r)){t.push({path:i,message:"Export item must be a non-null object",severity:"error"});return}(typeof r.id!="string"||r.id.length===0)&&t.push({path:`${i}.id`,message:"Export item id must be a non-empty string",severity:"error"}),typeof r.filename!="string"&&t.push({path:`${i}.filename`,message:"Export item filename must be a string",severity:"error"}),typeof r.format!="string"&&t.push({path:`${i}.format`,message:"Export item format must be a string",severity:"error"})})},unknownFields:(e,{errors:t})=>{de(e)||t.push({path:"unknownFields",message:"unknownFields must be a plain object (forward-compat quarantine bag)",severity:"error"})}};function Zf(e){let t=new Set;if(!Array.isArray(e))return t;for(let r of e)Li(r,{onShape:n=>{typeof n.id=="string"&&n.id.length>0&&t.add(n.id)}});return t}function gv(e){return e.startsWith("structural:")}function XF(e,t,r,n,i,a){if(e===null||typeof e!="object"){r.push({path:t,message:"Scene tree entry must be a non-null object",severity:"error"});return}let o=e;typeof o.id!="string"||o.id.length===0?r.push({path:`${t}.id`,message:"Scene tree id must be a non-empty string",severity:"error"}):(a.has(o.id)&&r.push({path:`${t}.id`,message:`Duplicate scene tree id: "${o.id}"`,severity:"error"}),a.add(o.id),!i.has(o.id)&&!gv(o.id)&&n.push({path:`${t}.id`,message:`Scene tree id "${o.id}" is not present in shapes`,severity:"warning"})),o.parentId!==null&&typeof o.parentId!="string"?r.push({path:`${t}.parentId`,message:"Scene tree parentId must be a string or null",severity:"error"}):typeof o.parentId=="string"&&!i.has(o.parentId)&&!gv(o.parentId)&&n.push({path:`${t}.parentId`,message:`Scene tree parentId "${o.parentId}" is not present in shapes`,severity:"warning"}),(typeof o.index!="number"||!Number.isInteger(o.index)||o.index<0)&&r.push({path:`${t}.index`,message:"Scene tree index must be a non-negative integer",severity:"error"}),o.updatedAt!==void 0&&(typeof o.updatedAt!="number"||!Number.isFinite(o.updatedAt)||o.updatedAt<0)&&r.push({path:`${t}.updatedAt`,message:"Scene tree updatedAt must be a non-negative finite number",severity:"error"}),o.clientId!==void 0&&typeof o.clientId!="string"&&r.push({path:`${t}.clientId`,message:"Scene tree clientId must be a string",severity:"error"})}var HF=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]);function Us(e,t,r,n,i){if(e===void 0)return;if(!de(e)){r.push({path:t,message:`${i} authoredPlacement must be an object`,severity:"error"});return}let a=e.parentId,o=e.parentDefinitionId,s=e.siblingIndex,l=!0;if((typeof a!="string"||a.length===0)&&(r.push({path:`${t}.parentId`,message:"Definition placement parentId must be a non-empty string",severity:"error"}),l=!1),o!==void 0&&(typeof o!="string"||o.length===0)&&(r.push({path:`${t}.parentDefinitionId`,message:"Definition placement parentDefinitionId must be a non-empty string when present",severity:"error"}),l=!1),l){let u=n.resolve(e);u.kind==="missing"?r.push({path:o===void 0?`${t}.parentId`:`${t}.parentDefinitionId`,message:o===void 0?`Definition placement parentId "${String(a)}" does not exist`:`Definition placement parent "${String(a)}" does not exist in library definition "${String(o)}"`,severity:"error"}):u.kind==="ambiguous"&&r.push({path:`${t}.parentId`,message:`Definition placement parentId "${String(a)}" is ambiguous across library definitions: ${u.definitionIds.join(", ")}`,severity:"error"})}(typeof s!="number"||!Number.isInteger(s)||s<0)&&r.push({path:`${t}.siblingIndex`,message:"Definition placement siblingIndex must be a non-negative integer",severity:"error"})}function qF(e,t,r){if(!Array.isArray(e)){r.push({path:t,message:"Appearance style layers must be an array",severity:"error"});return}let n=new Set;e.forEach((i,a)=>{let o=`${t}[${a}]`;if(!de(i)){r.push({path:o,message:"Appearance style layer must be an object",severity:"error"});return}if(i.kind!=="fill"&&i.kind!=="stroke"&&r.push({path:`${o}.kind`,message:"Appearance style layer kind must be fill or stroke",severity:"error"}),typeof i.id!="string"||i.id.length===0){r.push({path:`${o}.id`,message:"Appearance style layer id must be a non-empty string",severity:"error"});return}n.has(i.id)?r.push({path:`${o}.id`,message:`Duplicate appearance style layer id: "${i.id}"`,severity:"error"}):n.add(i.id)})}function YF(e,t,r,n,i){if(e===null||typeof e!="object"){r.push({path:t,message:"Paint server def must be a non-null object",severity:"error"});return}let a=e;typeof a.id!="string"||a.id.length===0?r.push({path:`${t}.id`,message:"Paint server def id must be a non-empty string",severity:"error"}):n.has(a.id)?r.push({path:`${t}.id`,message:`Duplicate paint server def id: "${a.id}"`,severity:"error"}):n.add(a.id),a.sourceId!==void 0&&(typeof a.sourceId!="string"||a.sourceId.length===0)&&r.push({path:`${t}.sourceId`,message:"Paint server def sourceId must be a non-empty string when present",severity:"error"});let o=a.role===void 0?"resource":a.role;o!=="resource"&&o!=="referenced-fragment"&&r.push({path:`${t}.role`,message:"Paint server def role must be resource or referenced-fragment",severity:"error"}),typeof a.type=="string"&&(o==="resource"&&HF.has(a.type)||o==="referenced-fragment"&&/^[A-Za-z][\w.-]*$/u.test(a.type))||r.push({path:`${t}.type`,message:"Paint server def type must be a supported SVG defs element type",severity:"error"}),(typeof a.markup!="string"||a.markup.length===0)&&r.push({path:`${t}.markup`,message:"Paint server def markup must be a non-empty string",severity:"error"}),a.passthrough!==void 0&&typeof a.passthrough!="boolean"&&r.push({path:`${t}.passthrough`,message:"Paint server def passthrough must be a boolean when present",severity:"error"});for(let s of["definitionChildIds","sourceDefinitionChildIds"]){let l=a[s];l!==void 0&&(!Array.isArray(l)||l.some(u=>typeof u!="string"||u.length===0))&&r.push({path:`${t}.${s}`,message:"Definition child ids must be non-empty strings",severity:"error"})}Array.isArray(a.definitionChildIds)&&Array.isArray(a.sourceDefinitionChildIds)&&a.definitionChildIds.length!==a.sourceDefinitionChildIds.length&&r.push({path:t,message:"Definition child id arrays must have equal lengths",severity:"error"}),Us(a.authoredPlacement,`${t}.authoredPlacement`,r,i,"Paint server def"),Eo(a.definitionOrder,`${t}.definitionOrder`,r),zo(a.definitionContainerId,`${t}.definitionContainerId`,r)}function Jf(e,t,r,n,i){if(e===null||typeof e!="object"||Array.isArray(e)){r.push({path:t,message:"Shape must be a non-null object",severity:"error"});return}Li(e,{onShape:(a,o)=>{KF(a,`${t}${o}`,r,n,i)}})}function KF(e,t,r,n,i){if(typeof e.id!="string"||e.id.length===0?r.push({path:`${t}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(e.id)?r.push({path:`${t}.id`,message:`Duplicate shape id: "${e.id}"`,severity:"error"}):i.add(e.id),typeof e.type!="string"?r.push({path:`${t}.type`,message:"Shape type must be a string",severity:"error"}):jF().has(e.type)||n.push({path:`${t}.type`,message:`Unknown shape type: "${e.type}"`,severity:"warning"}),e.state===void 0||e.state===null||typeof e.state!="object")r.push({path:`${t}.state`,message:"Shape state must be a non-null object",severity:"error"});else{let a=e.state;JF(a,`${t}.state`,r,n),e.type==="foreign-object"&&(Object.hasOwn(a,"rawContent")&&r.push({path:`${t}.state.rawContent`,message:"rawContent is noncanonical; use structured foreignContent nodes",severity:"error"}),a.foreignContent!==void 0&&nr(a.foreignContent,`${t}.state.foreignContent`,r)&&a.foreignContent.forEach((o,s)=>EI(o,`${t}.state.foreignContent[${s}]`,r))),a.children!==void 0&&!Array.isArray(a.children)?r.push({path:`${t}.state.children`,message:"children must be an array",severity:"error"}):Array.isArray(a.children)&&a.children.forEach((o,s)=>{(o===null||typeof o!="object"||Array.isArray(o))&&r.push({path:`${t}.state.children[${s}]`,message:"Shape must be a non-null object",severity:"error"})})}}var ZF=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function yv(e){return typeof e=="number"?isFinite(e):typeof e=="string"?ZF.test(e):!1}function JF(e,t,r,n){if(Eo(e.definitionOrder,`${t}.definitionOrder`,r),zo(e.definitionContainerId,`${t}.definitionContainerId`,r),de(e.metadata))for(let o of["linkUrl","linkTarget"])Object.hasOwn(e.metadata,o)&&r.push({path:`${t}.metadata.${o}`,message:`${o} is noncanonical; use a Hyperlink container shape`,severity:"error"});if((e.fillType==="linear-gradient"||e.fillType==="radial-gradient"||e.fillType==="pattern")&&e.fillColor==="none"&&e.fillOpacity===0&&r.push({path:`${t}.fillOpacity`,message:"Painted shapes cannot carry the noncanonical no-fill opacity encoding",severity:"error"}),e.charOffsets!==void 0&&e.charOffsets!==null&&(Array.isArray(e.charOffsets)?e.charOffsets.forEach((o,s)=>{let l=`${t}.charOffsets[${s}]`;if(!de(o)){r.push({path:l,message:"Each charOffsets entry must be a plain object",severity:"error"});return}for(let u of["x","y"]){let d=o[u];d!==null&&(typeof d!="number"||!Number.isFinite(d))&&r.push({path:`${l}.${u}`,message:`${u} must be null or a finite number`,severity:"error"})}for(let u of["dx","dy","rotate"]){let d=o[u];(typeof d!="number"||!Number.isFinite(d))&&r.push({path:`${l}.${u}`,message:`${u} must be a finite number`,severity:"error"})}if(o.raw!==void 0)if(!de(o.raw))r.push({path:`${l}.raw`,message:"raw must be a plain object",severity:"error"});else for(let[u,d]of Object.entries(o.raw))(!["x","y","dx","dy"].includes(u)||typeof d!="string")&&r.push({path:`${l}.raw.${u}`,message:"raw accepts only string x/y/dx/dy members",severity:"error"})}):r.push({path:`${t}.charOffsets`,message:"charOffsets must be an array",severity:"error"})),e.textPathReference!==void 0&&e.textPathReference!==null){let o=e.textPathReference;(!de(o)||o.kind!=="shape"&&o.kind!=="definition"||typeof o.targetId!="string"||o.targetId.length===0||o.element!=="href"&&o.element!=="mpath"||Object.keys(o).some(s=>!["kind","targetId","element"].includes(s)))&&r.push({path:`${t}.textPathReference`,message:"textPathReference requires an exact shape/definition target and href/mpath element",severity:"error"})}for(let o of["textPathRefShapeId","textPathImportRefId"])e[o]!==void 0&&r.push({path:`${t}.${o}`,message:`${o} is noncanonical; use textPathReference`,severity:"error"});if(e.authoredTextPosition!==void 0)if(!de(e.authoredTextPosition))r.push({path:`${t}.authoredTextPosition`,message:"authoredTextPosition must be a plain object",severity:"error"});else for(let[o,s]of Object.entries(e.authoredTextPosition)){let l=`${t}.authoredTextPosition.${o}`;if(!["x","y"].includes(o)||!de(s)){r.push({path:l,message:"Authored text position accepts only x/y coordinate objects",severity:"error"});continue}(typeof s.raw!="string"||s.raw.length===0||typeof s.resolved!="number"||!Number.isFinite(s.resolved))&&r.push({path:l,message:"Authored text coordinates require non-empty raw and finite resolved values",severity:"error"});for(let u of Object.keys(s))["raw","resolved"].includes(u)||r.push({path:`${l}.${u}`,message:"Authored text coordinates accept only raw/resolved members",severity:"error"})}if(e.textSpanTree!==void 0){let o=`${t}.textSpanTree`;if(!de(e.textSpanTree))r.push({path:o,message:"textSpanTree must be a plain object",severity:"error"});else{let s=e.textSpanTree,l=s.text,u=s.spans;if(typeof l!="string"||!Array.isArray(u))r.push({path:o,message:"Text span trees require text and spans",severity:"error"});else{let d=new Set,c=(f,p,h,m)=>{let g=p;f.forEach((v,b)=>{let y=`${m}[${b}]`,I=de(v)?v.start:void 0,x=de(v)?v.end:void 0,k=de(v)?v.children:void 0,$=de(v)?v.spanId:void 0,A=de(v)?v.id:void 0,S=de(v)?v.lineIndex:void 0,M=de(v)?v.rotate:void 0;!de(v)||typeof I!="number"||typeof x!="number"||!Number.isInteger(I)||!Number.isInteger(x)||I<g||x<I||I<p||x>h||!Array.isArray(k)||typeof $!="string"||$.length===0||d.has($)||A!==void 0&&(typeof A!="string"||A.length===0)||S!==void 0&&(typeof S!="number"||!Number.isInteger(S)||S<0)||M!==void 0&&(!Array.isArray(M)||M.length===0||M.some(T=>typeof T!="number"||!Number.isFinite(T)))||Object.keys(v).some(T=>!["spanId","start","end","id","lineIndex","rotate","children"].includes(T))?r.push({path:y,message:"Text span nodes require nested ordered ranges, child arrays, and valid optional identity/line fields",severity:"error"}):(d.add($),c(k,I,x,`${y}.children`),g=x)})};c(u,0,l.length,`${o}.spans`),s.rotate!==void 0&&(!Array.isArray(s.rotate)||s.rotate.length===0||s.rotate.some(f=>typeof f!="number"||!Number.isFinite(f)))&&r.push({path:`${o}.rotate`,message:"Text span root rotate must be a non-empty finite number list",severity:"error"});for(let f of Object.keys(s))["text","rotate","spans"].includes(f)||r.push({path:`${o}.${f}`,message:"Text span trees accept only text/spans members",severity:"error"})}}}if(e.authoredUseGeometry!==void 0)if(!de(e.authoredUseGeometry))r.push({path:`${t}.authoredUseGeometry`,message:"authoredUseGeometry must be a plain object",severity:"error"});else for(let[o,s]of Object.entries(e.authoredUseGeometry))(!["x","y","width","height"].includes(o)||typeof s!="string")&&r.push({path:`${t}.authoredUseGeometry.${o}`,message:"Authored use geometry accepts only string x/y/width/height members",severity:"error"});let i=["x","y","width","height","radius","rx","ry","fontSize"];for(let o of i)e[o]!==void 0&&!yv(e[o])&&r.push({path:`${t}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"});for(let o of Hb){let s=e[o];if(s!=null){if(o==="transformMatrix"){(!Array.isArray(s)||s.length<6||!s.slice(0,6).every(l=>typeof l=="number"&&Number.isFinite(l)))&&r.push({path:`${t}.${o}`,message:`${o} must be a 6-element finite affine matrix`,severity:"error"});continue}yv(s)||r.push({path:`${t}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"})}}let a=["width","height","radius","fontSize"];for(let o of a){let s=e[o];typeof s=="number"&&s<=0&&n.push({path:`${t}.${o}`,message:`${o} should be positive (got ${s})`,severity:"warning"})}}function QF(e,t,r,n){if(e===null||typeof e!="object"){r.push({path:t,message:"Viewbox must be a non-null object",severity:"error"});return}let i=e;typeof i.id!="string"||i.id.length===0?r.push({path:`${t}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):n.has(i.id)?r.push({path:`${t}.id`,message:`Duplicate viewbox id: "${i.id}"`,severity:"error"}):n.add(i.id);for(let a of["x","y","width","height"])(typeof i[a]!="number"||!isFinite(i[a]))&&r.push({path:`${t}.${a}`,message:`${a} must be a finite number`,severity:"error"});typeof i.width=="number"&&i.width<=0&&r.push({path:`${t}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof i.height=="number"&&i.height<=0&&r.push({path:`${t}.height`,message:"Viewbox height must be positive",severity:"error"})}function eL(e,t,r){if(e===null||typeof e!="object"){r.push({path:t,message:"Guide must be a non-null object",severity:"error"});return}let n=e;(typeof n.id!="string"||n.id.length===0)&&r.push({path:`${t}.id`,message:"Guide id must be a non-empty string",severity:"error"}),n.orientation!=="horizontal"&&n.orientation!=="vertical"&&r.push({path:`${t}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof n.position!="number"||!isFinite(n.position))&&r.push({path:`${t}.position`,message:"Guide position must be a finite number",severity:"error"})}function tL(e,t,r,n,i,a){if(e===null||typeof e!="object"){r.push({path:t,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let o=e;(typeof o.id!="string"||o.id.length===0)&&r.push({path:`${t}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),o.type!=="clip"&&o.type!=="mask"&&r.push({path:`${t}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),o.definitionPlacement!==void 0&&o.definitionPlacement!=="defs"&&o.definitionPlacement!=="document"&&r.push({path:`${t}.definitionPlacement`,message:'definitionPlacement must be "defs" or "document"',severity:"error"}),o.referenceChannel!==void 0&&o.referenceChannel!=="attribute"&&o.referenceChannel!=="style"&&o.referenceChannel!=="stylesheet"&&r.push({path:`${t}.referenceChannel`,message:'referenceChannel must be "attribute", "style", or "stylesheet"',severity:"error"}),o.referenceStyleOrder!==void 0&&(typeof o.referenceStyleOrder!="number"||!Number.isInteger(o.referenceStyleOrder)||o.referenceStyleOrder<0)&&r.push({path:`${t}.referenceStyleOrder`,message:"referenceStyleOrder must be a non-negative integer",severity:"error"}),Eo(o.definitionOrder,`${t}.definitionOrder`,r),zo(o.definitionContainerId,`${t}.definitionContainerId`,r),Us(o.authoredPlacement,`${t}.authoredPlacement`,r,a,"Clip/mask");let s=o.clipShapeIds,l=typeof o.rawDefinition=="string"&&o.rawDefinition.length>0;s!==void 0&&!Array.isArray(s)?r.push({path:`${t}.clipShapeIds`,message:"clipShapeIds must be an array",severity:"error"}):s===void 0?r.push({path:`${t}.clipShapeIds`,message:"ClipMaskGroup must carry clipShapeIds",severity:"error"}):Array.isArray(s)&&s.length===0&&!l&&n.push({path:`${t}.clipShapeIds`,message:"ClipMaskGroup has no clip shapes and no rawDefinition; it will clip nothing",severity:"warning"}),Array.isArray(o.contentShapeIds)||r.push({path:`${t}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function Gh(e){let t=[...e].sort((i,a)=>i.index-a.index);if(!t.some(i=>i.orderKey))return t;let r=LA(t.length),n=new Map;return t.forEach((i,a)=>{n.set(i.id,i.orderKey??r[a])}),t.sort((i,a)=>{let o=Yb(n.get(i.id)??"",n.get(a.id)??"");return o!==0?o:i.id<a.id?-1:i.id>a.id?1:0})}function Ro(e){return e.definitionId??`${e.type}-${e.id}`}function zI(e){return e.rawDefinition!==void 0?!0:e.clipShapeIds.length===0}function RI(e){let t=zI(e);return e.type==="clip"?{type:"clip",...e.definitionPlacement!==void 0?{definitionPlacement:e.definitionPlacement}:{},...e.definitionOrder!==void 0?{definitionOrder:e.definitionOrder}:{},...e.definitionContainerId!==void 0?{definitionContainerId:e.definitionContainerId}:{},...e.authoredPlacement!==void 0?{authoredPlacement:structuredClone(e.authoredPlacement)}:{},...e.clipPathUnits!==void 0?{clipPathUnits:e.clipPathUnits}:{},...!t&&e.clipRule!==void 0?{clipRule:e.clipRule}:{},...t&&e.rawDefinition!==void 0?{rawDefinition:e.rawDefinition}:{}}:{type:"mask",...e.definitionPlacement!==void 0?{definitionPlacement:e.definitionPlacement}:{},...e.definitionOrder!==void 0?{definitionOrder:e.definitionOrder}:{},...e.definitionContainerId!==void 0?{definitionContainerId:e.definitionContainerId}:{},...e.authoredPlacement!==void 0?{authoredPlacement:structuredClone(e.authoredPlacement)}:{},...e.maskUnits!==void 0?{maskUnits:e.maskUnits}:{},...e.maskContentUnits!==void 0?{maskContentUnits:e.maskContentUnits}:{},...e.maskType!==void 0?{maskType:e.maskType}:{},...e.maskBounds!==void 0?{maskBounds:structuredClone(e.maskBounds)}:{},...t&&e.rawDefinition!==void 0?{rawDefinition:e.rawDefinition}:{}}}function rL(e,t,r){let{clipPathUnits:n,clipRule:i,maskUnits:a,maskContentUnits:o,maskType:s,maskBounds:l,definitionPlacement:u,definitionOrder:d,definitionContainerId:c,authoredPlacement:f,rawDefinition:p,...h}=structuredClone(e),m=t.rawDefinition!==void 0||zI(e);return e.type==="clip"?{...h,type:"clip",...t.definitionPlacement!==void 0?{definitionPlacement:t.definitionPlacement}:{},...t.definitionOrder!==void 0?{definitionOrder:t.definitionOrder}:{},...t.definitionContainerId!==void 0?{definitionContainerId:t.definitionContainerId}:{},...t.authoredPlacement!==void 0?{authoredPlacement:structuredClone(t.authoredPlacement)}:{},...t.clipPathUnits!==void 0?{clipPathUnits:t.clipPathUnits}:{},...!m&&t.clipRule!==void 0?{clipRule:t.clipRule}:{},...m&&r&&t.rawDefinition!==void 0?{rawDefinition:t.rawDefinition}:{}}:{...h,type:"mask",...t.definitionPlacement!==void 0?{definitionPlacement:t.definitionPlacement}:{},...t.definitionOrder!==void 0?{definitionOrder:t.definitionOrder}:{},...t.definitionContainerId!==void 0?{definitionContainerId:t.definitionContainerId}:{},...t.authoredPlacement!==void 0?{authoredPlacement:structuredClone(t.authoredPlacement)}:{},...t.maskUnits!==void 0?{maskUnits:t.maskUnits}:{},...t.maskContentUnits!==void 0?{maskContentUnits:t.maskContentUnits}:{},...t.maskType!==void 0?{maskType:t.maskType}:{},...t.maskBounds!==void 0?{maskBounds:structuredClone(t.maskBounds)}:{},...m&&r&&t.rawDefinition!==void 0?{rawDefinition:t.rawDefinition}:{}}}function _I(e){let t=new Map;for(let r of e??[]){let n=Ro(r),i=RI(r),a=t.get(n);t.set(n,a?.type===i.type?{...a,...i}:i)}return t}function nL(e){let t=structuredClone(e??[]),r=_I(t),n=new Set;return t.map(i=>{let a=Ro(i),o=r.get(a)??RI(i),s=o.rawDefinition!==void 0&&!n.has(a);return s&&n.add(a),rL(i,o,s)})}var iL=/^structural:(clip|mask):(.+):(group|path|content)$/;function vv(e,t){let r=`structural:${e}:${t}`;return{group:`${r}:group`,path:`${r}:path`,content:`${r}:content`}}function FI(e,t){for(let r of e){t.add(r.id);let n=r.state.children;Array.isArray(n)&&FI(n,t)}}function LI(e,t=null){let r=[];return e.forEach((n,i)=>{r.push({id:n.id,parentId:t,index:i});let a=n.state.children;Array.isArray(a)&&r.push(...LI(a,n.id))}),r}function BI(e){let t=e.sceneTree&&e.sceneTree.length>0?e.sceneTree:LI(e.shapes),r=new Map(t.map(x=>[x.id,x])),n=new Map;for(let x of t){let k=n.get(x.parentId)??[];k.push(x),n.set(x.parentId,k)}for(let[x,k]of n)n.set(x,Gh(k));let i=x=>iL.test(x),a=new Set(t.filter(x=>!i(x.id)).map(x=>x.id)),o=new Set;FI(e.shapes,o);let s=new Map,l=new Set,u=(x,k)=>{let $=[];for(let A of n.get(x)??[]){if(!i(A.id)){l.has(A.id)||(l.add(A.id),$.push(A.id));continue}if(k.has(A.id))continue;let S=new Set(k);S.add(A.id),$.push(...u(A.id,S))}return $},d=[null,...a];for(let x of d){let k=u(x,new Set);k.length>0&&s.set(x,k)}for(let x of a){if(l.has(x))continue;let k=r.get(x)?.parentId??null,$=k!==null&&a.has(k)?k:null,A=s.get($)??[];A.push(x),s.set($,A),l.add(x)}let c=x=>{for(let[k,$]of s){let A=$.indexOf(x);if(A>=0)return{parentId:k,index:A}}return null},f=x=>{for(let k of s.values()){let $=k.indexOf(x);$>=0&&k.splice($,1)}},p=e.clipMaskGroups??[],h=_I(p),m=new Set(p.filter(x=>x.clipShapeIds.some(k=>o.has(k))).map(x=>`${x.type}\0${Ro(x)}`)),g=new Map(p.map(x=>[vv(x.type,x.id).content,x])),v=(x,k=new Set)=>{if(k.has(x.id))return Number.MAX_SAFE_INTEGER;let $=x.parentId?g.get(x.parentId):void 0;if(!$)return 0;let A=new Set(k);return A.add(x.id),1+v($,A)},b=[...p].sort((x,k)=>v(x)-v(k)||(x.siblingIndex??0)-(k.siblingIndex??0)),y=new Map;for(let x of b){let k=x.clipShapeIds.filter(V=>o.has(V)),$=x.contentShapeIds.filter(V=>o.has(V)),A=Ro(x),S=h.get(A)?.rawDefinition!==void 0||m.has(`${x.type}\0${A}`);if($.length===0||!S)continue;let M=[...$,...k].map(c).filter(V=>V!==null),T=M[0]?.parentId??null,E=M.length>0?Math.min(...M.map(V=>V.index)):void 0,C=x.parentId===null||a.has(x.parentId)||g.has(x.parentId)?x.parentId:T;for(let V of[...k,...$])f(V);let O=vv(x.type,x.id),z=s.get(C)??[],R=x.siblingIndex??E??z.length,U=Math.min(Math.max(0,R),z.length);z.splice(U,0,O.group),s.set(C,z),s.set(O.group,[O.path,O.content]),s.set(O.path,[...k]),s.set(O.content,[...$]),y.set(O.group,{id:O.group,parentId:C,index:0}),y.set(O.path,{id:O.path,parentId:O.group,index:0}),y.set(O.content,{id:O.content,parentId:O.group,index:1})}let I=[];for(let[x,k]of s)k.forEach(($,A)=>{let S=y.get($);if(S){I.push({...S,parentId:x,index:A});return}let M=r.get($);M&&M.parentId===x?I.push({...M,index:A}):I.push({id:$,parentId:x,index:A})});e.sceneTree=I}function Jn(e){let t=[],r=new Map,n=new Set,i=new WeakSet,a=[...e].reverse();for(;a.length>0;){let s=a.pop();if(!s||typeof s!="object"||i.has(s))continue;i.add(s),t.push(s);let l=r.get(s.id);l&&l!==s?n.add(s.id):l||r.set(s.id,s);let u=s.state.children;if(Array.isArray(u))for(let d=u.length-1;d>=0;d--){let c=u[d];c&&typeof c=="object"&&typeof c.id=="string"&&a.push(c)}}let o=new Map(r);for(let s of n)o.delete(s);return{ordered:t,uniqueById:o,duplicateIds:n}}function Jd(e){let t=[...e??[]],r=new Map;for(let a of t)r.set(a.id,(r.get(a.id)??0)+1);let n=new Set([...r].filter(([,a])=>a>1).map(([a])=>a)),i=new Map;for(let a of t)n.has(a.id)||i.set(a.id,a);return{ordered:t,uniqueById:i,duplicateIds:n,definition:a=>i.get(a),symbol:a=>{let o=i.get(a);return o?.kind==="symbol"?o:void 0}}}function aL(e){let t=e.groupData;if(!t||typeof t!="object"||Array.isArray(t))return null;let r=t.transform;return typeof r=="string"&&r.trim()?r:null}function Wh(e,t){let r=ln(e,t);if(r)return{matrix:ni(e,t),attribute:r,owner:"canonical"};let n=aL(e);if(n){let i=Fi(n),a=e.customPivot;return{matrix:a?fh(a,i):i,attribute:n,owner:"group-data"}}return{matrix:Pt,attribute:null,owner:"none"}}function Sn(e){let t=e.transformMatrix;return To(t)&&!dn(t)||e.customPivot||typeof e.rawTransform=="string"&&e.rawTransform?!1:(e.rotation??0)!==0||(e.skewX??0)!==0||(e.skewY??0)!==0||(e.scaleX??1)!==1||(e.scaleY??1)!==1}function VI(e,t){let r=t?{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}:void 0;return Wh(e,r)}var oL=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,sL=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)px$/i,lL=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)%$/;function il(e,t,r,n){let i=e.trim();if(oL.test(i))return Number(i);let a=sL.exec(i);if(a)return Number(a[1]);let o=lL.exec(i);if(o)return t.percentBasis===void 0?(n.push({code:"unresolved-symbol-viewport",message:`Symbol ${t.axis} percentage ${e} needs a containing viewport basis.`}),null):Number(o[1])/100*t.percentBasis;let s=r.resolveLength?.(e,t)??null;return s!==null&&Number.isFinite(s)?s:(n.push({code:"invalid-symbol-length",message:`Symbol ${t.axis} length ${e} is invalid or requires an unavailable length host.`}),null)}function uL(e){let t=e.state.authoredUseGeometry;return t&&typeof t=="object"?t:{}}function la(e,t){let r=e[t];if(typeof r=="string")return r;if(["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(t))return;let n=e.rootAttributes?.[t];return typeof n=="string"?n:void 0}function dL(e,t){if(e===void 0)return;let r=Nn(e);return r?r.width<0||r.height<0?(t.push({code:"invalid-symbol-viewbox",message:`Symbol viewBox ${e} has a non-finite or negative dimension and is ignored.`}),null):r:(t.push({code:"invalid-symbol-viewbox",message:`Symbol viewBox ${e} is not four finite SVG numbers and is ignored.`}),null)}function bv(e,t,r,n,i,a){return t===void 0?0:il(t,{axis:r,percentBasis:r==="x"?n?.width:n?.height},i,a)??0}function xv(e,t,r,n,i,a,o){let s=r==="width"?i?.width:i?.height,l=[n,la(t,r)];for(let u of l){if(u===void 0||u.trim().toLowerCase()==="auto")continue;let d=il(u,{axis:r,percentBasis:s},a,o);if(d!==null){if(d<0){o.push({code:"invalid-symbol-length",message:`Negative symbol ${r} ${u} is invalid and falls back to auto.`});continue}return d}}return s!==void 0?s:(o.push({code:"unresolved-symbol-viewport",message:`Symbol ${r} is auto and needs a containing viewport basis.`}),null)}function wv(e,t,r,n,i){if(e===void 0)return;let a=e.trim();if(t==="refX"){if(a==="left")return 0;if(a==="center")return(r?.width??0)/2;if(a==="right")return r?.width??0}else{if(a==="top")return 0;if(a==="center")return(r?.height??0)/2;if(a==="bottom")return r?.height??0}return il(e,{axis:t,percentBasis:t==="refX"?r?.width:r?.height},n,i)??void 0}function UI(e,t,r,n={}){let i=[],a=uL(e),o=bv(e,a.x,"x",r,n,i),s=bv(e,a.y,"y",r,n,i),l=Yt(o,s),u=la(t,"transform"),d=u?Fi(u):Pt;if((t.defKind??"symbol")!=="symbol")return{kind:"group",renders:!0,useX:o,useY:s,useAttributes:a,contentMatrix:Re(l,d),childPercentBasis:r??null,viewport:null,diagnostics:i};let c=xv(e,t,"width",a.width,r,n,i),f=xv(e,t,"height",a.height,r,n,i),p=la(t,"x"),h=la(t,"y"),m=p!==void 0?il(p,{axis:"x",percentBasis:r?.width},n,i)??0:0,g=h!==void 0?il(h,{axis:"y",percentBasis:r?.height},n,i)??0:0,v=dL(t.viewBox,i),b=Np({width:c,height:f,...v?{viewBoxX:v.x,viewBoxY:v.y,viewBoxWidth:v.width,viewBoxHeight:v.height}:{},preserveAspectRatio:la(t,"preserveAspectRatio")},r);for(let A of b.diagnostics)i.push({code:A.code==="unresolved-viewport-size"?"unresolved-symbol-viewport":"invalid-symbol-viewbox",message:A.message.replace("Nested SVG","Symbol")});if(c===null||f===null||!b.renders||!b.contentMatrix)return{kind:"symbol",renders:!1,useX:o,useY:s,useAttributes:a,contentMatrix:Re(l,d),childPercentBasis:b.childPercentBasis,viewport:b,diagnostics:i};let y=wv(la(t,"refX"),"refX",b.childPercentBasis,n,i),I=wv(la(t,"refY"),"refY",b.childPercentBasis,n,i),x=Lt(b.contentMatrix,{x:y??0,y:I??0}),k=Yt(m-(y===void 0?0:x.x),g-(I===void 0?0:x.y)),$=Re(Re(Re(l,d),k),b.contentMatrix);return{kind:"symbol",renders:!0,useX:o,useY:s,useAttributes:a,contentMatrix:$,childPercentBasis:b.childPercentBasis,viewport:b,diagnostics:i}}function gd(){return{bounds:null,status:"empty",diagnostics:[]}}function al(e,t,r){return r.resolveOwnTransform?.(e,t)??t}function ci(e,t){return{bounds:null,status:e,diagnostics:[t]}}function yd(e,t){return e?t?{minX:Math.min(e.minX,t.minX),minY:Math.min(e.minY,t.minY),maxX:Math.max(e.maxX,t.maxX),maxY:Math.max(e.maxY,t.maxY)}:e:t}function ii(e,t,r="empty"){return e?{bounds:e,status:"resolved",diagnostics:t}:t.some(n=>n.code==="container-cycle"||n.code==="reference-cycle"||n.code==="symbol-cycle")?{bounds:null,status:"cycle",diagnostics:t}:t.some(n=>n.code==="unsupported-shape"||n.code==="deferred-tree-kind")?{bounds:null,status:"unsupported",diagnostics:t}:t.some(n=>n.code==="unresolved-shape"||n.code==="unresolved-reference-target"||n.code==="unresolved-reference-pivot"||n.code==="duplicate-shape-id"||n.code==="unresolved-svg-viewport"||n.code==="unresolved-symbol-definition"||n.code==="duplicate-library-id"||n.code==="unresolved-symbol-viewport"||n.code==="unresolved-symbol-pivot")?{bounds:null,status:"unresolved",diagnostics:t}:{bounds:null,status:r,diagnostics:t}}function Vp(e){if(e.length===0)return null;let t=e[0].x,r=e[0].y,n=e[0].x,i=e[0].y;for(let a=1;a<e.length;a++){let o=e[a];t=Math.min(t,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y)}return{minX:t,minY:r,maxX:n,maxY:i}}function GI(e,t){return Vp([Lt(t,{x:e.minX,y:e.minY}),Lt(t,{x:e.maxX,y:e.minY}),Lt(t,{x:e.maxX,y:e.maxY}),Lt(t,{x:e.minX,y:e.maxY})])}function Iv(e,t,r,n,i){return r<0||n<0?null:GI({minX:e,minY:t,maxX:e+r,maxY:t+n},i)}function kv(e,t,r,n,i){if(r<0||n<0)return null;let a=Lt(i,{x:e,y:t}),o=Math.hypot(i[0]*r,i[2]*n),s=Math.hypot(i[1]*r,i[3]*n);return{minX:a.x-o,minY:a.y-s,maxX:a.x+o,maxY:a.y+s}}function cL(e,t){let r=Array.isArray(e)?e:[e],n=null;for(let i of r)n=yd(n,GI(i,t));return n}function Qf(e,t,r){return ci("unsupported",{code:t,shapeId:e.id,message:`Object bounds for ${r} require a document resolver policy.`,path:[e.id]})}function Sv(e,t,r,n){if(!t)return ci("unsupported",{code:"unsupported-shape",shapeId:e.id,message:`No geometry kernel is registered for shape type ${e.type}.`,path:[e.id]});let i;switch(t.kind){case"circle":i=kv(t.cx,t.cy,t.r,t.r,r);break;case"ellipse":i=kv(t.cx,t.cy,t.rx,t.ry,r);break;case"rectangle":if(t.width<0||t.height<0)i=null;else if(t.pathData)i=Po(t.pathData,r);else if(t.rx>0&&t.ry>0){let a=bw(t.x,t.y,t.width,t.height,t.rx,t.ry);i=a?Po(a,r):null}else i=Iv(t.x,t.y,t.width,t.height,r);break;case"line":if(t.boundsPolicy==="linked-line")return Qf(e,"deferred-tree-kind","linked line");i=Vp([Lt(r,{x:t.x1,y:t.y1}),Lt(r,{x:t.x2,y:t.y2})]);break;case"text":{let a=n.measureText?.(e,t)??null;if(!a)return Qf(e,"deferred-tree-kind","text");i=cL(a,r);break}case"path":{if(t.boundsPolicy==="empty")return gd();let a=t.placement?Re(r,Yt(t.placement.x,t.placement.y)):r;i=Mx(t,a);break}case"polyline":{let a=t.points.length>0?t.points:[{x:0,y:0}];i=Vp(a.map(o=>Lt(r,o)));break}case"positioning-rect":i=Iv(t.x,t.y,t.width,t.height,r);break;case"view":return gd();case"container":case"embedded-svg":case"shape-reference":case"symbol-instance":return Qf(e,"deferred-tree-kind",t.kind)}return i?{bounds:i,status:"resolved",diagnostics:[]}:{bounds:null,status:"empty",diagnostics:[]}}function Up(e){let t=e.state.children;return Array.isArray(t)?t.filter(r=>!!r&&typeof r=="object"&&typeof r.id=="string"):[]}function xa(e){let t=Jn(e.shapes),r=Jd(e.library),n=e.sceneTree??[];if(n.length===0)return{roots:()=>e.shapes,shape:s=>t.uniqueById.get(s),duplicateShapeIds:()=>t.duplicateIds,libraryDefinition:s=>r.definition(s),duplicateLibraryIds:()=>r.duplicateIds,children:Up};let i=new Map,a=new Set;for(let s of n){let l=i.get(s.parentId)??[];i.set(s.parentId,[...l,s]),t.uniqueById.has(s.id)&&a.add(s.id)}let o=s=>{let l=[],u=new Set,d=c=>{for(let f of Gh([...i.get(c)??[]])){let p=t.uniqueById.get(f.id);if(p){l.push(p);continue}u.has(f.id)||(u.add(f.id),d(f.id),u.delete(f.id))}};return d(s),l};return{roots:()=>[...o(null),...e.shapes.filter(s=>!a.has(s.id))],shape:s=>t.uniqueById.get(s),duplicateShapeIds:()=>t.duplicateIds,libraryDefinition:s=>r.definition(s),duplicateLibraryIds:()=>r.duplicateIds,children:s=>[...o(s.id),...Up(s).filter(l=>!a.has(l.id))]}}function WI(e,t){return`${t.identityPrefixes.at(-1)??"document"}\0${e.id}`}var fL=new Set(["block","contents","flex","flow","flow-root","grid","inherit","initial","inline","inline-block","inline-flex","inline-grid","inline-table","list-item","none","revert","revert-layer","ruby","ruby-base","ruby-base-container","ruby-text","ruby-text-container","run-in","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","unset"]),ep=new Set(["block","inline","run-in"]),pL=new Set(["flow","flow-root","table","flex","grid","ruby"]);function hL(e){let t=e.trim().toLowerCase();if(fL.has(t)||/^(?:var|env)\(/.test(t)&&t.endsWith(")"))return!0;let r=t.split(/\s+/);if(r.length<2||r.length>3||new Set(r).size!==r.length)return!1;if(r.includes("list-item")){let n=r.filter(i=>i!=="list-item");return n.filter(i=>ep.has(i)).length<=1&&n.filter(i=>i==="flow"||i==="flow-root").length<=1&&n.every(i=>ep.has(i)||i==="flow"||i==="flow-root")}return r.length===2&&r.some(n=>ep.has(n))&&r.some(n=>pL.has(n))}function mL(e){if(!e)return null;let t=null;for(let r of ha(e,";")){let n=ha(r,":");if(n.length<2||n[0].trim().toLowerCase()!=="display")continue;let i=n.slice(1).join(":").trim(),a=/\s*!important\s*$/i.test(i),o=i.replace(/\s*!important\s*$/i,"").trim().toLowerCase();hL(o)&&(!t||a||!t.important)&&(t={value:o,important:a})}return t}function XI(e,t){let r=mL(typeof t=="string"?t:void 0);return r?r.value!=="none":typeof e!="string"||e.trim().toLowerCase()!=="none"}function Qd(e,t){if(e.state.visible===!1)return!1;let r=e.type==="symbol-instance"||e.type==="shape-reference"?e.state.instancePresentation:void 0,n=r?.display??e.state.display;return XI(n,r?.style)?t.participatesInRendering?.(e)??!0:!1}function HI(e,t,r){let n=e.rootAttributes;return XI(n?.display,n?.style)?r.participatesSymbolDefinition?.(e,t)??!0:!1}function gL(e,t={}){return{x:e.x,y:e.y,width:t.width!==void 0?t.width:e.width,height:t.height!==void 0?t.height:e.height,viewBoxX:e.viewBoxX,viewBoxY:e.viewBoxY,viewBoxWidth:e.viewBoxWidth,viewBoxHeight:e.viewBoxHeight,preserveAspectRatio:e.preserveAspectRatio}}function Xh(e,t,r={}){let n=Bo(e);if(!n||n.kind!=="embedded-svg")return{matrix:Pt,attribute:null,pivotRequired:!1,pivotResolved:!1,viewport:Np({})};let i=Np(gL(n,r),t),a=Sn(e.state),o=i.frame?{x:i.frame.x+i.frame.width/2,y:i.frame.y+i.frame.height/2}:void 0;return{matrix:ni(e.state,o),attribute:ln(e.state,o),pivotRequired:a,pivotResolved:!a||o!==void 0,viewport:i}}function yL(e,t,r){return t.diagnostics.map(n=>({code:n.code==="unresolved-viewport-size"?"unresolved-svg-viewport":"invalid-svg-viewport",shapeId:e.id,message:n.message,path:[...r,e.id]}))}function vd(e,t,r,n){let i=null,a=[],o=r.forceInlineChildren>0?Up(e):r.view.children(e);for(let s of o){if(!Qd(s,r.host))continue;let l=yl(s,t,r,n);i=yd(i,l.bounds),a.push(...l.diagnostics)}return ii(i,a)}function qI(e,t){return{...e,diagnostics:e.diagnostics.map(r=>r.path.includes(t)?r:{...r,path:[t,...r.path]})}}function vL(e,t,r,n,i={}){let a=Xh(e,n,i),o=yL(e,a.viewport,r.path);if(a.pivotRequired&&!a.pivotResolved)return o.push({code:"unresolved-svg-viewport",shapeId:e.id,message:`Embedded SVG ${e.id} has decomposed rotation/scale/skew channels, but its auto viewport frame cannot be resolved without a parent viewport.`,path:[...r.path,e.id]}),ii(null,o,"unresolved");if(!a.viewport.renders)return ii(null,o,a.viewport.status==="zero-disabled"?"empty":"unresolved");let s=WI(e,r);r.active.add(s),r.path.push(e.id);let l=e.state.isRootSvg===!0?t:Re(Re(t,al(e,a.matrix,r.host)),a.viewport.contentMatrix??Pt),u=vd(e,l,r,a.viewport.childPercentBasis??n);return r.path.pop(),r.active.delete(s),ii(u.bounds,[...o,...u.diagnostics],u.status)}function YI(e,t,r){let n=r.view.duplicateShapeIds?.().has(t)??!1;return ci("unresolved",{code:n?"duplicate-shape-id":"unresolved-reference-target",shapeId:e.id,message:n?`Shape reference ${e.id} targets ambiguous duplicate id ${t}.`:t?`Shape reference ${e.id} targets ${t}, which is not present in the document.`:`Shape reference ${e.id} has no targetShapeId.`,path:t?[...r.path,t]:[...r.path]})}function bL(e,t){let r=[...t.path,e.id];return ci("cycle",{code:"reference-cycle",shapeId:e.id,message:`Shape reference cycle detected: ${r.join(" -> ")}.`,path:r})}function KI(e,t,r,n,i){if(!Sn(e.state))return{matrix:ni(e.state),attribute:ln(e.state),pivotRequired:!1,pivotResolved:!0,diagnostics:[],contentBounds:null};let a=Yt(t.offsetX,t.offsetY),o={width:t.width,height:t.height},s=qI(yl(r,a,n,i,o),e.id),l=s.diagnostics.some(d=>d.code==="unsupported-shape"||d.code==="deferred-tree-kind"||d.code==="unresolved-reference-pivot"),u=s.bounds&&!l?{x:(s.bounds.minX+s.bounds.maxX)/2,y:(s.bounds.minY+s.bounds.maxY)/2}:null;if(!u){let d=s.bounds===null&&(s.status==="empty"||s.status==="cycle"||s.status==="unresolved"),c={code:"unresolved-reference-pivot",shapeId:e.id,message:`Shape reference ${e.id} has decomposed rotation/scale/skew channels, but its translated target bounds require unavailable contextual geometry or measurement.`,path:[...n.path]};return{matrix:ni(e.state),attribute:ln(e.state),pivotRequired:!0,pivotResolved:d,diagnostics:d?s.diagnostics:[...s.diagnostics,c],contentBounds:s}}return{matrix:ni(e.state,u),attribute:ln(e.state,u),pivotRequired:!0,pivotResolved:!0,diagnostics:[],contentBounds:s}}function xL(e,t,r,n,i){if(n.activeReferences.has(e.id))return bL(e,n);n.activeReferences.add(e.id),n.path.push(e.id);let a=c=>(n.path.pop(),n.activeReferences.delete(e.id),c),o=t.targetShapeId?.trim()??"",s=o?n.view.shape(o):void 0;if(!s)return a(YI(e,o,n));if(!Qd(s,n.host))return a(gd());let l=KI(e,t,s,n,i);if(l.pivotRequired&&!l.pivotResolved)return a(ii(null,[...l.diagnostics],"unresolved"));if(l.contentBounds?.bounds===null&&l.pivotResolved)return a(l.contentBounds);let u=Re(Re(r,al(e,l.matrix,n.host)),Yt(t.offsetX,t.offsetY)),d=qI(yl(s,u,n,i,{width:t.width,height:t.height}),e.id);return a({...d,diagnostics:[...l.diagnostics,...d.diagnostics]})}function mo(e,t){let r=e.state.instancePresentation?.transform,n=typeof r=="string"&&r.trim()?r.trim():null,i=ni(e.state,t),a=ln(e.state,t);return n?{matrix:Re(Fi(n),i),attribute:a?`${n} ${a}`:n}:{matrix:i,attribute:a}}function fa(e,t,r,n){return{code:r,shapeId:e.id,message:n,path:[...t.path,e.id]}}function ZI(e,t,r,n,i,a){let o=null,s=[];for(let l of r){if(!Qd(l,i.host))continue;let u=yl(l,n,i,a);o=yd(o,u.bounds),s.push(...u.diagnostics)}for(let l of t.definitionContentOrder??[]){if(l.kind!=="definition")continue;let u=i.view.libraryDefinition?.(l.id);if(!u||u.kind!=="symbol"){s.push(fa(e,i,"unresolved-symbol-definition",`Nested definition ${l.id} is missing from ${t.id}.`));continue}if((u.defKind??"symbol")==="symbol"||!HI(u,e,i.host))continue;let d=`definition-forest\0${u.id}`;if(i.activeSymbols.has(d)){s.push(fa(e,i,"symbol-cycle",`Nested definition forest cycle detected through ${u.id}.`));continue}i.activeSymbols.add(d),i.path.push(u.id);let c=u.rootAttributes?.transform,f=c?Re(n,Fi(c)):n,p=ZI(e,u,u.shapes,f,i,a);i.path.pop(),i.activeSymbols.delete(d),o=yd(o,p.bounds),s.push(...p.diagnostics)}return ii(o,s)}function JI(e,t,r,n,i,a=!1){let o=$x(t,e),s=UI(e,t,i,{resolveLength:n.host.resolveSymbolLength}),l=[...o.diagnostics.map(m=>fa(e,n,m.code,m.message)),...s.diagnostics.map(m=>fa(e,n,m.code==="invalid-symbol-length"||m.code==="invalid-symbol-viewbox"?"invalid-symbol-viewport":"unresolved-symbol-viewport",m.message))];if(!s.renders){let m=s.viewport?.status==="zero-disabled";return{...ii(null,l,m?"empty":"unresolved"),transform:{...mo(e),pivotRequired:Sn(e.state),pivotResolved:!0,diagnostics:l}}}if(!HI(t,e,n.host))return{...gd(),transform:{...mo(e),pivotRequired:Sn(e.state),pivotResolved:!0,diagnostics:l}};if(n.activeSymbols.has(o.materializationKey)){let m=fa(e,n,"symbol-cycle",`Symbol instance cycle detected through ${t.id}.`);return{...ci("cycle",m),transform:{...mo(e),pivotRequired:Sn(e.state),pivotResolved:!0,diagnostics:[m]}}}n.activeSymbols.add(o.materializationKey),n.identityPrefixes.push(o.materializationKey),n.forceInlineChildren++,n.path.push(e.id);let u=m=>ZI(e,t,o.shapes,m,n,s.childPercentBasis??i),d=Sn(e.state),c=mo(e),f=!d,p=[];if(d){let m=u(s.contentMatrix),g=m.diagnostics.some(b=>b.code==="unsupported-shape"||b.code==="deferred-tree-kind"||b.code==="unresolved-symbol-viewport"),v=m.bounds&&!g?{x:(m.bounds.minX+m.bounds.maxX)/2,y:(m.bounds.minY+m.bounds.maxY)/2}:void 0;if(v)c=mo(e,v),f=!0;else{let b=m.bounds===null&&(m.status==="empty"||m.status==="cycle"||m.status==="unresolved");f=b,b||(p=[fa(e,n,"unresolved-symbol-pivot",`Symbol instance ${e.id} needs unavailable contextual geometry or measurement for its decomposed transform pivot.`)]),b&&!a&&(p=[...m.diagnostics])}}let h;if(d&&!f)h=ii(null,[...l,...p],"unresolved");else{let m=Re(Re(r,al(e,c.matrix,n.host)),s.contentMatrix),g=u(m);h=ii(g.bounds,[...l,...p,...g.diagnostics],g.status)}return n.path.pop(),n.forceInlineChildren--,n.identityPrefixes.pop(),n.activeSymbols.delete(o.materializationKey),{...h,transform:{...c,pivotRequired:d,pivotResolved:f,diagnostics:[...l,...p]}}}function wL(e,t,r,n){let i=String(e.state.symbolId??"").trim(),a=i?r.view.duplicateLibraryIds?.().has(i)??!1:!1,o=i?r.view.libraryDefinition?.(i):void 0;if(a||!o||o.kind!=="symbol")return ci("unresolved",fa(e,r,a?"duplicate-library-id":"unresolved-symbol-definition",a?`Symbol instance ${e.id} targets duplicate library id ${i}.`:`Symbol instance ${e.id} targets missing symbol definition ${i||"(blank)"}.`));let s=JI(e,o,t,r,n),{transform:l,...u}=s;return u}function yl(e,t,r,n,i={}){let a=WI(e,r);if(r.active.has(a)){if(!r.collectDiagnostics)return{bounds:null,status:"cycle",diagnostics:[]};let u=[...r.path,e.id];return ci("cycle",{code:"container-cycle",shapeId:e.id,message:`Container cycle detected: ${u.join(" -> ")}.`,path:u})}let o=Bo(e);if(!o)return Sv(e,o,t,r.host);if(o.kind==="shape-reference")return xL(e,o,t,r,n);if(o.kind==="embedded-svg")return vL(e,t,r,n,i);if(o.kind==="symbol-instance")return wL(e,t,r,n);if(o.kind!=="container"){let u=ni(e.state,o.defaultPivot??void 0);return Sv(e,o,Re(t,al(e,u,r.host)),r.host)}r.active.add(a),r.path.push(e.id);let s=Wh(e.state).matrix;if(Sn(e.state)){let u=r.collectDiagnostics;r.collectDiagnostics=!1;let d=vd(e,Pt,r,n);r.collectDiagnostics=u;let c=d.diagnostics.some(f=>f.code==="unsupported-shape"||f.code==="deferred-tree-kind");s=VI(e.state,c?null:d.bounds).matrix}let l=vd(e,Re(t,al(e,s,r.host)),r,n);return r.path.pop(),r.active.delete(a),l}function ec(e,t,r={},n={}){let i=typeof t=="string"?e.shape(t):t;if(!i){let a=typeof t=="string"?t:t.id;return ci("unresolved",{code:"unresolved-shape",shapeId:a,message:`Shape ${a} is not present in the document bounds view.`,path:[a]})}return yl(i,r.toTarget??Pt,{view:e,host:n,active:new Set,activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[],collectDiagnostics:!0},r.parentViewport)}function Hh(e,t,r={},n={}){let i=typeof t=="string"?e.shape(t):t;if(!i){let o=typeof t=="string"?t:t.id;return ci("unresolved",{code:"unresolved-shape",shapeId:o,message:`Shape ${o} is not present in the document bounds view.`,path:[o]})}let a={...n,resolveOwnTransform:(o,s)=>o===i?Pt:n.resolveOwnTransform?.(o,s)??s};return ec(e,i,{parentViewport:r.parentViewport},a)}function IL(e,t,r={},n){let i=Bo(t);if(!i||i.kind!=="shape-reference")return{matrix:Pt,attribute:null,pivotRequired:!1,pivotResolved:!1,diagnostics:[]};let a={view:e,host:r,active:new Set,activeReferences:new Set([t.id]),activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[t.id],collectDiagnostics:!0},o=i.targetShapeId?.trim()??"",s=o?e.shape(o):void 0;if(!s||!Qd(s,r)){let u=Sn(t.state);return{matrix:ni(t.state),attribute:ln(t.state),pivotRequired:u,pivotResolved:!0,diagnostics:s?[]:YI(t,o,a).diagnostics}}let l=KI(t,i,s,a,n);return{matrix:l.matrix,attribute:l.attribute,pivotRequired:l.pivotRequired,pivotResolved:l.pivotResolved,diagnostics:l.diagnostics}}function kL(e,t,r={},n){let i=Sn(t.state),a=String(t.state.symbolId??"").trim(),o=a?e.duplicateLibraryIds?.().has(a)??!1:!1,s=a?e.libraryDefinition?.(a):void 0;return o||!s||s.kind!=="symbol"?{...mo(t),pivotRequired:i,pivotResolved:!0,diagnostics:[]}:JI(t,s,Pt,{view:e,host:r,active:new Set,activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[],collectDiagnostics:!0},n,!0).transform}function SL(e,t={}){if(!Sn(e.state))return{transform:Wh(e.state),contentBounds:null,pivotRequired:!1,pivotResolved:!0};let r={view:xa({shapes:[e],viewboxes:[]}),host:t,active:new Set([`document\0${e.id}`]),activeReferences:new Set,activeSymbols:new Set,identityPrefixes:[],forceInlineChildren:0,path:[e.id],collectDiagnostics:!0},n=vd(e,Pt,r),i=n.diagnostics.some(a=>a.code==="unsupported-shape"||a.code==="deferred-tree-kind")?null:n.bounds;return{transform:VI(e.state,i),contentBounds:n,pivotRequired:!0,pivotResolved:i!==null||n.status==="empty"}}function $L(e,t=e.id){return{kind:"pattern",id:t,name:e.name??t,pattern:{type:"pattern",svgContent:e.svgContent,width:e.width,height:e.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function NL(){let e=new Set(CA);for(let t of OA)e.add(t);for(let t of Le.typeIds())for(let r of Object.keys(Le.getDefaults(t)))e.add(r);return e.delete("scaleAnchor"),e.delete("extra"),e}var ML=NL();function QI(e){let t=e.extra&&typeof e.extra=="object"&&!Array.isArray(e.extra)?e.extra:void 0;for(let r of Object.keys(e)){if(r==="extra"||ML.has(r))continue;let n=e[r];delete e[r],n!==void 0&&((t??={})[r]=n)}return t&&Object.keys(t).length>0?e.extra=t:delete e.extra,e}function AL(e){return Li(e,{onState:t=>{QI(t)}}),e}function Gp(e){return typeof e=="string"&&e.length>0?e:null}function CL(e){let t=Gp(e.groupId);if(t)return t;let r=e.extra;return!r||typeof r!="object"||Array.isArray(r)?null:Gp(r.groupId)}function e1(e){delete e.groupId;let t=e.extra;if(!t||typeof t!="object"||Array.isArray(t))return;let r=t;delete r.groupId,Object.keys(r).length===0&&delete e.extra}function OL(e){let t={};return e.transformOrigin&&(t.transformOrigin=e.transformOrigin),e.pluginId&&(t.pluginId=e.pluginId),e.pluginData&&(t.pluginData=e.pluginData),e.attributes&&Object.keys(e.attributes).length>0&&(t.attributes=e.attributes),e.fill&&(t.fill=e.fill),e.fillOpacity&&(t.fillOpacity=e.fillOpacity),e.strokeOpacity&&(t.strokeOpacity=e.strokeOpacity),e.opacity&&(t.opacity=e.opacity),e.filter&&(t.filter=e.filter),e.cssFilter&&(t.cssFilter=e.cssFilter),e.mixBlendMode&&(t.mixBlendMode=e.mixBlendMode),e.isolation&&(t.isolation=e.isolation),e.clipPath&&(t.clipPath=e.clipPath),e.mask&&(t.mask=e.mask),e.rawMetadata&&(t.rawMetadata=e.rawMetadata),e.transform&&(t.transform=e.transform),t}function TL(e){let t=OL(e),r={fillColor:null,borderColor:null,rotation:0,skewX:0,skewY:0,customPivot:null};return Object.keys(t).length>0&&(r.groupData=t),{id:e.id,type:"group",state:r}}function t1(e,t){let r=e.state.children;if(Array.isArray(r))for(let n of r)t.add(n.id),t1(n,t)}function r1(e,t=!1){let r=e.state,n=r.children;return t&&e1(r),Array.isArray(n)&&(r.children=n.map(i=>r1(i,!0))),e}function PL(e){if(e.length<2)return e.map(o=>o.shape);let t=e.filter(o=>o.shape.type==="group"&&o.siblingIndex!==void 0&&Number.isFinite(o.siblingIndex)).sort((o,s)=>(o.siblingIndex??0)-(s.siblingIndex??0));if(t.length===0)return[...e].sort((o,s)=>o.flatOrder-s.flatOrder).map(o=>o.shape);let r=Array(e.length).fill(null),n=new Set(t);for(let o of t){let s=Math.max(0,Math.min(e.length-1,o.siblingIndex??0));for(;s<r.length&&r[s]!==null;)s++;if(s>=r.length)for(s=r.length-1;s>=0&&r[s]!==null;)s--;s>=0&&(r[s]=o)}let i=e.filter(o=>!n.has(o)).sort((o,s)=>o.flatOrder-s.flatOrder),a=0;for(let o of i){for(;a<r.length&&r[a]!==null;)a++;a<r.length&&(r[a]=o)}return r.filter(o=>o!==null).map(o=>o.shape)}function bd(e,t=[]){let r=structuredClone(e),n=structuredClone(t),i=new Map;for(let g of n)i.set(g.id,g);let a=r.map(g=>r1(g)),o=new Set;for(let g of a)t1(g,o);let s=new Map,l=new Map;a.forEach((g,v)=>{o.has(g.id)||l.has(g.id)||(s.set(g.id,v),l.set(g.id,g))});for(let g of n){if(o.has(g.id)||l.has(g.id))continue;let v=TL(g);s.set(v.id,Number.POSITIVE_INFINITY),l.set(v.id,v)}let u=new Map,d=new Map;for(let g of l.values()){let v=g.state,b=i.get(g.id),y=CL(v)??(g.type==="group"?Gp(b?.parentId):null),I=u.get(y)??[];d.set(g.id,y),I.push({shape:g,flatOrder:s.get(g.id)??Number.POSITIVE_INFINITY,siblingIndex:g.type==="group"?b?.siblingIndex:void 0}),u.set(y,I)}let c=new Set,f=g=>{if(c.has(g.id))return null;c.add(g.id);let v=g.state,b=Array.isArray(v.children)?v.children:[],y=p(g.id),I=new Set(b.map(k=>k.id)),x=[...b,...y.filter(k=>!I.has(k.id))];return x.length>0?v.children=x:delete v.children,e1(v),g},p=g=>{let v=[];for(let b of PL(u.get(g)??[])){let y=f(b);y&&v.push(y)}return v},h=p(null),m=g=>{if(!g)return;let v=f(g);v&&h.push(v)};for(let g of l.values()){let v=d.get(g.id);v&&!l.has(v)&&m(g)}for(let g of n)m(l.get(g.id));for(let g of l.values())m(g);return h}var n1="data-svgsketch-passthrough",DL=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]),jL=/^<([A-Za-z][\w:-]*)\b[^>]*>/;function i1(e){return jL.exec(e.trimStart())}function a1(e){let t=i1(e);if(!t)return null;let r=/\bid\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(t[0]);return r?r[1]??r[2]:null}function EL(e){let t=i1(e);if(!t)return null;let r=t[1],n=r.lastIndexOf(":");return n>=0?r.slice(n+1):r}var zL=new RegExp(`\\s+${n1}\\s*=\\s*(?:"[^"]*"|'[^']*')`);function RL(e){let t=e.markup.indexOf(">");if(t<0)return e;let r=e.markup.slice(0,t+1),n=zL.exec(r);if(!n)return e;let i=r.slice(0,n.index)+r.slice(n.index+n[0].length);return{...e,markup:i+e.markup.slice(t+1),passthrough:!0}}function _L(e){let t=[];for(let r of e){if(typeof r!="string")continue;let n=a1(r);if(!n)continue;let i=EL(r),a=i&&DL.has(i)?i:"mask";t.push(RL({id:n,type:a,markup:r}))}return t}var FL=[["splinePoints","pathPoints"],["splineClosed","pathClosed"],["splineCurveType","pathCurveType"],["splineTension","pathTension"],["splineArcParams","pathArcParams"],["splineControlBounds","pathControlBounds"]];function LL(e){let t=!1;if(e.type==="spline"&&(e.type="path",t=!0),e.state&&typeof e.state=="object"){let r=e.state,n=r.extra&&typeof r.extra=="object"&&!Array.isArray(r.extra)?r.extra:null;for(let[i,a]of FL)Object.prototype.hasOwnProperty.call(r,i)&&(Object.prototype.hasOwnProperty.call(r,a)||(r[a]=r[i]),Reflect.deleteProperty(r,i),t=!0),n&&Object.prototype.hasOwnProperty.call(n,i)&&(Object.prototype.hasOwnProperty.call(r,a)||(r[a]=n[i]),delete n[i],t=!0);n&&Object.keys(n).length===0&&delete r.extra}return t}function BL(e){return ar(e,{onShape:t=>{LL(t)}}),e}function VL(e){if(e.type!=="connector")return;let t=e.state,r=Gs(t.sourcePoint),n=Gs(t.targetPoint);e.type="line",e.state={...e.state,x1:typeof t.x1=="number"?t.x1:r?.x??0,y1:typeof t.y1=="number"?t.y1:r?.y??0,x2:typeof t.x2=="number"?t.x2:n?.x??0,y2:typeof t.y2=="number"?t.y2:n?.y??0,routingMode:t.routingMode??"orthogonal"}}function o1(e){let t=e.customPivot;if(t)return t;let r=e.x,n=e.y,i=e.width,a=e.height;if(typeof r=="number"&&typeof n=="number"&&typeof i=="number"&&typeof a=="number")return{x:r+i/2,y:n+a/2};let o=e.radius;if(typeof r=="number"&&typeof n=="number"&&typeof o=="number")return{x:r,y:n};let s=e.cx,l=e.cy;if(typeof s=="number"&&typeof l=="number")return{x:s,y:l};let u=e.x1,d=e.y1,c=e.x2,f=e.y2;if(typeof u=="number"&&typeof d=="number"&&typeof c=="number"&&typeof f=="number")return{x:(u+c)/2,y:(d+f)/2};let p=e.pathPoints;if(p?.[0])return{x:p[0].x,y:p[0].y};let h=e.polylinePoints;if(h?.[0])return{x:h[0].x,y:h[0].y}}function UL(e){return ar(e,{onShape:t=>{let r=t.state;!r||typeof r!="object"||eO(r,o1(r))}}),e.schemaVersion=3,e}function Gs(e){let t=e;return t&&typeof t.x=="number"&&Number.isFinite(t.x)&&typeof t.y=="number"&&Number.isFinite(t.y)?{x:t.x,y:t.y}:null}function GL(e,t){let r=e.translateX??0,n=e.translateY??0,i=typeof e.rawTransform=="string"?e.rawTransform:"",a=Yt(r,n);if(i)return Zr(Re(a,Fi(i)));let o=e.rotation??0,s=e.skewX??0,l=e.skewY??0;if(o!==0||s!==0||l!==0){let c=Gs(e.customPivot)??t??Gs(e.scaleAnchor);c&&(a=Re(a,Yt(c.x,c.y)),o!==0&&(a=Re(a,nd(o))),s!==0&&(a=Re(a,dh(s))),l!==0&&(a=Re(a,ch(l))),a=Re(a,Yt(-c.x,-c.y)))}let u=e.scaleX??1,d=e.scaleY??1;if(u!==1||d!==1){let c=Gs(e.scaleAnchor)??t;c&&(a=Re(a,Yt(c.x,c.y)),a=Re(a,zd(u,d)),a=Re(a,Yt(-c.x,-c.y)))}return Zr(a)}function WL(e){return ar(e,{onShape:t=>{let r=t.state;!r||typeof r!="object"||!("scaleAnchor"in r)||(t.type==="text"&&!To(r.transformMatrix)&&(r.transformMatrix=GL(r,o1(r))),delete r.scaleAnchor)}}),e.schemaVersion=4,e}function XL(e){let t=e,r=Array.isArray(e.library)?[...e.library]:[],n=new Set(r.map(u=>u.id));if(Array.isArray(t.symbols))for(let u of t.symbols)!u||n.has(u.id)||(r.push({...u,kind:"symbol"}),n.add(u.id));if(Array.isArray(t.markers))for(let u of t.markers)!u||n.has(u.id)||(r.push({...u,kind:"marker"}),n.add(u.id));let i=new Map,a=(u,d)=>{let{id:c,sourceId:f,...p}=u,h=JSON.stringify({kind:d,...p}),m=i.get(h);if(m)return m;let g=n.has(u.id)?`grd-${Eu()}`:u.id;n.add(g),i.set(h,g);let v=d==="linear-gradient"?{kind:"linear-gradient",id:g,name:u.sourceId??g,sourceId:u.sourceId,gradient:$v(u)}:{kind:"radial-gradient",id:g,name:u.sourceId??g,sourceId:u.sourceId,gradient:$v(u)};return r.push(v),g},o=new Map;if(Array.isArray(t.customPatterns))for(let u of t.customPatterns){if(!u)continue;let d=n.has(u.id)?`pat-${Eu()}`:u.id;n.add(d),o.set(u.id,d),r.push($L(u,d))}let s=u=>{if(u.customPatternId){let b=o.get(u.customPatternId);if(b)return b}let{id:d,sourceId:c,customPatternId:f,...p}=u,h=JSON.stringify({kind:"pattern",...p}),m=i.get(h);if(m)return m;let g=n.has(u.id)?`pat-${Eu()}`:u.id;n.add(g),i.set(h,g);let v={kind:"pattern",id:g,name:u.sourceId??g,sourceId:u.sourceId,pattern:p};return r.push(v),g};for(let u of e.shapes??[]){let d=u.state;if(!d)continue;let c=d.fillGradient;c&&(typeof d.fillType!="string"&&(d.fillType=c.type),c.type==="linear-gradient"||c.type==="radial-gradient"?d.fillLibraryId=a(c,c.type):c.type==="pattern"&&(d.fillLibraryId=s(c)));let f=d.strokeGradient;f&&(typeof d.strokeType!="string"&&(d.strokeType=f.type),f.type==="linear-gradient"||f.type==="radial-gradient"?d.strokeLibraryId=a(f,f.type):f.type==="pattern"&&(d.strokeLibraryId=s(f)));let p=d.filters;if(Array.isArray(p)&&p.length>0){let h=l(p,d,u.id);d.filterLibraryIds=[h]}}return e.library=r,ar(e,{onShape:VL}),delete t.customPatterns,delete t.symbols,delete t.markers,e;function l(u,d,c){let f={filters:u,colorInterpolation:d.filterColorInterpolation,filterUnits:d.filterUnits,primitiveUnits:d.primitiveUnits,x:d.filterX,y:d.filterY,width:d.filterWidth,height:d.filterHeight},p=JSON.stringify({kind:"filter",...f}),h=i.get(p);if(h)return h;let m=`filter-${c}`,g=n.has(m)?`flt-${Eu()}`:m;n.add(g),i.set(p,g);let v={kind:"filter",id:g,name:g,filters:f.filters,...f.colorInterpolation?{colorInterpolation:f.colorInterpolation}:{},...f.filterUnits?{filterUnits:f.filterUnits}:{},...f.primitiveUnits?{primitiveUnits:f.primitiveUnits}:{},...f.x!==void 0?{x:f.x}:{},...f.y!==void 0?{y:f.y}:{},...f.width!==void 0?{width:f.width}:{},...f.height!==void 0?{height:f.height}:{}};return r.push(v),g}}function $v(e){let{id:t,sourceId:r,...n}=e;return n}var tp=0;function Eu(){return tp=tp+1&65535,`${Date.now().toString(36)}-${tp.toString(36)}`}function HL(e){return ar(e,{onState:t=>{let r=t,n=Object.prototype.hasOwnProperty.call(r,"richTextData"),i=r.richTextData;if(QI(t),!n)return;r.richTextData=i;let a=t.extra;a&&(delete a.richTextData,Object.keys(a).length===0&&delete t.extra)}}),e.schemaVersion=5,e}function qL(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;if(t.richTextRuns!==void 0&&t.richTextRuns!==null)return;let r=t.richTextData;!r||typeof r!="object"||Array.isArray(r)||Array.isArray(r.lines)&&(t.richTextRuns=Nh(r))}function YL(e){return ar(e,{onState:t=>qL(t)}),e.schemaVersion=6,e}function Wp(e,t){if(!t.has(e))return e;let r=2;for(;t.has(`${e}-${r}`);)r++;return`${e}-${r}`}function s1(e){let t=new Set,r=new Set,n=new Map;ar(e,{onShape:a=>{if(r.add(a.id),a.type!=="view")return;n.has(a.id)||n.set(a.id,a);let o=a.state.viewName;typeof o=="string"&&o&&t.add(o)}});let i=[];return(e.viewboxes??[]).filter(a=>{let o=n.get(a.id);return!(o&&o.state.viewBoxX===a.x&&o.state.viewBoxY===a.y&&o.state.viewBoxWidth===Math.max(1,a.width)&&o.state.viewBoxHeight===Math.max(1,a.height))}).forEach((a,o)=>{let s=Wp(`view-${o+1}`,t);t.add(s);let l=Wp(a.id||`legacy-view-${o+1}`,r);r.add(l),i.push({id:l,type:"view",state:{viewBoxX:a.x,viewBoxY:a.y,viewBoxWidth:Math.max(1,a.width),viewBoxHeight:Math.max(1,a.height),viewName:s}})}),i.length>0&&e.shapes.unshift(...i),e.viewboxes=[],e}var KL=["svgX","svgY","svgWidth","svgHeight","svgViewBoxX","svgViewBoxY","svgViewBoxWidth","svgViewBoxHeight","svgPreserveAspectRatio"];function ZL(e){if(e.type!=="svg"||e.state.isRootSvg===!0)return;let t=e.state;if([t.svgViewBoxX,t.svgViewBoxY,t.svgViewBoxWidth,t.svgViewBoxHeight].every(r=>r===0)){if(t.svgX===0&&t.svgY===0&&t.svgWidth===0&&t.svgHeight===0&&t.svgPreserveAspectRatio===""){for(let r of KL)delete t[r];return}delete t.svgViewBoxX,delete t.svgViewBoxY,delete t.svgViewBoxWidth,delete t.svgViewBoxHeight}}function JL(e){return ar(e,{onShape:ZL}),s1(e),e.schemaVersion=7,e}var QL=["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"];function eB(e,t){if(e.type!=="symbol-instance"||e.state.authoredUseGeometry!==void 0)return;let r={};for(let n of["x","y","width","height"]){if((n==="width"||n==="height")&&t.has(String(e.state.symbolId??"")))continue;let i=e.state[n];typeof i=="number"&&Number.isFinite(i)&&(r[n]=String(i))}Object.keys(r).length>0&&(e.state.authoredUseGeometry=r)}function tB(e){let t=new Set((e.library??[]).filter(r=>r.kind==="symbol"&&r.defKind==="group").map(r=>r.id));for(let r of e.library??[]){if(r.kind!=="symbol")continue;let n=r,i={...n.wrapperAttrs??{},...n.rootAttributes??{}};for(let o of QL){let s=i[o];n[o]===void 0&&s!==void 0&&(n[o]=s),delete i[o]}if(n.overflow!==void 0&&i.overflow===void 0&&(i.overflow=n.overflow),Object.keys(i).length>0?n.rootAttributes=i:delete n.rootAttributes,n.shapes=bd(n.shapes,n.groups),n.variants)for(let[o,s]of Object.entries(n.variants))n.variants[o]=bd(s,n.groups);let a=n;delete a.wrapperAttrs,delete a.groups,delete a.overflow}return ar(e,{onShape:r=>eB(r,t)}),e.schemaVersion=8,e}function rB(e){let t=e;Array.isArray(e.shapes)&&(e.shapes=bd(e.shapes,t.groups)),delete t.groups,Array.isArray(t.rawPaintServerDefs)&&!Array.isArray(e.paintServerDefs)&&(e.paintServerDefs=_L(t.rawPaintServerDefs)),delete t.rawPaintServerDefs;for(let r of e.library??[]){if(r.kind!=="marker")continue;let n=r;n.shapes=bd(n.shapes,n.groups),delete n.groups}return Array.isArray(t.clipMaskGroups)&&(e.clipMaskGroups=t.clipMaskGroups.map(r=>{let n=r,i=Array.isArray(n.clipShapeIds)?n.clipShapeIds:typeof n.clipShapeId=="string"&&n.clipShapeId.length>0?[n.clipShapeId]:[],a={...n,clipShapeIds:i};return delete a.clipShapeId,a})),e.schemaVersion=9,e}function nB(e){return ar(e,{onState:t=>{let r=t;r.richTextRuns===void 0&&r.richTextData!==null&&typeof r.richTextData=="object"&&Array.isArray(r.richTextData.lines)&&(r.richTextRuns=Nh(r.richTextData)),delete r.richTextData}}),e.schemaVersion=10,e}function iB(e){let t=(Array.isArray(e)?e.slice(0,6).join(" "):String(e)).trim().toLowerCase();return t==="none"||t==="hidden"||t==="collapse"?"none":"inline"}function Nv(e){let t=new Set(e.keyframes.flatMap(r=>r.id?[r.id]:[]));if(e.keyframes.forEach((r,n)=>{if(r.id)return;let i=`kf${n}`;for(;t.has(i);)i=`${i}x`;r.id=i,t.add(i)}),e.property==="visibility"&&e.sourceSmilAttribute==="display"){e.property="display";for(let r of e.keyframes)r.value=iB(r.value)}delete e.sourceSmilAttribute}function aB(e){if(!Array.isArray(e.shapes))return;let t=new Map,r=new Map,n=new Map,i=(o,s)=>{let l=s?r:t,u=l.get(o.id)??[];u.push(o),l.set(o.id,u),n.set(o.id,(n.get(o.id)??0)+1);let d=o.state.children;Array.isArray(d)&&d.forEach(c=>i(c,!0))};e.shapes.forEach(o=>i(o,!1));let a=new Set;for(let[o,s]of t)s.length!==1||n.get(o)!==2||(r.get(o)??[]).length===1&&a.add(o);e.shapes=e.shapes.filter(o=>!a.has(o.id))}function oB(e){if(!Array.isArray(e.shapes))return;ar(e,{onShape:s=>{if(s.type!=="view")return;let l=s.state;Reflect.deleteProperty(l,"viewLinkedSvgId"),typeof l.extra=="object"&&l.extra!==null&&!Array.isArray(l.extra)&&Reflect.deleteProperty(l.extra,"viewLinkedSvgId")}});let t=e.shapes.filter(s=>{if(s.type!=="view")return!1;let l=s.state;return l.isHomeView===!0||typeof l.extra=="object"&&l.extra!==null&&!Array.isArray(l.extra)&&l.extra.isHomeView===!0});if(t.length===0)return;let r=t[0].state,n=Number(r.viewBoxWidth??0),i=Number(r.viewBoxHeight??0),a=e.shapes.find(s=>s.type==="svg"&&s.state.isRootSvg===!0);if(a&&n>0&&i>0){let s=Number(a.state.svgViewBoxWidth??0),l=Number(a.state.svgViewBoxHeight??0);s>0&&l>0||(a.state.svgViewBoxX=Number(r.viewBoxX??0),a.state.svgViewBoxY=Number(r.viewBoxY??0),a.state.svgViewBoxWidth=n,a.state.svgViewBoxHeight=i,Number(a.state.svgWidth??0)>0||(a.state.svgWidth=n),Number(a.state.svgHeight??0)>0||(a.state.svgHeight=i))}let o=new Set(t.map(s=>s.id));e.shapes=e.shapes.filter(s=>!o.has(s.id)),e.sceneTree=e.sceneTree?.filter(s=>!o.has(s.id))}function sB(e){if(!Array.isArray(e.shapes))return;let t=new Set;ar(e,{onShape:i=>{typeof i.id=="string"&&t.add(i.id)}});let r=new Map,n=i=>i.map(a=>{let o=a.state.children;Array.isArray(o)&&(a.state.children=n(o));let s=a.state.metadata;if(!s||typeof s!="object"||Array.isArray(s))return a;let l=typeof s.linkUrl=="string"?s.linkUrl:"",u=typeof s.linkTarget=="string"?s.linkTarget:"";if(!Object.hasOwn(s,"linkUrl")&&!Object.hasOwn(s,"linkTarget"))return a;let{linkUrl:d,linkTarget:c,...f}=s;if(a.state.metadata=f,!l||a.type==="hyperlink")return a;let p=Wp(`${a.id}-link`,t);return t.add(p),r.set(a.id,p),{id:p,type:"hyperlink",state:{href:l,...u?{linkTarget:u}:{},children:[a]}}});e.shapes=n(e.shapes);for(let i of e.library??[])if(!(i.kind!=="symbol"&&i.kind!=="marker")&&(i.shapes=n(i.shapes),i.kind==="symbol"&&i.variants))for(let[a,o]of Object.entries(i.variants))i.variants[a]=n(o);if(e.sceneTree&&r.size>0){let i=[];for(let a of e.sceneTree){let o=r.get(a.id);if(!o){i.push(a);continue}i.push({...a,id:o}),i.push({id:a.id,parentId:o,index:0})}e.sceneTree=i}}function lB(e){ar(e,{onState:t=>{(t.fillType==="linear-gradient"||t.fillType==="radial-gradient"||t.fillType==="pattern")&&t.fillColor==="none"&&t.fillOpacity===0&&(t.fillOpacity=1)}})}function uB(e){ar(e,{onState:t=>{Array.isArray(t.charOffsets)&&(t.charOffsets=t.charOffsets.map(r=>{if(!r||typeof r!="object"||"dx"in r||typeof r.x!="number")return r;let n=r;return{x:null,y:null,dx:n.x,dy:typeof n.y=="number"&&Number.isFinite(n.y)?n.y:0,rotate:typeof n.rotate=="number"&&Number.isFinite(n.rotate)?n.rotate:0}}))}})}function dB(e){ar(e,{onShape:t=>{if(t.type!=="group")return;let r=t.state,n=r.groupData;if(!n||typeof n!="object"||Array.isArray(n))return;let i=n,a=i.attributes;if(a&&typeof a=="object"&&!Array.isArray(a)){let o={...a};r.locked===void 0&&o["data-locked"]==="true"&&(r.locked=!0),r.visible===void 0&&o["data-hidden"]==="true"&&(r.visible=!1),delete o["data-locked"],delete o["data-hidden"],Object.keys(o).length>0?i.attributes=o:delete i.attributes}Array.isArray(i.classes)&&(i.classes=i.classes.map(o=>{let s=String(o);return s.startsWith("usr-")?s.slice(4):s}))}})}function cB(e){let t=BL(e);s1(t),oB(t),aB(t),sB(t),lB(t),uB(t),dB(t);for(let r of t.animationTimeline?.tracks??[])Nv(r);for(let r of t.library??[])if(!(r.kind!=="marker"&&r.kind!=="symbol"))for(let n of r.animations??[])Nv(n);return t.schemaVersion=11,t}function fB(e){return e.schemaVersion=12,e}function pB(e){return e.schemaVersion=13,e}function hB(e){return e.schemaVersion=14,e}function mB(e){return ar(e,{onState:t=>{let r=t,n=r.authoredTextStructure;if(r.textSpanTree===void 0&&n&&typeof n.text=="string"&&Array.isArray(n.spans)){let i=n.spans.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];let o=a;return typeof o.start=="number"&&typeof o.end=="number"&&typeof o.id=="string"?[{start:o.start,end:o.end,id:o.id,children:[]}]:[]});i.length===n.spans.length&&(r.textSpanTree={text:n.text,spans:i})}delete r.authoredTextStructure}}),e.schemaVersion=15,e}function gB(e){return e.schemaVersion=16,e}function yB(e){for(let t of e.documentStyles??[]){let r=t;r.placement??="root"}return e.schemaVersion=17,e}function vB(e){return e.schemaVersion=18,e}function bB(e){return ar(e,{onState:t=>{let r=t;r.textPathReference===void 0&&typeof r.textPathRefShapeId=="string"&&r.textPathRefShapeId.length>0&&(r.textPathReference={kind:"shape",targetId:r.textPathRefShapeId,element:"href"}),delete r.textPathRefShapeId,delete r.textPathImportRefId}}),e.schemaVersion=19,e}function xB(e){return e.schemaVersion=20,e}function wB(e){return e.schemaVersion=21,e}function IB(e){let t=new Map,r=(n,i,a)=>{let o=n.textSpanTree;if(!o||typeof o!="object"||Array.isArray(o))return;let s=o.spans;if(!Array.isArray(s))return;let l=new Map,u=(d,c=[])=>{d.forEach((f,p)=>{if(!f||typeof f!="object"||Array.isArray(f))return;let h=f,m=[...c,p],g=typeof h.spanId=="string"&&h.spanId.length>0?h.spanId:`text-span:${i}:${m.join(".")}`;h.spanId=g,l.set(m.join("."),g),Array.isArray(h.children)&&u(h.children,m)})};u(s),a&&t.set(a,l)};return ar(e,{onShape:(n,i)=>r(n.state,n.id||i,n.id),onState:(n,i)=>r(n,i)}),e.animationTimeline&&(e.animationTimeline.tracks=e.animationTimeline.tracks.filter(n=>{let i=n.textSpanTarget;if(!i||Array.isArray(i.spanIds))return!0;let a=Array.isArray(i.path)?i.path:[],o=a.every(l=>Number.isInteger(l)&&Number(l)>=0)?a.join("."):"",s=o?t.get(n.shapeId)?.get(o):void 0;return s?(i.spanIds=[s],delete i.path,!0):!1})),e.schemaVersion=22,e}function kB(e){let t=da(e),r=n=>{let i=n.authoredPlacement;if(!i||i.parentDefinitionId!==void 0)return;let a=t.resolve(i);a.kind==="library"&&(i.parentDefinitionId=a.definitionId)};for(let n of e.library??[])r(n);for(let n of e.paintServerDefs??[])r(n);for(let n of e.clipMaskGroups??[])r(n);return e.schemaVersion=23,e}function SB(e){return e.schemaVersion=24,e}function $B(e){return e.schemaVersion=25,e}function NB(e){return ar(e,{onShape(t){if(t.type!=="foreign-object")return;let r=t.state,n=r.rawContent;if(typeof n!="string")return;let i=Ld(`<svg xmlns="${ye}"><foreignObject>${n}</foreignObject></svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"}).value,a=i?.index.children(i.root.sourceNodeId).find(o=>o.localName.toLowerCase()==="foreignobject");r.foreignContent=a?structuredClone(SI(a.children)):n.length===0?[]:[{kind:"text",value:n}],delete r.rawContent}}),e.schemaVersion=26,e}function MB(e){let t=typeof e.shapeId=="string"?e.shapeId:"";if(t.startsWith("__dom__")&&t.length>7)return t.slice(7);let r=typeof e.domTargetSelector=="string"?e.domTargetSelector:"",n=/\[id\s*=\s*(["'])(.*?)\1\]/u.exec(r);return n?.[2]?n[2]:/^#([A-Za-z_][\w:.-]*)$/u.exec(r.trim())?.[1]??null}function Mv(e,t){return e?Ld(`<svg xmlns="${ye}">${e}</svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"}).value?.nodes.some(r=>r.kind==="element"&&r.attributes.some(n=>n.namespaceUri===null&&n.localName==="id"&&n.value===t))??!1:!1}function AB(e,t){for(let r of e.clipMaskGroups??[]){let n=r.definitionId??`${r.type}-${r.id}`;if(n===t)return{definitionId:n};if(Mv(r.rawDefinition,t))return{definitionId:n,nodeId:t}}for(let r of e.paintServerDefs??[]){if(r.id===t)return{definitionId:r.id};if(Mv(r.markup,t))return{definitionId:r.id,nodeId:t}}for(let r of e.library??[]){if(r.id===t||r.sourceId===t)return{definitionId:r.id};if(r.kind==="filter")for(let n of r.filters){if(n.type!=="svg-primitive-chain")continue;let i=n.primitives.find(a=>a.id===t);if(i)return{definitionId:r.id,nodeId:i.id}}}return{definitionId:t}}function CB(e){let t=typeof e.property=="string"?e.property:"";if(t==="domTransformStack")return"targetTransformStack";if(t==="domDisplay")return"targetDisplay";if(t==="domVisibility")return"targetVisibility";if(t!=="domAttribute")return t;let r=typeof e.domAttribute=="string"?e.domAttribute:"",n=r.toLowerCase();return new Map([["class","className"],["fill","fillColor"],["stroke","strokeColor"],["preserveaspectratio","svgPreserveAspectRatio"],["xlink:href","referenceTargetShapeId"],["href","referenceTargetShapeId"],["clippathunits","clipPathUnits"],["spreadmethod","spreadMethod"]]).get(n)??r}function OB(e){let t=e.animationTimeline;for(let r of t?.tracks??[]){let n=r,i=MB(n);if(!i)continue;let a=AB(e,i);n.definitionTarget=a,n.shapeId=Td(a),n.property=CB(n),typeof n.domAttribute=="string"&&(n.targetAttribute=n.domAttribute),typeof n.domAttributeValueType=="string"&&(n.targetAttributeValueType=n.domAttributeValueType),delete n.domTargetSelector,delete n.domTargetIdGenerated,delete n.domAttribute,delete n.domAttributeValueType}return e.schemaVersion=27,e}function TB(e){return e.schemaVersion=28,e}function PB(e){let t=e.clipMaskGroups;if(!Array.isArray(t)||t.length===0)return e.schemaVersion=29,e;let r=new Set;for(let a of e.shapes)Li(a,{onShape:o=>r.add(o.id)});let n=new Set;for(let a of t){let o=typeof a.rawDefinition=="string"&&a.rawDefinition.length>0,s=a.clipShapeIds.some(l=>r.has(l));(o||s)&&n.add(`${a.type}\0${Ro(a)}`)}let i=t.filter(a=>n.has(`${a.type}\0${Ro(a)}`));return i.length!==t.length&&(e.clipMaskGroups=nL(i),BI(e)),e.schemaVersion=29,e}var DB=Object.freeze({1:XL,2:UL,3:WL,4:HL,5:YL,6:JL,7:tB,8:rB,9:nB,10:cB,11:fB,12:pB,13:hB,14:mB,15:gB,16:yB,17:vB,18:bB,19:xB,20:wB,21:IB,22:kB,23:SB,24:$B,25:NB,26:OB,27:TB,28:PB});function jB(e){let t=e.schemaVersion;return typeof t!="number"||!Number.isFinite(t)||t<1?1:Math.floor(t)}function EB(e,t=DB){let r=JSON.parse(JSON.stringify(e)),n=jB(r);if(n>wn)return r;if(n===wn)return r.schemaVersion=wn,r;for(;n<wn;){let i=t[n];if(!i)throw new Error(`[svgsketch/core] No migration registered for schema version ${n} \u2192 ${n+1}. Cannot safely upgrade this document to version ${wn}.`);r=i(r),n+=1}return r.schemaVersion=wn,r}var ge=e=>({mode:"supported",by:e}),Ni=e=>({mode:"diagnostic",signal:"warning",by:e}),Ee=e=>({mode:"outside-contract",reason:e}),Ht=e=>e,Av=Ee("DXF is a static CAD geometry contract and has no representation for this SVG behavior."),Cv=Ee("Mermaid is a static graph-structure contract and has no representation for this SVG behavior."),Ov=Ee("PDF export produces a static page from the current editor SVG projection and does not promise animation playback."),B7={"unknown-shape-diagnostic":Ht({renderToSvg:Ni("renderShape reports UNSUPPORTED_SHAPE_TYPE through renderToSvgWithDiagnostics"),codegen:Ni("buildRenderPlan carries UNSUPPORTED_SHAPE_TYPE into generateCodeWithDiagnostics"),dxf:Ni("DxfExportStats records unsupported types and the DXF export UI reports them"),mermaid:Ni("exportMermaidWithDiagnostics records unsupported nodes and both Mermaid UIs report them"),pdf:Ee("PDF conversion consumes an already-projected editor SVG; unknown model nodes never enter its input."),"editor-dom":Ee("Unknown nodes are preserved for round-trip but require a registered shape implementation for projection.")}),"symbol-variants-overrides":Ht({renderToSvg:ge("buildRenderPlan materializes symbol variants and per-instance overrides before emission"),codegen:ge("every component backend consumes buildRenderPlan symbol materialization"),dxf:Ni("DXF unsupported-shape accounting reports symbol instances without a lowering"),mermaid:Ni("Mermaid node-skip diagnostics report symbol instances without a lowering"),pdf:ge("the editor projects SymbolInstance content into the SVG consumed by svg2pdf"),"editor-dom":ge("SymbolInstance projects resolved library variants and overrides")}),"smil-timeline":Ht({renderToSvg:ge("buildRenderPlan injects renderAnimationElements output into target and document-root markup"),codegen:ge("component backends preserve SMIL elements in planned target and document-root markup"),dxf:Av,mermaid:Cv,pdf:Ov,"editor-dom":ge("AnimationManager and the shared SMIL kernel project live playback")}),"motion-only-partition":Ht({renderToSvg:ge("buildRenderPlan diverts motionOnly templates into defs outside visible paint"),codegen:ge("component backends consume the render plan visible and motion-def partitions"),dxf:Av,mermaid:Cv,pdf:Ov,"editor-dom":Ee("The authoring DOM retains motion templates for editing instead of applying export partitioning.")}),"paint-server-references":Ht({renderToSvg:ge("plan defs and shapes use one library-first paint-server reference resolver"),codegen:ge("buildShapeAttrs and plan defs use the library-first reference resolver"),dxf:Ee("DXF promises geometry and basic entity colors, not SVG paint-server definition graphs."),mermaid:Ee("Mermaid graph syntax has no SVG gradient or pattern paint-server model."),pdf:ge("the cloned SVG carries paint-server definitions and references into svg2pdf"),"editor-dom":ge("GradientManager maintains live defs matching shape paint references")}),"filter-references":Ht({renderToSvg:ge("renderFilterDefs and filterReferenceValue emit matching identifiers"),codegen:ge("planned filter defs and buildShapeAttrs share filter reference resolution"),dxf:Ee("DXF entity geometry has no SVG filter graph or filter-reference representation."),mermaid:Ee("Mermaid graph syntax has no SVG filter graph or filter-reference representation."),pdf:ge("the cloned SVG carries filter definitions and references into svg2pdf"),"editor-dom":ge("FilterManager maintains live filter definitions and shape references")}),"document-definition-context":Ht({renderToSvg:ge("buildRenderPlan consumes the full snapshot definition and style context"),codegen:ge("component codegen accepts snapshot context and clipboard supplies its definitions"),dxf:Ee("DXF consumes resolved shapes and does not serialize SVG document definition sections."),mermaid:Ee("Mermaid consumes graph nodes and does not serialize SVG definition sections."),pdf:ge("PDF receives a cloned SVG document with its referenced definition context"),"editor-dom":ge("the document aggregate and managers project referenced resources into defs")}),"inline-child-containers":Ht({renderToSvg:ge("renderShape recursively renders INLINE_CHILD_CONTAINER_TYPES children"),codegen:ge("component backends preserve recursively rendered plan container markup"),dxf:ge("DXF walks INLINE_CHILD_CONTAINER_TYPES with transforms and cycle guards"),mermaid:Ni("unsupported container nodes are counted by exportMermaidWithDiagnostics"),pdf:ge("the cloned editor SVG preserves nested containers for svg2pdf"),"editor-dom":ge("registered containers project managed children into nested SVG elements")}),"isolated-flowchart-nodes":Ht({renderToSvg:Ee("Isolated-node declarations are a Mermaid graph concern, not an SVG branch."),codegen:Ee("Isolated-node declarations are a Mermaid graph concern, not component SVG output."),dxf:Ee("DXF emits geometry independently and has no connector-enrolment requirement."),mermaid:ge("exportMermaid declares mapped nodes before emitting connector edges"),pdf:Ee("PDF paints SVG geometry independently and has no graph-node declaration requirement."),"editor-dom":Ee("The live SVG projects shapes independently and has no graph-node declaration requirement.")}),"text-path":Ht({renderToSvg:ge("renderText emits textPath markup and its referenced or private path definition; the render plan routes textPathMorph SMIL into that private path or into textPath for the inline path form"),codegen:ge("component backends preserve planned textPath markup, path definitions and their textPathMorph SMIL children"),dxf:Ee("DXF text entities do not reproduce SVG textPath layout along arbitrary paths."),mermaid:Ee("Mermaid labels do not reproduce SVG textPath layout along arbitrary paths."),pdf:Ni("ExportPanel.generatePdfBlob detects textPath content and shows its localized warning"),"editor-dom":ge("Text projects textPath attributes and maintains its referenced path")}),"common-presentation":Ht({renderToSvg:ge("commonAttrs projects the ordered PRESENTATION_SEMANTICS vocabulary"),codegen:ge("buildShapeAttrs projects the ordered PRESENTATION_SEMANTICS vocabulary"),dxf:Ee("DXF is not an SVG presentation-attribute serialization contract."),mermaid:Ee("Mermaid is not an SVG presentation-attribute serialization contract."),pdf:ge("svg2pdf consumes common presentation attributes from the cloned SVG"),"editor-dom":ge("COMMON_PROP_RENDERERS derives its dispatch from PRESENTATION_SEMANTICS")}),"gradient-definition-envelope":Ht({renderToSvg:ge("gradient renderers serialize the shared typed definition envelopes"),codegen:ge("render plan defs contain gradients serialized from shared typed envelopes"),dxf:Ee("DXF has no SVG linearGradient or radialGradient definition envelope."),mermaid:Ee("Mermaid has no SVG linearGradient or radialGradient definition envelope."),pdf:ge("the cloned SVG supplies shared-envelope gradient definitions to svg2pdf"),"editor-dom":ge("GradientManager projects shared gradient envelopes into live defs")}),"filter-definition-envelope":Ht({renderToSvg:ge("renderFilterElement serializes filterDefinitionEnvelope for each wrapper kind"),codegen:ge("render plan defs contain filters serialized from shared typed envelopes"),dxf:Ee("DXF has no SVG filter element or primitive graph envelope representation."),mermaid:Ee("Mermaid has no SVG filter element or primitive graph envelope representation."),pdf:ge("the cloned SVG supplies shared-envelope filter definitions to svg2pdf"),"editor-dom":ge("FilterManager projects filterDefinitionEnvelope before primitive emission")}),"export-precision-rounding":Ht({renderToSvg:ge("finalizeRenderPlan rounds markup coordinates at the effective documentMetadata.coordinatePrecision"),codegen:Ee("Codegen backends consume the un-finalized render plan; component output precision is a code-style concern, not an export boundary."),dxf:Ee("DXF numeric precision is owned by the DXF writer, not the SVG export boundary."),mermaid:Ee("Mermaid emits graph syntax rather than SVG coordinate attribute streams."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core rounding); selection pages pass through SvgExportFinalizer.roundSvgAttributes"),"editor-dom":ge("static string exports round through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks round through SvgExportFinalizer.roundSvgAttributes; the raster clone sink skips rounding by design (spelling-only, pixel-irrelevant)")}),"defs-deduplication":Ht({renderToSvg:ge("finalizeRenderPlan collapses content-identical gradient/pattern/marker defs and rewrites references"),codegen:Ee("Codegen backends consume the un-finalized render plan; def duplication in generated components is a code-size concern outside the export contract."),dxf:Ee("DXF output has no shared-definition graph in which duplicates could exist."),mermaid:Ee("Mermaid output has no shared-definition graph in which duplicates could exist."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core dedup); selection pages pass through SvgExportFinalizer.deduplicateDefsForExport"),"editor-dom":ge("static string exports dedup through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.deduplicateDefsForExport; the raster clone sink skips dedup by design (spelling-only, pixel-irrelevant)")}),"source-id-restoration":Ht({renderToSvg:ge("finalizeRenderPlan restores uncontested library sourceIds and rewrites references"),codegen:Ee("Generated components keep collision-safe runtime ids; source ids are a document round-trip concern."),dxf:Ee("DXF entities carry no SVG id namespace for source ids to be restored into."),mermaid:Ee("Mermaid nodes carry no SVG id namespace for source ids to be restored into."),pdf:Ee("PDF output has no id namespace to restore; the intermediate SVG string restores ids for fidelity but the PDF consumer never observes them."),"editor-dom":ge("static string exports restore source ids through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.restoreSourceIds; the raster clone sink skips restoration by design (ids are spelling, not pixels)")}),"orphan-def-exclusion":Ht({renderToSvg:ge("def emission is demand-driven (collectReferencedLibraryDefs, the referenced-marker gate, the paint-server reachability fixed point) \u2014 unreferenced defs are never emitted, so no pruning pass exists or is needed"),codegen:ge("component backends consume the same demand-driven plan def channels"),dxf:Ee("DXF output has no defs graph from which orphans could need excluding."),mermaid:Ee("Mermaid output has no defs graph from which orphans could need excluding."),pdf:ge("the editor SVG consumed by svg2pdf passes through pruneOrphanedDefs"),"editor-dom":ge("static string exports are demand-driven via the core plan (no orphans emitted); the raster/selection clone sinks sweep accumulated live defs with SvgExportFinalizer.pruneOrphanedDefs")}),"font-embedding":Ht({renderToSvg:ge("finalizeRenderPlan ships @font-face CSS from the injected resolveFontEmbedCss hook (core is platform-free; binary resolution is the caller environment responsibility)"),codegen:Ee("Generated components inherit the host page font pipeline; embedding binaries in component source is out of contract."),dxf:Ee("DXF text styling is font-name based; the format has no font binary embedding."),mermaid:Ee("Mermaid delegates font resolution entirely to the rendering host page."),pdf:ge("svg2pdf consumes the editor SVG after the async export inlined @font-face CSS"),"editor-dom":ge("every sink that leaves the live document embeds: static and animated string exports resolve plan-collected FACES (family + weight + style) through fontManager into the core resolveFontEmbedCss hook, and the embedded-SVG subtree and selection exports run SvgExportFinalizer.embedFontsInOutput over the projected tree. Raster sinks embed too, subset to the characters they render - an SVG handed to an <img> is processed in secure static/animated mode (SVG 2 2.2.4/2.2.6), so it resolves no external references and inherits none of the session live font faces. Only the internal clipboard payload skips embedding, because the session that wrote it is the session that reads it")}),"initial-value-elision":Ht({renderToSvg:ge("finalizeRenderPlan drops redundant spec initials and product defaults under an initial-valued cascade (elideInitialValuesInPlan)"),codegen:Ee("Codegen backends consume the un-finalized plan; explicit values in component source are a readability choice, not an export-boundary concern."),dxf:Ee("DXF entities carry explicit CAD attributes with no SVG initial-value cascade."),mermaid:Ee("Mermaid emits graph syntax; SVG presentation initial values never appear in its output."),pdf:ge("PDF viewbox pages consume the plan-assembled string (core elision); selection pages pass through SvgExportFinalizer.stripDefaultPaintAttributes"),"editor-dom":ge("static string exports elide through core finalizeRenderPlan (plan-assembled); the selection/subtree markup clone sinks run SvgExportFinalizer.stripDefaultPaintAttributes and the output-artifact rules; the raster clone sink keeps default attributes by design (elision is spelling-only)")}),"namespace-declaration-completion":Ht({renderToSvg:ge("finalizeRenderPlan declares used prefixes on the root via a well-known URI table (declareUsedNamespacePrefixes); unresolvable prefixes warn undeclarable-namespace-prefix"),codegen:Ee("Generated components render into a host document whose framework owns namespace handling; JSX/Vue templates have no xmlns declaration surface to complete."),dxf:Ee("DXF is not XML and has no namespace prefixes to declare or complete."),mermaid:Ee("Mermaid graph syntax is not XML; no namespace declarations exist."),pdf:ge("svg2pdf consumes the editor SVG string whose serializer declared every namespace it uses"),"editor-dom":ge("static string exports complete declarations through core declareUsedNamespacePrefixes; the raster/selection clone sinks rely on XMLSerializer plus hoistForeignNamespaceDecls")})};function zB(e,t,r={}){let n=gl(e),i=n.errors.filter(a=>!r.ignoreError?.(a));if(i.length>0){let a=i.map(o=>` ${o.path}: ${o.message}`).join(`
53
+ `);throw new Error(`Invalid .svgs document:
54
+ ${a}`)}return r.includeWarnings===!1?[]:n.warnings.map(a=>({severity:"warning",code:/\.type$/.test(a.path)&&/Unknown shape type/.test(a.message)?"unavailable-shape-descriptor":"native-validation-warning",source:"native-document",entrypoint:t,message:a.message,documentPath:a.path}))}function l1(e,t={}){let{indent:r=2,trailingNewline:n=!0,validate:i=!1}=t;if(i){let s=gl(e);if(!s.valid){let l=s.errors.map(u=>` ${u.path}: ${u.message}`).join(`
55
+ `);throw new Error(`Invalid document:
56
+ ${l}`)}}let a={};for(let s of iP){let l=s==="unknownFields"?sP(e):e[s];l!==void 0&&(a[s]=RB(va[s].serialization,l))}let o=JSON.stringify(a,null,r);return n?o+`
57
+ `:o}function RB(e,t){switch(e.kind){case"verbatim":return t;case"shape-array":return t.map(r=>BB(AL(structuredClone(r))));case"id-sorted-array":return LB(t).map(Ao);case"ordered-array":return t.map(Ao);case"deep-sorted-object":case"unknown-bag":return Ao(t);default:return _B(e)}}function _B(e){throw new Error(`Unhandled serialization kind: ${JSON.stringify(e)}`)}function Na(e,t={}){return FB(e,t).value}function FB(e,t={}){let{validate:r=!0,migrate:n=!0}=t,i;try{i=JSON.parse(e)}catch(s){throw new Error(`Failed to parse .svgs document: ${s.message}`)}if(i===null||typeof i!="object"||Array.isArray(i))throw new Error("Invalid .svgs document: root must be a JSON object");let a=i;a=aP(a),n&&(a=EB(a)),a=oP(a);let o=[];return r&&o.push(...zB(a,"native-document-open")),{value:a,diagnostics:o}}function LB(e){return[...e].sort((t,r)=>t.id.localeCompare(r.id))}function Ao(e){if(e==null)return e;if(Array.isArray(e))return e.map(Ao);if(typeof e!="object")return e;let t={},r=Object.keys(e).sort();for(let n of r)t[n]=Ao(e[n]);return t}function BB(e){let t={id:e.id,type:e.type},r=Object.keys(e).filter(n=>n!=="id"&&n!=="type").sort();for(let n of r)t[n]=Ao(e[n]);return t}var In=/\{\{\s*([\w.\-]+)\s*\}\}/g;function Tv(e,t){return e.replace(In,(r,n)=>{let i=t[n];return i!==void 0?String(i):r})}function Yo(e,t={}){let r={};if(e.templateVariables)for(let i of e.templateVariables)i.defaultValue!==void 0&&i.defaultValue!==""&&(r[i.name]=i.defaultValue);if(Object.assign(r,t),Object.keys(r).length===0)return JSON.parse(JSON.stringify(e));let n=JSON.parse(JSON.stringify(e));if(n.templateVariables)for(let i of n.templateVariables)Object.prototype.hasOwnProperty.call(t,i.name)&&(i.defaultValue=String(t[i.name]));return Xp(n,r),n}function Xp(e,t){for(let r of Object.keys(e)){let n=e[r];if(typeof n=="string"){if(In.lastIndex=0,In.test(n)){In.lastIndex=0;let i=Tv(n,t);if(VB(n)){let a=Number(i);if(!isNaN(a)&&GB(r)){e[r]=a;continue}}e[r]=i}}else if(Array.isArray(n))for(let i=0;i<n.length;i++)typeof n[i]=="string"?(In.lastIndex=0,In.test(n[i])&&(In.lastIndex=0,n[i]=Tv(n[i],t))):n[i]!==null&&typeof n[i]=="object"&&Xp(n[i],t);else n!==null&&typeof n=="object"&&Xp(n,t)}}function VB(e){return/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/.test(e)}var UB=new Set(["x","y","width","height","radius","rx","ry","cx","cy","x1","y1","x2","y2","fontSize","borderWidth","cornerRadius","opacity","fillOpacity","strokeOpacity",...Hb,"letterSpacing","wordSpacing","lineHeight","sides","arms","innerRadiusPercent","armWidthPercent","teeth","toothDepthPercent","holeRadiusPercent","turns","thicknessPercent","direction","headWidthPercent","headLengthPercent","shaftWidthPercent","shiftAngle","dashLength","gapLength","textPathStartOffset","imageOpacity"]);function GB(e){return UB.has(e)}function u1(e){let t=e.templateVariables??[],r=new Set(t.map(a=>a.name)),n=new Set;Hp(e,n);let i=[...n].filter(a=>!r.has(a)).sort();return{defined:[...t],undeclared:i}}function Hp(e,t){for(let r of Object.values(e))if(typeof r=="string"){let n;for(In.lastIndex=0;(n=In.exec(r))!==null;)t.add(n[1])}else if(Array.isArray(r))for(let n of r)if(typeof n=="string"){let i;for(In.lastIndex=0;(i=In.exec(n))!==null;)t.add(i[1])}else n!==null&&typeof n=="object"&&Hp(n,t);else r!==null&&typeof r=="object"&&Hp(r,t)}function qh(e){let t={};for(let r of e){let n=r.indexOf("=");if(n===-1)throw new Error(`Invalid variable format: "${r}". Expected "name=value".`);let i=r.slice(0,n).trim(),a=r.slice(n+1);if(!i)throw new Error(`Invalid variable format: "${r}". Variable name cannot be empty.`);t[i]=a}return t}var Yh=3,Co=12;function WB(e){return e==null||!Number.isFinite(e)?Yh:e<0?0:e>Co?Co:Math.floor(e)}function d1(e,t){if(!Number.isFinite(e))return e;let r=Math.pow(10,t);return Math.round(e*r)/r}var Kh=/[+-]?(?:(?:\d+\.\d*)|(?:\.\d+)|(?:\d+))(?:[eE][+-]?\d+)?/g,XB=new Set(["amplitude","azimuth","baseFrequency","bias","clip","cx","cy","d","diffuseConstant","divisor","dx","dy","elevation","enable-background","exponent","fill-opacity","filterRes","flood-opacity","font-size","font-size-adjust","fr","fx","fy","height","intercept","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","letter-spacing","limitingConeAngle","markerHeight","markerWidth","numOctaves","offset","opacity","order","orient","path","pathLength","patternTransform","points","pointsAtX","pointsAtY","pointsAtZ","r","radius","refX","refY","rotate","rx","ry","scale","seed","slope","specularConstant","specularExponent","startOffset","stdDeviation","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","surfaceScale","tableValues","targetX","targetY","textLength","transform","transform-origin","viewBox","width","word-spacing","x","x1","x2","y","y1","y2","z"]),HB=new Set(["by","from","to","values"]),qB=12;function Pv(e){for(let t of e)if(t!==","&&t!==";"&&!/\s/u.test(t))return!1;return!0}function YB(e){let t=0,r=!1;for(let n of e.matchAll(Kh)){let i=n.index??0;if(!Pv(e.slice(t,i)))return!1;r=!0,t=i+n[0].length}return r&&Pv(e.slice(t))}function KB(e){let t=e.trim();return/^[Mm][\s,]*[-+.\d]/u.test(t)?/^[MmZzLlHhVvCcSsQqTtAa\s,.;\-+0-9eE]+$/u.test(t):!1}function c1(e,t){return/\d/.test(t)?XB.has(e)?!0:HB.has(e)?YB(t)||KB(t):!1:!1}function ZB(e,t,r){return e.toLowerCase()==="transform"&&/(?:^|\s)matrix\s*\(/iu.test(t)?Math.max(r,qB):r}function JB(e){let t=0;for(let r of e.matchAll(Kh)){let n=Number(r[0]);if(!Number.isFinite(n))continue;let i=Co;for(let a=0;a<=Co;a++)if(d1(n,a)===n){i=a;break}if(t=Math.max(t,i),t===Co)break}return t}function QB(e,t){return e.replace(Kh,r=>{let n=parseFloat(r);return Number.isFinite(n)?String(d1(n,t)):r})}var e3=["unsupported-shape-type","unsupported-polygon-type","unresolved-reference","undeclarable-namespace-prefix","unresolved-container-pivot","unresolved-reference-pivot","duplicate-shape-id","reference-cycle","unresolved-svg-viewport","symbol-cycle","unresolved-symbol-definition","duplicate-library-id","invalid-symbol-viewport","unresolved-symbol-viewport","unresolved-symbol-pivot","unknown-symbol-variant","ambiguous-symbol-override-target","unresolved-symbol-override-target","unexpandable-appearance-stack","inert-text-path-morph","inert-variant-transition-content","unresolved-variant-transition-pivot","shared-variant-transition-gradient"],f1=class{collected=[];seen=new Set;report(e){let t=`${e.severity}|${e.code}|${e.shapeId??""}|${e.message}`;this.seen.has(t)||(this.seen.add(t),this.collected.push(e))}get diagnostics(){return[...this.collected]}},qp=[];function p1(e,t){qp.push(e);try{return t()}finally{qp.pop()}}function yr(e){for(let t of qp)t.report(e)}var t3="0 0 10 10";function h1(){return[{id:"line-marker-arrow",refX:10,refY:5,element:{tag:"path",attrs:{d:"M 0 0 L 10 5 L 0 10 Z",fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-open-arrow",refX:10,refY:5,element:{tag:"path",attrs:{d:"M 0 0 L 10 5 L 0 10",fill:"none",stroke:"context-stroke","stroke-width":1.5,"stroke-linejoin":"round","stroke-linecap":"round"}}},{id:"line-marker-circle",refX:5,refY:5,element:{tag:"circle",attrs:{cx:5,cy:5,r:3.2,fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-diamond",refX:5,refY:5,element:{tag:"path",attrs:{d:"M 5 0 L 10 5 L 5 10 L 0 5 Z",fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-square",refX:5,refY:5,element:{tag:"rect",attrs:{x:1.5,y:1.5,width:7,height:7,fill:"context-stroke",stroke:"context-stroke"}}}]}var m1={"line-marker-arrow":"mkr-builtin-arrow","line-marker-open-arrow":"mkr-builtin-open-arrow","line-marker-circle":"mkr-builtin-circle","line-marker-diamond":"mkr-builtin-diamond","line-marker-square":"mkr-builtin-square"};function zu(e,t){let r=t+e.x,n=e.authored?.x,i=e.authored?.y,a=e.authored?.dy;return{x:n?.resolved===r?n.raw:r,...e.y===void 0?{}:{y:i?.resolved===e.y?i.raw:e.y},dy:a?.resolved===e.dy?a.raw:e.dy}}var r3="http://www.w3.org/2000/svg",g1="http://www.w3.org/XML/1998/namespace";function y1(e){return e.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;")}function xo(e){return y1(e).replace(/"/gu,"&quot;")}function v1(e){let t=new Map([["xml",g1],["xmlns","http://www.w3.org/2000/xmlns/"]]),r=[];for(let n of e??[]){if(!n.prefix||n.prefix==="xml"||n.prefix==="xmlns")continue;let i=n.namespaceUri??"";t.get(n.prefix)!==i&&(t.set(n.prefix,i),r.push(`xmlns:${n.prefix}="${xo(i)}"`))}return[...r,...(e??[]).map(n=>`${n.name}="${xo(n.value)}"`)].join(" ")}function n3(e,t){let r=t.defaultNamespace,n=new Map(t.prefixes),i=[];if(e.prefix){let l=e.namespaceUri??"";n.get(e.prefix)!==l&&(n.set(e.prefix,l),i.push(`xmlns:${e.prefix}="${xo(l)}"`))}else r!==e.namespaceUri&&(r=e.namespaceUri,i.push(`xmlns="${xo(e.namespaceUri??"")}"`));for(let l of e.attributes){if(!l.prefix||l.prefix==="xml"||l.prefix==="xmlns")continue;let u=l.namespaceUri??"";n.get(l.prefix)!==u&&(n.set(l.prefix,u),i.push(`xmlns:${l.prefix}="${xo(u)}"`))}let a=[...i,...e.attributes.map(l=>`${l.name}="${xo(l.value)}"`)],o=a.length>0?`<${e.name} ${a.join(" ")}>`:`<${e.name}>`;if(e.children.length===0)return`${o.slice(0,-1)}/>`;let s={defaultNamespace:r,prefixes:n};return`${o}${e.children.map(l=>b1(l,s)).join("")}</${e.name}>`}function b1(e,t){return e.kind==="element"?n3(e,t):e.kind==="text"?y1(e.value):e.kind==="comment"?`<!--${e.value.replace(/--/gu,"- -").replace(/-$/u,"- ")}-->`:e.kind==="cdata"?`<![CDATA[${e.value.replace(/\]\]>/gu,"]]]]><![CDATA[>")}]]>`:`<?${e.value.replace(/\?>/gu,"? >")}?>`}function x1(e,t=r3){let r={defaultNamespace:t,prefixes:new Map([["xml",g1],["xmlns","http://www.w3.org/2000/xmlns/"]])};return(e??[]).map(n=>b1(n,r)).join("")}function Dv(e,t){return(e??[]).map((r,n)=>({extension:r,index:n})).filter(({extension:r})=>r.placement===t).sort((r,n)=>r.extension.order-n.extension.order||r.index-n.index).map(({extension:r})=>x1([r.element])).join("")}function rp(e,t){switch(t){case"uppercase":return e.toLocaleUpperCase();case"lowercase":return e.toLocaleLowerCase();case"capitalize":return e.replace(/\b\p{L}/gu,r=>r.toLocaleUpperCase());default:return e}}var w1=[["fontVariant","font-variant"],["fontVariantLigatures","font-variant-ligatures"],["fontVariantPosition","font-variant-position"],["fontVariantCaps","font-variant-caps"],["fontVariantNumeric","font-variant-numeric"],["fontVariantEastAsian","font-variant-east-asian"]];function i3(e){return w1.map(([t,r])=>{let n=e[t],i=typeof n=="string"?n.trim():"";return i?`${r}: ${i}`:""}).filter(Boolean).join("; ")}function np(e,t){let r=[],n=(s,l)=>{l!==""&&r.push({name:s,value:l})};e.fontFamily!==t.fontFamily&&n("font-family",String(e.fontFamily)),e.fontSize!==t.fontSize&&n("font-size",String(e.fontSize)),e.fontWeight!==t.fontWeight&&n("font-weight",String(e.fontWeight)),e.fontStyle!==t.fontStyle&&n("font-style",String(e.fontStyle)),e.fontStretch!==t.fontStretch&&n("font-stretch",e.fontStretch),e.fontSizeAdjust!==t.fontSizeAdjust&&n("font-size-adjust",e.fontSizeAdjust);let i=w1.flatMap(([s,l])=>{let u=e[s];return u!==t[s]&&u.trim()?[`${l}: ${u.trim()}`]:[]}).join("; ");i&&n("style",i);let a=e.textDecoration,o=t.textDecoration;if(a.underline!==o.underline||a.strikethrough!==o.strikethrough||a.overline!==o.overline){let s=[];a.underline&&s.push("underline"),a.strikethrough&&s.push("line-through"),a.overline&&s.push("overline"),n("text-decoration",s.join(" "))}if(e.baselineShift!==t.baselineShift){let s=e.baselineShift;s==="super"||s==="sub"?n("baseline-shift",s):typeof s=="number"&&n("baseline-shift",`${s}px`)}return e.dominantBaseline!==t.dominantBaseline&&n("dominant-baseline",e.dominantBaseline),e.alignmentBaseline!==t.alignmentBaseline&&n("alignment-baseline",e.alignmentBaseline),e.letterSpacing!==t.letterSpacing&&n("letter-spacing",String(e.letterSpacing)),e.fill!==t.fill&&n("fill",String(e.fill)),e.fillOpacity!==t.fillOpacity&&n("fill-opacity",String(e.fillOpacity)),e.direction!==t.direction&&n("direction",String(e.direction)),e.unicodeBidi!==t.unicodeBidi&&n("unicode-bidi",String(e.unicodeBidi)),r}function a3(e,t){if(e.text!==t?.text&&t!==null)return null;let r=t?$w(t):null,n=[];if(r){let d=0;r.lines.forEach((c,f)=>{f>0&&(d+=1);for(let p of c.segments)n.push({start:d,end:d+p.text.length,style:p.style}),d+=p.text.length})}let i=d=>r?n.find(c=>c.start<=d&&d<c.end)?.style??r.baseStyle:null,a=(d,c,f)=>{let p=[],h=d;for(let m of f)h<m.start&&p.push({start:h,end:m.start}),h=m.end;return h<c&&p.push({start:h,end:c}),p},o=(d,c,f,p)=>{let h=a(d,c,f);for(let g of h)for(let v=g.start;v<g.end;v++)if(!/\s/u.test(e.text[v]??""))return i(v);let m=h.find(g=>g.start<g.end);return m?i(m.start):p},s=(d,c)=>{if(d>=c)return[];let f=new Set([d,c]);for(let h of n)h.start>d&&h.start<c&&f.add(h.start),h.end>d&&h.end<c&&f.add(h.end);let p=[...f].sort((h,m)=>h-m);return p.slice(0,-1).map((h,m)=>({kind:"text",start:h,end:p[m+1],style:i(h)}))},l=(d,c,f,p)=>{let h=d,m=[];for(let g of f){if(!Number.isInteger(g.start)||!Number.isInteger(g.end)||g.start<h||g.end<g.start||g.end>c||!Array.isArray(g.children))return null;m.push(...s(h,g.start));let v=o(g.start,g.end,g.children,p),b=l(g.start,g.end,g.children,v);if(!b)return null;m.push({kind:"span",spanId:g.spanId,start:g.start,end:g.end,...g.id?{id:g.id}:{},...g.lineIndex===void 0?{}:{lineIndex:g.lineIndex},style:v,children:b}),h=g.end}return m.push(...s(h,c)),m},u=l(0,e.text.length,e.spans,r?.baseStyle??null);return u?{text:e.text,baseStyle:r?.baseStyle??null,children:u}:null}function o3(e){return{text:e.text,style:{...e.style}}}function Ru(e){return{segments:[{text:"",style:e}]}}function s3(e){let t=[];for(let r of e.segments){let n=r.text.match(/\S+|\s+/g);if(n)for(let i of n)t.push({text:i,style:r.style})}return t}function l3(e,t){if(t<=0)return e;let r=e.width-t*2;return r>0?{x:e.x+t,width:r}:null}function jv(e,t,r){let n=e.measureText(t,r);if(!Number.isFinite(n)||n<0)throw new TypeError(`TextMeasurementHost returned invalid width ${String(n)}`);return n}function Ev(e,t,r,n){if(e.length===0)return;let i=e[e.length-1],a=i.text.replace(/\s+$/,""),o=i.text.length-a.length;if(o!==0){r.length=n-o;for(let s=0;s<o;s++)t[t.length-o+s]=-1;e[e.length-1]={...i,text:a}}}function u3(e,t){let r=e.whiteSpace==="normal"||e.whiteSpace==="nowrap"||e.whiteSpace==="pre-line",n=e.whiteSpace==="normal"||e.whiteSpace==="nowrap",i=e.whiteSpace!=="pre"&&e.whiteSpace!=="nowrap",a=e.whiteSpace!=="break-spaces",o=e.shapeInsideGeometry??null,s=Math.max(0,e.shapePadding??0),l=[],u=[],d=new Map,c=x=>{if(!o)return e.inlineSize;let k=e.baseStyle.fontSize*e.lineHeight,$=o.bounds.minY+e.baseStyle.fontSize+x*k;if($>o.bounds.maxY)return u.push(o.bounds.minX),0;let A=Math.round($*256),S=d.get(A);if(S===void 0){let M=o.getSpanAtY($);S=M?l3(M,s):null,d.set(A,S)}return S?(u.push(S.x),S.width):(u.push(o.bounds.minX),0)},f=[];for(let x=0;x<e.lines.length;x++){x>0&&f.push(n?{text:" ",style:e.baseStyle,modelLen:1,isHardBreak:!1,isWhitespace:!0}:{text:"",style:e.baseStyle,modelLen:1,isHardBreak:!0,isWhitespace:!1});for(let k of s3(e.lines[x])){let $=/^\s+$/.test(k.text);f.push({text:r&&$?" ":k.text,style:k.style,modelLen:k.text.length,isHardBreak:!1,isWhitespace:$})}}if(r)for(let x=f.length-1;x>0;x--){let k=f[x],$=f[x-1];k.isWhitespace&&!k.isHardBreak&&$.isWhitespace&&!$.isHardBreak&&($.modelLen+=k.modelLen,f.splice(x,1))}let p=[],h=[],m=0,g=0,v=[],b=0,y=c(0),I=!0;for(let x of f){if(x.isHardBreak){v.length===0&&(h.push(m),g++,o&&u.length<=l.length&&c(l.length)),p.push(g),m++,l.push(v.length>0?{segments:v}:Ru(e.baseStyle)),v=[],b=0,y=c(l.length),I=!0;continue}if(r&&x.isWhitespace&&I){for(let A=0;A<x.modelLen;A++)p.push(-1),m++;continue}let k=jv(t,x.text,x.style);if(i&&y>0&&b+k>y&&b>0&&(a&&(Ev(v,p,h,g),g=h.length),l.push(v.length>0?{segments:v}:Ru(e.baseStyle)),v=[],b=0,y=c(l.length),I=!0,x.isWhitespace)){for(let A=0;A<x.modelLen;A++)p.push(-1),m++;continue}if(i&&y>0&&k>y&&e.overflowWrap!=="normal"){for(let S of x.text){let M=jv(t,S,x.style);b+M>y&&b>0&&(l.push(v.length>0?{segments:v}:Ru(e.baseStyle)),v=[],b=0,y=c(l.length)),p.push(g),h.push(m),m++,g++;let T=v[v.length-1];T&&Ia(T.style,x.style)?v[v.length-1]={...T,text:T.text+S}:v.push({text:S,style:{...x.style}}),b+=M}let A=x.modelLen-x.text.length;for(let S=0;S<A;S++)p.push(-1),m++;I=!1;continue}for(let A of x.text)p.push(g),h.push(m),m++,g++;for(let A=x.text.length;A<x.modelLen;A++)p.push(-1),m++;let $=v[v.length-1];$&&Ia($.style,x.style)?v[v.length-1]={...$,text:$.text+x.text}:x.text&&v.push(o3(x)),b+=k,I=!1}return r&&v.length>0&&Ev(v,p,h,g),v.length===0&&f.length===0&&h.push(m),l.push(v.length>0?{segments:v}:Ru(e.baseStyle)),{lines:l,modelToSvgMap:p,svgToModelMap:h,shapeInsideLineXOffsets:u}}var d3=class{constructor(e){this.measurementHost=e}measurementHost;layout(e){return u3(e,this.measurementHost)}};function vl(e){let t=0;for(;t<e.length;){let n=e.slice(t);if(!/^<defs[\s>]/.test(n))break;let i=e.indexOf("</defs>",t);if(i===-1)break;t=i+7}let r=/^<([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/.exec(e.slice(t));return r?{prefixEnd:t,openStart:t,openEnd:t+r[0].length,tagName:r[1],attributes:r[2],selfClosing:r[3]==="/"}:null}var c3=.25,f3=20;function Yp(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function zv(e,t,r){let n=r.x-t.x,i=r.y-t.y,a=n*n+i*i;if(a===0)return Yp(e,t);let o=Math.max(0,Math.min(1,((e.x-t.x)*n+(e.y-t.y)*i)/a));return Math.hypot(e.x-(t.x+o*n),e.y-(t.y+o*i))}function so(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function Ws(e,t,r,n,i,a,o=0){if(o>=f3||zv(t,e,n)<=i&&zv(r,e,n)<=i){a.push(n);return}let s=so(e,t),l=so(t,r),u=so(r,n),d=so(s,l),c=so(l,u),f=so(d,c);Ws(e,s,d,f,i,a,o+1),Ws(f,c,u,n,i,a,o+1)}function Rv(e,t){return e?{x:t.x*2-e.x,y:t.y*2-e.y}:{...t}}function p3(e){return Object.freeze({x:e.x,y:e.y})}function h3(e,t={}){let r=Fd(e);if(r.error||r.commands.length===0)return null;let n=t.transform??Pt,i=Number.isFinite(t.tolerance)&&(t.tolerance??0)>0?t.tolerance:c3,a=I=>Lt(n,I),o=[],s=null,l={x:0,y:0},u={x:0,y:0},d=null,c=null,f="",p=(I,x,k)=>({x:I.params[x]+(I.type===I.type.toLowerCase()?k.x:0),y:I.params[x+1]+(I.type===I.type.toLowerCase()?k.y:0)}),h=I=>{s||(s=[a(l)],o.push(s)),s.push(a(I)),l=I};for(let I of r.commands){let x=I.type.toUpperCase(),k=I.type===I.type.toLowerCase(),$={...l},A=f==="C"||f==="S",S=f==="Q"||f==="T";switch(x){case"M":{l=p(I,0,$),u={...l},s=[a(l)],o.push(s);break}case"L":h(p(I,0,$));break;case"H":h({x:I.params[0]+(k?$.x:0),y:l.y});break;case"V":h({x:l.x,y:I.params[0]+(k?$.y:0)});break;case"C":{let M=p(I,0,$),T=p(I,2,$),E=p(I,4,$);s||(s=[a(l)],o.push(s)),Ws(a(l),a(M),a(T),a(E),i,s),l=E,d=T;break}case"S":{let M=Rv(A?d:null,l),T=p(I,0,$),E=p(I,2,$);s||(s=[a(l)],o.push(s)),Ws(a(l),a(M),a(T),a(E),i,s),l=E,d=T;break}case"Q":case"T":{let M=x==="Q"?p(I,0,$):Rv(S?c:null,l),T=p(I,x==="Q"?2:0,$),E={x:l.x+2/3*(M.x-l.x),y:l.y+2/3*(M.y-l.y)},C={x:T.x+2/3*(M.x-T.x),y:T.y+2/3*(M.y-T.y)};s||(s=[a(l)],o.push(s)),Ws(a(l),a(E),a(C),a(T),i,s),l=T,c=M;break}case"A":{let M=p(I,5,$),T=wx(l.x,l.y,I.params[0],I.params[1],I.params[2],I.params[3]===1,I.params[4]===1,M.x,M.y);if(!T){h(M);break}s||(s=[a(l)],o.push(s));let E=Math.cos(T.phi),C=Math.sin(T.phi),O=Math.max(T.rx,T.ry),z=O<=i?Math.PI/4:Math.max(.01,2*Math.acos(Math.max(-1,1-i/O))),R=Math.max(1,Math.ceil(Math.abs(T.deltaTheta)/z));for(let U=1;U<=R;U++){let V=T.theta1+T.deltaTheta*U/R,Y=Math.cos(V),G=Math.sin(V);s.push(a({x:T.cx+T.rx*E*Y-T.ry*C*G,y:T.cy+T.rx*C*Y+T.ry*E*G}))}l=M;break}case"Z":s&&Yp(s[s.length-1],a(u))>0&&s.push(a(u)),l={...u};break;default:return null}x!=="C"&&x!=="S"&&(d=null),x!=="Q"&&x!=="T"&&(c=null),f=x}let m=[],g=0;for(let I of o)for(let x=1;x<I.length;x++){let k=Yp(I[x-1],I[x]);k!==0&&(m.push({start:I[x-1],end:I[x],offset:g,length:k}),g+=k)}let v=Object.freeze(o.map(I=>Object.freeze(I.map(p3)))),b=v[0]?.[0]??Object.freeze({x:0,y:0}),y=v[v.length-1]?.at(-1)??b;return Object.freeze({length:g,subpaths:v,pointAtLength(I){if(m.length===0||!Number.isFinite(I)||I<=0)return b;if(I>=g)return y;let x=m.find($=>I<=$.offset+$.length);if(!x)return y;let k=(I-x.offset)/x.length;return Object.freeze({x:x.start.x+(x.end.x-x.start.x)*k,y:x.start.y+(x.end.y-x.start.y)*k})}})}var I1=8,m3=12,g3="sans-serif",y3=-4;function v3(e){let t=e;if(t.sourceRef||t.targetRef)return!0;let r=t.routingMode;return typeof r=="string"&&r!=="straight"}function b3(e){let t=(e.minX+e.maxX)/2,r=(e.minY+e.maxY)/2;return[{id:"n",point:{x:t,y:e.minY},direction:"n",kind:"derived"},{id:"s",point:{x:t,y:e.maxY},direction:"s",kind:"derived"},{id:"w",point:{x:e.minX,y:r},direction:"w",kind:"derived"},{id:"e",point:{x:e.maxX,y:r},direction:"e",kind:"derived"},{id:"center",point:{x:t,y:r},direction:"any",kind:"derived"}]}function x3(e,t){let r=e,n={x:r.x1??0,y:r.y1??0},i="any",a={x:r.x2??0,y:r.y2??0},o="any";if(t){let s=r.sourceRef,l=r.targetRef;if(s){let u=t(s);u&&(n=u.point,i=u.direction)}if(l){let u=t(l);u&&(a=u.point,o=u.direction)}}return{a:n,dirA:i,b:a,dirB:o}}function w3(e,t,r,n,i,a=I1){switch(i){case"straight":return{d:`M${e.x},${e.y} L${r.x},${r.y}`,waypoints:[]};case"orthogonal":return _v(e,t,r,n);case"rounded-ortho":{let o=_v(e,t,r,n);return{d:I3(e,o.waypoints,r,a),waypoints:o.waypoints}}case"curved":return{d:k3(e,t,r,n),waypoints:[]}}}function _v(e,t,r,n){let i=t==="e"||t==="w",a=t==="n"||t==="s",o=n==="e"||n==="w",s=n==="n"||n==="s";if(i&&o){let c=(e.x+r.x)/2,f=[{x:c,y:e.y},{x:c,y:r.y}];return{d:`M${e.x},${e.y} L${c},${e.y} L${c},${r.y} L${r.x},${r.y}`,waypoints:f}}if(a&&s){let c=(e.y+r.y)/2,f=[{x:e.x,y:c},{x:r.x,y:c}];return{d:`M${e.x},${e.y} L${e.x},${c} L${r.x},${c} L${r.x},${r.y}`,waypoints:f}}if(i){let c=[{x:r.x,y:e.y}];return{d:`M${e.x},${e.y} L${r.x},${e.y} L${r.x},${r.y}`,waypoints:c}}if(a){let c=[{x:e.x,y:r.y}];return{d:`M${e.x},${e.y} L${e.x},${r.y} L${r.x},${r.y}`,waypoints:c}}let l=Math.abs(r.x-e.x),u=Math.abs(r.y-e.y);if(l>u){let c=(e.x+r.x)/2;return{d:`M${e.x},${e.y} L${c},${e.y} L${c},${r.y} L${r.x},${r.y}`,waypoints:[{x:c,y:e.y},{x:c,y:r.y}]}}let d=(e.y+r.y)/2;return{d:`M${e.x},${e.y} L${e.x},${d} L${r.x},${d} L${r.x},${r.y}`,waypoints:[{x:e.x,y:d},{x:r.x,y:d}]}}function I3(e,t,r,n){let i=[e,...t,r];if(i.length<3)return`M${e.x},${e.y} L${r.x},${r.y}`;let a=`M${i[0].x},${i[0].y}`;for(let o=1;o<i.length-1;o++){let s=i[o-1],l=i[o],u=i[o+1],d=Kp(s,l),c=Kp(l,u),f=Math.min(n,d/2,c/2),p={x:_u(l.x,s.x,f/d),y:_u(l.y,s.y,f/d)},h={x:_u(l.x,u.x,f/c),y:_u(l.y,u.y,f/c)};a+=` L${p.x},${p.y}`,a+=` Q${l.x},${l.y} ${h.x},${h.y}`}return a+=` L${i[i.length-1].x},${i[i.length-1].y}`,a}function _u(e,t,r){return e+(t-e)*r}function Kp(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function k3(e,t,r,n){let i=Kp(e,r),a=Math.max(30,i*.4),o=Fv(t,r.x-e.x,r.y-e.y),s=Fv(n,e.x-r.x,e.y-r.y),l={x:e.x+o.x*a,y:e.y+o.y*a},u={x:r.x+s.x*a,y:r.y+s.y*a};return`M${e.x},${e.y} C${l.x},${l.y} ${u.x},${u.y} ${r.x},${r.y}`}function Fv(e,t,r){switch(e){case"n":return{x:0,y:-1};case"s":return{x:0,y:1};case"e":return{x:1,y:0};case"w":return{x:-1,y:0};default:{let n=Math.hypot(t,r)||1;return{x:t/n,y:r/n}}}}function S3(e,t){let r=e.shape(t.shapeId);if(!r)return null;let n=r.state?.connectionPoints?.find(o=>o.id===t.anchorId);if(n)return{point:n.point,direction:n.direction};let i=ec(e,r);if(!i.bounds)return null;let a=b3(i.bounds).find(o=>o.id===t.anchorId);return a?{point:a.point,direction:a.direction}:null}var $3=.5,N3=0;function M3(e,t,r){let n=h3(e);if(!n||n.length===0)return null;let i=Math.min(1,Math.max(0,t??$3)),a=r??N3,o=n.pointAtLength(i*n.length);if(a===0)return{x:o.x,y:o.y};let s=Math.min(1,n.length/2),l=n.pointAtLength(Math.max(0,i*n.length-s)),u=n.pointAtLength(Math.min(n.length,i*n.length+s)),d=u.x-l.x,c=u.y-l.y,f=Math.hypot(d,c)||1;return{x:o.x+-c/f*a,y:o.y+d/f*a}}function F(e,t){return t==null||t===""?"":` ${e}="${Ne(String(t))}"`}function k1(e,t){if(!e||typeof e!="object")return"";let r=t&&typeof t=="object"&&!Array.isArray(t)?t:null,n="",i=[];for(let[a,o]of Object.entries(e))a!=="transform"&&(typeof o!="string"||o===""||/^[A-Za-z_][\w:.-]*$/.test(a)&&(r?.[a]==="stylesheet-static"||r?.[a]==="stylesheet-dynamic"||(r?.[a]==="style"?i.push(`${a}: ${o}`):n+=F(a,o))));return n+$1(i)}function S1(e){let t=SL(e);return t.pivotRequired&&!t.pivotResolved&&yr({severity:"warning",code:"unresolved-container-pivot",shapeId:e.id,message:`Container ${e.id} has decomposed rotation/scale/skew channels, but its local content bounds include contextual geometry unavailable without its document resolver or measurement host; the transform was emitted without a derived pivot.`}),t.transform.attribute}function Nr(e,t){let r=Bo(e);if(!r||r.kind!==t)throw new Error(`Shape geometry registry mismatch for ${e.type}: expected ${t}`);return r}function _o(e,t){return t==null?"":` ${e}="${Ne(t)}"`}function $1(e){let t=e.map(r=>(r??"").trim().replace(/;$/,"")).filter(Boolean).join("; ");return t?F("style",t):""}function A3(e,t){return typeof t=="number"&&t>0?`${e}: ${t}px`:""}function ip(e){if(e&&typeof e=="object"){let t=e;if("dx"in t){let r=t.raw&&typeof t.raw=="object"?t.raw:void 0;return{x:typeof t.x=="number"?t.x:null,y:typeof t.y=="number"?t.y:null,dx:typeof t.dx=="number"?t.dx:0,dy:typeof t.dy=="number"?t.dy:0,rotate:typeof t.rotate=="number"?t.rotate:0,...r?{raw:r}:{},...t.authored&&typeof t.authored=="object"?{authored:t.authored}:{}}}return{x:null,y:null,dx:typeof t.x=="number"?t.x:0,dy:typeof t.y=="number"?t.y:0,rotate:typeof t.rotate=="number"?t.rotate:0}}return{x:null,y:null,dx:0,dy:0,rotate:0}}function lo(e,t){let r=-1;for(let i=e.length-1;i>=0;i--)if(e[i][t]!==null){r=i;break}if(r<0)return[];let n=new Array(r+1);for(let i=0;i<=r;i++)n[i]=e[i].raw?.[t]??String(e[i][t]??0);return n}function uo(e,t){let r=-1;for(let i=e.length-1;i>=0;i--)if(e[i][t]!==0||e[i].authored?.[t]===!0){r=i;break}if(r<0)return[];let n=new Array(r+1);for(let i=0;i<=r;i++)n[i]=e[i].raw?.[t]??String(e[i][t]);return n}function Lv(e){if(e.length===0)return[];let t=e.length-1,r=e[t].rotate;for(;t>0&&e[t-1].rotate===r;)t--;if(t===0&&r===0)return[];let n=new Array(t+1);for(let i=0;i<=t;i++)n[i]=e[i].rotate;return n}function Mn(e,t){return ln(e,t)}function C3(e,t,r){return tO(e,t,r)}function O3(e){if(typeof e=="string"){let n=e.trim();return n.length>0?n:void 0}if(!e||typeof e!="object")return;let t=e,r=[];return t.underline&&r.push("underline"),t.strikethrough&&r.push("line-through"),t.overline&&r.push("overline"),r.length>0?r.join(" "):void 0}function T3(e,t){let r=e.split(`
58
+ `);return r.length<=1?Ne(e):r.map((n,i)=>i===0?`<tspan xml:space="preserve">${Ne(n)}</tspan>`:`<tspan x="0%" dy="${t}px" xml:space="preserve">${Ne(n)}</tspan>`).join("")}function Jr(e,t,r=[],n){return F("data-shape-id",t)+bl(sI(Ho(e),{shapeId:t,retainCssAnimationDeclarations:n?.retainCssAnimationDeclarations,projectStaticStylesheetValues:n?.projectStaticStylesheetValues}),r)}function bl(e,t=[]){let r="",n=new Map,i=new Map;for(let a of e){if(a.channel==="style"){i.delete(a.name),a.value!==null&&a.value!==""&&i.set(a.name,a.value);continue}a.ifAbsent&&n.has(a.name)||(n.delete(a.name),!(a.value===null||a.value===""&&!a.allowEmpty)&&n.set(a.name,a))}for(let a of n.values())r+=a.allowEmpty?_o(a.name,String(a.value)):F(a.name,a.value);return(t.length>0||i.size>0)&&(r+=$1([...t,...[...i].map(([a,o])=>`${a}: ${o}`)])),r}var P3=new Set(["element-opacity","system-language","required-extensions","visibility","display","metadata","inline-style","container-presentation","authored-attributes"]);function tc(e){let t=e.metadata;return Kd(t)}function D3(e,t){let r=tc(t);if(!r)return e;let n=vl(e);if(!n)return e;let i=e.slice(0,n.openStart),a=e.slice(n.openStart),o=n.openEnd-n.openStart;return n.selfClosing?i+`<${n.tagName}${n.attributes}>`+r+`</${n.tagName}>`+a.slice(o):i+a.slice(0,o)+r+a.slice(o)}function j3(e,t){if(t.length===0)return e;let r=t.join(""),n=vl(e);if(!n)return e;let i=e.slice(0,n.openStart),a=e.slice(n.openStart),o=n.openEnd-n.openStart;if(n.selfClosing)return i+`<${n.tagName}${n.attributes}>`+r+`</${n.tagName}>`+a.slice(o);let s=a.match(/<\/([\w:-]+)>$/);if(!s)return i+a+r;let l=a.lastIndexOf(`</${s[1]}>`);return i+a.slice(0,l)+r+a.slice(l)}function rc(e){let t="",r=e.startEndpoint,n=e.endEndpoint;return r&&r!=="none"&&!e.markerStart&&(t+=F("marker-start",`url(#line-marker-${r})`)),n&&n!=="none"&&!e.markerEnd&&(t+=F("marker-end",`url(#line-marker-${n})`)),t}function E3(e,t){let r=e.state,{cx:n,cy:i,r:a,defaultPivot:o}=Nr(e,"circle"),s=Mn(r,o??void 0);return`<circle${F("cx",n)}${F("cy",i)}${F("r",a)}${Jr(r,e.id,[],t)}${s?F("transform",s):""}/>`}function z3(e,t){let r=e.state,{cx:n,cy:i,rx:a,ry:o,pathLength:s,defaultPivot:l}=Nr(e,"ellipse"),u=Mn(r,l??void 0);return`<ellipse${F("cx",n)}${F("cy",i)}${F("rx",a)}${F("ry",o)}${s!==void 0?F("pathLength",s):""}${Jr(r,e.id,[],t)}${u?F("transform",u):""}/>`}function R3(e,t){let r=e.state,{x:n,y:i,width:a,height:o,authoredRx:s,authoredRy:l,pathData:u,defaultPivot:d}=Nr(e,"rectangle"),c=Mn(r,d??void 0);if(u)return`<path${F("d",u)}${Jr(r,e.id,[],t)}${c?F("transform",c):""}/>`;let f=`${s===void 0?"":F("rx",s)}${l===void 0?"":F("ry",l)}`;return`<rect${F("x",n)}${F("y",i)}${F("width",a)}${F("height",o)}${f}${Jr(r,e.id,[],t)}${c?F("transform",c):""}/>`}function _3(e,t){let r=e.state;if(v3(r))return F3(e,t);let{x1:n,y1:i,x2:a,y2:o,defaultPivot:s}=Nr(e,"line"),l=Mn(r,s??void 0),u={...r,fillType:"none"};return`<line${F("x1",n)}${F("y1",i)}${F("x2",a)}${F("y2",o)}${Jr(u,e.id,[],t)}${rc(r)}${l?F("transform",l):""}/>`.replace(' fill="none"',"")}function F3(e,t){let r=e.state,{a:n,dirA:i,b:a,dirB:o}=x3(r,t?.connectorAnchorPoint),s=r.routingMode??"straight",l=w3(n,i,a,o,s,r.cornerRadius??I1),u=Mn(r,{x:(n.x+a.x)/2,y:(n.y+a.y)/2}),d={...r,fillColor:"none",fillType:"none"},c=`<path${F("d",l.d)}${Jr(d,e.id,[],t)}${rc(r)}${u?F("transform",u):""}/>`,f=typeof r.label=="string"?r.label.trim():"";if(!f)return c;let p=M3(l.d,r.labelPosition,r.labelOffset);if(!p)return c;let h=r.borderColor||"#333333",m=`<text${F("x",p.x)}${F("y",p.y)}${F("dy",y3)}${F("text-anchor","middle")}${F("font-family",g3)}${F("font-size",m3)}${F("fill",h)}>${Ne(f)}</text>`;return`<g>${c}${m}</g>`}function L3(e,t){let r=e.state,{x:n,y:i,defaultPivot:a}=Nr(e,"text"),o=r.text??"",s=rp(o,r.textTransform),l=r.textSpanTree,u=l?.text===o&&l.spans.length>0,d=Array.isArray(r.charOffsets)?r.charOffsets.map(ip):void 0,c=u&&l?gj(l,d):null,f=r.whiteSpace==="pre"||r.whiteSpace==="pre-wrap"||r.whiteSpace==="break-spaces",p=Nw(r),h=r.fontSize??16,m=r.fontFamily??"sans-serif",g=r.fontWeight??"normal",v=r.fontStyle??"normal",b=r.fontStretch??"normal",y=r.fontSizeAdjust??"none",I=r.textAnchor??"start",x=O3(r.textDecoration),k=r.letterSpacing,$=r.wordSpacing,A=r.lineHeight??1.2,S=Mn(r,a??void 0),M=r.isTextPath&&r.textPathPoints,T=r.authoredTextPosition,E=T?.x?.resolved===n?T.x.raw:n,C=T?.y?.resolved===i?T.y.raw:i,O=!u&&!o.includes(`
59
+ `)&&Array.isArray(r.charOffsets)&&r.charOffsets.length>0?r.charOffsets.map(ip):null,z=E,R=C,U="";if(O){if(!M){let Je=lo(O,"x");Je.length>0&&(Je[0]=String(E),z=Je.join(" "));let yt=lo(O,"y");yt.length>0&&(yt[0]=String(C),R=yt.join(" "))}let We=uo(O,"dx");We.length>0&&(U+=F("dx",We.join(" ")));let et=uo(O,"dy");et.length>0&&(U+=F("dy",et.join(" ")));let tt=Lv(O);tt.length>0&&(U+=F("rotate",tt.join(" ")))}c&&c.root.length>0&&(U+=F("rotate",c.root.join(" ")));let V=M?U:F("x",z)+F("y",R)+U,Y=[],G=(We,et,tt=et)=>{let Je=r.presentationChannels?.[We];Je==="stylesheet-static"||Je==="stylesheet-dynamic"||(Je==="style"?Y.push(`${We}: ${tt}`):V+=F(We,et))};G("font-size",h,`${h}px`),G("font-family",m),g!=="normal"&&g!=="400"&&G("font-weight",g),v!=="normal"&&G("font-style",v),b!=="normal"&&G("font-stretch",b),y!=="none"&&G("font-size-adjust",y),I!=="start"&&G("text-anchor",I),x&&G("text-decoration",x),k&&G("letter-spacing",k,`${k}px`),$&&G("word-spacing",$,`${$}px`);let H=r.baselineShift;H&&H!=="baseline"&&G("baseline-shift",H);let X=r.dominantBaseline;X&&X!=="auto"&&G("dominant-baseline",X);let B=r.alignmentBaseline;B&&B!=="auto"&&G("alignment-baseline",B);let ae=r.writingMode;ae&&ae!=="horizontal-tb"&&G("writing-mode",ae);let K=r.textLength;K!==void 0&&K>0&&(V+=F("textLength",K),r.lengthAdjust==="spacingAndGlyphs"&&(V+=F("lengthAdjust","spacingAndGlyphs")));let W=r.textDirection;W&&W!=="ltr"&&G("direction",W);let J=r.unicodeBidi;J&&J!=="normal"&&G("unicode-bidi",J);let Q=r.shapeInsideRef,Z="",Ae="";if(Q){Z=`shape-inside: url(#${t?.shapeInsideTargetElementId?.(Q)??Q})`;let We=r.shapePadding;We!==void 0&&We>0&&(Ae=`shape-padding: ${We}`)}let Ie=i3(r),Xe=r.fontVariationSettings,Mt="";Xe&&Object.keys(Xe).length>0&&(Mt=`font-variation-settings: ${Object.entries(Xe).map(([We,et])=>`'${We}' ${et}`).join(", ")}`);let bi=r.inlineSize!==void 0||Q!==void 0||typeof r.overflowWrap=="string",ur=typeof r.lineHeight=="number"&&r.lineHeight!==1.2,pn=[...Y,Ie,Mt,A3("inline-size",r.inlineSize),Z,Ae,typeof r.overflowWrap=="string"?`overflow-wrap: ${r.overflowWrap}`:"",typeof r.whiteSpace=="string"?`white-space: ${r.whiteSpace}`:"",bi&&ur?`line-height: ${r.lineHeight}`:""];if(V+=Jr(r,e.id,pn,t),S&&(V+=F("transform",S)),r.isTextPath&&r.textPathPoints){let We=r.textPathPoints,et=r.textPathStartOffset??0,tt=r.textPathSide,Je=yj(e.id),yt=r.textPathMethod,Gt=r.textPathSpacing,zt=r.textPathLengthAdjust,Rt=r.textPathLength,It=r.textPathReference,Ke=It?.kind==="shape"?t?.textPathTargetElementId?.(It.targetId)??It.targetId:It?.kind==="definition"?It.targetId:void 0,At=We.length>=2?ph(We,r.textPathCurveType??"cubic",!1):"",ve=r.textPathStartOffsetUnit==="user"?et:`${et}%`,_t=t?.textPathAnimationElementsForShape?.(e)?.join("")??"",ht=Ke?It?.element==="mpath"?"":F("href",`#${Ke}`):r.textPathInlineFormat==="path-attr"?F("path",At):F("href",`#${Je}`),Ct=Ke&&It?.element==="mpath"?`<mpath href="#${Ne(Ke)}"/>`:"",or=`<textPath${ht}${F("startOffset",ve)}${F("method",yt)}${F("spacing",Gt)}${F("side",tt)}${F("lengthAdjust",zt)}${F("textLength",Rt)}>${Ct}${T3(s,h*A)}${_t}</textPath>`;if(Ke||r.textPathInlineFormat==="path-attr")return`<text${V}>${or}</text>`;let wr=t?.textPathGeometryAnimationElementsForShape?.(e)?.join("")??"",Wr=wr?`<path id="${Ne(Je)}"${F("d",At)} fill="none">${wr}</path>`:`<path id="${Ne(Je)}"${F("d",At)} fill="none"/>`;return t?.registerGeneratedDefinition?(t.registerGeneratedDefinition({id:Je,markup:Wr}),`<text${V}>${or}</text>`):`<defs>${Wr}</defs><text${V}>${or}</text>`}if(O)return`<text${V}>${Ne(s)}</text>`;if(r.charOffsets&&Array.isArray(r.charOffsets)&&r.charOffsets.length>0&&!u){let We=r.charOffsets.map(ip),et=s.split(`
60
+ `),tt=r.linePositions??[],Je=h*A,yt="",Gt=0;return et.forEach((zt,Rt)=>{let It=Array.from(zt).length,Ke=We.slice(Gt,Gt+It),At=tt[Rt],ve=At?zu(At,n):null,_t=ve?ve.x:Rt>0?n:NaN,ht=At?.y===void 0?ve?ve.dy:Rt>0?Je:NaN:NaN,Ct=F("id",At?.id),or=lo(Ke,"x");if(ve||Number.isFinite(_t)||or.length>0){let le=or.length>0?or.slice():[];(ve||Number.isFinite(_t))&&(le[0]=le[0]??String(_t)),Ct+=F("x",le.join(" "))}let wr=lo(Ke,"y");if(At?.y!==void 0||wr.length>0){let le=wr.length>0?wr.slice():[];At?.y!==void 0&&(le[0]=le[0]??String(ve?.y??At.y)),Ct+=F("y",le.join(" "))}let Wr=uo(Ke,"dx");Wr.length>0&&(Ct+=F("dx",Wr.join(" ")));let P=uo(Ke,"dy"),D=At?.y===void 0&&ve!==null||Number.isFinite(ht),L=P.length>0||D?P.slice():[];for(D&&(L[0]=P.length===0&&typeof ht=="string"?ht:String(Number(L[0]??0)+(At?.dy??Number(ht))));L.length>0&&Number(L[L.length-1])===0;)L.pop();L.length>0&&(Ct+=F("dy",L.join(" ")));let ne=Lv(Ke);ne.length>0&&(Ct+=F("rotate",ne.join(" "))),yt+=`<tspan${Ct}>${Ne(zt)}</tspan>`,Gt+=It+1}),`<text${V}>${yt}</text>`}if(l&&u){let We=a3(l,p),et=r.linePositions,tt=d,Je=zt=>Array.from(o.slice(0,zt)).length,yt=(zt,Rt,It=[])=>{let Ke="",At=0;for(let ve of zt){if(ve.kind==="text"){let be=f?o.slice(ve.start,ve.end):o.slice(ve.start,ve.end).replaceAll(`
61
+ `,"");if(!be)continue;let Ue=rp(be,ve.style?.textTransform??r.textTransform);if(!ve.style||!Rt||Ia(ve.style,Rt)){Ke+=Ne(Ue);continue}let je="";for(let{name:vt,value:$t}of np(ve.style,Rt))je+=F(vt,$t);Ke+=`<tspan${je} xml:space="preserve">${Ne(Ue)}</tspan>`;continue}let _t=[...It,At++],ht=F("id",ve.id);if(ve.style&&Rt)for(let{name:be,value:Ue}of np(ve.style,Rt))ht+=F(be,Ue);let Ct=ve.children.every(be=>be.kind==="text")&&tt?tt.slice(Je(ve.start),Je(ve.end)):[],or=lo(Ct,"x"),wr=lo(Ct,"y"),Wr=uo(Ct,"dx"),P=uo(Ct,"dy"),D=c?.spans.get(ve.spanId)??[],L=null;if(ve.lineIndex!==void 0){let be=et?.[ve.lineIndex];if(!be)return null;let Ue=zu(be,n);or.length===0&&(f||Math.abs(be.x)>.001||ve.lineIndex>0)&&(ht+=F("x",Ue.x)),wr.length===0&&be.y!==void 0&&(ht+=F("y",Ue.y)),be.y===void 0&&(Math.abs(be.dy)>.001||ve.lineIndex>0)&&(L=Ue.dy)}or.length>0&&(ht+=F("x",or.join(" "))),wr.length>0&&(ht+=F("y",wr.join(" "))),Wr.length>0&&(ht+=F("dx",Wr.join(" ")));let ne=L===null?P:P.length>0?P.slice():[];for(L!==null&&(ne[0]=P.length===0&&typeof L=="string"?L:String(Number(ne[0]??0)+Number(L)));ne.length>0&&Number(ne[ne.length-1])===0;)ne.pop();ne.length>0&&(ht+=F("dy",ne.join(" "))),D.length>0&&(ht+=F("rotate",D.join(" ")));let le=yt(ve.children,ve.style,_t);if(le===null)return null;let De=t?.textSpanAnimationElementsForShape?.(e,ve.spanId)?.join("")??"";Ke+=`<tspan${ht}>${le}${De}</tspan>`}return Ke},Gt=We?yt(We.children,We.baseStyle):null;if(Gt!==null)return`<text${V}>${Gt}</text>`}let Tn=r.linePositions;if(Tn&&Tn.length>0&&!p){let We=s.split(`
62
+ `);if(We.length===Tn.length){let et="";for(let tt=0;tt<We.length;tt++){let Je=Tn[tt],yt=zu(Je,n),Gt=F("id",Je.id);(Math.abs(Je.x)>.001||tt>0)&&(Gt+=F("x",yt.x)),Je.y!==void 0?Gt+=F("y",yt.y):(Math.abs(Je.dy)>.001||tt>0)&&(Gt+=F("dy",yt.dy)),et+=`<tspan${Gt}>${Ne(We[tt])}</tspan>`}return`<text${V}>${et}</text>`}}let qi=p;if(qi){let We=$w(qi),et=t?.textShapeInsideGeometry?.(e)??null,tt=t?.textMeasurementHost&&(typeof r.inlineSize=="number"||et!==null||r.whiteSpace==="normal"||r.whiteSpace==="nowrap"||r.whiteSpace==="pre-line")?new d3(t.textMeasurementHost).layout({lines:We.lines,baseStyle:We.baseStyle,lineHeight:We.lineHeight,inlineSize:typeof r.inlineSize=="number"?r.inlineSize:0,overflowWrap:r.overflowWrap==="break-word"||r.overflowWrap==="anywhere"?r.overflowWrap:"normal",whiteSpace:r.whiteSpace==="normal"||r.whiteSpace==="nowrap"||r.whiteSpace==="pre"||r.whiteSpace==="pre-line"||r.whiteSpace==="break-spaces"?r.whiteSpace:"pre-wrap",shapeInsideGeometry:et,shapePadding:typeof r.shapePadding=="number"?r.shapePadding:0}):null,Je=tt?.lines??We.lines,yt=r.linePositions,Gt=h*We.lineHeight,zt="";return Je.forEach((Rt,It)=>{Rt.segments.forEach((Ke,At)=>{let ve="";if(At===0){let _t=yt?.[It];_t?.id&&(ve+=F("id",_t.id));let ht=tt?.shapeInsideLineXOffsets[It];if(et&&ht!==void 0)ve+=F("x",ht),ve+=F("y",et.bounds.minY+h+It*Gt);else if(_t){let Ct=_t,or=zu(Ct,n);(Math.abs(Ct.x)>.001||It>0)&&(ve+=F("x",or.x)),(Math.abs(Ct.dy)>.001||It>0)&&(ve+=F("dy",or.dy))}else It>0&&(ve+=F("x",n),ve+=F("dy",`${Gt}px`))}for(let{name:_t,value:ht}of np(Ke.style,We.baseStyle))ve+=F(_t,ht);ve+=' xml:space="preserve"',zt+=`<tspan${ve}>${Ne(rp(Ke.text||(tt?"\u200B":""),Ke.style.textTransform))}</tspan>`})}),`<text${V}>${zt}</text>`}return`<text${V}>${Ne(s)}</text>`}function B3(e,t){let r=e.state,n=Nr(e,"path"),i=n.defaultPivot?Mn(r,n.defaultPivot):null;return`<path${F("d",n.d)}${Jr(r,e.id,[],t)}${rc(r)}${i?F("transform",i):""}/>`}function V3(e,t){let r=e.state,{points:n,closed:i,defaultPivot:a}=Nr(e,"polyline"),o=n.map(l=>`${l.x},${l.y}`).join(" "),s=a?Mn(r,a):null;return`<${i?"polygon":"polyline"}${F("points",o)}${Jr(r,e.id,[],t)}${rc(r)}${s?F("transform",s):""}/>`}function U3(e,t){let r=e.state,{x:n,y:i,width:a,height:o,defaultPivot:s}=Nr(e,"positioning-rect"),l=r.href??"",u=r.imageOpacity,d=r.specPreserveAspectRatio||(r.preserveAspectRatio?"xMidYMid meet":"none"),c=Mn(r,s??void 0);return`<image${F("x",n)}${F("y",i)}${F("width",a)}${F("height",o)}${F("href",l)}${F("preserveAspectRatio",d)}${u!==void 0&&u<1?F("opacity",u):""}${Jr(r,e.id,[],t)}${c?F("transform",c):""}/>`}function G3(e,t){let r=e.state,{x:n,y:i,width:a,height:o,defaultPivot:s}=Nr(e,"positioning-rect"),l=Array.isArray(r.foreignContent)?r.foreignContent:[],u=x1(l),d=Mn(r,s??void 0);return`<foreignObject${F("x",n)}${F("y",i)}${F("width",a)}${F("height",o)}${Jr(r,e.id,[],t)}${d?F("transform",d):""}>${u}</foreignObject>`}function nc(e,t,r){let n=(t??[]).map(l=>ui(l,r)),i=r?.definitionChildrenForShape?.(e);if(!i||i.length===0)return n.join("");let a=i.map((l,u)=>({...l,order:u})).sort((l,u)=>l.siblingIndex-u.siblingIndex||l.order-u.order),o=-1,s=0;for(let l of a)l.siblingIndex===o?s++:(o=l.siblingIndex,s=0),n.splice(Math.min(l.siblingIndex+s,n.length),0,l.markup);return n.join("")}function N1(e,t){let r=e.state,n="",i=Ho(r),a=Xo.filter(o=>P3.has(o.id)).flatMap(o=>hl(o,i,{shapeId:e.id,includeAuthoredAttributes:!0,includeContainerPresentation:!0,retainCssAnimationDeclarations:t?.retainCssAnimationDeclarations}));return n+=bl(a),n}var W3=new Set(["system-language","required-extensions","visibility","display","visible","inline-style","container-presentation"]);function X3(e,t){if(!e)return"";let r=Ho(e.state),n=Xo.filter(i=>W3.has(i.id)).flatMap(i=>hl(i,r,{shapeId:e.id,includeContainerPresentation:!0,retainCssAnimationDeclarations:t?.retainCssAnimationDeclarations}));return bl(n)}function M1(e,t){let r=S1(e);return(r?F("transform",r):"")+N1(e,t)}function H3(e,t){let r=e.state,n=r.href,i=r.hrefXlink,a="<a";return n!==void 0&&(a+=F("href",n)),i!==void 0&&(a+=F("xlink:href",i)),a+=F("target",r.linkTarget),a+=F("rel",r.linkRel),r.linkDownload===""?a+=' download=""':a+=F("download",r.linkDownload),a+=F("ping",r.linkPing),a+=F("hreflang",r.linkHreflang),a+=F("type",r.linkType),a+=F("referrerpolicy",r.linkReferrerPolicy),a+=M1(e,t),a+=F("data-shape-id",e.id),a+=">",a+=tc(r),a+=nc(e,r.children,t),a+="</a>",a}function q3(e,t){let r=e.state,n="<switch";return n+=_o("systemLanguage",r.switchSystemLanguage),n+=_o("requiredExtensions",r.switchRequiredExtensions),n+=M1(e,t),n+=F("data-shape-id",e.id),n+=">",n+=tc(r),n+=nc(e,r.children,t),n+="</switch>",n}function Y3(e,t){let r=e.state,n=S1(e),i="<g",a=[],o=r.presentationChannels,s=(d,c)=>{c===void 0||c===""||o?.[d]==="stylesheet-static"||o?.[d]==="stylesheet-dynamic"||(o?.[d]==="style"?a.push(`${d}: ${c}`):i+=F(d,c))};i+=F("data-shape-id",e.id),n&&(i+=F("transform",n)),i+=bl(Xo.filter(d=>["metadata","system-language","required-extensions"].includes(d.id)).flatMap(d=>hl(d,Ho(r),{shapeId:e.id}))),r.opacity!==void 0&&r.opacity<1&&s("opacity",r.opacity),r.visibility&&s("visibility",r.visibility);let l=r.groupData;r.blendMode&&a.push(`mix-blend-mode:${r.blendMode}`);let u=t?.retainCssAnimationDeclarations===!1?tx(r.inlineStyle):r.inlineStyle;for(let[d,c]of Object.entries(u??{}))a.push(`${d}: ${c}`);if(l){let d=l;if(s("clip-path",d.clipPath),s("mask",d.mask),s("filter",d.filter),s("fill",d.fill),s("fill-opacity",d.fillOpacity),s("stroke-opacity",d.strokeOpacity),d.opacity&&r.opacity===void 0&&s("opacity",d.opacity),Array.isArray(d.classes)&&d.classes.length>0&&!/\sclass\s*=/.test(i)&&(i+=F("class",d.classes.join(" "))),d.attributes)for(let[c,f]of Object.entries(d.attributes))/^[A-Za-z_][\w:.-]*$/.test(c)&&(new RegExp(`\\s${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*=`).test(i)||s(c,f));d.cssFilter&&a.push(`filter:${d.cssFilter}`),d.mixBlendMode&&!r.blendMode&&a.push(`mix-blend-mode:${d.mixBlendMode}`),d.isolation&&a.push(`isolation:${d.isolation}`),d.transformOrigin&&a.push(`transform-origin:${d.transformOrigin}`)}return a.length>0&&(i+=F("style",a.join(";"))),i+=">",i+=nc(e,r.children,t),i+="</g>",i}function K3(e){let t=e.state,r=Nr(e,"view"),n=r.viewBoxX,i=r.viewBoxY,a=r.viewBoxWidth,o=r.viewBoxHeight,s=n!==void 0&&i!==void 0&&a!==void 0&&o!==void 0?`${n} ${i} ${a} ${o}`:void 0,l=typeof t.viewName=="string"&&t.viewName.trim()?wa(t.viewName.trim()):void 0,u="<view";return u+=F("id",l),u+=F("viewBox",s),u+=F("preserveAspectRatio",r.preserveAspectRatio),u+=F("zoomAndPan",t.viewZoomAndPan),u+=F("viewTarget",t.viewTarget),u+="/>",u}function Z3(e,t){let r=e.state,n=Nr(e,"embedded-svg"),i=Xh(e);i.pivotRequired&&!i.pivotResolved&&yr({severity:"warning",code:"unresolved-svg-viewport",shapeId:e.id,message:`Embedded SVG ${e.id} has decomposed rotation/scale/skew channels, but its auto viewport frame cannot be resolved without a parent viewport.`});let a=n.x,o=n.y,s=n.width,l=n.height,u=n.viewBoxX,d=n.viewBoxY,c=n.viewBoxWidth,f=n.viewBoxHeight,p=u!==void 0&&d!==void 0&&c!==void 0&&f!==void 0?`${u} ${d} ${c} ${f}`:void 0,h="<svg";return h+=F("xmlns","http://www.w3.org/2000/svg"),h+=F("x",a),h+=F("y",o),h+=F("width",s),h+=F("height",l),h+=F("viewBox",p),n.preserveAspectRatio!==void 0&&(h+=_o("preserveAspectRatio",n.preserveAspectRatio)),i.attribute&&(h+=F("transform",i.attribute)),h+=N1(e,t),h+=F("data-shape-id",e.id),h+=">",h+=tc(r),h+=nc(e,r.children,t),h+="</svg>",h}function J3(e,t){let r=e.state,n=Nr(e,"shape-reference"),i=n.targetShapeId;if(!i?.trim())return yr({severity:"warning",code:"unresolved-reference",shapeId:e.id,message:`Shape reference ${e.id} has no targetShapeId and was not rendered.`}),`<!-- shape-reference ${Ne(e.id)} has no targetShapeId -->`;let a=n.offsetX,o=n.offsetY,s=t?.shapeReferenceTargetElementId?.(i);if(s===null)return yr({severity:"error",code:"duplicate-shape-id",shapeId:e.id,message:`Shape reference ${e.id} targets ambiguous duplicate id ${i}.`}),`<!-- shape-reference ${Ne(e.id)} has ambiguous target ${Ne(i)} -->`;let l=s??i,u=t?.shapeReferenceBounds?.(e),d=u?.diagnostics.find(b=>b.code==="reference-cycle");if(d&&yr({severity:"warning",code:"reference-cycle",shapeId:e.id,message:d.message}),u?.status==="cycle"&&u.bounds===null)return`<!-- cyclic shape-reference ${Ne(e.id)} was not rendered -->`;let c=t?.shapeReferenceTransform?.(e),f=c?.pivotRequired??Sn(e.state),p=c?.pivotResolved??!f;f&&!p&&yr({severity:"warning",code:"unresolved-reference-pivot",shapeId:e.id,message:`Shape reference ${e.id} has decomposed rotation/scale/skew channels, but its translated target bounds require unavailable contextual geometry or measurement.`});let h=c?.attribute??ln(e.state),m="<use",g=t?.elementIdForShape?.(e);g&&(m+=F("id",g)),m+=F("href",`#${l}`),m+=F("x",a),m+=F("y",o),n.width!==void 0&&(m+=F("width",n.width)),n.height!==void 0&&(m+=F("height",n.height)),m+=F("data-shape-id",e.id);let v=r.instancePresentation;return m+=k1(v,r.presentationChannels),h&&(m+=F("transform",h)),v?.opacity===void 0&&r.opacity!==void 0&&r.opacity<1&&(m+=F("opacity",r.opacity)),m+="/>",m}function Q3(e,t){let r=e.state,n=Nr(e,"symbol-instance"),i=t?.symbolInstanceTargetElementId?.(e),a=i===void 0?n.targetId:i;if(a===null)return`<!-- Invalid symbol instance: ${Ne(e.id)} -->`;let o=t?.symbolDefKind?.(n.symbolId),s=`<use href="#${Ne(a)}"`,l=r.authoredUseGeometry;l&&typeof l=="object"&&(l.x!==void 0&&(s+=F("x",l.x)),l.y!==void 0&&(s+=F("y",l.y)),(o===void 0||o==="symbol")&&(l.width!==void 0&&(s+=F("width",l.width)),l.height!==void 0&&(s+=F("height",l.height)))),s+=F("data-shape-id",e.id);let u=r.instancePresentation;s+=k1(u,r.presentationChannels);let d=t?.symbolInstanceTransform?.(e),c=ln(r),f=u?.transform?.trim(),p=f?c?`${f} ${c}`:f:c,h=d?.attribute??p;return h&&(s+=F("transform",h)),`${s}/>`}function e5(e,t){let r=e.state,n=Nr(e,"positioning-rect"),i=r.mediaKind??e.type,a=r.href??"",o=r.mediaMimeType,s=r.posterHref,l=r.mediaOpacity,u=`<${i} xmlns="http://www.w3.org/1999/xhtml"`;u+=F("src",a),o&&(u+=F("type",o)),s&&i==="video"&&(u+=F("poster",s)),r.muted&&(u+=' muted=""'),r.loop&&(u+=' loop=""'),r.playbackRate!==void 0&&(u+=F("data-playback-rate",r.playbackRate)),r.volume!==void 0&&(u+=F("data-volume",r.volume)),u+=' preload="auto" playsinline=""',u+=i==="video"?' style="width:100%;height:100%;display:block;"></video>':"></audio>";let d="<foreignObject";return d+=F("x",n.x),d+=F("y",n.y),d+=F("width",n.width),d+=F("height",n.height),d+=F("data-shape-id",e.id),d+=F("data-media-kind",i),r.naturalDuration!==void 0&&(d+=F("data-natural-duration",r.naturalDuration)),r.begin!==void 0&&(d+=F("data-begin",r.begin)),r.trimStart!==void 0&&(d+=F("data-trim-start",r.trimStart)),r.trimEnd!==void 0&&(d+=F("data-trim-end",r.trimEnd)),r.fadeInDuration!==void 0&&(d+=F("data-fade-in",r.fadeInDuration)),r.fadeOutDuration!==void 0&&(d+=F("data-fade-out",r.fadeOutDuration)),d+=_o("systemLanguage",r.systemLanguage),d+=_o("requiredExtensions",r.requiredExtensions),l!==void 0&&l<1&&(d+=F("opacity",l)),d+=">",d+=u,d+="</foreignObject>",d}function t5(e,t){let r=e.state,n=Nr(e,"path"),i=n.defaultPivot?Mn(r,n.defaultPivot):null;return`<path${F("d",n.d)}${Jr(r,e.id,[],t)}${i?F("transform",i):""}/>`}function r5(e,t){let r=e.state;if(gh(e.type)?.renderer!=="polygon")return yr({severity:"warning",code:"unsupported-polygon-type",message:`Unsupported polygon shape type "${e.type}" on shape "${e.id}"; the shape was dropped from the rendered output`,shapeId:e.id}),`<!-- unsupported polygon shape: ${Ne(e.type)} -->`;let n=Nr(e,"path"),i=n.placement??{x:0,y:0},a=C3(r,i.x,i.y),o=n.fillRule?F("fill-rule",n.fillRule):"";return`<path${F("d",n.d)}${o}${Jr(r,e.id,[],t)}${F("transform",a)}/>`}var n5={circle:E3,ellipse:z3,rectangle:R3,line:_3,text:L3,path:B3,polyline:V3,image:U3,polygon:r5,flowchart:t5,hyperlink:H3,switch:q3,container:Y3,view:K3,svg:Z3,"shape-reference":J3,"symbol-instance":Q3,media:e5,"foreign-object":G3};function ui(e,t){let r=gh(e.type);if(!r)return yr({severity:"warning",code:"unsupported-shape-type",message:`Unsupported shape type "${e.type}" on shape "${e.id}"; the shape was dropped from the rendered output`,shapeId:e.id}),`<!-- unsupported shape type: ${Ne(e.type)} -->`;let n=n5[r.renderer](e,t);n=s5(n,e),n=D3(n,e.state),t?.forcedElementIds?.has(e.id)&&(n=A1(n,e.id));let i=t?.elementIdForShape?.(e);i&&(n=o5(n,i));let a=t?.rootAttributeOverridesForShape?.(e);a&&(n=C1(n,a));let o=t?.animationElementsForShape?.(e);o&&o.length>0&&(n=j3(n,o));let s=e.state?.leadingComments;return Array.isArray(s)&&s.length>0&&(n=s.map(l=>`<!--${l.replace(/--/g,"- -").replace(/-$/,"- ")}-->`).join("")+n),n}function A1(e,t){let r=vl(e);if(!r)return e;let n=e.slice(r.openStart,r.openEnd);if(/\sid=/.test(n))return e;let i=r.openStart+1+r.tagName.length;return`${e.slice(0,i)}${F("id",t)}${e.slice(i)}`}function C1(e,t){let r=vl(e);if(!r)return e;let n=r.attributes,i=s=>new RegExp(`\\s${i5(s)}=("[^"]*"|'[^']*')`).exec(n),a=(s,l,u)=>{n=u?n.slice(0,u.index)+F(s,l)+n.slice(u.index+u[0].length):n+F(s,l)};for(let[s,l]of t.replace??[])/^[A-Za-z_][\w:.-]*$/.test(s)&&a(s,l,i(s));if(t.appendStyle){let s=i("style"),l=s?a5(s[1].slice(1,-1)):"";a("style",l?`${l}; ${t.appendStyle}`:t.appendStyle,s)}if(n===r.attributes)return e;let o=`<${r.tagName}${n}${r.selfClosing?"/":""}>`;return e.slice(0,r.openStart)+o+e.slice(r.openEnd)}function i5(e){return e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")}function a5(e){return e.replace(/&apos;/g,"'").replace(/&quot;/g,'"').replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}function o5(e,t){let r=vl(e);if(!r)return e;let n=e.slice(r.openStart,r.openEnd),i=/\sid=("[^"]*"|'[^']*')/.exec(n);if(!i)return A1(e,t);let a=r.openStart+i.index;return`${e.slice(0,a)}${F("id",t)}${e.slice(a+i[0].length)}`}function s5(e,t){let r=t.state?.authoredAttributes;if(!r)return e;let n=/^<([A-Za-z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/.exec(e);if(!n)return e;let[i,a,o,s]=n,l="";for(let[u,d]of Object.entries(r))d===null||!/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(u)||new RegExp(`\\s${u}\\s*=`).test(o)||(l+=` ${u}="${Ne(d)}"`);return l?`<${a}${o}${l}${s}>`+e.slice(i.length):e}function O1(e,t){let r=e.attributes.map(([o,s])=>F(o,s)).join(""),n=String(e.attributes.find(([o])=>o==="id")?.[1]??""),i=e.stops.map((o,s)=>{let l=o.attributes.map(([d,c])=>F(d,c)).join(""),u=t?.gradientStopAnimationElements?.(n,s)??[];return u.length>0?`<stop${l}>${u.join("")}</stop>`:`<stop${l}/>`}).join(""),a=t?.definitionAnimationElements?.(n)??[];return`<${e.element}${r}>${a.join("")}${i}</${e.element}>`}function l5(e,t){let r=Jz(e,t);return`<pattern${r.attributes.map(([n,i])=>F(n,i)).join("")}>${r.content}</pattern>`}function u5(e,t=[]){let r=Array.isArray(e)?Xx(e,t):e;if(r.ids.size===0&&r.legacyEndpoints.size===0)return"";let n="",i=h1();for(let a of i){let o=a.id,s=o.replace("line-marker-",""),l=`mkr-builtin-${s}`,u=r.legacyEndpoints.has(s)||r.ids.has(o),d=r.ids.has(l);if(!u&&!d)continue;let c=a.element,f=Object.entries(c.attrs).map(([m,g])=>F(m,g)).join(""),p=`<${c.tag}${f}/>`,h=m=>{n+=`<marker${F("id",m)}${F("viewBox",t3)}${F("refX",a.refX)}${F("refY",a.refY)}${F("markerWidth",6)}${F("markerHeight",6)}${F("orient","auto-start-reverse")}>${p}</marker>`};u&&h(o),d&&h(l)}return n}var T1=/^node\[(\d+)\]\.(x|y)$/;function d5(e){let t=T1.exec(e);return t?{index:Number.parseInt(t[1],10),coord:t[2]}:null}function P1(e){return T1.test(e.property)}function c5(e,t){return e.some(r=>r.shapeId===t&&r.enabled&&r.property==="pathMorph"&&r.keyframes.length>0)}function Zp(e){let t=e.keyframes;if(e.calcMode!=="paced"||t.length<2)return t.map(l=>l.time);let r=[],n=0;for(let l=1;l<t.length;l++){let u=t[l-1].value,d=t[l].value;if(typeof u!="number"||typeof d!="number")return t.map(f=>f.time);let c=Math.abs(d-u);r.push(c),n+=c}let i=t[0].time,a=t[t.length-1].time-i;if(a<=0)return t.map(l=>l.time);if(n<=0)return t.map((l,u)=>i+a*u/(t.length-1));let o=[i],s=0;for(let l of r)s+=l,o.push(i+a*s/n);return o}function f5(e,t){let r=e.keyframes;if(r.length===0)return null;let n=r[0].value;if(r.length===1)return typeof n=="number"?n:null;let i=Zp(e),a=-1,o=-1;for(let p=0;p<r.length;p++)i[p]<=t&&(a=p),i[p]>=t&&o===-1&&(o=p);let s=p=>typeof p.value=="number"?p.value:null;if(a===-1)return s(r[0]);if(o===-1)return s(r[r.length-1]);let l=r[a],u=r[o];if(a===o||i[a]===i[o]||e.calcMode==="discrete")return s(l);let d=s(l),c=s(u);if(d===null||c===null)return d??c;let f=(t-i[a])/(i[o]-i[a]);return d+(c-d)*iC(u,f)}var Bv=8;function p5(e){return e.easing!=="linear"}function h5(e){let t=new Set;for(let a of e)for(let o of Zp(a))t.add(o);let r=[...t].sort((a,o)=>a-o);if(r.length<2)return r;let n=(a,o)=>e.some(s=>{let l=Zp(s);for(let u=1;u<s.keyframes.length;u++)if(l[u-1]<o&&l[u]>a&&p5(s.keyframes[u]))return!0;return!1}),i=[r[0]];for(let a=1;a<r.length;a++){let o=r[a-1],s=r[a];if(s>o&&n(o,s))for(let l=1;l<Bv;l++)i.push(o+(s-o)*l/Bv);i.push(s)}return i}function m5(e,t,r){let n=d5(t);return!n||n.index<0||n.index>=e.length||!Number.isFinite(r)?!1:(e[n.index][n.coord]=r,!0)}function g5(e,t,r){let n=e.points.map(i=>({...i}));for(let i of t){let a=f5(i,r);a!==null&&m5(n,i.property,a)}return ph(n,e.curveType,e.closed,e.tension,e.arcParams,"expand")}function y5(e,t,r){let n=e.filter(d=>d.shapeId===t&&d.enabled&&P1(d)&&d.keyframes.length>0);if(n.length===0||r.points.length===0||c5(e,t))return null;let i=h5(n);if(i.length<2)return null;let a=i.map((d,c)=>({id:`${t}-node-lowered-${c}`,time:d,value:g5(r,n,d),easing:"linear"})),o=n[0],s=d=>n.every(c=>c[d]===o[d])?o[d]:void 0,l=i[i.length-1]-i[0],u=n.reduce((d,c)=>Math.max(d,c.cycleDuration??0),l);return{track:{id:`${t}-node-lowered`,shapeId:t,property:"pathMorph",keyframes:a,enabled:!0,locked:!1,cycleDuration:u,calcMode:"linear",beginTrigger:s("beginTrigger"),cycleRepeats:s("cycleRepeats"),cycleInfinite:s("cycleInfinite"),cycleBehavior:s("cycleBehavior"),fill:s("fill"),pasteOffset:o.pasteOffset,ancestorMatrix:o.ancestorMatrix},consumedTrackIds:n.map(d=>d.id)}}function v5(e){let t=e?.state;if(!t)return null;let r=t.pathPoints;return!Array.isArray(r)||r.length===0?null:{points:r,curveType:t.pathCurveType??"CUBIC",closed:t.pathClosed??!1,tension:t.pathTension??.5,arcParams:t.pathArcParams}}function b5(e){return e.easing==="custom-bezier"&&e.customBezier?e.customBezier:Od[e.easing]??null}function Jp(e){let t=e.split(/\s+/).map(parseFloat);if(t.length!==4||t.some(o=>!Number.isFinite(o)))return e;let[r,n,i,a]=t;return`${1-i} ${1-a} ${1-r} ${1-n}`}function Sr(e){return!Number.isFinite(e)||Math.abs(e)<1e-9?"0":Math.abs(e-1)<1e-9?"1":parseFloat(e.toFixed(6)).toString()}function Vv([e,t,r,n]){let i=a=>Number.isFinite(a)?parseFloat(a.toFixed(6)).toString():"0";return`${i(e)} ${i(t)} ${i(r)} ${i(n)}`}function D1(e){return e.length>0&&e.every(t=>t==="0 0 1 1")}function j1(e){if(e.length<2)return!1;let t=e.length-1,r=1e-4;for(let n=0;n<e.length;n++){let i=n/t,a=parseFloat(e[n]);if(!Number.isFinite(a)||Math.abs(a-i)>r)return!1}return!0}function x5(e){if(e.length<2)return!1;let t=e.length-1,r=1e-4;for(let n=0;n<e.length;n++)if(Math.abs(e[n]-n/t)>r)return!1;return!0}function Bi(e){let t=e.cycleDuration??(e.keyframes.length>0?e.keyframes[e.keyframes.length-1].time:0);return e.cycleBehavior==="alternate"||e.cycleBehavior==="alternate-reverse"?t*2:t}function xd(e){return e.simpleDuration==="indefinite"}function Ko(e){return xd(e)||Bi(e)>0}function E1(e){if(e){let t=e.smilRelations;if(t?.length)return t.map(r=>{let n=r.kind==="syncbase"?`${r.sourceAnimationId}.${r.event}`:`${r.sourceAnimationId}.repeat(${r.iteration})`;if(Math.abs(r.offset)<1e-9)return n;let i=r.offset<0?"-":"+";return`${n}${i}${Sr(Math.abs(r.offset))}s`}).join(";");switch(e.type){case"time":{let r=parseFloat(e.value);return Number.isNaN(r)?"":Number.isFinite(r)?r!==0?`${r}s`:"":"indefinite"}case"event":return e.value;case"expression":return"";default:break}}return""}function w5(e){return E1(e.endTrigger)}function wd(e){let t=E1(e.beginTrigger);if(t)return t;let r=e.keyframes[0]?.time??0;return r!==0?`${r}s`:""}function z1(e){return e.keyframes.length===1&&e.cycleDuration===void 0}function R1(e){return e.calcMode!=="discrete"?!1:e.sourceSmilElement==="set"?!0:!e.sourceSmilElement&&!e.cycleInfinite&&e.keyframes.every(t=>t.easing!=="steps")}function I5(e,t){if(t<=0)return wd(e);if(wd(e)==="indefinite")return"indefinite";let r=e.keyframes[t]?.time??0;return r!==0?`${r}s`:""}function k5(e){if(e.cycleInfinite)return"indefinite";let t=e.cycleRepeats??1,r=e.cycleBehavior==="alternate"||e.cycleBehavior==="alternate-reverse"?t/2:t;return r===1?null:String(r)}function Ma(e){return e.cycleInfinite||e.fill==="remove"?null:"freeze"}function ic(e){return e.additive==="sum"?"sum":null}function Zo(e){return e.accumulate==="sum"?"sum":null}function S5(e){return e.values.map(t=>{let r=typeof t=="number"?t:parseFloat(String(t));return Number.isFinite(r)?Math.max(0,Math.min(1,r)):0})}function $5(e){let t=r=>Math.max(0,Math.min(1,r));return[e[0],t(e[1]),e[2],t(e[3])]}function N5(e){let[t,r,n,i]=e,a=new Set,o=8;for(let c=1;c<=o;c++)a.add(c/o);let s=r-2*i+1,l=2*(i-2*r),u=r,d=c=>{if(!Number.isFinite(c)||c<=0||c>=1)return;let f=3*(1-c)**2*c*t+3*(1-c)*c**2*n+c**3;f>0&&f<1&&a.add(Number(f.toFixed(6)))};if(Math.abs(s)<1e-9)Math.abs(l)>=1e-9&&d(-u/l);else{let c=l*l-4*s*u;if(c>=0){let f=Math.sqrt(c);d((-l+f)/(2*s)),d((-l-f)/(2*s))}}return[...a].sort((c,f)=>c-f)}function M5(e,t,r,n,i,a){let o=typeof e.value=="number"&&typeof t.value=="number",s=zi(t.value);if(t.easing==="linear-function"&&t.linearPoints&&t.linearPoints.length>=2){if(o){let m=t.linearPoints;for(let g=1;g<m.length;g++){let v=m[g],b=e.time+(t.time-e.time)*v.position,y=e.value+(t.value-e.value)*v.value;n.push(y),i.push(Sr(r(b))),a.push("0 0 1 1")}return}n.push(s),i.push(Sr(r(t.time))),a.push("0 0 1 1");return}if(t.easing==="steps"){n.push(s),i.push(Sr(r(t.time))),a.push("0 0 1 1");return}let l=b5(t);if(!l){n.push(s),i.push(Sr(r(t.time))),a.push("0 0 1 1");return}let[,u,,d]=l;if(!(u<0||u>1||d<0||d>1)){n.push(s),i.push(Sr(r(t.time))),a.push(Vv(l));return}if(!o){n.push(s),i.push(Sr(r(t.time))),a.push(Vv($5(l)));return}let c=N5(l),f=e.value,p=t.value,h=t.time-e.time;for(let m of c){let g=yp(l[0],l[1],l[2],l[3],m),v=e.time+h*m,b=f+(p-f)*g;n.push(b),i.push(Sr(r(v))),a.push("0 0 1 1")}}function zi(e){return Array.isArray(e)?e.join(" "):e}function A5(e,t,r){let n=[],{count:i,position:a}=r,o=t.time-e.time,s=zi(e.value),l=zi(t.value),u=typeof s=="number"&&typeof l=="number",d=typeof s=="string"&&typeof l=="string",c=h=>d?h<.5?s:l:u?s+(l-s)*h:h>=1?l:s,f=h=>{let m=Math.floor(h*i);(a==="jump-start"||a==="jump-both")&&(m+=1);let g;switch(a){case"jump-start":case"jump-end":g=i;break;case"jump-none":g=i-1;break;case"jump-both":g=i+1;break}return m>g&&(m=g),m<0&&(m=0),m/g},p=f(0);for(let h=1;h<=i;h++){let m=h/i,g=f(m);if(g===p)continue;let v=e.time+m*o;n.push({value:c(g),time:v}),p=g}return n.length===0||n[n.length-1].time<t.time?n.push({value:l,time:t.time}):n[n.length-1]={value:l,time:t.time},n}function C5(e,t){let r=[],n=[],i=(a,o)=>{r.push(a),n.push(Sr(t(o)))};i(zi(e[0].value),e[0].time);for(let a=1;a<e.length;a++){let o=e[a-1],s=e[a];if(s.easing==="steps"&&s.stepsParams){let l=A5(o,s,s.stepsParams);for(let u of l)i(u.value,u.time)}else i(zi(s.value),s.time)}return{values:r,keyTimes:n}}function O5(e,t,r){return{values:e.slice().reverse(),keyTimes:t.slice().reverse().map(n=>Sr(1-parseFloat(n))),keySplines:r.slice().reverse().map(Jp)}}function Fu(e,t,r,n,i){let a=i.cycleBehavior??"restart";if(a==="restart"||e.length<2)return{values:e,keyTimes:t,keySplines:r,calcMode:n};if(a==="reverse")return{...O5(e,t,r),calcMode:n};if(a==="alternate-reverse"){let u=e.slice().reverse(),d=t.slice().reverse().map(f=>Sr(.5-parseFloat(f))),c=r.slice().reverse().map(Jp);return{values:[...u,...e.slice(1)],keyTimes:[...d,...t.slice(1).map(f=>Sr(.5+parseFloat(f)))],keySplines:[...c,...r],calcMode:n}}let o=e.slice(0,-1).reverse(),s=t.slice(0,-1).reverse().map(u=>Sr(1-parseFloat(u))),l=r.slice().reverse().map(Jp);return{values:[...e,...o],keyTimes:[...t,...s],keySplines:[...r,...l],calcMode:n}}function Vn(e){let t=e.keyframes,r=xd(e)?t.map((u,d)=>({...u,time:(t[0]?.time??0)+(t.length>1?d/(t.length-1):0)})):t;if(r.length===0)return{values:[],keyTimes:[],keySplines:[],calcMode:"spline"};let n=xd(e)?1:Bi(e),i=r[0]?.time??0,a=u=>n>0?(u-i)/n:0;if(r.some(u=>u.easing==="steps")){let{values:u,keyTimes:d}=C5(r,a);return Fu(u,d,[],"discrete",e)}if(e.calcMode==="discrete"){let u=r.map(c=>zi(c.value)),d=r.map(c=>Sr(a(c.time)));return Fu(u,d,[],"discrete",e)}if(e.calcMode==="paced"){let u=r.map(c=>zi(c.value)),d=r.map(c=>Sr(a(c.time)));return Fu(u,d,[],"paced",e)}let o=[zi(r[0].value)],s=[Sr(a(r[0].time))],l=[];for(let u=1;u<r.length;u++)M5(r[u-1],r[u],a,o,s,l);return Fu(o,s,l,"spline",e)}function _1(e,t={}){let r=t.defaultCalcMode??"linear",n={};if(e.calcMode==="paced")return r!=="paced"&&(n.calcMode="paced"),n;if(e.calcMode==="discrete")return n.keyTimes=e.keyTimes.join(";"),n.calcMode="discrete",n;let i=e.keySplines.length>0&&!D1(e.keySplines);return j1(e.keyTimes)||(n.keyTimes=e.keyTimes.join(";")),i&&(n.calcMode="spline",n.keySplines=e.keySplines.join(";")),n}function Ku(e,t){if(e.shapeId!==t.shapeId||e.keyframes.length!==t.keyframes.length||(e.cycleDuration??-1)!==(t.cycleDuration??-1)||e.simpleDuration!==t.simpleDuration||(e.cycleRepeats??1)!==(t.cycleRepeats??1)||!!e.cycleInfinite!=!!t.cycleInfinite||(e.cycleBehavior??"restart")!==(t.cycleBehavior??"restart")||(e.additive??"replace")!==(t.additive??"replace")||(e.calcMode??"linear")!==(t.calcMode??"linear")||!!e.locked!=!!t.locked)return!1;let r=(n,i)=>{if(!n||!i)return!n&&!i;if(n.type!==i.type||n.value!==i.value)return!1;let a=n.smilRelations,o=i.smilRelations;return!a||!o?!a&&!o:a.length!==o.length?!1:a.every((s,l)=>{let u=o[l];return!u||s.kind!==u.kind||s.sourceAnimationId!==u.sourceAnimationId||s.offset!==u.offset?!1:s.kind==="syncbase"?u.kind==="syncbase"&&s.event===u.event:u.kind==="repeat"&&s.iteration===u.iteration})};if(!r(e.beginTrigger,t.beginTrigger)||!r(e.endTrigger,t.endTrigger))return!1;for(let n=0;n<e.keyframes.length;n++){let i=e.keyframes[n],a=t.keyframes[n];if(i.time!==a.time||i.easing!==a.easing)return!1;let o=i.customBezier,s=a.customBezier;if(!!o!=!!s)return!1;if(o&&s){for(let l=0;l<4;l++)if(o[l]!==s[l])return!1}if(JSON.stringify(i.linearPoints??null)!==JSON.stringify(a.linearPoints??null)||JSON.stringify(i.stepsParams??null)!==JSON.stringify(a.stepsParams??null))return!1}return!0}function T5(e){let t=new Map,r=new Set,n=new Map;for(let i of e){if(!i.enabled||i.keyframes.length<2||i.property!=="translateX"&&i.property!=="translateY"&&i.property!=="scaleX"&&i.property!=="scaleY")continue;let a=n.get(i.shapeId)??[];a.push(i),n.set(i.shapeId,a)}for(let i of n.values()){let a=new Set;for(let o=0;o<i.length;o++){let s=i[o];if(a.has(s.id))continue;let l=s.property==="translateX"||s.property==="translateY",u=l?"translateX":"scaleX",d=l?"translateY":"scaleY";if(!(s.property!==u&&s.property!==d))for(let c=o+1;c<i.length;c++){let f=i[c];if(a.has(f.id)||!(s.property===u&&f.property===d||s.property===d&&f.property===u)||!Ku(s,f))continue;let p=s.property===u?s:f,h=s.property===d?s:f;t.set(p.id,h),r.add(h.id),a.add(p.id),a.add(h.id);break}}}return{partner:t,skip:r}}function P5(e,t,r,n){if(n){let a=t?n.values:e.values,o=t?e.values:n.values,s=Math.min(a.length,o.length),l=[];for(let u=0;u<s;u++)l.push(`${a[u]} ${o[u]}`);return l}let i=r?"1":"0";return e.values.map(a=>t?`${i} ${a}`:`${a} ${i}`)}function D5(e){let t=e.startsWith("svgViewBox")?`viewBox${e.slice(10)}`:e;return t==="viewBoxX"||t==="viewBoxY"||t==="viewBoxWidth"||t==="viewBoxHeight"?t:null}function j5(e){return e.sourceSmilElement&&e.sourceSmilOrder!==void 0?`${e.sourceSmilElement}|${e.sourceSmilOrder}|${e.sourceSmilPlacement??"target"}|${e.sourceSmilParentTarget===!0}`:e.sourceSmilId?`id|${e.sourceSmilId}`:"editor"}function E5(e){let t=new Map;for(let i of e){if(!i.enabled||i.keyframes.length<2)continue;let a=D5(i.property);if(!a)continue;let o=`${i.shapeId}\0${j5(i)}`,s=t.get(o)??{};s[a]||(s[a]=i,t.set(o,s))}let r=new Map,n=new Set;for(let i of t.values()){let{viewBoxX:a,viewBoxY:o,viewBoxWidth:s,viewBoxHeight:l}=i;!a||!o||!s||!l||!Ku(a,o)||!Ku(a,s)||!Ku(a,l)||(r.set(a.id,{viewBoxX:a,viewBoxY:o,viewBoxWidth:s,viewBoxHeight:l}),n.add(o.id),n.add(s.id),n.add(l.id))}return{quartet:r,skip:n}}function z5(e){let t=[Vn(e.viewBoxX),Vn(e.viewBoxY),Vn(e.viewBoxWidth),Vn(e.viewBoxHeight)],r=t[0],n=i=>JSON.stringify([i.keyTimes,i.keySplines,i.calcMode,i.values.length]);return t.some(i=>n(i)!==n(r))?null:{...r,values:r.values.map((i,a)=>t.map(o=>o.values[a]).join(" "))}}function R5(e,t,r){let n=e?.cssAnimationSources;if(!e||!n||n.length===0||e.cssAnimationDocumentStylesFingerprint!==nx(t)||e.cssAnimationInlineStylesFingerprint!==rx(r))return null;let i=new Map,a=new Set;for(let s of n){if(!s.id||i.has(s.id)||s.trackFingerprints.length!==s.trackIds.length)return null;i.set(s.id,s);for(let l of s.trackIds){if(!l||a.has(l))return null;a.add(l)}}let o=new Set;for(let s of e.tracks){let l=s.sourceCssAnimationId;if(!l)continue;let u=i.get(l),d=u?.trackIds.indexOf(s.id)??-1;if(!u||d<0||!s.enabled||!s.template||u.trackFingerprints[d]!==ix(s))return null;o.add(s.id)}if(o.size!==a.size)return null;for(let s of a)if(!o.has(s))return null;return a}var xl={x:"x",y:"y",cx:"cx",cy:"cy",x1:"x1",y1:"y1",x2:"x2",y2:"y2",posX:"x",posY:"y",radius:"r",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",pathLength:"pathLength",svgX:"x",svgY:"y",svgWidth:"width",svgHeight:"height",svgPreserveAspectRatio:"preserveAspectRatio",referenceTargetShapeId:"href",clipPathUnits:"clipPathUnits",spreadMethod:"spreadMethod",in:"in",opacity:"opacity",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",mask:"mask",display:"display",visibility:"visibility",className:"class",borderWidth:"stroke-width",cornerRadius:"rx",fontSize:"font-size",letterSpacing:"letter-spacing",wordSpacing:"word-spacing",textLength:"textLength",textPathStartOffset:"startOffset",d:"d",pathMorph:"d",textPathMorph:"d",polylinePoints:"points"};function _5(e,t){return e.property==="textPathMorph"?t?.state?.textPathInlineFormat==="path-attr"?"path":"d":t&&(t.type==="circle"||t.type==="ellipse")&&(e.property==="x"||e.property==="y")?e.property==="x"?"cx":"cy":e.targetAttribute??xl[e.property]}var F1=new Set(["transformMatrix","rotation","skewX","skewY"]),L1=new Set(["translateX","translateY","scaleX","scaleY"]);function ol(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Te(e,t){return t==null?"":` ${e}="${ol(t)}"`}function wl(e,t){let r=_1(e,t);return Te("keyTimes",r.keyTimes)+Te("calcMode",r.calcMode)+Te("keySplines",r.keySplines)}function Vi(e,t){return Te("dur",xd(e)?null:`${t}s`)+Te("begin",wd(e)||null)+Te("end",w5(e)||null)+Te("repeatCount",k5(e))}function Ds(e,t){let r=t??xl[e.property];if(!r)return"";let n=Bi(e);if(!Ko(e))return"";let i=Vn(e);return i.values.length<2?"":"<animate"+Te("attributeName",r)+Te("values",i.values.map(a=>e.property==="textPathStartOffset"&&e.textPathStartOffsetUnit==="%"?`${a}%`:a).join(";"))+wl(i)+Vi(e,n)+Te("additive",ic(e))+Te("accumulate",Zo(e))+Te("fill",Ma(e))+"/>"}function F5(e,t){let r=Bi(e);if(!Ko(e))return"";let n=z5(t);return!n||n.values.length<2?"":'<animate attributeName="viewBox"'+Te("values",n.values.join(";"))+wl(n)+Vi(e,r)+Te("additive",ic(e))+Te("accumulate",Zo(e))+Te("fill",Ma(e))+"/>"}function L5(e,t){let r;switch(e.property){case"transformMatrix":r="matrix";break;case"rotation":r="rotate";break;case"skewX":r="skewX";break;case"skewY":r="skewY";break;default:return""}let n=Bi(e);if(!Ko(e))return"";let i=Vn(e),a=r==="matrix"?i.values.map(u=>V5(u)):i.values.map(u=>String(u));if(a.length<2||a.some(u=>u.length===0))return"";let o=e.transformOrigin?{x:e.transformOrigin.x-(e.targetTransformOrigin?.x??0),y:e.transformOrigin.y-(e.targetTransformOrigin?.y??0)}:null,s=r==="rotate"&&o?a.map(u=>`${u} ${o.x} ${o.y}`):a,l=e.replacesCarrierBase&&t?"sum":ic(e);return'<animateTransform attributeName="transform"'+Te("type",r)+Te("values",s.join(";"))+wl(i)+Vi(e,n)+Te("additive",l)+Te("accumulate",Zo(e))+Te("fill",Ma(e))+"/>"}function B5(e,t,r){let n=e.property==="scaleX"||e.property==="scaleY",i=e.property==="translateY"||e.property==="scaleY",a=n?"scale":"translate",o=Bi(e);if(!Ko(e))return"";let s=Vn(e);if(s.values.length<2)return"";let l=t?Vn(t):void 0,u=P5(s,i,n,l);if(u.length<2)return"";let d=!e.replacesCarrierBase||r?"sum":null;return'<animateTransform attributeName="transform"'+Te("type",a)+Te("values",u.join(";"))+wl(s)+Vi(e,o)+Te("additive",d)+Te("accumulate",Zo(e))+Te("fill",Ma(e))+"/>"}function V5(e){if(Array.isArray(e)&&e.length>=6){let t=e.slice(0,6);if(t.every(r=>typeof r=="number"&&Number.isFinite(r)))return t.join(" ")}if(typeof e=="string"){let t=e.trim(),r=/^matrix\(([^)]+)\)$/i.exec(t),n=(r?r[1]:t).split(/[\s,]+/).filter(Boolean).map(Number);if(n.length>=6&&n.slice(0,6).every(Number.isFinite))return n.slice(0,6).join(" ")}return""}function U5(e,t){if(!e.motionPath)return"";let r=Bi(e);if(!Ko(e))return"";let n=Vn(e),i=S5(n),a=!!e.motionPathRef&&(e.motionPathRef.mode??"trackShape")==="curveTemplate",o=_1(n,{defaultCalcMode:"paced"});n.calcMode!=="paced"&&o.calcMode===void 0&&(o.calcMode="linear");let s=x5(i)&&j1(n.keyTimes)&&n.calcMode!=="discrete"&&(o.calcMode===void 0||o.calcMode==="linear"),l=n.calcMode==="spline"&&n.keySplines.length>0&&!D1(n.keySplines)&&o.keyTimes===void 0||!s&&o.keyTimes===void 0?n.keyTimes.join(";"):o.keyTimes,u="<animateMotion";if(a||(u+=Te("path",e.motionPath)),u+=Te("keyTimes",l),s||(u+=Te("keyPoints",i.join(";"))),u+=Te("calcMode",o.calcMode)+Te("keySplines",o.keySplines),u+=Vi(e,r),u+=Te("accumulate",Zo(e)),u+=Te("fill",Ma(e)),e.motionRotate!==void 0&&(u+=Te("rotate",typeof e.motionRotate=="number"?String(e.motionRotate):e.motionRotate)),a){let d=t?.(e.motionPathRef.shapeId)??e.motionPathRef.shapeId;u+=`><mpath${Te("id",e.sourceMpathId)} href="#${ol(d)}"/></animateMotion>`}else u+="/>";return u}function Id(e,t,r){if(F1.has(e.property)||L1.has(e.property)||e.property==="pathMotion")return"";let n=r??e.targetAttribute??xl[e.property];if(!n)return"";let i=e.keyframes[t];return i?"<set"+Te("attributeName",n)+Te("to",e.property==="textPathStartOffset"&&e.textPathStartOffsetUnit==="%"?`${String(i.value)}%`:Array.isArray(i.value)?i.value.join(" "):String(i.value))+Te("begin",I5(e,t)||null)+"/>":""}function B1(e){if(e.sourceSmilElement!=="set"||e.fill!=="remove"||e.cycleDuration===void 0||e.cycleDuration<=0||e.cycleInfinite||e.cycleRepeats!==void 0||e.keyframes.length!==2)return!1;let t=e.keyframes[0],r=e.keyframes[1];return Math.abs(r.time-t.time-e.cycleDuration)<=1e-9}function V1(e){return e.sourceSmilElement==="animate"&&e.cycleDuration!==void 0&&e.cycleDuration>0&&e.keyframes.length===1}function U1(e,t){let r=t??e.targetAttribute??xl[e.property],n=e.keyframes[0];if(!r||!n||e.cycleDuration===void 0)return"";let i=Array.isArray(n.value)?n.value.join(" "):String(n.value);return"<animate"+Te("attributeName",r)+Te("values",i)+Vi(e,e.cycleDuration)+Te("fill",Ma(e))+"/>"}function G1(e,t){let r=t??e.targetAttribute??xl[e.property],n=e.keyframes[0];return!r||!n||e.cycleDuration===void 0?"":"<set"+Te("attributeName",r)+Te("to",e.property==="textPathStartOffset"&&e.textPathStartOffsetUnit==="%"?`${String(n.value)}%`:Array.isArray(n.value)?n.value.join(" "):String(n.value))+Vi(e,e.cycleDuration)+"/>"}function G5(e,t){let r={...e,locked:e.locked??!1,keyframes:[...e.keyframes].sort((n,i)=>n.time-i.time).map(n=>({...n,easing:n.easing}))};return!r.enabled||r.keyframes.length===0?"":z1(r)?Id(r,0,t):B1(r)?G1(r,t):V1(r)?U1(r,t):R1(r)?r.keyframes.map((n,i)=>Id(r,i,t)).join(""):r.keyframes.length<2?"":Ds(r,t)}function W5(e){let t=wd(e);return t?`<discard begin="${ol(t)}"/>`:"<discard/>"}function X5(e){if(!e.transformFunction)return"";let t=Bi(e);if(!Ko(e))return"";let r=Vn(e);return r.values.length<2?"":'<animateTransform attributeName="transform"'+Te("type",e.transformFunction)+Te("values",r.values.join(";"))+wl(r)+Vi(e,t)+Te("additive",ic(e))+Te("accumulate",Zo(e))+Te("fill",Ma(e))+"/>"}function ac(e,t={}){let r=[],n=t.placement??"target",i=e.tracks.filter(p=>n==="target"?p.sourceSmilPlacement===void 0:p.sourceSmilPlacement===n).map(p=>{let h=m=>{if(p.property!=="referenceTargetShapeId"||typeof m!="string")return m;let g=t.referenceTargetElementId?.(m);return g?`#${g}`:m};return{...p,locked:p.locked??!1,...p.property==="referenceTargetShapeId"&&p.transformBaseValue!==void 0?{transformBaseValue:h(p.transformBaseValue)}:{},keyframes:[...p.keyframes].sort((m,g)=>m.time-g.time).map(m=>({...m,time:m.time,value:h(m.value),easing:m.easing}))}}),a=[...i.flatMap(p=>{let h=hC(p);return h?[h]:[]}),...i],o=Y5(a,t.targetShape),s=T5(o),l=E5(o),u=new Set,d=new Set,c=new Set,f=(p,h,m)=>{if(!h)return;let g=h;if(m.sourceSmilId&&!u.has(m.sourceSmilId)&&(u.add(m.sourceSmilId),g=h.replace(/^(<[a-zA-Z]+)/,`$1 id="${ol(m.sourceSmilId)}"`)),n!=="target"&&!(n==="document"&&m.sourceSmilParentTarget===!0)){let v=t.targetElementId?.(p);if(!v)return;g=g.replace(/^(<[a-zA-Z]+)/,`$1 href="#${ol(v)}"`)}r.push({shapeId:p,textSpanIds:m.textSpanTarget?.spanIds??null,markup:g,sourceOrder:m.sourceSmilOrder??null,definitionOrder:m.sourceSmilDefinitionOrder??null,definitionContainerId:m.sourceSmilDefinitionContainerId??null,sequence:r.length})};for(let p of o){if(!p.enabled||s.skip.has(p.id)||l.skip.has(p.id)||p.keyframes.length<1)continue;let h=_5(p,t.targetShape?.(p.shapeId));if(p.property==="discard"){f(p.shapeId,W5(p),p);continue}if(z1(p)){f(p.shapeId,Id(p,0,h),p);continue}if(B1(p)){f(p.shapeId,G1(p,h),p);continue}if(V1(p)){f(p.shapeId,U1(p,h),p);continue}if(R1(p)){for(let b=0;b<p.keyframes.length;b++)f(p.shapeId,Id(p,b,h),p);continue}if(p.keyframes.length<2)continue;let m=p.id.endsWith(":backwards-fill")?d:c,g="",v=l.quartet.get(p.id);v?g=F5(p,v):p.property==="targetTransformStack"?g=X5(p):p.targetAttribute?g=Ds(p,p.targetAttribute):p.property==="targetDisplay"?g=Ds(p,"display"):p.property==="targetVisibility"?g=Ds(p,"visibility"):p.property==="pathMotion"&&p.motionPath?g=U5(p,t.motionPathTargetElementId):F1.has(p.property)?(g=L5(p,m.has(p.shapeId)),g&&m.add(p.shapeId)):L1.has(p.property)?(g=B5(p,s.partner.get(p.id),m.has(p.shapeId)),g&&m.add(p.shapeId)):g=Ds(p,h),f(p.shapeId,g,p)}return r}function wo(e,t={}){let r=new Map;for(let n of ac(e,t)){let i=r.get(n.shapeId)??[];i.push(n.markup),r.set(n.shapeId,i)}return r}function W1(e,t={}){let r=new Map;for(let n of ac(e,t)){if(!n.textSpanIds)continue;let i=r.get(n.shapeId)??new Map;for(let a of n.textSpanIds){let o=i.get(a)??[];o.push(n.markup),i.set(a,o)}r.set(n.shapeId,i)}return r}function H5(e,t={}){return ac(e,{...t,placement:"document"}).sort((r,n)=>(r.sourceOrder??Number.POSITIVE_INFINITY)-(n.sourceOrder??Number.POSITIVE_INFINITY)||r.sequence-n.sequence).map(r=>r.markup)}function q5(e,t={}){return ac(e,{...t,placement:"defs"}).sort((r,n)=>(r.definitionOrder??Number.POSITIVE_INFINITY)-(n.definitionOrder??Number.POSITIVE_INFINITY)||r.sequence-n.sequence).map(r=>({markup:r.markup,...r.definitionOrder!==null?{definitionOrder:r.definitionOrder}:{},...r.definitionContainerId!==null?{definitionContainerId:r.definitionContainerId}:{}}))}function Y5(e,t){let r=new Set(e.filter(a=>a.enabled&&P1(a)).map(a=>a.shapeId));if(r.size===0)return e;let n=new Set,i=[];for(let a of r){let o=v5(t?.(a));if(!o)continue;let s=y5(e,a,o);if(s){i.push(s.track);for(let l of s.consumedTrackIds)n.add(l)}}return i.length===0?e:[...e.filter(a=>!n.has(a.id)),...i]}var gr=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function Uv(e){let t=Ld(`<svg xmlns="${ye}" xmlns:xlink="http://www.w3.org/1999/xlink">${e}</svg>`,{source:"native-document",entrypoint:"full-snapshot-restore"}).value;return t?new Set(t.index.localReferences.map(r=>r.targetAuthoredId)):new Set}function K5(e){let t=new Set,r=n=>{for(let i of sl(n))t.add(i.targetAuthoredId)};for(let n of e.documentStyles??[])r(n.css);for(let n of e.animationTimeline?.tracks??[])for(let i of n.keyframes)typeof i.value=="string"&&r(i.value);for(let n of e.clipMaskGroups??[])if(n.rawDefinition)for(let i of Uv(n.rawDefinition))t.add(i);for(let n of e.paintServerDefs??[])for(let i of Uv(n.markup))t.add(i);return t}var Gv=["linear-gradient","radial-gradient","pattern","filter","marker","symbol"];function Zh(e){let t=new Map;for(let r of e)r.kind==="symbol"&&t.set(r.id,r.defKind??"symbol");return{symbolDefKind:r=>t.get(r)}}function ap(e,t){switch(e.kind){case"symbol":return Z5(e,t);case"marker":return Q5(e,t);case"linear-gradient":return eV(e,t);case"radial-gradient":return tV(e,t);case"pattern":return rV(e);case"filter":return nV(e,t);case"appearance-style":return""}}function Z5(e,t){return kd(e,e.id,e.shapes,t)}function X1(e,t){if(!t||t.length===0)return;let r=t.map((a,o)=>({...a,order:o})).sort((a,o)=>a.siblingIndex-o.siblingIndex||a.order-o.order),n=-1,i=0;for(let a of r)a.siblingIndex===n?i++:(n=a.siblingIndex,i=0),e.splice(Math.min(a.siblingIndex+i,e.length),0,a.markup)}function H1(e,t){let r=new Map(e.map(o=>[o.definition.id,o])),n=new Map;for(let o of e)for(let s of o.definition.definitionContentOrder??[])s.kind==="definition"&&s.id!==o.definition.id&&r.has(s.id)&&!n.has(s.id)&&n.set(s.id,o.definition.id);let i=[],a=new Set;for(let o of t){if(!r.has(o))continue;let s=o,l=new Set;for(;n.has(s)&&!l.has(s);)l.add(s),s=n.get(s);a.has(s)||(a.add(s),i.push(s))}return i}var Wv=["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"];function Xv(e,t){let r=e.rootAttributes??{},n="";if(t)for(let i of Wv){let a=e[i];a!==void 0&&(n+=` ${i}="${gr(a)}"`)}for(let[i,a]of Object.entries(r))i==="id"||Wv.includes(i)||/^[A-Za-z_][\w:.-]*$/.test(i)&&(n+=` ${i}="${gr(a)}"`);return n}function q1(e){if(!e.animations||e.animations.length===0)return null;let t={duration:Math.max(0,...e.animations.flatMap(n=>n.keyframes.map(i=>i.time))),loop:e.animations.some(n=>n.cycleInfinite===!0),playbackSpeed:1,tracks:e.animations},r=new Map(Jn(e.kind==="symbol"?[...e.shapes,...Object.values(e.variants??{}).flat()]:e.shapes).ordered.map(n=>[n.id,n]));return{shape:wo({...t,tracks:t.tracks.filter(n=>n.textSpanTarget===void 0)},{placement:"target",targetShape:n=>r.get(n)}),textSpan:W1({...t,tracks:t.tracks.filter(n=>n.textSpanTarget!==void 0)},{placement:"target",targetShape:n=>r.get(n)})}}function Qp(e,t,r,n){return!t&&!r?.definitionChildrenForShape?r:{...r,...r?.definitionChildrenForShape?{definitionChildrenForShape:i=>r.definitionChildrenForShape?.(i,e.id)}:{},...t?{animationElementsForShape:i=>{let a=r?.animationElementsForShape?.(i)??[],o=[...t.shape.get(i.id)??[],...i.id===n?t.shape.get(e.id)??[]:[]];return a.length===0?o.length>0?o:void 0:o.length===0?a:[...a,...o]},textSpanAnimationElementsForShape:(i,a)=>{let o=r?.textSpanAnimationElementsForShape?.(i,a)??[],s=t.textSpan.get(i.id)?.get(a)??[];return o.length===0?s.length>0?s:void 0:s.length===0?o:[...o,...s]}}:{}}}function kd(e,t,r,n,i=new Map){let a=q1(e);if((e.defKind??"symbol")==="shape"){let[m]=r;if(!m||r.length!==1)return`<!-- invalid native-shape definition: ${gr(t)} -->`;let g={...m,state:{...m.state,authoredAttributes:{...m.state.authoredAttributes??{},...e.rootAttributes??{}},...e.metadata?{metadata:{...m.state.metadata??{},...e.metadata}}:{}}};return ui(g,{...Qp(e,a,n,g.id),elementIdForShape:v=>v.id===g.id?t:n?.elementIdForShape?.(v)})}let o=Qp(e,a,n),s=new Map(r.map(m=>[m.id,ui(m,o)])),l=new Set,u=new Set,d=[];for(let m of e.definitionContentOrder??[]){if(m.kind==="shape"){let v=s.get(m.id);if(!v||l.has(m.id))continue;l.add(m.id),d.push(v);continue}let g=i.get(m.id);!g||u.has(m.id)||(u.add(m.id),d.push(g))}for(let m of r)l.has(m.id)||d.push(s.get(m.id)??"");for(let[m,g]of i)u.has(m)||d.push(g);X1(d,n?.definitionChildrenForLibraryDefinition?.(e.id));let c=n?.variantTransitionDefinitionContent?.(t);d.push(...c?.children??[]);let f=a?.shape.get(e.id)?.join("")??"",p=Kd(e.metadata)+f+d.join("");if((e.defKind??"symbol")==="group"){let m=Hv(Xv(e,!1),c?.scopeClass);return`<g id="${gr(t)}"${m}>${p}</g>`}let h=Hv(Xv(e,!0),c?.scopeClass);return`<symbol id="${gr(t)}"${h}>${p}</symbol>`}function Hv(e,t){if(!t)return e;let r=/\sclass=("[^"]*"|'[^']*')/.exec(e);if(!r)return`${e} class="${t}"`;let n=r[1].slice(1,-1);return n.split(/\s+/).includes(t)?e:e.slice(0,r.index)+` class="${n?`${n} ${t}`:t}"`+e.slice(r.index+r[0].length)}function Y1(e,t){let r=new Map(e.map(o=>[o.definition.id,o])),n=new Set,i=new Set,a=o=>{if(n.has(o.definition.id)||i.has(o.definition.id))return"";i.add(o.definition.id);let s=new Map;for(let l of o.definition.definitionContentOrder??[]){if(l.kind!=="definition")continue;let u=r.get(l.id);if(!u)continue;let d=a(u);d&&s.set(l.id,d)}return i.delete(o.definition.id),n.add(o.definition.id),kd(o.definition,o.emittedId,o.shapes,t,s)};return{render(o){let s=r.get(o);return s?a(s):""},emitted:n}}function J5(e,t,r){return Y1(t,r).render(e)}function qv(e,t,r){let n=Y1(e,t),i=H1(e,r??e.map(o=>o.definition.id)),a="";for(let o of i)a+=n.render(o);if(r===void 0)for(let o of e)a+=n.render(o.definition.id);return a}function Q5(e,t){let r=q1(e),n=Qp(e,r,t),i;if(e.builtIn){let u=h1().find(d=>{let c=m1[d.id]??d.id;return e.id===c||e.id===d.id});if(u){let d=Object.entries(u.element.attrs).map(([c,f])=>` ${c}="${gr(String(f))}"`).join("");i=`<${u.element.tag}${d}/>`}else i=""}else{let u=e.shapes.map(d=>ui(d,n));X1(u,t?.definitionChildrenForLibraryDefinition?.(e.id)),i=u.join("")}let a=e.authoredGeometry??{},o={refX:a.refX??String(e.refX),refY:a.refY??String(e.refY),markerWidth:a.markerWidth??String(e.markerWidth),markerHeight:a.markerHeight??String(e.markerHeight),markerUnits:a.markerUnits??e.markerUnits,orient:a.orient??(typeof e.orient=="number"?String(e.orient):e.orient)},s="";e.viewBox!==void 0&&(s+=` viewBox="${gr(e.viewBox)}"`),e.preserveAspectRatio!==void 0&&(s+=` preserveAspectRatio="${gr(e.preserveAspectRatio)}"`);let l=new Set(["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"]);for(let[u,d]of Object.entries(e.rootAttributes??{}))l.has(u)||!/^[A-Za-z_][\w:.-]*$/.test(u)||(s+=` ${u}="${gr(d)}"`);return e.overflow!==void 0&&e.rootAttributes?.overflow===void 0&&(s+=` overflow="${gr(e.overflow)}"`),i=Kd(e.metadata)+(r?.shape.get(e.id)?.join("")??"")+i,`<marker id="${gr(e.id)}"${s} refX="${gr(o.refX)}" refY="${gr(o.refY)}" markerWidth="${gr(o.markerWidth)}" markerHeight="${gr(o.markerHeight)}" markerUnits="${gr(o.markerUnits)}" orient="${gr(o.orient)}">${i}</marker>`}function eV(e,t){return oc(O1(Yz(e.id,e.gradient),t),e.metadata)}function tV(e,t){return oc(O1(Kz(e.id,e.gradient),t),e.metadata)}function rV(e){let t={...e.pattern,type:"pattern",id:e.id};return oc(l5(e.id,t),e.metadata)}function nV(e,t){return oc(i_(e.id,e.filters,{colorInterpolation:e.colorInterpolation,filterUnits:e.filterUnits,primitiveUnits:e.primitiveUnits,x:e.x,y:e.y,width:e.width,height:e.height},{root:t?.definitionAnimationElements?.(e.id),primitive:r=>t?.definitionAnimationElements?.(e.id,r)}),e.metadata)}function oc(e,t){let r=Kd(t);if(!r)return e;let n=e.match(/^<([\w:-]+)([^>]*)\/>$/u);if(n)return`<${n[1]}${n[2]}>${r}</${n[1]}>`;let i=e.indexOf(">");return i<0?e:e.slice(0,i+1)+r+e.slice(i+1)}function iV(e,t,r=[]){let n=new Map;for(let f of t)n.set(f.id,f);let i=new Map,a=new Set,o=f=>{if(!f)return;let p=n.get(f);if(!(!p||a.has(f))){if(a.add(f),(p.kind==="linear-gradient"||p.kind==="radial-gradient")&&p.gradient.templateId&&o(p.gradient.templateId),p.kind==="pattern"&&p.pattern.templateId&&o(p.pattern.templateId),p.kind==="appearance-style"){qA(p,o),a.delete(f);return}if(i.set(f,p),p.kind==="symbol")for(let h of p.definitionContentOrder??[])h.kind==="definition"&&o(h.id);a.delete(f)}},s=(f,p)=>{if(!f||typeof f!="object")return;let h=f;if(!h.id||i.has(h.id))return;let m=p==="linear-gradient"?"linear-gradient":p==="radial-gradient"?"radial-gradient":p==="pattern"?"pattern":null;if(!m)return;let{id:g,sourceId:v,...b}=f,y;if(m==="linear-gradient")y={kind:"linear-gradient",id:h.id,name:v??h.id,sourceId:v,gradient:b};else if(m==="radial-gradient")y={kind:"radial-gradient",id:h.id,name:v??h.id,sourceId:v,gradient:b};else{let{customPatternId:I,...x}=b;y={kind:"pattern",id:h.id,name:v??h.id,sourceId:v,pattern:x}}i.set(h.id,y)},l=(f,p)=>{let h=f.filters;if(!(!Array.isArray(h)||h.length===0))for(let m of lU(h,p))u(f,m)},u=(f,p)=>{let h=p.id;i.has(h)||i.set(h,{kind:"filter",id:h,name:h,filters:p.filters,...f.filterColorInterpolation&&f.filterColorInterpolation!=="auto"?{colorInterpolation:f.filterColorInterpolation}:{},...f.filterUnits?{filterUnits:f.filterUnits}:{},...f.primitiveUnits?{primitiveUnits:f.primitiveUnits}:{},...typeof f.filterX=="string"?{x:f.filterX}:{},...typeof f.filterY=="string"?{y:f.filterY}:{},...typeof f.filterWidth=="string"?{width:f.filterWidth}:{},...typeof f.filterHeight=="string"?{height:f.filterHeight}:{}})},d=f=>{let p=f.state;if(!p)return;o(p.fillLibraryId),o(p.strokeLibraryId),o(p.markerStart),o(p.markerMid),o(p.markerEnd);let h=p.textPathReference;if(h?.kind==="definition"&&typeof h.targetId=="string"&&o(h.targetId),f.type==="symbol-instance"){let v=p.symbolId;v&&Nx(f)===v&&o(v)}else o(p.symbolId);let m=p.filterLibraryIds;if(Array.isArray(m))for(let v of m)typeof v=="string"&&o(v);p.fillLibraryId||s(p.fillGradient,p.fillType),p.strokeLibraryId||s(p.strokeGradient,p.strokeType),(!Array.isArray(m)||m.length===0)&&l(p,f.id),Jb(p,o);let g=p.appearance;if(Array.isArray(g))for(let v of g){if(!v||typeof v!="object")continue;let b=v;b.libraryId||s(b.gradient,b.paintType)}o(p.graphicStyleId)};for(let f of e)d(f);let c=Array.from(r);for(let f of c)o(f);return Wx(e,t,d),fP(c,t,d),Array.from(i.values())}function aV(e){let t=new Map,r=(o,s)=>{let l=o.type??s;return l==="linear-gradient"||l==="radial-gradient"||l==="pattern"?l:null},n=(o,s,l)=>{if(typeof o!="string"||o.length===0||!s||typeof s!="object"||t.has(o))return;let u=s,d=r(u,l);if(!d)return;let{id:c,sourceId:f,type:p,...h}=u,m=typeof f=="string"?f:o;if(d==="linear-gradient")t.set(o,{kind:d,id:o,name:m,...typeof f=="string"?{sourceId:f}:{},gradient:{type:"linear-gradient",...h}});else if(d==="radial-gradient")t.set(o,{kind:d,id:o,name:m,...typeof f=="string"?{sourceId:f}:{},gradient:{type:"radial-gradient",...h}});else{let{customPatternId:g,...v}=h;t.set(o,{kind:"pattern",id:o,name:m,...typeof f=="string"?{sourceId:f}:{},pattern:v})}},i=o=>{let s=o.filterLibraryIds;if(!Array.isArray(s)||s.length!==1||typeof s[0]!="string")return;let l=s[0],u=o.filters;!Array.isArray(u)||u.length===0||t.has(l)||t.set(l,{kind:"filter",id:l,name:l,filters:u,...o.filterColorInterpolation&&o.filterColorInterpolation!=="auto"?{colorInterpolation:o.filterColorInterpolation}:{},...o.filterUnits?{filterUnits:o.filterUnits}:{},...o.primitiveUnits?{primitiveUnits:o.primitiveUnits}:{},...typeof o.filterX=="string"?{x:o.filterX}:{},...typeof o.filterY=="string"?{y:o.filterY}:{},...typeof o.filterWidth=="string"?{width:o.filterWidth}:{},...typeof o.filterHeight=="string"?{height:o.filterHeight}:{}})},a=o=>{let s=o.state;if(!s)return;n(s.fillLibraryId,s.fillGradient,s.fillType),n(s.strokeLibraryId,s.strokeGradient,s.strokeType),i(s);let l=s.children;if(Array.isArray(l))for(let u of l)a(u)};for(let o of e)a(o);return Array.from(t.values())}var oV=new Map([["xlink","http://www.w3.org/1999/xlink"],["dc","http://purl.org/dc/elements/1.1/"],["cc","http://creativecommons.org/ns#"],["rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"],["inkscape","http://www.inkscape.org/namespaces/inkscape"],["sodipodi","http://sodipodi.sourceforge.net/DTD/sodipodi-0.0.dtd"]]),Jh=/([A-Za-z_][\w:.-]*)\s*=\s*"([^"]*)"/g;function sV(e,t){return e.length===0?e:e.replace(Jh,(r,n,i)=>{if(!c1(n,i))return r;let a=ZB(n,i,t),o=QB(i,a);return o===i?r:`${n}="${o}"`})}var co=/<\/?([A-Za-z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g;function Sd(e){let t=[],r=0,n=0,i="";co.lastIndex=0;let a;for(;(a=co.exec(e))!==null;){let o=a[0].startsWith("</"),s=a[3]==="/";if(o){if(r=Math.max(0,r-1),r===0){let l=e.slice(n,co.lastIndex);t.push({markup:l,tag:i,id:Yv(l)}),n=co.lastIndex,i=""}continue}if(r===0&&(i=a[1].toLowerCase()),!s)r++;else if(r===0){let l=e.slice(n,co.lastIndex);t.push({markup:l,tag:i,id:Yv(l)}),n=co.lastIndex,i=""}}if(n<e.length){let o=e.slice(n);o.trim().length>0&&t.push({markup:o,tag:"",id:null})}return t}function lV(e,t){let r=(t.paintServerDefs??[]).filter(c=>Array.isArray(c.definitionChildIds)&&c.definitionChildIds.length>0);if(r.length===0)return e;let n=new Map,i=new Map;e.defs.entries.forEach((c,f)=>{let p=Sd(c.markup);n.set(f,p),p.forEach((h,m)=>{!h.id||i.has(h.id)||i.set(h.id,{entryIndex:f,index:m,segment:h,key:`${f}:${m}`})})});let a=new Map(r.map(c=>[c.id,c])),o=new Set,s=new Map,l=new Map,u=(c,f)=>{let p=l.get(c);if(p)return p;if(f.has(c))return null;let h=a.get(c),m=i.get(c);if(!h||!m)return null;let g=m.segment.markup,v=g.indexOf(">"),b=g.lastIndexOf("</");if(v<0||b<=v)return g;let y=g.slice(v+1,b),I=h.sourceDefinitionChildIds??h.definitionChildIds,x=h.definitionChildIds,k=new Map(I.map((M,T)=>[M,T])),$=new Set(f);$.add(c);let A=Sd(y).map(M=>{if(!M.id)return M.markup;let T=k.get(M.id);if(T===void 0)return M.markup;let E=x[T],C=i.get(E);if(!C||C.key===m.key)return M.markup;let O=a.has(E)?u(E,$):C.segment.markup;return O?(o.add(C.key),M.markup.slice(0,M.markup.indexOf("<"))+O.trimStart()):M.markup}).join(""),S=g.slice(0,v+1)+A+g.slice(b);return l.set(c,S),S};for(let c of r){let f=i.get(c.id);if(!f)continue;let p=u(c.id,new Set);p&&s.set(f.key,p)}let d={...e.defs,entries:e.defs.entries.map((c,f)=>({...c,markup:(n.get(f)??[]).map((p,h)=>{let m=`${f}:${h}`;return o.has(m)?"":s.get(m)??p.markup}).join("")}))};return{...e,defs:d}}function Yv(e){let t=/^[^>]*>/.exec(e.trimStart()),r=t?t[0]:e,n=/\sid\s*=\s*"([^"]*)"/.exec(r);return n?n[1]:null}function $d(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qh(e,t){if(t.size===0||e.length===0)return e;let r=e;for(let[n,i]of t){let a=$d(n);r=r.replace(new RegExp(`url\\(\\s*(['"]?)#${a}\\1\\s*\\)`,"g"),(o,s)=>`url(${s}#${i}${s})`),r=r.replace(new RegExp(`((?:xlink:)?href\\s*=\\s*)(["'])#${a}\\2`,"g"),(o,s,l)=>`${s}${l}#${i}${l}`)}return r}function uV(e,t,r){return e.replace(new RegExp(`(\\sid\\s*=\\s*")${$d(t)}(")`),`$1${r}$2`)}function Xs(e,t){let r={...e.defs,entries:e.defs.entries.map(n=>({...n,markup:t(n.markup)}))};return{...e,defs:r,backgroundRect:t(e.backgroundRect),body:e.body.map(n=>n.kind==="shape"?{...n,markup:t(n.markup)}:{...n,open:t(n.open),close:t(n.close),members:n.members.map(i=>({...i,markup:t(i.markup)}))}),envelope:{...e.envelope,extensions:t(e.envelope.extensions),rootDefinitions:t(e.envelope.rootDefinitions),rootAnimations:t(e.envelope.rootAnimations)}}}function K1(e,t){let r=Xs(e,t);return{...r,envelope:{...r.envelope,styles:t(r.envelope.styles)}}}function dV(e){let t=new Set,r=/\sid\s*=\s*"([^"]*)"/g,n=i=>{r.lastIndex=0;let a;for(;(a=r.exec(i))!==null;)t.add(a[1])};for(let i of e.defs.containers)i.svgId&&t.add(i.svgId);for(let i of e.defs.entries)n(i.markup);for(let i of e.body)if(i.kind==="shape")n(i.markup);else{n(i.open);for(let a of i.members)n(a.markup)}return n(e.envelope.descriptive),n(e.envelope.rootAttributes),n(e.envelope.extensions),n(e.envelope.rootDefinitions),n(e.envelope.rootAnimations),t}function cV(e,t){let r=[...t.library??[],...t.paintServerDefs??[]];if(r.length===0)return e;let n=dV(e),i=new Map,a=new Set;for(let s of r){let l=s.sourceId,u=s.id;!l||!u||l===u||a.has(l)||n.has(l)||n.has(u)&&(i.set(u,l),a.add(l))}if(i.size===0)return e;let o=K1(e,s=>Qh(s,i));return Xs(o,s=>{let l=s;for(let[u,d]of i)l=uV(l,u,d);return l})}var Z1=new Set(["circle","ellipse","g","image","line","lineargradient","path","polygon","polyline","radialgradient","rect","pattern","marker","symbol","text","use"]),fV=new Set(["circle","ellipse","image","line","path","polygon","polyline","rect","text","use"]),pV=new Set(["defs","g"]);function J1(e,t,r){let n=t;r&&(n=n.replace(new RegExp(`\\sid\\s*=\\s*"${$d(r)}"`),""));let i=[];if(Z1.has(e)&&!["lineargradient","radialgradient","pattern","marker"].includes(e)){n=n.replace(/\sxmlns:svg="http:\/\/www\.w3\.org\/2000\/svg"/g,"").replace(/\sxmlns:xlink="http:\/\/www\.w3\.org\/1999\/xlink"/g,"");let a=/\sid\s*=\s*"([^"]*)"/g,o;for(;(o=a.exec(n))!==null;)o[1]!==""&&i.push(o[1]);let s=new Map;i.forEach((u,d)=>s.set(u,`__local_${d}`)),n=Qh(n,s);for(let[u,d]of s)n=n.replace(new RegExp(`(\\sid\\s*=\\s*")${$d(u)}(")`,"g"),`$1${d}$2`);let l=0;n=n.replace(/\s(data-shape-id|data-svgsketch-inner-id)\s*=\s*"[^"]*"/g,(u,d)=>` ${d}="__shape_${l++}"`),n=ua(n,[{}])}return{hash:n.replace(/\s+/g," ").trim(),localIds:i}}function hV(e,t=[e]){let r=t.includes(e)?t:[...t,e],n=J5(e.id,r.filter(o=>o.kind==="symbol").map(o=>({definition:o,emittedId:o.id,shapes:o.shapes})),Zh(r)),i=Sd(n).find(o=>o.id===e.id);if(!i)return`invalid|${n}`;let a=J1(i.tag,i.markup,i.id);return`${i.tag}|${a.hash}`}function Q1(e){let t=new Map,r=new Map,n=!1,i=(u,d)=>{u.forEach((c,f)=>{let p=d[f];p!==void 0&&c!==p&&r.set(c,p)})},a=(u,d)=>{let c=[],f=Sd(u);for(let p of f){let h=p;if(pV.has(h.tag)){let b=h.markup.indexOf(">"),y=h.markup.toLowerCase().lastIndexOf(`</${h.tag}>`);if(b>=0&&y>b){let I=h.markup.slice(b+1,y),x=a(I,h.tag==="defs");if(x!==I&&(n=!0),h={...h,markup:h.markup.slice(0,b+1)+x+h.markup.slice(y)},h.tag==="defs"||!h.id){c.push(h.markup);continue}}}if(!Z1.has(h.tag)||!h.id||!d&&fV.has(h.tag)){c.push(h.markup);continue}let m=J1(h.tag,h.markup,h.id),g=`${h.tag}|${m.hash}`,v=t.get(g);if(v===void 0){t.set(g,{id:h.id,localIds:m.localIds}),c.push(h.markup);continue}if(i(m.localIds,v.localIds),v.id===h.id){n=!0;continue}r.set(h.id,v.id),n=!0}return c.join("")},o={...e.defs,entries:e.defs.entries.map(u=>({...u,markup:a(u.markup,!0)}))};if(!n&&r.size===0)return e;let s={...e,defs:o},l=r.size===0?s:K1(s,u=>Qh(u,r));return Q1(l)}function Kv(e){return e.replace(/&apos;/g,"'").replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function mV(e){return!e.includes("&")&&!e.includes("<")?e:e.replace(/&/g,"\\26 ").replace(/</g,"\\3c ")}var Nd=/(font-family|font-weight|font-style)\s*:\s*([^;"}<]+)/g;function gV(e,t){let r,n,i,a="";if(e.replace(Jh,(o,s,l)=>{switch(s){case"font-family":r=Kv(l);break;case"font-weight":n=l;break;case"font-style":i=l;break;case"style":a=Kv(l);break}return o}),a.includes("font-")){Nd.lastIndex=0;let o;for(;(o=Nd.exec(a))!==null;){let s=o[2].trim();o[1]==="font-family"?r=s:o[1]==="font-weight"?n=s:i=s}}return{family:r??t.family,weight:MI(n,t.weight),style:i===void 0?t.style:AI(i)}}function op(e,t,r){if(e.length===0)return;let n=/<(\/?)([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g,i;for(;(i=n.exec(e))!==null;){let[,a,o,s,l]=i;if(a==="/"){t.length>1&&t.pop();continue}let u=gV(s,t[t.length-1]),d=o.toLowerCase();(d==="text"||d==="tspan"||d==="textpath")&&u.family&&r.push({family:u.family,weight:u.weight,style:u.style}),l!=="/"&&t.push(u)}}function yV(e,t){if(!e.includes("font-"))return;let r=e.replace(/@font-face\s*\{[^}]*\}/g,"");for(let n of r.split("}")){let i=n.indexOf("{");if(i<0)continue;let a=n.slice(i+1);if(!a.includes("font-"))continue;let o,s,l;Nd.lastIndex=0;let u;for(;(u=Nd.exec(a))!==null;){let d=u[2].trim();u[1]==="font-family"?o=d:u[1]==="font-weight"?s=d:l=d}o&&t.push({family:o,weight:MI(s),style:AI(l)})}}function vV(e){let t=[],r=i=>{op(i,[{weight:Bp,style:"normal"}],t)};for(let i of e.defs.entries)r(i.markup);r(e.envelope.rootDefinitions),r(e.envelope.rootAnimations);let n=[{weight:Bp,style:"normal"}];for(let i of e.body)if(i.kind==="shape")op(i.markup,n,t);else for(let a of i.members)op(a.markup,n,t);return yV(e.envelope.styles,t),Z_(t.filter(i=>!Y_(i.family)))}function bV(e,t){let r=vV(e);if(r.length===0)return e;let n=t(r);if(!n||n.trim().length===0)return e;let i=`<style type="text/css">
63
+ ${mV(n.trim())}
64
+ </style>`;return{...e,envelope:{...e.envelope,styles:e.envelope.styles.length>0?`${i}
65
+ ${e.envelope.styles}`:i}}}var xV=new Set(["rect","image","svg","use","text"]),Zv="Inter, sans-serif",wV=new Map([["stroke","stroke"],["stroke-width","strokeWidth"],["stroke-opacity","strokeOpacity"],["fill-opacity","fillOpacity"],["font-weight","fontWeight"],["font-style","fontStyle"],["text-anchor","textAnchor"],["font-family","fontFamily"]]);function Jv(e){let t=parseFloat(e);return Number.isFinite(t)&&Math.abs(t-1)<1e-6}function Qv(e){let t=parseFloat(e);return Number.isFinite(t)&&t===0}function eb(e){return e===void 0||e==="normal"||e==="400"}var IV=/\s+([A-Za-z_][\w:.-]*)\s*=\s*"([^"]*)"/g;function kV(e,t,r,n){let i=e.toLowerCase();if(i==="g")return t;let a=i==="image"||i==="foreignobject";return t.replace(IV,(o,s,l)=>{switch(s){case"stroke":return a?"":n?o:l==="none"&&(r.stroke===void 0||r.stroke==="none")?"":o;case"fill":return a?"":o;case"stroke-width":return a?"":n?o:Jv(l)&&(r.strokeWidth===void 0||Jv(r.strokeWidth))?"":o;case"stroke-opacity":case"fill-opacity":return o;case"x":case"y":return xV.has(i)&&Qv(l)?"":o;case"font-weight":return n?o:eb(l)&&eb(r.fontWeight)?"":o;case"font-style":return n?o:l==="normal"&&(r.fontStyle===void 0||r.fontStyle==="normal")?"":o;case"text-anchor":return n?o:l==="start"&&(r.textAnchor===void 0||r.textAnchor==="start")?"":o;case"font-family":return n?o:l===Zv&&(r.fontFamily===void 0||r.fontFamily===Zv)?"":o;case"orient":return i==="marker"&&Qv(l)?"":o;case"markerUnits":return i==="marker"&&l==="strokeWidth"?"":o;default:return o}})}function ua(e,t,r=!1){if(e.length===0)return e;let n=/<(\/?)([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g,i="",a=0,o;for(;(o=n.exec(e))!==null;){let[s,l,u,d,c]=o;if(i+=e.slice(a,o.index),a=o.index+s.length,l==="/"){t.length>1&&t.pop(),i+=s;continue}let f=t[t.length-1],p=kV(u,d,f,r);if(i+=`<${u}${p}${c}>`,c!=="/"){let h={...f};d.replace(Jh,(m,g,v)=>{let b=wV.get(g);return b&&(h[b]=v),m}),t.push(h)}}return i+=e.slice(a),i}function SV(e){let t={...e.defs,entries:e.defs.entries.map(a=>({...a,markup:ua(a.markup,[{}],!0)}))},r=ua(e.envelope.rootDefinitions,[{}],!0),n=[{}],i=e.body.map(a=>{if(a.kind==="shape")return{...a,markup:ua(a.markup,n)};let o=ua(a.open,n),s=a.members.map(u=>({...u,markup:ua(u.markup,n)})),l=ua(a.close,n);return{...a,open:o,members:s,close:l}});return{...e,defs:t,body:i,envelope:{...e.envelope,rootDefinitions:r}}}var $V=new Set(["xml","xmlns"]);function NV(e){let t=new Set,r=new Map,n=/<(\/)?([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/g,i=/(?:^|\s)([A-Za-z_][\w.-]*):([A-Za-z_][\w.-]*)\s*=/g,a=/(?:^|\s)xmlns:([A-Za-z_][\w.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,o=(c,f)=>{a.lastIndex=0;let p;for(;(p=a.exec(c))!==null;){let h=p[1],m=p[2]??p[3]??"";f.add(h);let g=r.get(h);g||(g=new Set,r.set(h,g)),g.add(m)}},s=(c,f)=>{i.lastIndex=0;let p;for(;(p=i.exec(c))!==null;)p[1]!=="xmlns"&&!f.has(p[1])&&t.add(p[1])},l=new Set($V);o(e.envelope.rootAttributes,l),s(e.envelope.rootAttributes,l);let u=c=>{if(c.length===0)return;let f=[new Set(l)];n.lastIndex=0;let p;for(;(p=n.exec(c))!==null;){if(p[1]){f.length>1&&f.pop();continue}let h=new Set(f[f.length-1]);o(p[3],h);let m=p[2].indexOf(":");if(m>0){let g=p[2].slice(0,m);h.has(g)||t.add(g)}s(p[3],h),p[4]||f.push(h)}};for(let c of e.defs.entries)u(c.markup);for(let c of e.body)c.kind==="shape"?u(c.markup):u(`${c.open}${c.members.map(f=>f.markup).join("")}</g>`);u(e.backgroundRect),u(e.envelope.descriptive),u(e.envelope.extensions),u(e.envelope.rootDefinitions),u(e.envelope.rootAnimations),u(e.envelope.scripts),u(e.envelope.styles);let d=[];for(let c of t){let f=r.get(c),p=(f?.size===1?[...f][0]:void 0)??oV.get(c);if(!p){yr({severity:"warning",code:"undeclarable-namespace-prefix",message:`namespace prefix "${c}:" is used by emitted markup but is neither bound to one unambiguous preserved URI nor a well-known prefix; the output is not namespace-well-formed for this prefix`});continue}d.push(` xmlns:${c}="${p}"`)}return d.length===0?e:(d.sort(),{...e,envelope:{...e.envelope,rootAttributes:e.envelope.rootAttributes+d.join("")}})}function ek(e){return e.replace(/\sdata-shape-id="[^"]*"/g,"")}function MV(e,t,r={}){let n=lV(e,t);if((r.restoreSourceIds??!0)&&(n=cV(n,t)),r.deduplicateDefs===!0&&(n=Q1(n)),r.shapeIdAttributes===!1&&(n=Xs(n,ek)),n=Xs(n,i=>i.replace(/\sdata-source-id="[^"]*"/g,"")),r.resolveFontEmbedCss&&(n=bV(n,r.resolveFontEmbedCss)),r.precision!==null){let i=WB(r.precision??t.documentMetadata?.coordinatePrecision??Yh);n=Xs(n,a=>sV(a,i))}return(r.elideInitialValues??!0)&&(n=SV(n)),n=NV(n),n}function AV(e,t){let r=new Set(Object.keys(t)),n=new Map(e.map(s=>[s.id,s])),i=s=>s.authoredId!==void 0?t[s.authoredId]:void 0,a=s=>{let l=new Set,u=s.parentId;for(;u!==null&&!l.has(u);){l.add(u);let d=n.get(u);if(!d)return!1;let c=i(d);if(c?.locked===!0&&c.inherit===!0)return!0;u=d.parentId}return!1},o=0;for(let s of e){let l=i(s),u=a(s);if(!l&&!u)continue;let d=s.state;l?.layerName!==void 0&&(d.layerName=l.layerName),(l?.locked!==void 0||u)&&(d.locked=l?.locked??u),l?.hidden!==void 0&&(d.visible=!l.hidden,l.hidden&&delete d.display),l&&(r.delete(s.authoredId),o++)}return{applied:o,unmatched:[...r]}}function CV(e,t){let r=new Map;for(let a of e.sceneTree??[])r.set(a.id,a.parentId);let n=[],i=(a,o)=>{for(let s of a??[]){let l=s.state;n.push({id:s.id,parentId:r.get(s.id)??o,authoredId:l.metadata?.name,state:l}),i(l.children,s.id)}};return i(e.shapes,null),AV(n,t)}function OV(e,t,r){return e.unmatched.map(n=>({severity:"warning",code:"foreign-structure-unmatched",source:t,entrypoint:r,message:`No imported element carries the id "${n}", so its layer name, lock or visibility was not applied.`,sourceId:n}))}function TV(e){let t=Yh;for(let r of e.index.elements)for(let n of r.attributes)if(c1(n.name,n.value)&&(t=Math.max(t,JB(n.value)),t===Co))return t;return t}function PV(e){let t={};for(let r of e.attributes)qd(r.name)&&(r.namespaceUri!==null&&r.localName.toLowerCase()==="href"||(t[r.name]=r.value));return t}function DV(e){let t={};for(let r of e.attributes)Yd(r.name)&&(t[r.name]=r.value);return t}var tb=new WeakMap,rb=new WeakMap,nb=new WeakMap,jV=new Set(["clippath","defs","filter","lineargradient","marker","mask","pattern","radialgradient","symbol","view"]);function ib(e,t){let r=e.useOccurrences.occurrence(t);if(!r)return"";let n=e.sourceDocument.index.element(r.correspondingSourceNodeId);return n?j(n,"class")??"":""}function EV(e,t){let r=nb.get(e);if(!r){let n=new Map;for(let i of e.animations.smil){let a=i.targetOccurrenceId;if(!a||i.attributeName?.trim().toLowerCase()!=="class")continue;let o=[i.attributes.from,i.attributes.to,...i.attributes.values?.split(";")??[]].filter(l=>l!==void 0).map(l=>l.trim()).filter(Boolean);if(o.length===0)continue;let s=e.styles.style(a)?.stylesheetCascadedValues??{};for(let l of o){let u=e.styles.stylesheetValuesWithClass(a,l);for(let d of new Set([...Object.keys(s),...Object.keys(u)])){if(!ul(d)||s[d]?.value===u[d])continue;let c=n.get(a)??new Set;c.add(d),n.set(a,c)}}}r=new Map([...n].map(([i,a])=>[i,new Set(a)])),nb.set(e,r)}return r.get(t)??new Set}function zV(e){let t=tb.get(e);if(t)return t;let r=new Set(e.hierarchy.containers.map(n=>n.occurrenceId));return tb.set(e,r),r}function ab(e){let t=rb.get(e);if(t)return t;let r=new Set(zV(e));for(let n of e.symbolUses.definitions)r.add(n.productRootOccurrenceId);for(let n of e.symbolUses.uses)n.status==="symbol-instance"&&r.add(n.useOccurrenceId);return rb.set(e,r),r}function Zu(e,t){for(let r of e){let n=r.state;typeof n.symbolId=="string"&&(n.symbolId=t.get(n.symbolId)??n.symbolId);let i=n.children;Array.isArray(i)&&Zu(i,t)}}function RV(e,t){let r=[...e];for(;;){let n=new Map,i=new Map;for(let a of r){if(a.kind!=="symbol")continue;let o=hV(a,r),s=`${a.sourceId??a.id}\0${o}`,l=n.get(s);l?i.set(a.id,l):n.set(s,a.id)}if(i.size===0)return r;Zu(t,i),r=r.map(a=>{if(a.kind!=="symbol")return a;Zu(a.shapes,i);for(let o of Object.values(a.variants??{}))Zu(o,i);return a.definitionContentOrder===void 0?a:{...a,definitionContentOrder:a.definitionContentOrder.map(o=>o.kind==="definition"?{...o,id:i.get(o.id)??o.id}:o)}}).filter(a=>a.kind!=="symbol"||!i.has(a.id))}}var _V=new Set(["height","href","id","download","dx","dy","hreflang","ping","preserveaspectratio","referrerpolicy","rel","rotate","requiredextensions","systemlanguage","target","transform","type","viewbox","width","x","xlink:href","y"]),tk=new Set(["color","color-interpolation","color-rendering","display","fill","fill-opacity","fill-rule","filter","marker","marker-end","marker-mid","marker-start","mask","mix-blend-mode","opacity","paint-order","pointer-events","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","image-rendering","transform-origin","isolation","vector-effect","visibility"]),FV=new Set([...tk,"mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","mix-blend-mode"]);function Ju(e){if(e===null)return;let t=e.trim();if(!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:px)?$/u.test(t))return;let r=Number(t.replace(/px$/iu,""));return Number.isFinite(r)?r:void 0}function Ms(e){if(e===null)return;let t=e.trim(),r=/^([+-]?(?:\d+(?:\.\d*)?|\.\d+))%$/u.exec(t),n=r?Number(r[1])/100:Ju(t);return n===void 0?void 0:Math.min(1,Math.max(0,n))}function As(e,t,r="auto"){if(e===null)return;let n=t.find(i=>i.toLowerCase()===e.trim().toLowerCase());return!n||n===r?void 0:n}function LV(e){if(e===null)return;let t=e.trim();if(!t||t.toLowerCase()==="none")return;if(/(?:^|[^-_a-z0-9])var\(/iu.test(t))return t;let r=Ed(t),n=t.replace(/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:px|pt|pc|in|cm|mm|q|em|rem|%|ex|ch|vw|vh|vmin|vmax)?/giu,"").replace(/[\s,]+/gu,"");if(!(r.length===0||n||r.some(i=>i.value<0))&&!r.every(i=>i.value===0))return t}function rk(e,t){let r=Math.max(e.length,t.length);for(let n=0;n<r;n++){let i=(e[n]??-1)-(t[n]??-1);if(i!==0)return i}return 0}function nk(e){let t=new Map(e.useOccurrences.occurrences.map(r=>[r.occurrenceId,r]));return[...new Set([...e.hierarchy.containers.map(r=>r.occurrenceId),...e.hierarchy.placements.map(r=>r.occurrenceId)])].map(r=>t.get(r)).filter(r=>r!==void 0).sort((r,n)=>rk(r.orderKey,n.orderKey)||r.productIndex-n.productIndex||r.occurrenceId.localeCompare(n.occurrenceId))}function BV(e){let t=new Set;for(let r of e.symbolUses.definitions){t.add(r.productRootOccurrenceId);for(let n of r.contentOccurrenceIds)t.add(n)}return t}function VV(e){let t=BV(e),r=new Map(e.useOccurrences.occurrences.map(d=>[d.occurrenceId,d])),n=d=>{if(d.usePath.length>0)return!1;let c=new Set,f=d.parentOccurrenceId;for(;f&&!c.has(f);){c.add(f);let p=r.get(f);if(!p)return!1;if(p.role==="definition")return!0;f=p.parentOccurrenceId}return!1},i=new Set;for(let d of e.clipMasks.definitions)if(d.representation==="decomposed")for(let c of d.geometrySourceNodeIds)i.add(c);let a=new Set(["clippath","filter","lineargradient","marker","mask","pattern","radialgradient"]),o=new Map,s=new Map(e.useOccurrences.occurrences.map(d=>[d.occurrenceId,d]));for(let d of e.useOccurrences.occurrences){if(!d.parentOccurrenceId)continue;let c=o.get(d.parentOccurrenceId)??[];c.push(d),o.set(d.parentOccurrenceId,c)}let l=new Set;for(let d of e.symbolUses.uses){if(!["symbol-instance","linked-reference"].includes(d.status))continue;let c=[...o.get(d.useOccurrenceId)??[]];for(;c.length>0;){let f=c.pop();l.has(f.occurrenceId)||(l.add(f.occurrenceId),c.push(...o.get(f.occurrenceId)??[]))}}let u=new Set;for(let d of e.useOccurrences.occurrences){let c=d,f=new Set;for(;c&&!f.has(c.occurrenceId);){f.add(c.occurrenceId);let p=e.sourceDocument.index.element(c.correspondingSourceNodeId);if(p&&a.has(p.localName.toLowerCase())){u.add(d.occurrenceId);break}c=c.parentOccurrenceId?s.get(c.parentOccurrenceId):void 0}}return nk(e).filter(d=>!t.has(d.occurrenceId)&&!n(d)&&!(d.usePath.length===0&&i.has(d.correspondingSourceNodeId))&&!l.has(d.occurrenceId)&&!u.has(d.occurrenceId))}function un(e,t){return t.replace(/url\(\s*(['"]?)#([^'")\s]+)\1\s*\)/gu,(r,n,i)=>{let a=e.identifiers.liveIdForSourceId(i);return a?`url(${n}#${a}${n})`:r})}function UV(e,t,r,n=!1){let i=e.metadata.candidate(t.correspondingSourceNodeId)?.metadata;if(!i||Object.keys(i).length===0)return;let a=structuredClone(i),o=e.identifiers.liveIdForSourceNodeId(t.correspondingSourceNodeId);if(o&&typeof a.name=="string"&&(a.name=o),typeof a.name=="string"&&t.usePath.length>0&&!n){let s=(r.get(a.name)??0)+1;r.set(a.name,s),a.name=`${a.name}-use-${s}`}return a}function GV(e,t){let r=e.scripts.forParent(t).map(n=>({...n.script,customAttrs:n.script.customAttrs?{...n.script.customAttrs}:void 0}));return r.length>0?r:void 0}function WV(e,t,r=!1){let n={};for(let i of e.authoredAttributes.forElement(t)){let a=i.name.toLowerCase();if(i.classification==="style"){r&&(n[i.name]=un(e,i.value));continue}["namespace","metadata","aria","data","conditional","geometry","element-specific","foreign"].includes(i.classification)||i.classification==="presentation"&&FV.has(a)&&a!=="color"||_V.has(a)||(n[i.name]=un(e,i.value))}return n}function ik(e,t){let r=e.styles.style(t),n=x=>{let k=x.toLowerCase();return r?.specifiedValues[k]??r?.resolvedValues[k]??null},i={},a=n("fill"),o=n("stroke"),s=e.useOccurrences.occurrence(t),l=s?.parentOccurrenceId?e.styles.style(s.parentOccurrenceId):null,u=r?.cascadedValues.fill!==void 0,d=r?.cascadedValues.stroke!==void 0;a!==null&&(i.fillColor=a==="black"&&r?.cascadedValues.fill===void 0?"#000000":un(e,a),a.trim().toLowerCase()==="none"&&(i.fillType="none")),o!==null&&o.trim().toLowerCase()!=="none"?i.borderColor=un(e,o):(i.borderColor="none",i.strokeType="none"),!u&&l&&l.resolvedValues.fill!==void 0&&l.resolvedValues.fill===r?.resolvedValues.fill&&(delete i.fillColor,delete i.fillType,i.inheritFill=!0),!d&&l&&l.resolvedValues.stroke!==void 0&&l.resolvedValues.stroke===r?.resolvedValues.stroke&&(delete i.borderColor,delete i.strokeType,i.inheritStroke=!0);let c=[["fillOpacity","fill-opacity",Ms],["strokeOpacity","stroke-opacity",Ms],["opacity","opacity",Ms],["borderWidth","stroke-width",Ju],["strokeMiterlimit","stroke-miterlimit",Ju],["dashOffset","stroke-dashoffset",Ju],["fillRule","fill-rule",x=>x??void 0],["strokeLinecap","stroke-linecap",x=>x??void 0],["strokeLinejoin","stroke-linejoin",x=>x??void 0],["strokeDasharray","stroke-dasharray",LV],["paintOrder","paint-order",x=>x??void 0],["vectorEffect","vector-effect",x=>x??void 0],["blendMode","mix-blend-mode",x=>x??void 0],["shapeRendering","shape-rendering",x=>As(x,["auto","optimizeSpeed","crispEdges","geometricPrecision"])],["textRendering","text-rendering",x=>As(x,["auto","optimizeSpeed","optimizeLegibility","geometricPrecision"])],["imageRendering","image-rendering",x=>As(x,["auto","optimizeSpeed","optimizeQuality","crisp-edges","pixelated","smooth","high-quality"])],["colorRendering","color-rendering",x=>As(x,["auto","optimizeSpeed","optimizeQuality"])],["colorInterpolation","color-interpolation",x=>As(x,["auto","sRGB","linearRGB"],"sRGB")]];for(let[x,k,$]of c){let A=r?.cascadedValues[k];if(!A&&el(k)?.inherited===!0&&l!==null&&s?.parentOccurrenceId!==null&&s?.parentOccurrenceId!==void 0&&ab(e).has(s.parentOccurrenceId)&&l.resolvedValues[k]===r?.resolvedValues[k]||!A&&["fill-opacity","stroke-opacity","stroke-width","opacity","stroke-miterlimit","stroke-dashoffset","fill-rule","stroke-linecap","stroke-linejoin","stroke-dasharray","paint-order","vector-effect","mix-blend-mode"].includes(k))continue;let S=$(n(k));S!==void 0&&(x==="paintOrder"&&S==="normal"||(i[x]=S))}i.opacity===1&&r?.cascadedValues.opacity!==void 0&&(i.preserveOpacity=!0);let f=Ms(l?.resolvedValues["fill-opacity"]??null);i.fillOpacity===1&&r?.cascadedValues["fill-opacity"]!==void 0&&f!==void 0&&f!==1&&(i.preserveFillOpacity=!0);let p=Ms(l?.resolvedValues["stroke-opacity"]??null);if(i.strokeOpacity===1&&r?.cascadedValues["stroke-opacity"]!==void 0&&p!==void 0&&p!==1&&(i.preserveStrokeOpacity=!0),i.inheritFill===!0&&r?.cascadedValues["fill-opacity"]===void 0&&delete i.fillOpacity,i.inheritStroke===!0)for(let[x,k]of[["stroke-opacity","strokeOpacity"],["stroke-width","borderWidth"],["stroke-miterlimit","strokeMiterlimit"],["stroke-dashoffset","dashOffset"],["stroke-linecap","strokeLinecap"],["stroke-linejoin","strokeLinejoin"],["stroke-dasharray","strokeDasharray"]])r?.cascadedValues[x]===void 0&&delete i[k];n("display")?.trim().toLowerCase()==="none"&&(i.display="none");let h=n("visibility")?.trim(),m=r?.cascadedValues.visibility?.value?.trim().toLowerCase();!(l!==null&&s?.parentOccurrenceId!==null&&s?.parentOccurrenceId!==void 0&&ab(e).has(s.parentOccurrenceId)&&l.resolvedValues.visibility===r?.resolvedValues.visibility&&(m===void 0||m==="inherit"||m==="unset"))&&(h==="hidden"||h==="collapse")&&(i.visibility=h);let g=r?.cascadedValues["clip-path"]?.value??null;g&&!/^url\(/iu.test(g.trim())&&(i.cssClipPath=g);let v={};for(let x of["mask","mask-image","mask-mode","mask-repeat","mask-position","mask-clip","mask-origin","mask-size","mask-composite","mask-type"]){let k=r?.cascadedValues[x]?.value??null;k!==null&&(v[x]=un(e,k))}Object.keys(v).length>0&&(i.cssMaskProperties=v);let b=Object.fromEntries(Object.entries(r?.inlineDeclarations??{}).filter(([x])=>x.startsWith("--")||x.startsWith("-")||oh(x)).map(([x,k])=>[x,k]));Object.keys(b).length>0&&(i.inlineStyle=b);let y={},I=EV(e,t);for(let[x,k]of Object.entries(r?.cascadedValues??{}))ul(x)&&(I.has(x)?y[x]="stylesheet-dynamic":k.origin==="presentation"?y[x]="attribute":k.origin==="style-attribute"?y[x]="style":k.origin==="stylesheet"&&(y[x]="stylesheet-static"));Object.keys(y).length>0&&(i.presentationChannels=y);for(let[x,k]of[["marker-start","markerStart"],["marker-mid","markerMid"],["marker-end","markerEnd"]]){let $=n(x);if(!$)continue;let A=e.resourceDependencies.edges.filter(M=>M.kind==="marker"&&M.propertyName===x&&M.propertyValue===$&&(M.occurrenceId!==null&&M.occurrenceId===t||M.occurrenceId===null&&M.fromSourceNodeId===r?.correspondingSourceNodeId));if(A.length>0){let M=A[0];if(M.validity!=="valid"||!M.targetSourceNodeId)continue;let T=e.markers.candidate(M.targetSourceNodeId);if(!T||T.status!=="materialized")continue;i[k]=Dr(e,T.sourceNodeId,T.sourceId)??void 0;continue}let S=/url\(\s*(['"]?)#([^'"\s)]+)\1\s*\)/u.exec($)?.[2];S&&(i[k]=e.identifiers.liveIdForSourceId(S)??S)}return i}function eh(e,t){let r={},n=e.styles.style(t);if(!n)return r;for(let[i,a]of Object.entries(n.cascadedValues))tk.has(i)&&(r[i]=un(e,a.value));return r}function XV(e,t){let r=e.symbolUses.use(t.occurrenceId);if(t.role==="use-carrier"&&r){let s=r.transform.matrix??[1,0,0,1,0,0],l=Re(s,Yt(r.geometry.x,r.geometry.y));return dn(l)?void 0:Zr(l)}let n=e.sourceDocument.index.element(t.correspondingSourceNodeId);if(!n)return;let i=e.styles.style(t.occurrenceId)?.cascadedValues.transform,a=i?.value??j(n,"transform");if(!a||a.trim().toLowerCase()==="none"||i&&i.origin!=="presentation")return;let o=_i(a);return o&&!dn(o)?Zr(o):void 0}function ak(e,t,r,n){let i=r.get(t)?.parentOccurrenceId??null;for(;i;){let o=n.get(i);if(o?.type==="svg"){let s=o.state;if(typeof s.svgViewBoxWidth=="number"&&typeof s.svgViewBoxHeight=="number"&&s.svgViewBoxWidth>0&&s.svgViewBoxHeight>0)return{x:typeof s.svgViewBoxX=="number"?s.svgViewBoxX:0,y:typeof s.svgViewBoxY=="number"?s.svgViewBoxY:0,width:s.svgViewBoxWidth,height:s.svgViewBoxHeight};if(typeof s.svgWidth=="number"&&typeof s.svgHeight=="number"&&s.svgWidth>=0&&s.svgHeight>=0)return{x:0,y:0,width:s.svgWidth,height:s.svgHeight}}i=r.get(i)?.parentOccurrenceId??null}let a=e.rootFrame;return{x:a.viewBoxX??0,y:a.viewBoxY??0,width:a.viewBoxWidth??a.width??300,height:a.viewBoxHeight??a.height??150}}function ok(e,t,r,n){if(t==="view-box")return{boxX:r.x,boxY:r.y,boxWidth:r.width,boxHeight:r.height};if(t!=="fill-box"&&t!=="content-box"&&t!=="stroke-box"&&t!=="border-box")return null;let i=Hh(n,e).bounds;if(!i)return null;let a=t==="stroke-box"||t==="border-box",o=Number(e.state.borderWidth??0),s=a&&Number.isFinite(o)&&o>0?o/2:0;return{boxX:i.minX-s,boxY:i.minY-s,boxWidth:i.maxX-i.minX+s*2,boxHeight:i.maxY-i.minY+s*2}}function HV(e,t,r,n,i){for(let a of[...t].reverse()){let o=n.get(a.occurrenceId);if(!o)continue;let s=e.styles.style(a.occurrenceId);if(!s)continue;let l=s?.cascadedValues.transform,u=s.cascadedValues["transform-origin"];if((!l||l.origin==="presentation")&&!u)continue;let d=e.sourceDocument.index.element(a.correspondingSourceNodeId),c=(l?.value??(d?j(d,"transform"):null))?.trim(),f=ak(e,a.occurrenceId,r,n),p=e.styles.value(a.occurrenceId,"transform-box")??"view-box",h=ok(o,p,f,i);if(!h)continue;let m=e.projectionContext.rootFontSize,g=at(e.styles.value(a.occurrenceId,"font-size"),{percentBasis:m,viewportWidth:f.width,viewportHeight:f.height,fontSize:m,rootFontSize:m})??m,v=u?px(e.styles.value(a.occurrenceId,"transform-origin")??"0 0",{...h,viewportWidth:f.width,viewportHeight:f.height,fontSize:g,rootFontSize:m}):{x:0,y:0};if(!v)continue;if(u&&(o.state.customPivot=v),!c||c.toLowerCase()==="none"){delete o.state.transformMatrix;continue}let b;if(!l||l.origin==="presentation"){let x=_i(c);if(!x)continue;if(o.type==="group"){let k=o.state.groupData??={};k.transform=c,o.state.customPivot=v,delete o.state.transformMatrix;continue}b=Re(Yt(v.x,v.y),Re(x,Yt(-v.x,-v.y)))}else{let x=gx([{offset:0,transform:c}],{...h,viewportWidth:f.width,viewportHeight:f.height,fontSize:g,rootFontSize:m,transformOrigin:v,retainPureRotationOrigin:!1});if(x.status!=="projected"||x.stops.length!==1)continue;b=x.stops[0].matrix}dn(b)?delete o.state.transformMatrix:o.state.transformMatrix=Zr(b);let y=o.state.groupData;y&&"transformOrigin"in y&&(delete y.transformOrigin,Object.keys(y).length===0&&delete o.state.groupData);let I=o.state.containerPresentation;I&&"transform-origin"in I&&(delete I["transform-origin"],Object.keys(I).length===0&&delete o.state.containerPresentation)}}function Rn(e,t,r,n=!1,i=!1){let a=ik(e,t.occurrenceId),o=UV(e,t,r,i),s=t.usePath.length===0?e.metadata.candidate(t.correspondingSourceNodeId)?.leadingComments:void 0,l=GV(e,t.correspondingSourceNodeId),u=WV(e,t.correspondingSourceNodeId,n),d=e.conditionalProcessing.condition(t.correspondingSourceNodeId),c=XV(e,t);return o&&(a.metadata=o),s&&s.length>0&&(a.leadingComments=[...s]),l&&(a.scripts=l),Object.keys(u).length>0&&(a.authoredAttributes=u),d&&d.systemLanguage!==null&&(a.systemLanguage=d.systemLanguage),d&&d.requiredExtensions!==null&&(a.requiredExtensions=d.requiredExtensions),c&&(a.transformMatrix=c),a}function Lu(e,t,r,n,i=!1){let a=Rn(e,t,n,!1,i),o=eh(e,t.occurrenceId);if(Object.keys(o).length>0)if(r==="group"){let l={},u={};for(let[d,c]of Object.entries(o))d==="fill"?l.fill=c:d==="fill-opacity"?l.fillOpacity=c:d==="stroke-opacity"?l.strokeOpacity=c:d==="opacity"?l.opacity=c:d==="mix-blend-mode"?l.mixBlendMode=c:d==="transform-origin"?l.transformOrigin=c:d==="isolation"?l.isolation=c:d==="filter"?l.filter=c:d==="clip-path"?l.clipPath=c:d==="mask"?l.mask=c:u[d]=c;Object.keys(u).length>0&&(l.attributes=u),a.groupData=l}else a.containerPresentation=o;let s=e.sourceDocument.index.element(t.correspondingSourceNodeId);if(!s)return a;if(r==="hyperlink"){let l=j(s,"href"),u=s.attributes.find(c=>c.name==="xlink:href")?.value,d=c=>{if(!c.startsWith("#"))return c;let f=e.identifiers.liveIdForSourceId(c.slice(1));return f?`#${f}`:c};l!==null?a.href=d(l):u!==void 0&&(a.href=d(u)),u!==void 0&&(a.hrefXlink=d(u));for(let[c,f]of[["target","linkTarget"],["download","linkDownload"],["ping","linkPing"],["rel","linkRel"],["hreflang","linkHreflang"],["type","linkType"],["referrerpolicy","linkReferrerPolicy"]]){let p=j(s,c);p!==null&&(a[f]=p)}}else if(r==="switch"){let l=e.conditionalProcessing.condition(s.sourceNodeId);l&&(a.switchSystemLanguage=l.systemLanguage,a.switchRequiredExtensions=l.requiredExtensions)}else if(r==="embedded-svg"){let l=e.embeddedFrames.find(u=>u.sourceNodeId===s.sourceNodeId);l&&Object.assign(a,l.state)}return a}function sp(e){return e==="embedded-svg"?"svg":e}function ei(e,t){let r=e.sourceDocument.index.parent(t);if(!r)return;let n=0;for(let i of r.children)if(i.kind==="element"){if(i.sourceNodeId===t)return n;n++}}function sk(e){return e.sourceDocument.index.elements.filter(t=>t.namespaceUri===ye&&t.localName.toLowerCase()==="defs")}function ti(e,t){let r=e.sourceDocument.index.parent(t);for(;r;){if(r.namespaceUri===ye&&r.localName.toLowerCase()==="defs"){let n=sk(e).findIndex(i=>i.sourceNodeId===r.sourceNodeId);return n>=0?`svg-definition-container-${n+1}`:void 0}if(e.symbolUses.definitions.some(n=>n.sourceNodeId===r.sourceNodeId)||e.markers.candidates.some(n=>n.sourceNodeId===r.sourceNodeId))return;r=e.sourceDocument.index.parent(r.sourceNodeId)}}function qV(e,t,r,n,i){return sk(e).map((a,o)=>{let s=ai(e,a.sourceNodeId),l=V_(a,e.identifiers).filter(d=>!(d.localName==="id"&&d.namespaceUri===null)),u=em(e,a.sourceNodeId,t,r,n,i);return{id:`svg-definition-container-${o+1}`,...s?{svgId:s}:{},order:o,...l.length>0?{attributes:[...l]}:{},...u?{authoredPlacement:u}:{}}})}function em(e,t,r,n,i,a){let o=e.sourceDocument.index.parent(t);if(!o||o.sourceNodeId===e.sourceDocument.root.sourceNodeId||o.namespaceUri===ye&&o.localName.toLowerCase()==="defs")return null;let s=a?.get(o.sourceNodeId),l=s??r.get(o.sourceNodeId);if(!l)return null;let u=0;for(let d of o.children)if(d.kind==="element"){if(d.sourceNodeId===t){let c=s??i?.get(l);return{parentId:l,...c?{parentDefinitionId:c}:{},siblingIndex:u}}(r.has(d.sourceNodeId)||n.has(d.sourceNodeId))&&u++}return null}function YV(e,t,r){let n=e.sourceDocument.index.parent(t);for(;n&&n.sourceNodeId!==e.sourceDocument.root.sourceNodeId;){let i=r.get(n.sourceNodeId);if(i)return i;if(n.localName.toLowerCase()==="defs")return;n=e.sourceDocument.index.parent(n.sourceNodeId)}}function KV(e,t,r,n,i){let a=e.styles.stylesheets.map((o,s)=>{let l=e.sourceDocument.index.element(o.sourceNodeId),u=YV(e,o.sourceNodeId,t),d=u?null:em(e,o.sourceNodeId,r,n,i,t);return{id:`svg-style-${s+1}`,placement:o.placement,...o.placement==="defs"&&l?{definitionOrder:ei(e,l.sourceNodeId),definitionContainerId:ti(e,l.sourceNodeId)}:{},...u?{scopeDefinitionId:u}:{},...d?{authoredPlacement:d}:{},...o.id?{svgId:o.id}:{},css:o.authoredText,...o.type?{type:o.type}:{},...o.media?{media:o.media}:{},preserved:!0}});return a.length>0?a:void 0}function ZV(e){return{severity:"error",code:"application-rolled-back",source:"svg",entrypoint:"svg-document-import",capability:"geometry",message:e}}function Dr(e,t,r){return e.identifiers.resourceIds.find(n=>n.sourceNodeId===t)?.liveId??r}function ai(e,t){return e.identifiers.liveIdForSourceNodeId(t)??e.identifiers.generatedIds.find(r=>r.sourceNodeId===t)?.liveId??null}function ob(e,t){let r=e.resourceDependencies.templateChain(t)[0];if(r)return r.targetSourceNodeId?ai(e,r.targetSourceNodeId)??r.targetAuthoredId:r.targetAuthoredId}function JV(e,t,r){let n=e.sourceDocument.index.parent(t);for(;n;){if(n.sourceNodeId===r)return!0;n=e.sourceDocument.index.parent(n.sourceNodeId)}return!1}function sb(e,t){let r=ai(e,t.sourceNodeId);return{...r?{id:r}:{},offset:t.offset,color:t.color,opacity:t.opacity}}function js(e,t){let r=structuredClone(t.state);if(t.canonicalType==="foreign-object"){let a=e.sourceDocument.index.element(t.sourceNodeId);r.foreignContent=structuredClone(SI(a?.children??[],e.identifiers))}Array.isArray(r.linePositions)&&(r.linePositions=r.linePositions.map(a=>{let o=a,s=typeof o.sourceNodeId=="string"?o.sourceNodeId:null,l=s?ai(e,s):null;return{x:typeof o.x=="number"?o.x:0,dy:typeof o.dy=="number"?o.dy:0,...typeof o.y=="number"?{y:o.y}:{},...o.authored&&typeof o.authored=="object"?{authored:structuredClone(o.authored)}:{},...l?{id:l}:{}}}));let n=t.textSpanTree;if(!n)return r;let i=a=>{let o=ai(e,a.sourceNodeId);return{spanId:a.sourceNodeId,start:a.start,end:a.end,...o?{id:o}:{},...a.lineIndex===void 0?{}:{lineIndex:a.lineIndex},...a.rotate===void 0?{}:{rotate:[...a.rotate]},children:a.children.map(i)}};return r.textSpanTree={text:n.text,...n.rotate===void 0?{}:{rotate:[...n.rotate]},spans:n.spans.map(i)},r}function lb(e,t){if(!t||t.status!=="missing")return null;let r=e.useOccurrences.sourceResolution(t.useSourceNodeId);return r?.sourceReferenceId?e.sourceDocument.index.localReferences.find(n=>n.sourceReferenceId===r.sourceReferenceId)?.targetAuthoredId??null:null}function ub(e,t,r,n,i,a=!1){let o=Rn(e,t,i,!1,a);return o.targetShapeId=n,o.broken=!0,o.offsetX=r.geometry.x,o.offsetY=r.geometry.y,r.geometry.width!==null&&(o.width=r.geometry.width),r.geometry.height!==null&&(o.height=r.geometry.height),Object.keys(r.presentation).length>0&&(o.instancePresentation={...r.presentation}),r.transform.matrix&&!dn(r.transform.matrix)?o.transformMatrix=Zr(r.transform.matrix):delete o.transformMatrix,o}function db(e){let t=e?.rawXml??"",r=t.indexOf(">"),n=t.lastIndexOf("</");return r>=0&&n>r?t.slice(r+1,n):""}function lk(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function cb(e){return lk(e).replaceAll('"',"&quot;")}function fb(e,t){let r=new Map(t.map(s=>[s.occurrenceId,s])),n=new Map;for(let s of t){if(!s.parentOccurrenceId||!r.has(s.parentOccurrenceId))continue;let l=n.get(s.parentOccurrenceId)??[];l.push(s),n.set(s.parentOccurrenceId,l)}let i=(s,l,u=new Set)=>{let d=[];for(let c of s.attributes){let f=c.name.toLowerCase();if(f.startsWith("xmlns")||/^on[a-z]/u.test(f)||u.has(f)||f==="id"&&l.shadow)continue;let p=f==="id"?Dr(e,s.sourceNodeId,c.value)??c.value:un(e,c.value);d.push(`${c.name}="${cb(p)}"`)}return d.length>0?` ${d.join(" ")}`:""},a=s=>s.children.filter(l=>l.kind!=="element").map(l=>l.kind==="comment"?`<!--${l.value}-->`:l.kind==="cdata"?`<![CDATA[${l.value.replaceAll("]]>","]]]]><![CDATA[>")}]]>`:l.kind==="processing-instruction"?`<?${l.value}?>`:l.kind==="doctype"?`<!DOCTYPE ${l.value}>`:lk(l.value)).join(""),o=s=>{let l=e.sourceDocument.index.element(s.correspondingSourceNodeId);if(!l)return"";let u=(n.get(s.occurrenceId)??[]).map(o).join("");if(l.localName.toLowerCase()==="use"){let c=new Set(["href","xlink:href","x","y","width","height","transform","id"]),f=e.symbolUses.use(s.sourceOccurrenceId),p=[];f?.transform.authored&&p.push(f.transform.authored);let h=f?.geometry.x??0,m=f?.geometry.y??0;(h!==0||m!==0)&&p.push(`translate(${h} ${m})`);let g=p.length>0?` transform="${cb(p.join(" "))}"`:"";return`<g${i(l,s,c)}${g}>${u}</g>`}let d=u||a(l);return`<${l.name}${i(l,s)}>${d}</${l.name}>`};return t.filter(s=>s.parentOccurrenceId===null||!r.has(s.parentOccurrenceId)).map(o).join("")}function Io(e,t){let r=a=>{let o=e.useOccurrences.direct(a.sourceNodeId);return o?e.styles.value(o.occurrenceId,"display"):j(a,"display")},n=e.sourceDocument.index.element(t);if(!n)return!1;if(r(n)?.trim().toLowerCase()==="none")return!0;let i=e.sourceDocument.index.parent(t);for(;i;){if(i.localName.toLowerCase()==="defs"&&r(i)?.trim().toLowerCase()==="none")return!0;i=e.sourceDocument.index.parent(i.sourceNodeId)}return!1}function QV(e){let t=e.indexOf(">");if(t<0)return e;let r=e.slice(0,t);return/\bdisplay\s*=/iu.test(r)?e:e.replace(/^(\s*<[\w:.-]+)/u,'$1 display="none"')}function lp(e,t,r){let n=r.kind==="color"?r.value??"none":"none";t==="fill"?(e.fillType=r.kind==="color"?"solid":"none",e.fillColor=n):(e.strokeType=r.kind==="color"?"solid":"none",e.borderColor=n)}function up(e,t){t==="fill"?(e.fillType="none",e.fillColor="none",delete e.fillGradient,delete e.fillLibraryId):(e.strokeType="none",e.borderColor="none",delete e.strokeGradient,delete e.strokeLibraryId)}function pb(e,t,r,n,i){let a=r==="fill"?"authoredFillPaint":"authoredStrokePaint";t[a]={value:un(e,n),resolution:i?"invalid-target":"missing"}}function hb(e,t){return e.resourceDependencies.edges.find(r=>r.resourceReferenceId===t)?.targetSourceNodeId??null}function mb(e,t,r){return e.styles.style(t)?.cascadedValues[r]?.origin==="presentation"}function gb(e,t){delete e[t==="fill"?"authoredFillPaint":"authoredStrokePaint"]}function eU(e,t,r){let n=[...t.library??[]],i=new Set,a=new Map,o=new Map,s={width:e.rootFrame.viewBoxWidth??e.rootFrame.width??300,height:e.rootFrame.viewBoxHeight??e.rootFrame.height??150},l=xa(t),u=new Map;for(let f of e.gradients.candidates){let p=Dr(e,f.sourceNodeId,f.sourceId);p&&u.set(f.sourceNodeId,p)}for(let f of e.gradients.candidates){let p=u.get(f.sourceNodeId);if(!p)continue;let h=e.sourceDocument.index.element(f.sourceNodeId);if(!h)continue;let m=Ww(f,{viewport:s,fontSize:16,rootFontSize:16}),g=Object.fromEntries(Object.entries(f.geometryValues).filter(([,M])=>M.ownerSourceNodeId===f.sourceNodeId&&M.validity==="valid").map(([M,T])=>[M,T.raw])),v=f.stops.filter(M=>e.sourceDocument.index.parent(M.sourceNodeId)?.sourceNodeId===f.sourceNodeId).map(M=>sb(e,M)),b=ob(e,f.sourceNodeId),y=j(h,"gradientUnits"),I=j(h,"spreadMethod"),x=e.styles.style(f.occurrenceId)?.cascadedValues["color-interpolation"],k=PV(h),$={...b?{templateId:b}:{},stops:v,...Object.keys(k).length>0?{rootAttributes:k}:{},...y==="userSpaceOnUse"||y==="objectBoundingBox"?{gradientUnits:f.gradientUnits}:{},...I==="pad"||I==="reflect"||I==="repeat"?{spreadMethod:f.spreadMethod}:{},...x&&["auto","sRGB","linearRGB"].includes(f.colorInterpolation)?{colorInterpolation:f.colorInterpolation}:{},...Object.keys(g).length>0?{authoredGeometry:g}:{},...f.transform.authored?.ownerSourceNodeId===f.sourceNodeId&&f.transform.authored.validity==="valid"?{gradientTransform:[...f.transform.matrix]}:{}},A;if(f.type==="linear-gradient")A={type:"linear-gradient",...$,...Object.fromEntries(["x1","y1","x2","y2"].flatMap(M=>f.geometryValues[M]?.ownerSourceNodeId===f.sourceNodeId?[[M,m[M]]]:[]))};else{let M=Object.fromEntries(["cx","cy","fx","fy","r","fr"].flatMap(T=>f.geometryValues[T]?.ownerSourceNodeId===f.sourceNodeId?[[T,m[T]]]:[]));A={type:"radial-gradient",...$,...M,...M.r!==void 0?{ry:M.r,rotation:0}:{}}}let S=e.metadata.candidate(f.sourceNodeId)?.metadata;a.set(p,{kind:f.type,id:p,name:f.sourceId??p,...f.sourceId?{sourceId:f.sourceId}:{},...f.definitionPlacement==="document"?{definitionPlacement:"document"}:{},definitionOrder:ei(e,f.sourceNodeId),definitionContainerId:ti(e,f.sourceNodeId),...S&&Object.keys(S).length>0?{metadata:structuredClone(S)}:{},gradient:A}),i.add(p)}for(let f of e.gradients.bindings){let p=r.get(f.occurrenceId);if(!p)continue;let h=p.state,m=f.propertyName==="fill"?"fill":"stroke";if(m==="fill"&&h.inheritFill===!0||m==="stroke"&&h.inheritStroke===!0)continue;if(f.status!=="materialized"||!f.gradientSourceNodeId||Io(e,f.gradientSourceNodeId)){let $=hb(e,f.resourceReferenceId),A=$?e.patterns.candidate($)?.status==="materialized":!1;mb(e,f.occurrenceId,f.propertyName)&&(f.status==="invalid-reference"||f.status==="other-paint-server"&&!A)&&pb(e,h,f.propertyName,f.authoredValue,$),f.status==="empty"?up(h,f.propertyName):(f.status==="invalid"||f.status==="invalid-reference"||f.status==="other-paint-server"&&!A||f.gradientSourceNodeId&&Io(e,f.gradientSourceNodeId))&&lp(h,f.propertyName,f.fallback);continue}gb(h,f.propertyName);let g=e.gradients.candidate(f.gradientSourceNodeId),v=g?Dr(e,g.sourceNodeId,g.sourceId):null;if(!g||g.status!=="materialized"||!v)continue;let b=e.gradients.resolveGeometry(f,{viewport:s,fontSize:16,rootFontSize:16});if(!b)continue;let y=Object.fromEntries(Object.entries(g.geometryValues).filter(([,$])=>$.validity==="valid").map(([$,A])=>[$,A.raw])),I={id:v,stops:g.stops.map($=>sb(e,$)),spreadMethod:g.spreadMethod,opacity:1,...g.gradientUnits==="userSpaceOnUse"?{gradientUnits:"userSpaceOnUse"}:{},...g.colorInterpolation!=="sRGB"?{colorInterpolation:g.colorInterpolation}:{},...Object.keys(y).length>0?{authoredGeometry:y}:{},...g.transform.authored?.validity==="valid"?{gradientTransform:[...g.transform.matrix]}:{},...g.sourceId?{sourceId:g.sourceId}:{}},x=g.type==="linear-gradient"?{type:"linear-gradient",x1:b.x1,y1:b.y1,x2:b.x2,y2:b.y2,...I}:{type:"radial-gradient",cx:b.cx,cy:b.cy,fx:b.fx,fy:b.fy,r:b.r,ry:b.r,rotation:0,...b.fr!==0||g.authoredGeometry.fr!==void 0?{fr:b.fr}:{},...I},k=x.stops[0]?.color??"#000000";m==="fill"?(h.fillType=x.type,h.fillGradient=x,h.fillLibraryId=v,h.fillColor=k):(h.strokeType=x.type,h.strokeGradient=x,h.strokeLibraryId=v,h.borderColor=k)}let d=new Map;for(let f of e.patterns.candidates){let p=Dr(e,f.sourceNodeId,f.sourceId);p&&d.set(f.sourceNodeId,p)}for(let f of e.patterns.candidates){let p=d.get(f.sourceNodeId);if(!p)continue;let h=e.sourceDocument.index.element(f.sourceNodeId);if(!h)continue;let m=ob(e,f.sourceNodeId),g=Object.fromEntries(Object.entries(f.values).filter(([,S])=>S.ownerSourceNodeId===f.sourceNodeId&&S.validity==="valid").map(([S,M])=>[S,M.raw])),v=f.contentProviderSourceNodeId===f.sourceNodeId,b=v?f.contentOccurrences.length>0?fb(e,f.contentOccurrences):db(h):"",y=j(h,"patternUnits"),I=j(h,"patternContentUnits"),x=y==="userSpaceOnUse"||y==="objectBoundingBox"?y:void 0,k=I==="userSpaceOnUse"||I==="objectBoundingBox"?I:void 0,$=DV(h),A={type:"pattern",patternType:"custom",color:"#000000",backgroundColor:"#ffffff",scale:1,rotation:0,opacity:1,...m?{templateId:m}:{},...Object.keys($).length>0?{rootAttributes:$}:{},...v&&b?{svgContent:un(e,b)}:{},...x?{patternUnits:x}:{},...k?{patternContentUnits:k}:{},...Object.keys(g).length>0?{authoredGeometry:g}:{},...f.transform.ownerSourceNodeId===f.sourceNodeId&&f.transform.raw&&f.transform.validity==="valid"?{patternTransform:f.transform.raw}:{},...f.viewBoxAuthored?.ownerSourceNodeId===f.sourceNodeId&&f.viewBoxAuthored.validity==="valid"?{viewBox:f.viewBoxAuthored.raw}:{},...f.preserveAspectRatioAuthored?.ownerSourceNodeId===f.sourceNodeId&&f.preserveAspectRatioAuthored.validity==="valid"?{preserveAspectRatio:f.preserveAspectRatioAuthored.raw}:{}};o.set(p,{kind:"pattern",id:p,name:f.sourceId??p,...f.sourceId?{sourceId:f.sourceId}:{},definitionOrder:ei(e,f.sourceNodeId),definitionContainerId:ti(e,f.sourceNodeId),pattern:A}),i.add(p)}for(let f of e.patterns.bindings){let p=r.get(f.occurrenceId);if(!p)continue;let h=p.state,m=f.propertyName==="fill"?"fill":"stroke";if(m==="fill"&&h.inheritFill===!0||m==="stroke"&&h.inheritStroke===!0)continue;if(f.status!=="materialized"||!f.patternSourceNodeId||Io(e,f.patternSourceNodeId)){let A=hb(e,f.resourceReferenceId),S=A?e.gradients.candidate(A)!==void 0:!1;mb(e,f.occurrenceId,f.propertyName)&&(f.status==="invalid-reference"||f.status==="other-paint-server"&&!S)&&pb(e,h,f.propertyName,f.authoredValue,A),f.status==="empty"?up(h,f.propertyName):(f.status==="invalid"||f.status==="invalid-reference"||f.status==="other-paint-server"&&!S||f.patternSourceNodeId&&Io(e,f.patternSourceNodeId))&&lp(h,f.propertyName,f.fallback);continue}gb(h,f.propertyName);let g=e.patterns.candidate(f.patternSourceNodeId),v=g?Dr(e,g.sourceNodeId,g.sourceId):null;if(!g||g.status!=="materialized"||!v){lp(h,f.propertyName,f.fallback);continue}let b=Hh(l,p).bounds,y=e.patterns.resolveTile(f,{viewport:s,objectBounds:b?{x:b.minX,y:b.minY,width:b.maxX-b.minX,height:b.maxY-b.minY}:{x:0,y:0,width:0,height:0},fontSize:16,rootFontSize:16});if(!y){up(h,f.propertyName);continue}let I=g.contentProviderSourceNodeId?e.sourceDocument.index.element(g.contentProviderSourceNodeId):null,x=g.contentOccurrences.length>0?fb(e,g.contentOccurrences):db(I);if(!x)continue;let k=Object.fromEntries(Object.entries(g.values).filter(([,A])=>A.validity==="valid").map(([A,S])=>[A,S.raw])),$={type:"pattern",id:v,patternType:"custom",color:"#000000",backgroundColor:"#ffffff",scale:1,rotation:0,opacity:1,svgContent:un(e,x),width:y.width,height:y.height,patternUnits:g.patternUnits,patternContentUnits:g.patternContentUnits,...g.values.x?{x:y.x}:{},...g.values.y?{y:y.y}:{},...Object.keys(k).length>0?{authoredGeometry:k}:{},...g.transform.raw&&g.transform.validity==="valid"?{patternTransform:g.transform.raw}:{},...g.viewBoxAuthored?.validity==="valid"?{viewBox:g.viewBoxAuthored.raw}:{},...g.preserveAspectRatioAuthored?.validity==="valid"?{preserveAspectRatio:g.preserveAspectRatioAuthored.raw}:{},...g.sourceId?{sourceId:g.sourceId}:{}};m==="fill"?(h.fillType="pattern",h.fillGradient=$,h.fillLibraryId=v,h.fillColor=$.color):(h.strokeType="pattern",h.strokeGradient=$,h.strokeLibraryId=v,h.borderColor=$.color)}let c=[...a.values(),...o.values()];return c.length>0&&(t.library=[...n,...c]),i}function tU(e,t,r){let n=[...t.library??[]],i=new Map,a=new Set;for(let o of e.filters.bindings){let s=r.get(o.consumerOccurrenceId);if(!s)continue;let l=s.state;if(o.status!=="materialized"){delete l.filterLibraryIds,delete l.filters;continue}let u=[],d=[],c=[],f=!1;for(let p of o.operations){if(p.status!=="materialized")continue;if(p.kind==="function"){f=!0,p.filter&&d.push(structuredClone(p.filter));continue}if(!p.filterSourceNodeId)continue;let h=e.filters.candidate(p.filterSourceNodeId),m=h?Dr(e,h.sourceNodeId,h.sourceId):null;!h||h.status!=="materialized"||!m||(u.push(m),a.add(m),c.push({id:m,candidate:h}),d.push(...structuredClone(h.filters)))}if(f&&u.length>0){let p=`filter-${s.id}`,h=1,m=new Set([...n.map(v=>v.id),...i.keys()]);for(;m.has(p);)p=`filter-${s.id}-${h++}`;let g=c[0]?.candidate;i.set(p,{kind:"filter",id:p,name:p,filters:structuredClone(d),...g?{colorInterpolation:g.colorInterpolation,filterUnits:g.filterUnits,primitiveUnits:g.primitiveUnits,x:g.region.x,y:g.region.y,width:g.region.width,height:g.region.height}:{}}),l.filterLibraryIds=[p]}else if(u.length>0){l.filterLibraryIds=u;for(let{id:p,candidate:h}of c)i.has(p)||i.set(p,{kind:"filter",id:p,name:h.sourceId??p,...h.sourceId?{sourceId:h.sourceId}:{},...h.definitionPlacement==="document"?{definitionPlacement:"document"}:{},definitionOrder:ei(e,h.sourceNodeId),definitionContainerId:ti(e,h.sourceNodeId),filters:[...structuredClone(h.filters)],colorInterpolation:h.colorInterpolation,filterUnits:h.filterUnits,primitiveUnits:h.primitiveUnits,x:h.region.x,y:h.region.y,width:h.region.width,height:h.region.height})}d.length>0&&(l.filters=d)}return i.size>0&&(t.library=[...n,...i.values()]),a}function rU(e,t,r,n,i,a,o,s,l){let u=[],d=new Set,c=new Map,f=new Map(t.sceneTree?.map(g=>[g.id,{parentId:g.parentId,index:g.index}])??[]),p=new Set([...e.clipMasks.definitions.flatMap(g=>{let v=e.sourceDocument.index.parent(g.sourceNodeId);return v&&v.sourceNodeId!==e.sourceDocument.root.sourceNodeId?[g.sourceNodeId]:[]}),...e.paintServerDefinitions.candidates.flatMap(g=>g.insideDefs?[]:[g.sourceNodeId])]),h=g=>{let v=e.sourceDocument.index.parent(g);if(!v||v.sourceNodeId===e.sourceDocument.root.sourceNodeId)return null;let b=s.get(v.sourceNodeId),y=b??a.get(v.sourceNodeId);if(!y)return null;let I=0;for(let x of v.children)if(x.kind==="element"){if(x.sourceNodeId===g){let k=b??o.get(y);return{parentId:y,...k?{parentDefinitionId:k}:{},siblingIndex:I}}(a.has(x.sourceNodeId)||p.has(x.sourceNodeId))&&I++}return null},m=0;for(let g of e.clipMasks.bindings){let v=r.get(g.consumerOccurrenceId);if(!v||!n.has(v.id))continue;let b=v.state,y=g.definitionSourceNodeId?e.clipMasks.definition(g.definitionSourceNodeId):null,I=un(e,g.authoredValue);if(g.status!=="materialized"||!y||y.status!=="materialized"||Io(e,y.sourceNodeId)){g.propertyName==="clip-path"?b.cssClipPath=I:b.cssMaskProperties={...b.cssMaskProperties??{},[g.propertyName]:I};continue}let x=Dr(e,y.sourceNodeId,y.sourceId)??`${y.type}-definition-${m+1}`,k=e.sourceDocument.index.element(y.sourceNodeId),$=h(y.sourceNodeId),A=!d.has(x);d.add(x);let S=A?e.paintServerDefinitions.candidate(y.sourceNodeId)?.definition.markup??un(e,k?.rawXml??y.rawDefinition??""):"",M=A&&y.representation==="raw"?S:"",T=t.sceneTree?.find(G=>G.id===v.id),E=f.get(v.id);if(delete b.cssClipPath,b.cssMaskProperties&&typeof b.cssMaskProperties=="object"){let G={...b.cssMaskProperties};delete G[g.propertyName],b.cssMaskProperties=Object.keys(G).length>0?G:void 0}let C=b.authoredAttributes;if(C&&typeof C=="object"){let G={...C};delete G[g.propertyName],b.authoredAttributes=Object.keys(G).length>0?G:void 0}for(let G of["containerPresentation","instancePresentation","inlineStyle"]){let H=b[G];if(!H||typeof H!="object")continue;let X={...H};delete X[g.propertyName],b[G]=Object.keys(X).length>0?X:void 0}let O=e.styles.style(g.consumerOccurrenceId)?.cascadedValues[g.propertyName],z=O?.origin==="stylesheet"?"stylesheet":O?.origin==="style-attribute"?"style":"attribute",R=z==="style"?Object.keys(e.styles.style(g.consumerOccurrenceId)?.inlineDeclarations??{}).map(G=>G.toLowerCase()).filter(G=>ul(G)).indexOf(g.propertyName):-1,U=A?[]:[...c.get(x)??[]],V=Hh(xa(t),v).bounds,Y=y.clipPathUnits==="objectBoundingBox"||y.maskUnits==="objectBoundingBox"||y.maskContentUnits==="objectBoundingBox";if(A&&(V||!Y)){let G=e.clipMasks.resolve(g,{consumerObjectBounds:V?{x:V.minX,y:V.minY,width:V.maxX-V.minX,height:V.maxY-V.minY}:{x:0,y:0,width:0,height:0}}),H=[];for(let X of G.geometryPlacements){let B=i.get(X.occurrenceId),ae=e.leafGeometry.candidate(X.occurrenceId);if(!B||!ae?.canonicalType||ae.status!=="materialized")continue;let K=`clip-mask-${m+1}-shape-${U.length+H.length+1}`,W={...js(e,ae),...Rn(e,B,l)},J=W.transformMatrix,Q=J?Re(X.definitionMatrix,J):X.definitionMatrix;dn(Q)?delete W.transformMatrix:W.transformMatrix=Zr(Q),y.type==="clip"&&(X.clipRule==="evenodd"?W.fillRule="evenodd":ae.canonicalType==="path"?W.fillRule="nonzero":delete W.fillRule);let Z={id:y.representation==="decomposed"?ai(e,X.sourceNodeId)??K:K,type:ae.canonicalType,state:W};H.push({occurrenceId:X.occurrenceId,shape:Z})}if(G.status==="materialized"&&H.length>0&&H.length===G.geometryPlacements.length)for(let X of H)t.shapes.push(X.shape),U.push(X.shape.id),r.has(X.occurrenceId)||r.set(X.occurrenceId,X.shape);else M||(M=S)}else A&&!M&&(M=S);A&&c.set(x,U),u.push({id:`clip-mask-${++m}`,type:y.type,definitionId:x,...y.definitionPlacement==="document"?{definitionPlacement:"document"}:{},...k?{definitionOrder:ei(e,k.sourceNodeId),definitionContainerId:ti(e,k.sourceNodeId)}:{},...$?{authoredPlacement:$}:{},clipShapeIds:U,contentShapeIds:[v.id],parentId:E?.parentId??T?.parentId??null,referenceChannel:z,...R>=0?{referenceStyleOrder:R}:{},...E?{siblingIndex:E.index}:{},...y.type==="clip"?{...y.clipPathUnits?{clipPathUnits:y.clipPathUnits}:{},...y.clipRule?{clipRule:y.clipRule}:{}}:{...y.maskUnits?{maskUnits:y.maskUnits}:{},...y.maskContentUnits?{maskContentUnits:y.maskContentUnits}:{},...y.maskType?{maskType:y.maskType}:{},...y.region?{maskBounds:{...y.region}}:{}},...M?{rawDefinition:M}:{}})}return u.length>0&&(t.clipMaskGroups=u,BI(t)),d}function nU(e,t={}){let r=new Map(e.useOccurrences.occurrences.map(P=>[P.occurrenceId,P])),n=new Map(e.hierarchy.containers.map(P=>[P.occurrenceId,P])),i=new Map(e.leafGeometry.candidates.filter(P=>P.status==="materialized").map(P=>[P.occurrenceId,P])),a=nk(e),o=VV(e),s=new Set(e.symbolUses.definitions.flatMap(P=>{let D=r.get(P.productRootOccurrenceId);return D&&D.usePath.length>0?[P.sourceNodeId]:[]})),l=e.symbolUses.definitions.filter(P=>{let D=r.get(P.productRootOccurrenceId);return!D||D.usePath.length>0||!s.has(P.sourceNodeId)}),u=new Map,d=new Map;for(let P of l){let D=Dr(e,P.sourceNodeId,P.sourceId)??`symbol-${u.size+1}`,L=(d.get(D)??0)+1;d.set(D,L),u.set(P.productKey,L===1?D:`${D}-use-${L}`)}let c=new Map,f=new Set;for(let P of l){let D=u.get(P.productKey);D&&!c.has(P.sourceNodeId)&&(c.set(P.sourceNodeId,D),f.add(P.productKey))}for(let P of e.symbolUses.definitions){if(u.has(P.productKey))continue;let D=c.get(P.sourceNodeId);D&&u.set(P.productKey,D)}let p=new Map;o.forEach((P,D)=>{p.set(P.occurrenceId,`svg-node-${D+1}`)});let h=new Map,m=[],g=new Map,v=new Map;for(let P of o){let D=p.get(P.occurrenceId),L=e.symbolUses.use(P.occurrenceId);if(L?.status==="symbol-instance"&&L.definitionProductKey){let be=e.symbolUses.definition(L.definitionProductKey),Ue=u.get(L.definitionProductKey);if(!be||!Ue)continue;let je=Rn(e,P,h);delete je.transformMatrix,je.symbolId=Ue,je.x=L.geometry.x,je.y=L.geometry.y,je.width=L.geometry.width??be.parsedViewBox?.width??100,je.height=L.geometry.height??be.parsedViewBox?.height??100,L.geometry.authored&&(je.authoredUseGeometry={...L.geometry.authored});let vt={...L.presentation};L.transform.authored&&L.transform.authored.trim()&&(vt.transform=L.transform.authored),Object.keys(vt).length>0&&(je.instancePresentation=vt),be.parsedViewBox?(je.viewBoxWidth=be.parsedViewBox.width,je.viewBoxHeight=be.parsedViewBox.height,je.scaleContentToViewport=!0):je.scaleContentToViewport=!1,m.push({id:D,type:"symbol-instance",state:je});continue}if(L?.status==="linked-reference"&&L.targetSourceNodeId){let be=e.useOccurrences.direct(L.targetSourceNodeId),Ue=be?p.get(be.occurrenceId):void 0,je=Rn(e,P,h),vt=L.transform.matrix;Ue?je.targetShapeId=Ue:g.set(D,L.targetSourceNodeId),je.offsetX=L.geometry.x,je.offsetY=L.geometry.y,Object.keys(L.presentation).length>0&&(je.instancePresentation={...L.presentation}),vt&&!dn(vt)?je.transformMatrix=Zr(vt):delete je.transformMatrix,m.push({id:D,type:"shape-reference",state:je});continue}let ne=lb(e,L);if(L&&ne){m.push({id:D,type:"shape-reference",state:ub(e,P,L,ne,h)});continue}let le=n.get(P.occurrenceId);if(le){m.push({id:D,type:sp(le.kind),state:Lu(e,P,le.kind,h)});continue}let De=i.get(P.occurrenceId);De?.canonicalType&&m.push({id:D,type:De.canonicalType,state:{...js(e,De),...Rn(e,P,h)}})}let b=new Set(e.animations.smil.flatMap(P=>P.motionPathSourceNodeId?[P.motionPathSourceNodeId]:[]));for(let P of b){let D=e.useOccurrences.direct(P);if(!D||p.has(D.occurrenceId))continue;let L=i.get(D.occurrenceId);if(!L?.canonicalType)continue;let ne=ai(e,P)??`svg-motion-path-${m.length+1}`,le={...js(e,L),...Rn(e,D,h),displayMode:"motionOnly",definitionOrder:ei(e,P),definitionContainerId:ti(e,P)},De={id:ne,type:L.canonicalType,state:le};m.push(De),v.set(P,De),p.set(D.occurrenceId,ne)}let y=P=>{if(typeof P!="string"||P.length===0)return;let D=e.sourceDocument.index.resolveAuthoredId(P);if(!D)return;let L=e.useOccurrences.direct(D.sourceNodeId);return L?p.get(L.occurrenceId):void 0};for(let P of m){if(P.type!=="text")continue;let D=P.state,L=D.textPathImportReference;if(L&&typeof L.targetSourceNodeId=="string"&&(L.element==="href"||L.element==="mpath")&&!e.leafGeometry.privateTextPathOwner(L.targetSourceNodeId)){let le=e.useOccurrences.direct(L.targetSourceNodeId),De=le?p.get(le.occurrenceId):void 0,be=c.get(L.targetSourceNodeId);De?D.textPathReference={kind:"shape",targetId:De,element:L.element}:be&&(D.textPathReference={kind:"definition",targetId:be,element:L.element})}delete D.textPathImportReference;let ne=y(D.shapeInsideImportRefId);ne&&(D.shapeInsideRef=ne),delete D.shapeInsideImportRefId}let I=new Map,x=[],k=new Map,$=new Map,A=new Map,S=new Set,M=new Set,T=(P,D)=>{let L=new Set,ne=P;for(;ne&&ne.occurrenceId!==D;){if(L.has(ne.occurrenceId))return!0;L.add(ne.occurrenceId);let le=e.sourceDocument.index.element(ne.correspondingSourceNodeId);if(le?.namespaceUri===ye&&jV.has(le.localName.toLowerCase()))return!0;ne=ne.parentOccurrenceId?r.get(ne.parentOccurrenceId):void 0}return!1};for(let[P,D]of l.entries()){let L=u.get(D.productKey);if(!L)continue;k.set(L,D.sourceNodeId);let ne=f.has(D.productKey),le=new Set;for(let oe of D.contentOccurrenceIds){let ke=e.symbolUses.use(oe);if(ke?.status!=="symbol-instance"||!ke.definitionProductKey)continue;let Be=e.symbolUses.definition(ke.definitionProductKey);if(Be){le.add(Be.productRootOccurrenceId);for(let Qt of Be.contentOccurrenceIds)le.add(Qt)}}let De=e.sourceDocument.index.element(D.sourceNodeId),be=De?.localName.toLowerCase(),Ue=new Set(be==="use"?[]:D.contentOccurrenceIds);De&&!["g","symbol"].includes(be??"")&&Ue.add(D.productRootOccurrenceId);let je=[...Ue].map(oe=>r.get(oe)).filter(oe=>oe!==void 0&&!le.has(oe.occurrenceId)&&!T(oe,D.productRootOccurrenceId)).sort((oe,ke)=>rk(oe.orderKey,ke.orderKey)||oe.productIndex-ke.productIndex||oe.occurrenceId.localeCompare(ke.occurrenceId)),vt=new Map;je.forEach((oe,ke)=>{vt.set(oe.occurrenceId,`symbol-node-${P+1}-${ke+1}`)});let $t=new Map;for(let oe of je){let ke=vt.get(oe.occurrenceId),Be=e.symbolUses.use(oe.occurrenceId),Qt=null;if(Be?.status==="symbol-instance"&&Be.definitionProductKey){let dr=e.symbolUses.definition(Be.definitionProductKey),Yn=u.get(Be.definitionProductKey);if(dr&&Yn){let Cr=Rn(e,oe,h,!1,ne);delete Cr.transformMatrix,Cr.symbolId=Yn,Cr.x=Be.geometry.x,Cr.y=Be.geometry.y,Cr.width=Be.geometry.width??dr.parsedViewBox?.width??100,Cr.height=Be.geometry.height??dr.parsedViewBox?.height??100,Be.geometry.authored&&(Cr.authoredUseGeometry={...Be.geometry.authored});let hs={...Be.presentation};Be.transform.authored&&Be.transform.authored.trim()&&(hs.transform=Be.transform.authored),Object.keys(hs).length>0&&(Cr.instancePresentation=hs),dr.parsedViewBox?(Cr.viewBoxWidth=dr.parsedViewBox.width,Cr.viewBoxHeight=dr.parsedViewBox.height,Cr.scaleContentToViewport=!0):Cr.scaleContentToViewport=!1,Qt={id:ke,type:"symbol-instance",state:Cr}}}else if(Be){let dr=lb(e,Be);dr&&(Qt={id:ke,type:"shape-reference",state:ub(e,oe,Be,dr,h,ne)})}else{let dr=n.get(oe.occurrenceId);if(dr)Qt={id:ke,type:sp(dr.kind),state:Lu(e,oe,dr.kind,h,ne)};else{let Yn=i.get(oe.occurrenceId);Yn?.canonicalType&&(Qt={id:ke,type:Yn.canonicalType,state:{...js(e,Yn),...Rn(e,oe,h,!1,ne)}})}}if(!Qt)continue;oe.occurrenceId===D.productRootOccurrenceId&&De&&!["g","symbol"].includes(be??"")&&delete Qt.state.transformMatrix;let zr=e.useOccurrences.direct(oe.correspondingSourceNodeId),Yi=zr?e.styles.style(zr.occurrenceId):null,sr=Qt.state;Yi?.cascadedValues.fill||(delete sr.fillColor,delete sr.fillType,delete sr.fillGradient,delete sr.fillLibraryId,sr.inheritFill=!0),Yi?.cascadedValues.stroke||(delete sr.borderColor,delete sr.strokeType,delete sr.strokeGradient,delete sr.strokeLibraryId,sr.inheritStroke=!0),$t.set(oe.occurrenceId,Qt),I.set(oe.occurrenceId,Qt),A.set(Qt.id,L),$.has(oe.correspondingSourceNodeId)||$.set(oe.correspondingSourceNodeId,Qt)}let qn=[],xi=new Map,_e=oe=>{let ke=oe.parentOccurrenceId,Be=new Set;for(;ke;){if(Be.has(ke))throw new Error(`SVG occurrence ancestry contains a cycle at ${ke}.`);if(Be.add(ke),n.has(ke)&&$t.has(ke))return ke;ke=r.get(ke)?.parentOccurrenceId??null}return null};for(let oe of je){let ke=$t.get(oe.occurrenceId);if(!ke)continue;let Be=n.get(oe.occurrenceId),Qt=e.hierarchy.placements.find(sr=>sr.occurrenceId===oe.occurrenceId),zr=Be?.parentContainerOccurrenceId??Qt?.parentContainerOccurrenceId??_e(oe),Yi=zr?$t.get(zr):void 0;if(Yi){let sr=Yi.state,dr=sr.children??[];sr.children=[...dr,ke]}else qn.push(ke),xi.set(oe.occurrenceId,ke.id)}let ct=[];for(let oe of D.definitionContentOrder??[])if(oe.kind==="definition"){let ke=u.get(oe.productKey);ke&&ct.push({kind:"definition",id:ke})}else{let ke=xi.get(oe.occurrenceId);ke&&ct.push({kind:"shape",id:ke})}let Ft=e.metadata.candidate(D.sourceNodeId)?.metadata,hn=De!==null&&["g","symbol"].includes(De.localName.toLowerCase()),mn={...D.rootAttributes,...hn?eh(e,D.productRootOccurrenceId):{}},en=["g","symbol"].includes(be??""),Pn=r.get(D.productRootOccurrenceId),Dn=en&&Pn?Lu(e,Pn,"group",h,ne):{},Uc={shapeId:L,shapeType:"group",state:Dn},_a=e.animations.smil.filter(oe=>oe.targetOccurrenceId!==null&&(en&&oe.targetOccurrenceId===D.productRootOccurrenceId||$t.has(oe.targetOccurrenceId))&&JV(e,oe.sourceNodeId,D.sourceNodeId));for(let oe of _a)S.add(oe.animationId),M.add(oe.sourceNodeId);let Fa=new Map;for(let[oe,ke]of $t){let Be=r.get(oe);Be&&!Fa.has(Be.correspondingSourceNodeId)&&Fa.set(Be.correspondingSourceNodeId,ke)}let ps=oe=>({shapeId:oe.id,shapeType:oe.type,state:oe.state}),Gc=oe=>{let ke=[];for(let[Be,Qt]of $t){let zr=r.get(Be)?.parentOccurrenceId??null;for(;zr;){if(zr===oe){ke.push(Qt);break}zr=r.get(zr)?.parentOccurrenceId??null}}return ke},wi=Sp(e.animations,e.styles,{shapeIdForOccurrence:oe=>en&&oe===D.productRootOccurrenceId?L:$t.get(oe)?.id??null,shapeStateForOccurrence:oe=>en&&oe===D.productRootOccurrenceId?Dn:$t.get(oe)?.state??null,shapeIdForSourceNode:oe=>en&&oe===D.sourceNodeId?L:Fa.get(oe)?.id??null,shapeBindingsForOccurrence:oe=>{if(en&&oe===D.productRootOccurrenceId)return[Uc];let ke=$t.get(oe);return ke?[ps(ke)]:[]},textSpanBindingForOccurrence:oe=>{let ke=X0(e.leafGeometry,e.useOccurrences,oe);if(!ke)return null;let Be=$t.get(ke.textOccurrenceId);return Be?{...ps(Be),className:ib(e,oe),textSpanId:ke.spanId}:null},descendantShapeBindingsForOccurrence:oe=>Gc(oe).map(ps),textPathAuthoredDataForOccurrence:oe=>{let ke=r.get(oe),Be=ke?e.sourceDocument.index.element(ke.correspondingSourceNodeId):null;return Be?Y0(e.sourceDocument,Be):null},cssTransformContextForOccurrence:oe=>({viewportWidth:D.parsedViewBox?.width??300,viewportHeight:D.parsedViewBox?.height??150,fontSize:e.viewportContexts.fontSize(oe)??e.projectionContext.rootFontSize,rootFontSize:e.projectionContext.rootFontSize,boxX:D.parsedViewBox?.x??0,boxY:D.parsedViewBox?.y??0,boxWidth:D.parsedViewBox?.width??300,boxHeight:D.parsedViewBox?.height??150})},e.gradients,{smil:_a,css:[]});for(let oe of wi?.tracks??[])S.add(oe.id);x.push({kind:"symbol",id:L,name:D.sourceId??L,...D.sourceId?{sourceId:D.sourceId}:{},defKind:D.defKind,...D.definitionPlacement==="document"?{definitionPlacement:"document"}:{},...De?{definitionOrder:ei(e,De.sourceNodeId),definitionContainerId:ti(e,De.sourceNodeId)}:{},...D.viewBox!==null?{viewBox:D.viewBox}:{},...D.preserveAspectRatio!==null?{preserveAspectRatio:D.preserveAspectRatio}:{},...D.x!==null?{x:D.x}:{},...D.y!==null?{y:D.y}:{},...D.width!==null?{width:D.width}:{},...D.height!==null?{height:D.height}:{},...D.refX!==null?{refX:D.refX}:{},...D.refY!==null?{refY:D.refY}:{},...Object.keys(mn).length>0?{rootAttributes:mn}:{},...Ft&&Object.keys(Ft).length>0?{metadata:structuredClone(Ft)}:{},...ct.some(oe=>oe.kind==="definition")?{definitionContentOrder:ct}:{},shapes:qn,...wi?{animations:wi.tracks}:{}})}for(let[P,D]of e.markers.candidates.entries()){if(D.status!=="materialized")continue;let L=Dr(e,D.sourceNodeId,D.sourceId);if(!L)continue;k.set(L,D.sourceNodeId);let ne=new Map;for(let _e of D.content){let ct=r.get(_e.occurrenceId);if(!ct)continue;let Ft=`marker-node-${P+1}-${ne.size+1}`,hn=n.get(ct.occurrenceId),mn=_e.elementName==="g"?"group":_e.elementName==="a"?"hyperlink":_e.elementName==="switch"?"switch":_e.elementName==="svg"?"embedded-svg":null,en=hn?.kind??mn,Pn=null;if(en)Pn={id:Ft,type:sp(en),state:Lu(e,ct,en,h)};else{let Dn=i.get(ct.occurrenceId);Dn?.canonicalType&&(Pn={id:Ft,type:Dn.canonicalType,state:{...js(e,Dn),...Rn(e,ct,h)}})}Pn&&ne.set(ct.occurrenceId,Pn)}let le=[];for(let _e of D.content){let ct=ne.get(_e.occurrenceId);if(!ct)continue;let Ft=_e.parentOccurrenceId?ne.get(_e.parentOccurrenceId):void 0;if(Ft){let hn=Ft.state;hn.children=[...hn.children??[],ct]}else le.push(ct)}let De=new Map(D.content.map(_e=>[_e.occurrenceId,_e])),be=new Map;for(let _e of D.content){let ct=ne.get(_e.occurrenceId);ct&&!be.has(_e.sourceNodeId)&&be.set(_e.sourceNodeId,ct)}for(let _e of ne.values())A.set(_e.id,L);for(let[_e,ct]of be)$.has(_e)||$.set(_e,ct);let Ue=_e=>({shapeId:_e.id,shapeType:_e.type,state:_e.state}),je=_e=>{let ct=[];for(let[Ft,hn]of ne){let mn=De.get(Ft)?.parentOccurrenceId??null;for(;mn;){if(mn===_e){ct.push(hn);break}mn=De.get(mn)?.parentOccurrenceId??null}}return ct},vt=D.viewBox?.trim().split(/[\s,]+/u).map(Number),$t=vt?.length===4&&vt.every(Number.isFinite)?{x:vt[0],y:vt[1],width:vt[2],height:vt[3]}:{x:0,y:0,width:D.markerWidth,height:D.markerHeight},qn=eP(e,{shapeIdForOccurrence:_e=>ne.get(_e)?.id??null,shapeStateForOccurrence:_e=>ne.get(_e)?.state??null,shapeIdForSourceNode:_e=>be.get(_e)?.id??null,shapeBindingsForOccurrence:_e=>{let ct=ne.get(_e);return ct?[Ue(ct)]:[]},descendantShapeBindingsForOccurrence:_e=>je(_e).map(Ue),cssTransformContextForOccurrence:_e=>({viewportWidth:$t.width,viewportHeight:$t.height,fontSize:e.viewportContexts.fontSize(_e)??e.projectionContext.rootFontSize,rootFontSize:e.projectionContext.rootFontSize,boxX:$t.x,boxY:$t.y,boxWidth:$t.width,boxHeight:$t.height})}),xi=e.metadata.candidate(D.sourceNodeId)?.metadata;x.push({kind:"marker",id:L,name:D.name,...D.sourceId?{sourceId:D.sourceId}:{},definitionOrder:ei(e,D.sourceNodeId),definitionContainerId:ti(e,D.sourceNodeId),...xi&&Object.keys(xi).length>0?{metadata:structuredClone(xi)}:{},...D.viewBox?{viewBox:D.viewBox}:{},...D.preserveAspectRatio?{preserveAspectRatio:D.preserveAspectRatio}:{},...Object.keys(D.authoredGeometry).length>0?{authoredGeometry:{...D.authoredGeometry}}:{},...Object.keys(D.rootAttributes).length>0?{rootAttributes:{...D.rootAttributes}}:{},refX:D.refX,refY:D.refY,markerWidth:D.markerWidth,markerHeight:D.markerHeight,markerUnits:D.markerUnits,orient:D.orient,...D.overflow?{overflow:D.overflow}:{},shapes:le,...qn?{animations:qn.tracks}:{}})}for(let[P,D]of e.views.entries()){let L=e.sourceDocument.index.element(D.sourceNodeId),ne=L?j(L,"id"):null,le=Dr(e,D.sourceNodeId,ne);m.push({id:`svg-view-${P+1}`,type:"view",state:{...D.state,...le?{viewName:le}:{}}})}let E=new Map,C=[];for(let P of o){let D=p.get(P.occurrenceId);if(!D||!m.some(Ue=>Ue.id===D))continue;let L=n.get(P.occurrenceId),ne=e.hierarchy.placements.find(Ue=>Ue.occurrenceId===P.occurrenceId),le=L?.parentContainerOccurrenceId??ne?.parentContainerOccurrenceId??null,De=le?p.get(le)??null:null,be=E.get(De)??0;E.set(De,be+1),C.push({id:D,parentId:De,index:be})}for(let P of m.filter(D=>D.type==="view")){let D=E.get(null)??0;E.set(null,D+1),C.push({id:P.id,parentId:null,index:D})}let O=e.rootFrame,z=t.entrypoint==="external-svg-paste",R=O.systemLanguage!==void 0||O.requiredExtensions!==void 0,U=z&&(O.targetedPasteWrapper||R)?"svg-import-root-wrapper":null;if(U){let P={...O.systemLanguage!==void 0?{systemLanguage:O.systemLanguage}:{},...O.requiredExtensions!==void 0?{requiredExtensions:O.requiredExtensions}:{}},D=O.targetedPasteWrapper?"svg":"group";if(D==="svg"){let L=qP(O);P.svgWidth=L.width,P.svgHeight=L.height,O.sizingMode==="explicit"&&(P.svgViewBoxX=O.viewBoxX,P.svgViewBoxY=O.viewBoxY,P.svgViewBoxWidth=O.viewBoxWidth,P.svgViewBoxHeight=O.viewBoxHeight),O.preserveAspectRatio!==void 0&&(P.svgPreserveAspectRatio=O.preserveAspectRatio)}m.unshift({id:U,type:D,state:P});for(let L of C)L.parentId===null&&(L.parentId=U);C.unshift({id:U,parentId:null,index:0})}let V=O.viewBoxWidth??O.width??300,Y=O.viewBoxHeight??O.height??150,G=ai(e,e.sourceDocument.root.sourceNodeId),H=e.useOccurrences.direct(e.sourceDocument.root.sourceNodeId),X=H?eh(e,H.occurrenceId):{},B=H?ik(e,H.occurrenceId):{};m.unshift({id:"svg-document-root",type:"svg",state:{isRootSvg:!0,svgWidth:O.width??V,svgHeight:O.height??Y,svgViewBoxX:O.viewBoxX??0,svgViewBoxY:O.viewBoxY??0,svgViewBoxWidth:V,svgViewBoxHeight:Y,...O.authoredWidth!==void 0||O.authoredHeight!==void 0?{authoredRootDimensions:{...O.authoredWidth!==void 0?{width:{raw:O.authoredWidth,resolved:O.width??V}}:{},...O.authoredHeight!==void 0?{height:{raw:O.authoredHeight,resolved:O.height??Y}}:{}}}:{},...O.preserveAspectRatio!==void 0?{svgPreserveAspectRatio:O.preserveAspectRatio}:{},...O.systemLanguage!==void 0?{systemLanguage:O.systemLanguage}:{},...O.requiredExtensions!==void 0?{requiredExtensions:O.requiredExtensions}:{},...Object.keys(X).length>0?{containerPresentation:X}:{},...B.presentationChannels?{presentationChannels:B.presentationChannels}:{},...B.inlineStyle?{inlineStyle:B.inlineStyle}:{},...G?{metadata:{name:G}}:{}}});let ae=RV(x,m),K={language:"",...e.metadata.document.metadata};K.coordinatePrecision===void 0&&(K.coordinatePrecision=TV(e.sourceDocument));let W=IF({shapes:m,viewboxes:[kF(O.viewBoxX??0,O.viewBoxY??0,Math.max(V,1),Math.max(Y,1),"svg-viewbox-1")],metadata:K});e.documentExtensions.length>0&&(W.documentExtensions=e.documentExtensions.map(P=>structuredClone(P))),W.sceneTree=[{id:"svg-document-root",parentId:null,index:0},...C.map(P=>P.parentId===null?{...P,index:P.index+1}:P)],ae.length>0&&(W.library=ae);let J=xa(W),Q=new Map,Z=new Map;for(let P of a){let D=p.get(P.occurrenceId),L=D?m.find(ne=>ne.id===D):void 0;L&&(Q.set(P.occurrenceId,L),Z.has(P.correspondingSourceNodeId)||Z.set(P.correspondingSourceNodeId,L.id))}for(let[P,D]of v){let L=e.useOccurrences.direct(P);L&&Q.set(L.occurrenceId,D),Z.set(P,D.id)}let Ae=e.useOccurrences.direct(e.sourceDocument.root.sourceNodeId),Ie=m.find(P=>P.id==="svg-document-root");Ae&&Ie&&(Q.set(Ae.occurrenceId,Ie),Z.set(e.sourceDocument.root.sourceNodeId,Ie.id)),HV(e,o,r,Q,J);let Xe=new Map(Q),Mt=new Map;for(let P of e.symbolUses.uses){if(P.status!=="symbol-instance"||!P.definitionProductKey)continue;let D=Xe.get(P.useOccurrenceId),L=e.symbolUses.definition(P.definitionProductKey);if(!D||!L)continue;let ne=Mt.get(L.productRootOccurrenceId)??[];ne.push(D),Mt.set(L.productRootOccurrenceId,ne),Z.has(L.sourceNodeId)||Z.set(L.sourceNodeId,D.id)}for(let[P,D]of I){Q.set(P,D);let L=r.get(P);L&&!Z.has(L.correspondingSourceNodeId)&&Z.set(L.correspondingSourceNodeId,D.id)}for(let[P,D]of $)Z.has(P)||Z.set(P,D.id);if(U){let P=m.find(L=>L.id===U),D=e.useOccurrences.direct(e.sourceDocument.root.sourceNodeId);P&&(Z.set(e.sourceDocument.root.sourceNodeId,P.id),D&&(Q.set(D.occurrenceId,P),Xe.set(D.occurrenceId,P)))}let bi=new Set(W.shapes.map(P=>P.id)),ur=new Map;for(let[P,D]of k)ur.has(D)||ur.set(D,P);for(let P of e.clipMasks.definitions){let D=Dr(e,P.sourceNodeId,P.sourceId);D&&!ur.has(P.sourceNodeId)&&ur.set(P.sourceNodeId,D)}rU(e,W,Q,bi,r,Z,A,ur,h);for(let[P,D]of g){let L=W.shapes.find(De=>De.id===P),ne=e.useOccurrences.direct(D),le=ne?Q.get(ne.occurrenceId):null;L&&le&&(L.state.targetShapeId=le.id)}for(let[P,D]of Q){let L=r.get(P);L&&!Z.has(L.correspondingSourceNodeId)&&Z.set(L.correspondingSourceNodeId,D.id)}eU(e,W,Q),tU(e,W,Q);for(let P of[...e.gradients.candidates,...e.patterns.candidates]){let D=Dr(e,P.sourceNodeId,P.sourceId);D&&W.library?.some(L=>L.id===D)&&k.set(D,P.sourceNodeId)}for(let P of e.filters.candidates){let D=Dr(e,P.sourceNodeId,P.sourceId);D&&W.library?.some(L=>L.id===D)&&k.set(D,P.sourceNodeId)}for(let[P,D]of k)ur.has(D)||ur.set(D,P);let pn=new Set(k.values());for(let P of e.paintServerDefinitions.candidates)W.paintServerDefs?.some(D=>D.id===P.destinationId)&&pn.add(P.sourceNodeId);for(let P of e.clipMasks.definitions){let D=Dr(e,P.sourceNodeId,P.sourceId);D&&W.clipMaskGroups?.some(L=>L.definitionId===D)&&pn.add(P.sourceNodeId)}for(let P of e.styles.stylesheets)pn.add(P.sourceNodeId);let Tn=qV(e,Z,pn,A,ur);Tn.length>0&&(W.definitionContainers=Tn);for(let P of W.library??[]){let D=k.get(P.id);if(!D)continue;let L=em(e,D,Z,pn,A,ur);L&&(P.authoredPlacement=L)}let qi=P=>{let D=[];for(let[L,ne]of Q){let le=r.get(L)?.parentOccurrenceId??null;for(;le;){if(le===P){D.push(ne);break}le=r.get(le)?.parentOccurrenceId??null}}return D},We=P=>ak(e,P,r,Q),et=P=>({shapeId:P.id,shapeType:P.type,state:P.state}),tt=P=>{let D=Xe.get(P);if(D)return[D];let L=Q.get(P);return L&&!I.has(P)?[L]:Mt.get(P)??[]},Je=KV(e,c,Z,pn,A),yt=Sp(e.animations,e.styles,{shapeIdForOccurrence:P=>tt(P)[0]?.id??null,shapeStateForOccurrence:P=>tt(P)[0]?.state??null,shapeIdForSourceNode:P=>Z.get(P)??null,elementIdForSourceNode:P=>e.identifiers.liveIdForSourceNodeId(P)??null,shapeBindingsForOccurrence:P=>tt(P).map(et),textSpanBindingForOccurrence:P=>{let D=X0(e.leafGeometry,e.useOccurrences,P);if(!D)return null;let L=tt(D.textOccurrenceId)[0];return L?{...et(L),className:ib(e,P),textSpanId:D.spanId}:null},descendantShapeBindingsForOccurrence:P=>qi(P).filter(D=>bi.has(D.id)).map(et),definitionTargetForOccurrence:P=>{let D=r.get(P);if(!D||D.usePath.length>0)return null;let L=e.sourceDocument.index.element(D.correspondingSourceNodeId);if(!L)return null;let ne=L;for(;!ur.has(ne.sourceNodeId)&&ne.sourceNodeId!==e.sourceDocument.root.sourceNodeId;){let je=e.sourceDocument.index.parent(ne.sourceNodeId);if(!je)return null;ne=je}let le=ur.get(ne.sourceNodeId);if(!le)return null;let De=e.filters.primitiveId(L.sourceNodeId),be=L.sourceNodeId===ne.sourceNodeId?void 0:De??ai(e,L.sourceNodeId)??void 0,Ue=Object.fromEntries(L.attributes.map(je=>[je.name,je.value]));return{definitionId:le,...be?{nodeId:be}:{},baseTransform:e.styles.value(P,"transform")??Ue.transform??"",baseAttributes:Object.freeze(Ue)}},textPathGeometryTargetForOccurrence:P=>{let D=r.get(P);if(!D||D.usePath.length>0)return null;let L=e.leafGeometry.privateTextPathOwner(D.correspondingSourceNodeId);if(!L)return null;let ne=tt(L.textOccurrenceId)[0];if(!ne)return null;let le=e.sourceDocument.index.element(L.pathSourceNodeId);return{binding:et(ne),baseData:(le?j(le,"d"):null)??""}},textPathAuthoredDataForOccurrence:P=>{let D=r.get(P),L=D?e.sourceDocument.index.element(D.correspondingSourceNodeId):null;return L?Y0(e.sourceDocument,L):null},shapeIdForLocalReference:P=>{let D=P.trim();if(!D.startsWith("#")||D.length===1)return null;let L=e.sourceDocument.index.resolveAuthoredId(D.slice(1));return L?Z.get(L.sourceNodeId)??null:null},definitionOrderForSourceNode:P=>ei(e,P),definitionContainerIdForSourceNode:P=>ti(e,P),cssTransformContextForOccurrence:(P,D)=>{let L=tt(P)[0],ne=We(P),le=L?ok(L,D,ne,J):null;return{viewportWidth:ne.width,viewportHeight:ne.height,fontSize:e.viewportContexts.fontSize(P)??e.projectionContext.rootFontSize,rootFontSize:e.projectionContext.rootFontSize,...le??{}}}},e.gradients,{smil:e.animations.smil.filter(P=>!S.has(P.animationId)&&!M.has(P.sourceNodeId))});yt&&(W.animationTimeline=yt.cssAnimationSources?.length?{...yt,cssAnimationDocumentStylesFingerprint:nx(Je),cssAnimationInlineStylesFingerprint:rx(W.shapes)}:yt),Je&&(W.documentStyles=Je);let Gt=new Set([...Q.keys()].map(P=>e.useOccurrences.occurrence(P)?.correspondingSourceNodeId).filter(P=>P!==void 0)),zt=[...e.scripts.documentScripts,...e.scripts.elementScripts.filter(P=>P.parentSourceNodeId!==null&&!Gt.has(P.parentSourceNodeId))].map(P=>({...P.script,customAttrs:P.script.customAttrs?{...P.script.customAttrs}:void 0}));zt.length>0&&(W.documentScripts=zt);let Rt=new Set((W.library??[]).map(P=>P.id)),It=new Set((W.clipMaskGroups??[]).map(P=>P.definitionId)),Ke=new Set;for(let P of e.paintServerDefinitions.candidates)(Rt.has(P.destinationId)||It.has(P.destinationId))&&Ke.add(P.sourceNodeId);for(let P of e.gradients.candidates)if(Ke.has(P.sourceNodeId))for(let D of P.templateSourceNodeIds)Ke.add(D);for(let P of e.patterns.candidates)if(Ke.has(P.sourceNodeId))for(let D of P.templateSourceNodeIds)Ke.add(D);let At=new Set(e.symbolUses.definitions.map(P=>P.sourceNodeId));for(let P of At)Ke.add(P);for(let P of e.markers.candidates)P.status==="materialized"&&Ke.add(P.sourceNodeId);let ve=[...e.paintServerDefinitions.definitions(Ke)],_t=new Set(e.paintServerDefinitions.candidates.filter(P=>!Ke.has(P.sourceNodeId)).map(P=>P.sourceNodeId)),ht=new Map,Ct=P=>{if(Ke.has(P)||At.has(P))return;let D=e.paintServerDefinitions.definitionForSourceNode(P);D&&!ve.some(L=>L.id===D.id)&&ht.set(D.id,D)};for(let P of e.filters.bindings){if(P.status!=="materialized")continue;let D=e.resourceDependencies.edges.filter(L=>L.kind==="filter"&&L.propertyName==="filter"&&L.propertyValue===P.authoredValue&&(L.occurrenceId!==null&&L.occurrenceId===P.consumerOccurrenceId||L.occurrenceId===null&&L.fromSourceNodeId===P.consumerSourceNodeId));for(let L of e.resourceDependencies.closureFromEdges(D).materializations)L.role==="referenced-fragment"&&Ct(L.sourceNodeId)}let or=(P,D)=>{let L=e.sourceDocument.index.parent(P);for(;L;){if(L.sourceNodeId===D)return!0;L=e.sourceDocument.index.parent(L.sourceNodeId)}return!1};for(let P of e.useOccurrences.sourceResolutions)P.status!=="resolved"||!P.targetSourceNodeId||[..._t].some(D=>or(P.useSourceNodeId,D))&&Ct(P.targetSourceNodeId);let wr=[...ve,...ht.values()];if(wr.length>0){let P=new Map(e.paintServerDefinitions.candidates.map(ne=>[ne.definition.id,ne])),D=new Set(wr.flatMap(ne=>{let le=P.get(ne.id);return le&&!le.insideDefs?[le.sourceNodeId]:[]})),L=ne=>{let le=e.sourceDocument.index.parent(ne);if(!le||le.sourceNodeId===e.sourceDocument.root.sourceNodeId)return null;let De=ur.get(le.sourceNodeId),be=De??Z.get(le.sourceNodeId);if(!be)return null;let Ue=0;for(let je of le.children)if(je.kind==="element"){if(je.sourceNodeId===ne){let vt=De??A.get(be);return{parentId:be,...vt?{parentDefinitionId:vt}:{},siblingIndex:Ue}}(Z.has(je.sourceNodeId)||D.has(je.sourceNodeId))&&Ue++}return null};W.paintServerDefs=wr.map(ne=>{let le=P.get(ne.id),De=le?.sourceNodeId,be=structuredClone(ne);if(De&&le&&!le.insideDefs){let Ue=L(De);Ue&&(be.authoredPlacement=Ue)}return De&&Io(e,De)&&(be.markup=QV(be.markup)),be})}let Wr=gl(W);return Wr.errors.length>0?{value:null,diagnostics:Wr.errors.map(P=>ZV(`${P.path}: ${P.message}`))}:{value:W,diagnostics:[]}}function tm(e,t={}){let r=xF(e,t);if(!r.value)return{value:null,diagnostics:r.diagnostics};let n=nU(r.value,t),i=[];if(n.value&&t.nodeDecorations){let a=CV(n.value,t.nodeDecorations);i.push(...OV(a,t.source??"svg",t.entrypoint??"svg-document-import"))}return{value:n.value,diagnostics:Object.freeze([...r.diagnostics,...n.diagnostics,...i])}}var iU=1024,aU=64*1024;function fo(e,t,r=0){if(e.length<r+t.length)return!1;for(let n=0;n<t.length;n++)if(e[r+n]!==t[n])return!1;return!0}function yb(e,t,r){let n=t.charCodeAt(0),i=Math.min(e.length,r)-t.length;e:for(let a=0;a<=i;a++)if(e[a]===n){for(let o=1;o<t.length;o++)if(e[a+o]!==t.charCodeAt(o))continue e;return a}return-1}function uk(e){if(e.length<4)return"unknown";if(fo(e,[137,80,78,71,13,10,26,10]))return"png";if(fo(e,[255,216,255]))return"jpeg";if(fo(e,[71,73,70,56]))return"gif";if(fo(e,[82,73,70,70])&&fo(e,[87,69,66,80],8))return"webp";if(yb(e,"%PDF-",iU)>=0)return"pdf";if(fo(e,[197,208,211,198])||yb(e,"%!PS",32)>=0)return"postscript";let t=RP(e.subarray(0,Math.min(e.length,aU))).text.replace(/^/,"").trimStart();if(t.startsWith("{")){let r=t.slice(0,4096);if(r.includes('"schemaVersion"')||r.includes('"shapes"'))return"svgs"}return/<svg[\s>/]/.test(t)||/^<\?xml[\s\S]{0,4096}?<svg[\s>/]/.test(t)?"svg":"unknown"}var vb={dropped:0,rasterized:1,approximated:2,preserved:3};function oU(e){switch(e){case"no-materializable-content":case"unsupported-svg-element":case"unsupported-ingest-capability":case"unresolved-reference":case"circular-use-reference":case"circular-resource-reference":case"use-expansion-limit-exceeded":case"required-features-dropped":case"empty-hyperlink-dropped":case"foreign-structure-unmatched":case"application-rolled-back":return"dropped";default:return"approximated"}}function dk(e){let t=new Map,r=a=>{let o=`${a.vocabulary}|${a.code}|${a.subject??""}`,s=t.get(o);s?t.set(o,{...s,count:s.count+a.count}):t.set(o,a)};for(let a of e.items)r(a);let n=new Set;for(let a of e.ingestDiagnostics){let o=`${a.code}|${a.documentPath??""}|${a.message}`;n.has(o)||(n.add(o),r({bucket:oU(a.code),vocabulary:"ingest",code:a.code,subject:a.sourceId??a.elementName,count:1,message:a.message}))}let i=[...t.values()].sort((a,o)=>vb[a.bucket]-vb[o.bucket]||a.code.localeCompare(o.code));return{version:1,source:e.source,artboards:e.artboards,colorMode:e.colorMode,textMode:e.textMode,counts:e.counts,items:i,fonts:e.fonts,ingestDiagnostics:e.ingestDiagnostics,timings:e.timings,details:e.details}}function wa(e){if(!e)return"";let t=e.replace(/[^A-Za-z0-9_.-]/g,"_");return t&&!/^[A-Za-z_]/.test(t)&&(t=`_${t}`),t}function sU(e,t){return t?wa(`filter-${e}--${t}`):`filter-${e}`}function lU(e,t){if(!Array.isArray(e)||e.length===0)return[];let r=new Map,n=[];for(let i of e){if(!i||typeof i!="object")continue;let a=typeof i.target=="string"&&i.target?i.target:null,o=r.get(a);o||(o={id:sU(t,a),targetLayerId:a,filters:[]},r.set(a,o),n.push(o)),o.filters.push(i)}return n}var He=["updatedAt","clientId"],Md=64,bb=25e4;function te(e,t,r){e.push({path:t,message:r})}function ck(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function $e(e,t,r){return ck(e)?e:(te(r,t,"must be an object"),null)}function pe(e,t,r,n=[],i,a=!0){let o=new Set([...a?["type"]:[],...r,...n]);for(let s of r)Object.hasOwn(e,s)||te(i,`${t}.${s}`,"is required");for(let s of Object.keys(e))o.has(s)||te(i,`${t}.${s}`,"is not allowed")}function se(e,t,r,n=!1){return typeof e!="string"||!n&&e.length===0?(te(r,t,n?"must be a string":"must be a non-empty string"),!1):!0}function $r(e,t,r,n){return typeof e!="number"||!Number.isFinite(e)?(te(r,t,"must be a finite number"),!1):n!==void 0&&e<n?(te(r,t,`must be at least ${n}`),!1):!0}function Zt(e,t,r,n=0){return $r(e,t,r,n)?Number.isInteger(e)?!0:(te(r,t,"must be an integer"),!1):!1}function Jo(e,t,r){return typeof e!="boolean"?(te(r,t,"must be a boolean"),!1):!0}function Me(e,t,r,n,i=!1){e[t]!==void 0&&se(e[t],`${r}.${t}`,n,i)}function pa(e,t,r,n,i){e[t]!==void 0&&$r(e[t],`${r}.${t}`,n,i)}function wt(e,t,r,n,i=0){e[t]!==void 0&&Zt(e[t],`${r}.${t}`,n,i)}function Fo(e,t,r,n){e[t]!==void 0&&Jo(e[t],`${r}.${t}`,n)}function di(e,t,r){return Array.isArray(e)?(e.forEach((n,i)=>se(n,`${t}[${i}]`,r)),!0):(te(r,t,"must be an array"),!1)}function dt(e,t,r,n){return Array.isArray(e)?(e.forEach((i,a)=>n(i,`${t}[${a}]`,r)),!0):(te(r,t,"must be an array"),!1)}function ir(e,t,r){let n=[{value:e,path:t,depth:0}],i=0;for(;n.length>0;){let a=n.pop();if(i++,i>bb){te(r,t,`exceeds the ${bb}-node validation limit`);return}if(a.depth>Md){te(r,a.path,`exceeds the ${Md}-level nesting limit`);continue}let o=a.value;if(!(o===null||typeof o=="string"||typeof o=="boolean")){if(typeof o=="number"){Number.isFinite(o)||te(r,a.path,"must be a finite JSON number");continue}if(Array.isArray(o)){o.forEach((s,l)=>n.push({value:s,path:`${a.path}[${l}]`,depth:a.depth+1}));continue}if(ck(o)){for(let[s,l]of Object.entries(o))n.push({value:l,path:`${a.path}.${s}`,depth:a.depth+1});continue}te(r,a.path,"must be JSON-serializable")}}}function qe(e,t,r){pa(e,"updatedAt",t,r,0),Me(e,"clientId",t,r)}function Ad(e,t,r){let n=$e(e,t,r);if(n)for(let[i,a]of Object.entries(n))se(a,`${t}.${i}`,r,!0)}function sc(e,t,r,n=0){if(n>Md){te(r,t,`exceeds the ${Md}-level shape nesting limit`);return}let i=$e(e,t,r);if(!i)return;pe(i,t,["id","type","state"],[],r),se(i.id,`${t}.id`,r),se(i.type,`${t}.type`,r);let a=$e(i.state,`${t}.state`,r);a&&(Object.hasOwn(a,"extra")&&te(r,`${t}.state.extra`,"is an at-rest field and is not allowed in operations"),pk(a,`${t}.state`,r),ir(a,`${t}.state`,r),a.children!==void 0&&dt(a.children,`${t}.state.children`,r,(o,s,l)=>sc(o,s,l,n+1)),a.definitionOrder!==void 0&&(Zt(a.definitionOrder,`${t}.state.definitionOrder`,r),typeof a.definitionOrder=="number"&&a.definitionOrder<0&&te(r,`${t}.state.definitionOrder`,"must be non-negative")),Me(a,"definitionContainerId",`${t}.state`,r))}function uU(e,t,r){let n=$e(e,t,r);n&&(Object.hasOwn(n,"extra")&&te(r,`${t}.extra`,"is an at-rest field and is not allowed in operations"),pk(n,t,r),ir(n,t,r),n.children!==void 0&&dt(n.children,`${t}.children`,r,(i,a,o)=>sc(i,a,o)),n.definitionOrder!==void 0&&(Zt(n.definitionOrder,`${t}.definitionOrder`,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&te(r,`${t}.definitionOrder`,"must be non-negative")),Me(n,"definitionContainerId",t,r))}function dU(e,t,r){let n=$e(e,t,r);if(n){if(se(n.id,`${t}.id`,r),n.type!=="clip"&&n.type!=="mask"&&te(r,`${t}.type`,'must be "clip" or "mask"'),n.definitionPlacement!==void 0&&n.definitionPlacement!=="defs"&&n.definitionPlacement!=="document"&&te(r,`${t}.definitionPlacement`,'must be "defs" or "document"'),n.referenceChannel!==void 0&&n.referenceChannel!=="attribute"&&n.referenceChannel!=="style"&&n.referenceChannel!=="stylesheet"&&te(r,`${t}.referenceChannel`,'must be "attribute", "style", or "stylesheet"'),wt(n,"referenceStyleOrder",t,r),typeof n.referenceStyleOrder=="number"&&n.referenceStyleOrder<0&&te(r,`${t}.referenceStyleOrder`,"must be non-negative"),wt(n,"definitionOrder",t,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&te(r,`${t}.definitionOrder`,"must be non-negative"),Me(n,"definitionContainerId",t,r),n.authoredPlacement!==void 0){let i=$e(n.authoredPlacement,`${t}.authoredPlacement`,r);i&&(pe(i,`${t}.authoredPlacement`,["parentId","siblingIndex"],["parentDefinitionId"],r),se(i.parentId,`${t}.authoredPlacement.parentId`,r),Me(i,"parentDefinitionId",`${t}.authoredPlacement`,r),Zt(i.siblingIndex,`${t}.authoredPlacement.siblingIndex`,r),typeof i.siblingIndex=="number"&&i.siblingIndex<0&&te(r,`${t}.authoredPlacement.siblingIndex`,"must be non-negative"))}di(n.clipShapeIds,`${t}.clipShapeIds`,r),di(n.contentShapeIds,`${t}.contentShapeIds`,r),n.parentId!==null&&se(n.parentId,`${t}.parentId`,r),wt(n,"siblingIndex",t,r),ir(n,t,r)}}function xb(e,t,r){let n=$e(e,t,r);n&&(se(n.id,`${t}.id`,r),n.orientation!=="horizontal"&&n.orientation!=="vertical"&&te(r,`${t}.orientation`,'must be "horizontal" or "vertical"'),$r(n.position,`${t}.position`,r),$r(n.controlPointOffset,`${t}.controlPointOffset`,r),Me(n,"color",t,r,!0),pa(n,"opacity",t,r),ir(n,t,r))}function wb(e,t,r){let n=$e(e,t,r);n&&(se(n.id,`${t}.id`,r),n.type!=="distance"&&n.type!=="angle"&&te(r,`${t}.type`,'must be "distance" or "angle"'),dt(n.points,`${t}.points`,r,(i,a,o)=>{let s=$e(i,a,o);s&&($r(s.x,`${a}.x`,o),$r(s.y,`${a}.y`,o))}),Jo(n.visible,`${t}.visible`,r),Zt(n.snapDivisions,`${t}.snapDivisions`,r,1),Me(n,"color",t,r,!0),pa(n,"opacity",t,r),ir(n,t,r))}var Ib=["title","description","author","keywords","license","licenseUrl","language","customMetadata","role","ariaLabel","aria","rawMetadata","rawMetadataAuthoritative","rawDescription","rawHtmlMetadata","descriptiveElements","coordinatePrecision"];function kb(e,t,r,n){let i=$e(e,t,r);if(i){pe(i,t,n?[]:["title","description","author","keywords","license","licenseUrl","language","customMetadata"],n?Ib:Ib.slice(8),r,!1);for(let a of["title","description","author","license","licenseUrl","language"])(!n||i[a]!==void 0)&&se(i[a],`${t}.${a}`,r,!0);(!n||i.keywords!==void 0)&&di(i.keywords,`${t}.keywords`,r),(!n||i.customMetadata!==void 0)&&Ad(i.customMetadata,`${t}.customMetadata`,r),Me(i,"role",t,r,!0),Me(i,"ariaLabel",t,r,!0),i.aria!==void 0&&Ad(i.aria,`${t}.aria`,r),Me(i,"rawMetadata",t,r,!0),Fo(i,"rawMetadataAuthoritative",t,r),Me(i,"rawDescription",t,r,!0),Me(i,"rawHtmlMetadata",t,r,!0),i.descriptiveElements!==void 0&&dt(i.descriptiveElements,`${t}.descriptiveElements`,r,(a,o,s)=>{let l=$e(a,o,s);l&&(pe(l,o,["kind","language","text","rawXml"],[],s,!1),l.kind!=="title"&&l.kind!=="desc"&&te(s,`${o}.kind`,'must be "title" or "desc"'),l.language!==null&&se(l.language,`${o}.language`,s,!0),se(l.text,`${o}.text`,s,!0),se(l.rawXml,`${o}.rawXml`,s,!0))}),wt(i,"coordinatePrecision",t,r)}}function Sb(e,t,r){let n=$e(e,t,r);n&&(se(n.id,`${t}.id`,r),n.source!=="inline"&&n.source!=="external"&&te(r,`${t}.source`,'must be "inline" or "external"'),se(n.content,`${t}.content`,r,!0),se(n.type,`${t}.type`,r,!0),Me(n,"svgId",t,r,!0),Me(n,"href",t,r,!0),Fo(n,"async",t,r),Fo(n,"defer",t,r),n.customAttrs!==void 0&&Ad(n.customAttrs,`${t}.customAttrs`,r),ir(n,t,r))}function Cd(e,t,r){e!==null&&se(e,t,r,!0)}function fk(e,t,r){let n=$e(e,t,r);n&&(pe(n,t,["name","localName","prefix","namespaceUri","value"],[],r,!1),se(n.name,`${t}.name`,r),se(n.localName,`${t}.localName`,r),Cd(n.prefix,`${t}.prefix`,r),Cd(n.namespaceUri,`${t}.namespaceUri`,r),se(n.value,`${t}.value`,r,!0))}function cU(e,t,r){fk(e,t,r);let n=$e(e,t,[]);n?.localName==="id"&&n.namespaceUri===null&&te(r,t,"must not duplicate the definition container svgId authority")}function rm(e,t,r){let n=$e(e,t,r);if(n){if(n.kind==="element"){pe(n,t,["kind","name","localName","prefix","namespaceUri","attributes","children"],[],r,!1),se(n.name,`${t}.name`,r),se(n.localName,`${t}.localName`,r),Cd(n.prefix,`${t}.prefix`,r),Cd(n.namespaceUri,`${t}.namespaceUri`,r),dt(n.attributes,`${t}.attributes`,r,fk),dt(n.children,`${t}.children`,r,rm);return}["text","comment","cdata","processing-instruction"].includes(String(n.kind))||te(r,`${t}.kind`,"must be a supported document extension node kind"),pe(n,t,["kind","value"],[],r,!1),se(n.value,`${t}.value`,r,!0)}}function pk(e,t,r){Object.hasOwn(e,"rawContent")&&te(r,`${t}.rawContent`,"is noncanonical; use structured foreignContent nodes"),e.foreignContent!==void 0&&dt(e.foreignContent,`${t}.foreignContent`,r,rm)}function $b(e,t,r){let n=$e(e,t,r);n&&(pe(n,t,["id","placement","order","element"],["definitionOrder","definitionContainerId"],r,!1),se(n.id,`${t}.id`,r),n.placement!=="root"&&n.placement!=="defs"&&te(r,`${t}.placement`,'must be "root" or "defs"'),Zt(n.order,`${t}.order`,r),wt(n,"definitionOrder",t,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&te(r,`${t}.definitionOrder`,"must be non-negative"),Me(n,"definitionContainerId",t,r),rm(n.element,`${t}.element`,r),ir(n,t,r))}function fU(e,t,r){let n=$e(e,t,r);if(n){if(pe(n,t,["id","order"],["svgId","attributes","authoredPlacement"],r,!1),se(n.id,`${t}.id`,r),Zt(n.order,`${t}.order`,r),typeof n.order=="number"&&n.order<0&&te(r,`${t}.order`,"must be non-negative"),Me(n,"svgId",t,r),n.attributes!==void 0&&dt(n.attributes,`${t}.attributes`,r,cU),n.authoredPlacement!==void 0){let i=$e(n.authoredPlacement,`${t}.authoredPlacement`,r);i&&(pe(i,`${t}.authoredPlacement`,["parentId","siblingIndex"],["parentDefinitionId"],r),se(i.parentId,`${t}.authoredPlacement.parentId`,r),Me(i,"parentDefinitionId",`${t}.authoredPlacement`,r),Zt(i.siblingIndex,`${t}.authoredPlacement.siblingIndex`,r),typeof i.siblingIndex=="number"&&i.siblingIndex<0&&te(r,`${t}.authoredPlacement.siblingIndex`,"must be non-negative"))}ir(n,t,r)}}function Nb(e,t,r){let n=$e(e,t,r);if(n){if(se(n.id,`${t}.id`,r),se(n.css,`${t}.css`,r,!0),Jo(n.preserved,`${t}.preserved`,r),n.placement!=="root"&&n.placement!=="defs"&&te(r,`${t}.placement`,'must be "root" or "defs"'),wt(n,"definitionOrder",t,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&te(r,`${t}.definitionOrder`,"must be non-negative"),Me(n,"definitionContainerId",t,r),n.authoredPlacement!==void 0){let i=$e(n.authoredPlacement,`${t}.authoredPlacement`,r);i&&(pe(i,`${t}.authoredPlacement`,["parentId","siblingIndex"],["parentDefinitionId"],r),se(i.parentId,`${t}.authoredPlacement.parentId`,r),Me(i,"parentDefinitionId",`${t}.authoredPlacement`,r),Zt(i.siblingIndex,`${t}.authoredPlacement.siblingIndex`,r),typeof i.siblingIndex=="number"&&i.siblingIndex<0&&te(r,`${t}.authoredPlacement.siblingIndex`,"must be non-negative"))}Me(n,"scopeDefinitionId",t,r),n.scopeDefinitionId!==void 0&&n.placement!=="defs"&&te(r,`${t}.scopeDefinitionId`,"requires defs placement"),Me(n,"svgId",t,r,!0),Me(n,"type",t,r,!0),Me(n,"media",t,r,!0),n.customAttrs!==void 0&&Ad(n.customAttrs,`${t}.customAttrs`,r),ir(n,t,r)}}function Mb(e,t,r){let n=$e(e,t,r);if(n){if(se(n.name,`${t}.name`,r),["string","color","number"].includes(String(n.type))||te(r,`${t}.type`,'must be "string", "color", or "number"'),se(n.defaultValue,`${t}.defaultValue`,r,!0),Me(n,"label",t,r,!0),Me(n,"description",t,r,!0),n.mode!==void 0&&n.mode!=="live"&&n.mode!=="stamped"&&te(r,`${t}.mode`,'must be "live" or "stamped"'),n.source!==void 0){let i=$e(n.source,`${t}.source`,r);i&&i.kind!=="user"&&te(r,`${t}.source.kind`,'must be "user"')}ir(n,t,r)}}function Ab(e,t,r){let n=$e(e,t,r);n&&(se(n.id,`${t}.id`,r),se(n.filename,`${t}.filename`,r,!0),se(n.format,`${t}.format`,r),ir(n,t,r))}function pU(e,t,r){let n=$e(e,t,r);n&&(Zt(n.glyphId,`${t}.glyphId`,r),Array.isArray(n.codepoints)?n.codepoints.forEach((i,a)=>Zt(i,`${t}.codepoints[${a}]`,r)):te(r,`${t}.codepoints`,"must be an array"),se(n.svgDocument,`${t}.svgDocument`,r,!0),Me(n,"glyphName",t,r,!0),wt(n,"advanceWidth",t,r),Me(n,"sourceFamily",t,r,!0),wt(n,"sourceGlyphId",t,r),Me(n,"label",t,r,!0),ir(n,t,r))}function Cb(e,t,r){let n=$e(e,t,r);if(!n)return;se(n.id,`${t}.id`,r),Me(n,"sourceId",t,r);let i=["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"],a=n.role===void 0?"resource":String(n.role);a!=="resource"&&a!=="referenced-fragment"&&te(r,`${t}.role`,"is not a supported raw SVG definition role");let o=String(n.type);if((a==="resource"&&!i.includes(o)||a==="referenced-fragment"&&!/^[A-Za-z][\w.-]*$/u.test(o))&&te(r,`${t}.type`,"is not a supported paint-server type"),se(n.markup,`${t}.markup`,r),n.definitionChildIds!==void 0&&di(n.definitionChildIds,`${t}.definitionChildIds`,r),n.sourceDefinitionChildIds!==void 0&&di(n.sourceDefinitionChildIds,`${t}.sourceDefinitionChildIds`,r),Array.isArray(n.definitionChildIds)&&Array.isArray(n.sourceDefinitionChildIds)&&n.definitionChildIds.length!==n.sourceDefinitionChildIds.length&&te(r,t,"definition child id arrays must have equal lengths"),n.authoredPlacement!==void 0){let s=$e(n.authoredPlacement,`${t}.authoredPlacement`,r);s&&(pe(s,`${t}.authoredPlacement`,["parentId","siblingIndex"],["parentDefinitionId"],r),se(s.parentId,`${t}.authoredPlacement.parentId`,r),Me(s,"parentDefinitionId",`${t}.authoredPlacement`,r),Zt(s.siblingIndex,`${t}.authoredPlacement.siblingIndex`,r),typeof s.siblingIndex=="number"&&s.siblingIndex<0&&te(r,`${t}.authoredPlacement.siblingIndex`,"must be non-negative"))}Fo(n,"passthrough",t,r),wt(n,"definitionOrder",t,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&te(r,`${t}.definitionOrder`,"must be non-negative"),Me(n,"definitionContainerId",t,r),ir(n,t,r)}function Ob(e,t,r){let n=$e(e,t,r);if(!n)return;se(n.id,`${t}.id`,r),se(n.name,`${t}.name`,r,!0),n.metadata!==void 0&&ir(n.metadata,`${t}.metadata`,r);let i=n.kind;if(["symbol","marker","linear-gradient","radial-gradient","pattern","filter"].includes(String(i))||te(r,`${t}.kind`,"is not a supported library kind"),wt(n,"definitionOrder",t,r),typeof n.definitionOrder=="number"&&n.definitionOrder<0&&te(r,`${t}.definitionOrder`,"must be non-negative"),Me(n,"definitionContainerId",t,r),n.authoredPlacement!==void 0){let a=$e(n.authoredPlacement,`${t}.authoredPlacement`,r);a&&(pe(a,`${t}.authoredPlacement`,["parentId","siblingIndex"],["parentDefinitionId"],r),se(a.parentId,`${t}.authoredPlacement.parentId`,r),Me(a,"parentDefinitionId",`${t}.authoredPlacement`,r),Zt(a.siblingIndex,`${t}.authoredPlacement.siblingIndex`,r),typeof a.siblingIndex=="number"&&a.siblingIndex<0&&te(r,`${t}.authoredPlacement.siblingIndex`,"must be non-negative"))}if(n.definitionPlacement!==void 0&&!["defs","document"].includes(String(n.definitionPlacement))&&te(r,`${t}.definitionPlacement`,'must be "defs" or "document"'),(i==="symbol"||i==="marker")&&(dt(n.shapes,`${t}.shapes`,r,sc),n.animations!==void 0&&dt(n.animations,`${t}.animations`,r,nm)),i==="symbol"){n.defKind!==void 0&&!["symbol","group","shape"].includes(String(n.defKind))&&te(r,`${t}.defKind`,'must be "symbol", "group", or "shape"'),n.definitionPlacement==="document"&&(n.defKind??"symbol")!=="symbol"&&te(r,`${t}.definitionPlacement`,'may be "document" only for symbol roots'),n.defKind==="shape"&&(!Array.isArray(n.shapes)||n.shapes.length!==1)&&te(r,`${t}.shapes`,"must contain exactly one native root shape");for(let a of["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"])Me(n,a,t,r,!0);if(n.rootAttributes!==void 0){let a=$e(n.rootAttributes,`${t}.rootAttributes`,r);if(a)for(let[o,s]of Object.entries(a))["viewBox","preserveAspectRatio","x","y","width","height","refX","refY"].includes(o)&&te(r,`${t}.rootAttributes.${o}`,"must use its typed symbol field"),se(s,`${t}.rootAttributes.${o}`,r,!0)}if(n.definitionContentOrder!==void 0){let a=Array.isArray(n.definitionContentOrder)?n.definitionContentOrder:null;if(!a)te(r,`${t}.definitionContentOrder`,"must be an array");else{let o=new Set(Array.isArray(n.shapes)?n.shapes.map(l=>l&&typeof l=="object"&&!Array.isArray(l)?l.id:void 0).filter(l=>typeof l=="string"&&l.length>0):[]),s=new Set;a.forEach((l,u)=>{let d=`${t}.definitionContentOrder[${u}]`,c=$e(l,d,r);if(!c||(c.kind!=="shape"&&c.kind!=="definition"&&te(r,`${d}.kind`,'must be "shape" or "definition"'),se(c.id,`${d}.id`,r),typeof c.id!="string"||c.id.length===0))return;let f=`${String(c.kind)}\0${c.id}`;s.has(f)&&te(r,d,"must not duplicate another content entry"),s.add(f),c.kind==="shape"&&!o.has(c.id)&&te(r,`${d}.id`,"must name a root shape of this definition"),c.kind==="definition"&&c.id===n.id&&te(r,`${d}.id`,"must not name the containing definition")})}}for(let a of["wrapperAttrs","groups","overflow"])n[a]!==void 0&&te(r,`${t}.${a}`,"is schema-v7 migration input only")}if(i==="marker"){Me(n,"viewBox",t,r,!0),Me(n,"preserveAspectRatio",t,r,!0);for(let a of["refX","refY","markerWidth","markerHeight"])$r(n[a],`${t}.${a}`,r);if(n.markerUnits!=="strokeWidth"&&n.markerUnits!=="userSpaceOnUse"&&te(r,`${t}.markerUnits`,'must be "strokeWidth" or "userSpaceOnUse"'),n.orient!=="auto"&&n.orient!=="auto-start-reverse"&&!(typeof n.orient=="number"&&Number.isFinite(n.orient))&&te(r,`${t}.orient`,"must be an orientation keyword or finite number"),n.authoredGeometry!==void 0){let a=$e(n.authoredGeometry,`${t}.authoredGeometry`,r);if(a)for(let o of["refX","refY","markerWidth","markerHeight","markerUnits","orient"])Me(a,o,`${t}.authoredGeometry`,r,!0)}if(n.rootAttributes!==void 0){let a=$e(n.rootAttributes,`${t}.rootAttributes`,r);if(a)for(let[o,s]of Object.entries(a))["id","viewBox","preserveAspectRatio","refX","refY","markerWidth","markerHeight","markerUnits","orient"].includes(o)&&te(r,`${t}.rootAttributes.${o}`,"must use its typed marker field"),se(s,`${t}.rootAttributes.${o}`,r,!0)}}if(i==="linear-gradient"||i==="radial-gradient"){let a=`${t}.gradient`,o=$e(n.gradient,a,r);if(o){if(o.rootAttributes!==void 0){let l=$e(o.rootAttributes,`${a}.rootAttributes`,r);if(l)for(let[u,d]of Object.entries(l))qd(u)||te(r,`${a}.rootAttributes.${u}`,"must be a safe non-typed gradient attribute"),se(d,`${a}.rootAttributes.${u}`,r,!0)}Me(o,"templateId",a,r,!0);let s=i==="linear-gradient"?["x1","y1","x2","y2","opacity"]:["cx","cy","fx","fy","r","ry","rotation","opacity"];for(let l of s)pa(o,l,a,r);if(pa(o,"fr",a,r),o.authoredGeometry!==void 0){let l=`${a}.authoredGeometry`,u=$e(o.authoredGeometry,l,r);if(u){let d=new Set(i==="linear-gradient"?["x1","y1","x2","y2","gradientTransform"]:["cx","cy","fx","fy","r","fr","gradientTransform"]);for(let[c,f]of Object.entries(u))d.has(c)?se(f,`${l}.${c}`,r,!0):te(r,`${l}.${c}`,"is not allowed")}}if(o.gradientTransform!==void 0){let l=o.gradientTransform;(!Array.isArray(l)||l.length!==6||!l.every(u=>typeof u=="number"&&Number.isFinite(u)))&&te(r,`${a}.gradientTransform`,"must be a 6-element finite affine matrix")}dt(o.stops,`${a}.stops`,r,(l,u,d)=>{let c=$e(l,u,d);c&&(Me(c,"id",u,d),$r(c.offset,`${u}.offset`,d),se(c.color,`${u}.color`,d,!0),pa(c,"opacity",u,d))})}}if(i==="pattern"){let a=`${t}.pattern`,o=$e(n.pattern,a,r);if(o){if(o.rootAttributes!==void 0){let s=$e(o.rootAttributes,`${a}.rootAttributes`,r);if(s)for(let[l,u]of Object.entries(s))Yd(l)||te(r,`${a}.rootAttributes.${l}`,"must be a safe non-typed pattern attribute"),se(u,`${a}.rootAttributes.${l}`,r,!0)}Me(o,"templateId",a,r,!0);for(let s of["x","y","width","height","scale","rotation","opacity"])pa(o,s,a,r);o.patternUnits!==void 0&&o.patternUnits!=="userSpaceOnUse"&&o.patternUnits!=="objectBoundingBox"&&te(r,`${a}.patternUnits`,'must be "userSpaceOnUse" or "objectBoundingBox"'),o.patternContentUnits!==void 0&&o.patternContentUnits!=="userSpaceOnUse"&&o.patternContentUnits!=="objectBoundingBox"&&te(r,`${a}.patternContentUnits`,'must be "userSpaceOnUse" or "objectBoundingBox"');for(let s of["svgContent","patternTransform","viewBox","preserveAspectRatio"])Me(o,s,a,r,!0);if(o.authoredGeometry!==void 0){let s=`${a}.authoredGeometry`,l=$e(o.authoredGeometry,s,r);if(l)for(let[u,d]of Object.entries(l))["x","y","width","height"].includes(u)?se(d,`${s}.${u}`,r,!0):te(r,`${s}.${u}`,"is not a supported authored pattern field")}}}i==="filter"&&dt(n.filters,`${t}.filters`,r,(a,o,s)=>{$e(a,o,s)}),ir(n,t,r)}function hk(e,t,r,n){let i=$e(e,t,r);i&&((n||i.id!==void 0)&&se(i.id,`${t}.id`,r),$r(i.time,`${t}.time`,r,0),typeof i.value!="string"&&!(typeof i.value=="number"&&Number.isFinite(i.value))&&!(Array.isArray(i.value)&&i.value.every(a=>typeof a=="number"&&Number.isFinite(a)))&&te(r,`${t}.value`,"must be a string, finite number, or finite number array"),se(i.easing,`${t}.easing`,r),ir(i,t,r))}function nm(e,t,r){let n=$e(e,t,r);if(n){if(se(n.id,`${t}.id`,r),se(n.shapeId,`${t}.shapeId`,r),se(n.property,`${t}.property`,r),n.textSpanTarget!==void 0){let i=$e(n.textSpanTarget,`${t}.textSpanTarget`,r);i&&(se(i.attributeName,`${t}.textSpanTarget.attributeName`,r),Array.isArray(i.spanIds)&&i.spanIds.length===0&&te(r,`${t}.textSpanTarget.spanIds`,"must contain at least one id"),dt(i.spanIds,`${t}.textSpanTarget.spanIds`,r,(a,o,s)=>{(typeof a!="string"||a.length===0)&&te(s,o,"must be a non-empty string")}),Array.isArray(i.spanIds)&&i.spanIds.every(a=>typeof a=="string")&&new Set(i.spanIds).size!==i.spanIds.length&&te(r,`${t}.textSpanTarget.spanIds`,"must contain unique ids"))}if(Jo(n.enabled,`${t}.enabled`,r),Fo(n,"locked",t,r),Me(n,"sourceCssAnimationId",t,r),Me(n,"sourceMpathId",t,r),Me(n,"targetAttribute",t,r),n.targetAttributeValueType!==void 0&&n.targetAttributeValueType!=="number"&&n.targetAttributeValueType!=="color"&&n.targetAttributeValueType!=="string"&&te(r,`${t}.targetAttributeValueType`,'must be "number", "color", or "string"'),n.definitionTarget!==void 0){let i=$e(n.definitionTarget,`${t}.definitionTarget`,r);if(i&&(se(i.definitionId,`${t}.definitionTarget.definitionId`,r),Me(i,"nodeId",`${t}.definitionTarget`,r),typeof i.definitionId=="string"&&i.definitionId.length>0)){let a=`definition:${i.definitionId}${typeof i.nodeId=="string"&&i.nodeId.length>0?`/${i.nodeId}`:""}`;n.shapeId!==a&&te(r,`${t}.shapeId`,`must equal ${a}`)}}n.simpleDuration!==void 0&&n.simpleDuration!=="indefinite"&&te(r,`${t}.simpleDuration`,'must be "indefinite" when present'),n.simpleDuration==="indefinite"&&n.cycleDuration!==void 0&&te(r,`${t}.cycleDuration`,"must be absent for an indefinite simple duration"),n.sourceSmilPlacement!==void 0&&n.sourceSmilPlacement!=="document"&&n.sourceSmilPlacement!=="defs"&&te(r,`${t}.sourceSmilPlacement`,'must be "document" or "defs" when present'),Fo(n,"sourceSmilParentTarget",t,r),n.sourceSmilParentTarget!==void 0&&n.sourceSmilParentTarget!==!0&&te(r,`${t}.sourceSmilParentTarget`,"must be true when present"),n.sourceSmilParentTarget===!0&&n.sourceSmilPlacement!=="document"&&te(r,`${t}.sourceSmilPlacement`,'must be "document" for an implicit parent target'),wt(n,"sourceSmilOrder",t,r),wt(n,"sourceSmilDefinitionOrder",t,r),typeof n.sourceSmilDefinitionOrder=="number"&&n.sourceSmilDefinitionOrder<0&&te(r,`${t}.sourceSmilDefinitionOrder`,"must be non-negative"),Me(n,"sourceSmilDefinitionContainerId",t,r),(n.sourceSmilDefinitionOrder!==void 0||n.sourceSmilDefinitionContainerId!==void 0)&&n.sourceSmilPlacement!=="defs"&&te(r,`${t}.sourceSmilPlacement`,'must be "defs" when definition placement fields are present'),n.textPathStartOffsetUnit!==void 0&&n.textPathStartOffsetUnit!=="%"&&n.textPathStartOffsetUnit!=="user"&&te(r,`${t}.textPathStartOffsetUnit`,'must be "%" or "user" when present'),dt(n.keyframes,`${t}.keyframes`,r,(i,a,o)=>hk(i,a,o,!0)),ir(n,t,r)}}function mk(e,t,r){let n=new Set,i=new Set;dt(e,t,r,(a,o,s)=>{let l=$e(a,o,s);if(!l)return;pe(l,o,["id","trackIds","trackFingerprints"],[],s,!1),se(l.id,`${o}.id`,s)&&(n.has(l.id)&&te(s,`${o}.id`,"must be unique"),n.add(l.id));let u=di(l.trackIds,`${o}.trackIds`,s)?l.trackIds:[],d=di(l.trackFingerprints,`${o}.trackFingerprints`,s)?l.trackFingerprints:[];u.length!==d.length&&te(s,o,"track ids and fingerprints must have equal lengths");for(let c of u)i.has(c)&&te(s,`${o}.trackIds`,"must be unique"),i.add(c)})}function hU(e,t,r){let n=$e(e,t,r);n&&($r(n.duration,`${t}.duration`,r,0),Jo(n.loop,`${t}.loop`,r),$r(n.playbackSpeed,`${t}.playbackSpeed`,r,0),n.cssAnimationSources!==void 0&&mk(n.cssAnimationSources,`${t}.cssAnimationSources`,r),Me(n,"cssAnimationDocumentStylesFingerprint",t,r),Me(n,"cssAnimationInlineStylesFingerprint",t,r),dt(n.tracks,`${t}.tracks`,r,nm))}function mU(e,t,r){let n=$e(e,t,r);if(!n)return;Zt(n.start,`${t}.start`,r),Zt(n.end,`${t}.end`,r),typeof n.start=="number"&&typeof n.end=="number"&&n.end<=n.start&&te(r,`${t}.end`,"must be greater than start");let i=$e(n.style,`${t}.style`,r);i&&Object.keys(i).length===0&&te(r,`${t}.style`,"must not be empty"),ir(n,t,r)}function gU(e,t,r){let n=$e(e,t,r);n&&(pe(n,t,["start","deleteCount","insert"],[],r,!1),Zt(n.start,`${t}.start`,r),Zt(n.deleteCount,`${t}.deleteCount`,r),se(n.insert,`${t}.insert`,r,!0))}var yU={"shape:add":(e,t,r)=>{pe(e,t,["shape"],[],r),sc(e.shape,`${t}.shape`,r)},"shape:update":(e,t,r)=>{if(pe(e,t,["id","state"],["propTimestamps","clientId","textSplices","baseSeq"],r),se(e.id,`${t}.id`,r),uU(e.state,`${t}.state`,r),e.propTimestamps!==void 0){let n=$e(e.propTimestamps,`${t}.propTimestamps`,r);if(n)for(let[i,a]of Object.entries(n))$r(a,`${t}.propTimestamps.${i}`,r,0)}Me(e,"clientId",t,r),e.textSplices!==void 0&&dt(e.textSplices,`${t}.textSplices`,r,gU),wt(e,"baseSeq",t,r)},"shape:remove":(e,t,r)=>{pe(e,t,["id"],[],r),se(e.id,`${t}.id`,r)},"text:format":(e,t,r)=>{pe(e,t,["id","ranges"],["baseSeq",...He],r),se(e.id,`${t}.id`,r),dt(e.ranges,`${t}.ranges`,r,mU),wt(e,"baseSeq",t,r),qe(e,t,r)},"scene:move":(e,t,r)=>{pe(e,t,["id","parentId","index"],He,r),se(e.id,`${t}.id`,r),e.parentId!==null&&se(e.parentId,`${t}.parentId`,r),Zt(e.index,`${t}.index`,r),qe(e,t,r)},"scene:place":(e,t,r)=>{pe(e,t,["id","parentId","orderKey"],He,r),se(e.id,`${t}.id`,r),e.parentId!==null&&se(e.parentId,`${t}.parentId`,r),se(e.orderKey,`${t}.orderKey`,r),qe(e,t,r)},"clipMask:upsert":(e,t,r)=>{pe(e,t,["clipMaskGroup"],["index",...He],r),dU(e.clipMaskGroup,`${t}.clipMaskGroup`,r),wt(e,"index",t,r),qe(e,t,r)},"clipMask:remove":(e,t,r)=>{pe(e,t,["id"],He,r),se(e.id,`${t}.id`,r),qe(e,t,r)},"guides:set":(e,t,r)=>{pe(e,t,["guides"],[],r),dt(e.guides,`${t}.guides`,r,xb)},"guide:upsert":(e,t,r)=>{pe(e,t,["guide"],["index",...He],r),xb(e.guide,`${t}.guide`,r),wt(e,"index",t,r),qe(e,t,r)},"guide:remove":(e,t,r)=>{pe(e,t,["id"],He,r),se(e.id,`${t}.id`,r),qe(e,t,r)},"guide:move":(e,t,r)=>{pe(e,t,["id","index"],He,r),se(e.id,`${t}.id`,r),Zt(e.index,`${t}.index`,r),qe(e,t,r)},"measurements:set":(e,t,r)=>{pe(e,t,["measurements"],[],r),dt(e.measurements,`${t}.measurements`,r,wb)},"measurement:upsert":(e,t,r)=>{pe(e,t,["measurement"],["index",...He],r),wb(e.measurement,`${t}.measurement`,r),wt(e,"index",t,r),qe(e,t,r)},"measurement:remove":(e,t,r)=>{pe(e,t,["id"],He,r),se(e.id,`${t}.id`,r),qe(e,t,r)},"measurement:move":(e,t,r)=>{pe(e,t,["id","index"],He,r),se(e.id,`${t}.id`,r),Zt(e.index,`${t}.index`,r),qe(e,t,r)},"metadata:set":(e,t,r)=>{pe(e,t,["metadata"],[],r),kb(e.metadata,`${t}.metadata`,r,!1)},"metadata:patch":(e,t,r)=>{pe(e,t,["patch"],["removeKeys",...He],r),kb(e.patch,`${t}.patch`,r,!0),e.removeKeys!==void 0&&di(e.removeKeys,`${t}.removeKeys`,r),qe(e,t,r)},"documentScripts:set":(e,t,r)=>{pe(e,t,["documentScripts"],[],r),dt(e.documentScripts,`${t}.documentScripts`,r,Sb)},"documentExtensions:set":(e,t,r)=>{pe(e,t,["documentExtensions"],[],r),dt(e.documentExtensions,`${t}.documentExtensions`,r,$b)},"definitionContainers:set":(e,t,r)=>{pe(e,t,["definitionContainers"],[],r),dt(e.definitionContainers,`${t}.definitionContainers`,r,fU)},"documentExtension:upsert":(e,t,r)=>{pe(e,t,["documentExtension"],["index",...He],r),$b(e.documentExtension,`${t}.documentExtension`,r),wt(e,"index",t,r),qe(e,t,r)},"documentExtension:remove":(e,t,r)=>{pe(e,t,["id"],He,r),se(e.id,`${t}.id`,r),qe(e,t,r)},"documentScript:upsert":(e,t,r)=>{pe(e,t,["documentScript"],["index",...He],r),Sb(e.documentScript,`${t}.documentScript`,r),wt(e,"index",t,r),qe(e,t,r)},"documentScript:remove":(e,t,r)=>{pe(e,t,["id"],He,r),se(e.id,`${t}.id`,r),qe(e,t,r)},"documentStyles:set":(e,t,r)=>{pe(e,t,["documentStyles"],[],r),dt(e.documentStyles,`${t}.documentStyles`,r,Nb)},"documentStyle:upsert":(e,t,r)=>{pe(e,t,["documentStyle"],["index",...He],r),Nb(e.documentStyle,`${t}.documentStyle`,r),wt(e,"index",t,r),qe(e,t,r)},"documentStyle:remove":(e,t,r)=>{pe(e,t,["id"],He,r),se(e.id,`${t}.id`,r),qe(e,t,r)},"templateVariables:set":(e,t,r)=>{pe(e,t,["templateVariables"],He,r),dt(e.templateVariables,`${t}.templateVariables`,r,Mb),qe(e,t,r)},"templateVariable:upsert":(e,t,r)=>{pe(e,t,["templateVariable"],["index",...He],r),Mb(e.templateVariable,`${t}.templateVariable`,r),wt(e,"index",t,r),qe(e,t,r)},"templateVariable:remove":(e,t,r)=>{pe(e,t,["name"],He,r),se(e.name,`${t}.name`,r),qe(e,t,r)},"exportItems:set":(e,t,r)=>{pe(e,t,["exportItems"],He,r),dt(e.exportItems,`${t}.exportItems`,r,Ab),qe(e,t,r)},"exportItem:upsert":(e,t,r)=>{pe(e,t,["exportItem"],["index",...He],r),Ab(e.exportItem,`${t}.exportItem`,r),wt(e,"index",t,r),qe(e,t,r)},"exportItem:remove":(e,t,r)=>{pe(e,t,["id"],He,r),se(e.id,`${t}.id`,r),qe(e,t,r)},"colorGlyphLibrary:set":(e,t,r)=>{if(pe(e,t,["colorGlyphLibrary"],He,r),e.colorGlyphLibrary!==null){let n=$e(e.colorGlyphLibrary,`${t}.colorGlyphLibrary`,r);n&&(n.version!==1&&te(r,`${t}.colorGlyphLibrary.version`,"must be 1"),dt(n.entries,`${t}.colorGlyphLibrary.entries`,r,pU),ir(n,`${t}.colorGlyphLibrary`,r))}qe(e,t,r)},"animation:set":(e,t,r)=>{pe(e,t,["animationTimeline"],[],r),e.animationTimeline!==void 0&&hU(e.animationTimeline,`${t}.animationTimeline`,r)},"animation:config":(e,t,r)=>{pe(e,t,["config"],He,r);let n=$e(e.config,`${t}.config`,r);n&&(pe(n,`${t}.config`,["duration","loop","playbackSpeed"],["cssAnimationSources","cssAnimationDocumentStylesFingerprint","cssAnimationInlineStylesFingerprint"],r,!1),$r(n.duration,`${t}.config.duration`,r,0),Jo(n.loop,`${t}.config.loop`,r),$r(n.playbackSpeed,`${t}.config.playbackSpeed`,r,0),n.cssAnimationSources!==void 0&&mk(n.cssAnimationSources,`${t}.config.cssAnimationSources`,r),Me(n,"cssAnimationDocumentStylesFingerprint",`${t}.config`,r),Me(n,"cssAnimationInlineStylesFingerprint",`${t}.config`,r)),qe(e,t,r)},"animation:clear":(e,t,r)=>{pe(e,t,[],He,r),qe(e,t,r)},"animationTrack:upsert":(e,t,r)=>{pe(e,t,["track"],["index",...He],r),nm(e.track,`${t}.track`,r),wt(e,"index",t,r),qe(e,t,r)},"animationTrack:remove":(e,t,r)=>{pe(e,t,["id"],He,r),se(e.id,`${t}.id`,r),qe(e,t,r)},"animationKeyframe:upsert":(e,t,r)=>{pe(e,t,["trackId","keyframe"],He,r),se(e.trackId,`${t}.trackId`,r),hk(e.keyframe,`${t}.keyframe`,r,!0),qe(e,t,r)},"animationKeyframe:remove":(e,t,r)=>{pe(e,t,["trackId","keyframeId"],He,r),se(e.trackId,`${t}.trackId`,r),se(e.keyframeId,`${t}.keyframeId`,r),qe(e,t,r)},"library:set":(e,t,r)=>{pe(e,t,["library"],[],r),dt(e.library,`${t}.library`,r,Ob)},"library:upsert":(e,t,r)=>{pe(e,t,["def"],["index",...He],r),Ob(e.def,`${t}.def`,r),wt(e,"index",t,r),qe(e,t,r)},"library:remove":(e,t,r)=>{pe(e,t,["id"],He,r),se(e.id,`${t}.id`,r),qe(e,t,r)},"paintServerDefs:set":(e,t,r)=>{pe(e,t,["paintServerDefs"],[],r),dt(e.paintServerDefs,`${t}.paintServerDefs`,r,Cb)},"paintServerDef:upsert":(e,t,r)=>{pe(e,t,["paintServerDef"],["index",...He],r),Cb(e.paintServerDef,`${t}.paintServerDef`,r),wt(e,"index",t,r),qe(e,t,r)},"paintServerDef:remove":(e,t,r)=>{pe(e,t,["id"],He,r),se(e.id,`${t}.id`,r),qe(e,t,r)},"presence:cursor":(e,t,r)=>{pe(e,t,["position"],[],r);let n=$e(e.position,`${t}.position`,r);n&&(pe(n,`${t}.position`,["x","y"],[],r,!1),$r(n.x,`${t}.position.x`,r),$r(n.y,`${t}.position.y`,r))},"presence:selection":(e,t,r)=>{pe(e,t,["shapeIds"],[],r),di(e.shapeIds,`${t}.shapeIds`,r)}},V7=new Set(Object.keys(yU));function vU(e){let t=e.state.children;return Array.isArray(t)?t:void 0}var dp=new Set(["group","hyperlink","switch","container","svg"]);function gk(e,t,r,n){for(let i of e){r.set(i.id,t),n.set(i.id,i);let a=vU(i);a&&gk(a,i.id,r,n)}}function bU(e){let t=e.sceneTree;if(!t||t.length===0)return;let r=new Map,n=new Map;if(gk(e.shapes,null,r,n),n.size===0)return;let i=new Map;for(let c of t){let f=i.get(c.parentId)??[];f.push(c),i.set(c.parentId,f)}let a=new Map,o=(c,f)=>{let p=a.get(c);p?p.push(f):a.set(c,[f])},s=new Set,l=new Set,u=(c,f)=>{for(let p of Gh(i.get(c)??[])){if(l.has(p.id))continue;l.add(p.id);let h=n.get(p.id);if(!h){u(p.id,f);continue}o(f,h),s.add(h.id),dp.has(h.type)&&u(p.id,h.id)}};if(u(null,null),s.size===0)return;let d=c=>{let f=r.get(c)??null,p=new Set;for(;f!==null&&!p.has(f);){p.add(f);let h=n.get(f);if(h&&dp.has(h.type))return f;f=r.get(f)??null}return null};for(let[c,f]of n)s.has(c)||o(d(c),f);for(let[c,f]of n){if(!dp.has(f.type))continue;let p=f.state,h=a.get(c);h&&h.length>0?p.children=h:"children"in p&&delete p.children}e.shapes=a.get(null)??[]}var Tb={schemaVersion:{kind:"stamped",note:"Serializer stamps CURRENT_SCHEMA_VERSION; no live state."},shapes:{kind:"graph",note:"SceneNode props on graph-owned nodes; the editor Shape registry is the interaction adapter."},viewboxes:{kind:"shape-derived",note:"Projected from `view` shapes on every read (DocumentRootManager.getViewboxes)."},guides:{kind:"aggregate"},measurements:{kind:"aggregate"},sceneTree:{kind:"graph",note:"Serialized by walking the SceneGraph; inline state.children is its projection."},clipMaskGroups:{kind:"aggregate"},documentMetadata:{kind:"aggregate"},documentExtensions:{kind:"aggregate"},definitionContainers:{kind:"aggregate"},documentScripts:{kind:"aggregate"},documentStyles:{kind:"aggregate"},templateVariables:{kind:"aggregate"},animationTimeline:{kind:"aggregate"},library:{kind:"aggregate"},paintServerDefs:{kind:"aggregate"},colorGlyphLibrary:{kind:"aggregate"},exportItems:{kind:"aggregate"},unknownFields:{kind:"aggregate"}},U7=Object.keys(Tb).filter(e=>Tb[e].kind==="aggregate");var yk=new Set(["fill","fill-opacity","stroke","stroke-width","stroke-opacity","stroke-linejoin","stroke-linecap","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","markers"]),vk=new Set(["element-opacity","blend-mode","filter","visibility","display","visible","css-clip-path","css-mask-properties","metadata","system-language","required-extensions","inline-style","authored-attributes","container-presentation"]),xU=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-opacity","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","marker","marker-start","marker-mid","marker-end","paint-order","color"]);function wU(e){let t=new Set,r=n=>{if(!(!n||typeof n!="object"||Array.isArray(n)))for(let i of Object.keys(n))xU.has(i)&&t.add(i)};return r(e.inlineStyle),r(e.authoredAttributes),[...t].sort()}function bk(e){let t=new Set;for(let r of Xo)if(e.has(r.id))for(let n of r.keys)t.add(n);return t}var IU=bk(yk),kU=bk(vk);function SU(e){return wa(`${e.id}-geometry`)}function xk(e,t){let r=e.state.appearance;return Array.isArray(r)&&r.length>0?!0:Kb(e.state,t)?HA(Zb(e.state,t)):!1}function $U(e){let t={...e};for(let r of IU)delete t[r];for(let r of kU)delete t[r];return delete t.appearance,delete t.graphicStyleId,t.inheritFill=!0,t.inheritStroke=!0,t.fillType="solid",t.strokeType="solid",t}function NU(e,t={}){let r={};if(e.kind==="fill")r.fillType=e.paintType??"solid",e.color!==void 0&&(r.fillColor=e.color),e.gradient!==void 0&&(r.fillGradient=e.gradient),e.libraryId!==void 0&&(r.fillLibraryId=e.libraryId),e.opacity!==void 0&&(r.fillOpacity=e.opacity),e.authoredPaint!==void 0&&(r.authoredFillPaint=e.authoredPaint),r.strokeType="none";else{r.strokeType=e.paintType??"solid",e.color!==void 0&&(r.borderColor=e.color),e.gradient!==void 0&&(r.strokeGradient=e.gradient),e.libraryId!==void 0&&(r.strokeLibraryId=e.libraryId),e.opacity!==void 0&&(r.strokeOpacity=e.opacity),e.width!==void 0&&(r.borderWidth=e.width),e.linejoin!==void 0&&(r.strokeLinejoin=e.linejoin),e.linecap!==void 0&&(r.strokeLinecap=e.linecap),e.miterlimit!==void 0&&(r.strokeMiterlimit=e.miterlimit),e.dasharray!==void 0&&(r.strokeDasharray=e.dasharray),e.dashoffset!==void 0&&(r.dashOffset=e.dashoffset),e.authoredPaint!==void 0&&(r.authoredStrokePaint=e.authoredPaint),r.fillType="none";let n=t.withMarkers;n&&(n.markerStart!==void 0&&(r.markerStart=n.markerStart),n.markerMid!==void 0&&(r.markerMid=n.markerMid),n.markerEnd!==void 0&&(r.markerEnd=n.markerEnd))}return r}function Pb(e,t,r,n){let i=Ho(e),a=Xo.filter(o=>t.has(o.id)).flatMap(o=>hl(o,i,{shapeId:r,includeAuthoredAttributes:!0}));return n(a)}function MU(e,t){if(!xk(e,t.styles))return null;let r=wU(e.state);if(r.length>0)return t.reportUnexpandable?.(e,r),null;let n=XA(e.state,t.styles);return n.length===0?Db(e,[],t):Db(e,n,t)}function Db(e,t,r){let n=SU(e),i={...e,state:$U(e.state)},a=r.renderShape(i),o=CU(a,n,r.escapeAttributeValue),s=t.findIndex(c=>c.kind==="stroke"),l=t.map((c,f)=>{let p=NU(c,{withMarkers:f===s?e.state:void 0}),h=Pb(p,yk,e.id,r.serializePresentationWrites),m=AU(c,r.escapeAttributeValue);return`<use href="#${r.escapeAttributeValue(n)}"${h}${m}/>`}),u=Pb(e.state,vk,e.id,r.serializePresentationWrites),d=`<g data-shape-id="${r.escapeAttributeValue(e.id)}"${u}>`;return{geometryId:n,geometryMarkup:o,open:d,close:"</g>",members:l}}function AU(e,t){let r=e.filterLibraryIds;return!Array.isArray(r)||r.length===0?"":` filter="${r.map(n=>`url(#${t(n)})`).join(" ")}"`}function CU(e,t,r){let n=/^<([A-Za-z][\w:.-]*)/.exec(e);if(!n)return e;let i=n[0].length;return`${e.slice(0,i)} id="${r(t)}"${e.slice(i)}`}function Hs(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(Hs).join(",")}]`:`{${Object.entries(e).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${JSON.stringify(t)}:${Hs(r)}`).join(",")}}`}function qs(e,t,r){for(let n of e){n.type==="symbol-instance"&&r(n,t);let i=n.state.children;if(!Array.isArray(i))continue;let a=t;n.type==="svg"&&(a=Xh(n,t).viewport.childPercentBasis??t),qs(i,a,r)}}function th(e,t,r,n,i=new Set){if(!i.has(e.id)){i.add(e.id);for(let a of e.definitionContentOrder??[]){if(a.kind!=="definition")continue;let o=t.symbol(a.id);!o||(o.defKind??"symbol")==="symbol"||(qs(o.shapes,r,n),th(o,t,r,n,i))}i.delete(e.id)}}function Qu(e,t){for(let r of e){if(r.type==="symbol-instance"){let i=String(r.state.symbolId??"").trim();i&&t.add(i)}let n=r.state.children;Array.isArray(n)&&Qu(n,t)}}function OU(e,t){let r=new Map;for(let a of e){if(a.kind!=="symbol")continue;let o=new Set;Qu(a.shapes,o);for(let u of Object.values(a.variants??{}))Qu(u,o);let s=new Set,l=u=>{if(!s.has(u.id)){s.add(u.id);for(let d of u.definitionContentOrder??[]){if(d.kind!=="definition")continue;let c=t.symbol(d.id);!c||(c.defKind??"symbol")==="symbol"||(Qu(c.shapes,o),l(c))}s.delete(u.id)}};l(a),r.set(a.id,o)}let n=new Map,i=a=>{let o=n.get(a);if(o==="visiting"||o==="cycle-reachable")return!0;if(o==="acyclic")return!1;n.set(a,"visiting");let s=!1;for(let l of r.get(a)??[])t.symbol(l)&&i(l)&&(s=!0);return n.set(a,s?"cycle-reachable":"acyclic"),s};for(let a of r.keys())i(a);return new Set([...n].flatMap(([a,o])=>o==="cycle-reachable"?[a]:[]))}function TU(e,t,r={}){let n=r.reservedIds??new Set,i=Jd(e),a=OU(e,i),o=new Map,s=[],l=new WeakMap,u=new Map,d=[],c=(C,O)=>{l.set(C,O);let z=u.get(C.id);z?z.push(O):u.set(C.id,[O]),d.push(...O.diagnostics)},f=(C,O,z)=>{if(l.has(C))return;let R=String(C.state.symbolId??"").trim(),U=R!==""&&i.duplicateIds.has(R),V=R?i.symbol(R):void 0;if(U||!V){c(C,{targetId:null,definition:null,materializationKey:null,materialization:null,parentViewport:z,viewport:null,diagnostics:[{code:U?"duplicate-library-id":"unresolved-symbol-definition",shapeId:C.id,message:U?`Symbol instance ${C.id} targets duplicate library id ${R}.`:`Symbol instance ${C.id} targets missing symbol definition ${R||"(blank)"}.`}]});return}let Y=r.instancePolicy?.(C),G=Y?.initialVariantKey===void 0?C:{...C,state:{...C.state,variantKey:Y.initialVariantKey}},H=$x(V,G),X=Y?.dedicated===!0,B=UI(C,V,z,r.viewportHost);if(O.includes(H.materializationKey)){c(C,{targetId:null,definition:V,materializationKey:H.materializationKey,materialization:null,parentViewport:z,viewport:B,diagnostics:[...H.diagnostics,{code:"symbol-cycle",shapeId:C.id,message:`Symbol instance cycle detected through ${V.id}.`}]});return}let ae=z?`${z.width},${z.height}`:"none",K=!H.materialized&&!X&&!a.has(V.id),W=K?`${H.materializationKey}\0native-base\0viewport=${ae}`:`${H.materializationKey}\0path=${O.join("")}\0viewport=${ae}`+(X?`\0dedicated=${C.id}`:""),J=o.get(W),Q=J===void 0;if(!J){let Ie=structuredClone(H.shapes);J={occurrenceKey:W,materializationKey:H.materializationKey,candidateTargetId:X?`${V.id}--ovr-${C.id}`:H.candidateTargetId,targetId:X?`${V.id}--ovr-${C.id}`:H.candidateTargetId,definition:V,shapes:Ie,materialized:H.materialized||X,forcedDedicated:X,activeDepth:O.length,parentViewport:z,viewport:B},o.set(W,J),s.push(J)}let Z={targetId:J.targetId,definition:V,materializationKey:H.materializationKey,materialization:null,diagnostics:H.diagnostics,parentViewport:z,viewport:B,pending:J};if(c(C,Z),K&&!Q)return;let Ae=[...O,H.materializationKey];qs(J.shapes,J.viewport.childPercentBasis??z,(Ie,Xe)=>f(Ie,Ae,Xe)),th(J.definition,i,J.viewport.childPercentBasis??z,(Ie,Xe)=>f(Ie,Ae,Xe))};qs(t,r.parentViewport,(C,O)=>{f(C,[],O)});let p=new Map,h=new Map,m=new Set,g=C=>{let O=p.get(C);if(O)return O;if(m.has(C))throw new Error(`Materialization occurrence graph retained a cycle at ${C.occurrenceKey}.`);m.add(C);let z=[];qs(C.shapes,C.viewport.childPercentBasis??C.parentViewport,V=>{let Y=l.get(V);if(Y?.pending){z.push(`resolved:${g(Y.pending)}`);return}z.push(Hs({materializationKey:Y?.materializationKey??null,diagnostics:Y?.diagnostics.map(G=>G.code)??["missing-resolution"]}))}),th(C.definition,i,C.viewport.childPercentBasis??C.parentViewport,V=>{let Y=l.get(V);if(Y?.pending){z.push(`resolved:${g(Y.pending)}`);return}z.push(Hs({materializationKey:Y?.materializationKey??null,diagnostics:Y?.diagnostics.map(G=>G.code)??["missing-resolution"]}))}),m.delete(C);let R=Hs({materializationKey:C.materializationKey,nested:z,forcedOccurrence:C.forcedDedicated?C.occurrenceKey:null}),U=h.get(R);return U||(U=`materialization-signature:${h.size+1}`,h.set(R,U)),p.set(C,U),U},v=(C,O)=>C.activeDepth-O.activeDepth||C.candidateTargetId.localeCompare(O.candidateTargetId)||C.occurrenceKey.localeCompare(O.occurrenceKey),b=new Map;for(let C of s){let O=g(C),z=b.get(O);(!z||v(C,z)<0)&&b.set(O,C)}let y=new Map;for(let C of s)y.set(C,b.get(g(C)));let I=s.filter(C=>y.get(C)===C),x=new Map;for(let C of I){let O=x.get(C.materializationKey);(!O||O.forcedDedicated&&!C.forcedDedicated||O.forcedDedicated===C.forcedDedicated&&v(C,O)<0)&&x.set(C.materializationKey,C)}let k=C=>C.forcedDedicated||C.materialized||x.get(C.materializationKey)!==C,$=new Set(I.filter(C=>!k(C)).map(C=>C.definition.id)),A=new Set([...n,...$,...I.filter(k).map(C=>C.candidateTargetId)]),S=new Set([...n,...$]);for(let C of I){if(!k(C)){C.targetId=C.definition.id;continue}let O=C.candidateTargetId,z=O;if(S.has(z)){let R=2;do z=`${O}-${R++}`;while(A.has(z)||S.has(z))}C.targetId=z,S.add(z)}let M=new Map,T=I.map(C=>{let O={materializationKey:C.materializationKey,targetId:C.targetId,candidateTargetId:C.candidateTargetId,definition:C.definition,shapes:C.shapes,parentViewport:C.parentViewport,viewport:C.viewport};return M.set(C,O),O});for(let C of s){let O=y.get(C),z=M.get(O);C.targetId=z.targetId,C!==O&&M.set(C,{materializationKey:C.materializationKey,targetId:z.targetId,candidateTargetId:C.candidateTargetId,definition:C.definition,shapes:C.shapes,parentViewport:C.parentViewport,viewport:C.viewport})}let E=new Set;for(let C of u.values())for(let O of C){if(!O.pending)continue;O.targetId=O.pending.targetId;let z=M.get(O.pending)??null;z&&E.has(O.pending)?O.materialization={...z,parentViewport:O.parentViewport,viewport:O.viewport??z.viewport}:(O.materialization=z,E.add(O.pending)),delete O.pending}return{materializations:T,diagnostics:d,resolve(C){let O=l.get(C);if(O)return O;let z=u.get(C.id);return z?.length===1?z[0]:void 0}}}function PU(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function wk(e){return e?e.includes("]]>")?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):/[<&>]/.test(e)?`<![CDATA[${e}]]>`:e:""}function DU(e){if(!e||e.length===0)return"";let t=[];for(let r of e){let n=new Map;if(r.svgId&&n.set("id",r.svgId),r.type&&n.set("type",r.type),r.source==="external"&&r.href&&n.set("href",r.href),r.crossorigin&&n.set("crossorigin",r.crossorigin),r.async&&n.set("async",""),r.defer&&n.set("defer",""),r.customAttrs)for(let[a,o]of Object.entries(r.customAttrs))n.has(a)||n.set(a,o);let i="<script";for(let[a,o]of n)i+=` ${a}="${PU(o)}"`;r.source==="inline"&&r.content?i+=`>${wk(r.content)}</script>`:i+="/>",t.push(i)}return t.join("")}var jU="text/css";function rh(e){return e.includes("{")?e.replace(/([^{}]*)\{([^{}]*)\}/g,(t,r,n)=>{let i=jb(n);if(i===n)return t;let a=String(r).trim();return!/^(?:from|to|[\d.]+%)(?:\s*,\s*(?:from|to|[\d.]+%))*$/i.test(a)&&!/[^\s;]/.test(i)?"":`${r}{${i}}`}):jb(e)}var EU=/(?:^|[\s;])(?:-(?:webkit|moz|o|ms)-)?animation(?:-[a-z-]+)?\s*:[^;]*(?:;|$)/gi,zU=/(?:^|[\s;])(?:-(?:webkit|moz|o|ms)-)?transition(?:-[a-z-]+)?\s*:[^;]*(?:;|$)/gi,RU=/(?:^|[\s;])(?:-(?:webkit|moz|o|ms)-)?(?:transform-origin|transform-box)\s*:[^;]*(?:;|$)/gi;function jb(e){let t=!1,r=e.replace(EU,n=>(t=!0,cp(n)));return r=r.replace(zU,n=>cp(n)),t&&(r=r.replace(RU,n=>cp(n))),r}function cp(e){return e.startsWith(";")?";":""}function _U(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function im(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;")}function Ik(e){let t=e.map(({name:r,defaultValue:n})=>` --${r}: ${n};`);return t.length?`:root, svg {
66
+ ${t.join(`
67
+ `)}
68
+ }
69
+ `:""}function FU(e){if(!e||e.length===0)return"";let t=Ik(e);return t?`<style id="svgsketch-variables">${im(t)}</style>`:""}function Bu(e,t={}){if(!e||e.length===0)return"";let r=[];for(let n of e){if(t.placement&&n.placement!==t.placement)continue;let i=new Map;if(n.svgId&&i.set("id",n.svgId),n.type&&n.type!==jU&&i.set("type",n.type),n.media&&i.set("media",n.media),n.customAttrs)for(let[s,l]of Object.entries(n.customAttrs))i.has(s)||i.set(s,l);let a="<style";for(let[s,l]of i)a+=` ${s}="${_U(l)}"`;let o=t.retainAnimationDeclarations?n.css:rh(n.css);a+=`>${im(o)}</style>`,r.push(a)}return r.join("")}function Eb(e,t){return t?e.variants?.[t]??e.shapes:e.shapes}function zb(e,t){return!t||Object.keys(t).length===0?e:e.map(r=>{let n=t[r.id];return!n||Object.keys(n).length===0?r:{...r,state:{...r.state,...n}}})}function am(e){let t=[];for(let r of e.timeline.tracks){if(r.property!=="instanceVariant"||r.enabled===!1)continue;let n=e.instances.get(r.shapeId);if(!n)continue;let i=e.getSymbol(n.symbolId);if(!i)continue;let a=e.instanceSymbolIds.get(n.id);if(!a||!e.existingInnerIds.has(a))continue;let o=[...r.keyframes].sort((s,l)=>s.time-l.time);o.length<2||t.push({symbolId:a,def:i,overrides:n.symbolOverrides,keyframes:o})}return t}function om(e){let t=new Map;for(let[r,n]of e.existingInnerIds)t.set(r,new Set(n));return t}function LU(e){return e.replace(/&apos;/g,"'").replace(/&quot;/g,'"').replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}function po(e,t){let r=ui(e),n=0;for(;r.startsWith("<!--",n);){let l=r.indexOf("-->",n);if(l===-1)return null;n=l+3}let i=r.indexOf("<",n);if(i===-1)return null;let a=r.indexOf(">",i);if(a===-1)return null;let o=r.slice(i,a+1),s=new RegExp(`\\s${t.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")}="([^"]*)"`).exec(o);return s?LU(s[1]):null}var oa=(e,t=0)=>typeof e=="number"&&Number.isFinite(e)?e:t;function BU(e,t,r){let n=e.transformMatrix;if(n&&n.length>=6)return{x:n[0]*t.x+n[2]*t.y+n[4],y:n[1]*t.x+n[3]*t.y+n[5]};let i=oa(e.translateX),a=oa(e.translateY),o=e.rawTransform;if(o){let m=Zr(Fi(o)),g=m[0]*t.x+m[2]*t.y+m[4],v=m[1]*t.x+m[3]*t.y+m[5];return{x:g+i,y:v+a}}let s=oa(e.rotation),l=oa(e.skewX),u=oa(e.skewY),d=oa(e.scaleX,1),c=oa(e.scaleY,1),f=d!==1||c!==1;if(s===0&&l===0&&u===0&&!f)return{x:t.x+i,y:t.y+a};let p=t.x-r.x,h=t.y-r.y;if(u!==0&&(h=h+p*Math.tan(u*Math.PI/180)),l!==0&&(p=p+h*Math.tan(l*Math.PI/180)),f&&(p*=d,h*=c),s!==0){let m=s*Math.PI/180,g=Math.cos(m),v=Math.sin(m),b=p*g-h*v,y=p*v+h*g;p=b,h=y}return{x:p+r.x+i,y:h+r.y+a}}function Rb(e,t){let r=gT(t);if(!r)return e.resolveShapeCenterFallback?.(t)??null;let n=t.state,i=n.customPivot??r;return BU(n,r,i)}var VU=[{key:"fillColor",attr:"fill"},{key:"borderColor",attr:"stroke"},{key:"borderWidth",attr:"stroke-width"},{key:"opacity",attr:"opacity"},{key:"fillOpacity",attr:"fill-opacity"},{key:"strokeOpacity",attr:"stroke-opacity"},{key:"fontSize",attr:"font-size"}],UU={circle:{x:"cx",y:"cy",radius:"r"},ellipse:{x:"cx",y:"cy",rx:"rx",ry:"ry"},rectangle:{x:"x",y:"y",width:"width",height:"height"},square:{x:"x",y:"y",width:"width",height:"height"},line:{x1:"x1",y1:"y1",x2:"x2",y2:"y2"},image:{x:"x",y:"y",width:"width",height:"height"},text:{x:"x",y:"y"}},_b=new Set(["triangle","polygon","star","diamond","ngon","cross","heart","gear","arrow","cloud","ring","lightning","speech-bubble","spiral"]),GU=[{key:"fillColor",prop:"fill"},{key:"borderColor",prop:"stroke"},{key:"borderWidth",prop:"stroke-width"},{key:"opacity",prop:"opacity"},{key:"fillOpacity",prop:"fill-opacity"},{key:"strokeOpacity",prop:"stroke-opacity"}],WU=[{key:"fillColor",prop:"fill"},{key:"borderColor",prop:"stroke"},{key:"borderWidth",prop:"strokeWidth"},{key:"opacity",prop:"opacity"},{key:"fillOpacity",prop:"fillOpacity"},{key:"strokeOpacity",prop:"strokeOpacity"}];function Fb(e,t){return e+(((t-e)%360+540)%360-180)}function Yr(e,t,r,n,i){return{element:"animate",attributes:[["attributeName",e],["from",t],["to",r],["begin",n],["dur",i],["fill","freeze"]]}}function fp(e,t,r,n,i,a){return{element:"animateTransform",attributes:[["attributeName","transform"],["type",e],["from",t],["to",r],["begin",n],["dur",i],["fill","freeze"],["additive",a]]}}function XU(e){let t=e.state.opacity;return t!==void 0?String(t):"1"}function kk(e){let t=e.state.opacity;return t!==void 0?String(Number(t)):"1"}function*sm(e){let{keyframes:t,def:r,overrides:n}=e;for(let i=0;i<t.length-1;i++){let a=t[i],o=t[i+1],s=String(a.value??""),l=String(o.value??"");if(s===l)continue;let u=zb(Eb(r,s),n),d=zb(Eb(r,l),n);yield{treeA:u,treeB:d,aById:new Map(u.map(c=>[c.id,c])),bById:new Map(d.map(c=>[c.id,c])),index:i,beginSec:a.time,durSec:o.time-a.time}}}function HU(e){let t=am(e);if(t.length===0)return[];let r=om(e),n=[];for(let i of t){let a=r.get(i.symbolId),o=[];for(let s of sm(i)){let l=`${s.beginSec}s`,u=`${s.durSec}s`;for(let d of s.treeB){let c=s.aById.get(d.id);if(!c||!a.has(d.id))continue;let f=c.state,p=d.state,h=[];for(let{key:g,attr:v}of VU){let b=f[g],y=p[g];b===void 0&&y===void 0||b!==y&&(b==null||y==null||h.push({action:"animate",spec:Yr(v,String(b),String(y),l,u)}))}let m=UU[d.type];if(m)for(let[g,v]of Object.entries(m)){let b=f[g],y=p[g];b===void 0&&y===void 0||b!==y&&(b==null||y==null||h.push({action:"animate",spec:Yr(v,String(b),String(y),l,u)}))}if(_b.has(d.type)){let g=Number(f.cx),v=Number(f.cy),b=Number(p.cx),y=Number(p.cy),I=Number(f.rotation??0),x=Number(p.rotation??0);if(Number.isFinite(g)&&Number.isFinite(v)&&Number.isFinite(b)&&Number.isFinite(y)&&Number.isFinite(I)&&Number.isFinite(x)&&(g!==b||v!==y||I!==x)){s.index===0&&h.push({action:"setBaseTransform",transform:`translate(${g}, ${v}) rotate(${I})`}),h.push({action:"animate",spec:fp("translate",`${g} ${v}`,`${b} ${y}`,l,u,"replace")});let A=Fb(I,x);h.push({action:"animate",spec:fp("rotate",String(I),String(A),l,u,"sum")})}let k=f.sides,$=p.sides;if((f.radius!==p.radius||f.shiftAngle!==p.shiftAngle||f.cornerRadius!==p.cornerRadius)&&k===$){let A=po(c,"d"),S=po(d,"d");A&&S&&A!==S&&h.push({action:"animate",spec:Yr("d",A,S,l,u)})}else if(k!==$){let A=`${d.id}--xf`,S=1;for(;a.has(A);)A=`${d.id}--xf${S++}`;a.add(A),h.push({action:"crossfade",innerId:A,shape:d,fadeOut:Yr("opacity","1","0",l,u),fadeIn:Yr("opacity","0",XU(d),l,u)})}}if(d.type==="polyline"){let g=f.polylinePoints??null,v=p.polylinePoints??null;if(g&&v&&g.length===v.length){let b=po(c,"points"),y=po(d,"points");b&&y&&b!==y&&h.push({action:"animate",spec:Yr("points",b,y,l,u)})}}if(f.lineStyle!==p.lineStyle||f.dashLength!==p.dashLength||f.gapLength!==p.gapLength){let g=po(c,"stroke-dasharray"),v=po(d,"stroke-dasharray");g&&v&&g!==v&&h.push({action:"animate",spec:Yr("stroke-dasharray",g,v,l,u)})}if(!_b.has(d.type)){let g=Number(f.rotation??0),v=Number(p.rotation??0);if(Number.isFinite(g)&&Number.isFinite(v)&&g!==v){let b=Rb(e,c),y=Rb(e,d);if(b&&y){let I=Fb(g,v);h.push({action:"animate",spec:fp("rotate",`${g} ${b.x} ${b.y}`,`${I} ${y.x} ${y.y}`,l,u,"sum")})}}}for(let[g,v]of[["fillGradient","fill"],["strokeGradient","stroke"]]){let b=qU(f,p,g,v,l,u);b&&h.push(b)}o.push({op:"withInner",innerId:d.id,actions:h})}for(let d of s.treeA)s.bById.has(d.id)||a.has(d.id)&&o.push({op:"withInner",innerId:d.id,actions:[{action:"animate",spec:Yr("opacity","1","0",l,u)}]});for(let d of s.treeB)s.aById.has(d.id)||(a.add(d.id),o.push({op:"ensureInner",innerId:d.id,shape:d,animations:[Yr("opacity","0",kk(d),l,u)]}))}n.push({symbolId:i.symbolId,ops:o})}return n}function qU(e,t,r,n,i,a){let o=e[r],s=t[r];if(!o||!s||o.type!==s.type||!Array.isArray(o.stops)||!Array.isArray(s.stops)||o.stops.length!==s.stops.length)return null;let l=[];for(let c=0;c<o.stops.length;c++){let f=o.stops[c],p=s.stops[c],h=[];f.offset!==p.offset&&h.push(Yr("offset",String(f.offset),String(p.offset),i,a)),f.color!==p.color&&h.push(Yr("stop-color",f.color,p.color,i,a)),f.opacity!==p.opacity&&h.push(Yr("stop-opacity",String(f.opacity),String(p.opacity),i,a)),h.length>0&&l.push({index:c,animations:h})}let u=o.type==="linear-gradient"?["x1","y1","x2","y2"]:["cx","cy","fx","fy","r"],d=[];for(let c of u){let f=o[c],p=s[c];typeof f!="number"||typeof p!="number"||f===p||d.push(Yr(c,String(f),String(p),i,a))}return{action:"gradient",paintAttr:n,expectedStopCount:o.stops.length,stops:l,gradient:d}}var YU=e=>e.replace(/[^a-zA-Z0-9_-]/g,"_");function KU(e){let t=am(e);if(t.length===0)return{stylesheet:null,symbols:[]};let r=om(e),n=[],i=0,a=[],o=new Map;for(let s of t){let l=r.get(s.symbolId),u=a.find(f=>f.symbolId===s.symbolId);u||(u={symbolId:s.symbolId,scopeClass:`svgsketch-variant-${YU(s.symbolId)}`,ensure:[],assignments:[]},a.push(u),o.set(u,new Map));let d=o.get(u),c=(f,p,h,m,g,v)=>{let b=`svgsketch-vt-${++i}`;n.push(`@keyframes ${b} { 0% { ${m}: ${p}; } 100% { ${m}: ${h}; } }`);let y=`${b} ${v}s linear ${g}s forwards`,I=d.get(f);I?I.push(y):d.set(f,[y])};for(let f of sm(s))if(!(f.durSec<=0)){for(let p of f.treeB){let h=f.aById.get(p.id);if(!h||!l.has(p.id))continue;let m=h.state,g=p.state;for(let{key:v,prop:b}of GU){let y=m[v],I=g[v];y===void 0&&I===void 0||y!==I&&(y==null||I==null||c(p.id,String(y),String(I),b,f.beginSec,f.durSec))}}for(let p of f.treeA)f.bById.has(p.id)||l.has(p.id)&&c(p.id,"1","0","opacity",f.beginSec,f.durSec);for(let p of f.treeB)f.aById.has(p.id)||(l.has(p.id)||(u.ensure.push({innerId:p.id,shape:p}),l.add(p.id)),c(p.id,"0",kk(p),"opacity",f.beginSec,f.durSec))}}for(let[s,l]of o)for(let[u,d]of l)s.assignments.push({innerId:u,animation:d.join(", ")});return{stylesheet:n.length>0?n.join(`
70
+ `):null,symbols:a}}function ZU(e){let t=am(e);if(t.length===0)return{scriptBody:null,symbols:[]};let r=om(e),n=[],i=[];for(let a of t){let o=r.get(a.symbolId),s=i.find(l=>l.symbolId===a.symbolId);s||(s={symbolId:a.symbolId,ensure:[]},i.push(s));for(let l of sm(a)){let u=l.beginSec*1e3,d=l.durSec*1e3;if(d<=0)continue;let c=(f,p)=>{let h={},m={};for(let[g,[v,b]]of Object.entries(p))h[g]=v,m[g]=b;n.push({symbolId:a.symbolId,innerId:f,keyframes:[h,m],durationMs:d,delayMs:u})};for(let f of l.treeB){let p=l.aById.get(f.id);if(!p)continue;let h=p.state,m=f.state,g={};for(let{key:v,prop:b}of WU){let y=h[v],I=m[v];y===void 0&&I===void 0||y!==I&&(y==null||I==null||(g[b]=[y,I]))}Object.keys(g).length>0&&c(f.id,g)}for(let f of l.treeA)l.bById.has(f.id)||c(f.id,{opacity:[1,0]});for(let f of l.treeB){if(l.aById.has(f.id))continue;o.has(f.id)||(s.ensure.push({innerId:f.id,shape:f}),o.add(f.id));let p=f.state.opacity,h=p!==void 0?Number(p):1;c(f.id,{opacity:[0,h]})}}}return n.length===0?{scriptBody:null,symbols:i}:{scriptBody:`
71
+ (function () {
72
+ function start() {
73
+ var specs = ${JSON.stringify(n)};
74
+ for (var i = 0; i < specs.length; i++) {
75
+ var spec = specs[i];
76
+ var symbolEl = document.getElementById(spec.symbolId);
77
+ if (!symbolEl) continue;
78
+ var innerEl = symbolEl.querySelector('[data-svgsketch-inner-id="' + spec.innerId + '"]');
79
+ if (!innerEl || !innerEl.animate) continue;
80
+ try {
81
+ innerEl.animate(spec.keyframes, {
82
+ duration: spec.durationMs,
83
+ delay: spec.delayMs,
84
+ fill: 'forwards',
85
+ easing: 'linear'
86
+ });
87
+ } catch (err) {
88
+ // Element.animate may throw on unsupported property names; skip silently.
89
+ }
90
+ }
91
+ }
92
+ if (document.readyState === 'loading') {
93
+ document.addEventListener('DOMContentLoaded', start);
94
+ } else {
95
+ start();
96
+ }
97
+ })();
98
+ `,symbols:i}}var JU={definitionContent:new Map,innerAnimations:new Map,innerRootOverrides:new Map,gradientStopAnimations:new Map,gradientRootAnimations:new Map,stylesheet:null,scriptBody:null,addressedSymbolIds:new Set,isEmpty:!0};function Sk(e,t){for(let r of e??[]){if(r.type==="symbol-instance"){let n=String(r.state.symbolId??"").trim();n&&t.set(r.id,{id:r.id,symbolId:n,symbolOverrides:r.state.symbolOverrides})}Sk(r.state.children,t)}return t}function $k(e,t,r){for(let n of e??[]){if(n.type==="symbol-instance"){let i=t.resolve(n)?.targetId;i&&r.set(n.id,i)}$k(n.state.children,t,r)}return r}function QU(e){let t=new Map;for(let r of e.materializations)t.set(r.targetId,new Set(r.shapes.map(n=>n.id)));return t}function eG(e){let t=e.snapshot.library??[],r=new Map,n=new Set;for(let i of t)r.has(i.id)?n.add(i.id):r.set(i.id,i);return i=>{let a=new Map,o=new Set,s=d=>{a.has(d.id)?o.add(d.id):a.set(d.id,d);for(let c of d.state.children??[])s(c)};s(i);let l={roots:()=>[i],shape:d=>a.get(d),duplicateShapeIds:()=>o,libraryDefinition:d=>r.get(d),duplicateLibraryIds:()=>n,children:d=>d.state.children??[]},{bounds:u}=ec(l,i,e.parentViewport?{parentViewport:e.parentViewport}:{},e.measureShapeTextBounds?{measureText:e.measureShapeTextBounds}:{});return u?{x:(u.minX+u.maxX)/2,y:(u.minY+u.maxY)/2}:(yr({severity:"warning",code:"unresolved-variant-transition-pivot",shapeId:i.id,message:`Variant transition cannot resolve a rotation pivot for ${i.id}: its center is not analytic and no text measurement host was supplied, so the rotation was not emitted.`}),null)}}function tG(e){let t=e.snapshot.animationTimeline;if(!t||!t.tracks?.some(n=>n.property==="instanceVariant"))return null;let r=Jd(e.snapshot.library??[]);return{timeline:t,instances:Sk(e.snapshot.shapes,new Map),getSymbol:n=>r.symbol(n),instanceSymbolIds:$k(e.snapshot.shapes,e.symbols,new Map),existingInnerIds:QU(e.symbols),resolveShapeCenterFallback:eG(e)}}function Nk(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ko(e){let t=`<${e.element}`;for(let[r,n]of e.attributes)t+=` ${r}="${Nk(n)}"`;return`${t}/>`}function rG(e){return e.replace(/\sdata-shape-id="[^"]*"/,"")}var nG=class{constructor(e){this.options=e;for(let t of e.symbols.materializations)this.definitionByTarget.set(t.targetId,t.definition),this.materializedByTarget.set(t.targetId,t.shapes.map(r=>r.id));this.gradientReferents=oG(e.snapshot)}options;byTarget=new Map;gradientStops=new Map;gradientRoots=new Map;addressedSymbolIds=new Set;definitionByTarget=new Map;materializedByTarget=new Map;gradientReferents;target(e){let t=this.byTarget.get(e);return t||(t={appended:[],present:new Set(this.materializedByTarget.get(e)??[]),animations:new Map,rootOverrides:new Map},this.byTarget.set(e,t)),t}isNativeShapeDefinition(e){return(this.definitionByTarget.get(e)?.defKind??"symbol")==="shape"}addAnimations(e,t,r){if(r.length===0)return;let n=this.target(e).animations,i=n.get(t);i?i.push(...r):n.set(t,[...r])}replaceRootAttribute(e,t,r,n){this.rootOverrideEntry(e,t).replace.set(r,n)}appendInnerStyle(e,t,r){let n=this.rootOverrideEntry(e,t);n.appendStyle=n.appendStyle?`${n.appendStyle}; ${r}`:r}rootOverrideEntry(e,t){let r=this.target(e).rootOverrides,n=r.get(t);return n||(n={replace:new Map},r.set(t,n)),n}setScopeClass(e,t){this.target(e).scopeClass=t,this.addressedSymbolIds.add(e)}addressSymbol(e){this.addressedSymbolIds.add(e)}has(e,t){return this.target(e).present.has(t)}appendContent(e,t,r){if(this.isNativeShapeDefinition(e))return yr({severity:"warning",code:"inert-variant-transition-content",shapeId:r.id,message:`Variant transition cannot add inner content to native-shape definition ${e}: it renders a single root element that cannot host siblings, so ${t} was not emitted.`}),!1;let n=ui(r,{...this.options.shapeContext,elementIdForShape:void 0,forcedElementIds:void 0,animationElementsForShape:void 0,rootAttributeOverridesForShape:void 0}),i=rG(n);if(!i)return!1;let a=this.target(e);return a.appended.push({innerId:t,markup:i}),a.present.add(t),this.replaceRootAttribute(e,t,"opacity","0"),!0}addGradientAnimations(e,t,r){(this.gradientReferents.get(e)??0)>1&&yr({severity:"warning",code:"shared-variant-transition-gradient",shapeId:r,message:`Variant transition animates gradient definition ${e}, which more than one shape references, so the animation is visible on every referent.`});let n=this.gradientStops.get(e)??new Map;for(let i of t.stops){let a=n.get(i.index)??[];a.push(...i.animations.map(ko)),n.set(i.index,a)}if(n.size>0&&this.gradientStops.set(e,n),t.gradient.length>0){let i=this.gradientRoots.get(e)??[];i.push(...t.gradient.map(ko)),this.gradientRoots.set(e,i)}}build(e,t){let r=new Map,n=new Map,i=new Map;for(let[a,o]of this.byTarget){let s=new Set(o.appended.map(c=>c.innerId)),l=o.appended.map(c=>{let f=Lb(o.rootOverrides.get(c.innerId)),p=f?C1(c.markup,f):c.markup;return this.options.target==="waapi"&&(p=iG(p,c.innerId)),aG(p,(o.animations.get(c.innerId)??[]).join(""))});(l.length>0||o.scopeClass!==void 0)&&r.set(a,{children:l,...o.scopeClass?{scopeClass:o.scopeClass}:{}});let u=new Map;for(let[c,f]of o.animations)s.has(c)||u.set(c,f);u.size>0&&n.set(a,u);let d=new Map;for(let[c,f]of o.rootOverrides){if(s.has(c))continue;let p=Lb(f);p&&d.set(c,p)}d.size>0&&i.set(a,d)}return{definitionContent:r,innerAnimations:n,innerRootOverrides:i,gradientStopAnimations:this.gradientStops,gradientRootAnimations:this.gradientRoots,stylesheet:e,scriptBody:t,addressedSymbolIds:this.addressedSymbolIds,isEmpty:r.size===0&&n.size===0&&i.size===0&&this.gradientStops.size===0&&this.gradientRoots.size===0&&e===null&&t===null}}};function Lb(e){return!e||e.replace.size===0&&!e.appendStyle?null:{...e.replace.size>0?{replace:e.replace}:{},...e.appendStyle?{appendStyle:e.appendStyle}:{}}}function iG(e,t){let r=/^<([A-Za-z_][\w:.-]*)/.exec(e);if(!r)return e;let n=r[0].length;return`${e.slice(0,n)} data-svgsketch-inner-id="${Nk(t)}"${e.slice(n)}`}function aG(e,t){if(t.length===0)return e;let r=/^<([A-Za-z_][\w:.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>/.exec(e);if(!r)return e;if(r[3]==="/")return`<${r[1]}${r[2]}>${t}</${r[1]}>${e.slice(r[0].length)}`;let n=`</${r[1]}>`,i=e.lastIndexOf(n);return i===-1?e+t:e.slice(0,i)+t+e.slice(i)}function oG(e){let t=new Map,r=i=>{typeof i!="string"||i===""||t.set(i,(t.get(i)??0)+1)},n=i=>{for(let a of i??[]){let o=a.state;r(o.fillLibraryId??o.fillGradient?.id),r(o.strokeLibraryId??o.strokeGradient?.id),n(a.state.children)}};n(e.shapes);for(let i of e.library??[])if(i.kind==="symbol"){n(i.shapes);for(let a of Object.values(i.variants??{}))n(a)}return t}function sG(e,t,r,n){let i=e.state,a=i[t==="fill"?"fillGradient":"strokeGradient"],o=i[t==="fill"?"fillLibraryId":"strokeLibraryId"]??a?.id;if(!o)return null;let s=n.definition(o)?.stops??a?.stops;return!Array.isArray(s)||s.length!==r?null:o}function lG(e){let t=tG(e);if(!t)return JU;let r=new nG(e),n=Jd(e.snapshot.library??[]);return e.target==="css"?dG(r,t):e.target==="waapi"?cG(r,t):uG(r,t,n)}function uG(e,t,r){for(let n of HU(t))for(let i of n.ops){if(i.op==="ensureInner"){if(!e.has(n.symbolId,i.innerId)&&!e.appendContent(n.symbolId,i.innerId,i.shape))continue;e.addAnimations(n.symbolId,i.innerId,i.animations.map(ko));continue}for(let a of i.actions)switch(a.action){case"animate":e.addAnimations(n.symbolId,i.innerId,[ko(a.spec)]);break;case"setBaseTransform":e.replaceRootAttribute(n.symbolId,i.innerId,"transform",a.transform);break;case"crossfade":{if(!e.appendContent(n.symbolId,a.innerId,a.shape))break;e.addAnimations(n.symbolId,i.innerId,[ko(a.fadeOut)]),e.addAnimations(n.symbolId,a.innerId,[ko(a.fadeIn)]);break}case"gradient":{let o=hG(t,n.symbolId,i.innerId);if(!o)break;let s=sG(o,a.paintAttr,a.expectedStopCount,r);if(!s)break;e.addGradientAnimations(s,a,o.id);break}}}return e.build(null,null)}function dG(e,t){let r=KU(t);for(let n of r.symbols){e.setScopeClass(n.symbolId,n.scopeClass);for(let i of n.ensure)e.has(n.symbolId,i.innerId)||e.appendContent(n.symbolId,i.innerId,i.shape);for(let i of n.assignments)e.appendInnerStyle(n.symbolId,i.innerId,`animation: ${i.animation}`)}return e.build(r.stylesheet,null)}function cG(e,t){let r=ZU(t);for(let n of r.symbols){e.addressSymbol(n.symbolId);for(let i of n.ensure)e.has(n.symbolId,i.innerId)||e.appendContent(n.symbolId,i.innerId,i.shape)}return e.build(null,r.scriptBody)}function fG(e){return e?`<style id="svgsketch-variant-transitions">${im(e)}</style>`:""}function pG(e){return e?`<script type="application/ecmascript">${wk(e)}</script>`:""}function hG(e,t,r){for(let[n,i]of e.instanceSymbolIds){if(i!==t)continue;let a=e.instances.get(n);if(!a)continue;let o=e.getSymbol(a.symbolId);if(!o)continue;let s=[o.shapes,...Object.values(o.variants??{})];for(let l of s){let u=l.find(d=>d.id===r);if(u)return u}}return null}var mG={defs:[],root:[],suppressedShapeIds:new Set,memberToDirective:new Map};function Br(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function nh(e){return e.definitionId??`${e.type}-${e.id}`}function lc(e,t){let r=0;for(;r<e.length;){let u=/^\s+/.exec(e.slice(r));if(u){r+=u[0].length;continue}if(!e.startsWith("<!--",r))break;let d=e.indexOf("-->",r+4);if(d<0)return e;r=d+3}let n=e.slice(r),i=/^<([A-Za-z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/.exec(n);if(!i)return e;let[a,o,s,l]=i;return e.slice(0,r)+`<${o}${t(s)}${l}>`+n.slice(a.length)}function gG(e,t){return lc(e,r=>{let n=r.replace(/\s+id\s*=\s*(?:"[^"]*"|'[^']*')/,"");return` id="${Br(t)}"${n}`})}function Mk(e,t,r){if(!r)return e;let n=`<svg xmlns="${ye}">`,i=`${n}${e}</svg>`,a=Yx.parse(i);if("error"in a)return e;let o=a.nodes.find(d=>d.kind==="element")?.children.find(d=>d.kind==="element");if(!o)return e;let s=[],l=(d,c)=>{if(d.kind!=="element")return;let f=c?void 0:d.attributes.find(h=>h.namespaceUri===null&&h.localName==="id")?.value,p=c?r(t):f?r(t,f):void 0;if(p?.length){let h=p.join(""),m=i.slice(d.span.start,d.span.end),g=/<\/[^>]+>\s*$/u.exec(m);if(g?.index!==void 0){let v=d.span.start+g.index;s.push({start:v,end:v,value:h})}else{let v=/\/\s*>\s*$/u.exec(m);if(v?.index!==void 0){let b=d.span.start+v.index;s.push({start:b,end:d.span.end,value:`>${h}</${d.name}>`})}}}for(let h of d.children)l(h,!1)};l(o,!0);let u=i;for(let d of s.sort((c,f)=>f.start-c.start))u=u.slice(0,d.start)+d.value+u.slice(d.end);return u.slice(n.length,u.length-6)}function yG(e,t,r){if(!e)return[];let n={...e,tracks:e.tracks.filter(i=>i.definitionTarget?.definitionId===t&&i.definitionTarget.nodeId===r)};return n.tracks.length===0?[]:wo(n,{placement:"target"}).get(Td({definitionId:t,...r?{nodeId:r}:{}}))??[]}function vG(e,t,r){return r?Mk(e,t,(n,i)=>yG(r,n,i)):e}function Ys(e,t){return e.replace(new RegExp(`\\s+${t}\\s*=\\s*(?:"[^"]*"|'[^']*')`,"g"),"")}function bG(e,t,r){return lc(e,n=>{let i=Ys(n,"data-shape-id");if(t==="clip"){let a=/\bfill-rule\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(i);i=Ys(i,"fill-rule"),i=Ys(i,"clip-rule");let o=r??a?.[1]??a?.[2];o&&(i+=` clip-rule="${Br(o)}"`)}return i})}function xG(e,t,r,n,i){let a=bG(ui(e,n),t,r);return i===void 0?a:lc(a,o=>{let s=Ys(o,"transform");return i?`${s} transform="${Br(i)}"`:s})}function wG(e,t,r,n,i){let a=e.clipMaskGroups;if(!Array.isArray(a)||a.length===0)return mG;let o=new Map;for(let h of e.shapes??[])Li(h,{onShape:m=>o.set(m.id,m)});let s=Zh(Array.isArray(e.library)?e.library:[]);s.animationElementsForShape=h=>t?.get(h.id),s.textPathAnimationElementsForShape=h=>r?.get(h.id),s.textPathGeometryAnimationElementsForShape=h=>i?.get(h.id);let l=new Set,u=new Map,d=new Set,c=[],f=[],p=(h,m)=>{(h.definitionPlacement==="document"?f:c).push({definitionId:nh(h),...h.definitionOrder!==void 0?{definitionOrder:h.definitionOrder}:{},...h.definitionContainerId?{definitionContainerId:h.definitionContainerId}:{},...h.authoredPlacement?{authoredPlacement:structuredClone(h.authoredPlacement)}:{},markup:m})};for(let h of a){if(!h||h.type!=="clip"&&h.type!=="mask")continue;let m=nh(h),g=Array.isArray(h.clipShapeIds)?h.clipShapeIds:[];for(let b of g)l.add(b);if(!d.has(m)){if(typeof h.rawDefinition=="string"&&h.rawDefinition.length>0)d.add(m),p(h,Mk(gG(h.rawDefinition,m),m,n));else if(g.length>0){d.add(m);let b=h.type==="clip"?"clipPath":"mask",y=`<${b} id="${Br(m)}"`;h.type==="clip"?(h.clipPathUnits&&(y+=` clipPathUnits="${Br(h.clipPathUnits)}"`),h.clipRule&&(y+=` clip-rule="${Br(h.clipRule)}"`)):(h.maskUnits&&(y+=` maskUnits="${Br(h.maskUnits)}"`),h.maskContentUnits&&(y+=` maskContentUnits="${Br(h.maskContentUnits)}"`),h.maskBounds&&(y+=` x="${Br(h.maskBounds.x)}" y="${Br(h.maskBounds.y)}"`,y+=` width="${Br(h.maskBounds.width)}"`,y+=` height="${Br(h.maskBounds.height)}"`),h.maskType&&(y+=` mask-type="${Br(h.maskType)}"`)),y+=">",y+=(n?.(m)??[]).join("");for(let I of g){let x=o.get(I);x&&(y+=xG(x,h.type,h.clipRule,s))}y+=`</${b}>`,p(h,y)}}let v=Array.isArray(h.contentShapeIds)?h.contentShapeIds:[];if(v.length>0){let b={attr:h.type==="clip"?"clip-path":"mask",defId:m,memberIds:v,...h.referenceChannel?{referenceChannel:h.referenceChannel}:{},...h.referenceStyleOrder!==void 0?{referenceStyleOrder:h.referenceStyleOrder}:{}};for(let y of v)u.has(y)||u.set(y,b)}}return{defs:c,root:f,suppressedShapeIds:l,memberToDirective:u}}function IG(e,t,r="attribute"){return lc(e,n=>{let i=Ys(n,t.attr),a=/\s+style\s*=\s*(["'])(.*?)\1/u.exec(i);if(a){let d=ha(a[2],";").map(c=>c.trim()).filter(c=>{if(c.length===0)return!1;let[f]=ha(c,":");return f?.trim().toLowerCase()!==t.attr});i=d.length?i.replace(a[0],` style=${a[1]}${d.join("; ")}${a[1]}`):i.replace(a[0],"")}if(r==="stylesheet")return i;let o=`url(#${Br(t.defId)})`;if(r!=="style")return`${i} ${t.attr}="${o}"`;let s=/\s+style\s*=\s*(["'])(.*?)\1/u.exec(i);if(!s)return`${i} style="${t.attr}: ${o}"`;let l=ha(s[2],";").map(d=>d.trim()).filter(Boolean);l.splice(Math.min(t.referenceStyleOrder??l.length,l.length),0,`${t.attr}: ${o}`);let u=l.join("; ");return i.replace(s[0],` style=${s[1]}${u}${s[1]}`)})}function Ak(e,t){let r=e.state?.children;return!Array.isArray(r)||r.length===0?e:{...e,state:{...e.state,children:kG(r,t)}}}function kG(e,t){let r=e.filter(i=>!t.suppressedShapeIds.has(i?.id)).map(i=>Ak(i,t)),n=[];for(let i=0;i<r.length;){let a=r[i],o=t.memberToDirective.get(a.id);if(!o){n.push(a),i++;continue}let s=[a],l=i+1;for(;l<r.length&&t.memberToDirective.get(r[l].id)===o;)s.push(r[l]),l++;s.length===1?n.push(SG(a,o)):o.referenceChannel==="stylesheet"?n.push(...s):n.push($G(s,o)),i=l}return n}function SG(e,t){if(t.referenceChannel==="stylesheet")return e;let r=e.state,n=r.presentationChannels;if(t.referenceChannel==="style"||n?.[t.attr]==="style"){let a=e.type==="symbol-instance"||e.type==="shape-reference"?"instancePresentation":"inlineStyle",o=Object.entries(r[a]??{}).filter(([l])=>l!==t.attr);o.splice(Math.min(t.referenceStyleOrder??o.length,o.length),0,[t.attr,`url(#${t.defId})`]);let s=Object.fromEntries(o);return{...e,state:{...r,[a]:s}}}let i={...r.authoredAttributes??{},[t.attr]:`url(#${t.defId})`};return{...e,state:{...r,authoredAttributes:i}}}function $G(e,t){return{id:`clipmask-wrapper:${t.defId}:${e[0].id}`,type:"group",state:{children:e,groupData:{[t.attr==="clip-path"?"clipPath":"mask"]:`url(#${t.defId})`}}}}function NG(e){return e.replace(new RegExp(`\\s+${n1}\\s*=\\s*(?:"[^"]*"|'[^']*')`,"g"),"")}function pp(e,t){let r=/url\(\s*['"]?#([^'")\s]+)['"]?\s*\)/g,n;for(;(n=r.exec(e))!==null;)t.add(n[1]);let i=/\b(?:xlink:)?href\s*=\s*(?:"#([^"]+)"|'#([^']+)')/g;for(;(n=i.exec(e))!==null;)t.add(n[1]??n[2])}function Bb(e,t,r=[],n=new Set,i=e.animationTimeline){let a=new Map;for(let d of e.paintServerDefs??[]){if(!d||typeof d.markup!="string")continue;let c=d.id??a1(d.markup);!c||n.has(c)||a.set(c,{id:c,markup:vG(NG(d.markup),c,i),passthrough:d.passthrough===!0,...d.authoredPlacement?{authoredPlacement:d.authoredPlacement}:{},...d.definitionOrder!==void 0?{definitionOrder:d.definitionOrder}:{},...d.definitionContainerId?{definitionContainerId:d.definitionContainerId}:{}})}if(a.size===0)return[];let o=new Set;pp(t,o);for(let d of r)pp(d,o);let s=new Map;for(let d of a.values())(d.passthrough||d.authoredPlacement)&&s.set(d.id,d);let l=!0;for(;l;){l=!1;for(let d of a.values())s.has(d.id)||!o.has(d.id)||(s.set(d.id,d),l=!0);for(let d of s.values()){let c=o.size;pp(d.markup,o),o.size>c&&(l=!0)}}if(s.size===0)return[];let u=[];for(let d of a.values())s.has(d.id)&&u.push({id:d.id,markup:d.markup,...d.authoredPlacement?{authoredPlacement:d.authoredPlacement}:{},...d.definitionOrder!==void 0?{definitionOrder:d.definitionOrder}:{},...d.definitionContainerId?{definitionContainerId:d.definitionContainerId}:{}});return u}function Vb(e){let t=new Set;for(let r of e??[])t.add(r.definitionId??`${r.type}-${r.id}`);return t}function MG(e){return e==="stylesheet-static"||e==="stylesheet-dynamic"?"stylesheet":e}function ka(e){return e.entries.map(t=>t.markup).join("")}function hp(e){return e.map((t,r)=>({entry:t,index:r})).sort((t,r)=>{let n=t.entry.definitionOrder,i=r.entry.definitionOrder;return n!==void 0&&i!==void 0?n-i:n!==void 0?-1:i!==void 0?1:t.index-r.index}).map(({entry:t})=>t)}function AG(e){return e3.some(t=>t===e)}function CG(e,t){let r=Nn(e);return r&&r.width>0&&r.height>0?{width:r.width,height:r.height}:t}function OG(e){let t=new Map;for(let r of e?.tracks??[]){if(r.property!=="instanceVariant"||r.enabled===!1)continue;let n;for(let i of r.keyframes)(n===void 0||i.time<n.time)&&(n=i);n!==void 0&&t.set(r.shapeId,String(n.value??""))}return t}function Il(e,t={}){let{backgroundColor:r,includeScripts:n=!0,includeMetadata:i=!0}=t;if(e.sceneTree&&e.sceneTree.length>0){let N={...e,shapes:structuredClone(e.shapes??[])};bU(N),e=N}let a=e.shapes??[],o=a.find(N=>N.type==="svg"&&N.state?.isRootSvg===!0),s=o?.state,l=Number(s?.svgViewBoxWidth??0),u=Number(s?.svgViewBoxHeight??0),d=l>0&&u>0?{x:Number(s?.svgViewBoxX??0),y:Number(s?.svgViewBoxY??0),width:l,height:u,intrinsicWidth:Number(s?.svgWidth??0)>0?Number(s?.svgWidth):l,intrinsicHeight:Number(s?.svgHeight??0)>0?Number(s?.svgHeight):u,preserveAspectRatio:typeof s?.svgPreserveAspectRatio=="string"?s.svgPreserveAspectRatio.trim():""}:null,c=e.viewboxes?.[0],f=t.width??d?.intrinsicWidth??c?.width??800,p=t.height??d?.intrinsicHeight??c?.height??600,h=s?.authoredRootDimensions,m=(N,q,ie)=>{if(ie!==void 0)return ie;if(t[N]!==void 0)return q;let Ce=h?.[N];return typeof Ce?.raw=="string"&&Ce.resolved===q?Ce.raw:q},g=m("width",f,t.widthAttribute),v=m("height",p,t.heightAttribute),b=t.viewBox??(d?`${d.x} ${d.y} ${d.width} ${d.height}`:`0 0 ${f} ${p}`),y=t.preserveAspectRatio??d?.preserveAspectRatio??"",I=CG(b,d?{width:d.width,height:d.height}:{width:f,height:p}),x=new Set,k=N=>{for(let q of N??[])x.add(q.id),k(q.state?.children)};for(let N of a)k(N.state?.children);let $=a.filter(N=>N.state?.displayMode==="motionOnly"),A=a.filter(N=>N.state?.displayMode!=="motionOnly"&&N!==o&&!x.has(N.id)),S=Jn(a).ordered,M=new Map(S.map(N=>[N.id,N])),T=new Set([...$.filter(N=>ih(N)!==null).map(N=>N.id),...S.filter(N=>N.type==="path"&&N.state?.displayMode!=="motionOnly").map(N=>N.id)]),E=e.animationTimeline?{...e.animationTimeline,tracks:e.animationTimeline.tracks.map(N=>{let q=N.motionPathRef;if(N.property!=="pathMotion"||!N.motionPath||!q||(q.mode??"trackShape")!=="curveTemplate"||T.has(q.shapeId))return N;let{motionPathRef:ie,...Ce}=N;return Ce})}:null,C=R5(E,e.documentStyles,e.shapes),O=C??new Set,z=C!==null,R=E?{...E,tracks:E.tracks.filter(N=>!O.has(N.id))}:null,U="",V=[],Y=new Map,G=DG(e),H=jG(e),X=Array.isArray(e.library)?e.library:[],B=da(e),ae=[];for(let N of X){if(N.kind==="marker"){ae.push(...N.shapes);continue}if(N.kind==="symbol"){ae.push(...N.shapes);for(let q of Object.values(N.variants??{}))ae.push(...q)}}let K=K5({documentStyles:e.documentStyles,animationTimeline:E,clipMaskGroups:e.clipMaskGroups,paintServerDefs:e.paintServerDefs});for(let N of X)(N.kind==="linear-gradient"||N.kind==="radial-gradient"||N.kind==="pattern"||N.kind==="symbol"&&N.sourceId)&&K.add(N.id),N.authoredPlacement&&(K.add(N.id),N.authoredPlacement.parentDefinitionId&&K.add(N.authoredPlacement.parentDefinitionId));for(let N of e.paintServerDefs??[])N.authoredPlacement?.parentDefinitionId&&K.add(N.authoredPlacement.parentDefinitionId);for(let N of e.clipMaskGroups??[])N.authoredPlacement?.parentDefinitionId&&K.add(N.authoredPlacement.parentDefinitionId);for(let N of e.definitionContainers??[])N.authoredPlacement?.parentDefinitionId&&K.add(N.authoredPlacement.parentDefinitionId);let W=iV(A,X,K),J=W.filter(N=>N.kind!=="symbol"),Q=Xx(A,X);for(let N of K)Q.ids.add(N);let Z=Zh(X),Ae=new Map;if(Z.registerGeneratedDefinition=({id:N,markup:q})=>{let ie=Ae.get(N);if(ie===void 0)Ae.set(N,q);else if(ie!==q)throw new Error(`Generated SVG definition ${N} was registered with conflicting markup.`)},Z.textMeasurementHost=t.textMeasurementHost,Z.retainCssAnimationDeclarations=z,S.some(N=>N.type==="line"&&!!(N.state?.sourceRef||N.state?.targetRef))){let N=xa(e),q=new Map;Z.connectorAnchorPoint=ie=>{let Ce=`${ie.shapeId}\0${ie.anchorId}`,Ve=q.get(Ce);if(Ve!==void 0)return Ve;let Ot=S3(N,ie);return q.set(Ce,Ot),Ot}}let Ie=new Map,Xe=new Map;for(let N of e.documentStyles??[]){if(!N.scopeDefinitionId)continue;let q=Ie.get(N.scopeDefinitionId)??[];q.push({siblingIndex:N.definitionOrder??Number.MAX_SAFE_INTEGER,markup:Bu([N],{retainAnimationDeclarations:z})}),Ie.set(N.scopeDefinitionId,q)}Z.definitionChildrenForLibraryDefinition=N=>{let q=Ie.get(N)??[],ie=Xe.get(N)??[];return q.length>0||ie.length>0?[...q,...ie]:void 0};let Mt;{let N=Jn(a),q=Jn([...a,...ae]),ie=new Map,Ce=new Set,Ve=new Set,Ot=new Set,cr=new Set((e.animationTimeline?.tracks??[]).flatMap(ee=>{let we=ee.motionPathRef;return ee.property==="pathMotion"&&we&&(we.mode??"trackShape")==="curveTemplate"?[we.shapeId]:[]})),Ki=new Set((R?.tracks??[]).filter(ee=>ee.sourceSmilPlacement==="document").map(ee=>ee.shapeId)),gs=new Set((R?.tracks??[]).filter(ee=>ee.sourceSmilPlacement==="defs").map(ee=>ee.shapeId)),Zi=(ee,we)=>{ee&&we.add(ee)};for(let ee of N.ordered){if(ee.type==="text"){Zi(ee.state?.shapeInsideRef,Ce);let we=ee.state?.textPathReference;we?.kind==="shape"&&Zi(we.targetId,Ve)}ee.type==="shape-reference"&&Zi(ee.state?.targetShapeId,Ot)}let Kn=new Map;for(let ee of q.ordered){let we=ee.state?.metadata?.name,er=ee.type==="view"?ee.state?.viewName:void 0,Qe=er?wa(er):we?wa(we):"",Ir=Ce.has(ee.id)||Ve.has(ee.id)||Ot.has(ee.id)||cr.has(ee.id)||Ki.has(ee.id)||gs.has(ee.id);Qe?Kn.set(ee,Qe):Ir&&!N.duplicateIds.has(ee.id)&&Kn.set(ee,ee.id)}let gn=new Set([...J.map(ee=>ee.id),...$.filter(ee=>ih(ee)&&!Kn.has(ee)).map(ee=>ee.id),...(e.clipMaskGroups??[]).map(nh)]);for(let[ee,we]of Object.entries(m1)){let er=ee.replace("line-marker-","");(Q.legacyEndpoints.has(er)||Q.ids.has(ee))&&gn.add(ee),Q.ids.has(we)&&gn.add(we)}for(let ee of N.ordered)ee.type==="text"&&ee.state.isTextPath&&ee.state.textPathPoints&&!ee.state.textPathReference&&ee.state.textPathInlineFormat!=="path-attr"&&gn.add(`text-path-${ee.id}`);Mt=TU(X,A,{reservedIds:new Set([...gn,...Kn.values()]),parentViewport:I,instancePolicy:(()=>{let ee=t.symbolInstanceInitialVariants??OG(e.animationTimeline);if(ee.size===0)return;let we=new WeakMap;for(let[er,Qe]of ee){let Ir=N.uniqueById.get(er);Ir?.type==="symbol-instance"&&we.set(Ir,Qe)}return er=>{let Qe=we.get(er);return Qe===void 0?void 0:{initialVariantKey:Qe,dedicated:!0}}})()});for(let ee of Mt.materializations)gn.add(ee.targetId);for(let ee of Mt.diagnostics)yr({severity:"warning",code:ee.code,shapeId:ee.shapeId,message:ee.message});Z.symbolInstanceTargetElementId=ee=>Mt.resolve(ee)?.targetId;let Hl=xa(e),lg=new WeakMap;Z.symbolInstanceTransform=ee=>{let we=lg.get(ee);if(!we){let er=Mt.resolve(ee);we=kL(Hl,ee,{},er?.parentViewport??I),lg.set(ee,we);for(let Qe of we.diagnostics)!["invalid-symbol-viewport","unresolved-symbol-viewport","unresolved-symbol-pivot"].includes(Qe.code)||!AG(Qe.code)||yr({severity:"warning",code:Qe.code,shapeId:Qe.shapeId,message:Qe.message})}return we};let cN=new Set([...Kn.values(),...gn]),Hc=new Set(gn),ug=new Map,ql=new Map,dg=new Map;for(let[ee,we]of Kn){let er=(ug.get(we)??0)+1;ug.set(we,er);let Qe=we;if(er>1||Hc.has(Qe)){let Ir=2;do Qe=`${we}-${Ir++}`;while(cN.has(Qe)||Hc.has(Qe))}ql.set(ee,Qe),q.duplicateIds.has(ee.id)||dg.set(ee.id,Qe),Hc.add(Qe)}for(let[ee,we]of N.uniqueById){let er=ql.get(we);er&&ie.set(ee,er)}for(let ee of cr){let we=ie.get(ee);we&&Y.set(ee,we)}if(R&&Ki.size>0&&(U=H5(R,{targetElementId:ee=>ie.get(ee),targetShape:ee=>M.get(ee),motionPathTargetElementId:ee=>Y.get(ee)}).join("")),R&&gs.size>0){let ee=new Map(R.tracks.flatMap(we=>we.definitionTarget?[[we.shapeId,we.definitionTarget.nodeId??we.definitionTarget.definitionId]]:[]));V=q5(R,{targetElementId:we=>ee.get(we)??ie.get(we),targetShape:we=>M.get(we),motionPathTargetElementId:we=>Y.get(we)}).map(we=>({kind:"animation",markup:we.markup,...we.definitionOrder!==void 0?{definitionOrder:we.definitionOrder}:{},...we.definitionContainerId?{definitionContainerId:we.definitionContainerId}:{}}))}if(ql.size>0&&(Z.elementIdForShape=ee=>dg.get(ee.id)??ql.get(ee)),Ce.size>0&&(Z.shapeInsideTargetElementId=ee=>ie.get(ee)),Ve.size>0&&(Z.textPathTargetElementId=ee=>ie.get(ee)),Ot.size>0){Z.shapeReferenceTargetElementId=Qe=>N.duplicateIds.has(Qe)?null:ie.get(Qe);let ee=xa(e),we=new WeakMap,er=new WeakMap;Z.shapeReferenceBounds=Qe=>{let Ir=we.get(Qe);return Ir||(Ir=ec(ee,Qe),we.set(Qe,Ir)),Ir},Z.shapeReferenceTransform=Qe=>{let Ir=er.get(Qe);return Ir||(Ir=IL(ee,Qe),er.set(Qe,Ir)),Ir}}}let bi=N=>{if(N.property!=="textPathMorph")return"inert";let q=M.get(N.shapeId);return!q||q.type!=="text"||!q.state?.isTextPath||q.state.textPathReference?"inert":q.state.textPathInlineFormat==="path-attr"?"textPath":"geometry"};for(let N of R?.tracks??[])N.property!=="textPathMorph"||bi(N)!=="inert"||yr({severity:"warning",code:"inert-text-path-morph",shapeId:N.shapeId,message:`Shape ${N.shapeId} carries a textPathMorph track but does not own the geometry its textPath follows; the track was not emitted.`});let ur=R?{...R,tracks:R.tracks.filter(N=>N.property==="textPathStartOffset"||bi(N)==="textPath")}:null,pn=R?{...R,tracks:R.tracks.filter(N=>bi(N)==="geometry")}:null,Tn=R?{...R,tracks:R.tracks.filter(N=>N.textSpanTarget!==void 0)}:null,qi=R?{...R,tracks:R.tracks.filter(N=>N.definitionTarget!==void 0)}:null,We=R?{...R,tracks:R.tracks.filter(N=>N.property!=="textPathStartOffset"&&N.property!=="textPathMorph"&&N.textSpanTarget===void 0&&N.definitionTarget===void 0)}:null,et=We?wo(We,{placement:"target",targetShape:N=>M.get(N),motionPathTargetElementId:N=>Y.get(N),referenceTargetElementId:N=>Z.shapeReferenceTargetElementId?.(N)}):null,tt=qi?wo(qi,{placement:"target",referenceTargetElementId:N=>Z.shapeReferenceTargetElementId?.(N)}):null;Z.definitionAnimationElements=(N,q)=>tt?.get(Td({definitionId:N,...q?{nodeId:q}:{}}));let Je=ur?wo(ur,{placement:"target",targetShape:N=>M.get(N)}):null,yt=pn?wo(pn,{placement:"target",targetShape:N=>M.get(N)}):null,Gt=Tn?W1(Tn,{placement:"target",targetShape:N=>M.get(N)}):null,zt=wG(e,et??void 0,Je??void 0,Z.definitionAnimationElements,yt??void 0),Rt=zt.defs,It=zt.root,Ke=Rt.map(N=>N.markup).join(""),At=It.map(N=>N.markup).join(""),ve=lG({snapshot:e,symbols:Mt,target:t.variantTransitionTarget??"smil",shapeContext:Z,...I?{parentViewport:I}:{},...t.measureShapeTextBounds?{measureShapeTextBounds:t.measureShapeTextBounds}:{}}),_t=new Map;for(let[N,q]of ve.gradientStopAnimations)_t.set(N,new Map([...q].map(([ie,Ce])=>[ie,[...Ce]])));let ht=new Set;for(let N of R?.tracks??[]){let q=/^(fill|stroke)GradientStop(\d+)(Color|Opacity|Offset)$/.exec(N.property);if(!q)continue;let ie=M.get(N.shapeId);if(!ie)continue;let Ce=q[1],Ve=Number(q[2]),Ot=q[3],cr=ie.state?.[Ce==="fill"?"fillGradient":"strokeGradient"],Ki=ie.state?.[Ce==="fill"?"fillLibraryId":"strokeLibraryId"]??cr?.id;if(!Ki)continue;let gs=Ot==="Color"?"stop-color":Ot==="Opacity"?"stop-opacity":"offset",Zi=G5(N,gs);if(!Zi)continue;let Kn=`${Ki}|${Ve}|${gs}|${Zi}`;if(ht.has(Kn))continue;ht.add(Kn);let gn=_t.get(Ki)??new Map,Hl=gn.get(Ve)??[];Hl.push(Zi),gn.set(Ve,Hl),_t.set(Ki,gn)}if(Z.gradientStopAnimationElements=(N,q)=>_t.get(N)?.get(q),ve.gradientRootAnimations.size>0){let N=Z.definitionAnimationElements;Z.definitionAnimationElements=(q,ie)=>{let Ce=N?.(q,ie)??[],Ve=ie===void 0?ve.gradientRootAnimations.get(q)??[]:[];return Ve.length===0?Ce.length>0?Ce:void 0:[...Ce,...Ve]}}let Ct=J.filter(N=>N.definitionPlacement!=="document"),or=J.filter(N=>N.definitionPlacement==="document"),wr=Gv.flatMap(N=>Ct.filter(q=>q.kind===N)),Wr=Gv.flatMap(N=>or.filter(q=>q.kind===N)),P=wr.map(N=>({kind:"library",definitionId:N.id,markup:ap(N,Z),...N.definitionOrder!==void 0?{definitionOrder:N.definitionOrder}:{},...N.definitionContainerId?{definitionContainerId:N.definitionContainerId}:{},...N.authoredPlacement?{authoredPlacement:N.authoredPlacement}:{}})),D=(e.documentStyles??[]).filter(N=>N.authoredPlacement&&!N.scopeDefinitionId).map(N=>({id:N.id,placement:N.authoredPlacement,markup:Bu([N],{retainAnimationDeclarations:z})})),L=new Map,ne=(N,q)=>q===void 0?`document\0${N}`:`library\0${q}\0${N}`,le=(N,q)=>{let ie=B.resolve(N);if(ie.kind!=="document"&&ie.kind!=="library")return null;if(ie.kind==="library"&&N.parentId===ie.definitionId){let Ot=Xe.get(ie.definitionId)??[];return Ot.push({siblingIndex:N.siblingIndex,markup:q}),Xe.set(ie.definitionId,Ot),"library"}let Ce=ne(N.parentId,ie.kind==="library"?ie.definitionId:void 0),Ve=L.get(Ce)??[];return Ve.push({siblingIndex:N.siblingIndex,markup:q}),L.set(Ce,Ve),ie.kind},De=new Set,be=new Set,Ue=new Set,je=new Set;for(let N of P)!N.definitionId||!N.authoredPlacement||N.definitionContainerId||B.resolve(N.authoredPlacement).kind==="library"&&le(N.authoredPlacement,N.markup)==="library"&&De.add(N.definitionId);let vt=Bb(e,"",[],Vb(e.clipMaskGroups),R);for(let N of vt)N.authoredPlacement&&(N.definitionContainerId||B.resolve(N.authoredPlacement).kind==="library"&&le(N.authoredPlacement,N.markup)==="library"&&be.add(N.id));for(let N of Rt)N.authoredPlacement&&(N.definitionContainerId||B.resolve(N.authoredPlacement).kind==="library"&&le(N.authoredPlacement,N.markup)==="library"&&Ue.add(N.definitionId));for(let N of D)B.resolve(N.placement).kind==="library"&&le(N.placement,N.markup)==="library"&&je.add(N.id);let $t=[...P,...vt.map(N=>({kind:"paint-server",definitionId:N.id,markup:N.markup,definitionOrder:N.definitionOrder,definitionContainerId:N.definitionContainerId})),...Rt.map(N=>({kind:"clip-mask",definitionId:N.definitionId,markup:N.markup,definitionOrder:N.definitionOrder,definitionContainerId:N.definitionContainerId}))];Z.definitionChildrenForShape=(N,q)=>L.get(ne(N.id,q));let qn=Wr.map(N=>({kind:"library",definitionId:N.id,markup:ap(N,Z),...N.definitionOrder!==void 0?{definitionOrder:N.definitionOrder}:{},...N.definitionContainerId?{definitionContainerId:N.definitionContainerId}:{},...N.authoredPlacement?{authoredPlacement:N.authoredPlacement}:{}})),xi=Mt.materializations.filter(N=>N.targetId===N.definition.id).map(N=>({definition:N.definition,emittedId:N.targetId,shapes:N.shapes})),_e=new Set(Mt.materializations.filter(N=>N.targetId===N.definition.id).map(N=>N.definition.id)),ct=W.filter(N=>N.kind==="symbol"&&!_e.has(N.id)).map(N=>({definition:N,emittedId:N.id,shapes:N.shapes})),Ft=[...xi,...ct];for(let N of Ft)N.definition.definitionContainerId&&$t.push({kind:"library",definitionId:N.definition.id,markup:kd(N.definition,N.emittedId,N.shapes,Z),...N.definition.definitionOrder!==void 0?{definitionOrder:N.definition.definitionOrder}:{},definitionContainerId:N.definition.definitionContainerId});for(let N of e.definitionContainers??[]){if(!N.authoredPlacement)continue;let q=hp($t.filter(Ve=>Ve.definitionContainerId===N.id)),ie=[...N.svgId?[`id="${So(N.svgId)}"`]:[],v1(N.attributes)].filter(Boolean),Ce=`<defs${ie.length>0?` ${ie.join(" ")}`:""}>${q.map(Ve=>Ve.markup).join("")}</defs>`;if(le(N.authoredPlacement,Ce))for(let Ve of q)Ve.definitionId&&(Ve.kind==="library"?De.add(Ve.definitionId):Ve.kind==="paint-server"?be.add(Ve.definitionId):Ve.kind==="clip-mask"&&Ue.add(Ve.definitionId))}let hn=N=>{for(let q of N){if(!q.definitionId)continue;let ie=X.find(Ce=>Ce.id===q.definitionId);ie?.kind==="marker"&&(q.markup=ap(ie,Z))}};hn(P),hn(qn);let mn=P.map(N=>N.markup).join(""),en=qn.map(N=>N.markup).join(""),Pn=H1(Ft,Ft.map(N=>N.definition.id)),Dn=Pn.filter(N=>Ft.find(q=>q.definition.id===N)?.definition.definitionPlacement==="document"),Uc=new Set(Dn),_a=Pn.filter(N=>!Uc.has(N)&&!De.has(N)).map(N=>{let q=Ft.find(ie=>ie.definition.id===N).definition;return{kind:"library",definitionId:q.id,markup:qv(Ft,Z,[N]),...q.definitionOrder!==void 0?{definitionOrder:q.definitionOrder}:{},...q.definitionContainerId?{definitionContainerId:q.definitionContainerId}:{},...q.authoredPlacement?{authoredPlacement:q.authoredPlacement}:{}}}),Fa=Dn.map(N=>{let q=Ft.find(ie=>ie.definition.id===N).definition;return{kind:"library",definitionId:q.id,markup:qv(Ft,Z,[N]),...q.definitionOrder!==void 0?{definitionOrder:q.definitionOrder}:{},...q.definitionContainerId?{definitionContainerId:q.definitionContainerId}:{},...q.authoredPlacement?{authoredPlacement:q.authoredPlacement}:{}}}),ps=_a.map(N=>N.markup).join(""),Gc=Fa.map(N=>N.markup).join(""),wi=new Set,oe=new Map(Ft.map(N=>[N.definition.id,N])),ke=new Set,Be=N=>{if(ke.has(N))return;ke.add(N);let q=oe.get(N);if(q){for(let ie of Jn(q.shapes).ordered)wi.add(ie.id);for(let ie of q.definition.definitionContentOrder??[])ie.kind==="definition"&&Be(ie.id)}};for(let N of Dn)Be(N);let Qt=mn+ps,zr=u5(Q,X),Yi=N=>{let q=ve.innerAnimations.get(N),ie=ve.innerRootOverrides.get(N),Ce=ve.definitionContent.get(N);return!q&&!ie&&!Ce?Z:{...Z,...q?{animationElementsForShape:Ve=>{let Ot=Z.animationElementsForShape?.(Ve)??[],cr=q.get(Ve.id)??[];return cr.length===0?Ot.length>0?Ot:void 0:[...Ot,...cr]}}:{},...ie?{rootAttributeOverridesForShape:Ve=>ie.get(Ve.id)}:{},...Ce?{variantTransitionDefinitionContent:Ve=>Ve===N?Ce:void 0}:{}}},sr=Mt.materializations.filter(N=>N.targetId!==N.definition.id).map(N=>({kind:"symbol-materialization",markup:kd(N.definition,N.targetId,N.shapes,Yi(N.targetId))})),dr=sr.map(N=>N.markup).join(""),Yn=$.flatMap(N=>{let q=EG([N],ie=>Y.get(ie.id)??ie.id);return q?[{kind:"motion-path",markup:q,...N.state.definitionOrder!==void 0?{definitionOrder:N.state.definitionOrder}:{},...typeof N.state.definitionContainerId=="string"?{definitionContainerId:N.state.definitionContainerId}:{}}]:[]}),Cr=Yn.map(N=>N.markup).join(""),hs=r?`<rect width="${f}" height="${p}" fill="${r}"/>`:"",ng={...Z,animationElementsForShape:N=>et?.get(N.id),textPathAnimationElementsForShape:N=>Je?.get(N.id),textPathGeometryAnimationElementsForShape:N=>yt?.get(N.id),textSpanAnimationElementsForShape:(N,q)=>Gt?.get(N.id)?.get(q)},Xl=N=>{let q=ui(N,ng),ie=et?.get(N.id),Ce=ie&&ie.length>0?ie:[];return{shape:N,markup:q,smil:Ce}},La=A.filter(N=>!zt.suppressedShapeIds.has(N.id)).map(N=>Ak(N,zt)),ms=Jn(La);for(let N of ms.ordered)wi.add(N.id);let K$=Jn(a);for(let N of e.clipMaskGroups??[])if(N.definitionPlacement==="document")for(let q of N.clipShapeIds){let ie=K$.uniqueById.get(q);if(ie)for(let Ce of Jn([ie]).ordered)wi.add(Ce.id)}let Wc=[],Z$=N=>{if(!xk(N,X))return null;let q=MU(N,{styles:X,renderShape:ie=>ui(ie,ng),serializePresentationWrites:bl,escapeAttributeValue:So,reportUnexpandable:(ie,Ce)=>{yr({severity:"warning",code:"unexpandable-appearance-stack",shapeId:ie.id,message:`Shape ${ie.id} has an appearance stack but authors ${Ce.join(", ")} through its style or attributes. A CSS declaration outranks the paint on the element it sits on, so the same declaration cannot say which layer it overrides once the shape paints in several passes. Only the base fill and stroke are rendered.`})}});return q?(Wc.push({kind:"generated",markup:q.geometryMarkup,definitionId:q.geometryId}),q):null},J$=(N,q)=>q.members.map(ie=>({shape:N,markup:ie,smil:[]})),ig=()=>{Wc.length=0;let N=[];for(let q=0;q<La.length;){let ie=La[q],Ce=zt.memberToDirective.get(ie.id);if(!Ce){let cr=Z$(ie);if(cr){N.push({kind:"appearance-stack",shape:ie,open:cr.open,close:cr.close,members:J$(ie,cr)}),q++;continue}N.push({kind:"shape",...Xl(ie)}),q++;continue}let Ve=[ie],Ot=q+1;for(;Ot<La.length&&zt.memberToDirective.get(La[Ot].id)===Ce;)Ve.push(La[Ot]),Ot++;if(Ve.length===1){let cr=Xl(ie);N.push({kind:"shape",...cr,markup:IG(cr.markup,Ce,MG(Ce.referenceChannel??ie.state.presentationChannels?.[Ce.attr]))})}else Ce.referenceChannel==="stylesheet"?N.push(...Ve.map(cr=>({kind:"shape",...Xl(cr)}))):N.push({kind:"clip-mask-run",directive:Ce,open:`<g ${Ce.attr}="url(#${So(Ce.defId)})">`,close:"</g>",members:Ve.map(Xl)});q=Ot}return N};for(let N of[...P,..._a])!N.definitionId||!N.authoredPlacement||!ms.uniqueById.has(N.authoredPlacement.parentId)||le(N.authoredPlacement,N.markup)==="document"&&De.add(N.definitionId);for(let N of D)ms.uniqueById.has(N.placement.parentId)&&le(N.placement,N.markup)==="document"&&je.add(N.id);let Xc=ig(),Q$=Ck(Xc),eN=(e.documentStyles??[]).map(N=>z?N.css:rh(N.css)),ag=(e.documentStyles??[]).filter(N=>!N.scopeDefinitionId).map(N=>z?N.css:rh(N.css)),tN=Ik(e.templateVariables??[]),og=Bb(e,Q$,[...eN,tN,Ke,At,Qt,en,Gc,dr,zr,Cr],Vb(e.clipMaskGroups),R);for(let N of og)!N.authoredPlacement||!ms.uniqueById.has(N.authoredPlacement.parentId)||le(N.authoredPlacement,N.markup)==="document"&&be.add(N.id);for(let N of Rt)!N.authoredPlacement||!ms.uniqueById.has(N.authoredPlacement.parentId)||le(N.authoredPlacement,N.markup)==="document"&&Ue.add(N.definitionId);Xc=ig();let rN=(e.documentExtensions??[]).filter(N=>N.placement==="defs").map(N=>({kind:"extension",markup:Dv([N],"defs"),...N.definitionOrder!==void 0?{definitionOrder:N.definitionOrder}:{},...N.definitionContainerId?{definitionContainerId:N.definitionContainerId}:{}})),nN=(e.documentStyles??[]).filter(N=>N.placement==="defs"&&!N.scopeDefinitionId&&!je.has(N.id)).map(N=>({kind:"document-style",markup:Bu([N],{placement:"defs",retainAnimationDeclarations:z}),...N.definitionOrder!==void 0?{definitionOrder:N.definitionOrder}:{},...N.definitionContainerId?{definitionContainerId:N.definitionContainerId}:{}})),iN=og.filter(N=>!be.has(N.id)).map(N=>({kind:"paint-server",markup:N.markup,...N.definitionOrder!==void 0?{definitionOrder:N.definitionOrder}:{},...N.definitionContainerId?{definitionContainerId:N.definitionContainerId}:{}})),aN=Rt.filter(N=>!Ue.has(N.definitionId)).map(N=>({kind:"clip-mask",markup:N.markup,...N.definitionOrder!==void 0?{definitionOrder:N.definitionOrder}:{},...N.definitionContainerId?{definitionContainerId:N.definitionContainerId}:{}})),oN=zr?[{kind:"builtin-marker",markup:zr}]:[],sN=[...Ae].map(([N,q])=>({kind:"generated",definitionId:N,markup:q})),lN=hp([...rN,...nN,...P.filter(N=>!N.definitionId||!De.has(N.definitionId)),..._a.filter(N=>!N.definitionId||!De.has(N.definitionId)),...oN,...sr,...Yn,...V,...iN,...aN,...sN,...Wc]),uN=hp([...qn,...Fa,...It.map(N=>({kind:"clip-mask",markup:N.markup,...N.definitionOrder!==void 0?{definitionOrder:N.definitionOrder}:{}}))]),dN={rootAttributes:X3(o,{retainCssAnimationDeclarations:z})+(typeof s?.metadata=="object"&&s.metadata!==null&&typeof s.metadata.name=="string"?` id="${So(wa(s.metadata.name))}"`:"")+w_(e.documentMetadata),descriptive:I_(e.documentMetadata,{includeMetadata:i}),extensions:Dv(e.documentExtensions,"root"),rootDefinitions:uN.map(N=>N.markup).join(""),rootAnimations:U,scripts:(n?DU(e.documentScripts):"")+pG(ve.scriptBody),styles:fG(ve.stylesheet)+FU(e.templateVariables)+Bu((e.documentStyles??[]).filter(N=>!je.has(N.id)),{placement:"root",retainAnimationDeclarations:z}),trailingComments:(e.documentMetadata?.trailingComments??[]).map(N=>`<!--${N.replace(/--/g,"- -").replace(/-$/,"- ")}-->`).join("")},sg={frame:{width:f,height:p,widthAttribute:g,heightAttribute:v,viewBox:b,preserveAspectRatio:y,...t.omitFrameAttributes?{omit:t.omitFrameAttributes}:{}},defs:{entries:lN,containers:[...e.definitionContainers??[]].filter(N=>!N.authoredPlacement).sort((N,q)=>N.order-q.order).map(N=>({...N}))},body:Xc,motionOnlyShapes:$,animationSurfaceShapeIds:wi,backgroundRect:hs,envelope:dN,documentCssTexts:ag,documentCss:ag.join(`
99
+ `).trim(),nativeCssAnimationTrackIds:O,symbols:Mt};return PG(sg),sg}function Ck(e){let t="";for(let r of e)if(r.kind==="shape")t+=r.markup;else{t+=r.open;for(let n of r.members)t+=n.markup;t+=r.close}return t}var Ub=/url\(\s*['"]?#([^'")\s]+)['"]?\s*\)/g,Gb=/<(?:use|mpath|textPath)\b[^>]*?\s(?:xlink:)?href\s*=\s*"#([^"]+)"/g,TG=/\sid\s*=\s*"([^"]+)"/g;function Cs(e,t,r){for(let n of t.matchAll(e))r.add(n[1])}function PG(e){let t=new Set,r=[ka(e.defs),Ck(e.body),e.envelope.descriptive,e.envelope.rootDefinitions,e.envelope.rootAnimations,e.envelope.styles];for(let s of r)Cs(TG,s,t);let n=(s,l)=>{for(let u of s)t.has(u)||yr({severity:"warning",code:"unresolved-reference",message:l?`Unresolved reference "#${u}" on shape "${l}"; no definition with that id is emitted`:`Unresolved reference "#${u}"; no definition with that id is emitted`,...l?{shapeId:l}:{}})},i=s=>{let l=new Set;Cs(Ub,s.markup,l),Cs(Gb,s.markup,l),n(l,s.shape.id)};for(let s of e.body)if(s.kind==="shape")i(s);else for(let l of s.members)i(l);let a=new Set,o=ka(e.defs)+e.envelope.rootDefinitions;Cs(Ub,o,a),Cs(Gb,o,a),n(a)}function DG(e){return(Array.isArray(e.library)?e.library:[]).filter(t=>t.kind==="symbol")}function jG(e){let t=(Array.isArray(e.library)?e.library:[]).filter(r=>r.kind==="marker");return t.length>0?t:void 0}function EG(e,t){if(e.length===0)return"";let r=[];for(let n of e){let i=ih(n);i&&r.push(`<path id="${So(t(n))}" d="${So(i)}"/>`)}return r.join("")}function So(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function ih(e){return xw(e)}function zG(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function RG(e,t={}){return uc(e,t).svg}function uc(e,t={}){let r=new f1;return{svg:p1(r,()=>_G(MV(Il(e,t),e,t),t)),diagnostics:r.diagnostics}}function _G(e,t={}){let{xmlDeclaration:r=!0,indent:n=!0,className:i}=t,a=n?`
100
+ `:"",o=n?" ":"",s=[];for(let g of e.body){if(g.kind==="shape"){s.push(`${o}${g.markup}`);continue}s.push(`${o}${g.open}`);for(let v of g.members)s.push(`${o}${o}${v.markup}`);s.push(`${o}${g.close}`)}let l=s.join(a),u=e.defs,d="",c=[...u.containers].sort((g,v)=>g.order-v.order),f=c.length>0?c.map((g,v)=>({...g,entries:u.entries.filter(b=>b.definitionContainerId===g.id||v===0&&b.definitionContainerId===void 0)})):ka(u).length>0?[{id:"",svgId:void 0,attributes:void 0,order:0,entries:u.entries}]:[];for(let g of f){let v=[...g.svgId?[`id="${zG(g.svgId)}"`]:[],v1(g.attributes)].filter(Boolean);d+=`${a}${o}<defs${v.length>0?` ${v.join(" ")}`:""}>${a}`;let b=null,y="",I=()=>{y.length>0&&(d+=`${o}${o}${y}${a}`),y=""};for(let x of g.entries)x.markup.length!==0&&(b!==null&&x.kind!==b&&I(),b=x.kind,y+=x.markup);I(),d+=`${o}</defs>`}let p=e.backgroundRect.length>0?`${a}${o}${e.backgroundRect}`:"",h="";r&&(h+=`<?xml version="1.0" encoding="UTF-8"?>${a}`);let m=e.frame.omit;return h+='<svg xmlns="http://www.w3.org/2000/svg"',m?.width||(h+=` width="${e.frame.widthAttribute}"`),m?.height||(h+=` height="${e.frame.heightAttribute}"`),m?.viewBox||(h+=` viewBox="${e.frame.viewBox}"`),e.frame.preserveAspectRatio&&(h+=` preserveAspectRatio="${e.frame.preserveAspectRatio}"`),i&&(h+=` class="${i}"`),h+=e.envelope.rootAttributes,h+=">",e.envelope.descriptive.length>0&&(h+=`${a}${o}${e.envelope.descriptive}`),h+=d,e.envelope.extensions.length>0&&(h+=`${a}${o}${e.envelope.extensions}`),e.envelope.rootDefinitions.length>0&&(h+=`${a}${o}${e.envelope.rootDefinitions}`),h+=p,l.length>0&&(h+=`${a}${l}`),e.envelope.rootAnimations.length>0&&(h+=`${a}${o}${e.envelope.rootAnimations}`),e.envelope.scripts.length>0&&(h+=`${a}${o}${e.envelope.scripts}`),e.envelope.styles.length>0&&(h+=`${a}${o}${e.envelope.styles}`),e.envelope.trailingComments.length>0&&(h+=`${a}${o}${e.envelope.trailingComments}`),h+=`${a}</svg>${a}`,h}function FG(e,t){let r=f_(e,t);return RG(e,{width:r.width,height:r.height,xmlDeclaration:t.xmlDeclaration??!1,indent:!0})}function LG(e){return e==="class"?"className":e==="for"?"htmlFor":e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase())}function Vu(e){return e.replace(/\s([a-z][a-z-]*?)=/g,(t,r)=>r.startsWith("data-")||r.startsWith("aria-")?t:` ${LG(r)}=`)}function BG(e,t){let r=t.componentName??"SvgComponent",n=t.indent??" ",i=t.typescript??!1,a=Il(e,{width:t.width,height:t.height}),o=[];for(let c of a.body){if(c.kind==="shape"){o.push(`${n}${n}${n}${Vu(c.markup)}`);continue}o.push(`${n}${n}${n}${Vu(c.open)}`);for(let f of c.members)o.push(`${n}${n}${n}${n}${Vu(f.markup)}`);o.push(`${n}${n}${n}${c.close}`)}let s=ka(a.defs),l=s.length>0,u=a.documentCss,d=[];d.push("import React from 'react';"),d.push(""),i?(d.push(`interface ${r}Props {`),d.push(`${n}className?: string;`),d.push(`${n}style?: React.CSSProperties;`),d.push("}"),d.push(""),d.push(`const ${r}: React.FC<${r}Props> = ({ className, style }) => {`)):d.push(`const ${r} = ({ className, style }) => {`),d.push(`${n}return (`),d.push(`${n}${n}<svg xmlns="http://www.w3.org/2000/svg" width="${a.frame.width}" height="${a.frame.height}" viewBox="${a.frame.viewBox}" className={className} style={style}>`),l&&(d.push(`${n}${n}${n}<defs>`),d.push(`${n}${n}${n}${n}${Vu(s)}`),d.push(`${n}${n}${n}</defs>`));for(let c of o)d.push(c);return u.length>0&&d.push(`${n}${n}${n}<style>{${JSON.stringify(u)}}</style>`),d.push(`${n}${n}</svg>`),d.push(`${n});`),d.push("};"),d.push(""),d.push(`export default ${r};`),d.push(""),d.join(`
101
+ `)}function VG(e,t){let r=t.componentName??"SvgComponent",n=t.indent??" ",i=t.typescript??!1,a=Il(e,{width:t.width,height:t.height}),o=[];for(let c of a.body){if(c.kind==="shape"){o.push(`${n}${n}${c.markup}`);continue}o.push(`${n}${n}${c.open}`);for(let f of c.members)o.push(`${n}${n}${n}${f.markup}`);o.push(`${n}${n}${c.close}`)}let s=ka(a.defs),l=s.length>0,u=a.documentCss,d=[];d.push("<template>"),d.push(`${n}<svg xmlns="http://www.w3.org/2000/svg" width="${a.frame.width}" height="${a.frame.height}" viewBox="${a.frame.viewBox}" :class="className" :style="style">`),l&&(d.push(`${n}${n}<defs>`),d.push(`${n}${n}${n}${s}`),d.push(`${n}${n}</defs>`));for(let c of o)d.push(c);return u.length>0&&d.push(`${n}${n}<component :is="'style'">${u}</component>`),d.push(`${n}</svg>`),d.push("</template>"),d.push(""),i?d.push('<script setup lang="ts">'):d.push("<script setup>"),d.push(`// ${r}`),i?(d.push("defineProps<{"),d.push(`${n}className?: string;`),d.push(`${n}style?: Record<string, string>;`),d.push("}>();")):(d.push("defineProps({"),d.push(`${n}className: { type: String, default: '' },`),d.push(`${n}style: { type: Object, default: () => ({}) },`),d.push("});")),d.push("</script>"),d.push(""),d.join(`
102
+ `)}var UG=new Set(["circle","ellipse","rectangle","square","line","text","image"]);function Wb(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function Uu(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function GG(e){let t=e.shape;if(!UG.has(t.type)||e.smil.length>0)return!0;let r=t.state.metadata;return!!(r?.title||r?.description||t.type==="text"&&t.state.isTextPath||/\s(?:clip-path|mask)="url\(#/u.test(e.markup))}function WG(e,t){let r=t.componentName??"createSvg",n=t.indent??" ",i=t.typescript??!1,a=Il(e,{width:t.width,height:t.height}),o=[];o.push("import * as d3 from 'd3';"),o.push(""),i?o.push(`export function ${r}(container: string | HTMLElement): d3.Selection<SVGSVGElement, unknown, HTMLElement, unknown> {`):o.push(`export function ${r}(container) {`),o.push(`${n}const svg = d3.select(container)`),o.push(`${n}${n}.append('svg')`),o.push(`${n}${n}.attr('xmlns', 'http://www.w3.org/2000/svg')`),o.push(`${n}${n}.attr('width', ${a.frame.width})`),o.push(`${n}${n}.attr('height', ${a.frame.height})`),o.push(`${n}${n}.attr('viewBox', '${a.frame.viewBox}');`),o.push("");let s=ka(a.defs);s.length>0&&(o.push(`${n}svg.append('defs').html(\`${Uu(s)}\`);`),o.push(""));let l=a.documentCss;l.length>0&&(o.push(`${n}svg.append('style').text(\`${Uu(l)}\`);`),o.push(""));let u=0;for(let d of a.body){if(u++,d.kind!=="shape"){o.push(`${n}// group`);let m=d.open+d.members.map(g=>g.markup).join("")+d.close;o.push(`${n}svg.append('g').html(\`${Uu(m)}\`);`),o.push("");continue}let c=d.shape;if(o.push(`${n}// ${c.type}${c.state.metadata?.name?` \u2014 ${c.state.metadata.name}`:""}`),GG(d)){o.push(`${n}svg.append('g').html(\`${Uu(d.markup)}\`);`),o.push("");continue}let f=d_(c),p=lI(c),h=`shape${u}`;o.push(`${n}const ${h} = svg.append('${f}')`);for(let[m,g]of p)o.push(`${n}${n}.attr('${m}', '${Wb(g)}')`);c.type==="text"&&c.state.text&&o.push(`${n}${n}.text('${Wb(c.state.text)}')`),o[o.length-1]=o[o.length-1]+";",o.push("")}return o.push(`${n}return svg;`),o.push("}"),o.push(""),o.join(`
103
+ `)}function XG(e,t){let r=e.state.metadata?.name;return r?r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""):`${e.type}-${t+1}`}var HG=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linecap","opacity","transform","filter"]);function Xb(e,t){let r=e.indexOf(" ");return r===-1?e:e.slice(0,r)+` class="${t}"`+e.slice(r)}function qG(e,t){let r=t.indent??" ",n=Il(e,{width:t.width,height:t.height}),i=0,a=new Map,o=[],s=p=>{a.set(p,XG(p.shape,i)),o.push(p),i++};for(let p of n.body)p.kind==="shape"?s(p):p.members.forEach(s);let l=[];for(let p of o){let h=lI(p.shape),m=[];for(let[g,v]of h)HG.has(g)&&m.push(`${r}${g}: ${v};`);m.length>0&&l.push(`.${a.get(p)} {
104
+ ${m.join(`
105
+ `)}
106
+ }`)}let u=[];for(let p of n.body){if(p.kind==="shape"){u.push(`${r}${Xb(p.markup,a.get(p))}`);continue}u.push(`${r}${p.open}`);for(let h of p.members)u.push(`${r}${r}${Xb(h.markup,a.get(h))}`);u.push(`${r}${p.close}`)}let d=ka(n.defs),c=n.documentCss,f=[];f.push("<style>");for(let p of l)f.push(p);c.length>0&&f.push(c),f.push("</style>"),f.push(""),f.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${n.frame.width}" height="${n.frame.height}" viewBox="${n.frame.viewBox}">`),d.length>0&&f.push(`${r}<defs>${d}</defs>`);for(let p of u)f.push(p);return f.push("</svg>"),f.push(""),f.join(`
107
+ `)}function Ok(e,t){let r=new f1;return{code:p1(r,()=>YG(e,t)),diagnostics:r.diagnostics}}function YG(e,t){let r=ZG(e,t),n={...t};return ek(KG(r,n))}function KG(e,t){switch(t.format){case"svg":return FG(e,t);case"react":return BG(e,t);case"vue":return VG(e,t);case"d3":return WG(e,t);case"css":return qG(e,t);default:throw new Error(`Unsupported code format: ${t.format}`)}}function ZG(e,t){if(Array.isArray(e)){let r=aV(e);return{shapes:e,viewboxes:[{id:"default",x:0,y:0,width:t.width??800,height:t.height??600}],...r.length>0?{library:r}:{}}}return e}var G7=Math.pow(6/29,3),W7=1/(3*Math.pow(6/29,2));var X7=Math.PI/180,H7=Math.pow(25,7);var q7=(.03*255)**2;import{createRequire as JG}from"module";var QG=JG("/"),es,e6,t6;try{es=QG("worker_threads"),e6=es.Worker,t6=es.isMarkedAsUntransferable}catch{}var Er=Uint8Array,Qo=Uint16Array,r6=Int32Array,Tk=new Er([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pk=new Er([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),n6=new Er([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Dk=function(e,t){for(var r=new Qo(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new r6(r[30]),n=1;n<30;++n)for(var a=r[n];a<r[n+1];++a)i[a]=a-r[n]<<5|n;return{b:r,r:i}},es=Dk(Tk,2),jk=es.b,i6=es.r;jk[28]=258,i6[258]=28;var Ek=Dk(Pk,0),a6=Ek.b,oH=Ek.r,dm=new Qo(32768);for(rt=0;rt<32768;++rt)fi=(rt&43690)>>1|(rt&21845)<<1,fi=(fi&52428)>>2|(fi&13107)<<2,fi=(fi&61680)>>4|(fi&3855)<<4,dm[rt]=((fi&65280)>>8|(fi&255)<<8)>>1;var fi,rt,kl=(function(e,t,r){for(var n=e.length,i=0,a=new Qo(t);i<n;++i)e[i]&&++a[e[i]-1];var o=new Qo(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(r){s=new Qo(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var u=i<<4|e[i],d=t-e[i],c=o[e[i]-1]++<<d,f=c|(1<<d)-1;c<=f;++c)s[dm[c]>>l]=u}else for(s=new Qo(n),i=0;i<n;++i)e[i]&&(s[i]=dm[o[e[i]-1]++]>>15-e[i]);return s}),$l=new Er(288);for(rt=0;rt<144;++rt)$l[rt]=8;var rt;for(rt=144;rt<256;++rt)$l[rt]=9;var rt;for(rt=256;rt<280;++rt)$l[rt]=7;var rt;for(rt=280;rt<288;++rt)$l[rt]=8;var rt,zk=new Er(32);for(rt=0;rt<32;++rt)zk[rt]=5;var rt;var o6=kl($l,9,1);var s6=kl(zk,5,1),lm=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},An=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&r},um=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},l6=function(e){return(e+7)/8|0},dc=function(e,t,r){return(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new Er(e.subarray(t,r))};var u6=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Vr=function(e,t,r){var n=new Error(t||u6[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,Vr),!r)throw n;return n},cm=function(e,t,r,n){var i=e.length,a=n?n.length:0;if(!i||t.f&&!t.l)return r||new Er(0);var o=!r,s=o||t.i!=2,l=t.i;o&&(r=new Er(i*3));var u=function(Ie){var Xe=r.length;if(Ie>Xe){var Mt=new Er(Math.max(Xe*2,Ie));Mt.set(r),r=Mt}},d=t.f||0,c=t.p||0,f=t.b||0,p=t.l,h=t.d,m=t.m,g=t.n,v=i*8;do{if(!p){d=An(e,c,1);var b=An(e,c+1,3);if(c+=3,b)if(b==1)p=o6,h=s6,m=9,g=5;else if(b==2){var k=An(e,c,31)+257,$=An(e,c+10,15)+4,A=k+An(e,c+5,31)+1;c+=14;for(var S=new Er(A),M=new Er(19),T=0;T<$;++T)M[n6[T]]=An(e,c+T*3,7);c+=$*3;for(var E=lm(M),C=(1<<E)-1,O=kl(M,E,1),T=0;T<A;){var z=O[An(e,c,C)];c+=z&15;var y=z>>4;if(y<16)S[T++]=y;else{var R=0,U=0;for(y==16?(U=3+An(e,c,3),c+=2,R=S[T-1]):y==17?(U=3+An(e,c,7),c+=3):y==18&&(U=11+An(e,c,127),c+=7);U--;)S[T++]=R}}var V=S.subarray(0,k),Y=S.subarray(k);m=lm(V),g=lm(Y),p=kl(V,m,1),h=kl(Y,g,1)}else Vr(1);else{var y=l6(c)+4,I=e[y-4]|e[y-3]<<8,x=y+I;if(x>i){l&&Vr(0);break}s&&u(f+I),r.set(e.subarray(y,x),f),t.b=f+=I,t.p=c=x*8,t.f=d;continue}if(c>v){l&&Vr(0);break}}s&&u(f+131072);for(var G=(1<<m)-1,H=(1<<g)-1,X=c;;X=c){var R=p[um(e,c)&G],B=R>>4;if(c+=R&15,c>v){l&&Vr(0);break}if(R||Vr(2),B<256)r[f++]=B;else if(B==256){X=c,p=null;break}else{var ae=B-254;if(B>264){var T=B-257,K=Tk[T];ae=An(e,c,(1<<K)-1)+jk[T],c+=K}var W=h[um(e,c)&H],J=W>>4;W||Vr(3),c+=W&15;var Y=a6[J];if(J>3){var K=Pk[J];Y+=um(e,c)&(1<<K)-1,c+=K}if(c>v){l&&Vr(0);break}s&&u(f+131072);var Q=f+ae;if(f<Y){var Z=a-Y,Ae=Math.min(Y,Q);for(Z+f<0&&Vr(3);f<Ae;++f)r[f]=n[Z+f]}for(;f<Q;++f)r[f]=r[f-Y]}}t.l=p,t.p=X,t.b=f,t.f=d,p&&(d=1,t.m=m,t.d=h,t.n=g)}while(!d);return f!=r.length&&o?dc(r,0,f):r.subarray(0,f)};var d6=new Er(0);var Rk=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&Vr(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&Vr(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};var Sl=(function(){function e(t,r){typeof t=="function"&&(r=t,t={}),this.ondata=r;var n=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new Er(32768),this.p=new Er(0),n&&this.o.set(n)}return e.prototype.e=function(t){if(this.ondata||Vr(5),this.d&&Vr(4),!this.p.length)this.p=t;else if(t.length){var r=new Er(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length),this.p=r}},e.prototype.c=function(t){this.s.i=+(this.d=t||!1);var r=this.s.b,n=cm(this.p,this.s,this.o);this.ondata(dc(n,r,this.s.b),this.d),this.o=dc(n,this.s.b-32768),this.s.b=this.o.length,this.p=dc(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(t,r){this.e(t),this.c(r)},e})();function fm(e,t){return cm(e,{i:2},t&&t.out,t&&t.dictionary)}var _k=(function(){function e(t,r){Sl.call(this,t,r),this.v=t&&t.dictionary?2:1}return e.prototype.push=function(t,r){if(Sl.prototype.e.call(this,t),this.v){if(this.p.length<6&&!r)return;this.p=this.p.subarray(Rk(this.p,this.v-1)),this.v=0}r&&(this.p.length<4&&Vr(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Sl.prototype.c.call(this,r)},e})();function pm(e,t){return cm(e.subarray(Rk(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var c6=typeof TextDecoder<"u"&&new TextDecoder,f6=0;try{c6.decode(d6,{stream:!0}),f6=1}catch{}var p6=ArrayBuffer,Dt=Uint8Array,cc=Uint16Array,h6=Int16Array;var fc=Int32Array,hm=function(e,t,r){if(Dt.prototype.slice)return Dt.prototype.slice.call(e,t,r);(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new Dt(r-t);return n.set(e.subarray(t,r)),n},Ml=function(e,t,r,n){if(Dt.prototype.fill)return Dt.prototype.fill.call(e,t,r,n);for((r==null||r<0)&&(r=0),(n==null||n>e.length)&&(n=e.length);r<n;++r)e[r]=t;return e},m6=function(e,t,r,n){if(Dt.prototype.copyWithin)return Dt.prototype.copyWithin.call(e,t,r,n);for((r==null||r<0)&&(r=0),(n==null||n>e.length)&&(n=e.length);r<n;)e[t++]=e[r++]};var g6=["invalid zstd data","window size too large (>2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],St=function(e,t,r){var n=new Error(t||g6[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,St),!r)throw n;return n},Fk=function(e,t,r){for(var n=0,i=0;n<r;++n)i|=e[t++]<<(n<<3);return i},y6=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},v6=function(e,t){var r=e[0]|e[1]<<8|e[2]<<16;if(r==3126568&&e[3]==253){var n=e[4],i=n>>5&1,a=n>>2&1,o=n&3,s=n>>6;n&8&&St(0);var l=6-i,u=o==3?4:o,d=Fk(e,l,u);l+=u;var c=s?1<<s:i,f=Fk(e,l,c)+(s==1&&256),p=f;if(!i){var h=1<<10+(e[5]>>3);p=h+(h>>3)*(e[5]&7)}p>2145386496&&St(1);var m=new Dt((t==1?f||p:t?0:p)+12);return m[0]=1,m[4]=4,m[8]=8,{b:l+c,y:0,l:0,d,w:t&&t!=1?t:m.subarray(12),e:p,o:new fc(m.buffer,0,3),u:f,c:a,m:Math.min(131072,p)}}else if((r>>4|e[3]<<20)==25481893)return y6(e,4)+8;St(0)},Aa=function(e){for(var t=0;1<<t<=e;++t);return t-1},Al=function(e,t,r){var n=(t<<3)+4,i=(e[t]&15)+5;i>r&&St(3);for(var a=1<<i,o=a,s=-1,l=-1,u=-1,d=a,c=new p6(512+(a<<2)),f=new h6(c,0,256),p=new cc(c,0,256),h=new cc(c,512,a),m=512+(a<<1),g=new Dt(c,m,a),v=new Dt(c,m+a);s<255&&o>0;){var b=Aa(o+1),y=n>>3,I=(1<<b+1)-1,x=(e[y]|e[y+1]<<8|e[y+2]<<16)>>(n&7)&I,k=(1<<b)-1,$=I-o-1,A=x&k;if(A<$?(n+=b,x=A):(n+=b+1,x>k&&(x-=$)),f[++s]=--x,x==-1?(o+=x,g[--d]=s):o-=x,!x)do{var S=n>>3;l=(e[S]|e[S+1]<<8)>>(n&7)&3,n+=2,s+=l}while(l==3)}(s>255||o)&&St(0);for(var M=0,T=(a>>1)+(a>>3)+3,E=a-1,C=0;C<=s;++C){var O=f[C];if(O<1){p[C]=-O;continue}for(u=0;u<O;++u){g[M]=C;do M=M+T&E;while(M>=d)}}for(M&&St(0),u=0;u<a;++u){var z=p[g[u]]++,R=v[u]=i-Aa(z);h[u]=(z<<R)-a}return[n+7>>3,{b:i,s:g,n:v,t:h}]},b6=function(e,t){var r=0,n=-1,i=new Dt(292),a=e[t],o=i.subarray(0,256),s=i.subarray(256,268),l=new cc(i.buffer,268);if(a<128){var u=Al(e,t+1,6),d=u[0],c=u[1];t+=a;var f=d<<3,p=e[t];p||St(0);for(var h=0,m=0,g=c.b,v=g,b=(++t<<3)-8+Aa(p);b-=g,!(b<f);){var y=b>>3;if(h+=(e[y]|e[y+1]<<8)>>(b&7)&(1<<g)-1,o[++n]=c.s[h],b-=v,b<f)break;y=b>>3,m+=(e[y]|e[y+1]<<8)>>(b&7)&(1<<v)-1,o[++n]=c.s[m],g=c.n[h],h=c.t[h],v=c.n[m],m=c.t[m]}++n>255&&St(0)}else{for(n=a-127;r<n;r+=2){var I=e[++t];o[r]=I>>4,o[r+1]=I&15}++t}var x=0;for(r=0;r<n;++r){var k=o[r];k>11&&St(0),x+=k&&1<<k-1}var $=Aa(x)+1,A=1<<$,S=A-x;for(S&S-1&&St(0),o[n++]=Aa(S)+1,r=0;r<n;++r){var k=o[r];++s[o[r]=k&&$+1-k]}var M=new Dt(A<<1),T=M.subarray(0,A),E=M.subarray(A);for(l[$]=0,r=$;r>0;--r){var C=l[r];Ml(E,r,C,l[r-1]=C+s[r]*(1<<$-r))}for(l[0]!=A&&St(0),r=0;r<n;++r){var O=o[r];if(O){var z=l[O];Ml(T,r,z,l[O]=z+(1<<$-O))}}return[t,{n:E,b:$,s:T}]},x6=Al(new Dt([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],w6=Al(new Dt([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],I6=Al(new Dt([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],Bk=function(e,t){for(var r=e.length,n=new fc(r),i=0;i<r;++i)n[i]=t,t+=1<<e[i];return n},mm=new Dt(new fc([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),k6=Bk(mm,0),gm=new Dt(new fc([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),S6=Bk(gm,3),Nl=function(e,t,r){var n=e.length,i=t.length,a=e[n-1],o=(1<<r.b)-1,s=-r.b;a||St(0);for(var l=0,u=r.b,d=(n<<3)-8+Aa(a)-u,c=-1;d>s&&c<i;){var f=d>>3,p=(e[f]|e[f+1]<<8|e[f+2]<<16)>>(d&7);l=(l<<u|p)&o,t[++c]=r.s[l],d-=u=r.n[l]}(d!=s||c+1!=i)&&St(0)},$6=function(e,t,r){var n=6,i=t.length,a=i+3>>2,o=a<<1,s=a+o;Nl(e.subarray(n,n+=e[0]|e[1]<<8),t.subarray(0,a),r),Nl(e.subarray(n,n+=e[2]|e[3]<<8),t.subarray(a,o),r),Nl(e.subarray(n,n+=e[4]|e[5]<<8),t.subarray(o,s),r),Nl(e.subarray(n),t.subarray(s),r)},N6=function(e,t,r){var n,i=t.b,a=e[i],o=a>>1&3;t.l=a&1;var s=a>>3|e[i+1]<<5|e[i+2]<<13,l=(i+=3)+s;if(o==1)return i>=e.length?void 0:(t.b=i+1,r?(Ml(r,e[i],t.y,t.y+=s),r):Ml(new Dt(s),e[i]));if(!(l>e.length)){if(o==0)return t.b=l,r?(r.set(e.subarray(i,l),t.y),t.y+=s,r):hm(e,i,l);if(o==2){var u=e[i],d=u&3,c=u>>2&3,f=u>>4,p=0,h=0;d<2?c&1?f|=e[++i]<<4|(c&2&&e[++i]<<12):f=u>>3:(h=c,c<2?(f|=(e[++i]&63)<<4,p=e[i]>>6|e[++i]<<2):c==2?(f|=e[++i]<<4|(e[++i]&3)<<12,p=e[i]>>2|e[++i]<<6):(f|=e[++i]<<4|(e[++i]&63)<<12,p=e[i]>>6|e[++i]<<2|e[++i]<<10)),++i;var m=r?r.subarray(t.y,t.y+t.m):new Dt(t.m),g=m.length-f;if(d==0)m.set(e.subarray(i,i+=f),g);else if(d==1)Ml(m,e[i++],g);else{var v=t.h;if(d==2){var b=b6(e,i);p+=i-(i=b[0]),t.h=v=b[1]}else v||St(0);(h?$6:Nl)(e.subarray(i,i+=p),m.subarray(g),v)}var y=e[i++];if(y){y==255?y=(e[i++]|e[i++]<<8)+32512:y>127&&(y=y-128<<8|e[i++]);var I=e[i++];I&3&&St(0);for(var x=[w6,I6,x6],k=2;k>-1;--k){var $=I>>(k<<1)+2&3;if($==1){var A=new Dt([0,0,e[i++]]);x[k]={s:A.subarray(2,3),n:A.subarray(0,1),t:new cc(A.buffer,0,1),b:0}}else $==2?(n=Al(e,i,9-(k&1)),i=n[0],x[k]=n[1]):$==3&&(t.t||St(0),x[k]=t.t[k])}var S=t.t=x,M=S[0],T=S[1],E=S[2],C=e[l-1];C||St(0);var O=(l<<3)-8+Aa(C)-E.b,z=O>>3,R=0,U=(e[z]|e[z+1]<<8)>>(O&7)&(1<<E.b)-1;z=(O-=T.b)>>3;var V=(e[z]|e[z+1]<<8)>>(O&7)&(1<<T.b)-1;z=(O-=M.b)>>3;var Y=(e[z]|e[z+1]<<8)>>(O&7)&(1<<M.b)-1;for(++y;--y;){var G=E.s[U],H=E.n[U],X=M.s[Y],B=M.n[Y],ae=T.s[V],K=T.n[V];z=(O-=ae)>>3;var W=1<<ae,J=W+((e[z]|e[z+1]<<8|e[z+2]<<16|e[z+3]<<24)>>>(O&7)&W-1);z=(O-=gm[X])>>3;var Q=S6[X]+((e[z]|e[z+1]<<8|e[z+2]<<16)>>(O&7)&(1<<gm[X])-1);z=(O-=mm[G])>>3;var Z=k6[G]+((e[z]|e[z+1]<<8|e[z+2]<<16)>>(O&7)&(1<<mm[G])-1);if(z=(O-=H)>>3,U=E.t[U]+((e[z]|e[z+1]<<8)>>(O&7)&(1<<H)-1),z=(O-=B)>>3,Y=M.t[Y]+((e[z]|e[z+1]<<8)>>(O&7)&(1<<B)-1),z=(O-=K)>>3,V=T.t[V]+((e[z]|e[z+1]<<8)>>(O&7)&(1<<K)-1),J>3)t.o[2]=t.o[1],t.o[1]=t.o[0],t.o[0]=J-=3;else{var Ae=J-(Z!=0);Ae?(J=Ae==3?t.o[0]-1:t.o[Ae],Ae>1&&(t.o[2]=t.o[1]),t.o[1]=t.o[0],t.o[0]=J):J=t.o[0]}for(var k=0;k<Z;++k)m[R+k]=m[g+k];R+=Z,g+=Z;var Ie=R-J;if(Ie<0){var Xe=-Ie,Mt=t.e+Ie;Xe>Q&&(Xe=Q);for(var k=0;k<Xe;++k)m[R+k]=t.w[Mt+k];R+=Xe,Q-=Xe,Ie=0}for(var k=0;k<Q;++k)m[R+k]=m[Ie+k];R+=Q}if(R!=g)for(;g<m.length;)m[R++]=m[g++];else R=m.length;r?t.y+=R:m=hm(m,0,R)}else if(r){if(t.y+=f,g)for(var k=0;k<f;++k)m[k]=m[g+k]}else g&&(m=hm(m,g));return t.b=l,m}St(2)}},Lk=function(e,t){if(e.length==1)return e[0];for(var r=new Dt(t),n=0,i=0;n<e.length;++n){var a=e[n];r.set(a,i),i+=a.length}return r};var Vk=(function(){function e(t){this.ondata=t,this.c=[],this.l=0,this.z=0}return e.prototype.push=function(t,r){if(typeof this.s=="number"){var n=Math.min(t.length,this.s);t=t.subarray(n),this.s-=n}var i=t.length,a=i+this.l;if(!this.s){if(r){if(!a){this.ondata(new Dt(0),!0);return}a<5&&St(5)}else if(a<18){this.c.push(t),this.l=a;return}if(this.l&&(this.c.push(t),t=Lk(this.c,a),this.c=[],this.l=0),typeof(this.s=v6(t))=="number")return this.push(t,r)}if(typeof this.s!="number"){if(a<(this.z||3)){r&&St(5),this.c.push(t),this.l=a;return}if(this.l&&(this.c.push(t),t=Lk(this.c,a),this.c=[],this.l=0),!this.z&&a<(this.z=t[this.s.b]&2?4:3+(t[this.s.b]>>3|t[this.s.b+1]<<5|t[this.s.b+2]<<13))){r&&St(5),this.c.push(t),this.l=a;return}else this.z=0;for(;;){var o=N6(t,this.s);if(o)this.ondata(o,!1),m6(this.s.w,0,o.length),this.s.w.set(o,this.s.w.length-o.length);else{r&&St(5);var s=t.subarray(this.s.b);this.s.b=0,this.c.push(s),this.l+=s.length;return}if(this.s.l){var l=t.subarray(this.s.b);this.s=this.s.c*4,this.push(l,r);return}}}else r&&St(5)},e})();function re(e,t=3){if(!Number.isFinite(e))return"0";let r=Math.pow(10,-t);if(Math.abs(e)<r)return"0";let n=e.toFixed(t);return n.includes(".")&&(n=n.replace(/0+$/,"").replace(/\.$/,"")),n==="-0"?"0":n}function Ui(e,t=3){let r=t+1;return`matrix(${re(e[0],r)} ${re(e[1],r)} ${re(e[2],r)} ${re(e[3],r)} ${re(e[4],t)} ${re(e[5],t)})`}var pi=[1,0,0,1,0,0];function jt(e,t){return[e[0]*t[0]+e[1]*t[2],e[0]*t[1]+e[1]*t[3],e[2]*t[0]+e[3]*t[2],e[2]*t[1]+e[3]*t[3],e[4]*t[0]+e[5]*t[2]+t[4],e[4]*t[1]+e[5]*t[3]+t[5]]}function ym(e){let t=e[0]*e[3]-e[1]*e[2];return!Number.isFinite(t)||Math.abs(t)<1e-12?null:[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[3]*e[4])/t,(e[1]*e[4]-e[0]*e[5])/t]}function Gn(e,t,r){return[e[0]*t+e[2]*r+e[4],e[1]*t+e[3]*r+e[5]]}function M6(e){return e[0]*e[3]-e[1]*e[2]}function Sm(e){return Math.sqrt(Math.abs(M6(e)))}function nS(e,t=1e-6){let[r,n,i,a]=e,o=r*r+n*n+i*i+a*a;if(o===0)return!1;let s=Math.abs(r*i+n*a),l=Math.abs(r*r+n*n-(i*i+a*a));return s<=t*o&&l<=t*o}function A6(e){return Math.atan2(e[1],e[0])*180/Math.PI}function Cn(e){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function iS(e){return[Math.min(e[0],e[2]),Math.min(e[1],e[3]),Math.max(e[0],e[2]),Math.max(e[1],e[3])]}function aS(e){return!e||!(e[2]>e[0])||!(e[3]>e[1])}function Pa(e,t){return e?t?[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[3],t[3])]:e:t}function C6(e,t){let r=[Math.max(e[0],t[0]),Math.max(e[1],t[1]),Math.min(e[2],t[2]),Math.min(e[3],t[3])];return aS(r)?null:r}function O6(e,t,r=1e-6){for(let n=0;n<4;n++)if(Math.abs(e[n]-t[n])>r)return!1;return!0}function pc(e,t){let r=[Gn(t,e[0],e[1]),Gn(t,e[2],e[1]),Gn(t,e[2],e[3]),Gn(t,e[0],e[3])];return{quad:r,bounds:oS(r)}}function oS(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let[a,o]of e)a<t&&(t=a),a>n&&(n=a),o<r&&(r=o),o>i&&(i=o);return[t,r,n,i]}function hc(e,t,r,n=.01){let i=0;for(let a=0;a<4;a++){let[o,s]=e[a],[l,u]=e[(a+1)%4],d=(l-o)*(r-s)-(u-s)*(t-o),c=Math.hypot(l-o,u-s)||1,f=d/c;if(Math.abs(f)<=n)continue;let p=f>0?1:-1;if(i===0)i=p;else if(p!==i)return!1}return!0}function T6(e,t,r=.01){return hc(e,t[0],t[1],r)&&hc(e,t[2],t[1],r)&&hc(e,t[2],t[3],r)&&hc(e,t[0],t[3],r)}function P6(e){if(e.length<2)return null;let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let a=0;a+1<e.length;a+=2){let o=e[a],s=e[a+1];o<t&&(t=o),o>n&&(n=o),s<r&&(r=s),s>i&&(i=s)}return Number.isFinite(t)?[t,r,n,i]:null}function Ye(e){return"text"in e}function me(e,t={},r=[]){return{tag:e,attrs:t,children:r}}function yc(e){return{text:e}}function fn(e){let t=e.trim().replace(/[^\p{L}\p{N}_.\-]+/gu,"_");return t===""&&(t="_"),/^[^\p{L}_]/u.test(t)&&(t=`_${t}`),t}var D6=class{constructor(e){this.prefix=e}prefix;counters=new Map;used=new Set;next(e){let t=(this.counters.get(e)??0)+1;this.counters.set(e,t);let r=`${this.prefix}-${e}-${t}`;return this.used.add(r),r}unique(e){let t=fn(e);if(!this.used.has(t))return this.used.add(t),t;for(let r=2;;r++){let n=`${t}-${r}`;if(!this.used.has(n))return this.used.add(n),n}}reserve(e){this.used.add(e)}},j6=class{constructor(e){this.ids=e}ids;byHash=new Map;byId=new Map;order=[];intern(e,t,r){let n=`${e}:${t}`,i=this.byHash.get(n);if(i)return i.id;let a=this.ids.next(e),o=r(a);o.attrs.id=a;let s={id:a,node:o,references:0};return this.byHash.set(n,s),this.byId.set(a,s),this.order.push(s),a}add(e,t){let r=this.ids.next(e),n=t(r);n.attrs.id=r;let i={id:r,node:n,references:0};return this.byId.set(r,i),this.order.push(i),r}node(e){return this.byId.get(e)?.node??null}has(e){return this.byId.has(e)}build(e){let t=new Set,r=a=>{for(let o of Object.values(a.attrs))E6(o,t);for(let o of a.children)Ye(o)||r(o)};r(e);let n=!0;for(;n;){n=!1;for(let a of this.order){if(!t.has(a.id))continue;let o=t.size;r(a.node),t.size!==o&&(n=!0)}}let i=this.order.filter(a=>t.has(a.id)).map(a=>a.node);return i.length===0?null:me("defs",{},i)}},Uk=/url\(#([^)]+)\)|^#([^\s]+)$/g;function E6(e,t){if(!e.includes("#"))return;Uk.lastIndex=0;let r;for(;r=Uk.exec(e);)t.add(r[1]??r[2])}function Ca(e){let t=2166136261,r=16777619;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);t=Math.imul(t^i,16777619),r=Math.imul(r^i,2166136261)+(r<<5)}return`${(t>>>0).toString(36)}${(r>>>0).toString(36)}`}function z6(e,t,r){let n=null;for(let f of e)n=Pa(n,f.page.box.canvas);let i=n??[0,0,1,1],a=me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:`${re(i[0],r.precision)} ${re(i[1],r.precision)} ${re(i[2]-i[0],r.precision)} ${re(i[3]-i[1],r.precision)}`,width:re(i[2]-i[0],r.precision),height:re(i[3]-i[1],r.precision)});r.title&&a.children.push(me("title",{},[yc(r.title)]));let o=[];if(e.length>1)for(let f of e){if(!f.page.viewId)continue;let p=f.page.box.canvas,h=me("view",{id:f.page.viewId,viewBox:`${re(p[0],r.precision)} ${re(p[1],r.precision)} ${re(p[2]-p[0],r.precision)} ${re(p[3]-p[1],r.precision)}`});f.page.label&&h.children.push(me("title",{},[yc(f.page.label)])),o.push(h)}let s=[],l=new Map,u=new Map,d=!1;for(let f of e)if(r.mergePages||e.length===1){for(let p of f.group.children){if(!("tag"in p))continue;let h=p.attrs.id&&r.layerOf?r.layerOf(p.attrs.id):null,m=h?u.get(h):void 0;if(h&&m){m.children.push(...p.children.filter(g=>!("tag"in g)||g.tag!=="title")),m.bbox=Pa(m.bbox??null,p.bbox??null)??void 0,l.set(p.attrs.id,m.attrs.id);continue}h&&u.set(h,p),s.push(p)}d||=f.isolate}else f.isolate&&(f.group.attrs.style="isolation:isolate"),o.push(f.group);s.length>0&&(d?o.push(me("g",{style:"isolation:isolate"},s)):o.push(...s));let c=t.build({tag:"svg",attrs:{},children:o});return c&&a.children.push(c),a.children.push(...o),{root:a,mergedLayerIds:l}}var sS=64*1024*1024;function R6(e){let t=$m(e,0,Math.min(e.length,1024)),r=/%PDF-(\d\.\d)/.exec(t),n=$m(e,0,Math.min(e.length,sS));return{pdfVersion:r?r[1]:null,encrypted:/\/Encrypt\b/.test(n),hasIllustratorMarkers:/\/AIPrivateData|\/AIPDFPrivateData|\/AIMetaData|\/Illustrator\b/.test(n),hasCmyk:/\/DeviceCMYK\b/.test(n)||/\/ICCBased\b[\s\S]{0,200}?\/N\s*4\b/.test(n),hasSeparation:/\/Separation\b|\/DeviceN\b/.test(n),hasIcc:/\/ICCBased\b/.test(n)}}function _6(e,t,r){let n=$m(e,0,Math.min(e.length,sS)),i=new RegExp(`(?:^|[^0-9])${t}\\s+${r}\\s+obj\\b`,"g"),a,o=null;for(;a=i.exec(n);)o=a.index+a[0].length;if(o===null)return null;let s=n.indexOf("endobj",o),l=n.slice(o,s<0?Math.min(n.length,o+65536):s);return!/\/Type\s*\/Page\b/.test(l)&&!/\/Contents\b/.test(l)?null:{mediaBox:Cl(l,"MediaBox"),cropBox:Cl(l,"CropBox"),artBox:Cl(l,"ArtBox"),trimBox:Cl(l,"TrimBox"),bleedBox:Cl(l,"BleedBox")}}function Cl(e,t){let r=new RegExp(`\\/${t}\\s*\\[\\s*([-+.\\deE]+)\\s+([-+.\\deE]+)\\s+([-+.\\deE]+)\\s+([-+.\\deE]+)\\s*\\]`).exec(e);if(!r)return null;let n=[Number(r[1]),Number(r[2]),Number(r[3]),Number(r[4])];return n.every(i=>Number.isFinite(i))?iS(n):null}function $m(e,t,r){let n=[];for(let i=t;i<r;i+=32768)n.push(String.fromCharCode.apply(null,Array.from(e.subarray(i,Math.min(r,i+32768)))));return n.join("")}function F6(e,t,r){let n=iS(e.view),i=L6(e.rotate),a=e.userUnit??1,o=r.pageBox==="auto"?"crop":r.pageBox,s=n,l="crop",u=!1;if(o!=="crop"){let p=e.ref,h=p?_6(t,p.num,p.gen):null,m=h?o==="media"?h.mediaBox:o==="art"?h.artBox:o==="trim"?h.trimBox:h.bleedBox:null,g=h?.mediaBox??n,v=m?C6(m,g):null;v&&!aS(v)?(s=v,l=o):u=!0}let d=e.getViewport({scale:1/(a||1),rotation:i,offsetX:0,offsetY:0}),c=Cn(d.transform);if(s!==n){let p=Gk(c,s[0],s[3]),h=Gk(c,s[2],s[1]),m=Math.min(p[0],h[0]),g=Math.min(p[1],h[1]);c=jt(c,[1,0,0,1,-m,-g])}let f=i===90||i===270?[s[3]-s[1],s[2]-s[0]]:[s[2]-s[0],s[3]-s[1]];return{kind:l,pdfBox:s,viewportTransform:c,width:f[0],height:f[1],rotate:i,userUnit:a,fallback:u}}function Gk(e,t,r){return[e[0]*t+e[2]*r+e[4],e[1]*t+e[3]*r+e[5]]}function L6(e){let t=(Math.round(e/90)*90%360+360)%360;return t===90?90:t===180?180:t===270?270:0}function B6(e,t,r){let n=[];if(t==="source"){for(let l of e){let u=l.pdfBox[0],d=-l.pdfBox[3];n.push({translation:[1,0,0,1,u,d],canvasBox:[u,d,u+l.width,d+l.height]})}return n}let i=t==="row"?e.length:t==="column"?1:Math.max(1,Math.ceil(Math.sqrt(e.length))),a=0,o=0,s=0;for(let l=0;l<e.length;l++){let u=e[l];l>0&&l%i===0&&(a=0,o+=s+r,s=0),n.push({translation:[1,0,0,1,a,o],canvasBox:[a,o,a+u.width,o+u.height]}),a+=u.width+r,s=Math.max(s,u.height)}return n}var V6={"password-required":"error","encrypted-opened":"info","no-pages":"error","page-skipped":"warning","page-empty":"info","page-box-fallback":"warning","page-rotated":"info","user-unit-ignored":"info","page-clip-dropped":"info","page-placement-mismatch":"warning","layer-imported-hidden":"info","layer-skipped-hidden":"info","layer-fragmented":"info","ocmd-hidden":"info","marked-content-unbalanced":"warning","annotations-skipped":"info","annotation-imported":"info","font-substituted":"warning","type3-outlined":"info","text-outlined-unmappable":"info","text-outlined-render-mode":"info","text-outlined-vertical":"info","text-outlined-mirrored":"info","invisible-text-dropped":"info","text-clip-converted":"info","glyph-outline-missing":"warning","cmyk-converted":"info","spot-color-flattened":"info","icc-profile-ignored":"info","blend-mode-unsupported":"warning","knockout-group-ignored":"warning","soft-mask-converted":"info","soft-mask-transfer-ignored":"warning","transfer-function-ignored":"warning","radial-gradient-rasterized":"warning","radial-gradient-approximated":"warning","shading-unsupported":"warning","shading-fill-unclipped":"info","mesh-rasterized":"info","mesh-triangulated":"warning","pattern-tile-overlap-clipped":"warning","image-downsampled":"info","image-skipped":"warning","image-decode-failed":"warning","image-mask-tinted":"info","image-reused":"info","hairline-stroke-widened":"info","form-reused":"info","artwork-deduped":"info","xobject-depth-limited":"warning","operator-ignored":"info","operator-unknown":"warning"},U6=class{items=[];index=new Map;add(e){let t=e.detail?JSON.stringify(e.detail):"",r=`${e.code}|${e.page??""}|${t}|${e.elementId??""}|${e.message}`,n=this.index.get(r),i=e.count??1;if(n===void 0){this.index.set(r,this.items.length),this.items.push({code:e.code,severity:e.severity??V6[e.code],message:e.message,page:e.page,count:i,detail:e.detail,elementId:e.elementId});return}let a=this.items[n];this.items[n]={...a,count:a.count+i}}has(e){return this.items.some(t=>t.code===e)}list(){return this.items.slice()}},Wk=class extends Error{constructor(e,t){super(e),this.diagnostics=t,this.name="PdfTranscodeError"}diagnostics},Am=class extends Error{constructor(){super("PDF transcoding was aborted."),this.name="PdfTranscodeAbortError"}};async function G6(e,t,r){let n=await t.runtime.load();rs(t.signal);let i=R6(e),a={...t.runtime.documentParams(),data:e.slice(),password:t.password,disableFontFace:!0,fontExtraProperties:!0,useSystemFonts:!1,isOffscreenCanvasSupported:!1,isImageDecoderSupported:!1,stopAtErrors:!1,maxImageSize:t.images.maxPixels,verbosity:0,useWasm:!0};(t.colorManagement!=="icc"||!t.runtime.supportsIcc())&&delete a.iccUrl;let o=n.getDocument(a),s;try{s=await o.promise}catch(p){throw p?.name==="PasswordException"?(r.add({code:"password-required",message:"The PDF is password protected and no valid password was supplied."}),new Wk("The PDF is password protected.",r.list())):p}rs(t.signal),i.encrypted&&r.add({code:"encrypted-opened",message:"The PDF is encrypted and was opened with the user password."}),i.hasCmyk&&r.add({code:"cmyk-converted",message:"CMYK colors were converted to sRGB with the U.S. Web Coated (SWOP) approximation."}),i.hasSeparation&&r.add({code:"spot-color-flattened",message:"Spot (Separation or DeviceN) colors were flattened through their alternate color spaces."}),i.hasIcc&&!(t.colorManagement==="icc"&&t.runtime.supportsIcc())&&r.add({code:"icc-profile-ignored",message:"ICC-based color spaces were converted through their alternate device spaces."});let l=null,u=null,d=null,c=i.pdfVersion;try{let p=(await s.getMetadata()).info;l=mc(p.Producer),u=mc(p.Creator),d=mc(p.Title),c=mc(p.PDFFormatVersion)??c}catch{}let f=i.hasIllustratorMarkers||/Adobe Illustrator/i.test(u??"")||/Adobe Illustrator/i.test(l??"");if(s.numPages===0)throw r.add({code:"no-pages",message:"The PDF has no pages."}),await o.destroy(),new Wk("The PDF has no pages.",r.list());return{pdfjs:n,document:s,task:o,bytes:e,info:{pageCount:s.numPages,producer:l,creator:u,title:d,isIllustrator:f,encrypted:i.encrypted,pdfVersion:c},close:()=>o.destroy()}}function mc(e){return typeof e=="string"&&e.length>0?e:null}function rs(e){if(e?.aborted)throw new Am}async function W6(e,t,r){let n=[];for(let i=0;i<t.fnArray.length;i++){if(t.fnArray[i]!==r)continue;let a=t.argsArray[i];for(let o of a){let s=o.startsWith("g_")?e.commonObjs:e.objs;n.push(new Promise(l=>s.get(o,l)))}}await Promise.all(n)}var Oa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function X6(e){let t=[],r=0,n=e.length,i="";for(;r+2<n;r+=3){let a=e[r]<<16|e[r+1]<<8|e[r+2];i+=Oa[a>>18&63]+Oa[a>>12&63]+Oa[a>>6&63]+Oa[a&63],i.length>=32768&&(t.push(i),i="")}if(r<n){let a=n-r,o=e[r]<<16|(a>1?e[r+1]:0)<<8;i+=Oa[o>>18&63]+Oa[o>>12&63],i+=a>1?Oa[o>>6&63]:"=",i+="="}return t.push(i),t.join("")}var vm={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};function H6(e){let t=e.data;if(!t)return null;switch(e.kind){case vm.GRAYSCALE_1BPP:return{width:e.width,height:e.height,colorType:0,bitDepth:1,data:t};case vm.RGB_24BPP:return{width:e.width,height:e.height,colorType:2,bitDepth:8,data:t};case vm.RGBA_32BPP:return{width:e.width,height:e.height,colorType:6,bitDepth:8,data:t};default:return null}}function q6(e){let{width:t,height:r}=e,n=new Uint8ClampedArray(t*r*4);if(e.bitDepth===1){let i=Math.ceil(t/8);for(let a=0;a<r;a++)for(let o=0;o<t;o++){let s=e.data[a*i+(o>>3)]>>7-(o&7)&1?255:0,l=(a*t+o)*4;n[l]=s,n[l+1]=s,n[l+2]=s,n[l+3]=255}return n}if(e.colorType===2){for(let i=0,a=0;i<e.data.length;i+=3,a+=4)n[a]=e.data[i],n[a+1]=e.data[i+1],n[a+2]=e.data[i+2],n[a+3]=255;return n}if(e.colorType===6)return n.set(e.data.subarray(0,n.length)),n;for(let i=0,a=0;i<e.data.length;i++,a+=4)n[a]=e.data[i],n[a+1]=e.data[i],n[a+2]=e.data[i],n[a+3]=255;return n}function Y6(e,t,r,n){let i=parseInt(n.slice(1,3),16),a=parseInt(n.slice(3,5),16),o=parseInt(n.slice(5,7),16),s=t+7>>3,l=new Uint8ClampedArray(t*r*4);for(let u=0;u<r;u++)for(let d=0;d<t;d++){let c=e[u*s+(d>>3)]>>7-(d&7)&1,f=(u*t+d)*4;l[f]=i,l[f+1]=a,l[f+2]=o,l[f+3]=c===0?255:0}return{width:t,height:r,colorType:6,bitDepth:8,data:l}}function K6(e,t){let r=Math.min(1,t/Math.max(e.width,e.height));if(r>=1)return e;let n=q6(e),i=Math.max(1,Math.round(e.width*r)),a=Math.max(1,Math.round(e.height*r)),o=new Uint8ClampedArray(i*a*4);for(let s=0;s<a;s++){let l=Math.floor(s*e.height/a),u=Math.max(l+1,Math.floor((s+1)*e.height/a));for(let d=0;d<i;d++){let c=Math.floor(d*e.width/i),f=Math.max(c+1,Math.floor((d+1)*e.width/i)),p=0,h=0,m=0,g=0,v=0;for(let y=l;y<u;y++)for(let I=c;I<f;I++){let x=(y*e.width+I)*4,k=n[x+3];p+=n[x]*k,h+=n[x+1]*k,m+=n[x+2]*k,g+=k,v++}let b=(s*i+d)*4;g>0&&(o[b]=p/g,o[b+1]=h/g,o[b+2]=m/g),o[b+3]=g/v}}return{width:i,height:a,colorType:6,bitDepth:8,data:o}}var Xk=Uint8Array.from([137,80,78,71,13,10,26,10]),gc=null;function Z6(e,t,r){if(!gc){gc=new Uint32Array(256);for(let i=0;i<256;i++){let a=i;for(let o=0;o<8;o++)a=a&1?3988292384^a>>>1:a>>>1;gc[i]=a>>>0}}let n=4294967295;for(let i=t;i<r;i++)n=gc[(n^e[i])&255]^n>>>8;return(n^4294967295)>>>0}function J6(e){let t=1,r=0;for(let n=0;n<e.length;n++)t=(t+e[n])%65521,r=(r+t)%65521;return(r<<16|t)>>>0}function bm(e,t){let r=new Uint8Array(12+t.length),n=new DataView(r.buffer);n.setUint32(0,t.length);for(let i=0;i<4;i++)r[4+i]=e.charCodeAt(i);return r.set(t,8),n.setUint32(8+t.length,Z6(r,4,8+t.length)),r}async function Q6(e){let t=globalThis.CompressionStream;if(t){let r=new Blob([e]).stream().pipeThrough(new t("deflate")),n=await new Response(r).arrayBuffer();return new Uint8Array(n)}return e4(e)}function e4(e){let t=Math.max(1,Math.ceil(e.length/65535)),r=new Uint8Array(2+e.length+t*5+4),n=0;r[n++]=120,r[n++]=1;for(let i=0;i<t;i++){let a=i*65535,o=Math.min(e.length,a+65535),s=o-a;r[n++]=i===t-1?1:0,r[n++]=s&255,r[n++]=s>>8&255,r[n++]=~s&255,r[n++]=~s>>8&255,r.set(e.subarray(a,o),n),n+=s}return new DataView(r.buffer).setUint32(n,J6(e)),r}async function Cm(e){let{width:t,height:r,colorType:n,bitDepth:i}=e,a=i===1?Math.ceil(t/8):t*(n===6?4:n===2?3:1),o=new Uint8Array((a+1)*r);for(let m=0;m<r;m++)o[m*(a+1)]=0,o.set(e.data.subarray(m*a,(m+1)*a),m*(a+1)+1);let s=await Q6(o),l=new Uint8Array(13),u=new DataView(l.buffer);u.setUint32(0,t),u.setUint32(4,r),l[8]=i,l[9]=n,l[10]=0,l[11]=0,l[12]=0;let d=bm("IHDR",l),c=bm("IDAT",s),f=bm("IEND",new Uint8Array(0)),p=new Uint8Array(Xk.length+d.length+c.length+f.length),h=0;for(let m of[Xk,d,c,f])p.set(m,h),h+=m.length;return p}function t4(e,t,r,n,i,a,o,s=3){let l=n[2]-n[0],u=n[3]-n[1];if(!(l>0)||!(u>0)||r<3)return null;let d=Math.min(i,a/l,a/u),c=Math.max(1,Math.ceil(l*d)),f=Math.max(1,Math.ceil(u*d)),p=new Uint8ClampedArray(c*f*4);if(o&&o.length>=3)for(let m=0;m<p.length;m+=4)p[m]=o[0],p[m+1]=o[1],p[m+2]=o[2],p[m+3]=255;let h=m=>[(e[m*2]-n[0])*d,(n[3]-e[m*2+1])*d];for(let m=0;m+2<r;m+=3)r4(p,c,f,h(m),h(m+1),h(m+2),t,m,s);return{png:{width:c,height:f,colorType:6,bitDepth:8,data:p},bounds:n}}function r4(e,t,r,n,i,a,o,s,l){let u=s*l,d=(s+1)*l,c=(s+2)*l,f=Math.max(0,Math.floor(Math.min(n[1],i[1],a[1]))),p=Math.min(r-1,Math.ceil(Math.max(n[1],i[1],a[1]))),h=Math.max(0,Math.floor(Math.min(n[0],i[0],a[0]))),m=Math.min(t-1,Math.ceil(Math.max(n[0],i[0],a[0]))),g=(i[0]-n[0])*(a[1]-n[1])-(a[0]-n[0])*(i[1]-n[1]);if(Math.abs(g)<1e-12)return;let v=1/g;for(let b=f;b<=p;b++){let y=b+.5;for(let I=h;I<=m;I++){let x=I+.5,k=((i[0]-x)*(a[1]-y)-(a[0]-x)*(i[1]-y))*v,$=((a[0]-x)*(n[1]-y)-(n[0]-x)*(a[1]-y))*v,A=1-k-$;if(k<-.002||$<-.002||A<-.002)continue;k=Math.max(0,k),$=Math.max(0,$),A=Math.max(0,A);let S=k+$+A||1,M=(b*t+I)*4;e[M]=(o[u]*k+o[d]*$+o[c]*A)/S,e[M+1]=(o[u+1]*k+o[d+1]*$+o[c+1]*A)/S,e[M+2]=(o[u+2]*k+o[d+2]*$+o[c+2]*A)/S,e[M+3]=255}}}function n4(e,t,r=3){let n=t*r,i=n+r,a=i+r,o=Math.round((e[n]+e[i]+e[a])/3),s=Math.round((e[n+1]+e[i+1]+e[a+1])/3),l=Math.round((e[n+2]+e[i+2]+e[a+2])/3);return`#${o.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}`}var lS=["xmlns","id","class","viewBox","width","height","transform","d","x","y","x1","y1","x2","y2","cx","cy","r","fx","fy","fr","rx","ry","points","href","offset","stop-color","stop-opacity","fill","fill-rule","fill-opacity","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","stroke-opacity","clip-path","clip-rule","clipPathUnits","mask","mask-type","maskUnits","maskContentUnits","opacity","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternContentUnits","patternTransform","preserveAspectRatio","image-rendering","shape-rendering","overflow","font-family","font-size","font-weight","font-style","font-stretch","letter-spacing","word-spacing","text-anchor","writing-mode","style"],i4=new Map(lS.map((e,t)=>[e,t]));function vc(e){let t=i4.get(e);return t!==void 0?t:lS.length+(e.startsWith("data-")?1:0)}function uS(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/[- -]/g,"")}function dS(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/[- -]/g,"")}function ns(e,t=""){let r=[];return cS(e,t,r),r.join("")}var a4=new Set(["text","tspan","title","desc","textPath","style"]);function cS(e,t,r){let n=Object.keys(e.attrs).sort((i,a)=>vc(i)-vc(a)||(i<a?-1:i>a?1:0));r.push(t,"<",e.tag);for(let i of n)r.push(" ",i,'="',uS(e.attrs[i]),'"');if(e.children.length===0){r.push(`/>
108
+ `);return}if(a4.has(e.tag)){r.push(">");for(let i of e.children)fS(i,r);r.push("</",e.tag,`>
109
+ `);return}r.push(`>
110
+ `);for(let i of e.children)Ye(i)?r.push(t," ",dS(i.text),`
111
+ `):cS(i,`${t} `,r);r.push(t,"</",e.tag,`>
112
+ `)}function fS(e,t){if(Ye(e)){t.push(dS(e.text));return}let r=Object.keys(e.attrs).sort((n,i)=>vc(n)-vc(i)||(n<i?-1:n>i?1:0));t.push("<",e.tag);for(let n of r)t.push(" ",n,'="',uS(e.attrs[n]),'"');if(e.children.length===0){t.push("/>");return}t.push(">");for(let n of e.children)fS(n,t);t.push("</",e.tag,">")}function Dl(e){if(typeof e=="string"){if(/^#[0-9a-fA-F]{6}$/.test(e))return e.toLowerCase();if(/^#[0-9a-fA-F]{3}$/.test(e))return`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`.toLowerCase();let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/.exec(e);return t?xm(Number(t[1]),Number(t[2]),Number(t[3])):"#000000"}if(s4(e)){let t=e instanceof Uint8Array||e instanceof Uint8ClampedArray||!o4(e),r=n=>t?Math.max(0,Math.min(255,Math.round(n))):Math.round(n*255);if(e.length>=3)return xm(r(e[0]),r(e[1]),r(e[2]));if(e.length===1){let n=r(e[0]);return xm(n,n,n)}}return"#000000"}function o4(e){for(let t=0;t<e.length;t++)if(e[t]>1||e[t]<0)return!1;return!0}function s4(e){return Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array}function xm(e,t,r){return`#${wm(e)}${wm(t)}${wm(r)}`}function wm(e){return Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")}function jl(e,t,r,n){let i=255+e*(-4.387332384609988*e+54.48615194189176*t+18.82290502165302*r+212.25662451639585*n-285.2331026137004)+t*(1.7149763477362134*t-5.6096736904047315*r+-17.873870861415444*n-5.497006427196366)+r*(-2.5217340131683033*r-21.248923337353073*n+17.5119270841813)+n*(-21.86122147463605*n-189.48180835922747),a=255+e*(8.841041422036149*e+60.118027045597366*t+6.871425592049007*r+31.159100130055922*n-79.2970844816548)+t*(-15.310361306967817*t+17.575251261109482*r+131.35250912493976*n-190.9453302588951)+r*(4.444339102852739*r+9.8632861493405*n-24.86741582555878)+n*(-20.737325471181034*n-187.80453709719578),o=255+e*(.8842522430003296*e+8.078677503112928*t+30.89978309703729*r-.23883238689178934*n-14.183576799673286)+t*(10.49593273432072*t+63.02378494754052*r+50.606957656360734*n-112.23884253719248)+r*(.03296041114873217*r+115.60384449646641*n-193.58209356861505)+n*(-22.33816807309886*n-180.12613974708367);return[Im(i),Im(a),Im(o)]}function Im(e){return Math.max(0,Math.min(255,Math.round(e)))}function l4(e){if(typeof e!="string")return{css:null,supported:!0};switch(e){case"source-over":case"normal":case"compatible":return{css:null,supported:!0};case"multiply":case"screen":case"overlay":case"darken":case"lighten":case"color-dodge":case"color-burn":case"hard-light":case"soft-light":case"difference":case"exclusion":case"hue":case"saturation":case"color":case"luminosity":return{css:e,supported:!0};default:return{css:null,supported:!1}}}function Ol(e,t){let r=[];for(let n of e)switch(n.op){case"M":case"L":{let[i,a]=Gn(t,n.x,n.y);r.push({op:n.op,x:i,y:a});break}case"C":{let[i,a]=Gn(t,n.x1,n.y1),[o,s]=Gn(t,n.x2,n.y2),[l,u]=Gn(t,n.x,n.y);r.push({op:"C",x1:i,y1:a,x2:o,y2:s,x:l,y:u});break}case"Q":{let[i,a]=Gn(t,n.x1,n.y1),[o,s]=Gn(t,n.x,n.y);r.push({op:"Q",x1:i,y1:a,x:o,y:s});break}case"Z":r.push(n);break}return r}function ts(e){let t=1/0,r=1/0,n=-1/0,i=-1/0,a=(o,s)=>{o<t&&(t=o),o>n&&(n=o),s<r&&(r=s),s>i&&(i=s)};for(let o of e)switch(o.op){case"M":case"L":a(o.x,o.y);break;case"C":a(o.x1,o.y1),a(o.x2,o.y2),a(o.x,o.y);break;case"Q":a(o.x1,o.y1),a(o.x,o.y);break;default:break}return Number.isFinite(t)?[t,r,n,i]:null}function km(e){let t=0,r=0;for(let n of e)n.op==="M"&&t++,n.op!=="Z"&&r++;return{subpaths:t,anchors:r}}function u4(e){let t=[],r=0;for(let d of e)if(d.op==="M"){if(r++,r>1)return null;t.push([d.x,d.y])}else if(d.op==="L")t.push([d.x,d.y]);else{if(d.op==="Z")continue;return null}if(t.length===5){let[d,c]=[t[0],t[4]];if(Math.abs(d[0]-c[0])>1e-6||Math.abs(d[1]-c[1])>1e-6)return null;t.pop()}if(t.length!==4)return null;let[n,i,a,o]=t,s=[i[0]-n[0],i[1]-n[1]],l=[a[0]-o[0],a[1]-o[1]],u=1e-4*(Math.hypot(s[0],s[1])+Math.hypot(l[0],l[1])+1);return Math.abs(s[0]-l[0])>u||Math.abs(s[1]-l[1])>u?null:[n,i,a,o]}function Ta(e,t=3){let r=[];for(let n of e)switch(n.op){case"M":case"L":r.push(`${n.op}${re(n.x,t)} ${re(n.y,t)}`);break;case"C":r.push(`C${re(n.x1,t)} ${re(n.y1,t)} ${re(n.x2,t)} ${re(n.y2,t)} ${re(n.x,t)} ${re(n.y,t)}`);break;case"Q":r.push(`Q${re(n.x1,t)} ${re(n.y1,t)} ${re(n.x,t)} ${re(n.y,t)}`);break;case"Z":r.push("Z");break}return r.join("")}function Tl(e){return[{op:"M",x:e[0],y:e[1]},{op:"L",x:e[2],y:e[1]},{op:"L",x:e[2],y:e[3]},{op:"L",x:e[0],y:e[3]},{op:"Z"}]}var d4=[[/^Arial(MT)?$/i,"Arial","sans-serif"],[/^ArialNarrow/i,"Arial Narrow","sans-serif"],[/^ArialBlack/i,"Arial Black","sans-serif"],[/^Helvetica(Neue)?(LT|LTStd)?$/i,"Helvetica","sans-serif"],[/^HelveticaNeue/i,"Helvetica Neue","sans-serif"],[/^Times(NewRoman)?(PS)?(MT)?$/i,"Times New Roman","serif"],[/^Courier(New)?(PS)?(MT)?$/i,"Courier New","monospace"],[/^Symbol$/i,"Symbol","serif"],[/^ZapfDingbats$/i,"Zapf Dingbats","serif"],[/^MyriadPro$/i,"Myriad Pro","sans-serif"],[/^Myriad$/i,"Myriad","sans-serif"],[/^MinionPro$/i,"Minion Pro","serif"],[/^Minion$/i,"Minion","serif"],[/^SourceSansPro$/i,"Source Sans Pro","sans-serif"],[/^SourceSans3$/i,"Source Sans 3","sans-serif"],[/^SourceSerifPro$/i,"Source Serif Pro","serif"],[/^SourceCodePro$/i,"Source Code Pro","monospace"],[/^OpenSans$/i,"Open Sans","sans-serif"],[/^TrebuchetMS$/i,"Trebuchet MS","sans-serif"],[/^Calibri$/i,"Calibri","sans-serif"],[/^Cambria$/i,"Cambria","serif"],[/^Georgia$/i,"Georgia","serif"],[/^Verdana$/i,"Verdana","sans-serif"],[/^Tahoma$/i,"Tahoma","sans-serif"],[/^Garamond/i,"Garamond","serif"],[/^Futura/i,"Futura","sans-serif"],[/^Gotham/i,"Gotham","sans-serif"],[/^Montserrat$/i,"Montserrat","sans-serif"],[/^Roboto$/i,"Roboto","sans-serif"],[/^RobotoMono$/i,"Roboto Mono","monospace"],[/^RobotoSlab$/i,"Roboto Slab","serif"],[/^Lato$/i,"Lato","sans-serif"],[/^Avenir(Next)?$/i,"Avenir","sans-serif"],[/^GillSans/i,"Gill Sans","sans-serif"],[/^FranklinGothic/i,"Franklin Gothic","sans-serif"],[/^CenturyGothic/i,"Century Gothic","sans-serif"],[/^Palatino/i,"Palatino","serif"],[/^BookAntiqua/i,"Book Antiqua","serif"],[/^SegoeUI/i,"Segoe UI","sans-serif"],[/^NotoSans$/i,"Noto Sans","sans-serif"],[/^NotoSerif$/i,"Noto Serif","serif"],[/^NotoSansMono$/i,"Noto Sans Mono","monospace"],[/^DejaVuSans$/i,"DejaVu Sans","sans-serif"],[/^DejaVuSerif$/i,"DejaVu Serif","serif"],[/^DejaVuSansMono$/i,"DejaVu Sans Mono","monospace"],[/^LiberationSans$/i,"Liberation Sans","sans-serif"],[/^LiberationSerif$/i,"Liberation Serif","serif"],[/^LiberationMono$/i,"Liberation Mono","monospace"],[/^Inter$/i,"Inter","sans-serif"],[/^Poppins$/i,"Poppins","sans-serif"],[/^Raleway$/i,"Raleway","sans-serif"],[/^Oswald$/i,"Oswald","sans-serif"],[/^Merriweather$/i,"Merriweather","serif"],[/^PlayfairDisplay$/i,"Playfair Display","serif"],[/^Consolas$/i,"Consolas","monospace"],[/^Menlo$/i,"Menlo","monospace"],[/^Monaco$/i,"Monaco","monospace"],[/^LucidaConsole$/i,"Lucida Console","monospace"],[/^ComicSansMS$/i,"Comic Sans MS","cursive"],[/^Impact$/i,"Impact","sans-serif"],[/^Optima/i,"Optima","sans-serif"],[/^Baskerville/i,"Baskerville","serif"],[/^Didot/i,"Didot","serif"],[/^Bodoni/i,"Bodoni","serif"],[/^Rockwell/i,"Rockwell","serif"],[/^TrajanPro$/i,"Trajan Pro","serif"],[/^AdobeGaramondPro$/i,"Adobe Garamond Pro","serif"]],pS=[[/^(Thin|Hairline)$/i,100],[/^(ExtraLight|UltraLight|ExtLight)$/i,200],[/^Light$/i,300],[/^(Regular|Book|Roman|Normal|Plain|Text)$/i,400],[/^Medium$/i,500],[/^(SemiBold|DemiBold|Semibold|Demibold|Demi)$/i,600],[/^Bold$/i,700],[/^(ExtraBold|UltraBold|Extrabold|Ultrabold|Heavy)$/i,800],[/^(Black|Ultra|ExtraBlack|UltraBlack|Fat)$/i,900]],c4=/^(Italic|It|Oblique|Obl|Slanted|Ital)$/i,hS=[[/^(UltraCondensed|ExtraCondensed)$/i,"extra-condensed"],[/^(Condensed|Cond|Cn|Narrow|Compressed|Compact)$/i,"condensed"],[/^(SemiCondensed|SemiCond)$/i,"semi-condensed"],[/^(Extended|Expanded|Wide|Ext)$/i,"expanded"],[/^(SemiExtended|SemiExpanded)$/i,"semi-expanded"]],f4=/^(MT|PS|PSMT|LT|LTStd|Com|Std|Pro|W1G|OTF)$/i;function mS(e){return e.replace(/^[A-Z]{6}\+/,"")}function p4(e){return e.replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/[_.]+/g," ").trim()}var h4=new RegExp(`^(?:${[...pS.map(([e])=>e),...hS.map(([e])=>e)].map(e=>e.source.replace(/^\^|\$$/g,"")).join("|")})$`,"i");function Hk(e){let t=[];for(let r of e.split(/[-_,\s]+/)){let n=r.replace(/([a-z])([A-Z])/g,"$1 $2").split(" ").filter(Boolean);for(let i=0;i<n.length;i++){let a=i+1<n.length?`${n[i]}${n[i+1]}`:null;a&&h4.test(a)?(t.push(a),i++):t.push(n[i])}}return t}function bc(e){let t=mS(e.name),r=t.search(/[-,]/),n=r>=0?t.slice(0,r):t,i=r>=0?t.slice(r+1):"",a=Hk(i),o=/^(.*?)(Bold|Italic|Oblique|Light|Black|Medium|Regular|Heavy|SemiBold|Condensed|Narrow)((?:Bold|Italic|Oblique|Light|Black|Medium|Regular|Heavy|SemiBold|Condensed|Narrow)*)$/.exec(n);o&&o[1].length>2&&(n=o[1],a.push(...Hk(`${o[2]}${o[3]??""}`.replace(/([a-z])([A-Z])/g,"$1 $2"))));let s=null,l=null;for(let[f,p,h]of d4)if(f.test(n)){s=p,l=h;break}s||(s=p4(n).split(" ").filter(f=>!f4.test(f)).join(" ").trim()||n||"sans-serif");let u=null,d="normal",c=null;for(let f of a){for(let[p,h]of pS)p.test(f)&&(u=h);c4.test(f)&&(d="italic");for(let[p,h]of hS)p.test(f)&&(c=h)}return u===null&&(u=e.black?900:e.bold?700:400),e.italic&&(d="italic"),l||(e.monospace||/Mono|Courier|Code/i.test(n)?l="monospace":e.serif?l="serif":l="sans-serif"),{family:s,generic:l,weight:u,style:d,stretch:c}}function xc(e){let t=/[\s,'"]/.test(e.family)?`'${e.family.replace(/'/g,"")}'`:e.family;return e.family===e.generic?e.generic:`${t}, ${e.generic}`}var m4=new Set(["Helvetica","Arial","Arial Narrow","Arial Black","Arial Unicode MS","Courier","Courier New","Times","Times New Roman","Symbol","Zapf Dingbats","Liberation Sans","Liberation Serif","Calibri","Century Gothic","Comic Sans MS","Gill Sans","Gill Sans MT","Impact","Lucida Console","Lucida Sans","Trebuchet MS","Wingdings","MS Gothic","MS Mincho","MS PGothic","MS PMincho","Itc Symbol","Book Antiqua","Century Schoolbook","Hoefler Text"]);function g4(e){return m4.has(e)}function y4(e){return/^[A-Z]{6}\+/.test(e)}var v4=1e-4;function gS(e,t){let r=Math.abs(e[0])+Math.abs(e[1])+Math.abs(e[2])+Math.abs(e[3])+1e-9;for(let n=0;n<4;n++)if(Math.abs(e[n]-t[n])>v4*r)return!1;return!0}function b4(e,t){return e.frames.length===t.frames.length&&e.frames.every((r,n)=>r.key===t.frames[n].key)}function yS(e,t){return e.fontKey===t.fontKey&&e.size===t.size&&e.renderMode===t.renderMode&&e.fill===t.fill&&e.stroke===t.stroke&&e.strokeWidth===t.strokeWidth&&e.fillOpacity===t.fillOpacity&&e.strokeOpacity===t.strokeOpacity&&e.blend===t.blend&&e.textObject===t.textObject&&e.rise===t.rise&&b4(e,t)}function Gi(e){let t=e.basis,r=e.penY+e.rise;return[t[0]*e.pen+t[2]*r+t[4],t[1]*e.pen+t[3]*r+t[5]]}function x4(e){return jt([e.hs,0,0,-1,0,0],e.basis)}function Da(e,t){let r=e[0]*e[3]-e[1]*e[2];if(Math.abs(r)<1e-12)return[0,0];let n=t[0]-e[4],i=t[1]-e[5];return[(n*e[3]-i*e[2])/r,(i*e[0]-n*e[1])/r]}function w4(e,t=()=>.25){let r=[],n=null;for(let i of e){let a=x4(i);if(n&&yS(n.first,i)&&gS(n.m,a)&&k4(n,i)&&!I4(n,i,t(i))){n.glyphs.push(i);continue}n={glyphs:[i],m:a,first:i},r.push(n)}return r}function I4(e,t,r){let n=e.glyphs[e.glyphs.length-1],i=Da(e.m,Gi(n))[0]+n.advance/n.hs,a=Da(e.m,Gi(t))[0]-i,o=Math.max(r*t.size,.25*t.size);return a>2*o||a<-.5*t.size}function k4(e,t){let r=e.glyphs[e.glyphs.length-1],n=Da(e.m,Gi(t)),i=Da(e.m,Gi(r));return Math.abs(n[1]-i[1])<=.1*Math.max(t.size,1e-6)}function S4(e,t){let r=[],n=[],i=()=>{n.length>0&&r.push(N4(n,t)),n=[]};for(let a of e)n.length>0&&(!gS(n[0].m,a.m)||!yS(n[0].first,a.first))&&i(),n.push(a);return i(),r}function $4(e,t){let r=[e[0],e[1],e[2],e[3],0,0],n=r[0]*r[3]-r[1]*r[2];if(nS(r)&&n>0){let i=Sm(r),a=A6(r);return Math.abs(a)<=.01?{sigma:i,transform:null,offset:[e[4],e[5]]}:{sigma:i,transform:`translate(${re(e[4],t)} ${re(e[5],t)}) rotate(${re(a,t+1)})`,offset:[0,0]}}return{sigma:1,transform:Ui(e,t),offset:[0,0]}}function N4(e,t){let r=e[0].first,n=e[0].m,i=r.size,a=$4(n,t.precision),o={};o["font-family"]=xc(r.mapping),r.mapping.weight!==400&&(o["font-weight"]=String(r.mapping.weight)),r.mapping.style==="italic"&&(o["font-style"]="italic"),r.mapping.stretch&&(o["font-stretch"]=r.mapping.stretch),o["font-size"]=re(i*a.sigma,t.precision),M4(o,r,t.precision),a.transform&&(o.transform=a.transform),r.blend&&(o.style=`mix-blend-mode:${r.blend}`);let s=me("text",o),l=[],u=null,d=0,c=null;for(let p of e){let h=Gi(p.first);c??=h;let m=Da(n,h),g=m[0]*a.sigma+a.offset[0],v=m[1]*a.sigma+a.offset[1],b=A4(p,t,a.sigma),y=me("tspan",{});y.attrs.x=t.positioning==="exact"?b.xs.map(I=>re(g+I,t.precision)).join(" "):re(g,t.precision),y.attrs.y=re(v,t.precision),t.positioning==="natural"&&(b.letterSpacing!==0&&(y.attrs["letter-spacing"]=re(b.letterSpacing,t.precision)),b.wordSpacing!==0&&(y.attrs["word-spacing"]=re(b.wordSpacing,t.precision))),y.children.push(yc(b.text)),s.children.push(y),l.push(b.text),d+=p.glyphs.length,u=O4(u,C4(p))}let f=c??[n[4],n[5]];return{node:s,bbox:u??[f[0],f[1]-i,f[0]+i,f[1]],unicode:l.join(`
113
+ `),frames:r.frames,glyphCount:d,baseline:{x:f[0],y:f[1]},fontName:r.fontName,size:i,blend:r.blend}}function M4(e,t,r){let n=t.renderMode&3,i=n===0||n===2?t.fill:null,a=n===1||n===2?t.stroke:null;e.fill=i??"none",i&&t.fillOpacity<1&&(e["fill-opacity"]=re(t.fillOpacity,3)),a&&(e.stroke=a,e["stroke-width"]=re(t.strokeWidth,r),t.strokeOpacity<1&&(e["stroke-opacity"]=re(t.strokeOpacity,3)))}function A4(e,t,r){let n="",i=[],a=Da(e.m,Gi(e.first)),o=e.first.charSpacing,s=e.first.wordSpacing,l=e.glyphs.every(c=>c.charSpacing===o)?o*r:0,u=e.glyphs.every(c=>c.wordSpacing===s)?s*r:0,d=0;for(let c=0;c<e.glyphs.length;c++){let f=e.glyphs[c],p=(Da(e.m,Gi(f))[0]-a[0])*r;if(c>0){let h=p-d,m=f.size*r,g=Math.max(t.spaceAdvance(f)*f.size,.25*f.size)*r,v=e.glyphs[c-1];h>.08*m&&h<=2*g&&!v.isSpace&&!f.isSpace&&f.unicode!==" "&&v.unicode!==" "&&(n+=" ",i.push(d))}i.push(p),n+=f.unicode||"\uFFFD",d=p+f.advance/f.hs*r}return{text:n,xs:i,letterSpacing:l,wordSpacing:u}}function C4(e){let t=[],r=e.m;for(let n of e.glyphs){let i=Gi(n),a=n.advance/n.hs;t.push(i[0],i[1]),t.push(r[0]*a+i[0],r[1]*a+i[1]),t.push(r[2]*-n.size*.8+i[0],r[3]*-n.size*.8+i[1]),t.push(r[0]*a+r[2]*-n.size*.8+i[0],r[1]*a+r[3]*-n.size*.8+i[1])}return P6(t)}function O4(e,t){return e?t?[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[3],t[3])]:e:t}var Pl={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},xe={status:"handled"},qk=e=>({status:"ignored",reason:e}),Ze=e=>({status:"unreachable",reason:e}),Mr="folded into constructPath by the evaluator",Yk="consumed by the evaluator before the operator list is built",uH={dependency:xe,setLineWidth:xe,setLineCap:xe,setLineJoin:xe,setMiterLimit:xe,setDash:xe,setRenderingIntent:qk("rendering intents have no SVG equivalent"),setFlatness:qk("flatness tolerance has no SVG equivalent"),setGState:xe,save:xe,restore:xe,transform:xe,moveTo:Ze(Mr),lineTo:Ze(Mr),curveTo:Ze(Mr),curveTo2:Ze(Mr),curveTo3:Ze(Mr),closePath:Ze(Mr),rectangle:Ze(Mr),stroke:Ze(Mr),closeStroke:Ze(Mr),fill:Ze(Mr),eoFill:Ze(Mr),fillStroke:Ze(Mr),eoFillStroke:Ze(Mr),closeFillStroke:Ze(Mr),closeEOFillStroke:Ze(Mr),endPath:Ze(Mr),clip:xe,eoClip:xe,beginText:xe,endText:xe,setCharSpacing:xe,setWordSpacing:xe,setHScale:xe,setLeading:xe,setFont:xe,setTextRenderingMode:xe,setTextRise:xe,moveText:xe,setLeadingMoveText:xe,setTextMatrix:xe,nextLine:xe,showText:xe,showSpacedText:Ze("converted to showText by the evaluator"),nextLineShowText:xe,nextLineSetSpacingShowText:xe,setCharWidth:xe,setCharWidthAndBounds:xe,setStrokeColorSpace:Ze(Yk),setFillColorSpace:Ze(Yk),setStrokeColor:Ze("converted to setStrokeRGBColor by the evaluator"),setStrokeColorN:xe,setFillColor:Ze("converted to setFillRGBColor by the evaluator"),setFillColorN:xe,setStrokeGray:Ze("converted to setStrokeRGBColor by the evaluator"),setFillGray:Ze("converted to setFillRGBColor by the evaluator"),setStrokeRGBColor:xe,setFillRGBColor:xe,setStrokeCMYKColor:Ze("converted to setStrokeRGBColor by the evaluator"),setFillCMYKColor:Ze("converted to setFillRGBColor by the evaluator"),shadingFill:xe,beginInlineImage:Ze("parser-level operator"),beginImageData:Ze("parser-level operator"),endInlineImage:Ze("parser-level operator"),paintXObject:Ze("resolved by the evaluator"),markPoint:Ze("skipped by the evaluator"),markPointProps:Ze("skipped by the evaluator"),beginMarkedContent:xe,beginMarkedContentProps:xe,endMarkedContent:xe,beginCompat:Ze("skipped by the evaluator"),endCompat:Ze("skipped by the evaluator"),paintFormXObjectBegin:xe,paintFormXObjectEnd:xe,beginGroup:xe,endGroup:xe,beginAnnotation:xe,endAnnotation:xe,paintImageMaskXObject:xe,paintImageMaskXObjectGroup:xe,paintImageXObject:xe,paintInlineImageXObject:xe,paintInlineImageXObjectGroup:xe,paintImageXObjectRepeat:xe,paintImageMaskXObjectRepeat:xe,paintSolidColorImageMask:xe,constructPath:xe,setStrokeTransparent:xe,setFillTransparent:xe,rawFillPath:xe};function Nm(e){let t=[];if(!e)return t;let r=e.length,n=0;for(;n<r;)switch(e[n++]){case Pl.moveTo:t.push({op:"M",x:e[n],y:e[n+1]}),n+=2;break;case Pl.lineTo:t.push({op:"L",x:e[n],y:e[n+1]}),n+=2;break;case Pl.curveTo:t.push({op:"C",x1:e[n],y1:e[n+1],x2:e[n+2],y2:e[n+3],x:e[n+4],y:e[n+5]}),n+=6;break;case Pl.quadraticCurveTo:t.push({op:"Q",x1:e[n],y1:e[n+1],x:e[n+2],y:e[n+3]}),n+=4;break;case Pl.closePath:t.length>0&&t[t.length-1].op!=="Z"&&t.push({op:"Z"});break;default:return t}return t}function vS(){return{font:null,size:0,charSpacing:0,wordSpacing:0,hscale:1,leading:0,rise:0,renderMode:0,tm:pi,tlm:pi,penX:0,penY:0,lineX:0,lineY:0}}function T4(e){return{ctm:e,baseCtm:e,clip:[],fill:{kind:"color",hex:"#000000"},stroke:{kind:"color",hex:"#000000"},fillAlpha:1,strokeAlpha:1,blend:null,softMask:null,lineWidth:1,lineCap:0,lineJoin:0,miterLimit:10,dash:null,transferActive:!1,text:vS(),pendingClip:null}}function Kk(e){return{...e,text:{...e.text}}}var P4=2048,Zk=6,Jk=32,D4=4,j4=class Mm{constructor(t,r,n,i){this.doc=t,this.pageCtx=r,this.emitter=n,this.state=T4(i)}doc;pageCtx;emitter;state;stack=[];frames=[];blendModeUsed=!1;markedStack=[];groupStack=[];captureStack=[];suppress=0;textRecords=[];textObject=0;textClipPaths=[];textClipActive=!1;lastMask=null;emittedOnPage=!1;markedIndex=0;frameSerial=0;formDepth=0;patternDepth=0;opCount=0;pageDiagnosed=new Set;get objs(){return this.pageCtx.page.objs}get commonObjs(){return this.pageCtx.page.commonObjs}async run(t){let{fnArray:r,argsArray:n}=t;for(let i=0;i<r.length;i++)if(this.execute(r[i],n[i]),++this.opCount%P4===0){if(this.doc.options.signal?.aborted)throw new Am;await E4()}this.flushText(),this.emitter.closeAll(),this.doc.stats.operators+=r.length}runNested(t){let{fnArray:r,argsArray:n}=t;for(let i=0;i<r.length;i++)this.execute(r[i],n[i]);this.flushText(),this.doc.stats.operators+=r.length}diagnoseOnce(t,r,n){this.pageDiagnosed.has(t)||(this.pageDiagnosed.add(t),this.doc.sink.add({code:t,message:r,page:this.pageCtx.pageNumber,detail:n}))}diagnose(t,r,n){this.doc.sink.add({code:t,message:r,page:this.pageCtx.pageNumber,detail:n})}execute(t,r){let n=this.doc.opName[t]??"",i=r??[];switch(n){case"dependency":return;case"setLineWidth":this.state.lineWidth=Number(i[0]);return;case"setLineCap":this.state.lineCap=Number(i[0]);return;case"setLineJoin":this.state.lineJoin=Number(i[0]);return;case"setMiterLimit":this.state.miterLimit=Number(i[0]);return;case"setDash":this.setDash(i[0],i[1]);return;case"setRenderingIntent":case"setFlatness":return;case"setGState":this.setGState(i[0]);return;case"save":this.save();return;case"restore":this.restore();return;case"transform":this.state.ctm=jt(Qk(i),this.state.ctm);return;case"clip":this.state.pendingClip="nonzero";return;case"eoClip":this.state.pendingClip="evenodd";return;case"constructPath":this.constructPath(i);return;case"rawFillPath":this.rawFillPath(i[0]);return;case"beginText":this.beginText();return;case"endText":this.endText();return;case"setCharSpacing":this.state.text.charSpacing=Number(i[0]);return;case"setWordSpacing":this.state.text.wordSpacing=Number(i[0]);return;case"setHScale":this.state.text.hscale=Number(i[0])/100;return;case"setLeading":this.state.text.leading=Number(i[0]);return;case"setFont":this.setFont(String(i[0]),Number(i[1]));return;case"setTextRenderingMode":this.state.text.renderMode=Number(i[0]);return;case"setTextRise":this.state.text.rise=Number(i[0]);return;case"moveText":this.moveText(Number(i[0]),Number(i[1]));return;case"setLeadingMoveText":this.state.text.leading=-Number(i[1]),this.moveText(Number(i[0]),Number(i[1]));return;case"setTextMatrix":{let a=Qk(i);this.state.text.tm=a,this.state.text.tlm=a,this.state.text.penX=0,this.state.text.penY=0,this.state.text.lineX=0,this.state.text.lineY=0;return}case"nextLine":this.moveText(0,-this.state.text.leading);return;case"showText":this.showText(i[0]);return;case"nextLineShowText":this.moveText(0,-this.state.text.leading),this.showText(i[0]);return;case"nextLineSetSpacingShowText":this.state.text.wordSpacing=Number(i[0]),this.state.text.charSpacing=Number(i[1]),this.moveText(0,-this.state.text.leading),this.showText(i[2]);return;case"setCharWidth":case"setCharWidthAndBounds":return;case"setStrokeRGBColor":this.uncolored||(this.state.stroke={kind:"color",hex:Dl(i[0])});return;case"setFillRGBColor":this.uncolored||(this.state.fill={kind:"color",hex:Dl(i[0])});return;case"setStrokeColorN":this.uncolored||(this.state.stroke=this.patternPaint(i));return;case"setFillColorN":this.uncolored||(this.state.fill=this.patternPaint(i));return;case"setStrokeTransparent":this.uncolored||(this.state.stroke={kind:"none"});return;case"setFillTransparent":this.uncolored||(this.state.fill={kind:"none"});return;case"shadingFill":this.shadingFill(String(i[0]));return;case"beginMarkedContent":this.markedStack.push(null);return;case"beginMarkedContentProps":this.beginMarkedContentProps(String(i[0]),i[1]);return;case"endMarkedContent":this.endMarkedContent();return;case"paintFormXObjectBegin":this.formBegin(i[0],i[1]);return;case"paintFormXObjectEnd":this.formEnd();return;case"beginGroup":this.beginGroup(i[0]);return;case"endGroup":this.endGroup();return;case"beginAnnotation":this.beginAnnotation(i);return;case"endAnnotation":this.endAnnotation();return;case"paintImageMaskXObject":this.paintImageMask(i[0],this.state.ctm);return;case"paintImageMaskXObjectGroup":for(let a of i[0])this.paintImageMask(a,jt(Cn(a.transform),this.state.ctm));return;case"paintImageMaskXObjectRepeat":{let[a,o,s,l,u,d]=i;for(let c=0;c+1<d.length;c+=2)this.paintImageMask(a,jt([o,s,l,u,d[c],d[c+1]],this.state.ctm));return}case"paintImageXObject":this.paintImage(this.imageObject(String(i[0])),this.state.ctm,String(i[0]));return;case"paintInlineImageXObject":this.paintImage(i[0],this.state.ctm,null);return;case"paintInlineImageXObjectGroup":{let a=i[0];for(let o of i[1])this.paintImage(a,jt(Cn(o.transform),this.state.ctm),null);return}case"paintImageXObjectRepeat":{let[a,o,s,l]=i,u=this.imageObject(a);for(let d=0;d+1<l.length;d+=2)this.paintImage(u,jt([o,0,0,s,l[d],l[d+1]],this.state.ctm),a);return}case"paintSolidColorImageMask":this.fillCanvasPath(Ol(Tl([0,0,1,1]),this.state.ctm),"nonzero",!0,!1);return;default:n===""?this.diagnose("operator-unknown",`Operator ${t} is not known to this transcoder.`,{operator:t}):this.diagnoseOnce("operator-ignored",`Operator ${n} has no effect in SVG output.`,{operator:n})}}save(){this.stack.push(Kk(this.state))}restore(){let t=this.stack.pop();t&&(this.state=t,this.frames=this.frames.filter(r=>this.frameStillActive(r)))}frameStillActive(t){return t.kind==="clip"?this.state.clip.some(r=>r.frame===t):t.kind==="mask"?this.state.softMask===t:!0}setDash(t,r){let n=Array.isArray(t)?t.filter(i=>Number.isFinite(i)):[];if(n.length===0||n.every(i=>i===0)){this.state.dash=null;return}this.state.dash={array:n,phase:Number(r)||0}}setGState(t){if(Array.isArray(t))for(let[r,n]of t)switch(r){case"LW":this.state.lineWidth=Number(n);break;case"LC":this.state.lineCap=Number(n);break;case"LJ":this.state.lineJoin=Number(n);break;case"ML":this.state.miterLimit=Number(n);break;case"D":Array.isArray(n)&&this.setDash(n[0],n[1]);break;case"CA":this.state.strokeAlpha=eS(Number(n));break;case"ca":this.state.fillAlpha=eS(Number(n));break;case"BM":{let i=l4(n);i.supported||this.diagnose("blend-mode-unsupported",`Blend mode ${String(n)} has no CSS equivalent; normal blending is used.`,{mode:String(n)}),this.state.blend=i.css;break}case"Font":Array.isArray(n)&&this.setFont(String(n[0]),Number(n[1]));break;case"SMask":n?this.activateMask():this.deactivateMask();break;case"TR":n!=null&&n!==!1&&(this.state.transferActive=!0,this.diagnoseOnce("transfer-function-ignored","A transfer function in the graphics state was ignored."));break;default:break}}newFrameKey(t){return`${t}:${++this.frameSerial}`}place(t,r=this.frames){this.suppress>0||(this.emittedOnPage=!0,this.emitter.place(t,r))}constructPath(t){let r=this.doc.opName[Number(t[0])]??"endPath",n=t[1],i=Array.isArray(n)?n[0]:n,a=i?Nm(i):[];if(this.state.pendingClip&&(this.applyClip(a,this.state.pendingClip),this.state.pendingClip=null),a.length!==0)switch(r){case"fill":this.paintPath(a,"nonzero",!0,!1,!1);break;case"eoFill":this.paintPath(a,"evenodd",!0,!1,!1);break;case"stroke":this.paintPath(a,"nonzero",!1,!0,!1);break;case"closeStroke":this.paintPath(a,"nonzero",!1,!0,!0);break;case"fillStroke":this.paintPath(a,"nonzero",!0,!0,!1);break;case"eoFillStroke":this.paintPath(a,"evenodd",!0,!0,!1);break;case"closeFillStroke":this.paintPath(a,"nonzero",!0,!0,!0);break;case"closeEOFillStroke":this.paintPath(a,"evenodd",!0,!0,!0);break;default:break}}rawFillPath(t){let r=Nm(t);r.length>0&&this.paintPath(r,"nonzero",!0,!1,!1)}applyClip(t,r){if(t.length===0)return;let n=Ol(t,this.state.ctm),i=u4(n),a=ts(n);if(!a)return;if(this.pageCtx.dropPageClip&&!this.emittedOnPage&&i&&O6(oS(i),this.pageCtx.pageBox,.5)&&this.formDepth===0){this.diagnoseOnce("page-clip-dropped","A clip equal to the page box was dropped.");return}let o=Ta(n,this.doc.options.precision),s=this.doc.defs.intern("clip",Ca(`${r}|${o}`),u=>me("clipPath",{id:u,clipPathUnits:"userSpaceOnUse"},[me("path",r==="evenodd"?{d:o,"clip-rule":"evenodd"}:{d:o})]));this.doc.clips.has(s)||this.doc.clips.set(s,{quad:i,bounds:a,path:n});let l={key:this.newFrameKey("clip"),kind:"clip",attrs:{"clip-path":`url(#${s})`},clipId:s,clipQuad:i,clipBounds:a};this.state.clip=[...this.state.clip,{frame:l}],this.frames.push(l)}paintPath(t,r,n,i,a){let o=a&&t[t.length-1]?.op!=="Z"?[...t,{op:"Z"}]:t,s=n&&this.state.fill.kind!=="none",l=i&&this.state.stroke.kind!=="none";if(!s&&!l)return;let u=Ol(o,this.state.ctm);this.emitPath(o,u,r,s,l)}fillCanvasPath(t,r,n,i){this.emitPath(t,t,r,n,i,!0)}emitPath(t,r,n,i,a,o=!1){let s=ts(r);if(!s)return;let l=this.doc.options.precision,u=this.state.ctm,d=o||!a||nS(u),c=Sm(u),f={};d?f.d=Ta(r,l):(f.d=Ta(t,l),f.transform=Ui(u,l));let p=i?this.paintValue(this.state.fill,d?null:u):"none";f.fill=p,n==="evenodd"&&i&&(f["fill-rule"]="evenodd"),i&&this.state.fillAlpha<1&&(f["fill-opacity"]=re(this.state.fillAlpha,3));let h=0;if(a){f.stroke=this.paintValue(this.state.stroke,d?null:u);let b=this.state.lineWidth;if(b<=0?(b=d?this.doc.options.hairlineWidth:this.doc.options.hairlineWidth/(c||1),this.diagnoseOnce("hairline-stroke-widened",`Zero-width strokes are drawn ${this.doc.options.hairlineWidth} units wide.`)):d&&(b*=c),h=d?b:b*c,f["stroke-width"]=re(b,l),this.state.lineCap===1?f["stroke-linecap"]="round":this.state.lineCap===2&&(f["stroke-linecap"]="square"),this.state.lineJoin===1?f["stroke-linejoin"]="round":this.state.lineJoin===2&&(f["stroke-linejoin"]="bevel"),this.state.miterLimit!==10&&this.state.lineJoin===0&&(f["stroke-miterlimit"]=re(this.state.miterLimit,3)),this.state.dash){let y=d?c:1;f["stroke-dasharray"]=this.state.dash.array.map(I=>re(I*y,l)).join(" "),this.state.dash.phase&&(f["stroke-dashoffset"]=re(this.state.dash.phase*y,l))}this.state.strokeAlpha<1&&(f["stroke-opacity"]=re(this.state.strokeAlpha,3))}if(this.applyBlend(f),this.isDuplicate(`path|${JSON.stringify(f)}`))return;let m=me("path",f),g=h/2;m.bbox=[s[0]-g,s[1]-g,s[2]+g,s[3]+g],this.place(m),this.doc.stats.paths++;let v=km(r);this.recordAtom({node:m,kind:"path",bbox:m.bbox,fill:i?tS(this.state.fill):"none",stroke:a?tS(this.state.stroke):"none",fillRgb:i&&this.state.fill.kind==="color"?this.state.fill.hex:void 0,strokeRgb:a&&this.state.stroke.kind==="color"?this.state.stroke.hex:void 0,strokeWidth:a?h:void 0,subpathCount:v.subpaths,anchorCount:v.anchors,pathHash:Ca(Ta(r,3))})}applyBlend(t){if(!this.state.blend)return;let r=`mix-blend-mode:${this.state.blend}`;t.style=t.style?`${t.style};${r}`:r,this.blendModeUsed=!0}isDuplicate(t){if(!this.doc.dedupe||this.suppress>0)return!1;let r=this.doc.seenLeaves.get(t);return r===void 0?(this.doc.seenLeaves.set(t,this.pageCtx.pageNumber),!1):r===this.pageCtx.pageNumber?!1:(this.diagnoseOnce("artwork-deduped","Artwork repeated identically on an earlier page was imported once."),!0)}recordAtom(t){if(this.suppress>0||!this.recordAtoms)return;let r=null,n=null,i=!1,a=null;for(let o of this.frames)o.kind==="layer"&&o.ocgId&&(r=o.ocgId),o.kind==="marked"&&o.markedIndex!==void 0&&(n=o.markedIndex),o.kind==="clip"&&(i=!0,o.clipBounds&&(a=a?[Math.max(a[0],o.clipBounds[0]),Math.max(a[1],o.clipBounds[1]),Math.min(a[2],o.clipBounds[2]),Math.min(a[3],o.clipBounds[3])]:o.clipBounds));this.doc.atoms.push({id:this.doc.ids.next("a"),page:this.pageCtx.pageNumber,ocg:r,markedContentIndex:n,order:this.doc.atoms.length,opacity:this.state.fillAlpha<1?this.state.fillAlpha:void 0,blend:this.state.blend??void 0,clipped:i,clipBounds:a,...t,kind:this.atomKind??t.kind}),this.state.blend&&(this.blendModeUsed=!0)}patternPaint(t){if(Array.isArray(t)){if(t[0]==="TilingPattern"){let[,r,n,i,a,o,s,l,u]=t;return{kind:"tiling",ir:{color:r,operatorList:n,matrix:i,bbox:a,xstep:o,ystep:s,paintType:l,tilingType:u}}}if(t[0]==="Shading")return{kind:"shading",objId:String(t[1]),matrix:t[2]?Cn(t[2]):null}}return this.diagnose("shading-unsupported","A pattern color could not be interpreted; the paint was dropped."),{kind:"none"}}paintValue(t,r){switch(t.kind){case"color":return t.hex;case"none":return"none";case"shading":{let n=jt(t.matrix??pi,this.state.baseCtm),i=r?jt(n,ym(r)??pi):n,a=this.gradientDef(t.objId,i,null);return a?`url(#${a})`:"none"}case"tiling":{let n=this.tilingDef(t.ir,r);return n?`url(#${n})`:"none"}}}shadingObject(t){try{let r=this.objs.get(t);return Array.isArray(r)?r:null}catch{return null}}gradientDef(t,r,n){let i=this.shadingObject(t);if(!i)return this.diagnose("shading-unsupported","A shading could not be read; its paint was dropped.",{objId:t}),null;if(i[0]==="Dummy")return this.diagnose("shading-unsupported","An unsupported shading type was dropped.",{objId:t}),null;if(i[0]==="Mesh")return this.meshDef(i,r,n);let[,a,,o,s,l,u,d]=i,c=this.doc.options.precision,f=rS(o).map(([x,k,$])=>{let A={offset:re(x,Zk),"stop-color":k};return $<1&&(A["stop-opacity"]=re($,3)),me("stop",A)}),p=Ui(r,c);if(a==="axial"){let x=Ca(`axial|${JSON.stringify(o)}|${s}|${l}|${p}`);return this.doc.defs.intern("grad",x,k=>me("linearGradient",{id:k,gradientUnits:"userSpaceOnUse",x1:re(s[0],c),y1:re(s[1],c),x2:re(l[0],c),y2:re(l[1],c),gradientTransform:p},f))}let h=s,m=u??0,g=l,v=d??0,b=f,y=Math.hypot(g[0]-h[0],g[1]-h[1]);if(y+m>v+1e-6)if(Math.hypot(s[0]-l[0],s[1]-l[1])+v<=m+1e-6)h=l,m=d??0,g=s,v=u??0,b=rS(o).map(([x,k,$])=>{let A={offset:re(1-x,Zk),"stop-color":k};return $<1&&(A["stop-opacity"]=re($,3)),me("stop",A)}).reverse();else{let x=Math.max(0,v-m-.001)/(y||1);h=[g[0]+(h[0]-g[0])*x,g[1]+(h[1]-g[1])*x],this.diagnose("radial-gradient-approximated","A radial shading whose circles are not nested was approximated with a nested focal circle.",{objId:t})}let I=Ca(`radial|${JSON.stringify(o)}|${h}|${m}|${g}|${v}|${p}`);return this.doc.defs.intern("grad",I,x=>me("radialGradient",{id:x,gradientUnits:"userSpaceOnUse",cx:re(g[0],c),cy:re(g[1],c),r:re(v,c),fx:re(h[0],c),fy:re(h[1],c),...m>0?{fr:re(m,c)}:{},gradientTransform:p},b))}meshDef(t,r,n){let[,,i,a,o,s]=t,l=t[7];if(!s||s.length<4)return this.diagnose("shading-unsupported","A mesh shading without bounds was dropped."),null;let u=[s[0],s[1],s[2],s[3]],d=o>0?Math.max(3,Math.floor(a.length/o)):3,c=this.doc.options.precision,f=ym(r),p=f?pc(this.pageCtx.pageBox,f).bounds:null,h=Pa(u,p)??u,m={patternUnits:"userSpaceOnUse",x:re(h[0],c),y:re(h[1],c),width:re(h[2]-h[0],c),height:re(h[3]-h[1],c),patternTransform:Ui(r,c)};if(this.doc.options.mesh.strategy==="triangles"){let b=[];for(let y=0;y+2<o;y+=3){let I=`M${re(i[y*2],c)} ${re(i[y*2+1],c)}L${re(i[(y+1)*2],c)} ${re(i[(y+1)*2+1],c)}L${re(i[(y+2)*2],c)} ${re(i[(y+2)*2+1],c)}Z`;b.push(me("path",{d:I,fill:n4(a,y,d),"shape-rendering":"crispEdges"}))}return this.diagnose("mesh-triangulated","A mesh shading was flattened into flat-shaded triangles.",{triangles:Math.floor(o/3)}),this.doc.defs.add("mesh",y=>me("pattern",{id:y,...m},b))}let g=t4(i,a,o,u,this.doc.options.mesh.pixelsPerUnit,this.doc.options.mesh.maxSize,l,d);if(!g)return this.diagnose("shading-unsupported","A mesh shading could not be rasterized."),null;let v=me("image",{x:re(u[0],c),y:re(u[1],c),width:re(u[2]-u[0],c),height:re(u[3]-u[1],c),preserveAspectRatio:"none",transform:`matrix(1 0 0 -1 0 ${re(u[1]+u[3],c)})`});return this.queueImage(v,g.png),this.diagnose("mesh-rasterized","A mesh shading was rasterized into an embedded image.",{width:g.png.width,height:g.png.height}),this.doc.defs.add("mesh",b=>me("pattern",{id:b,...m},[v]))}tilingDef(t,r){if(this.patternDepth>=D4)return this.diagnose("shading-unsupported","Nested tiling patterns beyond four levels were dropped."),null;let n=this.doc.options.precision,i=jt(Cn(t.matrix),this.state.baseCtm),a=r?jt(i,ym(r)??pi):i,o=t.bbox,s=Math.abs(t.xstep)||o[2]-o[0],l=Math.abs(t.ystep)||o[3]-o[1],u=Ca(`tile|${JSON.stringify([t.color,t.paintType,t.xstep,t.ystep,Array.from(o)])}|${Ui(a,n)}|${t.operatorList.fnArray.length}`);return this.doc.defs.intern("pat",u,d=>{let c=me("pattern",{id:d,patternUnits:"userSpaceOnUse",x:re(o[0],n),y:re(o[1],n),width:re(s,n),height:re(l,n),patternTransform:Ui(a,n)});(o[2]-o[0]>s+1e-6||o[3]-o[1]>l+1e-6)&&this.diagnose("pattern-tile-overlap-clipped","A tiling pattern whose cell exceeds its step is clipped to the step in SVG.");let f=new Mm(this.doc,this.pageCtx,this.emitterFor(c),pi);if(f.patternDepth=this.patternDepth+1,f.recordAtoms=!1,t.paintType===2){let p=Dl(t.color);f.state.fill={kind:"color",hex:p},f.state.stroke={kind:"color",hex:p},f.uncolored=!0}return f.runNested(t.operatorList),f.emitter.closeAll(),c})}uncolored=!1;recordAtoms=!0;atomKind=null;emitterFor(t){let r=this.emitter.constructor;return new r(t)}shadingFill(t){let r=this.state.clip.length>0?this.state.clip[this.state.clip.length-1]:null,n,i=this.frames;if(r){let d=this.doc.clips.get(r.frame.clipId??"");n=d?[...d.path]:Tl(r.frame.clipBounds??this.pageCtx.pageBox),i=this.frames.filter(c=>c!==r.frame)}else n=Tl(this.pageCtx.pageBox),this.diagnoseOnce("shading-fill-unclipped","A shading fill without a clip was painted over the whole page.");let a=this.gradientDef(t,this.state.ctm,ts(n));if(!a)return;let o=ts(n);if(!o)return;let s={d:Ta(n,this.doc.options.precision),fill:`url(#${a})`};if(this.state.fillAlpha<1&&(s["fill-opacity"]=re(this.state.fillAlpha,3)),this.applyBlend(s),this.isDuplicate(`shading|${JSON.stringify(s)}`))return;let l=me("path",s);l.bbox=o,this.place(l,i),this.doc.stats.paths++;let u=km(n);this.recordAtom({node:l,kind:"shading",bbox:o,fill:"shading",stroke:"none",subpathCount:u.subpaths,anchorCount:u.anchors,pathHash:Ca(s.d)})}imageObject(t){try{let r=this.objs.get(t);return r&&typeof r=="object"?r:null}catch{return null}}queueImage(t,r){let n=this.doc.options.images.maxDimension,i=r;(r.width>n||r.height>n)&&(i=K6(r,n),this.diagnose("image-downsampled","An image larger than the configured maximum was downsampled.",{from:`${r.width}x${r.height}`,to:`${i.width}x${i.height}`})),this.doc.imageJobs.push(Cm(i).then(a=>{t.attrs.href=`data:image/png;base64,${X6(a)}`}))}paintImage(t,r,n){if(!t||!t.data&&!t.bitmap){this.diagnose("image-skipped","An image could not be decoded and was skipped.",n?{objId:n}:void 0);return}let i=H6(t);if(!i){this.diagnose("image-decode-failed","An image in an unexpected pixel format was skipped.",{kind:t.kind});return}let a=this.doc.options.precision,o=jt([1/t.width,0,0,-1/t.height,0,1],r),s=me("image",{width:String(t.width),height:String(t.height),preserveAspectRatio:"none",transform:Ui(o,a)});this.state.fillAlpha<1&&(s.attrs.opacity=re(this.state.fillAlpha,3)),this.applyBlend(s.attrs);let l=pc([0,0,1,1],r).bounds;t.interpolate!==!0&&(l[2]-l[0]>t.width||l[3]-l[1]>t.height)&&(s.attrs["image-rendering"]="optimizeSpeed"),!this.isDuplicate(`image|${n??`inline:${i.width}x${i.height}:${i.data.length}`}|${JSON.stringify(s.attrs)}`)&&(s.bbox=l,this.queueImage(s,i),this.place(s),this.doc.stats.images++,this.recordAtom({node:s,kind:"image",bbox:l,fill:"none",stroke:"none"}))}paintImageMask(t,r){let n=null;if(typeof t.data=="string")try{let f=this.objs.get(t.data);n=f instanceof Uint8Array||f instanceof Uint8ClampedArray?f:f?.data??null}catch{n=null}else n=t.data;if(!n){this.diagnose("image-skipped","A stencil mask could not be decoded and was skipped.");return}let i=this.state.fill,a=i.kind==="color"?i.hex:"#000000";i.kind!=="color"&&this.diagnose("image-mask-tinted","A stencil mask painted with a pattern was tinted with black instead.");let o=Y6(n,t.width,t.height,a),s=this.doc.options.precision,l=jt([1/t.width,0,0,-1/t.height,0,1],r),u=me("image",{width:String(t.width),height:String(t.height),preserveAspectRatio:"none",transform:Ui(l,s)});this.state.fillAlpha<1&&(u.attrs.opacity=re(this.state.fillAlpha,3)),this.applyBlend(u.attrs);let d=pc([0,0,1,1],r).bounds;if(t.interpolate!==!0&&(d[2]-d[0]>t.width||d[3]-d[1]>t.height)&&(u.attrs["image-rendering"]="optimizeSpeed"),this.isDuplicate(`mask|${typeof t.data=="string"?t.data:`inline:${t.width}x${t.height}:${n.length}`}|${a}|${JSON.stringify(u.attrs)}`))return;let c=pc([0,0,1,1],r).bounds;u.bbox=c,this.queueImage(u,o),this.place(u),this.doc.stats.images++,this.recordAtom({node:u,kind:"image",bbox:c,fill:i.kind==="color"?"flat":"none",stroke:"none",fillRgb:a})}formBegin(t,r){if(this.save(),this.formDepth++,this.formDepth>Jk){this.diagnoseOnce("xobject-depth-limited","Form XObjects nested deeper than 32 levels were suppressed."),this.suppress++;return}if(t&&(this.state.ctm=jt(Cn(t),this.state.ctm)),this.state.baseCtm=this.state.ctm,r&&r.length>=4){let n=[Math.min(r[0],r[2]),Math.min(r[1],r[3]),Math.max(r[0],r[2]),Math.max(r[1],r[3])];this.applyClip(Tl(n),"nonzero")}}formEnd(){this.formDepth>Jk&&(this.suppress=Math.max(0,this.suppress-1)),this.formDepth=Math.max(0,this.formDepth-1),this.flushText(),this.restore()}beginGroup(t){if(this.flushText(),t.smask){let a=t.smask.subtype==="Alpha"?"alpha":"luminance",o=me("mask",{maskUnits:"userSpaceOnUse","mask-type":a,style:`mask-type:${a}`}),s=this.doc.defs.add("mask",()=>o),l={savedFrames:this.frames,maskId:s,maskNode:o,smask:t.smask};this.save(),this.state.fillAlpha=1,this.state.strokeAlpha=1,this.state.blend=null,this.state.softMask=null,this.state.clip=[],this.frames=[],this.emitter.pushTarget(o),this.captureStack.push(l),this.groupStack.push({frame:null,capture:l});return}let r={},n=[];this.state.fillAlpha<1&&(r.opacity=re(this.state.fillAlpha,3)),this.state.blend&&(n.push(`mix-blend-mode:${this.state.blend}`),this.blendModeUsed=!0),n.push("isolation:isolate"),n.length>0&&(r.style=n.join(";")),t.knockout&&this.diagnoseOnce("knockout-group-ignored","Knockout transparency groups are composited as ordinary groups."),this.save(),this.state.fillAlpha=1,this.state.strokeAlpha=1,this.state.blend=null;let i=null;Object.keys(r).length>0&&(i={key:this.newFrameKey("group"),kind:"group",attrs:r},this.frames.push(i)),this.groupStack.push({frame:i,capture:null})}endGroup(){this.flushText();let t=this.groupStack.pop();if(t){if(t.capture){this.captureStack.pop(),this.emitter.closeAll();let r=this.emitter.popTarget();this.restore(),this.frames=t.capture.savedFrames,this.finishMask(t.capture,r),this.lastMask={id:t.capture.maskId};return}this.restore(),t.frame&&(this.frames=this.frames.filter(r=>r!==t.frame))}}finishMask(t,r){let n=this.doc.options.precision,i=Pa(r.bbox??null,this.pageCtx.pageBox)??this.pageCtx.pageBox;r.attrs.x=re(i[0],n),r.attrs.y=re(i[1],n),r.attrs.width=re(i[2]-i[0],n),r.attrs.height=re(i[3]-i[1],n);let a=t.smask.backdrop;if(t.smask.subtype==="Luminosity"&&a&&a.length>0){let o=a.length>=3?.299*a[0]+.587*a[1]+.114*a[2]:a[0],s=o<=1?Math.round(o*255):Math.round(o);if(s>0){let l=`#${s.toString(16).padStart(2,"0").repeat(3)}`;r.children.unshift(me("rect",{x:r.attrs.x,y:r.attrs.y,width:r.attrs.width,height:r.attrs.height,fill:l}))}}t.smask.transferMap&&this.diagnose("soft-mask-transfer-ignored","A soft mask transfer function was ignored."),this.diagnose("soft-mask-converted","A soft mask was converted to an SVG mask.",{type:t.smask.subtype})}activateMask(){if(!this.lastMask)return;this.deactivateMask();let t={key:this.newFrameKey("mask"),kind:"mask",attrs:{mask:`url(#${this.lastMask.id})`}};this.state.softMask=t,this.frames.push(t)}deactivateMask(){if(!this.state.softMask)return;let t=this.state.softMask;this.state.softMask=null,this.frames=this.frames.filter(r=>r!==t)}beginAnnotation(t){let[r,n,i,a]=t;this.flushText(),this.save(),i&&(this.state.ctm=jt(Cn(i),this.state.ctm)),a&&(this.state.ctm=jt(Cn(a),this.state.ctm)),this.state.baseCtm=this.state.ctm,n&&n.length>=4&&this.applyClip(Tl([Math.min(n[0],n[2]),Math.min(n[1],n[3]),Math.max(n[0],n[2]),Math.max(n[1],n[3])]),"nonzero");let o={key:this.newFrameKey("annotation"),kind:"annotation",attrs:{id:this.doc.ids.unique(`annotation-${String(r)}`)}};this.frames.push(o),this.groupStack.push({frame:o,capture:null}),this.diagnose("annotation-imported","An annotation appearance was imported as a group.",{id:String(r)})}endAnnotation(){this.flushText();let t=this.groupStack.pop();this.restore(),t?.frame&&(this.frames=this.frames.filter(r=>r!==t.frame))}beginMarkedContentProps(t,r){if(t==="OC"){this.markedStack.push(this.layerFrame(r));return}if(t==="Layer"){let n=this.markedIndex++,i={key:this.newFrameKey("marked"),kind:"marked",attrs:{"data-pdf-layer":String(n)},markedIndex:n};this.frames.push(i),this.markedStack.push(i);return}this.markedStack.push(null)}layerFrame(t){if(!t)return null;let r=this.doc.ocConfig,n=r?r.isVisible(t):!0;if(t.type==="OCG"){let i=(r?.getGroup(t.id)??null)?.name??null;if(!n&&this.doc.options.hiddenLayers==="skip")return this.diagnose("layer-skipped-hidden","A hidden layer was left out.",{layer:i??t.id}),this.suppress++,{key:this.newFrameKey("skip"),kind:"layer",attrs:{},ocgId:t.id};if(this.doc.options.layers==="flatten"){n||this.diagnose("layer-imported-hidden","A hidden layer was imported hidden.",{layer:i??t.id});let u={key:this.newFrameKey("layer"),kind:"layer",attrs:n?{}:{style:"display:none"},ocgId:t.id};return n||this.frames.push(u),n?null:u}let a=this.doc.layers.get(t.id);a||(a={id:this.doc.ids.unique(i??`layer-${fn(t.id)}`),name:i,visible:n,svgIds:[]},this.doc.layers.set(t.id,a));let o=a.svgIds.length===0?a.id:this.doc.ids.unique(a.id);a.svgIds.push(o),n||this.diagnose("layer-imported-hidden","A hidden layer was imported hidden.",{layer:i??t.id});let s={id:o};n||(s.style="display:none");let l={key:this.newFrameKey("layer"),kind:"layer",attrs:s,title:this.doc.options.layerTitles?i??void 0:void 0,ocgId:t.id};return this.frames.push(l),l}if(!n){if(this.doc.options.hiddenLayers==="skip")return this.diagnose("ocmd-hidden","Content in a hidden optional-content membership was left out."),this.suppress++,{key:this.newFrameKey("skip"),kind:"layer",attrs:{}};this.diagnose("ocmd-hidden","Content in a hidden optional-content membership was imported hidden.");let i={key:this.newFrameKey("layer"),kind:"layer",attrs:{style:"display:none"}};return this.frames.push(i),i}return null}endMarkedContent(){if(this.markedStack.length===0){this.diagnoseOnce("marked-content-unbalanced","An EMC without a matching BDC was ignored.");return}let t=this.markedStack.pop()??null;if(t){if(this.flushText(),t.key.startsWith("skip:")){this.suppress=Math.max(0,this.suppress-1);return}this.frames=this.frames.filter(r=>r!==t)}}beginText(){let t=this.state.text;t.tm=pi,t.tlm=pi,t.penX=0,t.penY=0,t.lineX=0,t.lineY=0,this.textObject++}endText(){this.flushText(),this.textClipActive&&this.applyTextClip()}moveText(t,r){let n=this.state.text;n.lineX+=t,n.lineY+=r,n.penX=n.lineX,n.penY=n.lineY}setFont(t,r){this.state.text.size=r,this.state.text.font=this.loadFont(t)}loadFont(t){let r=this.doc.fonts.get(t);if(r)return r;let n=null;try{n=this.commonObjs.get(t)}catch{n=null}if(!n)return null;let i=mS(n.name??t),a={name:i,type:n.type??"",subtype:n.subtype??"",bold:!!n.bold,italic:!!n.italic,black:!!n.black,serif:!!n.isSerifFont,monospace:!!n.isMonospace,symbolic:!!n.isSymbolicFont,missingFile:!!n.missingFile,isType3:!!n.isType3Font,vertical:!!n.vertical,composite:!!n.composite},o=bc(a),s=this.doc.options.fontMap?.(a);s&&(o={...o,...s});let l=n.fontMatrix&&n.fontMatrix.length>=6?Cn(n.fontMatrix):[.001,0,0,.001,0,0],u=n.widths,d=u?(Array.isArray(u),u[32]):void 0,c={loadedName:t,font:n,mapping:o,fontMatrix:l,isType3:!!n.isType3Font,vertical:!!n.vertical,embedded:y4(n.name??"")||!!n.data&&!n.missingFile&&!g4(o.family),name:i,type:n.type??"",subtype:n.subtype??"",spaceAdvance:typeof d=="number"&&d>0?d*l[0]:.25,glyphsShown:0,outlinedGlyphs:0,unmappableGlyphs:0};return this.doc.fonts.set(t,c),c.isType3||this.doc.sink.add({code:"font-substituted",message:`Font ${i} is not embedded as a web font; text uses the mapped family.`,detail:{font:i,family:o.family,embedded:c.embedded}}),c}showText(t){let r=this.state.text,n=r.font;if(!n||!Array.isArray(t))return;let i=r.size,a=r.hscale,o=i*n.fontMatrix[0],s=jt(r.tm,this.state.ctm),l=this.state.fill.kind==="color"?this.state.fill.hex:this.state.fill.kind==="none"?null:"#000000",u=this.state.stroke.kind==="color"?this.state.stroke.hex:this.state.stroke.kind==="none"?null:"#000000",d=(this.state.lineWidth>0?this.state.lineWidth:this.doc.options.hairlineWidth)*Sm(this.state.ctm);for(let c of t){if(typeof c=="number"){r.penX+=-c*i*.001*a;continue}let f=c;if(!f||typeof f!="object")continue;let p=r.charSpacing+(f.isSpace?r.wordSpacing:0),h=(f.width*o+p)*a;n.glyphsShown++,this.doc.stats.glyphs++,r.renderMode===3?this.diagnoseOnce("invisible-text-dropped","Invisible text (render mode 3) was dropped."):(r.renderMode&3)!==3&&this.textRecords.push({unicode:f.unicode??"",fontChar:f.fontChar??"",...f.operatorListId!==void 0?{operatorListId:String(f.operatorListId)}:{},isSpace:!!f.isSpace,fontKey:n.loadedName,mapping:n.mapping,fontName:n.name,size:i,hs:a,rise:r.rise,penY:r.penY,renderMode:r.renderMode,pen:r.penX,advance:h,basis:s,fill:l,stroke:u,strokeWidth:d,fillOpacity:this.state.fillAlpha,strokeOpacity:this.state.strokeAlpha,blend:this.state.blend,frames:this.frames.slice(),textObject:this.textObject,charSpacing:r.charSpacing,wordSpacing:r.wordSpacing}),r.renderMode>=4&&(this.textClipActive=!0,this.accumulateTextClip(n,f,i,a,r.penX,r.penY+r.rise,s)),r.penX+=h}}accumulateTextClip(t,r,n,i,a,o,s){let l=this.doc.glyphCache.get(this.commonObjs,t.loadedName,r.fontChar);if(!l||l.length===0)return;let u=jt([n*i,0,0,n,a,o],s);this.textClipPaths.push(...Ol(l,u))}applyTextClip(){this.textClipActive=!1;let t=this.textClipPaths;if(this.textClipPaths=[],t.length===0)return;let r=Ta(t,this.doc.options.precision),n=ts(t);if(!n)return;let i=this.doc.defs.intern("clip",Ca(`text|${r}`),o=>me("clipPath",{id:o,clipPathUnits:"userSpaceOnUse"},[me("path",{d:r})]));this.doc.clips.set(i,{quad:null,bounds:n,path:t});let a={key:this.newFrameKey("clip"),kind:"clip",attrs:{"clip-path":`url(#${i})`},clipId:i,clipQuad:null,clipBounds:n};this.state.clip=[...this.state.clip,{frame:a}],this.frames.push(a),this.diagnose("text-clip-converted","Text used as a clipping path was converted to a clip path of glyph outlines.")}flushText(){if(this.textRecords.length===0)return;let t=this.textRecords;this.textRecords=[];let r=w4(t,o=>this.doc.fonts.get(o.fontKey)?.spaceAdvance??.25),n=this.doc.options.textMode==="outline",i=[];for(let o of r){let s=this.doc.fonts.get(o.first.fontKey);if(s?.isType3){this.diagnose("type3-outlined",`Text set in the Type3 font ${o.first.fontName} was drawn from its glyph procedures.`,{font:o.first.fontName}),this.emitType3Run(o,s);continue}let l=s?this.outlineReason(o,s):"missing";if(n||l){!n&&l&&this.diagnose(l==="vertical"?"text-outlined-vertical":l==="mirrored"?"text-outlined-mirrored":l==="render-mode"?"text-outlined-render-mode":"text-outlined-unmappable",`Text set in ${o.first.fontName} was converted to outlines.`,{font:o.first.fontName}),this.emitOutlinedRun(o,s);continue}i.push(o)}if(i.length===0)return;let a=S4(i,{precision:this.doc.options.precision,positioning:this.doc.options.textPositioning,spaceAdvance:o=>this.doc.fonts.get(o.fontKey)?.spaceAdvance??.25});for(let o of a)o.blend&&(this.blendModeUsed=!0),!this.isDuplicate(`text|${ns(o.node)}`)&&(o.node.bbox=o.bbox,this.place(o.node,o.frames),this.doc.stats.texts++,this.recordAtom({node:o.node,kind:"text",bbox:o.bbox,fill:o.node.attrs.fill==="none"?"none":"flat",stroke:o.node.attrs.stroke?"flat":"none",fillRgb:o.node.attrs.fill!=="none"?o.node.attrs.fill:void 0,text:{unicode:o.unicode,font:o.fontName,size:o.size,baseline:o.baseline}}))}outlineReason(t,r){if(r.vertical)return"vertical";if(t.first.size<0)return"mirrored";let n=t.first.renderMode&3;if((n===1||n===2)&&(this.state.stroke.kind==="shading"||this.state.stroke.kind==="tiling")||n===0&&(this.state.fill.kind==="shading"||this.state.fill.kind==="tiling"))return"render-mode";let i=0;for(let a of t.glyphs){let o=a.unicode.codePointAt(0)??0;a.unicode.length>0&&o!==65533&&!(o>=57344&&o<=63743)&&!(o>=983040)&&i++}return i<t.glyphs.length*.6?"unmappable":null}emitOutlinedRun(t,r){let n=this.doc.options.precision,i=[],a=0;for(let h of t.glyphs){let m=r?this.glyphOutline(r,h.fontChar):null;if(!m){a++;continue}let g=jt([h.size*h.hs,0,0,h.size,h.pen,h.penY+h.rise],h.basis);i.push(...Ol(m,g)),r&&r.outlinedGlyphs++}if(a>0&&this.diagnose("glyph-outline-missing",`${a} glyph outlines of ${t.first.fontName} were unavailable and skipped.`,{font:t.first.fontName,count:a}),i.length===0)return;let o=ts(i);if(!o)return;let s=t.first,l=s.renderMode&3,u={d:Ta(i,n)},d=(l===0||l===2)&&s.fill,c=(l===1||l===2)&&s.stroke;if(u.fill=d?this.paintValue(this.state.fill,null):"none",d&&s.fillOpacity<1&&(u["fill-opacity"]=re(s.fillOpacity,3)),c&&(u.stroke=this.paintValue(this.state.stroke,null),u["stroke-width"]=re(s.strokeWidth,n),s.strokeOpacity<1&&(u["stroke-opacity"]=re(s.strokeOpacity,3))),!d&&!c||(s.blend&&(u.style=`mix-blend-mode:${s.blend}`),this.isDuplicate(`outline|${JSON.stringify(u)}`)))return;let f=me("path",u);f.bbox=o,this.place(f,s.frames),this.doc.stats.texts++,this.doc.stats.textsOutlined++;let p=km(i);this.recordAtom({node:f,kind:"text",bbox:o,fill:d?"flat":"none",stroke:c?"flat":"none",fillRgb:d?s.fill??void 0:void 0,subpathCount:p.subpaths,anchorCount:p.anchors,text:{unicode:t.glyphs.map(h=>h.unicode).join(""),font:s.fontName,size:s.size,baseline:{x:s.basis[4],y:s.basis[5]}}})}glyphOutline(t,r){return this.doc.glyphCache.get(this.commonObjs,t.loadedName,r)}emitType3Run(t,r){let n=r.font.charProcOperatorList,i=o=>{if(n)return n instanceof Map?n.get(o):n[o]},a=0;for(let o of t.glyphs){let s=o.operatorListId??o.fontChar,l=i(s);if(!l||l.fnArray.length===0){a++;continue}let u=jt(r.fontMatrix,jt([o.size*o.hs,0,0,o.size,o.pen,o.penY+o.rise],o.basis)),d=new Mm(this.doc,this.pageCtx,this.emitter,u);d.state=Kk(this.state),d.state.ctm=u,d.state.baseCtm=u,d.state.text=vS(),d.state.pendingClip=null,d.state.fillAlpha=o.fillOpacity,d.state.strokeAlpha=o.strokeOpacity,this.doc.opName[l.fnArray[0]]==="setCharWidth"&&(d.state.fillAlpha=1,d.state.strokeAlpha=1),d.frames=o.frames.slice(),d.formDepth=this.formDepth+1,d.emittedOnPage=!0,d.suppress=this.suppress,d.atomKind="text",d.runNested(l),d.blendModeUsed&&(this.blendModeUsed=!0),r.outlinedGlyphs++}a>0&&this.diagnose("glyph-outline-missing",`${a} glyph procedures of ${t.first.fontName} were unavailable and skipped.`,{font:t.first.fontName,count:a}),this.doc.stats.texts++,this.doc.stats.textsOutlined++}};function Qk(e){if(e.length>=6&&typeof e[0]=="number")return Cn(e);let t=e[0];return t&&typeof t=="object"&&t.length>=6?Cn(t):pi}function eS(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function tS(e){switch(e.kind){case"color":return"flat";case"none":return"none";case"shading":return"shading";case"tiling":return"pattern"}}function rS(e){let t=e.map((n,i)=>({offset:Math.max(0,Math.min(1,n[0])),color:n[1],index:i})).sort((n,i)=>n.offset-i.offset||n.index-i.index),r=n=>n==="transparent";return t.map((n,i)=>{if(!r(n.color))return[n.offset,Dl(n.color),1];let a=[t[i+1],t[i-1]].find(o=>o&&!r(o.color));return[n.offset,a?Dl(a.color):"#000000",0]})}async function E4(){let e=globalThis.scheduler;if(e?.yield){await e.yield();return}await new Promise(t=>setTimeout(t,0))}var z4=class{targets=[];constructor(e){this.targets.push({root:e,open:[]})}pushTarget(e){this.targets.push({root:e,open:[]})}popTarget(){if(this.targets.length===1)throw new Error("Emitter target stack underflow");return this.targets.pop().root}get root(){return this.targets[0].root}get currentRoot(){return this.targets[this.targets.length-1].root}get depth(){return this.targets.length}place(e,t){let r=this.targets[this.targets.length-1],n=0;for(;n<r.open.length&&n<t.length&&r.open[n].frame.key===t[n].key;)n++;r.open.length=n;for(let a=n;a<t.length;a++){let o=t[a],s=a===0?r.root:r.open[a-1].node,l=me("g",{...o.attrs});o.title&&l.children.push(me("title",{},[yc(o.title)])),s.children.push(l),r.open.push({frame:o,node:l})}let i=t.length===0?r.root:r.open[t.length-1].node;if(i.children.push(e),e.bbox){for(let a of r.open)a.node.bbox=Pa(a.node.bbox??null,e.bbox);r.root.bbox=Pa(r.root.bbox??null,e.bbox)}return i}closeAll(){this.targets[this.targets.length-1].open.length=0}},R4=new Set(["opacity","clip-path","mask","style","transform","id","class"]),_4=new Set(["opacity","clip-path","mask","style","id"]),F4=new Set(["clip-path","mask"]);function L4(e,t){bS(e),xS(e,t),wS(e)}function B4(e){return e.tag!=="g"&&e.tag!=="title"}function bS(e){let t=!1;return e.children=e.children.filter(r=>{if(Ye(r))return t=!0,!0;if(r.tag==="title"||r.tag==="desc")return!0;if(r.tag==="g"||r.tag==="svg"){let n=bS(r);return n&&(t=!0),n}return t=!0,!0}),t||B4(e)||e.tag==="svg"}function V4(e){let t=e.attrs["clip-path"],r=t?/^url\(#([^)]+)\)$/.exec(t):null;return r?r[1]:null}function xS(e,t){for(let i of e.children)Ye(i)||xS(i,t);let r=V4(e);if(!r||!e.bbox)return;let n=t.get(r);n?.quad&&T6(n.quad,e.bbox,.01)&&delete e.attrs["clip-path"]}function wS(e){for(let r of e.children)Ye(r)||wS(r);let t=[];for(let r of e.children){if(Ye(r)||r.tag!=="g"){t.push(r);continue}if(Object.keys(r.attrs).length===0&&r.children.every(a=>Ye(a)||a.tag!=="title")){t.push(...r.children);continue}let n=r.children.filter(a=>!Ye(a)&&a.tag!=="title"),i=r.children.filter(a=>!Ye(a)&&a.tag==="title");if(n.length===1&&n[0].tag==="g"&&i.length===0){let a=n[0],o=Object.keys(a.attrs);if(!(o.some(s=>_4.has(s)&&s in r.attrs)||!o.every(s=>R4.has(s)||!(s in r.attrs))||"transform"in a.attrs&&Object.keys(r.attrs).some(s=>F4.has(s)))&&!("id"in r.attrs&&"id"in a.attrs)){let s={tag:"g",attrs:{...r.attrs,...a.attrs},children:a.children,bbox:r.bbox};r.attrs.transform&&a.attrs.transform&&(s.attrs.transform=`${r.attrs.transform} ${a.attrs.transform}`),t.push(s);continue}}t.push(r)}e.children=t}var U4=class{cache=new Map;get(e,t,r){let n=`${t}_path_${r}`,i=this.cache.get(n);if(i!==void 0)return i;let a=null;if(e.has(n)){let o=e.get(n),s=o&&typeof o=="object"&&"path"in o?o.path:null;a=s?Nm(s):[]}return this.cache.set(n,a),a}clear(){this.cache.clear()}};function G4(e){return{runtime:e.runtime,pages:e.pages??"all",textMode:e.textMode??"editable",textPositioning:e.textPositioning??"natural",layers:e.layers??"groups",hiddenLayers:e.hiddenLayers??"import-hidden",layerTitles:e.layerTitles??!0,pageBox:e.pageBox??"auto",pageLayout:e.pageLayout??"auto",pageGap:e.pageGap??24,pagePlacements:e.pagePlacements??[],pageClip:e.pageClip??"auto",dedupeAcrossPages:e.dedupeAcrossPages??"auto",annotations:e.annotations??"skip",colorManagement:e.colorManagement??"device",images:{maxPixels:e.images?.maxPixels??16e6,maxDimension:e.images?.maxDimension??4096},mesh:{strategy:e.mesh?.strategy??"raster",pixelsPerUnit:e.mesh?.pixelsPerUnit??2,maxSize:e.mesh?.maxSize??2048},hairlineWidth:e.hairlineWidth??.25,precision:e.precision??3,idPrefix:e.idPrefix??"pdf",password:e.password,fontMap:e.fontMap,signal:e.signal,onProgress:e.onProgress}}function W4(e,t){if(e==="all")return Array.from({length:t},(n,i)=>i+1);let r=new Set;if(Array.isArray(e))for(let n of e)Number.isInteger(n)&&n>=1&&n<=t&&r.add(n);else{let n=e,i=Math.max(1,Math.floor(n.from)),a=Math.min(t,Math.floor(n.to));for(let o=i;o<=a;o++)r.add(o)}return[...r].sort((n,i)=>n-i)}async function IS(e,t){let r=Date.now(),n=G4(t),i=new U6,a=(s,l,u,d=0)=>{n.onProgress?.({phase:s,fraction:l,page:u,pageCount:d})};a("load",0);let o=await G6(e,n,i);try{let{pdfjs:s,document:l}=o,u=W4(n.pages,l.numPages),d=[];for(let[R,U]of Object.entries(s.OPS))d[U]=R;let c=null;try{c=await l.getOptionalContentConfig()}catch{c=null}a("scan",.05,void 0,u.length);let f=[],p=[];for(let R of u){rs(n.signal);let U=await l.getPage(R);f.push(U);let V=F6(U,e,n);V.fallback&&i.add({code:"page-box-fallback",message:`The requested ${n.pageBox} box was not found; the crop box was used.`,page:R}),V.rotate!==0&&i.add({code:"page-rotated",message:`The page declares a rotation of ${V.rotate} degrees, which was applied.`,page:R}),V.userUnit!==1&&i.add({code:"user-unit-ignored",message:"The page declares a UserUnit, which SVG output ignores.",page:R,detail:{userUnit:V.userUnit}}),p.push(V)}let h=n.pageLayout==="auto"?o.info.isIllustrator||Y4(p)?"source":"row":n.pageLayout,m=B6(p,h,n.pageGap);H4(m,p,u,n,i),q4(m);let g=n.pageClip==="drop"||n.pageClip==="auto"&&o.info.isIllustrator,v=n.dedupeAcrossPages===!0||n.dedupeAcrossPages==="auto"&&o.info.isIllustrator&&h==="source",b=null;try{b=await l.getPageLabels()}catch{b=null}let y=new D6(n.idPrefix),I=new j6(y),x={pdfjs:s,opName:d,options:n,sink:i,ids:y,defs:I,fonts:new Map,glyphCache:new U4,ocConfig:c,layers:new Map,clips:new Map,atoms:[],imageJobs:[],stats:{operators:0,paths:0,images:0,texts:0,textsOutlined:0,glyphs:0},isIllustrator:o.info.isIllustrator,dedupe:v,seenLeaves:new Map},k=[];for(let R=0;R<f.length;R++){rs(n.signal);let U=f[R],V=u[R],Y=p[R],G=m[R];a("page-operators",.1+.8*R/f.length,V,f.length);let H=me("g",f.length>1&&!o.info.isIllustrator?{id:y.unique(`page-${V}`)}:{}),X={index:V,label:b?.[V-1]??null,viewId:f.length>1?y.unique(`Page_${V}`):null,box:{kind:Y.kind,pdf:Y.pdfBox,canvas:G.canvasBox},rotate:Y.rotate,userUnit:Y.userUnit,groupId:H.attrs.id??null},B=!1,ae=!1;try{n.annotations==="skip"&&await X4(U,V,i);let K=await U.getOperatorList({intent:"display",annotationMode:n.annotations==="appearance"?s.AnnotationMode.ENABLE:s.AnnotationMode.DISABLE});await W6(U,K,s.OPS.dependency),rs(n.signal),a("page-transcode",.1+.8*(R+.5)/f.length,V,f.length);let W=jt(Y.viewportTransform,G.translation),J=new z4(H),Q=new j4(x,{page:U,pageNumber:V,pageBox:G.canvasBox,dropPageClip:g},J,W);await Q.run(K),B=Q.blendModeUsed,L4(H,x.clips),H.children.length===0&&i.add({code:"page-empty",message:"The page has no visible content.",page:V})}catch(K){if(K instanceof Am)throw K;let W=K instanceof Error?K.message:String(K);H.children.length=0,ae={reason:W},i.add({code:"page-skipped",message:`The page could not be interpreted and was left out: ${W}`,page:V})}k.push({page:{...X,skipped:ae},group:H,isolate:B}),U.cleanup()}a("images",.92,void 0,f.length),await Promise.all(x.imageJobs),rs(n.signal),a("assemble",.97,void 0,f.length);let $=new Map;for(let[R,U]of x.layers)for(let V of U.svgIds)$.set(V,R);let{root:A,mergedLayerIds:S}=z6(k,I,{precision:n.precision,title:o.info.title,mergePages:o.info.isIllustrator&&h==="source",layerOf:R=>$.get(R)??null}),M=new Set,T=R=>{R.attrs.id&&M.add(R.attrs.id);for(let U of R.children)Ye(U)||T(U)};T(A);for(let[R,U]of x.layers){let V=U.svgIds.filter(Y=>!S.has(Y)&&M.has(Y));U.svgIds.splice(0,U.svgIds.length,...V),V.length>1&&i.add({code:"layer-fragmented",message:"A layer painted in several separate ranges was imported as several groups.",detail:{layer:U.name??R,groups:V.length}})}let E=ns(A),C=K4(x,c),O=[...x.fonts.values()].map(R=>({loadedName:R.loadedName,name:R.name,type:R.type,subtype:R.subtype,embedded:R.embedded,isType3:R.isType3,vertical:R.vertical,mapping:R.mapping,glyphsShown:R.glyphsShown,outlined:R.outlinedGlyphs>0&&R.outlinedGlyphs>=R.glyphsShown,unmappableGlyphs:R.unmappableGlyphs})),z=x.atoms;return{svg:E,tree:A,pages:k.map(R=>R.page),layers:C,atoms:z,fonts:O,diagnostics:i.list(),info:o.info,stats:{...x.stats,bytes:E.length,durationMs:Date.now()-r}}}finally{await o.close().catch(()=>{})}}async function X4(e,t,r){let n=0;try{n=(await e.getAnnotations()).length}catch{n=0}n>0&&r.add({code:"annotations-skipped",message:'Annotations were left out; pass annotations: "appearance" to import their appearance streams.',page:t,detail:{count:n}})}function H4(e,t,r,n,i){for(let a of n.pagePlacements){let o=r.indexOf(a.page);if(o<0)continue;let s=t[o],[l,u,d,c]=a.canvas,f=d-l,p=c-u;(Math.abs(f-s.width)>.5||Math.abs(p-s.height)>.5)&&i.add({code:"page-placement-mismatch",message:"The requested placement rectangle differs in size from the page box; the page was aligned to the rectangle's top-left corner.",page:a.page,detail:{requested:`${f}x${p}`,page:`${s.width}x${s.height}`}}),e[o]={translation:[1,0,0,1,l,u],canvasBox:[l,u,l+s.width,u+s.height]}}}function q4(e){if(e.length===0)return;let t=1/0,r=1/0;for(let n of e)t=Math.min(t,n.canvasBox[0]),r=Math.min(r,n.canvasBox[1]);if(!(t===0&&r===0))for(let n=0;n<e.length;n++){let i=e[n];e[n]={translation:[1,0,0,1,i.translation[4]-t,i.translation[5]-r],canvasBox:[i.canvasBox[0]-t,i.canvasBox[1]-r,i.canvasBox[2]-t,i.canvasBox[3]-r]}}}function Y4(e){let t=e.map(n=>[n.pdfBox[0],-n.pdfBox[3],n.pdfBox[2],-n.pdfBox[1]]);for(let n=0;n<t.length;n++)for(let i=n+1;i<t.length;i++){let a=t[n],o=t[i];if(a[0]<o[2]&&o[0]<a[2]&&a[1]<o[3]&&o[1]<a[3])return!1}let r=t.reduce((n,i)=>Pa(n,i),null);return t.length>1&&r!==null}function K4(e,t){let r=t?.getOrder(),n=new Set,i=s=>{n.add(s);let l=e.layers.get(s),u=t?.getGroup(s)??null;return{id:s,name:l?.name??u?.name??null,svgIds:l?.svgIds??[],visible:l?.visible??u?.visible??!0,children:[]}},a=s=>{if(Array.isArray(s))return s.flatMap(l=>a(l));if(typeof s=="string")return[i(s)];if(s&&typeof s=="object"&&"order"in s){let l=s;return[{id:`label:${l.name??""}`,name:l.name??null,svgIds:[],visible:!0,children:a(l.order)}]}return[]},o=r?a(r):[];for(let s of e.layers.keys())n.has(s)||o.push(i(s));return o}function vi(e,t=0,r=e.length){if(r<=t)return"";if(r-t<=32768)return String.fromCharCode.apply(null,Array.from(e.subarray(t,r)));let n=[];for(let i=t;i<r;i+=32768){let a=Math.min(i+32768,r);n.push(String.fromCharCode.apply(null,Array.from(e.subarray(i,a))))}return n.join("")}function KS(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r)&255;return t}function Ut(e){return KS(e)}function Ar(e,t,r=0,n=e.length){let i=t.length;if(i===0)return r;let a=t[0],o=Math.min(n,e.length)-i;e:for(let s=Math.max(0,r);s<=o;s++)if(e[s]===a){for(let l=1;l<i;l++)if(e[s+l]!==t[l])continue e;return s}return-1}function Z4(e,t,r=e.length){let n=t.length;if(n===0)return-1;let i=t[0];e:for(let a=Math.min(r,e.length-n);a>=0;a--)if(e[a]===i){for(let o=1;o<n;o++)if(e[a+o]!==t[o])continue e;return a}return-1}function as(e,t,r=0){if(r+t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(e[r+n]!==t[n])return!1;return!0}function J4(e){let t=0;for(let i of e)t+=i.length;let r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}function Ur(e){return e===32||e===10||e===13||e===9||e===12||e===0}function Q4(e){return e===40||e===41||e===60||e===62||e===91||e===93||e===123||e===125||e===47||e===37}function kS(e){return!Ur(e)&&!Q4(e)}function Oc(e){return e>=48&&e<=57}function e8(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:-1}function ZS(e){let t=new Uint8Array(Math.ceil(e.length/2)),r=0,n=-1;for(let i=0;i<e.length;i++){let a=e[i];if(a===62)break;let o=e8(a);o<0||(n<0?n=o:(t[r++]=n<<4|o,n=-1))}return n>=0&&(t[r++]=n<<4),t.subarray(0,r)}function Ym(e){let t=new Uint8Array(Math.ceil(e.length*4/5)+4),r=0,n=0,i=0,a=0;for(e.length>=2&&e[0]===60&&e[1]===126&&(a=2);a<e.length;a++){let o=e[a];if(o===126)break;if(!Ur(o)){if(o===122&&i===0){t[r++]=0,t[r++]=0,t[r++]=0,t[r++]=0;continue}o<33||o>117||(n=n*85+(o-33),i++,i===5&&(t[r++]=n>>>24&255,t[r++]=n>>>16&255,t[r++]=n>>>8&255,t[r++]=n&255,n=0,i=0))}}if(i>0){for(let s=i;s<5;s++)n=n*85+84;let o=[n>>>24&255,n>>>16&255,n>>>8&255,n&255];for(let s=0;s<i-1;s++)t[r++]=o[s]}return t.subarray(0,r)}function Om(e,t,r){let n=0;for(let i=0;i<r;i++)n=n*256+e[t+i];return n}function SS(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}var Hi=class{items=[];index=new Map;add(e){let t=`${e.code}|${e.name??""}|${e.construct??""}|${e.elementId??""}|${e.message}`,r=this.index.get(t);if(r===void 0){this.index.set(t,this.items.length),this.items.push({...e,count:e.count??1});return}let n=this.items[r];this.items[r]={...n,count:(n.count??1)+(e.count??1)}}info(e,t,r={}){this.add({code:e,severity:"info",message:t,...r})}warning(e,t,r={}){this.add({code:e,severity:"warning",message:t,...r})}error(e,t,r={}){this.add({code:e,severity:"error",message:t,...r})}addAll(e){for(let t of e)this.add(t)}has(e){return this.items.some(t=>t.code===e)}list(){return this.items.slice()}},Vt=class extends Error{constructor(e,t){super(t),this.code=e,this.name="IllustratorContainerError"}code},Et={maxInputBytes:268435456,maxStreamBytes:67108864,maxPrivateSourceBytes:268435456,bombCheckBytes:67108864,bombRatio:200,maxXrefEntries:1e7,maxXrefChain:64,maxPageTreeDepth:64,maxPages:1e4,maxPlaceholderProbeBytes:2097152,maxTokens:5e7,maxNesting:512,maxNodes:5e6,maxTextDocumentBytes:67108864},JS=class{constructor(e){this.name=e}name},QS=class{constructor(e){this.bytes=e}bytes},jc=class{constructor(e,t){this.num=e,this.gen=t}num;gen;key(){return`${this.num}R${this.gen}`}},e$=class{constructor(e,t){this.dict=e,this.raw=t}dict;raw};function On(e){return e instanceof Map}function Xn(e,t){return e instanceof JS&&(t===void 0||e.name===t)}function wc(e){return e instanceof jc}function yi(e){return e instanceof e$}function Gr(e){return typeof e=="number"&&Number.isFinite(e)}function Ea(e){return Array.isArray(e)}function t$(e){return e instanceof QS}function r$(e){let t=e.bytes;if(t.length>=2&&t[0]===254&&t[1]===255){let n="";for(let i=2;i+1<t.length;i+=2)n+=String.fromCharCode(t[i]<<8|t[i+1]);return n}let r="";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return r}function t8(e,t){let r=t(e.get("Filter")??e.get("F")),n=t(e.get("DecodeParms")??e.get("DP")),i=[];if(Xn(r))i.push(r.name);else if(Ea(r))for(let o of r){let s=t(o);Xn(s)&&i.push(s.name)}let a=[];if(On(n))a.push(n);else if(Ea(n))for(let o of n){let s=t(o);a.push(On(s)?s:null)}return i.map((o,s)=>({name:o,parms:a[s]??(i.length===1?a[0]??null:null)}))}function r8(e,t=Et.maxStreamBytes){let r=[()=>pm(e),()=>fm(e),()=>pm(n8(e)),()=>fm(e.subarray(1))],n=null;for(let i of r)try{let a=i();if(a.length>t)throw new Vt("container-limit",`Decoded stream exceeds ${t} bytes.`);return a}catch(a){if(a instanceof Vt)throw a;n=a}throw new Vt("private-source-corrupt",`FlateDecode failed: ${n instanceof Error?n.message:String(n)}`)}function n8(e){let t=0;for(;t<e.length&&(e[t]===10||e[t]===13||e[t]===32||e[t]===9);)t++;return e.subarray(t)}function i8(e,t,r){if(!t)return e;let n=Ic(r(t.get("Predictor")),1);if(n<=1)return e;let i=Ic(r(t.get("Colors")),1),a=Ic(r(t.get("BitsPerComponent")),8),o=Ic(r(t.get("Columns")),1),s=Math.max(1,Math.ceil(i*a/8)),l=Math.ceil(i*a*o/8);if(n===2){if(a!==8)throw new Vt("container-unsupported-filter",`TIFF predictor with ${a} bits per component is not supported.`);let f=new Uint8Array(e),p=Math.floor(f.length/l);for(let h=0;h<p;h++){let m=h*l;for(let g=s;g<l;g++)f[m+g]=f[m+g]+f[m+g-s]&255}return f}let u=Math.floor(e.length/(l+1)),d=new Uint8Array(u*l),c=new Uint8Array(l);for(let f=0;f<u;f++){let p=f*(l+1),h=e[p],m=f*l;for(let g=0;g<l;g++){let v=e[p+1+g],b=g>=s?d[m+g-s]:0,y=c[g],I=g>=s?c[g-s]:0,x;switch(h){case 0:x=v;break;case 1:x=v+b;break;case 2:x=v+y;break;case 3:x=v+(b+y>>1);break;case 4:{let k=b+y-I,$=Math.abs(k-b),A=Math.abs(k-y),S=Math.abs(k-I);x=v+($<=A&&$<=S?b:A<=S?y:I);break}default:x=v}d[m+g]=x&255}c.set(d.subarray(m,m+l))}return d}function Ic(e,t){return Gr(e)?e:t}function n$(e,t,r,n=Et.maxStreamBytes){let i=e;for(let a of t8(t,r)){switch(a.name){case"FlateDecode":case"Fl":i=i8(r8(i,n),a.parms,r);break;case"ASCIIHexDecode":case"AHx":i=ZS(i);break;case"ASCII85Decode":case"A85":i=Ym(i);break;case"Crypt":break;default:throw new Vt("container-unsupported-filter",`Stream filter /${a.name} is not supported.`)}if(i.length>n)throw new Vt("container-limit",`Decoded stream exceeds ${n} bytes.`)}return i}var us=class{constructor(e,t=0,r=e.length){this.bytes=e,this.end=r,this.pos=t}bytes;end;pos;skipWhitespaceAndComments(){let e=this.bytes;for(;this.pos<this.end;){let t=e[this.pos];if(Ur(t))this.pos++;else if(t===37)for(;this.pos<this.end&&e[this.pos]!==10&&e[this.pos]!==13;)this.pos++;else break}}next(){this.skipWhitespaceAndComments();let e=this.bytes,t=this.pos;if(t>=this.end)return{kind:"eof",start:t,end:t};let r=e[t];if(Oc(r)||r===43||r===45||r===46){let i=t+1;for(;i<this.end&&(Oc(e[i])||e[i]===46||e[i]===45||e[i]===43||e[i]===69||e[i]===101);)i++;let a=vi(e,t,i),o=a8(a);return this.pos=i,o!==null?{kind:"number",value:o,start:t,end:i}:{kind:"keyword",value:a,start:t,end:i}}if(r===47){let i=t+1,a="";for(;i<this.end&&kS(e[i]);){if(e[i]===35&&i+2<this.end){let o=parseInt(vi(e,i+1,i+3),16);if(!Number.isNaN(o)){a+=String.fromCharCode(o),i+=3;continue}}a+=String.fromCharCode(e[i]),i++}return this.pos=i,{kind:"name",value:a,start:t,end:i}}if(r===40)return this.literalString(t);if(r===60)return e[t+1]===60?(this.pos=t+2,{kind:"delimiter",value:"<<",start:t,end:this.pos}):this.hexString(t);if(r===62)return e[t+1]===62?(this.pos=t+2,{kind:"delimiter",value:">>",start:t,end:this.pos}):(this.pos=t+1,this.next());if(r===91||r===93||r===123||r===125)return this.pos=t+1,{kind:"delimiter",value:String.fromCharCode(r),start:t,end:this.pos};if(r===41)return this.pos=t+1,this.next();let n=t;for(;n<this.end&&kS(e[n]);)n++;return n===t&&(n=t+1),this.pos=n,{kind:"keyword",value:vi(e,t,n),start:t,end:n}}literalString(e){let t=this.bytes,r=[],n=0,i=e;for(;i<this.end;){let a=t[i];if(a===92){let o=t[i+1];switch(i+=2,o){case 110:r.push(10);break;case 114:r.push(13);break;case 116:r.push(9);break;case 98:r.push(8);break;case 102:r.push(12);break;case 10:break;case 13:t[i]===10&&i++;break;default:if(o>=48&&o<=55){let s=o-48;for(let l=0;l<2&&t[i]>=48&&t[i]<=55;l++)s=s*8+(t[i]-48),i++;r.push(s&255)}else o!==void 0&&r.push(o)}continue}if(a===40){n++,n>1&&r.push(a),i++;continue}if(a===41){if(n--,i++,n===0)break;r.push(a);continue}r.push(a),i++}return this.pos=i,{kind:"string",value:Uint8Array.from(r),start:e,end:i}}hexString(e){let t=this.bytes,r=[],n=-1,i=e+1;for(;i<this.end&&t[i]!==62;){let a=t[i++],o=-1;a>=48&&a<=57?o=a-48:a>=65&&a<=70?o=a-65+10:a>=97&&a<=102&&(o=a-97+10),!(o<0)&&(n<0?n=o:(r.push(n<<4|o),n=-1))}return n>=0&&r.push(n<<4),this.pos=Math.min(i+1,this.end),{kind:"string",value:Uint8Array.from(r),start:e,end:this.pos}}};function a8(e){if(!/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(e)){let r=/^[+-]?\d*\.?\d*/.exec(e);if(!r||r[0]===""||r[0]==="-"||r[0]==="+"||r[0]===".")return null;let n=Number(r[0]);return Number.isFinite(n)?n:null}let t=Number(e);return Number.isFinite(t)?t:null}function za(e,t,r,n=e.length){let i=new us(e,t,n);return{value:i$(i,r,0),end:i.pos}}var o8=256;function i$(e,t,r){let n=e.next();return Bm(e,n,t,r)}function Bm(e,t,r,n){if(n>o8)return null;switch(t.kind){case"eof":return null;case"number":{let i=e.pos;if(Number.isInteger(t.value)&&t.value>=0){let a=e.next();if(a.kind==="number"&&Number.isInteger(a.value)&&a.value>=0){let o=e.next();if(o.kind==="keyword"&&o.value==="R")return new jc(t.value,a.value)}}return e.pos=i,t.value}case"name":return new JS(t.value);case"string":return new QS(t.value);case"keyword":return t.value==="true"?!0:t.value==="false"?!1:(t.value,null);case"delimiter":switch(t.value){case"[":{let i=[];for(;;){let a=e.next();if(a.kind==="eof"||a.kind==="delimiter"&&a.value==="]")break;if(!(a.kind==="delimiter"&&(a.value===">>"||a.value==="}"))){if(a.kind==="keyword"&&(a.value==="endobj"||a.value==="stream"||a.value==="endstream")){e.pos=a.start;break}i.push(Bm(e,a,r,n+1))}}return i}case"<<":{let i=new Map;for(;;){let a=e.next();if(a.kind==="eof"||a.kind==="delimiter"&&a.value===">>")break;if(a.kind==="keyword"&&(a.value==="endobj"||a.value==="stream")){e.pos=a.start;break}if(a.kind!=="name"){Bm(e,a,r,n+1);continue}let o=i$(e,r,n+1);i.set(a.value,o)}return l8(e,i,r)}case"{":{let i=1;for(;i>0;){let a=e.next();if(a.kind==="eof")break;a.kind==="delimiter"&&a.value==="{"?i++:a.kind==="delimiter"&&a.value==="}"&&i--}return null}default:return null}}}var s8=6;function l8(e,t,r){let n=e.pos,i=e.next();if(i.kind!=="keyword"||i.value!=="stream")return e.pos=n,t;let a=e.bytes,o=i.start+s8;a[o]===13&&o++,a[o]===10&&o++;let s=t.get("Length"),l;typeof s=="number"&&s>=0?l=s:s!=null&&r&&(l=r(s));let u=-1;if(l!==void 0&&o+l<=e.end){let d=new us(a,o+l,e.end).next();d.kind==="keyword"&&d.value==="endstream"&&(u=o+l,e.pos=d.end)}if(u<0){let d=u8(a,o,e.end);d<0?(u=e.end,e.pos=e.end):(u=d,a[u-1]===10&&u--,a[u-1]===13&&u--,e.pos=d+9)}return new e$(t,a.subarray(o,u))}var Tm=[101,110,100,115,116,114,101,97,109];function u8(e,t,r){e:for(let n=t;n<=r-Tm.length;n++)if(e[n]===101){for(let i=1;i<Tm.length;i++)if(e[n+i]!==Tm[i])continue e;return n}return-1}function Vm(e,t,r=e.length){let n=new us(e,t,r),i=n.next();if(i.kind!=="number"||!Number.isInteger(i.value))return null;let a=n.next();if(a.kind!=="number"||!Number.isInteger(a.value))return null;let o=n.next();return o.kind!=="keyword"||o.value!=="obj"?null:{num:i.value,gen:a.value,bodyStart:n.pos}}function d8(e,t,r){let n=r(t.get("N")),i=r(t.get("First")),a=new Map;if(!Gr(n)||!Gr(i))return{offsets:a,body:e};let o=new us(e,0,Math.min(e.length,i));for(let s=0;s<n;s++){let l=o.next(),u=o.next();if(l.kind!=="number"||u.kind!=="number")break;let d=i+u.value;d<0||d>=e.length||a.set(l.value,d)}return{offsets:a,body:e}}function c8(e,t){let r=e.offsets.get(t);if(r!==void 0)return za(e.body,r).value}var Pm=Ut("obj"),Dm=Ut("trailer");function f8(e){let t=new Map,r=[],n=e.length;for(let o=0;o+3<=n;o++){if(e[o]!==Pm[0]||e[o+1]!==Pm[1]||e[o+2]!==Pm[2])continue;let s=e[o+3];if(s!==void 0&&!Ur(s)&&s!==60&&s!==91&&s!==47&&s!==40&&s!==37)continue;let l=o-1;for(;l>=0&&Ur(e[l]);)l--;let u=l+1;for(;l>=0&&Oc(e[l]);)l--;let d=l+1;if(d===u||l<0||!Ur(e[l]))continue;for(;l>=0&&Ur(e[l]);)l--;let c=l+1;for(;l>=0&&Oc(e[l]);)l--;let f=l+1;if(f===c||l>=0&&!Ur(e[l])&&e[l]!==62&&e[l]!==93&&e[l]!==41)continue;let p=parseInt($S(e,f,c),10),h=parseInt($S(e,d,u),10);!Number.isFinite(p)||!Number.isFinite(h)||(t.set(p,{kind:"offset",offset:f,gen:h}),o+=2)}for(let[o,s]of t){if(s.kind!=="offset")continue;let l=NS(e,s.offset);l<0||h8(e,l)&&r.push(o)}let i=new Map,a=0;for(;;){let o=a$(e,Dm,a);if(o<0)break;let s=za(e,o+Dm.length);if(On(s.value))for(let[l,u]of s.value)i.set(l,u);a=o+Dm.length}if(!i.has("Root"))for(let[o,s]of t){if(s.kind!=="offset")continue;let l=NS(e,s.offset);if(l<0)continue;let u=za(e,l,void 0,Math.min(e.length,l+4096)).value,d=On(u)?u:null;if(d&&Xn(d.get("Type"),"Catalog")){i.set("Root",new jc(o,s.gen));break}if(d&&Xn(d.get("Type"),"XRef")&&!i.has("Root"))for(let[c,f]of d)(c==="Root"||c==="Info"||c==="Encrypt"||c==="ID")&&i.set(c,f)}return{entries:t,trailer:i,objectStreams:r}}function $S(e,t,r){let n="";for(let i=t;i<r;i++)n+=String.fromCharCode(e[i]);return n}function NS(e,t){let r=t,n=()=>{for(;r<e.length&&Ur(e[r]);)r++;let i=r;for(;r<e.length&&!Ur(e[r]);)r++;return r>i};return!n()||!n()||!n()?-1:r}var p8=Ut("/ObjStm");function h8(e,t){let r=Math.min(e.length,t+512);return a$(e,p8,t,r)>=0}function a$(e,t,r,n=e.length){e:for(let i=r;i<=n-t.length;i++){for(let a=0;a<t.length;a++)if(e[i+a]!==t[a])continue e;return i}return-1}var MS=Ut("startxref"),m8=64*1024;function g8(e,t){let r=y8(e);if(r===null)return null;let n=new Map,i=new Map,a=new Set,o=[r],s=0;for(;o.length>0&&s<Et.maxXrefChain;){let l=o.shift();if(!Number.isInteger(l)||l<0||l>=e.length||a.has(l))continue;a.add(l);let u=v8(e,l);if(!u){if(s===0)return null;t.info("container-xref-reconstructed",`Cross-reference section at byte ${l} is unreadable; earlier sections were kept.`);continue}s++;for(let[f,p]of u.entries)if(n.has(f)||n.set(f,p),n.size>Et.maxXrefEntries)return null;for(let[f,p]of u.trailer)i.has(f)||i.set(f,p);let d=u.trailer.get("XRefStm");Gr(d)&&o.unshift(d);let c=u.trailer.get("Prev");Gr(c)&&o.push(c)}return s===0?null:{entries:n,trailer:i,sections:s}}function y8(e){let t=Math.max(0,e.length-m8),r=Z4(e,MS,e.length);if(r<t||r<0)return null;let n=new us(e,r+MS.length).next();return n.kind==="number"&&Number.isInteger(n.value)?n.value:null}function v8(e,t){let r=t;for(;r<e.length&&Ur(e[r]);)r++;let n=new us(e,r),i=n.next();return i.kind==="keyword"&&i.value==="xref"?b8(e,n):i.kind==="number"?x8(e,r):null}function b8(e,t){let r=new Map;for(;;){let n=t.pos,i=t.next();if(i.kind==="keyword"&&i.value==="trailer"){let l=za(e,t.pos);return{entries:r,trailer:On(l.value)?l.value:new Map}}if(i.kind!=="number")return t.pos=n,{entries:r,trailer:new Map};let a=t.next();if(a.kind!=="number")return{entries:r,trailer:new Map};let o=i.value,s=a.value;if(!Number.isInteger(o)||!Number.isInteger(s)||s<0)return null;for(let l=0;l<s;l++){let u=t.next(),d=t.next(),c=t.next();if(u.kind!=="number"||d.kind!=="number"||c.kind!=="keyword")return{entries:r,trailer:new Map};let f=o+l;if(c.value==="n")r.has(f)||r.set(f,{kind:"offset",offset:u.value,gen:d.value});else if(c.value==="f")r.has(f)||r.set(f,{kind:"free"});else return{entries:r,trailer:new Map};if(r.size>Et.maxXrefEntries)return null}}}function x8(e,t){let r=Vm(e,t);if(!r)return null;let n=za(e,r.bodyStart).value;if(!yi(n)||!Xn(n.dict.get("Type"),"XRef"))return null;let i=g=>g,a;try{a=n$(n.raw,n.dict,i)}catch{return null}let o=n.dict.get("W");if(!Ea(o)||o.length<3||!o.every(g=>Gr(g)&&g>=0))return null;let[s,l,u]=o,d=n.dict.get("Size"),c=n.dict.get("Index"),f=[];Ea(c)&&c.every(g=>Gr(g))?f.push(...c):f.push(0,Gr(d)?d:0);let p=s+l+u;if(p===0)return null;let h=new Map,m=0;for(let g=0;g+1<f.length;g+=2){let v=f[g],b=f[g+1];for(let y=0;y<b&&!(m+p>a.length);y++){let I=s===0?1:Om(a,m,s),x=Om(a,m+s,l),k=u===0?0:Om(a,m+s+l,u);m+=p;let $=v+y;if(!h.has($)&&(I===1?h.set($,{kind:"offset",offset:x,gen:k}):I===2?h.set($,{kind:"compressed",streamNum:x,index:k}):I===0&&h.set($,{kind:"free"}),h.size>Et.maxXrefEntries))return null}}return{entries:h,trailer:n.dict}}var w8=32,Km=class{constructor(e){if(this.bytes=e,e.length>Et.maxInputBytes)throw new Vt("container-limit",`Input exceeds ${Et.maxInputBytes} bytes.`);let t=g8(e,this.diagnostics);t&&t.trailer.has("Root")?(this.entries=t.entries,this.trailerDict=t.trailer,this.reconstructed=!1):(this.reconstruct("The cross-reference table is missing or unreadable."),this.reconstructed=!0),this.encrypted=this.trailerDict.has("Encrypt")}bytes;diagnostics=new Hi;encrypted;reconstructed;entries=new Map;trailerDict=new Map;cache=new Map;objectStreams=new Map;didReconstruct=!1;resolving=new Set;get trailer(){return this.trailerDict}reconstruct(e){if(this.didReconstruct)return;this.didReconstruct=!0;let t=f8(this.bytes),r=new Map(t.entries);for(let i of t.objectStreams){let a=this.objectStreamIndex(i,r);if(a)for(let o of a.offsets.keys())r.has(o)||r.set(o,{kind:"compressed",streamNum:i,index:0})}this.entries=r;let n=new Map(t.trailer);if(this.trailerDict)for(let[i,a]of this.trailerDict)n.has(i)||n.set(i,a);this.trailerDict=n,this.cache.clear(),this.diagnostics.info("container-xref-reconstructed",`Cross-reference data was rebuilt by scanning the file: ${e}`)}fetch(e,t=0){let r=this.cache.get(e);if(r!==void 0)return r;if(this.resolving.has(e))return null;this.resolving.add(e);try{let n=this.fetchUncached(e,t);n===void 0&&!this.didReconstruct&&(this.reconstruct(`object ${e} was not where the cross-reference table said.`),n=this.fetchUncached(e,t));let i=n===void 0?null:n;return this.cache.set(e,i),i}finally{this.resolving.delete(e)}}fetchUncached(e,t){let r=this.entries.get(e);if(!r||r.kind==="free")return;if(r.kind==="compressed"){let i=this.objectStreamIndex(r.streamNum,this.entries);return i?c8(i,e):void 0}let n=Vm(this.bytes,r.offset);return!n||n.num!==e?void 0:(n.gen!==t&&t!==0&&n.gen!==0&&this.diagnostics.info("container-xref-reconstructed",`Object ${e} has generation ${n.gen}, expected ${t}.`),za(this.bytes,n.bodyStart,i=>{let a=this.resolve(i);return Gr(a)?a:void 0}).value)}objectStreamIndex(e,t){let r=this.objectStreams.get(e);if(r!==void 0)return r;this.objectStreams.set(e,null);let n=t.get(e);if(!n||n.kind!=="offset")return null;let i=Vm(this.bytes,n.offset);if(!i)return null;let a=za(this.bytes,i.bodyStart,l=>{let u=this.resolve(l);return Gr(u)?u:void 0});if(!yi(a.value)||!Xn(a.value.dict.get("Type"),"ObjStm"))return null;let o;try{o=this.decodeStream(a.value)}catch{return null}let s=d8(o,a.value.dict,l=>this.resolve(l));return this.objectStreams.set(e,s),s}resolve(e){let t=e;for(let r=0;r<w8&&wc(t);r++)t=this.fetch(t.num,t.gen);return wc(t)?null:t}get(e,t){if(e)return this.resolve(e.get(t))}getDict(e,t){let r=this.get(e,t);return On(r)?r:yi(r)?r.dict:null}catalog(){let e=this.resolve(this.trailerDict.get("Root"));if(On(e))return e;if(!this.didReconstruct){this.reconstruct("the trailer has no usable /Root.");let t=this.resolve(this.trailerDict.get("Root"));if(On(t))return t}return null}decodeStream(e,t=Et.maxStreamBytes){return n$(e.raw,e.dict,r=>this.resolve(r),t)}pages(){let e=this.catalog(),t=[],r=e?.get("Pages"),n=this.resolve(r);if(!On(n))return this.pagesByScan();let i=new Set,a=(o,s,l,u)=>{if(u>Et.maxPageTreeDepth||t.length>=Et.maxPages)return;if(s){let p=s.key();if(i.has(p))return;i.add(p)}let d={resources:this.getDict(o,"Resources")??l.resources,mediaBox:this.numberArray(o.get("MediaBox"))??l.mediaBox,cropBox:this.numberArray(o.get("CropBox"))??l.cropBox,rotate:(()=>{let p=this.get(o,"Rotate");return Gr(p)?p:l.rotate})()},c=this.get(o,"Kids"),f=this.get(o,"Type");if(Ea(c)&&!Xn(f,"Page")){for(let p of c){let h=wc(p)?p:null,m=this.resolve(p);On(m)&&a(m,h,d,u+1)}return}(Xn(f,"Page")||o.has("Contents")||o.has("MediaBox"))&&t.push({index:t.length,ref:s,dict:o,resources:d.resources,mediaBox:d.mediaBox,cropBox:d.cropBox,rotate:d.rotate})};return a(n,wc(r)?r:null,{resources:null,mediaBox:null,cropBox:null,rotate:0},0),t.length>0?t:this.pagesByScan()}pagesByScan(){this.didReconstruct||this.reconstruct("the page tree is unusable.");let e=[],t=[...this.entries.keys()].sort((r,n)=>r-n);for(let r of t){let n=this.fetch(r);if(!(!On(n)||!Xn(n.get("Type"),"Page"))&&(e.push({index:e.length,ref:new jc(r,0),dict:n,resources:this.getDict(n,"Resources"),mediaBox:this.numberArray(n.get("MediaBox")),cropBox:this.numberArray(n.get("CropBox")),rotate:0}),e.length>=Et.maxPages))break}return e}numberArray(e){let t=this.resolve(e);if(!Ea(t))return null;let r=[];for(let n of t){let i=this.resolve(n);if(!Gr(i))return null;r.push(i)}return r}pageContent(e,t=Et.maxPlaceholderProbeBytes){let r=this.get(e.dict,"Contents"),n=[];if(yi(r))n.push(r);else if(Ea(r))for(let l of r){let u=this.resolve(l);yi(u)&&n.push(u)}let i=[],a=0;for(let l of n){let u=this.decodeStream(l,t);if(i.push(u,new Uint8Array([10])),a+=u.length+1,a>t)break}let o=new Uint8Array(Math.min(a,t)),s=0;for(let l of i){let u=Math.min(l.length,o.length-s);if(o.set(l.subarray(0,u),s),s+=u,s>=o.length)break}return o}objectNumbers(){return[...this.entries.keys()]}};function kc(e){if(e!=null){if(Gr(e))return String(e);if(t$(e))return r$(e)}}function o$(e,t){let r=[],n=(i,a)=>{let o=e.getDict(i,"PieceInfo"),s=e.getDict(o,"Illustrator"),l=e.getDict(s,"Private");if(!l)return;let u=e.get(l,"NumBlock"),d=Gr(u)?Math.max(0,Math.floor(u)):0,c=l.has("AIPDFPrivateData1")&&!l.has("AIPrivateData1")?"AIPDFPrivateData":"AIPrivateData";r.push({pageIndex:a,privateDict:l,numBlock:d,keyPrefix:c,hasMetaData:l.has("AIMetaData"),creatorVersion:kc(e.get(l,"CreatorVersion")),containerVersion:kc(e.get(l,"ContainerVersion")),roundtripVersion:kc(e.get(l,"RoundtripVersion")),roundtripStreamType:kc(e.get(l,"RoundtripStreamType"))})};for(let i of t)n(i.dict,i.index);if(r.length===0){let i=e.catalog();i&&n(i,-1)}return r}function I8(e,t){let r=e.get(t.privateDict,"AIMetaData"),n=yi(r)?e.decodeStream(r):null,i=[],a=0,o=t.numBlock>0?t.numBlock:k8(t.privateDict,t.keyPrefix);for(let s=1;s<=o;s++){let l=`${t.keyPrefix}${s}`,u=e.get(t.privateDict,l);if(yi(u))i.push(e.decodeStream(u,Et.maxPrivateSourceBytes));else{let d=e.get(t.privateDict,`${t.keyPrefix==="AIPrivateData"?"AIPDFPrivateData":"AIPrivateData"}${s}`);if(!yi(d))throw new Vt("private-source-corrupt",`Private data block ${s} of ${o} (/${l}) is missing.`);i.push(e.decodeStream(d,Et.maxPrivateSourceBytes))}if(a+=i[i.length-1].length,a>Et.maxPrivateSourceBytes)throw new Vt("private-source-limit",`Private data exceeds ${Et.maxPrivateSourceBytes} bytes.`)}return{metadata:n,payload:J4(i),compressedBytes:a}}function k8(e,t){let r=0;for(;e.has(`${t}${r+1}`);)r++;return r}function AS(e){let t=vi(e),r="",n=0,i=t.length,a=[];for(;n<i;){let o=t[n];if(o==="("){let s=S8(t,n);a.push(s.value),n=s.end;continue}if(o==="<"&&t[n+1]!=="<"){let s=t.indexOf(">",n+1),l=t.slice(n+1,s<0?i:s).replace(/\s+/g,""),u="";for(let d=0;d+1<l.length;d+=2)u+=String.fromCharCode(parseInt(l.slice(d,d+2),16));a.push(u),n=s<0?i:s+1;continue}if(o==="%"){for(;n<i&&t[n]!==`
114
+ `&&t[n]!=="\r";)n++;continue}if(/[A-Za-z'"]/.test(o)){let s=n;for(;s<i&&/[A-Za-z'"*]/.test(t[s]);)s++;let l=t.slice(n,s);l==="Tj"||l==="TJ"||l==="'"||l==='"'?(r+=a.join(""),a=[]):l!=="T"&&l.length<=3&&(a=[]),n=s;continue}if(o==="]"||o==="["){n++;continue}n++}return r}function S8(e,t){let r=0,n="",i=t;for(;i<e.length;){let a=e[i];if(a==="\\"){let o=e[i+1];if(o>="0"&&o<="7"){let s=0,l=i+1;for(;l<i+4&&e[l]>="0"&&e[l]<="7";)s=s*8+(e.charCodeAt(l)-48),l++;n+=String.fromCharCode(s&255),i=l;continue}switch(o){case"n":n+=`
115
+ `;break;case"r":n+="\r";break;case"t":n+=" ";break;case`
116
+ `:case"\r":break;default:o!==void 0&&(n+=o)}i+=2;continue}if(a==="("){r++,r>1&&(n+=a),i++;continue}if(a===")"){if(r--,i++,r===0)break;n+=a;continue}n+=a,i++}return{value:n,end:i}}var $8=/savedwithoutpdfcontent/i;function N8(e,t,r){let n=[AS(r)],i=e.getDict(t.resources,"XObject");if(i){let a=0;for(let o of i.values()){let s=e.resolve(o);if(!(!yi(s)||!Xn(e.get(s.dict,"Subtype"),"Form"))){if(++a>16)break;try{n.push(AS(e.decodeStream(s,2*1024*1024)))}catch{}}}}return n.some(a=>$8.test(a.replace(/\s+/g,"")))}var Um=Ut("%AI24_ZStandard_Data"),Gm=Ut("%AI12_CompressedData"),Sc=Ut("%!PS-Adobe"),$c=[40,181,47,253],M8=8;function A8(e,t={}){let r=new Km(e);if(r.encrypted)throw new Vt("container-encrypted","The PDF container is encrypted; the private Illustrator source cannot be read.");let n=r.pages(),i=o$(r,n);if(i.length===0)throw new Vt("private-source-missing","The PDF carries no Illustrator private data (/PieceInfo /Illustrator /Private).");let a=C8(i,t.page),o=I8(r,a),s=new Hi;for(let u of r.diagnostics.list())s.add(u);let l=s$(o.payload,o.metadata,t.maxOutputBytes??Et.maxPrivateSourceBytes);return{metadataHeader:o.metadata?vi(o.metadata):"",source:vi(l.bytes),sourceBytes:l.bytes,compression:l.compression,blockCount:a.numBlock,compressedBytes:o.compressedBytes,page:a.pageIndex,containerVersion:a.containerVersion,creatorVersion:a.creatorVersion,roundtripVersion:a.roundtripVersion,roundtripStreamType:a.roundtripStreamType,diagnostics:s.list()}}function C8(e,t){if(t!==void 0){let r=e.find(n=>n.pageIndex===t);if(r)return r}return e.filter(r=>r.numBlock>0||r.privateDict.has(`${r.keyPrefix}1`))[0]??e[0]}function s$(e,t,r){let n=0;for(;n<e.length&&Ur(e[n]);)n++;let i="none",a;if(as(e,Um,n))i="zstd",a=CS(e.subarray(jm(e,n+Um.length,"zstd")),r);else if(as(e,Gm,n))i="deflate",a=Em(e.subarray(jm(e,n+Gm.length,"deflate")),r);else if(P8(e,n))i="deflate",a=Em(e.subarray(n),r);else{a=e.subarray(n);let s=O8(a);if(s){i=s.kind;let l=jm(a,s.markerEnd,s.kind),u=s.kind==="zstd"?CS(a.subarray(l),r):Em(a.subarray(l),r),d=new Uint8Array(s.markerStart+u.length);d.set(a.subarray(0,s.markerStart),0),d.set(u,s.markerStart),a=d}}let o=0;for(;o<a.length&&Ur(a[o]);)o++;if(as(a,Sc,o))return{bytes:o===0?a:a.subarray(o),compression:i};if(t&&as(t,Sc,T8(t))){let s=new Uint8Array(t.length+1+a.length);return s.set(t,0),s[t.length]=10,s.set(a,t.length+1),{bytes:s,compression:i}}if(Ar(a,Sc,0,Math.min(a.length,4096))>=0)return{bytes:a.subarray(Ar(a,Sc,0)),compression:i};throw new Vt("private-source-corrupt",`Decoded private data does not start with %!PS-Adobe (compression: ${i}, ${a.length} bytes).`)}function O8(e){for(let[t,r]of[["deflate",Gm],["zstd",Um]]){let n=0;for(;n<e.length;){let i=Ar(e,r,n);if(i<0)break;if(i===0||e[i-1]===10||e[i-1]===13)return{kind:t,markerStart:i,markerEnd:i+r.length};n=i+r.length}}return null}function T8(e){let t=0;for(;t<e.length&&Ur(e[t]);)t++;return t}function P8(e,t){if(t+1>=e.length)return!1;let r=e[t],n=e[t+1];return(r&15)===8&&r>>4<=7&&(r<<8|n)%31===0}function jm(e,t,r){let n=Math.min(e.length,t+M8);for(let i=t;i<n;i++)if(r==="zstd"){if(e[i]===$c[0]&&e[i+1]===$c[1]&&e[i+2]===$c[2]&&e[i+3]===$c[3])return i}else{let a=e[i],o=e[i+1];if((a&15)===8&&(a<<8|o)%31===0)return i}return t}var l$=class{constructor(e,t){this.inputBytes=e,this.maxOutputBytes=t}inputBytes;maxOutputBytes;chunks=[];total=0;push(e){if(e.length!==0){if(this.chunks.push(e),this.total+=e.length,this.total>this.maxOutputBytes)throw new Vt("private-source-limit",`Decompressed private data exceeds ${this.maxOutputBytes} bytes.`);if(this.total>Et.bombCheckBytes&&this.total>this.inputBytes*Et.bombRatio)throw new Vt("private-source-limit","Decompressed private data grows far beyond its compressed size; refusing to continue.")}}bytes(){if(this.chunks.length===1)return this.chunks[0];let e=new Uint8Array(this.total),t=0;for(let r of this.chunks)e.set(r,t),t+=r.length;return e}};function CS(e,t){let r=new l$(e.length,t);try{new Vk(n=>r.push(n)).push(e,!0)}catch(n){throw n instanceof Vt?n:new Vt("private-source-corrupt",`zstd decompression failed: ${u$(n)}`)}return r.bytes()}function Em(e,t){let r=[()=>OS(new _k,e,t),()=>OS(new Sl,e,t)],n;for(let i of r)try{return i()}catch(a){if(a instanceof Vt&&a.code==="private-source-limit")throw a;n=a}throw new Vt("private-source-corrupt",`zlib decompression failed: ${u$(n)}`)}function OS(e,t,r){let n=new l$(t.length,r);e.ondata=a=>n.push(a),e.push(t,!0);let i=n.bytes();if(i.length===0)throw new Error("empty output");return i}function u$(e){return e instanceof Error?e.message:String(e)}var D8=[197,208,211,198],j8=Ut("%AI9_PrivateDataBegin"),E8=Ut("%AI9_PrivateDataEnd"),z8=Ut("%AI9_DataStream");function d$(e){if(e.length<30)return null;for(let n=0;n<4;n++)if(e[n]!==D8[n])return null;let t=SS(e,4),r=SS(e,8);return t<=0||t>=e.length?null:{psOffset:t,psLength:Math.min(r,e.length-t)}}function c$(e){let t=d$(e);return t?e.subarray(t.psOffset,t.psOffset+t.psLength):e}function R8(e,t=Et.maxPrivateSourceBytes){let r=Ar(e,j8);if(r<0)return null;let n=Ar(e,E8,r),i=TS(e,r),a=n<0?e.length:n,o=null,s=Ar(e,z8,i,a);s>=0&&(o=e.subarray(i,s),i=TS(e,s));let l=[],u=i;for(;u<a;){let p=u;for(;p<a&&e[p]!==10&&e[p]!==13;)p++;let h=u;e[h]===37&&h++;for(let m=h;m<p;m++)l.push(e[m]);for(u=p;u<a&&(e[u]===10||e[u]===13);)u++}let d=Uint8Array.from(l),c=[{encoding:"ascii85",decode:()=>Ym(d)},{encoding:"hex",decode:()=>ZS(d)},{encoding:"raw",decode:()=>d}],f;for(let p of c)try{let h=p.decode();if(h.length===0)continue;return{...s$(h,o,t),encoding:p.encoding}}catch(h){f=h}throw new Vt("private-source-corrupt",`The %AI9_PrivateDataBegin block could not be decoded: ${f instanceof Error?f.message:String(f)}`)}function TS(e,t){let r=t;for(;r<e.length&&e[r]!==10&&e[r]!==13;)r++;for(;r<e.length&&(e[r]===10||e[r]===13);)r++;return r}var _8=Ut("%!PS-Adobe"),PS=Ut("%!PS");function F8(e){return as(e,_8)||as(e,PS)?!0:Ar(e,PS,0,Math.min(e.length,32))>=0}var Wm=Ut("%PDF-"),L8=Ut("/AIPrivateData"),B8=Ut("/AIPDFPrivateData"),V8=Ut("/AIMetaData"),U8=Ut("/Illustrator"),G8=Ut("Adobe Illustrator"),W8=Ut("%%Creator: Adobe Illustrator"),X8=Ut("%AI"),H8=Ut("EPSF-"),q8=1024;function Y8(e){let t=new Hi;if(e.length<8)return Xm(t);let r=d$(e),n=r?c$(e):e,i=Ar(n,Wm,0,Math.min(n.length,q8));return i>=0?K8(n,i,t):F8(n)?J8(n,r,t):Xm(t)}function Xm(e){return{kind:"not-illustrator",hasPrivateSource:!1,pdfCompatible:"unknown",encrypted:!1,diagnostics:e.list()}}function K8(e,t,r){let n=vi(e,t+Wm.length,Math.min(e.length,t+Wm.length+8)),i=/^(\d\.\d)/.exec(n),a=i?i[1]:void 0,o=Ar(e,L8)>=0||Ar(e,B8)>=0||Ar(e,V8)>=0,s=o||Ar(e,U8)>=0,l=Ar(e,G8)>=0,u;try{u=new Km(e)}catch(y){if(y instanceof Vt)return r.error(y.code,y.message),{kind:s||l?"pdf-compatible":"pdf-foreign",hasPrivateSource:o,pdfCompatible:"unknown",pdfVersion:a,encrypted:!1,diagnostics:r.list()};throw y}for(let y of u.diagnostics.list())r.add(y);let d=u.getDict(u.trailer,"Info"),c=DS(u.get(d,"Producer")),f=DS(u.get(d,"Creator")),p=u.encrypted;p&&r.warning("container-encrypted","The PDF is encrypted; only its rendition can be read, not the Illustrator source.");let h=[];try{h=u.pages()}catch{h=[]}let m=p?[]:o$(u,h);if(!(m.length>0||s||l||(f?.includes("Adobe Illustrator")??!1)))return{kind:"pdf-foreign",hasPrivateSource:!1,pdfCompatible:"yes",pdfVersion:a,pdfPageCount:h.length,producer:c,creator:f,encrypted:p,diagnostics:r.list()};let g=m[0],v=m.some(y=>y.numBlock>0||y.privateDict.has(`${y.keyPrefix}1`)),b="yes";return v&&!p&&(b=Z8(u,h)),{kind:b==="no"?"pdf-private-only":"pdf-compatible",hasPrivateSource:v,pdfCompatible:b,pdfVersion:a,pdfPageCount:h.length,creatorVersion:g?.creatorVersion,containerVersion:g?.containerVersion,producer:c,creator:f,pieceInfoPages:m.map(y=>y.pageIndex),privateDataKeyPrefix:g?.keyPrefix,encrypted:p,diagnostics:r.list()}}function Z8(e,t){if(t.length!==1)return"yes";let r;try{r=e.pageContent(t[0],Et.maxPlaceholderProbeBytes)}catch{return"unknown"}return N8(e,t[0],r)?"no":"yes"}function DS(e){return t$(e)?r$(e):void 0}function J8(e,t,r){let n=Math.min(e.length,65536),i=Ar(e,W8,0,n)>=0,a=Ar(e,X8,0,n)>=0;if(!i&&!a)return Xm(r);let o=(()=>{let u=0;for(;u<e.length&&e[u]!==10&&e[u]!==13;)u++;return u})(),s=Ar(e,H8,0,o)>=0,l=Q8(e,n);return{kind:s?"postscript-eps":"postscript-legacy",hasPrivateSource:!0,pdfCompatible:"unknown",creatorVersion:l,creator:i?"Adobe Illustrator":void 0,dosEpsHeader:t??void 0,encrypted:!1,diagnostics:r.list()}}function Q8(e,t){let r=vi(e,0,t),n=/%%AI8_CreatorVersion:\s*([^\r\n]+)/.exec(r)??/%%Creator: Adobe Illustrator\(R\)\s*([^\r\n]+)/.exec(r);return n?n[1].trim():void 0}function Fl(e,t,r=e.length){for(let n=t;n<r;n++){let i=e.charCodeAt(n);if(i===10||i===13)return n}return r}var eW=class{starts=[0];constructor(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);r===10?this.starts.push(t+1):r===13&&(e.charCodeAt(t+1)===10&&t++,this.starts.push(t+1))}}lineOf(e){let t=0,r=this.starts.length-1;for(;t<r;){let n=t+r+1>>1;this.starts[n]<=e?t=n:r=n-1}return t+1}};function Ll(e,t,r=e.length){return t>=r?r:e.charCodeAt(t)===13&&t+1<r&&e.charCodeAt(t+1)===10?t+2:t+1}function f$(e){let t=[];for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n!==92){t.push(n&255);continue}let i=e[r+1];if(i===void 0)break;switch(i){case"n":t.push(10),r++;break;case"r":t.push(13),r++;break;case"t":t.push(9),r++;break;case"b":t.push(8),r++;break;case"f":t.push(12),r++;break;case`
117
+ `:r++;break;case"\r":r++,e[r+1]===`
118
+ `&&r++;break;default:if(i>="0"&&i<="7"){let a=0,o=0;for(;o<3;){let s=e[r+1+o];if(s===void 0||s<"0"||s>"7")break;a=a*8+(s.charCodeAt(0)-48),o++}t.push(a&255),r+=o}else t.push(i.charCodeAt(0)&255),r++}}return Uint8Array.from(t)}function tW(e){let t="",r=0;for(;r<e.length;){let n=e[r];if(n<128){t+=String.fromCharCode(n),r++;continue}let i,a;if(n>=194&&n<=223)i=1,a=n&31;else if(n>=224&&n<=239)i=2,a=n&15;else if(n>=240&&n<=244)i=3,a=n&7;else return null;if(r+i>=e.length)return null;for(let o=1;o<=i;o++){let s=e[r+o];if(s===void 0||(s&192)!==128)return null;a=a<<6|s&63}if(i===2&&(a<2048||a>=55296&&a<=57343)||i===3&&(a<65536||a>1114111))return null;t+=String.fromCodePoint(a),r+=i+1}return t}function p$(e){let t="";for(let r=0;r+1<e.length;r+=2)t+=String.fromCharCode(e[r]<<8|e[r+1]);return t}function jS(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}function Ec(e){let t=f$(e);if(t.length>=2&&t[0]===254&&t[1]===255)return p$(t.subarray(2));let r=!0;for(let n=0;n<t.length;n++)if(t[n]>=128){r=!1;break}return r?jS(t):tW(t)??jS(t)}function Zm(e,t){let r=0;for(let n=t;n<e.length;n++){let i=e[n];if(i==="\\"){n++;continue}if(i==="(")r++;else if(i===")"&&(r--,r===0))return n}return-1}var rW=/^%(%[A-Za-z0-9_]+|AI\d+_[A-Za-z0-9_]+)(?::\s?(.*))?$/;function Ac(e,t){if(e===void 0)return null;let r=e.trim().split(/\s+/).map(Number);return r.length<t||r.slice(0,t).some(n=>!Number.isFinite(n))?null:r.slice(0,t)}function zm(e){let t=Ac(e,4);return t?[t[0],t[1],t[2],t[3]]:null}function nW(e){switch(e?.trim()){case"1":return"cmyk";case"2":return"rgb";case"3":return"grayscale";default:return"unknown"}}function iW(e){if(e===void 0)return null;let t=e.trim();return t.startsWith("(")&&t.endsWith(")")?Ec(t.slice(1,-1)):t||null}function aW(e,t=400){let r=new Map,n=0,i=0;for(;n<e.length&&i<t;){let l=Fl(e,n),u=e.slice(n,l);if(n=Ll(e,l),i++,u.length===0)continue;if(u[0]!=="%"){if(r.size>0)break;continue}let d=rW.exec(u);if(!d)continue;let c=d[1].startsWith("%")?d[1].slice(1):d[1];r.has(c)||r.set(c,d[2]??"")}let a=r.get("Creator")??"",o=/Adobe Illustrator(?:\(R\)|\(TM\))?\s*([0-9.]+)/.exec(a),s=Ac(r.get("AI5_ArtSize"),2);return{formatVersion:o?o[1]:null,creatorVersion:r.get("AI8_CreatorVersion")?.trim()||null,title:iW(r.get("Title")),creationDate:r.get("CreationDate")?.trim()||null,boundingBox:zm(r.get("BoundingBox")),hiResBoundingBox:zm(r.get("HiResBoundingBox")),cropmarks:zm(r.get("AI3_Cropmarks")),artSize:s?[s[0],s[1]]:null,rulerUnits:Ac(r.get("AI5_RulerUnits"),1)?.[0]??null,colorModel:nW(r.get("AI9_ColorModel")),numLayers:Ac(r.get("AI5_NumLayers"),1)?.[0]??null,keys:r}}var oW=/^%%BeginData:\s*(\d+)(?:\s+(Hex|Binary|ASCII))?\s*(Bytes|Lines)?/i;function*h$(e,t=0){let r=t,n=0,i=e.length;for(;r<i;){let a=Fl(e,r),o=Ll(e,a),s=e.slice(r,a);yield{text:s,start:r,next:o,index:n},n++,r=o;let l=oW.exec(s);if(l&&l[3]?.toLowerCase()!=="lines"){let u=Number(l[1]);Number.isFinite(u)&&u>0&&(r=Math.min(i,r+u),r<i&&Fl(e,r,r+1)===r&&(r=Ll(e,r)))}}}function Rm(e){return Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")}function ES(e,t){let r=e.operands,n=r.length>=13,i=n?8:6,a=r.length>=i+3?`#${Rm(r[i])}${Rm(r[i+1])}${Rm(r[i+2])}`:null;return{name:e.name,visible:(r[0]??1)!==0&&(!n||(r[6]??1)!==0),locked:(r[2]??1)===0,preview:(r[1]??1)!==0,printing:(r[3]??1)!==0,dimmed:(r[4]??0)!==0,template:n?(r[11]??0)!==0:(r[10]??0)!==0,color:a,operands:r,children:e.children,beginLine:e.beginLine,artStart:e.artStart,artEnd:t,depth:e.depth}}function sW(e){let t=[],r=[],n=0,i=!1,a=null;for(let o of h$(e)){let s=o.text;if(s==="%AI5_BeginLayer"){a={line:o.index};continue}if(a&&s.endsWith(" Lb")){let u=s.slice(0,-3).trim().split(/\s+/).map(Number).filter(d=>Number.isFinite(d));r.push({operands:u,name:"",children:[],beginLine:a.line,artStart:o.next,depth:r.length}),a=null,n++;continue}let l=r[r.length-1];if(l){if(s.endsWith(" Ln")&&s.startsWith("(")){let u=Zm(s,0);l.name=Ec(s.slice(1,u<0?s.length-3:u)),l.artStart=o.next;continue}if(s==="LB"){r.pop();let u=ES(l,o.start),d=r[r.length-1];d?d.children.push(u):t.push(u)}}}for(;r.length>0;){i=!0;let o=r.pop(),s=ES(o,e.length),l=r[r.length-1];l?l.children.push(s):t.push(s)}return{layers:t,unbalanced:i,count:n}}var lW=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;function uW(e){let t=[],r=0,n=e.length;for(;r<n;){let i=e[r];if(i===" "||i===" "||i===`
119
+ `||i==="\r"||i==="\f"){r++;continue}if(i==="("){let s=Zm(e,r),l=s<0?n:s,u=e.slice(r+1,l);t.push({kind:"string",text:Ec(u),raw:u}),r=l+1;continue}if(i===":"){t.push({kind:"colon"}),r++;continue}if(i===","){t.push({kind:"comma"}),r++;continue}if(i===";"){t.push({kind:"semicolon"}),r++;continue}let a=r;for(;a<n;){let s=e[a];if(s===" "||s===" "||s===`
120
+ `||s==="\r"||s==="\f"||s==="("||s===")"||a>r&&(s===":"||s===","||s===";"||s==="/"))break;a++}if(a===r){r++;continue}let o=e.slice(r,a);r=a,o.startsWith("/")?t.push({kind:"name",name:o.slice(1)}):lW.test(o)?t.push({kind:"number",value:Number(o)}):t.push({kind:"word",text:o})}return t}function Nc(e){let t=e.pending;if(e.pending=[],t.length===0)return;let r=t[t.length-1];if(r.kind==="string"||r.kind==="name"){let n=r.kind==="string"?r.text:r.name,i=t[t.length-2],a=i!==void 0&&i.kind==="name"&&t.length>=2,o=t.slice(0,a?t.length-2:t.length-1);e.entries.push({key:n,type:a?i.name:null,values:o});return}e.entries.push({key:null,type:null,values:t})}function dW(e){return cW(uW(e))}function cW(e){let t=[{type:null,entries:[],pending:[]}];for(let r of e){let n=t[t.length-1];switch(r.kind){case"colon":{let i=n.pending.pop(),a=i&&i.kind==="name"?i.name:null;i&&i.kind!=="name"&&n.pending.push(i),t.push({type:a,entries:[],pending:[]});break}case"comma":Nc(n);break;case"semicolon":{if(t.length===1)break;Nc(n),t.pop();let i={kind:"record",type:n.type,entries:n.entries};t[t.length-1].pending.push(i);break}default:n.pending.push(r)}}for(;t.length>1;){let r=t.pop();Nc(r),t[t.length-1].pending.push({kind:"record",type:r.type,entries:r.entries})}return Nc(t[0]),{kind:"record",type:null,entries:t[0].entries}}function mi(e,t){if(e.kind==="record"){for(let r of e.entries)if(r.key===t)return r;for(let r of e.entries)for(let n of r.values){let i=mi(n,t);if(i)return i}}}function zS(e){let t=e?.values[0];return t&&t.kind==="string"?t.text:null}function zl(e){return(e?.values??[]).flatMap(t=>t.kind==="number"?[t.value]:[])}var fW="(ArtboardArray) ,";function pW(e){let t=[],r=-1;for(let n of h$(e)){if(!n.text.startsWith("%_")){if(r>=0)break;t.length=0;continue}t.push({text:n.text}),r<0&&n.text.endsWith(fW)&&(r=t.length-1)}return r<0?null:t.map(n=>n.text.slice(2)).join(`
121
+ `)}function hW(e,t){if(e.kind!=="record")return null;let r=zl(mi(e,"PositionPoint1")),n=zl(mi(e,"PositionPoint2"));if(r.length<2||n.length<2)return null;let i=zS(mi(e,"Name"))??`Artboard ${t+1}`,a=zl(mi(e,"IsArtboardDefaultName")),o=zl(mi(e,"RulerOrigin"));return{index:t,name:i,defaultName:a.length>0?a[0]!==0:!1,rect:[Math.min(r[0],n[0]),Math.min(r[1],n[1]),Math.max(r[0],n[0]),Math.max(r[1],n[1])],uuid:zS(mi(e,"ArtboardUUID")),rulerOrigin:o.length>=2?[o[0],o[1]]:null}}function Jm(e){let t=pW(e);if(t===null)return null;let r=dW(t),n=[],i=mi(r,"ArtboardArray")?.values[0];if(i&&i.kind==="record")for(let o of i.entries)for(let s of o.values){let l=hW(s,n.length);l&&n.push(l)}let a=zl(mi(r,"AIDocumentCanvasSize"));return{record:r,artboards:n,canvasSize:a.length>0?a[0]:null}}function os(e){return e===0?0:e}function Hm(e){return[os(e[0]),os(-e[3]),os(e[2]),os(-e[1])]}function mW(e,t,r){let n=new Hi,i;try{if(t==="pdf-compatible"||t==="pdf-private-only"){let u=A8(e);n.addAll(u.diagnostics),i=u.source}else if(t==="postscript-legacy"||t==="postscript-eps"){let u=c$(e),d=R8(u);i=vi(d?d.bytes:u)}else return null}catch(u){if(u instanceof Vt)return n.add({code:u.code,severity:"warning",message:u.message}),null;throw u}let a=aW(i),o=sW(i);o.unbalanced&&n.add({code:"source-unbalanced-container",severity:"warning",message:"A layer block was not closed; its contents were attached to the enclosing layer."});let s=Jm(i),l=[];if(s&&s.artboards.length>0)s.artboards.forEach((u,d)=>{let c=Hm(u.rect);l.push({index:d+1,name:u.name,defaultName:u.defaultName,canvas:c,width:c[2]-c[0],height:c[3]-c[1],origin:"artboard-record",page:d<r?d+1:null})});else if(a.cropmarks){let u=Hm(a.cropmarks);l.push({index:1,name:"Artboard 1",defaultName:!0,canvas:u,width:u[2]-u[0],height:u[3]-u[1],origin:"cropmarks",page:r>0?1:null})}return{source:i,header:a,layers:o.layers,layerCount:o.count,artboards:l,diagnostics:n.list()}}function m$(e){return{name:e.name,visible:e.visible,locked:e.locked,color:e.color,children:e.children.map(m$),origin:"source",svgIds:[]}}function gW(e){return new Km(e).pages().map((t,r)=>{let n=t.cropBox??t.mediaBox??[0,0,612,792],i=[0,0,os(n[2]-n[0]),os(n[3]-n[1])];return{index:r+1,name:`Page ${r+1}`,defaultName:!0,canvas:i,width:i[2]-i[0],height:i[3]-i[1],origin:"page-box",page:r+1}})}function yW(e){let t=Y8(e),r=new Hi;r.addAll(t.diagnostics);let n=t.pdfPageCount??0,i=t.kind,a=i==="not-illustrator"||i==="pdf-foreign"?null:mW(e,i,n);a&&r.addAll(a.diagnostics);let o=a?.artboards??[];if(o.length===0&&(i==="pdf-compatible"||i==="pdf-foreign")&&!t.encrypted)try{o=gW(e)}catch{o=[]}return o.length===0&&i!=="not-illustrator"&&r.add({code:"artboards-missing",severity:"warning",message:"No artboard rectangle was found; the artwork bounds are used."}),{inspection:{container:t,kind:i,title:a?.header.title??null,formatVersion:a?.header.formatVersion??null,creatorVersion:a?.header.creatorVersion??t.creatorVersion??null,colorModel:a?.header.colorModel??"unknown",pageCount:n,artboards:o,layers:(a?.layers??[]).map(m$),hasPrivateSource:a!==null,placeholderPage:i==="pdf-private-only",encrypted:t.encrypted,diagnostics:r.list()},parsed:a}}var vW={"password-required":"dropped","encrypted-opened":"preserved","no-pages":"dropped","page-skipped":"dropped","page-empty":"preserved","page-box-fallback":"approximated","page-rotated":"preserved","page-placement-mismatch":"approximated","user-unit-ignored":"approximated","page-clip-dropped":"preserved","layer-imported-hidden":"preserved","layer-skipped-hidden":"dropped","layer-fragmented":"preserved","ocmd-hidden":"approximated","marked-content-unbalanced":"approximated","annotations-skipped":"dropped","annotation-imported":"preserved","font-substituted":"approximated","type3-outlined":"approximated","text-outlined-unmappable":"approximated","text-outlined-render-mode":"approximated","text-outlined-vertical":"approximated","text-outlined-mirrored":"approximated","invisible-text-dropped":"dropped","text-clip-converted":"approximated","glyph-outline-missing":"dropped","cmyk-converted":"approximated","spot-color-flattened":"approximated","icc-profile-ignored":"approximated","blend-mode-unsupported":"approximated","knockout-group-ignored":"approximated","soft-mask-converted":"approximated","soft-mask-transfer-ignored":"approximated","transfer-function-ignored":"approximated","radial-gradient-rasterized":"rasterized","radial-gradient-approximated":"approximated","shading-unsupported":"dropped","shading-fill-unclipped":"approximated","mesh-rasterized":"rasterized","mesh-triangulated":"preserved","pattern-tile-overlap-clipped":"approximated","image-downsampled":"approximated","image-skipped":"dropped","image-decode-failed":"dropped","image-mask-tinted":"approximated","image-reused":"preserved","hairline-stroke-widened":"approximated","form-reused":"preserved","artwork-deduped":"preserved","xobject-depth-limited":"dropped","operator-ignored":"dropped","operator-unknown":"dropped"},bW={"container-not-illustrator":"dropped","container-encrypted":"dropped","container-xref-reconstructed":"preserved","container-unsupported-filter":"dropped","container-limit":"dropped","private-source-missing":"approximated","private-source-corrupt":"approximated","private-source-limit":"approximated","source-header-missing":"approximated","source-unbalanced-container":"approximated","source-operand-mismatch":"approximated","source-limit":"dropped","text-document-undecodable":"approximated","text-story-unbound":"approximated","text-position-unknown":"approximated","artboards-missing":"approximated","color-converted":"approximated","spot-color-converted":"approximated","font-required":"approximated","construct-approximated":"approximated","construct-dropped":"dropped","construct-rasterized":"rasterized","structure-degraded":"approximated","layer-unmatched":"approximated","layer-source-rendered":"approximated","object-unmatched":"approximated","pdf-compatibility-undetermined":"approximated"};function xW(e){if(e)for(let t of["layer","font","name","color","page","construct"]){let r=e[t];if(r!==void 0)return String(r)}}function wW(e){return e.map(t=>({bucket:vW[t.code],vocabulary:"pdf",code:t.code,subject:xW(t.detail),count:t.count,message:t.message}))}function g$(e){return e.map(t=>({bucket:bW[t.code],vocabulary:"illustrator",code:t.code,subject:t.name,count:t.count??1,message:t.message}))}function IW(e){let t=new Map;for(let r of e){if(r.glyphsShown===0)continue;let n=`${r.mapping.family}|${r.mapping.style}|${r.mapping.weight}`,i=t.get(n),a=r.outlined;i?t.set(n,{...i,embedded:i.embedded||r.embedded,glyphs:(i.glyphs??0)+r.glyphsShown,status:i.status==="outlined"&&a?"outlined":"unresolved"}):t.set(n,{family:r.mapping.family,style:r.mapping.style,weight:r.mapping.weight,embedded:r.embedded,status:a?"outlined":"unresolved",glyphs:r.glyphsShown})}return[...t.values()]}var kW=new Set(["path","rect","circle","ellipse","line","polyline","polygon","use"]);function SW(e){let t=0,r=0,n=0,i=0,a=o=>{for(let s of o.children)Ye(s)||s.tag!=="defs"&&(kW.has(s.tag)?t++:s.tag==="g"?r++:s.tag==="text"?n++:s.tag==="image"&&i++,a(s))};return a(e),{shapes:t,groups:r,texts:n,images:i}}var $W=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,RS=new Set([" "," ","\r",`
122
+ `,"\f","\0","(",")","<",">","[","]","{","}","/","%"]),NW=/^%%BeginData:\s*(\d+)(?:\s+(Hex|Binary|ASCII))?\s*(Bytes|Lines)?/i;function MW(e){return e===" "||e===" "||e==="\r"||e===`
123
+ `||e==="\f"||e==="\0"}function*Qm(e,t=0,r=e.length,n={}){let i=n.hiddenCode??!0,a=t;for(;a<r;){let o=e[a];if(MW(o)){a++;continue}if(o==="%"){let u=Fl(e,a,r),d=Ll(e,u,r),c=e.slice(a,u),f=e[a+1];if(f==="_"&&i){yield*Qm(e,a+2,u,n),a=d;continue}if(f==="%"||f==="A"||f==="!"){yield{kind:"marker",text:c,offset:a};let p=NW.exec(c);if(p&&p[3]?.toLowerCase()!=="lines"){let h=Number(p[1]),m=d,g=Math.min(r,m+(Number.isFinite(h)?h:0));if(!e.startsWith("%%EndData",AW(e,g,r))){let v=e.indexOf("%%EndData",m);v>=0&&v<=r&&(g=v)}yield{kind:"data",start:m,end:g,offset:m},a=g;continue}}a=d;continue}if(o==="("){let u=Zm(e,a),d=u<0||u>r?r:u,c=e.slice(a+1,d);yield{kind:"string",text:Ec(c),raw:c,offset:a},a=d+1;continue}if(o==="<"){if(e[a+1]==="<"){yield{kind:"dict-open",offset:a},a+=2;continue}let u=e.indexOf(">",a);(u<0||u>r)&&(u=r);let d=e.slice(a+1,u).replace(/[^0-9a-fA-F]/g,""),c=new Uint8Array(Math.floor(d.length/2));for(let f=0;f<c.length;f++)c[f]=Number.parseInt(d.slice(f*2,f*2+2),16);yield{kind:"hexstring",bytes:c,offset:a},a=u+1;continue}if(o===">"){if(e[a+1]===">"){yield{kind:"dict-close",offset:a},a+=2;continue}a++;continue}if(o==="["){yield{kind:"array-open",offset:a},a++;continue}if(o==="]"){yield{kind:"array-close",offset:a},a++;continue}if(o==="{"){yield{kind:"proc-open",offset:a},a++;continue}if(o==="}"){yield{kind:"proc-close",offset:a},a++;continue}if(o===")"){a++;continue}if(o==="/"){let u=a+1;for(;u<r&&!RS.has(e[u]);)u++;yield{kind:"name",name:e.slice(a+1,u),offset:a},a=u;continue}let s=a;for(;s<r&&!RS.has(e[s]);)s++;if(s===a){a++;continue}let l=e.slice(a,s);$W.test(l)?yield{kind:"number",value:Number(l),offset:a}:yield{kind:"operator",op:l,offset:a},a=s}}function AW(e,t,r){let n=t;for(;n<r&&(e[n]===`
124
+ `||e[n]==="\r");)n++;return n}function ja(e){return e<0?0:e>1?1:e}function _m(e){return Math.round(ja(e)*255).toString(16).padStart(2,"0")}function zc(e,t,r){return`#${_m(e)}${_m(t)}${_m(r)}`}function _l(e,t,r,n,i,a){let[o,s,l]=jl(ja(e),ja(t),ja(r),ja(n));return{kind:"flat",rgb:zc(o/255,s/255,l/255),space:i?"spot":"cmyk",...i?{name:i}:{},...a!==void 0?{tint:a}:{}}}function Wi(e,t,r,n,i){return{kind:"flat",rgb:zc(e,t,r),space:n?"spot":"rgb",...n?{name:n}:{},...i!==void 0?{tint:i}:{}}}function Tc(e){let[t,r,n]=jl(0,0,0,ja(1-e));return{kind:"flat",rgb:zc(t/255,r/255,n/255),space:"gray"}}function CW(e,t){if(t>=1)return e;let r=Number.parseInt(e.rgb.slice(1,3),16)/255,n=Number.parseInt(e.rgb.slice(3,5),16)/255,i=Number.parseInt(e.rgb.slice(5,7),16)/255,a=o=>1-(1-o)*ja(t);return{...e,rgb:zc(a(r),a(n),a(i)),tint:t}}var _S=[1,0,0,1,0,0],OW={width:1,cap:0,join:0,miterLimit:10,dash:[],dashOffset:0},TW=new Set(["O","R","Xw","Ap","Ae","As","AE","Xd","XW","XL","Xz","Xk","XK","XP","Xt","Xf","Xg","XT","XE","X1","X2","XS","XM","XQ","XV","Np","Nb","Ba","Bd","Bs","BS","BD","Br","Bn","Bm","Pb","PB","Pn","Pc","TP","Tk","Tt","Ta","TV","Tv","Tb","TW","Td","Tw","TY","Xh","XH","XF","D","Xe","Xs","XU","Xn","XN","Xi","XI","XG","Ah","XR","Xv","Xl","XB","XC","XD","Xj","Xo","XJ","Xp","XX","Xx","x","X","X=","X+"]);function Fm(e,t=0){return e&&e.kind==="number"?e.value:t}function gi(e){return e.flatMap(t=>t.kind==="number"?[t.value]:[])}function Rl(e){return e?e.kind==="string"?e.text:e.kind==="name"?e.name:null:null}function is(e){return e.length>=6?[e[0],e[1],e[2],e[3],e[4],e[5]]:null}function FS(e){return e===1?1:e===2?2:0}function y$(e){switch(e.kind){case"number":return{kind:"number",value:e.value};case"name":return{kind:"name",name:e.name};case"string":return{kind:"string",text:e.text,raw:e.raw};case"hexstring":return{kind:"hexstring",bytes:e.bytes};default:return null}}function PW(e){let t=e.length>=13,r=t?8:6,n=a=>Math.max(0,Math.min(255,Math.round(a))).toString(16).padStart(2,"0"),i=e.length>=r+3?`#${n(e[r])}${n(e[r+1])}${n(e[r+2])}`:null;return{layerName:"",visible:(e[0]??1)!==0&&(!t||(e[6]??1)!==0),locked:(e[2]??1)===0,color:i,template:t?(e[11]??0)!==0:(e[10]??0)!==0,printing:(e[3]??1)!==0}}function Mc(e,t){let r=e.find(u=>u.kind==="string"),n=r&&r.kind==="string"?r.text:void 0,i=r?e.indexOf(r):e.length,a=gi(e.slice(0,i)),o=gi(e.slice(i+1)),s=o.length>0?o[0]:1,l;return t==="rgb"&&a.length>=7?l=Wi(a[4],a[5],a[6],n):t==="rgb"&&a.length>=3?l=Wi(a[0],a[1],a[2],n):a.length>=4?l=_l(a[0],a[1],a[2],a[3],n):l=Tc(a[0]??0),l.kind==="flat"?CW(l,s):l}function DW(e){let t=[...e];return t.length>=3&&t[t.length-1]===6&&t.splice(t.length-2,2),t.pop(),t.length>=7?Wi(t[4],t[5],t[6]).rgb:t.length>=4?_l(t[0],t[1],t[2],t[3]).rgb:t.length===3?Wi(t[0],t[1],t[2]).rgb:Tc(t[0]??0).rgb}function jW(e){let t=[];for(let r of e){let n=t[t.length-1];n&&n.offset===r.offset&&n.rgb===r.rgb||t.push(r)}return t}function EW(e){let t=new Map,r=0;for(;;){let n=e.indexOf("%AI5_BeginGradient",r);if(n<0)break;let i=e.indexOf("%AI5_EndGradient",n),a=i<0?e.length:i,o=null,s="linear",l=[],u=[];for(let d of Qm(e,n,a)){if(d.kind==="operator"){if(d.op==="Bd"){let f=gi(u);o=Rl(u.find(p=>p.kind==="string"))??o,s=(f[0]??0)===1?"radial":"linear"}else if(d.op==="Bs"||d.op==="BS"){let f=gi(u);if(f.length>=4){let p=f[f.length-1],h=f[f.length-2];l.push({offset:p/100,midpoint:h/100,opacity:1,rgb:DW(f.slice(0,-2))})}}u=[];continue}if(d.kind==="marker"||d.kind==="data"||d.kind==="array-open"||d.kind==="array-close")continue;let c=y$(d);c&&u.push(c)}o&&(l.sort((d,c)=>d.offset-c.offset),t.set(o,{name:o,type:s,stops:jW(l)})),r=a+1}return t}var zW=class{diagnostics;source;gradients;patterns=new Set;unknown=new Map;stack=[];containers=[];roots=[];state;subpaths=[];current=null;text=null;gradient=null;nextId=1;objectCount=0;lastClosedGroup=null;lastNode=null;image=null;collectDepth=0;collected=[];recordDepth=0;recordKeys=[];textRecord=null;inArt=!1;lastRecordString=null;pendingHighlight=null;finished=!1;constructor(e,t={}){this.source=e,this.diagnostics=t.diagnostics??new Hi,this.gradients=EW(e),this.state={fill:_l(0,0,0,1),stroke:null,strokeStyle:OW,fillRule:0,locked:!1,transparency:null,pendingClip:!1}}run(e,t){let r=e??this.artStart(),n=t??this.source.length;for(let i of Qm(this.source,r,n))if(this.consume(i),this.finished)break;for(this.text&&this.endText(n);this.containers.length>0;)this.diagnostics.add({code:"source-unbalanced-container",severity:"warning",message:"A container was not closed before the end of the source."}),this.closeContainer();return{roots:this.roots,gradients:this.gradients,patterns:this.patterns,unknownOperators:this.unknown,objectCount:this.objectCount}}lineIndex=null;lineOf(e){return this.lineIndex||(this.lineIndex=new eW(this.source)),this.lineIndex.lineOf(e)}artStart(){let e=this.source.indexOf("%%EndSetup");if(e>=0)return e;let t=this.source.indexOf("%AI5_BeginLayer");if(t>=0)return t;let r=this.source.indexOf("%%EndProlog");return r>=0?r:0}consume(e){switch(e.kind){case"marker":this.marker(e.text,e.offset);return;case"data":{if(!this.image)return;let t=e.start,r=Fl(this.source,t,e.end);(r<e.end?this.source.slice(t,r):"")==="XI"&&(this.operator("XI",t),t=Ll(this.source,r,e.end)),this.image.payload=this.source.slice(t,e.end);return}case"array-open":case"dict-open":this.collectDepth++,this.collected.push([]);return;case"array-close":case"dict-close":{if(this.collectDepth===0)return;this.collectDepth--;let t=this.collected.pop()??[];this.push({kind:e.kind==="array-close"?"array":"dict",items:t});return}case"proc-open":case"proc-close":return;case"operator":if(this.collectDepth>0){(e.op==="true"||e.op==="false")&&this.push({kind:"number",value:e.op==="true"?1:0});return}this.operator(e.op,e.offset);return;default:{let t=y$(e);t&&this.push(t)}}}push(e){this.collectDepth>0?this.collected[this.collected.length-1].push(e):this.stack.push(e)}take(){let e=this.stack;return this.stack=[],e}marker(e,t){if(e.startsWith("%%PageTrailer")||e.startsWith("%%Trailer")){this.finished=!0;return}if(e.startsWith("%AI5_BeginRaster")||e.startsWith("%AI5_File")){this.image={};return}e.startsWith("%AI5_EndRaster")&&this.finishImage(t)}operator(e,t){if(e===":"){this.openRecord();return}if(e===","){this.recordEntry(this.take());return}if(e===";"){this.closeRecord(t);return}if(this.recordDepth>0&&!this.inArt)return;let r=this.take();e!=="Xy"&&(this.lastClosedGroup=null),this.dispatch(e,r,t)||TW.has(e)||this.unknown.set(e,(this.unknown.get(e)??0)+1)}openRecord(){let e=this.stack.pop(),t=e&&e.kind==="name"?e.name:"";this.recordDepth++,this.recordKeys.push(t),t==="AI11Text"?this.textRecord={storyIndex:-1,frameIndex:-1,frame:null,depth:this.recordDepth}:t==="Art"&&this.textRecord&&this.recordDepth===this.textRecord.depth+1&&(this.inArt=!0),this.stack=[]}recordEntry(e){if(this.recordDepth===0)return;let t=Rl(e[e.length-1]);if(this.textRecord&&this.recordDepth===this.textRecord.depth){let n=Fm(e[0],-1);t==="StoryIndex"?this.textRecord.storyIndex=n:t==="FrameIndex"&&(this.textRecord.frameIndex=n);return}t==="AI10_ArtUID"&&this.lastRecordString!==null&&this.lastNode&&(this.lastNode.name=this.lastRecordString);let r=e[0];r&&r.kind==="string"&&(this.lastRecordString=r.text)}closeRecord(e){if(this.recordDepth===0)return;let t=this.recordKeys.pop()??"",r=this.stack.find(n=>n.kind==="string");r&&r.kind==="string"&&(this.lastRecordString=r.text),this.inArt&&t==="Art"&&(this.inArt=!1),this.textRecord&&this.recordDepth===this.textRecord.depth&&(this.emitModernText(e),this.textRecord=null),this.recordDepth--,this.stack=[]}openContainer(e,t){let r={id:this.nextId++,kind:e,children:[],locked:this.state.locked,transparency:null,name:null,line:this.lineOf(t)};return this.attach(r),this.containers.push(r),this.lastClosedGroup=null,r}closeContainer(){let e=this.containers.pop()??null;e&&(this.lastClosedGroup=e.kind==="group"||e.kind==="compound"||e.kind==="clipgroup"?e:null,this.lastNode=e)}closeCompound(){let e=this.containers[this.containers.length-1];if(e&&e.kind==="compound"){let t=e.children.filter(r=>r.kind==="path");if(t.length>1&&e.children.length===t.length){let r={...t[0],subpaths:t.flatMap(n=>n.subpaths),fill:t.find(n=>n.fill)?.fill??null,stroke:t.find(n=>n.stroke)?.stroke??null,fillRule:t[t.length-1].fillRule,painted:t.some(n=>n.painted),clip:t.some(n=>n.clip)};e.children.splice(0,e.children.length,r)}}this.closeContainer()}attach(e){let t=this.containers[this.containers.length-1];t?t.children.push(e):this.roots.push(e),this.lastNode=e,this.lastRecordString=null}beginLayer(e,t){let r=gi(e),n=this.openContainer("layer",t);n.layer=PW(r)}nameLayer(e){let t=this.containers[this.containers.length-1],r=Rl(e[0])??"";t&&t.kind==="layer"&&t.layer&&(t.layer={...t.layer,layerName:r})}endLayer(){for(;this.containers.length>0&&this.containers[this.containers.length-1].kind!=="layer";)this.closeContainer();this.containers.length>0&&this.closeContainer(),this.lastClosedGroup=null}moveTo(e,t){this.current={start:[e,t],segments:[],closed:!1},this.subpaths.push(this.current)}lineTo(e,t){this.current?this.current.segments.push({to:[e,t]}):this.moveTo(e,t)}curveTo(e,t,r){if(!this.current){this.moveTo(r[0],r[1]);return}let n=this.current.segments,i=n.length>0?n[n.length-1].to:this.current.start;n.push({c1:e??i,c2:t??r,to:r})}closePath(){this.current&&(this.current.closed=!0)}emitPath(e,t,r,n,i){if(r)for(let o of this.subpaths)o.closed=!0;let a={id:this.nextId++,kind:"path",subpaths:this.subpaths,fill:e?this.gradient?this.gradientPaint():this.state.fill:null,stroke:t?this.gradient&&!e?this.gradientPaint():this.state.stroke:null,strokeStyle:this.state.strokeStyle,fillRule:this.state.fillRule,clip:this.state.pendingClip,painted:n,locked:this.state.locked,transparency:this.state.transparency,name:null,line:this.lineOf(i)};if(this.subpaths=[],this.current=null,this.state.pendingClip=!1,this.objectCount++,this.textRecord&&this.inArt){this.textRecord.frame=a;return}this.attach(a)}gradientPaint(){let e=this.gradient;return{kind:"gradient",name:e.name,definition:this.gradients.get(e.name)??null,origin:e.origin,angle:e.angle,length:e.length,matrix:e.matrix,xm:e.xm,bm:e.bm,highlight:e.highlight,hilightMatrix:e.hilightMatrix}}beginText(e){let t=this.textState;this.text={type:e,matrix:_S,font:t.font,size:t.size,render:t.render,tracking:t.tracking,leading:t.leading,horizontalScale:t.horizontalScale,runs:[]}}textState={font:null,size:12,render:0,tracking:0,leading:0,horizontalScale:100};showText(e){this.text&&this.text.runs.push({text:e,font:this.text.font,size:this.text.size,matrix:this.text.matrix,fill:this.state.fill,stroke:this.state.stroke,render:this.text.render,tracking:this.text.tracking,leading:this.text.leading,horizontalScale:this.text.horizontalScale})}endText(e){let t=this.text;if(this.text=null,!t)return;this.textState={font:t.font,size:t.size,render:t.render,tracking:t.tracking,leading:t.leading,horizontalScale:t.horizontalScale};let r={id:this.nextId++,kind:"text",textType:t.type,runs:t.runs,story:null,frame:null,locked:this.state.locked,transparency:this.state.transparency,name:null,line:this.lineOf(e)};this.objectCount++,this.attach(r)}emitModernText(e){let t=this.textRecord;if(!t)return;let r={id:this.nextId++,kind:"text",textType:1,runs:[],story:{storyIndex:t.storyIndex,frameIndex:t.frameIndex},frame:t.frame,locked:this.state.locked,transparency:this.state.transparency,name:null,line:this.lineOf(e)};this.objectCount++,this.attach(r)}finishImage(e){let t=this.image;if(this.image=null,!t||t.width===void 0||t.height===void 0||!t.matrix)return;let r={id:this.nextId++,kind:"image",matrix:t.matrix,width:t.width,height:t.height,bits:t.bits??8,channels:t.channels??3,alphaChannels:t.alphaChannels??0,binary:t.binary??!0,mask:t.mask??!1,payload:t.payload??"",colorSpace:t.colorSpace??null,bounds:t.bounds??[0,0,t.width,t.height],linked:t.linked??null,locked:this.state.locked,transparency:this.state.transparency,name:null,line:this.lineOf(e)};this.objectCount++,this.attach(r)}dispatch(e,t,r){let n=gi(t);switch(e){case"Lb":return this.beginLayer(t,r),!0;case"Ln":return this.nameLayer(t),!0;case"LB":return this.endLayer(),!0;case"u":return this.openContainer("group",r),!0;case"U":return this.closeContainer(),!0;case"*u":return this.openContainer("compound",r),!0;case"*U":return this.closeCompound(),!0;case"q":return this.openContainer("clipgroup",r),!0;case"Q":return this.closeContainer(),!0;case"A":return this.state.locked=Fm(t[0])!==0,!0;case"Xy":{let i=n.length>=2?{blendMode:n[0],opacity:n[1],isolated:(n[2]??0)!==0,knockout:n[3]??0,alphaIsShape:(n[4]??0)!==0}:null;return this.lastClosedGroup&&this.subpaths.length===0&&!this.text&&i?(this.lastClosedGroup.transparency=i,this.lastClosedGroup=null,this.state.transparency=null,!0):(this.state.transparency=i,!0)}case"XR":return this.state.fillRule=Fm(t[0])===1?1:0,!0;case"W":return this.state.pendingClip=!0,!0;case"k":return this.state.fill=_l(n[0]??0,n[1]??0,n[2]??0,n[3]??0),!0;case"K":return this.state.stroke=_l(n[0]??0,n[1]??0,n[2]??0,n[3]??0),!0;case"g":return this.state.fill=Tc(n[0]??0),!0;case"G":return this.state.stroke=Tc(n[0]??0),!0;case"Xa":return this.state.fill=n.length>=7?Wi(n[4],n[5],n[6]):Wi(n[0]??0,n[1]??0,n[2]??0),!0;case"XA":return this.state.stroke=n.length>=7?Wi(n[4],n[5],n[6]):Wi(n[0]??0,n[1]??0,n[2]??0),!0;case"x":return this.state.fill=Mc(t,"cmyk"),!0;case"X":return this.state.stroke=Mc(t,"cmyk"),!0;case"Xx":return this.state.fill=Mc(t,"rgb"),!0;case"XX":return this.state.stroke=Mc(t,"rgb"),!0;case"p":case"P":{let i=t.find(s=>s.kind==="string"),a=i&&i.kind==="string"?i.text:"pattern";this.patterns.add(a);let o={kind:"pattern",name:a};return e==="p"?this.state.fill=o:this.state.stroke=o,!0}case"w":return this.state.strokeStyle={...this.state.strokeStyle,width:n[0]??1},!0;case"J":return this.state.strokeStyle={...this.state.strokeStyle,cap:FS(n[0]??0)},!0;case"j":return this.state.strokeStyle={...this.state.strokeStyle,join:FS(n[0]??0)},!0;case"M":return this.text||(this.state.strokeStyle={...this.state.strokeStyle,miterLimit:n[0]??10}),!0;case"d":{let i=t.find(o=>o.kind==="array"),a=i&&i.kind==="array"?gi(i.items).filter(o=>o>=0):[];return this.state.strokeStyle={...this.state.strokeStyle,dash:a,dashOffset:n[n.length-1]??0},!0}case"m":return this.moveTo(n[0]??0,n[1]??0),!0;case"l":case"L":return this.lineTo(n[0]??0,n[1]??0),!0;case"c":case"C":return this.curveTo([n[0]??0,n[1]??0],[n[2]??0,n[3]??0],[n[4]??0,n[5]??0]),!0;case"v":case"V":return this.curveTo(null,[n[0]??0,n[1]??0],[n[2]??0,n[3]??0]),!0;case"y":case"Y":return this.curveTo([n[0]??0,n[1]??0],null,[n[2]??0,n[3]??0]),!0;case"h":case"H":return this.closePath(),!0;case"N":return this.emitPath(!1,!1,!1,!1,r),!0;case"n":return this.emitPath(!1,!1,!0,!1,r),!0;case"F":return this.emitPath(!0,!1,!1,!0,r),!0;case"f":return this.emitPath(!0,!1,!0,!0,r),!0;case"S":return this.emitPath(!1,!0,!1,!0,r),!0;case"s":return this.emitPath(!1,!0,!0,!0,r),!0;case"B":return this.emitPath(!0,!0,!1,!0,r),!0;case"b":return this.emitPath(!0,!0,!0,!0,r),!0;case"Bb":return this.gradient=null,this.pendingHighlight=null,!0;case"Bg":{let i=t.find(o=>o.kind==="string"),a=n.slice(1);return this.gradient={name:i&&i.kind==="string"?i.text:"",origin:[a[0]??0,a[1]??0],angle:a[2]??0,length:a[3]??0,matrix:is(a.slice(4,10)),xm:null,bm:null,highlight:this.pendingHighlight,hilightMatrix:null},!0}case"Xm":return this.gradient&&(this.gradient.xm=is(n)),!0;case"Bm":return this.gradient&&(this.gradient.bm=is(n)),!0;case"Bh":{let i=n.length>=4?{origin:[n[0],n[1]],angle:n[2],length:n[3]}:null;return this.gradient?this.gradient.highlight=i:this.pendingHighlight=i,!0}case"Bc":return this.gradient&&!this.gradient.hilightMatrix&&(this.gradient.hilightMatrix=is(n)),!0;case"BB":return this.gradient=null,!0;case"To":return this.beginText(n[0]??0),!0;case"TO":return this.endText(r),!0;case"Tp":case"Tm":{let i=is(n);return this.text&&i&&(this.text.matrix=i),!0}case"Tf":{if(!this.text)return!0;let i=t.find(a=>a.kind==="name");return i&&i.kind==="name"&&(this.text.font=i.name.replace(/^_/,"")),n.length>0&&(this.text.size=n[0]),!0}case"Tz":return this.text&&(this.text.horizontalScale=n[0]??100),!0;case"Tl":return this.text&&(this.text.leading=n[0]??0),!0;case"Tc":return this.text&&(this.text.tracking=n[0]??0),!0;case"Tr":return this.text&&(this.text.render=n[0]??0),!0;case"Tx":case"TX":case"Tj":return this.showText(Rl(t[0])??""),!0;case"XG":{let i=Rl(t[0]);return this.image&&i&&(this.image.linked=i),!0}case"XN":{let i=t.find(a=>a.kind==="name");return this.image&&i&&i.kind==="name"&&(this.image.colorSpace=i.name),!0}case"XI":{this.image||(this.image={});let i=t.find(s=>s.kind==="array"),a=gi(t.filter(s=>s.kind!=="array")),o=i&&i.kind==="array"?is(gi(i.items)):null;return this.image.matrix=o??_S,this.image.bounds=[a[0]??0,a[1]??0,a[2]??0,a[3]??0],this.image.width=a[4]??0,this.image.height=a[5]??0,this.image.bits=a[6]??8,this.image.channels=a[7]??3,this.image.alphaChannels=a[8]??0,this.image.binary=(a[10]??1)!==0,this.image.mask=(a[11]??0)!==0,!0}default:return!1}}};function v$(e,t={}){return new zW(e,t).run(t.from,t.to)}function RW(e){if(e.binary){let n=new Uint8Array(e.payload.length);for(let i=0;i<e.payload.length;i++)n[i]=e.payload.charCodeAt(i)&255;return n}let t=e.payload.replace(/[^0-9a-fA-F]/g,""),r=new Uint8Array(Math.floor(t.length/2));for(let n=0;n<r.length;n++)r[n]=Number.parseInt(t.slice(n*2,n*2+2),16);return r}function _W(e){if(e.bits!==8||e.width<=0||e.height<=0)return null;let t=RW(e),r=e.channels,n=r+e.alphaChannels,i=e.width*e.height;if(t.length<i*n||t.length>i*n+64)return null;let a=new Uint8ClampedArray(i*4);for(let o=0;o<i;o++){let s=o*n,l=0,u=0,d=0;if(r===4){let[f,p,h]=jl(t[s]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255);l=f,u=p,d=h}else r===3?(l=t[s],u=t[s+1],d=t[s+2]):l=u=d=t[s];let c=e.alphaChannels>0?t[s+r]:255;a[o*4]=l,a[o*4+1]=u,a[o*4+2]=d,a[o*4+3]=c}return a}async function FW(e){let t=_W(e);if(!t)return null;let r=await Cm({width:e.width,height:e.height,colorType:6,bitDepth:8,data:t}),n="";for(let i=0;i<r.length;i+=32768)n+=String.fromCharCode(...r.subarray(i,i+32768));return`data:image/png;base64,${btoa(n)}`}var LW=[null,"multiply","screen","overlay","soft-light","hard-light","color-dodge","color-burn","darken","lighten","difference","exclusion","hue","saturation","color","luminosity"];function ce(e,t){let r=10**t,n=Math.round(e*r)/r,i=(Object.is(n,-0)?0:n).toString();return i.includes("e")?n.toFixed(t).replace(/\.?0+$/,""):i}function hi(e){return{text:e}}function Lm(e,t){let[r,n,i,a,o,s]=e,[l,u,d,c,f,p]=t;return[r*l+n*d,r*u+n*c,i*l+a*d,i*u+a*c,o*l+s*d+f,o*u+s*c+p]}function Jt(e,t){return[e[0]*t[0]+e[2]*t[1]+e[4],e[1]*t[0]+e[3]*t[1]+e[5]]}var BW=class{taken=new Set;unique(e){let t=fn(e)||"object",r=t,n=2;for(;this.taken.has(r);)r=`${t}_${n++}`;return this.taken.add(r),r}};function VW(e,t){let r=new b$(e,t);return{renderNode:n=>r.renderStandalone(n),textBounds:n=>r.textBounds(n),decorations:()=>r.decorationMap(),toCanvas:r.canvasMatrix()}}async function UW(e,t){return new b$(e,t).render()}var b$=class{constructor(e,t){this.document=e,this.options=t;let r=t.artboards,n=null;for(let a of r)n=n?[Math.min(n[0],a.canvas[0]),Math.min(n[1],a.canvas[1]),Math.max(n[2],a.canvas[2]),Math.max(n[3],a.canvas[3])]:a.canvas;let i=n??[0,0,100,100];this.toCanvas=[1,0,0,-1,-i[0],-i[1]],this.viewBox=[0,0,i[2]-i[0],i[3]-i[1]]}document;options;ids=new BW;defs=[];decorations={};constructs=new Map;layers=[];counts={shapes:0,groups:0,texts:0,images:0,textOutlined:0};toCanvas;viewBox;gradientCount=0;clipCount=0;pending=[];renderStandalone(e){return this.renderNode(e,null)}decorationMap(){return this.decorations}canvasMatrix(){return this.toCanvas}async render(){let e=this.options.precision,t=me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${ce(this.viewBox[2],e)} ${ce(this.viewBox[3],e)}`,width:ce(this.viewBox[2],e),height:ce(this.viewBox[3],e)});this.options.title&&t.children.push(me("title",{},[hi(this.options.title)]));let r=[];if(this.options.artboards.length>1)for(let i of this.options.artboards){let a=i.canvas,o=me("view",{id:this.ids.unique(i.name||`Artboard_${i.index}`),viewBox:`${ce(a[0]-this.frameLeft(),e)} ${ce(a[1]-this.frameTop(),e)} ${ce(a[2]-a[0],e)} ${ce(a[3]-a[1],e)}`});o.children.push(me("title",{},[hi(i.name)])),r.push(o)}let n=this.document.roots;if(n.some(i=>i.kind==="layer"))for(let i of n){let a=this.renderNode(i,null);a&&r.push(a)}else{let i={id:0,kind:"layer",children:[...n],locked:!1,transparency:null,name:null,line:1,layer:{layerName:"Layer 1",visible:!0,locked:!1,color:null,template:!1,printing:!0}},a=this.renderLayer(i);a&&r.push(a)}return await Promise.all(this.pending),this.defs.length>0&&t.children.push(me("defs",{},this.defs)),t.children.push(...r),{tree:t,svg:ns(t),decorations:this.decorations,layers:this.layers,counts:this.counts,constructs:this.constructs,artboards:this.options.artboards.map(i=>({...i,imported:!0}))}}frameLeft(){return-this.toCanvas[4]}frameTop(){return-this.toCanvas[5]}renderNode(e,t){switch(e.kind){case"layer":return this.renderLayer(e);case"group":case"compound":case"clipgroup":return this.renderContainer(e,t);case"path":return this.renderPath(e);case"text":return this.renderText(e);case"image":return this.renderImage(e);case"placeholder":return this.count(e.construct),null}}count(e){this.constructs.set(e,(this.constructs.get(e)??0)+1)}renderLayer(e){let t=e.layer??{layerName:"",visible:!0,locked:!1,color:null,template:!1,printing:!0};if(!t.visible&&this.options.hiddenLayers==="skip")return null;let r=this.ids.unique(t.layerName||"Layer"),n=me("g",{id:r});this.options.layerTitles!==!1&&n.children.push(me("title",{},[hi(t.layerName||r)]));let i={name:t.layerName||r,visible:t.visible,locked:t.locked,color:t.color,children:[],origin:"source",svgIds:[r]};this.decorations[r]={layerName:i.name,hidden:!t.visible,locked:t.locked,inherit:t.locked},this.applyTransparency(n,e),this.counts.groups++;for(let a of VS(e.children)){if(a.kind==="layer"){let s=this.renderLayer(a);if(s){n.children.push(s);let l=this.layers.pop();l&&i.children.push(l)}continue}let o=this.renderNode(a,i);o&&n.children.push(o)}return this.layers.push(i),n}renderContainer(e,t){let r=[],n=e.kind==="clipgroup"?e.children.filter(o=>o.kind==="path"&&o.clip):[];for(let o of VS(e.children)){if(n.includes(o))continue;let s=this.renderNode(o,t);s&&r.push(s)}if(r.length===0&&n.length===0)return null;if(e.kind==="compound"&&r.length===1&&n.length===0&&!e.transparency){let o=r[0];return e.name&&!o.attrs.id&&(o.attrs.id=this.ids.unique(e.name)),e.locked&&o.attrs.id&&(this.decorations[o.attrs.id]={locked:!0}),o}let i={};e.name&&(i.id=this.ids.unique(e.name));let a=me("g",i,r);if(n.length>0){let o=`clip-${++this.clipCount}`,s=me("clipPath",{id:o});for(let l of n)s.children.push(me("path",{d:this.pathData(l.subpaths),...l.fillRule===1?{"clip-rule":"evenodd"}:{}}));this.defs.push(s),a.attrs["clip-path"]=`url(#${o})`}return this.applyTransparency(a,e),e.locked&&i.id&&(this.decorations[i.id]={locked:!0,inherit:!0}),this.counts.groups++,a}applyTransparency(e,t){let r=t.transparency;if(!r)return;r.opacity<1&&(e.attrs.opacity=ce(r.opacity,3));let n=LW[r.blendMode]??null;n&&(e.attrs.style=`mix-blend-mode:${n}`),r.blendMode!==0&&!n&&this.count("blend-mode-unsupported")}pathData(e){let t=this.options.precision,r=[];for(let n of e){let i=Jt(this.toCanvas,n.start);r.push(`M${ce(i[0],t)} ${ce(i[1],t)}`);for(let a of n.segments){let o=Jt(this.toCanvas,a.to);if(a.c1&&a.c2){let s=Jt(this.toCanvas,a.c1),l=Jt(this.toCanvas,a.c2);r.push(`C${ce(s[0],t)} ${ce(s[1],t)} ${ce(l[0],t)} ${ce(l[1],t)} ${ce(o[0],t)} ${ce(o[1],t)}`)}else r.push(`L${ce(o[0],t)} ${ce(o[1],t)}`)}n.closed&&r.push("Z")}return r.join("")}renderPath(e){if(!e.painted||e.subpaths.length===0||e.clip&&!e.fill&&!e.stroke)return null;let t={d:this.pathData(e.subpaths)};e.name&&(t.id=this.ids.unique(e.name));let r=e.fill?this.paintValue(e.fill,e,"fill"):"none";if(t.fill=r,e.fillRule===1&&e.fill&&(t["fill-rule"]="evenodd"),e.stroke){t.stroke=this.paintValue(e.stroke,e,"stroke");let i=e.strokeStyle;t["stroke-width"]=ce(i.width,this.options.precision),i.cap===1?t["stroke-linecap"]="round":i.cap===2&&(t["stroke-linecap"]="square"),i.join===1?t["stroke-linejoin"]="round":i.join===2&&(t["stroke-linejoin"]="bevel"),i.miterLimit!==4&&i.join===0&&(t["stroke-miterlimit"]=ce(i.miterLimit,3)),i.dash.length>0&&(t["stroke-dasharray"]=i.dash.map(a=>ce(a,this.options.precision)).join(" "),i.dashOffset&&(t["stroke-dashoffset"]=ce(i.dashOffset,this.options.precision)))}let n=me("path",t);return this.applyTransparency(n,e),e.locked&&t.id&&(this.decorations[t.id]={locked:!0}),this.counts.shapes++,n}paintValue(e,t,r){switch(e.kind){case"flat":return e.rgb;case"gradient":return this.gradientValue(e,t);case"pattern":return this.count("pattern"),"#808080"}}gradientValue(e,t){let r=e.definition;if(!r||r.stops.length===0)return this.count("gradient-missing"),"#808080";let n=`gradient-${++this.gradientCount}`,i=this.options.precision,a=r.stops.map(u=>me("stop",{offset:ce(Math.max(0,Math.min(1,u.offset)),4),"stop-color":u.rgb,...u.opacity<1?{"stop-opacity":ce(u.opacity,3)}:{}})),o=e.xm??e.bm;if(r.type==="radial"){if(o){let u=Lm(o,this.toCanvas),d={id:n,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:`matrix(${u.map(c=>ce(c,6)).join(" ")})`};if(e.highlight){let c=GW(o,e.highlight.origin);c&&(d.fx=ce(c[0],4),d.fy=ce(c[1],4))}this.defs.push(me("radialGradient",d,a))}else{let u=Jt(this.toCanvas,Jt(e.matrix??LS,e.origin)),d={id:n,cx:ce(u[0],i),cy:ce(u[1],i),r:ce(Math.abs(e.length)||1,i),gradientUnits:"userSpaceOnUse"};this.defs.push(me("radialGradient",d,a))}return`url(#${n})`}let s,l;if(o)s=Jt(this.toCanvas,Jt(o,[0,0])),l=Jt(this.toCanvas,Jt(o,[1,0]));else{let u=e.angle*Math.PI/180,d=e.matrix??LS;s=Jt(this.toCanvas,Jt(d,e.origin)),l=Jt(this.toCanvas,Jt(d,[e.origin[0]+Math.cos(u)*e.length,e.origin[1]+Math.sin(u)*e.length]))}return this.defs.push(me("linearGradient",{id:n,x1:ce(s[0],i),y1:ce(s[1],i),x2:ce(l[0],i),y2:ce(l[1],i),gradientUnits:"userSpaceOnUse"},a)),`url(#${n})`}renderText(e){if(e.story)return this.renderStoryText(e);if(e.runs.length===0)return null;let t=this.options.precision,r=this.mergeRuns(e.runs),n=r[0],i=n.font?bc(BS(n.font)):null,a=Jt(this.toCanvas,[n.matrix[4],n.matrix[5]]),o=n.matrix,s=[o[0],-o[1],-o[2],o[3],0,0],l={"font-size":ce(n.size,t),fill:n.fill&&n.fill.kind==="flat"?n.fill.rgb:n.fill?"#000000":"none"};i&&(l["font-family"]=xc(i),i.weight!==400&&(l["font-weight"]=String(i.weight)),i.style==="italic"&&(l["font-style"]="italic")),n.stroke&&n.stroke.kind==="flat"&&n.render>=1&&n.render<=2&&(l.stroke=n.stroke.rgb),n.horizontalScale!==100&&n.horizontalScale>0?(l.transform=`matrix(${ce(s[0]*(n.horizontalScale/100),4)} ${ce(s[1],4)} ${ce(s[2],4)} ${ce(s[3],4)} ${ce(a[0],t)} ${ce(a[1],t)})`,l.x="0",l.y="0"):Math.abs(s[0]-1)>1e-6||Math.abs(s[1])>1e-6||Math.abs(s[2])>1e-6||Math.abs(s[3]-1)>1e-6?(l.transform=`matrix(${ce(s[0],4)} ${ce(s[1],4)} ${ce(s[2],4)} ${ce(s[3],4)} ${ce(a[0],t)} ${ce(a[1],t)})`,l.x="0",l.y="0"):(l.x=ce(a[0],t),l.y=ce(a[1],t)),e.name&&(l.id=this.ids.unique(e.name));let u=me("text",l);if(r.length===1)u.children.push(hi(n.text));else for(let d of r){let c=Jt(this.toCanvas,[d.matrix[4],d.matrix[5]]),f=c[0]-a[0],p=c[1]-a[1];u.children.push(me("tspan",{x:ce(l.x==="0"?f:c[0],t),y:ce(l.x==="0"?p:c[1],t)},[hi(d.text)]))}return this.applyTransparency(u,e),e.locked&&l.id&&(this.decorations[l.id]={locked:!0}),this.counts.texts++,u}mergeRuns(e){let t=[];for(let r of e){let n=t[t.length-1];if(n&&Math.abs(n.matrix[5]-r.matrix[5])<1e-6&&n.font===r.font&&Math.abs(n.size-r.size)<1e-6&&n.matrix[0]===r.matrix[0]&&n.matrix[1]===r.matrix[1]){let i=n.text.length*n.size*.5,a=r.matrix[4]-(n.matrix[4]+i)>n.size*.35&&!n.text.endsWith(" ")&&!r.text.startsWith(" ")?" ":"";t[t.length-1]={...n,text:n.text+a+r.text};continue}t.push(r)}return t}storyGeometry(e){let t=e.story,r=this.options.textDocument,n=r?.stories??[],i=t?n[t.storyIndex]:void 0;if(!t||!r||!i||i.text.length===0)return null;let a=this.options.rulerOrigin??[0,0],o=i.frameResources[t.frameIndex]??i.frameResources[0],s=(o!==void 0?r.frames[o]:void 0)??null,l=i.layouts.find(u=>u.frameIndex===t.frameIndex)??i.layouts[t.frameIndex]??i.layouts[0]??null;return{storyData:i,frame:s,layout:l,toPath:(u,d)=>{let c=s?.matrix??[1,0,0,1,0,0],f=c[0]*u+c[2]*d+c[4],p=c[1]*u+c[3]*d+c[5];return[f-a[0],-(p-a[1])]}}}textBounds(e){let t=this.storyGeometry(e);if(!t)return null;let{frame:r,layout:n,toPath:i}=t,a=[];for(let u of n?.rows??[])a.push(i(u.bbox[0],u.bbox[1]),i(u.bbox[2],u.bbox[3])),a.push(i(u.bbox[0],u.bbox[3]),i(u.bbox[2],u.bbox[1]));if(a.length===0&&r&&n?.extent){let[u,d,c,f]=n.extent;a.push(i(u,d),i(c,f),i(u,f),i(c,d))}if(a.length===0)return null;let o=a.map(u=>Jt(this.toCanvas,u)),s=o.map(u=>u[0]),l=o.map(u=>u[1]);return[Math.min(...s),Math.min(...l),Math.max(...s),Math.max(...l)]}renderStoryText(e){let t=this.storyGeometry(e),r=this.options.textDocument;if(!t||!r)return this.count("text-story-unbound"),null;let{storyData:n,frame:i,layout:a,toPath:o}=t,s=this.options.precision,l=this.options.rulerOrigin??[0,0],u=n.runs[0],d=u?.size??(u?.leading?u.leading/1.2:12),c=u&&u.fontIndex!==null?r.fontNames[u.fontIndex]:void 0,f=c?bc(BS(c)):null,p={"font-size":ce(d,s),fill:"#000000"};f&&(p["font-family"]=xc(f),f.weight!==400&&(p["font-weight"]=String(f.weight)),f.style==="italic"&&(p["font-style"]="italic")),e.name&&(p.id=this.ids.unique(e.name));let h=[],m=a?.rows??[];if(m.length>0){let I=0,x=n.text;for(let k of m){let $=I+k.glyphCount,A=x.slice(I,$),S=A.indexOf("\r");S>=0?(A=A.slice(0,S),$=I+S+1):x[$]==="\r"&&$++,I=Math.min(x.length,$);let M=k.bbox[1]-k.ascent;h.push({text:A.replace(/\s+$/,""),at:o(k.bbox[0],M),local:[k.bbox[0],M]})}}else{let I=u?.leading??d*1.2,x=i?i.position:[0,0];n.paragraphs.forEach((k,$)=>{h.push({text:k,at:o(x[0],x[1]+d+I*$),local:[x[0],x[1]+d+I*$]})})}if(h.length===0)return this.count("text-story-unbound"),null;let g=i?.matrix??[1,0,0,1,0,0],v=Math.abs(g[0]-1)>1e-6||Math.abs(g[1])>1e-6||Math.abs(g[2])>1e-6||Math.abs(g[3]-1)>1e-6,b=me("text",p),y=h.map(I=>({text:I.text,at:I.local}));if(v){let I=[g[4]-l[0]-this.frameLeft(),g[5]-l[1]-this.frameTop()];if(p.transform=`matrix(${ce(g[0],6)} ${ce(g[1],6)} ${ce(g[2],6)} ${ce(g[3],6)} ${ce(I[0],s)} ${ce(I[1],s)})`,p.x=ce(y[0].at[0],s),p.y=ce(y[0].at[1],s),y.length===1)b.children.push(hi(y[0].text));else for(let x of y)b.children.push(me("tspan",{x:ce(x.at[0],s),y:ce(x.at[1],s)},[hi(x.text)]))}else{let I=Jt(this.toCanvas,h[0].at);if(p.x=ce(I[0],s),p.y=ce(I[1],s),h.length===1)b.children.push(hi(h[0].text));else for(let x of h){let k=Jt(this.toCanvas,x.at);b.children.push(me("tspan",{x:ce(k[0],s),y:ce(k[1],s)},[hi(x.text)]))}}return this.applyTransparency(b,e),e.locked&&p.id&&(this.decorations[p.id]={locked:!0}),this.counts.texts++,b}boundsOf(e){let t=1/0,r=1/0,n=-1/0,i=-1/0,a=o=>{let s=Jt(this.toCanvas,o);t=Math.min(t,s[0]),r=Math.min(r,s[1]),n=Math.max(n,s[0]),i=Math.max(i,s[1])};for(let o of e){a(o.start);for(let s of o.segments)s.c1&&a(s.c1),s.c2&&a(s.c2),a(s.to)}return[t,r,n,i]}renderImage(e){if(e.width<=0||e.height<=0)return null;if(!e.payload)return this.count(e.linked?"image-linked":"image-missing"),null;let t=this.options.precision,r=e.matrix,n=Lm([r[0],r[1],r[2],r[3],r[4],r[5]],this.toCanvas),i=Lm([1,0,0,-1,0,0],n),a={width:String(e.width),height:String(e.height),transform:`matrix(${i.map(s=>ce(s,6)).join(" ")})`,preserveAspectRatio:"none",href:""};e.name&&(a.id=this.ids.unique(e.name));let o=me("image",a);return this.applyTransparency(o,e),this.counts.images++,this.pending.push(FW(e).then(s=>{s?o.attrs.href=s:(this.count("image-undecodable"),o.attrs.href="")})),o}},LS=[1,0,0,1,0,0];function BS(e){let t=e.toLowerCase();return{name:e,type:"Type1",subtype:"Type1",bold:/bold|black|heavy|semibold|demibold/.test(t),italic:/italic|oblique/.test(t),black:/black|heavy/.test(t),serif:!1,monospace:/mono|courier/.test(t),symbolic:!1,missingFile:!0,isType3:!1,vertical:!1,composite:!1}}function GW(e,t){let r=e[0]*e[3]-e[1]*e[2];return Math.abs(r)<1e-12?null:[(e[3]*t[0]-e[2]*t[1])/r,(-e[1]*t[0]+e[0]*t[1])/r]}function VS(e){let t=[];for(let r of e){let n=t[t.length-1];if(r.kind==="text"&&!r.story&&n&&n.kind==="text"&&!n.story&&r.runs.length>0&&n.runs.length>0&&Math.abs(n.runs[n.runs.length-1].matrix[5]-r.runs[0].matrix[5])<1e-6&&n.runs[n.runs.length-1].font===r.runs[0].font&&Math.abs(n.runs[n.runs.length-1].size-r.runs[0].size)<1e-6){t[t.length-1]={...n,runs:[...n.runs,...r.runs]};continue}t.push(r)}return t}function WW(e){let t=e.indexOf("%AI11_BeginTextDocument");if(t<0)return null;let r=e.indexOf("%AI11_EndTextDocument",t),n=e.slice(t,r<0?e.length:r).split(/\r\n|\r|\n/),i=[];for(let s of n)!s.startsWith("%")||s.startsWith("%AI11")||s.startsWith("%_")||i.push(s.slice(1));if(i.length===0)return null;let a=Ym(KS(i.join(""))),o="";for(let s=0;s<a.length;s+=32768)o+=String.fromCharCode(...a.subarray(s,s+32768));return o}function XW(e){let t=f$(e);if(t.length>=2&&t[0]===254&&t[1]===255)return p$(t.subarray(2));let r="";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return r}function x$(e){let t=0,r=e.length,n=()=>{for(;t<r&&/\s/.test(e[t]);)t++};if(n(),e[t]==="/")return x$(`<< ${e.slice(t)} >>`);let i=()=>{if(n(),t>=r)return null;let a=e[t];if(a==="<"&&e[t+1]==="<"){t+=2;let u=new Map;for(;n(),!(t>=r);){if(e[t]===">"&&e[t+1]===">"){t+=2;break}if(e[t]!=="/"){if(!i())break;continue}t++;let d=t;for(;d<r&&!/[\s/(<>[\]]/.test(e[d]);)d++;let c=e.slice(t,d);t=d;let f=i();if(!f)break;u.set(c,f)}return{kind:"dict",entries:u}}if(a==="["){t++;let u=[];for(;n(),!(t>=r);){if(e[t]==="]"){t++;break}let d=i();if(!d)break;u.push(d)}return{kind:"array",items:u}}if(a==="("){let u=0,d=t;for(;d<r;d++){let f=e[d];if(f==="\\"){d++;continue}if(f==="(")u++;else if(f===")"&&(u--,u===0))break}let c=e.slice(t+1,d);return t=d+1,{kind:"string",text:XW(c)}}if(a==="/"){t++;let u=t;for(;u<r&&!/[\s/(<>[\]]/.test(e[u]);)u++;let d=e.slice(t,u);return t=u,{kind:"name",name:d}}if(a===">"||a==="]")return t++,i();let o=t;for(;o<r&&!/[\s/(<>[\]]/.test(e[o]);)o++;let s=e.slice(t,o);if(t=o,s==="true"||s==="false")return{kind:"bool",value:s==="true"};let l=Number(s);return s.length>0&&Number.isFinite(l)?{kind:"number",value:l}:s.length>0?{kind:"name",name:s}:null};return i()}function HW(e){return e&&e.kind==="dict"?e:void 0}function st(e,...t){let r=HW(e);if(r)for(let n of t){let i=r.entries.get(n);if(i!==void 0)return i}}function Wn(e,...t){let r=st(e,...t);return r&&r.kind==="number"?r.value:null}function Bl(e){return!e||e.kind!=="array"?[]:e.items.flatMap(t=>t.kind==="number"?[t.value]:[])}function w$(e,...t){let r=st(e,...t);return r&&r.kind==="string"?r.text:null}function eg(e){return e&&e.kind==="array"?e.items:[]}function Pc(e){let t=st(e,"99","StreamTag");return t&&t.kind==="name"?t.name:null}function Xi(e,t){if(e&&t(e)!==!0){if(e.kind==="dict")for(let r of e.entries.values())Xi(r,t);else if(e.kind==="array")for(let r of e.items)Xi(r,t)}}function qW(e){return eg(st(e,"0","RunArray")).flatMap(t=>{let r=Wn(t,"1","Length");if(r===null)return[];let n=st(t,"0","RunData"),i=st(n,"0","StyleSheet"),a=st(i,"Features");if(!a){let o=st(i,"6"),s=st(i,"5");a=o&&o.kind==="dict"?o:s&&s.kind==="dict"?s:void 0}return[{length:r,fontIndex:Wn(a,"0","Font")??0,size:Wn(a,"1","FontSize"),leading:Wn(a,"5","Leading"),horizontalScale:Wn(a,"6","HorizontalScale"),tracking:Wn(a,"8","Tracking")}]})}function YW(e,t,r){let n=w$(t,"0","Text");if(n===null)return null;let i=qW(st(t,"StyleRun")??st(t,"6")??st(t,"5")),a=i.map(c=>c.length),o=a.reduce((c,f)=>c+f,0);if(a.length===0||Math.abs(o-n.length)>1)return null;let s=n.replace(/\r\n|\r|\n/g,"\r").replace(/\r$/,""),l=st(e,"1","View"),u=eg(st(l,"0","Frames")).flatMap(c=>{let f=Wn(c,"0","Resource");return f===null?[]:[f]}),d=st(l,"2","Strikes");return{index:r,text:s,paragraphs:s.split("\r"),runLengths:a,runs:i,frameResources:u,layouts:d?I$(d):[]}}function KW(e){let t=[];return Xi(e,r=>{if(r.kind!=="dict")return;let n=st(r,"0"),i=st(r,"Model")??(n&&n.kind==="dict"?n:r),a=YW(r,i,t.length);if(a)return t.push(a),!0}),t}function ZW(e){let t=[];return Xi(e,r=>{if(r.kind!=="dict"||Pc(r)!=="CoolTypeFont")return;let n=st(r,"0","Identifier"),i=w$(n,"0","Name");return i!==null&&t.push(i),!0}),t}function JW(e){let t=[];return Xi(e,r=>{if(r.kind!=="dict")return;let n=st(r,"97","UUID"),i=st(r,"0","Bezier"),a=st(st(r,"1"),"0"),o=Bl(i&&i.kind==="dict"?st(i,"Points"):i??a),s=st(r,"2","Data");if(!n||n.kind!=="string"||o.length<2||!s||s.kind!=="dict")return;let l=Bl(st(s,"2","FrameMatrix"));return t.push({index:t.length,position:[o[0],o[1]],matrix:l.length===6?[l[0],l[1],l[2],l[3],l[4],l[5]]:[1,0,0,1,0,0]}),!0}),t}function QW(e){let t=[];return Xi(e,r=>{if(r.kind!=="dict")return;let n=Pc(r);if(n!=="LineStrike"&&n!=="L")return;let i=Wn(r,"14","SelectionAscent")??0,a=Wn(r,"15","SelectionDescent")??0,o=0,s=null;return Xi(r,l=>{if(l.kind!=="dict")return;let u=Pc(l);if(u!=="GlyphStrike"&&u!=="G")return;o+=eg(st(l,"5","Glyphs")).length;let d=Bl(st(l,"8","VisualBounds"));return d.length===4&&(s=s?[Math.min(s[0],d[0]),Math.min(s[1],d[1]),Math.max(s[2],d[2]),Math.max(s[3],d[3])]:[d[0],d[1],d[2],d[3]]),!0}),s&&t.push({bbox:s,ascent:i,descent:a,glyphCount:o}),!0}),t}function I$(e){let t=[];return Xi(e,r=>{if(r.kind!=="dict")return;let n=Pc(r);if(n!=="FrameStrike"&&n!=="F")return;let i=st(r,"0","Transform"),a=Bl(st(i,"0","Origin")),o=Bl(st(r,"1","Bounds"));return t.push({frameIndex:Wn(r,"10","Frame")??t.length,position:a.length===2?[a[0],a[1]]:[0,0],extent:o.length===4?[o[0],o[1],o[2],o[3]]:null,rows:QW(r)}),!0}),t}function k$(e){let t=WW(e);if(t===null)return null;let r=x$(t);return{root:r,stories:KW(r),fontNames:ZW(r),frames:JW(r),layouts:I$(r)}}var eX={pattern:{code:"construct-approximated",message:"A pattern fill was painted as a flat gray; patterns have no PDF rendition to copy in this file."},"gradient-missing":{code:"construct-approximated",message:"A gradient referenced a definition the file does not carry; a flat gray was used."},"blend-mode-unsupported":{code:"construct-approximated",message:"A blend mode has no CSS equivalent; normal blending is used."},"text-story-unbound":{code:"construct-dropped",message:"A text object could not be matched to its story in the text document."},"image-linked":{code:"construct-dropped",message:"A linked image is not embedded in the file and was left out."},"image-missing":{code:"construct-dropped",message:"An image carried no pixel data and was left out."},"image-undecodable":{code:"construct-dropped",message:"An image payload could not be decoded and was left out."}};function tX(e,t){if(t.artboards.length>0)return[...t.artboards];if(e.artboards.length>0)return[...e.artboards];let r=e.header.hiResBoundingBox??e.header.boundingBox;if(!r)return[];let n=Hm(r);return[{index:1,name:"Artwork",defaultName:!0,canvas:n,width:n[2]-n[0],height:n[3]-n[1],origin:"cropmarks",page:null}]}async function rX(e,t,r,n,i){let a=Date.now(),o=new Hi;o.addAll(t.diagnostics);let s=v$(r.source,{diagnostics:o}),l=k$(r.source),u=Jm(r.source),d=((u?.canvasSize??16383)+.5)/2-.25,c=t.artboards[0],f=u?.artboards[0]?.rulerOrigin??(c?[Math.floor(d-c.width/2),Math.floor(d-c.height/2)]:null),p=tX(r,t),h=new Set(n.artboards&&n.artboards!=="all"?n.artboards:p.map(x=>x.index)),m=await UW(s,{artboards:p.filter(x=>h.has(x.index)),textMode:n.textMode??"editable",hiddenLayers:n.hiddenLayers??"import-hidden",precision:n.precision??3,title:r.header.title,layerTitles:n.layerTitles??!0,textDocument:l,rulerOrigin:f});for(let[x,k]of m.constructs){let $=eX[x];o.add({code:$?.code??"construct-dropped",severity:"warning",message:$?.message??`An Illustrator construct (${x}) was dropped.`,name:x,count:k})}for(let[x,k]of s.unknownOperators)o.add({code:"source-operand-mismatch",severity:"info",message:`The source uses the ${x} operator, which the importer does not model.`,name:x,count:k});s.patterns.size>0&&o.add({code:"construct-approximated",severity:"warning",message:"Pattern swatches are painted flat; the file has no PDF rendition to copy them from.",name:[...s.patterns].join(", "),count:s.patterns.size});let g=x=>x.flatMap(k=>[k,...g(k.children)]),v=g(m.layers),b=o.list(),y=g$(b),I=Date.now()-a;return{svg:m.svg,tree:m.tree,decorations:m.decorations,inspection:t,source:{kind:"illustrator",container:t.kind==="not-illustrator"?"pdf-foreign":t.kind,fileName:n.fileName,byteLength:e.length,creatorVersion:t.creatorVersion??void 0},artboards:p.map(x=>({...x,imported:h.has(x.index)})),layers:m.layers,fonts:[],items:y,counts:{shapes:m.counts.shapes,groups:m.counts.groups,layers:v.length,hiddenLayers:v.filter(x=>!x.visible).length,lockedLayers:v.filter(x=>x.locked).length,textEditable:m.counts.texts,textOutlined:m.counts.textOutlined,imagesEmbedded:m.counts.images,rasterizedRegions:0},colorMode:{source:r.header.colorModel==="cmyk"?"CMYK":r.header.colorModel==="rgb"?"RGB":r.header.colorModel==="grayscale"?"Grayscale":"unknown",converted:r.header.colorModel==="cmyk",method:"device"},textMode:(n.textMode??"editable")==="outline"?"outlines":"editable",timings:{parseMs:i,transcodeMs:I},diagnostics:{illustrator:b,pdf:[]},pdf:null,reconciliation:null}}var nX=64,iX=4e6,aX=.9,US=.9,oX=.5,sX=2,lX=.6,uX=4;function Dc(e,t){return[e[0]*t[0]+e[2]*t[1]+e[4],e[1]*t[0]+e[3]*t[1]+e[5]]}function Cc(e,t){let r=1/0,n=1/0,i=-1/0,a=-1/0,o=s=>{let l=Dc(t,s);r=Math.min(r,l[0]),n=Math.min(n,l[1]),i=Math.max(i,l[0]),a=Math.max(a,l[1])};for(let s of e){o(s.start);for(let l of s.segments)l.c1&&o(l.c1),l.c2&&o(l.c2),o(l.to)}return Number.isFinite(r)?[r,n,i,a]:null}function dX(e,t){let r=e.matrix,n=[[0,0],[e.width,0],[0,-e.height],[e.width,-e.height]].map(o=>Dc(t,Dc(r,o))),i=n.map(o=>o[0]),a=n.map(o=>o[1]);return[Math.min(...i),Math.min(...a),Math.max(...i),Math.max(...a)]}function cX(e,t,r){switch(e.kind){case"path":return Cc(e.subpaths,t);case"image":return dX(e,t);case"text":if(e.story)return r?.(e)??(e.frame?Cc(e.frame.subpaths,t):null);if(e.frame)return Cc(e.frame.subpaths,t);if(e.runs.length>0){let n=e.runs[0],i=Dc(t,[n.matrix[4],n.matrix[5]]),a=e.runs.reduce((o,s)=>o+s.text.length*s.size*.55,0);return[i[0],i[1]-n.size,i[0]+a,i[1]+n.size*.3]}return null;default:return null}}function S$(e){return Math.max(0,e[2]-e[0])*Math.max(0,e[3]-e[1])}function fX(e,t){let r=e[2]-e[0],n=e[3]-e[1],i=t[2]-t[0],a=t[3]-t[1],o=Math.max(r,n,i,a,1),s=Math.hypot((e[0]+e[2])/2-(t[0]+t[2])/2,(e[1]+e[3])/2-(t[1]+t[3])/2),l=Math.abs(r-i)+Math.abs(n-a);return 1-Math.min(1,(s+l/2)/o)}function ss(e,t){let r=Math.max(0,Math.min(e[2],t[2])-Math.max(e[0],t[0])),n=Math.max(0,Math.min(e[3],t[3])-Math.max(e[1],t[1]));return r*n/Math.max(1e-6,S$(t))}function pX(e,t,r){let n=(t[0]+t[2])/2,i=(t[1]+t[3])/2;return n>=e[0]-r&&n<=e[2]+r&&i>=e[1]-r&&i<=e[3]+r}function hX(e){return Math.max(2,(e[3]-e[1])*.25)}function tg(e){return[Math.min(...e.map(t=>t[0])),Math.min(...e.map(t=>t[1])),Math.max(...e.map(t=>t[2])),Math.max(...e.map(t=>t[3]))]}function mX(e,t){return e.node.kind==="path"||e.node.kind==="compound"?t.kinds.has("path")||t.kinds.has("shading"):e.node.kind==="image"?t.kinds.has("image"):!1}function gX(e){let t=e.clipBounds;if(!t)return e.bbox;let r=[Math.max(e.bbox[0],t[0]),Math.max(e.bbox[1],t[1]),Math.min(e.bbox[2],t[2]),Math.min(e.bbox[3],t[3])];return r[2]>r[0]&&r[3]>r[1]?r:null}function GS(e){return e.node.kind==="text"?e.node.story?.storyIndex??null:null}function $$(e,t){let r=[],n=(a,o,s)=>{r.push({node:a,containers:o,bbox:s,order:r.length,aligned:!1,replaced:!1,failed:!1})},i=(a,o)=>{if(a.kind==="compound"){let s=[],l=!1,u=d=>{if(d.kind==="path"){if(!d.painted||d.clip)return;l=!0;let c=Cc(d.subpaths,t.toCanvas);c&&s.push(c)}else if("children"in d)for(let c of d.children)u(c)};u(a),l&&n(a,o,s.length>0?tg(s):null);return}if(a.kind==="layer"||a.kind==="group"||a.kind==="clipgroup"){let s=a===e?o:[...o,a];for(let l of a.children)i(l,s);return}a.kind!=="placeholder"&&(a.kind==="path"&&(!a.painted||a.clip)||n(a,o,cX(a,t.toCanvas,t.textBounds)))};return i(e,[]),r}function N$(e,t){if(e.attrs.id===t)return e;for(let r of e.children){if(Ye(r))continue;let n=N$(r,t);if(n)return n}return null}function M$(e,t){let r=[];for(let n of e.children){if(Ye(n)||n.tag==="title")continue;let i=t.get(n)??null,a=new Set,o=[],s=l=>{let u=t.get(l);if(u){a.add(u.kind);let d=gX(u);d&&o.push(d)}for(let d of l.children)Ye(d)||s(d)};s(n),r.push({node:n,atom:i,bbox:o.length>0?tg(o):null,kinds:a,anchor:null,owners:[]})}return r}function A$(e,t){let r=e.filter(i=>i.node.kind==="text"&&i.bbox!==null);if(r.length===0)return;for(let i of t){if(!i.atom||i.atom.kind!=="text"||!i.bbox)continue;let a=i.bbox,o=null,s=1/0;for(let u of r){let d=u.bbox;if(!pX(d,a,hX(d)))continue;let c=S$(d);c<s&&(o=u,s=c)}if(!o)continue;i.anchor=o,o.aligned=!0;let l=[o];if(ss(o.bbox,a)<US){let u=GS(o),d=u===null?[]:r.filter(c=>c!==o&&GS(c)===u&&ss(c.bbox,a)>0);l=[o,...d].sort((c,f)=>c.order-f.order),ss(tg(l.map(c=>c.bbox)),a)<US&&(l=ss(o.bbox,a)>=oX?[o]:[])}i.owners=l;for(let u of l)u.aligned=!0}let n=new Map;for(let i of t)if(i.atom?.text)for(let a of i.owners){let o=n.get(a)??[];o.push(i.atom.text.unicode.replace(/\s+/g,"").length),n.set(a,o)}for(let[i,a]of n)a.length<uX||a.filter(o=>o<=sX).length/a.length>=lX&&(i.failed=!0)}function C$(e,t){let r=e.length*t.length<=iX,n=0;for(let i of e){if(i.node.kind==="text"||!i.bbox)continue;let a=i.bbox,o=-1,s=aX,l=c=>{let f=t[c];if(f.anchor||!f.bbox||!mX(i,f))return!1;let p=fX(a,f.bbox);return p>s?(o=c,s=p,p>.995):!1},u=Math.min(t.length,n+nX),d=!1;for(let c=n;c<u&&!d;c++)d=l(c);if(o<0&&r){for(let c=u;c<t.length&&!d;c++)d=l(c);for(let c=n-1;c>=0&&!d;c--)d=l(c)}o<0||(t[o].anchor=i,i.aligned=!0,n=o+1)}}function yX(e,t){let r=e[t].anchor;if(r)return r.containers;let n=t-1;for(;n>=0&&!e[n].anchor;)n--;let i=t+1;for(;i<e.length&&!e[i].anchor;)i++;let a=n>=0?e[n].anchor:null,o=i<e.length?e[i].anchor:null;if(a&&o&&vX(a.containers,o.containers))return a.containers;let s=e[t].bbox;if(s){let l=a?.bbox?ss(a.bbox,s):0,u=o?.bbox?ss(o.bbox,s):0;if(l>=.5&&l>=u)return a.containers;if(u>=.5)return o.containers}return a&&o?a.containers.slice(0,O$(a.containers,o.containers)):[]}function vX(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function O$(e,t){let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];)r++;return r}function bX(e,t,r){let n=[];for(let i of e){let a=r(i.node);if(!a||a.tag!=="text")return null;t&&(a.attrs.fill=t),n.push(a)}return n}function xX(e,t,r,n){let i={},a=[],o=[],s=new Map(e.atoms.map(A=>[A.node,A])),l=new Set,u=A=>{A.attrs.id&&l.add(A.attrs.id);for(let S of A.children)Ye(S)||u(S)};u(e.tree);let d=A=>{let S=fn(A)||"group",M=S,T=2;for(;l.has(M);)M=`${S}_${T++}`;return l.add(M),M},c=n.minimumMatchRatio??.5,f=0,p=0,h=0,m=0,g=t.roots.filter(A=>A.kind==="layer"),v=(A,S)=>({name:A.layer?.layerName??"",visible:A.layer?.visible??!0,locked:A.layer?.locked??!1,color:A.layer?.color??null,children:A.children.filter(M=>M.kind==="layer").map(M=>v(M,[])),origin:"source",svgIds:S}),b=r.matches.filter(A=>A.native),y=new Set,I=A=>{let S=A.layer?.layerName??"",M=b.find(T=>!y.has(T)&&T.native?.name===S)??null;return M&&y.add(M),M},x=[],k=[],$=r.structure==="flat"&&g.length>1?wX(e,g,s,n,d):null;for(let A of g){let S=I(A),M=$?.get(A)??null,T=M?[M]:(S?.svgIds??[]).map(U=>N$(e.tree,U)).filter(U=>U!==null);if(T.length===0){x.push(null),a.push(v(A,[]));continue}x.push(T[0]);let E=$$(A,n);f+=E.length;let C=v(A,M?[M.attrs.id]:S?.svgIds??[]);M&&(i[M.attrs.id]={layerName:A.layer?.layerName||M.attrs.id,hidden:!(A.layer?.visible??!0),locked:A.layer?.locked??!1,inherit:A.layer?.locked??!1});let O=new Map,z=T.map(U=>M$(U,s));for(let U of z)A$(E,U),C$(E,U);let R=E.filter(U=>U.aligned).length;if(p+=R,E.length>0&&R/E.length<c){o.push(A.layer?.layerName??""),a.push(C);continue}T.forEach((U,V)=>{let Y=z[V],G=[],H=[],X=U.children.filter(W=>!Ye(W)&&W.tag==="title"),B=W=>{(H.length>0?H[H.length-1].node.children:G).push(W)},ae=W=>{let J=W.kind==="layer",Q=O.get(W);if(Q){Q=d(J?W.layer?.layerName||"Sublayer":W.name||"group");let Ae=i[O.get(W)];Ae&&(i[Q]=Ae)}else if(Q=d(J?W.layer?.layerName||"Sublayer":W.name||"group"),O.set(W,Q),J){m++,i[Q]={layerName:W.layer?.layerName||Q,hidden:!(W.layer?.visible??!0),locked:W.layer?.locked??!1,inherit:W.layer?.locked??!1};let Ae=kX(C,W);Ae&&(Ae.svgIds=[...Ae.svgIds,Q])}else{let Ae={...W.name?{layerName:W.name}:{},...W.locked?{locked:!0,inherit:!0}:{}};Object.keys(Ae).length>0&&(i[Q]=Ae)}let Z=me("g",{id:Q});J&&n.layerTitles!==!1&&Z.children.push(me("title",{},[{text:W.layer?.layerName??Q}])),B(Z),H.push({container:W,node:Z})},K=[];for(let W=0;W<Y.length;W++){let J=Y[W];if(J.owners.length>0&&J.owners.every(Ie=>Ie.replaced))continue;let Q=yX(Y,W),Z=O$(K,Q);for(;H.length>Z;)H.pop();for(let Ie=Z;Ie<Q.length;Ie++)ae(Q[Ie]);if(K=Q,J.owners.length>0&&J.owners.every(Ie=>!Ie.replaced&&!Ie.failed)){let Ie=bX(J.owners,J.node.attrs.fill,n.renderNode);if(Ie){for(let Xe of Ie)B(Xe);for(let Xe of J.owners)Xe.replaced=!0;h+=J.owners.length;continue}for(let Xe of J.owners)Xe.failed=!0}B(J.node);let Ae=J.anchor?.node.name;if(Ae&&J.atom&&!J.node.attrs.id){let Ie=d(Ae);J.node.attrs.id=Ie,i[Ie]={layerName:Ae}}}U.children=[...X,...G]}),a.push(C)}return IX(e.tree,g,x,a,i,d,v,n,k),{decorations:i,layers:a,stats:{leaves:f,matched:p,textReplaced:h,degradedLayers:o,sublayers:m,sourceRenderedLayers:k}}}var WS=new Set(["defs","title","desc","metadata","view","style"]);function wX(e,t,r,n,i){let a=e.tree,o=a.children.filter(v=>!Ye(v)&&!WS.has(v.tag)),s=o.length===1&&o[0].tag==="g"&&!o[0].attrs.id?o[0]:a,l=M$(s,r).filter(v=>!WS.has(v.node.tag)),u=new Map;t.forEach((v,b)=>{let y=$$(v,n);for(let I of y)u.set(I,b);A$(y,l),C$(y,l)});let d=l.map(v=>v.anchor?u.get(v.anchor)??-1:-1);for(let v=0;v<l.length;v++){if(d[v]>=0)continue;let b=v-1;for(;b>=0&&d[b]<0;)b--;let y=v+1;for(;y<l.length&&d[y]<0;)y++;d[v]=b>=0?d[b]:y<l.length?d[y]:0}let c=new Map,f=[];t.forEach((v,b)=>{let y=l.filter((k,$)=>d[$]===b);if(y.length===0)return;let I=v.layer?.layerName||"Layer",x=me("g",{id:i(I)},n.layerTitles!==!1?[me("title",{},[{text:I}])]:[]);x.children.push(...y.map(k=>k.node)),c.set(v,x),f.push(x)});let p=new Set(l.map(v=>v.node)),h=s.children.filter(v=>Ye(v)||!p.has(v)),m=s.children.findIndex(v=>!Ye(v)&&p.has(v)),g=m<0?h.length:h.findIndex(v=>v===s.children[m-1])+1;return h.splice(Math.max(0,Math.min(h.length,m<0?h.length:g)),0,...f),s.children=h,c}function IX(e,t,r,n,i,a,o,s,l){let u=new Map,d=p=>{for(let h of p.children)Ye(h)||(u.set(h,p),d(h))};d(e);let c=r.find(p=>p!==null)??null,f=c?u.get(c)??e:e;t.forEach((p,h)=>{if(r[h])return;let m=!(p.layer?.visible??!0);if(m&&s.hiddenLayers==="skip")return;let g=p.layer?.layerName||"Layer",v=a(g),b=me("g",{id:v},s.layerTitles!==!1?[me("title",{},[{text:g}])]:[]),y=p.children.map(k=>s.renderNode(k)).filter(k=>k!==null);b.children.push(...y),y.some(T$)&&l.push(g);let I=null;for(let k=h-1;k>=0&&!I;k--)I=r[k];let x=null;for(let k=h+1;k<r.length&&!x;k++)x=r[k];if(I){let k=u.get(I)??f;k.children.splice(k.children.indexOf(I)+1,0,b),u.set(b,k)}else if(x){let k=u.get(x)??f;k.children.splice(k.children.indexOf(x),0,b),u.set(b,k)}else f.children.push(b),u.set(b,f);r[h]=b,i[v]={layerName:g,hidden:m,locked:p.layer?.locked??!1,inherit:p.layer?.locked??!1},n[h]=o(p,[v])})}function T$(e){return e.tag==="path"||e.tag==="text"||e.tag==="image"||e.tag==="use"?!0:e.children.some(t=>!Ye(t)&&T$(t))}function kX(e,t){let r=t.layer?.layerName??"",n=i=>{for(let a of i.children){if(a.name===r&&a.svgIds.length===0)return a;let o=n(a);if(o)return o}return null};return n(e)}var XS=new Set(["defs","title","desc","metadata","view","style"]);function P$(e,t){e.attrs.id&&t.add(e.attrs.id);for(let r of e.children)Ye(r)||P$(r,t)}function HS(e,t){let r=fn(e)||"Layer",n=2;for(;t.has(r);)r=`${fn(e)||"Layer"}_${n++}`;return t.add(r),r}function D$(e){let t=[];for(let r of e)r.id.startsWith("label:")?t.push(...D$(r.children)):t.push(r);return t}function j$(e,t){for(let r of e.children)Ye(r)||(r.tag==="g"&&r.attrs["data-pdf-layer"]!==void 0&&t.push(r),j$(r,t))}function SX(e,t){return e?{layerName:e.name,hidden:!e.visible,locked:e.locked,inherit:e.locked}:{...t?.name?{layerName:t.name}:{},hidden:t?!t.visible:!1}}function $X(e,t){let r=e.children.find(n=>!Ye(n)&&n.tag==="title");r?r.children=[qm(t)]:e.children.unshift(me("title",{},[qm(t)]))}function qS(e){return new Set(e).size===e.length}function NX(e,t,r,n={}){let i=n.layerTitles??!0,a=new Set;P$(r,a);let o=D$(t).filter(p=>p.svgIds.length>0),s=[],l="flat",u=[];if(o.length>0){l="optional-content";let p=[...o].reverse(),h=e.map(b=>b.name),m=p.map(b=>b.name??""),g=e.length>0&&qS(h)&&qS(m)&&h.every(b=>m.includes(b)),v=new Set;if(g)for(let b of e){let y=p.find(I=>I.name===b.name);v.add(y),s.push({native:b,pdf:y,svgIds:y.svgIds})}else if(e.length===p.length)e.forEach((b,y)=>{v.add(p[y]),s.push({native:b,pdf:p[y],svgIds:p[y].svgIds})});else for(let b of e){let y=p.find(I=>!v.has(I)&&I.name===b.name);y?(v.add(y),s.push({native:b,pdf:y,svgIds:y.svgIds})):u.push(b)}for(let b of p)v.has(b)||s.push({native:null,pdf:b,svgIds:b.svgIds})}else{let p=[];if(j$(r,p),p.sort((h,m)=>Number(h.attrs["data-pdf-layer"])-Number(m.attrs["data-pdf-layer"])),p.length>0)l="marked-content",p.forEach((h,m)=>{let g=e.length===p.length?e[m]:e[m]??null;delete h.attrs["data-pdf-layer"];let v=g?.name??`Layer ${m+1}`;h.attrs.id||(h.attrs.id=HS(v,a)),i&&$X(h,v),s.push({native:g,pdf:null,svgIds:[h.attrs.id]})}),e.length>p.length&&u.push(...e.slice(p.length));else if(e.length===1){l="single-layer";let h=r.children.filter(b=>!Ye(b)&&!XS.has(b.tag)),m=e[0],g=HS(m.name,a),v=me("g",{id:g},[...i?[me("title",{},[qm(m.name)])]:[],...h]);r.children=[...r.children.filter(b=>Ye(b)||XS.has(b.tag)),v],s.push({native:m,pdf:null,svgIds:[g]})}else u.push(...e)}let d={};for(let p of s){let h=SX(p.native,p.pdf);for(let m of p.svgIds)d[m]=h}let c=(p,h)=>({name:p.name,visible:p.visible,locked:p.locked,color:p.color,children:p.children.map(m=>c(m,[])),origin:"source",svgIds:h}),f=[];for(let p of e){let h=s.find(m=>m.native===p);f.push(c(p,h?.svgIds??[]))}for(let p of s)p.native===null&&p.pdf&&f.push({name:p.pdf.name??"",visible:p.pdf.visible,locked:!1,color:null,children:[],origin:"pdf",svgIds:p.svgIds});return{structure:l,matches:s,decorations:d,layers:f,unmatchedNative:u}}function qm(e){return{text:e}}var ls=class extends Error{code;container;constructor(e,t,r){super(r),this.name="IllustratorImportError",this.code=e,this.container=t}};function MX(e,t){if(!t||t==="all")return new Set(e.map(n=>n.index));let r=new Set;for(let n of t)e.some(i=>i.index===n)&&r.add(n);return r}function AX(e,t,r,n){return{source:e.colorModel==="cmyk"?"CMYK":e.colorModel==="rgb"?"RGB":e.colorModel==="grayscale"?"Grayscale":t?.diagnostics.some(i=>i.code==="cmyk-converted")?"CMYK":"unknown",converted:r,method:n}}function CX(e,t,r){let n=new Set,i=a=>{a.attrs.id&&n.add(a.attrs.id);for(let o of a.children)Ye(o)||i(o)};i(e);for(let a of t.pages){if(!a.viewId)continue;let o=r.find(c=>c.page===a.index);if(!o)continue;let s=e.children.find(c=>!Ye(c)&&c.tag==="view"&&c.attrs.id===a.viewId);if(!s)continue;n.delete(s.attrs.id);let l=fn(o.name)||`Artboard_${o.index}`,u=2;for(;n.has(l);)l=`${fn(o.name)||"Artboard"}_${u++}`;n.add(l),s.attrs.id=l;let d=s.children.find(c=>!Ye(c)&&c.tag==="title");d?d.children=[YS(o.name)]:s.children.unshift(me("title",{},[YS(o.name)]))}}function El(){return Date.now()}function E$(e){return e.reduce((t,r)=>t+(r.svgIds.length>0?1:0)+E$(r.children),0)}async function z$(e,t){let r=El(),{inspection:n,parsed:i}=yW(e),a=n.kind,o=a==="not-illustrator"?"not-illustrator":a;if(a==="not-illustrator")throw new ls("not-illustrator",o,"The file is neither an Illustrator document nor a PDF.");if(n.encrypted)throw new ls("encrypted",o,"The document is encrypted.");if(a==="pdf-private-only"||a==="postscript-legacy"||a==="postscript-eps"){if(!i)throw new ls("native-source-required",o,"The file has no PDF rendition and its Illustrator source could not be read.");return rX(e,n,i,t,El()-r)}let s=new Hi;s.addAll(n.diagnostics);let l=El()-r,u=MX(n.artboards,t.artboards);if(u.size===0)throw new ls("no-artboards-selected",o,"No artboard was selected for import.");let d=n.artboards.filter(O=>u.has(O.index)&&O.page!==null).map(O=>O.page),c=n.artboards.filter(O=>O.origin==="artboard-record"&&O.page!==null).map(O=>({page:O.page,canvas:O.canvas})),f=El(),p=await IS(e,{runtime:t.runtime,pages:d.length>0?d:"all",textMode:t.textMode??"editable",hiddenLayers:t.hiddenLayers??"import-hidden",layerTitles:t.layerTitles??!0,pagePlacements:c,colorManagement:t.colorManagement??"device",precision:t.precision,idPrefix:a==="pdf-foreign"?"pdf":"ai",fontMap:t.fontMap,signal:t.signal,onProgress:t.onProgress}),h=El()-f,m=i?.layers??[],g=t.layerTitles??!0,v=NX(m,p.layers,p.tree,{layerTitles:g}),b=v.decorations,y=v.layers,I=null;if(i&&a==="pdf-compatible"){let O=v$(i.source,{diagnostics:s}),z=k$(i.source),R=Jm(i.source),U=n.artboards[0],V=((R?.canvasSize??16383)+.5)/2-.25,Y=R?.artboards[0]?.rulerOrigin??(U?[Math.floor(V-U.width/2),Math.floor(V-U.height/2)]:null),G=n.artboards.map(B=>{let ae=p.pages.find(K=>K.index===B.page);return ae?{...B,canvas:ae.box.canvas}:B}),H=VW(O,{artboards:G,textMode:t.textMode??"editable",hiddenLayers:t.hiddenLayers??"import-hidden",precision:t.precision??3,title:null,layerTitles:g,textDocument:z,rulerOrigin:Y});I=xX(p,O,v,{renderNode:H.renderNode,textBounds:H.textBounds,toCanvas:H.toCanvas,hiddenLayers:t.hiddenLayers??"import-hidden",layerTitles:g}),b={...v.decorations,...I.decorations};let X=new Set(I.layers.map(B=>B.name));y=[...I.layers,...v.layers.filter(B=>!X.has(B.name))];for(let B of I.stats.degradedLayers)s.add({code:"structure-degraded",severity:"warning",message:"Fewer than half of a layer's objects aligned with the PDF rendition, so the layer keeps the PDF structure.",name:B});for(let B of I.stats.sourceRenderedLayers)s.add({code:"layer-source-rendered",severity:"info",message:"The PDF rendition has nothing for this layer, so its art was drawn from the Illustrator source; live effects on it are not shown.",name:B})}if(!I)for(let O of v.unmatchedNative)s.add({code:"layer-unmatched",severity:"warning",message:"A layer of the Illustrator document has no matching group in its PDF rendition; its objects keep the PDF structure.",name:O.name});CX(p.tree,p,n.artboards);let x=ns(p.tree),k=SW(p.tree),$=O=>O.flatMap(z=>[z,...$(z.children)]),A=$(m),S=p.diagnostics.filter(O=>O.code==="mesh-rasterized"||O.code==="radial-gradient-rasterized").reduce((O,z)=>O+z.count,0),M=[...wW(p.diagnostics),...g$(s.list())],T=p.diagnostics.some(O=>O.code==="cmyk-converted"||O.code==="spot-color-flattened"),E=p.diagnostics,C=s.list();return{svg:x,tree:p.tree,decorations:b,inspection:n,source:{kind:a==="pdf-foreign"?"pdf":"illustrator",container:a,fileName:t.fileName,byteLength:e.length,producer:p.info.producer??void 0,creatorVersion:n.creatorVersion??void 0},artboards:n.artboards.map(O=>{let z=p.pages.find(U=>U.index===O.page),R=z?z.box.canvas:O.canvas;return{...O,canvas:R,width:R[2]-R[0],height:R[3]-R[1],imported:u.has(O.index)}}),layers:y,fonts:IW(p.fonts),items:M,counts:{shapes:k.shapes,groups:k.groups,layers:E$(y),hiddenLayers:A.filter(O=>!O.visible).length,lockedLayers:A.filter(O=>O.locked).length,textEditable:k.texts,textOutlined:p.stats.textsOutlined,imagesEmbedded:k.images,rasterizedRegions:S},colorMode:AX(n,p,T,t.colorManagement??"device"),textMode:(t.textMode??"editable")==="outline"?"outlines":"editable",timings:{parseMs:l,transcodeMs:h},diagnostics:{illustrator:C,pdf:E},pdf:p,reconciliation:I?I.stats:null}}function YS(e){return{text:e}}function Rc(e){return e.endsWith("/")?e:`${e}/`}import{createRequire as OX}from"module";import*as ds from"path";import{pathToFileURL as TX}from"url";function R$(){let e=OX(import.meta.url);return ds.dirname(e.resolve("pdfjs-dist/package.json"))}function _$(e={}){let t=null,r=()=>(e.assetDir??R$()).split(ds.sep).join("/");return{env:"node",load(){return t||(t=e.loadModule?e.loadModule():import(TX(ds.join(R$(),"legacy/build/pdf.mjs")).href)),t},documentParams(){let n=r();return{cMapUrl:Rc(`${n}/cmaps`),cMapPacked:!0,standardFontDataUrl:Rc(`${n}/standard_fonts`),wasmUrl:Rc(`${n}/wasm`)}},supportsIcc(){return!1}}}function jX(e){if(e==="smil"||e==="css"||e==="waapi")return e;throw new Vl(`Unknown variant transition target "${e}". Expected smil, css or waapi.`)}var Hn=new PX,EX=DX(import.meta.url)("../package.json").version;Hn.name("svgsketch").description("CLI for importing SVG, Illustrator and PDF files and working with SVGSketch .svgs documents").version(EX);async function Wl(e,t=".svgs"){let r=Ra(e),n=V$(r).toLowerCase();n!==t&&console.error(`\u26A0 Warning: expected a ${t} file but got "${n||"(no extension)"}"`);try{await B$(r)}catch{return console.error(`\u2717 File not found: ${r}`),process.exitCode=1,null}try{let i=await L$(r,"utf-8");return{filePath:r,content:i}}catch(i){return console.error(`\u2717 Failed to read file: ${i.message}`),process.exitCode=1,null}}function U$(e){for(let t of e)console.error(`${t.severity}: ${t.code}: ${t.message}`)}async function G$(e){let t=Ra(e);try{await B$(t)}catch{return console.error(`\u2717 File not found: ${t}`),process.exitCode=1,null}try{let r=new Uint8Array(await L$(t));return{filePath:t,bytes:r}}catch(r){return console.error(`\u2717 Failed to read file: ${r.message}`),process.exitCode=1,null}}var zX={svg:[".svg"],svgs:[".svgs"],pdf:[".pdf",".ai"],postscript:[".ai",".eps",".ps"],png:[".png"],jpeg:[".jpg",".jpeg"],gif:[".gif"],webp:[".webp"]};function W$(e){switch(e){case"svg":return"an SVG document";case"svgs":return"an SVGSketch .svgs document";case"pdf":return"a PDF (or PDF-compatible Illustrator) document";case"postscript":return"a PostScript document";case"png":return"a PNG image";case"jpeg":return"a JPEG image";case"gif":return"a GIF image";case"webp":return"a WebP image";default:return"an unrecognized file"}}function RX(e,t){let r=zX[t];if(!r)return;let n=V$(e).toLowerCase();r.includes(n)||console.error(`\u26A0 Note: "${Ul(e)}" has extension "${n||"(none)"}" but contains ${W$(t)}; the bytes decide`)}function X$(e){let t=e.trim();if(t.toLowerCase()==="all")return"all";let r=t.split(",").map(n=>n.trim());if(r.length===0||r.some(n=>!/^[1-9]\d*$/.test(n)))throw new Vl('must be "all" or comma-separated 1-based indices such as 1,3');return[...new Set(r.map(Number))]}function Fc(e){return t=>{let r=t.trim().toLowerCase();if(!e.includes(r))throw new Vl(`must be one of: ${e.join(", ")}`);return r}}var Lc=["editable","outline"],Bc=["import","skip"];function _X(e,t,r){return dk({source:e.source,artboards:e.artboards.map(n=>({index:n.index,name:n.name,width:n.width,height:n.height,imported:n.imported})),colorMode:e.colorMode,textMode:e.textMode,counts:e.counts,items:e.items,fonts:e.fonts,ingestDiagnostics:t,timings:{...e.timings,ingestMs:r},details:{layers:e.layers,illustratorDiagnostics:e.diagnostics.illustrator,pdfDiagnostics:e.diagnostics.pdf}})}async function FX(e,t,r){let n;try{n=await z$(t,{runtime:_$(),artboards:r.artboards??"all",textMode:r.text??"editable",hiddenLayers:r.hiddenLayers==="skip"?"skip":"import-hidden",fileName:Ul(e)})}catch(d){return d instanceof ls?(console.error(`\u2717 ${d.message}`),d.code==="native-source-required"&&console.error(' Save the file again from Illustrator with "Create PDF Compatible File" enabled.')):console.error(`\u2717 Failed to convert ${Ul(e)}: ${d.message}`),process.exitCode=1,null}let i=0;for(let d of n.diagnostics.pdf)console.error(`${d.severity}: pdf:${d.code}: ${d.message}`),d.severity!=="info"&&i++;for(let d of n.diagnostics.illustrator)console.error(`${d.severity}: illustrator:${d.code}: ${d.message}`),d.severity!=="info"&&i++;let a=performance.now(),o=tm(n.svg,{source:n.source.kind==="pdf"?"pdf":"illustrator",entrypoint:n.source.kind==="pdf"?"pdf-document-import":"illustrator-document-import",nodeDecorations:n.decorations}),s=Math.round(performance.now()-a);U$(o.diagnostics);let l=o.diagnostics.filter(d=>d.severity==="error");if(!o.value||l.length>0)return process.exitCode=1,null;let u=o.diagnostics.filter(d=>d.severity==="warning");return{snapshot:o.value,diagnostics:o.diagnostics,warningCount:u.length+i,report:_X(n,o.diagnostics,s)}}function LX(e){let t=tm(Buffer.from(e).toString("utf-8"),{source:"svg",entrypoint:"svg-document-import"});U$(t.diagnostics);let r=t.diagnostics.filter(n=>n.severity==="error");return!t.value||r.length>0?(process.exitCode=1,null):{snapshot:t.value,diagnostics:t.diagnostics,warningCount:t.diagnostics.filter(n=>n.severity==="warning").length,report:null}}async function H$(e,t){let r=Ra(t);try{await Gl(r,JSON.stringify(e,null,2)+`
125
+ `,"utf-8")}catch(n){return console.error(`\u2717 Failed to write report: ${n.message}`),process.exitCode=1,!1}return console.log(`\u2713 Import report \u2192 ${r}`),!0}function q$(e,t){t&&e>0&&(console.error(`\u2717 ${e} import warning${e!==1?"s":""} treated as failure (--fail-on-warnings)`),process.exitCode=1)}function cs(e){let t=e.trim();if(!/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(t))throw new Vl("must be a valid number");let r=Number(t);if(!Number.isFinite(r))throw new Vl("must be a finite number");return r}function Vc(e,t){for(let r of e)console.error(`${r.severity}: ${r.message}`);t&&e.length>0&&(console.error(`\u2717 ${e.length} render diagnostic${e.length!==1?"s":""} treated as failure (--fail-on-warnings)`),process.exitCode=1)}function fs(e,t){return e===void 0?!0:isNaN(e)||e<=0||!isFinite(e)?(console.error(`\u2717 Invalid ${t}: must be a positive number`),process.exitCode=1,!1):!0}async function Y$(e,t,r){let n=uk(t);switch(RX(e,n),n){case"svg":return LX(t);case"pdf":case"postscript":return FX(e,t,r);case"svgs":{if(!r.acceptSvgs)return console.error(`\u2717 "${Ul(e)}" is already an SVGSketch .svgs document; use validate, render or convert`),process.exitCode=1,null;let i;try{i=Na(Buffer.from(t).toString("utf-8"))}catch(a){return console.error(`Error parsing document: ${a.message}`),process.exitCode=1,null}return{snapshot:Yo(i),diagnostics:[],warningCount:0,report:null}}default:return console.error(`\u2717 "${Ul(e)}" is ${W$(n)}; accepted inputs are SVG, Illustrator (.ai), PDF and EPS files${r.acceptSvgs?" and .svgs documents":""}`),process.exitCode=1,null}}Hn.command("import").description("Import an SVG, Illustrator (.ai), PDF or EPS document into the native .svgs format").argument("<input>","Path to the source file (.svg, .ai, .pdf or .eps)").requiredOption("-o, --output <path>","Output file path (.svgs)").option("--artboards <list>",'Artboards or pages to import from .ai and .pdf input: comma-separated 1-based indices, or "all" (default)',X$).option("--text <mode>",`Text handling for .ai and .pdf input: ${Lc.join(" | ")} (default: editable)`,Fc(Lc)).option("--hidden-layers <mode>",`Hidden layers in .ai and .pdf input: ${Bc.join(" | ")} (default: import)`,Fc(Bc)).option("--report <path>","Write the import report as JSON (.ai and .pdf input)").option("--fail-on-warnings","Exit with a nonzero status when import warnings are reported").action(async(e,t)=>{let r=await G$(e);if(!r)return;let n=await Y$(r.filePath,r.bytes,{...t,acceptSvgs:!1});if(!n)return;let i=Ra(t.output);try{await Gl(i,l1(n.snapshot),"utf-8")}catch(o){console.error(`\u2717 Failed to write output: ${o.message}`),process.exitCode=1;return}if(t.report){if(!n.report)console.error("\u26A0 Note: --report applies to Illustrator and PDF input only; no report written");else if(!await H$(n.report,t.report))return}q$(n.warningCount,t.failOnWarnings);let a=n.snapshot.shapes.length;console.log(`\u2713 Imported ${a} shape${a!==1?"s":""} \u2192 ${i}`)});Hn.command("convert").description("Convert an SVG, Illustrator (.ai), PDF, EPS or .svgs document to a plain SVG file").argument("<input>","Path to the source file (.svg, .ai, .pdf, .eps or .svgs)").requiredOption("-o, --output <path>","Output file path (.svg)").option("-w, --width <n>","Override canvas width",cs).option("-H, --height <n>","Override canvas height",cs).option("--background <color>","Background color (e.g. #ffffff)").option("--no-xml-declaration","Omit the XML declaration").option("--artboards <list>",'Artboards or pages to convert from .ai and .pdf input: comma-separated 1-based indices, or "all" (default)',X$).option("--text <mode>",`Text handling for .ai and .pdf input: ${Lc.join(" | ")} (default: editable)`,Fc(Lc)).option("--hidden-layers <mode>",`Hidden layers in .ai and .pdf input: ${Bc.join(" | ")} (default: import)`,Fc(Bc)).option("--report <path>","Write the import report as JSON (.ai and .pdf input)").option("--fail-on-warnings","Exit with a nonzero status when import or render diagnostics are reported (output is still written)").action(async(e,t)=>{if(!fs(t.width,"width")||!fs(t.height,"height"))return;let r=await G$(e);if(!r)return;let n=await Y$(r.filePath,r.bytes,{...t,acceptSvgs:!0});if(!n)return;let i={width:t.width,height:t.height,backgroundColor:t.background,xmlDeclaration:t.xmlDeclaration},{svg:a,diagnostics:o}=uc(n.snapshot,i),s=Ra(t.output);try{await Gl(s,a,"utf-8")}catch(u){console.error(`\u2717 Failed to write output: ${u.message}`),process.exitCode=1;return}if(t.report){if(!n.report)console.error("\u26A0 Note: --report applies to Illustrator and PDF input only; no report written");else if(!await H$(n.report,t.report))return}Vc(o,t.failOnWarnings??!1),q$(n.warningCount,t.failOnWarnings);let l=n.snapshot.shapes?.length??0;console.log(`\u2713 Converted ${l} shape${l!==1?"s":""} \u2192 ${s}`)});Hn.command("validate").description("Validate a .svgs document").argument("<input>","Path to the .svgs file").option("--json","Output result as JSON").action(async(e,t)=>{let r=await Wl(e);if(!r)return;let{filePath:n,content:i}=r,a;try{a=Na(i)}catch(s){t.json?console.log(JSON.stringify({valid:!1,file:n,error:s.message},null,2)):console.error(`\u2717 Parse error: ${s.message}`),process.exitCode=1;return}let o=gl(a);if(t.json)console.log(JSON.stringify({valid:o.valid,file:n,version:a.schemaVersion??"unknown",shapes:a.shapes?.length??0,warnings:o.warnings.map(s=>s.message),errors:o.errors.map(s=>s.message)},null,2));else if(o.valid){let s=a.shapes?.length??0;if(console.log(`\u2713 Valid .svgs document (v${a.schemaVersion??"?"}, ${s} shape${s!==1?"s":""})`),o.warnings.length>0)for(let l of o.warnings)console.log(` \u26A0 ${l.message}`)}else{console.error("\u2717 Invalid document:");for(let s of o.errors)console.error(` \u2022 ${s.message}`);process.exitCode=1}});Hn.command("render").description("Render a .svgs document to SVG").argument("<input>","Path to the .svgs file").requiredOption("-o, --output <path>","Output file path (.svg)").option("-w, --width <n>","Override canvas width",cs).option("-H, --height <n>","Override canvas height",cs).option("--background <color>","Background color (e.g. #ffffff)").option("--no-xml-declaration","Omit the XML declaration").option("--variant-transitions <target>","How symbol variant animations are encoded: smil (default; animates a standalone file with no script), css (@keyframes, for an SVG embedded in HTML), or waapi (a script you can drive)",jX).option("--fail-on-warnings","Exit with a nonzero status when render diagnostics are reported (output is still written)").option("--var <key=value...>","Set template variable (repeatable)",(e,t)=>[...t,e],[]).action(async(e,t)=>{if(!fs(t.width,"width")||!fs(t.height,"height"))return;let r=await Wl(e);if(!r)return;let{content:n}=r,i;try{i=Na(n)}catch(u){console.error(`Error parsing document: ${u.message}`),process.exitCode=1;return}if(t.var&&t.var.length>0)try{let u=qh(t.var);i=Yo(i,u)}catch(u){console.error(`Error parsing variables: ${u.message}`),process.exitCode=1;return}else i=Yo(i);let a={width:t.width,height:t.height,backgroundColor:t.background,xmlDeclaration:t.xmlDeclaration,...t.variantTransitions?{variantTransitionTarget:t.variantTransitions}:{}},{svg:o,diagnostics:s}=uc(i,a),l=Ra(t.output);try{await Gl(l,o,"utf-8")}catch(u){console.error(`\u2717 Failed to write output: ${u.message}`),process.exitCode=1;return}Vc(s,t.failOnWarnings??!1),console.log(`\u2713 Rendered ${i.shapes?.length??0} shapes \u2192 ${l}`)});Hn.command("info").description("Display document metadata").argument("<input>","Path to the .svgs file").option("--json","Output result as JSON").action(async(e,t)=>{let r=await Wl(e);if(!r)return;let{filePath:n,content:i}=r,a;try{a=Na(i)}catch(f){console.error(`Error parsing document: ${f.message}`),process.exitCode=1;return}let o=a.shapes??[],s={};for(let f of o)s[f.type]=(s[f.type]??0)+1;let l=a.viewboxes?.[0],u=a.documentMetadata,d=a.templateVariables??[],c={file:n,schemaVersion:a.schemaVersion??"unknown",currentVersion:wn,canvas:{width:l?.width??"?",height:l?.height??"?"},metadata:u?{title:u.title||void 0,description:u.description||void 0,author:u.author||void 0,keywords:u.keywords&&u.keywords.length>0?u.keywords:void 0,language:u.language||void 0,license:u.license||void 0}:void 0,templateVariables:d.length>0?d.length:void 0,shapes:{total:o.length,byType:s}};if(t.json)console.log(JSON.stringify(c,null,2));else if(console.log(`File: ${c.file}`),console.log(`Version: ${c.schemaVersion} (current: ${c.currentVersion})`),console.log(`Canvas: ${c.canvas.width}\xD7${c.canvas.height}`),u&&(u.title&&console.log(`Title: ${u.title}`),u.author&&console.log(`Author: ${u.author}`),u.description&&console.log(`Description: ${u.description}`),u.language&&console.log(`Language: ${u.language}`),u.license&&console.log(`License: ${u.license}`),u.keywords&&u.keywords.length>0&&console.log(`Keywords: ${u.keywords.join(", ")}`)),d.length>0&&console.log(`Variables: ${d.length}`),console.log(`Shapes: ${c.shapes.total}`),Object.keys(s).length>0)for(let[f,p]of Object.entries(s).sort())console.log(` ${f}: ${p}`)});Hn.command("vars").description("List template variables defined in a .svgs document").argument("<input>","Path to the .svgs file").option("--json","Output result as JSON").action(async(e,t)=>{let r=await Wl(e);if(!r)return;let{content:n}=r,i;try{i=Na(n)}catch(s){console.error(`Error parsing document: ${s.message}`),process.exitCode=1;return}let{defined:a,undeclared:o}=u1(i);if(t.json)console.log(JSON.stringify({defined:a,undeclared:o},null,2));else{if(a.length===0&&o.length===0){console.log("No template variables found.");return}if(a.length>0){console.log("Defined variables:");for(let s of a){let l=s.label?` (${s.label})`:"";console.log(` {{${s.name}}}${l} [${s.type}] default: ${s.defaultValue||"(empty)"}`)}}if(o.length>0){console.log("Undeclared references (used but not defined):");for(let s of o)console.log(` \u26A0 {{${s}}}`)}}});var rg=["svg","react","vue","d3","css"];Hn.command("codegen").description("Generate code from a .svgs document (React, Vue, D3, CSS, or raw SVG)").argument("<input>","Path to the .svgs file").requiredOption("-f, --format <format>",`Output format: ${rg.join(", ")}`).option("-o, --output <path>","Output file path (prints to stdout if omitted)").option("--name <name>","Component/function name (default: SvgComponent)").option("-w, --width <n>","Override canvas width",cs).option("-H, --height <n>","Override canvas height",cs).option("--typescript","Use TypeScript syntax (React, Vue, D3)").option("--fail-on-warnings","Exit with a nonzero status when render diagnostics are reported (output is still written)").option("--var <key=value...>","Set template variable (repeatable)",(e,t)=>[...t,e],[]).action(async(e,t)=>{if(!fs(t.width,"width")||!fs(t.height,"height"))return;let r=t.format;if(!rg.includes(r)){console.error(`\u2717 Invalid format "${t.format}". Valid formats: ${rg.join(", ")}`),process.exitCode=1;return}let n=await Wl(e);if(!n)return;let{content:i}=n,a;try{a=Na(i)}catch(l){console.error(`Error parsing document: ${l.message}`),process.exitCode=1;return}if(t.var&&t.var.length>0)try{let l=qh(t.var);a=Yo(a,l)}catch(l){console.error(`Error parsing variables: ${l.message}`),process.exitCode=1;return}else a=Yo(a);let{code:o,diagnostics:s}=Ok(a,{format:r,componentName:t.name,width:t.width,height:t.height,typescript:t.typescript??!1});if(t.output){let l=Ra(t.output);try{await Gl(l,o,"utf-8")}catch(u){console.error(`\u2717 Failed to write output: ${u.message}`),process.exitCode=1;return}Vc(s,t.failOnWarnings??!1),console.log(`\u2713 Generated ${r} code \u2192 ${l}`)}else Vc(s,t.failOnWarnings??!1),process.stdout.write(o)});var F$="https://docs.svgsketch.com",_c={document:{url:"/sdk/document/",description:"DocumentBuilder class API"},shapes:{url:"/sdk/shapes/",description:"Shape builders (Circle, Rectangle, Text, ...)"},styles:{url:"/sdk/styles/",description:"Gradients & patterns"},filters:{url:"/sdk/filters/",description:"Filter effects (shadow, blur, artistic, ...)"},animation:{url:"/sdk/animation/",description:"Timeline & Track animation builders"},types:{url:"/sdk/types/",description:"TypeScript types & interfaces"},cli:{url:"/cli/",description:"CLI command reference"},format:{url:"/format/",description:".svgs file format specification"}};Hn.command("docs").description("Open SDK documentation or show a quick reference").argument("[section]","Section to open: "+Object.keys(_c).join(", ")).option("--url","Print the URL instead of opening the browser").option("--list","List all available documentation sections").action(async(e,t)=>{if(t.list){console.log(`Available documentation sections:
126
+ `);for(let[o,{description:s}]of Object.entries(_c))console.log(` ${o.padEnd(12)} ${s}`);console.log(`
127
+ Usage: svgsketch docs [section]`),console.log(" svgsketch docs --url [section]");return}let r=F$+"/sdk/";if(e){let o=_c[e.toLowerCase()];if(!o){console.error(`\u2717 Unknown section "${e}". Available: ${Object.keys(_c).join(", ")}`),process.exitCode=1;return}r=F$+o.url}if(t.url){console.log(r);return}let{exec:n}=await import("child_process"),{platform:i}=await import("os"),a=i()==="win32"?`start "" "${r}"`:i()==="darwin"?`open "${r}"`:`xdg-open "${r}"`;n(a,o=>{o&&console.log(r)})});Hn.parseAsync().catch(e=>{console.error(`\u2717 ${e instanceof Error?e.message:String(e)}`),process.exitCode=1});
128
+ /*! Bundled license information:
129
+
130
+ xmlchars/xml/1.0/ed5.js:
131
+ (**
132
+ * Character classes and associated utilities for the 5th edition of XML 1.0.
133
+ *
134
+ * @author Louis-Dominique Dubeau
135
+ * @license MIT
136
+ * @copyright Louis-Dominique Dubeau
137
+ *)
138
+
139
+ xmlchars/xml/1.1/ed2.js:
140
+ (**
141
+ * Character classes and associated utilities for the 2nd edition of XML 1.1.
142
+ *
143
+ * @author Louis-Dominique Dubeau
144
+ * @license MIT
145
+ * @copyright Louis-Dominique Dubeau
146
+ *)
147
+
148
+ xmlchars/xmlns/1.0/ed3.js:
149
+ (**
150
+ * Character class utilities for XML NS 1.0 edition 3.
151
+ *
152
+ * @author Louis-Dominique Dubeau
153
+ * @license MIT
154
+ * @copyright Louis-Dominique Dubeau
155
+ *)
156
+ */