@emasoft/svg-matrix 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -0
- package/bin/svgfonts.js +1412 -0
- package/bin/svgm.js +1 -1
- package/dist/svg-matrix.global.min.js +8 -0
- package/dist/svg-matrix.min.js +2 -2
- package/dist/svg-toolbox.global.min.js +493 -0
- package/dist/svg-toolbox.min.js +16 -16
- package/dist/svgm.min.js +60 -60
- package/dist/version.json +44 -16
- package/package.json +11 -3
- package/src/bezier-intersections.js +1 -1
- package/src/browser-verify.js +0 -1
- package/src/clip-path-resolver.js +3 -1
- package/src/font-manager.js +1013 -0
- package/src/index.js +2 -2
- package/src/inkscape-support.js +2 -2
- package/src/mask-resolver.js +14 -6
- package/src/mesh-gradient.js +0 -2
- package/src/off-canvas-detection.js +14 -22
- package/src/svg-boolean-ops.js +0 -5
- package/src/svg-collections.js +11 -0
- package/src/svg-matrix-lib.js +2 -2
- package/src/svg-parser.js +0 -24
- package/src/svg-rendering-context.js +2 -4
- package/src/svg-toolbox-lib.js +2 -2
- package/src/svgm-lib.js +2 -2
- package/src/transform-optimization.js +93 -142
- package/src/verification.js +0 -2
- package/templates/svgm_replacement_map.yml +53 -0
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
/*! svg-matrix v1.3.0 | MIT License | https://github.com/Emasoft/svg-matrix */
|
|
2
|
+
(()=>{var $Z=Object.create;var{getPrototypeOf:JZ,defineProperty:S6,getOwnPropertyNames:PJ,getOwnPropertyDescriptor:KZ}=Object,AJ=Object.prototype.hasOwnProperty;var K6=($,J,Z)=>{Z=$!=null?$Z(JZ($)):{};let K=J||!$||!$.__esModule?S6(Z,"default",{value:$,enumerable:!0}):Z;for(let Q of PJ($))if(!AJ.call(K,Q))S6(K,Q,{get:()=>$[Q],enumerable:!0});return K},CJ=new WeakMap,EJ=($)=>{var J=CJ.get($),Z;if(J)return J;if(J=S6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")PJ($).map((K)=>!AJ.call(J,K)&&S6(J,K,{get:()=>$[K],enumerable:!(Z=KZ($,K))||Z.enumerable}));return CJ.set($,J),J};var q$=($,J)=>{for(var Z in J)S6($,Z,{get:J[Z],enumerable:!0,configurable:!0,set:(K)=>J[Z]=()=>K})};var ZZ=($,J)=>()=>($&&(J=$($=0)),J);var f7=(($)=>typeof require!=="undefined"?require:typeof Proxy!=="undefined"?new Proxy($,{get:(J,Z)=>(typeof require!=="undefined"?require:J)[Z]}):$)(function($){if(typeof require!=="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var I6={};q$(I6,{win32:()=>Z8,toNamespacedPath:()=>wz,sep:()=>Pz,resolve:()=>Oz,relative:()=>Lz,posix:()=>e7,parse:()=>Cz,normalize:()=>Yz,join:()=>kz,isAbsolute:()=>Xz,format:()=>Iz,extname:()=>Nz,dirname:()=>Rz,delimiter:()=>Az,default:()=>Mz,basename:()=>Bz});var Hz,AK,zz,qz,Wz,jz,Gz=($,J)=>()=>(J||$((J={exports:{}}).exports,J),J.exports),Fz=($,J,Z,K)=>{if(J&&typeof J=="object"||typeof J=="function")for(let Q of qz(J))!jz.call($,Q)&&Q!==Z&&AK($,Q,{get:()=>J[Q],enumerable:!(K=zz(J,Q))||K.enumerable});return $},_z=($,J,Z)=>(Z=$!=null?Hz(Wz($)):{},Fz(J||!$||!$.__esModule?AK(Z,"default",{value:$,enumerable:!0}):Z,$)),Uz,EK,m0,Vz,PK=function($){return $},TK=function(){throw new Error("Not implemented")},e7,Z8,Mz,Oz,Yz,Xz,kz,Lz,wz,Rz,Bz,Nz,Iz,Cz,Pz,Az;var C6=ZZ(()=>{Hz=Object.create,AK=Object.defineProperty,zz=Object.getOwnPropertyDescriptor,qz=Object.getOwnPropertyNames,Wz=Object.getPrototypeOf,jz=Object.prototype.hasOwnProperty,Uz=Gz(($,J)=>{function Z(z){if(typeof z!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(z))}function K(z,q){for(var W="",j=0,G=-1,F=0,_,U=0;U<=z.length;++U){if(U<z.length)_=z.charCodeAt(U);else{if(_===47)break;_=47}if(_===47){if(!(G===U-1||F===1))if(G!==U-1&&F===2){if(W.length<2||j!==2||W.charCodeAt(W.length-1)!==46||W.charCodeAt(W.length-2)!==46){if(W.length>2){var O=W.lastIndexOf("/");if(O!==W.length-1){O===-1?(W="",j=0):(W=W.slice(0,O),j=W.length-1-W.lastIndexOf("/")),G=U,F=0;continue}}else if(W.length===2||W.length===1){W="",j=0,G=U,F=0;continue}}q&&(W.length>0?W+="/..":W="..",j=2)}else W.length>0?W+="/"+z.slice(G+1,U):W=z.slice(G+1,U),j=U-G-1;G=U,F=0}else _===46&&F!==-1?++F:F=-1}return W}function Q(z,q){var W=q.dir||q.root,j=q.base||(q.name||"")+(q.ext||"");return W?W===q.root?W+j:W+z+j:j}var H={resolve:function(){for(var z="",q=!1,W,j=arguments.length-1;j>=-1&&!q;j--){var G;j>=0?G=arguments[j]:(W===void 0&&(W=process.cwd()),G=W),Z(G),G.length!==0&&(z=G+"/"+z,q=G.charCodeAt(0)===47)}return z=K(z,!q),q?z.length>0?"/"+z:"/":z.length>0?z:"."},normalize:function(z){if(Z(z),z.length===0)return".";var q=z.charCodeAt(0)===47,W=z.charCodeAt(z.length-1)===47;return z=K(z,!q),z.length===0&&!q&&(z="."),z.length>0&&W&&(z+="/"),q?"/"+z:z},isAbsolute:function(z){return Z(z),z.length>0&&z.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var z,q=0;q<arguments.length;++q){var W=arguments[q];Z(W),W.length>0&&(z===void 0?z=W:z+="/"+W)}return z===void 0?".":H.normalize(z)},relative:function(z,q){if(Z(z),Z(q),z===q||(z=H.resolve(z),q=H.resolve(q),z===q))return"";for(var W=1;W<z.length&&z.charCodeAt(W)===47;++W);for(var j=z.length,G=j-W,F=1;F<q.length&&q.charCodeAt(F)===47;++F);for(var _=q.length,U=_-F,O=G<U?G:U,V=-1,M=0;M<=O;++M){if(M===O){if(U>O){if(q.charCodeAt(F+M)===47)return q.slice(F+M+1);if(M===0)return q.slice(F+M)}else G>O&&(z.charCodeAt(W+M)===47?V=M:M===0&&(V=0));break}var Y=z.charCodeAt(W+M),X=q.charCodeAt(F+M);if(Y!==X)break;Y===47&&(V=M)}var w="";for(M=W+V+1;M<=j;++M)(M===j||z.charCodeAt(M)===47)&&(w.length===0?w+="..":w+="/..");return w.length>0?w+q.slice(F+V):(F+=V,q.charCodeAt(F)===47&&++F,q.slice(F))},_makeLong:function(z){return z},dirname:function(z){if(Z(z),z.length===0)return".";for(var q=z.charCodeAt(0),W=q===47,j=-1,G=!0,F=z.length-1;F>=1;--F)if(q=z.charCodeAt(F),q===47){if(!G){j=F;break}}else G=!1;return j===-1?W?"/":".":W&&j===1?"//":z.slice(0,j)},basename:function(z,q){if(q!==void 0&&typeof q!="string")throw new TypeError('"ext" argument must be a string');Z(z);var W=0,j=-1,G=!0,F;if(q!==void 0&&q.length>0&&q.length<=z.length){if(q.length===z.length&&q===z)return"";var _=q.length-1,U=-1;for(F=z.length-1;F>=0;--F){var O=z.charCodeAt(F);if(O===47){if(!G){W=F+1;break}}else U===-1&&(G=!1,U=F+1),_>=0&&(O===q.charCodeAt(_)?--_===-1&&(j=F):(_=-1,j=U))}return W===j?j=U:j===-1&&(j=z.length),z.slice(W,j)}else{for(F=z.length-1;F>=0;--F)if(z.charCodeAt(F)===47){if(!G){W=F+1;break}}else j===-1&&(G=!1,j=F+1);return j===-1?"":z.slice(W,j)}},extname:function(z){Z(z);for(var q=-1,W=0,j=-1,G=!0,F=0,_=z.length-1;_>=0;--_){var U=z.charCodeAt(_);if(U===47){if(!G){W=_+1;break}continue}j===-1&&(G=!1,j=_+1),U===46?q===-1?q=_:F!==1&&(F=1):q!==-1&&(F=-1)}return q===-1||j===-1||F===0||F===1&&q===j-1&&q===W+1?"":z.slice(q,j)},format:function(z){if(z===null||typeof z!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof z);return Q("/",z)},parse:function(z){Z(z);var q={root:"",dir:"",base:"",ext:"",name:""};if(z.length===0)return q;var W=z.charCodeAt(0),j=W===47,G;j?(q.root="/",G=1):G=0;for(var F=-1,_=0,U=-1,O=!0,V=z.length-1,M=0;V>=G;--V){if(W=z.charCodeAt(V),W===47){if(!O){_=V+1;break}continue}U===-1&&(O=!1,U=V+1),W===46?F===-1?F=V:M!==1&&(M=1):F!==-1&&(M=-1)}return F===-1||U===-1||M===0||M===1&&F===U-1&&F===_+1?U!==-1&&(_===0&&j?q.base=q.name=z.slice(1,U):q.base=q.name=z.slice(_,U)):(_===0&&j?(q.name=z.slice(1,F),q.base=z.slice(1,U)):(q.name=z.slice(_,F),q.base=z.slice(_,U)),q.ext=z.slice(F,U)),_>0?q.dir=z.slice(0,_-1):j&&(q.dir="/"),q},sep:"/",delimiter:":",win32:null,posix:null};H.posix=H,J.exports=H}),EK=_z(Uz()),m0=EK,Vz=EK;m0.parse??=TK;Vz.parse??=TK;e7={resolve:m0.resolve.bind(m0),normalize:m0.normalize.bind(m0),isAbsolute:m0.isAbsolute.bind(m0),join:m0.join.bind(m0),relative:m0.relative.bind(m0),toNamespacedPath:PK,dirname:m0.dirname.bind(m0),basename:m0.basename.bind(m0),extname:m0.extname.bind(m0),format:m0.format.bind(m0),parse:m0.parse.bind(m0),sep:"/",delimiter:":",win32:void 0,posix:void 0,_makeLong:PK},Z8={sep:"\\",delimiter:";",win32:void 0,...e7,posix:e7};e7.win32=Z8.win32=Z8;e7.posix=e7;Mz=e7,{resolve:Oz,normalize:Yz,isAbsolute:Xz,join:kz,relative:Lz,toNamespacedPath:wz,dirname:Rz,basename:Bz,extname:Nz,format:Iz,parse:Cz,sep:Pz,delimiter:Az}=e7});var Gq={};q$(Gq,{validateXML:()=>jJ,validateSVGAsync:()=>oK,validateSVG:()=>GJ,straightCurves:()=>m$,sortDefsChildren:()=>g8,sortAttrs:()=>u8,simplifyPaths:()=>YJ,simplifyPath:()=>VJ,saveOutput:()=>_8,reusePaths:()=>x8,removeXlink:()=>p8,removeXMLProcInst:()=>w8,removeXMLNS:()=>C8,removeViewBox:()=>I8,removeUselessDefs:()=>X8,removeUselessCommands:()=>c$,removeUnknownsAndDefaults:()=>O8,removeTitle:()=>R8,removeStyleElement:()=>d8,removeScriptElement:()=>A8,removeRasterImages:()=>P8,removeOffCanvasPath:()=>m8,removeNonInheritableGroupAttrs:()=>Y8,removeMetadata:()=>Q$,removeLeadingZero:()=>D$,removeHiddenElements:()=>J$,removeEmptyText:()=>k8,removeEmptyContainers:()=>K$,removeEmptyAttrs:()=>N8,removeElementsByAttr:()=>r8,removeEditorsNSData:()=>J9,removeDoctype:()=>L8,removeDimensions:()=>s8,removeDesc:()=>B8,removeComments:()=>Z$,removeAttrs:()=>i8,removeAttributesBySelector:()=>o8,printHierarchicalMatrix:()=>lK,presetNone:()=>H9,presetDefault:()=>Q9,prefixIds:()=>n8,optimizePaths:()=>OJ,optimizeAnimationTiming:()=>MJ,optimize:()=>t8,negativeExtraSpace:()=>h$,moveGroupAttrsToElems:()=>D8,moveElemsAttrsToGroup:()=>h8,minifyStyles:()=>Z9,mergePaths:()=>v8,measureDistance:()=>WJ,loadInput:()=>T6,lineShorthands:()=>g$,inlineStyles:()=>y8,imageToPath:()=>zJ,generateOutput:()=>b6,generateFullCompatibilityMatrix:()=>cK,generateFlexibleSVGTable:()=>FJ,generateCompatibilityMatrixSVG:()=>nK,generateCompatibilityMatrixFlexible:()=>sK,formatPrecision:()=>F8,floatPrecision:()=>p$,flattenUseElements:()=>HJ,flattenPatterns:()=>ZJ,flattenMasks:()=>JJ,flattenGradients:()=>KJ,flattenFilters:()=>QJ,flattenClipPaths:()=>$J,flattenAll:()=>UJ,fixInvalidSVG:()=>_J,exportEmbeddedResources:()=>LJ,escapeXml:()=>xK,embedExternalDependencies:()=>z9,detectOutputTarget:()=>e$,detectInputType:()=>E6,detectCollisions:()=>qJ,default:()=>Fq,decomposeTransform:()=>XJ,createOperation:()=>j0,createConfig:()=>e8,convertTransform:()=>b8,convertToZ:()=>x$,convertToRelative:()=>y$,convertToAbsolute:()=>u$,convertStyleToAttrs:()=>K9,convertShapesToPath:()=>E8,convertQuadraticToSmooth:()=>n$,convertPathData:()=>T8,convertEllipseToCircle:()=>f8,convertCubicToSmooth:()=>s$,convertCubicToQuadratic:()=>l$,convertColors:()=>H$,collapseRepeated:()=>d$,collapseGroups:()=>S8,cleanupNumericValues:()=>$$,cleanupListOfValues:()=>U8,cleanupIds:()=>$9,cleanupEnableBackground:()=>M8,cleanupAttributes:()=>V8,arcShorthands:()=>o$,applyPreset:()=>a8,analyzeCompatibilityMatrix:()=>pK,analyzeCompatibility:()=>dK,addClassesToSVGElement:()=>l8,addAttributesToSVGElement:()=>c8,ValidationSeverity:()=>C0,VERSION:()=>aK,PRECISION_LEVELS:()=>j8,OutputTarget:()=>z7,OutputFormat:()=>q7,MAX_PRECISION:()=>A6,InputType:()=>S0,DEFAULT_PRECISION:()=>e6});var wJ={};q$(wJ,{validateXML:()=>jJ,validateSVGAsync:()=>oK,validateSVG:()=>GJ,straightCurves:()=>m$,sortDefsChildren:()=>g8,sortAttrs:()=>u8,simplifyPaths:()=>YJ,simplifyPath:()=>VJ,saveOutput:()=>_8,reusePaths:()=>x8,removeXlink:()=>p8,removeXMLProcInst:()=>w8,removeXMLNS:()=>C8,removeViewBox:()=>I8,removeUselessDefs:()=>X8,removeUselessCommands:()=>c$,removeUnknownsAndDefaults:()=>O8,removeTitle:()=>R8,removeStyleElement:()=>d8,removeScriptElement:()=>A8,removeRasterImages:()=>P8,removeOffCanvasPath:()=>m8,removeNonInheritableGroupAttrs:()=>Y8,removeMetadata:()=>Q$,removeLeadingZero:()=>D$,removeHiddenElements:()=>J$,removeEmptyText:()=>k8,removeEmptyContainers:()=>K$,removeEmptyAttrs:()=>N8,removeElementsByAttr:()=>r8,removeEditorsNSData:()=>J9,removeDoctype:()=>L8,removeDimensions:()=>s8,removeDesc:()=>B8,removeComments:()=>Z$,removeAttrs:()=>i8,removeAttributesBySelector:()=>o8,printHierarchicalMatrix:()=>lK,presetNone:()=>H9,presetDefault:()=>Q9,prefixIds:()=>n8,optimizePaths:()=>OJ,optimizeAnimationTiming:()=>MJ,optimize:()=>t8,negativeExtraSpace:()=>h$,moveGroupAttrsToElems:()=>D8,moveElemsAttrsToGroup:()=>h8,minifyStyles:()=>Z9,mergePaths:()=>v8,measureDistance:()=>WJ,loadInput:()=>T6,lineShorthands:()=>g$,inlineStyles:()=>y8,imageToPath:()=>zJ,generateOutput:()=>b6,generateFullCompatibilityMatrix:()=>cK,generateFlexibleSVGTable:()=>FJ,generateCompatibilityMatrixSVG:()=>nK,generateCompatibilityMatrixFlexible:()=>sK,formatPrecision:()=>F8,floatPrecision:()=>p$,flattenUseElements:()=>HJ,flattenPatterns:()=>ZJ,flattenMasks:()=>JJ,flattenGradients:()=>KJ,flattenFilters:()=>QJ,flattenClipPaths:()=>$J,flattenAll:()=>UJ,fixInvalidSVG:()=>_J,exportEmbeddedResources:()=>LJ,escapeXml:()=>xK,embedExternalDependencies:()=>z9,detectOutputTarget:()=>e$,detectInputType:()=>E6,detectCollisions:()=>qJ,default:()=>jq,decomposeTransform:()=>XJ,createOperation:()=>j0,createConfig:()=>e8,convertTransform:()=>b8,convertToZ:()=>x$,convertToRelative:()=>y$,convertToAbsolute:()=>u$,convertStyleToAttrs:()=>K9,convertShapesToPath:()=>E8,convertQuadraticToSmooth:()=>n$,convertPathData:()=>T8,convertEllipseToCircle:()=>f8,convertCubicToSmooth:()=>s$,convertCubicToQuadratic:()=>l$,convertColors:()=>H$,collapseRepeated:()=>d$,collapseGroups:()=>S8,cleanupNumericValues:()=>$$,cleanupListOfValues:()=>U8,cleanupIds:()=>$9,cleanupEnableBackground:()=>M8,cleanupAttributes:()=>V8,arcShorthands:()=>o$,applyPreset:()=>a8,analyzeCompatibilityMatrix:()=>pK,analyzeCompatibility:()=>dK,addClassesToSVGElement:()=>l8,addAttributesToSVGElement:()=>c8,ValidationSeverity:()=>C0,PRECISION_LEVELS:()=>j8,OutputTarget:()=>z7,OutputFormat:()=>q7,MAX_PRECISION:()=>A6,InputType:()=>S0,DEFAULT_PRECISION:()=>e6});/*!
|
|
3
|
+
* decimal.js v10.6.0
|
|
4
|
+
* An arbitrary-precision Decimal type for JavaScript.
|
|
5
|
+
* https://github.com/MikeMcl/decimal.js
|
|
6
|
+
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
7
|
+
* MIT Licence
|
|
8
|
+
*/var U6=9000000000000000,l7=1e9,j9="0123456789abcdef",G$="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",F$="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",G9={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-U6,maxE:U6,crypto:!1},SJ,S7,A0=!0,U$="[DecimalError] ",c7=U$+"Invalid argument: ",vJ=U$+"Precision limit exceeded",DJ=U$+"crypto unavailable",hJ="[object Decimal]",a0=Math.floor,p0=Math.pow,QZ=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,HZ=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,zZ=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,yJ=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,k7=1e7,w0=7,qZ=9007199254740991,WZ=G$.length-1,F9=F$.length-1,Z0={toStringTag:hJ};Z0.absoluteValue=Z0.abs=function(){var $=new this.constructor(this);if($.s<0)$.s=1;return Y0($)};Z0.ceil=function(){return Y0(new this.constructor(this),this.e+1,2)};Z0.clampedTo=Z0.clamp=function($,J){var Z,K=this,Q=K.constructor;if($=new Q($),J=new Q(J),!$.s||!J.s)return new Q(NaN);if($.gt(J))throw Error(c7+J);return Z=K.cmp($),Z<0?$:K.cmp(J)>0?J:new Q(K)};Z0.comparedTo=Z0.cmp=function($){var J,Z,K,Q,H=this,z=H.d,q=($=new H.constructor($)).d,W=H.s,j=$.s;if(!z||!q)return!W||!j?NaN:W!==j?W:z===q?0:!z^W<0?1:-1;if(!z[0]||!q[0])return z[0]?W:q[0]?-j:0;if(W!==j)return W;if(H.e!==$.e)return H.e>$.e^W<0?1:-1;K=z.length,Q=q.length;for(J=0,Z=K<Q?K:Q;J<Z;++J)if(z[J]!==q[J])return z[J]>q[J]^W<0?1:-1;return K===Q?0:K>Q^W<0?1:-1};Z0.cosine=Z0.cos=function(){var $,J,Z=this,K=Z.constructor;if(!Z.d)return new K(NaN);if(!Z.d[0])return new K(1);return $=K.precision,J=K.rounding,K.precision=$+Math.max(Z.e,Z.sd())+w0,K.rounding=1,Z=jZ(K,dJ(K,Z)),K.precision=$,K.rounding=J,Y0(S7==2||S7==3?Z.neg():Z,$,J,!0)};Z0.cubeRoot=Z0.cbrt=function(){var $,J,Z,K,Q,H,z,q,W,j,G=this,F=G.constructor;if(!G.isFinite()||G.isZero())return new F(G);if(A0=!1,H=G.s*p0(G.s*G,0.3333333333333333),!H||Math.abs(H)==1/0){if(Z=o0(G.d),$=G.e,H=($-Z.length+1)%3)Z+=H==1||H==-2?"0":"00";if(H=p0(Z,0.3333333333333333),$=a0(($+1)/3)-($%3==($<0?-1:2)),H==1/0)Z="5e"+$;else Z=H.toExponential(),Z=Z.slice(0,Z.indexOf("e")+1)+$;K=new F(Z),K.s=G.s}else K=new F(H.toString());z=($=F.precision)+3;for(;;)if(q=K,W=q.times(q).times(q),j=W.plus(G),K=v0(j.plus(G).times(q),j.plus(W),z+2,1),o0(q.d).slice(0,z)===(Z=o0(K.d)).slice(0,z))if(Z=Z.slice(z-3,z+1),Z=="9999"||!Q&&Z=="4999"){if(!Q){if(Y0(q,$+1,0),q.times(q).times(q).eq(G)){K=q;break}}z+=4,Q=1}else{if(!+Z||!+Z.slice(1)&&Z.charAt(0)=="5")Y0(K,$+1,1),J=!K.times(K).times(K).eq(G);break}return A0=!0,Y0(K,$,F.rounding,J)};Z0.decimalPlaces=Z0.dp=function(){var $,J=this.d,Z=NaN;if(J){if($=J.length-1,Z=($-a0(this.e/w0))*w0,$=J[$],$)for(;$%10==0;$/=10)Z--;if(Z<0)Z=0}return Z};Z0.dividedBy=Z0.div=function($){return v0(this,new this.constructor($))};Z0.dividedToIntegerBy=Z0.divToInt=function($){var J=this,Z=J.constructor;return Y0(v0(J,new Z($),0,1,1),Z.precision,Z.rounding)};Z0.equals=Z0.eq=function($){return this.cmp($)===0};Z0.floor=function(){return Y0(new this.constructor(this),this.e+1,3)};Z0.greaterThan=Z0.gt=function($){return this.cmp($)>0};Z0.greaterThanOrEqualTo=Z0.gte=function($){var J=this.cmp($);return J==1||J===0};Z0.hyperbolicCosine=Z0.cosh=function(){var $,J,Z,K,Q,H=this,z=H.constructor,q=new z(1);if(!H.isFinite())return new z(H.s?1/0:NaN);if(H.isZero())return q;if(Z=z.precision,K=z.rounding,z.precision=Z+Math.max(H.e,H.sd())+4,z.rounding=1,Q=H.d.length,Q<32)$=Math.ceil(Q/3),J=(1/M$(4,$)).toString();else $=16,J="2.3283064365386962890625e-10";H=V6(z,1,H.times(J),new z(1),!0);var W,j=$,G=new z(8);for(;j--;)W=H.times(H),H=q.minus(W.times(G.minus(W.times(G))));return Y0(H,z.precision=Z,z.rounding=K,!0)};Z0.hyperbolicSine=Z0.sinh=function(){var $,J,Z,K,Q=this,H=Q.constructor;if(!Q.isFinite()||Q.isZero())return new H(Q);if(J=H.precision,Z=H.rounding,H.precision=J+Math.max(Q.e,Q.sd())+4,H.rounding=1,K=Q.d.length,K<3)Q=V6(H,2,Q,Q,!0);else{$=1.4*Math.sqrt(K),$=$>16?16:$|0,Q=Q.times(1/M$(5,$)),Q=V6(H,2,Q,Q,!0);var z,q=new H(5),W=new H(16),j=new H(20);for(;$--;)z=Q.times(Q),Q=Q.times(q.plus(z.times(W.times(z).plus(j))))}return H.precision=J,H.rounding=Z,Y0(Q,J,Z,!0)};Z0.hyperbolicTangent=Z0.tanh=function(){var $,J,Z=this,K=Z.constructor;if(!Z.isFinite())return new K(Z.s);if(Z.isZero())return new K(Z);return $=K.precision,J=K.rounding,K.precision=$+7,K.rounding=1,v0(Z.sinh(),Z.cosh(),K.precision=$,K.rounding=J)};Z0.inverseCosine=Z0.acos=function(){var $=this,J=$.constructor,Z=$.abs().cmp(1),K=J.precision,Q=J.rounding;if(Z!==-1)return Z===0?$.isNeg()?N7(J,K,Q):new J(0):new J(NaN);if($.isZero())return N7(J,K+4,Q).times(0.5);return J.precision=K+6,J.rounding=1,$=new J(1).minus($).div($.plus(1)).sqrt().atan(),J.precision=K,J.rounding=Q,$.times(2)};Z0.inverseHyperbolicCosine=Z0.acosh=function(){var $,J,Z=this,K=Z.constructor;if(Z.lte(1))return new K(Z.eq(1)?0:NaN);if(!Z.isFinite())return new K(Z);return $=K.precision,J=K.rounding,K.precision=$+Math.max(Math.abs(Z.e),Z.sd())+4,K.rounding=1,A0=!1,Z=Z.times(Z).minus(1).sqrt().plus(Z),A0=!0,K.precision=$,K.rounding=J,Z.ln()};Z0.inverseHyperbolicSine=Z0.asinh=function(){var $,J,Z=this,K=Z.constructor;if(!Z.isFinite()||Z.isZero())return new K(Z);return $=K.precision,J=K.rounding,K.precision=$+2*Math.max(Math.abs(Z.e),Z.sd())+6,K.rounding=1,A0=!1,Z=Z.times(Z).plus(1).sqrt().plus(Z),A0=!0,K.precision=$,K.rounding=J,Z.ln()};Z0.inverseHyperbolicTangent=Z0.atanh=function(){var $,J,Z,K,Q=this,H=Q.constructor;if(!Q.isFinite())return new H(NaN);if(Q.e>=0)return new H(Q.abs().eq(1)?Q.s/0:Q.isZero()?Q:NaN);if($=H.precision,J=H.rounding,K=Q.sd(),Math.max(K,$)<2*-Q.e-1)return Y0(new H(Q),$,J,!0);return H.precision=Z=K-Q.e,Q=v0(Q.plus(1),new H(1).minus(Q),Z+$,1),H.precision=$+4,H.rounding=1,Q=Q.ln(),H.precision=$,H.rounding=J,Q.times(0.5)};Z0.inverseSine=Z0.asin=function(){var $,J,Z,K,Q=this,H=Q.constructor;if(Q.isZero())return new H(Q);if(J=Q.abs().cmp(1),Z=H.precision,K=H.rounding,J!==-1){if(J===0)return $=N7(H,Z+4,K).times(0.5),$.s=Q.s,$;return new H(NaN)}return H.precision=Z+6,H.rounding=1,Q=Q.div(new H(1).minus(Q.times(Q)).sqrt().plus(1)).atan(),H.precision=Z,H.rounding=K,Q.times(2)};Z0.inverseTangent=Z0.atan=function(){var $,J,Z,K,Q,H,z,q,W,j=this,G=j.constructor,F=G.precision,_=G.rounding;if(!j.isFinite()){if(!j.s)return new G(NaN);if(F+4<=F9)return z=N7(G,F+4,_).times(0.5),z.s=j.s,z}else if(j.isZero())return new G(j);else if(j.abs().eq(1)&&F+4<=F9)return z=N7(G,F+4,_).times(0.25),z.s=j.s,z;G.precision=q=F+10,G.rounding=1,Z=Math.min(28,q/w0+2|0);for($=Z;$;--$)j=j.div(j.times(j).plus(1).sqrt().plus(1));A0=!1,J=Math.ceil(q/w0),K=1,W=j.times(j),z=new G(j),Q=j;for(;$!==-1;)if(Q=Q.times(W),H=z.minus(Q.div(K+=2)),Q=Q.times(W),z=H.plus(Q.div(K+=2)),z.d[J]!==void 0)for($=J;z.d[$]===H.d[$]&&$--;);if(Z)z=z.times(2<<Z-1);return A0=!0,Y0(z,G.precision=F,G.rounding=_,!0)};Z0.isFinite=function(){return!!this.d};Z0.isInteger=Z0.isInt=function(){return!!this.d&&a0(this.e/w0)>this.d.length-2};Z0.isNaN=function(){return!this.s};Z0.isNegative=Z0.isNeg=function(){return this.s<0};Z0.isPositive=Z0.isPos=function(){return this.s>0};Z0.isZero=function(){return!!this.d&&this.d[0]===0};Z0.lessThan=Z0.lt=function($){return this.cmp($)<0};Z0.lessThanOrEqualTo=Z0.lte=function($){return this.cmp($)<1};Z0.logarithm=Z0.log=function($){var J,Z,K,Q,H,z,q,W,j=this,G=j.constructor,F=G.precision,_=G.rounding,U=5;if($==null)$=new G(10),J=!0;else{if($=new G($),Z=$.d,$.s<0||!Z||!Z[0]||$.eq(1))return new G(NaN);J=$.eq(10)}if(Z=j.d,j.s<0||!Z||!Z[0]||j.eq(1))return new G(Z&&!Z[0]?-1/0:j.s!=1?NaN:Z?0:1/0);if(J)if(Z.length>1)H=!0;else{for(Q=Z[0];Q%10===0;)Q/=10;H=Q!==1}if(A0=!1,q=F+U,z=p7(j,q),K=J?_$(G,q+10):p7($,q),W=v0(z,K,q,1),v6(W.d,Q=F,_))do if(q+=10,z=p7(j,q),K=J?_$(G,q+10):p7($,q),W=v0(z,K,q,1),!H){if(+o0(W.d).slice(Q+1,Q+15)+1==100000000000000)W=Y0(W,F+1,0);break}while(v6(W.d,Q+=10,_));return A0=!0,Y0(W,F,_)};Z0.minus=Z0.sub=function($){var J,Z,K,Q,H,z,q,W,j,G,F,_,U=this,O=U.constructor;if($=new O($),!U.d||!$.d){if(!U.s||!$.s)$=new O(NaN);else if(U.d)$.s=-$.s;else $=new O($.d||U.s!==$.s?U:NaN);return $}if(U.s!=$.s)return $.s=-$.s,U.plus($);if(j=U.d,_=$.d,q=O.precision,W=O.rounding,!j[0]||!_[0]){if(_[0])$.s=-$.s;else if(j[0])$=new O(U);else return new O(W===3?-0:0);return A0?Y0($,q,W):$}if(Z=a0($.e/w0),G=a0(U.e/w0),j=j.slice(),H=G-Z,H){if(F=H<0,F)J=j,H=-H,z=_.length;else J=_,Z=G,z=j.length;if(K=Math.max(Math.ceil(q/w0),z)+2,H>K)H=K,J.length=1;J.reverse();for(K=H;K--;)J.push(0);J.reverse()}else{if(K=j.length,z=_.length,F=K<z,F)z=K;for(K=0;K<z;K++)if(j[K]!=_[K]){F=j[K]<_[K];break}H=0}if(F)J=j,j=_,_=J,$.s=-$.s;z=j.length;for(K=_.length-z;K>0;--K)j[z++]=0;for(K=_.length;K>H;){if(j[--K]<_[K]){for(Q=K;Q&&j[--Q]===0;)j[Q]=k7-1;--j[Q],j[K]+=k7}j[K]-=_[K]}for(;j[--z]===0;)j.pop();for(;j[0]===0;j.shift())--Z;if(!j[0])return new O(W===3?-0:0);return $.d=j,$.e=V$(j,Z),A0?Y0($,q,W):$};Z0.modulo=Z0.mod=function($){var J,Z=this,K=Z.constructor;if($=new K($),!Z.d||!$.s||$.d&&!$.d[0])return new K(NaN);if(!$.d||Z.d&&!Z.d[0])return Y0(new K(Z),K.precision,K.rounding);if(A0=!1,K.modulo==9)J=v0(Z,$.abs(),0,3,1),J.s*=$.s;else J=v0(Z,$,0,K.modulo,1);return J=J.times($),A0=!0,Z.minus(J)};Z0.naturalExponential=Z0.exp=function(){return _9(this)};Z0.naturalLogarithm=Z0.ln=function(){return p7(this)};Z0.negated=Z0.neg=function(){var $=new this.constructor(this);return $.s=-$.s,Y0($)};Z0.plus=Z0.add=function($){var J,Z,K,Q,H,z,q,W,j,G,F=this,_=F.constructor;if($=new _($),!F.d||!$.d){if(!F.s||!$.s)$=new _(NaN);else if(!F.d)$=new _($.d||F.s===$.s?F:NaN);return $}if(F.s!=$.s)return $.s=-$.s,F.minus($);if(j=F.d,G=$.d,q=_.precision,W=_.rounding,!j[0]||!G[0]){if(!G[0])$=new _(F);return A0?Y0($,q,W):$}if(H=a0(F.e/w0),K=a0($.e/w0),j=j.slice(),Q=H-K,Q){if(Q<0)Z=j,Q=-Q,z=G.length;else Z=G,K=H,z=j.length;if(H=Math.ceil(q/w0),z=H>z?H+1:z+1,Q>z)Q=z,Z.length=1;Z.reverse();for(;Q--;)Z.push(0);Z.reverse()}if(z=j.length,Q=G.length,z-Q<0)Q=z,Z=G,G=j,j=Z;for(J=0;Q;)J=(j[--Q]=j[Q]+G[Q]+J)/k7|0,j[Q]%=k7;if(J)j.unshift(J),++K;for(z=j.length;j[--z]==0;)j.pop();return $.d=j,$.e=V$(j,K),A0?Y0($,q,W):$};Z0.precision=Z0.sd=function($){var J,Z=this;if($!==void 0&&$!==!!$&&$!==1&&$!==0)throw Error(c7+$);if(Z.d){if(J=uJ(Z.d),$&&Z.e+1>J)J=Z.e+1}else J=NaN;return J};Z0.round=function(){var $=this,J=$.constructor;return Y0(new J($),$.e+1,J.rounding)};Z0.sine=Z0.sin=function(){var $,J,Z=this,K=Z.constructor;if(!Z.isFinite())return new K(NaN);if(Z.isZero())return new K(Z);return $=K.precision,J=K.rounding,K.precision=$+Math.max(Z.e,Z.sd())+w0,K.rounding=1,Z=FZ(K,dJ(K,Z)),K.precision=$,K.rounding=J,Y0(S7>2?Z.neg():Z,$,J,!0)};Z0.squareRoot=Z0.sqrt=function(){var $,J,Z,K,Q,H,z=this,q=z.d,W=z.e,j=z.s,G=z.constructor;if(j!==1||!q||!q[0])return new G(!j||j<0&&(!q||q[0])?NaN:q?z:1/0);if(A0=!1,j=Math.sqrt(+z),j==0||j==1/0){if(J=o0(q),(J.length+W)%2==0)J+="0";if(j=Math.sqrt(J),W=a0((W+1)/2)-(W<0||W%2),j==1/0)J="5e"+W;else J=j.toExponential(),J=J.slice(0,J.indexOf("e")+1)+W;K=new G(J)}else K=new G(j.toString());Z=(W=G.precision)+3;for(;;)if(H=K,K=H.plus(v0(z,H,Z+2,1)).times(0.5),o0(H.d).slice(0,Z)===(J=o0(K.d)).slice(0,Z))if(J=J.slice(Z-3,Z+1),J=="9999"||!Q&&J=="4999"){if(!Q){if(Y0(H,W+1,0),H.times(H).eq(z)){K=H;break}}Z+=4,Q=1}else{if(!+J||!+J.slice(1)&&J.charAt(0)=="5")Y0(K,W+1,1),$=!K.times(K).eq(z);break}return A0=!0,Y0(K,W,G.rounding,$)};Z0.tangent=Z0.tan=function(){var $,J,Z=this,K=Z.constructor;if(!Z.isFinite())return new K(NaN);if(Z.isZero())return new K(Z);return $=K.precision,J=K.rounding,K.precision=$+10,K.rounding=1,Z=Z.sin(),Z.s=1,Z=v0(Z,new K(1).minus(Z.times(Z)).sqrt(),$+10,0),K.precision=$,K.rounding=J,Y0(S7==2||S7==4?Z.neg():Z,$,J,!0)};Z0.times=Z0.mul=function($){var J,Z,K,Q,H,z,q,W,j,G=this,F=G.constructor,_=G.d,U=($=new F($)).d;if($.s*=G.s,!_||!_[0]||!U||!U[0])return new F(!$.s||_&&!_[0]&&!U||U&&!U[0]&&!_?NaN:!_||!U?$.s/0:$.s*0);if(Z=a0(G.e/w0)+a0($.e/w0),W=_.length,j=U.length,W<j)H=_,_=U,U=H,z=W,W=j,j=z;H=[],z=W+j;for(K=z;K--;)H.push(0);for(K=j;--K>=0;){J=0;for(Q=W+K;Q>K;)q=H[Q]+U[K]*_[Q-K-1]+J,H[Q--]=q%k7|0,J=q/k7|0;H[Q]=(H[Q]+J)%k7|0}for(;!H[--z];)H.pop();if(J)++Z;else H.shift();return $.d=H,$.e=V$(H,Z),A0?Y0($,F.precision,F.rounding):$};Z0.toBinary=function($,J){return U9(this,2,$,J)};Z0.toDecimalPlaces=Z0.toDP=function($,J){var Z=this,K=Z.constructor;if(Z=new K(Z),$===void 0)return Z;if($7($,0,l7),J===void 0)J=K.rounding;else $7(J,0,8);return Y0(Z,$+Z.e+1,J)};Z0.toExponential=function($,J){var Z,K=this,Q=K.constructor;if($===void 0)Z=I7(K,!0);else{if($7($,0,l7),J===void 0)J=Q.rounding;else $7(J,0,8);K=Y0(new Q(K),$+1,J),Z=I7(K,!0,$+1)}return K.isNeg()&&!K.isZero()?"-"+Z:Z};Z0.toFixed=function($,J){var Z,K,Q=this,H=Q.constructor;if($===void 0)Z=I7(Q);else{if($7($,0,l7),J===void 0)J=H.rounding;else $7(J,0,8);K=Y0(new H(Q),$+Q.e+1,J),Z=I7(K,!1,$+K.e+1)}return Q.isNeg()&&!Q.isZero()?"-"+Z:Z};Z0.toFraction=function($){var J,Z,K,Q,H,z,q,W,j,G,F,_,U=this,O=U.d,V=U.constructor;if(!O)return new V(U);if(j=Z=new V(1),K=W=new V(0),J=new V(K),H=J.e=uJ(O)-U.e-1,z=H%w0,J.d[0]=p0(10,z<0?w0+z:z),$==null)$=H>0?J:j;else{if(q=new V($),!q.isInt()||q.lt(j))throw Error(c7+q);$=q.gt(J)?H>0?J:j:q}A0=!1,q=new V(o0(O)),G=V.precision,V.precision=H=O.length*w0*2;for(;;){if(F=v0(q,J,0,1,1),Q=Z.plus(F.times(K)),Q.cmp($)==1)break;Z=K,K=Q,Q=j,j=W.plus(F.times(Q)),W=Q,Q=J,J=q.minus(F.times(Q)),q=Q}return Q=v0($.minus(Z),K,0,1,1),W=W.plus(Q.times(j)),Z=Z.plus(Q.times(K)),W.s=j.s=U.s,_=v0(j,K,H,1).minus(U).abs().cmp(v0(W,Z,H,1).minus(U).abs())<1?[j,K]:[W,Z],V.precision=G,A0=!0,_};Z0.toHexadecimal=Z0.toHex=function($,J){return U9(this,16,$,J)};Z0.toNearest=function($,J){var Z=this,K=Z.constructor;if(Z=new K(Z),$==null){if(!Z.d)return Z;$=new K(1),J=K.rounding}else{if($=new K($),J===void 0)J=K.rounding;else $7(J,0,8);if(!Z.d)return $.s?Z:$;if(!$.d){if($.s)$.s=Z.s;return $}}if($.d[0])A0=!1,Z=v0(Z,$,0,J,1).times($),A0=!0,Y0(Z);else $.s=Z.s,Z=$;return Z};Z0.toNumber=function(){return+this};Z0.toOctal=function($,J){return U9(this,8,$,J)};Z0.toPower=Z0.pow=function($){var J,Z,K,Q,H,z,q=this,W=q.constructor,j=+($=new W($));if(!q.d||!$.d||!q.d[0]||!$.d[0])return new W(p0(+q,j));if(q=new W(q),q.eq(1))return q;if(K=W.precision,H=W.rounding,$.eq(1))return Y0(q,K,H);if(J=a0($.e/w0),J>=$.d.length-1&&(Z=j<0?-j:j)<=qZ)return Q=gJ(W,q,Z,K),$.s<0?new W(1).div(Q):Y0(Q,K,H);if(z=q.s,z<0){if(J<$.d.length-1)return new W(NaN);if(($.d[J]&1)==0)z=1;if(q.e==0&&q.d[0]==1&&q.d.length==1)return q.s=z,q}if(Z=p0(+q,j),J=Z==0||!isFinite(Z)?a0(j*(Math.log("0."+o0(q.d))/Math.LN10+q.e+1)):new W(Z+"").e,J>W.maxE+1||J<W.minE-1)return new W(J>0?z/0:0);if(A0=!1,W.rounding=q.s=1,Z=Math.min(12,(J+"").length),Q=_9($.times(p7(q,K+Z)),K),Q.d){if(Q=Y0(Q,K+5,1),v6(Q.d,K,H)){if(J=K+10,Q=Y0(_9($.times(p7(q,J+Z)),J),J+5,1),+o0(Q.d).slice(K+1,K+15)+1==100000000000000)Q=Y0(Q,K+1,0)}}return Q.s=z,A0=!0,W.rounding=H,Y0(Q,K,H)};Z0.toPrecision=function($,J){var Z,K=this,Q=K.constructor;if($===void 0)Z=I7(K,K.e<=Q.toExpNeg||K.e>=Q.toExpPos);else{if($7($,1,l7),J===void 0)J=Q.rounding;else $7(J,0,8);K=Y0(new Q(K),$,J),Z=I7(K,$<=K.e||K.e<=Q.toExpNeg,$)}return K.isNeg()&&!K.isZero()?"-"+Z:Z};Z0.toSignificantDigits=Z0.toSD=function($,J){var Z=this,K=Z.constructor;if($===void 0)$=K.precision,J=K.rounding;else if($7($,1,l7),J===void 0)J=K.rounding;else $7(J,0,8);return Y0(new K(Z),$,J)};Z0.toString=function(){var $=this,J=$.constructor,Z=I7($,$.e<=J.toExpNeg||$.e>=J.toExpPos);return $.isNeg()&&!$.isZero()?"-"+Z:Z};Z0.truncated=Z0.trunc=function(){return Y0(new this.constructor(this),this.e+1,1)};Z0.valueOf=Z0.toJSON=function(){var $=this,J=$.constructor,Z=I7($,$.e<=J.toExpNeg||$.e>=J.toExpPos);return $.isNeg()?"-"+Z:Z};function o0($){var J,Z,K,Q=$.length-1,H="",z=$[0];if(Q>0){H+=z;for(J=1;J<Q;J++){if(K=$[J]+"",Z=w0-K.length,Z)H+=d7(Z);H+=K}if(z=$[J],K=z+"",Z=w0-K.length,Z)H+=d7(Z)}else if(z===0)return"0";for(;z%10===0;)z/=10;return H+z}function $7($,J,Z){if($!==~~$||$<J||$>Z)throw Error(c7+$)}function v6($,J,Z,K){var Q,H,z,q;for(H=$[0];H>=10;H/=10)--J;if(--J<0)J+=w0,Q=0;else Q=Math.ceil((J+1)/w0),J%=w0;if(H=p0(10,w0-J),q=$[Q]%H|0,K==null)if(J<3){if(J==0)q=q/100|0;else if(J==1)q=q/10|0;z=Z<4&&q==99999||Z>3&&q==49999||q==50000||q==0}else z=(Z<4&&q+1==H||Z>3&&q+1==H/2)&&($[Q+1]/H/100|0)==p0(10,J-2)-1||(q==H/2||q==0)&&($[Q+1]/H/100|0)==0;else if(J<4){if(J==0)q=q/1000|0;else if(J==1)q=q/100|0;else if(J==2)q=q/10|0;z=(K||Z<4)&&q==9999||!K&&Z>3&&q==4999}else z=((K||Z<4)&&q+1==H||!K&&Z>3&&q+1==H/2)&&($[Q+1]/H/1000|0)==p0(10,J-3)-1;return z}function W$($,J,Z){var K,Q=[0],H,z=0,q=$.length;for(;z<q;){for(H=Q.length;H--;)Q[H]*=J;Q[0]+=j9.indexOf($.charAt(z++));for(K=0;K<Q.length;K++)if(Q[K]>Z-1){if(Q[K+1]===void 0)Q[K+1]=0;Q[K+1]+=Q[K]/Z|0,Q[K]%=Z}}return Q.reverse()}function jZ($,J){var Z,K,Q;if(J.isZero())return J;if(K=J.d.length,K<32)Z=Math.ceil(K/3),Q=(1/M$(4,Z)).toString();else Z=16,Q="2.3283064365386962890625e-10";$.precision+=Z,J=V6($,1,J.times(Q),new $(1));for(var H=Z;H--;){var z=J.times(J);J=z.times(z).minus(z).times(8).plus(1)}return $.precision-=Z,J}var v0=function(){function $(K,Q,H){var z,q=0,W=K.length;for(K=K.slice();W--;)z=K[W]*Q+q,K[W]=z%H|0,q=z/H|0;if(q)K.unshift(q);return K}function J(K,Q,H,z){var q,W;if(H!=z)W=H>z?1:-1;else for(q=W=0;q<H;q++)if(K[q]!=Q[q]){W=K[q]>Q[q]?1:-1;break}return W}function Z(K,Q,H,z){var q=0;for(;H--;)K[H]-=q,q=K[H]<Q[H]?1:0,K[H]=q*z+K[H]-Q[H];for(;!K[0]&&K.length>1;)K.shift()}return function(K,Q,H,z,q,W){var j,G,F,_,U,O,V,M,Y,X,w,R,I,f,u,m,S,x,h,E,d=K.constructor,c=K.s==Q.s?1:-1,p=K.d,N=Q.d;if(!p||!p[0]||!N||!N[0])return new d(!K.s||!Q.s||(p?N&&p[0]==N[0]:!N)?NaN:p&&p[0]==0||!N?c*0:c/0);if(W)U=1,G=K.e-Q.e;else W=k7,U=w0,G=a0(K.e/U)-a0(Q.e/U);h=N.length,S=p.length,Y=new d(c),X=Y.d=[];for(F=0;N[F]==(p[F]||0);F++);if(N[F]>(p[F]||0))G--;if(H==null)f=H=d.precision,z=d.rounding;else if(q)f=H+(K.e-Q.e)+1;else f=H;if(f<0)X.push(1),O=!0;else{if(f=f/U+2|0,F=0,h==1){_=0,N=N[0],f++;for(;(F<S||_)&&f--;F++)u=_*W+(p[F]||0),X[F]=u/N|0,_=u%N|0;O=_||F<S}else{if(_=W/(N[0]+1)|0,_>1)N=$(N,_,W),p=$(p,_,W),h=N.length,S=p.length;m=h,w=p.slice(0,h),R=w.length;for(;R<h;)w[R++]=0;if(E=N.slice(),E.unshift(0),x=N[0],N[1]>=W/2)++x;do{if(_=0,j=J(N,w,h,R),j<0){if(I=w[0],h!=R)I=I*W+(w[1]||0);if(_=I/x|0,_>1){if(_>=W)_=W-1;if(V=$(N,_,W),M=V.length,R=w.length,j=J(V,w,M,R),j==1)_--,Z(V,h<M?E:N,M,W)}else{if(_==0)j=_=1;V=N.slice()}if(M=V.length,M<R)V.unshift(0);if(Z(w,V,R,W),j==-1){if(R=w.length,j=J(N,w,h,R),j<1)_++,Z(w,h<R?E:N,R,W)}R=w.length}else if(j===0)_++,w=[0];if(X[F++]=_,j&&w[0])w[R++]=p[m]||0;else w=[p[m]],R=1}while((m++<S||w[0]!==void 0)&&f--);O=w[0]!==void 0}if(!X[0])X.shift()}if(U==1)Y.e=G,SJ=O;else{for(F=1,_=X[0];_>=10;_/=10)F++;Y.e=F+G*U-1,Y0(Y,q?H+Y.e+1:H,z,O)}return Y}}();function Y0($,J,Z,K){var Q,H,z,q,W,j,G,F,_,U=$.constructor;$:if(J!=null){if(F=$.d,!F)return $;for(Q=1,q=F[0];q>=10;q/=10)Q++;if(H=J-Q,H<0)H+=w0,z=J,G=F[_=0],W=G/p0(10,Q-z-1)%10|0;else if(_=Math.ceil((H+1)/w0),q=F.length,_>=q)if(K){for(;q++<=_;)F.push(0);G=W=0,Q=1,H%=w0,z=H-w0+1}else break $;else{G=q=F[_];for(Q=1;q>=10;q/=10)Q++;H%=w0,z=H-w0+Q,W=z<0?0:G/p0(10,Q-z-1)%10|0}if(K=K||J<0||F[_+1]!==void 0||(z<0?G:G%p0(10,Q-z-1)),j=Z<4?(W||K)&&(Z==0||Z==($.s<0?3:2)):W>5||W==5&&(Z==4||K||Z==6&&(H>0?z>0?G/p0(10,Q-z):0:F[_-1])%10&1||Z==($.s<0?8:7)),J<1||!F[0]){if(F.length=0,j)J-=$.e+1,F[0]=p0(10,(w0-J%w0)%w0),$.e=-J||0;else F[0]=$.e=0;return $}if(H==0)F.length=_,q=1,_--;else F.length=_+1,q=p0(10,w0-H),F[_]=z>0?(G/p0(10,Q-z)%p0(10,z)|0)*q:0;if(j)for(;;)if(_==0){for(H=1,z=F[0];z>=10;z/=10)H++;z=F[0]+=q;for(q=1;z>=10;z/=10)q++;if(H!=q){if($.e++,F[0]==k7)F[0]=1}break}else{if(F[_]+=q,F[_]!=k7)break;F[_--]=0,q=1}for(H=F.length;F[--H]===0;)F.pop()}if(A0){if($.e>U.maxE)$.d=null,$.e=NaN;else if($.e<U.minE)$.e=0,$.d=[0]}return $}function I7($,J,Z){if(!$.isFinite())return mJ($);var K,Q=$.e,H=o0($.d),z=H.length;if(J){if(Z&&(K=Z-z)>0)H=H.charAt(0)+"."+H.slice(1)+d7(K);else if(z>1)H=H.charAt(0)+"."+H.slice(1);H=H+($.e<0?"e":"e+")+$.e}else if(Q<0){if(H="0."+d7(-Q-1)+H,Z&&(K=Z-z)>0)H+=d7(K)}else if(Q>=z){if(H+=d7(Q+1-z),Z&&(K=Z-Q-1)>0)H=H+"."+d7(K)}else{if((K=Q+1)<z)H=H.slice(0,K)+"."+H.slice(K);if(Z&&(K=Z-z)>0){if(Q+1===z)H+=".";H+=d7(K)}}return H}function V$($,J){var Z=$[0];for(J*=w0;Z>=10;Z/=10)J++;return J}function _$($,J,Z){if(J>WZ){if(A0=!0,Z)$.precision=Z;throw Error(vJ)}return Y0(new $(G$),J,1,!0)}function N7($,J,Z){if(J>F9)throw Error(vJ);return Y0(new $(F$),J,Z,!0)}function uJ($){var J=$.length-1,Z=J*w0+1;if(J=$[J],J){for(;J%10==0;J/=10)Z--;for(J=$[0];J>=10;J/=10)Z++}return Z}function d7($){var J="";for(;$--;)J+="0";return J}function gJ($,J,Z,K){var Q,H=new $(1),z=Math.ceil(K/w0+4);A0=!1;for(;;){if(Z%2){if(H=H.times(J),bJ(H.d,z))Q=!0}if(Z=a0(Z/2),Z===0){if(Z=H.d.length-1,Q&&H.d[Z]===0)++H.d[Z];break}J=J.times(J),bJ(J.d,z)}return A0=!0,H}function TJ($){return $.d[$.d.length-1]&1}function xJ($,J,Z){var K,Q,H=new $(J[0]),z=0;for(;++z<J.length;){if(Q=new $(J[z]),!Q.s){H=Q;break}if(K=H.cmp(Q),K===Z||K===0&&H.s===Z)H=Q}return H}function _9($,J){var Z,K,Q,H,z,q,W,j=0,G=0,F=0,_=$.constructor,U=_.rounding,O=_.precision;if(!$.d||!$.d[0]||$.e>17)return new _($.d?!$.d[0]?1:$.s<0?0:1/0:$.s?$.s<0?0:$:NaN);if(J==null)A0=!1,W=O;else W=J;q=new _(0.03125);while($.e>-2)$=$.times(q),F+=5;K=Math.log(p0(2,F))/Math.LN10*2+5|0,W+=K,Z=H=z=new _(1),_.precision=W;for(;;){if(H=Y0(H.times($),W,1),Z=Z.times(++G),q=z.plus(v0(H,Z,W,1)),o0(q.d).slice(0,W)===o0(z.d).slice(0,W)){Q=F;while(Q--)z=Y0(z.times(z),W,1);if(J==null)if(j<3&&v6(z.d,W-K,U,j))_.precision=W+=10,Z=H=q=new _(1),G=0,j++;else return Y0(z,_.precision=O,U,A0=!0);else return _.precision=O,z}z=q}}function p7($,J){var Z,K,Q,H,z,q,W,j,G,F,_,U=1,O=10,V=$,M=V.d,Y=V.constructor,X=Y.rounding,w=Y.precision;if(V.s<0||!M||!M[0]||!V.e&&M[0]==1&&M.length==1)return new Y(M&&!M[0]?-1/0:V.s!=1?NaN:M?0:V);if(J==null)A0=!1,G=w;else G=J;if(Y.precision=G+=O,Z=o0(M),K=Z.charAt(0),Math.abs(H=V.e)<1500000000000000){while(K<7&&K!=1||K==1&&Z.charAt(1)>3)V=V.times($),Z=o0(V.d),K=Z.charAt(0),U++;if(H=V.e,K>1)V=new Y("0."+Z),H++;else V=new Y(K+"."+Z.slice(1))}else return j=_$(Y,G+2,w).times(H+""),V=p7(new Y(K+"."+Z.slice(1)),G-O).plus(j),Y.precision=w,J==null?Y0(V,w,X,A0=!0):V;F=V,W=z=V=v0(V.minus(1),V.plus(1),G,1),_=Y0(V.times(V),G,1),Q=3;for(;;){if(z=Y0(z.times(_),G,1),j=W.plus(v0(z,new Y(Q),G,1)),o0(j.d).slice(0,G)===o0(W.d).slice(0,G)){if(W=W.times(2),H!==0)W=W.plus(_$(Y,G+2,w).times(H+""));if(W=v0(W,new Y(U),G,1),J==null)if(v6(W.d,G-O,X,q))Y.precision=G+=O,j=z=V=v0(F.minus(1),F.plus(1),G,1),_=Y0(V.times(V),G,1),Q=q=1;else return Y0(W,Y.precision=w,X,A0=!0);else return Y.precision=w,W}W=j,Q+=2}}function mJ($){return String($.s*$.s/0)}function j$($,J){var Z,K,Q;if((Z=J.indexOf("."))>-1)J=J.replace(".","");if((K=J.search(/e/i))>0){if(Z<0)Z=K;Z+=+J.slice(K+1),J=J.substring(0,K)}else if(Z<0)Z=J.length;for(K=0;J.charCodeAt(K)===48;K++);for(Q=J.length;J.charCodeAt(Q-1)===48;--Q);if(J=J.slice(K,Q),J){if(Q-=K,$.e=Z=Z-K-1,$.d=[],K=(Z+1)%w0,Z<0)K+=w0;if(K<Q){if(K)$.d.push(+J.slice(0,K));for(Q-=w0;K<Q;)$.d.push(+J.slice(K,K+=w0));J=J.slice(K),K=w0-J.length}else K-=Q;for(;K--;)J+="0";if($.d.push(+J),A0){if($.e>$.constructor.maxE)$.d=null,$.e=NaN;else if($.e<$.constructor.minE)$.e=0,$.d=[0]}}else $.e=0,$.d=[0];return $}function GZ($,J){var Z,K,Q,H,z,q,W,j,G;if(J.indexOf("_")>-1){if(J=J.replace(/(\d)_(?=\d)/g,"$1"),yJ.test(J))return j$($,J)}else if(J==="Infinity"||J==="NaN"){if(!+J)$.s=NaN;return $.e=NaN,$.d=null,$}if(HZ.test(J))Z=16,J=J.toLowerCase();else if(QZ.test(J))Z=2;else if(zZ.test(J))Z=8;else throw Error(c7+J);if(H=J.search(/p/i),H>0)W=+J.slice(H+1),J=J.substring(2,H);else J=J.slice(2);if(H=J.indexOf("."),z=H>=0,K=$.constructor,z)J=J.replace(".",""),q=J.length,H=q-H,Q=gJ(K,new K(Z),H,H*2);j=W$(J,Z,k7),G=j.length-1;for(H=G;j[H]===0;--H)j.pop();if(H<0)return new K($.s*0);if($.e=V$(j,G),$.d=j,A0=!1,z)$=v0($,Q,q*4);if(W)$=$.times(Math.abs(W)<54?p0(2,W):D6.pow(2,W));return A0=!0,$}function FZ($,J){var Z,K=J.d.length;if(K<3)return J.isZero()?J:V6($,2,J,J);Z=1.4*Math.sqrt(K),Z=Z>16?16:Z|0,J=J.times(1/M$(5,Z)),J=V6($,2,J,J);var Q,H=new $(5),z=new $(16),q=new $(20);for(;Z--;)Q=J.times(J),J=J.times(H.plus(Q.times(z.times(Q).minus(q))));return J}function V6($,J,Z,K,Q){var H,z,q,W,j=1,G=$.precision,F=Math.ceil(G/w0);A0=!1,W=Z.times(Z),q=new $(K);for(;;){if(z=v0(q.times(W),new $(J++*J++),G,1),q=Q?K.plus(z):K.minus(z),K=v0(z.times(W),new $(J++*J++),G,1),z=q.plus(K),z.d[F]!==void 0){for(H=F;z.d[H]===q.d[H]&&H--;);if(H==-1)break}H=q,q=K,K=z,z=H,j++}return A0=!0,z.d.length=F+1,z}function M$($,J){var Z=$;while(--J)Z*=$;return Z}function dJ($,J){var Z,K=J.s<0,Q=N7($,$.precision,1),H=Q.times(0.5);if(J=J.abs(),J.lte(H))return S7=K?4:1,J;if(Z=J.divToInt(Q),Z.isZero())S7=K?3:2;else{if(J=J.minus(Z.times(Q)),J.lte(H))return S7=TJ(Z)?K?2:3:K?4:1,J;S7=TJ(Z)?K?1:4:K?3:2}return J.minus(Q).abs()}function U9($,J,Z,K){var Q,H,z,q,W,j,G,F,_,U=$.constructor,O=Z!==void 0;if(O)if($7(Z,1,l7),K===void 0)K=U.rounding;else $7(K,0,8);else Z=U.precision,K=U.rounding;if(!$.isFinite())G=mJ($);else{if(G=I7($),z=G.indexOf("."),O){if(Q=2,J==16)Z=Z*4-3;else if(J==8)Z=Z*3-2}else Q=J;if(z>=0)G=G.replace(".",""),_=new U(1),_.e=G.length-z,_.d=W$(I7(_),10,Q),_.e=_.d.length;F=W$(G,10,Q),H=W=F.length;for(;F[--W]==0;)F.pop();if(!F[0])G=O?"0p+0":"0";else{if(z<0)H--;else $=new U($),$.d=F,$.e=H,$=v0($,_,Z,K,0,Q),F=$.d,H=$.e,j=SJ;if(z=F[Z],q=Q/2,j=j||F[Z+1]!==void 0,j=K<4?(z!==void 0||j)&&(K===0||K===($.s<0?3:2)):z>q||z===q&&(K===4||j||K===6&&F[Z-1]&1||K===($.s<0?8:7)),F.length=Z,j){for(;++F[--Z]>Q-1;)if(F[Z]=0,!Z)++H,F.unshift(1)}for(W=F.length;!F[W-1];--W);for(z=0,G="";z<W;z++)G+=j9.charAt(F[z]);if(O){if(W>1)if(J==16||J==8){z=J==16?4:3;for(--W;W%z;W++)G+="0";F=W$(G,Q,J);for(W=F.length;!F[W-1];--W);for(z=1,G="1.";z<W;z++)G+=j9.charAt(F[z])}else G=G.charAt(0)+"."+G.slice(1);G=G+(H<0?"p":"p+")+H}else if(H<0){for(;++H;)G="0"+G;G="0."+G}else if(++H>W)for(H-=W;H--;)G+="0";else if(H<W)G=G.slice(0,H)+"."+G.slice(H)}G=(J==16?"0x":J==2?"0b":J==8?"0o":"")+G}return $.s<0?"-"+G:G}function bJ($,J){if($.length>J)return $.length=J,!0}function _Z($){return new this($).abs()}function UZ($){return new this($).acos()}function VZ($){return new this($).acosh()}function MZ($,J){return new this($).plus(J)}function OZ($){return new this($).asin()}function YZ($){return new this($).asinh()}function XZ($){return new this($).atan()}function kZ($){return new this($).atanh()}function LZ($,J){$=new this($),J=new this(J);var Z,K=this.precision,Q=this.rounding,H=K+4;if(!$.s||!J.s)Z=new this(NaN);else if(!$.d&&!J.d)Z=N7(this,H,1).times(J.s>0?0.25:0.75),Z.s=$.s;else if(!J.d||$.isZero())Z=J.s<0?N7(this,K,Q):new this(0),Z.s=$.s;else if(!$.d||J.isZero())Z=N7(this,H,1).times(0.5),Z.s=$.s;else if(J.s<0)this.precision=H,this.rounding=1,Z=this.atan(v0($,J,H,1)),J=N7(this,H,1),this.precision=K,this.rounding=Q,Z=$.s<0?Z.minus(J):Z.plus(J);else Z=this.atan(v0($,J,H,1));return Z}function wZ($){return new this($).cbrt()}function RZ($){return Y0($=new this($),$.e+1,2)}function BZ($,J,Z){return new this($).clamp(J,Z)}function NZ($){if(!$||typeof $!=="object")throw Error(U$+"Object expected");var J,Z,K,Q=$.defaults===!0,H=["precision",1,l7,"rounding",0,8,"toExpNeg",-U6,0,"toExpPos",0,U6,"maxE",0,U6,"minE",-U6,0,"modulo",0,9];for(J=0;J<H.length;J+=3){if(Z=H[J],Q)this[Z]=G9[Z];if((K=$[Z])!==void 0)if(a0(K)===K&&K>=H[J+1]&&K<=H[J+2])this[Z]=K;else throw Error(c7+Z+": "+K)}if(Z="crypto",Q)this[Z]=G9[Z];if((K=$[Z])!==void 0)if(K===!0||K===!1||K===0||K===1)if(K)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[Z]=!0;else throw Error(DJ);else this[Z]=!1;else throw Error(c7+Z+": "+K);return this}function IZ($){return new this($).cos()}function CZ($){return new this($).cosh()}function pJ($){var J,Z,K;function Q(H){var z,q,W,j=this;if(!(j instanceof Q))return new Q(H);if(j.constructor=Q,fJ(H)){if(j.s=H.s,A0)if(!H.d||H.e>Q.maxE)j.e=NaN,j.d=null;else if(H.e<Q.minE)j.e=0,j.d=[0];else j.e=H.e,j.d=H.d.slice();else j.e=H.e,j.d=H.d?H.d.slice():H.d;return}if(W=typeof H,W==="number"){if(H===0){j.s=1/H<0?-1:1,j.e=0,j.d=[0];return}if(H<0)H=-H,j.s=-1;else j.s=1;if(H===~~H&&H<1e7){for(z=0,q=H;q>=10;q/=10)z++;if(A0)if(z>Q.maxE)j.e=NaN,j.d=null;else if(z<Q.minE)j.e=0,j.d=[0];else j.e=z,j.d=[H];else j.e=z,j.d=[H];return}if(H*0!==0){if(!H)j.s=NaN;j.e=NaN,j.d=null;return}return j$(j,H.toString())}if(W==="string"){if((q=H.charCodeAt(0))===45)H=H.slice(1),j.s=-1;else{if(q===43)H=H.slice(1);j.s=1}return yJ.test(H)?j$(j,H):GZ(j,H)}if(W==="bigint"){if(H<0)H=-H,j.s=-1;else j.s=1;return j$(j,H.toString())}throw Error(c7+H)}if(Q.prototype=Z0,Q.ROUND_UP=0,Q.ROUND_DOWN=1,Q.ROUND_CEIL=2,Q.ROUND_FLOOR=3,Q.ROUND_HALF_UP=4,Q.ROUND_HALF_DOWN=5,Q.ROUND_HALF_EVEN=6,Q.ROUND_HALF_CEIL=7,Q.ROUND_HALF_FLOOR=8,Q.EUCLID=9,Q.config=Q.set=NZ,Q.clone=pJ,Q.isDecimal=fJ,Q.abs=_Z,Q.acos=UZ,Q.acosh=VZ,Q.add=MZ,Q.asin=OZ,Q.asinh=YZ,Q.atan=XZ,Q.atanh=kZ,Q.atan2=LZ,Q.cbrt=wZ,Q.ceil=RZ,Q.clamp=BZ,Q.cos=IZ,Q.cosh=CZ,Q.div=PZ,Q.exp=AZ,Q.floor=EZ,Q.hypot=TZ,Q.ln=bZ,Q.log=fZ,Q.log10=vZ,Q.log2=SZ,Q.max=DZ,Q.min=hZ,Q.mod=yZ,Q.mul=uZ,Q.pow=gZ,Q.random=xZ,Q.round=mZ,Q.sign=dZ,Q.sin=pZ,Q.sinh=cZ,Q.sqrt=lZ,Q.sub=nZ,Q.sum=sZ,Q.tan=oZ,Q.tanh=iZ,Q.trunc=rZ,$===void 0)$={};if($){if($.defaults!==!0){K=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];for(J=0;J<K.length;)if(!$.hasOwnProperty(Z=K[J++]))$[Z]=this[Z]}}return Q.config($),Q}function PZ($,J){return new this($).div(J)}function AZ($){return new this($).exp()}function EZ($){return Y0($=new this($),$.e+1,3)}function TZ(){var $,J,Z=new this(0);A0=!1;for($=0;$<arguments.length;)if(J=new this(arguments[$++]),!J.d){if(J.s)return A0=!0,new this(1/0);Z=J}else if(Z.d)Z=Z.plus(J.times(J));return A0=!0,Z.sqrt()}function fJ($){return $ instanceof D6||$&&$.toStringTag===hJ||!1}function bZ($){return new this($).ln()}function fZ($,J){return new this($).log(J)}function SZ($){return new this($).log(2)}function vZ($){return new this($).log(10)}function DZ(){return xJ(this,arguments,-1)}function hZ(){return xJ(this,arguments,1)}function yZ($,J){return new this($).mod(J)}function uZ($,J){return new this($).mul(J)}function gZ($,J){return new this($).pow(J)}function xZ($){var J,Z,K,Q,H=0,z=new this(1),q=[];if($===void 0)$=this.precision;else $7($,1,l7);if(K=Math.ceil($/w0),!this.crypto)for(;H<K;)q[H++]=Math.random()*1e7|0;else if(crypto.getRandomValues){J=crypto.getRandomValues(new Uint32Array(K));for(;H<K;)if(Q=J[H],Q>=4290000000)J[H]=crypto.getRandomValues(new Uint32Array(1))[0];else q[H++]=Q%1e7}else if(crypto.randomBytes){J=crypto.randomBytes(K*=4);for(;H<K;)if(Q=J[H]+(J[H+1]<<8)+(J[H+2]<<16)+((J[H+3]&127)<<24),Q>=2140000000)crypto.randomBytes(4).copy(J,H);else q.push(Q%1e7),H+=4;H=K/4}else throw Error(DJ);if(K=q[--H],$%=w0,K&&$)Q=p0(10,w0-$),q[H]=(K/Q|0)*Q;for(;q[H]===0;H--)q.pop();if(H<0)Z=0,q=[0];else{Z=-1;for(;q[0]===0;Z-=w0)q.shift();for(K=1,Q=q[0];Q>=10;Q/=10)K++;if(K<w0)Z-=w0-K}return z.e=Z,z.d=q,z}function mZ($){return Y0($=new this($),$.e+1,this.rounding)}function dZ($){return $=new this($),$.d?$.d[0]?$.s:0*$.s:$.s||NaN}function pZ($){return new this($).sin()}function cZ($){return new this($).sinh()}function lZ($){return new this($).sqrt()}function nZ($,J){return new this($).sub(J)}function sZ(){var $=0,J=arguments,Z=new this(J[$]);A0=!1;for(;Z.s&&++$<J.length;)Z=Z.plus(J[$]);return A0=!0,Y0(Z,this.precision,this.rounding)}function oZ($){return new this($).tan()}function iZ($){return new this($).tanh()}function rZ($){return Y0($=new this($),$.e+1,1)}Z0[Symbol.for("nodejs.util.inspect.custom")]=Z0.toString;Z0[Symbol.toStringTag]="Decimal";var D6=Z0.constructor=pJ(G9);G$=new D6(G$);F$=new D6(F$);var k=D6;k.set({precision:80});var Mq=new k("1e-40"),Oq=new k("1e-10");var V9=($)=>{if($===null||$===void 0)throw new Error(`Cannot convert ${$===null?"null":"undefined"} to Decimal`);if($ instanceof k)return $;try{return new k($)}catch(J){throw new Error(`Invalid numeric value: ${J.message}`)}};class D0{constructor($){if(!Array.isArray($))throw new Error("Vector requires array");if($.length===0)throw new Error("Vector requires at least one component");try{this.data=$.map((J,Z)=>{if(J===null||J===void 0)throw new Error(`Vector component at index ${Z} is ${J===null?"null":"undefined"}`);return V9(J)})}catch(J){throw new Error(`Vector constructor failed: ${J.message}`)}this.length=this.data.length}static from($){if($===null||$===void 0)throw new Error(`Vector.from: argument is ${$===null?"null":"undefined"}`);return new D0($)}clone(){return new D0(this.data.map(($)=>new k($)))}toArray(){return this.data.slice()}toNumberArray(){return this.data.map(($)=>$.toNumber())}toStringArray(){return this.data.map(($)=>$.toString())}add($){if(!$||!($ instanceof D0))throw new Error("add: argument must be a Vector");if(this.length!==$.length)throw new Error(`add: dimension mismatch (${this.length} vs ${$.length})`);return new D0(this.data.map((J,Z)=>J.plus($.data[Z])))}sub($){if(!$||!($ instanceof D0))throw new Error("sub: argument must be a Vector");if(this.length!==$.length)throw new Error(`sub: dimension mismatch (${this.length} vs ${$.length})`);return new D0(this.data.map((J,Z)=>J.minus($.data[Z])))}scale($){if($===null||$===void 0)throw new Error(`scale: scalar is ${$===null?"null":"undefined"}`);let J;try{J=V9($)}catch(Z){throw new Error(`scale: invalid scalar - ${Z.message}`)}return new D0(this.data.map((Z)=>Z.mul(J)))}negate(){return new D0(this.data.map(($)=>$.negated()))}dot($){if(!$||!($ instanceof D0))throw new Error("dot: argument must be a Vector");if(this.length!==$.length)throw new Error(`dot: dimension mismatch (${this.length} vs ${$.length})`);return this.data.reduce((J,Z,K)=>J.plus(Z.mul($.data[K])),new k(0))}outer($){if(!$||!($ instanceof D0))throw new Error("outer: argument must be a Vector");if(this.length===0||$.length===0)throw new Error("outer: cannot compute outer product with empty vector");let J=this.length,Z=$.length;return Array.from({length:J},(Q,H)=>Array.from({length:Z},(z,q)=>this.data[H].mul($.data[q])))}cross($){if(!$||!($ instanceof D0))throw new Error("cross: argument must be a Vector");if(this.length!==3||$.length!==3)throw new Error(`cross: requires 3D vectors (got ${this.length}D and ${$.length}D)`);let[J,Z,K]=this.data,[Q,H,z]=$.data;return new D0([Z.mul(z).minus(K.mul(H)),K.mul(Q).minus(J.mul(z)),J.mul(H).minus(Z.mul(Q))])}norm(){let $=new k(0);for(let J of this.data)$=$.plus(J.mul(J));return $.sqrt()}normalize(){let $=this.norm();if($.isZero())throw new Error("Cannot normalize zero vector");return this.scale(new k(1).div($))}angleBetween($){if(!$||!($ instanceof D0))throw new Error("angleBetween: argument must be a Vector");if(this.length!==$.length)throw new Error(`angleBetween: dimension mismatch (${this.length} vs ${$.length})`);let J=this.dot($),Z=this.norm(),K=$.norm();if(Z.isZero()||K.isZero())throw new Error("angleBetween: angle with zero vector is undefined");let H=J.div(Z.mul(K)).toNumber(),z=Math.min(1,Math.max(-1,H));return new k(Math.acos(z))}projectOnto($){if(!$||!($ instanceof D0))throw new Error("projectOnto: argument must be a Vector");if(this.length!==$.length)throw new Error(`projectOnto: dimension mismatch (${this.length} vs ${$.length})`);let J=$.dot($);if(J.isZero())throw new Error("projectOnto: cannot project onto zero vector");let Z=this.dot($).div(J);return $.scale(Z)}orthogonal(){if(this.norm().isZero())throw new Error("orthogonal: cannot find orthogonal vector to zero vector");if(this.length===2)return new D0([this.data[1].negated(),this.data[0]]);for(let J=0;J<this.length;J++){let Z=Array.from({length:this.length},(q,W)=>new k(W===J?1:0)),K=new D0(Z),Q=K.projectOnto(this),H=K.sub(Q);if(!H.norm().isZero())return H.normalize()}throw new Error("orthogonal: unable to find orthogonal vector (degenerate case)")}isOrthogonalTo($){if(!$||!($ instanceof D0))throw new Error("isOrthogonalTo: argument must be a Vector");if(this.length!==$.length)throw new Error(`isOrthogonalTo: dimension mismatch (${this.length} vs ${$.length})`);return this.dot($).isZero()}distance($){if(!$||!($ instanceof D0))throw new Error("distance: argument must be a Vector");if(this.length!==$.length)throw new Error(`distance: dimension mismatch (${this.length} vs ${$.length})`);return this.sub($).norm()}equals($,J=0){if(!($ instanceof D0))return!1;if($.length!==this.length)return!1;if(J===null)throw new Error("equals: tolerance cannot be null");let Z;try{if(Z=V9(J),Z.isNaN())throw new Error("equals: tolerance cannot be NaN");if(Z.isNegative())throw new Error("equals: tolerance must be non-negative")}catch(K){throw new Error(`equals: invalid tolerance - ${K.message}`)}for(let K=0;K<this.length;K++)if(this.data[K].minus($.data[K]).abs().greaterThan(Z))return!1;return!0}}var M6=($)=>{if($==null)throw new Error("Cannot convert null or undefined to Decimal");return $ instanceof k?$:new k($)};class U0{constructor($){if(!Array.isArray($)||$.length===0)throw new Error("Matrix requires non-empty 2D array");if(!Array.isArray($[0])||$[0].length===0)throw new Error("Matrix rows must be non-empty arrays");let J=$[0].length;for(let Z of $)if(!Array.isArray(Z)||Z.length!==J)throw new Error("All rows must have same length");this.data=$.map((Z)=>Z.map((K)=>M6(K))),this.rows=$.length,this.cols=J}static from($){return new U0($)}static zeros($,J){if(!Number.isInteger($)||$<=0)throw new Error("rows must be a positive integer");if(!Number.isInteger(J)||J<=0)throw new Error("cols must be a positive integer");let Z=Array.from({length:$},()=>Array.from({length:J},()=>new k(0)));return new U0(Z)}static identity($){if(!Number.isInteger($)||$<=0)throw new Error("size must be a positive integer");let J=Array.from({length:$},(Z,K)=>Array.from({length:$},(Q,H)=>K===H?new k(1):new k(0)));return new U0(J)}clone(){return new U0(this.data.map(($)=>$.map((J)=>new k(J))))}toArrayOfStrings(){return this.data.map(($)=>$.map((J)=>J.toString()))}toNumberArray(){return this.data.map(($)=>$.map((J)=>J.toNumber()))}isSquare(){return this.rows===this.cols}applyToVector($){let J;if($ instanceof D0)J=$;else if(Array.isArray($))J=D0.from($);else throw new Error("applyToVector expects Vector or array");if(this.cols!==J.length)throw new Error("shape mismatch: matrix cols must equal vector length");let Z=[];for(let K=0;K<this.rows;K++){let Q=new k(0);for(let H=0;H<this.cols;H++)Q=Q.plus(this.data[K][H].mul(J.data[H]));Z.push(Q)}return new D0(Z)}add($){if($ instanceof U0){if(this.rows!==$.rows||this.cols!==$.cols)throw new Error("shape mismatch: matrices must have same dimensions");return new U0(this.data.map((J,Z)=>J.map((K,Q)=>K.plus($.data[Z][Q]))))}else{let J=M6($);return new U0(this.data.map((Z)=>Z.map((K)=>K.plus(J))))}}sub($){if($ instanceof U0){if(this.rows!==$.rows||this.cols!==$.cols)throw new Error("shape mismatch: matrices must have same dimensions");return new U0(this.data.map((J,Z)=>J.map((K,Q)=>K.minus($.data[Z][Q]))))}else{let J=M6($);return new U0(this.data.map((Z)=>Z.map((K)=>K.minus(J))))}}mul($){if($ instanceof U0){if(this.cols!==$.rows)throw new Error("shape mismatch: A.cols must equal B.rows for matrix multiplication");let J=Array.from({length:this.rows},()=>Array.from({length:$.cols},()=>new k(0)));for(let Z=0;Z<this.rows;Z++)for(let K=0;K<this.cols;K++){let Q=this.data[Z][K];if(Q.isZero())continue;for(let H=0;H<$.cols;H++)J[Z][H]=J[Z][H].plus(Q.mul($.data[K][H]))}return new U0(J)}else{let J=M6($);return new U0(this.data.map((Z)=>Z.map((K)=>K.mul(J))))}}div($){let J=M6($);if(J.isZero())throw new Error("Cannot divide by zero");return new U0(this.data.map((Z)=>Z.map((K)=>K.div(J))))}negate(){return new U0(this.data.map(($)=>$.map((J)=>J.negated())))}transpose(){let $=Array.from({length:this.cols},(J,Z)=>Array.from({length:this.rows},(K,Q)=>new k(this.data[Q][Z])));return new U0($)}trace(){if(!this.isSquare())throw new Error("Trace only defined for square matrices");let $=new k(0);for(let J=0;J<this.rows;J++)$=$.plus(this.data[J][J]);return $}equals($,J=0){if(!($ instanceof U0))return!1;if(this.rows!==$.rows||this.cols!==$.cols)return!1;let Z=M6(J);if(Z.isNegative()||!Z.isFinite())throw new Error("tolerance must be non-negative and finite");for(let K=0;K<this.rows;K++)for(let Q=0;Q<this.cols;Q++)if(this.data[K][Q].minus($.data[K][Q]).abs().greaterThan(Z))return!1;return!0}lu(){if(!this.isSquare())throw new Error("LU decomposition requires square matrix");let $=this.rows,J=this.data.map((z)=>z.map((q)=>new k(q))),Z=Array.from({length:$},(z,q)=>q),K=Array.from({length:$},()=>Array.from({length:$},()=>new k(0)));for(let z=0;z<$;z++)K[z][z]=new k(1);for(let z=0;z<$;z++){let q=z,W=J[z][z].abs();for(let j=z+1;j<$;j++){let G=J[j][z].abs();if(G.greaterThan(W))W=G,q=j}if(J[q][z].isZero())throw new Error("Singular matrix: LU decomposition failed");if(q!==z){let j=J[z];J[z]=J[q],J[q]=j;let G=Z[z];Z[z]=Z[q],Z[q]=G;for(let F=0;F<z;F++){let _=K[z][F];K[z][F]=K[q][F],K[q][F]=_}}for(let j=z+1;j<$;j++){let G=J[j][z].div(J[z][z]);K[j][z]=G;for(let F=z;F<$;F++)J[j][F]=J[j][F].minus(G.mul(J[z][F]))}}let Q=Array.from({length:$},(z,q)=>Array.from({length:$},(W,j)=>j<q?new k(0):J[q][j])),H=U0.zeros($,$);for(let z=0;z<$;z++)H.data[z][Z[z]]=new k(1);return{L:new U0(K),U:new U0(Q),P:H}}determinant(){if(!this.isSquare())throw new Error("Determinant only defined for square matrices");let $=this.rows,{L:J,U:Z,P:K}=this.lu(),Q=new k(1);for(let q=0;q<$;q++)Q=Q.mul(Z.data[q][q]);let H=[];for(let q=0;q<$;q++)for(let W=0;W<$;W++)if(K.data[q][W].equals(1))H.push(W);let z=0;for(let q=0;q<H.length;q++)for(let W=q+1;W<H.length;W++)if(H[q]>H[W])z++;if(z%2===1)Q=Q.negated();return Q}inverse(){if(!this.isSquare())throw new Error("Inverse only defined for square matrices");let $=this.rows,J=Array.from({length:$},(K,Q)=>Array.from({length:2*$},(H,z)=>z<$?new k(this.data[Q][z]):z-$===Q?new k(1):new k(0)));for(let K=0;K<$;K++){let Q=K,H=J[K][K].abs();for(let q=K+1;q<$;q++){let W=J[q][K].abs();if(W.greaterThan(H))H=W,Q=q}if(J[Q][K].isZero())throw new Error("Singular matrix: inverse does not exist");if(Q!==K){let q=J[K];J[K]=J[Q],J[Q]=q}let z=J[K][K];for(let q=0;q<2*$;q++)J[K][q]=J[K][q].div(z);for(let q=0;q<$;q++){if(q===K)continue;let W=J[q][K];if(W.isZero())continue;for(let j=0;j<2*$;j++)J[q][j]=J[q][j].minus(W.mul(J[K][j]))}}let Z=J.map((K)=>K.slice($));return new U0(Z)}solve($){let J;if($ instanceof D0)J=$;else if(Array.isArray($))J=D0.from($);else throw new Error("b must be Vector or array");if(!this.isSquare())throw new Error("solve() only implemented for square matrices");let Z=this.rows;if(J.length!==Z)throw new Error("dimension mismatch: b length must equal matrix rows");let K=Array.from({length:Z},(H,z)=>Array.from({length:Z+1},(q,W)=>new k(W<Z?this.data[z][W]:J.data[z])));for(let H=0;H<Z;H++){let z=H,q=K[H][H].abs();for(let W=H+1;W<Z;W++){let j=K[W][H].abs();if(j.greaterThan(q))q=j,z=W}if(K[z][H].isZero())throw new Error("Singular matrix: no unique solution");if(z!==H){let W=K[H];K[H]=K[z],K[z]=W}for(let W=H+1;W<Z;W++){let j=K[W][H].div(K[H][H]);if(j.isZero())continue;for(let G=H;G<Z+1;G++)K[W][G]=K[W][G].minus(j.mul(K[H][G]))}}let Q=Array.from({length:Z},()=>new k(0));for(let H=Z-1;H>=0;H--){if(K[H][H].isZero())throw new Error("Zero diagonal element in back substitution: system is singular");let z=new k(0);for(let q=H+1;q<Z;q++)z=z.plus(K[H][q].mul(Q[q]));Q[H]=K[H][Z].minus(z).div(K[H][H])}return new D0(Q)}qr(){let $=this.rows,J=this.cols,Z=this.data.map((H)=>H.map((z)=>new k(z))),K=U0.identity($).data;for(let H=0;H<Math.min($,J);H++){let z=[];for(let F=H;F<$;F++)z.push(Z[F][H]);let q=new k(0);for(let F of z)q=q.plus(F.mul(F));if(q=q.sqrt(),q.isZero())continue;let W=z[0].isNegative()?new k(-1):new k(1),j=z.slice();j[0]=j[0].plus(W.mul(q));let G=new k(0);for(let F of j)G=G.plus(F.mul(F));if(G=G.sqrt(),G.isZero())continue;for(let F=0;F<j.length;F++)j[F]=j[F].div(G);for(let F=H;F<J;F++){let _=new k(0);for(let U=0;U<j.length;U++)_=_.plus(j[U].mul(Z[H+U][F]));for(let U=0;U<j.length;U++)Z[H+U][F]=Z[H+U][F].minus(new k(2).mul(j[U]).mul(_))}for(let F=0;F<$;F++){let _=new k(0);for(let U=0;U<j.length;U++)_=_.plus(j[U].mul(K[H+U][F]));for(let U=0;U<j.length;U++)K[H+U][F]=K[H+U][F].minus(new k(2).mul(j[U]).mul(_))}}let Q=Array.from({length:$},(H,z)=>Array.from({length:J},(q,W)=>z<=W?Z[z][W]:new k(0)));return{Q:new U0(K).transpose(),R:new U0(Q)}}exp($={}){let J=this.rows;if(!this.isSquare())throw new Error("Matrix exponential requires square matrix");let Z=U0.identity(J),K=$.maxIter||120;if(!Number.isInteger(K)||K<=0)throw new Error("maxIter must be a positive integer");let Q=new k($.tolerance||"1e-40");if(Q.isNegative()||Q.isZero()||!Q.isFinite())throw new Error("tolerance must be positive and finite");let z=((F)=>{let _=new k(0);for(let U=0;U<F.rows;U++){let O=new k(0);for(let V=0;V<F.cols;V++)O=O.plus(F.data[U][V].abs());if(O.greaterThan(_))_=O}return _})(this),q=0;if(z.greaterThan(new k(1))){let F=z.toNumber();if(!isFinite(F))throw new Error("Matrix norm too large for exponential computation");if(q=Math.max(0,Math.ceil(Math.log2(F))),q>50)throw new Error(`Matrix norm too large: requires ${q} scaling steps (max 50 allowed)`)}let W=this;if(q>0)W=this.mul(new k(1).div(new k(2).pow(q)));let j=Z.clone(),G=Z.clone();for(let F=1;F<K;F++){j=j.mul(W).mul(new k(1).div(F)),G=G.add(j);let _=new k(0);for(let U=0;U<j.rows;U++)for(let O=0;O<j.cols;O++)_=_.plus(j.data[U][O].abs());if(_.lessThan(Q))break}for(let F=0;F<q;F++)G=G.mul(G);return G}}k.set({precision:80});var y0=($)=>$ instanceof k?$:new k($),tZ=new k("1e-40"),eZ=new k("1e-30");function $Q($,J){if($==null)throw new TypeError("translationMatrix: tx parameter is required");if(J==null)throw new TypeError("translationMatrix: ty parameter is required");return U0.from([[1,0,y0($)],[0,1,y0(J)],[0,0,1]])}function JQ($){if($==null)throw new TypeError("rotationMatrix: angle parameter is required");let J=y0($),Z=k.cos(J),K=k.sin(J);return U0.from([[Z,K.neg(),0],[K,Z,0],[0,0,1]])}function KQ($,J){if($==null)throw new TypeError("scaleMatrix: sx parameter is required");if(J==null)throw new TypeError("scaleMatrix: sy parameter is required");return U0.from([[y0($),0,0],[0,y0(J),0],[0,0,1]])}function ZQ($){if($==null)throw new TypeError("skewXMatrix: angle parameter is required");let J=k.tan(y0($));return U0.from([[1,J,0],[0,1,0],[0,0,1]])}function QQ($){if($==null)throw new TypeError("skewYMatrix: angle parameter is required");let J=k.tan(y0($));return U0.from([[1,0,0],[J,1,0],[0,0,1]])}function HQ($){if(!$)throw new TypeError("extractLinearPart: matrix parameter is required");if(!$.data)throw new TypeError("extractLinearPart: matrix must have data property");if($.rows<2||$.cols<2)throw new RangeError("extractLinearPart: matrix must be at least 2x2");let J=$.data;return{a:J[0][0],b:J[1][0],c:J[0][1],d:J[1][1]}}function zQ($){if(!$)throw new TypeError("extractTranslation: matrix parameter is required");if(!$.data)throw new TypeError("extractTranslation: matrix must have data property");if($.rows<2||$.cols<3)throw new RangeError("extractTranslation: matrix must be at least 2x3");let J=$.data;return{tx:J[0][2],ty:J[1][2]}}function cJ($){if(!$)throw new TypeError("decomposeMatrix: matrix parameter is required");let{a:J,b:Z,c:K,d:Q}=HQ($),{tx:H,ty:z}=zQ($),q=J.mul(Q).minus(Z.mul(K)),W=J.mul(J).plus(Z.mul(Z)).sqrt();if(W.abs().lessThan(tZ))return{translateX:H,translateY:z,rotation:y0(0),scaleX:y0(0),scaleY:y0(0),skewX:y0(0),skewY:y0(0),verified:!1,maxError:y0("Infinity"),singular:!0};let j=q.div(W);if(j.abs().greaterThan(new k("1e40")))return{translateX:H,translateY:z,rotation:y0(0),scaleX:y0(0),scaleY:y0(0),skewX:y0(0),skewY:y0(0),verified:!1,maxError:y0("Infinity"),singular:!0};if(q.lessThan(0))W=W.neg(),j=j.neg();let G=k.atan2(Z,J),F=k.cos(G),_=k.sin(G),U=J.mul(F).plus(Z.mul(_)),O=K.mul(F).plus(Q.mul(_)),V,M=new k("1e-30");if(U.abs().greaterThan(M)){let I=O.div(U);if(I.abs().greaterThan(new k("1e10")))V=y0(0);else V=k.atan(I)}else V=y0(0);let Y=y0(0),X=qQ({translateX:H,translateY:z,rotation:G,scaleX:W,scaleY:j,skewX:V,skewY:y0(0)}),w=WQ($,X),R=w.lessThan(eZ);return{translateX:H,translateY:z,rotation:G,scaleX:W,scaleY:j,skewX:V,skewY:Y,verified:R,maxError:w}}function qQ($){if(!$)throw new TypeError("composeTransform: components parameter is required");if($.translateX==null)throw new TypeError("composeTransform: components.translateX is required");if($.translateY==null)throw new TypeError("composeTransform: components.translateY is required");if($.rotation==null)throw new TypeError("composeTransform: components.rotation is required");if($.scaleX==null)throw new TypeError("composeTransform: components.scaleX is required");if($.scaleY==null)throw new TypeError("composeTransform: components.scaleY is required");if($.skewX==null)throw new TypeError("composeTransform: components.skewX is required");let{translateX:J,translateY:Z,rotation:K,scaleX:Q,scaleY:H,skewX:z,skewY:q=0}=$,W=$Q(J,Z),j=JQ(K),G=ZQ(z),F=QQ(q),_=KQ(Q,H);return W.mul(j).mul(F).mul(G).mul(_)}function WQ($,J){if(!$)throw new TypeError("matrixMaxDifference: m1 parameter is required");if(!J)throw new TypeError("matrixMaxDifference: m2 parameter is required");if(!$.data)throw new TypeError("matrixMaxDifference: m1 must have data property");if(!J.data)throw new TypeError("matrixMaxDifference: m2 must have data property");if($.rows!==J.rows||$.cols!==J.cols)throw new RangeError(`matrixMaxDifference: matrices must have same dimensions (${$.rows}x${$.cols} vs ${J.rows}x${J.cols})`);let Z=y0(0);for(let K=0;K<$.rows;K++)for(let Q=0;Q<$.cols;Q++){let H=$.data[K][Q].minus(J.data[K][Q]).abs();if(H.greaterThan(Z))Z=H}return Z}k.set({precision:80});var G7=($)=>$ instanceof k?$:new k($),g0=new k("1e-40"),lJ=100;function C7($,J){if($==null)throw new TypeError("point: x coordinate cannot be null or undefined");if(J==null)throw new TypeError("point: y coordinate cannot be null or undefined");return{x:G7($),y:G7(J)}}function GQ($,J){if(!$||$.x==null||$.y==null)throw new TypeError("vectorAdd: first vector must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("vectorAdd: second vector must have x and y properties");return{x:$.x.plus(J.x),y:$.y.plus(J.y)}}function x0($,J){if(!$||$.x==null||$.y==null)throw new TypeError("vectorSub: first vector must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("vectorSub: second vector must have x and y properties");return{x:$.x.minus(J.x),y:$.y.minus(J.y)}}function y6($){if(!$||$.x==null||$.y==null)throw new TypeError("vectorNeg: vector must have x and y properties");return{x:$.x.neg(),y:$.y.neg()}}function O9($,J){if(!$||$.x==null||$.y==null)throw new TypeError("vectorScale: vector must have x and y properties");if(J==null)throw new TypeError("vectorScale: scale factor cannot be null or undefined");let Z=G7(J);return{x:$.x.mul(Z),y:$.y.mul(Z)}}function J7($,J){if(!$||$.x==null||$.y==null)throw new TypeError("dot: first vector must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("dot: second vector must have x and y properties");return $.x.mul(J.x).plus($.y.mul(J.y))}function h6($,J){if(!$||$.x==null||$.y==null)throw new TypeError("cross: first vector must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("cross: second vector must have x and y properties");return $.x.mul(J.y).minus($.y.mul(J.x))}function j7($){if(!$||$.x==null||$.y==null)throw new TypeError("magnitudeSquared: vector must have x and y properties");return $.x.mul($.x).plus($.y.mul($.y))}function Z6($){if(!$||$.x==null||$.y==null)throw new TypeError("magnitude: vector must have x and y properties");return j7($).sqrt()}function FQ($){if(!$||$.x==null||$.y==null)throw new TypeError("normalize: vector must have x and y properties");let J=Z6($);if(J.lessThan(g0))return{x:G7(0),y:G7(0)};return{x:$.x.div(J),y:$.y.div(J)}}function n7($,J,Z){if(!$||$.x==null||$.y==null)throw new TypeError("tripleProduct: first vector must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("tripleProduct: second vector must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new TypeError("tripleProduct: third vector must have x and y properties");let K=J7($,Z),Q=J7(J,Z);return x0(O9(J,K),O9($,Q))}function nJ($,J){if(!Array.isArray($))throw new TypeError("supportPoint: polygon must be an array");if(!J||J.x==null||J.y==null)throw new TypeError("supportPoint: direction must have x and y properties");if($.length===0)throw new TypeError("supportPoint: polygon cannot be empty");if(!$[0]||$[0].x==null||$[0].y==null)throw new TypeError("supportPoint: polygon[0] must have x and y properties");let Z=J7($[0],J),K=$[0];for(let Q=1;Q<$.length;Q++){if(!$[Q]||$[Q].x==null||$[Q].y==null)throw new TypeError(`supportPoint: polygon[${Q}] must have x and y properties`);let H=J7($[Q],J);if(H.greaterThan(Z))Z=H,K=$[Q]}return K}function sJ($,J,Z){if(!Array.isArray($))throw new TypeError("minkowskiSupport: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("minkowskiSupport: polygonB must be an array");if(!Z||Z.x==null||Z.y==null)throw new TypeError("minkowskiSupport: direction must have x and y properties");let K=nJ($,Z),Q=nJ(J,y6(Z));return x0(K,Q)}function _Q($,J){if(!Array.isArray($))throw new TypeError("processLineSimplex: simplex must be an array");if($.length!==2)throw new TypeError("processLineSimplex: simplex must have exactly 2 points");if(!J||J.x==null||J.y==null)throw new TypeError("processLineSimplex: direction must have x and y properties");if(!$[0]||$[0].x==null||$[0].y==null)throw new TypeError("processLineSimplex: simplex[0] must have x and y properties");if(!$[1]||$[1].x==null||$[1].y==null)throw new TypeError("processLineSimplex: simplex[1] must have x and y properties");let Z=$[0],K=$[1],Q=x0(K,Z),H=y6(Z),z=j7(Q);if(z.lessThan(g0)){if(j7(Z).lessThan(g0))return{contains:!0,newDirection:J};return{contains:!1,newDirection:H}}let q=n7(Q,H,Q);if(j7(q).lessThan(g0)){let W=J7(Q,H);if(W.greaterThanOrEqualTo(0)&&W.lessThanOrEqualTo(z))return{contains:!0,newDirection:J};return{contains:!1,newDirection:H}}return{contains:!1,newDirection:q}}function UQ($,J){if(!Array.isArray($))throw new TypeError("processTriangleSimplex: simplex must be an array");if($.length!==3)throw new TypeError("processTriangleSimplex: simplex must have exactly 3 points");if(!J||J.x==null||J.y==null)throw new TypeError("processTriangleSimplex: direction must have x and y properties");if(!$[0]||$[0].x==null||$[0].y==null)throw new TypeError("processTriangleSimplex: simplex[0] must have x and y properties");if(!$[1]||$[1].x==null||$[1].y==null)throw new TypeError("processTriangleSimplex: simplex[1] must have x and y properties");if(!$[2]||$[2].x==null||$[2].y==null)throw new TypeError("processTriangleSimplex: simplex[2] must have x and y properties");let Z=$[0],K=$[1],Q=$[2],H=x0(K,Z),z=x0(Q,Z),q=y6(Z),W=j7(H),j=j7(z);if(W.lessThan(g0))return{contains:!1,newDirection:n7(z,q,z),newSimplex:[Z,Q]};if(j.lessThan(g0))return{contains:!1,newDirection:n7(H,q,H),newSimplex:[Z,K]};let G=n7(z,H,H),F=n7(H,z,z);if(j7(G).lessThan(g0)&&j7(F).lessThan(g0)){let _=x0(Q,K),U=j7(_);if(U.greaterThan(W)&&U.greaterThan(j))return{contains:!1,newDirection:n7(_,y6(K),_),newSimplex:[K,Q]};else if(W.greaterThan(j))return{contains:!1,newDirection:n7(H,q,H),newSimplex:[Z,K]};else return{contains:!1,newDirection:n7(z,q,z),newSimplex:[Z,Q]}}if(J7(G,q).greaterThan(g0))return{contains:!1,newDirection:G,newSimplex:[Z,K]};if(J7(F,q).greaterThan(g0))return{contains:!1,newDirection:F,newSimplex:[Z,Q]};return{contains:!0,newDirection:J,newSimplex:$}}function rJ($,J){if(!Array.isArray($))throw new TypeError("gjkIntersects: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("gjkIntersects: polygonB must be an array");if($.length===0||J.length===0)return{intersects:!1,iterations:0,simplex:[],verified:!0};if($.length===1&&J.length===1){if(!$[0]||$[0].x==null||$[0].y==null)throw new TypeError("gjkIntersects: polygonA[0] must have x and y properties");if(!J[0]||J[0].x==null||J[0].y==null)throw new TypeError("gjkIntersects: polygonB[0] must have x and y properties");return{intersects:Z6(x0($[0],J[0])).lessThan(g0),iterations:1,simplex:[],verified:!0}}let Z=x0(O$(J),O$($));if(j7(Z).lessThan(g0))Z=C7(1,0);let K=[sJ($,J,Z)];if(Z=y6(K[0]),j7(K[0]).lessThan(g0))return{intersects:!0,iterations:1,simplex:K,verified:M9($,J)};for(let Q=0;Q<lJ;Q++){let H=sJ($,J,Z);if(J7(H,Z).lessThanOrEqualTo(G7(0)))return{intersects:!1,iterations:Q+1,simplex:K,verified:!0};if(K.unshift(H),K.length===2){let z=_Q(K,Z);if(z.contains)return{intersects:!0,iterations:Q+1,simplex:K,verified:M9($,J)};Z=z.newDirection}else if(K.length===3){let z=UQ(K,Z);if(z.contains)return{intersects:!0,iterations:Q+1,simplex:z.newSimplex,verified:M9($,J)};K=z.newSimplex,Z=z.newDirection}if(j7(Z).lessThan(g0))return{intersects:!1,iterations:Q+1,simplex:K,verified:!1};Z=FQ(Z)}return{intersects:!1,iterations:lJ,simplex:K,verified:!1}}function O$($){if(!Array.isArray($))throw new TypeError("centroid: polygon must be an array");if($.length===0)throw new TypeError("centroid: polygon cannot be empty");let J=G7(0),Z=G7(0);for(let Q=0;Q<$.length;Q++){if(!$[Q]||$[Q].x==null||$[Q].y==null)throw new TypeError(`centroid: polygon[${Q}] must have x and y properties`);J=J.plus($[Q].x),Z=Z.plus($[Q].y)}let K=G7($.length);return{x:J.div(K),y:Z.div(K)}}function oJ($,J){if(!$||$.x==null||$.y==null)throw new TypeError("pointInConvexPolygon: point must have x and y properties");if(!Array.isArray(J))throw new TypeError("pointInConvexPolygon: polygon must be an array");if(J.length<3)return!1;let Z=null;for(let K=0;K<J.length;K++){let Q=J[K],H=J[(K+1)%J.length];if(!Q||Q.x==null||Q.y==null)throw new TypeError(`pointInConvexPolygon: polygon[${K}] must have x and y properties`);if(!H||H.x==null||H.y==null)throw new TypeError(`pointInConvexPolygon: polygon[${(K+1)%J.length}] must have x and y properties`);let z=x0(H,Q),q=x0($,Q),W=h6(z,q);if(W.abs().lessThan(g0))continue;let j=W.greaterThan(0);if(Z===null)Z=j;else if(Z!==j)return!1}return!0}function M9($,J){if(!Array.isArray($))throw new TypeError("verifyIntersection: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("verifyIntersection: polygonB must be an array");for(let Z=0;Z<$.length;Z++){if(!$[Z]||$[Z].x==null||$[Z].y==null)throw new TypeError(`verifyIntersection: polygonA[${Z}] must have x and y properties`);if(oJ($[Z],J))return!0}for(let Z=0;Z<J.length;Z++){if(!J[Z]||J[Z].x==null||J[Z].y==null)throw new TypeError(`verifyIntersection: polygonB[${Z}] must have x and y properties`);if(oJ(J[Z],$))return!0}for(let Z=0;Z<$.length;Z++){let K=$[Z],Q=$[(Z+1)%$.length];if(!K||K.x==null||K.y==null)throw new TypeError(`verifyIntersection: polygonA[${Z}] must have x and y properties`);if(!Q||Q.x==null||Q.y==null)throw new TypeError(`verifyIntersection: polygonA[${(Z+1)%$.length}] must have x and y properties`);for(let H=0;H<J.length;H++){let z=J[H],q=J[(H+1)%J.length];if(!z||z.x==null||z.y==null)throw new TypeError(`verifyIntersection: polygonB[${H}] must have x and y properties`);if(!q||q.x==null||q.y==null)throw new TypeError(`verifyIntersection: polygonB[${(H+1)%J.length}] must have x and y properties`);if(VQ(K,Q,z,q))return!0}}return!1}function VQ($,J,Z,K){if(!$||$.x==null||$.y==null)throw new TypeError("segmentsIntersect: a1 must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("segmentsIntersect: a2 must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new TypeError("segmentsIntersect: b1 must have x and y properties");if(!K||K.x==null||K.y==null)throw new TypeError("segmentsIntersect: b2 must have x and y properties");let Q=x0(J,$),H=x0(K,Z),z=h6(Q,H);if(z.abs().lessThan(g0)){let G=x0(Z,$);if(h6(Q,G).abs().lessThan(g0)){let F=J7(Q,Q);if(F.lessThan(g0)){let Y=J7(H,H);if(Y.lessThan(g0))return Z6(G).lessThan(g0);let X=J7(G,H).div(Y);return X.greaterThanOrEqualTo(0)&&X.lessThanOrEqualTo(1)}let _=J7(G,Q).div(F),U=x0(K,$),O=J7(U,Q).div(F),V=k.min(_,O);return k.max(_,O).greaterThanOrEqualTo(0)&&V.lessThanOrEqualTo(1)}return!1}let q=x0(Z,$),W=h6(q,H).div(z),j=h6(q,Q).div(z);return W.greaterThanOrEqualTo(0)&&W.lessThanOrEqualTo(1)&&j.greaterThanOrEqualTo(0)&&j.lessThanOrEqualTo(1)}function MQ($,J){if(!Array.isArray($))throw new TypeError("gjkDistance: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("gjkDistance: polygonB must be an array");if($.length===0)throw new TypeError("gjkDistance: polygonA cannot be empty");if(J.length===0)throw new TypeError("gjkDistance: polygonB cannot be empty");if(rJ($,J).intersects)return{distance:G7(0),closestA:O$($),closestB:O$(J),verified:!0};if(!$[0]||$[0].x==null||$[0].y==null)throw new TypeError("gjkDistance: polygonA[0] must have x and y properties");if(!J[0]||J[0].x==null||J[0].y==null)throw new TypeError("gjkDistance: polygonB[0] must have x and y properties");let K=G7(1/0),Q=$[0],H=J[0];for(let W=0;W<$.length;W++){if(!$[W]||$[W].x==null||$[W].y==null)throw new TypeError(`gjkDistance: polygonA[${W}] must have x and y properties`);for(let j=0;j<J.length;j++){if(!J[j]||J[j].x==null||J[j].y==null)throw new TypeError(`gjkDistance: polygonB[${j}] must have x and y properties`);let G=Z6(x0($[W],J[j]));if(G.lessThan(K))K=G,Q=$[W],H=J[j]}}for(let W=0;W<$.length;W++){if(!$[W]||$[W].x==null||$[W].y==null)throw new TypeError(`gjkDistance: polygonA[${W}] must have x and y properties`);for(let j=0;j<J.length;j++){let G=J[j],F=J[(j+1)%J.length];if(!G||G.x==null||G.y==null)throw new TypeError(`gjkDistance: polygonB[${j}] must have x and y properties`);if(!F||F.x==null||F.y==null)throw new TypeError(`gjkDistance: polygonB[${(j+1)%J.length}] must have x and y properties`);let _=iJ($[W],G,F),U=Z6(x0($[W],_));if(U.lessThan(K))K=U,Q=$[W],H=_}}for(let W=0;W<J.length;W++){if(!J[W]||J[W].x==null||J[W].y==null)throw new TypeError(`gjkDistance: polygonB[${W}] must have x and y properties`);for(let j=0;j<$.length;j++){let G=$[j],F=$[(j+1)%$.length];if(!G||G.x==null||G.y==null)throw new TypeError(`gjkDistance: polygonA[${j}] must have x and y properties`);if(!F||F.x==null||F.y==null)throw new TypeError(`gjkDistance: polygonA[${(j+1)%$.length}] must have x and y properties`);let _=iJ(J[W],G,F),U=Z6(x0(J[W],_));if(U.lessThan(K))K=U,Q=_,H=J[W]}}let q=Z6(x0(Q,H)).minus(K).abs().lessThan(g0);return{distance:K,closestA:Q,closestB:H,verified:q}}function iJ($,J,Z){if(!$||$.x==null||$.y==null)throw new TypeError("closestPointOnSegment: pt must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("closestPointOnSegment: a must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new TypeError("closestPointOnSegment: b must have x and y properties");let K=x0(Z,J),Q=x0($,J),H=j7(K);if(H.lessThan(g0))return J;let z=J7(Q,K).div(H);return z=k.max(G7(0),k.min(G7(1),z)),GQ(J,O9(K,z))}function Y$($,J){if(!Array.isArray($))throw new TypeError("polygonsOverlap: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("polygonsOverlap: polygonB must be an array");let Z=$.map((H,z)=>{if(!H||H.x==null||H.y==null)throw new TypeError(`polygonsOverlap: polygonA[${z}] must have x and y properties`);return C7(H.x,H.y)}),K=J.map((H,z)=>{if(!H||H.x==null||H.y==null)throw new TypeError(`polygonsOverlap: polygonB[${z}] must have x and y properties`);return C7(H.x,H.y)}),Q=rJ(Z,K);return{overlaps:Q.intersects,verified:Q.verified}}function aJ($,J){if(!Array.isArray($))throw new TypeError("polygonsDistance: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("polygonsDistance: polygonB must be an array");let Z=$.map((H,z)=>{if(!H||H.x==null||H.y==null)throw new TypeError(`polygonsDistance: polygonA[${z}] must have x and y properties`);return C7(H.x,H.y)}),K=J.map((H,z)=>{if(!H||H.x==null||H.y==null)throw new TypeError(`polygonsDistance: polygonB[${z}] must have x and y properties`);return C7(H.x,H.y)}),Q=MQ(Z,K);return{distance:Q.distance,closestA:Q.closestA,closestB:Q.closestB,verified:Q.verified}}k.set({precision:80});var Cq=new k("1e-40"),Pq=new k("1e-10");k.set({precision:80});var Tq=new k("1e-40"),bq=new k("1e-30");k.set({precision:80});var W0=($)=>$ instanceof k?$:new k($),vq=new k("1e-40"),kQ=new k("1e-10");function J5($){if(typeof $!=="string")throw new Error("ViewBox must be a string");let J=$.trim().split(/[\s,]+/).filter((Z)=>Z.length>0);if(J.length!==4)throw new Error(`Invalid viewBox format: expected 4 values, got ${J.length}`);try{let Z=W0(J[0]),K=W0(J[1]),Q=W0(J[2]),H=W0(J[3]);if(Q.lessThanOrEqualTo(0)||H.lessThanOrEqualTo(0))throw new Error("ViewBox width and height must be positive");let z=`${Z.toString()} ${K.toString()} ${Q.toString()} ${H.toString()}`,q=J.join(" ");return{x:Z,y:K,width:Q,height:H,verified:z===q}}catch(Z){throw new Error(`Invalid viewBox values: ${Z.message}`)}}function LQ($,J,Z,K){if($==null||J==null||Z==null||K==null)throw new Error("createBBox: all parameters (minX, minY, maxX, maxY) must be provided");let Q=W0($),H=W0(J),z=W0(Z),q=W0(K);if(z.lessThan(Q))throw new Error(`createBBox: maxX (${z}) must be >= minX (${Q})`);if(q.lessThan(H))throw new Error(`createBBox: maxY (${q}) must be >= minY (${H})`);return{minX:Q,minY:H,maxX:z,maxY:q,width:z.minus(Q),height:q.minus(H)}}function tJ($,J,Z,K,Q,H,z,q,W=20){if($==null||J==null||Z==null||K==null||Q==null||H==null||z==null||q==null)throw new Error("sampleCubicBezier: all coordinate parameters must be provided");if(W==null||W<=0)throw new Error("sampleCubicBezier: samples must be a positive number");let j=[];for(let G=0;G<=W;G++){let F=W0(G).div(W),_=W0(1).minus(F),U=F.mul(F),O=U.mul(F),V=_.mul(_),M=V.mul(_),Y=M.mul($).plus(W0(3).mul(V).mul(F).mul(Z)).plus(W0(3).mul(_).mul(U).mul(Q)).plus(O.mul(z)),X=M.mul(J).plus(W0(3).mul(V).mul(F).mul(K)).plus(W0(3).mul(_).mul(U).mul(H)).plus(O.mul(q));j.push({x:Y,y:X})}return j}function eJ($,J,Z,K,Q,H,z=20){if($==null||J==null||Z==null||K==null||Q==null||H==null)throw new Error("sampleQuadraticBezier: all coordinate parameters must be provided");if(z==null||z<=0)throw new Error("sampleQuadraticBezier: samples must be a positive number");let q=[];for(let W=0;W<=z;W++){let j=W0(W).div(z),G=W0(1).minus(j),F=G.mul(G),_=j.mul(j),U=F.mul($).plus(W0(2).mul(G).mul(j).mul(Z)).plus(_.mul(Q)),O=F.mul(J).plus(W0(2).mul(G).mul(j).mul(K)).plus(_.mul(H));q.push({x:U,y:O})}return q}function wQ($,J,Z=kQ){if(!$||typeof $!=="object"||$.x==null||$.y==null)throw new Error("pointInBBox: pt must be an object with x and y properties");if(!J||typeof J!=="object")throw new Error("pointInBBox: bbox must be a bounding box object");if(J.minX==null||J.minY==null||J.maxX==null||J.maxY==null)throw new Error("pointInBBox: bbox must have minX, minY, maxX, maxY properties");return $.x.greaterThanOrEqualTo(J.minX.minus(Z))&&$.x.lessThanOrEqualTo(J.maxX.plus(Z))&&$.y.greaterThanOrEqualTo(J.minY.minus(Z))&&$.y.lessThanOrEqualTo(J.maxY.plus(Z))}function K5($){if(!$||$.length===0)throw new Error("pathBoundingBox: path commands array is empty");let J=W0(1/0),Z=W0(1/0),K=W0(-1/0),Q=W0(-1/0),H=W0(0),z=W0(0),q=W0(0),W=W0(0),j=W0(0),G=W0(0),F=null,_=[];for(let V of $){if(!V||typeof V!=="object"||!V.type||typeof V.type!=="string")throw new Error("pathBoundingBox: each command must be an object with a string type property");let M=V.type.toUpperCase(),Y=V.type===V.type.toLowerCase();switch(M){case"M":{if(V.x==null||V.y==null)throw new Error("pathBoundingBox: M command requires x and y properties");let X=Y?H.plus(W0(V.x)):W0(V.x),w=Y?z.plus(W0(V.y)):W0(V.y);H=X,z=w,q=H,W=z,J=k.min(J,H),Z=k.min(Z,z),K=k.max(K,H),Q=k.max(Q,z),_.push({x:H,y:z}),j=H,G=z,F="M"}break;case"L":{if(V.x==null||V.y==null)throw new Error("pathBoundingBox: L command requires x and y properties");let X=Y?H.plus(W0(V.x)):W0(V.x),w=Y?z.plus(W0(V.y)):W0(V.y);J=k.min(J,X),Z=k.min(Z,w),K=k.max(K,X),Q=k.max(Q,w),_.push({x:X,y:w}),H=X,z=w,j=H,G=z,F="L"}break;case"H":{if(V.x==null)throw new Error("pathBoundingBox: H command requires x property");let X=Y?H.plus(W0(V.x)):W0(V.x);J=k.min(J,X),K=k.max(K,X),_.push({x:X,y:z}),H=X,j=H,G=z,F="H"}break;case"V":{if(V.y==null)throw new Error("pathBoundingBox: V command requires y property");let X=Y?z.plus(W0(V.y)):W0(V.y);Z=k.min(Z,X),Q=k.max(Q,X),_.push({x:H,y:X}),z=X,j=H,G=z,F="V"}break;case"C":{if(V.x1==null||V.y1==null||V.x2==null||V.y2==null||V.x==null||V.y==null)throw new Error("pathBoundingBox: C command requires x1, y1, x2, y2, x, y properties");let X=Y?H.plus(W0(V.x1)):W0(V.x1),w=Y?z.plus(W0(V.y1)):W0(V.y1),R=Y?H.plus(W0(V.x2)):W0(V.x2),I=Y?z.plus(W0(V.y2)):W0(V.y2),f=Y?H.plus(W0(V.x)):W0(V.x),u=Y?z.plus(W0(V.y)):W0(V.y),m=tJ(H,z,X,w,R,I,f,u,20);for(let S of m)J=k.min(J,S.x),Z=k.min(Z,S.y),K=k.max(K,S.x),Q=k.max(Q,S.y),_.push(S);j=R,G=I,H=f,z=u,F="C"}break;case"S":{if(V.x2==null||V.y2==null||V.x==null||V.y==null)throw new Error("pathBoundingBox: S command requires x2, y2, x, y properties");let X=Y?H.plus(W0(V.x2)):W0(V.x2),w=Y?z.plus(W0(V.y2)):W0(V.y2),R=Y?H.plus(W0(V.x)):W0(V.x),I=Y?z.plus(W0(V.y)):W0(V.y),f,u;if(F==="C"||F==="S")f=H.mul(2).minus(j),u=z.mul(2).minus(G);else f=H,u=z;let m=tJ(H,z,f,u,X,w,R,I,20);for(let S of m)J=k.min(J,S.x),Z=k.min(Z,S.y),K=k.max(K,S.x),Q=k.max(Q,S.y),_.push(S);j=X,G=w,H=R,z=I,F="S"}break;case"Q":{if(V.x1==null||V.y1==null||V.x==null||V.y==null)throw new Error("pathBoundingBox: Q command requires x1, y1, x, y properties");let X=Y?H.plus(W0(V.x1)):W0(V.x1),w=Y?z.plus(W0(V.y1)):W0(V.y1),R=Y?H.plus(W0(V.x)):W0(V.x),I=Y?z.plus(W0(V.y)):W0(V.y),f=eJ(H,z,X,w,R,I,20);for(let u of f)J=k.min(J,u.x),Z=k.min(Z,u.y),K=k.max(K,u.x),Q=k.max(Q,u.y),_.push(u);j=X,G=w,H=R,z=I,F="Q"}break;case"T":{if(V.x==null||V.y==null)throw new Error("pathBoundingBox: T command requires x and y properties");let X=Y?H.plus(W0(V.x)):W0(V.x),w=Y?z.plus(W0(V.y)):W0(V.y),R,I;if(F==="Q"||F==="T")R=H.mul(2).minus(j),I=z.mul(2).minus(G);else R=H,I=z;let f=eJ(H,z,R,I,X,w,20);for(let u of f)J=k.min(J,u.x),Z=k.min(Z,u.y),K=k.max(K,u.x),Q=k.max(Q,u.y),_.push(u);j=R,G=I,H=X,z=w,F="T"}break;case"A":{if(V.x==null||V.y==null||V.rx==null||V.ry==null)throw new Error("pathBoundingBox: A command requires x, y, rx, ry properties");let X=Y?H.plus(W0(V.x)):W0(V.x),w=Y?z.plus(W0(V.y)):W0(V.y),R=W0(V.rx).abs(),I=W0(V.ry).abs();if(R.isZero()||I.isZero())J=k.min(J,H,X),Z=k.min(Z,z,w),K=k.max(K,H,X),Q=k.max(Q,z,w),_.push({x:H,y:z},{x:X,y:w});else{J=k.min(J,H,X,H.minus(R),X.minus(R)),Z=k.min(Z,z,w,z.minus(I),w.minus(I)),K=k.max(K,H,X,H.plus(R),X.plus(R)),Q=k.max(Q,z,w,z.plus(I),w.plus(I));let f=20;for(let u=0;u<=f;u++){let m=W0(u).div(f),S=H.plus(X.minus(H).mul(m)),x=z.plus(w.minus(z).mul(m));_.push({x:S,y:x})}}H=X,z=w,j=H,G=z,F="A"}break;case"Z":H=q,z=W,j=H,G=z,F="Z";break;default:throw new Error(`pathBoundingBox: unknown path command type: ${M}`)}}if(!J.isFinite()||!Z.isFinite()||!K.isFinite()||!Q.isFinite())throw new Error("Invalid bounding box: no valid coordinates found");let U=LQ(J,Z,K,Q),O=!0;for(let V of _)if(!wQ(V,U)){O=!1;break}return{...U,verified:O}}function $5($){if(!$||typeof $!=="object")throw new Error("bboxToPolygon: bbox must be a bounding box object");if($.minX==null||$.minY==null||$.maxX==null||$.maxY==null)throw new Error("bboxToPolygon: bbox must have minX, minY, maxX, maxY properties");return[C7($.minX,$.minY),C7($.maxX,$.minY),C7($.maxX,$.maxY),C7($.minX,$.maxY)]}function Z5($,J){if(!J||typeof J!=="object")throw new Error("bboxIntersectsViewBox: viewBox must be an object");if(J.x==null||J.y==null||J.width==null||J.height==null)throw new Error("bboxIntersectsViewBox: viewBox must have x, y, width, height properties");let Z=$5($),K=$5({minX:J.x,minY:J.y,maxX:J.x.plus(J.width),maxY:J.y.plus(J.height)}),Q=Y$(Z,K);return{intersects:Q.overlaps,verified:Q.verified}}var e0={ID:"id",CLASS:"class",ATTRIBUTE:"attr",PSEUDO_CLASS:"pseudo-class",PSEUDO_ELEMENT:"pseudo-element",TYPE:"type",UNIVERSAL:"universal"};function BQ($){if(typeof $!=="string"||!$.trim())throw new Error("Selector must be a non-empty string");let J=$.trim(),Z=[],K=NQ(J);for(let Q of K){if(!Q.trim())continue;let H=IQ(Q.trim());Z.push(...H)}return Z}function NQ($){if(typeof $!=="string")throw new Error("Selector must be a string");let J=[],Z="",K=0,Q=0,H=!1,z=null;for(let W=0;W<$.length;W++){let j=$[W],G=W>0?$[W-1]:null;if((j==='"'||j==="'")&&G!=="\\"){if(!H)H=!0,z=j;else if(j===z)H=!1,z=null}if(!H){if(j==="["&&G!=="\\")K++;else if(j==="]"&&G!=="\\"){if(K--,K<0)throw new Error(`Unbalanced brackets at position ${W}`)}else if(j==="("&&G!=="\\")Q++;else if(j===")"&&G!=="\\"){if(Q--,Q<0)throw new Error(`Unbalanced parentheses at position ${W}`)}}if(!H&&K===0&&Q===0){if(j===">"||j==="+"||j==="~"){let F=Z.trim();if(F)J.push(F);Z="";continue}else if(j===" "){let F=Z.trim();if(F){J.push(F),Z="";continue}else continue}}Z+=j}if(H)throw new Error("Unclosed quote in selector");if(K!==0)throw new Error("Unclosed brackets in selector");if(Q!==0)throw new Error("Unclosed parentheses in selector");let q=Z.trim();if(q)J.push(q);return J}function IQ($){if(typeof $!=="string")throw new Error("Selector must be a string");let J=[],Z=0;while(Z<$.length){let K=$[Z];if(K==="#"){let Q=$.slice(Z).match(/^#([a-zA-Z_-][\w-]*)/);if(!Q)throw new Error(`Invalid ID selector at position ${Z}`);J.push({type:e0.ID,value:Q[1]}),Z+=Q[0].length}else if(K==="."){let Q=$.slice(Z).match(/^\.([a-zA-Z_-][\w-]*)/);if(!Q)throw new Error(`Invalid class selector at position ${Z}`);J.push({type:e0.CLASS,value:Q[1]}),Z+=Q[0].length}else if(K==="["){let Q=CQ($,Z);if(Q===-1)throw new Error(`Unclosed attribute selector at position ${Z}`);let H=$.slice(Z+1,Q);J.push({type:e0.ATTRIBUTE,value:H}),Z=Q+1}else if(K===":")if(Z+1<$.length&&$[Z+1]===":"){let Q=$.slice(Z).match(/^::([\w-]+)/);if(!Q)throw new Error(`Invalid pseudo-element at position ${Z}`);J.push({type:e0.PSEUDO_ELEMENT,value:Q[1]}),Z+=Q[0].length}else{let Q=$.slice(Z).match(/^:([\w-]+)/);if(!Q)throw new Error(`Invalid pseudo-class at position ${Z}`);let H=Q[1];if(Z+=Q[0].length,Z<$.length&&$[Z]==="("){let W=PQ($,Z);if(W===-1)throw new Error(`Unclosed pseudo-class function at position ${Z}`);H+=$.slice(Z,W+1),Z=W+1}let q=["before","after","first-line","first-letter"].includes(H);J.push({type:q?e0.PSEUDO_ELEMENT:e0.PSEUDO_CLASS,value:H})}else if(K==="*"){let Q=Z+1;if(Q<$.length&&$[Q]==="|"){if(Q++,Q<$.length&&$[Q]==="*")Q++}J.push({type:e0.UNIVERSAL,value:"*"}),Z=Q}else if(/[a-zA-Z]/.test(K)){let Q=$.slice(Z).match(/^([a-zA-Z][\w-]*)/);if(!Q)throw new Error(`Invalid type selector at position ${Z}`);let H=Q[1],z=Z+Q[0].length;if(z<$.length&&$[z]==="|"){z++;let q=$.slice(z).match(/^([a-zA-Z*][\w-]*)/);if(q)H=q[1],z+=q[0].length}J.push({type:e0.TYPE,value:H}),Z=z}else if(K===">"||K==="+"||K==="~"||K===" ")Z++;else throw new Error(`Unexpected character '${K}' at position ${Z}`)}return J}function CQ($,J){if(typeof $!=="string")throw new Error("str must be a string");if(typeof J!=="number"||J<0||J>=$.length)throw new Error("startIdx must be a valid index within the string");let Z=0,K=!1,Q=null;for(let H=J;H<$.length;H++){let z=$[H],q=H>0?$[H-1]:null;if((z==='"'||z==="'")&&q!=="\\"){if(!K)K=!0,Q=z;else if(z===Q)K=!1,Q=null}if(!K){if(z==="["&&q!=="\\")Z++;if(z==="]"&&q!=="\\"){if(Z--,Z===0)return H}}}return-1}function PQ($,J){if(typeof $!=="string")throw new Error("str must be a string");if(typeof J!=="number"||J<0||J>=$.length)throw new Error("startIdx must be a valid index within the string");let Z=0,K=!1,Q=null;for(let H=J;H<$.length;H++){let z=$[H],q=H>0?$[H-1]:null;if((z==='"'||z==="'")&&q!=="\\"){if(!K)K=!0,Q=z;else if(z===Q)K=!1,Q=null}if(!K){if(z==="("&&q!=="\\")Z++;if(z===")"&&q!=="\\"){if(Z--,Z===0)return H}}}return-1}function X$($){let J=typeof $==="string"?BQ($):$;if(!Array.isArray(J))throw new Error("Selector must be a string or an array of components");let Z=0,K=0,Q=0;for(let H of J){if(!H||typeof H.type!=="string")throw new Error("Invalid component: must have a 'type' property");switch(H.type){case e0.ID:Z++;break;case e0.CLASS:case e0.ATTRIBUTE:K++;break;case e0.PSEUDO_CLASS:{let z=H.value;if(z.startsWith("where(")&&z.endsWith(")"))break;if((z.startsWith("not(")||z.startsWith("is(")||z.startsWith("has("))&&z.endsWith(")")){let q=z.match(/^(\w+)\(/)[1],W=z.slice(q.length+1,-1);if(W.trim()){let j=AQ(W),G=[0,0,0];for(let F of j)if(F.trim()){let _=X$(F.trim());if(k$(_,G)>0)G=_}Z+=G[0],K+=G[1],Q+=G[2]}break}if((z.startsWith("nth-child(")||z.startsWith("nth-last-child("))&&z.endsWith(")")){let q=z.match(/^([\w-]+)\(/)[1],j=z.slice(q.length+1,-1).match(/\s+of\s+(.+)$/);if(j){let G=j[1].trim(),F=X$(G);Z+=F[0],K+=F[1],Q+=F[2]}K++;break}K++;break}case e0.TYPE:case e0.PSEUDO_ELEMENT:Q++;break;case e0.UNIVERSAL:break;default:break}}return[Z,K,Q]}function AQ($){if(typeof $!=="string")throw new Error("selectorList must be a string");let J=[],Z="",K=0,Q=0,H=!1,z=null;for(let q=0;q<$.length;q++){let W=$[q],j=q>0?$[q-1]:null;if((W==='"'||W==="'")&&j!=="\\"){if(!H)H=!0,z=W;else if(W===z)H=!1,z=null}if(!H){if(W==="(")K++;if(W===")")K--;if(W==="[")Q++;if(W==="]")Q--;if(W===","&&K===0&&Q===0){J.push(Z),Z="";continue}}Z+=W}if(Z)J.push(Z);return J}function k$($,J){if(!Array.isArray($)||$.length!==3)throw new Error("spec1 must be an array of 3 numbers");if(!Array.isArray(J)||J.length!==3)throw new Error("spec2 must be an array of 3 numbers");for(let Z=0;Z<3;Z++){if(typeof $[Z]!=="number"||!Number.isFinite($[Z])||$[Z]<0)throw new Error(`spec1[${Z}] must be a non-negative finite number`);if(typeof J[Z]!=="number"||!Number.isFinite(J[Z])||J[Z]<0)throw new Error(`spec2[${Z}] must be a non-negative finite number`)}for(let Z=0;Z<3;Z++){if($[Z]<J[Z])return-1;if($[Z]>J[Z])return 1}return 0}var f0=($)=>$ instanceof k?$:new k($);function Y9(){let $=new k(2),J=new k(3);return new k(4).mul($.sqrt().minus(1)).div(J)}function TQ($){if($==null)throw new Error("getKappaForArc: thetaRadians parameter is required");let J=f0($);if(!J.isFinite())throw new Error("getKappaForArc: thetaRadians must be finite");if(J.isZero()||J.isNegative())throw new Error("getKappaForArc: thetaRadians must be positive");let Z=new k(4),K=new k(3);return Z.div(K).mul(k.tan(J.div(Z)))}function Q5($,J,Z,K=8,Q=6){if($==null||J==null||Z==null)throw new Error("circleToPathDataHP: cx, cy, and r parameters are required");let H=f0(Z);if(!H.isFinite()||H.isNegative())throw new Error("circleToPathDataHP: radius must be finite and non-negative");if(H.isZero())return"";if(!Number.isFinite(K)||K<=0)throw new Error("circleToPathDataHP: arcs must be a positive number");if(!Number.isFinite(Q)||Q<0)throw new Error("circleToPathDataHP: precision must be non-negative");return X9($,J,Z,Z,K,Q)}function X9($,J,Z,K,Q=8,H=6){if($==null||J==null||Z==null||K==null)throw new Error("ellipseToPathDataHP: cx, cy, rx, and ry parameters are required");if(!Number.isFinite(Q)||Q<=0)throw new Error("ellipseToPathDataHP: arcs must be a positive number");if(!Number.isFinite(H)||H<0)throw new Error("ellipseToPathDataHP: precision must be non-negative");let z=Q;if(z%4!==0)z=Math.ceil(z/4)*4;let q=f0($),W=f0(J),j=f0(Z),G=f0(K);if(!j.isFinite()||j.isNegative())throw new Error("ellipseToPathDataHP: rx must be finite and non-negative");if(!G.isFinite()||G.isNegative())throw new Error("ellipseToPathDataHP: ry must be finite and non-negative");if(j.isZero()||G.isZero())return"";let F=(Y)=>Q6(Y,H),O=k.acos(-1).mul(2).div(z),V=TQ(O),M=[];for(let Y=0;Y<z;Y++){let X=O.mul(Y),w=O.mul(Y+1),R=k.cos(X),I=k.sin(X),f=k.cos(w),u=k.sin(w),m=q.plus(j.mul(R)),S=W.plus(G.mul(I)),x=q.plus(j.mul(f)),h=W.plus(G.mul(u)),E=I.neg(),d=R,c=u.neg(),p=f,N=m.plus(V.mul(j).mul(E)),y=S.plus(V.mul(G).mul(d)),B=x.minus(V.mul(j).mul(c)),e=h.minus(V.mul(G).mul(p));if(Y===0)M.push(`M${F(m)} ${F(S)}`);M.push(`C${F(N)} ${F(y)} ${F(B)} ${F(e)} ${F(x)} ${F(h)}`)}return M.push("Z"),M.join(" ")}function Q6($,J=6){if($==null)throw new Error("formatNumber: value parameter is required");if(!Number.isFinite(J)||J<0)throw new Error("formatNumber: precision must be non-negative");let Z=f0($);if(!Z.isFinite())throw new Error("formatNumber: value must be finite");let K=Z.toFixed(J);if(K.includes("."))K=K.replace(/\.?0+$/,"");return K}function k9($,J,Z,K=6){if($==null||J==null||Z==null)throw new Error("circleToPathData: cx, cy, and r parameters are required");if(!Number.isFinite(K)||K<0)throw new Error("circleToPathData: precision must be non-negative");let Q=f0($),H=f0(J),z=f0(Z);if(!z.isFinite()||z.isNegative())throw new Error("circleToPathData: radius must be finite and non-negative");if(z.isZero())return"";let q=Y9().mul(z),W=Q.plus(z),j=H,G=W,F=j.minus(q),_=Q.plus(q),U=H.minus(z),O=Q,V=H.minus(z),M=Q.minus(q),Y=V,X=Q.minus(z),w=H.minus(q),R=Q.minus(z),I=H,f=R,u=H.plus(q),m=Q.minus(q),S=H.plus(z),x=Q,h=H.plus(z),E=Q.plus(q),d=h,c=W,p=H.plus(q),N=(y)=>Q6(y,K);return`M${N(W)} ${N(j)}C${N(G)} ${N(F)} ${N(_)} ${N(U)} ${N(O)} ${N(V)}C${N(M)} ${N(Y)} ${N(X)} ${N(w)} ${N(R)} ${N(I)}C${N(f)} ${N(u)} ${N(m)} ${N(S)} ${N(x)} ${N(h)}C${N(E)} ${N(d)} ${N(c)} ${N(p)} ${N(W)} ${N(j)}Z`}function L9($,J,Z,K,Q=6){if($==null||J==null||Z==null||K==null)throw new Error("ellipseToPathData: cx, cy, rx, and ry parameters are required");if(!Number.isFinite(Q)||Q<0)throw new Error("ellipseToPathData: precision must be non-negative");let H=f0($),z=f0(J),q=f0(Z),W=f0(K);if(!q.isFinite()||q.isNegative())throw new Error("ellipseToPathData: rx must be finite and non-negative");if(!W.isFinite()||W.isNegative())throw new Error("ellipseToPathData: ry must be finite and non-negative");if(q.isZero()||W.isZero())return"";let j=Y9(),G=j.mul(q),F=j.mul(W),_=H.plus(q),U=z,O=_,V=U.minus(F),M=H.plus(G),Y=z.minus(W),X=H,w=z.minus(W),R=H.minus(G),I=w,f=H.minus(q),u=z.minus(F),m=H.minus(q),S=z,x=m,h=z.plus(F),E=H.minus(G),d=z.plus(W),c=H,p=z.plus(W),N=H.plus(G),y=p,B=_,e=z.plus(F),r=(s)=>Q6(s,Q);return`M${r(_)} ${r(U)}C${r(O)} ${r(V)} ${r(M)} ${r(Y)} ${r(X)} ${r(w)}C${r(R)} ${r(I)} ${r(f)} ${r(u)} ${r(m)} ${r(S)}C${r(x)} ${r(h)} ${r(E)} ${r(d)} ${r(c)} ${r(p)}C${r(N)} ${r(y)} ${r(B)} ${r(e)} ${r(_)} ${r(U)}Z`}function w9($,J,Z,K,Q=0,H=null,z=!1,q=6){if($==null||J==null||Z==null||K==null)throw new Error("rectToPathData: x, y, width, and height parameters are required");if(!Number.isFinite(q)||q<0)throw new Error("rectToPathData: precision must be non-negative");let W=f0($),j=f0(J),G=f0(Z),F=f0(K);if(!W.isFinite())throw new Error("rectToPathData: x must be finite");if(!j.isFinite())throw new Error("rectToPathData: y must be finite");if(!G.isFinite()||G.isNegative())throw new Error("rectToPathData: width must be finite and non-negative");if(!F.isFinite()||F.isNegative())throw new Error("rectToPathData: height must be finite and non-negative");if(G.isZero()||F.isZero())return"";let _=f0(Q||0),U=H!==null?f0(H):_;if(!_.isFinite()||_.isNegative())throw new Error("rectToPathData: rx must be finite and non-negative");if(!U.isFinite()||U.isNegative())throw new Error("rectToPathData: ry must be finite and non-negative");let O=G.div(2),V=F.div(2);if(_.gt(O))_=O;if(U.gt(V))U=V;let M=(E)=>Q6(E,q);if(_.isZero()||U.isZero()){let E=W.plus(G),d=j.plus(F);return`M${M(W)} ${M(j)}H${M(E)}V${M(d)}H${M(W)}Z`}let Y=W,X=W.plus(G),w=j,R=j.plus(F),I=Y.plus(_),f=X.minus(_),u=w.plus(U),m=R.minus(U);if(z)return`M${M(I)} ${M(w)}L${M(f)} ${M(w)}A${M(_)} ${M(U)} 0 0 1 ${M(X)} ${M(u)}L${M(X)} ${M(m)}A${M(_)} ${M(U)} 0 0 1 ${M(f)} ${M(R)}L${M(I)} ${M(R)}A${M(_)} ${M(U)} 0 0 1 ${M(Y)} ${M(m)}L${M(Y)} ${M(u)}A${M(_)} ${M(U)} 0 0 1 ${M(I)} ${M(w)}Z`;let S=Y9(),x=S.mul(_),h=S.mul(U);return`M${M(I)} ${M(w)}L${M(f)} ${M(w)}C${M(f.plus(x))} ${M(w)} ${M(X)} ${M(u.minus(h))} ${M(X)} ${M(u)}L${M(X)} ${M(m)}C${M(X)} ${M(m.plus(h))} ${M(f.plus(x))} ${M(R)} ${M(f)} ${M(R)}L${M(I)} ${M(R)}C${M(I.minus(x))} ${M(R)} ${M(Y)} ${M(m.plus(h))} ${M(Y)} ${M(m)}L${M(Y)} ${M(u)}C${M(Y)} ${M(u.minus(h))} ${M(I.minus(x))} ${M(w)} ${M(I)} ${M(w)}Z`}function R9($,J,Z,K,Q=6){if($==null||J==null||Z==null||K==null)throw new Error("lineToPathData: x1, y1, x2, and y2 parameters are required");if(!Number.isFinite(Q)||Q<0)throw new Error("lineToPathData: precision must be non-negative");let H=f0($),z=f0(J),q=f0(Z),W=f0(K);if(!H.isFinite()||!z.isFinite()||!q.isFinite()||!W.isFinite())throw new Error("lineToPathData: all coordinates must be finite");let j=(G)=>Q6(G,Q);return`M${j(H)} ${j(z)}L${j(q)} ${j(W)}`}function bQ($){if($==null)return[];if(Array.isArray($))try{return $.map(([H,z])=>[f0(H),f0(z)])}catch(H){return[]}let J=$;if(typeof J==="object"&&J.baseVal!==void 0)J=J.baseVal;if(typeof J!=="string")if(typeof J.toString==="function")J=J.toString();else return[];let Z=[],K=J.split(/[\s,]+/).filter((H)=>H.length>0);for(let H of K)try{Z.push(f0(H))}catch(z){continue}let Q=[];for(let H=0;H<Z.length;H+=2)if(H+1<Z.length)Q.push([Z[H],Z[H+1]]);return Q}function L$($,J=6){if(!Number.isFinite(J)||J<0)throw new Error("polylineToPathData: precision must be non-negative");let Z=bQ($);if(Z.length===0)return"";let K=(q)=>Q6(q,J),[Q,H]=Z[0],z=`M${K(Q)} ${K(H)}`;for(let q=1;q<Z.length;q++){let[W,j]=Z[q];z+=`L${K(W)} ${K(j)}`}return z}function B9($,J=6){if(!Number.isFinite(J)||J<0)throw new Error("polygonToPathData: precision must be non-negative");let Z=L$($,J);return Z?Z+" Z":""}var fQ={M:2,m:2,L:2,l:2,H:1,h:1,V:1,v:1,C:6,c:6,S:4,s:4,Q:4,q:4,T:2,t:2,A:7,a:7,Z:0,z:0};function u6($){if($==null)throw new Error("parsePathData: pathData parameter is required");if(typeof $!=="string")throw new Error("parsePathData: pathData must be a string");let J=[],Z=/([MmLlHhVvCcSsQqTtAaZz])\s*([^MmLlHhVvCcSsQqTtAaZz]*)/g,K;while((K=Z.exec($))!==null){let Q=K[1],H=K[2].trim(),z=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,q=[];if(H.length>0)for(let j of H.matchAll(z))try{q.push(f0(j[0]))}catch(G){continue}let W=fQ[Q];if(W===0||q.length===0)J.push({command:Q,args:[]});else for(let j=0;j<q.length;j+=W){let G=q.slice(j,j+W);if(G.length===W){let F=Q;if(j>0&&(Q==="M"||Q==="m"))F=Q==="M"?"L":"l";J.push({command:F,args:G})}}}return J}function N9($,J=6){if($==null)throw new Error("pathArrayToString: commands parameter is required");if(!Array.isArray($))throw new Error("pathArrayToString: commands must be an array");if(!Number.isFinite(J)||J<0)throw new Error("pathArrayToString: precision must be non-negative");return $.map((Z)=>{if(!Z||typeof Z.command!=="string"||!Array.isArray(Z.args))throw new Error("pathArrayToString: each command must have 'command' (string) and 'args' (array) properties");let{command:K,args:Q}=Z,H=Q.map((z)=>Q6(z,J)).join(" ");return H.length>0?`${K} ${H}`:K}).join(" ")}function H5($){if($==null)throw new Error("pathToAbsolute: pathData parameter is required");let J=u6($),Z=[],K=new k(0),Q=new k(0),H=new k(0),z=new k(0),q=new k(0),W=new k(0),j="";for(let{command:G,args:F}of J){let _=G===G.toLowerCase(),U=G.toUpperCase();if(U==="M"){if(F.length<2)continue;let O=_?K.plus(F[0]):F[0],V=_?Q.plus(F[1]):F[1];K=O,Q=V,H=O,z=V,Z.push({command:"M",args:[O,V]}),j="M"}else if(U==="L"){if(F.length<2)continue;let O=_?K.plus(F[0]):F[0],V=_?Q.plus(F[1]):F[1];K=O,Q=V,Z.push({command:"L",args:[O,V]}),j="L"}else if(U==="H"){if(F.length<1)continue;let O=_?K.plus(F[0]):F[0];K=O,Z.push({command:"L",args:[O,Q]}),j="H"}else if(U==="V"){if(F.length<1)continue;let O=_?Q.plus(F[0]):F[0];Q=O,Z.push({command:"L",args:[K,O]}),j="V"}else if(U==="C"){if(F.length<6)continue;let O=_?K.plus(F[0]):F[0],V=_?Q.plus(F[1]):F[1],M=_?K.plus(F[2]):F[2],Y=_?Q.plus(F[3]):F[3],X=_?K.plus(F[4]):F[4],w=_?Q.plus(F[5]):F[5];q=M,W=Y,K=X,Q=w,Z.push({command:"C",args:[O,V,M,Y,X,w]}),j="C"}else if(U==="S"){if(F.length<4)continue;let O,V;if(j==="C"||j==="S")O=K.mul(2).minus(q),V=Q.mul(2).minus(W);else O=K,V=Q;let M=_?K.plus(F[0]):F[0],Y=_?Q.plus(F[1]):F[1],X=_?K.plus(F[2]):F[2],w=_?Q.plus(F[3]):F[3];q=M,W=Y,K=X,Q=w,Z.push({command:"C",args:[O,V,M,Y,X,w]}),j="S"}else if(U==="Q"){if(F.length<4)continue;let O=_?K.plus(F[0]):F[0],V=_?Q.plus(F[1]):F[1],M=_?K.plus(F[2]):F[2],Y=_?Q.plus(F[3]):F[3];q=O,W=V,K=M,Q=Y,Z.push({command:"Q",args:[O,V,M,Y]}),j="Q"}else if(U==="T"){if(F.length<2)continue;let O,V;if(j==="Q"||j==="T")O=K.mul(2).minus(q),V=Q.mul(2).minus(W);else O=K,V=Q;let M=_?K.plus(F[0]):F[0],Y=_?Q.plus(F[1]):F[1];q=O,W=V,K=M,Q=Y,Z.push({command:"Q",args:[O,V,M,Y]}),j="T"}else if(U==="A"){if(F.length<7)continue;let O=_?K.plus(F[5]):F[5],V=_?Q.plus(F[6]):F[6];K=O,Q=V,Z.push({command:"A",args:[F[0],F[1],F[2],F[3],F[4],O,V]}),j="A"}else if(U==="Z")K=H,Q=z,Z.push({command:"Z",args:[]}),j="Z";else Z.push({command:G,args:F}),j=G}return N9(Z)}function z5($,J=6){if($==null)throw new Error("convertElementToPath: element parameter is required");if(!Number.isFinite(J)||J<0)throw new Error("convertElementToPath: precision must be non-negative");let Z=(Q,H=0)=>{let z=$.getAttribute?$.getAttribute(Q):$[Q];return SQ(z!==void 0&&z!==null?z:H)},K=($.tagName||$.type||"").toLowerCase();if(K==="circle")return k9(Z("cx",0),Z("cy",0),Z("r",0),J);else if(K==="ellipse")return L9(Z("cx",0),Z("cy",0),Z("rx",0),Z("ry",0),J);else if(K==="rect")return w9(Z("x",0),Z("y",0),Z("width",0),Z("height",0),Z("rx",0),Z("ry",null),!1,J);else if(K==="line")return R9(Z("x1",0),Z("y1",0),Z("x2",0),Z("y2",0),J);else if(K==="polyline")return L$(Z("points",""),J);else if(K==="polygon")return B9(Z("points",""),J);return null}function SQ($){if($==null)return 0;if(typeof $==="string"){let Z=parseFloat($);return isNaN(Z)?0:Z}if(typeof $==="number")return isNaN($)?0:$;if($ instanceof k)return $.toNumber();let J=Number($);return isNaN(J)?0:J}var L7=($)=>{if($ instanceof k){if(!$.isFinite())throw new Error(`Value must be finite (got ${$.toString()})`);return $}try{let J=new k($);if(!J.isFinite())throw new Error(`Value must be finite (got ${$})`);return J}catch(J){throw new Error(`Invalid numeric value: "${$}" (${J.message})`)}};function V7($,J){if($===void 0||$===null)throw new Error(`${J} is required`);if(typeof $!=="number"&&typeof $!=="string"&&!($ instanceof k))throw new Error(`${J} must be a number, string, or Decimal`);if(typeof $==="number"&&!isFinite($))throw new Error(`${J} must be a finite number (got ${$})`);if($ instanceof k&&!$.isFinite())throw new Error(`${J} must be a finite Decimal (got ${$.toString()})`)}function i0($,J){return V7($,"tx"),V7(J,"ty"),U0.from([[new k(1),new k(0),L7($)],[new k(0),new k(1),L7(J)],[new k(0),new k(0),new k(1)]])}function w7($,J=null){if(V7($,"sx"),J!==null)V7(J,"sy");let Z=J===null?$:J,K=L7($),Q=L7(Z);if(K.isZero()||Q.isZero())throw new Error("Scale factors cannot be zero (creates singular matrix)");return U0.from([[K,new k(0),new k(0)],[new k(0),Q,new k(0)],[new k(0),new k(0),new k(1)]])}function O6($){V7($,"theta");let Z=L7($).toNumber(),K=Math.PI,Q=Z-2*K*Math.floor((Z+K)/(2*K));if(!isFinite(Q))throw new Error(`Angle normalization failed for theta=${$} (too large or invalid)`);let H=new k(Math.cos(Q)),z=new k(Math.sin(Q));if(!H.isFinite()||!z.isFinite())throw new Error(`Trigonometric computation failed for theta=${$} (produced non-finite values)`);return U0.from([[H,z.negated(),new k(0)],[z,H,new k(0)],[new k(0),new k(0),new k(1)]])}function W5($,J,Z){V7($,"theta"),V7(J,"px"),V7(Z,"py");let K=L7(J),Q=L7(Z);return i0(K,Q).mul(O6($)).mul(i0(K.negated(),Q.negated()))}function I9($,J){V7($,"ax"),V7(J,"ay");let Z=L7($),K=L7(J);if(new k(1).minus(Z.mul(K)).lessThanOrEqualTo(0))throw new Error(`Skew parameters create singular or orientation-inverting matrix (ax*ay = ${Z.mul(K).toString()}, must be < 1)`);return U0.from([[new k(1),Z,new k(0)],[K,new k(1),new k(0)],[new k(0),new k(0),new k(1)]])}function c0($,J,Z){if(!$||typeof $.mul!=="function")throw new Error("applyTransform: first argument must be a Matrix");if(!$.data||!Array.isArray($.data)||$.data.length!==3||!$.data[0]||$.data[0].length!==3||!$.data[1]||$.data[1].length!==3||!$.data[2]||$.data[2].length!==3)throw new Error("applyTransform: matrix must be 3x3");V7(J,"x"),V7(Z,"y");let K=U0.from([[L7(J)],[L7(Z)],[new k(1)]]),Q=$.mul(K);if(!Q||!Q.data||!Array.isArray(Q.data)||Q.data.length!==3||!Q.data[0]||!Q.data[0][0]||!Q.data[1]||!Q.data[1][0]||!Q.data[2]||!Q.data[2][0])throw new Error("applyTransform: matrix multiplication produced invalid result");let H=Q.data[0][0],z=Q.data[1][0],q=Q.data[2][0];if(q.isZero())throw new Error("applyTransform: perspective division by zero (invalid transformation matrix)");return[H.div(q),z.div(q)]}k.set({precision:80});function j5($,J,Z){return C9($,J,Z,Z)}function C9($,J,Z,K){let Q=(R)=>new k(R),H=Q($),z=Q(J),q=Q(Z),W=Q(K);if(!q.isFinite()||!W.isFinite()||!H.isFinite()||!z.isFinite())throw new Error("Ellipse parameters must be finite");if(q.eq(0)||W.eq(0))return console.warn("Degenerate ellipse with zero radius, returning empty path"),"";if(q.lt(0)||W.lt(0))throw new Error("Ellipse radii must be non-negative");let j=Q("0.5522847498307936"),G=q.mul(j),F=W.mul(j),_=H.plus(q),U=z,O=H,V=z.minus(W),M=H.minus(q),Y=z,X=H,w=z.plus(W);return[`M ${_.toFixed(6)} ${U.toFixed(6)}`,`C ${_.toFixed(6)} ${U.minus(F).toFixed(6)} ${O.plus(G).toFixed(6)} ${V.toFixed(6)} ${O.toFixed(6)} ${V.toFixed(6)}`,`C ${O.minus(G).toFixed(6)} ${V.toFixed(6)} ${M.toFixed(6)} ${Y.minus(F).toFixed(6)} ${M.toFixed(6)} ${Y.toFixed(6)}`,`C ${M.toFixed(6)} ${Y.plus(F).toFixed(6)} ${X.minus(G).toFixed(6)} ${w.toFixed(6)} ${X.toFixed(6)} ${w.toFixed(6)}`,`C ${X.plus(G).toFixed(6)} ${w.toFixed(6)} ${_.toFixed(6)} ${U.plus(F).toFixed(6)} ${_.toFixed(6)} ${U.toFixed(6)}`,"Z"].join(" ")}function G5($,J,Z,K,Q=0,H=null){let z=(M)=>new k(M),q=z($),W=z(J),j=z(Z),G=z(K);if(j.lte(0)||G.lte(0))throw new Error("Rectangle dimensions must be positive");if(!j.isFinite()||!G.isFinite()||!q.isFinite()||!W.isFinite())throw new Error("Rectangle parameters must be finite");let F=z(Q),_=H!==null?z(H):F;if(F.lt(0)||_.lt(0))throw new Error("Rectangle corner radii must be non-negative");let U=j.div(2),O=G.div(2);if(F.gt(U))F=U;if(_.gt(O))_=O;if(!(F.gt(0)||_.gt(0)))return[`M ${q.toFixed(6)} ${W.toFixed(6)}`,`L ${q.plus(j).toFixed(6)} ${W.toFixed(6)}`,`L ${q.plus(j).toFixed(6)} ${W.plus(G).toFixed(6)}`,`L ${q.toFixed(6)} ${W.plus(G).toFixed(6)}`,"Z"].join(" ");return[`M ${q.plus(F).toFixed(6)} ${W.toFixed(6)}`,`L ${q.plus(j).minus(F).toFixed(6)} ${W.toFixed(6)}`,`A ${F.toFixed(6)} ${_.toFixed(6)} 0 0 1 ${q.plus(j).toFixed(6)} ${W.plus(_).toFixed(6)}`,`L ${q.plus(j).toFixed(6)} ${W.plus(G).minus(_).toFixed(6)}`,`A ${F.toFixed(6)} ${_.toFixed(6)} 0 0 1 ${q.plus(j).minus(F).toFixed(6)} ${W.plus(G).toFixed(6)}`,`L ${q.plus(F).toFixed(6)} ${W.plus(G).toFixed(6)}`,`A ${F.toFixed(6)} ${_.toFixed(6)} 0 0 1 ${q.toFixed(6)} ${W.plus(G).minus(_).toFixed(6)}`,`L ${q.toFixed(6)} ${W.plus(_).toFixed(6)}`,`A ${F.toFixed(6)} ${_.toFixed(6)} 0 0 1 ${q.plus(F).toFixed(6)} ${W.toFixed(6)}`].join(" ")}function F5($,J,Z,K){let Q=(j)=>new k(j),H=Q($),z=Q(J),q=Q(Z),W=Q(K);if(!H.isFinite()||!z.isFinite()||!q.isFinite()||!W.isFinite())throw new Error("lineToPath: all parameters must be finite");return`M ${H.toFixed(6)} ${z.toFixed(6)} L ${q.toFixed(6)} ${W.toFixed(6)}`}function _5($){let J=V5($);if(J.length===0)return"";let Z=`M ${J[0][0]} ${J[0][1]}`;for(let K=1;K<J.length;K++)Z+=` L ${J[K][0]} ${J[K][1]}`;return Z+" Z"}function U5($){let J=V5($);if(J.length===0)return"";let Z=`M ${J[0][0]} ${J[0][1]}`;for(let K=1;K<J.length;K++)Z+=` L ${J[K][0]} ${J[K][1]}`;return Z}function V5($){if(!$)return[];let J;try{if(Array.isArray($))J=$.flat().map((K)=>new k(K).toFixed(6));else if(typeof $==="string")J=$.trim().split(/[\s,]+/).filter((K)=>K.length>0).map((K)=>new k(K).toFixed(6));else return console.warn("parsePointPairs: invalid input type"),[]}catch(K){return console.warn(`parsePointPairs: parse error - ${K.message}`),[]}if(J.length%2!==0)console.warn("parsePointPairs: odd number of coordinates, ignoring last value"),J=J.slice(0,-1);let Z=[];for(let K=0;K+1<J.length;K+=2)Z.push([J[K],J[K+1]]);return Z}function vQ($,J,Z,K,Q,H,z,q){let W=(Q0)=>new k(Q0),j=W("1e-16");if(!q||!q.data||!Array.isArray(q.data)||q.data.length<3)throw new Error("transformArc: invalid matrix");let G=W($),F=W(J);if(G.lte(0)||F.lte(0))return console.warn("transformArc: radii must be positive, returning degenerate arc"),{rx:0,ry:0,xAxisRotation:0,largeArcFlag:K,sweepFlag:Q,x:W(H).toNumber(),y:W(z).toNumber()};let _=K;if(typeof _!=="number"||_!==0&&_!==1)console.warn(`transformArc: largeArcFlag must be 0 or 1, got ${K}`),_=_?1:0;let U=Q;if(typeof U!=="number"||U!==0&&U!==1)console.warn(`transformArc: sweepFlag must be 0 or 1, got ${Q}`),U=U?1:0;let O=q.data[0][0],V=q.data[1][0],M=q.data[0][1],Y=q.data[1][1],X=q.data[0][2],w=q.data[1][2],R=W(H),I=W(z),f=O.mul(R).plus(M.mul(I)).plus(X),u=V.mul(R).plus(Y.mul(I)).plus(w),m=W(Z).mul(W(Math.PI)).div(180),S=k.sin(m),x=k.cos(m),h=O.mul(G).mul(x).plus(M.mul(G).mul(S)),E=V.mul(G).mul(x).plus(Y.mul(G).mul(S)),d=O.mul(F.neg()).mul(S).plus(M.mul(F).mul(x)),c=V.mul(F.neg()).mul(S).plus(Y.mul(F).mul(x)),p=h.mul(h).plus(d.mul(d)),N=E.mul(E).plus(c.mul(c)),y=h.mul(E).plus(d.mul(c)).mul(2),B=p.minus(N),e,r,s;if(y.abs().lt(j))e=W(0),r=p,s=N;else if(B.abs().lt(j))r=p.plus(y.mul("0.5")),s=p.minus(y.mul("0.5")),e=W(Math.PI).div(4);else{let Q0=W(1).plus(y.mul(y).div(B.mul(B))).sqrt();r=p.plus(N).plus(Q0.mul(B)).div(2),s=p.plus(N).minus(Q0.mul(B)).div(2),e=k.atan(y.div(B)).div(2)}if(r.lt(0))r=W(0);if(s.lt(0))s=W(0);let z0=r.sqrt(),T=s.sqrt();if(B.lte(0)){let Q0=z0;z0=T,T=Q0}if(T.gt(z0)){let Q0=z0;z0=T,T=Q0,e=e.plus(W(Math.PI).div(2))}let P=O.mul(Y).minus(V.mul(M)),t=U;if(P.lt(0))t=U?0:1;let $0=e.mul(180).div(W(Math.PI));while($0.lt(0))$0=$0.plus(180);while($0.gte(180))$0=$0.minus(180);return{rx:z0.toNumber(),ry:T.toNumber(),xAxisRotation:$0.toNumber(),largeArcFlag:_,sweepFlag:t,x:f.toNumber(),y:u.toNumber()}}function DQ($,J){if(!$||typeof $!=="string")return console.warn("parseTransformFunction: invalid function name"),U0.identity(3);if(!J||!Array.isArray(J))return console.warn("parseTransformFunction: invalid arguments array"),U0.identity(3);let Z=(K)=>new k(K);switch($.toLowerCase()){case"translate":{let K=J[0]!==void 0?J[0]:0,Q=J[1]!==void 0?J[1]:0;return i0(K,Q)}case"scale":{let K=J[0]!==void 0?J[0]:1,Q=J[1]!==void 0?J[1]:K;return w7(K,Q)}case"rotate":{let K=J[0]!==void 0?J[0]:0,Q=Z(K).mul(Z(Math.PI)).div(180);if(J.length>=3){if(J[1]===void 0||J[2]===void 0||!isFinite(J[1])||!isFinite(J[2]))return console.warn("parseTransformFunction: rotate(angle, cx, cy) has invalid cx or cy, using origin rotation"),O6(Q);let H=J[1],z=J[2];return W5(Q,H,z)}return O6(Q)}case"skewx":{let K=J[0]!==void 0?J[0]:0,Q=Z(K).mul(Z(Math.PI)).div(180),H=k.tan(Q);return I9(H,0)}case"skewy":{let K=J[0]!==void 0?J[0]:0,Q=Z(K).mul(Z(Math.PI)).div(180),H=k.tan(Q);return I9(0,H)}case"matrix":{if(J.length<6)return console.warn(`parseTransformFunction: matrix() requires 6 arguments, got ${J.length}`),U0.identity(3);let[K,Q,H,z,q,W]=J.slice(0,6).map((j)=>Z(j!==void 0?j:0));return U0.from([[K,H,q],[Q,z,W],[Z(0),Z(0),Z(1)]])}default:return console.warn(`Unknown transform function: ${$}`),U0.identity(3)}}function F7($){if(!$||$.trim()==="")return U0.identity(3);let J=/(\w+)\s*\(([^)]*)\)/g,Z,K=U0.identity(3);while((Z=J.exec($))!==null){let Q=Z[1],z=Z[2].split(/[\s,]+/).filter((W)=>W.length>0).map((W)=>{let j=parseFloat(W);if(isNaN(j))return console.warn(`parseTransformAttribute: invalid numeric argument "${W}" in ${Q}(), using 0`),0;return j}),q=DQ(Q,z);K=K.mul(q)}return K}function M7($,J,Z){if(!$||!$.data||!Array.isArray($.data))throw new Error("applyToPoint: invalid CTM matrix");let K=(z)=>new k(z);try{let z=K(J),q=K(Z);if(!z.isFinite()||!q.isFinite())throw new Error("applyToPoint: coordinates must be finite")}catch(z){throw new Error(`applyToPoint: invalid coordinates - ${z.message}`)}let[Q,H]=c0($,J,Z);return{x:Q,y:H}}function M5($,J=6){if(!$||!$.data||!Array.isArray($.data)||$.data.length<3||!Array.isArray($.data[0])||!Array.isArray($.data[1])||$.data[0].length<3||$.data[1].length<3)throw new Error("toSVGMatrix: invalid CTM matrix structure");let Z=J;if(typeof Z!=="number"||Z<0||Z>20)console.warn("toSVGMatrix: invalid precision, using default 6"),Z=6;try{let K=$.data[0][0].toFixed(Z),Q=$.data[1][0].toFixed(Z),H=$.data[0][1].toFixed(Z),z=$.data[1][1].toFixed(Z),q=$.data[0][2].toFixed(Z),W=$.data[1][2].toFixed(Z);return`matrix(${K}, ${Q}, ${H}, ${z}, ${q}, ${W})`}catch(K){throw new Error(`toSVGMatrix: invalid matrix elements - ${K.message}`)}}function Y6($,J,Z={}){if(!$||typeof $!=="string")return console.warn("transformPathData: invalid pathData (must be string)"),"";if(!J||!J.data)return console.warn("transformPathData: invalid CTM matrix"),$;let{toAbsolute:K=!0,precision:Q=6}=Z,H=Q;if(typeof H!=="number"||H<0||H>20||!isFinite(H))console.warn("transformPathData: invalid precision, using default 6"),H=6;let z=(U)=>new k(U),q=hQ($);if(q.length===0)return"";let W=[],j=z(0),G=z(0),F=z(0),_=z(0);for(let{cmd:U,args:O}of q){let V=U===U.toLowerCase();switch(U.toUpperCase()){case"M":{let Y=[];if(O.length%2!==0)console.warn(`transformPathData: M command has ${O.length} args, expected multiple of 2`);for(let X=0;X+1<O.length;X+=2){let w=z(O[X]),R=z(O[X+1]);if(V)w=w.plus(j),R=R.plus(G);let I=M7(J,w,R);if(Y.push(I.x.toFixed(H),I.y.toFixed(H)),j=w,G=R,X===0)F=w,_=R}W.push((K?"M":U)+" "+Y.join(" "));break}case"L":{let Y=[];if(O.length%2!==0)console.warn(`transformPathData: L command has ${O.length} args, expected multiple of 2`);for(let X=0;X+1<O.length;X+=2){let w=z(O[X]),R=z(O[X+1]);if(V)w=w.plus(j),R=R.plus(G);let I=M7(J,w,R);Y.push(I.x.toFixed(H),I.y.toFixed(H)),j=w,G=R}W.push((K?"L":U)+" "+Y.join(" "));break}case"H":{if(O.length<1){console.warn("transformPathData: H command requires at least 1 argument");break}for(let Y=0;Y<O.length;Y++){let X=z(O[Y]);if(V)X=X.plus(j);let R=M7(J,X,G);W.push("L "+R.x.toFixed(H)+" "+R.y.toFixed(H)),j=X}break}case"V":{if(O.length<1){console.warn("transformPathData: V command requires at least 1 argument");break}for(let Y=0;Y<O.length;Y++){let X=j,w=z(O[Y]);if(V)w=w.plus(G);let R=M7(J,X,w);W.push("L "+R.x.toFixed(H)+" "+R.y.toFixed(H)),G=w}break}case"C":{let Y=[];if(O.length%6!==0)console.warn(`transformPathData: C command has ${O.length} args, expected multiple of 6`);for(let X=0;X+5<O.length;X+=6){let w=z(O[X]),R=z(O[X+1]),I=z(O[X+2]),f=z(O[X+3]),u=z(O[X+4]),m=z(O[X+5]);if(V)w=w.plus(j),R=R.plus(G),I=I.plus(j),f=f.plus(G),u=u.plus(j),m=m.plus(G);let S=M7(J,w,R),x=M7(J,I,f),h=M7(J,u,m);Y.push(S.x.toFixed(H),S.y.toFixed(H),x.x.toFixed(H),x.y.toFixed(H),h.x.toFixed(H),h.y.toFixed(H)),j=u,G=m}W.push((K?"C":U)+" "+Y.join(" "));break}case"S":{let Y=[];if(O.length%4!==0)console.warn(`transformPathData: S command has ${O.length} args, expected multiple of 4`);for(let X=0;X+3<O.length;X+=4){let w=z(O[X]),R=z(O[X+1]),I=z(O[X+2]),f=z(O[X+3]);if(V)w=w.plus(j),R=R.plus(G),I=I.plus(j),f=f.plus(G);let u=M7(J,w,R),m=M7(J,I,f);Y.push(u.x.toFixed(H),u.y.toFixed(H),m.x.toFixed(H),m.y.toFixed(H)),j=I,G=f}W.push((K?"S":U)+" "+Y.join(" "));break}case"Q":{let Y=[];if(O.length%4!==0)console.warn(`transformPathData: Q command has ${O.length} args, expected multiple of 4`);for(let X=0;X+3<O.length;X+=4){let w=z(O[X]),R=z(O[X+1]),I=z(O[X+2]),f=z(O[X+3]);if(V)w=w.plus(j),R=R.plus(G),I=I.plus(j),f=f.plus(G);let u=M7(J,w,R),m=M7(J,I,f);Y.push(u.x.toFixed(H),u.y.toFixed(H),m.x.toFixed(H),m.y.toFixed(H)),j=I,G=f}W.push((K?"Q":U)+" "+Y.join(" "));break}case"T":{let Y=[];if(O.length%2!==0)console.warn(`transformPathData: T command has ${O.length} args, expected multiple of 2`);for(let X=0;X+1<O.length;X+=2){let w=z(O[X]),R=z(O[X+1]);if(V)w=w.plus(j),R=R.plus(G);let I=M7(J,w,R);Y.push(I.x.toFixed(H),I.y.toFixed(H)),j=w,G=R}W.push((K?"T":U)+" "+Y.join(" "));break}case"A":{let Y=[];if(O.length%7!==0)console.warn(`transformPathData: Arc command has ${O.length} args, expected multiple of 7`);for(let X=0;X+6<O.length;X+=7){let w=O[X],R=O[X+1],I=O[X+2],f=O[X+3],u=O[X+4],m=z(O[X+5]),S=z(O[X+6]);if(V)m=m.plus(j),S=S.plus(G);let x=vQ(w,R,I,f,u,m.toNumber(),S.toNumber(),J);Y.push(x.rx.toFixed(H),x.ry.toFixed(H),x.xAxisRotation.toFixed(H),x.largeArcFlag,x.sweepFlag,x.x.toFixed(H),x.y.toFixed(H)),j=m,G=S}W.push((K?"A":U)+" "+Y.join(" "));break}case"Z":{W.push("Z"),j=F,G=_;break}default:W.push(U+" "+O.join(" "))}}return W.join(" ")}function hQ($){if(!$||typeof $!=="string")return[];let J=[],Z=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,K;while((K=Z.exec($))!==null){let Q=K[1],H=K[2].trim(),z=H.length>0?H.split(/[\s,]+/).filter((q)=>q.length>0).map((q)=>{let W=parseFloat(q);if(isNaN(W))return console.warn(`parsePathCommands: invalid number '${q}'`),0;return W}):[];J.push({cmd:Q,args:z})}return J}var A7={};q$(A7,{sign:()=>P9,segmentIntersection:()=>R$,reversePolygon:()=>b9,polygonUnion:()=>z6,polygonIntersection:()=>P7,polygonDifference:()=>R5,polygonArea:()=>g6,pointsEqual:()=>v7,pointOnSegment:()=>A9,pointInPolygon:()=>R7,point:()=>b0,lineSegmentIntersection:()=>L5,isCounterClockwise:()=>T9,isConvex:()=>S9,ensureCCW:()=>B$,dot:()=>k5,default:()=>mQ,cross:()=>D7,convexHull:()=>f9,clipPolygonSH:()=>E9,boundingBox:()=>h7,bboxIntersects:()=>x6});k.set({precision:80});var O7=($)=>$ instanceof k?$:new k($),_7=new k("1e-40");function b0($,J){if($===null||$===void 0)throw new Error("point: x coordinate is required");if(J===null||J===void 0)throw new Error("point: y coordinate is required");return{x:O7($),y:O7(J)}}function v7($,J,Z=_7){if(!$||typeof $!=="object"||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("pointsEqual: p1 must be a point with x and y properties");if(!J||typeof J!=="object"||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("pointsEqual: p2 must be a point with x and y properties");if(!Z||typeof Z.abs!=="function")throw new Error("pointsEqual: tolerance must be a Decimal instance");return $.x.minus(J.x).abs().lt(Z)&&$.y.minus(J.y).abs().lt(Z)}function D7($,J,Z){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("cross: origin point o must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("cross: point a must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("cross: point b must have x and y properties");let K=J.x.minus($.x),Q=J.y.minus($.y),H=Z.x.minus($.x),z=Z.y.minus($.y);return K.mul(z).minus(Q.mul(H))}function k5($,J,Z){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("dot: origin point o must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("dot: point a must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("dot: point b must have x and y properties");let K=J.x.minus($.x),Q=J.y.minus($.y),H=Z.x.minus($.x),z=Z.y.minus($.y);return K.mul(H).plus(Q.mul(z))}function P9($){if($===null||$===void 0||typeof $.abs!=="function")throw new Error("sign: val must be a Decimal instance");if($.abs().lt(_7))return 0;return $.lt(0)?-1:1}function R$($,J,Z,K){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("segmentIntersection: point a must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("segmentIntersection: point b must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("segmentIntersection: point c must have x and y properties");if(!K||K.x===null||K.x===void 0||K.y===null||K.y===void 0)throw new Error("segmentIntersection: point d must have x and y properties");let Q=J.x.minus($.x),H=J.y.minus($.y),z=K.x.minus(Z.x),q=K.y.minus(Z.y),W=Q.mul(q).minus(H.mul(z));if(W.abs().lt(_7))return null;let j=Z.x.minus($.x),G=Z.y.minus($.y),F=j.mul(q).minus(G.mul(z)).div(W),_=j.mul(H).minus(G.mul(Q)).div(W),U=O7(0),O=O7(1);if(F.gte(U)&&F.lte(O)&&_.gte(U)&&_.lte(O))return{x:$.x.plus(Q.mul(F)),y:$.y.plus(H.mul(F)),t:F,s:_};return null}function L5($,J,Z,K){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("lineSegmentIntersection: lineA must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("lineSegmentIntersection: lineB must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("lineSegmentIntersection: segA must have x and y properties");if(!K||K.x===null||K.x===void 0||K.y===null||K.y===void 0)throw new Error("lineSegmentIntersection: segB must have x and y properties");let Q=J.x.minus($.x),H=J.y.minus($.y),z=K.x.minus(Z.x),q=K.y.minus(Z.y),W=Q.mul(q).minus(H.mul(z));if(W.abs().lt(_7))return null;let j=Z.x.minus($.x),G=Z.y.minus($.y),F=j.mul(H).minus(G.mul(Q)).div(W);if(F.gte(0)&&F.lte(1))return{x:Z.x.plus(z.mul(F)),y:Z.y.plus(q.mul(F)),s:F};return null}function R7($,J){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("pointInPolygon: pt must have x and y properties");if(!Array.isArray(J))throw new Error("pointInPolygon: polygon must be an array");let Z=J.length;if(Z<3)return-1;for(let Q=0;Q<Z;Q++)if(!J[Q]||J[Q].x===null||J[Q].x===void 0||J[Q].y===null||J[Q].y===void 0)throw new Error(`pointInPolygon: polygon[${Q}] must have x and y properties`);let K=0;for(let Q=0;Q<Z;Q++){let H=J[Q],z=J[(Q+1)%Z];if(A9($,H,z))return 0;if(H.y.lte($.y)){if(z.y.gt($.y)){if(D7(H,z,$).gt(0))K++}}else if(z.y.lte($.y)){if(D7(H,z,$).lt(0))K--}}return K!==0?1:-1}function A9($,J,Z){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("pointOnSegment: pt must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("pointOnSegment: segment point a must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("pointOnSegment: segment point b must have x and y properties");if(D7(J,Z,$).abs().gt(_7))return!1;let Q=k.min(J.x,Z.x),H=k.max(J.x,Z.x),z=k.min(J.y,Z.y),q=k.max(J.y,Z.y);return $.x.gte(Q.minus(_7))&&$.x.lte(H.plus(_7))&&$.y.gte(z.minus(_7))&&$.y.lte(q.plus(_7))}function E9($,J){if(!Array.isArray($))throw new Error("clipPolygonSH: subject must be an array");if(!Array.isArray(J))throw new Error("clipPolygonSH: clip must be an array");if($.length<3||J.length<3)return[];for(let Q=0;Q<$.length;Q++)if(!$[Q]||$[Q].x===null||$[Q].x===void 0||$[Q].y===null||$[Q].y===void 0)throw new Error(`clipPolygonSH: subject[${Q}] must have x and y properties`);for(let Q=0;Q<J.length;Q++)if(!J[Q]||J[Q].x===null||J[Q].x===void 0||J[Q].y===null||J[Q].y===void 0)throw new Error(`clipPolygonSH: clip[${Q}] must have x and y properties`);let Z=$.map((Q)=>b0(Q.x,Q.y)),K=J.map((Q)=>b0(Q.x,Q.y));K=B$(K);for(let Q=0;Q<K.length;Q++){if(Z.length===0)return[];let H=K[Q],z=K[(Q+1)%K.length],q=Z;Z=[];for(let W=0;W<q.length;W++){let j=q[W],G=q[(W+q.length-1)%q.length],F=Y5(j,H,z),_=Y5(G,H,z);if(F){if(!_){let U=X5(G,j,H,z);if(U)Z.push(U)}Z.push(j)}else if(_){let U=X5(G,j,H,z);if(U)Z.push(U)}}}return Z}function Y5($,J,Z){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("isInsideEdge: pt must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("isInsideEdge: edgeStart must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("isInsideEdge: edgeEnd must have x and y properties");return D7(J,Z,$).gte(0)}function X5($,J,Z,K){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("lineIntersection: point a must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("lineIntersection: point b must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("lineIntersection: point c must have x and y properties");if(!K||K.x===null||K.x===void 0||K.y===null||K.y===void 0)throw new Error("lineIntersection: point d must have x and y properties");let Q=J.x.minus($.x),H=J.y.minus($.y),z=K.x.minus(Z.x),q=K.y.minus(Z.y),W=Q.mul(q).minus(H.mul(z));if(W.abs().lt(_7))return null;let j=Z.x.minus($.x),G=Z.y.minus($.y),F=j.mul(q).minus(G.mul(z)).div(W);return{x:$.x.plus(Q.mul(F)),y:$.y.plus(H.mul(F))}}function g6($){if(!Array.isArray($))throw new Error("polygonArea: polygon must be an array");let J=$.length;if(J<3)return O7(0);for(let K=0;K<J;K++)if(!$[K]||$[K].x===null||$[K].x===void 0||$[K].y===null||$[K].y===void 0)throw new Error(`polygonArea: polygon[${K}] must have x and y properties`);let Z=O7(0);for(let K=0;K<J;K++){let Q=$[K],H=$[(K+1)%J];Z=Z.plus(Q.x.mul(H.y).minus(H.x.mul(Q.y)))}return Z.div(2)}function T9($){if(!Array.isArray($))throw new Error("isCounterClockwise: polygon must be an array");return g6($).gt(0)}function b9($){if(!Array.isArray($))throw new Error("reversePolygon: polygon must be an array");return[...$].reverse()}function B$($){if(!Array.isArray($))throw new Error("ensureCCW: polygon must be an array");if(!T9($))return b9($);return $}function f9($){if(!Array.isArray($))throw new Error("convexHull: points must be an array");if($.length<3){for(let z=0;z<$.length;z++)if(!$[z]||$[z].x===null||$[z].x===void 0||$[z].y===null||$[z].y===void 0)throw new Error(`convexHull: points[${z}] must have x and y properties`);return $.map((z)=>b0(z.x,z.y))}for(let z=0;z<$.length;z++)if(!$[z]||$[z].x===null||$[z].x===void 0||$[z].y===null||$[z].y===void 0)throw new Error(`convexHull: points[${z}] must have x and y properties`);let J=$.map((z)=>b0(z.x,z.y)),Z=0;for(let z=1;z<J.length;z++)if(J[z].y.lt(J[Z].y)||J[z].y.eq(J[Z].y)&&J[z].x.lt(J[Z].x))Z=z;[J[0],J[Z]]=[J[Z],J[0]];let K=J[0],Q=J.slice(1).sort((z,q)=>{let W=D7(K,z,q);if(W.abs().lt(_7)){let G=z.x.minus(K.x).pow(2).plus(z.y.minus(K.y).pow(2)),F=q.x.minus(K.x).pow(2).plus(q.y.minus(K.y).pow(2)),_=G.minus(F);if(_.abs().lt(_7))return 0;return _.lt(0)?-1:1}return-P9(W)}),H=[K];for(let z of Q){while(H.length>1&&D7(H[H.length-2],H[H.length-1],z).lte(0))H.pop();H.push(z)}return H}function h7($){if(!Array.isArray($))throw new Error("boundingBox: polygon must be an array");if($.length===0)return null;if(!$[0]||$[0].x===null||$[0].x===void 0||$[0].y===null||$[0].y===void 0)throw new Error("boundingBox: polygon[0] must have x and y properties");let J=O7($[0].x),Z=O7($[0].y),K=O7($[0].x),Q=O7($[0].y);for(let H=0;H<$.length;H++){let z=$[H];if(!z||z.x===null||z.x===void 0||z.y===null||z.y===void 0)throw new Error(`boundingBox: polygon[${H}] must have x and y properties`);let q=O7(z.x),W=O7(z.y);if(q.lt(J))J=q;if(W.lt(Z))Z=W;if(q.gt(K))K=q;if(W.gt(Q))Q=W}return{minX:J,minY:Z,maxX:K,maxY:Q}}function x6($,J){if(!$||!J)return!1;if($.minX===null||$.minX===void 0||$.minY===null||$.minY===void 0||$.maxX===null||$.maxX===void 0||$.maxY===null||$.maxY===void 0)throw new Error("bboxIntersects: bb1 must have minX, minY, maxX, maxY properties");if(J.minX===null||J.minX===void 0||J.minY===null||J.minY===void 0||J.maxX===null||J.maxX===void 0||J.maxY===null||J.maxY===void 0)throw new Error("bboxIntersects: bb2 must have minX, minY, maxX, maxY properties");return!($.maxX.lt(J.minX)||J.maxX.lt($.minX)||$.maxY.lt(J.minY)||J.maxY.lt($.minY))}function P7($,J){if(!Array.isArray($))throw new Error("polygonIntersection: subject must be an array");if(!Array.isArray(J))throw new Error("polygonIntersection: clip must be an array");for(let z=0;z<$.length;z++)if(!$[z]||$[z].x===null||$[z].x===void 0||$[z].y===null||$[z].y===void 0)throw new Error(`polygonIntersection: subject[${z}] must have x and y properties`);for(let z=0;z<J.length;z++)if(!J[z]||J[z].x===null||J[z].x===void 0||J[z].y===null||J[z].y===void 0)throw new Error(`polygonIntersection: clip[${z}] must have x and y properties`);let Z=$.map((z)=>b0(z.x,z.y)),K=J.map((z)=>b0(z.x,z.y)),Q=h7(Z),H=h7(K);if(!x6(Q,H))return[];if(S9(K)){let z=E9(Z,B$(K));return z.length>=3?[z]:[]}return yQ(Z,K)}function S9($){if(!Array.isArray($))throw new Error("isConvex: polygon must be an array");let J=$.length;if(J<3)return!1;for(let K=0;K<J;K++)if(!$[K]||$[K].x===null||$[K].x===void 0||$[K].y===null||$[K].y===void 0)throw new Error(`isConvex: polygon[${K}] must have x and y properties`);let Z=0;for(let K=0;K<J;K++){let Q=$[K],H=$[(K+1)%J],z=$[(K+2)%J],q=D7(Q,H,z),W=q.gt(0)?1:q.lt(0)?-1:0;if(W!==0){if(Z===0)Z=W;else if(Z!==W)return!1}}return!0}function yQ($,J){if(!Array.isArray($)||!Array.isArray(J))throw new Error("generalPolygonIntersection: both arguments must be arrays");let Z=[];for(let W=0;W<$.length;W++){let j=$[W],G=$[(W+1)%$.length];for(let F=0;F<J.length;F++){let _=J[F],U=J[(F+1)%J.length],O=R$(j,G,_,U);if(O)Z.push(b0(O.x,O.y))}}let K=$.filter((W)=>R7(W,J)>=0),Q=J.filter((W)=>R7(W,$)>=0),H=[...Z,...K,...Q];if(H.length<3)return[];let z=uQ(H);if(z.length<3)return[];let q=f9(z);return q.length>=3?[q]:[]}function uQ($){if(!Array.isArray($))throw new Error("removeDuplicatePoints: points must be an array");let J=[];for(let Z of $){let K=!1;for(let Q of J)if(v7(Z,Q)){K=!0;break}if(!K)J.push(Z)}return J}function z6($,J){if(!Array.isArray($))throw new Error("polygonUnion: polygon1 must be an array");if(!Array.isArray(J))throw new Error("polygonUnion: polygon2 must be an array");for(let z=0;z<$.length;z++)if(!$[z]||$[z].x===null||$[z].x===void 0||$[z].y===null||$[z].y===void 0)throw new Error(`polygonUnion: polygon1[${z}] must have x and y properties`);for(let z=0;z<J.length;z++)if(!J[z]||J[z].x===null||J[z].x===void 0||J[z].y===null||J[z].y===void 0)throw new Error(`polygonUnion: polygon2[${z}] must have x and y properties`);let Z=$.map((z)=>b0(z.x,z.y)),K=J.map((z)=>b0(z.x,z.y)),Q=h7(Z),H=h7(K);if(!x6(Q,H))return[Z,K];return gQ(Z,K)}function gQ($,J){if(!Array.isArray($)||!Array.isArray(J))throw new Error("traceBoundaryUnion: both arguments must be arrays");let Z=w5($,J);if(Z.length===0){let V=R7($[0],J),M=R7(J[0],$);if(V>0)return[J];else if(M>0)return[$];else return[$,J]}let K=w$($,Z.map((V)=>({edgeIndex:V.edge1,t:V.t1,point:V.point,intersectionId:V.id}))),Q=w$(J,Z.map((V)=>({edgeIndex:V.edge2,t:V.t2,point:V.point,intersectionId:V.id}))),H=new Map;for(let V=0;V<K.length;V++)if(K[V].intersectionId!==void 0){if(!H.has(K[V].intersectionId))H.set(K[V].intersectionId,{});H.get(K[V].intersectionId).idx1=V}for(let V=0;V<Q.length;V++)if(Q[V].intersectionId!==void 0){if(!H.has(Q[V].intersectionId))H.set(Q[V].intersectionId,{});H.get(Q[V].intersectionId).idx2=V}let z=1,q=-1;for(let V=0;V<K.length;V++){let M=K[V];if(M.intersectionId===void 0&&R7(M,J)<0){q=V;break}}if(q===-1){z=2;for(let V=0;V<Q.length;V++){let M=Q[V];if(M.intersectionId===void 0&&R7(M,$)<0){q=V;break}}}if(q===-1){let V=g6($).abs(),M=g6(J).abs();return V.gt(M)?[$]:[J]}let W=[],j=z===1,G=q,F=new Set,_=(K.length+Q.length)*3,U=0,O=`${z}-${q}`;while(U<_){U++;let V=j?K:Q,M=j?Q:K,Y=V[G];if(W.length===0||!v7(W[W.length-1],Y))W.push(b0(Y.x,Y.y));let X=(G+1)%V.length,w=V[X];if(w.intersectionId!==void 0&&!F.has(w.intersectionId)){W.push(b0(w.x,w.y)),F.add(w.intersectionId);let I=H.get(w.intersectionId),f=j?I.idx2:I.idx1;j=!j,G=(f+1)%M.length}else G=X;if(`${j?1:2}-${G}`===O)break}if(W.length>1&&v7(W[0],W[W.length-1]))W.pop();return W.length>=3?[W]:[]}function w5($,J){if(!Array.isArray($)||!Array.isArray(J))throw new Error("findAllIntersections: both arguments must be arrays");let Z=[],K=0;for(let Q=0;Q<$.length;Q++){let H=$[Q],z=$[(Q+1)%$.length];for(let q=0;q<J.length;q++){let W=J[q],j=J[(q+1)%J.length],G=R$(H,z,W,j);if(G)Z.push({id:K++,point:b0(G.x,G.y),edge1:Q,edge2:q,t1:G.t,t2:G.s})}}return Z}function w$($,J){if(!Array.isArray($))throw new Error("augmentPolygon: polygon must be an array");if(!Array.isArray(J))throw new Error("augmentPolygon: insertions must be an array");let Z=new Map;for(let Q of J){if(!Z.has(Q.edgeIndex))Z.set(Q.edgeIndex,[]);Z.get(Q.edgeIndex).push(Q)}for(let Q of Z.values())Q.sort((H,z)=>H.t.minus(z.t).toNumber());let K=[];for(let Q=0;Q<$.length;Q++)if(K.push({...$[Q]}),Z.has(Q))for(let H of Z.get(Q))K.push({x:H.point.x,y:H.point.y,intersectionId:H.intersectionId});return K}function R5($,J){if(!Array.isArray($))throw new Error("polygonDifference: polygon1 must be an array");if(!Array.isArray(J))throw new Error("polygonDifference: polygon2 must be an array");for(let z=0;z<$.length;z++)if(!$[z]||$[z].x===null||$[z].x===void 0||$[z].y===null||$[z].y===void 0)throw new Error(`polygonDifference: polygon1[${z}] must have x and y properties`);for(let z=0;z<J.length;z++)if(!J[z]||J[z].x===null||J[z].x===void 0||J[z].y===null||J[z].y===void 0)throw new Error(`polygonDifference: polygon2[${z}] must have x and y properties`);let Z=$.map((z)=>b0(z.x,z.y)),K=J.map((z)=>b0(z.x,z.y)),Q=h7(Z),H=h7(K);if(!x6(Q,H))return[Z];return xQ(Z,K)}function xQ($,J){if(!Array.isArray($)||!Array.isArray(J))throw new Error("traceBoundaryDifference: both arguments must be arrays");let Z=w5($,J);if(Z.length===0)if(R7($[0],J)>0)return[];else return[$];let K=w$($,Z.map((U)=>({edgeIndex:U.edge1,t:U.t1,point:U.point,intersectionId:U.id}))),Q=w$(J,Z.map((U)=>({edgeIndex:U.edge2,t:U.t2,point:U.point,intersectionId:U.id}))),H=new Map;for(let U=0;U<K.length;U++)if(K[U].intersectionId!==void 0){if(!H.has(K[U].intersectionId))H.set(K[U].intersectionId,{});H.get(K[U].intersectionId).idx1=U}for(let U=0;U<Q.length;U++)if(Q[U].intersectionId!==void 0){if(!H.has(Q[U].intersectionId))H.set(Q[U].intersectionId,{});H.get(Q[U].intersectionId).idx2=U}let z=-1;for(let U=0;U<K.length;U++){let O=K[U];if(O.intersectionId===void 0&&R7(O,J)<0){z=U;break}}if(z===-1)return[];let q=[],W=!0,j=z,G=new Set,F=(K.length+Q.length)*3,_=0;while(_<F){_++;let O=(W?K:Q)[j];if(q.length===0||!v7(q[q.length-1],O))q.push(b0(O.x,O.y));let V=`${W?1:2}-${j}`;if(G.has(V))break;if(G.add(V),W){let M=(j+1)%K.length,Y=K[M];if(Y.intersectionId!==void 0){let X=K[(M+1)%K.length];if(R7(X,J)>0){let R=H.get(Y.intersectionId);q.push(b0(Y.x,Y.y)),W=!1,j=(R.idx2-1+Q.length)%Q.length}else j=M}else j=M}else{let M=(j-1+Q.length)%Q.length,Y=Q[M];if(Y.intersectionId!==void 0){let X=H.get(Y.intersectionId);q.push(b0(Y.x,Y.y)),W=!0,j=(X.idx1+1)%K.length}else j=M}if(W&&j===z)break}if(q.length>1&&v7(q[0],q[q.length-1]))q.pop();return q.length>=3?[q]:[]}var mQ={point:b0,pointsEqual:v7,cross:D7,dot:k5,sign:P9,segmentIntersection:R$,lineSegmentIntersection:L5,pointInPolygon:R7,pointOnSegment:A9,clipPolygonSH:E9,polygonArea:g6,isCounterClockwise:T9,reversePolygon:b9,ensureCCW:B$,isConvex:S9,convexHull:f9,boundingBox:h7,bboxIntersects:x6,polygonIntersection:P7,polygonUnion:z6,polygonDifference:R5,EPSILON:_7};k.set({precision:80});var N$=($)=>$ instanceof k?$:new k($),y7=new k("1e-40"),{point:s7,cross:v9,polygonIntersection:pq,polygonUnion:cq,polygonDifference:lq}=A7,o7={NONZERO:"nonzero",EVENODD:"evenodd"};function I$($,J,Z=o7.NONZERO){if(!$||typeof $!=="object")throw new Error("pointInPolygonWithRule: pt must be an object with x, y properties");if($.x===void 0||$.x===null||$.y===void 0||$.y===null)throw new Error("pointInPolygonWithRule: pt must have x and y properties");if(!Array.isArray(J))throw new Error("pointInPolygonWithRule: polygon must be an array");let K=J.length;if(K<3)return-1;let Q=0;for(let H=0;H<K;H++){let z=J[H],q=J[(H+1)%K];if(dQ($,z,q))return 0;if(z.y.lte($.y)){if(q.y.gt($.y)){if(v9(z,q,$).gt(0))Q++}}else if(q.y.lte($.y)){if(v9(z,q,$).lt(0))Q--}}if(Z===o7.EVENODD)return Math.abs(Q)%2===1?1:-1;else return Q!==0?1:-1}function dQ($,J,Z){if(!$||!J||!Z)throw new Error("pointOnSegment: pt, a, and b must be defined");if($.x===void 0||$.x===null||$.y===void 0||$.y===null||J.x===void 0||J.x===null||J.y===void 0||J.y===null||Z.x===void 0||Z.x===null||Z.y===void 0||Z.y===null)throw new Error("pointOnSegment: all points must have x and y properties");if(v9(J,Z,$).abs().gt(y7))return!1;let Q=k.min(J.x,Z.x),H=k.max(J.x,Z.x),z=k.min(J.y,Z.y),q=k.max(J.y,Z.y);return $.x.gte(Q.minus(y7))&&$.x.lte(H.plus(y7))&&$.y.gte(z.minus(y7))&&$.y.lte(q.plus(y7))}function pQ($,J,Z={}){if(!Array.isArray($))throw new Error("offsetPolygon: polygon must be an array");if(J===void 0||J===null)throw new Error("offsetPolygon: distance must be defined");if(!Z||typeof Z!=="object")throw new Error("offsetPolygon: options must be an object");let K=N$(J);if(K.lte(0))throw new Error("offsetPolygon: distance must be positive");let Q=Z.linejoin||"miter",H=N$(Z.miterLimit||4);if($.length<3)return{outer:[],inner:[]};let z=$.length,q=[],W=[];for(let j=0;j<z;j++){let G=$[(j-1+z)%z],F=$[j],_=$[(j+1)%z],U=F.x.minus(G.x),O=F.y.minus(G.y),V=_.x.minus(F.x),M=_.y.minus(F.y),Y=U.pow(2).plus(O.pow(2)).sqrt(),X=V.pow(2).plus(M.pow(2)).sqrt();if(Y.lt(y7)||X.lt(y7))continue;let w=O.div(Y),R=U.neg().div(Y),I=M.div(X),f=V.neg().div(X),u=w.plus(I).div(2),m=R.plus(f).div(2),S=u.pow(2).plus(m.pow(2)).sqrt();if(S.lt(y7))u=w,m=R;else u=u.div(S),m=m.div(S);let x=w.times(I).plus(R.times(f)),h=N$(1).minus(x).div(2).sqrt(),E=K;if(h.gt(y7)){let d=K.div(h);if(Q==="miter"&&d.lte(K.times(H)))E=d;else if(Q==="bevel"||d.gt(K.times(H))){let c=s7(F.x.plus(w.times(K)),F.y.plus(R.times(K))),p=s7(F.x.plus(I.times(K)),F.y.plus(f.times(K)));q.push(c,p);let N=s7(F.x.minus(w.times(K)),F.y.minus(R.times(K))),y=s7(F.x.minus(I.times(K)),F.y.minus(f.times(K)));W.push(N,y);continue}else if(Q==="round"){let c=Math.atan2(R.toNumber(),w.toNumber()),N=Math.atan2(f.toNumber(),I.toNumber())-c;if(N<-Math.PI)N+=2*Math.PI;if(N>Math.PI)N-=2*Math.PI;let y=Math.max(2,Math.ceil(Math.abs(N)/(Math.PI/8)));for(let B=0;B<=y;B++){let e=c+N*(B/y);q.push(s7(F.x.plus(K.times(Math.cos(e))),F.y.plus(K.times(Math.sin(e))))),W.push(s7(F.x.minus(K.times(Math.cos(e))),F.y.minus(K.times(Math.sin(e)))))}continue}}q.push(s7(F.x.plus(u.times(E)),F.y.plus(m.times(E)))),W.push(s7(F.x.minus(u.times(E)),F.y.minus(m.times(E))))}return{outer:q,inner:W.reverse()}}function D9($,J){if(!Array.isArray($))throw new Error("strokeToFilledPolygon: polygon must be an array");if(!J||typeof J!=="object")throw new Error("strokeToFilledPolygon: strokeProps must be an object");if(J.width===void 0||J.width===null)throw new Error("strokeToFilledPolygon: strokeProps must have width property");let Z=N$(J.width).div(2);if(Z.lte(0))throw new Error("strokeToFilledPolygon: width must be positive");return pQ($,Z,J).outer}k.set({precision:80});var E7=($)=>$ instanceof k?$:new k($),cQ={fill:"black","fill-rule":"nonzero","fill-opacity":1,stroke:"none","stroke-width":1,"stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":4,"stroke-dasharray":"none","stroke-dashoffset":0,"stroke-opacity":1,"marker-start":"none","marker-mid":"none","marker-end":"none","paint-order":"normal","clip-path":"none","clip-rule":"nonzero",mask:"none","mask-type":"luminance",opacity:1,transform:"none","vector-effect":"none",filter:"none"};class C${constructor($,J={},Z=null){if(!$)throw new Error("SVGRenderingContext: element parameter is required");if(J!==null&&typeof J!=="object")throw new Error("SVGRenderingContext: inherited must be an object or null");this.element=$,this.defsMap=Z||new Map,this.properties=this._extractProperties($,J||{}),this.dashArray=this._parseDashArray(this.properties["stroke-dasharray"]),this.dashOffset=E7(this.properties["stroke-dashoffset"]||0),this.markers={start:this._parseMarkerRef(this.properties["marker-start"]),mid:this._parseMarkerRef(this.properties["marker-mid"]),end:this._parseMarkerRef(this.properties["marker-end"])},this.hasFill=this.properties.fill!=="none"&&this.properties["fill-opacity"]>0,this.hasStroke=this.properties.stroke!=="none"&&E7(this.properties["stroke-width"]).gt(0)&&this.properties["stroke-opacity"]>0,this.hasMarkers=this.markers.start||this.markers.mid||this.markers.end}_extractProperties($,J){if(J!==null&&typeof J!=="object")throw new Error("_extractProperties: inherited must be an object or null");let Z={...cQ,...J||{}};if($&&$.getAttributeNames)for(let Q of $.getAttributeNames()){let H=$.getAttribute(Q);if(H!==null&&H!==void 0)Z[Q]=H}if(Z.style){let Q=this._parseStyleAttribute(Z.style);Object.assign(Z,Q)}let K=["stroke-width","stroke-miterlimit","stroke-dashoffset","opacity","fill-opacity","stroke-opacity"];for(let Q of K)if(typeof Z[Q]==="string"){let H=parseFloat(Z[Q]);if(!isNaN(H))Z[Q]=H}return Z}_parseStyleAttribute($){let J={};if(!$)return J;let Z=$.split(";");for(let K of Z){if(!K.includes(":"))continue;let[Q,H]=K.split(":").map((z)=>z.trim());if(Q&&H)J[Q]=H}return J}_parseDashArray($){if(!$||$==="none")return null;let J=$.toString().split(/[\s,]+/).filter((K)=>K),Z=[];for(let K of J){let Q=parseFloat(K);if(isNaN(Q)||!isFinite(Q))throw new Error(`_parseDashArray: invalid dash value '${K}'`);if(Q<0)throw new Error(`_parseDashArray: dash values must be non-negative, got ${Q}`);Z.push(E7(Q))}if(Z.length===0)return null;if(Z.length%2===1)return[...Z,...Z];return Z}_parseMarkerRef($){if(!$||$==="none")return null;let J=$.match(/url\(#?([^)]+)\)/);return J?J[1]:null}get fillRule(){return this.properties["fill-rule"]||"nonzero"}get clipRule(){return this.properties["clip-rule"]||"nonzero"}get strokeWidth(){return E7(this.properties["stroke-width"]||0)}get strokeLinecap(){return this.properties["stroke-linecap"]||"butt"}get strokeLinejoin(){return this.properties["stroke-linejoin"]||"miter"}get strokeMiterlimit(){return E7(this.properties["stroke-miterlimit"]||4)}getStrokeExtent(){if(!this.hasStroke)return E7(0);let $=this.strokeWidth.div(2),J=$;if(this.strokeLinejoin==="miter")J=$.times(this.strokeMiterlimit);if(this.strokeLinecap==="square"){let Z=$.times(2);if(Z.gt(J))J=Z}return J}expandBBoxForStroke($){if(!$||typeof $!=="object")throw new Error("expandBBoxForStroke: bbox must be an object");if(!("x"in $)||!("y"in $)||!("width"in $)||!("height"in $))throw new Error("expandBBoxForStroke: bbox must have x, y, width, height properties");if(typeof $.x.minus!=="function"||typeof $.y.minus!=="function"||typeof $.width.plus!=="function"||typeof $.height.plus!=="function")throw new Error("expandBBoxForStroke: bbox properties must be Decimal instances");if(!this.hasStroke)return $;let J=this.getStrokeExtent();return{x:$.x.minus(J),y:$.y.minus(J),width:$.width.plus(J.times(2)),height:$.height.plus(J.times(2))}}expandBBoxForMarkers($,J=null){if(!$||typeof $!=="object")throw new Error("expandBBoxForMarkers: bbox must be an object");if(!("x"in $)||!("y"in $)||!("width"in $)||!("height"in $))throw new Error("expandBBoxForMarkers: bbox must have x, y, width, height properties");if(typeof $.x.minus!=="function"||typeof $.y.minus!=="function"||typeof $.width.plus!=="function"||typeof $.height.plus!=="function")throw new Error("expandBBoxForMarkers: bbox properties must be Decimal instances");if(!this.hasMarkers)return $;let Z=E7(0);if(J){if(typeof J!=="object")throw new Error("expandBBoxForMarkers: markerSizes must be an object");let Q=[J.start,J.mid,J.end].filter((H)=>H!==null&&H!==void 0).map((H)=>{let z=typeof H==="number"?H:parseFloat(H);if(isNaN(z)||!isFinite(z))throw new Error(`expandBBoxForMarkers: invalid marker size '${H}'`);return E7(z)});if(Q.length>0)Z=k.max(...Q)}else Z=this.strokeWidth.times(3);if(Z.lte(0))return $;let K=Z.div(2);return{x:$.x.minus(K),y:$.y.minus(K),width:$.width.plus(K.times(2)),height:$.height.plus(K.times(2))}}expandBBoxForFilter($,J=null){if(!$||typeof $!=="object")throw new Error("expandBBoxForFilter: bbox must be an object");if(!("x"in $)||!("y"in $)||!("width"in $)||!("height"in $))throw new Error("expandBBoxForFilter: bbox must have x, y, width, height properties");if(typeof $.x.minus!=="function"||typeof $.y.minus!=="function"||typeof $.width.times!=="function"||typeof $.height.times!=="function")throw new Error("expandBBoxForFilter: bbox properties must be Decimal instances");let Z=this.properties.filter;if(!Z||Z==="none")return $;let K=$.width.times("0.1"),Q=$.height.times("0.1");if(J){if(typeof J!=="object")throw new Error("expandBBoxForFilter: filterDef must be an object");if(J.x!==void 0){let H=parseFloat(J.x);if(isNaN(H)||!isFinite(H))throw new Error(`expandBBoxForFilter: invalid filterDef.x value '${J.x}'`);K=E7(H).abs()}if(J.y!==void 0){let H=parseFloat(J.y);if(isNaN(H)||!isFinite(H))throw new Error(`expandBBoxForFilter: invalid filterDef.y value '${J.y}'`);Q=E7(H).abs()}}return{x:$.x.minus(K),y:$.y.minus(Q),width:$.width.plus(K.times(2)),height:$.height.plus(Q.times(2))}}getRenderedBBox($,J={}){if(!$||typeof $!=="object")throw new Error("getRenderedBBox: geometryBBox must be an object");if(!("x"in $)||!("y"in $)||!("width"in $)||!("height"in $))throw new Error("getRenderedBBox: geometryBBox must have x, y, width, height properties");if(typeof $.x.minus!=="function"||typeof $.y.minus!=="function")throw new Error("getRenderedBBox: geometryBBox properties must be Decimal instances");if(J!==null&&typeof J!=="object")throw new Error("getRenderedBBox: options must be an object or null");let Z={...$};return Z=this.expandBBoxForStroke(Z),Z=this.expandBBoxForMarkers(Z,J.markerSizes),Z=this.expandBBoxForFilter(Z,J.filterDef),Z}getFilledArea($){if(!Array.isArray($))throw new Error("getFilledArea: polygon must be an array");if($.length===0)throw new Error("getFilledArea: polygon must not be empty");let J=[];if(this.hasFill)J.push({polygon:$,fillRule:this.fillRule,type:"fill"});if(this.hasStroke){let Z=D9($,{width:this.strokeWidth.toNumber(),linecap:this.strokeLinecap,linejoin:this.strokeLinejoin,miterlimit:this.strokeMiterlimit.toNumber()});if(Z&&Z.length>0)J.push({polygon:Z,fillRule:"nonzero",type:"stroke"})}return J}isPointInRenderedArea($,J){if(!$||typeof $!=="object")throw new Error("isPointInRenderedArea: point must be an object");if($.x===void 0||$.y===void 0)throw new Error("isPointInRenderedArea: point must have x and y properties");if(!Array.isArray(J))throw new Error("isPointInRenderedArea: polygon must be an array");if(J.length===0)throw new Error("isPointInRenderedArea: polygon must not be empty");if(this.hasFill){let Z=this.fillRule==="evenodd"?o7.EVENODD:o7.NONZERO;if(I$($,J,Z)>=0)return!0}if(this.hasStroke){let Z=D9(J,{width:this.strokeWidth.toNumber(),linecap:this.strokeLinecap,linejoin:this.strokeLinejoin,miterlimit:this.strokeMiterlimit.toNumber()});if(Z&&Z.length>0){if(I$($,Z,o7.NONZERO)>=0)return!0}}return!1}canMergeWith($){if(!($ instanceof C$))throw new Error("canMergeWith: other must be an instance of SVGRenderingContext");if(this.fillRule!==$.fillRule)return{canMerge:!1,reason:"Different fill-rule"};if(this.hasStroke||$.hasStroke){if(this.hasStroke!==$.hasStroke)return{canMerge:!1,reason:"Different stroke presence"};if(!this.strokeWidth.eq($.strokeWidth))return{canMerge:!1,reason:"Different stroke-width"};if(this.strokeLinecap!==$.strokeLinecap)return{canMerge:!1,reason:"Different stroke-linecap"};if(this.strokeLinejoin!==$.strokeLinejoin)return{canMerge:!1,reason:"Different stroke-linejoin"}}if(this.hasMarkers||$.hasMarkers)return{canMerge:!1,reason:"Has markers"};if(this.properties["clip-path"]!=="none"||$.properties["clip-path"]!=="none")return{canMerge:!1,reason:"Has clip-path"};if(this.properties.mask!=="none"||$.properties.mask!=="none")return{canMerge:!1,reason:"Has mask"};if(this.properties.filter!=="none"||$.properties.filter!=="none")return{canMerge:!1,reason:"Has filter"};return{canMerge:!0,reason:null}}toSummary(){return{hasFill:this.hasFill,hasStroke:this.hasStroke,hasMarkers:this.hasMarkers,fillRule:this.fillRule,strokeWidth:this.hasStroke?this.strokeWidth.toNumber():0,strokeExtent:this.getStrokeExtent().toNumber(),linecap:this.strokeLinecap,linejoin:this.strokeLinejoin,clipPath:this.properties["clip-path"],filter:this.properties.filter}}}function m6($,J={},Z=null){if(!$)throw new Error("createRenderingContext: element parameter is required");return new C$($,J,Z)}function d6($){if(!$)throw new Error("getInheritedProperties: element parameter is required");let J={},Z=["fill","fill-rule","fill-opacity","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","stroke-opacity","marker-start","marker-mid","marker-end","clip-rule","opacity","font-family","font-size","font-style","font-weight"];if(!$.parentNode)return J;let K=$.parentNode;while(K&&K.tagName){for(let Q of Z)if(J[Q]===void 0){let H=K.getAttribute?K.getAttribute(Q):null;if(H!==null&&H!==void 0)J[Q]=H}K=K.parentNode}return J}k.set({precision:80});function C5($,J){if(!$||!J)throw new Error("setOwnerDocument: element and document are required");if(!$.children||!Array.isArray($.children))throw new Error("setOwnerDocument: element must have a children array");$.ownerDocument=J;for(let Z of $.children)if(Z instanceof B0)C5(Z,J)}function d0($){if(typeof $!=="string")throw new Error("parseSVG: input must be a string");if($.trim().length===0)throw new Error("parseSVG: input cannot be empty");let J=$.trim(),Z=A5(J,0);if(!Z.element)throw new Error("Failed to parse SVG: no root element found");let K=new P5(Z.element);return C5(Z.element,K),Z.element}class P5{constructor($=null){this.documentElement=$}createElement($){if(!$||typeof $!=="string")throw new Error("createElement: tagName must be a non-empty string");let J=new B0($);return J.ownerDocument=this,J}createElementNS($,J){if($!==null&&$!==void 0&&typeof $!=="string")throw new Error("createElementNS: namespace must be a string");return this.createElement(J)}}class B0{constructor($,J={},Z=[],K=""){if(!$||typeof $!=="string")throw new Error("SVGElement: tagName must be a non-empty string");if(J!==null&&typeof J!=="object")throw new Error("SVGElement: attributes must be an object");if(!Array.isArray(Z))throw new Error("SVGElement: children must be an array");if(typeof K!=="string")throw new Error("SVGElement: textContent must be a string");this.tagName=$,this.nodeName=$.toUpperCase(),this._attributes={...J},this.children=Z,this.childNodes=Z,this.textContent=K,this.parentNode=null,this.ownerDocument=null;for(let Q of Z)if(Q instanceof B0)Q.parentNode=this}getAttribute($){if(typeof $!=="string")throw new Error("getAttribute: name must be a string");return this._attributes[$]??null}setAttribute($,J){if(typeof $!=="string")throw new Error("setAttribute: name must be a string");if(J!==null&&J!==void 0)this._attributes[$]=String(J);else this._attributes[$]=""}hasAttribute($){if(typeof $!=="string")throw new Error("hasAttribute: name must be a string");return $ in this._attributes}removeAttribute($){if(typeof $!=="string")throw new Error("removeAttribute: name must be a string");delete this._attributes[$]}getAttributeNames(){return Object.keys(this._attributes)}getElementsByTagName($){if(typeof $!=="string")throw new Error("getElementsByTagName: tagName must be a string");if($.length===0)return[];let J=$.toLowerCase(),Z=[],K=(Q)=>{for(let H of Q.children)if(H instanceof B0){if(H.tagName.toLowerCase()===J||J==="*")Z.push(H);K(H)}};return K(this),Z}getElementById($){if(typeof $!=="string")throw new Error("getElementById: id must be a string");if($.length===0)return null;let J=(Z)=>{if(Z.getAttribute("id")===$)return Z;for(let K of Z.children)if(K instanceof B0){let Q=J(K);if(Q)return Q}return null};return J(this)}querySelector($){if(typeof $!=="string")throw new Error("querySelector: selector must be a string");return this.querySelectorAll($)[0]||null}querySelectorAll($){if(typeof $!=="string")throw new Error("querySelectorAll: selector must be a string");let J=[],Z=B5($),K=(Q)=>{for(let H of Q.children)if(H instanceof B0){if(N5(H,Z))J.push(H);K(H)}};return K(this),J}matches($){if(typeof $!=="string")throw new Error("matches: selector must be a string");let J=B5($);return N5(this,J)}cloneNode($=!0){if(typeof $!=="boolean")throw new Error("cloneNode: deep must be a boolean");let J=$?this.children.map((K)=>K instanceof B0?K.cloneNode(!0):K):[],Z=new B0(this.tagName,{...this._attributes},J,this.textContent);if(this.ownerDocument){let K=(Q,H)=>{Q.ownerDocument=H;for(let z of Q.children)if(z instanceof B0)K(z,H)};K(Z,this.ownerDocument)}return Z}appendChild($){if($===null||$===void 0)throw new Error("appendChild: child cannot be null or undefined");if($ instanceof B0&&$.parentNode)$.parentNode.removeChild($);if($ instanceof B0)$.parentNode=this;return this.children.push($),this.childNodes=this.children,$}removeChild($){if($===null||$===void 0)throw new Error("removeChild: child cannot be null or undefined");let J=this.children.indexOf($);if(J>=0){if(this.children.splice(J,1),this.childNodes=this.children,$ instanceof B0)$.parentNode=null}return $}insertBefore($,J){if($===null||$===void 0)throw new Error("insertBefore: newChild cannot be null or undefined");if(J===null||J===void 0)throw new Error("insertBefore: refChild cannot be null or undefined");if($ instanceof B0&&$.parentNode)$.parentNode.removeChild($);let Z=this.children.indexOf(J);if(Z>=0){if($ instanceof B0)$.parentNode=this;this.children.splice(Z,0,$),this.childNodes=this.children}else this.appendChild($);return $}replaceChild($,J){if($===null||$===void 0)throw new Error("replaceChild: newChild cannot be null or undefined");if(J===null||J===void 0)throw new Error("replaceChild: oldChild cannot be null or undefined");if($ instanceof B0&&$.parentNode)$.parentNode.removeChild($);let Z=this.children.indexOf(J);if(Z>=0){if(J instanceof B0)J.parentNode=null;if($ instanceof B0)$.parentNode=this;this.children[Z]=$,this.childNodes=this.children}return J}get style(){let $=this.getAttribute("style")||"",J={};if($.length===0)return J;return $.split(";").forEach((Z)=>{let K=Z.indexOf(":");if(K>0){let Q=Z.slice(0,K).trim(),H=Z.slice(K+1).trim();if(Q&&H)J[Q]=H}}),J}get firstChild(){return this.children[0]||null}get lastChild(){return this.children[this.children.length-1]||null}get nextSibling(){if(!this.parentNode)return null;let $=this.parentNode.children,J=$.indexOf(this);return $[J+1]||null}get previousSibling(){if(!this.parentNode)return null;let $=this.parentNode.children,J=$.indexOf(this);return J>0?$[J-1]:null}serialize($=0,J=!1){if(typeof $!=="number"||!Number.isFinite($)||$<0)throw new Error("serialize: indent must be a non-negative finite number");if(typeof J!=="boolean")throw new Error("serialize: minify must be a boolean");let Z=J?"":" ".repeat($),K=this._attributes["data-cdata-pending"]==="true",Q=Object.entries(this._attributes).filter(([j])=>j!=="data-cdata-pending").map(([j,G])=>`${j}="${lQ(G)}"`).join(" "),H=Q?" "+Q:"";if(this.children.length===0&&!this.textContent)return`${Z}<${this.tagName}${H}/>`;let z=J?"":`
|
|
9
|
+
`,q=this.children.map((j)=>j instanceof B0?j.serialize($+1,J):P$(j)).join(z),W="";if(this.textContent&&this.children.length>0)if(K)W=`<![CDATA[
|
|
10
|
+
${this.textContent}
|
|
11
|
+
]]>`+z+q;else W=P$(this.textContent)+z+q;else if(this.textContent)if(K)W=`<![CDATA[
|
|
12
|
+
${this.textContent}
|
|
13
|
+
]]>`;else W=P$(this.textContent);else W=q;if(this.children.length===0)return`${Z}<${this.tagName}${H}>${W}</${this.tagName}>`;return`${Z}<${this.tagName}${H}>${z}${W}${z}${Z}</${this.tagName}>`}get outerHTML(){return this.serialize(0)}get innerHTML(){return this.children.map(($)=>$ instanceof B0?$.serialize(0):P$($)).join(`
|
|
14
|
+
`)}}function A5($,J,Z=!1){if(typeof $!=="string")throw new Error("parseElement: str must be a string");if(typeof J!=="number"||!Number.isFinite(J)||J<0)throw new Error("parseElement: pos must be a non-negative finite number");if($.length===0)return{element:null,endPos:0};if(J>=$.length)return{element:null,endPos:J};let K=J;while(K<$.length){let O=$.slice(K).match(/^(\s+)/);if(O){K+=O[1].length;continue}if($.slice(K,K+4)==="<!--"){let V=$.indexOf("-->",K+4);if(V===-1)break;K=V+3;continue}if($.slice(K,K+9)==="<![CDATA["){let V=$.indexOf("]]>",K+9);if(V===-1)break;K=V+3;continue}if($.slice(K,K+2)==="<?"){let V=$.indexOf("?>",K+2);if(V===-1)break;K=V+2;continue}if($.slice(K,K+9).toUpperCase()==="<!DOCTYPE"){let V=0,M=K+9;while(M<$.length){if($[M]==="[")V++;else if($[M]==="]")V--;else if($[M]===">"&&V===0){K=M+1;break}M++}if(M>=$.length)break;continue}break}if(K>=$.length||$[K]!=="<")return{element:null,endPos:K};let Q=$.slice(K).match(/^<([a-zA-Z][a-zA-Z0-9_:-]*)/);if(!Q)return{element:null,endPos:K};let H=Q[1];K+=Q[0].length;let z={};while(K<$.length){let O=$.slice(K).match(/^(\s+)/);if(O)K+=O[1].length;if($[K]===">"){K++;break}if($.slice(K,K+2)==="/>")return K+=2,{element:new B0(H,z,[]),endPos:K};let V=$.slice(K).match(/^([a-zA-Z][a-zA-Z0-9_:-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/);if(V){let M=V[1],Y=V[2]!==void 0?V[2]:V[3];z[M]=nQ(Y),K+=V[0].length}else{let M=$.slice(K).match(/^([a-zA-Z][a-zA-Z0-9_:-]*)/);if(M)z[M[1]]="",K+=M[0].length;else K++}}let q=[],W="",j=`</${H}>`;while(K<$.length){if($.slice(K,K+j.length).toLowerCase()===j.toLowerCase()){K+=j.length;break}if($[K]==="<"&&$[K+1]!=="/"){if($.slice(K,K+9)==="<![CDATA["){let Y=$.indexOf("]]>",K+9);if(Y!==-1){W+=$.slice(K+9,Y),K=Y+3;continue}}if($.slice(K,K+4)==="<!--"){let Y=$.indexOf("-->",K+4);if(Y!==-1){K=Y+3;continue}}let O=z["xml:space"],M=A5($,K,O==="preserve"?!0:O==="default"?!1:Z);if(M.element)q.push(M.element),K=M.endPos;else K++}else if($[K]==="<"&&$[K+1]==="/"){let O=$.slice(K).match(/^<\/([a-zA-Z][a-zA-Z0-9_:-]*)>/);if(O&&O[1].toLowerCase()===H.toLowerCase()){K+=O[0].length;break}K++}else{let O=$.indexOf("<",K);if(O===-1)W+=$.slice(K),K=$.length;else W+=$.slice(K,O),K=O}}let G=new B0(H,z,q,""),F=z["xml:space"],U=(F==="preserve"?!0:F==="default"?!1:Z)?I5(W):I5(W.trim());return G.textContent=U,{element:G,endPos:K}}function B5($){if(typeof $!=="string")throw new Error("parseSelector: selector must be a string");let J=$.trim();if(J.length===0)throw new Error("parseSelector: selector cannot be empty");let Z=[],K=J.split(/\s*,\s*/);for(let Q of K){let H={tag:null,id:null,classes:[],attrs:[]},z=Q,q=z.match(/^([a-zA-Z][a-zA-Z0-9_-]*)/);if(q)H.tag=q[1].toLowerCase(),z=z.slice(q[0].length);let W=z.match(/#([a-zA-Z][a-zA-Z0-9_-]*)/);if(W)H.id=W[1],z=z.replace(W[0],"");let j=z.matchAll(/\.([a-zA-Z][a-zA-Z0-9_-]*)/g);for(let F of j)H.classes.push(F[1]);let G=z.matchAll(/\[([a-zA-Z][a-zA-Z0-9_:-]*)(?:=["']?([^"'\]]+)["']?)?\]/g);for(let F of G)H.attrs.push({name:F[1],value:F[2]});Z.push(H)}return Z}function N5($,J){if(!($ instanceof B0))throw new Error("matchesAllSelectors: el must be an SVGElement");if(!Array.isArray(J))throw new Error("matchesAllSelectors: matchers must be an array");return J.some((Z)=>{if(Z.tag&&$.tagName.toLowerCase()!==Z.tag)return!1;if(Z.id&&$.getAttribute("id")!==Z.id)return!1;let K=($.getAttribute("class")||"").split(/\s+/).filter((Q)=>Q.length>0);for(let Q of Z.classes)if(!K.includes(Q))return!1;for(let Q of Z.attrs){if(!$.hasAttribute(Q.name))return!1;if(Q.value!==void 0&&$.getAttribute(Q.name)!==Q.value)return!1}return!0})}function P$($){if($===void 0||$===null)return"";if(typeof $!=="string")return String($);return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function lQ($){if($===null||$===void 0)return"";if(typeof $!=="string")return String($);return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function nQ($){if(!$)return $;return $.replace(/&#[xX]([0-9A-Fa-f]+);/g,(J,Z)=>{let K=parseInt(Z,16);if(!Number.isFinite(K))return"�";if(K===0||K>=1&&K<=8||K>=11&&K<=12||K>=14&&K<=31||K===65534||K===65535||K>1114111||K>=55296&&K<=57343)return"�";return String.fromCodePoint(K)}).replace(/&#(\d+);/g,(J,Z)=>{let K=parseInt(Z,10);if(!Number.isFinite(K))return"�";if(K===0||K>=1&&K<=8||K>=11&&K<=12||K>=14&&K<=31||K===65534||K===65535||K>1114111||K>=55296&&K<=57343)return"�";return String.fromCodePoint(K)}).replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function I5($){if(!$)return $;return $.replace(/&#[xX]([0-9A-Fa-f]+);/g,(J,Z)=>{let K=parseInt(Z,16);if(!Number.isFinite(K))return"�";if(K===0||K>=1&&K<=8||K>=11&&K<=12||K>=14&&K<=31||K===65534||K===65535||K>1114111||K>=55296&&K<=57343)return"�";return String.fromCodePoint(K)}).replace(/&#(\d+);/g,(J,Z)=>{let K=parseInt(Z,10);if(!Number.isFinite(K))return"�";if(K===0||K>=1&&K<=8||K>=11&&K<=12||K>=14&&K<=31||K===65534||K===65535||K>1114111||K>=55296&&K<=57343)return"�";return String.fromCodePoint(K)}).replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function i7($){if(!$)throw new Error("buildDefsMap: svgRoot cannot be null or undefined");if(!($ instanceof B0))throw new Error("buildDefsMap: svgRoot must be an SVGElement");let J=new Map,Z=(K)=>{let Q=K.getAttribute("id");if(Q)J.set(Q,K);for(let H of K.children)if(H instanceof B0)Z(H)};return Z($),J}function u7($,J){if(!$)throw new Error("findElementsWithAttribute: root cannot be null or undefined");if(!($ instanceof B0))throw new Error("findElementsWithAttribute: root must be an SVGElement");if(typeof J!=="string")throw new Error("findElementsWithAttribute: attrName must be a string");let Z=[],K=(Q)=>{if(Q.hasAttribute(J))Z.push(Q);for(let H of Q.children)if(H instanceof B0)K(H)};return K($),Z}function r7($){if(!$||typeof $!=="string")return null;let J=$.trim();if(J.length===0)return null;let Z=J.match(/url\(\s*["']?#?([^"')]+)["']?\s*\)/i);return Z?Z[1]:null}function B7($,J={}){if(!$)throw new Error("serializeSVG: document is required");if(typeof $.serialize!=="function"){if(typeof $==="string")return $;throw new Error(`serializeSVG: expected SVGElement with serialize method, got ${$?.constructor?.name||typeof $}`)}let Z=J.minify||!1;return'<?xml version="1.0" encoding="UTF-8"?>'+(Z?"":`
|
|
15
|
+
`)+$.serialize(0,Z)}var E5=(()=>({})),sQ=100,oQ=5000,p6={SILENT:0,ERROR:1,WARN:2,INFO:3,DEBUG:4},A$={level:p6.WARN,logToFile:null,timestamps:!1,_buffer:[],_flushTimer:null,_safeStringify($){if($===null)return"null";if($===void 0)return"undefined";if($ instanceof Error)return $.stack||`${$.name}: ${$.message}`;if(typeof $!=="object")return String($);try{let J=new WeakSet;return JSON.stringify($,(Z,K)=>{if(typeof K==="object"&&K!==null){if(J.has(K))return"[Circular]";J.add(K)}return K})}catch{return String($)}},_format($,J){if(typeof $!=="string"||!$)throw new Error("Logger._format: level must be a non-empty string");let Z=this._safeStringify(J);if(this.timestamps)return`[${new Date().toISOString()}] [${$}] ${Z}`;return`[${$}] ${Z}`},_bufferWrite($){if(!this.logToFile)return;if(this._buffer.push($),this._buffer.length>=sQ)this.flush();if(!this._flushTimer)this._flushTimer=setInterval(()=>this.flush(),oQ),this._flushTimer.unref()},flush(){if(!this.logToFile||this._buffer.length===0)return;try{let $=this._buffer.join(`
|
|
16
|
+
`)+`
|
|
17
|
+
`;E5.appendFileSync(this.logToFile,$),this._buffer=[]}catch{this._buffer=[]}},error($,...J){if(this.level<p6.ERROR)return;let Z=this._format("ERROR",$),K=J.length?" "+J.map((Q)=>this._safeStringify(Q)).join(" "):"";console.error(Z,...J),this._bufferWrite(Z+K),this.flush()},warn($,...J){if(this.level<p6.WARN)return;let Z=this._format("WARN",$),K=J.length?" "+J.map((Q)=>this._safeStringify(Q)).join(" "):"";console.warn(Z,...J),this._bufferWrite(Z+K)},info($,...J){if(this.level<p6.INFO)return;let Z=this._format("INFO",$),K=J.length?" "+J.map((Q)=>this._safeStringify(Q)).join(" "):"";console.log(Z,...J),this._bufferWrite(Z+K)},debug($,...J){if(this.level<p6.DEBUG)return;let Z=this._format("DEBUG",$),K=J.length?" "+J.map((Q)=>this._safeStringify(Q)).join(" "):"";console.log(Z,...J),this._bufferWrite(Z+K)},shutdown(){if(this._flushTimer)clearInterval(this._flushTimer),this._flushTimer=null;this.flush()}};var iQ=F7;k.set({precision:80});var _0=($)=>$ instanceof k?$:new k($),S5=20;function a7($,J=S5){if(typeof $!=="string")throw new Error("pathToPolygon: pathData must be a string");if(typeof J!=="number"||J<=0||!Number.isFinite(J))throw new Error(`pathToPolygon: samplesPerCurve must be a positive finite number, got ${J}`);let Z=[],K=_0(0),Q=_0(0),H=_0(0),z=_0(0),q=rQ($);if(!Array.isArray(q))throw new Error("pathToPolygon: parsePathCommands must return an array");for(let W of q){let{type:j,args:G}=W;if(!Array.isArray(G))throw new Error(`pathToPolygon: command args must be an array for command ${j}`);switch(j){case"M":if(G.length<2)throw new Error(`pathToPolygon: M command requires 2 arguments, got ${G.length}`);K=_0(G[0]),Q=_0(G[1]),H=K,z=Q,Z.push(b0(K,Q));break;case"m":if(G.length<2)throw new Error(`pathToPolygon: m command requires 2 arguments, got ${G.length}`);K=K.plus(G[0]),Q=Q.plus(G[1]),H=K,z=Q,Z.push(b0(K,Q));break;case"L":if(G.length<2)throw new Error(`pathToPolygon: L command requires 2 arguments, got ${G.length}`);K=_0(G[0]),Q=_0(G[1]),Z.push(b0(K,Q));break;case"l":if(G.length<2)throw new Error(`pathToPolygon: l command requires 2 arguments, got ${G.length}`);K=K.plus(G[0]),Q=Q.plus(G[1]),Z.push(b0(K,Q));break;case"H":if(G.length<1)throw new Error(`pathToPolygon: H command requires 1 argument, got ${G.length}`);K=_0(G[0]),Z.push(b0(K,Q));break;case"h":if(G.length<1)throw new Error(`pathToPolygon: h command requires 1 argument, got ${G.length}`);K=K.plus(G[0]),Z.push(b0(K,Q));break;case"V":if(G.length<1)throw new Error(`pathToPolygon: V command requires 1 argument, got ${G.length}`);Q=_0(G[0]),Z.push(b0(K,Q));break;case"v":if(G.length<1)throw new Error(`pathToPolygon: v command requires 1 argument, got ${G.length}`);Q=Q.plus(G[0]),Z.push(b0(K,Q));break;case"C":if(G.length<6)throw new Error(`pathToPolygon: C command requires 6 arguments, got ${G.length}`);T5(Z,K,Q,_0(G[0]),_0(G[1]),_0(G[2]),_0(G[3]),_0(G[4]),_0(G[5]),J),K=_0(G[4]),Q=_0(G[5]);break;case"c":if(G.length<6)throw new Error(`pathToPolygon: c command requires 6 arguments, got ${G.length}`);T5(Z,K,Q,K.plus(G[0]),Q.plus(G[1]),K.plus(G[2]),Q.plus(G[3]),K.plus(G[4]),Q.plus(G[5]),J),K=K.plus(G[4]),Q=Q.plus(G[5]);break;case"Q":if(G.length<4)throw new Error(`pathToPolygon: Q command requires 4 arguments, got ${G.length}`);b5(Z,K,Q,_0(G[0]),_0(G[1]),_0(G[2]),_0(G[3]),J),K=_0(G[2]),Q=_0(G[3]);break;case"q":if(G.length<4)throw new Error(`pathToPolygon: q command requires 4 arguments, got ${G.length}`);b5(Z,K,Q,K.plus(G[0]),Q.plus(G[1]),K.plus(G[2]),Q.plus(G[3]),J),K=K.plus(G[2]),Q=Q.plus(G[3]);break;case"A":if(G.length<7)throw new Error(`pathToPolygon: A command requires 7 arguments, got ${G.length}`);f5(Z,K,Q,_0(G[0]),_0(G[1]),_0(G[2]),G[3],G[4],_0(G[5]),_0(G[6]),J),K=_0(G[5]),Q=_0(G[6]);break;case"a":if(G.length<7)throw new Error(`pathToPolygon: a command requires 7 arguments, got ${G.length}`);f5(Z,K,Q,_0(G[0]),_0(G[1]),_0(G[2]),G[3],G[4],K.plus(G[5]),Q.plus(G[6]),J),K=K.plus(G[5]),Q=Q.plus(G[6]);break;case"Z":case"z":K=H,Q=z;break;default:break}}return aQ(Z)}function rQ($){if(typeof $!=="string")throw new Error(`parsePathCommands: pathData must be a string, got ${typeof $}`);let J=[],Z=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,K;while((K=Z.exec($))!==null){let Q=K[1],H=K[2].trim(),z=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,q=H.length>0?Array.from(H.matchAll(z),(W)=>Number(W[0])):[];J.push({type:Q,args:q})}return J}function T5($,J,Z,K,Q,H,z,q,W,j){if(!Array.isArray($))throw new Error("sampleCubicBezier: points must be an array");if(typeof j!=="number"||j<=0||!Number.isFinite(j))throw new Error(`sampleCubicBezier: samples must be a positive finite number, got ${j}`);if(!(J instanceof k)||!(Z instanceof k)||!(K instanceof k)||!(Q instanceof k)||!(H instanceof k)||!(z instanceof k)||!(q instanceof k)||!(W instanceof k))throw new Error("sampleCubicBezier: all coordinate parameters must be Decimal instances");for(let G=1;G<=j;G++){let F=_0(G).div(j),_=_0(1).minus(F),U=_.mul(_),O=U.mul(_),V=F.mul(F),M=V.mul(F),Y=O.mul(J).plus(_0(3).mul(U).mul(F).mul(K)).plus(_0(3).mul(_).mul(V).mul(H)).plus(M.mul(q)),X=O.mul(Z).plus(_0(3).mul(U).mul(F).mul(Q)).plus(_0(3).mul(_).mul(V).mul(z)).plus(M.mul(W));$.push(b0(Y,X))}}function b5($,J,Z,K,Q,H,z,q){if(!Array.isArray($))throw new Error("sampleQuadraticBezier: points must be an array");if(typeof q!=="number"||q<=0||!Number.isFinite(q))throw new Error(`sampleQuadraticBezier: samples must be a positive finite number, got ${q}`);if(!(J instanceof k)||!(Z instanceof k)||!(K instanceof k)||!(Q instanceof k)||!(H instanceof k)||!(z instanceof k))throw new Error("sampleQuadraticBezier: all coordinate parameters must be Decimal instances");for(let W=1;W<=q;W++){let j=_0(W).div(q),G=_0(1).minus(j),F=G.mul(G),_=j.mul(j),U=F.mul(J).plus(_0(2).mul(G).mul(j).mul(K)).plus(_.mul(H)),O=F.mul(Z).plus(_0(2).mul(G).mul(j).mul(Q)).plus(_.mul(z));$.push(b0(U,O))}}function f5($,J,Z,K,Q,H,z,q,W,j,G){if(!Array.isArray($))throw new Error("sampleArc: points must be an array");if(typeof G!=="number"||G<=0||!Number.isFinite(G))throw new Error(`sampleArc: samples must be a positive finite number, got ${G}`);if(!(J instanceof k)||!(Z instanceof k)||!(K instanceof k)||!(Q instanceof k)||!(H instanceof k)||!(W instanceof k)||!(j instanceof k))throw new Error("sampleArc: all coordinate and angle parameters must be Decimal instances");if(typeof z!=="number"||z!==0&&z!==1)throw new Error(`sampleArc: largeArc must be 0 or 1, got ${z}`);if(typeof q!=="number"||q!==0&&q!==1)throw new Error(`sampleArc: sweep must be 0 or 1, got ${q}`);if(K.eq(0)||Q.eq(0)){$.push(b0(W,j));return}let F=K.abs(),_=Q.abs(),U=H.mul(Math.PI).div(180),O=U.cos(),V=U.sin(),M=J.minus(W).div(2),Y=Z.minus(j).div(2),X=O.mul(M).plus(V.mul(Y)),w=O.mul(Y).minus(V.mul(M)),R=F.mul(F),I=_.mul(_),f=X.mul(X),u=w.mul(w),m=f.div(R).plus(u.div(I));if(m.gt(1)){let $0=m.sqrt();F=F.mul($0),_=_.mul($0),R=F.mul(F),I=_.mul(_)}let S=R.mul(I).minus(R.mul(u)).minus(I.mul(f));if(S=S.div(R.mul(u).plus(I.mul(f))),S.lt(0))S=_0(0);if(S=S.sqrt(),z===q)S=S.neg();let x=S.mul(K).mul(w).div(Q),h=S.neg().mul(Q).mul(X).div(K),E=J.plus(W).div(2),d=Z.plus(j).div(2),c=O.mul(x).minus(V.mul(h)).plus(E),p=V.mul(x).plus(O.mul(h)).plus(d),N=X.minus(x).div(K),y=w.minus(h).div(Q),B=X.neg().minus(x).div(K),e=w.neg().minus(h).div(Q),r=N.mul(N).plus(y.mul(y)).sqrt();if(r.eq(0)){A$.warn("sampleArc: degenerate arc - center coincides with start point, treating as line to end"),$.push(b0(W,j));return}let s=k.acos(N.div(r));if(y.lt(0))s=s.neg();let z0=r.mul(B.mul(B).plus(e.mul(e)).sqrt());if(z0.eq(0)){A$.warn("sampleArc: degenerate arc - zero length, treating as single point"),$.push(b0(W,j));return}let T=k.acos(N.mul(B).plus(y.mul(e)).div(z0));if(N.mul(e).minus(y.mul(B)).lt(0))T=T.neg();let P=_0(Math.PI),t=P.mul(2);if(q&&T.lt(0))T=T.plus(t);else if(!q&&T.gt(0))T=T.minus(t);for(let $0=1;$0<=G;$0++){let Q0=_0($0).div(G),V0=s.plus(T.mul(Q0)),N0=V0.cos(),h0=V0.sin(),o=O.mul(K.mul(N0)).minus(V.mul(Q.mul(h0))).plus(c),J0=V.mul(K.mul(N0)).plus(O.mul(Q.mul(h0))).plus(p);$.push(b0(o,J0))}}function aQ($){if(!Array.isArray($))throw new Error("removeDuplicateConsecutive: points must be an array");if($.length<2)return $;let J=[$[0]];for(let Z=1;Z<$.length;Z++)if(!v7($[Z],J[J.length-1]))J.push($[Z]);return J}function X6($,J=null,Z=S5,K=4){if(!$||typeof $!=="object")throw new Error("shapeToPolygon: element must be an object");if(!$.type||typeof $.type!=="string")throw new Error("shapeToPolygon: element.type must be a string");if(typeof Z!=="number"||Z<=0||!Number.isFinite(Z))throw new Error(`shapeToPolygon: samples must be a positive finite number, got ${Z}`);if(typeof K!=="number"||K<=0||!Number.isFinite(K))throw new Error(`shapeToPolygon: bezierArcs must be a positive finite number, got ${K}`);if(J!==null&&!(J instanceof U0))throw new Error("shapeToPolygon: ctm must be null or a Matrix instance");let Q;switch($.type){case"circle":if(K>4)Q=Q5($.cx||0,$.cy||0,$.r||0,K,10);else Q=j5(_0($.cx||0),_0($.cy||0),_0($.r||0));break;case"ellipse":if(K>4)Q=X9($.cx||0,$.cy||0,$.rx||0,$.ry||0,K,10);else Q=C9(_0($.cx||0),_0($.cy||0),_0($.rx||0),_0($.ry||0));break;case"rect":Q=G5(_0($.x||0),_0($.y||0),_0($.width||0),_0($.height||0),_0($.rx||0),$.ry!==void 0?_0($.ry):null);break;case"line":Q=F5(_0($.x1||0),_0($.y1||0),_0($.x2||0),_0($.y2||0));break;case"polygon":Q=_5($.points||"");break;case"polyline":Q=U5($.points||"");break;case"path":Q=$.d||"";break;default:return[]}if($.transform){let H=iQ($.transform);if(!(H instanceof U0))throw new Error(`shapeToPolygon: parseTransform must return a Matrix, got ${typeof H}`);Q=Y6(Q,H)}if(J)Q=Y6(Q,J);return a7(Q,Z)}function h9($,J=6){if(!Array.isArray($))throw new Error("polygonToPathData: polygon must be an array");if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error(`polygonToPathData: precision must be a non-negative finite number, got ${J}`);if($.length<2)return"";let Z=(Q)=>(Q instanceof k?Q:_0(Q)).toFixed(J).replace(/\.?0+$/,""),K=`M ${Z($[0].x)} ${Z($[0].y)}`;for(let Q=1;Q<$.length;Q++)K+=` L ${Z($[Q].x)} ${Z($[Q].y)}`;return K+" Z"}k.set({precision:80});k.set({precision:80});var v5=($)=>$ instanceof k?$:new k($),D5=-0.1,h5=-0.1,y5=1.2,u5=1.2,E$={LUMINANCE:"luminance",ALPHA:"alpha"};function g5($){if(!$)throw new Error("parseMaskElement: maskElement is required");if(!$.getAttribute)throw new Error("parseMaskElement: maskElement must be a DOM element");let J={id:$.getAttribute("id")||"",maskUnits:$.getAttribute("maskUnits")||"objectBoundingBox",maskContentUnits:$.getAttribute("maskContentUnits")||"userSpaceOnUse",maskType:$.getAttribute("mask-type")||$.style?.maskType||"luminance",x:$.getAttribute("x"),y:$.getAttribute("y"),width:$.getAttribute("width"),height:$.getAttribute("height"),transform:$.getAttribute("transform")||null,children:[]},Z=(K,Q)=>{let H=parseFloat(K);return isNaN(H)?Q:H};if(J.maskUnits==="objectBoundingBox")J.x=J.x!==null?Z(J.x,D5):D5,J.y=J.y!==null?Z(J.y,h5):h5,J.width=J.width!==null?Z(J.width,y5):y5,J.height=J.height!==null?Z(J.height,u5):u5;else J.x=J.x!==null?Z(J.x,null):null,J.y=J.y!==null?Z(J.y,null):null,J.width=J.width!==null?Z(J.width,null):null,J.height=J.height!==null?Z(J.height,null):null;if(!$.children)return J;for(let K of $.children){if(!K.tagName)continue;let Q=K.tagName.toLowerCase(),H={type:Q,fill:K.getAttribute("fill")||K.style?.fill||"black",fillOpacity:Z(K.getAttribute("fill-opacity")||K.style?.fillOpacity||"1",1),opacity:Z(K.getAttribute("opacity")||K.style?.opacity||"1",1),transform:K.getAttribute("transform")||null};switch(Q){case"rect":H.x=Z(K.getAttribute("x")||"0",0),H.y=Z(K.getAttribute("y")||"0",0),H.width=Z(K.getAttribute("width")||"0",0),H.height=Z(K.getAttribute("height")||"0",0),H.rx=Z(K.getAttribute("rx")||"0",0),H.ry=Z(K.getAttribute("ry")||"0",0);break;case"circle":H.cx=Z(K.getAttribute("cx")||"0",0),H.cy=Z(K.getAttribute("cy")||"0",0),H.r=Z(K.getAttribute("r")||"0",0);break;case"ellipse":H.cx=Z(K.getAttribute("cx")||"0",0),H.cy=Z(K.getAttribute("cy")||"0",0),H.rx=Z(K.getAttribute("rx")||"0",0),H.ry=Z(K.getAttribute("ry")||"0",0);break;case"path":H.d=K.getAttribute("d")||"";break;case"polygon":H.points=K.getAttribute("points")||"";break;case"polyline":H.points=K.getAttribute("points")||"";break;case"g":if(H.children=[],K.children){for(let z of K.children)if(z.tagName)H.children.push({type:z.tagName.toLowerCase(),fill:z.getAttribute("fill")||"inherit"})}break;default:break}J.children.push(H)}return J}function tQ($,J,Z,K=20){if(!$)throw new Error("maskChildToPolygon: child is required");if(!J)throw new Error("maskChildToPolygon: targetBBox is required");if(!Z)throw new Error("maskChildToPolygon: contentUnits is required");if(typeof K!=="number"||K<=0)throw new Error("maskChildToPolygon: samples must be a positive number");if(typeof J.x!=="number"||typeof J.y!=="number"||typeof J.width!=="number"||typeof J.height!=="number")throw new Error("maskChildToPolygon: targetBBox must have numeric x, y, width, height properties");if(J.width<0||J.height<0)throw new Error("maskChildToPolygon: targetBBox width and height cannot be negative");let Q={type:$.type,...$,transform:$.transform},H=X6(Q,null,K);if(!Array.isArray(H))return[];if(Z==="objectBoundingBox"&&H.length>0){if(J.width===0||J.height===0)return[];H=H.map((z)=>({x:v5(J.x).plus(z.x.mul(J.width)),y:v5(J.y).plus(z.y.mul(J.height))}))}return H}function eQ($){if(!$||$==="none"||$==="transparent")return 0;if(typeof $!=="string")return 0;let J=$.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(J){let H=parseInt(J[1],10),z=parseInt(J[2],10),q=parseInt(J[3],10);if(isNaN(H)||isNaN(z)||isNaN(q))return 0;let W=Math.max(0,Math.min(255,H))/255,j=Math.max(0,Math.min(255,z))/255,G=Math.max(0,Math.min(255,q))/255,F=0.2126*W+0.7152*j+0.0722*G;return isNaN(F)?0:F}let Z=$.match(/^#([0-9a-f]{3,6})$/i);if(Z){let H=Z[1];if(H.length===3)H=H[0]+H[0]+H[1]+H[1]+H[2]+H[2];let z=parseInt(H.slice(0,2),16),q=parseInt(H.slice(2,4),16),W=parseInt(H.slice(4,6),16);if(isNaN(z)||isNaN(q)||isNaN(W))return 0;let j=0.2126*(z/255)+0.7152*(q/255)+0.0722*(W/255);return isNaN(j)?0:j}let K={white:1,black:0,red:0.2126,green:0.7152,blue:0.0722,yellow:0.9278,cyan:0.7874,magenta:0.2848,gray:0.5,grey:0.5},Q=$.toLowerCase();if(K[Q]!==void 0)return K[Q];return 0}function $H($,J){if(!$)throw new Error("getMaskChildOpacity: child is required");if(!J)throw new Error("getMaskChildOpacity: maskType is required");if(J!==E$.LUMINANCE&&J!==E$.ALPHA)throw new Error('getMaskChildOpacity: maskType must be "luminance" or "alpha"');let Z=typeof $.fillOpacity==="number"&&!isNaN($.fillOpacity)?$.fillOpacity:1,K=typeof $.opacity==="number"&&!isNaN($.opacity)?$.opacity:1,Q=Z*K;if(J===E$.ALPHA)return Q;let H=eQ($.fill),z=Q*H;return isNaN(z)?0:z}function JH($,J,Z={}){if(!$)throw new Error("resolveMask: maskData is required");if(!J)throw new Error("resolveMask: targetBBox is required");if(!Array.isArray($.children))throw new Error("resolveMask: maskData.children must be an array");let{samples:K=20}=Z;if(typeof K!=="number"||K<=0)throw new Error("resolveMask: samples must be a positive number");let Q=$.maskType||E$.LUMINANCE,H=[];for(let z of $.children){if(!z)continue;let q=tQ(z,J,$.maskContentUnits,K);if(q.length>=3){let W=$H(z,Q);H.push({polygon:q,opacity:W})}}return H}function KH($,J,Z=0.5,K={}){if(!$)throw new Error("maskToClipPath: maskData is required");if(!J)throw new Error("maskToClipPath: targetBBox is required");if(typeof Z!=="number"||Z<0||Z>1)throw new Error("maskToClipPath: opacityThreshold must be a number between 0 and 1");let Q=JH($,J,K),H=[];for(let{polygon:z,opacity:q}of Q)if(q>=Z&&z&&z.length>=3)if(H.length===0)H=z;else{let W=z6(H,z);if(W.length>0&&W[0].length>=3)H=W[0]}return H}function x5($,J,Z={}){if(!$)throw new Error("maskToPathData: maskData is required");if(!J)throw new Error("maskToPathData: targetBBox is required");let K=KH($,J,0.5,Z);if(K.length<3)return"";let Q="",H=0;for(let z=0;z<K.length;z++){let q=K[z];if(!q||q.x===void 0||q.y===void 0)continue;let W=Number(q.x),j=Number(q.y);if(isNaN(W)||isNaN(j)||!isFinite(W)||!isFinite(j))continue;let G=W.toFixed(6),F=j.toFixed(6);Q+=H===0?`M ${G} ${F}`:` L ${G} ${F}`,H++}if(H>=3)Q+=" Z";else return"";return Q}k.set({precision:80});function m5($){if(!$)throw new Error("parseUseElement: useElement is required");let J=$.getAttribute("href")||$.getAttribute("xlink:href")||"",Z=J.startsWith("#")?J.slice(1):J;if(!Z)throw new Error("parseUseElement: href attribute must reference a valid element id (found empty reference)");let K=parseFloat($.getAttribute("x")||"0"),Q=parseFloat($.getAttribute("y")||"0");if(isNaN(K)||isNaN(Q)||!isFinite(K)||!isFinite(Q))throw new Error("parseUseElement: x and y attributes must be valid finite numbers");let H=null,z=null;if($.getAttribute("width")){if(H=parseFloat($.getAttribute("width")),isNaN(H)||!isFinite(H)||H<=0)throw new Error("parseUseElement: width attribute must be a valid positive finite number")}if($.getAttribute("height")){if(z=parseFloat($.getAttribute("height")),isNaN(z)||!isFinite(z)||z<=0)throw new Error("parseUseElement: height attribute must be a valid positive finite number")}return{href:Z,x:K,y:Q,width:H,height:z,transform:$.getAttribute("transform")||null,style:p5($)}}function d5($){if(!$)throw new Error("parseSymbolElement: symbolElement is required");let J=parseFloat($.getAttribute("refX")||"0"),Z=parseFloat($.getAttribute("refY")||"0");if(isNaN(J)||isNaN(Z)||!isFinite(J)||!isFinite(Z))throw new Error("parseSymbolElement: refX and refY must be valid finite numbers");let K={id:$.getAttribute("id")||"",viewBox:$.getAttribute("viewBox")||null,preserveAspectRatio:$.getAttribute("preserveAspectRatio")||"xMidYMid meet",children:[],refX:J,refY:Z};if(K.viewBox){let Q=K.viewBox.trim().split(/[\s,]+/).map(Number);if(Q.length===4&&Q.every((H)=>!isNaN(H)&&isFinite(H)))K.viewBoxParsed={x:Q[0],y:Q[1],width:Q[2],height:Q[3]}}for(let Q of $.children)K.children.push(T$(Q));return K}function T$($){if(!$||!$.tagName)throw new Error("parseChildElement: element with tagName is required");let J=$.tagName.toLowerCase(),Z={type:J,id:$.getAttribute("id")||null,transform:$.getAttribute("transform")||null,style:p5($)},K=(Q,H="0")=>{let z=parseFloat($.getAttribute(Q)||H);if(isNaN(z)||!isFinite(z))throw new Error(`parseChildElement: ${Q} must be a valid finite number in ${J} element`);return z};switch(J){case"rect":Z.x=K("x"),Z.y=K("y"),Z.width=K("width"),Z.height=K("height"),Z.rx=K("rx"),Z.ry=K("ry");break;case"circle":Z.cx=K("cx"),Z.cy=K("cy"),Z.r=K("r");break;case"ellipse":Z.cx=K("cx"),Z.cy=K("cy"),Z.rx=K("rx"),Z.ry=K("ry");break;case"path":Z.d=$.getAttribute("d")||"";break;case"polygon":Z.points=$.getAttribute("points")||"";break;case"polyline":Z.points=$.getAttribute("points")||"";break;case"line":Z.x1=K("x1"),Z.y1=K("y1"),Z.x2=K("x2"),Z.y2=K("y2");break;case"g":Z.children=[];for(let Q of $.children)Z.children.push(T$(Q));break;case"use":Z.href=($.getAttribute("href")||$.getAttribute("xlink:href")||"").replace("#",""),Z.x=K("x"),Z.y=K("y"),Z.width=$.getAttribute("width")?K("width"):null,Z.height=$.getAttribute("height")?K("height"):null;break;default:break}return Z}function p5($){if(!$)throw new Error("extractStyleAttributes: element is required");return{fill:$.getAttribute("fill"),stroke:$.getAttribute("stroke"),strokeWidth:$.getAttribute("stroke-width"),opacity:$.getAttribute("opacity"),fillOpacity:$.getAttribute("fill-opacity"),strokeOpacity:$.getAttribute("stroke-opacity"),visibility:$.getAttribute("visibility"),display:$.getAttribute("display")}}function QH($,J,Z,K="xMidYMid meet"){if(!$||!J||!Z)return U0.identity(3);if(!isFinite(J)||!isFinite(Z)||J<=0||Z<=0)return U0.identity(3);let{width:Q,height:H,x:z,y:q}=$;if(!isFinite(Q)||!isFinite(H)||!isFinite(z)||!isFinite(q)||Q<=0||H<=0)return U0.identity(3);let W=K.trim().split(/\s+/),j=W[0]||"xMidYMid",G=W[1]||"meet";if(j==="none"){let X=J/Q,w=Z/H;return i0(-z*X,-q*w).mul(w7(X,w))}let F=J/Q,_=Z/H,U;if(G==="slice")U=Math.max(F,_);else U=Math.min(F,_);let O=-z*U,V=-q*U,M=Q*U,Y=H*U;if(j.includes("xMid"))O+=(J-M)/2;else if(j.includes("xMax"))O+=J-M;if(j.includes("YMid"))V+=(Z-Y)/2;else if(j.includes("YMax"))V+=Z-Y;return i0(O,V).mul(w7(U,U))}function u9($,J,Z={}){if(!$||!$.href)throw new Error("resolveUse: useData with href property is required");if(!J)throw new Error("resolveUse: defs map is required");if(typeof $.x!=="number"||isNaN($.x)||!isFinite($.x))throw new Error("resolveUse: useData.x must be a valid finite number");if(typeof $.y!=="number"||isNaN($.y)||!isFinite($.y))throw new Error("resolveUse: useData.y must be a valid finite number");if($.width!==null&&(typeof $.width!=="number"||isNaN($.width)||!isFinite($.width)||$.width<=0))throw new Error("resolveUse: useData.width must be null or a positive finite number");if($.height!==null&&(typeof $.height!=="number"||isNaN($.height)||!isFinite($.height)||$.height<=0))throw new Error("resolveUse: useData.height must be null or a positive finite number");if($.style!==null&&$.style!==void 0){if(typeof $.style!=="object"||Array.isArray($.style))throw new Error("resolveUse: useData.style must be null, undefined, or a valid non-array object")}if($.transform!==null&&$.transform!==void 0&&typeof $.transform!=="string")throw new Error("resolveUse: useData.transform must be null, undefined, or a string");if(Z&&typeof Z!=="object")throw new Error("resolveUse: options must be an object or undefined");let{maxDepth:K=10,_visited:Q=new Set}=Z;if(typeof K!=="number"||K<=0||!isFinite(K))throw new Error("resolveUse: maxDepth must be a positive finite number");if(Q.has($.href))return console.warn(`resolveUse: circular reference detected for '#${$.href}', skipping to prevent infinite loop`),null;let H=J[$.href];if(!H)return console.warn(`resolveUse: target element '#${$.href}' not found in defs map`),null;Q.add($.href);let z=i0($.x,$.y);if($.transform){let j=F7($.transform);z=z.mul(j)}if(H.type==="symbol"&&H.viewBoxParsed){if(typeof H.viewBoxParsed.x!=="number"||typeof H.viewBoxParsed.y!=="number"||typeof H.viewBoxParsed.width!=="number"||typeof H.viewBoxParsed.height!=="number"||!isFinite(H.viewBoxParsed.x)||!isFinite(H.viewBoxParsed.y)||!isFinite(H.viewBoxParsed.width)||!isFinite(H.viewBoxParsed.height)||H.viewBoxParsed.width<=0||H.viewBoxParsed.height<=0)throw new Error("resolveUse: target.viewBoxParsed must have finite x, y and positive finite width, height");let j=$.width!==null?$.width:H.viewBoxParsed.width,G=$.height!==null?$.height:H.viewBoxParsed.height;z=QH(H.viewBoxParsed,j,G,H.preserveAspectRatio||"xMidYMid meet").mul(z)}let q=[],W=H.children&&Array.isArray(H.children)&&H.children.length>0?H.children:[H];for(let j of W)if(j.type==="use"){if(K<=1){console.warn(`resolveUse: maximum nesting depth reached for use element '#${j.href}', skipping nested resolution`);continue}let G=u9(j,J,{maxDepth:K-1,_visited:Q});if(G)q.push(G)}else q.push({element:j,transform:U0.identity(3)});return Q.delete($.href),{element:H,transform:z,children:q,inheritedStyle:$.style}}function c5($,J=20){let Z=[];if(!$)return Z;if(typeof J!=="number"||J<=0||!isFinite(J))throw new Error("flattenResolvedUse: samples must be a positive finite number");if(!$.children||!$.transform)return Z;for(let K of $.children){if(!K||!K.transform)continue;let Q=$.transform.mul(K.transform),H=K.element;if(K.children){let z=c5(K,J);for(let q of z)q.polygon=q.polygon.map((W)=>{let[j,G]=c0($.transform,W.x,W.y);return{x:j,y:G}}),Z.push(q)}else{let z=HH(H,Q,J);if(z.length>=3)Z.push({polygon:z,style:zH($.inheritedStyle,H.style)})}}return Z}function HH($,J,Z=20){if(!$)throw new Error("elementToPolygon: element is required");if(typeof Z!=="number"||Z<=0||!isFinite(Z))throw new Error("elementToPolygon: samples must be a positive finite number");let K=X6($,null,Z);if(J&&K.length>0)K=K.map((Q)=>{let[H,z]=c0(J,Q.x,Q.y);return{x:H,y:z}});return K}function zH($,J){if(!J||typeof J!=="object"||Array.isArray(J))throw new Error("mergeStyles: element must be a valid non-array object");let Z={...J};if($!==null&&$!==void 0){if(typeof $!=="object"||Array.isArray($))throw new Error("mergeStyles: inherited must be null, undefined, or a valid non-array object")}for(let[K,Q]of Object.entries($||{}))if(Q!==null&&(Z[K]===null||Z[K]===void 0))Z[K]=Q;return Z}function l5($,J=20){if(typeof J!=="number"||J<=0||!isFinite(J))throw new Error("resolvedUseToPathData: samples must be a positive finite number");let Z=c5($,J),K=[];for(let{polygon:Q}of Z)if(Q.length>=3){let H="";for(let z=0;z<Q.length;z++){let q=Q[z],W=Number(q.x),j=Number(q.y);if(isNaN(W)||isNaN(j))continue;H+=z===0?`M ${W.toFixed(6)} ${j.toFixed(6)}`:` L ${W.toFixed(6)} ${j.toFixed(6)}`}H+=" Z",K.push(H)}return K.join(" ")}k.set({precision:80});var K7=($)=>$ instanceof k?$:new k($);function n5($){if(!$)throw new Error("parsePatternElement: patternElement is required");if(typeof $.getAttribute!=="function")throw new Error("parsePatternElement: patternElement must be a DOM element with getAttribute method");let J={id:$.getAttribute("id")||"",patternUnits:$.getAttribute("patternUnits")||"objectBoundingBox",patternContentUnits:$.getAttribute("patternContentUnits")||"userSpaceOnUse",patternTransform:$.getAttribute("patternTransform")||null,x:$.getAttribute("x"),y:$.getAttribute("y"),width:$.getAttribute("width"),height:$.getAttribute("height"),viewBox:$.getAttribute("viewBox")||null,preserveAspectRatio:$.getAttribute("preserveAspectRatio")||"xMidYMid meet",href:$.getAttribute("href")||$.getAttribute("xlink:href")||null,children:[]},Z=(K,Q)=>{if(K===null||K===void 0)return Q;let H=parseFloat(K);return isNaN(H)?Q:H};if(J.x=Z(J.x,0),J.y=Z(J.y,0),J.width=Z(J.width,0),J.height=Z(J.height,0),J.viewBox){let K=J.viewBox.trim().split(/[\s,]+/).map(Number);if(K.length===4&&K.every((Q)=>!isNaN(Q)&&isFinite(Q)))J.viewBoxParsed={x:K[0],y:K[1],width:K[2],height:K[3]}}if($.children&&typeof $.children[Symbol.iterator]==="function")for(let K of $.children){if(!K||typeof K.getAttribute!=="function")continue;let Q=K.tagName?K.tagName.toLowerCase():"";if(!Q)continue;let H={type:Q,fill:K.getAttribute("fill")||"black",stroke:K.getAttribute("stroke")||"none",strokeWidth:Z(K.getAttribute("stroke-width"),1),opacity:Z(K.getAttribute("opacity"),1),transform:K.getAttribute("transform")||null};switch(Q){case"rect":H.x=Z(K.getAttribute("x"),0),H.y=Z(K.getAttribute("y"),0),H.width=Z(K.getAttribute("width"),0),H.height=Z(K.getAttribute("height"),0),H.rx=Z(K.getAttribute("rx"),0),H.ry=Z(K.getAttribute("ry"),0);break;case"circle":H.cx=Z(K.getAttribute("cx"),0),H.cy=Z(K.getAttribute("cy"),0),H.r=Z(K.getAttribute("r"),0);break;case"ellipse":H.cx=Z(K.getAttribute("cx"),0),H.cy=Z(K.getAttribute("cy"),0),H.rx=Z(K.getAttribute("rx"),0),H.ry=Z(K.getAttribute("ry"),0);break;case"path":H.d=K.getAttribute("d")||"";break;case"polygon":H.points=K.getAttribute("points")||"";break;case"polyline":H.points=K.getAttribute("points")||"";break;case"line":H.x1=Z(K.getAttribute("x1"),0),H.y1=Z(K.getAttribute("y1"),0),H.x2=Z(K.getAttribute("x2"),0),H.y2=Z(K.getAttribute("y2"),0);break;case"use":H.href=K.getAttribute("href")||K.getAttribute("xlink:href")||"",H.x=Z(K.getAttribute("x"),0),H.y=Z(K.getAttribute("y"),0);break;case"g":if(H.children=[],K.children&&typeof K.children[Symbol.iterator]==="function"){for(let z of K.children)if(z&&z.tagName&&typeof z.getAttribute==="function")H.children.push({type:z.tagName.toLowerCase(),fill:z.getAttribute("fill")||"inherit"})}break;default:break}J.children.push(H)}return J}function WH($,J){if(!$)throw new Error("getPatternTile: patternData is required");if(!J)throw new Error("getPatternTile: targetBBox is required");if(typeof J.x!=="number"||typeof J.y!=="number"||typeof J.width!=="number"||typeof J.height!=="number")throw new Error("getPatternTile: targetBBox must have numeric x, y, width, and height properties");if(typeof $.x!=="number"||typeof $.y!=="number"||typeof $.width!=="number"||typeof $.height!=="number")throw new Error("getPatternTile: patternData must have numeric x, y, width, and height properties");if($.patternUnits==="objectBoundingBox")return{x:K7(J.x).plus(K7($.x).mul(J.width)),y:K7(J.y).plus(K7($.y).mul(J.height)),width:K7($.width).mul(J.width),height:K7($.height).mul(J.height)};return{x:K7($.x),y:K7($.y),width:K7($.width),height:K7($.height)}}function jH($,J,Z){if(!$)throw new Error("getPatternContentTransform: patternData is required");if(!J)throw new Error("getPatternContentTransform: tile is required");if(!Z)throw new Error("getPatternContentTransform: targetBBox is required");if(!J.width||!J.height)throw new Error("getPatternContentTransform: tile must have width and height properties");if(typeof Z.x!=="number"||typeof Z.y!=="number"||typeof Z.width!=="number"||typeof Z.height!=="number")throw new Error("getPatternContentTransform: targetBBox must have numeric x, y, width, and height properties");let K=U0.identity(3);if($.viewBoxParsed){let Q=$.viewBoxParsed;if(typeof Q.x!=="number"||typeof Q.y!=="number"||typeof Q.width!=="number"||typeof Q.height!=="number")throw new Error("getPatternContentTransform: viewBoxParsed must have numeric x, y, width, and height properties");let H=Number(J.width),z=Number(J.height);if(H===0||z===0)throw new Error("getPatternContentTransform: tile width and height must be non-zero when viewBox is present");if(Q.width===0||Q.height===0)throw new Error("getPatternContentTransform: viewBox width and height must be non-zero");let q=H/Q.width,W=z/Q.height,j=Math.min(q,W);if(!isFinite(j))throw new Error("getPatternContentTransform: computed scale is not finite");let G=(H-Q.width*j)/2,F=(z-Q.height*j)/2;K=K.mul(i0(G-Q.x*j,F-Q.y*j)),K=K.mul(w7(j,j))}if($.patternContentUnits==="objectBoundingBox"){if(Z.width===0||Z.height===0)throw new Error("getPatternContentTransform: targetBBox width and height must be non-zero when patternContentUnits is objectBoundingBox");K=K.mul(i0(Z.x,Z.y)),K=K.mul(w7(Z.width,Z.height))}return K}function GH($,J=null,Z=20){if(!$)throw new Error("patternChildToPolygon: child is required");if(!$.type)throw new Error("patternChildToPolygon: child must have a type property");if(typeof Z!=="number"||Z<=0||!isFinite(Z))throw new Error("patternChildToPolygon: samples must be a positive finite number");let K={type:$.type,...$,transform:$.transform},Q=X6(K,null,Z);if(!Array.isArray(Q))return[];if(J&&Q.length>0)Q=Q.map((H)=>{if(!H||typeof H.x!=="number"||typeof H.y!=="number")throw new Error("patternChildToPolygon: invalid polygon point - must have numeric x and y properties");let[z,q]=c0(J,H.x,H.y);return{x:z,y:q}});return Q}function FH($,J){if(!$)throw new Error("getTilePositions: tile is required");if(!J)throw new Error("getTilePositions: coverBBox is required");if(!("x"in $)||!("y"in $)||!("width"in $)||!("height"in $))throw new Error("getTilePositions: tile must have x, y, width, and height properties");if(typeof J.x!=="number"||typeof J.y!=="number"||typeof J.width!=="number"||typeof J.height!=="number")throw new Error("getTilePositions: coverBBox must have numeric x, y, width, and height properties");let Z=[],K=Number($.x),Q=Number($.y),H=Number($.width),z=Number($.height);if(!isFinite(K)||!isFinite(Q)||!isFinite(H)||!isFinite(z))throw new Error("getTilePositions: tile dimensions must be finite numbers");if(H<=0||z<=0)return Z;let q=Math.floor((J.x-K)/H),W=Math.ceil((J.x+J.width-K)/H),j=Math.floor((J.y-Q)/z),G=Math.ceil((J.y+J.height-Q)/z);if(!isFinite(q)||!isFinite(W)||!isFinite(j)||!isFinite(G))throw new Error("getTilePositions: computed tile indices are not finite");for(let F=q;F<W;F++)for(let _=j;_<G;_++)Z.push({x:K7(K).plus(K7(H).mul(F)),y:K7(Q).plus(K7(z).mul(_))});return Z}function _H($,J,Z={}){if(!$)throw new Error("resolvePattern: patternData is required");if(!J)throw new Error("resolvePattern: targetBBox is required");if(!Array.isArray($.children))throw new Error("resolvePattern: patternData.children must be an array");let{samples:K=20,maxTiles:Q=1000}=Z,H=[],z=WH($,J);if(Number(z.width)<=0||Number(z.height)<=0)return H;let q=jH($,z,J),W=VH($.patternTransform),G=FH(z,J).slice(0,Q);for(let F of G){let _=i0(F.x,F.y);for(let U of $.children){let O=W.mul(_.mul(q)),V=GH(U,O,K);if(V.length>=3)H.push({polygon:V,fill:U.fill,stroke:U.stroke,strokeWidth:U.strokeWidth,opacity:U.opacity})}}return H}function UH($,J,Z={}){if(!$)throw new Error("patternToClipPath: patternData is required");if(!J)throw new Error("patternToClipPath: targetBBox is required");let K=_H($,J,Z),Q=[];for(let{polygon:H,opacity:z}of K)if(z>0&&H.length>=3)if(Q.length===0)Q=H;else{let q=z6(Q,H);if(Array.isArray(q)&&q.length>0&&Array.isArray(q[0])&&q[0].length>=3)Q=q[0]}return Q}function s5($,J,Z={}){if(!$)throw new Error("patternToPathData: patternData is required");if(!J)throw new Error("patternToPathData: targetBBox is required");let K=UH($,J,Z);if(!Array.isArray(K))return"";if(K.length<3)return"";let Q="";for(let H=0;H<K.length;H++){let z=K[H];if(!z||typeof z.x!=="number"||typeof z.y!=="number")throw new Error("patternToPathData: invalid polygon point - must have numeric x and y properties");if(!isFinite(z.x)||!isFinite(z.y))throw new Error("patternToPathData: polygon point coordinates must be finite numbers");let q=Number(z.x).toFixed(6),W=Number(z.y).toFixed(6);Q+=H===0?`M ${q} ${W}`:` L ${q} ${W}`}return Q+=" Z",Q}function VH($){if(!$)return U0.identity(3);return(void 0)($)}k.set({precision:80});function g9($,J,Z,K=1,Q=!1){if(!$)throw new Error("getMarkerTransform: markerDef is required");if(!J||typeof J.x!=="number"||typeof J.y!=="number")throw new Error("getMarkerTransform: position must be an object with x and y numeric properties");if(typeof Z!=="number"||isNaN(Z)||!isFinite(Z))throw new Error("getMarkerTransform: tangentAngle must be a valid finite number");if(typeof K!=="number"||isNaN(K)||K<=0)throw new Error("getMarkerTransform: strokeWidth must be a positive number");let{markerWidth:H,markerHeight:z,refX:q,refY:W,orient:j,markerUnits:G,viewBox:F}=$;if(typeof H!=="number"||H<=0)throw new Error("getMarkerTransform: markerDef.markerWidth must be a positive number");if(typeof z!=="number"||z<=0)throw new Error("getMarkerTransform: markerDef.markerHeight must be a positive number");if(typeof q!=="number"||!isFinite(q))throw new Error("getMarkerTransform: markerDef.refX must be a finite number");if(typeof W!=="number"||!isFinite(W))throw new Error("getMarkerTransform: markerDef.refY must be a finite number");let _=U0.identity(3),U=i0(J.x,J.y);_=_.mul(U);let O=0;if(j==="auto")O=Z;else if(j==="auto-start-reverse")O=Q?Z+Math.PI:Z;else if(typeof j==="number")O=j*(Math.PI/180);if(O!==0){let X=O6(O);_=_.mul(X)}let V=1,M=1;if(G==="strokeWidth")V=K,M=K;if(F){let{width:X,height:w}=F;if(X>0&&w>0&&isFinite(X)&&isFinite(w)){let R=H/X,I=z/w;if(isFinite(R)&&isFinite(I)){let f=Math.min(R,I);V*=f,M*=f;let u=i0(-F.x,-F.y);_=_.mul(u)}}}if(V!==1||M!==1){let X=w7(V,M);_=_.mul(X)}let Y=i0(-q,-W);return _=_.mul(Y),_}function OH($){if(typeof $!=="string")throw new Error("getPathVertices: pathData must be a string");let J=[],Z=0,K=0,Q=0,H=0,z=o5($);for(let q=0;q<z.length;q++){let W=z[q],j=Z,G=K;switch(W.type){case"M":if(Z=W.x,K=W.y,Q=Z,H=K,J.length>0){let F=J[J.length-1],_=Math.atan2(K-G,Z-j);F.tangentOut=_}J.push({x:Z,y:K,tangentIn:0,tangentOut:0,index:J.length});break;case"L":{Z=W.x,K=W.y;let F=Z-j,_=K-G,U=F===0&&_===0?J.length>0?J[J.length-1].tangentOut:0:Math.atan2(_,F);if(J.length>0)J[J.length-1].tangentOut=U;J.push({x:Z,y:K,tangentIn:U,tangentOut:U,index:J.length});break}case"C":{Z=W.x,K=W.y;let F=W.x1-j,_=W.y1-G,U=F===0&&_===0?Math.atan2(W.y2-G,W.x2-j):Math.atan2(_,F),O=Z-W.x2,V=K-W.y2,M=O===0&&V===0?Math.atan2(K-W.y1,Z-W.x1):Math.atan2(V,O);if(J.length>0)J[J.length-1].tangentOut=U;J.push({x:Z,y:K,tangentIn:M,tangentOut:M,index:J.length});break}case"Q":{Z=W.x,K=W.y;let F=W.x1-j,_=W.y1-G,U=F===0&&_===0?Math.atan2(K-G,Z-j):Math.atan2(_,F),O=Z-W.x1,V=K-W.y1,M=O===0&&V===0?Math.atan2(K-G,Z-j):Math.atan2(V,O);if(J.length>0)J[J.length-1].tangentOut=U;J.push({x:Z,y:K,tangentIn:M,tangentOut:M,index:J.length});break}case"A":{Z=W.x,K=W.y;let F=Z-j,_=K-G,U=F===0&&_===0?J.length>0?J[J.length-1].tangentOut:0:Math.atan2(_,F);if(J.length>0)J[J.length-1].tangentOut=U;J.push({x:Z,y:K,tangentIn:U,tangentOut:U,index:J.length});break}case"Z":{Z=Q,K=H;let F=Z-j,_=K-G,U=F===0&&_===0?J.length>0?J[J.length-1].tangentOut:0:Math.atan2(_,F);if(J.length>0)J[J.length-1].tangentOut=U;if(J.length>0)J[0].tangentIn=U;break}default:break}}return J}function o5($){if(typeof $!=="string")throw new Error("parsePathCommands: pathData must be a string");let J=[];if($.trim()==="")return J;let Z=$.replace(/([MmLlHhVvCcSsQqTtAaZz])/g," $1 ").trim(),K=/[MmLlHhVvCcSsQqTtAaZz]/,Q=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,H=[],z=0;while(z<Z.length){while(z<Z.length&&/[\s,]/.test(Z[z]))z++;if(z>=Z.length)break;if(K.test(Z[z]))H.push(Z[z]),z++;else{Q.lastIndex=z;let F=Q.exec(Z);if(F&&F.index===z)H.push(F[0]),z=Q.lastIndex;else z++}}let q=0,W=0,j=0,G=(F,_)=>{if(F>=H.length)throw new Error(`parsePathCommands: missing ${_} parameter at token ${F}`);let U=parseFloat(H[F]);if(isNaN(U)||!isFinite(U))throw new Error(`parsePathCommands: invalid ${_} value "${H[F]}" at token ${F}`);return U};while(q<H.length){let F=H[q];switch(F.toUpperCase()){case"M":{let _=G(q+1,"M.x"),U=G(q+2,"M.y");J.push({type:"M",x:F==="M"?_:W+_,y:F==="M"?U:j+U}),W=J[J.length-1].x,j=J[J.length-1].y,q+=3;break}case"L":{let _=G(q+1,"L.x"),U=G(q+2,"L.y");J.push({type:"L",x:F==="L"?_:W+_,y:F==="L"?U:j+U}),W=J[J.length-1].x,j=J[J.length-1].y,q+=3;break}case"H":{let _=G(q+1,"H.x");J.push({type:"L",x:F==="H"?_:W+_,y:j}),W=J[J.length-1].x,q+=2;break}case"V":{let _=G(q+1,"V.y");J.push({type:"L",x:W,y:F==="V"?_:j+_}),j=J[J.length-1].y,q+=2;break}case"C":{let _=G(q+1,"C.x1"),U=G(q+2,"C.y1"),O=G(q+3,"C.x2"),V=G(q+4,"C.y2"),M=G(q+5,"C.x"),Y=G(q+6,"C.y");J.push({type:"C",x1:F==="C"?_:W+_,y1:F==="C"?U:j+U,x2:F==="C"?O:W+O,y2:F==="C"?V:j+V,x:F==="C"?M:W+M,y:F==="C"?Y:j+Y}),W=J[J.length-1].x,j=J[J.length-1].y,q+=7;break}case"Q":{let _=G(q+1,"Q.x1"),U=G(q+2,"Q.y1"),O=G(q+3,"Q.x"),V=G(q+4,"Q.y");J.push({type:"Q",x1:F==="Q"?_:W+_,y1:F==="Q"?U:j+U,x:F==="Q"?O:W+O,y:F==="Q"?V:j+V}),W=J[J.length-1].x,j=J[J.length-1].y,q+=5;break}case"A":{let _=G(q+1,"A.rx"),U=G(q+2,"A.ry"),O=G(q+3,"A.rotation");if(q+4>=H.length||q+5>=H.length)throw new Error("parsePathCommands: missing arc flag parameters");let V=parseInt(H[q+4],10),M=parseInt(H[q+5],10);if(isNaN(V)||isNaN(M))throw new Error("parsePathCommands: invalid arc flag values");let Y=G(q+6,"A.x"),X=G(q+7,"A.y");J.push({type:"A",rx:_,ry:U,xAxisRotation:O,largeArcFlag:V,sweepFlag:M,x:F==="A"?Y:W+Y,y:F==="A"?X:j+X}),W=J[J.length-1].x,j=J[J.length-1].y,q+=8;break}case"Z":J.push({type:"Z"}),q+=1;break;default:q+=1}}return J}function i5($,J){if(!$)throw new Error("resolveMarkers: pathElement is required");if(!J||typeof J!=="object")throw new Error("resolveMarkers: defsMap must be an object");let Z=[],K=$.getAttribute("marker-start"),Q=$.getAttribute("marker-mid"),H=$.getAttribute("marker-end"),z=$.getAttribute("stroke-width")||"1",q=parseFloat(z);if(isNaN(q)||q<=0)throw new Error("resolveMarkers: stroke-width must be a positive number");let W=$.getAttribute("d")||"",j=OH(W);if(j.length===0)return Z;let G=(F)=>{if(!F)return null;let _=F.match(/url\(#([^)]+)\)/);return _?_[1]:null};if(K){let F=G(K),_=F?J[F]:null;if(_&&j.length>0){let U=j[0],O=j.length>1?U.tangentOut:U.tangentIn;Z.push({markerDef:_,position:{x:U.x,y:U.y},transform:g9(_,{x:U.x,y:U.y},O,q,!0),type:"start",vertex:U})}}if(Q&&j.length>2){let F=G(Q),_=F?J[F]:null;if(_)for(let U=1;U<j.length-1;U++){let O=j[U],V=O.tangentIn,Y=O.tangentOut-V;while(Y>Math.PI)Y-=2*Math.PI;while(Y<-Math.PI)Y+=2*Math.PI;let X=V+Y/2;Z.push({markerDef:_,position:{x:O.x,y:O.y},transform:g9(_,{x:O.x,y:O.y},X,q,!1),type:"mid",vertex:O})}}if(H){let F=G(H),_=F?J[F]:null;if(_&&j.length>0){let U=j[j.length-1],O=U.tangentIn;Z.push({markerDef:_,position:{x:U.x,y:U.y},transform:g9(_,{x:U.x,y:U.y},O,q,!1),type:"end",vertex:U})}}return Z}function YH($,J={}){if(!$)throw new Error("markerToPolygons: markerInstance is required");if(!$.markerDef)throw new Error("markerToPolygons: markerInstance.markerDef is required");if(!$.transform)throw new Error("markerToPolygons: markerInstance.transform is required");let{precision:Z=2,curveSegments:K=10}=J;if(typeof Z!=="number"||Z<0)throw new Error("markerToPolygons: precision must be a non-negative number");if(typeof K!=="number"||K<=0)throw new Error("markerToPolygons: curveSegments must be a positive number");let Q=[],{markerDef:H,transform:z}=$;if(!Array.isArray(H.children))throw new Error("markerToPolygons: markerDef.children must be an array");for(let q of H.children){let W=[];switch(q.type){case"path":W=XH(q.d,K);break;case"rect":W=[{x:q.x,y:q.y},{x:q.x+q.width,y:q.y},{x:q.x+q.width,y:q.y+q.height},{x:q.x,y:q.y+q.height}];break;case"circle":W=kH(q.cx,q.cy,q.r,K*4);break;case"ellipse":W=LH(q.cx,q.cy,q.rx,q.ry,K*4);break;case"line":W=[{x:q.x1,y:q.y1},{x:q.x2,y:q.y2}];break;case"polygon":case"polyline":W=wH(q.points);break;default:break}if(W.length>0){let j=W.map((G)=>{let F=c0(z,G.x,G.y);return{x:parseFloat(F[0].toFixed(Z)),y:parseFloat(F[1].toFixed(Z))}});Q.push(j)}}return Q}function XH($,J=10){if(typeof $!=="string")throw new Error("pathToPoints: pathData must be a string");if(typeof J!=="number"||J<=0)throw new Error("pathToPoints: segments must be a positive number");let Z=[],K=o5($),Q=0,H=0;for(let z of K)switch(z.type){case"M":Q=z.x,H=z.y,Z.push({x:Q,y:H});break;case"L":Q=z.x,H=z.y,Z.push({x:Q,y:H});break;case"C":for(let q=1;q<=J;q++){let W=q/J,j=1-W,G=j*j*j*Q+3*j*j*W*z.x1+3*j*W*W*z.x2+W*W*W*z.x,F=j*j*j*H+3*j*j*W*z.y1+3*j*W*W*z.y2+W*W*W*z.y;Z.push({x:G,y:F})}Q=z.x,H=z.y;break;case"Q":for(let q=1;q<=J;q++){let W=q/J,j=1-W,G=j*j*Q+2*j*W*z.x1+W*W*z.x,F=j*j*H+2*j*W*z.y1+W*W*z.y;Z.push({x:G,y:F})}Q=z.x,H=z.y;break;case"A":Q=z.x,H=z.y,Z.push({x:Q,y:H});break;default:break}return Z}function kH($,J,Z,K=32){if(typeof $!=="number"||!isFinite($))throw new Error("circleToPoints: cx must be a finite number");if(typeof J!=="number"||!isFinite(J))throw new Error("circleToPoints: cy must be a finite number");if(typeof Z!=="number"||!isFinite(Z)||Z<0)throw new Error("circleToPoints: r must be a non-negative finite number");if(typeof K!=="number"||K<=0)throw new Error("circleToPoints: segments must be a positive number");let Q=[];for(let H=0;H<K;H++){let z=H/K*2*Math.PI;Q.push({x:$+Z*Math.cos(z),y:J+Z*Math.sin(z)})}return Q}function LH($,J,Z,K,Q=32){if(typeof $!=="number"||!isFinite($))throw new Error("ellipseToPoints: cx must be a finite number");if(typeof J!=="number"||!isFinite(J))throw new Error("ellipseToPoints: cy must be a finite number");if(typeof Z!=="number"||!isFinite(Z)||Z<0)throw new Error("ellipseToPoints: rx must be a non-negative finite number");if(typeof K!=="number"||!isFinite(K)||K<0)throw new Error("ellipseToPoints: ry must be a non-negative finite number");if(typeof Q!=="number"||Q<=0)throw new Error("ellipseToPoints: segments must be a positive number");let H=[];for(let z=0;z<Q;z++){let q=z/Q*2*Math.PI;H.push({x:$+Z*Math.cos(q),y:J+K*Math.sin(q)})}return H}function wH($){if(typeof $!=="string")throw new Error("parsePoints: pointsStr must be a string");let J=[],Z=$.trim().split(/[\s,]+/).map(Number).filter((K)=>!isNaN(K)&&isFinite(K));if(Z.length%2!==0)throw new Error("parsePoints: pointsStr must contain an even number of valid coordinates");for(let K=0;K<Z.length;K+=2)J.push({x:Z[K],y:Z[K+1]});return J}function r5($,J=2){if(!Array.isArray($))throw new Error("markersToPathData: markerInstances must be an array");if(typeof J!=="number"||J<0)throw new Error("markersToPathData: precision must be a non-negative number");let Z=[];for(let K of $){let Q=YH(K,{precision:J});for(let H of Q){if(H.length===0)continue;let z=H[0];Z.push(`M ${z.x.toFixed(J)} ${z.y.toFixed(J)}`);for(let q=1;q<H.length;q++){let W=H[q];Z.push(`L ${W.x.toFixed(J)} ${W.y.toFixed(J)}`)}Z.push("Z")}}return Z.join(" ")}k.set({precision:80});var k0=($)=>$ instanceof k?$:new k($),r0=new k(0),L6=new k(1);function w6(){let $=k.precision;if($<20)throw new Error(`Decimal precision (${$}) is too low for verification. Minimum required: 20`);let J=Math.max(1,$-10);return new k(10).pow(-J)}function $K($,J,Z){let K=w6();if(!$)return{valid:!1,error:new k(1/0),tolerance:K,message:"Matrix parameter is null or undefined"};if(J==null||Z==null)return{valid:!1,error:new k(1/0),tolerance:K,message:"Coordinates x or y are null or undefined"};let Q=k0(J),H=k0(Z);try{let[z,q]=c0($,Q,H),W=$.inverse();if(!W)return{valid:!1,error:new k(1/0),tolerance:K,message:"Matrix is not invertible (determinant = 0)",details:{determinant:$.determinant()}};let[j,G]=c0(W,z,q),F=Q.minus(j).abs(),_=H.minus(G).abs(),U=k.max(F,_),O=U.lessThan(K);return{valid:O,error:U,tolerance:K,message:O?`Round-trip verified: error ${U.toExponential()} < tolerance ${K.toExponential()}`:`Round-trip FAILED: error ${U.toExponential()} >= tolerance ${K.toExponential()}`,details:{original:{x:Q.toString(),y:H.toString()},transformed:{x:z.toString(),y:q.toString()},recovered:{x:j.toString(),y:G.toString()},errorX:F.toExponential(),errorY:_.toExponential()}}}catch(z){return{valid:!1,error:new k(1/0),tolerance:K,message:`Verification error: ${z.message}`}}}function x9($){let J=w6();if(!$)return{valid:!1,error:new k(1/0),tolerance:J,message:"Matrix parameter is null or undefined"};try{let Z=$.inverse();if(!Z)return{valid:!1,error:new k(1/0),tolerance:J,message:"Matrix is singular (not invertible)",details:{determinant:$.determinant().toString()}};let K=$.mul(Z),Q=$.rows,H=r0,z=[];for(let W=0;W<Q;W++)for(let j=0;j<Q;j++){let G=W===j?L6:r0,F=K.data[W][j],_=F.minus(G).abs();if(_.greaterThan(H))H=_;if(_.greaterThanOrEqualTo(J))z.push({row:W,col:j,expected:G.toString(),actual:F.toString(),error:_.toExponential()})}let q=H.lessThan(J);return{valid:q,error:H,tolerance:J,message:q?`Matrix inversion verified: max error ${H.toExponential()} < tolerance`:`Matrix inversion FAILED: max error ${H.toExponential()} at ${z.length} positions`,details:{matrixSize:`${Q}x${Q}`,maxError:H.toExponential(),failedElements:z.slice(0,5)}}}catch(Z){return{valid:!1,error:new k(1/0),tolerance:J,message:`Verification error: ${Z.message}`}}}function a5($,J,Z=null){let K=w6(),Q=Z||new k("1e-6");if(!$||!Array.isArray($))return{valid:!1,error:r0,tolerance:K,message:"Inner polygon parameter is null, undefined, or not an array"};if(!J||!Array.isArray(J))return{valid:!1,error:r0,tolerance:K,message:"Outer polygon parameter is null, undefined, or not an array"};if($.length<3||J.length<3)return{valid:!1,error:r0,tolerance:K,message:"Polygons must have at least 3 vertices"};try{let H=!0,z=[],q=r0;for(let W=0;W<$.length;W++){let j=$[W];if(!NH(j,J)){let G=BH(j,J);if(G.greaterThan(q))q=G;if(G.greaterThan(Q))H=!1,z.push({index:W,x:j.x.toString(),y:j.y.toString(),distanceOutside:G.toExponential()})}}return{valid:H,error:q,tolerance:Q,message:H?`All inner polygon points are inside or within tolerance (max outside: ${q.toExponential()})`:`${z.length} points exceed tolerance distance outside outer polygon`,details:{innerVertices:$.length,outerVertices:J.length,maxOutsideDistance:q.toExponential(),outsidePoints:z.slice(0,5)}}}catch(H){return{valid:!1,error:new k(1/0),tolerance:K,message:`Verification error: ${H.message}`}}}function BH($,J){if(!$||$.x==null||$.y==null)throw new Error("Invalid point parameter: must have x and y properties");if(!J||!Array.isArray(J)||J.length===0)throw new Error("Invalid polygon parameter: must be non-empty array of points");let Z=new k(1/0),K=k0($.x),Q=k0($.y);for(let H=0;H<J.length;H++){let z=(H+1)%J.length,q=J[H],W=J[z],j=k0(q.x),G=k0(q.y),F=k0(W.x),_=k0(W.y),U=F.minus(j),O=_.minus(G),V=U.times(U).plus(O.times(O)),M;if(V.isZero())M=ZK($,q);else{let Y=k.max(r0,k.min(L6,K.minus(j).times(U).plus(Q.minus(G).times(O)).div(V))),X=j.plus(Y.times(U)),w=G.plus(Y.times(O));M=K.minus(X).pow(2).plus(Q.minus(w).pow(2)).sqrt()}if(M.lessThan(Z))Z=M}return Z}function JK($,J,Z){let K=w6();if(!$||!Array.isArray($))return{valid:!1,error:r0,tolerance:K,message:"Poly1 parameter must be an array"};if(!J||!Array.isArray(J))return{valid:!1,error:r0,tolerance:K,message:"Poly2 parameter must be an array"};if(!Z||!Array.isArray(Z))return{valid:!1,error:r0,tolerance:K,message:"Intersection parameter must be an array"};if(Z.length<3)return{valid:!0,error:r0,tolerance:K,message:"Intersection is empty or degenerate (valid result)",details:{intersectionVertices:Z.length}};try{let Q=a5(Z,$),H=a5(Z,J),z=c6($),q=c6(J),W=c6(Z),j=k.min(z,q),G=W.lessThanOrEqualTo(j.times(L6.plus(K))),F=Q.valid&&H.valid&&G;return{valid:F,error:F?r0:L6,tolerance:K,message:F?"Intersection verified: contained in both polygons, area valid":`Intersection FAILED: ${!Q.valid?"not in poly1, ":""}${!H.valid?"not in poly2, ":""}${!G?"area too large":""}`,details:{containedInPoly1:Q.valid,containedInPoly2:H.valid,area1:z.toString(),area2:q.toString(),intersectionArea:W.toString(),areaValid:G}}}catch(Q){return{valid:!1,error:new k(1/0),tolerance:K,message:`Verification error: ${Q.message}`}}}function KK($,J,Z){let K=w6();if(!$||typeof $!=="object")return{valid:!1,error:new k(1/0),tolerance:K,message:"Original gradient parameter must be an object"};if(!J||typeof J!=="object")return{valid:!1,error:new k(1/0),tolerance:K,message:"Baked gradient parameter must be an object"};if(!Z)return{valid:!1,error:new k(1/0),tolerance:K,message:"Matrix parameter is null or undefined"};try{let[Q,H]=c0(Z,k0($.x1||0),k0($.y1||0)),[z,q]=c0(Z,k0($.x2||1),k0($.y2||0)),W=k0(J.x1).minus(Q).abs(),j=k0(J.y1).minus(H).abs(),G=k0(J.x2).minus(z).abs(),F=k0(J.y2).minus(q).abs(),_=k.max(W,j,G,F),U=_.lessThan(K);return{valid:U,error:_,tolerance:K,message:U?`Linear gradient transform verified: max error ${_.toExponential()}`:`Linear gradient transform FAILED: max error ${_.toExponential()}`,details:{expected:{x1:Q.toString(),y1:H.toString(),x2:z.toString(),y2:q.toString()},actual:J}}}catch(Q){return{valid:!1,error:new k(1/0),tolerance:K,message:`Verification error: ${Q.message}`}}}function c6($){if(!$||!Array.isArray($))throw new Error("Invalid polygon parameter: must be an array");if($.length<3)return r0;let J=r0,Z=$.length;for(let K=0;K<Z;K++){let Q=(K+1)%Z,H=k0($[K].x),z=k0($[K].y),q=k0($[Q].x),W=k0($[Q].y);J=J.plus(H.times(W).minus(q.times(z)))}return J.abs().div(2)}function NH($,J){if(!$||$.x==null||$.y==null)throw new Error("Invalid point parameter: must have x and y properties");if(!J||!Array.isArray(J)||J.length===0)throw new Error("Invalid polygon parameter: must be non-empty array of points");let Z=k0($.x),K=k0($.y),Q=J.length,H=!1;for(let z=0,q=Q-1;z<Q;q=z++){let W=k0(J[z].x),j=k0(J[z].y),G=k0(J[q].x),F=k0(J[q].y);if(IH($,J[z],J[q]))return!0;if(j.greaterThan(K)!==F.greaterThan(K)&&Z.lessThan(G.minus(W).times(K.minus(j)).div(F.minus(j)).plus(W)))H=!H}return H}function IH($,J,Z){if(!$||$.x==null||$.y==null)throw new Error("Invalid point parameter: must have x and y properties");if(!J||J.x==null||J.y==null)throw new Error("Invalid segStart parameter: must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new Error("Invalid segEnd parameter: must have x and y properties");let K=w6(),Q=k0($.x),H=k0($.y),z=k0(J.x),q=k0(J.y),W=k0(Z.x),j=k0(Z.y),G=k.min(z,W).minus(K),F=k.max(z,W).plus(K),_=k.min(q,j).minus(K),U=k.max(q,j).plus(K);if(Q.lessThan(G)||Q.greaterThan(F)||H.lessThan(_)||H.greaterThan(U))return!1;let O=W.minus(z).times(H.minus(q)).minus(j.minus(q).times(Q.minus(z))).abs(),V=ZK(J,Z);return O.div(V.plus(K)).lessThan(K)}function ZK($,J){if(!$||$.x==null||$.y==null)throw new Error("Invalid p1 parameter: must have x and y properties");if(!J||J.x==null||J.y==null)throw new Error("Invalid p2 parameter: must have x and y properties");let Z=k0(J.x).minus(k0($.x)),K=k0(J.y).minus(k0($.y));return Z.times(Z).plus(K.times(K)).sqrt()}function QK($,J){if(!$||$.length<3||!J||J.length<3)return[];let Z=[];for(let K=0;K<J.length;K++){let Q=J[K],H=J[(K+1)%J.length],z=[];for(let q=0;q<$.length;q++){let W=$[q],j=$[(q+1)%$.length],G=!t5(W,Q,H),F=!t5(j,Q,H);if(G){if(z.push(W),!F)z.push(e5(W,j,Q,H))}else if(F)z.push(e5(W,j,Q,H))}if(z.length>=3)Z.push(z)}return Z}function HK($,J,Z=[],K="1e-10"){let Q=K instanceof k?K:new k(K),H=Z||[];if(!$||!Array.isArray($))return{valid:!1,error:new k(1/0),tolerance:Q,message:"Original polygon parameter must be an array"};if(!J||!Array.isArray(J))return{valid:!1,error:new k(1/0),tolerance:Q,message:"Clipped polygon parameter must be an array"};try{let z=c6($),q=J.length>=3?c6(J):r0,W=z.minus(q),j=q.lessThanOrEqualTo(z.times(L6.plus(Q))),G=W.greaterThanOrEqualTo(r0.minus(Q.times(z))),F=z.isZero()?L6:q.div(z),_=r0,U=j&&G;return{valid:U,error:_,tolerance:Q,message:U?`ClipPath E2E verified: area conserved (clipped ${F.times(100).toFixed(2)}% of original)`:"ClipPath E2E FAILED: invalid intersection (clipped > original or negative outside)",details:{originalArea:z.toString(),clippedArea:q.toString(),outsideArea:W.toString(),areaRatio:F.toFixed(6),fragmentCount:H.length,clippedValid:j,outsideValid:G}}}catch(z){return{valid:!1,error:new k(1/0),tolerance:Q,message:`E2E verification error: ${z.message}`}}}function t5($,J,Z){if(!$||$.x==null||$.y==null)throw new Error("Invalid point parameter: must have x and y properties");if(!J||J.x==null||J.y==null)throw new Error("Invalid edgeStart parameter: must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new Error("Invalid edgeEnd parameter: must have x and y properties");let K=k0($.x).toNumber(),Q=k0($.y).toNumber(),H=k0(J.x).toNumber(),z=k0(J.y).toNumber(),q=k0(Z.x).toNumber(),W=k0(Z.y).toNumber();return(q-H)*(Q-z)-(W-z)*(K-H)>=0}function e5($,J,Z,K){if(!$||$.x==null||$.y==null)throw new Error("Invalid p1 parameter: must have x and y properties");if(!J||J.x==null||J.y==null)throw new Error("Invalid p2 parameter: must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new Error("Invalid p3 parameter: must have x and y properties");if(!K||K.x==null||K.y==null)throw new Error("Invalid p4 parameter: must have x and y properties");let Q=k0($.x).toNumber(),H=k0($.y).toNumber(),z=k0(J.x).toNumber(),q=k0(J.y).toNumber(),W=k0(Z.x).toNumber(),j=k0(Z.y).toNumber(),G=k0(K.x).toNumber(),F=k0(K.y).toNumber(),_=(Q-z)*(j-F)-(H-q)*(W-G);if(Math.abs(_)<0.0000000001)return{x:k0((Q+z)/2),y:k0((H+q)/2)};let U=((Q-W)*(j-F)-(H-j)*(W-G))/_;return{x:k0(Q+U*(z-Q)),y:k0(H+U*(q-H))}}var jK=["animate","animateTransform","animateMotion","animateColor","set"],zK=["href","xlink:href"],qK=["fill","stroke","clip-path","mask","filter","marker-start","marker-mid","marker-end","cursor","color-profile"],PH=["begin","end"],AH=["values","from","to","by"];function m9($){if(!$||typeof $!=="string")return null;let J=$.match(/url\(\s*["']?#([^"')\s]+)\s*["']?\s*\)/);return J&&J[1]?J[1]:null}function WK($){if(!$||typeof $!=="string")return null;if($.startsWith("#")){let J=$.substring(1);return J&&!J.startsWith("#")?J:null}return null}function GK($){if(!$||typeof $!=="string")return[];let J=[],Z=$.split(";");for(let K of Z){let Q=K.trim();if(Q.startsWith("#")){let z=Q.substring(1);if(z)J.push(z)}let H=m9(Q);if(H)J.push(H)}return J}function FK($){if(!$||typeof $!=="string")return[];let J=[],Z=$.split(";");for(let K of Z){let H=K.trim().match(/^([a-zA-Z_][a-zA-Z0-9_-]*)\.(begin|end|click|mousedown|mouseup|mouseover|mouseout|mousemove|mouseenter|mouseleave|focusin|focusout|activate|repeat)(?:[+-]\d+(?:\.\d+)?[a-z]*)?/);if(H)J.push(H[1])}return J}function l6($){if(!$||typeof $!=="string")return[];let J=[],Z=/url\(\s*["']?#([^"')]+)["']?\s*\)/g,K;while((K=Z.exec($))!==null)if(K[1])J.push(K[1]);return J}function _K($){if(!$||typeof $!=="string")return[];let J=[],Z=/getElementById\(\s*["']([^"']+)["']\s*\)/g,K;while((K=Z.exec($))!==null)if(K[1])J.push(K[1]);let Q=/querySelector(?:All)?\(\s*["']#([^"'#\s]+)["']\s*\)/g;while((K=Q.exec($))!==null)if(K[1])J.push(K[1]);return J}function EH($){if(!$||typeof $!=="object"||!($ instanceof B0))throw new TypeError("collectElementReferences: el must be a valid SVGElement");if(typeof $.getAttributeNames!=="function")throw new TypeError("collectElementReferences: el must have getAttributeNames method");let J={static:new Set,animation:new Set,css:new Set,js:new Set},Z=$.tagName?.toLowerCase()||"",K=jK.includes(Z),Q=$.getAttributeNames();if(!Array.isArray(Q))throw new TypeError("collectElementReferences: getAttributeNames must return an array");for(let H of Q){let z=$.getAttribute(H);if(!z)continue;if(zK.includes(H)){let q=WK(z);if(q)if(K)J.animation.add(q);else J.static.add(q)}if(qK.includes(H)||H==="style"){let q=m9(z);if(q)J.static.add(q);if(H==="style")l6(z).forEach((W)=>J.css.add(W))}if(PH.includes(H))FK(z).forEach((q)=>J.animation.add(q));if(AH.includes(H))GK(z).forEach((q)=>J.animation.add(q));if(!qK.includes(H)&&z.includes("url(")){let q=m9(z);if(q)J.static.add(q)}}if(Z==="animatemotion"){if(typeof $.getElementsByTagName!=="function")throw new TypeError("collectElementReferences: el must have getElementsByTagName method");let H=$.getElementsByTagName("mpath");if(!H||typeof H[Symbol.iterator]!=="function")throw new TypeError("collectElementReferences: getElementsByTagName must return an iterable");for(let z of H){if(!z||typeof z.getAttribute!=="function")continue;for(let q of zK){let W=z.getAttribute(q),j=WK(W);if(j)J.animation.add(j)}}}return J}function UK($){if(!$||typeof $!=="object"||!($ instanceof B0))throw new TypeError("collectAllReferences: root must be a valid SVGElement");let J={all:new Set,static:new Set,animation:new Set,css:new Set,js:new Set,details:new Map},Z={animation:4,js:3,css:2,static:1},K=(H,z,q)=>{if(J.all.add(H),J[z].add(H),!J.details.has(H))J.details.set(H,{sources:[],type:z});else{let W=J.details.get(H);if(Z[z]>Z[W.type])W.type=z}J.details.get(H).sources.push(q)},Q=(H,z="")=>{let q=H.tagName?.toLowerCase()||"",W=z?`${z}>${q}`:q,j=H.getAttribute("id"),G=j?`${q}#${j}`:W,F=EH(H);if(F.static.forEach((_)=>K(_,"static",G)),F.animation.forEach((_)=>K(_,"animation",G)),F.css.forEach((_)=>K(_,"css",G)),F.js.forEach((_)=>K(_,"js",G)),q==="style"){let _=H.textContent||"";l6(_).forEach((U)=>K(U,"css","<style>"))}if(q==="script"){let _=H.textContent||"";_K(_).forEach((U)=>K(U,"js","<script>"))}if(H.children&&typeof H.children[Symbol.iterator]==="function"){for(let _ of H.children)if(_ instanceof B0)Q(_,W)}};return Q($),J}k.set({precision:80});var Y7=($)=>$ instanceof k?$:new k($),TH={precision:6,curveSegments:20,clipSegments:64,bezierArcs:8,resolveUse:!0,resolveMarkers:!0,resolvePatterns:!0,resolveMasks:!0,resolveClipPaths:!0,flattenTransforms:!0,bakeGradients:!0,removeUnusedDefs:!0,preserveIds:!1,svg2Polyfills:!1,e2eTolerance:"1e-10"};function B6($,J={}){if($===null||$===void 0)throw new Error("flattenSVG: svgString parameter is required");if(typeof $!=="string")throw new Error(`flattenSVG: svgString must be a string, got ${typeof $}`);if($.trim().length===0)throw new Error("flattenSVG: svgString cannot be empty");let Z={...TH,...J},K={useResolved:0,markersResolved:0,patternsResolved:0,masksResolved:0,clipPathsApplied:0,transformsFlattened:0,gradientsProcessed:0,defsRemoved:0,errors:[],verifications:{transforms:[],matrices:[],polygons:[],gradients:[],e2e:[],passed:0,failed:0,allPassed:!0},clipOutsideFragments:[]};try{let Q=d0($);if(Q.tagName.toLowerCase()!=="svg")throw new Error("Root element must be <svg>");let H=i7(Q),z=Z.removeUnusedDefs?gH(Q):null;if(Z.resolveUse){let W=bH(Q,H,Z);K.useResolved=W.count,K.errors.push(...W.errors),H=i7(Q)}if(Z.resolveMarkers){let W=fH(Q,H,Z);K.markersResolved=W.count,K.errors.push(...W.errors)}if(Z.resolvePatterns){let W=SH(Q,H,Z);K.patternsResolved=W.count,K.errors.push(...W.errors)}if(Z.resolveMasks){let W=vH(Q,H,Z);K.masksResolved=W.count,K.errors.push(...W.errors)}if(Z.resolveClipPaths){let W=DH(Q,H,Z,K);K.clipPathsApplied=W.count,K.errors.push(...W.errors)}if(Z.flattenTransforms){let W=hH(Q,Z,K);K.transformsFlattened=W.count,K.errors.push(...W.errors)}if(Z.bakeGradients){let W=uH(Q,Z,K);K.gradientsProcessed=W.count,K.errors.push(...W.errors)}if(Z.removeUnusedDefs&&z){let W=xH(Q,z);K.defsRemoved=W.count}return{svg:B7(Q),stats:K}}catch(Q){return K.errors.push(`Pipeline error: ${Q.message}`),{svg:$,stats:K}}}var YK=new Set(["animate","animatetransform","animatemotion","animatecolor","set"]),XK=new Set(["foreignobject","audio","video","iframe","script","style",...YK]);function d9($){if(!$)return!1;let J=$.tagName?.toLowerCase();if(XK.has(J))return!0;for(let Z of $.children||[])if(Z&&Z.tagName&&d9(Z))return!0;return!1}function bH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("resolveAllUseElements: invalid root element");if(!J||!(J instanceof Map))throw new Error("resolveAllUseElements: defsMap must be a Map");if(!Z||typeof Z!=="object")throw new Error("resolveAllUseElements: opts must be an object");let K=[],Q=0,H=$.getElementsByTagName("use"),z={};for(let[q,W]of J.entries())if(W.tagName.toLowerCase()==="symbol")z[q]=d5(W),z[q].type="symbol";else z[q]=T$(W);for(let q of[...H])try{let W=q.getAttribute("href")||q.getAttribute("xlink:href");if(!W)continue;let j=W.replace(/^#/,""),G=J.get(j);if(!G){K.push(`use: referenced element #${j} not found`);continue}let F=d9(G),_=d9(q);if(F||_){let M=G.cloneNode(!0),Y=parseFloat(q.getAttribute("x")||"0"),X=parseFloat(q.getAttribute("y")||"0");if(isNaN(Y)||isNaN(X)){K.push(`use: invalid x/y coordinates for element #${j}`);continue}let w=q.getAttribute("transform")||"",R="";if(w)R=w;if(Y!==0||X!==0){let m=`translate(${Y}, ${X})`;R=R?`${R} ${m}`:m}let I=new B0("g",{});if(R)I.setAttribute("transform",R);let f=n6(q);for(let[m,S]of Object.entries(f))if(S&&!I.hasAttribute(m))I.setAttribute(m,S);if(G.tagName.toLowerCase()==="symbol"){for(let m of M.children||[])if(m&&m.tagName)I.appendChild(m.cloneNode(!0))}else M.removeAttribute("id"),I.appendChild(M);for(let m of q.children||[])if(m&&m.tagName){let S=m.tagName.toLowerCase();if(YK.has(S))I.appendChild(m.cloneNode(!0))}if(q.parentNode)q.parentNode.replaceChild(I,q),Q++;continue}let U=m5(q),O=u9(U,z,{samples:Z.curveSegments});if(!O){K.push(`use: failed to resolve #${j}`);continue}let V=l5(O,Z.curveSegments);if(V){let M=new B0("path",{d:V,...n6(q)});if(O.style){for(let[Y,X]of Object.entries(O.style))if(X&&!M.hasAttribute(Y))M.setAttribute(Y,X)}if(q.parentNode)q.parentNode.replaceChild(M,q),Q++}}catch(W){K.push(`use: ${W.message}`)}return{count:Q,errors:K}}function fH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("resolveAllMarkers: invalid root element");if(!J||!(J instanceof Map))throw new Error("resolveAllMarkers: defsMap must be a Map");if(!Z||typeof Z!=="object")throw new Error("resolveAllMarkers: opts must be an object");let K=[],Q=0,H=["marker-start","marker-mid","marker-end","marker"];for(let z of H){let q=u7($,z);for(let W of q){if(W.tagName!=="path"&&W.tagName!=="line"&&W.tagName!=="polyline"&&W.tagName!=="polygon")continue;try{let j=i5(W,Object.fromEntries(J));if(!j||j.length===0)continue;let G=r5(j,Z.precision);if(G){let F=new B0("path",{d:G,fill:W.getAttribute("stroke")||"currentColor"});if(W.parentNode){let _=W.nextSibling;if(_)W.parentNode.insertBefore(F,_);else W.parentNode.appendChild(F);Q++}}for(let F of H)W.removeAttribute(F)}catch(j){K.push(`marker: ${j.message}`)}}}return{count:Q,errors:K}}function SH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("resolveAllPatterns: invalid root element");if(!J||!(J instanceof Map))throw new Error("resolveAllPatterns: defsMap must be a Map");if(!Z||typeof Z!=="object")throw new Error("resolveAllPatterns: opts must be an object");let K=[],Q=0,H=u7($,"fill");for(let z of H){let q=z.getAttribute("fill");if(!q||!q.includes("url("))continue;let W=r7(q);if(!W)continue;let j=J.get(W);if(!j||j.tagName.toLowerCase()!=="pattern")continue;try{let G=j.getAttribute("patternUnits")||"objectBoundingBox",F=j.getAttribute("patternContentUnits")||"userSpaceOnUse",_=j.getAttribute("patternTransform");if(G!=="objectBoundingBox")K.push(`pattern ${W}: non-default patternUnits="${G}" may cause rendering issues`);if(F!=="userSpaceOnUse")K.push(`pattern ${W}: non-default patternContentUnits="${F}" may cause rendering issues`);if(_)K.push(`pattern ${W}: patternTransform present - complex transformation may cause rendering issues`);let U=kK(z);if(!U)continue;let O=n5(j),V=s5(O,U,{samples:Z.curveSegments});if(V){let M=new B0("g",{}),Y=new B0("path",{d:V,fill:"#000"});if(M.appendChild(Y),z.setAttribute("fill","none"),z.setAttribute("stroke",z.getAttribute("stroke")||"none"),z.parentNode)z.parentNode.insertBefore(M,z),Q++}}catch(G){K.push(`pattern: ${G.message}`)}}return{count:Q,errors:K}}function vH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("resolveAllMasks: invalid root element");if(!J||!(J instanceof Map))throw new Error("resolveAllMasks: defsMap must be a Map");if(!Z||typeof Z!=="object")throw new Error("resolveAllMasks: opts must be an object");let K=[],Q=0,H=u7($,"mask");for(let z of H){let q=z.getAttribute("mask");if(!q||!q.includes("url("))continue;let W=r7(q);if(!W)continue;let j=J.get(W);if(!j||j.tagName.toLowerCase()!=="mask")continue;try{let G=j.getAttribute("maskUnits")||"objectBoundingBox",F=j.getAttribute("maskContentUnits")||"userSpaceOnUse";if(G!=="objectBoundingBox")K.push(`mask ${W}: non-default maskUnits="${G}" may cause rendering issues`);if(F!=="userSpaceOnUse")K.push(`mask ${W}: non-default maskContentUnits="${F}" may cause rendering issues`);let _=kK(z);if(!_)continue;let U=g5(j),O=x5(U,_,{samples:Z.curveSegments,opacityThreshold:0.5});if(O){let V=R6(z,Z.precision);if(V){let M=a7(V,Z.curveSegments),Y=a7(O,Z.curveSegments),X=LK(M,Y);if(X&&X.length>2){let w=h9(X,Z.precision);z.setAttribute("d",w),z.removeAttribute("mask"),Q++}}}}catch(G){K.push(`mask: ${G.message}`)}}return{count:Q,errors:K}}function DH($,J,Z,K){if(!$||!$.getElementsByTagName)throw new Error("applyAllClipPaths: invalid root element");if(!J||!(J instanceof Map))throw new Error("applyAllClipPaths: defsMap must be a Map");if(!Z||typeof Z!=="object")throw new Error("applyAllClipPaths: opts must be an object");if(!K||typeof K!=="object")throw new Error("applyAllClipPaths: stats must be an object");let Q=[],H=0;if(!K.verifications.e2e)K.verifications.e2e=[];if(!K.clipOutsideFragments)K.clipOutsideFragments=[];let z=u7($,"clip-path");for(let q of z){let W=q.getAttribute("clip-path");if(!W||!W.includes("url("))continue;let j=r7(W);if(!j)continue;let G=J.get(j),F=G?G.tagName.toLowerCase():"";if(!G||F!=="clippath")continue;try{if((G.getAttribute("clipPathUnits")||"userSpaceOnUse")==="objectBoundingBox")Q.push(`clipPath ${j}: objectBoundingBox units require bbox-relative coordinate transformation`);let U=R6(q,Z.precision);if(!U)continue;let O="";if(G.children&&G.children.length>0){for(let I of G.children)if(I&&I.tagName){let f=R6(I,Z.precision);if(f)O+=(O?" ":"")+f}}if(!O)continue;let V=Z.clipSegments||64,M=a7(U,V),Y=a7(O,V),X=LK(M,Y),w=M.map((I)=>({x:I.x instanceof k?I.x:Y7(I.x),y:I.y instanceof k?I.y:Y7(I.y)})),R=Y.map((I)=>({x:I.x instanceof k?I.x:Y7(I.x),y:I.y instanceof k?I.y:Y7(I.y)}));if(X&&X.length>2){let I=X.map((x)=>({x:x.x instanceof k?x.x:Y7(x.x),y:x.y instanceof k?x.y:Y7(x.y)})),f=JK(w,R,I);if(K.verifications.polygons.push({element:q.tagName,clipPathId:j,...f}),f.valid)K.verifications.passed++;else K.verifications.failed++,K.verifications.allPassed=!1;let u=QK(w,R);K.clipOutsideFragments.push({elementId:q.getAttribute("id")||`clip-${H}`,clipPathId:j,fragments:u,visible:!1});let m=Z.e2eTolerance||"1e-10",S=HK(w,I,u,m);if(K.verifications.e2e.push({element:q.tagName,clipPathId:j,type:"clip-area-conservation",...S}),S.valid)K.verifications.passed++;else K.verifications.failed++,K.verifications.allPassed=!1}if(X&&X.length>2){let I=h9(X,Z.precision),f=q;if(q.tagName==="path")q.setAttribute("d",I);else{let u=new B0("path",{d:I,...n6(q)});if(q.parentNode)q.parentNode.replaceChild(u,q),f=u}f.removeAttribute("clip-path"),H++}}catch(_){Q.push(`clipPath: ${_.message}`)}}return{count:H,errors:Q}}function hH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("flattenAllTransforms: invalid root element");if(!J||typeof J!=="object")throw new Error("flattenAllTransforms: opts must be an object");if(!Z||typeof Z!=="object")throw new Error("flattenAllTransforms: stats must be an object");let K=[],Q=0,H=u7($,"transform");for(let z of H){let q=z.getAttribute("transform");if(!q)continue;try{let W=F7(q),j=x9(W);if(Z.verifications.matrices.push({element:z.tagName,transform:q,...j}),j.valid)Z.verifications.passed++;else Z.verifications.failed++,Z.verifications.allPassed=!1;let G=R6(z,J.precision);if(!G){if(z.tagName==="g")yH(z,W,J,Z),z.removeAttribute("transform"),Q++;continue}let F=[],_=a7(G,4);if(_&&_.length>0)F=_.slice(0,4).map((V)=>({x:V.x instanceof k?V.x:Y7(V.x),y:V.y instanceof k?V.y:Y7(V.y)}));let U=Y6(G,W,{precision:J.precision});for(let V=0;V<F.length;V++){let M=F[V],Y=$K(W,M.x,M.y);if(Z.verifications.transforms.push({element:z.tagName,pointIndex:V,...Y}),Y.valid)Z.verifications.passed++;else Z.verifications.failed++,Z.verifications.allPassed=!1}let O=z;if(z.tagName==="path")z.setAttribute("d",U);else{let V=new B0("path",{d:U,...n6(z)});for(let M of mH(z.tagName))V.removeAttribute(M);if(z.parentNode)z.parentNode.replaceChild(V,z),O=V}O.removeAttribute("transform"),Q++}catch(W){K.push(`transform: ${W.message}`)}}return{count:Q,errors:K}}function yH($,J,Z,K){if(!$||!$.children)throw new Error("propagateTransformToChildren: invalid group element");if(!J||!J.data)throw new Error("propagateTransformToChildren: invalid matrix");if(!Z||typeof Z!=="object")throw new Error("propagateTransformToChildren: opts must be an object");if(!K||typeof K!=="object")throw new Error("propagateTransformToChildren: stats must be an object");for(let Q of[...$.children]){if(!(Q&&Q.tagName))continue;if(Q.tagName==="g"){let H=Q.getAttribute("transform");if(H){let z=F7(H),q=J.mul(z);Q.setAttribute("transform",VK(q))}else Q.setAttribute("transform",VK(J))}else{let H=R6(Q,Z.precision);if(H){let z=Q.getAttribute("transform"),q=J;if(z){let F=F7(z);q=J.mul(F)}let W=x9(q);if(K.verifications.matrices.push({element:Q.tagName,context:"group-propagation",...W}),W.valid)K.verifications.passed++;else K.verifications.failed++,K.verifications.allPassed=!1;let j=Y6(H,q,{precision:Z.precision}),G=Q;if(Q.tagName==="path")Q.setAttribute("d",j);else{let F=new B0("path",{d:j,...n6(Q)});$.replaceChild(F,Q),G=F}G.removeAttribute("transform")}}}}function uH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("bakeAllGradientTransforms: invalid root element");if(!J||typeof J!=="object")throw new Error("bakeAllGradientTransforms: opts must be an object");if(!Z||typeof Z!=="object")throw new Error("bakeAllGradientTransforms: stats must be an object");let K=[],Q=0,H=$.getElementsByTagName("linearGradient");for(let q of H){let W=q.getAttribute("gradientTransform");if(!W)continue;try{let j=F7(W),G=parseFloat(q.getAttribute("x1")||"0"),F=parseFloat(q.getAttribute("y1")||"0"),_=parseFloat(q.getAttribute("x2")||"1"),U=parseFloat(q.getAttribute("y2")||"0");if(isNaN(G)||isNaN(F)||isNaN(_)||isNaN(U)){K.push(`linearGradient: invalid coordinate values for gradient ${q.getAttribute("id")||"unknown"}`);continue}let[O,V]=c0(j,G,F),[M,Y]=c0(j,_,U),X=KK({x1:G,y1:F,x2:_,y2:U},{x1:O.toNumber(),y1:V.toNumber(),x2:M.toNumber(),y2:Y.toNumber()},j);if(Z.verifications.gradients.push({gradientId:q.getAttribute("id")||"unknown",type:"linear",...X}),X.valid)Z.verifications.passed++;else Z.verifications.failed++,Z.verifications.allPassed=!1;q.setAttribute("x1",O.toFixed(J.precision)),q.setAttribute("y1",V.toFixed(J.precision)),q.setAttribute("x2",M.toFixed(J.precision)),q.setAttribute("y2",Y.toFixed(J.precision)),q.removeAttribute("gradientTransform"),Q++}catch(j){K.push(`linearGradient: ${j.message}`)}}let z=$.getElementsByTagName("radialGradient");for(let q of z){let W=q.getAttribute("gradientTransform");if(!W)continue;try{let j=F7(W),G=parseFloat(q.getAttribute("cx")||"0.5"),F=parseFloat(q.getAttribute("cy")||"0.5"),_=parseFloat(q.getAttribute("fx")||G.toString()),U=parseFloat(q.getAttribute("fy")||F.toString()),O=parseFloat(q.getAttribute("r")||"0.5");if(isNaN(G)||isNaN(F)||isNaN(_)||isNaN(U)||isNaN(O)){K.push(`radialGradient: invalid coordinate/radius values for gradient ${q.getAttribute("id")||"unknown"}`);continue}if(O<=0){K.push(`radialGradient: radius must be positive for gradient ${q.getAttribute("id")||"unknown"}`);continue}let[V,M]=c0(j,G,F),[Y,X]=c0(j,_,U),w=j.data[0][0].toNumber()*j.data[1][1].toNumber();if(Math.abs(w)<0.0000000001){K.push("radialGradient: matrix determinant too close to zero (degenerate transform)");continue}let R=Math.sqrt(Math.abs(w)),I=O*R;q.setAttribute("cx",V.toFixed(J.precision)),q.setAttribute("cy",M.toFixed(J.precision)),q.setAttribute("fx",Y.toFixed(J.precision)),q.setAttribute("fy",X.toFixed(J.precision)),q.setAttribute("r",I.toFixed(J.precision)),q.removeAttribute("gradientTransform"),Q++}catch(j){K.push(`radialGradient: ${j.message}`)}}return{count:Q,errors:K}}function gH($){if(!$||!$.getElementsByTagName)throw new Error("collectAllReferences: invalid root element");let J=new Set,Z=(K)=>{if(!K||!K.getAttributeNames)return;if(K.tagName&&K.tagName.toLowerCase()==="style"){let Q=K.textContent||"";if(Q)l6(Q).forEach((z)=>J.add(z))}for(let Q of K.getAttributeNames()){let H=K.getAttribute(Q);if(!H)continue;if(H.includes("url(")){let z=r7(H);if(z)J.add(z)}if(Q==="href"||Q==="xlink:href"){let z=H.replace(/^#/,"");if(z&&z!==H)J.add(z)}}for(let Q of K.children)if(Q&&Q.tagName)Z(Q)};return Z($),J}function xH($,J){if(!$||!$.getElementsByTagName)throw new Error("removeUnusedDefinitions: invalid root element");if(!J||!(J instanceof Set))throw new Error("removeUnusedDefinitions: referencedIds must be a Set");let Z=0;function K(H){if(!H||!H.getAttribute)return!1;let z=H.getAttribute("id");if(z&&J.has(z))return!0;for(let q of H.children||[])if(q&&q.tagName&&K(q))return!0;return!1}let Q=$.getElementsByTagName("defs");for(let H of Q)for(let z of[...H.children])if(z&&z.tagName){let q=z.tagName.toLowerCase();if(XK.has(q))continue;if(!K(z))H.removeChild(z),Z++}return{count:Z}}function R6($,J){if(!$||!$.tagName)return null;if(typeof J!=="number"||isNaN(J)||J<0)throw new Error(`getElementPathData: precision must be a non-negative number, got ${J}`);let Z=$.tagName.toLowerCase();if(Z==="path")return $.getAttribute("d");let K=(Q,H=0)=>{let z=$.getAttribute(Q);if(z===null)return H;let q=parseFloat(z);if(isNaN(q))throw new Error(`getElementPathData: invalid numeric value "${z}" for attribute "${Q}"`);return q};switch(Z){case"rect":{let H=$.getAttribute("ry")!==null?K("ry"):null;return w9(K("x"),K("y"),K("width"),K("height"),K("rx"),H,!1,J)}case"circle":return k9(K("cx"),K("cy"),K("r"),J);case"ellipse":return L9(K("cx"),K("cy"),K("rx"),K("ry"),J);case"line":return R9(K("x1"),K("y1"),K("x2"),K("y2"),J);case"polyline":return L$($.getAttribute("points")||"",J);case"polygon":return B9($.getAttribute("points")||"",J);default:return null}}function kK($){if(!$||!$.tagName)return null;let J=R6($,6);if(!J)return null;try{let Z=a7(J,10);if(!Z||Z.length===0)return null;let K=1/0,Q=1/0,H=-1/0,z=-1/0;for(let q of Z){if(!q||q.x===void 0&&q.y===void 0)continue;let W=q.x instanceof k?q.x.toNumber():typeof q.x==="number"?q.x:0,j=q.y instanceof k?q.y.toNumber():typeof q.y==="number"?q.y:0;if(isNaN(W)||isNaN(j))continue;if(W<K)K=W;if(j<Q)Q=j;if(W>H)H=W;if(j>z)z=j}if(K===1/0||H===-1/0||Q===1/0||z===-1/0)return null;return{x:K,y:Q,width:H-K,height:z-Q}}catch{return null}}function n6($){if(!$||!$.getAttribute)return{};let J=["stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","vector-effect","fill","fill-opacity","fill-rule","clip-path","mask","filter","opacity","clip-rule","marker","marker-start","marker-mid","marker-end","visibility","display","color","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","alignment-baseline","letter-spacing","word-spacing","text-decoration","shape-rendering","text-rendering","image-rendering","color-rendering","paint-order","pointer-events","cursor","class","style","id"],Z={};for(let K of J){let Q=$.getAttribute(K);if(Q!==null)Z[K]=Q}return Z}function mH($){if(!$||typeof $!=="string")return[];return{rect:["x","y","width","height","rx","ry"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],polyline:["points"],polygon:["points"],image:["x","y","width","height","href","xlink:href","preserveAspectRatio"]}[$.toLowerCase()]||[]}function VK($){if(!$||!$.data||!Array.isArray($.data))throw new Error("matrixToTransform: invalid matrix");if(!$.data[0]||!$.data[1]||!$.data[0][0]||!$.data[0][1]||!$.data[0][2]||!$.data[1][0]||!$.data[1][1]||!$.data[1][2])throw new Error("matrixToTransform: matrix is missing required elements");let J=$.data[0][0].toNumber(),Z=$.data[1][0].toNumber(),K=$.data[0][1].toNumber(),Q=$.data[1][1].toNumber(),H=$.data[0][2].toNumber(),z=$.data[1][2].toNumber();if(!isFinite(J)||!isFinite(Z)||!isFinite(K)||!isFinite(Q)||!isFinite(H)||!isFinite(z))throw new Error("matrixToTransform: matrix contains non-finite values");return`matrix(${J} ${Z} ${K} ${Q} ${H} ${z})`}function LK($,J){if(!$||$.length<3||!J||J.length<3)return $;if(A7&&P7)try{return P7($,J)}catch(K){}let Z=[...$];for(let K=0;K<J.length;K++){if(Z.length===0)break;let Q=Z;Z=[];let H=J[K],z=J[(K+1)%J.length];for(let q=0;q<Q.length;q++){let W=Q[q],j=Q[(q+1)%Q.length],G=MK(W,H,z),F=MK(j,H,z);if(G){if(Z.push(W),!F)Z.push(OK(W,j,H,z))}else if(F)Z.push(OK(W,j,H,z))}}return Z}function MK($,J,Z){if(!$||$.x===void 0&&$.y===void 0)throw new Error("isInsideEdge: invalid point");if(!J||J.x===void 0&&J.y===void 0)throw new Error("isInsideEdge: invalid edgeStart");if(!Z||Z.x===void 0&&Z.y===void 0)throw new Error("isInsideEdge: invalid edgeEnd");let K=$.x instanceof k?$.x.toNumber():$.x||0,Q=$.y instanceof k?$.y.toNumber():$.y||0,H=J.x instanceof k?J.x.toNumber():J.x||0,z=J.y instanceof k?J.y.toNumber():J.y||0,q=Z.x instanceof k?Z.x.toNumber():Z.x||0,W=Z.y instanceof k?Z.y.toNumber():Z.y||0;return(q-H)*(Q-z)-(W-z)*(K-H)>=0}function OK($,J,Z,K){if(!$||$.x===void 0&&$.y===void 0)throw new Error("lineIntersect: invalid p1");if(!J||J.x===void 0&&J.y===void 0)throw new Error("lineIntersect: invalid p2");if(!Z||Z.x===void 0&&Z.y===void 0)throw new Error("lineIntersect: invalid p3");if(!K||K.x===void 0&&K.y===void 0)throw new Error("lineIntersect: invalid p4");let Q=$.x instanceof k?$.x.toNumber():$.x||0,H=$.y instanceof k?$.y.toNumber():$.y||0,z=J.x instanceof k?J.x.toNumber():J.x||0,q=J.y instanceof k?J.y.toNumber():J.y||0,W=Z.x instanceof k?Z.x.toNumber():Z.x||0,j=Z.y instanceof k?Z.y.toNumber():Z.y||0,G=K.x instanceof k?K.x.toNumber():K.x||0,F=K.y instanceof k?K.y.toNumber():K.y||0,_=(Q-z)*(j-F)-(H-q)*(W-G);if(Math.abs(_)<0.0000000001)return{x:Y7((Q+z)/2),y:Y7((H+q)/2)};let U=((Q-W)*(j-F)-(H-j)*(W-G))/_;return{x:Y7(Q+U*(z-Q)),y:Y7(H+U*(q-H))}}var q6=new Set(["clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cursor","direction","dominant-baseline","fill","fill-opacity","fill-rule","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-orientation-horizontal","glyph-orientation-vertical","image-rendering","letter-spacing","marker","marker-end","marker-mid","marker-start","paint-order","pointer-events","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-rendering","visibility","word-spacing","writing-mode"]);var s6={animation:new Set(["animate","animateColor","animatecolor","animateMotion","animatemotion","animateTransform","animatetransform","set"]),descriptive:new Set(["desc","metadata","title"]),shape:new Set(["circle","ellipse","line","path","polygon","polyline","rect"]),structural:new Set(["defs","g","svg","symbol","use"]),paintServer:new Set(["hatch","linearGradient","lineargradient","meshGradient","meshgradient","pattern","radialGradient","radialgradient","solidColor","solidcolor"]),nonRendering:new Set(["clipPath","clippath","filter","linearGradient","lineargradient","marker","mask","pattern","radialGradient","radialgradient","solidColor","solidcolor","symbol"]),container:new Set(["a","defs","g","marker","mask","pattern","svg","switch","symbol"]),textContent:new Set(["altGlyph","altGlyphDef","altGlyphItem","glyph","glyphRef","text","textPath","tref","tspan"]),filterPrimitive:new Set(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),lightSource:new Set(["feDistantLight","fePointLight","feSpotLight"])};var o6={svg:new Set(["a","altGlyphDef","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),g:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),defs:new Set(["a","altGlyphDef","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view","meshgradient","meshGradient","hatch","solidcolor","solidColor"]),symbol:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),marker:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),clipPath:new Set(["animate","animateColor","animateMotion","animateTransform","circle","desc","ellipse","line","metadata","path","polygon","polyline","rect","set","text","title","use"]),mask:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),pattern:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),a:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),switch:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","cursor","desc","ellipse","foreignObject","g","image","line","metadata","path","polygon","polyline","rect","set","svg","switch","text","title","use","view"]),text:new Set(["a","altGlyph","animate","animateColor","animateMotion","animateTransform","desc","metadata","set","textPath","title","tref","tspan"]),textPath:new Set(["a","altGlyph","animate","animateColor","desc","metadata","set","title","tref","tspan"]),tspan:new Set(["a","altGlyph","animate","animateColor","desc","metadata","set","title","tref","tspan"]),linearGradient:new Set(["animate","animateTransform","desc","metadata","set","stop","title"]),radialGradient:new Set(["animate","animateTransform","desc","metadata","set","stop","title"]),meshgradient:new Set(["animate","animateTransform","desc","metadata","meshrow","set","title"]),meshGradient:new Set(["animate","animateTransform","desc","metadata","meshrow","set","title"]),meshrow:new Set(["meshpatch"]),meshpatch:new Set(["stop"]),hatch:new Set(["animate","animateTransform","desc","hatchpath","hatchPath","metadata","script","set","style","title"]),hatchpath:new Set(["animate","animateTransform","desc","metadata","script","set","title"]),hatchPath:new Set(["animate","animateTransform","desc","metadata","script","set","title"]),filter:new Set(["animate","animateTransform","desc","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","metadata","set","title"]),feBlend:new Set(["animate","set"]),feColorMatrix:new Set(["animate","set"]),feComponentTransfer:new Set(["feFuncA","feFuncB","feFuncG","feFuncR"]),feComposite:new Set(["animate","set"]),feConvolveMatrix:new Set(["animate","set"]),feDiffuseLighting:new Set(["animate","feDistantLight","fePointLight","feSpotLight","set"]),feDisplacementMap:new Set(["animate","set"]),feDropShadow:new Set(["animate","set"]),feFlood:new Set(["animate","set"]),feFuncA:new Set(["animate","set"]),feFuncB:new Set(["animate","set"]),feFuncG:new Set(["animate","set"]),feFuncR:new Set(["animate","set"]),feGaussianBlur:new Set(["animate","set"]),feImage:new Set(["animate","set"]),feMerge:new Set(["feMergeNode"]),feMergeNode:new Set(["animate","set"]),feMorphology:new Set(["animate","set"]),feOffset:new Set(["animate","set"]),feSpecularLighting:new Set(["animate","feDistantLight","fePointLight","feSpotLight","set"]),feTile:new Set(["animate","set"]),feTurbulence:new Set(["animate","set"]),animate:new Set(["desc","metadata","title"]),animateColor:new Set(["desc","metadata","title"]),animateMotion:new Set(["desc","metadata","mpath","title"]),animateTransform:new Set(["desc","metadata","title"]),set:new Set(["desc","metadata","title"]),circle:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),ellipse:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),line:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),path:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),polygon:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),polyline:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),rect:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),image:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),use:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),title:new Set([]),desc:new Set([]),metadata:new Set([]),feDistantLight:new Set(["animate","set"]),fePointLight:new Set(["animate","set"]),feSpotLight:new Set(["animate","set"]),stop:new Set(["animate","set"]),solidColor:new Set(["animate","animateColor","animateTransform","desc","metadata","set","title"]),solidcolor:new Set(["animate","animateColor","animateTransform","desc","metadata","set","title"]),tref:new Set(["animate","animateColor","desc","metadata","set","title"]),altGlyph:new Set(["animate","animateColor","desc","metadata","set","title"]),altGlyphDef:new Set(["altGlyphItem"]),altGlyphItem:new Set(["glyphRef","altGlyphItem"]),glyph:new Set(["animate","animateColor","animateMotion","animateTransform","circle","desc","ellipse","line","metadata","path","polygon","polyline","rect","set","title","use"]),glyphRef:new Set([]),foreignObject:new Set([]),style:new Set([]),script:new Set([]),view:new Set(["desc","metadata","title"]),mpath:new Set(["desc","metadata","title"])},wK={userAction:new Set([":hover",":active",":focus",":focus-within",":focus-visible"]),treeStructural:new Set([":root",":empty",":first-child",":last-child",":only-child",":first-of-type",":last-of-type",":only-of-type",":nth-child",":nth-last-child",":nth-of-type",":nth-last-of-type"]),link:new Set([":link",":visited",":any-link",":local-link",":target"]),input:new Set([":enabled",":disabled",":read-only",":read-write",":placeholder-shown",":default",":checked",":indeterminate",":valid",":invalid",":in-range",":out-of-range",":required",":optional"]),linguistic:new Set([":lang",":dir"]),functional:new Set([":not",":is",":where",":has"]),preventInlining:new Set([":hover",":active",":focus",":focus-within",":focus-visible",":visited",":target",":lang",":dir",":not",":is",":where",":has"])};k.set({precision:20,rounding:k.ROUND_HALF_UP});var p9={linear:[0,0,1,1],ease:[0.25,0.1,0.25,1],"ease-in":[0.42,0,1,1],"ease-out":[0,0,0.58,1],"ease-in-out":[0.42,0,0.58,1]};function i6($,J=3){if($===null||$===void 0)throw new Error("formatSplineValue: value parameter is required");if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("formatSplineValue: precision must be a non-negative finite number");let Z=typeof $==="number"?$:parseFloat($);if(!Number.isFinite(Z))throw new Error(`formatSplineValue: value must be a finite number, got ${$}`);let H=new k($).toDecimalPlaces(J).toString();if(H.includes("."))H=H.replace(/\.?0+$/,"");if(H.startsWith("0."))H=H.substring(1);else if(H.startsWith("-0."))H="-"+H.substring(2);if(H===""||H==="."||H==="-0")H="0";return H}function f$($){if(!$||typeof $!=="string")return[];return $.split(";").map((Z)=>Z.trim()).filter((Z)=>Z).map((Z)=>{let K=Z.split(/[\s,]+/).map((Q)=>parseFloat(Q)).filter((Q)=>Number.isFinite(Q));if(K.length!==4)throw new Error(`parseKeySplines: invalid spline "${Z}", expected 4 values, got ${K.length}`);return K})}function c9($,J=3){if(!Array.isArray($))throw new Error("serializeKeySplines: splines must be an array");if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("serializeKeySplines: precision must be a non-negative finite number");return $.map((Z,K)=>{if(!Array.isArray(Z))throw new Error(`serializeKeySplines: spline at index ${K} must be an array`);if(Z.length!==4)throw new Error(`serializeKeySplines: spline at index ${K} must have exactly 4 values, got ${Z.length}`);return Z.map((Q)=>i6(Q,J)).join(" ")}).join("; ")}function S$($,J=0.001){if(!Array.isArray($)||$.length!==4)return!1;if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("isLinearSpline: tolerance must be a non-negative finite number");let[Z,K,Q,H]=$;if(!Number.isFinite(Z)||!Number.isFinite(K)||!Number.isFinite(Q)||!Number.isFinite(H))return!1;return Math.abs(Z)<J&&Math.abs(K)<J&&Math.abs(Q-1)<J&&Math.abs(H-1)<J}function RK($){let J=f$($);if(J.length===0)return!1;return J.every((Z)=>S$(Z))}function l9($,J=0.01){if(!Array.isArray($)||$.length!==4)return null;if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("identifyStandardEasing: tolerance must be a non-negative finite number");if(!$.every((Z)=>Number.isFinite(Z)))return null;for(let[Z,K]of Object.entries(p9))if($.every((H,z)=>Math.abs(H-K[z])<J))return Z;return null}function n9($,J={}){let Z=J.precision??3,K=J.removeLinear!==!1,Q=f$($);if(Q.length===0)return{value:null,allLinear:!1,standardEasings:[]};let H=Q.every((W)=>S$(W)),z=Q.map((W)=>l9(W)).filter(Boolean);if(H&&K)return{value:null,allLinear:!0,standardEasings:z};return{value:c9(Q,Z),allLinear:H,standardEasings:z}}function dH($){if(!$||typeof $!=="string")return[];return $.split(";").map((J)=>parseFloat(J.trim())).filter((J)=>Number.isFinite(J))}function pH($,J=3){if(!Array.isArray($))throw new Error("serializeKeyTimes: times must be an array");if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("serializeKeyTimes: precision must be a non-negative finite number");if($.length===0)return"";return $.map((Z)=>i6(Z,J)).join("; ")}function s9($,J=3){if($===null||$===void 0)throw new Error("optimizeKeyTimes: keyTimes parameter is required");if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("optimizeKeyTimes: precision must be a non-negative finite number");let Z=dH($);if(Z.length===0)return $;return pH(Z,J)}function b$($,J=3){if(!$||typeof $!=="string")return $;if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("optimizeAnimationValues: precision must be a non-negative finite number");let Z=$.split(";");if(Z.length===0)return $;return Z.map((Q)=>{let H=Q.trim();if(H.startsWith("#")||H.includes("url("))return H;return H.split(/[\s,]+/).filter((W)=>W).map((W)=>{let j=parseFloat(W);if(!Number.isFinite(j))return W;return i6(j,J)}).join(" ")}).join("; ")}function cH($,J={}){if(!$||typeof $!=="object")throw new Error("optimizeElementTiming: el parameter must be a valid element");if(typeof $.getAttribute!=="function"||typeof $.setAttribute!=="function"||typeof $.removeAttribute!=="function")throw new Error("optimizeElementTiming: el parameter must have getAttribute, setAttribute, and removeAttribute methods");let Z=J.precision??3,K=J.removeLinearSplines!==!1,Q=J.optimizeValues!==!1;if(typeof Z!=="number"||Z<0||!Number.isFinite(Z))throw new Error("optimizeElementTiming: options.precision must be a non-negative finite number");let H=[],z=!1,q=$.getAttribute("keySplines");if(q){let j=n9(q,{precision:Z,removeLinear:K});if(j.allLinear&&K){if($.getAttribute("calcMode")==="spline")$.setAttribute("calcMode","linear"),$.removeAttribute("keySplines"),H.push('Converted linear splines to calcMode="linear"'),z=!0}else if(j.value&&j.value!==q)$.setAttribute("keySplines",j.value),H.push(`keySplines: "${q}" -> "${j.value}"`),z=!0}let W=$.getAttribute("keyTimes");if(W){let j=s9(W,Z);if(j!==W)$.setAttribute("keyTimes",j),H.push(`keyTimes: "${W}" -> "${j}"`),z=!0}if(Q){let j=$.getAttribute("values");if(j){let G=b$(j,Z);if(G!==j)$.setAttribute("values",G),H.push(`values: "${j}" -> "${G}"`),z=!0}}for(let j of["from","to","by"]){let G=$.getAttribute(j);if(G){let F=b$(G,Z);if(F!==G)$.setAttribute(j,F),H.push(`${j}: "${G}" -> "${F}"`),z=!0}}return{modified:z,changes:H}}var lH=["animate","animatetransform","animatemotion","animatecolor","set"];function BK($,J={}){if(!$||typeof $!=="object")throw new Error("optimizeDocumentAnimationTiming: root parameter must be a valid element");let Z=0,K=0,Q=[],H=(z)=>{if(!z||typeof z!=="object")return;let q=z.tagName?.toLowerCase();if(!q)return;if(lH.includes(q)){let j=cH(z,J);if(j.modified)Z++,K+=j.changes.length,Q.push({element:q,id:z.getAttribute("id")||null,changes:j.changes})}let W=z.children||[];for(let j of W)H(j)};return H($),{elementsModified:Z,totalChanges:K,details:Q}}k.set({precision:80});var i9={M:2,m:2,L:2,l:2,H:1,h:1,V:1,v:1,C:6,c:6,S:4,s:4,Q:4,q:4,T:2,t:2,A:7,a:7,Z:0,z:0};function nH($){if(typeof $!=="string")throw new TypeError(`parseArcArgs: argsStr must be a string, got ${typeof $}`);let J=[],Z=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,K=0,Q=0;while(K<$.length){while(K<$.length&&/[\s,]/.test($[K]))K++;if(K>=$.length)break;let H=Q%7;if(H===3||H===4)if($[K]==="0"||$[K]==="1")J.push($[K]==="1"?1:0),K++,Q++;else return null;else{Z.lastIndex=K;let z=Z.exec($);if(z&&z.index===K)J.push(parseFloat(z[0])),K=Z.lastIndex,Q++;else K++}}return J}function l0($){if(!$||typeof $!=="string")return[];let J=[],Z=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,K;while((K=Z.exec($))!==null){let Q=K[1],H=K[2].trim();if(Q==="Z"||Q==="z"){J.push({command:"Z",args:[]});let W=H.match(/-?\d*\.?\d+(?:[eE][+-]?\d+)?/g);if(W&&W.length>=2){J.push({command:"M",args:[parseFloat(W[0]),parseFloat(W[1])]});for(let j=2;j+1<W.length;j+=2)J.push({command:"L",args:[parseFloat(W[j]),parseFloat(W[j+1])]})}continue}let z;if(Q==="A"||Q==="a"){if(z=nH(H),z===null){console.warn(`Invalid arc command with malformed flags - skipping: ${Q}${H}`);continue}for(let W=0;W<z.length;W+=7)if(W+6<z.length)z[W]=Math.abs(z[W]),z[W+1]=Math.abs(z[W+1])}else{let W=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g;z=[];let j;while((j=W.exec(H))!==null)z.push(parseFloat(j[0]))}let q=i9[Q];if(q===void 0){console.warn(`Unknown SVG path command '${Q}' - skipping`);continue}if(q===0||z.length===0)J.push({command:Q,args:[]});else for(let W=0;W<z.length;W+=q){let j=z.slice(W,W+q);if(j.length===q){let G=W>0&&(Q==="M"||Q==="m")?Q==="M"?"L":"l":Q;J.push({command:G,args:j})}else if(j.length>0)console.warn(`Incomplete ${Q} command: expected ${q} args, got ${j.length} - remaining args dropped`)}}return J}function T7($,J=3){if(typeof $!=="number")throw new TypeError(`formatNumber: num must be a number, got ${typeof $}`);if(typeof J!=="number"||!Number.isInteger(J)||J<0)throw new TypeError(`formatNumber: precision must be a non-negative integer, got ${J}`);if(!isFinite($))return"0";if($===0)return"0";let Z=Math.pow(10,J),Q=(Math.round($*Z)/Z).toFixed(J);if(Q.includes("."))Q=Q.replace(/\.?0+$/,"");if(Q.startsWith("0."))Q=Q.substring(1);else if(Q.startsWith("-0."))Q="-"+Q.substring(2);if(Q===""||Q==="."||Q==="-.")Q="0";return Q}function X7($,J,Z){if(!$||typeof $!=="object")throw new TypeError(`toAbsolute: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`toAbsolute: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("toAbsolute: cmd.args must be an array");if(typeof J!=="number"||!isFinite(J))throw new TypeError(`toAbsolute: cx must be a finite number, got ${J}`);if(typeof Z!=="number"||!isFinite(Z))throw new TypeError(`toAbsolute: cy must be a finite number, got ${Z}`);let{command:K,args:Q}=$;if(K===K.toUpperCase()){if(i9[K]===void 0)throw new TypeError(`toAbsolute: unknown command '${K}'`);return $}let H=K.toUpperCase(),z=[...Q];switch(K){case"m":case"l":case"t":if(z.length<2)throw new RangeError(`toAbsolute: command ${K} requires at least 2 args, got ${z.length}`);z[0]+=J,z[1]+=Z;break;case"h":if(z.length<1)throw new RangeError(`toAbsolute: command ${K} requires at least 1 arg, got ${z.length}`);z[0]+=J;break;case"v":if(z.length<1)throw new RangeError(`toAbsolute: command ${K} requires at least 1 arg, got ${z.length}`);z[0]+=Z;break;case"c":if(z.length<6)throw new RangeError(`toAbsolute: command ${K} requires at least 6 args, got ${z.length}`);z[0]+=J,z[1]+=Z,z[2]+=J,z[3]+=Z,z[4]+=J,z[5]+=Z;break;case"s":case"q":if(z.length<4)throw new RangeError(`toAbsolute: command ${K} requires at least 4 args, got ${z.length}`);z[0]+=J,z[1]+=Z,z[2]+=J,z[3]+=Z;break;case"a":if(z.length<7)throw new RangeError(`toAbsolute: command ${K} requires at least 7 args, got ${z.length}`);z[5]+=J,z[6]+=Z;break;default:throw new TypeError(`toAbsolute: unsupported command '${K}' for conversion`)}return{command:H,args:z}}function r9($,J,Z){if(!$||typeof $!=="object")throw new TypeError(`toRelative: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`toRelative: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("toRelative: cmd.args must be an array");if(typeof J!=="number"||!isFinite(J))throw new TypeError(`toRelative: cx must be a finite number, got ${J}`);if(typeof Z!=="number"||!isFinite(Z))throw new TypeError(`toRelative: cy must be a finite number, got ${Z}`);let{command:K,args:Q}=$;if(K===K.toLowerCase()&&K!=="z"){if(i9[K]===void 0)throw new TypeError(`toRelative: unknown command '${K}'`);return $}if(K==="Z"||K==="z")return{command:"z",args:[]};let H=K.toLowerCase(),z=[...Q];switch(K){case"M":case"L":case"T":if(z.length<2)throw new RangeError(`toRelative: command ${K} requires at least 2 args, got ${z.length}`);z[0]-=J,z[1]-=Z;break;case"H":if(z.length<1)throw new RangeError(`toRelative: command ${K} requires at least 1 arg, got ${z.length}`);z[0]-=J;break;case"V":if(z.length<1)throw new RangeError(`toRelative: command ${K} requires at least 1 arg, got ${z.length}`);z[0]-=Z;break;case"C":if(z.length<6)throw new RangeError(`toRelative: command ${K} requires at least 6 args, got ${z.length}`);z[0]-=J,z[1]-=Z,z[2]-=J,z[3]-=Z,z[4]-=J,z[5]-=Z;break;case"S":case"Q":if(z.length<4)throw new RangeError(`toRelative: command ${K} requires at least 4 args, got ${z.length}`);z[0]-=J,z[1]-=Z,z[2]-=J,z[3]-=Z;break;case"A":if(z.length<7)throw new RangeError(`toRelative: command ${K} requires at least 7 args, got ${z.length}`);z[5]-=J,z[6]-=Z;break;default:throw new TypeError(`toRelative: unsupported command '${K}' for conversion`)}return{command:H,args:z}}function sH($,J,Z,K=0.000001){if(!$||typeof $!=="object")throw new TypeError(`lineToHV: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`lineToHV: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("lineToHV: cmd.args must be an array");if(typeof J!=="number"||!isFinite(J))throw new TypeError(`lineToHV: cx must be a finite number, got ${J}`);if(typeof Z!=="number"||!isFinite(Z))throw new TypeError(`lineToHV: cy must be a finite number, got ${Z}`);if(typeof K!=="number"||!isFinite(K)||K<0)throw new TypeError(`lineToHV: tolerance must be a non-negative finite number, got ${K}`);let{command:Q,args:H}=$;if(Q!=="L"&&Q!=="l")return null;if(H.length<2)throw new RangeError(`lineToHV: command ${Q} requires at least 2 args, got ${H.length}`);let z=Q==="L",q=z?H[0]:J+H[0],W=z?H[1]:Z+H[1];if(Math.abs(W-Z)<K)return z?{command:"H",args:[q]}:{command:"h",args:[q-J]};if(Math.abs(q-J)<K)return z?{command:"V",args:[W]}:{command:"v",args:[W-Z]};return null}function oH($,J,Z,K,Q,H=0.000001){if(!$||typeof $!=="object")throw new TypeError(`lineToZ: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`lineToZ: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("lineToZ: cmd.args must be an array");if(typeof J!=="number"||!isFinite(J))throw new TypeError(`lineToZ: cx must be a finite number, got ${J}`);if(typeof Z!=="number"||!isFinite(Z))throw new TypeError(`lineToZ: cy must be a finite number, got ${Z}`);if(typeof K!=="number"||!isFinite(K))throw new TypeError(`lineToZ: startX must be a finite number, got ${K}`);if(typeof Q!=="number"||!isFinite(Q))throw new TypeError(`lineToZ: startY must be a finite number, got ${Q}`);if(typeof H!=="number"||!isFinite(H)||H<0)throw new TypeError(`lineToZ: tolerance must be a non-negative finite number, got ${H}`);let{command:z,args:q}=$;if(z!=="L"&&z!=="l")return!1;if(q.length<2)throw new RangeError(`lineToZ: command ${z} requires at least 2 args, got ${q.length}`);let W=z==="L",j=W?q[0]:J+q[0],G=W?q[1]:Z+q[1];return Math.abs(j-K)<H&&Math.abs(G-Q)<H}function iH($,J,Z,K,Q,H,z,q,W=0.5){let j={x0:$,y0:J,cp1x:Z,cp1y:K,cp2x:Q,cp2y:H,x3:z,y3:q,tolerance:W};for(let[O,V]of Object.entries(j))if(typeof V!=="number"||!isFinite(V))throw new TypeError(`isCurveStraight: ${O} must be a finite number, got ${V}`);if(W<0)throw new TypeError(`isCurveStraight: tolerance must be non-negative, got ${W}`);let G=(z-$)**2+(q-J)**2;if(G<0.0000000001){let O=Math.sqrt((Z-$)**2+(K-J)**2),V=Math.sqrt((Q-$)**2+(H-J)**2);return Math.max(O,V)<W}let F=Math.sqrt(G),_=Math.abs((q-J)*Z-(z-$)*K+z*J-q*$)/F,U=Math.abs((q-J)*Q-(z-$)*H+z*J-q*$)/F;return Math.max(_,U)<W}function rH($,J,Z,K=0.5){if(!$||typeof $!=="object")throw new TypeError(`straightCurveToLine: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`straightCurveToLine: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("straightCurveToLine: cmd.args must be an array");if(typeof J!=="number"||!isFinite(J))throw new TypeError(`straightCurveToLine: cx must be a finite number, got ${J}`);if(typeof Z!=="number"||!isFinite(Z))throw new TypeError(`straightCurveToLine: cy must be a finite number, got ${Z}`);if(typeof K!=="number"||!isFinite(K)||K<0)throw new TypeError(`straightCurveToLine: tolerance must be a non-negative finite number, got ${K}`);let{command:Q,args:H}=$;if(Q!=="C"&&Q!=="c")return null;if(H.length<6)throw new RangeError(`straightCurveToLine: command ${Q} requires at least 6 args, got ${H.length}`);let z=Q==="C",q=z?H[0]:J+H[0],W=z?H[1]:Z+H[1],j=z?H[2]:J+H[2],G=z?H[3]:Z+H[3],F=z?H[4]:J+H[4],_=z?H[5]:Z+H[5];if(iH(J,Z,q,W,j,G,F,_,K))return z?{command:"L",args:[F,_]}:{command:"l",args:[F-J,_-Z]};return null}function o9($,J,Z=3,K=!1){if(!$||typeof $!=="object")throw new TypeError(`serializeCommand: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`serializeCommand: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("serializeCommand: cmd.args must be an array");if(J!==null&&typeof J!=="string")throw new TypeError(`serializeCommand: prevCommand must be a string or null, got ${typeof J}`);if(typeof Z!=="number"||!Number.isInteger(Z)||Z<0)throw new TypeError(`serializeCommand: precision must be a non-negative integer, got ${Z}`);if(typeof K!=="boolean")throw new TypeError(`serializeCommand: prevLastArgHadDecimal must be a boolean, got ${typeof K}`);let{command:Q,args:H}=$;if(Q==="Z"||Q==="z")return{str:"z",lastArgHadDecimal:!1};if(Q==="A"||Q==="a"){if(H.length<7)throw new RangeError(`serializeCommand: arc command requires at least 7 args, got ${H.length}`);if(H.length>7)console.warn(`serializeCommand: arc command has ${H.length} args (expected 7) - only first 7 will be used`);let F=[T7(H[0],Z),T7(H[1],Z),T7(H[2],Z),H[3]?"1":"0",H[4]?"1":"0",T7(H[5],Z),T7(H[6],Z)].join(" ");return{str:Q+F,lastArgHadDecimal:F.includes(".")}}if(H.length===0)throw new RangeError(`serializeCommand: command ${Q} has empty args array (only Z/z should have no args)`);let z=H.map((F)=>T7(F,Z)),q="";for(let F=0;F<z.length;F++){let _=z[F];if(F===0)q=_;else{let O=z[F-1].includes(".");if(_.startsWith("-"))q+=_;else if(_.startsWith(".")&&O)q+=_;else q+=" "+_}}let j=(z[z.length-1]||"").includes("."),G=Q;if(J==="M"&&Q==="L")G="";else if(J==="m"&&Q==="l")G="";else if(J===Q&&Q!=="A"&&Q!=="a")G="";if(G)return{str:G+q,lastArgHadDecimal:j};else{let F=z[0]||"";if(F.startsWith("-"))return{str:q,lastArgHadDecimal:j};else if(F.startsWith(".")&&K)return{str:q,lastArgHadDecimal:j};else return{str:" "+q,lastArgHadDecimal:j}}}function n0($,J=3){if(!Array.isArray($))throw new TypeError(`serializePath: commands must be an array, got ${typeof $}`);if(typeof J!=="number"||!Number.isInteger(J)||J<0)throw new TypeError(`serializePath: precision must be a non-negative integer, got ${J}`);if($.length===0)return"";let Z="",K=null,Q=!1;for(let H of $){let{str:z,lastArgHadDecimal:q}=o9(H,K,J,Q);Z+=z,K=H.command,Q=q}return Z}function a9($,J={}){if(typeof $!=="string")throw new TypeError(`convertPathData: d must be a string, got ${typeof $}`);if(typeof J!=="object"||J===null||Array.isArray(J))throw new TypeError(`convertPathData: options must be an object, got ${typeof J}`);let{floatPrecision:Z=3,straightCurves:K=!0,lineShorthands:Q=!0,convertToZ:H=!0,utilizeAbsolute:z=!0,straightTolerance:q=0.5}=J;if(typeof Z!=="number"||!Number.isInteger(Z)||Z<0)throw new TypeError(`convertPathData: floatPrecision must be a non-negative integer, got ${Z}`);if(typeof K!=="boolean")throw new TypeError(`convertPathData: straightCurves must be a boolean, got ${typeof K}`);if(typeof Q!=="boolean")throw new TypeError(`convertPathData: lineShorthands must be a boolean, got ${typeof Q}`);if(typeof H!=="boolean")throw new TypeError(`convertPathData: convertToZ must be a boolean, got ${typeof H}`);if(typeof z!=="boolean")throw new TypeError(`convertPathData: utilizeAbsolute must be a boolean, got ${typeof z}`);if(typeof q!=="number"||!isFinite(q)||q<0)throw new TypeError(`convertPathData: straightTolerance must be a non-negative finite number, got ${q}`);let W=$.length,j=l0($);if(j.length===0)return{d:$,originalLength:W,optimizedLength:W,savings:0};let G=0,F=0,_=0,U=0,O=[];for(let M=0;M<j.length;M++){let Y=j[M];if(Y.command==="A"||Y.command==="a"){if(Y.args.length<7)console.warn(`Arc command has insufficient args (${Y.args.length} < 7) - skipping optimization`);else if(Y.args[0]===0||Y.args[1]===0){let w=Y.command==="A",R=Y.args[5],I=Y.args[6];Y=w?{command:"L",args:[R,I]}:{command:"l",args:[R,I]}}}if(K&&(Y.command==="C"||Y.command==="c")){let w=rH(Y,G,F,q);if(w)Y=w}if(Q&&(Y.command==="L"||Y.command==="l")){let w=sH(Y,G,F);if(w)Y=w}if(H&&(Y.command==="L"||Y.command==="l")){if(oH(Y,G,F,_,U))Y={command:"z",args:[]}}if(z&&Y.command!=="Z"&&Y.command!=="z"){let w=X7(Y,G,F),R=r9(Y,G,F),I=o9(w,null,Z);Y=o9(R,null,Z).str.length<I.str.length?R:w}O.push(Y);let X=X7(Y,G,F);switch(X.command){case"M":if(X.args.length>=2)G=X.args[0],F=X.args[1],_=G,U=F;break;case"L":case"T":if(X.args.length>=2)G=X.args[0],F=X.args[1];break;case"H":if(X.args.length>=1)G=X.args[0];break;case"V":if(X.args.length>=1)F=X.args[0];break;case"C":if(X.args.length>=6)G=X.args[4],F=X.args[5];break;case"S":case"Q":if(X.args.length>=4)G=X.args[2],F=X.args[3];break;case"A":if(X.args.length>=7)G=X.args[5],F=X.args[6];break;case"Z":G=_,F=U;break;default:break}}let V=n0(O,Z);return{d:V,originalLength:W,optimizedLength:V.length,savings:W-V.length}}function NK($,J={}){if(!$||typeof $!=="object")throw new TypeError(`optimizeDocumentPaths: root must be a DOM element object, got ${typeof $}`);if(typeof J!=="object"||J===null||Array.isArray(J))throw new TypeError(`optimizeDocumentPaths: options must be an object, got ${typeof J}`);let Z=0,K=0,Q=[],H=(z)=>{if(!z||typeof z!=="object")return;if(z.tagName?.toLowerCase()==="path"){let W=z.getAttribute("d");if(W){let j=a9(W,J);if(j.savings>0)z.setAttribute("d",j.d),Z++,K+=j.savings,Q.push({id:z.getAttribute("id")||null,originalLength:j.originalLength,optimizedLength:j.optimizedLength,savings:j.savings})}}for(let W of z.children||[])H(W)};return H($),{pathsOptimized:Z,totalSavings:K,details:Q}}function IK($,J,Z){if(!$||typeof $.x!=="number"||typeof $.y!=="number")throw new TypeError("perpendicularDistance: point must be an object with numeric x and y properties");if(!J||typeof J.x!=="number"||typeof J.y!=="number")throw new TypeError("perpendicularDistance: lineStart must be an object with numeric x and y properties");if(!Z||typeof Z.x!=="number"||typeof Z.y!=="number")throw new TypeError("perpendicularDistance: lineEnd must be an object with numeric x and y properties");if(!Number.isFinite($.x)||!Number.isFinite($.y)||!Number.isFinite(J.x)||!Number.isFinite(J.y)||!Number.isFinite(Z.x)||!Number.isFinite(Z.y))throw new RangeError("perpendicularDistance: all coordinates must be finite numbers");let K=Z.x-J.x,Q=Z.y-J.y,H=K*K+Q*Q;if(H<0.0000000001){let W=$.x-J.x,j=$.y-J.y;return Math.sqrt(W*W+j*j)}let z=Math.abs(Q*$.x-K*$.y+Z.x*J.y-Z.y*J.x),q=Math.sqrt(H);return z/q}function r6($,J){if(!Array.isArray($))throw new TypeError("douglasPeucker: points must be an array");if($.length===0)throw new RangeError("douglasPeucker: points array cannot be empty");for(let z=0;z<$.length;z++){let q=$[z];if(!q||typeof q!=="object")throw new TypeError(`douglasPeucker: point at index ${z} must be an object`);if(typeof q.x!=="number"||!Number.isFinite(q.x))throw new TypeError(`douglasPeucker: point at index ${z} must have a finite numeric x property`);if(typeof q.y!=="number"||!Number.isFinite(q.y))throw new TypeError(`douglasPeucker: point at index ${z} must have a finite numeric y property`)}if(typeof J!=="number"||!Number.isFinite(J))throw new TypeError("douglasPeucker: tolerance must be a finite number");if(J<0)throw new RangeError("douglasPeucker: tolerance cannot be negative");if(J>0&&J<0.0000000001)throw new RangeError("douglasPeucker: tolerance must be either 0 or >= 1e-10 to avoid numerical precision issues");if($.length<=2)return $;if($.length>1e4)return aH($,J);let Z=0,K=0,Q=$[0],H=$[$.length-1];for(let z=1;z<$.length-1;z++){let q=IK($[z],Q,H);if(q>Z)Z=q,K=z}if(Z>J){let z=r6($.slice(0,K+1),J),q=r6($.slice(K),J);return z.slice(0,-1).concat(q)}else return[Q,H]}function aH($,J){if($.length<=2)return $;let Z=new Array($.length).fill(!1);Z[0]=!0,Z[$.length-1]=!0;let K=[[0,$.length-1]];while(K.length>0){let[Q,H]=K.pop();if(H-Q<=1)continue;let z=0,q=Q,W=$[Q],j=$[H];for(let G=Q+1;G<H;G++){let F=IK($[G],W,j);if(F>z)z=F,q=G}if(z>J)Z[q]=!0,K.push([Q,q]),K.push([q,H])}return $.filter((Q,H)=>Z[H])}function t9($,J){if(!Array.isArray($))throw new TypeError("visvalingamWhyatt: points must be an array");if($.length===0)throw new RangeError("visvalingamWhyatt: points array cannot be empty");for(let q=0;q<$.length;q++){let W=$[q];if(!W||typeof W!=="object")throw new TypeError(`visvalingamWhyatt: point at index ${q} must be an object`);if(typeof W.x!=="number"||!Number.isFinite(W.x))throw new TypeError(`visvalingamWhyatt: point at index ${q} must have a finite numeric x property`);if(typeof W.y!=="number"||!Number.isFinite(W.y))throw new TypeError(`visvalingamWhyatt: point at index ${q} must have a finite numeric y property`)}if(typeof J!=="number"||!Number.isFinite(J))throw new TypeError("visvalingamWhyatt: minArea must be a finite number");if(J<0)throw new RangeError("visvalingamWhyatt: minArea cannot be negative");if($.length<=2)return $;let Z=(q,W,j)=>{return Math.abs((W.x-q.x)*(j.y-q.y)-(j.x-q.x)*(W.y-q.y))/2},K=$.map((q,W)=>({...q,index:W})),Q=new Array(K.length).fill(1/0);for(let q=1;q<K.length-1;q++)Q[q]=Z(K[q-1],K[q],K[q+1]);let H=new Array(K.length).fill(!0),z=K.length;while(z>2){let q=1/0,W=-1;for(let F=1;F<K.length-1;F++)if(H[F]&&Q[F]<q)q=Q[F],W=F;if(q>=J||W===-1)break;H[W]=!1,z--;let j=W-1;while(j>=0&&!H[j])j--;let G=W+1;while(G<K.length&&!H[G])G++;if(j>0){let F=j-1;while(F>=0&&!H[F])F--;if(F>=0&&G<K.length)Q[j]=Z(K[F],K[j],K[G])}if(G<K.length-1){let F=G+1;while(F<K.length&&!H[F])F++;if(F<K.length&&j>=0)Q[G]=Z(K[j],K[G],K[F])}}return K.filter((q,W)=>H[W])}function e9($,J,Z="douglas-peucker"){if(!Array.isArray($))throw new TypeError("simplifyPolyline: points must be an array");if($.length===0)throw new RangeError("simplifyPolyline: points array cannot be empty");if(typeof J!=="number"||!Number.isFinite(J))throw new TypeError("simplifyPolyline: tolerance must be a finite number");if(J<0)throw new RangeError("simplifyPolyline: tolerance cannot be negative");if(J>0&&J<0.0000000001)throw new RangeError("simplifyPolyline: tolerance must be either 0 or >= 1e-10 to avoid numerical precision issues");if(typeof Z!=="string")throw new TypeError("simplifyPolyline: algorithm must be a string");let K=["douglas-peucker","visvalingam"];if(!K.includes(Z))throw new RangeError(`simplifyPolyline: algorithm must be one of: ${K.join(", ")}`);if(Z==="visvalingam")return t9($,J*J);return r6($,J)}function tH($){if(!Array.isArray($))throw new TypeError("extractPolylinePoints: commands must be an array");let J=[],Z=0,K=0,Q=0,H=0;for(let z of $){if(!z||typeof z!=="object")throw new TypeError("extractPolylinePoints: each command must be an object");if(typeof z.command!=="string")throw new TypeError('extractPolylinePoints: each command must have a string "command" property');if(!Array.isArray(z.args))throw new TypeError('extractPolylinePoints: each command must have an "args" array');let{command:q,args:W}=z,j=(F)=>{if(W.length<F)throw new RangeError(`extractPolylinePoints: command "${q}" requires at least ${F} arguments, got ${W.length}`)},G=(F)=>{if(typeof W[F]!=="number"||!Number.isFinite(W[F]))throw new TypeError(`extractPolylinePoints: command "${q}" argument at index ${F} must be a finite number, got ${W[F]}`)};switch(q){case"M":j(2),G(0),G(1),Z=W[0],K=W[1],Q=Z,H=K,J.push({x:Z,y:K});break;case"m":j(2),G(0),G(1),Z+=W[0],K+=W[1],Q=Z,H=K,J.push({x:Z,y:K});break;case"L":j(2),G(0),G(1),Z=W[0],K=W[1],J.push({x:Z,y:K});break;case"l":j(2),G(0),G(1),Z+=W[0],K+=W[1],J.push({x:Z,y:K});break;case"H":j(1),G(0),Z=W[0],J.push({x:Z,y:K});break;case"h":j(1),G(0),Z+=W[0],J.push({x:Z,y:K});break;case"V":j(1),G(0),K=W[0],J.push({x:Z,y:K});break;case"v":j(1),G(0),K+=W[0],J.push({x:Z,y:K});break;case"Z":case"z":if(Z!==Q||K!==H)J.push({x:Q,y:H});Z=Q,K=H;break;case"C":j(6),G(4),G(5),Z=W[4],K=W[5];break;case"c":j(6),G(4),G(5),Z+=W[4],K+=W[5];break;case"S":case"Q":j(4),G(2),G(3),Z=W[2],K=W[3];break;case"s":case"q":j(4),G(2),G(3),Z+=W[2],K+=W[3];break;case"T":j(2),G(0),G(1),Z=W[0],K=W[1];break;case"t":j(2),G(0),G(1),Z+=W[0],K+=W[1];break;case"A":j(7),G(5),G(6),Z=W[5],K=W[6];break;case"a":j(7),G(5),G(6),Z+=W[5],K+=W[6];break;default:break}}return J}function eH($,J=!1){if(!Array.isArray($))throw new TypeError("rebuildPathFromPoints: points must be an array");if($.length===0)return[];if(typeof J!=="boolean")throw new TypeError("rebuildPathFromPoints: closed must be a boolean");for(let K=0;K<$.length;K++){let Q=$[K];if(!Q||typeof Q!=="object")throw new TypeError(`rebuildPathFromPoints: point at index ${K} must be an object`);if(typeof Q.x!=="number"||!Number.isFinite(Q.x))throw new TypeError(`rebuildPathFromPoints: point at index ${K} must have a finite numeric x property`);if(typeof Q.y!=="number"||!Number.isFinite(Q.y))throw new TypeError(`rebuildPathFromPoints: point at index ${K} must have a finite numeric y property`)}let Z=[];Z.push({command:"M",args:[$[0].x,$[0].y]});for(let K=1;K<$.length;K++)Z.push({command:"L",args:[$[K].x,$[K].y]});if(J)Z.push({command:"Z",args:[]});return Z}function $8($){if(!Array.isArray($))throw new TypeError("isPurePolyline: commands must be an array");let J=new Set(["M","m","L","l","H","h","V","v","Z","z"]);return $.every((Z)=>{if(!Z||typeof Z!=="object"||typeof Z.command!=="string")return!1;return J.has(Z.command)})}function J8($,J,Z="douglas-peucker"){if(!Array.isArray($))throw new TypeError("simplifyPath: commands must be an array");if(typeof J!=="number"||!Number.isFinite(J))throw new TypeError("simplifyPath: tolerance must be a finite number");if(J<0)throw new RangeError("simplifyPath: tolerance cannot be negative");if(J>0&&J<0.0000000001)throw new RangeError("simplifyPath: tolerance must be either 0 or >= 1e-10 to avoid numerical precision issues");if(!$8($)||$.length<3)return{commands:$,simplified:!1,originalPoints:0,simplifiedPoints:0};let K=tH($),Q=K.length;if(Q<3)return{commands:$,simplified:!1,originalPoints:Q,simplifiedPoints:Q};let H=$[$.length-1].command.toLowerCase()==="z";if(H&&K.length>1){let j=K[0],G=K[K.length-1];if(Math.abs(G.x-j.x)<0.0000000001&&Math.abs(G.y-j.y)<0.0000000001)K=K.slice(0,-1)}let z=e9(K,J,Z),q=z.length;if(q>=Q)return{commands:$,simplified:!1,originalPoints:Q,simplifiedPoints:Q};return{commands:eH(z,H),simplified:!0,originalPoints:Q,simplifiedPoints:q}}function Z7($){if(typeof $!=="string")throw new TypeError("Path d must be a string")}function Q7($){if(typeof $!=="number"||!Number.isFinite($)||$<0)throw new TypeError(`Precision must be a finite non-negative number, got ${$}`)}function t7($){if(typeof $!=="number"||!Number.isFinite($)||$<0)throw new TypeError(`Tolerance must be a finite non-negative number, got ${$}`)}function H7($,J=0){if(!$||typeof $!=="object")throw new TypeError("Command must be an object");if(typeof $.command!=="string")throw new TypeError("Command must have a string 'command' property");if(!Array.isArray($.args))throw new TypeError("Command must have an array 'args' property");if($.args.length<J)throw new TypeError(`Command ${$.command} requires at least ${J} args, got ${$.args.length}`);for(let Z=0;Z<$.args.length;Z++)if(typeof $.args[Z]!=="number"||!Number.isFinite($.args[Z]))throw new TypeError(`Command ${$.command} arg[${Z}] must be a finite number, got ${$.args[Z]}`)}function D$($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;Z.forEach((Q)=>H7(Q));let K=Z.map((Q)=>({command:Q.command,args:Q.args.map((H)=>{let z=T7(H,J),q=parseFloat(z);if(!Number.isFinite(q))throw new Error(`Invalid numeric value encountered: ${z}`);return q})}));return n0(K,J)}function h$($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;return Z.forEach((K)=>H7(K)),n0(Z,J)}function y$($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;Z.forEach((W)=>H7(W));let K=0,Q=0,H=0,z=0,q=[];for(let W of Z){let j=r9(W,K,Q);q.push(j);let G=X7(W,K,Q);switch(G.command){case"M":K=G.args[0],Q=G.args[1],H=K,z=Q;break;case"L":case"T":K=G.args[0],Q=G.args[1];break;case"H":K=G.args[0];break;case"V":Q=G.args[0];break;case"C":K=G.args[4],Q=G.args[5];break;case"S":case"Q":K=G.args[2],Q=G.args[3];break;case"A":K=G.args[5],Q=G.args[6];break;case"Z":K=H,Q=z;break;default:break}}return n0(q,J)}function u$($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;Z.forEach((W)=>H7(W));let K=0,Q=0,H=0,z=0,q=[];for(let W of Z){let j=X7(W,K,Q);switch(q.push(j),j.command){case"M":K=j.args[0],Q=j.args[1],H=K,z=Q;break;case"L":case"T":K=j.args[0],Q=j.args[1];break;case"H":K=j.args[0];break;case"V":Q=j.args[0];break;case"C":K=j.args[4],Q=j.args[5];break;case"S":case"Q":K=j.args[2],Q=j.args[3];break;case"A":K=j.args[5],Q=j.args[6];break;case"Z":K=H,Q=z;break;default:break}}return n0(q,J)}function g$($,J=0.000001,Z=3){Z7($),t7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((j)=>H7(j));let Q=0,H=0,z=0,q=0,W=[];for(let j of K){let G=j;if(j.command==="L"||j.command==="l"){let _=j.command==="L",U=_?j.args[0]:Q+j.args[0],O=_?j.args[1]:H+j.args[1];if(Math.abs(O-H)<J)G=_?{command:"H",args:[U]}:{command:"h",args:[U-Q]};else if(Math.abs(U-Q)<J)G=_?{command:"V",args:[O]}:{command:"v",args:[O-H]}}W.push(G);let F=X7(G,Q,H);switch(F.command){case"M":Q=F.args[0],H=F.args[1],z=Q,q=H;break;case"L":case"T":Q=F.args[0],H=F.args[1];break;case"H":Q=F.args[0];break;case"V":H=F.args[0];break;case"C":Q=F.args[4],H=F.args[5];break;case"S":case"Q":Q=F.args[2],H=F.args[3];break;case"A":Q=F.args[5],H=F.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(W,Z)}function x$($,J=0.000001,Z=3){Z7($),t7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((j)=>H7(j));let Q=0,H=0,z=0,q=0,W=[];for(let j=0;j<K.length;j++){let G=K[j],F=G;if(G.command==="L"||G.command==="l"){let U=G.command==="L",O=U?G.args[0]:Q+G.args[0],V=U?G.args[1]:H+G.args[1];if((j===K.length-1||K[j+1].command==="M"||K[j+1].command==="m")&&Math.abs(O-z)<J&&Math.abs(V-q)<J)F={command:"z",args:[]}}W.push(F);let _=X7(F,Q,H);switch(_.command){case"M":Q=_.args[0],H=_.args[1],z=Q,q=H;break;case"L":case"T":Q=_.args[0],H=_.args[1];break;case"H":Q=_.args[0];break;case"V":H=_.args[0];break;case"C":Q=_.args[4],H=_.args[5];break;case"S":case"Q":Q=_.args[2],H=_.args[3];break;case"A":Q=_.args[5],H=_.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(W,Z)}function N6(...$){for(let J=0;J<$.length;J++)if(typeof $[J]!=="number"||!Number.isFinite($[J]))throw new TypeError(`Coordinate at position ${J} must be a finite number, got ${$[J]}`)}function CK($){if(typeof $!=="number"||!Number.isFinite($))throw new TypeError(`Parameter t must be a finite number, got ${$}`);if($<0||$>1)throw new RangeError(`Parameter t must be in range [0, 1], got ${$}`)}function v$($,J,Z,K,Q,H,z,q,W){CK($),N6(J,Z,K,Q,H,z,q,W);let j=1-$,G=j*j,F=G*j,_=$*$,U=_*$;return{x:F*J+3*G*$*K+3*j*_*H+U*q,y:F*Z+3*G*$*Q+3*j*_*z+U*W}}function K8($,J,Z,K,Q,H){N6($,J,Z,K,Q,H);let z=Q-Z,q=H-K,W=z*z+q*q;if(W<0.0000000001)return Math.sqrt(($-Z)**2+(J-K)**2);let j=Math.max(0,Math.min(1,(($-Z)*z+(J-K)*q)/W)),G=Z+j*z,F=K+j*q;return Math.sqrt(($-G)**2+(J-F)**2)}function $z($,J,Z,K,Q,H,z,q){N6($,J,Z,K,Q,H,z,q);let W=0,j=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9];for(let G of j){let F=v$(G,$,J,Z,K,Q,H,z,q),_=K8(F.x,F.y,$,J,z,q);if(_>W)W=_}for(let G=0;G<j.length-1;G++){let F=(j[G]+j[G+1])/2,_=v$(F,$,J,Z,K,Q,H,z,q),U=K8(_.x,_.y,$,J,z,q);if(U>W)W=U}for(let G of[0.05,0.95]){let F=v$(G,$,J,Z,K,Q,H,z,q),_=K8(F.x,F.y,$,J,z,q);if(_>W)W=_}return W}function Jz($,J,Z,K,Q,H,z,q,W){return $z($,J,Z,K,Q,H,z,q)<=W}function m$($,J=0.5,Z=3){Z7($),t7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((j)=>H7(j));let Q=0,H=0,z=0,q=0,W=[];for(let j of K){let G=j;if(j.command==="C"||j.command==="c"){let _=j.command==="C",U=_?j.args[0]:Q+j.args[0],O=_?j.args[1]:H+j.args[1],V=_?j.args[2]:Q+j.args[2],M=_?j.args[3]:H+j.args[3],Y=_?j.args[4]:Q+j.args[4],X=_?j.args[5]:H+j.args[5];if(Jz(Q,H,U,O,V,M,Y,X,J))G=_?{command:"L",args:[Y,X]}:{command:"l",args:[Y-Q,X-H]}}W.push(G);let F=X7(G,Q,H);switch(F.command){case"M":Q=F.args[0],H=F.args[1],z=Q,q=H;break;case"L":case"T":Q=F.args[0],H=F.args[1];break;case"H":Q=F.args[0];break;case"V":H=F.args[0];break;case"C":Q=F.args[4],H=F.args[5];break;case"S":case"Q":Q=F.args[2],H=F.args[3];break;case"A":Q=F.args[5],H=F.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(W,Z)}function d$($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;return Z.forEach((K)=>H7(K)),n0(Z,J)}function p$($,J=3){if(Z7($),Q7(J),J>15)throw new RangeError(`Precision ${J} is too large (max 15)`);let Z=l0($);if(Z.length===0)return $;Z.forEach((H)=>H7(H));let K=Math.pow(10,J),Q=Z.map((H)=>({command:H.command,args:H.args.map((z)=>Math.round(z*K)/K)}));return n0(Q,J)}function c$($,J=0.000001,Z=3){Z7($),t7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((j)=>H7(j));let Q=0,H=0,z=0,q=0,W=[];for(let j of K){let G=X7(j,Q,H),F=!0;switch(G.command){case"L":case"T":if(Math.abs(G.args[0]-Q)<J&&Math.abs(G.args[1]-H)<J)F=!1;break;case"H":if(Math.abs(G.args[0]-Q)<J)F=!1;break;case"V":if(Math.abs(G.args[0]-H)<J)F=!1;break;case"C":if(Math.abs(G.args[4]-Q)<J&&Math.abs(G.args[5]-H)<J&&Math.abs(G.args[0]-Q)<J&&Math.abs(G.args[1]-H)<J&&Math.abs(G.args[2]-Q)<J&&Math.abs(G.args[3]-H)<J)F=!1;break;case"S":if(Math.abs(G.args[2]-Q)<J&&Math.abs(G.args[3]-H)<J&&Math.abs(G.args[0]-Q)<J&&Math.abs(G.args[1]-H)<J)F=!1;break;case"Q":if(Math.abs(G.args[2]-Q)<J&&Math.abs(G.args[3]-H)<J&&Math.abs(G.args[0]-Q)<J&&Math.abs(G.args[1]-H)<J)F=!1;break;case"A":if(Math.abs(G.args[5]-Q)<J&&Math.abs(G.args[6]-H)<J||Math.abs(G.args[0])<J||Math.abs(G.args[1])<J)F=!1;break;default:break}if(F)switch(W.push(j),G.command){case"M":Q=G.args[0],H=G.args[1],z=Q,q=H;break;case"L":case"T":Q=G.args[0],H=G.args[1];break;case"H":Q=G.args[0];break;case"V":H=G.args[0];break;case"C":Q=G.args[4],H=G.args[5];break;case"S":case"Q":Q=G.args[2],H=G.args[3];break;case"A":Q=G.args[5],H=G.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(W,Z)}function Kz($,J,Z,K,Q,H,z){CK($),N6(J,Z,K,Q,H,z);let q=1-$,W=q*q,j=$*$;return{x:W*J+2*q*$*K+j*H,y:W*Z+2*q*$*Q+j*z}}function Zz($,J,Z,K,Q,H,z,q,W,j){N6($,J,Z,K,Q,H,z,q,W,j);let G=0,F=[0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95];for(let _ of F){let U=v$(_,$,J,Z,K,Q,H,z,q),O=Kz(_,$,J,W,j,z,q),V=Math.sqrt((U.x-O.x)**2+(U.y-O.y)**2);if(V>G)G=V}return G}function Qz($,J,Z,K,Q,H,z,q,W){N6($,J,Z,K,Q,H,z,q),t7(W);let j=(3*(Z+Q)-$-z)/4,G=(3*(K+H)-J-q)/4;if(Zz($,J,Z,K,Q,H,z,q,j,G)<=W)return{cpx:j,cpy:G};return null}function l$($,J=0.5,Z=3){Z7($),t7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((j)=>H7(j));let Q=0,H=0,z=0,q=0,W=[];for(let j of K){let G=j;if(j.command==="C"||j.command==="c"){let _=j.command==="C",U=_?j.args[0]:Q+j.args[0],O=_?j.args[1]:H+j.args[1],V=_?j.args[2]:Q+j.args[2],M=_?j.args[3]:H+j.args[3],Y=_?j.args[4]:Q+j.args[4],X=_?j.args[5]:H+j.args[5],w=Qz(Q,H,U,O,V,M,Y,X,J);if(w)G=_?{command:"Q",args:[w.cpx,w.cpy,Y,X]}:{command:"q",args:[w.cpx-Q,w.cpy-H,Y-Q,X-H]}}W.push(G);let F=X7(G,Q,H);switch(F.command){case"M":Q=F.args[0],H=F.args[1],z=Q,q=H;break;case"L":case"T":Q=F.args[0],H=F.args[1];break;case"H":Q=F.args[0];break;case"V":H=F.args[0];break;case"C":Q=F.args[4],H=F.args[5];break;case"S":case"Q":Q=F.args[2],H=F.args[3];break;case"A":Q=F.args[5],H=F.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(W,Z)}function n$($,J=0.000001,Z=3){Z7($),t7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((F)=>H7(F));let Q=0,H=0,z=0,q=0,W=null,j=null,G=[];for(let F of K){let _=F,U=X7(F,Q,H);if(U.command==="Q"&&W!==null){let O=2*Q-W,V=2*H-j;if(Math.abs(U.args[0]-O)<J&&Math.abs(U.args[1]-V)<J)_=F.command==="Q"?{command:"T",args:[U.args[2],U.args[3]]}:{command:"t",args:[U.args[2]-Q,U.args[3]-H]}}if(G.push(_),U.command==="Q")W=U.args[0],j=U.args[1];else if(U.command==="T")if(W!==null)W=2*Q-W,j=2*H-j;else W=Q,j=H;else W=null,j=null;switch(U.command){case"M":Q=U.args[0],H=U.args[1],z=Q,q=H;break;case"L":case"T":Q=U.args[0],H=U.args[1];break;case"H":Q=U.args[0];break;case"V":H=U.args[0];break;case"C":Q=U.args[4],H=U.args[5];break;case"S":case"Q":Q=U.args[2],H=U.args[3];break;case"A":Q=U.args[5],H=U.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(G,Z)}function s$($,J=0.000001,Z=3){Z7($),t7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((F)=>H7(F));let Q=0,H=0,z=0,q=0,W=null,j=null,G=[];for(let F of K){let _=F,U=X7(F,Q,H);if(U.command==="C"&&W!==null){let O=2*Q-W,V=2*H-j;if(Math.abs(U.args[0]-O)<J&&Math.abs(U.args[1]-V)<J)_=F.command==="C"?{command:"S",args:[U.args[2],U.args[3],U.args[4],U.args[5]]}:{command:"s",args:[U.args[2]-Q,U.args[3]-H,U.args[4]-Q,U.args[5]-H]}}if(G.push(_),U.command==="C")W=U.args[2],j=U.args[3];else if(U.command==="S")W=U.args[0],j=U.args[1];else W=null,j=null;switch(U.command){case"M":Q=U.args[0],H=U.args[1],z=Q,q=H;break;case"L":case"T":Q=U.args[0],H=U.args[1];break;case"H":Q=U.args[0];break;case"V":H=U.args[0];break;case"C":Q=U.args[4],H=U.args[5];break;case"S":case"Q":Q=U.args[2],H=U.args[3];break;case"A":Q=U.args[5],H=U.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(G,Z)}function o$($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;Z.forEach((Q)=>H7(Q));let K=Z.map((Q)=>{if(Q.command==="A"||Q.command==="a"){let H=[...Q.args];if(H.length!==7)throw new Error(`Arc command requires 7 arguments, got ${H.length}`);if(H[2]=(H[2]%360+360)%360,Math.abs(H[0]-H[1])<0.000001)H[2]=0;return H[3]=H[3]?1:0,H[4]=H[4]?1:0,{command:Q.command,args:H}}return Q});return n0(K,J)}var G6=new Set(["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"]),z8=new Set([...G6].map(($)=>$.toLowerCase())),F6=new Set(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","class","clip","clip-path","clip-rule","clipPathUnits","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","contentScriptType","contentStyleType","cursor","cx","cy","d","descent","diffuseConstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","end","exponent","externalResourcesRequired","fill","fill-opacity","fill-rule","filter","filterRes","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","height","horiz-adv-x","horiz-origin-x","horiz-origin-y","href","id","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lang","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","max","media","method","min","mode","name","numOctaves","offset","onabort","onactivate","onbegin","onclick","onend","onerror","onfocusin","onfocusout","onload","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onrepeat","onresize","onscroll","onunload","onzoom","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","path","pathLength","patternContentUnits","patternTransform","patternUnits","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfaceScale","systemLanguage","tableValues","target","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","title","to","transform","type","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","version","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","viewTarget","visibility","width","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","xlink:actuate","xlink:arcrole","xlink:href","xlink:role","xlink:show","xlink:title","xlink:type","xml:base","xml:id","xml:lang","xml:space","xmlns","xmlns:xlink","y","y1","y2","yChannelSelector","z","zoomAndPan","line-height","marker"]),q8=new Set([...F6].map(($)=>$.toLowerCase())),Ez=new Set(["mesh","meshgradient","meshpatch","meshrow","solidcolor","hatch","hatchpath","discard","unknown","canvas","video","audio","iframe","source","track"]),Tz=new Set(["href","tabindex","lang","transform-origin","vector-effect","paint-order","pathLength","fr","side","crossorigin","role","aria-label","aria-labelledby","aria-describedby","aria-hidden","aria-controls","aria-expanded","aria-haspopup","aria-live","aria-atomic","aria-relevant","aria-busy","aria-owns"]),bz=($)=>{if(!$||typeof $!=="string")return!1;return Ez.has($.toLowerCase())},fz=($)=>{if(!$||typeof $!=="string")return!1;let J=$.toLowerCase();return Tz.has(J)||J.startsWith("aria-")||J.startsWith("data-")},bK=new Set(["foreignobject","script","style","title","desc","metadata"]),i$=new Map,Sz=($,J)=>{if(typeof $!=="string"||typeof J!=="string")throw new Error("Both parameters must be strings");let Z=`${$}|${J}`;if(i$.has(Z))return i$.get(Z);if($.length===0)return J.length;if(J.length===0)return $.length;let K=[];for(let H=0;H<=J.length;H++)K[H]=[H];for(let H=0;H<=$.length;H++)K[0][H]=H;for(let H=1;H<=J.length;H++)for(let z=1;z<=$.length;z++){let q=$[z-1]===J[H-1]?0:1;K[H][z]=Math.min(K[H-1][z]+1,K[H][z-1]+1,K[H-1][z-1]+q)}let Q=K[J.length][$.length];return i$.set(Z,Q),Q},vz=()=>i$.clear(),P6=($,J,Z=2)=>{if(!$||typeof $!=="string")return null;if(!J||!(J instanceof Set)||J.size===0)return null;let K=typeof Z!=="number"||Z<0?2:Z,Q=$.toLowerCase(),H=null,z=K+1;for(let q of J){let W=Sz(Q,q.toLowerCase());if(W>0&&W<z)z=W,H=q}return H};function m7($){if(!$||typeof $!=="string")return!1;return/(%|em|rem|px|pt|cm|mm|in|pc|ex|ch|vw|vh|vmin|vmax|Q)$/i.test($.trim())}function Dz($,J,Z=100){let K=new Set,Q=$,H=0;while(Q!==null&&Q!==void 0&&H<Z){if(K.has(Q))return!0;K.add(Q),Q=J(Q),H++}return H>=Z}function fK($){if(!$||typeof $!=="string")return $||"";return $.replace(/<(script|style)([^>]*)\sdata-cdata-pending="true"([^>]*)>([\s\S]*?)<\/\1>/gi,(J,Z,K,Q,H)=>{let z=H.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),q=(K+Q).replace(/\s*data-cdata-pending="true"\s*/g," ").trim(),W=q?" "+q:"";return`<${Z}${W}><![CDATA[
|
|
18
|
+
${z}
|
|
19
|
+
]]></${Z}>`})}var r$=/-?\d*\.?\d+(?:[eE][+-]?\d+)?/g,A6=80,e6=6,j8={BROWSER_MIN:2,BROWSER_TYPICAL:6,FLOAT32:7,FLOAT64:15,GEOGRAPHIC:8,SCIENTIFIC:20,MAX:80};k.set({precision:A6,rounding:k.ROUND_HALF_UP});var G8=($)=>$ instanceof k?$:new k($);function a($){return $!==null&&typeof $==="object"&&typeof $.tagName==="string"&&typeof $.getAttribute==="function"&&typeof $.setAttribute==="function"}function F8($,J=e6){if($===null||$===void 0)return"0";let Z=J;if(typeof J!=="number"||isNaN(J)||J<0)Z=e6;if(Z>A6)Z=A6;let Q=G8($).toFixed(Z);if(Q.includes("."))return Q.replace(/\.?0+$/,"");return Q}function xK($){if($===null||$===void 0)return"";return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var S0={SVG_STRING:"string",DOM_ELEMENT:"dom",FILE_PATH:"file",URL:"url",XML_DOCUMENT:"xml",CSS_SELECTOR:"selector",OBJECT_ELEMENT:"object",EMBED_ELEMENT:"embed",IFRAME_ELEMENT:"iframe"},q7={SVG_STRING:"string",DOM_ELEMENT:"dom",XML_DOCUMENT:"xml"},z7={STRING:"string",FILE:"file",DOM_REPLACE:"dom_replace",DOM_UPDATE:"dom_update",DOWNLOAD:"download"};function e$($){if($===null||$===void 0)return z7.STRING;if(typeof $==="object"&&$.nodeType)return z7.DOM_UPDATE;if(typeof $==="string"){let J=$.trim();if(typeof document!=="undefined"&&(J.startsWith("#")||J.startsWith(".")||J.startsWith("[")))return z7.DOM_REPLACE;if(J.includes("/")||J.includes("\\")||/\.\w+$/.test(J))return z7.FILE;if(J.toLowerCase()==="download")return z7.DOWNLOAD}return z7.STRING}async function _8($,J=null,Z={}){let K=e$(J),Q;if(typeof $==="string")Q=$;else Q=b6($,q7.SVG_STRING,Z);switch(K){case z7.STRING:return Q;case z7.FILE:{if(typeof process!=="undefined"&&process.versions?.node){let H=await import("fs"),q=(await Promise.resolve().then(() => (C6(),I6))).dirname(J);if(q&&q!=="."&&!H.existsSync(q))H.mkdirSync(q,{recursive:!0});H.writeFileSync(J,Q,"utf8");return}throw new Error("File saving requires Node.js environment")}case z7.DOM_REPLACE:{if(typeof document==="undefined")throw new Error("DOM operations require browser environment");let H=document.querySelector(J);if(!H)throw new Error(`No element found for selector: ${J}`);H.innerHTML=Q;return}case z7.DOM_UPDATE:{if(typeof document==="undefined")throw new Error("DOM operations require browser environment");if(J.tagName?.toLowerCase()==="svg"){let q=new DOMParser().parseFromString(Q,"image/svg+xml").documentElement;while(J.attributes.length>0)J.removeAttribute(J.attributes[0].name);for(let W of q.attributes)J.setAttribute(W.name,W.value);J.innerHTML=q.innerHTML}else J.innerHTML=Q;return}case z7.DOWNLOAD:{if(typeof document==="undefined"||typeof Blob==="undefined")throw new Error("Download requires browser environment");let H=new Blob([Q],{type:"image/svg+xml"}),z=URL.createObjectURL(H),q=document.createElement("a");q.href=z,q.download=Z.filename||"output.svg",document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(z);return}default:return Q}}function E6($){if($===null||$===void 0)throw new Error("Input cannot be null or undefined");if(typeof $==="string"){let J=$.trim();if(J.startsWith("<"))return S0.SVG_STRING;else if($.startsWith("http://")||$.startsWith("https://"))return S0.URL;else if(typeof document!=="undefined"&&(J.startsWith("#")||J.startsWith(".")||J.startsWith("[")))return S0.CSS_SELECTOR;else return S0.FILE_PATH}if(typeof HTMLObjectElement!=="undefined"&&$ instanceof HTMLObjectElement)return S0.OBJECT_ELEMENT;if(typeof HTMLEmbedElement!=="undefined"&&$ instanceof HTMLEmbedElement)return S0.EMBED_ELEMENT;if(typeof HTMLIFrameElement!=="undefined"&&$ instanceof HTMLIFrameElement)return S0.IFRAME_ELEMENT;if(a($))return S0.DOM_ELEMENT;if($&&$.nodeType===9)return S0.XML_DOCUMENT;return S0.SVG_STRING}async function T6($,J){switch(J){case S0.SVG_STRING:return d0($);case S0.DOM_ELEMENT:if($&&typeof $.serialize==="function")return $;if(typeof XMLSerializer!=="undefined"){let K=new XMLSerializer().serializeToString($);return d0(K)}return $;case S0.XML_DOCUMENT:{let Z=$.documentElement||$;if(Z&&typeof Z.serialize==="function")return Z;if(typeof XMLSerializer!=="undefined"){let Q=new XMLSerializer().serializeToString(Z);return d0(Q)}return Z}case S0.FILE_PATH:{let K=(()=>({})).readFileSync($,"utf8");return d0(K)}if(typeof process!=="undefined"&&process.versions?.node){let{readFileSync:Z}=await import("fs"),K=Z($,"utf8");return d0(K)}throw new Error("File loading requires Node.js environment");case S0.URL:if(typeof fetch!=="undefined"){let K=await(await fetch($)).text();return d0(K)}throw new Error("URL loading requires fetch API");case S0.CSS_SELECTOR:if(typeof document!=="undefined"){let Z=document.querySelector($);if(!Z)throw new Error(`No element found for selector: ${$}`);if(Z.tagName.toLowerCase()==="svg")return d0(new XMLSerializer().serializeToString(Z));let K=Z.querySelector("svg");if(K)return d0(new XMLSerializer().serializeToString(K));throw new Error(`Element "${$}" is not an SVG and contains no SVG`)}throw new Error("CSS selector requires browser environment");case S0.OBJECT_ELEMENT:try{if($.contentDocument&&$.contentDocument.documentElement){let Z=$.contentDocument.documentElement;if(Z.tagName.toLowerCase()==="svg")return d0(new XMLSerializer().serializeToString(Z))}}catch(Z){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${Z.message}`);throw new Error("HTMLObjectElement: SVG content not accessible (cross-origin or security error)")}throw new Error("HTMLObjectElement: SVG content not accessible (not loaded or cross-origin)");case S0.EMBED_ELEMENT:if(typeof $.getSVGDocument==="function"){let Z=$.getSVGDocument();if(Z&&Z.documentElement)return d0(new XMLSerializer().serializeToString(Z.documentElement))}throw new Error("HTMLEmbedElement: SVG content not accessible");case S0.IFRAME_ELEMENT:try{let Z=$.contentDocument;if(Z&&Z.documentElement){let K=Z.documentElement;if(K.tagName.toLowerCase()==="svg")return d0(new XMLSerializer().serializeToString(K))}}catch(Z){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${Z.message}`);throw new Error("HTMLIFrameElement: SVG content not accessible (cross-origin)")}throw new Error("HTMLIFrameElement: No SVG content found");default:throw new Error(`Unknown input type: ${J}`)}}function b6($,J,Z={}){switch(J){case q7.SVG_STRING:{let K=B7($,{minify:Z.minify!==!1});return fK(K)}case q7.DOM_ELEMENT:return $;case q7.XML_DOCUMENT:return $;default:{let K=B7($,{minify:Z.minify!==!1});return fK(K)}}}function j0($){return async function(J,Z={}){let K=E6(J),Q=await T6(J,K),H=Z.outputFormat||(K===S0.DOM_ELEMENT?q7.DOM_ELEMENT:q7.SVG_STRING),z=await $(Q,Z);return b6(z,H,Z)}}var $9=j0(($,J={})=>{let Z=J.minify!==!1,K=J.remove!==!1,Q=J.force||!1,H=J.preserve||[],z=J.preservePrefixes||[];if(!Q){let I=$.querySelectorAll("script").length>0,f=Array.from($.querySelectorAll("style")).some((u)=>u.textContent&&u.textContent.trim().length>0);if(I||f)return $}let q=(I)=>{if(H.includes(I))return!0;if(z.some((f)=>I.startsWith(f)))return!0;return!1},W=(I)=>{try{return decodeURI(I)}catch(f){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${f.message}`);return I}},j=UK($),G=new Set;for(let I of j.all)G.add(I),G.add(W(I));let F=new Map,_=(I)=>{let f=I.getAttribute("id");if(f){if(!F.has(f))F.set(f,I)}for(let u of I.children)if(a(u))_(u)};_($);let U=new Set,O=new Set,V=(I)=>{let f=I.getAttribute("id");if(f){if(U.has(f))O.add(f);U.add(f)}for(let u of I.children)if(a(u))V(u)};V($);let M=new Set,Y=new Map,X=0,w=()=>{let I;do I=`a${X++}`;while(G.has(I)&&!F.has(I));return I},R=(I)=>{let f=I.getAttribute("id");if(f){if(O.has(f)){if(M.has(f)){I.removeAttribute("id");return}M.add(f)}let u=W(f),m=G.has(f)||G.has(u);if(q(f));else if(!m&&K)I.removeAttribute("id");else if(Z&&m){let S=w();if(Y.set(f,S),u!==f)Y.set(u,S);I.setAttribute("id",S)}}for(let u of I.children)if(a(u))R(u)};if(R($),Z){let I=(m)=>{let S=(x)=>x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");for(let x of m.getAttributeNames()){let h=m.getAttribute(x);if(h&&h.includes("url(#")){for(let[E,d]of Y){let c=S(E);h=h.replace(new RegExp(`url\\(#${c}\\)`,"g"),`url(#${d})`);let p=S(encodeURI(E));h=h.replace(new RegExp(`url\\(#${p}\\)`,"g"),`url(#${d})`)}m.setAttribute(x,h)}if((x==="href"||x==="xlink:href")&&h?.startsWith("#")){let E=h.substring(1),d=W(E);if(Y.has(E))m.setAttribute(x,`#${Y.get(E)}`);else if(Y.has(d))m.setAttribute(x,`#${Y.get(d)}`)}if((x==="begin"||x==="end")&&h){for(let[E,d]of Y){let c=S(E);h=h.replace(new RegExp(`^${c}\\.`,"g"),`${d}.`),h=h.replace(new RegExp(`;${c}\\.`,"g"),`;${d}.`)}m.setAttribute(x,h)}if((x==="values"||x==="from"||x==="to"||x==="by")&&h){for(let[E,d]of Y){let c=S(E);h=h.replace(new RegExp(`#${c}([;\\s]|$)`,"g"),`#${d}$1`)}m.setAttribute(x,h)}}for(let x of m.children)if(a(x))I(x)};I($);let f=(m)=>m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=$.getElementsByTagName("style");for(let m of u){let S=m.textContent;if(!S)continue;for(let[x,h]of Y){let E=f(x);S=S.replace(new RegExp(`#${E}([^\\w-]|$)`,"g"),`#${h}$1`),S=S.replace(new RegExp(`url\\(#${E}\\)`,"g"),`url(#${h})`)}m.textContent=S}}return $}),$$=j0(($,J={})=>{let Z=J.precision||6,K=(H)=>{let z=parseFloat(H);if(isNaN(z))return H;let j=G8(z).toDecimalPlaces(Z).toString();if(j.includes("."))j=j.replace(/0+$/,""),j=j.replace(/\.$/,"");return j},Q=(H)=>{for(let z of H.getAttributeNames()){let q=H.getAttribute(z);if(z.match(/^(x|y|cx|cy|r|rx|ry|width|height|x1|y1|x2|y2|stroke-width|font-size)$/)){if(m7(q))continue;H.setAttribute(z,K(q))}if(z==="d"&&q){let W=q.replace(r$,(j)=>K(j));H.setAttribute("d",W)}if(z==="transform"&&q){let W=q.replace(r$,(j)=>K(j));H.setAttribute("transform",W)}if(z==="points"&&q){let W=q.replace(r$,(j)=>K(j));H.setAttribute("points",W)}}for(let z of H.children)if(a(z))Q(z)};return Q($),$}),U8=j0(($,J={})=>{let Z=J.precision||6,K=(H)=>{let z=parseFloat(H);if(isNaN(z))return H;let W=G8(z).toDecimalPlaces(Z).toString();if(W.includes("."))W=W.replace(/0+$/,""),W=W.replace(/\.$/,"");return W},Q=(H)=>{for(let z of["points"]){let q=H.getAttribute(z);if(q){let W=q.replace(r$,K);H.setAttribute(z,W)}}for(let z of H.children)if(a(z))Q(z)};return Q($),$}),V8=j0(($,J={})=>{let Z=["data-name","data-id","class"],K=["xmlns:serif"],Q=(H)=>{for(let z of Z)if(H.hasAttribute(z))H.removeAttribute(z);if(!J.preserveVendor){for(let z of K)if(H.hasAttribute(z))H.removeAttribute(z)}for(let z of H.children)if(a(z))Q(z)};return Q($),$}),M8=j0(($,J={})=>{let Z=(K)=>{if(K.hasAttribute("enable-background"))K.removeAttribute("enable-background");for(let Q of K.children)if(a(Q))Z(Q)};return Z($),$}),O8=j0(($,J={})=>{let Z=Array.from($.querySelectorAll("style")).some((Y)=>{let X=Y.textContent||"";return X.includes("@media")||X.includes(":hover")||X.includes(":focus")||X.includes(":active")||X.includes(":visited")||X.includes(":first-child")||X.includes(":last-child")||X.includes(":nth-child")||X.includes(":not(")}),K=$.querySelectorAll("script").length>0,Q=new Set,H=$.outerHTML||"",z=H.matchAll(/url\(#([^)]+)\)/g);for(let Y of z)Q.add(Y[1]);let q=H.matchAll(/xlink:href="#([^"]+)"/g);for(let Y of q)Q.add(Y[1]);let W=H.matchAll(/\shref="#([^"]+)"/g);for(let Y of W)Q.add(Y[1]);let j={clippath:"clipPath",textpath:"textPath",lineargradient:"linearGradient",radialgradient:"radialGradient",meshgradient:"meshGradient",hatchpath:"hatchPath",solidcolor:"solidColor",foreignobject:"foreignObject",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",animatemotion:"animateMotion",animatetransform:"animateTransform"},G=(Y)=>j[Y]||Y,F=["svg","g","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","tref","textPath","textpath","defs","clipPath","clippath","mask","pattern","linearGradient","lineargradient","radialGradient","radialgradient","meshGradient","meshgradient","meshrow","meshpatch","hatch","hatchpath","hatchPath","solidcolor","solidColor","stop","image","use","symbol","marker","title","desc","metadata","foreignObject","foreignobject","switch","a","filter","feBlend","feblend","feColorMatrix","fecolormatrix","feComponentTransfer","fecomponenttransfer","feComposite","fecomposite","feConvolveMatrix","feconvolvematrix","feDiffuseLighting","fediffuselighting","feDisplacementMap","fedisplacementmap","feDistantLight","fedistantlight","feDropShadow","fedropshadow","feFlood","feflood","feFuncA","fefunca","feFuncB","fefuncb","feFuncG","fefuncg","feFuncR","fefuncr","feGaussianBlur","fegaussianblur","feImage","feimage","feMerge","femerge","feMergeNode","femergenode","feMorphology","femorphology","feOffset","feoffset","fePointLight","fepointlight","feSpecularLighting","fespecularlighting","feSpotLight","fespotlight","feTile","fetile","feTurbulence","feturbulence","animate","animateMotion","animatemotion","animateTransform","animatetransform","set","mpath","view","cursor","style","script","font","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","glyph","missing-glyph","hkern","vkern"],_={fill:"#000","fill-opacity":"1","fill-rule":"nonzero",stroke:"none","stroke-width":"1","stroke-opacity":"1","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-dashoffset":"0",opacity:"1",visibility:"visible",display:"inline",clip:"auto","clip-path":"none","clip-rule":"nonzero",mask:"none","marker-start":"none","marker-mid":"none","marker-end":"none","stop-color":"#000","stop-opacity":"1","flood-color":"#000","flood-opacity":"1","lighting-color":"#fff","color-interpolation":"sRGB","color-interpolation-filters":"linearRGB","color-rendering":"auto","shape-rendering":"auto","text-rendering":"auto","image-rendering":"auto","paint-order":"normal","vector-effect":"none","text-anchor":"start","text-overflow":"clip","text-decoration":"none","dominant-baseline":"auto","alignment-baseline":"baseline","baseline-shift":"baseline","writing-mode":"lr-tb",direction:"ltr","unicode-bidi":"normal","letter-spacing":"normal","word-spacing":"normal","font-style":"normal","font-variant":"normal","font-weight":"normal","font-stretch":"normal","font-size":"medium","font-size-adjust":"none"},U={circle:{cx:"0",cy:"0"},ellipse:{cx:"0",cy:"0"},line:{x1:"0",y1:"0",x2:"0",y2:"0"},rect:{x:"0",y:"0",rx:"0",ry:"0"},image:{x:"0",y:"0",preserveAspectRatio:"xMidYMid meet"},svg:{x:"0",y:"0",preserveAspectRatio:"xMidYMid meet"},symbol:{preserveAspectRatio:"xMidYMid meet"},marker:{markerUnits:"strokeWidth",refX:"0",refY:"0",markerWidth:"3",markerHeight:"3"},linearGradient:{x1:"0",y1:"0",x2:"100%",y2:"0",spreadMethod:"pad"},radialGradient:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%",spreadMethod:"pad"},pattern:{x:"0",y:"0",patternUnits:"objectBoundingBox",patternContentUnits:"userSpaceOnUse"},clipPath:{clipPathUnits:"userSpaceOnUse"},mask:{maskUnits:"objectBoundingBox",maskContentUnits:"userSpaceOnUse",x:"-10%",y:"-10%",width:"120%",height:"120%"},filter:{primitiveUnits:"userSpaceOnUse",x:"-10%",y:"-10%",width:"120%",height:"120%"},feBlend:{mode:"normal"},feColorMatrix:{type:"matrix"},feComposite:{operator:"over",k1:"0",k2:"0",k3:"0",k4:"0"},feTurbulence:{baseFrequency:"0",numOctaves:"1",seed:"0",stitchTiles:"noStitch",type:"turbulence"},feDisplacementMap:{scale:"0",xChannelSelector:"A",yChannelSelector:"A"},feDistantLight:{azimuth:"0",elevation:"0"},fePointLight:{x:"0",y:"0",z:"0"},a:{target:"_self"},textPath:{startOffset:"0"}},O=(Y)=>{if(Y.startsWith("data-"))return!0;if(Y.startsWith("aria-"))return!0;if(Y==="role")return!0;if(Y==="xmlns")return!0;if(Y.includes(":")&&!Y.startsWith("xml:")&&!Y.startsWith("xlink:"))return!0;return!1},V=(Y,X)=>{let w=Y.parentNode;while(w&&a(w)){let R=w.getAttribute(X);if(R!==null)return R;w=w.parentNode}return null},M=(Y,X={})=>{if(Y.tagName==="foreignObject")return;if(Y.tagName.includes(":"))return;if(!Y.getAttribute("id")){for(let[u,m]of Object.entries(_))if(!O(u)&&Y.getAttribute(u)===m)Y.removeAttribute(u);let f=U[Y.tagName.toLowerCase()]||{};for(let[u,m]of Object.entries(f))if(!O(u)&&Y.getAttribute(u)===m)Y.removeAttribute(u);if(!Z){for(let u of Y.getAttributeNames())if(q6.has(u)&&!O(u)){let m=Y.getAttribute(u),S=V(Y,u);if(S!==null&&m===S)Y.removeAttribute(u)}}}let w={...X};for(let f of q6){let u=Y.getAttribute(f);if(u!==null)w[f]=u}let R=Y.tagName.toLowerCase(),I=o6[R]||o6[G(R)];for(let f of[...Y.children])if(a(f)){if(f.tagName.includes(":"))continue;let u=f.tagName.toLowerCase(),m=f.getAttribute("id"),S=K&&m,x=(h)=>{let E=h.getAttribute("id");if(E&&Q.has(E))return!0;for(let d of h.children||[])if(a(d)&&x(d))return!0;return!1};if(!F.includes(u)){if(!x(f)&&!S){Y.removeChild(f);continue}}if(I&&!I.has(u)&&!I.has(G(u))){if(!x(f)&&!S){Y.removeChild(f);continue}}M(f,w)}};return M($,{}),$}),Y8=j0(($,J={})=>{let Z=["x","y","width","height","viewBox"],K=(Q)=>{if(Q.tagName==="g"){for(let H of Z)if(Q.hasAttribute(H))Q.removeAttribute(H)}for(let H of Q.children)if(a(H))K(H)};return K($),$}),X8=j0(($,J={})=>{let Z=$.getElementsByTagName("defs");for(let K of[...Z])if(K.children.length===0){if(K.parentNode)K.parentNode.removeChild(K)}return $}),J$=j0(($,J={})=>{let Z=J.force||!1,K=$.querySelectorAll("script").length>0,Q=new Set,H=(G)=>{for(let F of G.getAttributeNames()){let _=G.getAttribute(F);if(_&&_.includes("url(#")){let U=_.matchAll(/url\(#([^)]+)\)/g);for(let O of U)Q.add(O[1])}if((F==="href"||F==="xlink:href")&&_&&_.startsWith("#"))Q.add(_.substring(1))}for(let F of G.children)if(a(F))H(F)};H($);let z=(G)=>{let F=G.getAttribute("href")||G.getAttribute("xlink:href");if(F&&F.startsWith("#"))return!0;for(let _ of G.getAttributeNames?G.getAttributeNames():[]){let U=G.getAttribute(_);if(U&&U.includes("url(#"))return!0}return!1},q=(G)=>{for(let F of G.children){if(!a(F))continue;let _=F.tagName?.toLowerCase();if(s6.animation.has(_))return!0;if(q(F))return!0}return!1},W=(G)=>{let F=G.getAttribute("id");if(F&&(Q.has(F)||K))return!0;for(let _ of G.children){if(!a(_))continue;if(W(_))return!0}return!1},j=(G,F=!1)=>{let _=G.tagName.toLowerCase(),U=F||_==="defs",O=G.getAttribute("display"),V=G.getAttribute("visibility"),M=parseFloat(G.getAttribute("opacity")||"1");if(O==="none"||V==="hidden"||M===0){if(!Z&&W(G));else if(!Z&&_==="marker");else if(!Z&&(G.getAttribute("marker-start")||G.getAttribute("marker-mid")||G.getAttribute("marker-end")));else if(!Z&&U&&s6.nonRendering.has(_));else if(!Z&&s6.animation.has(_));else if(!Z&&q(G));else if(!Z&&_==="use");else if(!Z&&z(G));else if(G.parentNode){G.parentNode.removeChild(G);return}}for(let X of[...G.children])if(a(X))j(X,U)};return j($),$}),k8=j0(($,J={})=>{let Z=$.getElementsByTagName("text"),K=(z)=>{let q=z.textContent||"";if(z.children)for(let W of z.children)q+=K(W);return q},Q=(z,q)=>{if(!q||q.length===0)return!1;return(z.getAttributeNames?z.getAttributeNames():[]).some((j)=>q.some((G)=>j.startsWith(G+":")))},H=J.preserveNamespaces||[];for(let z of[...Z]){let q=K(z),W=!q||q.trim()==="",j=Q(z,H);if(W&&!j){if(z.parentNode)z.parentNode.removeChild(z)}}return $}),K$=j0(($,J={})=>{let Z=["g","defs","symbol","marker","clipPath","clippath","mask","pattern"],K=$.querySelectorAll("script").length>0,Q=new Set,H=(q)=>{for(let W of q.getAttributeNames?q.getAttributeNames():[]){let j=q.getAttribute(W);if(j&&j.includes("url(#")){let G=j.matchAll(/url\(#([^)]+)\)/g);for(let F of G)Q.add(F[1])}if((W==="href"||W==="xlink:href")&&j&&j.startsWith("#"))Q.add(j.substring(1))}for(let W of q.children||[])if(a(W))H(W)};H($);let z=(q)=>{for(let G of[...q.children])if(a(G))z(G);let W=q.tagName?.toLowerCase();if(!Z.includes(q.tagName)&&!Z.includes(W))return;if(q.getAttribute("href")||q.getAttribute("xlink:href"))return;let j=q.getAttribute("id");if(j&&(Q.has(j)||K))return;if(q.children.length===0){if(q.parentNode)q.parentNode.removeChild(q)}};return z($),$}),L8=j0(($,J={})=>{return $}),w8=j0(($,J={})=>{return $}),Z$=j0(($,J={})=>{return $}),Q$=j0(($,J={})=>{if(J.preserveVendor)return $;let Z=$.getElementsByTagName("metadata");for(let K of[...Z])if(K.parentNode)K.parentNode.removeChild(K);return $}),R8=j0(($,J={})=>{let Z=$.getElementsByTagName("title");for(let K of[...Z])if(K.parentNode)K.parentNode.removeChild(K);return $}),B8=j0(($,J={})=>{let Z=$.getElementsByTagName("desc");for(let K of[...Z])if(K.parentNode)K.parentNode.removeChild(K);return $}),J9=j0(($,J={})=>{if(J.preserveVendor===!0)return $;let Z=J.preserveNamespaces||[],K=new Set(Z);if(K.has("sodipodi"))K.add("inkscape");if(K.has("inkscape"))K.add("sodipodi");let Q=["inkscape","sodipodi","illustrator","sketch","ai","serif","vectornator","figma"].filter((j)=>!K.has(j));if(Q.length===0)return $;let H=(j)=>{for(let G of[...j.children])if(a(G)){let F=G.tagName.indexOf(":");if(F>0){let _=G.tagName.substring(0,F);if(Q.includes(_)){j.removeChild(G);continue}}H(G)}};H($);let z=(j)=>{for(let G of[...j.getAttributeNames()]){if(G.startsWith("xmlns:"))continue;let F=G.indexOf(":");if(F>0){let _=G.substring(0,F);if(Q.includes(_))j.removeAttribute(G)}}for(let G of j.children)if(a(G))z(G)};z($);let q=new Set,W=(j)=>{for(let F of j.getAttributeNames()){if(F.startsWith("xmlns:"))continue;let _=F.indexOf(":");if(_>0){let U=F.substring(0,_);q.add(U)}}let G=j.tagName.indexOf(":");if(G>0)q.add(j.tagName.substring(0,G));for(let F of j.children)if(a(F))W(F)};W($);for(let j of Q){let G=`xmlns:${j}`;if($.hasAttribute(G)&&!q.has(j))$.removeAttribute(G)}return $}),N8=j0(($,J={})=>{let Z=(K)=>{for(let Q of[...K.getAttributeNames()]){let H=K.getAttribute(Q);if(H===""||H===null)K.removeAttribute(Q)}for(let Q of K.children)if(a(Q))Z(Q)};return Z($),$}),I8=j0(($,J={})=>{let Z=$.getAttribute("width"),K=$.getAttribute("height"),Q=$.getAttribute("viewBox");if(m7(Z)||m7(K))return $;if(Z&&K&&Q){let H=Q.split(/[\s,]+/).map(parseFloat),z=parseFloat(Z),q=parseFloat(K);if(isNaN(z)||isNaN(q)||H.some((j)=>isNaN(j)))return $;let W=0.000001;if(H.length===4&&Math.abs(H[0])<W&&Math.abs(H[1])<W&&Math.abs(H[2]-z)<W&&Math.abs(H[3]-q)<W)$.removeAttribute("viewBox")}return $}),C8=j0(($,J={})=>{let Z=J.preserveSvgNamespace!==!1,K=J.removeXlinkNamespace!==!1;if(J.preserveVendor){if(!Z)$.removeAttribute("xmlns");return $}if(!Z)$.removeAttribute("xmlns");if(K){let Q=!1,H=(z)=>{for(let q of z.getAttributeNames())if(q.startsWith("xlink:")){Q=!0;return}for(let q of z.children){if(a(q))H(q);if(Q)return}};if(H($),!Q)$.removeAttribute("xmlns:xlink")}return $.removeAttribute("xmlns:svg"),$}),P8=j0(($,J={})=>{let Z=$.querySelectorAll("script").length>0,K=new Set,Q=(z)=>{for(let q of z.getAttributeNames()){let W=z.getAttribute(q);if(W&&W.includes("url(#")){let j=W.matchAll(/url\(#([^)]+)\)/g);for(let G of j)K.add(G[1])}if((q==="href"||q==="xlink:href")&&W&&W.startsWith("#"))K.add(W.substring(1))}for(let q of z.children)if(a(q))Q(q)};Q($);let H=$.getElementsByTagName("image");for(let z of[...H]){let q=z.getAttribute("id");if(q&&(K.has(q)||Z))continue;if(z.parentNode)z.parentNode.removeChild(z)}return $}),A8=j0(($,J={})=>{let Z=new Set,K=(H)=>{for(let z of H.getAttributeNames()){let q=H.getAttribute(z);if(q&&q.includes("url(#")){let W=q.matchAll(/url\(#([^)]+)\)/g);for(let j of W)Z.add(j[1])}if((z==="href"||z==="xlink:href")&&q&&q.startsWith("#"))Z.add(q.substring(1))}for(let z of H.children)if(a(z))K(z)};K($);let Q=$.getElementsByTagName("script");for(let H of[...Q]){let z=H.getAttribute("id");if(!z||!Z.has(z)){if(H.parentNode)H.parentNode.removeChild(H)}}return $}),E8=j0(($,J={})=>{let Z=J.precision||6,K=J.convertRoundedRects||!1,Q=["rect","circle","ellipse","line","polyline","polygon"],H=(z)=>{if(Q.includes(z.tagName)){if(z.tagName==="rect"){let W=parseFloat(z.getAttribute("x")||"0"),j=parseFloat(z.getAttribute("y")||"0"),G=parseFloat(z.getAttribute("width")||"0"),F=parseFloat(z.getAttribute("height")||"0");if(isNaN(W)||isNaN(j)||isNaN(G)||isNaN(F)){for(let _ of[...z.children])if(a(_))H(_);return}}if(z.tagName==="rect"&&!K){let W=parseFloat(z.getAttribute("rx")||"0"),j=parseFloat(z.getAttribute("ry")||"0");if(isNaN(W)||isNaN(j)||W>0||j>0){for(let G of[...z.children])if(a(G))H(G);return}}if(z.tagName==="polyline"||z.tagName==="polygon"){if((z.getAttribute("points")||"").trim().split(/[\s,]+/).length<4){for(let G of[...z.children])if(a(G))H(G);return}}let q=z5(z,Z);if(q){let W=new B0("path",{d:q});for(let j of z.getAttributeNames())if(!j.match(/^(x|y|cx|cy|r|rx|ry|width|height|x1|y1|x2|y2|points)$/)){let G=z.getAttribute(j);if(G!==null)W.setAttribute(j,G)}for(let j of[...z.children])W.appendChild(j);if(z.parentNode)z.parentNode.replaceChild(W,z)}}for(let q of[...z.children])if(a(q))H(q)};return H($),$}),T8=j0(($,J={})=>{let Z=J.precision||6,K=J.force||!1,Q=new Set,H=(q)=>{for(let W of["href","xlink:href"]){let j=q.getAttribute(W);if(j&&j.startsWith("#"))Q.add(j.substring(1))}for(let W of q.children)if(a(W))H(W)};H($);let z=$.getElementsByTagName("path");for(let q of z){let W=q.getAttribute("d");if(!W)continue;let j=q.getAttribute("id");if(!K&&j&&Q.has(j))continue;if(!K&&q.getAttribute("style"))continue;let G=q.getAttribute("stroke-linecap"),F=G&&G!=="butt";if((W.match(/[MmLlHhVvCcSsQqTtAaZz]/g)||[]).length<=1)continue;if(!K&&q.getAttribute("marker-mid"))continue;let U=H5(W);q.setAttribute("d",U)}return $}),b8=j0(($,J={})=>{let Z=J.precision||6,K=J.force||!1,Q=(H)=>{let z=H.getAttribute("transform");if(z){let q=F7(z),W=M5(q,Z);if(!K&&W.length>=z.length);else if(!K&&H.getAttribute("stroke")&&H.getAttribute("stroke")!=="none"){let j=q.data[0][0].toNumber(),G=q.data[0][1].toNumber(),F=q.data[1][0].toNumber(),_=q.data[1][1].toNumber(),U=j*_-G*F,O=Math.abs(j-_)<0.000001&&Math.abs(G+F)<0.000001,V=0.0000000001;if(!O&&Math.abs(U)>0.0000000001);else H.setAttribute("transform",W)}else H.setAttribute("transform",W)}for(let q of H.children)if(a(q))Q(q)};return Q($),$}),H$=j0(($,J={})=>{let Z=["fill","stroke","stop-color","flood-color","lighting-color"],K=(H)=>{if(!H||typeof H!=="string")return H;let z={white:"#fff",black:"#000",red:"#f00",green:"#0f0",blue:"#00f",yellow:"#ff0",cyan:"#0ff",magenta:"#f0f"};if(z[H.toLowerCase()])return z[H.toLowerCase()];let q=H.match(/^#([0-9a-f]{6})$/i);if(q){let W=q[1];if(W[0]===W[1]&&W[2]===W[3]&&W[4]===W[5])return`#${W[0]}${W[2]}${W[4]}`}return H},Q=(H)=>{for(let z of Z){let q=H.getAttribute(z);if(q)H.setAttribute(z,K(q))}for(let z of H.children)if(a(z))Q(z)};return Q($),$}),K9=j0(($,J={})=>{let Z=J.preserveVendor||!1,K=new Set(["alignment-baseline","baseline-shift","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cursor","direction","display","dominant-baseline","enable-background","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-orientation-horizontal","glyph-orientation-vertical","image-rendering","kerning","letter-spacing","lighting-color","marker","marker-end","marker-mid","marker-start","mask","opacity","overflow","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","transform","transform-origin","unicode-bidi","vector-effect","visibility","word-spacing","writing-mode"]),Q=(H)=>{let z=H.getAttribute("style");if(z){let q=z.split(";").map((j)=>j.trim()).filter((j)=>j),W=[];for(let j of q){let G=j.indexOf(":");if(G===-1)continue;let F=j.substring(0,G).trim(),_=j.substring(G+1).trim();if(F&&_){if(!F.startsWith("-")&&K.has(F))H.setAttribute(F,_);else if(Z&&F.startsWith("-"))W.push(j)}}if(W.length>0)H.setAttribute("style",W.join("; "));else H.removeAttribute("style")}for(let q of H.children)if(a(q))Q(q)};return Q($),$}),f8=j0(($,J={})=>{let Z=$.getElementsByTagName("ellipse");for(let K of[...Z]){let Q=parseFloat(K.getAttribute("rx")||"0"),H=parseFloat(K.getAttribute("ry")||"0");if(isNaN(Q)||isNaN(H))continue;if(Math.abs(Q-H)<0.001){let z=new B0("circle",{});for(let q of K.getAttributeNames()){let W=K.getAttribute(q);if(q==="rx"||q==="ry")z.setAttribute("r",W);else z.setAttribute(q,W)}for(let q of[...K.children])z.appendChild(q);if(K.parentNode)K.parentNode.replaceChild(z,K)}}return $}),S8=j0(($,J={})=>{let Z=J.force||!1,K=(Q,H=!1,z=!1)=>{let q=Q.tagName.toLowerCase(),W=z||q==="switch";for(let j of[...Q.children])if(a(j))K(j,!1,W);if(q!=="g")return;if(!Z&&(H||W))return;if(!Z&&Q.getAttribute("filter"))return;if(Q.children.length===1){let j=Q.children[0];if(!a(j))return;if(!Z&&j.getAttribute("id"))return;let G=Array.from(Q.children).some((U)=>a(U)&&s6.animation.has(U.tagName.toLowerCase()));if(!Z&&G)return;let F=Q.getAttributeNames(),_=F.some((U)=>{if(q6.has(U))return!1;return j.hasAttribute(U)});if(!Z&&_)return;if(F.length===0){if(Q.parentNode)Q.parentNode.replaceChild(j,Q)}else{let U=!0;for(let O of F){if(!q6.has(O)&&O!=="class"&&O!=="style"){U=!1;break}if(j.hasAttribute(O)){U=!1;break}}if(U&&Q.parentNode){for(let O of F){let V=Q.getAttribute(O);if(V!==null)j.setAttribute(O,V)}Q.parentNode.replaceChild(j,Q)}}}};return K($,!0),$}),v8=j0(($,J={})=>{let Z=J.force||!1,K=(H)=>H&&H.includes("url("),Q=(H)=>{let z=[...H.children].filter((q)=>a(q)&&q.tagName==="path");for(let q=0;q<z.length-1;q++){let W=z[q],j=z[q+1];if(!Z&&(W.children.length>0||j.children.length>0))continue;let F=["marker-start","marker-mid","marker-end"].some((O)=>W.getAttribute(O)||j.getAttribute(O));if(!Z&&F)continue;if(!Z&&(W.getAttribute("clip-path")||W.getAttribute("mask")||j.getAttribute("clip-path")||j.getAttribute("mask")))continue;if(!Z){let O=W.getAttribute("fill"),V=W.getAttribute("stroke"),M=j.getAttribute("fill"),Y=j.getAttribute("stroke");if(K(O)||K(V)||K(M)||K(Y))continue}if(!Z){let O=W.getAttribute("fill-rule")||"nonzero",V=j.getAttribute("fill-rule")||"nonzero";if(O!==V)continue}if(!Z&&(W.getAttribute("filter")||j.getAttribute("filter")))continue;let _=W.getAttributeNames().filter((O)=>O!=="d").sort(),U=j.getAttributeNames().filter((O)=>O!=="d").sort();if(JSON.stringify(_)===JSON.stringify(U)){let O=!0;for(let V of _)if(W.getAttribute(V)!==j.getAttribute(V)){O=!1;break}if(O){let V=W.getAttribute("d"),M=j.getAttribute("d");if(W.setAttribute("d",`${V} ${M}`),j.parentNode)j.parentNode.removeChild(j);z.splice(q+1,1),q--}}}for(let q of H.children)if(a(q))Q(q)};return Q($),$}),D8=j0(($,J={})=>{let Z=(K)=>{if(K.tagName==="g")for(let Q of[...K.getAttributeNames()]){if(!q6.has(Q))continue;let H=K.getAttribute(Q);if(H){for(let z of K.children)if(a(z)&&!z.hasAttribute(Q))z.setAttribute(Q,H);K.removeAttribute(Q)}}for(let Q of K.children)if(a(Q))Z(Q)};return Z($),$}),h8=j0(($,J={})=>{let Z=(K)=>{if(K.tagName==="g"&&K.children.length>1)for(let Q of q6){let H=null,z=!0;for(let q of K.children){if(!a(q))continue;let W=q.getAttribute(Q);if(!W){z=!1;break}if(H===null)H=W;else if(H!==W){z=!1;break}}if(z&&H){K.setAttribute(Q,H);for(let q of K.children)if(a(q))q.removeAttribute(Q)}}for(let Q of K.children)if(a(Q))Z(Q)};return Z($),$}),Z9=j0(($,J={})=>{if($.getElementsByTagName("script").length>0&&!J.force)return $;let K=$.getElementsByTagName("style");for(let Q of K){let H=Q.textContent;if(!H||!H.trim())continue;let z=H.includes("<![CDATA[")||H.includes("]]>"),q="",W="";if(z){let j=H.match(/^(\s*<!\[CDATA\[\s*)/),G=H.match(/(\s*\]\]>\s*)$/);if(j)q="<![CDATA[",H=H.replace(/^\s*<!\[CDATA\[\s*/,"");if(G)W="]]>",H=H.replace(/\s*\]\]>\s*$/,"")}if(H=H.replace(/\/\*[\s\S]*?\*\//g,""),H=H.replace(/\s+/g," "),H=H.replace(/\s*([{}:;,])\s*/g,"$1"),H=H.trim(),q||W)H=q+H+W;Q.textContent=H}return $}),y8=j0(($,J={})=>{let Z=J.onlyMatchedOnce!==!1,K=J.removeStyleElement!==!1,Q=$.getElementsByTagName("style"),H=[];for(let z of Q){let q=z.getAttribute("type");if(q&&q!=="text/css")continue;let W=z.textContent;if(!W||!W.trim())continue;if(W.includes("@media")||W.includes("@keyframes")||W.includes("@supports")||W.includes("@font-face"))continue;let j=W.match(/([^{]+)\{([^}]+)\}/g)||[],G=[];for(let U of j){let O=U.match(/([^{]+)\{([^}]+)\}/);if(!O)continue;let V=O[1].trim(),M=O[2].trim(),Y=!1;for(let w of wK.preventInlining)if(V.includes(w)){Y=!0;break}if(Y){H.push(U);continue}let X;try{X=X$(V)}catch(w){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${w.message}`);H.push(U);continue}G.push({selector:V,declarations:M,specificity:X,originalRule:U})}G.sort((U,O)=>k$(U.specificity,O.specificity));let F=new WeakMap,_=new Set;for(let{selector:U,declarations:O,specificity:V,originalRule:M}of G)try{let Y=$.querySelectorAll(U);if(Z&&U.startsWith("#")&&Y.length>1){H.push(M);continue}for(let X of Y){let w=X,R=!1;while(w){if(w.tagName==="foreignObject"){R=!0;break}w=w.parentNode}if(R)continue;if(!F.has(X))F.set(X,new Map),_.add(X);let I=F.get(X),f=X.getAttribute("style")||"";if(f&&I.size===0){let m=f.split(";");for(let S of m){let x=S.indexOf(":");if(x>0){let h=S.substring(0,x).trim(),E=S.substring(x+1).trim(),d=E.includes("!important");if(d)E=E.replace(/\s*!important\s*/g,"").trim();I.set(h,{specificity:[1,0,0,0],isImportant:d,value:E})}}}let u=O.split(";");for(let m of u){let S=m.indexOf(":");if(S<=0)continue;let x=m.substring(0,S).trim(),h=m.substring(S+1).trim(),E=h.includes("!important");if(E)h=h.replace(/\s*!important\s*/g,"").trim();let d=I.get(x);if(d){let c=k$(V,d.specificity);if(c<0){if(E&&!d.isImportant)I.set(x,{specificity:V,isImportant:E,value:h})}else if(c===0){if(E||!d.isImportant)I.set(x,{specificity:V,isImportant:E,value:h})}else if(!d.isImportant||E)I.set(x,{specificity:V,isImportant:E,value:h})}else I.set(x,{specificity:V,isImportant:E,value:h})}}}catch(Y){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${Y.message}`);H.push(M)}for(let U of _){let O=F.get(U),V=[];for(let[M,{value:Y,isImportant:X}]of O)if(X)V.push(`${M}: ${Y} !important`);else V.push(`${M}: ${Y}`);U.setAttribute("style",V.join("; "))}if(K&&z.parentNode)if(H.length>0)z.textContent=H.join(`
|
|
20
|
+
`);else z.parentNode.removeChild(z)}return $}),u8=j0(($,J={})=>{let Z=(K)=>{let Q=K.getAttributeNames().sort(),H=Q.map((z)=>[z,K.getAttribute(z)]);for(let z of Q)K.removeAttribute(z);for(let[z,q]of H)K.setAttribute(z,q);for(let z of K.children)if(a(z))Z(z)};return Z($),$}),g8=j0(($,J={})=>{let Z=$.getElementsByTagName("defs");for(let K of Z){let Q=[...K.children].filter((H)=>a(H));Q.sort((H,z)=>H.tagName.localeCompare(z.tagName));for(let H of[...K.children])K.removeChild(H);for(let H of Q)K.appendChild(H)}return $}),x8=j0(($,J={})=>{let Z=J.threshold||2,K=$.getElementsByTagName("path"),Q=new Map;for(let q of K){let W=q.getAttribute("d");if(W){if(!Q.has(W))Q.set(W,[]);Q.get(W).push(q)}}let H=$.querySelector("defs");if(!H)if(H=new B0("defs",{}),$.firstChild)$.insertBefore(H,$.firstChild);else $.appendChild(H);let z=0;for(let[q,W]of Q)if(W.length>=Z){let j=`path${z++}`,G=new B0("path",{id:j,d:q});H.appendChild(G);for(let F of W){let _=new B0("use",{href:`#${j}`});for(let U of F.getAttributeNames())if(U!=="d"){let O=F.getAttribute(U);if(O!==null)_.setAttribute(U,O)}for(let U of[...F.children])_.appendChild(U);if(F.parentNode)F.parentNode.replaceChild(_,F)}}return $}),m8=j0(($,J={})=>{let Z=$.getAttribute("viewBox");if(!Z)return $;let K=J5(Z);if(!K)return $;let Q=i7($),H=$.getElementsByTagName("path");for(let z of[...H]){let q=z.getAttribute("d");if(!q)continue;try{let W=u6(q),j=K5(W);if(!j)continue;let G=d6(z),_=m6(z,G,Q).getRenderedBBox(j),U={x:_.x,y:_.y,width:_.width,height:_.height};if(!Z5(U,K)){if(z.parentNode)z.parentNode.removeChild(z)}}catch(W){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${W.message}`)}}return $}),d8=j0(($,J={})=>{let Z=$.getElementsByTagName("style");for(let K of[...Z])if(K.parentNode)K.parentNode.removeChild(K);return $}),p8=j0(($,J={})=>{let Z={new:"_blank",replace:"_self"},K=!1,Q=(H)=>{for(let z of[...H.getAttributeNames()])if(z.startsWith("xlink:")){let q=z.substring(6),W=H.getAttribute(z);if(q==="href")K=!0;else if(q==="show"){if(!H.hasAttribute("target")){let j=Z[W];if(j)H.setAttribute("target",j)}H.removeAttribute(z)}else if(q==="title"){if(!(H.querySelector&&H.querySelector("title"))&&W){let G=new B0("title",{},[],W);if(typeof H.insertBefore==="function"&&H.firstChild)H.insertBefore(G,H.firstChild);else if(typeof H.appendChild==="function")H.appendChild(G);else if(H.children&&Array.isArray(H.children))H.children.unshift(G),G.parentNode=H}H.removeAttribute(z)}else if(["actuate","type","role","arcrole"].includes(q))H.removeAttribute(z);else K=!0}for(let z of H.children)if(a(z))Q(z)};if(Q($),!K)$.removeAttribute("xmlns:xlink");return $}),c8=j0(($,J={})=>{let Z=J.attributes||{};for(let[K,Q]of Object.entries(Z))$.setAttribute(K,Q);return $}),l8=j0(($,J={})=>{let Z=J.classes||[],K=$.getAttribute("class")||"",Q=K?`${K} ${Z.join(" ")}`:Z.join(" ");return $.setAttribute("class",Q.trim()),$}),n8=j0(($,J={})=>{let Z=J.prefix||"svg",K=new Map,Q=new Map,H=(j)=>j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=(j)=>{let G=j.getAttribute("id");if(G){let F=`${Z}${G}`;K.set(G,F),j.setAttribute("id",F)}for(let F of j.children)if(a(F))z(F)};if(z($),J.prefixClassNames!==!1){let j=(F)=>{let _=F.getAttribute("class");if(_){for(let U of _.split(/\s+/))if(U&&!Q.has(U))Q.set(U,`${Z}${U}`)}for(let U of F.children)if(a(U))j(U)};j($);let G=(F)=>{let _=F.getAttribute("class");if(_){let U=_.split(/\s+/).map((O)=>Q.get(O)||O).join(" ");F.setAttribute("class",U)}for(let U of F.children)if(a(U))G(U)};G($)}let q=$.getElementsByTagName("style");for(let j of q){let G=j.textContent;if(!G)continue;for(let[F,_]of K){let U=H(F);G=G.replace(new RegExp(`#${U}([^\\w-]|$)`,"g"),`#${_}$1`),G=G.replace(new RegExp(`url\\(#${U}\\)`,"g"),`url(#${_})`)}if(J.prefixClassNames!==!1)for(let[F,_]of Q){let U=H(F);G=G.replace(new RegExp(`\\.${U}([^\\w-]|$)`,"g"),`.${_}$1`)}j.textContent=G}let W=(j)=>{for(let G of j.getAttributeNames()){let F=j.getAttribute(G);if(F&&F.includes("url(#")){for(let[_,U]of K){let O=H(_);F=F.replace(new RegExp(`url\\(#${O}\\)`,"g"),`url(#${U})`)}j.setAttribute(G,F)}if((G==="href"||G==="xlink:href")&&F?.startsWith("#")){let _=F.substring(1);if(K.has(_))j.setAttribute(G,`#${K.get(_)}`)}if(G==="begin"||G==="end"){for(let[_,U]of K){let O=H(_);F=F.replace(new RegExp(`(^|;|\\s)${O}\\.`,"g"),`$1${U}.`)}j.setAttribute(G,F)}if(G==="values"||G==="from"||G==="to"||G==="by"){for(let[_,U]of K){let O=H(_);F=F.replace(new RegExp(`#${O}([;\\s]|$)`,"g"),`#${U}$1`)}j.setAttribute(G,F)}}for(let G of j.children)if(a(G))W(G)};return W($),$}),s8=j0(($,J={})=>{return $.removeAttribute("width"),$.removeAttribute("height"),$}),o8=j0(($,J={})=>{let Z=J.selector||"*",K=J.attributes||[];try{let Q=$.querySelectorAll(Z);for(let H of Q)for(let z of K)if(H.hasAttribute(z))H.removeAttribute(z)}catch(Q){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${Q.message}`)}return $}),i8=j0(($,J={})=>{let Z=J.pattern?new RegExp(J.pattern):null,K=J.attrs||[],Q=(H)=>{for(let z of[...H.getAttributeNames()])if(K.includes(z)||Z&&Z.test(z))H.removeAttribute(z);for(let z of H.children)if(a(z))Q(z)};return Q($),$}),r8=j0(($,J={})=>{let{name:Z,value:K}=J;if(!Z)return $;let Q=(H)=>{for(let z of[...H.children]){if(!a(z))continue;let q=z.getAttribute(Z);if(K===void 0){if(q!==null){H.removeChild(z);continue}}else if(q===K){H.removeChild(z);continue}Q(z)}};return Q($),$}),Q9=j0(async($,J={})=>{let Z={...J,outputFormat:q7.DOM_ELEMENT},K=$;return K=await Q$(K,Z),K=await Z$(K,Z),K=await K$(K,Z),K=await J$(K,Z),K=await $$(K,Z),K=await H$(K,Z),K=await K9(K,Z),K=await J9(K,Z),K=await $9(K,Z),K=await Z9(K,Z),K}),H9=j0(($,J={})=>{return $}),a8=j0(async($,J={})=>{let Z=J.preset||"default",K={...J,outputFormat:q7.DOM_ELEMENT};switch(Z){case"default":return await Q9($,K);case"none":return await H9($,K);default:return $}}),t8=j0(async($,J={})=>{let Z=J.config||{},K={...J,outputFormat:q7.DOM_ELEMENT},Q=$;if(Z.removeMetadata!==!1)Q=await Q$(Q,K);if(Z.removeComments!==!1)Q=await Z$(Q,K);if(Z.cleanupNumericValues!==!1)Q=await $$(Q,K);if(Z.convertColors!==!1)Q=await H$(Q,K);if(Z.removeHiddenElements!==!1)Q=await J$(Q,K);if(Z.removeEmptyContainers!==!1)Q=await K$(Q,K);return Q});function e8($={}){return{precision:$.precision||6,removeMetadata:$.removeMetadata!==!1,removeComments:$.removeComments!==!1,cleanupNumericValues:$.cleanupNumericValues!==!1,convertColors:$.convertColors!==!1,removeHiddenElements:$.removeHiddenElements!==!1,removeEmptyContainers:$.removeEmptyContainers!==!1,...$}}var $J=j0(async($,J={})=>{let Z=B7($,{minify:J.minify!==!1}),K=await B6(Z,{...J,resolveClipPaths:!0,resolveUse:!1,resolveMarkers:!1,resolvePatterns:!1,resolveMasks:!1,flattenTransforms:!1,removeUnusedDefs:!1});return d0(K.svg)}),JJ=j0(async($,J={})=>{let Z=B7($,{minify:J.minify!==!1}),K=await B6(Z,{...J,resolveMasks:!0,resolveClipPaths:!1,resolveUse:!1,resolveMarkers:!1,resolvePatterns:!1,flattenTransforms:!1,removeUnusedDefs:!1});return d0(K.svg)}),KJ=j0(($,J={})=>{let Z=i7($),K=(j)=>{let G=Z.get(j);if(!G)return null;let F=G.getAttribute("href")||G.getAttribute("xlink:href");return F?.startsWith("#")?F.substring(1):null},Q=(j,G)=>{let F=j.getAttribute("gradientUnits")||"objectBoundingBox",_=j.getAttribute("gradientTransform");if(Dz(G,K)){if(J.verbose)console.warn(`Circular gradient reference detected: #${G}`);return!1}if(F==="userSpaceOnUse")return!1;if(_)return!1;return!0},H=u7($,"fill");for(let j of H){let G=j.getAttribute("fill");if(G&&G.includes("url(")){let F=r7(G);if(F&&Z.has(F)){let _=Z.get(F),U=_.tagName.toLowerCase();if(U==="lineargradient"||U==="radialgradient"){if(!Q(_,F)){if(J.verbose)console.warn(`Skipping gradient flatten for ${F}: userSpaceOnUse or gradientTransform requires coordinate transformation`);continue}let O=SK(_,J.position||0.5);j.setAttribute("fill",O)}}else j.setAttribute("fill",J.fallbackColor||"#808080")}}let z=u7($,"stroke");for(let j of z){let G=j.getAttribute("stroke");if(G&&G.includes("url(")){let F=r7(G);if(F&&Z.has(F)){let _=Z.get(F),U=_.tagName.toLowerCase();if(U==="lineargradient"||U==="radialgradient"){if(!Q(_,F)){if(J.verbose)console.warn(`Skipping gradient flatten for ${F}: userSpaceOnUse or gradientTransform requires coordinate transformation`);continue}let O=SK(_,J.position||0.5);j.setAttribute("stroke",O)}}else j.setAttribute("stroke",J.fallbackColor||"#808080")}}let q=[...$.querySelectorAll("linearGradient, radialGradient")],W=(j)=>j.replace(/["\\]/g,"\\$&");for(let j of q){let G=j.getAttribute("id"),F=G?W(G):"";if(!(G&&([...$.querySelectorAll(`[fill*="url(#${F})"]`)].length>0||[...$.querySelectorAll(`[stroke*="url(#${F})"]`)].length>0))&&j.parentNode)j.parentNode.removeChild(j)}return $});function SK($,J=0.5){let Z=[...$.children].filter((q)=>q.tagName&&q.tagName.toLowerCase()==="stop");if(Z.length===0)return"#808080";if(Z.length===1)return vK(Z[0]);let K=Z.map((q)=>{let W=q.getAttribute("offset")||"0";if(W.endsWith("%"))W=parseFloat(W)/100;else W=parseFloat(W);return W=isNaN(W)?0:Math.max(0,Math.min(1,W)),{offset:W,color:vK(q),opacity:hz(q)}});K.sort((q,W)=>q.offset-W.offset);let Q=null,H=null;for(let q=0;q<K.length;q++){let W=K[q];if(W.offset<=J)Q=W;if(W.offset>=J&&!H){H=W;break}}if(!Q)return K[0].color;if(!H)return K[K.length-1].color;if(Q.offset===H.offset)return Q.color;let z=(J-Q.offset)/(H.offset-Q.offset);return uz(Q.color,H.color,z)}function vK($){let J=$.getAttribute("stop-color");if(!J){let Z=$.getAttribute("style");if(Z){let K=Z.match(/stop-color\s*:\s*([^;]+)/i);if(K)J=K[1].trim()}}if(!J)J="#000000";return yz(J)}function hz($){let J=$.getAttribute("stop-opacity");if(!J){let K=$.getAttribute("style");if(K){let Q=K.match(/stop-opacity\s*:\s*([^;]+)/i);if(Q)J=Q[1].trim()}}let Z=J?parseFloat(J):1;return isNaN(Z)?1:Z}function yz($){if(!$||typeof $!=="string")return"#000000";let J=$.trim().toLowerCase();if(J.startsWith("#")){if(J.length===4)return"#"+J[1]+J[1]+J[2]+J[2]+J[3]+J[3];return J}if(J.startsWith("rgb(")){let K=J.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);if(K){let Q=parseInt(K[1],10),H=parseInt(K[2],10),z=parseInt(K[3],10);return mK(Q,H,z)}}let Z={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff",yellow:"#ffff00",cyan:"#00ffff",magenta:"#ff00ff",gray:"#808080",grey:"#808080",silver:"#c0c0c0",maroon:"#800000",olive:"#808000",lime:"#00ff00",aqua:"#00ffff",teal:"#008080",navy:"#000080",fuchsia:"#ff00ff",purple:"#800080"};if(Z[J])return Z[J];return"#000000"}function uz($,J,Z){let K=(U)=>{let O=U.replace("#","");if(O.length===3)O=O[0]+O[0]+O[1]+O[1]+O[2]+O[2];let V=parseInt(O.slice(0,2),16),M=parseInt(O.slice(2,4),16),Y=parseInt(O.slice(4,6),16);if(isNaN(V)||isNaN(M)||isNaN(Y))return[0,0,0];return[V,M,Y]},[Q,H,z]=K($),[q,W,j]=K(J),G=Math.round(Q+(q-Q)*Z),F=Math.round(H+(W-H)*Z),_=Math.round(z+(j-z)*Z);return mK(G,F,_)}function mK($,J,Z){let K=(Q)=>{return Math.max(0,Math.min(255,Math.round(Q))).toString(16).padStart(2,"0")};return"#"+K($)+K(J)+K(Z)}var ZJ=j0(async($,J={})=>{let Z=B7($,{minify:J.minify!==!1}),K=await B6(Z,{...J,resolvePatterns:!0,resolveClipPaths:!1,resolveUse:!1,resolveMarkers:!1,resolveMasks:!1,flattenTransforms:!1,removeUnusedDefs:!1});return d0(K.svg)}),QJ=j0(($,J={})=>{let Z=(Q)=>{if(Q.hasAttribute("filter"))Q.removeAttribute("filter");for(let H of Q.children)if(a(H))Z(H)};Z($);let K=$.getElementsByTagName("filter");for(let Q of[...K])if(Q.parentNode)Q.parentNode.removeChild(Q);return $}),HJ=j0(async($,J={})=>{let Z=B7($,{minify:J.minify!==!1}),K=await B6(Z,{...J,resolveUse:!0,resolveClipPaths:!1,resolveMarkers:!1,resolvePatterns:!1,resolveMasks:!1,flattenTransforms:!1,removeUnusedDefs:!1});return d0(K.svg)}),zJ=j0(($,J={})=>{let Z=$.getElementsByTagName("image");for(let K of[...Z])K.setAttribute("data-trace-needed","true");return $}),qJ=j0(($,J={})=>{let{samples:Z=10,includeStroke:K=!0,includeFillOnly:Q=!1}=J,H=[...$.getElementsByTagName("path"),...$.getElementsByTagName("rect"),...$.getElementsByTagName("circle"),...$.getElementsByTagName("ellipse")],z=i7($),q=[];for(let W=0;W<H.length;W++)for(let j=W+1;j<H.length;j++){let G=H[W],F=H[j],_=a$(G,Z),U=a$(F,Z);if(!_||!U)continue;let O=d6(G),V=d6(F),M=m6(G,O,z),Y=m6(F,V,z);if(K&&!Q){if(M.hasStroke){let w=M.getStrokeExtent().toNumber();_=DK(_,w)}if(Y.hasStroke){let w=Y.getStrokeExtent().toNumber();U=DK(U,w)}}if(Y$(_,U).overlaps)q.push({shape1:G.tagName,shape2:F.tagName,id1:G.getAttribute("id"),id2:F.getAttribute("id"),stroke1:M.hasStroke?M.strokeWidth.toNumber():0,stroke2:Y.hasStroke?Y.strokeWidth.toNumber():0,fillRule1:M.fillRule,fillRule2:Y.fillRule})}if(q.length>0)$.setAttribute("data-collisions",JSON.stringify(q));return $});function DK($,J){if(J<=0||!$||$.length===0)return $;let Z=0,K=0;for(let Q of $)Z+=Q.x,K+=Q.y;return Z/=$.length,K/=$.length,$.map((Q)=>{let H=Q.x-Z,z=Q.y-K,q=Math.sqrt(H*H+z*z);if(q<0.0001)return Q;let W=(q+J)/q;return{x:Z+H*W,y:K+z*W}})}var WJ=j0(($,J={})=>{let{id1:Z,id2:K}=J;if(!Z||!K)return $;let Q=$.getElementById(Z),H=$.getElementById(K);if(!Q||!H)return $;let z=a$(Q,J.samples||10),q=a$(H,J.samples||10);if(z&&q){let W=aJ(z,q);$.setAttribute("data-distance",W.distance.toString())}return $}),jJ=j0(($,J={})=>{let Z=[],K=[],Q=new Set,H=new Set,z=(W)=>{if(W.tagName.includes(":")){let j=W.tagName.split(":")[0];Q.add(j)}for(let j of W.getAttributeNames()){let G=W.getAttribute(j);if(j==="xmlns")H.add("");else if(j.startsWith("xmlns:")){let F=j.substring(6);H.add(F)}if(j.includes(":")&&!j.startsWith("xmlns:")){let F=j.split(":")[0];Q.add(F)}if(G&&/[\x00-\x08\x0B\x0C\x0E-\x1F]/.test(G))Z.push(`Invalid XML characters in attribute '${j}' of <${W.tagName}>`)}if(W.textContent&&/[\x00-\x08\x0B\x0C\x0E-\x1F]/.test(W.textContent))Z.push(`Invalid XML characters in text content of <${W.tagName}>`);for(let j of W.children)if(a(j))z(j)};z($);for(let W of Q)if(W&&!H.has(W))Z.push(`Unbound namespace prefix: '${W}' - SVGO would produce invalid XML here`);let q={valid:Z.length===0,errors:Z,warnings:K,namespacesUsed:[...Q],namespacesDeclared:[...H]};return $.setAttribute("data-xml-validation",JSON.stringify(q)),$}),GJ=j0(($,J={})=>{let Z=[],K=[],Q=J.version||"1.1";if($.tagName!=="svg")Z.push("Root element must be <svg>");let H=$.getAttribute("xmlns");if(!H)K.push("Missing xmlns attribute (required for standalone SVG)");else if(H!=="http://www.w3.org/2000/svg")Z.push(`Invalid SVG namespace: expected 'http://www.w3.org/2000/svg', got '${H}'`);let z=$.getAttribute("viewBox");if(z){let F=z.split(/[\s,]+/);if(F.length!==4)Z.push(`Invalid viewBox: expected 4 values, got ${F.length}`);else if(F.some((_)=>isNaN(parseFloat(_))))Z.push("Invalid viewBox: contains non-numeric values");else{let[_,U,O,V]=F.map(parseFloat);if(O<0||V<0)Z.push("Invalid viewBox: width and height must be non-negative")}}let q={meshGradients:[],hatches:[],solidColors:[],needsPolyfills:!1},W={meshGradient:"meshgradient",meshRow:"meshrow",meshPatch:"meshpatch",hatchPath:"hatchpath",solidColor:"solidcolor"},j=(F,_=0)=>{if(!F||!F.tagName){K.push(`Element at depth ${_} has no tagName property`);return}let U=F.tagName.toLowerCase(),O=F.tagName;if(W[O])Z.push(`Invalid SVG 2.0 element: <${O}> must be lowercase <${W[O]}> per SVG 2.0 specification`);if(U==="meshgradient"){let V=F.getAttribute("id");if(q.meshGradients.push(V||null),q.needsPolyfills=!0,!V)K.push("<meshgradient> element without 'id' attribute may be difficult to reference")}if(U==="hatch"){let V=F.getAttribute("id");if(q.hatches.push(V||null),q.needsPolyfills=!0,!V)K.push("<hatch> element without 'id' attribute may be difficult to reference")}if(U==="solidcolor"){let V=F.getAttribute("id");if(q.solidColors.push(V||null),q.needsPolyfills=!0,!V)K.push("<solidcolor> element without 'id' attribute may be difficult to reference")}if(U==="path"){let V=F.getAttribute("d");if(!V||!V.trim())Z.push("<path> element missing required 'd' attribute");else{let M=V.match(/[MmLlHhVvCcSsQqTtAaZz]/g);if(!M||M.length===0)Z.push("<path> 'd' attribute contains no valid commands");let Y=V.trim()[0];if(Y!=="M"&&Y!=="m")Z.push("<path> 'd' must start with M or m command")}}if(U==="rect"){let V=F.getAttribute("width"),M=F.getAttribute("height");if(V!==null&&!m7(V)&&parseFloat(V)<0)Z.push("<rect> width must be non-negative");if(M!==null&&!m7(M)&&parseFloat(M)<0)Z.push("<rect> height must be non-negative")}if(U==="circle"){let V=F.getAttribute("r");if(V!==null&&parseFloat(V)<0)Z.push("<circle> r must be non-negative")}if(U==="ellipse"){let V=F.getAttribute("rx"),M=F.getAttribute("ry");if(V!==null&&parseFloat(V)<0)Z.push("<ellipse> rx must be non-negative");if(M!==null&&parseFloat(M)<0)Z.push("<ellipse> ry must be non-negative")}if(U==="use"){let V=F.getAttribute("href")||F.getAttribute("xlink:href");if(V&&V.startsWith("#")){let M=V.substring(1);if(!$.getElementById(M))K.push(`<use> references non-existent ID: '${M}'`)}}for(let V of["fill","stroke","clip-path","mask","filter"]){let M=F.getAttribute(V);if(M&&M.startsWith("url(#")){let Y=M.match(/url\(#([^)]+)\)/);if(Y){let X=Y[1];if(!$.getElementById(X))K.push(`<${F.tagName}> ${V} references non-existent ID: '${X}'`)}}}if(o6[U]){let V=o6[U];for(let M of F.children)if(a(M)){let Y=M.tagName.toLowerCase();if(!V.has(Y))K.push(`<${Y}> is not a standard child of <${U}>`)}}for(let V of F.children)if(a(V))j(V,_+1)};if(j($),q.needsPolyfills){let F=[];if(q.meshGradients.length>0)F.push(`meshgradient (${q.meshGradients.length} found)`);if(q.hatches.length>0)F.push(`hatch (${q.hatches.length} found)`);if(q.solidColors.length>0)F.push(`solidcolor (${q.solidColors.length} found)`);K.push(`SVG contains SVG 2.0 features that require polyfills for browser compatibility: ${F.join(", ")}. Use --svg2-polyfills option to inject runtime polyfills.`)}let G={valid:Z.length===0,svgVersion:Q,errors:Z,warnings:K,elementsChecked:iK($),svg2Features:q};if($.setAttribute("data-svg-validation",JSON.stringify(G)),Z.length>0)$.setAttribute("data-validation-errors",JSON.stringify(Z));else $.setAttribute("data-validation-status","valid");return $}),gz=new Set(["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","focus","blur","focusin","focusout","keydown","keyup","keypress","activate","load","unload","abort","error","resize","scroll","beginEvent","endEvent","repeatEvent","touchstart","touchend","touchmove","touchcancel","wheel","auxclick","input","beforeinput","select","compositionstart","compositionupdate","compositionend"]),dK=j0(($,J={})=>{let Z=J.verbose||!1,K=J.printTables!==!1,Q={valid:!0,timestamp:new Date().toISOString(),media:{hasAudio:!1,hasVideo:!1,audioElements:[],videoElements:[],foreignObjectWithMedia:[],mediaEmbedMethod:null},smil:{hasAnimations:!1,animationCount:0,animationElements:{animate:0,animateTransform:0,animateMotion:0,animateColor:0,set:0},hasInteractiveAnimations:!1,eventTriggers:[],timingTriggers:[]},compatibility:{worksInAllBrowsers:!0,issues:[],recommendations:[]},errors:[],warnings:[],info:[]},H=(V)=>{let M=[],Y=V.toLowerCase(),X=(w)=>{if(w.tagName&&w.tagName.toLowerCase()===Y)M.push(w);for(let R of w.children||[])if(R&&R.tagName)X(R)};return X($),M},z=(V,M=[])=>{if(V.tagName)M.push(V);for(let Y of V.children||[])if(Y&&Y.tagName)z(Y,M);return M},q=H("audio");if(q.length>0)Q.media.hasAudio=!0,Q.media.audioElements=q.map((V)=>({id:V.getAttribute("id"),src:V.getAttribute("src"),hasSource:H("source").filter((M)=>M.parentNode===V).length>0}));let W=H("video");if(W.length>0)Q.media.hasVideo=!0,Q.media.videoElements=W.map((V)=>({id:V.getAttribute("id"),src:V.getAttribute("src")}));let j=H("foreignObject");for(let V of j){let M=V.children||[],Y=!1,X=[],w=(R)=>{let I=R.tagName?.toLowerCase();if(I==="audio"||I==="video")Y=!0,X.push({type:I,id:R.getAttribute("id"),src:R.getAttribute("src")});for(let f of R.children||[])if(f&&f.tagName)w(f)};for(let R of M)if(R&&R.tagName)w(R);if(Y)Q.media.hasAudio=!0,Q.media.foreignObjectWithMedia.push({id:V.getAttribute("id"),media:X}),Q.media.mediaEmbedMethod="foreignObject"}let G=z($);for(let V of G)for(let M of["src","href","xlink:href"]){let Y=V.getAttribute(M);if(Y&&Y.startsWith("data:audio/"))Q.media.hasAudio=!0,Q.media.mediaEmbedMethod="data-uri";if(Y&&Y.startsWith("data:video/"))Q.media.hasVideo=!0,Q.media.mediaEmbedMethod="data-uri"}let F=["animate","animateTransform","animateMotion","animateColor","set"];for(let V of F){let M=H(V),Y=M.length;Q.smil.animationElements[V==="animateTransform"?"animateTransform":V==="animateMotion"?"animateMotion":V==="animateColor"?"animateColor":V]=Y,Q.smil.animationCount+=Y;for(let X of M){let w=X.getAttribute("begin")||"",R=X.getAttribute("end")||"",I=(m,S)=>{let x=m.split(";").map((h)=>h.trim()).filter(Boolean);for(let h of x){let E=h.match(/^(?:([a-zA-Z_][a-zA-Z0-9_-]*)\.)?([a-zA-Z]+)(\s*[+-]\s*[\d.]+[smh]?)?$/);if(E){let[,d,c,p]=E;if(gz.has(c))Q.smil.hasInteractiveAnimations=!0,Q.smil.eventTriggers.push({animationElement:V,animationId:X.getAttribute("id"),attribute:S,event:c,targetId:d||null,offset:p?.trim()||null,parentId:X.parentNode?.getAttribute?.("id")})}else if(/^[\d.]+[smh]?$/.test(h)||h==="indefinite")Q.smil.timingTriggers.push({animationElement:V,value:h});else if(/\.(begin|end)/.test(h))Q.smil.timingTriggers.push({animationElement:V,value:h,type:"syncbase"})}};if(w)I(w,"begin");if(R)I(R,"end");let f=X.getAttribute("onbegin"),u=X.getAttribute("onend");if(f||u){if(Q.smil.hasInteractiveAnimations=!0,f?.includes("play()")||u?.includes("play()"))Q.info.push(`Animation uses JavaScript to trigger audio playback via ${f?"onbegin":"onend"} handler`)}}}if(Q.smil.hasAnimations=Q.smil.animationCount>0,Q.media.hasAudio)Q.compatibility.worksInAllBrowsers=!1,Q.warnings.push("SVG contains embedded audio. Browser autoplay policies will block playback in most scenarios."),Q.compatibility.issues.push({type:"AUDIO_AUTOPLAY_BLOCKED",severity:"HIGH",description:"Embedded audio in SVG is blocked by Chrome/Firefox/Safari autoplay policies",affectedBrowsers:["Chrome","Firefox","Safari","Edge"]}),Q.compatibility.recommendations.push("To enable audio playback, embed the SVG in an HTML page that extracts audio dynamically after user interaction","Use JavaScript to extract audio data URI from foreignObject and create Audio element on click","Consider using Web Audio API for more control over audio playback");if(Q.media.hasVideo)Q.compatibility.worksInAllBrowsers=!1,Q.warnings.push("SVG contains embedded video. This has limited browser support and autoplay restrictions.");if(Q.smil.hasAnimations)Q.info.push(`SVG contains ${Q.smil.animationCount} SMIL animation elements`),Q.compatibility.issues.push({type:"SMIL_IE_UNSUPPORTED",severity:"LOW",description:"SMIL animations are not supported in IE11",affectedBrowsers:["IE (no support)"]});if(Q.smil.hasInteractiveAnimations){let V=[...new Set(Q.smil.eventTriggers.map((M)=>M.event))];if(Q.info.push(`SVG contains interactive SMIL animations triggered by: ${V.join(", ")}`),V.includes("click")||V.includes("mouseover"))Q.compatibility.recommendations.push("Interactive animations (click/hover) work in most browsers but require the SVG to be inline or loaded as <object>/<embed>","Using <img> tag to display SVG will disable all interactivity and animations")}let _={Chrome:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"Autoplay blocked without user gesture"},Firefox:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"MEI (Media Engagement Index) affects autoplay"},Safari:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"Strict autoplay policy"},Edge:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"Chromium-based, same as Chrome"},"IE 11":{smil:"No support",audio:"No support",interactive:"No support",notes:"Use CSS animations or JavaScript"}},U=[{scenario:"Standalone SVG",protocol:"file://",example:"file:///path/to/sample.svg",smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"SMIL works, audio blocked by autoplay policy"},{scenario:"Standalone SVG",protocol:"http://",example:"http://localhost/sample.svg",smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"SMIL works, audio blocked by autoplay policy"},{scenario:"SVG in HTML via <img>",protocol:"any",example:'<img src="sample.svg">',smilWorks:!1,audioWorks:!1,interactiveWorks:!1,notes:"All scripting and interactivity disabled"},{scenario:"SVG in HTML via <object>",protocol:"any",example:'<object data="sample.svg">',smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"Full SVG features, audio still blocked"},{scenario:"SVG in HTML via <embed>",protocol:"any",example:'<embed src="sample.svg">',smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"Full SVG features, audio still blocked"},{scenario:"Inline SVG in HTML",protocol:"any",example:"<svg>...</svg> in HTML",smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"Full features, audio needs user gesture"},{scenario:"HTML extracts audio on click",protocol:"file://",example:"JS extracts data-uri, plays on click",smilWorks:!0,audioWorks:!0,interactiveWorks:!0,notes:"WORKS - user gesture enables audio"},{scenario:"HTML extracts audio on click",protocol:"http://",example:"JS extracts data-uri, plays on click",smilWorks:!0,audioWorks:!0,interactiveWorks:!0,notes:"WORKS - user gesture enables audio"}],O=[{trigger:'begin="click"',description:"Animation starts on click (on animation target)",syntax:'<animate begin="click" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Target element must be clickable (not in <defs>)"},{trigger:'begin="elementId.click"',description:"Animation starts when another element is clicked",syntax:'<animate begin="button.click" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Referenced element must exist with matching id"},{trigger:'begin="mouseover"',description:"Animation starts on mouse hover",syntax:'<animate begin="mouseover" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Often paired with mouseout for hover effects"},{trigger:'begin="elementId.mouseover"',description:"Animation starts when hovering another element",syntax:'<animate begin="trigger.mouseover" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Useful for triggering animations on related elements"},{trigger:'begin="mouseout"',description:"Animation starts when mouse leaves",syntax:'<animate begin="mouseout" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Use with mouseover for complete hover cycle"},{trigger:'begin="focus"',description:"Animation starts when element receives focus",syntax:'<animate begin="focus" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Works with focusable elements (links, inputs)"},{trigger:'begin="accessKey(s)"',description:"Animation starts on keyboard shortcut",syntax:'<animate begin="accessKey(s)" .../>',browserSupport:"Limited",notes:"Press Alt+S (Windows) or Ctrl+Opt+S (Mac)"}];if(Q.tables={browserSupport:_,usageScenarios:U,smilEventScenarios:O},K&&(Q.media.hasAudio||Q.media.hasVideo||Q.smil.hasInteractiveAnimations)){if(console.log(`
|
|
21
|
+
`+"=".repeat(80)),console.log("SVG COMPATIBILITY ANALYSIS REPORT"),console.log("=".repeat(80)),console.log(`
|
|
22
|
+
--- SUMMARY ---`),console.log(`SMIL Animations: ${Q.smil.animationCount} (${Q.smil.hasInteractiveAnimations?"includes interactive":"time-based only"})`),console.log(`Audio Elements: ${Q.media.hasAudio?"YES":"NO"}`),console.log(`Video Elements: ${Q.media.hasVideo?"YES":"NO"}`),Q.media.hasAudio)console.log(`
|
|
23
|
+
--- AUDIO PLAYBACK WARNING ---`),console.log("This SVG contains embedded audio which will be BLOCKED by browser autoplay policies."),console.log("Audio will NOT play automatically in any browser without user interaction.");console.log(`
|
|
24
|
+
--- BROWSER SUPPORT ---`),console.log("┌─────────────┬────────────────────┬──────────────────────────┬─────────────┐"),console.log("│ Browser │ SMIL Animations │ Audio Autoplay │ Interactive │"),console.log("├─────────────┼────────────────────┼──────────────────────────┼─────────────┤");for(let[V,M]of Object.entries(_)){let Y=V.padEnd(11),X=M.smil.padEnd(18),w=M.audio.padEnd(24),R=M.interactive.padEnd(11);console.log(`│ ${Y} │ ${X} │ ${w} │ ${R} │`)}console.log("└─────────────┴────────────────────┴──────────────────────────┴─────────────┘"),console.log(`
|
|
25
|
+
--- USAGE SCENARIOS ---`),console.log("┌────────────────────────────────┬───────────┬───────┬───────┬─────────────┐"),console.log("│ Scenario │ Protocol │ SMIL │ Audio │ Interactive │"),console.log("├────────────────────────────────┼───────────┼───────┼───────┼─────────────┤");for(let V of U){let M=V.scenario.substring(0,30).padEnd(30),Y=V.protocol.padEnd(9),X=(V.smilWorks?"✅":"❌").padEnd(5),w=(V.audioWorks?"✅":"❌").padEnd(5),R=(V.interactiveWorks?"✅":"❌").padEnd(11);console.log(`│ ${M} │ ${Y} │ ${X} │ ${w} │ ${R} │`)}if(console.log("└────────────────────────────────┴───────────┴───────┴───────┴─────────────┘"),Q.smil.hasInteractiveAnimations){console.log(`
|
|
26
|
+
--- SMIL INTERACTIVE EVENT TRIGGERS ---`),console.log("┌───────────────────────────────┬────────────────────────────────────────────┐"),console.log("│ Trigger Syntax │ Description │"),console.log("├───────────────────────────────┼────────────────────────────────────────────┤");for(let V of O){let M=V.trigger.padEnd(29),Y=V.description.substring(0,42).padEnd(42);console.log(`│ ${M} │ ${Y} │`)}if(console.log("└───────────────────────────────┴────────────────────────────────────────────┘"),Q.smil.eventTriggers.length>0){console.log(`
|
|
27
|
+
--- DETECTED INTERACTIVE TRIGGERS IN THIS SVG ---`);for(let V of Q.smil.eventTriggers){let M=V.targetId?`${V.targetId}.${V.event}`:V.event;console.log(` - <${V.animationElement}> triggered by: ${M}${V.offset?` ${V.offset}`:""}`)}}}if(Q.compatibility.recommendations.length>0){console.log(`
|
|
28
|
+
--- RECOMMENDATIONS ---`);for(let V of Q.compatibility.recommendations)console.log(` • ${V}`)}console.log(`
|
|
29
|
+
`+"=".repeat(80)+`
|
|
30
|
+
`)}return Q.valid=Q.errors.length===0,$.setAttribute("data-compatibility-report",JSON.stringify({hasAudio:Q.media.hasAudio,hasVideo:Q.media.hasVideo,smilCount:Q.smil.animationCount,hasInteractive:Q.smil.hasInteractiveAnimations,issues:Q.compatibility.issues.length})),$._compatibilityReport=Q,$}),a6={RENDER_VECTORS:{cat:"display",name:"Vector paths/shapes",critical:!0},RENDER_TEXT:{cat:"display",name:"Text rendering",critical:!0},RENDER_GRADIENTS:{cat:"display",name:"Gradients (linear/radial)",critical:!1},RENDER_PATTERNS:{cat:"display",name:"Pattern fills",critical:!1},RENDER_OPACITY:{cat:"display",name:"Opacity/transparency",critical:!1},RENDER_BLENDMODES:{cat:"display",name:"Blend modes",critical:!1},RENDER_TRANSFORMS:{cat:"display",name:"Transforms",critical:!0},FONTS_EMBEDDED:{cat:"fonts",name:"Embedded fonts (data-uri)",critical:!1},FONTS_SYSTEM:{cat:"fonts",name:"System fonts",critical:!1},FONTS_WEB_SAME:{cat:"fonts",name:"Web fonts (same-origin)",critical:!1},FONTS_WEB_CROSS:{cat:"fonts",name:"Web fonts (cross-origin)",critical:!1},IMAGES_EMBEDDED:{cat:"images",name:"Embedded images (data-uri)",critical:!1},IMAGES_LOCAL:{cat:"images",name:"Local images",critical:!1},IMAGES_REMOTE_SAME:{cat:"images",name:"Remote images (same-origin)",critical:!1},IMAGES_REMOTE_CROSS:{cat:"images",name:"Remote images (cross-origin)",critical:!1},FILTERS_BASIC:{cat:"effects",name:"Basic filters (blur, shadow)",critical:!1},FILTERS_COMPLEX:{cat:"effects",name:"Complex filters (lighting, turbulence)",critical:!1},MASKS:{cat:"effects",name:"Mask elements",critical:!1},CLIP_PATHS:{cat:"effects",name:"Clip paths",critical:!1},SMIL_TIMED:{cat:"animation",name:"SMIL time-based animation",critical:!1},SMIL_CLICK:{cat:"animation",name:"SMIL click-triggered",critical:!1},SMIL_HOVER:{cat:"animation",name:"SMIL mouseover-triggered",critical:!1},SMIL_FOCUS:{cat:"animation",name:"SMIL focus-triggered",critical:!1},SMIL_ACCESSKEY:{cat:"animation",name:"SMIL accessKey-triggered",critical:!1},SMIL_SYNCBASE:{cat:"animation",name:"SMIL syncbase (anim.begin)",critical:!1},CSS_KEYFRAMES:{cat:"animation",name:"CSS @keyframes animation",critical:!1},CSS_TRANSITIONS:{cat:"animation",name:"CSS transitions",critical:!1},CSS_HOVER:{cat:"animation",name:"CSS :hover effects",critical:!1},SCRIPT_INLINE:{cat:"scripting",name:"Inline <script>",critical:!1},SCRIPT_EXTERNAL:{cat:"scripting",name:'External <script src="">',critical:!1},SCRIPT_MODULE:{cat:"scripting",name:"ES modules in SVG",critical:!1},EVENT_ONCLICK:{cat:"events",name:"onclick handler",critical:!1},EVENT_ONDBLCLICK:{cat:"events",name:"ondblclick handler",critical:!1},EVENT_ONMOUSEDOWN:{cat:"events",name:"onmousedown handler",critical:!1},EVENT_ONMOUSEUP:{cat:"events",name:"onmouseup handler",critical:!1},EVENT_ONMOUSEOVER:{cat:"events",name:"onmouseover handler",critical:!1},EVENT_ONMOUSEOUT:{cat:"events",name:"onmouseout handler",critical:!1},EVENT_ONMOUSEMOVE:{cat:"events",name:"onmousemove handler",critical:!1},EVENT_ONFOCUS:{cat:"events",name:"onfocus handler",critical:!1},EVENT_ONBLUR:{cat:"events",name:"onblur handler",critical:!1},EVENT_ONLOAD:{cat:"events",name:"onload handler",critical:!1},EVENT_ONERROR:{cat:"events",name:"onerror handler",critical:!1},EVENT_ONSCROLL:{cat:"events",name:"onscroll handler",critical:!1},EVENT_ONWHEEL:{cat:"events",name:"onwheel handler",critical:!1},EVENT_ONTOUCH:{cat:"events",name:"touch events",critical:!1},EVENT_ONKEYBOARD:{cat:"events",name:"keyboard events",critical:!1},LINK_INTERNAL:{cat:"links",name:"Internal anchor links",critical:!1},LINK_EXTERNAL:{cat:"links",name:"External hyperlinks",critical:!1},LINK_TARGET:{cat:"links",name:"Link target attribute",critical:!1},LINK_DOWNLOAD:{cat:"links",name:"Download attribute",critical:!1},FOREIGNOBJECT_BASIC:{cat:"html",name:"foreignObject rendering",critical:!1},FOREIGNOBJECT_HTML:{cat:"html",name:"HTML in foreignObject",critical:!1},FOREIGNOBJECT_FORM:{cat:"html",name:"Forms in foreignObject",critical:!1},FOREIGNOBJECT_INPUT:{cat:"html",name:"Input elements in foreignObject",critical:!1},FOREIGNOBJECT_CANVAS:{cat:"html",name:"Canvas in foreignObject",critical:!1},FOREIGNOBJECT_VIDEO:{cat:"html",name:"Video in foreignObject",critical:!1},FOREIGNOBJECT_IFRAME:{cat:"html",name:"iframe in foreignObject",critical:!1},AUDIO_EMBEDDED:{cat:"media",name:"Embedded audio (data-uri)",critical:!1},AUDIO_LOCAL:{cat:"media",name:"Local audio files",critical:!1},AUDIO_REMOTE:{cat:"media",name:"Remote audio files",critical:!1},AUDIO_AUTOPLAY:{cat:"media",name:"Audio autoplay",critical:!1},AUDIO_CONTROLS:{cat:"media",name:"Audio controls visible",critical:!1},VIDEO_EMBEDDED:{cat:"media",name:"Embedded video (data-uri)",critical:!1},VIDEO_LOCAL:{cat:"media",name:"Local video files",critical:!1},VIDEO_REMOTE:{cat:"media",name:"Remote video files",critical:!1},VIDEO_AUTOPLAY:{cat:"media",name:"Video autoplay",critical:!1},USE_INTERNAL:{cat:"sprites",name:"Internal <use> references",critical:!1},USE_EXTERNAL_SAME:{cat:"sprites",name:"External <use> (same-origin)",critical:!1},USE_EXTERNAL_CROSS:{cat:"sprites",name:"External <use> (cross-origin)",critical:!1},USE_SHADOW_DOM:{cat:"sprites",name:"Shadow DOM styling of <use>",critical:!1},MAP_BASIC:{cat:"maps",name:"SVG as image map",critical:!1},MAP_COORDS:{cat:"maps",name:"Clickable regions",critical:!1},A11Y_ARIA:{cat:"accessibility",name:"ARIA attributes",critical:!1},A11Y_ROLE:{cat:"accessibility",name:"Role attributes",critical:!1},A11Y_TITLE:{cat:"accessibility",name:"Title/desc for screen readers",critical:!1},A11Y_TABINDEX:{cat:"accessibility",name:"Tab navigation",critical:!1},META_DATA_ATTRS:{cat:"metadata",name:"data-* attributes",critical:!1},META_CLASS:{cat:"metadata",name:"class attribute styling",critical:!1},META_ID:{cat:"metadata",name:"id references",critical:!0},EXT_CSS_LINK:{cat:"external",name:"External CSS via <?xml-stylesheet?>",critical:!1},EXT_CSS_IMPORT:{cat:"external",name:"@import in <style>",critical:!1},EXT_XLINK:{cat:"external",name:"xlink:href references",critical:!1}},xz={STANDALONE_BROWSER:{id:"standalone-browser",name:"Standalone (Browser)",type:"browser"},HTML_PAGE:{id:"html-page",name:"HTML Page",type:"browser"},ELECTRON:{id:"electron",name:"Electron App",type:"browser"},WEBVIEW_IOS:{id:"webview-ios",name:"iOS WKWebView",type:"mobile"},WEBVIEW_ANDROID:{id:"webview-android",name:"Android WebView",type:"mobile"},CAIRO:{id:"cairo",name:"Cairo/librsvg",type:"renderer"},INKSCAPE:{id:"inkscape",name:"Inkscape",type:"renderer"},IMAGEMAGICK:{id:"imagemagick",name:"ImageMagick",type:"renderer"},BATIK:{id:"batik",name:"Apache Batik",type:"renderer"},RESVG:{id:"resvg",name:"resvg",type:"renderer"},QT_SVG:{id:"qt-svg",name:"Qt SVG",type:"renderer"},SKIA:{id:"skia",name:"Skia (Chrome/Flutter)",type:"renderer"}},mz={FILE:{id:"file",name:"file://",protocol:"file"},HTTP:{id:"http",name:"http://",protocol:"http"},HTTPS:{id:"https",name:"https://",protocol:"https"},DATA_URI:{id:"data-uri",name:"data: URI",protocol:"data"},BLOB_URL:{id:"blob-url",name:"blob: URL",protocol:"blob"}},dz={INLINE:{id:"inline",name:"Inline in HTML",location:"inline"},BASE64:{id:"base64",name:"Base64 encoded",location:"embedded"},LOCAL_SAME:{id:"local-same",name:"Local (same dir)",location:"local"},LOCAL_ABS:{id:"local-abs",name:"Local (absolute)",location:"local"},REMOTE_SAME:{id:"remote-same",name:"Remote (same-origin)",location:"remote"},REMOTE_CROSS:{id:"remote-cross",name:"Remote (cross-origin)",location:"cross"},REMOTE_CORS:{id:"remote-cors",name:"Remote (cross+CORS)",location:"cors"}},hK={DIRECT:{id:"direct",name:"Direct SVG file",html:!1},IMG:{id:"img",name:'<img src="">',html:!0},PICTURE:{id:"picture",name:"<picture><source>",html:!0},OBJECT:{id:"object",name:'<object data="">',html:!0},EMBED:{id:"embed",name:'<embed src="">',html:!0},IFRAME:{id:"iframe",name:'<iframe src="">',html:!0},INLINE_SVG:{id:"inline-svg",name:"<svg>...</svg>",html:!0},CSS_BG:{id:"css-bg",name:"CSS background-image",html:!0},CSS_MASK:{id:"css-mask",name:"CSS mask-image",html:!0},CSS_CONTENT:{id:"css-content",name:"CSS content: url()",html:!0},CSS_LIST:{id:"css-list",name:"CSS list-style-image",html:!0},CSS_BORDER:{id:"css-border",name:"CSS border-image",html:!0},CANVAS_DRAW:{id:"canvas-draw",name:"canvas.drawImage()",html:!0},SCRIPT_INNER:{id:"script-inner",name:"innerHTML assignment",html:!0},SCRIPT_DOM:{id:"script-dom",name:"DOM createElement",html:!0},SCRIPT_FETCH:{id:"script-fetch",name:"fetch + parse",html:!0}},pz={NA:{id:"n/a",name:"N/A (not script)",script:!1},INLINE_SCRIPT:{id:"inline-script",name:"Inline <script>",script:!0},SAME_ORIGIN:{id:"same-origin",name:"Same-origin script",script:!0},CROSS_CORS:{id:"cross-cors",name:"Cross-origin (CORS)",script:!0},CROSS_NO_CORS:{id:"cross-no-cors",name:"Cross-origin (no CORS)",script:!0}},yK={CHROME:{id:"chrome",name:"Chrome",engine:"blink"},FIREFOX:{id:"firefox",name:"Firefox",engine:"gecko"},SAFARI:{id:"safari",name:"Safari",engine:"webkit"},EDGE:{id:"edge",name:"Edge",engine:"blink"},IE11:{id:"ie11",name:"IE 11",engine:"trident"},SAFARI_IOS:{id:"safari-ios",name:"Safari iOS",engine:"webkit"},CHROME_ANDROID:{id:"chrome-android",name:"Chrome Android",engine:"blink"},SAMSUNG:{id:"samsung",name:"Samsung Internet",engine:"blink"}},L={WORKS:"✅",PARTIAL:"⚠️",BLOCKED:"❌",DEPENDS:"❓",NA:"➖"},Q8={RENDER_VECTORS:{default:L.WORKS,exceptions:{}},RENDER_TEXT:{default:L.WORKS,exceptions:{"renderer:imagemagick":{status:L.PARTIAL,note:"Font substitution may occur"},"renderer:batik":{status:L.PARTIAL,note:"Limited font support"}}},RENDER_GRADIENTS:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.PARTIAL,note:"Some gradient types unsupported"}}},RENDER_PATTERNS:{default:L.WORKS,exceptions:{"renderer:resvg":{status:L.PARTIAL,note:"Limited pattern support"}}},RENDER_OPACITY:{default:L.WORKS,exceptions:{}},RENDER_BLENDMODES:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No blend mode support"},"renderer:cairo":{status:L.PARTIAL,note:"Limited blend modes"}}},FONTS_EMBEDDED:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No embedded fonts in img context",browsers:"all"},"syntax:css-bg":{status:L.BLOCKED,note:"No embedded fonts in CSS context",browsers:"all"},"syntax:css-mask":{status:L.BLOCKED,note:"No embedded fonts in CSS context",browsers:"all"},"renderer:imagemagick":{status:L.BLOCKED,note:"Cannot process embedded fonts"}}},FONTS_SYSTEM:{default:L.WORKS,exceptions:{}},FONTS_WEB_SAME:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources in img"},"syntax:css-bg":{status:L.BLOCKED,note:"No external resources in CSS bg"},"load:file":{status:L.PARTIAL,note:"May fail due to local file restrictions"},"renderer:*":{status:L.BLOCKED,note:"Renderers cannot fetch web fonts"}}},FONTS_WEB_CROSS:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources"},"syntax:css-*":{status:L.BLOCKED,note:"No external resources in CSS"},"storage:remote-cors":{status:L.WORKS,note:"Works with CORS headers"},"renderer:*":{status:L.BLOCKED,note:"Renderers cannot fetch fonts"}}},IMAGES_EMBEDDED:{default:L.WORKS,exceptions:{}},IMAGES_LOCAL:{default:L.WORKS,exceptions:{"load:http":{status:L.BLOCKED,note:"Cannot load file:// from http://"},"load:https":{status:L.BLOCKED,note:"Cannot load file:// from https://"},"syntax:img":{status:L.BLOCKED,note:"No external resources in img"}}},IMAGES_REMOTE_SAME:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources in img"},"load:file":{status:L.BLOCKED,note:"Cannot fetch http from file://"}}},IMAGES_REMOTE_CROSS:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources in img"},"storage:remote-cors":{status:L.WORKS,note:"Works with CORS"},"load:file":{status:L.BLOCKED,note:"CORS not applicable"}}},FILTERS_BASIC:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.PARTIAL,note:"Limited filter support"}}},FILTERS_COMPLEX:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"Complex filters unsupported"},"renderer:resvg":{status:L.PARTIAL,note:"Some filters unsupported"},"renderer:qt-svg":{status:L.PARTIAL,note:"Limited filter primitives"}}},MASKS:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"SVG masks not supported"}}},CLIP_PATHS:{default:L.WORKS,exceptions:{}},SMIL_TIMED:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"syntax:img":{status:L.PARTIAL,note:"May animate, no interaction",browsers:["chrome","firefox"]},"syntax:css-bg":{status:L.PARTIAL,note:"May animate, varies by browser"},"renderer:*":{status:L.BLOCKED,note:"Static render, no animation"}}},SMIL_CLICK:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"syntax:img":{status:L.BLOCKED,note:"No interaction in img context"},"syntax:css-*":{status:L.BLOCKED,note:"No interaction in CSS context"},"syntax:canvas-draw":{status:L.BLOCKED,note:"Rasterized, no interaction"},"renderer:*":{status:L.BLOCKED,note:"No interaction in renderers"}}},SMIL_HOVER:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"syntax:img":{status:L.BLOCKED,note:"No interaction in img context"},"syntax:css-*":{status:L.BLOCKED,note:"No interaction in CSS context"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},SMIL_FOCUS:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"syntax:img":{status:L.BLOCKED,note:"No interaction"},"syntax:css-*":{status:L.BLOCKED,note:"No interaction"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},SMIL_ACCESSKEY:{default:L.PARTIAL,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"browser:chrome":{status:L.PARTIAL,note:"Limited accessKey support"},"syntax:img":{status:L.BLOCKED,note:"No keyboard in img context"},"syntax:css-*":{status:L.BLOCKED,note:"No keyboard in CSS context"},"renderer:*":{status:L.BLOCKED,note:"No keyboard"}}},SMIL_SYNCBASE:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"syntax:img":{status:L.PARTIAL,note:"Sync works if animation plays"},"renderer:*":{status:L.BLOCKED,note:"No animation"}}},CSS_KEYFRAMES:{default:L.WORKS,exceptions:{"syntax:img":{status:L.WORKS,note:"CSS animations work in img"},"syntax:css-bg":{status:L.WORKS,note:"CSS animations work"},"renderer:*":{status:L.BLOCKED,note:"Static render"}}},CSS_TRANSITIONS:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No interaction for transitions"},"syntax:css-bg":{status:L.BLOCKED,note:"No interaction"},"renderer:*":{status:L.BLOCKED,note:"Static render"}}},CSS_HOVER:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No :hover in img context"},"syntax:css-*":{status:L.BLOCKED,note:"No :hover in CSS context"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},SCRIPT_INLINE:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"Scripts disabled for security"},"syntax:css-*":{status:L.BLOCKED,note:"Scripts disabled in CSS context"},"syntax:canvas-draw":{status:L.BLOCKED,note:"Rasterized, no scripts"},"renderer:*":{status:L.BLOCKED,note:"No script execution"},"display:html-page+syntax:inline-svg":{status:L.WORKS,note:"Runs in page context"},"display:html-page+syntax:object":{status:L.WORKS,note:"Isolated context"},"display:html-page+syntax:embed":{status:L.WORKS,note:"Isolated context"}}},SCRIPT_EXTERNAL:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources"},"syntax:css-*":{status:L.BLOCKED,note:"No external resources"},"load:file":{status:L.PARTIAL,note:"May be blocked by local file restrictions"},"storage:remote-cross":{status:L.BLOCKED,note:"CORS required"},"storage:remote-cors":{status:L.WORKS,note:"Works with CORS"},"renderer:*":{status:L.BLOCKED,note:"No scripts"}}},SCRIPT_MODULE:{default:L.PARTIAL,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No ES modules"},"browser:safari":{status:L.PARTIAL,note:"Limited module support in SVG"},"syntax:img":{status:L.BLOCKED,note:"No scripts"},"syntax:css-*":{status:L.BLOCKED,note:"No scripts"},"renderer:*":{status:L.BLOCKED,note:"No scripts"}}},EVENT_ONCLICK:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events in img context"},"syntax:css-*":{status:L.BLOCKED,note:"No events in CSS context"},"syntax:canvas-draw":{status:L.BLOCKED,note:"Rasterized"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONDBLCLICK:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONMOUSEDOWN:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONMOUSEUP:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONMOUSEOVER:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONMOUSEOUT:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONMOUSEMOVE:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONFOCUS:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No focus in img"},"syntax:css-*":{status:L.BLOCKED,note:"No focus"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONBLUR:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONLOAD:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No scripts/events"},"syntax:css-*":{status:L.BLOCKED,note:"No scripts"},"renderer:*":{status:L.BLOCKED,note:"No scripts"}}},EVENT_ONERROR:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No scripts"},"syntax:css-*":{status:L.BLOCKED,note:"No scripts"},"renderer:*":{status:L.BLOCKED,note:"No scripts"}}},EVENT_ONSCROLL:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No scroll in img"},"syntax:css-*":{status:L.BLOCKED,note:"No scroll"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONWHEEL:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONTOUCH:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No touch events"},"syntax:css-*":{status:L.BLOCKED,note:"No touch"},"display:*-browser":{status:L.NA,note:"No touch on desktop"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONKEYBOARD:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No keyboard"},"syntax:css-*":{status:L.BLOCKED,note:"No keyboard"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},LINK_INTERNAL:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No links in img"},"syntax:css-*":{status:L.BLOCKED,note:"No links in CSS"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},LINK_EXTERNAL:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No links in img"},"syntax:css-*":{status:L.BLOCKED,note:"No links"},"syntax:object":{status:L.WORKS,note:"Opens in object frame"},"renderer:*":{status:L.BLOCKED,note:"No links"}}},LINK_TARGET:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No links"},"syntax:css-*":{status:L.BLOCKED,note:"No links"},"syntax:object":{status:L.PARTIAL,note:"May not break out of frame"},"renderer:*":{status:L.BLOCKED,note:"No links"}}},LINK_DOWNLOAD:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No links"},"browser:safari":{status:L.PARTIAL,note:"Limited download attr support"},"renderer:*":{status:L.BLOCKED,note:"No links"}}},FOREIGNOBJECT_BASIC:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"foreignObject disabled in img"},"syntax:css-*":{status:L.BLOCKED,note:"foreignObject disabled in CSS"},"syntax:canvas-draw":{status:L.BLOCKED,note:"Security: tainted canvas"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject support"},"renderer:cairo":{status:L.BLOCKED,note:"No foreignObject"},"renderer:resvg":{status:L.BLOCKED,note:"No foreignObject"},"renderer:imagemagick":{status:L.BLOCKED,note:"No foreignObject"}}},FOREIGNOBJECT_HTML:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No HTML rendering"}}},FOREIGNOBJECT_FORM:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"syntax:object":{status:L.PARTIAL,note:"Form submission may be restricted"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No forms"}}},FOREIGNOBJECT_INPUT:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No inputs"}}},FOREIGNOBJECT_CANVAS:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No canvas"}}},FOREIGNOBJECT_VIDEO:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No video"}}},FOREIGNOBJECT_IFRAME:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"syntax:object":{status:L.PARTIAL,note:"Nested contexts may fail"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No iframes"}}},AUDIO_EMBEDDED:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg+processing:*-script":{status:L.WORKS,note:"Play on user gesture via JS"},"syntax:script-*":{status:L.WORKS,note:"JS can play on user gesture"}},note:"All browsers block autoplay without user gesture"},AUDIO_LOCAL:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:L.PARTIAL,note:"Needs user gesture"},"load:file":{status:L.PARTIAL,note:"May work locally with gesture"}}},AUDIO_REMOTE:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:L.PARTIAL,note:"Needs user gesture + CORS"},"storage:remote-cors":{status:L.PARTIAL,note:"Needs user gesture"}}},AUDIO_AUTOPLAY:{default:L.BLOCKED,exceptions:{},note:"Autoplay blocked by ALL modern browsers"},AUDIO_CONTROLS:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject/audio"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject/audio"},"syntax:object":{status:L.PARTIAL,note:"May render controls"}}},VIDEO_EMBEDDED:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:L.PARTIAL,note:"Needs user gesture"},"syntax:script-*":{status:L.WORKS,note:"JS can play on gesture"}}},VIDEO_LOCAL:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:L.PARTIAL,note:"Needs user gesture"}}},VIDEO_REMOTE:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:L.PARTIAL,note:"Needs gesture + CORS"}}},VIDEO_AUTOPLAY:{default:L.BLOCKED,exceptions:{"browser:*":{status:L.PARTIAL,note:"May work muted"}},note:"Autoplay only works muted in most browsers"},USE_INTERNAL:{default:L.WORKS,exceptions:{"syntax:img":{status:L.WORKS,note:"Internal refs work"},"syntax:css-*":{status:L.WORKS,note:"Internal refs work"}}},USE_EXTERNAL_SAME:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external refs"},"syntax:css-*":{status:L.BLOCKED,note:"No external refs"},"browser:chrome":{status:L.BLOCKED,note:"External use blocked since Chrome 50"},"browser:firefox":{status:L.BLOCKED,note:"Blocked for security"},"browser:safari":{status:L.PARTIAL,note:"May work same-origin"}},note:"Most browsers block external <use> for security"},USE_EXTERNAL_CROSS:{default:L.BLOCKED,exceptions:{},note:"Cross-origin external <use> blocked by all browsers"},USE_SHADOW_DOM:{default:L.PARTIAL,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No shadow DOM"},"syntax:img":{status:L.BLOCKED,note:"No styling access"}},note:"Styling shadow DOM from <use> is limited"},MAP_BASIC:{default:L.NA,exceptions:{"syntax:inline-svg":{status:L.WORKS,note:"Can use SVG elements as map"}},note:"Traditional image maps not applicable, use SVG events"},MAP_COORDS:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events for clickable regions"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},A11Y_ARIA:{default:L.WORKS,exceptions:{"syntax:img":{status:L.PARTIAL,note:"Only alt text accessible"},"syntax:css-*":{status:L.BLOCKED,note:"No a11y in CSS images"},"renderer:*":{status:L.BLOCKED,note:"No a11y tree"}}},A11Y_ROLE:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"Use alt attribute instead"},"syntax:css-*":{status:L.BLOCKED,note:"No a11y"},"renderer:*":{status:L.BLOCKED,note:"No a11y"}}},A11Y_TITLE:{default:L.WORKS,exceptions:{"syntax:img":{status:L.PARTIAL,note:"May not be read by screen readers"},"syntax:css-*":{status:L.BLOCKED,note:"Not accessible"}}},A11Y_TABINDEX:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No focus in img"},"syntax:css-*":{status:L.BLOCKED,note:"No focus"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},META_DATA_ATTRS:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"Not accessible from outside"},"syntax:css-*":{status:L.BLOCKED,note:"Not accessible"}}},META_CLASS:{default:L.WORKS,exceptions:{}},META_ID:{default:L.WORKS,exceptions:{"syntax:img":{status:L.PARTIAL,note:"IDs isolated"}}},EXT_CSS_LINK:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources"},"syntax:css-*":{status:L.BLOCKED,note:"No external resources"},"load:file":{status:L.PARTIAL,note:"Local file restrictions"},"renderer:*":{status:L.BLOCKED,note:"No external fetch"}}},EXT_CSS_IMPORT:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No @import"},"syntax:css-*":{status:L.BLOCKED,note:"No @import"},"load:file":{status:L.PARTIAL,note:"May be blocked"},"renderer:*":{status:L.BLOCKED,note:"No external fetch"}}},EXT_XLINK:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external xlink"},"syntax:css-*":{status:L.BLOCKED,note:"No external xlink"},"storage:remote-cross":{status:L.BLOCKED,note:"CORS required"}}}},X0={JAVASCRIPT:"javascript",EVENT_HANDLERS:"event_handlers",SMIL_ANIMATIONS:"smil_animations",SMIL_INTERACTIVE:"smil_interactive",CSS_ANIMATIONS:"css_animations",AUDIO:"audio",VIDEO:"video",EXTERNAL_IMAGES:"external_images",EXTERNAL_CSS:"external_css",EXTERNAL_FONTS:"external_fonts",EXTERNAL_SCRIPTS:"external_scripts",EXTERNAL_USE:"external_use",FOREIGN_OBJECT:"foreign_object",IFRAME:"iframe",FILTERS:"filters",MASKS:"masks",CLIP_PATHS:"clip_paths",HYPERLINKS:"hyperlinks",ANCHORS:"anchors"},pK=j0(($,J={})=>{let Z=J.verbose||!1,K=J.printTables!==!1,Q=J.includeMetaAnalysis!==!1,H=(T)=>{let P=[],t=T.toLowerCase(),$0=(Q0)=>{if(Q0.tagName&&Q0.tagName.toLowerCase()===t)P.push(Q0);for(let V0 of Q0.children||[])if(V0&&V0.tagName)$0(V0)};return $0($),P},z=(T,P=[])=>{if(T.tagName)P.push(T);for(let t of T.children||[])if(t&&t.tagName)z(t,P);return P},q=(T,...P)=>{for(let t of P)if(T.getAttribute(t))return!0;return!1},W={detected:new Set,details:{}},j=z($),G=H("script");if(G.length>0){if(W.detected.add(X0.JAVASCRIPT),W.details.javascript={count:G.length,hasExternalSrc:G.some((T)=>T.getAttribute("src")||T.getAttribute("href")||T.getAttribute("xlink:href")),types:G.map((T)=>T.getAttribute("type")||"text/javascript")},W.details.javascript.hasExternalSrc)W.detected.add(X0.EXTERNAL_SCRIPTS)}let F=["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","onfocus","onblur","onkeydown","onkeyup","onkeypress","onload","onerror","onscroll","onwheel","ontouchstart","ontouchend","ontouchmove","onbegin","onend","onrepeat"],_=[];for(let T of j){let P=F.filter((t)=>T.getAttribute(t));if(P.length>0)_.push({tag:T.tagName,handlers:P})}if(_.length>0)W.detected.add(X0.EVENT_HANDLERS),W.details.eventHandlers={count:_.length,types:[...new Set(_.flatMap((T)=>T.handlers))],elements:_.slice(0,10)};let U=["animate","animatetransform","animatemotion","animatecolor","set"],O=[],V=[];for(let T of U){let P=H(T);O.push(...P);for(let t of P){let $0=t.getAttribute("begin")||"",Q0=t.getAttribute("end")||"",V0=["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","focus","blur","focusin","focusout"];for(let N0 of V0)if($0.includes(N0)||Q0.includes(N0))V.push({element:t.tagName,event:N0,begin:$0,end:Q0});if($0.includes("accessKey(")||Q0.includes("accessKey("))V.push({element:t.tagName,event:"accessKey",begin:$0,end:Q0})}}if(O.length>0){if(W.detected.add(X0.SMIL_ANIMATIONS),W.details.smilAnimations={count:O.length,breakdown:{animate:H("animate").length,animateTransform:H("animatetransform").length,animateMotion:H("animatemotion").length,animateColor:H("animatecolor").length,set:H("set").length}},V.length>0)W.detected.add(X0.SMIL_INTERACTIVE),W.details.smilInteractive={count:V.length,triggers:[...new Set(V.map((T)=>T.event))],elements:V.slice(0,10)}}let M=H("style"),Y=!1;for(let T of M){let P=T.textContent||"";if(P.includes("@keyframes")||P.includes("animation:")||P.includes("animation-name")||P.includes("transition:")||P.includes("transition-property")){Y=!0;break}}for(let T of j){let P=T.getAttribute("style")||"";if(P.includes("animation")||P.includes("transition")){Y=!0;break}}if(Y)W.detected.add(X0.CSS_ANIMATIONS),W.details.cssAnimations={detected:!0};let X=H("audio"),w=H("video"),R=H("foreignobject");for(let T of R){let P=[],t=[],$0=(Q0)=>{let V0=Q0.tagName?.toLowerCase();if(V0==="audio")P.push(Q0);if(V0==="video")t.push(Q0);for(let N0 of Q0.children||[])if(N0&&N0.tagName)$0(N0)};for(let Q0 of T.children||[])if(Q0&&Q0.tagName)$0(Q0);X.push(...P),w.push(...t)}if(X.length>0)W.detected.add(X0.AUDIO),W.details.audio={count:X.length,hasAutoplay:X.some((T)=>T.hasAttribute("autoplay")),sources:X.map((T)=>({id:T.getAttribute("id"),src:T.getAttribute("src"),isDataUri:(T.getAttribute("src")||"").startsWith("data:"),isExternal:(T.getAttribute("src")||"").startsWith("http")}))};if(w.length>0)W.detected.add(X0.VIDEO),W.details.video={count:w.length,hasAutoplay:w.some((T)=>T.hasAttribute("autoplay"))};let I=H("image"),f=[],u=[];for(let T of I){let P=T.getAttribute("href")||T.getAttribute("xlink:href")||"";if(P.startsWith("http://")||P.startsWith("https://")||P.startsWith("//"))f.push({href:P,element:"image"});else if(P.startsWith("data:"))u.push({type:"data-uri",element:"image"});else if(P&&!P.startsWith("#"))f.push({href:P,element:"image",type:"local"})}if(f.length>0)W.detected.add(X0.EXTERNAL_IMAGES),W.details.externalImages={count:f.length,urls:f.slice(0,5)};let m=H("use"),S=[];for(let T of m){let P=T.getAttribute("href")||T.getAttribute("xlink:href")||"";if(P&&!P.startsWith("#"))S.push({href:P})}if(S.length>0)W.detected.add(X0.EXTERNAL_USE),W.details.externalUse={count:S.length,refs:S.slice(0,5)};let x=!1;for(let T of M){let P=T.textContent||"";if(P.includes("@font-face")&&P.includes("url(")){let t=P.match(/url\(['"]?(https?:\/\/[^'")\s]+)['"]?\)/);if(t){x=!0,W.detected.add(X0.EXTERNAL_FONTS),W.details.externalFonts={detected:!0,sample:t[1]};break}}}if(R.length>0){if(W.detected.add(X0.FOREIGN_OBJECT),W.details.foreignObject={count:R.length,hasIframe:R.some((T)=>{let P=!1,t=($0)=>{if($0.tagName?.toLowerCase()==="iframe")P=!0;for(let Q0 of $0.children||[])if(Q0&&Q0.tagName)t(Q0)};return t(T),P})},W.details.foreignObject.hasIframe)W.detected.add(X0.IFRAME)}let h=H("filter"),E=H("mask"),d=H("clippath");if(h.length>0)W.detected.add(X0.FILTERS),W.details.filters={count:h.length};if(E.length>0)W.detected.add(X0.MASKS),W.details.masks={count:E.length};if(d.length>0)W.detected.add(X0.CLIP_PATHS),W.details.clipPaths={count:d.length};let c=H("a");if(c.length>0)W.detected.add(X0.HYPERLINKS),W.details.hyperlinks={count:c.length,hasExternal:c.some((T)=>{return(T.getAttribute("href")||T.getAttribute("xlink:href")||"").startsWith("http")})};let p={STANDALONE:"standalone",HTML:"html",CUSTOM_RENDERER:"custom"},N={FILE:"file://",HTTP:"http://"},y={INLINE_BASE64:"inline",LOCAL_PATH:"local",REMOTE_URL:"remote"},B={NONE:"none",IMG:"img",OBJECT:"object",EMBED:"embed",INLINE:"inline",CSS:"css",SCRIPT:"script"},e={INLINE_CODE:"inline",LOCAL_SERVER:"local",REMOTE_CDN:"remote"},r={[X0.JAVASCRIPT]:{[B.NONE]:{file:"✅",http:"✅",note:"Full JS execution"},[B.IMG]:{file:"❌",http:"❌",note:"All scripting disabled for security"},[B.OBJECT]:{file:"✅",http:"✅",note:"Isolated JS context"},[B.EMBED]:{file:"✅",http:"✅",note:"Isolated JS context"},[B.INLINE]:{file:"✅",http:"✅",note:"Same JS context as parent page"},[B.CSS]:{file:"❌",http:"❌",note:"CSS image context - no scripts"},[B.SCRIPT]:{file:"✅",http:"✅",note:"JS-generated = full control"}},[X0.EVENT_HANDLERS]:{[B.NONE]:{file:"✅",http:"✅",note:"Full event handling"},[B.IMG]:{file:"❌",http:"❌",note:"No events in img context"},[B.OBJECT]:{file:"✅",http:"✅",note:"Events work, isolated from parent"},[B.EMBED]:{file:"✅",http:"✅",note:"Events work, isolated from parent"},[B.INLINE]:{file:"✅",http:"✅",note:"Full event handling"},[B.CSS]:{file:"❌",http:"❌",note:"No events in CSS context"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Full event handling"}},[X0.SMIL_ANIMATIONS]:{[B.NONE]:{file:"✅",http:"✅",note:"Full SMIL support"},[B.IMG]:{file:"⚠️",http:"⚠️",note:"Time-based only, varies by browser"},[B.OBJECT]:{file:"✅",http:"✅",note:"Full SMIL support"},[B.EMBED]:{file:"✅",http:"✅",note:"Full SMIL support"},[B.INLINE]:{file:"✅",http:"✅",note:"Full SMIL support"},[B.CSS]:{file:"⚠️",http:"⚠️",note:"Time-based only, varies by browser"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Full SMIL support"}},[X0.SMIL_INTERACTIVE]:{[B.NONE]:{file:"✅",http:"✅",note:"Full interactive SMIL"},[B.IMG]:{file:"❌",http:"❌",note:"No interaction in img context"},[B.OBJECT]:{file:"✅",http:"✅",note:"Interactive SMIL works"},[B.EMBED]:{file:"✅",http:"✅",note:"Interactive SMIL works"},[B.INLINE]:{file:"✅",http:"✅",note:"Full interactive SMIL"},[B.CSS]:{file:"❌",http:"❌",note:"No interaction in CSS context"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Full interactive SMIL"}},[X0.CSS_ANIMATIONS]:{[B.NONE]:{file:"✅",http:"✅",note:"Full CSS animation support"},[B.IMG]:{file:"✅",http:"✅",note:"CSS animations work in img"},[B.OBJECT]:{file:"✅",http:"✅",note:"Full CSS animation support"},[B.EMBED]:{file:"✅",http:"✅",note:"Full CSS animation support"},[B.INLINE]:{file:"✅",http:"✅",note:"Full CSS animation support"},[B.CSS]:{file:"✅",http:"✅",note:"CSS animations work"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Full CSS animation support"}},[X0.AUDIO]:{[B.NONE]:{file:"❌",http:"❌",note:"Autoplay blocked, needs user gesture"},[B.IMG]:{file:"❌",http:"❌",note:"No audio in img context"},[B.OBJECT]:{file:"❌",http:"❌",note:"Autoplay blocked"},[B.EMBED]:{file:"❌",http:"❌",note:"Autoplay blocked"},[B.INLINE]:{file:"⚠️",http:"⚠️",note:"Needs JS + user gesture to play"},[B.CSS]:{file:"❌",http:"❌",note:"No audio in CSS context"},[B.SCRIPT]:{file:"✅",http:"✅",note:"JS can play audio on user gesture"}},[X0.VIDEO]:{[B.NONE]:{file:"❌",http:"❌",note:"Autoplay blocked, needs user gesture"},[B.IMG]:{file:"❌",http:"❌",note:"No video in img context"},[B.OBJECT]:{file:"❌",http:"❌",note:"Autoplay blocked"},[B.EMBED]:{file:"❌",http:"❌",note:"Autoplay blocked"},[B.INLINE]:{file:"⚠️",http:"⚠️",note:"Needs JS + user gesture to play"},[B.CSS]:{file:"❌",http:"❌",note:"No video in CSS context"},[B.SCRIPT]:{file:"✅",http:"✅",note:"JS can play video on user gesture"}},[X0.EXTERNAL_IMAGES]:{[B.NONE]:{file:"⚠️",http:"✅",note:"file:// may have CORS issues"},[B.IMG]:{file:"❌",http:"⚠️",note:"Blocked or CORS restricted"},[B.OBJECT]:{file:"⚠️",http:"✅",note:"CORS applies"},[B.EMBED]:{file:"⚠️",http:"✅",note:"CORS applies"},[B.INLINE]:{file:"⚠️",http:"✅",note:"CORS applies"},[B.CSS]:{file:"❌",http:"⚠️",note:"Restricted for security"},[B.SCRIPT]:{file:"⚠️",http:"✅",note:"CORS applies"}},[X0.EXTERNAL_CSS]:{[B.NONE]:{file:"✅",http:"✅",note:"External CSS loaded"},[B.IMG]:{file:"❌",http:"❌",note:"No external resources in img"},[B.OBJECT]:{file:"✅",http:"✅",note:"External CSS works"},[B.EMBED]:{file:"✅",http:"✅",note:"External CSS works"},[B.INLINE]:{file:"✅",http:"✅",note:"External CSS works"},[B.CSS]:{file:"❌",http:"❌",note:"No external resources"},[B.SCRIPT]:{file:"✅",http:"✅",note:"External CSS works"}},[X0.EXTERNAL_FONTS]:{[B.NONE]:{file:"✅",http:"✅",note:"External fonts loaded"},[B.IMG]:{file:"❌",http:"❌",note:"No external resources in img"},[B.OBJECT]:{file:"✅",http:"✅",note:"External fonts work (CORS)"},[B.EMBED]:{file:"✅",http:"✅",note:"External fonts work (CORS)"},[B.INLINE]:{file:"✅",http:"✅",note:"External fonts work (CORS)"},[B.CSS]:{file:"❌",http:"⚠️",note:"Limited, varies by browser"},[B.SCRIPT]:{file:"✅",http:"✅",note:"External fonts work"}},[X0.EXTERNAL_USE]:{[B.NONE]:{file:"❌",http:"⚠️",note:"Most browsers block external use"},[B.IMG]:{file:"❌",http:"❌",note:"No external use in img"},[B.OBJECT]:{file:"❌",http:"⚠️",note:"Most browsers block"},[B.EMBED]:{file:"❌",http:"⚠️",note:"Most browsers block"},[B.INLINE]:{file:"❌",http:"⚠️",note:"Most browsers block"},[B.CSS]:{file:"❌",http:"❌",note:"No external use"},[B.SCRIPT]:{file:"❌",http:"⚠️",note:"Most browsers block"}},[X0.FOREIGN_OBJECT]:{[B.NONE]:{file:"✅",http:"✅",note:"Full foreignObject support"},[B.IMG]:{file:"❌",http:"❌",note:"foreignObject disabled in img"},[B.OBJECT]:{file:"✅",http:"✅",note:"foreignObject works"},[B.EMBED]:{file:"✅",http:"✅",note:"foreignObject works"},[B.INLINE]:{file:"✅",http:"✅",note:"foreignObject works"},[B.CSS]:{file:"❌",http:"❌",note:"foreignObject disabled"},[B.SCRIPT]:{file:"✅",http:"✅",note:"foreignObject works"}},[X0.HYPERLINKS]:{[B.NONE]:{file:"✅",http:"✅",note:"Links work"},[B.IMG]:{file:"❌",http:"❌",note:"No links in img context"},[B.OBJECT]:{file:"✅",http:"✅",note:"Links work (in iframe-like context)"},[B.EMBED]:{file:"✅",http:"✅",note:"Links work"},[B.INLINE]:{file:"✅",http:"✅",note:"Links work normally"},[B.CSS]:{file:"❌",http:"❌",note:"No links in CSS context"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Links work"}},[X0.FILTERS]:{[B.NONE]:{file:"✅",http:"✅",note:"Full filter support"},[B.IMG]:{file:"✅",http:"✅",note:"Filters work"},[B.OBJECT]:{file:"✅",http:"✅",note:"Filters work"},[B.EMBED]:{file:"✅",http:"✅",note:"Filters work"},[B.INLINE]:{file:"✅",http:"✅",note:"Filters work"},[B.CSS]:{file:"✅",http:"✅",note:"Filters work"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Filters work"}}},s={"GitHub README.md":{syntax:"IMG (implicit)",restrictions:["No JavaScript","No SMIL","No external resources","No foreignObject","No links"],worksFor:["Static SVG","CSS animations (some)","Embedded images (data-uri)"],note:"GitHub sanitizes SVG heavily - only safe static content"},"GitHub Flavored Markdown (GFM)":{syntax:"IMG",restrictions:["Same as GitHub README"],worksFor:["Static SVG only"],note:"GFM renders SVG as images"},"GitLab README.md":{syntax:"IMG (implicit)",restrictions:["Similar to GitHub but slightly more permissive"],worksFor:["Static SVG","Some CSS animations"],note:"GitLab also sanitizes SVG"},"Wikipedia/MediaWiki":{syntax:"IMG (sanitized)",restrictions:["Heavy sanitization","No scripts","No external resources","No animations"],worksFor:["Static vector graphics only"],note:"MediaWiki converts SVG to PNG for display"},"EPUB 3.x":{syntax:"IMG or INLINE",restrictions:["No external resources","Limited JavaScript","No autoplay"],worksFor:["Static SVG","CSS animations","SMIL (in some readers)"],note:"Support varies by e-reader - Apple Books better than Kindle"},"Email (HTML email)":{syntax:"IMG (base64)",restrictions:["Heavily filtered","No scripts","No external resources","No animations"],worksFor:["Static embedded SVG only","Many clients block SVG entirely"],note:"Most email clients block or rasterize SVG"},"Slack/Discord":{syntax:"IMG (auto-converted)",restrictions:["Converted to raster","No interactivity"],worksFor:["Static preview only"],note:"SVG files are typically converted to PNG previews"},"Twitter/X":{syntax:"N/A",restrictions:["SVG not supported as media"],worksFor:["Nothing - upload as PNG"],note:"Twitter does not support SVG uploads"},Notion:{syntax:"EMBED/IMG",restrictions:["Limited - treated as image"],worksFor:["Static SVG"],note:"Notion embeds SVG as images"},Obsidian:{syntax:"INLINE or IMG",restrictions:["Depends on mode and plugins"],worksFor:["Static SVG","Some CSS animations"],note:"Obsidian has good local SVG support"},"Bear Notes":{syntax:"IMG",restrictions:["Image context only"],worksFor:["Static SVG"],note:"Bear treats SVG as images"},"Markdown-it":{syntax:"IMG (default)",restrictions:["Default IMG behavior","Can be configured for INLINE"],worksFor:["Depends on configuration"],note:"Parser library - output depends on implementation"},MDX:{syntax:"INLINE (JSX)",restrictions:["Full React component - depends on framework"],worksFor:["Full SVG when used as component"],note:"MDX can import SVG as React components"},"iOS Safari":{syntax:"ALL",restrictions:["Stricter autoplay policies"],worksFor:["All standard SVG features except auto-audio"],note:"Good SVG support, strict media policies"},"Android WebView":{syntax:"ALL",restrictions:["Varies by Android version"],worksFor:["Most SVG features"],note:"WebView behavior varies significantly"},"Cairo/librsvg":{syntax:"CUSTOM_RENDERER",restrictions:["Limited JS","Limited SMIL","No foreignObject"],worksFor:["Static SVG","Basic filters","CSS styling"],note:"Server-side rendering library - no dynamic features"},Inkscape:{syntax:"CUSTOM_RENDERER",restrictions:["May not run JS","SMIL playback varies"],worksFor:["All static SVG","Partial animation preview"],note:"Full SVG editor with preview capabilities"},ImageMagick:{syntax:"CUSTOM_RENDERER",restrictions:["Rasterizes immediately","No animations","No JS"],worksFor:["Static rasterization only"],note:"Converts SVG to raster - no dynamic features"}},z0={timestamp:new Date().toISOString(),features:W,interactivityLevel:"static",bySyntax:{},specialCases:{},recommendations:[],warnings:[]};if(W.detected.has(X0.JAVASCRIPT)||W.detected.has(X0.EVENT_HANDLERS))z0.interactivityLevel="scripted";else if(W.detected.has(X0.SMIL_INTERACTIVE))z0.interactivityLevel="interactive";else if(W.detected.has(X0.SMIL_ANIMATIONS)||W.detected.has(X0.CSS_ANIMATIONS))z0.interactivityLevel="animated";for(let T of Object.values(B)){z0.bySyntax[T]={file:{works:[],partial:[],blocked:[]},http:{works:[],partial:[],blocked:[]}};for(let P of W.detected){let t=r[P];if(t&&t[T]){let{file:$0,http:Q0,note:V0}=t[T];if($0==="✅")z0.bySyntax[T].file.works.push({feature:P,note:V0});else if($0==="⚠️")z0.bySyntax[T].file.partial.push({feature:P,note:V0});else z0.bySyntax[T].file.blocked.push({feature:P,note:V0});if(Q0==="✅")z0.bySyntax[T].http.works.push({feature:P,note:V0});else if(Q0==="⚠️")z0.bySyntax[T].http.partial.push({feature:P,note:V0});else z0.bySyntax[T].http.blocked.push({feature:P,note:V0})}}}for(let[T,P]of Object.entries(s)){let t=[],$0=[];for(let Q0 of W.detected){let N0={[X0.JAVASCRIPT]:"JavaScript",[X0.EVENT_HANDLERS]:"Event handlers",[X0.SMIL_ANIMATIONS]:"SMIL",[X0.SMIL_INTERACTIVE]:"Interactive SMIL",[X0.CSS_ANIMATIONS]:"CSS animations",[X0.AUDIO]:"Audio",[X0.VIDEO]:"Video",[X0.EXTERNAL_IMAGES]:"External images",[X0.EXTERNAL_USE]:"External use",[X0.FOREIGN_OBJECT]:"foreignObject",[X0.HYPERLINKS]:"Links"}[Q0]||Q0;if(P.restrictions.some((o)=>o.toLowerCase().includes(N0.toLowerCase())||o.toLowerCase().includes("no "+N0.toLowerCase())))t.push(N0);else if(P.worksFor.some((J0)=>J0.toLowerCase().includes(N0.toLowerCase())))$0.push(N0)}z0.specialCases[T]={syntax:P.syntax,blockedFeatures:t,workingFeatures:$0,note:P.note,overallCompat:t.length===0?"✅ Compatible":t.length<W.detected.size/2?"⚠️ Partial":"❌ Not compatible"}}if(W.detected.has(X0.AUDIO))z0.recommendations.push({issue:"Audio playback blocked",solution:"Use SCRIPT syntax with user gesture: embed SVG inline, extract audio data-uri via JavaScript, play on click",example:`document.querySelector('svg').addEventListener('click', () => {
|
|
31
|
+
const audio = new Audio(svgAudioDataUri);
|
|
32
|
+
audio.play();
|
|
33
|
+
});`});if(W.detected.has(X0.SMIL_INTERACTIVE))z0.recommendations.push({issue:"Interactive SMIL animations",solution:"Use OBJECT, EMBED, or INLINE syntax - avoid IMG and CSS background",example:'<object data="animation.svg" type="image/svg+xml"></object>'});if(W.detected.has(X0.JAVASCRIPT))z0.recommendations.push({issue:"JavaScript in SVG",solution:"Use INLINE syntax for same-page JS context, or OBJECT/EMBED for isolated context",example:"<svg><!-- your SVG with scripts --></svg>"});if(W.detected.has(X0.EXTERNAL_IMAGES)||W.detected.has(X0.EXTERNAL_FONTS)||W.detected.has(X0.EXTERNAL_USE))z0.recommendations.push({issue:"External resources",solution:"Embed resources as data-URIs for maximum compatibility, or ensure CORS headers are set",example:"Use svg-toolbox embedExternalDependencies() to inline all resources"});if(z0.interactivityLevel==="scripted")z0.warnings.push("SVG contains JavaScript - will not work in IMG, CSS, or most markdown contexts");if(W.detected.has(X0.FOREIGN_OBJECT))z0.warnings.push("SVG contains foreignObject - disabled in IMG and CSS contexts");if(W.detected.has(X0.EXTERNAL_USE))z0.warnings.push("External <use> references are blocked by most modern browsers");if(K){console.log(`
|
|
34
|
+
`+"═".repeat(100)),console.log("SVG COMPREHENSIVE COMPATIBILITY MATRIX ANALYSIS"),console.log("═".repeat(100)),console.log(`
|
|
35
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ DETECTED SVG FEATURES"+" ".repeat(76)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log(`│ Interactivity Level: ${z0.interactivityLevel.toUpperCase().padEnd(75)} │`),console.log("│"+" ".repeat(98)+"│");for(let Q0 of W.detected){let V0=W.details[Q0.replace("_","")]||W.details[Q0]||{},N0=Q0;if(V0.count!==void 0)N0+=` (${V0.count})`;console.log(`│ • ${N0.padEnd(92)} │`)}console.log("└"+"─".repeat(98)+"┘"),console.log(`
|
|
36
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ 5-AXIS COMPATIBILITY MATRIX"+" ".repeat(70)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log("│ SYNTAX TAG │ PROTOCOL │ WORKS │ PARTIAL │ BLOCKED │"),console.log("├────────────────────┼───────────┼────────────────────────────┼──────────────────┼────────────┤");for(let[Q0,V0]of Object.entries(z0.bySyntax)){let N0={none:"Direct SVG file",img:'<img src="">',object:'<object data="">',embed:'<embed src="">',inline:"<svg>...</svg>",css:"CSS background",script:"JS-generated"}[Q0]||Q0;for(let h0 of["file","http"]){let o=V0[h0],J0=o.works.length>0?o.works.length+" features":"-",F0=o.partial.length>0?o.partial.length+" features":"-",O0=o.blocked.length>0?o.blocked.length+" features":"-";console.log(`│ ${N0.padEnd(18)} │ ${(h0+"://").padEnd(9)} │ ${J0.padEnd(26)} │ ${F0.padEnd(16)} │ ${O0.padEnd(10)} │`)}}console.log("└"+"─".repeat(98)+"┘"),console.log(`
|
|
37
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ RECOMMENDED EMBEDDING METHODS FOR THIS SVG"+" ".repeat(54)+"│"),console.log("├"+"─".repeat(98)+"┤");let T="inline",P=0;for(let[Q0,V0]of Object.entries(z0.bySyntax)){let N0=V0.http.works.length*3+V0.http.partial.length-V0.http.blocked.length*2;if(N0>P)P=N0,T=Q0}let t={none:"Open SVG file directly in browser",img:'<img src="your-file.svg" alt="description">',object:'<object data="your-file.svg" type="image/svg+xml"></object>',embed:'<embed src="your-file.svg" type="image/svg+xml">',inline:"Copy <svg>...</svg> content directly into HTML",css:'.element { background-image: url("your-file.svg"); }',script:'const svgEl = document.createElementNS("http://www.w3.org/2000/svg", "svg"); ...'};if(console.log(`│ BEST: ${T.toUpperCase().padEnd(91)} │`),console.log(`│ ${t[T].substring(0,96).padEnd(96)} │`),console.log("│"+" ".repeat(98)+"│"),z0.interactivityLevel!=="static")console.log("│ AVOID: IMG and CSS background (no interactivity)"+" ".repeat(49)+"│");console.log("└"+"─".repeat(98)+"┘"),console.log(`
|
|
38
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ SPECIAL ENVIRONMENT COMPATIBILITY"+" ".repeat(63)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log("│ ENVIRONMENT │ COMPAT │ BLOCKED FEATURES"+" ".repeat(43)+"│"),console.log("├───────────────────────────┼────────┼"+"─".repeat(61)+"┤");let $0=["GitHub README.md","EPUB 3.x","Email (HTML email)","Wikipedia/MediaWiki","MDX","Cairo/librsvg","iOS Safari"];for(let Q0 of $0){let V0=z0.specialCases[Q0];if(V0){let N0=V0.overallCompat.substring(0,6).padEnd(6),h0=V0.blockedFeatures.slice(0,3).join(", ").substring(0,58).padEnd(58);console.log(`│ ${Q0.substring(0,25).padEnd(25)} │ ${N0} │ ${h0} │`)}}if(console.log("└"+"─".repeat(98)+"┘"),z0.warnings.length>0){console.log(`
|
|
39
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ ⚠️ WARNINGS"+" ".repeat(85)+"│"),console.log("├"+"─".repeat(98)+"┤");for(let Q0 of z0.warnings)console.log(`│ • ${Q0.substring(0,94).padEnd(94)} │`);console.log("└"+"─".repeat(98)+"┘")}if(z0.recommendations.length>0){console.log(`
|
|
40
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ \uD83D\uDCA1 RECOMMENDATIONS"+" ".repeat(79)+"│"),console.log("├"+"─".repeat(98)+"┤");for(let Q0 of z0.recommendations)console.log(`│ Issue: ${Q0.issue.substring(0,89).padEnd(89)} │`),console.log(`│ Solution: ${Q0.solution.substring(0,86).padEnd(86)} │`),console.log("│"+" ".repeat(98)+"│");console.log("└"+"─".repeat(98)+"┘")}if(W.detected.has(X0.AUDIO))console.log(`
|
|
41
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ \uD83D\uDD0A AUDIO PLAYBACK TRUTH TABLE"+" ".repeat(67)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log("│ METHOD │ FILE:// │ HTTP:// │ USER GESTURE NEEDED │ RESULT │"),console.log("├─────────────────────────────────────┼─────────┼─────────┼─────────────────────┼──────────────┤"),console.log("│ SVG direct (autoplay) │ ❌ │ ❌ │ Yes but no trigger │ BLOCKED │"),console.log("│ SVG in <img> │ ❌ │ ❌ │ N/A │ NO AUDIO │"),console.log("│ SVG in <object> │ ❌ │ ❌ │ Yes but isolated │ BLOCKED │"),console.log("│ SVG inline + SMIL onbegin │ ⚠️ │ ⚠️ │ SMIL click trigger │ MAYBE │"),console.log("│ SVG inline + JS on click │ ✅ │ ✅ │ Yes - click event │ WORKS │"),console.log("│ HTML extracts audio, plays on click │ ✅ │ ✅ │ Yes - click event │ RECOMMENDED │"),console.log("└"+"─".repeat(98)+"┘"),console.log(`
|
|
42
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ \uD83D\uDCDD AUDIO SOLUTION CODE EXAMPLE"+" ".repeat(66)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log("│ // In your HTML page: │"),console.log('│ <button id="play">Click to Play SVG Audio</button> │'),console.log('│ <object id="svg" data="your-audio.svg" type="image/svg+xml"></object> │'),console.log("│ │"),console.log("│ <script> │"),console.log('│ document.getElementById("play").addEventListener("click", () => { │'),console.log('│ const svgDoc = document.getElementById("svg").contentDocument; │'),console.log('│ const audioSrc = svgDoc.querySelector("source")?.getAttribute("src"); │'),console.log("│ if (audioSrc) new Audio(audioSrc).play(); │"),console.log("│ }); │"),console.log("│ </script> │"),console.log("└"+"─".repeat(98)+"┘");console.log(`
|
|
43
|
+
`+"═".repeat(100)+`
|
|
44
|
+
`)}return $._compatibilityMatrix=z0,$}),cK=j0(($,J={})=>{let Z=J.printFullMatrix||!1,K=J.groupBySyntax!==!1,Q=J.showOnlyIssues!==!1,H=J.browserDetails!==!1,z=J.filterCapabilities||null,q=(o)=>{let J0=[],F0=o.toLowerCase(),O0=(R0)=>{if(R0.tagName&&R0.tagName.toLowerCase()===F0)J0.push(R0);for(let I0 of R0.children||[])if(I0&&I0.tagName)O0(I0)};return O0($),J0},W=(o,J0=[])=>{if(o.tagName)J0.push(o);for(let F0 of o.children||[])if(F0&&F0.tagName)W(F0,J0);return J0},j=new Set,G={},F=W($);if(F.length>1)j.add("RENDER_VECTORS"),j.add("RENDER_TRANSFORMS");let U=q("text").concat(q("tspan"));if(U.length>0)j.add("RENDER_TEXT"),G.RENDER_TEXT={count:U.length};let O=q("linearGradient"),V=q("radialGradient");if(O.length>0||V.length>0)j.add("RENDER_GRADIENTS"),G.RENDER_GRADIENTS={linear:O.length,radial:V.length};let M=q("pattern");if(M.length>0)j.add("RENDER_PATTERNS"),G.RENDER_PATTERNS={count:M.length};for(let o of F)if(o.getAttribute("opacity")||o.getAttribute("fill-opacity")||o.getAttribute("stroke-opacity")||(o.getAttribute("style")||"").includes("opacity")){j.add("RENDER_OPACITY");break}for(let o of F)if((o.getAttribute("style")||"").includes("mix-blend-mode")||o.getAttribute("mix-blend-mode")){j.add("RENDER_BLENDMODES");break}let Y=q("style");for(let o of Y){let J0=o.textContent||"";if(J0.includes("@font-face")){if(J0.includes("data:"))j.add("FONTS_EMBEDDED");else if(J0.includes("url(")&&J0.match(/url\s*\(\s*['"]?https?:/))j.add("FONTS_WEB_CROSS");else if(J0.includes("url("))j.add("FONTS_WEB_SAME")}}if(U.length>0)j.add("FONTS_SYSTEM");let X=q("image");for(let o of X){let J0=o.getAttribute("href")||o.getAttribute("xlink:href")||"";if(J0.startsWith("data:"))j.add("IMAGES_EMBEDDED");else if(J0.startsWith("http://")||J0.startsWith("https://")){let F0=!0;try{let O0=new URL(J0),R0=new URL($.documentURI||$.baseURI||"");F0=O0.origin!==R0.origin}catch(O0){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${O0.message}`);F0=!0}j.add(F0?"IMAGES_REMOTE_CROSS":"IMAGES_REMOTE_SAME")}else if(J0&&!J0.startsWith("#"))j.add("IMAGES_LOCAL")}G.IMAGES={count:X.length};let w=q("filter");if(w.length>0){j.add("FILTERS_BASIC");for(let o of w){let J0=o.outerHTML||"";if(J0.includes("feTurbulence")||J0.includes("feLighting")||J0.includes("feConvolveMatrix")||J0.includes("feDisplacementMap")){j.add("FILTERS_COMPLEX");break}}G.FILTERS={count:w.length}}let R=q("mask");if(R.length>0)j.add("MASKS"),G.MASKS={count:R.length};let I=q("clippath");if(I.length>0)j.add("CLIP_PATHS"),G.CLIP_PATHS={count:I.length};let f=["animate","animatetransform","animatemotion","animatecolor","set"],u=0,m={timed:0,click:0,hover:0,focus:0,accesskey:0,syncbase:0};for(let o of f){let J0=q(o);u+=J0.length;for(let F0 of J0){let O0=(F0.getAttribute("begin")||"").toLowerCase(),R0=(F0.getAttribute("end")||"").toLowerCase(),I0=O0+" "+R0;if(I0.includes("click")||I0.includes("dblclick"))m.click++,j.add("SMIL_CLICK");if(I0.includes("mouseover")||I0.includes("mouseout")||I0.includes("mouseenter")||I0.includes("mouseleave"))m.hover++,j.add("SMIL_HOVER");if(I0.includes("focus")||I0.includes("blur"))m.focus++,j.add("SMIL_FOCUS");if(I0.includes("accesskey("))m.accesskey++,j.add("SMIL_ACCESSKEY");if(I0.match(/\w+\.(begin|end)/))m.syncbase++,j.add("SMIL_SYNCBASE");if(!I0.includes("click")&&!I0.includes("mouse")&&!I0.includes("focus")&&!I0.includes("accesskey"))m.timed++}}if(u>0)j.add("SMIL_TIMED"),G.SMIL={count:u,triggers:m};let S=!1,x=!1,h=!1;for(let o of Y){let J0=o.textContent||"";if(J0.includes("@keyframes"))S=!0;if(J0.includes("transition:")||J0.includes("transition-property"))x=!0;if(J0.includes(":hover"))h=!0}if(S)j.add("CSS_KEYFRAMES");if(x)j.add("CSS_TRANSITIONS");if(h)j.add("CSS_HOVER");let E=q("script");if(E.length>0){for(let o of E){let J0=o.getAttribute("src")||o.getAttribute("href")||o.getAttribute("xlink:href"),F0=o.getAttribute("type")||"";if(J0)j.add("SCRIPT_EXTERNAL");else j.add("SCRIPT_INLINE");if(F0==="module")j.add("SCRIPT_MODULE")}G.SCRIPTS={count:E.length}}let d=["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","onfocus","onblur","onkeydown","onkeyup","onkeypress","onload","onerror","onscroll","onwheel","ontouchstart","ontouchend","ontouchmove"],c={onclick:"EVENT_ONCLICK",ondblclick:"EVENT_ONDBLCLICK",onmousedown:"EVENT_ONMOUSEDOWN",onmouseup:"EVENT_ONMOUSEUP",onmouseover:"EVENT_ONMOUSEOVER",onmouseout:"EVENT_ONMOUSEOUT",onmousemove:"EVENT_ONMOUSEMOVE",onfocus:"EVENT_ONFOCUS",onblur:"EVENT_ONBLUR",onload:"EVENT_ONLOAD",onerror:"EVENT_ONERROR",onscroll:"EVENT_ONSCROLL",onwheel:"EVENT_ONWHEEL",ontouchstart:"EVENT_ONTOUCH",ontouchend:"EVENT_ONTOUCH",ontouchmove:"EVENT_ONTOUCH",onkeydown:"EVENT_ONKEYBOARD",onkeyup:"EVENT_ONKEYBOARD",onkeypress:"EVENT_ONKEYBOARD"};for(let o of F)for(let J0 of d)if(o.getAttribute(J0)){let F0=c[J0];if(F0)j.add(F0)}let p=q("a");if(p.length>0){for(let o of p){if((o.getAttribute("href")||o.getAttribute("xlink:href")||"").startsWith("#"))j.add("LINK_INTERNAL");else j.add("LINK_EXTERNAL");if(o.getAttribute("target"))j.add("LINK_TARGET");if(o.getAttribute("download"))j.add("LINK_DOWNLOAD")}G.LINKS={count:p.length}}let N=q("foreignobject");if(N.length>0){j.add("FOREIGNOBJECT_BASIC"),j.add("FOREIGNOBJECT_HTML");for(let o of N){let J0=(F0)=>{let O0=F0.tagName?.toLowerCase();if(O0==="form")j.add("FOREIGNOBJECT_FORM");if(O0==="input"||O0==="textarea"||O0==="select")j.add("FOREIGNOBJECT_INPUT");if(O0==="canvas")j.add("FOREIGNOBJECT_CANVAS");if(O0==="video")j.add("FOREIGNOBJECT_VIDEO");if(O0==="iframe")j.add("FOREIGNOBJECT_IFRAME");for(let R0 of F0.children||[])if(R0&&R0.tagName)J0(R0)};J0(o)}G.FOREIGNOBJECT={count:N.length}}let y=q("audio"),B=q("video");for(let o of N){let J0=(F0)=>{let O0=F0.tagName?.toLowerCase();if(O0==="audio")y.push(F0);if(O0==="video")B.push(F0);for(let R0 of F0.children||[])if(R0&&R0.tagName)J0(R0)};J0(o)}if(y.length>0){for(let o of y){let J0=o.getAttribute("src")||"",F0=q("source").filter((R0)=>R0.parentNode===o),O0=J0||(F0.length>0?F0[0].getAttribute("src"):"");if(O0?.startsWith("data:"))j.add("AUDIO_EMBEDDED");else if(O0?.startsWith("http"))j.add("AUDIO_REMOTE");else if(O0)j.add("AUDIO_LOCAL");if(o.hasAttribute("autoplay"))j.add("AUDIO_AUTOPLAY");if(o.hasAttribute("controls"))j.add("AUDIO_CONTROLS")}G.AUDIO={count:y.length}}if(B.length>0){for(let o of B){let J0=o.getAttribute("src")||"";if(J0.startsWith("data:"))j.add("VIDEO_EMBEDDED");else if(J0.startsWith("http"))j.add("VIDEO_REMOTE");else if(J0)j.add("VIDEO_LOCAL");if(o.hasAttribute("autoplay"))j.add("VIDEO_AUTOPLAY")}G.VIDEO={count:B.length}}let e=q("use");if(e.length>0){for(let o of e){let J0=o.getAttribute("href")||o.getAttribute("xlink:href")||"";if(J0.startsWith("#"))j.add("USE_INTERNAL");else if(J0.startsWith("http"))j.add("USE_EXTERNAL_CROSS");else if(J0)j.add("USE_EXTERNAL_SAME")}j.add("USE_SHADOW_DOM"),G.USE={count:e.length}}for(let o of F){for(let J0 of o.getAttributeNames?.()||[])if(J0.startsWith("aria-")){j.add("A11Y_ARIA");break}if(o.getAttribute("role"))j.add("A11Y_ROLE");if(o.getAttribute("tabindex"))j.add("A11Y_TABINDEX")}if(q("title").length>0||q("desc").length>0)j.add("A11Y_TITLE");for(let o of F){for(let J0 of o.getAttributeNames?.()||[])if(J0.startsWith("data-")){j.add("META_DATA_ATTRS");break}if(o.getAttribute("class"))j.add("META_CLASS");if(o.getAttribute("id"))j.add("META_ID")}for(let o of Y)if((o.textContent||"").includes("@import"))j.add("EXT_CSS_IMPORT");for(let o of F)for(let J0 of o.getAttributeNames?.()||[])if(J0.startsWith("xlink:")){j.add("EXT_XLINK");break}let r={timestamp:new Date().toISOString(),detectedCapabilities:[...j],capabilityDetails:G,totalCombinations:0,combinationsWithIssues:0,cells:[]},s=(o,J0,F0,O0,R0,I0)=>{let b=Q8[o];if(!b)return{status:L.DEPENDS,note:"No compatibility data",browsers:[]};let C=b.default,l="",g=[];for(let[n,G0]of Object.entries(b.exceptions||{})){let L0=!1;if(n.startsWith("syntax:")){let P0=n.substring(7);if(P0==="*"||P0===R0.id||P0.includes("*")&&R0.id.startsWith(P0.replace("*","")))L0=!0}else if(n.startsWith("load:")){if(n.substring(5)===F0.id)L0=!0}else if(n.startsWith("storage:")){if(n.substring(8)===O0.id)L0=!0}else if(n.startsWith("display:")){if(n.substring(8)===J0.id)L0=!0}else if(n.startsWith("renderer:")){let P0=n.substring(9);if(P0==="*"&&J0.type==="renderer")L0=!0;if(P0===J0.id)L0=!0}else if(n.startsWith("browser:")){let P0=n.substring(8);if(P0==="*")for(let E0 of Object.values(yK))g.push({browser:E0.name,status:G0.status,note:G0.note});else{let E0=Object.values(yK).find((U7)=>U7.id===P0);if(E0)g.push({browser:E0.name,status:G0.status,note:G0.note})}}if(L0)C=G0.status,l=G0.note||""}return{status:C,note:l,browserIssues:g}},z0=Object.values(xz),T=Object.values(mz),P=Object.values(dz),t=Object.values(hK),$0=Object.values(pz);for(let o of z0)for(let J0 of T)for(let F0 of P)for(let O0 of t)for(let R0 of $0){if(r.totalCombinations++,R0.script&&!["script-inner","script-dom","script-fetch"].includes(O0.id))continue;if(o.type==="renderer"&&O0.html)continue;let I0=[],b={};for(let C of j){if(z){let n=a6[C];if(n&&!z.includes(n.cat))continue}let l=s(C,o,J0,F0,O0,R0),g=a6[C]||{name:C,cat:"unknown"};if(b[C]={name:g.name,category:g.cat,status:l.status,note:l.note,browserIssues:l.browserIssues},l.status!==L.WORKS&&l.status!==L.NA)I0.push({capability:C,name:g.name,category:g.cat,status:l.status,note:l.note,browserIssues:l.browserIssues})}if(I0.length>0||!Q){let C={combination:{display:o.name,displayId:o.id,displayType:o.type,load:J0.name,loadId:J0.id,storage:F0.name,storageId:F0.id,syntax:O0.name,syntaxId:O0.id,processing:R0.name,processingId:R0.id},issueCount:I0.length,issues:I0,allCapabilities:b};if(r.cells.push(C),I0.length>0)r.combinationsWithIssues++}}console.log(`
|
|
45
|
+
`+"═".repeat(120)),console.log("╔"+"═".repeat(118)+"╗"),console.log("║"+" FULL COMBINATORIAL SVG COMPATIBILITY MATRIX ".padStart(82).padEnd(118)+"║"),console.log("║"+" ALL AXIS COMBINATIONS × ALL CAPABILITIES × ALL BROWSERS ".padStart(88).padEnd(118)+"║"),console.log("╚"+"═".repeat(118)+"╝"),console.log(`
|
|
46
|
+
┌`+"─".repeat(118)+"┐"),console.log("│ SUMMARY STATISTICS"+" ".repeat(99)+"│"),console.log("├"+"─".repeat(118)+"┤"),console.log(`│ Total axis combinations evaluated: ${r.totalCombinations.toString().padEnd(80)} │`),console.log(`│ Combinations with issues: ${r.combinationsWithIssues.toString().padEnd(89)} │`),console.log(`│ Detected capabilities in SVG: ${r.detectedCapabilities.length.toString().padEnd(85)} │`),console.log("└"+"─".repeat(118)+"┘"),console.log(`
|
|
47
|
+
┌`+"─".repeat(118)+"┐"),console.log("│ DETECTED SVG CAPABILITIES"+" ".repeat(92)+"│"),console.log("├"+"─".repeat(118)+"┤");let Q0={};for(let o of j){let J0=a6[o]||{cat:"unknown",name:o};if(!Q0[J0.cat])Q0[J0.cat]=[];Q0[J0.cat].push({key:o,name:J0.name})}for(let[o,J0]of Object.entries(Q0)){let F0=o.toUpperCase();console.log(`│ ${F0}:`.padEnd(119)+"│");for(let O0 of J0){let R0=G[O0.key.split("_")[0]]||{},I0=` • ${O0.name}`;if(R0.count!==void 0)I0+=` (${R0.count})`;console.log(`│ ${I0}`.padEnd(119)+"│")}}if(console.log("└"+"─".repeat(118)+"┘"),K){console.log(`
|
|
48
|
+
╔`+"═".repeat(118)+"╗"),console.log("║ FULL COMPATIBILITY MATRIX BY EMBEDDING METHOD"+" ".repeat(71)+"║"),console.log("╚"+"═".repeat(118)+"╝");let o={};for(let J0 of r.cells){let F0=J0.combination.syntaxId;if(!o[F0])o[F0]=[];o[F0].push(J0)}for(let[J0,F0]of Object.entries(o)){let O0=Object.values(hK).find((b)=>b.id===J0),R0=O0?O0.name:J0;console.log(`
|
|
49
|
+
┌`+"─".repeat(118)+"┐"),console.log(`│ SYNTAX: ${R0}`.padEnd(119)+"│"),console.log("├"+"─".repeat(30)+"┬"+"─".repeat(20)+"┬"+"─".repeat(25)+"┬"+"─".repeat(40)+"┤"),console.log("│ CONTEXT COMBINATION │ ISSUES │ BLOCKED CAPABILITIES │ BROWSER-SPECIFIC NOTES │"),console.log("├"+"─".repeat(30)+"┼"+"─".repeat(20)+"┼"+"─".repeat(25)+"┼"+"─".repeat(40)+"┤"),F0.sort((b,C)=>C.issueCount-b.issueCount);let I0=Z?F0:F0.slice(0,20);for(let b of I0){let C=`${(b.combination.displayId||"").substring(0,8)}/${b.combination.loadId}/${(b.combination.storageId||"").substring(0,8)}`,l=b.issueCount.toString(),g=b.issues.filter((G0)=>G0.status===L.BLOCKED).map((G0)=>(G0.name||"").substring(0,15)).slice(0,2).join(", "),n=b.issues.flatMap((G0)=>G0.browserIssues||[]).slice(0,2).map((G0)=>`${G0.browser}: ${G0.note?.substring(0,15)||""}`).join("; ");console.log(`│ ${C.padEnd(28)} │ ${l.padEnd(18)} │ ${(g||"-").substring(0,23).padEnd(23)} │ ${(n||"-").substring(0,38).padEnd(38)} │`)}if(!Z&&F0.length>20)console.log(`│ ... and ${F0.length-20} more combinations`.padEnd(119)+"│");console.log("└"+"─".repeat(30)+"┴"+"─".repeat(20)+"┴"+"─".repeat(25)+"┴"+"─".repeat(40)+"┘")}}console.log(`
|
|
50
|
+
╔`+"═".repeat(118)+"╗"),console.log("║ DETAILED ISSUE BREAKDOWN BY CAPABILITY"+" ".repeat(78)+"║"),console.log("╚"+"═".repeat(118)+"╝");for(let o of j){let J0=a6[o]||{name:o,cat:"unknown"},F0=Q8[o];if(console.log(`
|
|
51
|
+
┌`+"─".repeat(118)+"┐"),console.log(`│ ${J0.name} (${J0.cat})`.padEnd(119)+"│"),console.log("├"+"─".repeat(118)+"┤"),!F0)console.log("│ No compatibility data available".padEnd(119)+"│");else if(console.log(`│ Default status: ${F0.default}`.padEnd(119)+"│"),Object.keys(F0.exceptions||{}).length>0){console.log("│ Exceptions:".padEnd(119)+"│");for(let[O0,R0]of Object.entries(F0.exceptions)){let I0=` ${O0}: ${R0.status} - ${R0.note||"No details"}`;console.log(`│ ${I0.substring(0,116)}`.padEnd(119)+"│")}}console.log("└"+"─".repeat(118)+"┘")}if(H){console.log(`
|
|
52
|
+
╔`+"═".repeat(118)+"╗"),console.log("║ BROWSER-SPECIFIC COMPATIBILITY QUICK REFERENCE"+" ".repeat(70)+"║"),console.log("╚"+"═".repeat(118)+"╝"),console.log(`
|
|
53
|
+
┌`+"─".repeat(14)+"┬"+"─".repeat(103)+"┐"),console.log("│ BROWSER │ KNOWN LIMITATIONS FOR DETECTED CAPABILITIES"+" ".repeat(58)+"│"),console.log("├"+"─".repeat(14)+"┼"+"─".repeat(103)+"┤");let o={Chrome:["Full SMIL support","Autoplay policy","External use blocked"],Firefox:["Good SMIL support","Autoplay policy","External use blocked"],Safari:["Full SMIL support","Strict autoplay","WebKit-specific filters"],"Safari iOS":["Full SMIL","VERY strict autoplay","Touch events only"],Edge:["Same as Chrome (Blink)","Autoplay policy","External use blocked"],"IE 11":["NO SMIL","NO blend modes","Limited filters","NO foreignObject scripting"],"Android WebView":["Varies by version","Autoplay restrictions","Limited CSS animations"]};for(let[J0,F0]of Object.entries(o)){let O0=F0.filter((R0)=>{let I0=R0.toLowerCase();if(I0.includes("smil")&&[...j].some((b)=>b.startsWith("SMIL_")))return!0;if(I0.includes("autoplay")&&j.has("AUDIO_AUTOPLAY"))return!0;if(I0.includes("blend")&&j.has("RENDER_BLENDMODES"))return!0;if(I0.includes("filter")&&(j.has("FILTERS_BASIC")||j.has("FILTERS_COMPLEX")))return!0;if(I0.includes("foreign")&&[...j].some((b)=>b.startsWith("FOREIGNOBJECT_")))return!0;if(I0.includes("external use")&&(j.has("USE_EXTERNAL_SAME")||j.has("USE_EXTERNAL_CROSS")))return!0;return!1});if(O0.length>0){let R0=O0.slice(0,3).join(", ");console.log(`│ ${J0.padEnd(12)} │ ${R0.substring(0,101).padEnd(101)} │`)}}console.log("└"+"─".repeat(14)+"┴"+"─".repeat(103)+"┘")}console.log(`
|
|
54
|
+
╔`+"═".repeat(118)+"╗"),console.log("║ RECOMMENDATIONS FOR MAXIMUM COMPATIBILITY"+" ".repeat(75)+"║"),console.log("╚"+"═".repeat(118)+"╝");let V0=[];if(j.has("AUDIO_AUTOPLAY")||j.has("AUDIO_EMBEDDED")||j.has("AUDIO_LOCAL")||j.has("AUDIO_REMOTE"))V0.push({feature:"Audio Playback",issue:"Browser autoplay policies block automatic audio",bestSyntax:"INLINE-SVG with JavaScript",workaround:"Extract audio data-URI, create Audio object, play on user click gesture",code:"document.querySelector('svg').addEventListener('click', () => new Audio(dataUri).play());"});if(j.has("SMIL_CLICK")||j.has("SMIL_HOVER")||j.has("SMIL_FOCUS")||j.has("SMIL_ACCESSKEY"))V0.push({feature:"Interactive SMIL Animation",issue:"Blocked in <img>, CSS backgrounds, and most renderers",bestSyntax:"<object>, <embed>, <iframe>, or inline <svg>",workaround:"Avoid <img> and CSS embedding for interactive SVGs",code:'<object data="animation.svg" type="image/svg+xml" width="800" height="600"></object>'});if(j.has("SCRIPT_INLINE")||j.has("SCRIPT_EXTERNAL"))V0.push({feature:"JavaScript Execution",issue:"Completely blocked in <img>, CSS contexts, email, most social platforms",bestSyntax:"Inline <svg> or <object>/<embed>/<iframe>",workaround:"For widest compatibility, convert JS interactions to SMIL or CSS",code:`<!-- Inline: --> <div><svg>...</svg></div>
|
|
55
|
+
<!-- Isolated: --> <object data="app.svg"></object>`});if([...j].some((o)=>o.startsWith("FOREIGNOBJECT_")))V0.push({feature:"foreignObject / HTML Content",issue:"Completely ignored in <img>, CSS contexts, most renderers (Cairo, ImageMagick)",bestSyntax:"Inline <svg> or <object>/<embed>",workaround:"For rasterization, use browser screenshot or Puppeteer instead of ImageMagick",code:'<object data="with-html.svg" type="image/svg+xml"></object>'});if(j.has("IMAGES_REMOTE_CROSS")||j.has("FONTS_WEB_CROSS")||j.has("USE_EXTERNAL_CROSS")||j.has("AUDIO_REMOTE"))V0.push({feature:"Cross-Origin Resources",issue:"Blocked without CORS headers, completely blocked in <img> context",bestSyntax:"Any syntax with proper CORS, or embed resources as data-URIs",workaround:"Use embedExternalDependencies() to inline all external resources",code:"await embedExternalDependencies(doc, { embedImages: true, embedFonts: true, embedAudio: true });"});for(let o of V0){console.log(`
|
|
56
|
+
┌`+"─".repeat(118)+"┐"),console.log(`│ ${o.feature}`.padEnd(119)+"│"),console.log("├"+"─".repeat(118)+"┤"),console.log(`│ Issue: ${o.issue}`.substring(0,119).padEnd(119)+"│"),console.log(`│ Best syntax: ${o.bestSyntax}`.substring(0,119).padEnd(119)+"│"),console.log(`│ Workaround: ${o.workaround}`.substring(0,119).padEnd(119)+"│"),console.log("│ Code:".padEnd(119)+"│");for(let J0 of(o.code||"").split(`
|
|
57
|
+
`).slice(0,3))console.log(`│ ${J0}`.substring(0,119).padEnd(119)+"│");console.log("└"+"─".repeat(118)+"┘")}console.log(`
|
|
58
|
+
╔`+"═".repeat(118)+"╗"),console.log("║ OVERALL COMPATIBILITY ASSESSMENT"+" ".repeat(84)+"║"),console.log("╚"+"═".repeat(118)+"╝");let N0={};for(let o of t){let J0=100,F0=[];for(let O0 of j){let R0=a6[O0]||{name:O0,critical:!1},I0=Q8[O0];if(I0){for(let[b,C]of Object.entries(I0.exceptions||{}))if(b.startsWith("syntax:")){let l=b.substring(7);if(l===o.id||l==="*"||l.includes("*")&&o.id.startsWith(l.replace("*",""))){let g=R0.critical?30:10;J0-=g,F0.push({cap:R0.name,penalty:g,status:C.status})}}}}N0[o.id]={name:o.name,score:Math.max(0,J0),deductions:F0}}let h0=Object.entries(N0).sort((o,J0)=>J0[1].score-o[1].score);console.log(`
|
|
59
|
+
┌`+"─".repeat(25)+"┬"+"─".repeat(10)+"┬"+"─".repeat(81)+"┐"),console.log("│ EMBEDDING METHOD │ SCORE │ ISSUES"+" ".repeat(74)+"│"),console.log("├"+"─".repeat(25)+"┼"+"─".repeat(10)+"┼"+"─".repeat(81)+"┤");for(let[o,J0]of h0){let F0=J0.score===100?"100% ✅":J0.score>=70?`${J0.score}% ⚠️`:`${J0.score}% ❌`,O0=J0.deductions.slice(0,3).map((R0)=>R0.cap).join(", ")||"None";console.log(`│ ${J0.name.padEnd(23)} │ ${F0.padEnd(8)} │ ${O0.substring(0,79).padEnd(79)} │`)}if(console.log("└"+"─".repeat(25)+"┴"+"─".repeat(10)+"┴"+"─".repeat(81)+"┘"),h0.length===0)console.log(`
|
|
60
|
+
⚠️ No embedding methods available for recommendation.`);else{let o=h0[0];if(console.log(`
|
|
61
|
+
★ RECOMMENDED: Use "${o[1].name}" for this SVG (score: ${o[1].score}%)`),o[1].score<100)console.log(`
|
|
62
|
+
⚠️ No embedding method achieves 100% compatibility for this SVG.`),console.log(" Consider using embedExternalDependencies() to maximize portability.")}return console.log(`
|
|
63
|
+
`+"═".repeat(120)+`
|
|
64
|
+
`),$._fullCompatibilityMatrix=r,$});function lK($,J={}){let Z=J.compact!==!1,K=J.showAllCells||!1,Q=[{id:"direct",label:"DIRECT",desc:"SVG file"},{id:"img",label:"IMG",desc:"<img>"},{id:"object",label:"OBJECT",desc:"<object>"},{id:"embed",label:"EMBED",desc:"<embed>"},{id:"inline",label:"INLINE",desc:"<svg>"},{id:"css",label:"CSS",desc:"bg-image"}],H=[{id:"embedded",label:"EMB",desc:"data-uri/inline"},{id:"local",label:"LOC",desc:"local path"},{id:"remote",label:"REM",desc:"http(s) URL"}],z=[{id:"browser",label:"BROWSER",desc:"Desktop browsers"},{id:"mobile",label:"MOBILE",desc:"Mobile WebView"},{id:"renderer",label:"RENDER",desc:"Server-side"}],q=[{id:"file",label:"file://",desc:"Local filesystem"},{id:"http",label:"http(s)://",desc:"Web server"},{id:"data",label:"data:",desc:"Data URI"}],W=[{id:"script",label:"+JS",desc:"With JavaScript"},{id:"noscript",label:"-JS",desc:"No JavaScript"}],j=[{id:"chrome",code:"C",name:"Chrome"},{id:"firefox",code:"F",name:"Firefox"},{id:"safari",code:"S",name:"Safari"},{id:"edge",code:"E",name:"Edge"},{id:"ie11",code:"I",name:"IE11"},{id:"ios",code:"i",name:"iOS Safari"},{id:"android",code:"A",name:"Android"}],G={display:{icon:"D",emoji:"\uD83D\uDCD0",name:"Basic rendering"},animation:{icon:"A",emoji:"\uD83C\uDFAC",name:"SMIL/CSS animation"},scripting:{icon:"J",emoji:"\uD83D\uDCDC",name:"JavaScript"},events:{icon:"E",emoji:"\uD83D\uDDB1️",name:"Event handlers"},media:{icon:"M",emoji:"\uD83D\uDD0A",name:"Audio/Video"},html:{icon:"H",emoji:"\uD83D\uDCC4",name:"foreignObject"},images:{icon:"I",emoji:"\uD83D\uDDBC️",name:"External images"},fonts:{icon:"T",emoji:"\uD83D\uDD24",name:"External fonts"},sprites:{icon:"U",emoji:"\uD83C\uDFAF",name:"use elements"},links:{icon:"L",emoji:"\uD83D\uDD17",name:"Hyperlinks"}},F=Q.length*H.length,_=z.length*q.length*W.length,U=Z?18:28,O=25,V=Z?2:3;console.log(`
|
|
65
|
+
`),console.log("╔"+"═".repeat(160)+"╗"),console.log("║"+" HIERARCHICAL SVG COMPATIBILITY MATRIX - DETAILED ".padStart(105).padEnd(160)+"║"),console.log("║"+` ${F} columns × ${_} rows = ${F*_} cells `.padStart(105).padEnd(160)+"║"),console.log("║"+" Each cell shows: [Browser status] / [Functionality issues] ".padStart(105).padEnd(160)+"║"),console.log("╚"+"═".repeat(160)+"╝"),console.log(`
|
|
66
|
+
`);let M=H.length*U,Y=26+Q.length*(M+1),X="".padEnd(25)+"│";for(let N of Q){let y=`${N.label} (${N.desc})`;X+=y.padStart(Math.floor(M/2)+Math.floor(y.length/2)).padEnd(M)+"│"}console.log("┌"+"─".repeat(25)+"┬"+Q.map(()=>"─".repeat(M)).join("┬")+"┐"),console.log("│"+"SYNTAX →".padEnd(25)+X.substring(26));let w="".padEnd(25)+"│";for(let N of Q){for(let y of H){let B=`${y.label}`;w+=B.padStart(Math.floor(U/2)+Math.floor(B.length/2)).padEnd(U)}w+="│"}console.log("│"+"STORAGE →".padEnd(25)+w.substring(26));let R="".padEnd(25)+"│";for(let N of Q){for(let y of H)R+="Brws|Func".padStart(Math.floor(U/2)+5).padEnd(U);R+="│"}console.log("│"+"".padEnd(25)+R.substring(26)),console.log("├"+"─".repeat(25)+"┼"+Q.map(()=>H.map(()=>"─".repeat(U)).join("─")).join("┼")+"┤");let I=(N,y,B,e,r)=>{let s={browserStatus:{},funcStatus:{},overallStatus:"ok",issueCount:0,browserCount:0};for(let t of j){s.browserStatus[t.id]={};for(let[$0]of Object.entries(G))s.browserStatus[t.id][$0]="ok"}for(let[t]of Object.entries(G))s.funcStatus[t]="ok";if(e==="img"||e==="css"){let t=["animation","scripting","events","html","media","links"];for(let $0 of t){s.funcStatus[$0]="block";for(let Q0 of j)s.browserStatus[Q0.id][$0]="block"}if(B==="remote"){s.funcStatus.images="block",s.funcStatus.fonts="block";for(let $0 of j)s.browserStatus[$0.id].images="block",s.browserStatus[$0.id].fonts="block"}}if(N==="renderer"){let t=["animation","scripting","events","media"];for(let $0 of t){s.funcStatus[$0]="block";for(let Q0 of j)s.browserStatus[Q0.id][$0]="block"}s.funcStatus.html="block";for(let $0 of j)s.browserStatus[$0.id].html="block"}if(r==="noscript"){s.funcStatus.scripting="block",s.funcStatus.events="warn";for(let t of j)s.browserStatus[t.id].scripting="block",s.browserStatus[t.id].events="warn"}if(s.browserStatus.ie11.animation="block",s.browserStatus.ie11.html="block",s.browserStatus.ie11.sprites="warn",$.detectedCapabilities?.some((t)=>t.startsWith("AUDIO_")||t.startsWith("VIDEO_"))){for(let t of j)if(s.browserStatus[t.id].media!=="block")s.browserStatus[t.id].media="warn";s.browserStatus.ios.media="block",s.funcStatus.media="warn"}if(B==="remote"){s.funcStatus.images=s.funcStatus.images==="block"?"block":"warn",s.funcStatus.fonts=s.funcStatus.fonts==="block"?"block":"warn",s.funcStatus.sprites=s.funcStatus.sprites==="block"?"block":"warn";for(let t of j){if(s.browserStatus[t.id].images!=="block")s.browserStatus[t.id].images="warn";if(s.browserStatus[t.id].fonts!=="block")s.browserStatus[t.id].fonts="warn"}}if(y==="file"){if(B==="remote")s.funcStatus.images="warn",s.funcStatus.fonts="warn",s.funcStatus.links="warn"}if(y==="data"){if(B==="remote"||B==="local")s.funcStatus.images="warn",s.funcStatus.fonts="warn"}let z0=!1,T=!1,P=new Set;for(let[t,$0]of Object.entries(s.funcStatus))if($0==="block")z0=!0,s.issueCount++;else if($0==="warn")T=!0,s.issueCount++;for(let t of j)for(let[$0,Q0]of Object.entries(s.browserStatus[t.id]))if(Q0!=="ok")P.add(t.id);return s.browserCount=P.size,s.overallStatus=z0?"block":T?"warn":"ok",s},f=(N,y)=>{let B=[],e={ok:"✓",warn:"⚠",block:"✗"};if(N.overallStatus==="ok")return B.push("✅ ALL OK".padStart(Math.floor(y/2)+5).padEnd(y)),B.push("".padEnd(y)),B;let r="";for(let z0 of j){let T="ok";for(let[P,t]of Object.entries(N.browserStatus[z0.id]))if(t==="block"){T="block";break}else if(t==="warn"&&T!=="block")T="warn";r+=`${z0.code}${e[T]}`}B.push(r.padStart(Math.floor(y/2)+Math.floor(r.length/2)).padEnd(y));let s="";for(let[z0,T]of Object.entries(G)){let P=N.funcStatus[z0];if(P!=="ok")s+=`${T.icon}${e[P]}`}if(s==="")s="(ok)";return B.push(s.padStart(Math.floor(y/2)+Math.floor(s.length/2)).padEnd(y)),B},u=(N,y)=>{let B={ok:"✓",warn:"⚠",block:"✗"};if(N.overallStatus==="ok")return"✅".padStart(Math.floor(y/2)+1).padEnd(y);let e=N.overallStatus==="block"?"❌":"⚠️",r=`${N.browserCount}B`,s=`${N.issueCount}F`,z0=`${e}${r}${s}`;return z0.padStart(Math.floor(y/2)+Math.floor(z0.length/2)).padEnd(y)};for(let N of z){let y=Q.map(()=>H.map(()=>" ".repeat(U)).join(" ")).join("│");console.log("│ "+(N.label+":").padEnd(23)+"│"+y+"│");for(let B of q){for(let e of W){let r=[];for(let $0 of Q)for(let Q0 of H){let V0=I(N.id,B.id,Q0.id,$0.id,e.id);r.push(V0)}let s=r.map(($0)=>f($0,U)),T="│"+` ${B.label} ${e.label}`.padEnd(25)+"│",P=0;for(let $0=0;$0<Q.length;$0++){for(let Q0=0;Q0<H.length;Q0++)T+=s[P][0],P++;T+="│"}console.log(T.substring(0,T.length-1));let t="│"+"".padEnd(25)+"│";P=0;for(let $0=0;$0<Q.length;$0++){for(let Q0=0;Q0<H.length;Q0++)t+=s[P][1],P++;t+="│"}if(console.log(t.substring(0,t.length-1)),e!==W[W.length-1]){let $0=Q.map(()=>H.map(()=>"·".repeat(U)).join("·")).join("│");console.log("│"+"·".repeat(25)+"│"+$0+"│")}}if(B!==q[q.length-1]){let e=Q.map(()=>H.map(()=>"─".repeat(U)).join("─")).join("┼");console.log("├"+"─".repeat(25)+"┼"+e+"┤")}}if(N!==z[z.length-1]){let B=Q.map(()=>H.map(()=>"═".repeat(U)).join("═")).join("╪");console.log("╞"+"═".repeat(25)+"╪"+B+"╡")}}console.log("└"+"─".repeat(25)+"┴"+Q.map(()=>H.map(()=>"─".repeat(U)).join("─")).join("┴")+"┘"),console.log(`
|
|
67
|
+
┌`+"─".repeat(120)+"┐"),console.log("│ LEGEND - HOW TO READ CELL CONTENT"+" ".repeat(85)+"│"),console.log("├"+"─".repeat(120)+"┤"),console.log("│ Each cell shows 2 lines:"+" ".repeat(95)+"│"),console.log("│ Line 1: Browser status (C=Chrome F=Firefox S=Safari E=Edge I=IE11 i=iOS A=Android)"+" ".repeat(34)+"│"),console.log("│ Line 2: Functionality issues (codes below)"+" ".repeat(74)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ Status symbols: ✓ = works ⚠ = warning/partial ✗ = blocked/broken"+" ".repeat(49)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ ✅ ALL OK = No issues in this combination"+" ".repeat(78)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ FUNCTIONALITY CODES:"+" ".repeat(99)+"│");let m="│ ";for(let[N,y]of Object.entries(G))m+=`${y.icon}=${N} `;console.log(m.padEnd(121)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ FULL FUNCTIONALITY NAMES:"+" ".repeat(94)+"│");let S="│ ";for(let[N,y]of Object.entries(G))S+=`${y.icon}=${y.name} `;if(S.length>120)console.log(S.substring(0,121)+"│"),S="│ "+S.substring(121);console.log(S.padEnd(121)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ EXAMPLES:"+" ".repeat(110)+"│"),console.log('│ "C✓F✓S✓E⚠I✗i✗A✓" = Chrome/Firefox/Safari/Android OK, Edge warning, IE11/iOS blocked'+" ".repeat(30)+"│"),console.log('│ "A✗J✗M⚠H✗" = Animation blocked, Scripting blocked, Media warning, HTML blocked'+" ".repeat(37)+"│"),console.log("└"+"─".repeat(120)+"┘"),console.log(`
|
|
68
|
+
`),console.log("╔"+"═".repeat(120)+"╗"),console.log("║"+" TABLE 2: INTERNAL SVG RESOURCES COMPATIBILITY ".padStart(84).padEnd(120)+"║"),console.log("╚"+"═".repeat(120)+"╝");let x=[{id:"images_embedded",label:"Embedded Images (data-uri)",icon:"\uD83D\uDDBC️"},{id:"images_local",label:"Local Images (path)",icon:"\uD83D\uDCC1"},{id:"images_remote",label:"Remote Images (URL)",icon:"\uD83C\uDF10"},{id:"fonts_embedded",label:"Embedded Fonts (data-uri)",icon:"\uD83D\uDD24"},{id:"fonts_local",label:"Local Fonts (path)",icon:"\uD83D\uDCC1"},{id:"fonts_remote",label:"Remote Fonts (URL)",icon:"\uD83C\uDF10"},{id:"css_inline",label:"Inline <style>",icon:"\uD83C\uDFA8"},{id:"css_external",label:"External CSS",icon:"\uD83D\uDCC4"},{id:"scripts_inline",label:"Inline <script>",icon:"\uD83D\uDCDC"},{id:"scripts_external",label:"External Scripts",icon:"\uD83D\uDCE6"},{id:"audio_embedded",label:"Embedded Audio",icon:"\uD83D\uDD0A"},{id:"audio_external",label:"External Audio",icon:"\uD83C\uDFB5"}],h=14,E="".padEnd(30)+"│";for(let N of Q)E+=N.label.padStart(h-1).padEnd(h);E+="│",console.log(`
|
|
69
|
+
┌`+"─".repeat(30)+"┬"+"─".repeat(Q.length*h)+"┐"),console.log("│"+"RESOURCE TYPE".padEnd(30)+E.substring(31)),console.log("├"+"─".repeat(30)+"┼"+"─".repeat(Q.length*h)+"┤");let d=(N,y)=>{if(y==="img"||y==="css"){if(N.includes("external")||N.includes("remote")||N.includes("scripts")||N.includes("audio"))return"❌";if(N.includes("local")&&!N.includes("embedded"))return"⚠️"}if(y==="object"||y==="embed"){if(N.includes("remote")&&!N.includes("embedded"))return"⚠️"}if(N.includes("embedded")||N.includes("inline"))return"✅";if(N.includes("local"))return"⚠️";if(N.includes("remote")||N.includes("external"))return"⚠️";return"✅"};for(let N of x){let y=`│ ${N.icon} ${N.label}`.padEnd(31)+"│";for(let B of Q){let e=d(N.id,B.id);y+=e.padStart(h-1).padEnd(h)}y+="│",console.log(y)}console.log("└"+"─".repeat(30)+"┴"+"─".repeat(Q.length*h)+"┘"),console.log(`
|
|
70
|
+
`),console.log("╔"+"═".repeat(120)+"╗"),console.log("║"+" TABLE 3: BROWSER-SPECIFIC ISSUES FOR DETECTED CAPABILITIES ".padStart(90).padEnd(120)+"║"),console.log("╚"+"═".repeat(120)+"╝");let c={};for(let N of $.detectedCapabilities||[]){let y={RENDER_:"display",FONTS_:"fonts",IMAGES_:"images",FILTERS_:"effects",MASKS:"effects",CLIP_:"effects",SMIL_:"animation",CSS_:"animation",SCRIPT_:"scripting",EVENT_:"events",LINK_:"links",FOREIGNOBJECT_:"html",AUDIO_:"media",VIDEO_:"media",USE_:"sprites",A11Y_:"accessibility",META_:"metadata"};for(let[B,e]of Object.entries(y))if(N.startsWith(B)||N===B.replace("_","")){if(!c[e])c[e]=[];c[e].push(N);break}}console.log(`
|
|
71
|
+
┌`+"─".repeat(20)+"┬"+"─".repeat(99)+"┐"),console.log("│ CAPABILITY"+" ".repeat(9)+"│ BROWSER ISSUES"+" ".repeat(84)+"│"),console.log("├"+"─".repeat(20)+"┼"+"─".repeat(99)+"┤");let p={animation:{Chrome:"Full SMIL support",IE11:"NO SMIL SUPPORT",Safari:"Full support"},media:{ALL:"Autoplay blocked - needs user gesture",iOS:"VERY strict autoplay policy"},html:{IE11:"No scripting in foreignObject",Cairo:"Not rendered",ImageMagick:"Not rendered"},scripting:{IE11:"Limited ES6 support"},effects:{IE11:"Limited filter support, no blend modes"}};for(let[N,y]of Object.entries(c)){let B=p[N]||{},e=Object.entries(B).map(([r,s])=>`${r}: ${s}`).join("; ")||"No known issues";console.log(`│ ${N.toUpperCase().padEnd(18)} │ ${e.substring(0,97).padEnd(97)} │`)}return console.log("└"+"─".repeat(20)+"┴"+"─".repeat(99)+"┘"),console.log(`
|
|
72
|
+
`+"═".repeat(140)+`
|
|
73
|
+
`),$}function nK($,J={}){let Z=J.fontFamily||"system-ui, -apple-system, BlinkMacSystemFont, sans-serif",K=(e)=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Q=[{id:"standalone",name:"Standalone SVG",desc:"Open .svg directly",color:"#1565C0",parent:null},{id:"img",name:"<img>",desc:"Image element",color:"#1976D2",parent:"html"},{id:"object",name:"<object>",desc:"Object element",color:"#1E88E5",parent:"html"},{id:"embed",name:"<embed>",desc:"Embed element",color:"#2196F3",parent:"html"},{id:"inline",name:"Inline <svg>",desc:"SVG in HTML",color:"#42A5F5",parent:"html"},{id:"css",name:"CSS background",desc:"background-image",color:"#64B5F6",parent:"html"}],H=[{id:"desktop",name:"Desktop Browser",color:"#E3F2FD",type:"desktop"},{id:"mobile",name:"Mobile Browser",color:"#E8F5E9",type:"mobile"}],z=[{id:"nodejs",name:"Node.js (JSDOM)",color:"#FFF3E0",issues:["No rendering","No animations","No interaction"]},{id:"imagemagick",name:"ImageMagick",color:"#EFEBE9",issues:["No animations","No scripts","No foreignObject","No web fonts"]},{id:"inkscape",name:"Inkscape CLI",color:"#F3E5F5",issues:["No animations","No scripts"]},{id:"librsvg",name:"librsvg",color:"#E0F2F1",issues:["No animations","No scripts","Limited filters"]},{id:"cairo",name:"Cairo",color:"#FBE9E7",issues:["No animations","No scripts","No filters","No foreignObject"]},{id:"batik",name:"Apache Batik",color:"#F3E5F5",issues:["No CSS animations","Limited SMIL","No web fonts"]}],q=[{id:"file",name:"file://",color:"#BBDEFB"},{id:"http",name:"http(s)://",color:"#C8E6C9"}],W=[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}],j=(e,r,s,z0)=>{let T=[],P=(t)=>T.push({text:t});if(z0==="img"||z0==="css")return P("No scripts"),P("No events"),P("No audio/video"),P("No links"),P("No foreignObject"),P("No external resources"),T;if(s==="nojs")P("No scripts"),P("No event handlers");if(r==="file")P("No remote fonts (Chrome, Safari)"),P("No remote images (Chrome)"),P("No fetch/XHR to remote URLs");if(z0==="object"||z0==="embed"){if(P("No event bubbling to parent"),r==="http")P("No cross-origin script access")}if(e==="desktop"){if(P("No SMIL (IE11 only)"),P("No CSS variables (IE11 only)"),s==="js")P("Audio: blocked until user click/tap event"),P("Audio: once blocked, won't auto-retry")}if(e==="mobile")P("No hover/mouseover events"),P("Audio: blocked until user tap event"),P("Audio: once blocked, won't auto-retry"),P("Video autoplay blocked");return T},G=0;for(let e of H)for(let r of q)for(let s of W)for(let z0 of Q){let T=j(e.id,r.id,s.id,z0.id).length;if(T>G)G=T}let F=130,_=80,U=90,O=F+_+U,V=60,M=220,Y=13,X=Math.max(80,(G+1)*Y+25),w=Q.length,R=H.length*q.length*W.length,I=O+w*M,u=V+R*X+40,m=30,S=40+z.length*m,x=u+S+30,h=1020,E=I+50,d=55+x+h+50,c=`<?xml version="1.0" encoding="UTF-8"?>
|
|
74
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${E} ${d}" preserveAspectRatio="xMinYMin meet" height="${d}" width="100%">
|
|
75
|
+
<title>SVG Compatibility Matrix</title>
|
|
76
|
+
|
|
77
|
+
<defs>
|
|
78
|
+
<style>
|
|
79
|
+
.title { font: bold 20px ${Z}; fill: #1a1a1a; }
|
|
80
|
+
.subtitle { font: 12px ${Z}; fill: #666; }
|
|
81
|
+
.col-header { font: bold 12px ${Z}; fill: #FFF; }
|
|
82
|
+
.col-desc { font: 10px ${Z}; fill: rgba(255,255,255,0.85); }
|
|
83
|
+
.row-label { font: 11px ${Z}; fill: #333; }
|
|
84
|
+
.row-label-bold { font: bold 11px ${Z}; fill: #1a1a1a; }
|
|
85
|
+
.cell-ok { fill: #C8E6C9; }
|
|
86
|
+
.cell-warn { fill: #FFF9C4; }
|
|
87
|
+
.cell-bad { fill: #FFCDD2; }
|
|
88
|
+
.ok-text { font: bold 13px ${Z}; fill: #2E7D32; }
|
|
89
|
+
.problem-text { font: 10px ${Z}; fill: #333; }
|
|
90
|
+
.legend-title { font: bold 11px ${Z}; fill: #333; }
|
|
91
|
+
.legend-text { font: 10px ${Z}; fill: #444; }
|
|
92
|
+
</style>
|
|
93
|
+
</defs>
|
|
94
|
+
|
|
95
|
+
<text x="${E/2}" y="24" text-anchor="middle" class="title">SVG Compatibility Matrix</text>
|
|
96
|
+
<text x="${E/2}" y="42" text-anchor="middle" class="subtitle">What problems will your SVG have in each configuration?</text>
|
|
97
|
+
|
|
98
|
+
<g transform="translate(25, 55)">
|
|
99
|
+
`,p=O;c+=` <rect x="${p}" y="0" width="${M}" height="${V}" fill="${Q[0].color}" stroke="#1565C0"/>
|
|
100
|
+
<text x="${p+M/2}" y="25" text-anchor="middle" class="col-header">${K(Q[0].name)}</text>
|
|
101
|
+
<text x="${p+M/2}" y="42" text-anchor="middle" class="col-desc">${K(Q[0].desc)}</text>
|
|
102
|
+
`,p+=M;let N=(Q.length-1)*M;c+=` <rect x="${p}" y="0" width="${N}" height="25" fill="#0D47A1"/>
|
|
103
|
+
<text x="${p+N/2}" y="17" text-anchor="middle" class="col-header">In HTML Page</text>
|
|
104
|
+
`;for(let e=1;e<Q.length;e++){let r=Q[e];c+=` <rect x="${p}" y="25" width="${M}" height="${V-25}" fill="${r.color}" stroke="#1976D2"/>
|
|
105
|
+
<text x="${p+M/2}" y="42" text-anchor="middle" class="col-header">${K(r.name)}</text>
|
|
106
|
+
<text x="${p+M/2}" y="55" text-anchor="middle" class="col-desc">${K(r.desc)}</text>
|
|
107
|
+
`,p+=M}let y=V;for(let e of H){let r=q.length*W.length*X;c+=` <rect x="0" y="${y}" width="${F}" height="${r}" fill="${e.color}" stroke="#999"/>
|
|
108
|
+
<text x="${F/2}" y="${y+r/2+4}" text-anchor="middle" class="row-label-bold">${K(e.name)}</text>
|
|
109
|
+
`;for(let s of q){let z0=W.length*X;c+=` <rect x="${F}" y="${y}" width="${_}" height="${z0}" fill="${s.color}" stroke="#CCC"/>
|
|
110
|
+
<text x="${F+_/2}" y="${y+z0/2+4}" text-anchor="middle" class="row-label">${K(s.name)}</text>
|
|
111
|
+
`;for(let T of W){c+=` <rect x="${F+_}" y="${y}" width="${U}" height="${X}" fill="${T.color}" stroke="#DDD"/>
|
|
112
|
+
<text x="${F+_+U/2}" y="${y+X/2+4}" text-anchor="middle" class="row-label">${K(T.name)}</text>
|
|
113
|
+
`,p=O;for(let P of Q){let t=j(e.id,s.id,T.id,P.id),$0="cell-ok";if(t.length>=4)$0="cell-bad";else if(t.length>0)$0="cell-warn";if(c+=` <rect x="${p}" y="${y}" width="${M}" height="${X}" class="${$0}" stroke="#DDD"/>
|
|
114
|
+
`,t.length===0)c+=` <text x="${p+M/2}" y="${y+X/2-5}" text-anchor="middle" class="ok-text">No issues</text>
|
|
115
|
+
<text x="${p+M/2}" y="${y+X/2+12}" text-anchor="middle" class="problem-text" style="fill:#388E3C">Everything works</text>
|
|
116
|
+
`;else{let Q0=y+16;for(let V0 of t){let N0=`• ${V0.text||"Unknown issue"}`;c+=` <text x="${p+8}" y="${Q0}" class="problem-text">${K(N0)}</text>
|
|
117
|
+
`,Q0+=Y}}p+=M}y+=X}}c+=` <line x1="0" y1="${y}" x2="${I}" y2="${y}" stroke="#999" stroke-width="2"/>
|
|
118
|
+
`}c+=`
|
|
119
|
+
<text x="0" y="${u}" class="legend-title">SERVER-SIDE SVG RENDERERS (no HTML embedding)</text>
|
|
120
|
+
`;let B=u+20;for(let e of z){c+=` <rect x="0" y="${B}" width="150" height="${m-4}" fill="${e.color}" stroke="#999"/>
|
|
121
|
+
<text x="10" y="${B+18}" class="row-label-bold">${K(e.name)}</text>
|
|
122
|
+
`;let r=e.issues.join(" • ");c+=` <text x="160" y="${B+18}" class="problem-text">${K(r)}</text>
|
|
123
|
+
`,B+=m}return c+=`
|
|
124
|
+
<g transform="translate(0, ${x})">
|
|
125
|
+
<text x="0" y="0" class="legend-title">LEGEND</text>
|
|
126
|
+
|
|
127
|
+
<rect x="0" y="15" width="18" height="14" class="cell-ok" stroke="#4CAF50"/>
|
|
128
|
+
<text x="24" y="26" class="legend-text">No issues - full SVG support</text>
|
|
129
|
+
|
|
130
|
+
<rect x="200" y="15" width="18" height="14" class="cell-warn" stroke="#FFC107"/>
|
|
131
|
+
<text x="224" y="26" class="legend-text">Some limitations - check details</text>
|
|
132
|
+
|
|
133
|
+
<rect x="450" y="15" width="18" height="14" class="cell-bad" stroke="#F44336"/>
|
|
134
|
+
<text x="474" y="26" class="legend-text">Many restrictions - features blocked</text>
|
|
135
|
+
|
|
136
|
+
<text x="0" y="55" class="legend-title">HOW TO READ THIS MATRIX</text>
|
|
137
|
+
<text x="0" y="73" class="legend-text">1. COLUMNS = How the SVG is embedded (Standalone, img tag, object tag, embed tag, inline, CSS background)</text>
|
|
138
|
+
<text x="0" y="89" class="legend-text">2. ROWS = Environment (Desktop/Mobile) + Protocol (file:// or http://) + JavaScript (enabled/disabled)</text>
|
|
139
|
+
<text x="0" y="105" class="legend-text">3. CELL CONTENT = Issues in that configuration. Browser names in parentheses = browser-specific issue.</text>
|
|
140
|
+
|
|
141
|
+
<text x="0" y="135" class="legend-title">SMIL "begin" ATTRIBUTE - HOW TO TRIGGER ANIMATIONS</text>
|
|
142
|
+
<text x="0" y="153" class="legend-text">The begin attribute defines when an animation becomes active. Use it on: <animate>, <animateMotion>, <animateTransform>, <set></text>
|
|
143
|
+
<text x="0" y="169" class="legend-text">Values can be semicolon-separated. Each value can be one of:</text>
|
|
144
|
+
|
|
145
|
+
<text x="0" y="189" class="legend-text" style="font-weight:bold"><offset-value></text>
|
|
146
|
+
<text x="140" y="189" class="legend-text">Clock-value relative to document load. Example: begin="2s" (start 2 seconds after load)</text>
|
|
147
|
+
|
|
148
|
+
<text x="0" y="205" class="legend-text" style="font-weight:bold"><syncbase-value></text>
|
|
149
|
+
<text x="140" y="205" class="legend-text">Sync with another animation. Example: begin="anim1.end" or begin="anim1.begin+1s"</text>
|
|
150
|
+
|
|
151
|
+
<text x="0" y="221" class="legend-text" style="font-weight:bold"><event-value></text>
|
|
152
|
+
<text x="140" y="221" class="legend-text">Start on DOM event. Example: begin="click" or begin="myRect.click" or begin="mouseover"</text>
|
|
153
|
+
|
|
154
|
+
<text x="0" y="237" class="legend-text" style="font-weight:bold"><repeat-value></text>
|
|
155
|
+
<text x="140" y="237" class="legend-text">Start when another animation repeats. Example: begin="anim1.repeat(2)"</text>
|
|
156
|
+
|
|
157
|
+
<text x="0" y="253" class="legend-text" style="font-weight:bold"><accessKey-value></text>
|
|
158
|
+
<text x="140" y="253" class="legend-text">Start on keypress. Example: begin="accessKey(s)" (start when 's' key is pressed)</text>
|
|
159
|
+
|
|
160
|
+
<text x="0" y="269" class="legend-text" style="font-weight:bold">indefinite</text>
|
|
161
|
+
<text x="140" y="269" class="legend-text">Only starts via JavaScript beginElement() call or hyperlink. Example: begin="indefinite"</text>
|
|
162
|
+
|
|
163
|
+
<text x="0" y="295" class="legend-title">EVENTS THAT SATISFY USER ACTIVATION (allow audio/video playback)</text>
|
|
164
|
+
<text x="0" y="313" class="legend-text" style="fill:#2E7D32">click - YES, allows audio. Direct user click/tap.</text>
|
|
165
|
+
<text x="0" y="329" class="legend-text" style="fill:#2E7D32">dblclick - YES, allows audio. Direct user double-click.</text>
|
|
166
|
+
<text x="0" y="345" class="legend-text" style="fill:#2E7D32">mousedown - YES, allows audio. User pressed mouse button.</text>
|
|
167
|
+
<text x="0" y="361" class="legend-text" style="fill:#2E7D32">mouseup - YES, allows audio. User released mouse button.</text>
|
|
168
|
+
<text x="0" y="377" class="legend-text" style="fill:#2E7D32">keydown - YES, allows audio. User pressed a key.</text>
|
|
169
|
+
<text x="0" y="393" class="legend-text" style="fill:#2E7D32">keyup - YES, allows audio. User released a key.</text>
|
|
170
|
+
<text x="0" y="409" class="legend-text" style="fill:#2E7D32">touchstart - YES, allows audio. User touched screen (mobile).</text>
|
|
171
|
+
<text x="0" y="425" class="legend-text" style="fill:#2E7D32">touchend - YES, allows audio. User lifted finger (mobile).</text>
|
|
172
|
+
|
|
173
|
+
<text x="0" y="455" class="legend-title">EVENTS THAT DO NOT SATISFY USER ACTIVATION (audio will fail)</text>
|
|
174
|
+
<text x="0" y="473" class="legend-text" style="fill:#C62828">mouseover, mouseout, mouseenter, mouseleave - NO, passive cursor movement.</text>
|
|
175
|
+
<text x="0" y="489" class="legend-text" style="fill:#C62828">mousemove - NO, passive cursor tracking.</text>
|
|
176
|
+
<text x="0" y="505" class="legend-text" style="fill:#C62828">scroll, wheel - NO, passive scrolling.</text>
|
|
177
|
+
<text x="0" y="521" class="legend-text" style="fill:#C62828">focus, blur, focusin, focusout - NO, can be triggered programmatically.</text>
|
|
178
|
+
<text x="0" y="537" class="legend-text" style="fill:#C62828">load - NO, programmatic document event.</text>
|
|
179
|
+
<text x="0" y="553" class="legend-text" style="fill:#C62828">DOMActivate - DEPRECATED, behavior varies. Do not use.</text>
|
|
180
|
+
<text x="0" y="569" class="legend-text" style="fill:#C62828">beginEvent, endEvent, repeatEvent - NO, SMIL internal events.</text>
|
|
181
|
+
|
|
182
|
+
<text x="0" y="599" class="legend-title">AUDIO AUTOPLAY BLOCKING - CRITICAL</text>
|
|
183
|
+
<text x="0" y="617" class="legend-text">If audio.play() is called WITHOUT prior user activation, it FAILS silently and will NOT auto-retry.</text>
|
|
184
|
+
<text x="0" y="633" class="legend-text">SMIL animations START IMMEDIATELY regardless of audio failure - they are NOT synchronized.</text>
|
|
185
|
+
<text x="0" y="649" class="legend-text">To play audio with animation: BOTH must use begin="elementId.click" (or other activation event).</text>
|
|
186
|
+
|
|
187
|
+
<text x="0" y="679" class="legend-title">EVENT SYNTAX: begin="event" vs begin="elementId.event"</text>
|
|
188
|
+
<text x="0" y="697" class="legend-text" style="font-weight:bold">begin="click"</text>
|
|
189
|
+
<text x="140" y="697" class="legend-text">Listens for click ON THE ANIMATION'S PARENT ELEMENT (the element being animated).</text>
|
|
190
|
+
<text x="140" y="713" class="legend-text">The user must click directly on the animated shape. If shape is small/invisible, hard to trigger.</text>
|
|
191
|
+
|
|
192
|
+
<text x="0" y="737" class="legend-text" style="font-weight:bold">begin="myBtn.click"</text>
|
|
193
|
+
<text x="140" y="737" class="legend-text">Listens for click ON THE ELEMENT WITH id="myBtn" (any element in the SVG).</text>
|
|
194
|
+
<text x="140" y="753" class="legend-text">Create a dedicated button/area for the user to click. Multiple animations can share the same trigger.</text>
|
|
195
|
+
|
|
196
|
+
<text x="0" y="777" class="legend-title">CLICK ANYWHERE ON SVG (recommended for audio)</text>
|
|
197
|
+
<text x="0" y="795" class="legend-text">To trigger animation/audio when user clicks ANYWHERE on the SVG, use the SVG root element id directly:</text>
|
|
198
|
+
<text x="0" y="815" class="legend-text" style="font-family:monospace;font-size:9px"><svg id="mySvg" viewBox="0 0 800 600"></text>
|
|
199
|
+
<text x="0" y="831" class="legend-text" style="font-family:monospace;font-size:9px"> <circle><animate begin="mySvg.click" .../></circle></text>
|
|
200
|
+
<text x="0" y="847" class="legend-text" style="font-family:monospace;font-size:9px"> <audio><animate attributeName="..." begin="mySvg.click" .../></audio></text>
|
|
201
|
+
<text x="0" y="863" class="legend-text" style="font-family:monospace;font-size:9px"></svg></text>
|
|
202
|
+
<text x="0" y="883" class="legend-text">The SVG root element receives all click events that occur anywhere within the SVG viewport.</text>
|
|
203
|
+
<text x="0" y="899" class="legend-text">No transparent rect needed - the SVG document root itself can be the trigger element.</text>
|
|
204
|
+
|
|
205
|
+
<text x="0" y="929" class="legend-title">BEST PRACTICE FOR AUDIO+ANIMATION</text>
|
|
206
|
+
<text x="0" y="947" class="legend-text">1. Add an id attribute to the <svg> root element (e.g., id="mySvg")</text>
|
|
207
|
+
<text x="0" y="963" class="legend-text">2. Set ALL animations AND audio to begin="mySvg.click"</text>
|
|
208
|
+
<text x="0" y="979" class="legend-text">3. User clicks anywhere on SVG → user activation satisfied → audio plays → animations start</text>
|
|
209
|
+
<text x="0" y="995" class="legend-text">4. All animations and audio are synchronized because they share the same trigger event</text>
|
|
210
|
+
</g>
|
|
211
|
+
</g>
|
|
212
|
+
</svg>`,c}function FJ($){let{title:J="Data Table",subtitle:Z="",columns:K=[],rowLevels:Q=[],rowData:H=[],getCellContent:z=()=>({lines:[],status:"ok"}),legend:q=null,additionalSections:W=[],options:j={}}=$,G={fontFamily:j.fontFamily||"system-ui, -apple-system, BlinkMacSystemFont, sans-serif",minCellWidth:j.minCellWidth||150,maxCellWidth:j.maxCellWidth||300,minCellHeight:j.minCellHeight||60,cellPaddingX:j.cellPaddingX||8,cellPaddingY:j.cellPaddingY||12,titleFontSize:j.titleFontSize||20,subtitleFontSize:j.subtitleFontSize||12,headerFontSize:j.headerFontSize||12,cellFontSize:j.cellFontSize||10,lineHeight:j.lineHeight||13,titleColor:j.titleColor||"#1a1a1a",subtitleColor:j.subtitleColor||"#666",borderColor:j.borderColor||"#DDD",okColor:j.okColor||"#C8E6C9",warnColor:j.warnColor||"#FFF9C4",badColor:j.badColor||"#FFCDD2",okTextColor:j.okTextColor||"#2E7D32",colHeaderHeight:j.colHeaderHeight||60,marginTop:j.marginTop||55,marginLeft:j.marginLeft||25,marginRight:j.marginRight||25,marginBottom:j.marginBottom||50,sectionSpacing:j.sectionSpacing||40,groupHeaderHeight:j.groupHeaderHeight||25,groupHeaderColor:j.groupHeaderColor||"#0D47A1"},F=(T)=>String(T).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),_=(T,P=0,t=[])=>{let $0=[];for(let Q0 of T){let V0=[...t,{level:P,...Q0}];if(Q0.children&&Q0.children.length>0&&P<Q.length-1)$0.push(..._(Q0.children,P+1,V0));else $0.push(V0)}return $0},U=_(H[0]||[]),O=U.length,V=Q.length,M=Q.map((T,P)=>{if(T.width)return T.width;let t=T.name.length,$0=(Q0,V0)=>{for(let N0 of Q0){if(V0===P)t=Math.max(t,(N0.name||"").length);if(N0.children)$0(N0.children,V0+1)}};return $0(H[0]||[],0),Math.max(60,t*7+20)}),Y=M.reduce((T,P)=>T+P,0),X=0,w=0;for(let T of U)for(let P of K){let $0=z(T,P.id).lines||[];X=Math.max(X,$0.length);for(let Q0 of $0)w=Math.max(w,Q0.length)}let R=Math.min(G.maxCellWidth,Math.max(G.minCellWidth,w*6+G.cellPaddingX*2)),I=Math.max(G.minCellHeight,(X+1)*G.lineHeight+G.cellPaddingY*2),f=[],u=null;for(let T=0;T<K.length;T++){let P=K[T];if(P.group)if(!u||u.name!==P.group)u={name:P.group,startIndex:T,count:1,color:P.groupColor||G.groupHeaderColor},f.push(u);else u.count++;else u=null}let m=f.length>0,S=m?G.colHeaderHeight+G.groupHeaderHeight:G.colHeaderHeight,x=Y+K.length*R,h=S+O*I,E=0;for(let T of W)E+=G.sectionSpacing+(T.height||100);let d=q?j.legendHeight||200:0,c=x+G.marginLeft+G.marginRight,p=G.marginTop+h+E+(q?G.sectionSpacing+d:0)+G.marginBottom,N=`<?xml version="1.0" encoding="UTF-8"?>
|
|
213
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${c} ${p}" preserveAspectRatio="xMinYMin meet" height="${p}" width="100%">
|
|
214
|
+
<title>${F(J)}</title>
|
|
215
|
+
|
|
216
|
+
<defs>
|
|
217
|
+
<style>
|
|
218
|
+
.title { font: bold ${G.titleFontSize}px ${G.fontFamily}; fill: ${G.titleColor}; }
|
|
219
|
+
.subtitle { font: ${G.subtitleFontSize}px ${G.fontFamily}; fill: ${G.subtitleColor}; }
|
|
220
|
+
.col-header { font: bold ${G.headerFontSize}px ${G.fontFamily}; fill: #FFF; }
|
|
221
|
+
.col-desc { font: ${G.cellFontSize}px ${G.fontFamily}; fill: rgba(255,255,255,0.85); }
|
|
222
|
+
.row-label { font: ${G.headerFontSize-1}px ${G.fontFamily}; fill: #333; }
|
|
223
|
+
.row-label-bold { font: bold ${G.headerFontSize-1}px ${G.fontFamily}; fill: #1a1a1a; }
|
|
224
|
+
.cell-ok { fill: ${G.okColor}; }
|
|
225
|
+
.cell-warn { fill: ${G.warnColor}; }
|
|
226
|
+
.cell-bad { fill: ${G.badColor}; }
|
|
227
|
+
.ok-text { font: bold ${G.lineHeight}px ${G.fontFamily}; fill: ${G.okTextColor}; }
|
|
228
|
+
.cell-text { font: ${G.cellFontSize}px ${G.fontFamily}; fill: #333; }
|
|
229
|
+
.section-title { font: bold ${G.headerFontSize}px ${G.fontFamily}; fill: #333; }
|
|
230
|
+
.legend-text { font: ${G.cellFontSize}px ${G.fontFamily}; fill: #444; }
|
|
231
|
+
</style>
|
|
232
|
+
</defs>
|
|
233
|
+
|
|
234
|
+
<text x="${c/2}" y="24" text-anchor="middle" class="title">${F(J)}</text>
|
|
235
|
+
${Z?`<text x="${c/2}" y="42" text-anchor="middle" class="subtitle">${F(Z)}</text>`:""}
|
|
236
|
+
|
|
237
|
+
<g transform="translate(${G.marginLeft}, ${G.marginTop})">
|
|
238
|
+
`,y=Y;if(m){let T=0;for(let P=0;P<K.length&&!K[P].group;P++)T++;for(let P of f){let t=Y+P.startIndex*R,$0=P.count*R;N+=` <rect x="${t}" y="0" width="${$0}" height="${G.groupHeaderHeight}" fill="${P.color}"/>
|
|
239
|
+
<text x="${t+$0/2}" y="${G.groupHeaderHeight-8}" text-anchor="middle" class="col-header">${F(P.name)}</text>
|
|
240
|
+
`}}let B=m?G.groupHeaderHeight:0,e=m?G.colHeaderHeight:S;for(let T=0;T<K.length;T++){let P=K[T],t=Y+T*R,$0=P.group?B:0,Q0=P.group?e:S;if(N+=` <rect x="${t}" y="${$0}" width="${R}" height="${Q0}" fill="${P.color}" stroke="${G.borderColor}"/>
|
|
241
|
+
<text x="${t+R/2}" y="${$0+Q0/2-5}" text-anchor="middle" class="col-header">${F(P.name)}</text>
|
|
242
|
+
`,P.desc)N+=` <text x="${t+R/2}" y="${$0+Q0/2+10}" text-anchor="middle" class="col-desc">${F(P.desc)}</text>
|
|
243
|
+
`}let r=new Map,s=S;for(let T=0;T<U.length;T++){let P=U[T],t=0;for(let $0=0;$0<V;$0++){let Q0=P.find((N0)=>N0.level===$0);if(!Q0){t+=M[$0];continue}let V0=`${$0}-${Q0.id}`;if(!r.has(V0)){let N0=1;for(let o=T+1;o<U.length;o++){let J0=U[o].find((F0)=>F0.level===$0);if(J0&&J0.id===Q0.id)N0++;else break}let h0=N0*I;N+=` <rect x="${t}" y="${s}" width="${M[$0]}" height="${h0}" fill="${Q0.color||"#F5F5F5"}" stroke="${G.borderColor}"/>
|
|
244
|
+
<text x="${t+M[$0]/2}" y="${s+h0/2+4}" text-anchor="middle" class="${$0===0?"row-label-bold":"row-label"}">${F(Q0.name)}</text>
|
|
245
|
+
`,r.set(V0,{y:s,height:h0})}t+=M[$0]}for(let $0=0;$0<K.length;$0++){let Q0=K[$0],V0=Y+$0*R,N0=z(P,Q0.id),h0=N0.lines||[],o=N0.status||"ok";if(N+=` <rect x="${V0}" y="${s}" width="${R}" height="${I}" class="${o==="bad"?"cell-bad":o==="warn"?"cell-warn":"cell-ok"}" stroke="${G.borderColor}"/>
|
|
246
|
+
`,h0.length===0)N+=` <text x="${V0+R/2}" y="${s+I/2}" text-anchor="middle" class="ok-text">No issues</text>
|
|
247
|
+
`;else{let F0=s+G.cellPaddingY+G.lineHeight;for(let O0 of h0)N+=` <text x="${V0+G.cellPaddingX}" y="${F0}" class="cell-text">${F("• "+O0)}</text>
|
|
248
|
+
`,F0+=G.lineHeight}}if(s+=I,T<U.length-1){let $0=P[0]?.id,Q0=U[T+1][0]?.id;if($0!==Q0)N+=` <line x1="0" y1="${s}" x2="${x}" y2="${s}" stroke="#999" stroke-width="2"/>
|
|
249
|
+
`}}let z0=h+G.sectionSpacing;for(let T of W){if(T.title)N+=`
|
|
250
|
+
<text x="0" y="${z0}" class="section-title">${F(T.title)}</text>
|
|
251
|
+
`,z0+=20;if(T.content)N+=` <g transform="translate(0, ${z0})">
|
|
252
|
+
${T.content}
|
|
253
|
+
</g>
|
|
254
|
+
`;if(T.items)for(let P of T.items){if(P.rect)N+=` <rect x="${P.rect.x}" y="${z0+P.rect.y}" width="${P.rect.width}" height="${P.rect.height}" fill="${P.rect.fill||"#EEE"}" stroke="${P.rect.stroke||"#999"}"/>
|
|
255
|
+
`;if(P.text)N+=` <text x="${P.text.x}" y="${z0+P.text.y}" class="${P.text.class||"legend-text"}">${F(P.text.content)}</text>
|
|
256
|
+
`}z0+=T.height||100}if(q)N+=`
|
|
257
|
+
<g transform="translate(0, ${z0})">
|
|
258
|
+
${q}
|
|
259
|
+
</g>
|
|
260
|
+
`;return N+=` </g>
|
|
261
|
+
</svg>`,N}function sK($={}){let J=$.fontFamily||"system-ui, -apple-system, BlinkMacSystemFont, sans-serif",Z=[{id:"standalone",name:"Standalone SVG",desc:"Open .svg directly",color:"#1565C0"},{id:"img",name:"<img>",desc:"Image element",color:"#1976D2",group:"In HTML Page",groupColor:"#0D47A1"},{id:"object",name:"<object>",desc:"Object element",color:"#1E88E5",group:"In HTML Page"},{id:"embed",name:"<embed>",desc:"Embed element",color:"#2196F3",group:"In HTML Page"},{id:"inline",name:"Inline <svg>",desc:"SVG in HTML",color:"#42A5F5",group:"In HTML Page"},{id:"css",name:"CSS background",desc:"background-image",color:"#64B5F6",group:"In HTML Page"}],K=[{id:"environment",name:"Environment",width:130},{id:"protocol",name:"Protocol",width:80},{id:"script",name:"JavaScript",width:90}],Q=[[{id:"desktop",name:"Desktop Browser",color:"#E3F2FD",children:[{id:"file",name:"file://",color:"#BBDEFB",children:[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}]},{id:"http",name:"http(s)://",color:"#C8E6C9",children:[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}]}]},{id:"mobile",name:"Mobile Browser",color:"#E8F5E9",children:[{id:"file",name:"file://",color:"#BBDEFB",children:[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}]},{id:"http",name:"http(s)://",color:"#C8E6C9",children:[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}]}]}]],H=$.getCellContent||((G,F)=>{return{lines:[],status:"ok"}}),z=[{name:"Node.js (JSDOM)",color:"#FFF3E0",issues:["No rendering","No animations","No interaction"]},{name:"ImageMagick",color:"#EFEBE9",issues:["No animations","No scripts","No foreignObject","No web fonts"]},{name:"Inkscape CLI",color:"#F3E5F5",issues:["No animations","No scripts"]},{name:"librsvg",color:"#E0F2F1",issues:["No animations","No scripts","Limited filters"]},{name:"Cairo",color:"#FBE9E7",issues:["No animations","No scripts","No filters","No foreignObject"]},{name:"Apache Batik",color:"#F3E5F5",issues:["No CSS animations","Limited SMIL","No web fonts"]}],q="",W=0;for(let G of z)q+=`<rect x="0" y="${W}" width="150" height="26" fill="${G.color}" stroke="#999"/>
|
|
262
|
+
<text x="10" y="${W+18}" class="row-label-bold">${G.name}</text>
|
|
263
|
+
<text x="160" y="${W+18}" class="cell-text">${G.issues.join(" • ")}</text>
|
|
264
|
+
`,W+=30;let j=`
|
|
265
|
+
<text x="0" y="0" class="section-title">LEGEND</text>
|
|
266
|
+
|
|
267
|
+
<rect x="0" y="15" width="18" height="14" class="cell-ok" stroke="#4CAF50"/>
|
|
268
|
+
<text x="24" y="26" class="legend-text">No issues - full SVG support</text>
|
|
269
|
+
|
|
270
|
+
<rect x="200" y="15" width="18" height="14" class="cell-warn" stroke="#FFC107"/>
|
|
271
|
+
<text x="224" y="26" class="legend-text">Some limitations - check details</text>
|
|
272
|
+
|
|
273
|
+
<rect x="450" y="15" width="18" height="14" class="cell-bad" stroke="#F44336"/>
|
|
274
|
+
<text x="474" y="26" class="legend-text">Many restrictions - features blocked</text>
|
|
275
|
+
|
|
276
|
+
<text x="0" y="55" class="section-title">HOW TO READ THIS MATRIX</text>
|
|
277
|
+
<text x="0" y="73" class="legend-text">1. COLUMNS = How the SVG is embedded (Standalone, img tag, object tag, embed tag, inline, CSS background)</text>
|
|
278
|
+
<text x="0" y="89" class="legend-text">2. ROWS = Environment (Desktop/Mobile) + Protocol (file:// or http://) + JavaScript (enabled/disabled)</text>
|
|
279
|
+
<text x="0" y="105" class="legend-text">3. CELL CONTENT = Issues in that configuration. Browser names in parentheses = browser-specific issue.</text>
|
|
280
|
+
|
|
281
|
+
<text x="0" y="135" class="section-title">SMIL "begin" ATTRIBUTE - HOW TO TRIGGER ANIMATIONS</text>
|
|
282
|
+
<text x="0" y="153" class="legend-text">The begin attribute defines when an animation becomes active. Use it on: <animate>, <animateMotion>, <animateTransform>, <set></text>
|
|
283
|
+
<text x="0" y="169" class="legend-text">Values can be semicolon-separated. Each value can be one of:</text>
|
|
284
|
+
|
|
285
|
+
<text x="0" y="189" class="legend-text" style="font-weight:bold"><offset-value></text>
|
|
286
|
+
<text x="140" y="189" class="legend-text">Clock-value relative to document load. Example: begin="2s" (start 2 seconds after load)</text>
|
|
287
|
+
|
|
288
|
+
<text x="0" y="205" class="legend-text" style="font-weight:bold"><syncbase-value></text>
|
|
289
|
+
<text x="140" y="205" class="legend-text">Sync with another animation. Example: begin="anim1.end" or begin="anim1.begin+1s"</text>
|
|
290
|
+
|
|
291
|
+
<text x="0" y="221" class="legend-text" style="font-weight:bold"><event-value></text>
|
|
292
|
+
<text x="140" y="221" class="legend-text">Start on DOM event. Example: begin="click" or begin="myRect.click" or begin="mouseover"</text>
|
|
293
|
+
|
|
294
|
+
<text x="0" y="237" class="legend-text" style="font-weight:bold"><repeat-value></text>
|
|
295
|
+
<text x="140" y="237" class="legend-text">Start when another animation repeats. Example: begin="anim1.repeat(2)"</text>
|
|
296
|
+
|
|
297
|
+
<text x="0" y="253" class="legend-text" style="font-weight:bold"><accessKey-value></text>
|
|
298
|
+
<text x="140" y="253" class="legend-text">Start on keypress. Example: begin="accessKey(s)" (start when 's' key is pressed)</text>
|
|
299
|
+
|
|
300
|
+
<text x="0" y="269" class="legend-text" style="font-weight:bold">indefinite</text>
|
|
301
|
+
<text x="140" y="269" class="legend-text">Only starts via JavaScript beginElement() call or hyperlink. Example: begin="indefinite"</text>
|
|
302
|
+
|
|
303
|
+
<text x="0" y="295" class="section-title">EVENTS THAT SATISFY USER ACTIVATION (allow audio/video playback)</text>
|
|
304
|
+
<text x="0" y="313" class="legend-text" style="fill:#2E7D32">click - YES, allows audio. Direct user click/tap.</text>
|
|
305
|
+
<text x="0" y="329" class="legend-text" style="fill:#2E7D32">dblclick - YES, allows audio. Direct user double-click.</text>
|
|
306
|
+
<text x="0" y="345" class="legend-text" style="fill:#2E7D32">mousedown - YES, allows audio. User pressed mouse button.</text>
|
|
307
|
+
<text x="0" y="361" class="legend-text" style="fill:#2E7D32">mouseup - YES, allows audio. User released mouse button.</text>
|
|
308
|
+
<text x="0" y="377" class="legend-text" style="fill:#2E7D32">keydown - YES, allows audio. User pressed a key.</text>
|
|
309
|
+
<text x="0" y="393" class="legend-text" style="fill:#2E7D32">keyup - YES, allows audio. User released a key.</text>
|
|
310
|
+
<text x="0" y="409" class="legend-text" style="fill:#2E7D32">touchstart - YES, allows audio. User touched screen (mobile).</text>
|
|
311
|
+
<text x="0" y="425" class="legend-text" style="fill:#2E7D32">touchend - YES, allows audio. User lifted finger (mobile).</text>
|
|
312
|
+
|
|
313
|
+
<text x="0" y="455" class="section-title">EVENTS THAT DO NOT SATISFY USER ACTIVATION (audio will fail)</text>
|
|
314
|
+
<text x="0" y="473" class="legend-text" style="fill:#C62828">mouseover, mouseout, mouseenter, mouseleave - NO, passive cursor movement.</text>
|
|
315
|
+
<text x="0" y="489" class="legend-text" style="fill:#C62828">mousemove - NO, passive cursor tracking.</text>
|
|
316
|
+
<text x="0" y="505" class="legend-text" style="fill:#C62828">scroll, wheel - NO, passive scrolling.</text>
|
|
317
|
+
<text x="0" y="521" class="legend-text" style="fill:#C62828">focus, blur, focusin, focusout - NO, can be triggered programmatically.</text>
|
|
318
|
+
<text x="0" y="537" class="legend-text" style="fill:#C62828">load - NO, programmatic document event.</text>
|
|
319
|
+
<text x="0" y="553" class="legend-text" style="fill:#C62828">DOMActivate - DEPRECATED, behavior varies. Do not use.</text>
|
|
320
|
+
<text x="0" y="569" class="legend-text" style="fill:#C62828">beginEvent, endEvent, repeatEvent - NO, SMIL internal events.</text>
|
|
321
|
+
|
|
322
|
+
<text x="0" y="599" class="section-title">AUDIO AUTOPLAY BLOCKING - CRITICAL</text>
|
|
323
|
+
<text x="0" y="617" class="legend-text">If audio.play() is called WITHOUT prior user activation, it FAILS silently and will NOT auto-retry.</text>
|
|
324
|
+
<text x="0" y="633" class="legend-text">SMIL animations START IMMEDIATELY regardless of audio failure - they are NOT synchronized.</text>
|
|
325
|
+
<text x="0" y="649" class="legend-text">To play audio with animation: BOTH must use begin="elementId.click" (or other activation event).</text>
|
|
326
|
+
|
|
327
|
+
<text x="0" y="679" class="section-title">EVENT SYNTAX: begin="event" vs begin="elementId.event"</text>
|
|
328
|
+
<text x="0" y="697" class="legend-text" style="font-weight:bold">begin="click"</text>
|
|
329
|
+
<text x="140" y="697" class="legend-text">Listens for click ON THE ANIMATION'S PARENT ELEMENT (the element being animated).</text>
|
|
330
|
+
<text x="140" y="713" class="legend-text">The user must click directly on the animated shape. If shape is small/invisible, hard to trigger.</text>
|
|
331
|
+
|
|
332
|
+
<text x="0" y="737" class="legend-text" style="font-weight:bold">begin="myBtn.click"</text>
|
|
333
|
+
<text x="140" y="737" class="legend-text">Listens for click ON THE ELEMENT WITH id="myBtn" (any element in the SVG).</text>
|
|
334
|
+
<text x="140" y="753" class="legend-text">Create a dedicated button/area for the user to click. Multiple animations can share the same trigger.</text>
|
|
335
|
+
|
|
336
|
+
<text x="0" y="777" class="section-title">CLICK ANYWHERE ON SVG (recommended for audio)</text>
|
|
337
|
+
<text x="0" y="795" class="legend-text">To trigger animation/audio when user clicks ANYWHERE on the SVG, use the SVG root element id directly:</text>
|
|
338
|
+
<text x="0" y="815" class="legend-text" style="font-family:monospace;font-size:9px"><svg id="mySvg" viewBox="0 0 800 600"></text>
|
|
339
|
+
<text x="0" y="831" class="legend-text" style="font-family:monospace;font-size:9px"> <circle><animate begin="mySvg.click" .../></circle></text>
|
|
340
|
+
<text x="0" y="847" class="legend-text" style="font-family:monospace;font-size:9px"> <audio><animate attributeName="..." begin="mySvg.click" .../></audio></text>
|
|
341
|
+
<text x="0" y="863" class="legend-text" style="font-family:monospace;font-size:9px"></svg></text>
|
|
342
|
+
<text x="0" y="883" class="legend-text">The SVG root element receives all click events that occur anywhere within the SVG viewport.</text>
|
|
343
|
+
<text x="0" y="899" class="legend-text">No transparent rect needed - the SVG document root itself can be the trigger element.</text>
|
|
344
|
+
|
|
345
|
+
<text x="0" y="929" class="section-title">BEST PRACTICE FOR AUDIO+ANIMATION</text>
|
|
346
|
+
<text x="0" y="947" class="legend-text">1. Add an id attribute to the <svg> root element (e.g., id="mySvg")</text>
|
|
347
|
+
<text x="0" y="963" class="legend-text">2. Set ALL animations AND audio to begin="mySvg.click"</text>
|
|
348
|
+
<text x="0" y="979" class="legend-text">3. User clicks anywhere on SVG → user activation satisfied → audio plays → animations start</text>
|
|
349
|
+
<text x="0" y="995" class="legend-text">4. All animations and audio are synchronized because they share the same trigger event</text>
|
|
350
|
+
`;return FJ({title:"SVG Compatibility Matrix",subtitle:"What problems will your SVG have in each configuration?",columns:Z,rowLevels:K,rowData:Q,getCellContent:H,additionalSections:[{title:"SERVER-SIDE SVG RENDERERS (no HTML embedding)",content:q,height:z.length*30+20}],legend:j,options:{fontFamily:J,minCellWidth:220,legendHeight:1020,...$}})}var _J=j0(($,J={})=>{let Z=J.fixInvalidGroupAttrs!==!1,K=J.fixMissingNamespaces!==!1,Q=J.fixBrokenRefs!==!1,H=J.fixAnimationTiming!==!1,z=J.verbose||!1,q=[],W=new Set,j=(b)=>{let C=b.getAttribute("id");if(C)W.add(C);for(let l of b.children)if(a(l))j(l)};j($);let G=["x","y","width","height","cx","cy","r","rx","ry","x1","y1","x2","y2","d","points"],F=new Set(["svg","rect","image","foreignObject","use","symbol","pattern","mask","filter","clipPath"]),_=(b)=>{let C=b.tagName.toLowerCase();if(C==="g"&&Z){for(let l of G)if(b.hasAttribute(l)){let g=b.getAttribute(l);b.removeAttribute(l),q.push({type:"invalid_attr_removed",element:C,attr:l,value:g,reason:`SVG 1.1: <g> elements do not support '${l}' attribute`})}}for(let l of b.children)if(a(l))_(l)},U=()=>{if(!K)return;let b=!1,C=(l)=>{for(let g of l.getAttributeNames())if(g.startsWith("xlink:")){b=!0;return}for(let g of l.children){if(a(g))C(g);if(b)return}};if(C($),b&&!$.hasAttribute("xmlns:xlink"))$.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),q.push({type:"namespace_added",namespace:"xmlns:xlink",value:"http://www.w3.org/1999/xlink",reason:"SVG 1.1: xmlns:xlink required when xlink:* attributes are present"})},O=(b)=>{let C=[b,b.replace(/^FRAME(\d+)$/,"FRAME0$1"),b.replace(/^FRAME0(\d+)$/,"FRAME00$1"),b.replace(/^FRAME00(\d+)$/,"FRAME000$1"),b.replace(/^FRAME0+(\d+)$/,"FRAME$1"),b.replace(/^FRAME(\d)$/,"FRAME0000$1"),b.replace(/^FRAME(\d{2})$/,"FRAME000$1"),b.replace(/^FRAME(\d{3})$/,"FRAME00$1"),b.replace(/^FRAME(\d{4})$/,"FRAME0$1")];for(let n of C)if(W.has(n)&&n!==b)return n;let l=null,g=1/0;for(let n of W)if(n.toLowerCase().includes(b.toLowerCase())||b.toLowerCase().includes(n.toLowerCase())){let G0=Math.abs(n.length-b.length);if(G0<g&&G0<=2)g=G0,l=n}return l},V=(b)=>{if(!Q)return;for(let C of["href","xlink:href"]){let l=b.getAttribute(C);if(l&&l.startsWith("#")){let g=l.substring(1);if(!W.has(g)){let n=O(g);if(n)b.setAttribute(C,`#${n}`),q.push({type:"ref_fixed",element:b.tagName.toLowerCase(),attr:C,oldValue:l,newValue:`#${n}`,reason:`ID '${g}' not found, fixed to similar ID '${n}'`})}}}if(b.tagName.toLowerCase()==="animate"){let C=b.getAttribute("attributeName");if(C==="href"||C==="xlink:href"){let l=b.getAttribute("values");if(l){let g=l.split(";"),n=!1,G0=g.map((L0)=>{let P0=L0.trim();if(P0.startsWith("#")){let E0=P0.substring(1);if(!W.has(E0)){let U7=O(E0);if(U7)return n=!0,`#${U7}`}}return P0});if(n){let L0=G0.join(";");b.setAttribute("values",L0),q.push({type:"animate_values_fixed",oldValue:l,newValue:L0,reason:"Fixed broken ID references in animate values"})}}}}for(let C of["fill","stroke","clip-path","mask","filter"]){let l=b.getAttribute(C);if(l&&l.startsWith("url(#")){let g=l.match(/url\(#([^)]+)\)/);if(g){let n=g[1];if(!W.has(n)){let G0=O(n);if(G0)b.setAttribute(C,`url(#${G0})`),q.push({type:"url_ref_fixed",element:b.tagName.toLowerCase(),attr:C,oldValue:l,newValue:`url(#${G0})`,reason:`ID '${n}' not found, fixed to similar ID '${G0}'`})}}}}for(let C of b.children)if(a(C))V(C)},M=(b)=>{if(!H)return;let C=["animate","animateTransform","animateMotion","animateColor","set"],l=b.tagName.toLowerCase();if(C.includes(l)){let g=b.getAttribute("dur"),n=b.getAttribute("repeatCount");if(g==="0"||g==="0s"){if(!b.getAttribute("keyTimes"))q.push({type:"timing_warning",element:l,attr:"dur",value:g,reason:'dur="0" may cause animation to not play'})}let G0=b.getAttribute("begin");if(G0){let L0=G0;if(G0==="0")L0="0s",b.setAttribute("begin",L0),q.push({type:"timing_normalized",element:l,attr:"begin",oldValue:G0,newValue:L0,reason:"Normalized begin value to include time unit"})}}for(let g of b.children)if(a(g))M(g)},Y=new Set(["font-face-format","font-face-name","glyphref","hkern","vkern"]),X=new Set(["animate","animateTransform","animateMotion","animateColor","set"]),w=(b)=>{let C=b.tagName.toLowerCase();if(Y.has(C)){let l=[];for(let g of Array.from(b.children))if(a(g)&&X.has(g.tagName.toLowerCase()))l.push(g);if(l.length>0){let g=b.getAttribute("id");if(!g)g=`_fix_${C}_${Math.random().toString(36).substring(2,8)}`,b.setAttribute("id",g),q.push({type:"id_generated",element:C,id:g,reason:"Generated ID for animation targeting after moving animate element"});for(let n of l){if(b.removeChild(n),!n.hasAttribute("href")&&!n.hasAttribute("xlink:href"))n.setAttribute("href",`#${g}`);let G0=b.parentNode;if(G0){let L0=b.nextSibling;if(L0)G0.insertBefore(n,L0);else G0.appendChild(n)}q.push({type:"animation_moved_from_empty_element",element:n.tagName.toLowerCase(),parentElement:C,targetId:g,reason:`SVG 1.1: <${C}> has EMPTY content model and cannot have children. Animation moved outside and targets element via href="#${g}".`})}}}for(let l of Array.from(b.children))if(a(l))w(l)},R=/^([+-]?\d*\.?\d+(?:[Ee][+-]?\d+)?)(EM|EX|PX|IN|CM|MM|PT|PC|DEG|GRAD|RAD|S|MS|HZ|KHZ|%)$/i,I=new Set(["x","y","width","height","rx","ry","cx","cy","r","fx","fy","x1","y1","x2","y2","dx","dy","textLength","startOffset","stroke-width","stroke-dashoffset","font-size","baseline-shift","kerning","letter-spacing","word-spacing","markerWidth","markerHeight","refX","refY","stdDeviation","radius"]),f=(b)=>{for(let C of b.getAttributeNames()){if(!I.has(C)&&!C.includes("-"))continue;let l=b.getAttribute(C);if(!l)continue;let g=l.match(R);if(g){let[,n,G0]=g,L0=G0.toLowerCase();if(G0!==L0){let P0=n+L0;b.setAttribute(C,P0),q.push({type:"unit_normalized",element:b.tagName.toLowerCase(),attr:C,oldValue:l,newValue:P0,reason:"SVG 1.1: Unit identifiers in attributes must be lowercase"})}}}for(let C of b.children)if(a(C))f(C)},u=/[\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/g,m=new Set(["points","viewBox","preserveAspectRatio","transform","d","values","keyTimes","keySplines","keyPoints","rotate","stroke-dasharray","baseFrequency","kernelMatrix","tableValues","filterRes","stdDeviation","radius","origin"]),S=(b)=>{for(let C of b.getAttributeNames()){if(!m.has(C)&&C!=="style")continue;let l=b.getAttribute(C);if(!l)continue;if(u.test(l)){let g=l.replace(u," ");b.setAttribute(C,g),q.push({type:"whitespace_normalized",element:b.tagName.toLowerCase(),attr:C,reason:"SVG 1.1: Replaced invalid Unicode whitespace with standard space (0x20)"})}}for(let C of b.children)if(a(C))S(C)},x=(b)=>{for(let C of b.getAttributeNames()){let l=b.getAttribute(C);if(!l)continue;let g=l,n=!1;if(/\d\.$/.test(g)||/\d\.(?=[,\s;)])/.test(g))g=g.replace(/(\d)\.(?=$|[,\s;)])/g,"$1"),n=!0;if(g=g.replace(/(^|[,\s;(])\.(\d)/g,"$10.$2"),g=g.replace(/(^|[,\s;(])-\.(\d)/g,"$1-0.$2"),g!==l)n=!0;if(/\.\.+/.test(g))g=g.replace(/\.\.+/g,"."),n=!0;if(n)b.setAttribute(C,g),q.push({type:"number_format_fixed",element:b.tagName.toLowerCase(),attr:C,oldValue:l,newValue:g,reason:"SVG 1.1: Fixed invalid number format"})}for(let C of b.children)if(a(C))x(C)},h=340000000000000000000000000000000000000,E=-340000000000000000000000000000000000000,d=/[+-]?\d*\.?\d+(?:[Ee][+-]?\d+)?/g,c=(b)=>{for(let C of b.getAttributeNames()){let l=b.getAttribute(C);if(!l)continue;if(C==="id"||C==="class"||C.startsWith("xmlns")||C==="href"||C==="xlink:href"||C==="style")continue;let g=l.match(d);if(!g)continue;for(let n of g){let G0=parseFloat(n);if(!isFinite(G0))q.push({type:"invalid_number_detected",element:b.tagName.toLowerCase(),attr:C,value:n,reason:"SVG 1.1: Invalid number (Infinity or NaN)"});else if(G0>h||G0<E)q.push({type:"out_of_range_detected",element:b.tagName.toLowerCase(),attr:C,value:n,reason:"SVG 1.1: Number exceeds single-precision float range"})}}for(let C of b.children)if(a(C))c(C)},p=(b)=>{let C=b.tagName,l=C.toLowerCase();if(C.includes(":")||G6.has(C)||z8.has(l));else{let g=P6(C,G6);if(g)q.push({type:"mistyped_element_detected",element:C,suggestion:g,reason:`Unknown element <${C}> - did you mean <${g}>?`});else q.push({type:"unknown_element_detected",element:C,reason:`Unknown element <${C}> - not in SVG 1.1 spec`})}for(let g of b.children)if(a(g))p(g)},N=(b)=>{for(let C of b.getAttributeNames()){if(C.startsWith("xmlns")||C.startsWith("data-"))continue;let l=C.toLowerCase();if(F6.has(C)||q8.has(l))continue;if(C.startsWith("-webkit-")||C.startsWith("-moz-")||C.startsWith("-ms-")||C.startsWith("-o-"))continue;if(C.includes(":")&&!C.startsWith("xlink:")&&!C.startsWith("xml:"))continue;let g=P6(C,F6);if(g)q.push({type:"mistyped_attribute_detected",element:b.tagName.toLowerCase(),attr:C,suggestion:g,reason:`Unknown attribute '${C}' on <${b.tagName.toLowerCase()}> - did you mean '${g}'?`})}for(let C of b.children)if(a(C))N(C)},y={a:["href"],animate:["attributeName"],animateColor:["attributeName"],animateTransform:["attributeName"],circle:["r"],"color-profile":["name"],cursor:["href"],ellipse:["rx","ry"],feBlend:["in2"],feComposite:["in2"],feConvolveMatrix:["kernelMatrix"],feDisplacementMap:["in2"],feFuncA:["type"],feFuncB:["type"],feFuncG:["type"],feFuncR:["type"],feImage:["href"],font:["horiz-adv-x"],"font-face-uri":["href"],foreignObject:["width","height"],hkern:["k"],image:["href","width","height"],mpath:["href"],path:["d"],polygon:["points"],polyline:["points"],rect:["width","height"],script:["type"],set:["attributeName"],stop:["offset"],style:["type"],textPath:["href"],tref:["href"],use:["href"],vkern:["k"]},B=["href","xlink:href"],e=(b)=>{let C=b.tagName.toLowerCase(),l=y[C];if(l){for(let g of l)if(g==="href"){if(!B.some((G0)=>b.hasAttribute(G0)))q.push({type:"missing_required_attribute",element:C,attr:g,reason:`Element <${C}> is missing required attribute '${g}' (or 'xlink:href')`})}else if(!b.hasAttribute(g))q.push({type:"missing_required_attribute",element:C,attr:g,reason:`Element <${C}> is missing required attribute '${g}'`})}for(let g of b.children)if(a(g))e(g)},r={circle:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),ellipse:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),line:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),path:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),polygon:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),polyline:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),rect:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),use:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),image:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),animate:new Set(["desc","title","metadata"]),animatecolor:new Set(["desc","title","metadata"]),animatemotion:new Set(["desc","title","metadata","mpath"]),animatetransform:new Set(["desc","title","metadata"]),set:new Set(["desc","title","metadata"]),lineargradient:new Set(["desc","title","metadata","animate","animatetransform","set","stop"]),radialgradient:new Set(["desc","title","metadata","animate","animatetransform","set","stop"]),filter:new Set(["desc","title","metadata","animate","set","feblend","fecolormatrix","fecomponenttransfer","fecomposite","feconvolvematrix","fediffuselighting","fedisplacementmap","feflood","fegaussianblur","feimage","femerge","femorphology","feoffset","fespecularlighting","fetile","feturbulence"]),stop:new Set(["animate","animatecolor","set"])},s=(b)=>{let C=b.tagName.toLowerCase(),l=r[C];if(l){for(let g of b.children)if(a(g)){let n=g.tagName.toLowerCase();if(!n.includes(":")&&!l.has(n))q.push({type:"invalid_child_element",parent:C,child:n,reason:`Element <${n}> is not a valid child of <${C}> per SVG 1.1 DTD`})}}for(let g of b.children)if(a(g))s(g)},z0={"alignment-baseline":["auto","baseline","before-edge","text-before-edge","middle","central","after-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","inherit"],"clip-rule":["nonzero","evenodd","inherit"],"color-interpolation":["auto","sRGB","linearRGB","inherit"],"color-interpolation-filters":["auto","sRGB","linearRGB","inherit"],"color-rendering":["auto","optimizeSpeed","optimizeQuality","inherit"],direction:["ltr","rtl","inherit"],display:["inline","block","list-item","run-in","compact","marker","table","inline-table","table-row-group","table-header-group","table-footer-group","table-row","table-column-group","table-column","table-cell","table-caption","none","inherit"],"dominant-baseline":["auto","use-script","no-change","reset-size","ideographic","alphabetic","hanging","mathematical","central","middle","text-after-edge","text-before-edge","inherit"],"fill-rule":["nonzero","evenodd","inherit"],"font-stretch":["normal","wider","narrower","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded","ultra-expanded","inherit"],"font-style":["normal","italic","oblique","inherit"],"font-variant":["normal","small-caps","inherit"],"font-weight":["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900","inherit"],"image-rendering":["auto","optimizeSpeed","optimizeQuality","inherit"],overflow:["visible","hidden","scroll","auto","inherit"],"pointer-events":["visiblePainted","visibleFill","visibleStroke","visible","painted","fill","stroke","all","none","inherit"],"shape-rendering":["auto","optimizeSpeed","crispEdges","geometricPrecision","inherit"],"stroke-linecap":["butt","round","square","inherit"],"stroke-linejoin":["miter","round","bevel","inherit"],"text-anchor":["start","middle","end","inherit"],"text-rendering":["auto","optimizeSpeed","optimizeLegibility","geometricPrecision","inherit"],"unicode-bidi":["normal","embed","bidi-override","inherit"],visibility:["visible","hidden","collapse","inherit"],"writing-mode":["lr-tb","rl-tb","tb-rl","lr","rl","tb","inherit"],"xml:space":["default","preserve"],additive:["replace","sum"],accumulate:["none","sum"],calcMode:["discrete","linear","paced","spline"],fill:["freeze","remove"],restart:["always","whenNotActive","never"],attributeType:["CSS","XML","auto"],edgeMode:["duplicate","wrap","none"],operator:["over","in","out","atop","xor","arithmetic","erode","dilate"],mode:["normal","multiply","screen","darken","lighten"],type:["translate","scale","rotate","skewX","skewY","matrix","saturate","hueRotate","luminanceToAlpha","identity","table","discrete","linear","gamma","fractalNoise","turbulence"],spreadMethod:["pad","reflect","repeat"],gradientUnits:["userSpaceOnUse","objectBoundingBox"],patternUnits:["userSpaceOnUse","objectBoundingBox"],patternContentUnits:["userSpaceOnUse","objectBoundingBox"],clipPathUnits:["userSpaceOnUse","objectBoundingBox"],maskUnits:["userSpaceOnUse","objectBoundingBox"],maskContentUnits:["userSpaceOnUse","objectBoundingBox"],filterUnits:["userSpaceOnUse","objectBoundingBox"],primitiveUnits:["userSpaceOnUse","objectBoundingBox"],markerUnits:["strokeWidth","userSpaceOnUse"],method:["align","stretch"],spacing:["auto","exact"],lengthAdjust:["spacing","spacingAndGlyphs"],preserveAspectRatio:["none","xMinYMin","xMidYMin","xMaxYMin","xMinYMid","xMidYMid","xMaxYMid","xMinYMax","xMidYMax","xMaxYMax"],zoomAndPan:["disable","magnify"],externalResourcesRequired:["true","false"]},T=new Set(["preserveAspectRatio"]),P=(b)=>{let C=b.tagName.toLowerCase();for(let l of b.getAttributeNames()){let g=z0[l];if(g){let n=b.getAttribute(l);if(T.has(l)&&n)n=n.split(/\s+/)[0];if(l==="fill"&&!["animate","animatecolor","animatemotion","animatetransform","set"].includes(C))continue;if(!g.includes(n)&&n!=="inherit")q.push({type:"invalid_enum_value",element:C,attr:l,value:n,validValues:g.slice(0,5).join(", ")+(g.length>5?"...":""),reason:`Invalid value '${n}' for attribute '${l}' - must be one of: ${g.slice(0,5).join(", ")}${g.length>5?"...":""}`})}}for(let l of b.children)if(a(l))P(l)},t={opacity:{min:0,max:1,type:"number"},"fill-opacity":{min:0,max:1,type:"number"},"stroke-opacity":{min:0,max:1,type:"number"},"stop-opacity":{min:0,max:1,type:"number"},"flood-opacity":{min:0,max:1,type:"number"},"stroke-width":{min:0,type:"length"},"stroke-miterlimit":{min:1,type:"number"},"font-size":{min:0,type:"length"},r:{min:0,type:"length"},rx:{min:0,type:"length"},ry:{min:0,type:"length"},width:{min:0,type:"length"},height:{min:0,type:"length"},stdDeviation:{min:0,type:"number"},scale:{type:"number"},baseFrequency:{min:0,type:"number"},numOctaves:{min:1,type:"integer"},seed:{min:0,type:"number"},repeatCount:{min:0,type:"number"}},$0=(b)=>{let C=b.tagName.toLowerCase();for(let l of b.getAttributeNames()){let g=t[l];if(g){let n=b.getAttribute(l);if(n==="inherit"||n==="none"||n==="indefinite"||n==="auto")continue;let G0=n.match(/^([+-]?\d*\.?\d+)/);if(G0){let L0=parseFloat(G0[1]);if(isNaN(L0))q.push({type:"invalid_numeric_value",element:C,attr:l,value:n,reason:`Invalid numeric value '${n}' for attribute '${l}'`});else{if(g.min!==void 0&&L0<g.min)q.push({type:"numeric_out_of_range",element:C,attr:l,value:n,constraint:`min: ${g.min}`,reason:`Value '${n}' for '${l}' is below minimum (${g.min})`});if(g.max!==void 0&&L0>g.max)q.push({type:"numeric_out_of_range",element:C,attr:l,value:n,constraint:`max: ${g.max}`,reason:`Value '${n}' for '${l}' exceeds maximum (${g.max})`});if(g.type==="integer"&&!Number.isInteger(L0))q.push({type:"invalid_numeric_value",element:C,attr:l,value:n,reason:`Attribute '${l}' requires an integer value, got '${n}'`})}}}}for(let l of b.children)if(a(l))$0(l)},Q0=(b)=>{let C=new Map,l=(g)=>{let n=g.getAttribute("id");if(n){if(!C.has(n))C.set(n,[]);C.get(n).push(g.tagName.toLowerCase())}for(let G0 of g.children)if(a(G0))l(G0)};l(b);for(let[g,n]of C)if(n.length>1)q.push({type:"duplicate_id",id:g,count:n.length,elements:n.join(", "),reason:`Duplicate ID '${g}' found on ${n.length} elements: ${n.join(", ")}`})},V0=(b)=>{let C=new Set,l=(L0)=>{let P0=L0.getAttribute("id");if(P0)C.add(P0);for(let E0 of L0.children)if(a(E0))l(E0)};l(b);let g=/url\(\s*['"]?#([^'")]+)['"]?\s*\)/g,n=/^#(.+)$/,G0=(L0)=>{let P0=L0.tagName.toLowerCase();for(let E0 of L0.getAttributeNames()){let U7=L0.getAttribute(E0),f6;g.lastIndex=0;while((f6=g.exec(U7))!==null){let b7=f6[1];if(!C.has(b7))q.push({type:"broken_reference",element:P0,attr:E0,refId:b7,reason:`Broken reference: url(#${b7}) points to non-existent ID`})}if(E0==="href"||E0==="xlink:href"){let b7=U7.match(n);if(b7){let _6=b7[1];if(!C.has(_6))q.push({type:"broken_reference",element:P0,attr:E0,refId:_6,reason:`Broken reference: ${E0}="#${_6}" points to non-existent ID`})}}}for(let E0 of L0.children)if(a(E0))G0(E0)};G0($)},N0=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),h0=new Set(["fill","stroke","color","stop-color","flood-color","lighting-color","solid-color"]),o=(b)=>{let C=b.toLowerCase().trim();if(C==="none"||C==="inherit"||C==="currentcolor")return!0;if(N0.has(C))return!0;if(C.startsWith("url("))return!0;if(/^#[0-9a-f]{3}$/.test(C)||/^#[0-9a-f]{6}$/.test(C))return!0;if(/^rgb\(\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)$/.test(C))return!0;if(/^rgba\(\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*[\d.]+%?\s*\)$/.test(C))return!0;return!1},J0=(b)=>{let C=b.tagName.toLowerCase();for(let l of b.getAttributeNames())if(h0.has(l)){let g=b.getAttribute(l);if(!o(g))q.push({type:"invalid_color",element:C,attr:l,value:g,reason:`Invalid color value '${g}' for attribute '${l}'`})}for(let l of b.children)if(a(l))J0(l)},F0=(b)=>{let C=b.tagName.toLowerCase();if(["svg","symbol","marker","pattern","view"].includes(C)){let n=b.getAttribute("viewBox");if(n){let G0=n.trim().split(/[\s,]+/);if(G0.length!==4)q.push({type:"malformed_viewbox",element:C,value:n,reason:`viewBox must have exactly 4 values (min-x, min-y, width, height), got ${G0.length}`});else{for(let E0=0;E0<G0.length;E0++)if(!/^[+-]?\d*\.?\d+([Ee][+-]?\d+)?$/.test(G0[E0])){q.push({type:"malformed_viewbox",element:C,value:n,reason:`viewBox contains invalid number '${G0[E0]}' at position ${E0+1}`});break}let L0=parseFloat(G0[2]),P0=parseFloat(G0[3]);if(isNaN(L0)||isNaN(P0)||L0<0||P0<0)q.push({type:"invalid_viewbox_dimensions",element:C,value:n,reason:`viewBox width and height must be valid non-negative numbers, got ${L0}x${P0}`})}}}let l=b.getAttribute("preserveAspectRatio");if(l){if(!/^(none|xMinYMin|xMidYMin|xMaxYMin|xMinYMid|xMidYMid|xMaxYMid|xMinYMax|xMidYMax|xMaxYMax)(\s+(meet|slice))?$/.test(l.trim()))q.push({type:"malformed_preserveaspectratio",element:C,value:l,reason:`Invalid preserveAspectRatio format '${l}'`})}if(["polygon","polyline"].includes(C)){let n=b.getAttribute("points");if(n){let G0=n.trim().split(/[\s,]+/);if(G0.length>0&&G0.length%2!==0)q.push({type:"malformed_points",element:C,value:n.slice(0,50)+(n.length>50?"...":""),reason:`points attribute must have even number of values (x,y pairs), got ${G0.length}`})}}let g=b.getAttribute("transform");if(g){if(!/^(\s{0,20}(matrix|translate|scale|rotate|skewX|skewY)\s{0,20}\([^)]*\)\s{0,20})+$/.test(g.trim())){if(!/^[\s\w(),.\-+]+$/.test(g))q.push({type:"malformed_transform",element:C,value:g.slice(0,50)+(g.length>50?"...":""),reason:"Potentially malformed transform attribute"})}}for(let n of b.children)if(a(n))F0(n)},O0=(b)=>{let C=b.tagName,l=C.toLowerCase();if(C.includes(":")||G6.has(C)||z8.has(l)){for(let n of Array.from(b.children))if(a(n))O0(n);return}let g=P6(C,G6);if(g){let n=b.ownerDocument.createElement(g);for(let G0 of b.getAttributeNames())n.setAttribute(G0,b.getAttribute(G0));while(b.firstChild)n.appendChild(b.firstChild);if(b.parentNode)b.parentNode.replaceChild(n,b);q.push({type:"element_typo_fixed",oldName:C,newName:g,reason:`Fixed element typo: <${C}> -> <${g}>`});for(let G0 of Array.from(n.children))if(a(G0))O0(G0)}else for(let n of Array.from(b.children))if(a(n))O0(n)},R0=(b)=>{for(let C of Array.from(b.getAttributeNames())){if(C.startsWith("xmlns")||C.startsWith("data-"))continue;if(C.startsWith("-webkit-")||C.startsWith("-moz-"))continue;if(C.includes(":")&&!C.startsWith("xlink:")&&!C.startsWith("xml:"))continue;if(F6.has(C)||q8.has(C.toLowerCase()))continue;let l=P6(C,F6);if(l){let g=b.getAttribute(C);b.removeAttribute(C),b.setAttribute(l,g),q.push({type:"attr_typo_fixed",element:b.tagName.toLowerCase(),oldAttr:C,newAttr:l,reason:`Fixed attribute typo: '${C}' -> '${l}'`})}}for(let C of b.children)if(a(C))R0(C)},I0=(b)=>{let C=new Map,l=new Set,g=(L0)=>{let P0=L0.getAttribute("id");if(P0)C.set(P0,(C.get(P0)||0)+1),l.add(P0);for(let E0 of L0.children)if(a(E0))g(E0)};g(b);let n=new Set,G0=(L0)=>{let P0=L0.getAttribute("id");if(P0)if(n.has(P0)){let E0=P0,U7=2;while(l.has(E0)||n.has(E0))E0=`${P0}_${U7++}`;L0.setAttribute("id",E0),l.add(E0),n.add(E0),q.push({type:"duplicate_id_renamed",oldId:P0,newId:E0,element:L0.tagName.toLowerCase(),reason:`Renamed duplicate ID: '${P0}' -> '${E0}'`})}else n.add(P0);for(let E0 of L0.children)if(a(E0))G0(E0)};G0(b)};if(_($),U(),V($),M($),w($),f($),S($),x($),O0($),R0($),I0($),c($),e($),s($),P($),$0($),V0($),J0($),F0($),$.setAttribute("data-fixes-applied",String(q.length)),z&&q.length>0)$.setAttribute("data-fix-report",JSON.stringify(q));return $}),C0={ERROR:"error",WARNING:"warning"},cz={broken_reference:C0.ERROR,broken_url_reference:C0.ERROR,duplicate_id:C0.ERROR,missing_required_attribute:C0.ERROR,invalid_child_element:C0.ERROR,animation_in_empty_element:C0.ERROR,malformed_viewbox:C0.ERROR,malformed_points:C0.ERROR,malformed_transform:C0.ERROR,invalid_enum_value:C0.ERROR,invalid_numeric_constraint:C0.ERROR,invalid_attr_on_element:C0.WARNING,missing_namespace:C0.WARNING,invalid_timing:C0.WARNING,uppercase_unit:C0.WARNING,invalid_whitespace:C0.WARNING,invalid_number:C0.WARNING,mistyped_element_detected:C0.WARNING,unknown_element_detected:C0.WARNING,mistyped_attribute_detected:C0.WARNING,unknown_attribute_detected:C0.WARNING,invalid_color:C0.WARNING,circular_reference:C0.WARNING,deep_nesting:C0.WARNING,empty_defs:C0.WARNING,gradient_stop_order:C0.WARNING,path_complexity:C0.WARNING,external_resource:C0.WARNING,script_content:C0.WARNING,event_handler:C0.WARNING,missing_title:C0.WARNING,missing_desc:C0.WARNING,invalid_aria:C0.WARNING,missing_lang:C0.WARNING},lz=new Set(["onabort","onactivate","onbegin","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onend","onended","onerror","onfocus","onfocusin","onfocusout","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onpause","onplay","onplaying","onprogress","onratechange","onrepeat","onreset","onresize","onscroll","onseeked","onseeking","onselect","onshow","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","onunload","onvolumechange","onwaiting","onwheel"]),nz=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"]),uK=new Set(["img","graphics-document","graphics-object","graphics-symbol","group","list","listitem","none","presentation","application"]);function sz($){let J={elements:new Map,lines:[]},Z=0;J.lines.push(0);for(let Y=0;Y<$.length;Y++)if($[Y]===`
|
|
351
|
+
`)J.lines.push(Y+1);let K=[],Q=/<!\[CDATA\[([\s\S]*?)\]\]>/g,H;while((H=Q.exec($))!==null)K.push({start:H.index,end:H.index+H[0].length});let z=/<!--[\s\S]*?-->/g,q;while((q=z.exec($))!==null)K.push({start:q.index,end:q.index+q[0].length});let W=/<script[^>]*>([\s\S]*?)<\/script>/gi,j;while((j=W.exec($))!==null){let Y=j.index+j[0].indexOf(">")+1,X=j.index+j[0].lastIndexOf("<");if(X>Y)K.push({start:Y,end:X})}let G=/<style[^>]*>([\s\S]*?)<\/style>/gi,F;while((F=G.exec($))!==null){let Y=F.index+F[0].indexOf(">")+1,X=F.index+F[0].lastIndexOf("<");if(X>Y)K.push({start:Y,end:X})}K.sort((Y,X)=>Y.start-X.start);let _=(Y)=>{for(let X of K){if(Y>=X.start&&Y<X.end)return!0;if(X.start>Y)break}return!1},U=(Y)=>{let X=1;for(let I=0;I<J.lines.length;I++){if(J.lines[I]>Y){X=I;break}X=I+1}let w=J.lines[X-1]||0,R=Y-w+1;return{line:X,column:R}},O=/<([a-zA-Z][a-zA-Z0-9:_-]*)\s*([^>]*?)(\/?)\s*>/g,V=/([a-zA-Z][a-zA-Z0-9:_-]*)\s*=\s*["']([^"']*)["']/g,M;while((M=O.exec($))!==null){if(_(M.index))continue;let Y=M[1].toLowerCase(),X=M[2],w=M.index,R=M.index+M[0].length,{line:I,column:f}=U(w),u=X?M[0].indexOf(X):0,m=new Map;V.lastIndex=0;let S;while((S=V.exec(X))!==null){let x=S[1],h=S[2],E=w+u+S.index,d=U(E);m.set(x.toLowerCase(),{name:x,value:h,line:d.line,column:d.column})}if(!J.elements.has(Y))J.elements.set(Y,[]);J.elements.get(Y).push({line:I,column:f,endColumn:f+M[0].length-1,attrs:m})}return J.getElementPosition=(Y,X=0)=>{let w=J.elements.get(Y.toLowerCase());if(w&&w[X]){let R=w[X];return{line:R.line,column:R.column}}return{line:1,column:1}},J.getAttributePosition=(Y,X,w=0)=>{let R=J.elements.get(Y.toLowerCase());if(R&&R[w]){let I=R[w],f=I.attrs.get(X.toLowerCase());if(f)return{line:f.line,column:f.column};return{line:I.line,column:I.column}}return{line:1,column:1}},J}async function oK($,J={}){vz();let Z=J.errorsOnly===!0,K=J.outputFile||null,Q=(J.outputFormat||"json").toLowerCase(),H=J.includeSource===!0,z=["text","json","xml","yaml"];if(K&&!z.includes(Q))throw new Error(`Invalid outputFormat '${Q}'. Must be one of: ${z.join(", ")}`);let q="",W;try{if(W=E6($),W===S0.SVG_STRING)q=$;else if(W===S0.FILE_PATH){let D=await import("node:fs/promises"),i=(await Promise.resolve().then(() => (C6(),I6))).normalize($);try{q=await D.readFile(i,"utf8")}catch(v){throw new Error(`Failed to read file '${$}': ${v.message}`)}}else if(W===S0.URL)try{let D=await fetch($);if(!D.ok)throw new Error(`HTTP ${D.status}: ${D.statusText}`);q=await D.text()}catch(D){throw new Error(`Failed to fetch URL '${$}': ${D.message}`)}else if(W===S0.DOM_ELEMENT)if(typeof XMLSerializer!=="undefined")q=new XMLSerializer().serializeToString($);else if($.outerHTML)q=$.outerHTML;else throw new Error("Cannot serialize DOM element: XMLSerializer not available");else throw new Error(`Unknown input type: ${typeof $}`)}catch(D){return{issues:[{type:"input_error",severity:C0.ERROR,reason:D.message,line:0,column:0}],isValid:!1,hasErrors:!0,hasWarnings:!1,errorCount:1,warningCount:0,summary:{input_error:1}}}let j=H?q.split(`
|
|
352
|
+
`):null,G=sz(q),F,_=[],U=(D)=>{let A=D.match(/line\s*:?\s*(\d+)/i)||D.match(/:(\d+):/);return A?parseInt(A[1],10):1},O=(D)=>{let A=D.match(/column\s*:?\s*(\d+)/i)||D.match(/:\d+:(\d+)/);return A?parseInt(A[1],10):1},V=(D)=>{let A=D,i=[],v="_VALID_ENTITY_",K0=/&(amp|lt|gt|quot|apos|#\d{1,7}|#x[\da-fA-F]{1,6});/g,M0=A.replace(K0,v+"$1;").replace(/&/g,"&").replace(new RegExp(v,"g"),"&");if(M0!==A)A=M0,i.push("Escaped unencoded ampersands");let T0=A.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"");if(T0!==A)A=T0,i.push("Removed invalid control characters");if(A.charCodeAt(0)===65279)A=A.slice(1),i.push("Removed UTF-8 BOM");let u0=A.replace(/="([^"]*)<([^"]*)"(?!\s*>)/g,(W7,t0,s0)=>{if(!s0.includes(">"))return`="${t0}<${s0}"`;return W7});if(u0!==A)A=u0,i.push("Escaped < in attribute values");return{fixed:A,appliedFixes:i}};try{F=await T6($,W)}catch(D){let A=D.message||String(D),i=U(A),v=O(A),{fixed:K0,appliedFixes:q0}=V(q);if(q0.length>0&&K0!==q)try{let{JSDOM:H0}=await import("jsdom");F=new H0(K0,{contentType:"image/svg+xml"}).window.document.documentElement,_.push({type:"parse_recovery",severity:C0.WARNING,reason:`Recovered from parse error. Applied fixes: ${q0.join("; ")}`,line:i,column:v}),_.push({type:"original_parse_error",severity:C0.ERROR,reason:`Original parse error: ${A}`,line:i,column:v})}catch(H0){return{issues:[{type:"parse_error",severity:C0.ERROR,reason:`Failed to parse SVG: ${A}`,line:i,column:v},{type:"recovery_failed",severity:C0.WARNING,reason:`Recovery attempted (${q0.join("; ")}) but still failed: ${H0.message}`,line:i,column:v}],isValid:!1,hasErrors:!0,hasWarnings:!0,errorCount:1,warningCount:1,summary:{parse_error:1,recovery_failed:1}}}else return{issues:[{type:"parse_error",severity:C0.ERROR,reason:`Failed to parse SVG: ${A}`,line:i,column:v}],isValid:!1,hasErrors:!0,hasWarnings:!1,errorCount:1,warningCount:0,summary:{parse_error:1}}}let M=[];if(_.length>0)M.push(..._);let Y=new Map,X=(D)=>{let A=D.toLowerCase(),i=Y.get(A)||0;return Y.set(A,i+1),i},w=()=>{Y.clear()},R=(D,A,i=null,v=null)=>{let K0;if(i)K0=G.getAttributePosition(A,i,v||0);else K0=G.getElementPosition(A,v||0);let q0=cz[D.type]||C0.WARNING,H0={...D,severity:q0,line:K0.line,column:K0.column};if(H&&j&&K0.line>0&&K0.line<=j.length)H0.sourceLine=j[K0.line-1];return H0},I=new Set,f=(D)=>{if(!D)return;let A=D.getAttribute("id");if(A)I.add(A);for(let i of D.children)if(a(i))f(i)};f(F);let u=["x","y","width","height","cx","cy","r","rx","ry","x1","y1","x2","y2","d","points"],m=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);if(A==="g"){for(let v of u)if(D.hasAttribute(v))M.push(R({type:"invalid_attr_on_element",element:A,attr:v,value:D.getAttribute(v),reason:`SVG 1.1: <g> elements do not support '${v}' attribute`},A,v,i))}for(let v of D.children)if(a(v))m(v)},S=()=>{let D=!1,A=null,i=null,v=(K0)=>{for(let q0 of K0.getAttributeNames())if(q0.startsWith("xlink:")){D=!0,A=K0.tagName.toLowerCase(),i=q0;return}for(let q0 of K0.children){if(a(q0))v(q0);if(D)return}};if(v(F),D&&!F.hasAttribute("xmlns:xlink")){let K0=G.getAttributePosition(A,i,0);M.push({type:"missing_namespace",namespace:"xmlns:xlink",reason:"Document uses xlink:* attributes but missing xmlns:xlink namespace declaration",line:K0.line,column:K0.column})}},x=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of["xlink:href","href"]){let K0=D.getAttribute(v);if(K0&&K0.startsWith("#")){let q0=K0.slice(1);if(q0&&!I.has(q0))M.push(R({type:"broken_reference",element:A,attr:v,referencedId:q0,reason:`Reference to non-existent ID '${q0}'`},A,v,i))}}for(let v of D.children)if(a(v))x(v)},h=["begin","end","dur","repeatDur","min","max"],E=new Set(["animate","animateTransform","animateMotion","animateColor","set"]),d=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);if(E.has(A))for(let v of h){let K0=D.getAttribute(v);if(K0){let q0=K0.trim();if(q0!==K0)M.push(R({type:"invalid_timing",element:A,attr:v,value:K0,reason:"Timing value has leading/trailing whitespace"},A,v,i));if(/[;,]/.test(q0)&&!/^[\d\w\s.;,+-]+$/.test(q0))M.push(R({type:"invalid_timing",element:A,attr:v,value:K0,reason:"Timing value may contain invalid characters"},A,v,i))}}for(let v of D.children)if(a(v))d(v)},c=new Set(["font-face-format","font-face-name","glyphref","hkern","vkern"]),p=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);if(c.has(A)){for(let v of D.children)if(a(v)){let K0=v.tagName.toLowerCase();if(E.has(K0))M.push(R({type:"animation_in_empty_element",element:A,child:K0,reason:`Animation element <${K0}> inside <${A}> which has EMPTY content model per SVG 1.1 DTD`},A,null,i))}}for(let v of D.children)if(a(v))p(v)},N=/(\d+\.?\d*)(PX|EM|EX|PT|PC|CM|MM|IN|%)/gi,y=["width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","stroke-width","font-size","letter-spacing","word-spacing","stroke-dashoffset"],B=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of y){let K0=D.getAttribute(v);if(K0){let q0=K0.match(N);if(q0)for(let H0 of q0){let M0=H0.replace(/[\d.]+/,"");if(M0!==M0.toLowerCase())M.push(R({type:"uppercase_unit",element:A,attr:v,value:K0,reason:`Unit '${M0}' should be lowercase '${M0.toLowerCase()}'`},A,v,i))}}}for(let v of D.children)if(a(v))B(v)},e=["points","viewBox","d","values","keyTimes","keySplines","rotate"],r=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of e){let K0=D.getAttribute(v);if(K0){if(/[\t\n\r]/.test(K0)||/ +/.test(K0))M.push(R({type:"invalid_whitespace",element:A,attr:v,reason:"List attribute contains tabs, newlines, or multiple consecutive spaces"},A,v,i))}}for(let v of D.children)if(a(v))r(v)},s=["width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","stroke-width","stroke-miterlimit","stroke-dashoffset","opacity","fill-opacity","stroke-opacity","font-size"],z0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of s){let K0=D.getAttribute(v);if(K0){let q0=K0.trim();if(/^0\d/.test(q0.replace(/[a-z%]+$/i,"")))M.push(R({type:"invalid_number",element:A,attr:v,value:K0,reason:"Number has unnecessary leading zeros"},A,v,i));if(/\.$/.test(q0.replace(/[a-z%]+$/i,"")))M.push(R({type:"invalid_number",element:A,attr:v,value:K0,reason:"Number has trailing decimal point"},A,v,i))}}for(let v of D.children)if(a(v))z0(v)},T=(D,A=!1)=>{let i=D.tagName,v=i.toLowerCase(),K0=X(v),q0=i.includes(":"),H0=A||bK.has(v)||q0;if(!H0){if(!G6.has(i)&&!z8.has(v)){if(!bz(v)){let M0=P6(i,G6);if(M0)M.push(R({type:"mistyped_element_detected",element:i,suggestion:M0,reason:`Unknown element <${i}> - did you mean <${M0}>?`},v,null,K0));else M.push(R({type:"unknown_element_detected",element:i,reason:`Unknown element <${i}> - not in SVG 1.1 spec`},v,null,K0))}}}for(let M0 of D.children)if(a(M0))T(M0,H0)},P=(D,A=!1)=>{let i=D.tagName.toLowerCase(),v=X(i),K0=D.tagName.includes(":"),q0=A||bK.has(i)||K0;if(!q0)for(let H0 of D.getAttributeNames()){if(H0.startsWith("data-")||H0.startsWith("aria-"))continue;if(H0==="xmlns"||H0.startsWith("xmlns:"))continue;if(H0.includes(":")&&!H0.startsWith("xlink:")&&!H0.startsWith("xml:"))continue;if(fz(H0))continue;if(!F6.has(H0)&&!q8.has(H0.toLowerCase())){let M0=P6(H0,F6);if(M0)M.push(R({type:"mistyped_attribute_detected",element:i,attr:H0,suggestion:M0,reason:`Unknown attribute '${H0}' - did you mean '${M0}'?`},i,H0,v));else M.push(R({type:"unknown_attribute_detected",element:i,attr:H0,reason:`Unknown attribute '${H0}' on <${i}> - not in SVG 1.1 spec`},i,H0,v))}}for(let H0 of D.children)if(a(H0))P(H0,q0)},t={use:["xlink:href","href"],image:["xlink:href","href"],feImage:["xlink:href","href"],textPath:["xlink:href","href"],mpath:["xlink:href","href"],animate:["attributeName"],animateTransform:["attributeName","type"],animateMotion:[],animateColor:["attributeName"],set:["attributeName"],feBlend:["in2"],feComposite:["in2"],feDisplacementMap:["in2","scale"],feMorphology:["operator"],feTurbulence:["type"],feConvolveMatrix:["kernelMatrix"],feFuncR:["type"],feFuncG:["type"],feFuncB:["type"],feFuncA:["type"],linearGradient:[],radialGradient:[],stop:["offset"]},$0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A),v=t[A];if(v&&v.length>0){if(v.includes("xlink:href")&&v.includes("href")){if(!D.hasAttribute("xlink:href")&&!D.hasAttribute("href"))M.push(R({type:"missing_required_attribute",element:A,attrs:["href","xlink:href"],reason:`<${A}> requires 'href' or 'xlink:href' attribute`},A,null,i))}else for(let K0 of v)if(!D.hasAttribute(K0))M.push(R({type:"missing_required_attribute",element:A,attr:K0,reason:`<${A}> requires '${K0}' attribute per SVG 1.1 DTD`},A,K0,i))}for(let K0 of D.children)if(a(K0))$0(K0)},Q0={linearGradient:new Set(["stop","animate","animateTransform","set"]),radialGradient:new Set(["stop","animate","animateTransform","set"]),stop:new Set(["animate","set"]),clipPath:new Set(["path","text","rect","circle","ellipse","line","polyline","polygon","use","animate","animateTransform","set","desc","title"]),mask:new Set(["path","text","rect","circle","ellipse","line","polyline","polygon","use","g","defs","image","switch","a","animate","animateTransform","set","desc","title"])},V0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A),v=Q0[A];if(v){for(let K0 of D.children)if(a(K0)){let q0=K0.tagName.toLowerCase();if(!q0.includes(":")&&!v.has(q0))M.push(R({type:"invalid_child_element",element:A,child:q0,reason:`<${q0}> is not a valid child of <${A}> per SVG 1.1 DTD`},A,null,i))}}for(let K0 of D.children)if(a(K0))V0(K0)},N0={spreadMethod:new Set(["pad","reflect","repeat"]),gradientUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),clipPathUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),maskUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),maskContentUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),filterUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),primitiveUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),patternUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),patternContentUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),markerUnits:new Set(["strokeWidth","userSpaceOnUse"]),"fill-rule":new Set(["nonzero","evenodd","inherit"]),"clip-rule":new Set(["nonzero","evenodd","inherit"]),"stroke-linecap":new Set(["butt","round","square","inherit"]),"stroke-linejoin":new Set(["miter","round","bevel","inherit"]),"text-anchor":new Set(["start","middle","end","inherit"]),"dominant-baseline":new Set(["auto","use-script","no-change","reset-size","ideographic","alphabetic","hanging","mathematical","central","middle","text-after-edge","text-before-edge","inherit"]),"alignment-baseline":new Set(["auto","baseline","before-edge","text-before-edge","middle","central","after-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","inherit"]),visibility:new Set(["visible","hidden","collapse","inherit"]),display:new Set(["inline","block","list-item","run-in","compact","marker","table","inline-table","table-row-group","table-header-group","table-footer-group","table-row","table-column-group","table-column","table-cell","table-caption","none","inherit"]),overflow:new Set(["visible","hidden","scroll","auto","inherit"])},h0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let[v,K0]of Object.entries(N0)){let q0=D.getAttribute(v);if(q0&&!K0.has(q0))M.push(R({type:"invalid_enum_value",element:A,attr:v,value:q0,validValues:[...K0],reason:`Invalid value '${q0}' for '${v}'. Valid values: ${[...K0].join(", ")}`},A,v,i))}for(let v of D.children)if(a(v))h0(v)},o={opacity:{min:0,max:1,type:"number"},"fill-opacity":{min:0,max:1,type:"number"},"stroke-opacity":{min:0,max:1,type:"number"},"stop-opacity":{min:0,max:1,type:"number"},"flood-opacity":{min:0,max:1,type:"number"},"stroke-width":{min:0,type:"length"},"stroke-miterlimit":{min:1,type:"number"},r:{min:0,type:"length"},rx:{min:0,type:"length"},ry:{min:0,type:"length"}},J0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let[v,K0]of Object.entries(o)){let q0=D.getAttribute(v);if(q0){let H0=parseFloat(q0);if(!isNaN(H0)){if(K0.min!==void 0&&H0<K0.min)M.push(R({type:"invalid_numeric_constraint",element:A,attr:v,value:q0,reason:`Value ${H0} is below minimum ${K0.min}`},A,v,i));if(K0.max!==void 0&&H0>K0.max)M.push(R({type:"invalid_numeric_constraint",element:A,attr:v,value:q0,reason:`Value ${H0} is above maximum ${K0.max}`},A,v,i))}}}for(let v of D.children)if(a(v))J0(v)},F0=(D)=>{let A=new Map,i=new Map,v=(K0)=>{let q0=K0.tagName.toLowerCase(),H0=X(q0),M0=K0.getAttribute("id");if(M0){if(!A.has(M0))A.set(M0,[]),i.set(M0,{tagName:q0,occIdx:H0});A.get(M0).push(q0)}for(let T0 of K0.children)if(a(T0))v(T0)};v(D);for(let[K0,q0]of A)if(q0.length>1){let H0=i.get(K0);M.push(R({type:"duplicate_id",id:K0,elements:q0,count:q0.length,reason:`ID '${K0}' is used ${q0.length} times (on ${q0.join(", ")})`},H0.tagName,"id",H0.occIdx))}},O0=/url\(#([^)]+)\)/g,R0=["fill","stroke","clip-path","mask","filter","color-profile","marker","marker-start","marker-mid","marker-end"],I0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of R0){let K0=D.getAttribute(v);if(K0){let q0;O0.lastIndex=0;while((q0=O0.exec(K0))!==null){let H0=q0[1];if(!I.has(H0))M.push(R({type:"broken_url_reference",element:A,attr:v,referencedId:H0,reason:`url(#${H0}) references non-existent ID`},A,v,i))}}}for(let v of D.children)if(a(v))I0(v)},b=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","currentcolor","inherit","none","transparent"]),C=["fill","stroke","color","stop-color","flood-color","lighting-color","solid-color"],l=(D)=>{let A=D.toLowerCase().trim();if(b.has(A))return!0;if(/^#[0-9a-f]{3}$/i.test(A))return!0;if(/^#[0-9a-f]{4}$/i.test(A))return!0;if(/^#[0-9a-f]{6}$/i.test(A))return!0;if(/^#[0-9a-f]{8}$/i.test(A))return!0;if(/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+\s*)?\)$/i.test(A))return!0;if(/^rgba?\(\s*\d+%\s*,\s*\d+%\s*,\s*\d+%\s*(,\s*[\d.]+%?\s*)?\)$/i.test(A))return!0;if(/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(,\s*[\d.]+\s*)?\)$/i.test(A))return!0;if(/^url\(#[^)]+\)$/i.test(A))return!0;return!1},g=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of C){let K0=D.getAttribute(v);if(K0&&!l(K0))M.push(R({type:"invalid_color",element:A,attr:v,value:K0,reason:`Invalid color value '${K0}'`},A,v,i))}for(let v of D.children)if(a(v))g(v)},n=(D)=>{let A=D.tagName.toLowerCase(),i=X(A),v=D.getAttribute("viewBox");if(v){let H0=v.trim().split(/[\s,]+/);if(H0.length!==4||!H0.every((M0)=>!isNaN(parseFloat(M0))))M.push(R({type:"malformed_viewbox",element:A,value:v,reason:"viewBox must be exactly 4 numbers (min-x, min-y, width, height)"},A,"viewBox",i))}let K0=D.getAttribute("points");if(K0){let H0=K0.trim().split(/[\s,]+/).filter((M0)=>M0);if(H0.length%2!==0||!H0.every((M0)=>!isNaN(parseFloat(M0))))M.push(R({type:"malformed_points",element:A,value:K0.length>50?K0.substring(0,50)+"...":K0,reason:"points must be pairs of numbers"},A,"points",i))}let q0=D.getAttribute("transform");if(q0){let H0=/^\s{0,20}(matrix|translate|scale|rotate|skewX|skewY)\s{0,20}\([^)]*\)\s{0,20},?\s{0,20}/,M0=q0.trim();while(M0.length>0){let T0=M0.match(H0);if(T0&&T0[0].length>0)M0=M0.substring(T0[0].length);else if(!T0){M.push(R({type:"malformed_transform",element:A,value:q0.length>50?q0.substring(0,50)+"...":q0,reason:`Invalid transform syntax near '${M0.substring(0,20)}'`},A,"transform",i));break}else M0=M0.substring(1)}}if(A==="path"){let H0=D.getAttribute("d");if(H0){let M0=H0.trim();if(M0.length>0){if(!/^[Mm]/.test(M0))M.push(R({type:"malformed_path_data",element:"path",value:H0.length>50?H0.substring(0,50)+"...":H0,reason:"Path data must start with M or m command"},"path","d",i));let T0=M0.replace(/[MmZzLlHhVvCcSsQqTtAa\d\s,.\-+eE]/g,"");if(T0.length>0)M.push(R({type:"malformed_path_data",element:"path",value:H0.length>50?H0.substring(0,50)+"...":H0,reason:`Path data contains invalid characters: '${T0.substring(0,10)}'`},"path","d",i))}}}for(let H0 of D.children)if(a(H0))n(H0)},G0=()=>{let D=new Map,A=(H0)=>{let M0=H0.getAttribute("id");if(M0)D.set(M0,H0);for(let T0 of H0.children)if(a(T0))A(T0)};A(F);let i=["href","xlink:href","mask","clip-path","filter","fill","stroke"],v=(H0)=>{if(!H0)return null;let M0=H0.match(/url\(#([^)]+)\)/);if(M0)return M0[1];let T0=H0.match(/^#(.+)$/);if(T0)return T0[1];return null},K0=(H0,M0=new Set)=>{if(M0.has(H0))return!0;let T0=D.get(H0);if(!T0)return!1;M0.add(H0);let u0=(t0)=>{for(let s0 of i){let IJ=v(t0.getAttribute(s0));if(IJ&&K0(IJ,M0))return!0}for(let s0 of t0.children)if(a(s0)&&u0(s0))return!0;return!1},W7=u0(T0);return M0.delete(H0),W7},q0=["clipPath","mask","filter","symbol","pattern","marker"];for(let[H0,M0]of D){let T0=M0.tagName.toLowerCase();if(q0.includes(T0)){if(K0(H0)){w();let u0=X(T0);M.push(R({type:"circular_reference",element:T0,attr:"id",value:H0,reason:`Circular reference detected: '${H0}' directly or indirectly references itself`},T0,"id",u0))}}}},L0=50,P0=(D,A=0)=>{if(A>L0){let i=D.tagName.toLowerCase(),v=X(i);M.push(R({type:"deep_nesting",element:i,value:String(A),reason:`Element nesting depth (${A}) exceeds ${L0} levels`},i,null,v));return}for(let i of D.children)if(a(i))P0(i,A+1)},E0=(D)=>{let A=D.tagName.toLowerCase();if(A==="defs"){let i=!1;for(let v of D.childNodes)if(a(v)){i=!0;break}if(!i){let v=X(A);M.push(R({type:"empty_defs",element:A,reason:"Empty <defs> element (can be removed)"},A,null,v))}}for(let i of D.children)if(a(i))E0(i)},U7=(D)=>{let A=D.tagName.toLowerCase();if(A==="lineargradient"||A==="radialgradient"){let i=Array.from(D.children).filter((v)=>a(v)&&v.tagName.toLowerCase()==="stop");if(i.length>=2){let v=-1;for(let K0 of i){let q0=K0.getAttribute("offset")||"0",H0=parseFloat(q0);if(q0.includes("%"))H0=H0/100;if(!isNaN(H0)&&H0<v){let M0=X(A);M.push(R({type:"gradient_stop_order",element:A,reason:`Gradient stops not in ascending offset order (${v} followed by ${H0})`},A,null,M0));break}if(!isNaN(H0))v=H0}}}for(let i of D.children)if(a(i))U7(i)},f6=1e4,b7=(D)=>{let A=D.tagName.toLowerCase();if(A==="path"){let i=D.getAttribute("d");if(i){let v=i.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g);if(v&&v.length>f6){let K0=X(A);M.push(R({type:"path_complexity",element:A,attr:"d",value:`${v.length} coordinates`,reason:`Path has ${v.length} coordinates (>${f6}), may cause slow rendering`},A,"d",K0))}}}for(let i of D.children)if(a(i))b7(i)},_6=(D)=>{let A=D.tagName.toLowerCase(),i=X(A),v=["href","xlink:href"];for(let K0 of v){let q0=D.getAttribute(K0);if(q0&&(q0.startsWith("http://")||q0.startsWith("https://")||q0.startsWith("//")))M.push(R({type:"external_resource",element:A,attr:K0,value:q0.length>60?q0.substring(0,60)+"...":q0,reason:"External resource reference detected (potential security/CORS issue)"},A,K0,i))}if(A==="style"&&D.textContent){let K0=D.textContent.match(/@import\s+url\s*\(\s*['"]?(https?:\/\/[^'")\s]+)/i);if(K0)M.push(R({type:"external_resource",element:A,value:K0[1],reason:"External CSS import detected in style element"},A,null,i))}for(let K0 of D.children)if(a(K0))_6(K0)},RJ=(D)=>{let A=D.tagName.toLowerCase();if(A==="script"){let i=X(A);M.push(R({type:"script_content",element:A,reason:"Script element detected (potential security issue in untrusted SVGs)"},A,null,i))}for(let i of D.children)if(a(i))RJ(i)},BJ=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of D.getAttributeNames())if(lz.has(v.toLowerCase()))M.push(R({type:"event_handler",element:A,attr:v,reason:`Event handler attribute '${v}' detected (potential XSS vector)`},A,v,i));for(let v of D.children)if(a(v))BJ(v)},eK=()=>{let D=!1,A=!1,i=!1,v=F.hasAttribute("lang")||F.hasAttribute("xml:lang"),K0=(T0)=>{for(let u0 of T0.children){if(!a(u0))continue;let W7=u0.tagName.toLowerCase();if(W7==="title")D=!0;if(W7==="desc")A=!0;if(W7==="text"||W7==="tspan"||W7==="textpath")i=!0;K0(u0)}};if(K0(F),!D)M.push(R({type:"missing_title",element:"svg",reason:"Missing <title> element (recommended for accessibility)"},"svg",null,0));let q0=0,H0=(T0)=>{q0++;for(let u0 of T0.children)if(a(u0))H0(u0)};if(H0(F),!A&&q0>10)M.push(R({type:"missing_desc",element:"svg",reason:`Missing <desc> element (recommended for complex SVGs with ${q0} elements)`},"svg",null,0));if(i&&!v)M.push(R({type:"missing_lang",element:"svg",reason:"Missing lang attribute on SVG with text content"},"svg",null,0));let M0=(T0)=>{let u0=T0.tagName.toLowerCase(),W7=X(u0);for(let t0 of T0.getAttributeNames()){if(t0.startsWith("aria-")&&!nz.has(t0.toLowerCase()))M.push(R({type:"invalid_aria",element:u0,attr:t0,reason:`Unknown ARIA attribute '${t0}'`},u0,t0,W7));if(t0==="role"){let s0=T0.getAttribute("role");if(s0&&!uK.has(s0.toLowerCase()))M.push(R({type:"invalid_aria",element:u0,attr:"role",value:s0,reason:`Invalid role value '${s0}' (valid: ${Array.from(uK).slice(0,5).join(", ")}...)`},u0,"role",W7))}if(t0==="aria-hidden"){let s0=T0.getAttribute("aria-hidden");if(s0&&s0!=="true"&&s0!=="false")M.push(R({type:"invalid_aria",element:u0,attr:"aria-hidden",value:s0,reason:`aria-hidden must be 'true' or 'false', got '${s0}'`},u0,"aria-hidden",W7))}}for(let t0 of T0.children)if(a(t0))M0(t0)};w(),M0(F)};w(),m(F),S(),w(),x(F),w(),d(F),w(),p(F),w(),B(F),w(),r(F),w(),z0(F),w(),T(F),w(),P(F),w(),$0(F),w(),V0(F),w(),h0(F),w(),J0(F),w(),F0(F),w(),I0(F),w(),g(F),w(),n(F),w(),G0(),w(),P0(F),w(),E0(F),w(),U7(F),w(),b7(F),w(),_6(F),w(),RJ(F),w(),BJ(F),eK(),M.sort((D,A)=>{if(D.line!==A.line)return D.line-A.line;return D.column-A.column});let z$=M;if(Z)z$=M.filter((D)=>D.severity===C0.ERROR);let q9=M.filter((D)=>D.severity===C0.ERROR).length,NJ=M.filter((D)=>D.severity===C0.WARNING).length,W9={};for(let D of z$)W9[D.type]=(W9[D.type]||0)+1;let J6={issues:z$,isValid:q9===0,hasErrors:q9>0,hasWarnings:NJ>0,errorCount:q9,warningCount:NJ,issueCount:z$.length,summary:W9};if(K)try{let D=await import("node:fs/promises"),A=await Promise.resolve().then(() => (C6(),I6)),i;switch(Q){case"json":i=JSON.stringify(J6,null,2);break;case"yaml":i=iz(J6);break;case"xml":i=rz(J6);break;case"text":default:i=oz(J6);break}let v=A.normalize(K);await D.writeFile(v,i,"utf8"),J6.outputFile=v}catch(D){J6.exportError=`Failed to write report to '${K}': ${D.message}`}return J6}function oz($){let J=["=".repeat(60),"SVG VALIDATION REPORT","=".repeat(60),"",`Status: ${$.isValid?"VALID":"INVALID"}`,`Errors: ${$.errorCount}`,`Warnings: ${$.warningCount}`,`Total Issues: ${$.issueCount}`,""];if($.issues.length>0){J.push("-".repeat(60)),J.push("ISSUES:"),J.push("-".repeat(60)),J.push("");for(let Z of $.issues){let K=Z.severity.toUpperCase(),Q=`${Z.line}:${Z.column}`;if(J.push(`[${K}] Line ${Q}: ${Z.type}`),Z.element)J.push(` Element: <${Z.element}>`);if(Z.attr)J.push(` Attribute: ${Z.attr}`);if(Z.value)J.push(` Value: ${Z.value}`);if(J.push(` ${Z.reason}`),Z.sourceLine)J.push(` Source: ${Z.sourceLine.trim()}`);J.push("")}}J.push("=".repeat(60)),J.push("SUMMARY BY TYPE:"),J.push("-".repeat(60));for(let[Z,K]of Object.entries($.summary))J.push(` ${Z}: ${K}`);return J.push("=".repeat(60)),J.join(`
|
|
353
|
+
`)}function iz($){let J=["validation_result:",` is_valid: ${$.isValid}`,` has_errors: ${$.hasErrors}`,` has_warnings: ${$.hasWarnings}`,` error_count: ${$.errorCount}`,` warning_count: ${$.warningCount}`,` issue_count: ${$.issueCount}`,""," summary:"];for(let[K,Q]of Object.entries($.summary))J.push(` ${K}: ${Q}`);J.push(""),J.push(" issues:");let Z=(K)=>String(K).replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");for(let K of $.issues){if(J.push(` - type: ${K.type}`),J.push(` severity: ${K.severity}`),J.push(` line: ${K.line}`),J.push(` column: ${K.column}`),K.element)J.push(` element: "${Z(K.element)}"`);if(K.attr)J.push(` attr: "${Z(K.attr)}"`);if(K.value)J.push(` value: "${Z(K.value)}"`);if(J.push(` reason: "${Z(K.reason)}"`),K.sourceLine)J.push(` source_line: "${Z(K.sourceLine)}"`)}return J.join(`
|
|
354
|
+
`)}function rz($){let J=(K)=>String(K).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Z=['<?xml version="1.0" encoding="UTF-8"?>',"<validation_result>",` <is_valid>${$.isValid}</is_valid>`,` <has_errors>${$.hasErrors}</has_errors>`,` <has_warnings>${$.hasWarnings}</has_warnings>`,` <error_count>${$.errorCount}</error_count>`,` <warning_count>${$.warningCount}</warning_count>`,` <issue_count>${$.issueCount}</issue_count>`," <summary>"];for(let[K,Q]of Object.entries($.summary))Z.push(` <${K}>${Q}</${K}>`);Z.push(" </summary>"),Z.push(" <issues>");for(let K of $.issues){if(Z.push(" <issue>"),Z.push(` <type>${J(K.type)}</type>`),Z.push(` <severity>${J(K.severity)}</severity>`),Z.push(` <line>${K.line}</line>`),Z.push(` <column>${K.column}</column>`),K.element)Z.push(` <element>${J(K.element)}</element>`);if(K.attr)Z.push(` <attr>${J(K.attr)}</attr>`);if(K.value)Z.push(` <value>${J(K.value)}</value>`);if(Z.push(` <reason>${J(K.reason)}</reason>`),K.sourceLine)Z.push(` <source_line>${J(K.sourceLine)}</source_line>`);Z.push(" </issue>")}return Z.push(" </issues>"),Z.push("</validation_result>"),Z.join(`
|
|
355
|
+
`)}function iK($){let J=1;for(let Z of $.children)if(a(Z))J+=iK(Z);return J}var UJ=j0(async($,J={})=>{let Z=B7($,{minify:J.minify!==!1}),K=await B6(Z,{precision:J.precision||6,curveSegments:J.curveSegments||20,resolveUse:!0,resolveMarkers:!0,resolvePatterns:!0,resolveMasks:!0,resolveClipPaths:!0,flattenTransforms:!0,bakeGradients:!0,removeUnusedDefs:!0,...J});return d0(K.svg)}),VJ=j0(($,J={})=>{let Z=$.getElementsByTagName("path");for(let K of Z){let Q=K.getAttribute("d");if(!Q)continue;try{let H=u6(Q),z=N9(H,J.precision||6);K.setAttribute("d",z)}catch(H){console.warn(`Failed to simplify path: ${H.message}`,{pathData:Q.substring(0,100)})}}return $}),MJ=j0(($,J={})=>{return BK($,{precision:J.precision??3,removeLinearSplines:J.removeLinearSplines!==!1,optimizeValues:J.optimizeValues!==!1}),$}),OJ=j0(($,J={})=>{return NK($,{floatPrecision:J.floatPrecision??J.precision??3,straightCurves:J.straightCurves!==!1,lineShorthands:J.lineShorthands!==!1,convertToZ:J.convertToZ!==!1,utilizeAbsolute:J.utilizeAbsolute!==!1,straightTolerance:J.straightTolerance??0.5}),$}),YJ=j0(($,J={})=>{let Z=J.tolerance??1,K=J.algorithm??"douglas-peucker",Q=J.respectStroke!==!1,H=i7($),z=(q)=>{if(q.tagName?.toLowerCase()==="path"){let j=q.getAttribute("d");if(j){let G=Z;if(Q){let U=d6(q),O=m6(q,U,H);if(O.hasStroke&&O.strokeWidth.greaterThan(0)){let V=O.strokeWidth.div(4).toNumber();G=Math.min(Z,V)}}let F=l0(j),_=J8(F,G,K);if(_.simplified){let U=n0(_.commands,J.precision??3);q.setAttribute("d",U)}}}for(let j of q.children||[])z(j)};return z($),$}),XJ=j0(($,J={})=>{let Z=(K)=>{let Q=K.getAttribute("transform");if(Q){let H=F7(Q),z=cJ(H);K.setAttribute("data-decomposed",JSON.stringify({translateX:z.translateX.toNumber(),translateY:z.translateY.toNumber(),rotation:z.rotation.toNumber(),scaleX:z.scaleX.toNumber(),scaleY:z.scaleY.toNumber(),skewX:z.skewX.toNumber()}))}for(let H of K.children)if(a(H))Z(H)};return Z($),$});function a$($,J){let Z=$.tagName.toLowerCase();try{if(Z==="path"){let K=$.getAttribute("d");if(!K)return null;let Q=u6(K),H=[],z=0,q=0;for(let W of Q)if(W.command==="M"||W.command==="L")z=W.args[0].toNumber(),q=W.args[1].toNumber(),H.push({x:z,y:q});return H}if(Z==="rect"){let K=$.getAttribute("x")||"0",Q=$.getAttribute("y")||"0",H=$.getAttribute("width")||"0",z=$.getAttribute("height")||"0";if(m7(K)||m7(Q)||m7(H)||m7(z))return null;let q=parseFloat(K),W=parseFloat(Q),j=parseFloat(H),G=parseFloat(z);if(isNaN(q)||isNaN(W)||isNaN(j)||isNaN(G))return null;return[{x:q,y:W},{x:q+j,y:W},{x:q+j,y:W+G},{x:q,y:W+G}]}if(Z==="circle"){let K=parseFloat($.getAttribute("cx")||"0"),Q=parseFloat($.getAttribute("cy")||"0"),H=parseFloat($.getAttribute("r")||"0");if(isNaN(K)||isNaN(Q)||isNaN(H))return null;let z=[];for(let q=0;q<J;q++){let W=q/J*2*Math.PI;z.push({x:K+H*Math.cos(W),y:Q+H*Math.sin(W)})}return z}return null}catch(K){return console.warn(`getShapePolygon failed for ${Z}:`,K.message),null}}var az={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".webp":"image/webp",".avif":"image/avif",".ico":"image/x-icon",".bmp":"image/bmp",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject",".wav":"audio/wav",".mp3":"audio/mpeg",".ogg":"audio/ogg",".m4a":"audio/mp4",".aac":"audio/aac",".flac":"audio/flac",".webm":"audio/webm",".mp4":"video/mp4",".ogv":"video/ogg",".mov":"video/quicktime",".css":"text/css",".js":"text/javascript"};function kJ(){return typeof process!=="undefined"&&process.versions?.node}function gK($){if(!$||typeof $!=="string")return!1;if($.startsWith("#"))return!1;if($.startsWith("data:"))return!1;return!0}function tz($){let J=$.indexOf("#");if(J===-1)return{path:$,fragment:null};return{path:$.substring(0,J),fragment:$.substring(J+1)}}function t$($){let J=($.match(/\.[a-z0-9]+$/i)||[""])[0].toLowerCase();return az[J]||"application/octet-stream"}function g7($,J){if(!$)return $;if($.match(/^https?:\/\//i))return $;if($.startsWith("data:"))return $;if($.startsWith("file://"))return $;if(!J)return $;if(J.match(/^https?:\/\//i))try{return new URL($,J).href}catch(K){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${K.message}`);return $}if(kJ())try{let K=(C6(),EJ(I6)),Q=J.endsWith("/")?J:K.dirname(J),H=K.resolve(Q,$),z=K.resolve(Q);if(!H.startsWith(z+K.sep)&&H!==z)return console.warn(`Path traversal blocked: ${$} escapes base directory`),$;return H}catch(K){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${K.message}`);let Q=J.endsWith("/")?J:J.substring(0,J.lastIndexOf("/")+1);if($.includes("..")||$.startsWith("/"))return console.warn(`Unsafe path pattern blocked in fallback: ${$}`),$;return Q+$}let Z=J.endsWith("/")?J:J.substring(0,J.lastIndexOf("/")+1);if($.includes("..")||$.startsWith("/"))return console.warn(`Unsafe path pattern blocked: ${$}`),$;return Z+$}async function x7($,J="text",Z=30000){if(kJ()&&!$.match(/^https?:\/\//i)){let H=await import("node:fs/promises");return{content:J==="binary"?await H.readFile($):await H.readFile($,"utf8"),contentType:t$($)}}let K=new AbortController,Q=setTimeout(()=>K.abort(),Z);try{let H=await fetch($,{signal:K.signal});if(!H.ok)throw new Error(`HTTP ${H.status}: ${H.statusText}`);let z=H.headers.get("content-type")||t$($);return{content:J==="binary"?await H.arrayBuffer():await H.text(),contentType:z}}finally{clearTimeout(Q)}}function t6($,J){let Z;if(kJ())Z=Buffer.from($).toString("base64");else{let K=new Uint8Array($),Q="";for(let H=0;H<K.length;H++)Q+=String.fromCharCode(K[H]);Z=btoa(Q)}return`data:${J};base64,${Z}`}function H8($){let J=[],Z=[],K=/@import\s+(?:url\(\s*["']?([^"')]+)["']?\s*\)|["']([^"']+)["'])/gi,Q,H=0;while((Q=K.exec($))!==null){if(Q.index===H&&Q[0].length===0){console.error("Regex matched empty string in @import, breaking to prevent infinite loop");break}H=Q.index+Math.max(1,Q[0].length),J.push({url:Q[1]||Q[2],fullMatch:Q[0],index:Q.index})}let z=/url\(\s*["']?([^"')]+)["']?\s*\)/gi,q=0;while((Q=z.exec($))!==null){if(Q.index===q&&Q[0].length===0){console.error("Regex matched empty string in url(), breaking to prevent infinite loop");break}if(q=Q.index+Math.max(1,Q[0].length),$.substring(Math.max(0,Q.index-10),Q.index).includes("@import"))continue;if(Q[1].startsWith("#"))continue;if(Q[1].startsWith("data:"))continue;Z.push({url:Q[1],fullMatch:Q[0],index:Q.index})}return{imports:J,urls:Z}}function W8($,J,Z=new Map){if(!$)return Z;let K=$.getAttribute?.("id");if(K){let z=J+K;Z.set(K,z),$.setAttribute("id",z)}let Q=["href","xlink:href","fill","stroke","clip-path","mask","filter","marker-start","marker-mid","marker-end"];for(let z of Q){let q=$.getAttribute?.(z);if(!q)continue;if(q.includes("url(#")){let W=q.replace(/url\(#([^)]+)\)/g,(j,G)=>{return`url(#${Z.get(G)||J+G})`});$.setAttribute(z,W)}else if(q.startsWith("#")){let W=q.substring(1);$.setAttribute(z,"#"+(Z.get(W)||J+W))}}let H=$.getAttribute?.("style");if(H&&H.includes("url(#")){let z=H.replace(/url\(#([^)]+)\)/g,(q,W)=>{return`url(#${Z.get(W)||J+W})`});$.setAttribute("style",z)}if($.children)for(let z of $.children)W8(z,J,Z);return Z}function rK($,J,Z){if(!$){console.warn("setCDATAContent called with null element");return}let K=0,Q=1e4;while($.firstChild&&K++<Q){let z=$.firstChild;if($.removeChild(z),$.firstChild===z){console.error("removeChild failed to remove child in setCDATAContent, breaking to prevent infinite loop");break}}if(K>=Q)console.error(`Safety limit reached in setCDATAContent: ${Q} children processed`);let H=J.includes("<")||J.includes("&")||J.includes("]]>");if(H&&typeof Z.createCDATASection==="function")if(J.includes("]]>")){let z=J.split("]]>");for(let q=0;q<z.length;q++)if(q===0)$.appendChild(Z.createCDATASection(z[q]+"]]"));else if(q===z.length-1)$.appendChild(Z.createCDATASection(">"+z[q]));else $.appendChild(Z.createCDATASection(">"+z[q]+"]]"))}else $.appendChild(Z.createCDATASection(J));else if(H){let z=J.replace(/\]\]>/g,"]]]]><![CDATA[>");$.setAttribute("data-cdata-pending","true"),$.textContent=z}else $.textContent=J}var ez={audio:[".wav",".mp3",".ogg",".webm",".m4a",".aac",".flac"],image:[".png",".jpg",".jpeg",".gif",".svg",".webp",".avif",".ico",".bmp"],video:[".mp4",".webm",".ogv",".avi",".mov"],data:[".json",".xml",".txt",".csv",".tsv"],font:[".woff",".woff2",".ttf",".otf",".eot"]},$q=Object.values(ez).flat();function Jq($){let J=new Set,Z=$q.map((H)=>H.replace(".","\\.")).join("|"),K=new RegExp(`["'\`]([^"'\`]*(?:${Z}))["'\`]`,"gi"),Q;while((Q=K.exec($))!==null){let H=Q[1];if(H&&!H.startsWith("data:")&&!H.match(/^https?:\/\/(?!localhost)/)&&H.length>0)J.add(H)}return J}function Kq($){if($.size===0)return"";let J={};for(let[Z,K]of $)J[Z]=K;return`
|
|
356
|
+
// ===== EMBEDDED RESOURCES INTERCEPTOR (auto-generated) =====
|
|
357
|
+
(function() {
|
|
358
|
+
var __EMBEDDED_RESOURCES__ = ${JSON.stringify(J,null,0)};
|
|
359
|
+
|
|
360
|
+
// Helper to normalize paths for lookup
|
|
361
|
+
function normalizePath(url) {
|
|
362
|
+
if (!url || typeof url !== 'string') return url;
|
|
363
|
+
// Handle relative paths: ./foo, ../foo, foo
|
|
364
|
+
var normalized = url.replace(/^\\.?\\//, '');
|
|
365
|
+
// Try exact match first
|
|
366
|
+
if (__EMBEDDED_RESOURCES__[url]) return url;
|
|
367
|
+
if (__EMBEDDED_RESOURCES__['./' + normalized]) return './' + normalized;
|
|
368
|
+
if (__EMBEDDED_RESOURCES__[normalized]) return normalized;
|
|
369
|
+
// Try without leading ./ (hasOwnProperty check for safety with prototype pollution)
|
|
370
|
+
// BUG FIX: Use stricter path matching to avoid false positives
|
|
371
|
+
// Only match if the suffix is a complete path segment (after / or start of string)
|
|
372
|
+
for (var key in __EMBEDDED_RESOURCES__) {
|
|
373
|
+
if (Object.prototype.hasOwnProperty.call(__EMBEDDED_RESOURCES__, key)) {
|
|
374
|
+
var keyBase = key.replace(/^\\.?\\//, '');
|
|
375
|
+
var normalizedBase = normalized.replace(/^\\.?\\//, '');
|
|
376
|
+
// Check for exact filename match (case: key="./dir/file.wav", normalized="file.wav")
|
|
377
|
+
if (keyBase === normalizedBase) return key;
|
|
378
|
+
// Check if normalized ends with /keyBase or starts with keyBase
|
|
379
|
+
if (key.endsWith('/' + normalizedBase) || normalizedBase.endsWith('/' + keyBase)) {
|
|
380
|
+
return key;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return url;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// Override XMLHttpRequest.open to intercept resource loading
|
|
388
|
+
var __originalXHROpen__ = XMLHttpRequest.prototype.open;
|
|
389
|
+
XMLHttpRequest.prototype.open = function(method, url) {
|
|
390
|
+
var normalizedUrl = normalizePath(url);
|
|
391
|
+
if (__EMBEDDED_RESOURCES__[normalizedUrl]) {
|
|
392
|
+
this.__embeddedUrl__ = normalizedUrl;
|
|
393
|
+
}
|
|
394
|
+
return __originalXHROpen__.apply(this, arguments);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
// Override XMLHttpRequest.send to serve embedded resources
|
|
398
|
+
var __originalXHRSend__ = XMLHttpRequest.prototype.send;
|
|
399
|
+
XMLHttpRequest.prototype.send = function() {
|
|
400
|
+
if (this.__embeddedUrl__) {
|
|
401
|
+
var xhr = this;
|
|
402
|
+
var dataUri = __EMBEDDED_RESOURCES__[this.__embeddedUrl__];
|
|
403
|
+
// Simulate async response
|
|
404
|
+
setTimeout(function() {
|
|
405
|
+
// Convert data URI to ArrayBuffer for audio/binary (validate comma exists in data URI)
|
|
406
|
+
var commaIdx = dataUri.indexOf(',');
|
|
407
|
+
if (commaIdx === -1) {
|
|
408
|
+
// BUG FIX: Properly signal error state instead of silently returning
|
|
409
|
+
console.error('Invalid data URI format: missing comma separator');
|
|
410
|
+
Object.defineProperty(xhr, 'status', { value: 400, writable: false });
|
|
411
|
+
Object.defineProperty(xhr, 'readyState', { value: 4, writable: false });
|
|
412
|
+
if (xhr.onerror) {
|
|
413
|
+
var errorEvent = new ProgressEvent('error');
|
|
414
|
+
xhr.onerror.call(xhr, errorEvent);
|
|
415
|
+
}
|
|
416
|
+
if (xhr.onreadystatechange) {
|
|
417
|
+
var stateEvent = new Event('readystatechange');
|
|
418
|
+
xhr.onreadystatechange.call(xhr, stateEvent);
|
|
419
|
+
}
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
var base64 = dataUri.substring(commaIdx + 1);
|
|
423
|
+
var binary = atob(base64);
|
|
424
|
+
var len = binary.length;
|
|
425
|
+
var bytes = new Uint8Array(len);
|
|
426
|
+
for (var i = 0; i < len; i++) {
|
|
427
|
+
bytes[i] = binary.charCodeAt(i);
|
|
428
|
+
}
|
|
429
|
+
Object.defineProperty(xhr, 'response', { value: bytes.buffer, writable: false });
|
|
430
|
+
Object.defineProperty(xhr, 'responseType', { value: 'arraybuffer', writable: false });
|
|
431
|
+
Object.defineProperty(xhr, 'status', { value: 200, writable: false });
|
|
432
|
+
Object.defineProperty(xhr, 'readyState', { value: 4, writable: false });
|
|
433
|
+
// Create a proper ProgressEvent and call handlers with correct 'this' context
|
|
434
|
+
var loadEvent = new ProgressEvent('load', { lengthComputable: true, loaded: len, total: len });
|
|
435
|
+
if (xhr.onload) xhr.onload.call(xhr, loadEvent);
|
|
436
|
+
// BUG FIX: Pass Event object to onreadystatechange per XHR spec
|
|
437
|
+
if (xhr.onreadystatechange) {
|
|
438
|
+
var stateEvent = new Event('readystatechange');
|
|
439
|
+
xhr.onreadystatechange.call(xhr, stateEvent);
|
|
440
|
+
}
|
|
441
|
+
}, 0);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
return __originalXHRSend__.apply(this, arguments);
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
// Override fetch to serve embedded resources
|
|
448
|
+
if (typeof fetch !== 'undefined') {
|
|
449
|
+
var __originalFetch__ = fetch;
|
|
450
|
+
window.fetch = function(url, options) {
|
|
451
|
+
var urlStr = typeof url === 'string' ? url : (url.url || url.toString());
|
|
452
|
+
var normalizedUrl = normalizePath(urlStr);
|
|
453
|
+
if (__EMBEDDED_RESOURCES__[normalizedUrl]) {
|
|
454
|
+
var dataUri = __EMBEDDED_RESOURCES__[normalizedUrl];
|
|
455
|
+
return __originalFetch__(dataUri, options);
|
|
456
|
+
}
|
|
457
|
+
return __originalFetch__.apply(this, arguments);
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// Override Audio constructor to serve embedded resources
|
|
462
|
+
if (typeof Audio !== 'undefined') {
|
|
463
|
+
var __OriginalAudio__ = Audio;
|
|
464
|
+
window.Audio = function(src) {
|
|
465
|
+
var normalizedSrc = normalizePath(src);
|
|
466
|
+
if (__EMBEDDED_RESOURCES__[normalizedSrc]) {
|
|
467
|
+
return new __OriginalAudio__(__EMBEDDED_RESOURCES__[normalizedSrc]);
|
|
468
|
+
}
|
|
469
|
+
return new __OriginalAudio__(src);
|
|
470
|
+
};
|
|
471
|
+
window.Audio.prototype = __OriginalAudio__.prototype;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// Override Image.src to serve embedded resources
|
|
475
|
+
var __originalImageSrcDescriptor__ = Object.getOwnPropertyDescriptor(HTMLImageElement.prototype, 'src');
|
|
476
|
+
if (__originalImageSrcDescriptor__) {
|
|
477
|
+
Object.defineProperty(HTMLImageElement.prototype, 'src', {
|
|
478
|
+
set: function(val) {
|
|
479
|
+
var normalizedVal = normalizePath(val);
|
|
480
|
+
if (__EMBEDDED_RESOURCES__[normalizedVal]) {
|
|
481
|
+
__originalImageSrcDescriptor__.set.call(this, __EMBEDDED_RESOURCES__[normalizedVal]);
|
|
482
|
+
} else {
|
|
483
|
+
__originalImageSrcDescriptor__.set.call(this, val);
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
get: __originalImageSrcDescriptor__.get
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
})();
|
|
490
|
+
// ===== END EMBEDDED RESOURCES INTERCEPTOR =====
|
|
491
|
+
|
|
492
|
+
`}function Zq($){let J=new Map,Z=(Q,H)=>{if(!Q||!H)return;let z=Q.replace(/['"]/g,"").trim().split(",")[0].trim();if(!J.has(z))J.set(z,new Set);let q=J.get(z);for(let W of H)q.add(W)},K=(Q)=>{if(!Q)return;let z=(Q.getAttribute?.("style")||"").match(/font-family:\s*([^;]+)/i),q=z?z[1]:null,W=Q.getAttribute?.("font-family"),j=Q.getAttribute?.("face"),G=q||W||j,F="";if(Q.childNodes){for(let _ of Q.childNodes)if(_.nodeType===3)F+=_.nodeValue||""}if(G&&F.trim())Z(G,F);if(Q.tagName==="text"||Q.tagName==="tspan"){let _=G;if(!_&&Q.parentNode){let O=(Q.parentNode.getAttribute?.("style")||"").match(/font-family:\s*([^;]+)/i);_=O?O[1]:Q.parentNode.getAttribute?.("font-family")}if(_&&F.trim())Z(_,F)}if(Q.children)for(let _ of Q.children)K(_)};return K($),J}function Qq($){let J=[...$].sort().join("");return encodeURIComponent(J)}function Hq($){return $&&($.includes("fonts.googleapis.com")||$.includes("fonts.gstatic.com"))}function zq($){try{let Z=new URL($).searchParams.get("family");if(Z)return Z.split(":")[0].replace(/\+/g," ")}catch(J){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${J.message}`);let Z=$.match(/family=([^&:]+)/);if(Z)return Z[1].replace(/\+/g," ")}return null}function qq($,J){if(!J)return $;try{let Z=new URL($);return Z.searchParams.set("text",decodeURIComponent(J)),Z.toString()}catch(Z){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${Z.message}`);let K=$.includes("?")?"&":"?";return`${$}${K}text=${J}`}}var z9=j0(async($,J={})=>{let{basePath:Z="",embedImages:K=!0,embedExternalSVGs:Q=!0,externalSVGMode:H="extract",embedCSS:z=!0,embedFonts:q=!0,embedScripts:W=!0,embedAudio:j=!1,subsetFonts:G=!0,verbose:F=!1,recursive:_=!0,maxRecursionDepth:U=10,timeout:O=30000,onMissingResource:V="warn",onProgress:M=null,idPrefix:Y="ext_",_visitedURLs:X=null}=J,w=X||new Set,R=[],I=new Map,f=0,u=(h)=>{if(!h||!h.attributes)return;let E=["http://www.inkscape.org/namespaces/inkscape","http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd","http://ns.adobe.com/AdobeIllustrator/","http://ns.adobe.com/AdobeSVGViewerExtensions/","http://www.bohemiancoding.com/sketch/ns","http://www.figma.com/figma/ns","http://www.serif.com/","http://www.vecta.io/nano"],d=["http://www.w3.org/2000/svg","http://www.w3.org/1999/xlink","http://www.w3.org/XML/1998/namespace","http://www.w3.org/2000/xmlns/"],c=h.attributes;for(let p=0;p<c.length;p++){let N=c[p];if(N.name.startsWith("xmlns:")){let y=N.name.substring(6),B=N.value;if(E.some((e)=>B.startsWith(e))||!d.includes(B))I.set(y,B)}}},m=(h,E)=>{let d=`Failed to fetch resource: ${h} - ${E.message}`;if(V==="fail")throw new Error(d);else if(V==="warn")R.push(d),console.warn("embedExternalDependencies:",d);return null};if(K){let E=[...$.getElementsByTagName("image")];if(M)M("images",0,E.length);for(let d=0;d<E.length;d++){let c=E[d],p=c.getAttribute("href")||c.getAttribute("xlink:href");if(!p||!gK(p))continue;try{let N=g7(p,Z),{content:y,contentType:B}=await x7(N,"binary",O),e=t6(y,B.split(";")[0]);if(c.getAttribute("href"))c.setAttribute("href",e);if(c.getAttribute("xlink:href"))c.setAttribute("xlink:href",e)}catch(N){m(p,N)}if(M)M("images",d+1,E.length)}}if(Q){let E=[...$.getElementsByTagName("use")];if(M)M("externalSVGs",0,E.length);let d=$.querySelector("defs");if(!d){let c=$.documentElement||$;if(!c){if(R.push("Cannot add defs: document has no root SVG element"),M)M("externalSVGs",E.length,E.length)}else if(d=new B0("defs",{},[]),typeof c.insertBefore==="function"&&c.firstChild)c.insertBefore(d,c.firstChild);else if(typeof c.appendChild==="function")c.appendChild(d);else if(c.children&&Array.isArray(c.children))c.children.unshift(d),d.parentNode=c}if(d)for(let c=0;c<E.length;c++){let p=E[c],N=p.getAttribute("href")||p.getAttribute("xlink:href");if(!N||!gK(N))continue;let{path:y,fragment:B}=tz(N);if(!y)continue;let e=g7(y,Z);if(w.has(e)){R.push(`Circular reference detected: ${e}`);continue}w.add(e);try{let{content:r}=await x7(e,"text",O),s=d0(r);if(!s){m(y,new Error("Failed to parse SVG"));continue}let z0=s.documentElement||s;if(u(z0),_&&U>0)await z9(s,{...J,basePath:e,maxRecursionDepth:U-1,_visitedURLs:w});f++;let T=`${Y}${f}_`;if(H==="extract"&&B){let P=s.getElementById(B);if(P){let t=P.clone?P.clone():JSON.parse(JSON.stringify(P));W8(t,T),d.children.push(t);let $0=T+B;if(p.getAttribute("href"))p.setAttribute("href","#"+$0);if(p.getAttribute("xlink:href"))p.setAttribute("xlink:href","#"+$0)}else m(N,new Error(`Fragment #${B} not found in ${y}`))}else{let P=s.documentElement||s;W8(P,T);let t=T+"svg";P.setAttribute("id",t),d.children.push(P);let $0=B?"#"+T+B:"#"+t;if(p.getAttribute("href"))p.setAttribute("href",$0);if(p.getAttribute("xlink:href"))p.setAttribute("xlink:href",$0)}}catch(r){m(y,r)}if(M)M("externalSVGs",c+1,E.length)}}if(z||q){let E=[...$.getElementsByTagName("style")];if(M)M("stylesheets",0,E.length);let d=G?Zq($):null;for(let c=0;c<E.length;c++){let p=E[c],N=p.textContent||"";if(z){let{imports:y}=H8(N);for(let B of y.reverse())try{let e=B.url;if(d&&Hq(e)){let P=zq(e);if(P&&d.has(P)){let t=Qq(d.get(P));if(e=qq(e,t),F)console.log(`Font subsetting: ${P} -> ${d.get(P).size} chars`)}}let r=g7(e,Z),{content:s}=await x7(r,"text",O),z0=s,T=H8(s).imports;if(T.length>0)for(let P of T.reverse())try{let t=g7(P.url,r),$0=await x7(t,"text",O);z0=z0.substring(0,P.index)+$0.content+z0.substring(P.index+P.fullMatch.length)}catch(t){m(P.url,t)}N=N.substring(0,B.index)+z0+N.substring(B.index+B.fullMatch.length)}catch(e){m(B.url,e)}}if(z||q){let{urls:y}=H8(N);for(let B of y.reverse()){let e=t$(B.url),r=e.startsWith("font/")||e.includes("fontobject");if(r&&!q)continue;if(!r&&!z)continue;try{let s=g7(B.url,Z),{content:z0,contentType:T}=await x7(s,"binary",O),t=`url("${t6(z0,T.split(";")[0])}")`;N=N.substring(0,B.index)+t+N.substring(B.index+B.fullMatch.length)}catch(s){m(B.url,s)}}}if(p.textContent=N,M)M("stylesheets",c+1,E.length)}}if(W){let E=[...$.getElementsByTagName("script")];if(M)M("scripts",0,E.length);for(let d=0;d<E.length;d++){let c=E[d],p=c.getAttribute("src")||c.getAttribute("href")||c.getAttribute("xlink:href");if(!p)continue;if(p.startsWith("data:"))continue;try{let N=g7(p,Z),{content:y}=await x7(N,"text",O);c.removeAttribute("src"),c.removeAttribute("href"),c.removeAttribute("xlink:href"),rK(c,y,$)}catch(N){m(p,N)}if(M)M("scripts",d+1,E.length)}}if(j){let E=[...$.getElementsByTagName("audio")];if(M)M("audio",0,E.length);for(let d=0;d<E.length;d++){let c=E[d],p=c.getAttribute("src");if(p&&!p.startsWith("data:"))try{let y=g7(p,Z),{content:B,contentType:e}=await x7(y,"binary",O),r=e.split(";")[0]||"audio/mpeg",s=t6(B,r);c.setAttribute("src",s)}catch(y){m(p,y)}let N=c.getElementsByTagName("source");for(let y of N){let B=y.getAttribute("src");if(B&&!B.startsWith("data:"))try{let e=g7(B,Z),{content:r,contentType:s}=await x7(e,"binary",O),z0=s.split(";")[0]||y.getAttribute("type")||"audio/mpeg",T=t6(r,z0);y.setAttribute("src",T)}catch(e){m(B,e)}}if(M)M("audio",d+1,E.length)}}if(W){let h=[],E=$.getElementsByTagName("script");for(let N of E)if(N.textContent)h.push(N.textContent);let d=$.getElementsByTagName("style");for(let N of d)if(N.textContent)h.push(N.textContent);let c=$.getElementsByTagName("foreignObject");for(let N of c){let y=N.textContent||"";if(y)h.push(y)}let p=new Set;for(let N of h){let y=Jq(N);for(let B of y)p.add(B)}if(p.size>0){let N=new Map;if(M)M("resources",0,p.size);let y=0;for(let B of p){try{let e=g7(B,Z),{content:r,contentType:s}=await x7(e,"binary",O),z0=s.split(";")[0]||t$(B),T=t6(r,z0);if(N.set(B,T),F){let P=(r.length/1024).toFixed(1);console.log(`Embedded resource: ${B} (${P} KB)`)}}catch(e){m(B,e)}if(y++,M)M("resources",y,p.size)}if(N.size>0){let B=Kq(N),e=E[0];if(e){let r=e.textContent||"";if(B.includes("<")||B.includes("&")||r.includes("<")||r.includes("&"))e.setAttribute("data-cdata-pending","true");e.textContent=B+r}else{let r=$.createElement("script");r.setAttribute("type","text/javascript"),r.setAttribute("data-cdata-pending","true"),r.textContent=B;let s=$.documentElement||$;if(s.firstChild)s.insertBefore(r,s.firstChild);else s.appendChild(r)}if(F)console.log(`Injected resource interceptor for ${N.size} embedded resources`)}}}let S=$.documentElement||$;if(!S.getAttribute("xmlns"))S.setAttribute("xmlns","http://www.w3.org/2000/svg");if(B7($).includes("xlink:")&&!S.getAttribute("xmlns:xlink"))S.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");for(let[h,E]of I){let d=`xmlns:${h}`;if(!S.getAttribute(d))S.setAttribute(d,E)}if(R.length>0)$._embedWarnings=R;return $}),Wq={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/svg+xml":".svg","image/bmp":".bmp","image/x-icon":".ico","image/tiff":".tiff","audio/mpeg":".mp3","audio/wav":".wav","audio/ogg":".ogg","audio/webm":".webm","audio/aac":".aac","audio/flac":".flac","video/mp4":".mp4","video/webm":".webm","video/ogg":".ogv","video/quicktime":".mov","application/javascript":".js","text/javascript":".js","text/css":".css","font/woff":".woff","font/woff2":".woff2","font/ttf":".ttf","font/otf":".otf","application/font-woff":".woff","application/font-woff2":".woff2","application/x-font-ttf":".ttf","application/x-font-opentype":".otf"};function W6($){if(!$||!$.startsWith("data:"))return null;let J=$.match(/^data:([^;,]+)?(?:;([^,]+))?,(.*)$/);if(!J)return null;let Z=J[1]||"application/octet-stream",K=J[2]||"",Q=J[3]||"";return{mimeType:Z,encoding:K,data:Q}}function j6($){if($.encoding==="base64")return Buffer.from($.data,"base64");try{return decodeURIComponent($.data)}catch(J){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${J.message}`);return $.data}}function $6($,J,Z,K=null){let Q=Wq[J]||".bin";if(K){let z=K.replace(/[^a-zA-Z0-9._-]/g,"_");return`${$}_${z}`}let H="resource";if(J.startsWith("image/"))H="image";else if(J.startsWith("audio/"))H="audio";else if(J.startsWith("video/"))H="video";else if(J.startsWith("font/")||J.includes("font"))H="font";else if(J.includes("javascript"))H="script";else if(J.includes("css"))H="style";return`${$}_${H}_${String(Z).padStart(3,"0")}${Q}`}async function LJ($,J={}){let Z=E6($),K=await T6($,Z),Q=J.outputFormat||(Z===S0.DOM_ELEMENT?q7.DOM_ELEMENT:q7.SVG_STRING),{outputDir:H=null,filenamePrefix:z="resource",extractImages:q=!0,extractFonts:W=!0,extractScripts:j=!0,extractStyles:G=!0,extractAudio:F=!0,extractVideo:_=!0,elementIds:U=null,restoreGoogleFonts:O=!0,dryRun:V=!1,extractOnly:M=!1,onProgress:Y=null}=J,X=[],w=[],R=0,I=U?new Set(Array.isArray(U)?U:[U]):null,f=(S)=>{if(!I)return!0;let x=S;while(x&&x.getAttribute){let h=x.getAttribute("id");if(h&&I.has(h))return!0;x=x.parentNode}return!1},u=async(S,x,h)=>{let E=0;if(typeof Buffer!=="undefined"&&Buffer.isBuffer(x))E=x.length;else if(typeof Buffer!=="undefined")E=Buffer.byteLength(x,"utf8");else if(typeof Blob!=="undefined")E=new Blob([x]).size;else E=x.length||0;let d={filename:S,path:H?`${H}/${S}`:S,mimeType:h,size:E};if(!V&&H)try{let c=await import("node:fs/promises"),p=await Promise.resolve().then(() => (C6(),I6));await c.mkdir(H,{recursive:!0});let N=p.join(H,S);if(typeof Buffer!=="undefined"&&Buffer.isBuffer(x))await c.writeFile(N,x);else await c.writeFile(N,x,"utf8");d.path=N,X.push(d)}catch(c){w.push(`Failed to save ${S}: ${c.message}`),d.error=c.message}else X.push(d);return d};if(q){let x=[...K.getElementsByTagName("image")];if(Y)Y("images",0,x.length);for(let h=0;h<x.length;h++){let E=x[h];if(!f(E))continue;let d=E.getAttribute("href")||E.getAttribute("xlink:href");if(!d||!d.startsWith("data:"))continue;let c=W6(d);if(!c)continue;if(!c.mimeType.startsWith("image/"))continue;R++;let p=$6(z,c.mimeType,R),N=j6(c),y=await u(p,N,c.mimeType);if(y.type="image",y.elementId=E.getAttribute("id"),!M){let B=`./${p}`;if(E.getAttribute("href"))E.setAttribute("href",B);if(E.getAttribute("xlink:href"))E.setAttribute("xlink:href",B)}if(Y)Y("images",h+1,x.length)}}if(F){let x=[...K.getElementsByTagName("audio")];if(Y)Y("audio",0,x.length);for(let h=0;h<x.length;h++){let E=x[h];if(!f(E))continue;let d=E.getAttribute("src");if(d&&d.startsWith("data:")){let p=W6(d);if(p&&p.mimeType.startsWith("audio/")){R++;let N=$6(z,p.mimeType,R),y=j6(p),B=await u(N,y,p.mimeType);if(B.type="audio",B.elementId=E.getAttribute("id"),!M)E.setAttribute("src",`./${N}`)}}let c=E.getElementsByTagName("source");for(let p of c){let N=p.getAttribute("src");if(N&&N.startsWith("data:")){let y=W6(N);if(y&&y.mimeType.startsWith("audio/")){R++;let B=$6(z,y.mimeType,R),e=j6(y),r=await u(B,e,y.mimeType);if(r.type="audio",!M)p.setAttribute("src",`./${B}`)}}}if(Y)Y("audio",h+1,x.length)}}if(_){let x=[...K.getElementsByTagName("video")];if(Y)Y("video",0,x.length);for(let h=0;h<x.length;h++){let E=x[h];if(!f(E))continue;let d=E.getAttribute("src");if(d&&d.startsWith("data:")){let p=W6(d);if(p&&p.mimeType.startsWith("video/")){R++;let N=$6(z,p.mimeType,R),y=j6(p),B=await u(N,y,p.mimeType);if(B.type="video",B.elementId=E.getAttribute("id"),!M)E.setAttribute("src",`./${N}`)}}let c=E.getElementsByTagName("source");for(let p of c){let N=p.getAttribute("src");if(N&&N.startsWith("data:")){let y=W6(N);if(y&&y.mimeType.startsWith("video/")){R++;let B=$6(z,y.mimeType,R),e=j6(y),r=await u(B,e,y.mimeType);if(r.type="video",!M)p.setAttribute("src",`./${B}`)}}}if(Y)Y("video",h+1,x.length)}}if(j){let x=[...K.getElementsByTagName("script")];if(Y)Y("scripts",0,x.length);for(let h=0;h<x.length;h++){let E=x[h];if(!f(E))continue;let d=E.getAttribute("href")||E.getAttribute("xlink:href");if(d&&!d.startsWith("data:"))continue;let c="";if(d&&d.startsWith("data:")){let y=W6(d);if(y){let B=j6(y);c=typeof B==="string"?B:B.toString("utf8")}}else if(c=E.textContent||"",E.firstChild&&E.firstChild.nodeType===4)c=E.firstChild.nodeValue||"";if(!c.trim())continue;R++;let p=$6(z,"application/javascript",R),N=await u(p,c,"application/javascript");if(N.type="script",N.elementId=E.getAttribute("id"),!M){let y=0;while(E.firstChild&&y++<1e4){let B=E.firstChild;if(E.removeChild(B),E.firstChild===B)break}if(y>=1e4)console.error("Safety limit reached removing script children: 10000 iterations");E.setAttribute("href",`./${p}`)}if(Y)Y("scripts",h+1,x.length)}}if(G||W){let x=[...K.getElementsByTagName("style")];if(Y)Y("styles",0,x.length);for(let h=0;h<x.length;h++){let E=x[h];if(!f(E))continue;let d=E.textContent||"";if(E.firstChild&&E.firstChild.nodeType===4)d=E.firstChild.nodeValue||"";if(!d.trim())continue;let c=!1;if(W){let p=/@font-face\s*\{[^}]*\}/gi,N=d.match(p)||[];for(let y of N){let B=y.match(/src:\s*url\(["']?(data:[^"')]+)["']?\)/);if(B){let e=B[1],r=W6(e);if(r){R++;let s=$6(z,r.mimeType,R),z0=j6(r),T=await u(s,z0,r.mimeType);T.type="font";let P=y.match(/font-family:\s*["']?([^"';]+)["']?/);if(P)T.fontFamily=P[1].trim();if(!M)d=d.replace(e,`./${s}`),c=!0}}}if(O){let y=[],B=/font-family:\s*["']?([^"';,]+)/gi,e;while((e=B.exec(d))!==null){let r=e[1].trim();if(["Roboto","Open Sans","Lato","Montserrat","Oswald","Raleway","Poppins","Source Sans Pro","Ubuntu","Playfair Display","Merriweather","Nunito","PT Sans","Rubik","Work Sans","DM Serif Display","Monofett","Dokdo","Orbitron","Notable","Fira Mono","Fira Code","Inter","Noto Sans","Noto Serif"].some((z0)=>r.toLowerCase().includes(z0.toLowerCase())))y.push(r)}if(y.length>0&&!M){let r=[...new Set(y)],s=`@import url('https://fonts.googleapis.com/css2?family=${r.map((z0)=>z0.replace(/\s+/g,"+")).join("&family=")}&display=swap');
|
|
493
|
+
`;if(!d.includes("fonts.googleapis.com"))d=s+d,c=!0,w.push(`Restored Google Fonts import for: ${r.join(", ")}`)}}}if(G&&d.trim()){R++;let p=$6(z,"text/css",R),N=await u(p,d,"text/css");if(N.type="stylesheet",N.elementId=E.getAttribute("id"),!M){let y=0;while(E.firstChild&&y++<1e4){let B=E.firstChild;if(E.removeChild(B),E.firstChild===B)break}if(y>=1e4)console.error("Safety limit reached removing style children: 10000 iterations");E.textContent=`@import url('./${p}');`,c=!0}}else if(c&&!M){let p=0;while(E.firstChild&&p++<1e4){let N=E.firstChild;if(E.removeChild(N),E.firstChild===N)break}if(p>=1e4)console.error("Safety limit reached updating style children: 10000 iterations");rK(E,d,K)}if(Y)Y("styles",h+1,x.length)}}if(!M){if(K._exportedResources=X,w.length>0)K._exportWarnings=w}return{doc:M?null:b6(K,Q,J),extractedFiles:X,warnings:w,summary:{totalExtracted:X.length,images:X.filter((S)=>S.type==="image").length,audio:X.filter((S)=>S.type==="audio").length,video:X.filter((S)=>S.type==="video").length,scripts:X.filter((S)=>S.type==="script").length,fonts:X.filter((S)=>S.type==="font").length,stylesheets:X.filter((S)=>S.type==="stylesheet").length,totalSize:X.reduce((S,x)=>S+x.size,0)}}}var jq={MAX_PRECISION:A6,DEFAULT_PRECISION:e6,PRECISION_LEVELS:j8,formatPrecision:F8,InputType:S0,OutputFormat:q7,OutputTarget:z7,detectInputType:E6,detectOutputTarget:e$,loadInput:T6,generateOutput:b6,saveOutput:_8,createOperation:j0,cleanupIds:$9,cleanupNumericValues:$$,cleanupListOfValues:U8,cleanupAttributes:V8,cleanupEnableBackground:M8,removeUnknownsAndDefaults:O8,removeNonInheritableGroupAttrs:Y8,removeUselessDefs:X8,removeHiddenElements:J$,removeEmptyText:k8,removeEmptyContainers:K$,removeDoctype:L8,removeXMLProcInst:w8,removeComments:Z$,removeMetadata:Q$,removeTitle:R8,removeDesc:B8,removeEditorsNSData:J9,removeEmptyAttrs:N8,removeViewBox:I8,removeXMLNS:C8,removeRasterImages:P8,removeScriptElement:A8,convertShapesToPath:E8,convertPathData:T8,convertTransform:b8,convertColors:H$,convertStyleToAttrs:K9,convertEllipseToCircle:f8,collapseGroups:S8,mergePaths:v8,moveGroupAttrsToElems:D8,moveElemsAttrsToGroup:h8,minifyStyles:Z9,inlineStyles:y8,sortAttrs:u8,sortDefsChildren:g8,reusePaths:x8,removeOffCanvasPath:m8,removeStyleElement:d8,removeXlink:p8,addAttributesToSVGElement:c8,addClassesToSVGElement:l8,prefixIds:n8,removeDimensions:s8,removeAttributesBySelector:o8,removeAttrs:i8,removeElementsByAttr:r8,presetDefault:Q9,presetNone:H9,applyPreset:a8,optimize:t8,createConfig:e8,flattenClipPaths:$J,flattenMasks:JJ,flattenGradients:KJ,flattenPatterns:ZJ,flattenFilters:QJ,flattenUseElements:HJ,imageToPath:zJ,detectCollisions:qJ,measureDistance:WJ,validateXML:jJ,validateSVG:GJ,fixInvalidSVG:_J,ValidationSeverity:C0,flattenAll:UJ,simplifyPath:VJ,decomposeTransform:XJ,optimizeAnimationTiming:MJ,optimizePaths:OJ,simplifyPaths:YJ,embedExternalDependencies:z9,exportEmbeddedResources:LJ,convertPathDataAdvanced:a9,parsePathCommands:l0,serializePathCommands:n0,formatPathNumber:T7,douglasPeucker:r6,visvalingamWhyatt:t9,simplifyPolyline:e9,simplifyPolylinePath:J8,isPurePolyline:$8,optimizeKeySplines:n9,optimizeKeyTimes:s9,optimizeAnimationValues:b$,formatSplineValue:i6,parseKeySplines:f$,serializeKeySplines:c9,isLinearSpline:S$,areAllSplinesLinear:RK,identifyStandardEasing:l9,STANDARD_EASINGS:p9,removeLeadingZero:D$,negativeExtraSpace:h$,convertToRelative:y$,convertToAbsolute:u$,lineShorthands:g$,convertToZ:x$,straightCurves:m$,collapseRepeated:d$,floatPrecision:p$,removeUselessCommands:c$,convertCubicToQuadratic:l$,convertQuadraticToSmooth:n$,convertCubicToSmooth:s$,arcShorthands:o$};var aK="1.3.0",tK={VERSION:aK,...wJ},Fq=tK;if(typeof window!=="undefined")window.SVGToolbox=tK;})();
|