@svgsketch/core 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- "use strict";var Xt=Object.defineProperty;var hn=Object.getOwnPropertyDescriptor;var pn=Object.getOwnPropertyNames;var fn=Object.prototype.hasOwnProperty;var mn=(r,e)=>{for(var t in e)Xt(r,t,{get:e[t],enumerable:!0})},gn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of pn(e))!fn.call(r,i)&&i!==t&&Xt(r,i,{get:()=>e[i],enumerable:!(n=hn(e,i))||n.enumerable});return r};var bn=r=>gn(Xt({},"__esModule",{value:!0}),r);var Ws={};mn(Ws,{Arrow:()=>Rt,Audio:()=>Nt,BUILTIN_MARKER_ID_MAP:()=>ir,CURRENT_SCHEMA_VERSION:()=>X,Circle:()=>gt,Cloud:()=>At,Container:()=>Bt,ContainerShapeBuilder:()=>ie,Cross:()=>wt,DEFAULT_COORDINATE_PRECISION:()=>Ir,Document:()=>pt,EASING_CURVES:()=>we,EVENT_TRIGGER_OPTIONS:()=>$n,EasingType:()=>jt,Ellipse:()=>bt,Gear:()=>Ft,Heart:()=>Mt,Hyperlink:()=>Lt,ImageShape:()=>Wt,LIBRARY_EMIT_ORDER:()=>mr,Lightning:()=>Ct,Line:()=>xt,LinearGradientBuilder:()=>Se,MARKER_HEIGHT:()=>nt,MARKER_VIEWBOX:()=>xe,MARKER_WIDTH:()=>rt,MAX_COORDINATE_PRECISION:()=>Lr,MIGRATIONS:()=>Kt,NGon:()=>_t,NestedSvg:()=>Ot,PUZZLE_DEFAULTS:()=>Fr,Path:()=>Vt,PathCurveType:()=>Yt,PathPointType:()=>Rr,PatternBuilder:()=>_e,Polyline:()=>Ht,RadialGradientBuilder:()=>ke,Rectangle:()=>yt,Ring:()=>Pt,ShapeBuilder:()=>U,ShapeReference:()=>Gt,SpeechBubble:()=>It,Spiral:()=>Tt,Square:()=>$t,Star:()=>vt,Switch:()=>Dt,Text:()=>St,Timeline:()=>mt,Track:()=>ft,Triangle:()=>kt,Video:()=>zt,View:()=>Et,collectReferencedLibraryIds:()=>Kr,computeArrowVertices:()=>ze,computeCloudPath:()=>We,computeCrossVertices:()=>Ue,computeDashArray:()=>he,computeGearPath:()=>Ye,computeGearVertices:()=>er,computeHeartPath:()=>He,computeLightningVertices:()=>Ve,computePolygonVertices:()=>ye,computeRectanglePath:()=>qe,computeRingPath:()=>Xe,computeSpeechBubbleVertices:()=>Ne,computeSpiralPath:()=>je,computeSplinePath:()=>de,computeStarVertices:()=>Ge,createDocument:()=>Fe,createShape:()=>Cr,createViewbox:()=>ge,defaultVariableMode:()=>xn,escXml:()=>O,extractVariables:()=>De,filterAttr:()=>et,generateCode:()=>ht,generateCssCode:()=>dt,generateD3Code:()=>ct,generateId:()=>T,generatePatternSvgContent:()=>tt,generatePuzzlePieces:()=>dn,generateReactCode:()=>lt,generateSvgCode:()=>ot,generateVueCode:()=>ut,getBuiltInMarkerDefs:()=>Vr,getEasingCubicBezier:()=>yn,getEffectivePrecision:()=>Dr,getMarkerDescriptors:()=>ae,getPatternElements:()=>$e,linearGradient:()=>nn,migrateSnapshot:()=>Te,parseDocument:()=>Me,parseVariableArgs:()=>Ar,pattern:()=>an,radialGradient:()=>sn,renderAnimationElements:()=>at,renderBuiltinMarkerDefs:()=>te,renderCircle:()=>ar,renderEllipse:()=>or,renderFilterDefs:()=>Nr,renderFilterLibraryDef:()=>kr,renderFilterPrimitive:()=>Je,renderFilterPrimitivesForType:()=>rr,renderImage:()=>pr,renderLibraryDef:()=>gr,renderLibraryDefs:()=>_r,renderLine:()=>ur,renderLinearGradientLibraryDef:()=>$r,renderMarkerLibraryDef:()=>yr,renderPatternLibraryDef:()=>Sr,renderPolygonShape:()=>fr,renderPolyline:()=>hr,renderRadialGradientLibraryDef:()=>xr,renderRectangle:()=>lr,renderReferencedLibraryDefs:()=>re,renderShape:()=>H,renderSpline:()=>dr,renderSvgPrimitiveChainFilter:()=>tr,renderSymbolLibraryDef:()=>br,renderText:()=>cr,renderToSvg:()=>fe,roundCoord:()=>Ee,roundNumberString:()=>Zt,roundSerializedShape:()=>Be,roundSnapshot:()=>Br,stringifyDocument:()=>Re,substituteString:()=>Ce,substituteVariables:()=>Le,validateSnapshot:()=>me,verticesToPath:()=>q});module.exports=bn(Ws);var jt=(C=>(C.LINEAR="linear",C.EASE="ease",C.EASE_IN="ease-in",C.EASE_OUT="ease-out",C.EASE_IN_OUT="ease-in-out",C.EASE_IN_QUAD="ease-in-quad",C.EASE_OUT_QUAD="ease-out-quad",C.EASE_IN_OUT_QUAD="ease-in-out-quad",C.EASE_IN_CUBIC="ease-in-cubic",C.EASE_OUT_CUBIC="ease-out-cubic",C.EASE_IN_OUT_CUBIC="ease-in-out-cubic",C.EASE_IN_QUART="ease-in-quart",C.EASE_OUT_QUART="ease-out-quart",C.EASE_IN_OUT_QUART="ease-in-out-quart",C.EASE_IN_SINE="ease-in-sine",C.EASE_OUT_SINE="ease-out-sine",C.EASE_IN_OUT_SINE="ease-in-out-sine",C.EASE_IN_QUINT="ease-in-quint",C.EASE_OUT_QUINT="ease-out-quint",C.EASE_IN_OUT_QUINT="ease-in-out-quint",C.EASE_IN_EXPO="ease-in-expo",C.EASE_OUT_EXPO="ease-out-expo",C.EASE_IN_OUT_EXPO="ease-in-out-expo",C.EASE_IN_CIRC="ease-in-circ",C.EASE_OUT_CIRC="ease-out-circ",C.EASE_IN_OUT_CIRC="ease-in-out-circ",C.EASE_IN_BACK="ease-in-back",C.EASE_OUT_BACK="ease-out-back",C.EASE_IN_OUT_BACK="ease-in-out-back",C.CUSTOM_BEZIER="custom-bezier",C.LINEAR_FUNCTION="linear-function",C.STEPS="steps",C))(jt||{}),we={linear:null,ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1],"ease-in-quad":[.55,.085,.68,.53],"ease-out-quad":[.25,.46,.45,.94],"ease-in-out-quad":[.455,.03,.515,.955],"ease-in-cubic":[.55,.055,.675,.19],"ease-out-cubic":[.215,.61,.355,1],"ease-in-out-cubic":[.645,.045,.355,1],"ease-in-quart":[.895,.03,.685,.22],"ease-out-quart":[.165,.84,.44,1],"ease-in-out-quart":[.77,0,.175,1],"ease-in-sine":[.47,0,.745,.715],"ease-out-sine":[.39,.575,.565,1],"ease-in-out-sine":[.445,.05,.55,.95],"ease-in-quint":[.755,.05,.855,.06],"ease-out-quint":[.23,1,.32,1],"ease-in-out-quint":[.86,0,.07,1],"ease-in-expo":[.95,.05,.795,.035],"ease-out-expo":[.19,1,.22,1],"ease-in-out-expo":[1,0,0,1],"ease-in-circ":[.6,.04,.98,.335],"ease-out-circ":[.075,.82,.165,1],"ease-in-out-circ":[.785,.135,.15,.86],"ease-in-back":[.6,-.28,.735,.045],"ease-out-back":[.175,.885,.32,1.275],"ease-in-out-back":[.68,-.55,.265,1.55],"custom-bezier":null,"linear-function":null,steps:null};function yn(r){let e=we[r];return e?`cubic-bezier(${e.join(", ")})`:"linear"}var $n=[{value:"click",label:"Click"},{value:"mouseenter",label:"Mouse Enter"},{value:"mouseleave",label:"Mouse Leave"},{value:"focus",label:"Focus"},{value:"blur",label:"Blur"},{value:"load",label:"Page Load"}];var Yt=(o=>(o.LINEAR="linear",o.QUADRATIC="quadratic",o.CUBIC="cubic",o.CATMULL_ROM="catmull-rom",o.ARC="arc",o.BASIS="basis",o.MIXED="mixed",o))(Yt||{}),Rr=(n=>(n.SMOOTH="smooth",n.CORNER="corner",n.SYMMETRIC="symmetric",n))(Rr||{});function xn(r){return r==="color"?"live":"stamped"}var X=2;function Sn(r){let e=Array.isArray(r.library)?[...r.library]:[],t=new Set(e.map(u=>u.id));if(Array.isArray(r.symbols))for(let u of r.symbols)!u||t.has(u.id)||(e.push({...u,kind:"symbol"}),t.add(u.id));if(Array.isArray(r.markers))for(let u of r.markers)!u||t.has(u.id)||(e.push({...u,kind:"marker"}),t.add(u.id));let n=new Map,i=(u,c)=>{let{id:h,sourceId:d,...f}=u,m=JSON.stringify({kind:c,...f}),b=n.get(m);if(b)return b;let g=t.has(u.id)?`grd-${Pe()}`:u.id;t.add(g),n.set(m,g);let x=c==="linear-gradient"?{kind:"linear-gradient",id:g,name:u.sourceId??g,sourceId:u.sourceId,gradient:Mr(u)}:{kind:"radial-gradient",id:g,name:u.sourceId??g,sourceId:u.sourceId,gradient:Mr(u)};return e.push(x),g},a=new Map;if(Array.isArray(r.customPatterns))for(let u of r.customPatterns){if(!u)continue;let c=t.has(u.id)?`pat-${Pe()}`:u.id;t.add(c),a.set(u.id,c),e.push(kn(u,c))}let l=u=>{if(u.customPatternId){let v=a.get(u.customPatternId);if(v)return v}let{id:c,sourceId:h,customPatternId:d,...f}=u,m=JSON.stringify({kind:"pattern",...f}),b=n.get(m);if(b)return b;let g=t.has(u.id)?`pat-${Pe()}`:u.id;t.add(g),n.set(m,g);let x={kind:"pattern",id:g,name:u.sourceId??g,sourceId:u.sourceId,pattern:f};return e.push(x),g};for(let u of r.shapes??[]){let c=u.state;if(!c)continue;let h=c.fillGradient;h&&(h.type==="linear-gradient"||h.type==="radial-gradient"?c.fillLibraryId=i(h,h.type):h.type==="pattern"&&(c.fillLibraryId=l(h)));let d=c.strokeGradient;d&&(d.type==="linear-gradient"||d.type==="radial-gradient"?c.strokeLibraryId=i(d,d.type):d.type==="pattern"&&(c.strokeLibraryId=l(d)));let f=c.filters;if(Array.isArray(f)&&f.length>0){let m=o(f,c,u.id);c.filterLibraryIds=[m]}}return r.library=e,r;function o(u,c,h){let d={filters:u,colorInterpolation:c.filterColorInterpolation,filterUnits:c.filterUnits,primitiveUnits:c.primitiveUnits,x:c.filterX,y:c.filterY,width:c.filterWidth,height:c.filterHeight},f=JSON.stringify({kind:"filter",...d}),m=n.get(f);if(m)return m;let b=`filter-${h}`,g=t.has(b)?`flt-${Pe()}`:b;t.add(g),n.set(f,g);let x={kind:"filter",id:g,name:g,filters:d.filters,...d.colorInterpolation?{colorInterpolation:d.colorInterpolation}:{},...d.filterUnits?{filterUnits:d.filterUnits}:{},...d.primitiveUnits?{primitiveUnits:d.primitiveUnits}:{},...d.x!==void 0?{x:d.x}:{},...d.y!==void 0?{y:d.y}:{},...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{}};return e.push(x),g}}function kn(r,e){return{kind:"pattern",id:e,name:r.name??e,pattern:{type:"pattern",svgContent:r.svgContent,width:r.width,height:r.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function Mr(r){let{id:e,sourceId:t,...n}=r;return n}var qt=0;function Pe(){return qt=qt+1&65535,`${Date.now().toString(36)}-${qt.toString(36)}`}var Kt=Object.freeze({1:Sn});function _n(r){let e=r.schemaVersion;return typeof e!="number"||!Number.isFinite(e)||e<1?1:Math.floor(e)}function Te(r,e=Kt){let t=JSON.parse(JSON.stringify(r)),n=_n(t);if(n>X)return t;if(n===X)return t.schemaVersion=X,t;for(;n<X;){let i=e[n];if(!i)throw new Error(`[svgsketch/core] No migration registered for schema version ${n} \u2192 ${n+1}. Cannot safely upgrade this document to version ${X}.`);t=i(t),n+=1}return t.schemaVersion=X,t}var vn=new Set(["circle","rectangle","square","ellipse","text","triangle","ngon","star","cross","ring","spiral","gear","arrow","line","path","polyline","image"]);function me(r){let e=[],t=[];if(r==null||typeof r!="object")return e.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:e,warnings:t};let n=r;if(n.schemaVersion!==void 0&&(typeof n.schemaVersion!="number"||!Number.isInteger(n.schemaVersion)?e.push({path:"schemaVersion",message:"schemaVersion must be an integer",severity:"error"}):n.schemaVersion>X&&t.push({path:"schemaVersion",message:`schemaVersion ${n.schemaVersion} is newer than supported (${X})`,severity:"warning"})),!Array.isArray(n.shapes))e.push({path:"shapes",message:"shapes must be an array",severity:"error"});else{let i=new Set;n.shapes.forEach((a,l)=>{wn(a,`shapes[${l}]`,e,t,i)})}if(!Array.isArray(n.viewboxes))e.push({path:"viewboxes",message:"viewboxes must be an array",severity:"error"});else{let i=new Set;n.viewboxes.forEach((a,l)=>{Rn(a,`viewboxes[${l}]`,e,t,i)})}return n.guides!==void 0&&(Array.isArray(n.guides)?n.guides.forEach((i,a)=>{Mn(i,`guides[${a}]`,e,t)}):e.push({path:"guides",message:"guides must be an array",severity:"error"})),n.groups!==void 0&&(Array.isArray(n.groups)?n.groups.forEach((i,a)=>{Cn(i,`groups[${a}]`,e)}):e.push({path:"groups",message:"groups must be an array",severity:"error"})),n.clipMaskGroups!==void 0&&(Array.isArray(n.clipMaskGroups)?n.clipMaskGroups.forEach((i,a)=>{An(i,`clipMaskGroups[${a}]`,e)}):e.push({path:"clipMaskGroups",message:"clipMaskGroups must be an array",severity:"error"})),n.measurements!==void 0&&(Array.isArray(n.measurements)||e.push({path:"measurements",message:"measurements must be an array",severity:"error"})),{valid:e.length===0,errors:e,warnings:t}}function wn(r,e,t,n,i){if(r===null||typeof r!="object"){t.push({path:e,message:"Shape must be a non-null object",severity:"error"});return}let a=r;typeof a.id!="string"||a.id.length===0?t.push({path:`${e}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(a.id)?t.push({path:`${e}.id`,message:`Duplicate shape id: "${a.id}"`,severity:"error"}):i.add(a.id),typeof a.type!="string"?t.push({path:`${e}.type`,message:"Shape type must be a string",severity:"error"}):vn.has(a.type)||n.push({path:`${e}.type`,message:`Unknown shape type: "${a.type}"`,severity:"warning"}),a.state===void 0||a.state===null||typeof a.state!="object"?t.push({path:`${e}.state`,message:"Shape state must be a non-null object",severity:"error"}):Fn(a.state,`${e}.state`,t,n)}var Pn=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function Tn(r){return typeof r=="number"?isFinite(r):typeof r=="string"?Pn.test(r):!1}function Fn(r,e,t,n){let i=["x","y","width","height","radius","rx","ry","rotation","fontSize"];for(let l of i)r[l]!==void 0&&!Tn(r[l])&&t.push({path:`${e}.${l}`,message:`${l} must be a finite number or a {{variable}} reference`,severity:"error"});let a=["width","height","radius","fontSize"];for(let l of a){let o=r[l];typeof o=="number"&&o<=0&&n.push({path:`${e}.${l}`,message:`${l} should be positive (got ${o})`,severity:"warning"})}}function Rn(r,e,t,n,i){if(r===null||typeof r!="object"){t.push({path:e,message:"Viewbox must be a non-null object",severity:"error"});return}let a=r;typeof a.id!="string"||a.id.length===0?t.push({path:`${e}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):i.has(a.id)?t.push({path:`${e}.id`,message:`Duplicate viewbox id: "${a.id}"`,severity:"error"}):i.add(a.id);for(let l of["x","y","width","height"])(typeof a[l]!="number"||!isFinite(a[l]))&&t.push({path:`${e}.${l}`,message:`${l} must be a finite number`,severity:"error"});typeof a.width=="number"&&a.width<=0&&t.push({path:`${e}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof a.height=="number"&&a.height<=0&&t.push({path:`${e}.height`,message:"Viewbox height must be positive",severity:"error"})}function Mn(r,e,t,n){if(r===null||typeof r!="object"){t.push({path:e,message:"Guide must be a non-null object",severity:"error"});return}let i=r;(typeof i.id!="string"||i.id.length===0)&&t.push({path:`${e}.id`,message:"Guide id must be a non-empty string",severity:"error"}),i.orientation!=="horizontal"&&i.orientation!=="vertical"&&t.push({path:`${e}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof i.position!="number"||!isFinite(i.position))&&t.push({path:`${e}.position`,message:"Guide position must be a finite number",severity:"error"})}function Cn(r,e,t){if(r===null||typeof r!="object"){t.push({path:e,message:"Group must be a non-null object",severity:"error"});return}let n=r;(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${e}.id`,message:"Group id must be a non-empty string",severity:"error"}),n.parentId!==null&&typeof n.parentId!="string"&&t.push({path:`${e}.parentId`,message:"Group parentId must be a string or null",severity:"error"})}function An(r,e,t){if(r===null||typeof r!="object"){t.push({path:e,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let n=r;(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${e}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),n.type!=="clip"&&n.type!=="mask"&&t.push({path:`${e}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),(typeof n.clipShapeId!="string"||n.clipShapeId.length===0)&&t.push({path:`${e}.clipShapeId`,message:"clipShapeId must be a non-empty string",severity:"error"}),Array.isArray(n.contentShapeIds)||t.push({path:`${e}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function T(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function Fe(r={}){let e={schemaVersion:X,shapes:r.shapes?r.shapes.map(t=>({...t})):[],viewboxes:r.viewboxes?r.viewboxes.map(t=>({...t})):[]};return r.metadata&&(e.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...r.metadata}),e}function Cr(r){let{type:e,id:t,...n}=r,i={};for(let[a,l]of Object.entries(n))l!==void 0&&(i[a]=l);return{id:t??T(),type:e,state:i}}function ge(r,e,t,n,i){return{id:i??T(),x:r,y:e,width:t,height:n}}var In=["schemaVersion","documentMetadata","documentScripts","documentStyles","templateVariables","viewboxes","guides","measurements","groups","clipMaskGroups","customPatterns","symbols","markers","library","colorGlyphLibrary","rawPaintServerDefs","animationTimeline","shapes"];function Re(r,e={}){let{indent:t=2,trailingNewline:n=!0,validate:i=!1}=e;if(i){let o=me(r);if(!o.valid){let u=o.errors.map(c=>` ${c.path}: ${c.message}`).join(`
1
+ "use strict";var Zt=Object.defineProperty;var Ln=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Bn=Object.prototype.hasOwnProperty;var Dn=(r,e)=>{for(var t in e)Zt(r,t,{get:e[t],enumerable:!0})},On=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of En(e))!Bn.call(r,i)&&i!==t&&Zt(r,i,{get:()=>e[i],enumerable:!(n=Ln(e,i))||n.enumerable});return r};var Gn=r=>On(Zt({},"__esModule",{value:!0}),r);var ka={};Dn(ka,{Arrow:()=>At,Audio:()=>Wt,BUILTIN_MARKER_ID_MAP:()=>lr,CURRENT_SCHEMA_VERSION:()=>X,Circle:()=>$t,Cloud:()=>Et,Container:()=>Gt,ContainerShapeBuilder:()=>se,Cross:()=>Ft,DEFAULT_COORDINATE_PRECISION:()=>Nr,Document:()=>gt,EASING_CURVES:()=>Fe,EVENT_TRIGGER_OPTIONS:()=>Un,EasingType:()=>Kt,Ellipse:()=>xt,Gear:()=>Ct,Heart:()=>It,Hyperlink:()=>Dt,ImageShape:()=>Yt,LIBRARY_EMIT_ORDER:()=>xr,Lightning:()=>Lt,Line:()=>_t,LinearGradientBuilder:()=>ke,MARKER_HEIGHT:()=>at,MARKER_VIEWBOX:()=>Se,MARKER_WIDTH:()=>st,MAX_COORDINATE_PRECISION:()=>Hr,MIGRATIONS:()=>er,NGon:()=>Pt,NestedSvg:()=>Ut,PUZZLE_DEFAULTS:()=>Ir,Path:()=>Xt,PathCurveType:()=>Qt,PathPointType:()=>Gr,PatternBuilder:()=>ve,Polyline:()=>jt,RadialGradientBuilder:()=>_e,Rectangle:()=>St,Ring:()=>Rt,ShapeBuilder:()=>z,ShapeReference:()=>Vt,SpeechBubble:()=>Bt,Spiral:()=>Mt,Square:()=>kt,Star:()=>Tt,Switch:()=>Ot,Text:()=>vt,Timeline:()=>yt,Track:()=>bt,Triangle:()=>wt,Video:()=>Ht,View:()=>zt,collectReferencedLibraryIds:()=>ln,computeArrowVertices:()=>He,computeCloudPath:()=>Ye,computeCrossVertices:()=>Ne,computeDashArray:()=>he,computeGearPath:()=>Ke,computeGearVertices:()=>ir,computeHeartPath:()=>je,computeLightningVertices:()=>Xe,computePolygonVertices:()=>$e,computeRectanglePath:()=>Qe,computeRingPath:()=>qe,computeSpeechBubbleVertices:()=>We,computeSpiralPath:()=>Ze,computeSplinePath:()=>de,computeStarVertices:()=>Ve,createDocument:()=>Ce,createShape:()=>Ur,createViewbox:()=>be,defaultVariableMode:()=>Vn,escXml:()=>O,extractVariables:()=>Oe,filterAttr:()=>nt,generateCode:()=>mt,generateCssCode:()=>pt,generateD3Code:()=>ft,generateId:()=>T,generatePatternSvgContent:()=>it,generatePuzzlePieces:()=>kn,generateReactCode:()=>dt,generateSudokuPuzzle:()=>In,generateSvgCode:()=>ct,generateVueCode:()=>ht,getBuiltInMarkerDefs:()=>Jr,getEasingCubicBezier:()=>zn,getEffectivePrecision:()=>Wr,getMarkerDescriptors:()=>le,getPatternElements:()=>xe,linearGradient:()=>mn,migrateSnapshot:()=>Me,parseDocument:()=>Ie,parseVariableArgs:()=>Vr,pattern:()=>bn,radialGradient:()=>gn,renderAnimationElements:()=>ut,renderBuiltinMarkerDefs:()=>re,renderCircle:()=>dr,renderEllipse:()=>hr,renderFilterDefs:()=>Qr,renderFilterLibraryDef:()=>Tr,renderFilterPrimitive:()=>rt,renderFilterPrimitivesForType:()=>ar,renderImage:()=>yr,renderLibraryDef:()=>Sr,renderLibraryDefs:()=>Fr,renderLine:()=>pr,renderLinearGradientLibraryDef:()=>vr,renderMarkerLibraryDef:()=>_r,renderPatternLibraryDef:()=>Pr,renderPolygonShape:()=>$r,renderPolyline:()=>br,renderRadialGradientLibraryDef:()=>wr,renderRectangle:()=>fr,renderReferencedLibraryDefs:()=>ne,renderShape:()=>N,renderSpline:()=>gr,renderSvgPrimitiveChainFilter:()=>sr,renderSymbolLibraryDef:()=>kr,renderText:()=>mr,renderToSvg:()=>pe,roundCoord:()=>ze,roundNumberString:()=>tr,roundSerializedShape:()=>Ge,roundSnapshot:()=>Xr,solveSudoku:()=>Pe,stringifyDocument:()=>Ae,substituteString:()=>Le,substituteVariables:()=>De,validateSnapshot:()=>ge,validateSudokuPuzzle:()=>An,verticesToPath:()=>K});module.exports=Gn(ka);var Kt=(F=>(F.LINEAR="linear",F.EASE="ease",F.EASE_IN="ease-in",F.EASE_OUT="ease-out",F.EASE_IN_OUT="ease-in-out",F.EASE_IN_QUAD="ease-in-quad",F.EASE_OUT_QUAD="ease-out-quad",F.EASE_IN_OUT_QUAD="ease-in-out-quad",F.EASE_IN_CUBIC="ease-in-cubic",F.EASE_OUT_CUBIC="ease-out-cubic",F.EASE_IN_OUT_CUBIC="ease-in-out-cubic",F.EASE_IN_QUART="ease-in-quart",F.EASE_OUT_QUART="ease-out-quart",F.EASE_IN_OUT_QUART="ease-in-out-quart",F.EASE_IN_SINE="ease-in-sine",F.EASE_OUT_SINE="ease-out-sine",F.EASE_IN_OUT_SINE="ease-in-out-sine",F.EASE_IN_QUINT="ease-in-quint",F.EASE_OUT_QUINT="ease-out-quint",F.EASE_IN_OUT_QUINT="ease-in-out-quint",F.EASE_IN_EXPO="ease-in-expo",F.EASE_OUT_EXPO="ease-out-expo",F.EASE_IN_OUT_EXPO="ease-in-out-expo",F.EASE_IN_CIRC="ease-in-circ",F.EASE_OUT_CIRC="ease-out-circ",F.EASE_IN_OUT_CIRC="ease-in-out-circ",F.EASE_IN_BACK="ease-in-back",F.EASE_OUT_BACK="ease-out-back",F.EASE_IN_OUT_BACK="ease-in-out-back",F.CUSTOM_BEZIER="custom-bezier",F.LINEAR_FUNCTION="linear-function",F.STEPS="steps",F))(Kt||{}),Fe={linear:null,ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1],"ease-in-quad":[.55,.085,.68,.53],"ease-out-quad":[.25,.46,.45,.94],"ease-in-out-quad":[.455,.03,.515,.955],"ease-in-cubic":[.55,.055,.675,.19],"ease-out-cubic":[.215,.61,.355,1],"ease-in-out-cubic":[.645,.045,.355,1],"ease-in-quart":[.895,.03,.685,.22],"ease-out-quart":[.165,.84,.44,1],"ease-in-out-quart":[.77,0,.175,1],"ease-in-sine":[.47,0,.745,.715],"ease-out-sine":[.39,.575,.565,1],"ease-in-out-sine":[.445,.05,.55,.95],"ease-in-quint":[.755,.05,.855,.06],"ease-out-quint":[.23,1,.32,1],"ease-in-out-quint":[.86,0,.07,1],"ease-in-expo":[.95,.05,.795,.035],"ease-out-expo":[.19,1,.22,1],"ease-in-out-expo":[1,0,0,1],"ease-in-circ":[.6,.04,.98,.335],"ease-out-circ":[.075,.82,.165,1],"ease-in-out-circ":[.785,.135,.15,.86],"ease-in-back":[.6,-.28,.735,.045],"ease-out-back":[.175,.885,.32,1.275],"ease-in-out-back":[.68,-.55,.265,1.55],"custom-bezier":null,"linear-function":null,steps:null};function zn(r){let e=Fe[r];return e?`cubic-bezier(${e.join(", ")})`:"linear"}var Un=[{value:"click",label:"Click"},{value:"mouseenter",label:"Mouse Enter"},{value:"mouseleave",label:"Mouse Leave"},{value:"focus",label:"Focus"},{value:"blur",label:"Blur"},{value:"load",label:"Page Load"}];var Qt=(o=>(o.LINEAR="linear",o.QUADRATIC="quadratic",o.CUBIC="cubic",o.CATMULL_ROM="catmull-rom",o.ARC="arc",o.BASIS="basis",o.MIXED="mixed",o))(Qt||{}),Gr=(n=>(n.SMOOTH="smooth",n.CORNER="corner",n.SYMMETRIC="symmetric",n))(Gr||{});function Vn(r){return r==="color"?"live":"stamped"}var X=2;function Nn(r){let e=Array.isArray(r.library)?[...r.library]:[],t=new Set(e.map(u=>u.id));if(Array.isArray(r.symbols))for(let u of r.symbols)!u||t.has(u.id)||(e.push({...u,kind:"symbol"}),t.add(u.id));if(Array.isArray(r.markers))for(let u of r.markers)!u||t.has(u.id)||(e.push({...u,kind:"marker"}),t.add(u.id));let n=new Map,i=(u,c)=>{let{id:h,sourceId:d,...p}=u,m=JSON.stringify({kind:c,...p}),b=n.get(m);if(b)return b;let g=t.has(u.id)?`grd-${Re()}`:u.id;t.add(g),n.set(m,g);let y=c==="linear-gradient"?{kind:"linear-gradient",id:g,name:u.sourceId??g,sourceId:u.sourceId,gradient:zr(u)}:{kind:"radial-gradient",id:g,name:u.sourceId??g,sourceId:u.sourceId,gradient:zr(u)};return e.push(y),g},a=new Map;if(Array.isArray(r.customPatterns))for(let u of r.customPatterns){if(!u)continue;let c=t.has(u.id)?`pat-${Re()}`:u.id;t.add(c),a.set(u.id,c),e.push(Hn(u,c))}let l=u=>{if(u.customPatternId){let S=a.get(u.customPatternId);if(S)return S}let{id:c,sourceId:h,customPatternId:d,...p}=u,m=JSON.stringify({kind:"pattern",...p}),b=n.get(m);if(b)return b;let g=t.has(u.id)?`pat-${Re()}`:u.id;t.add(g),n.set(m,g);let y={kind:"pattern",id:g,name:u.sourceId??g,sourceId:u.sourceId,pattern:p};return e.push(y),g};for(let u of r.shapes??[]){let c=u.state;if(!c)continue;let h=c.fillGradient;h&&(h.type==="linear-gradient"||h.type==="radial-gradient"?c.fillLibraryId=i(h,h.type):h.type==="pattern"&&(c.fillLibraryId=l(h)));let d=c.strokeGradient;d&&(d.type==="linear-gradient"||d.type==="radial-gradient"?c.strokeLibraryId=i(d,d.type):d.type==="pattern"&&(c.strokeLibraryId=l(d)));let p=c.filters;if(Array.isArray(p)&&p.length>0){let m=o(p,c,u.id);c.filterLibraryIds=[m]}}return r.library=e,r;function o(u,c,h){let d={filters:u,colorInterpolation:c.filterColorInterpolation,filterUnits:c.filterUnits,primitiveUnits:c.primitiveUnits,x:c.filterX,y:c.filterY,width:c.filterWidth,height:c.filterHeight},p=JSON.stringify({kind:"filter",...d}),m=n.get(p);if(m)return m;let b=`filter-${h}`,g=t.has(b)?`flt-${Re()}`:b;t.add(g),n.set(p,g);let y={kind:"filter",id:g,name:g,filters:d.filters,...d.colorInterpolation?{colorInterpolation:d.colorInterpolation}:{},...d.filterUnits?{filterUnits:d.filterUnits}:{},...d.primitiveUnits?{primitiveUnits:d.primitiveUnits}:{},...d.x!==void 0?{x:d.x}:{},...d.y!==void 0?{y:d.y}:{},...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{}};return e.push(y),g}}function Hn(r,e){return{kind:"pattern",id:e,name:r.name??e,pattern:{type:"pattern",svgContent:r.svgContent,width:r.width,height:r.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function zr(r){let{id:e,sourceId:t,...n}=r;return n}var Jt=0;function Re(){return Jt=Jt+1&65535,`${Date.now().toString(36)}-${Jt.toString(36)}`}var er=Object.freeze({1:Nn});function Wn(r){let e=r.schemaVersion;return typeof e!="number"||!Number.isFinite(e)||e<1?1:Math.floor(e)}function Me(r,e=er){let t=JSON.parse(JSON.stringify(r)),n=Wn(t);if(n>X)return t;if(n===X)return t.schemaVersion=X,t;for(;n<X;){let i=e[n];if(!i)throw new Error(`[svgsketch/core] No migration registered for schema version ${n} \u2192 ${n+1}. Cannot safely upgrade this document to version ${X}.`);t=i(t),n+=1}return t.schemaVersion=X,t}var Xn=new Set(["circle","rectangle","square","ellipse","text","triangle","ngon","star","cross","ring","spiral","gear","arrow","line","path","polyline","image"]);function ge(r){let e=[],t=[];if(r==null||typeof r!="object")return e.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:e,warnings:t};let n=r;if(n.schemaVersion!==void 0&&(typeof n.schemaVersion!="number"||!Number.isInteger(n.schemaVersion)?e.push({path:"schemaVersion",message:"schemaVersion must be an integer",severity:"error"}):n.schemaVersion>X&&t.push({path:"schemaVersion",message:`schemaVersion ${n.schemaVersion} is newer than supported (${X})`,severity:"warning"})),!Array.isArray(n.shapes))e.push({path:"shapes",message:"shapes must be an array",severity:"error"});else{let i=new Set;n.shapes.forEach((a,l)=>{jn(a,`shapes[${l}]`,e,t,i)})}if(!Array.isArray(n.viewboxes))e.push({path:"viewboxes",message:"viewboxes must be an array",severity:"error"});else{let i=new Set;n.viewboxes.forEach((a,l)=>{Kn(a,`viewboxes[${l}]`,e,t,i)})}return n.guides!==void 0&&(Array.isArray(n.guides)?n.guides.forEach((i,a)=>{Qn(i,`guides[${a}]`,e,t)}):e.push({path:"guides",message:"guides must be an array",severity:"error"})),n.groups!==void 0&&(Array.isArray(n.groups)?n.groups.forEach((i,a)=>{Jn(i,`groups[${a}]`,e)}):e.push({path:"groups",message:"groups must be an array",severity:"error"})),n.clipMaskGroups!==void 0&&(Array.isArray(n.clipMaskGroups)?n.clipMaskGroups.forEach((i,a)=>{ei(i,`clipMaskGroups[${a}]`,e)}):e.push({path:"clipMaskGroups",message:"clipMaskGroups must be an array",severity:"error"})),n.measurements!==void 0&&(Array.isArray(n.measurements)||e.push({path:"measurements",message:"measurements must be an array",severity:"error"})),{valid:e.length===0,errors:e,warnings:t}}function jn(r,e,t,n,i){if(r===null||typeof r!="object"){t.push({path:e,message:"Shape must be a non-null object",severity:"error"});return}let a=r;typeof a.id!="string"||a.id.length===0?t.push({path:`${e}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(a.id)?t.push({path:`${e}.id`,message:`Duplicate shape id: "${a.id}"`,severity:"error"}):i.add(a.id),typeof a.type!="string"?t.push({path:`${e}.type`,message:"Shape type must be a string",severity:"error"}):Xn.has(a.type)||n.push({path:`${e}.type`,message:`Unknown shape type: "${a.type}"`,severity:"warning"}),a.state===void 0||a.state===null||typeof a.state!="object"?t.push({path:`${e}.state`,message:"Shape state must be a non-null object",severity:"error"}):Zn(a.state,`${e}.state`,t,n)}var Yn=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function qn(r){return typeof r=="number"?isFinite(r):typeof r=="string"?Yn.test(r):!1}function Zn(r,e,t,n){let i=["x","y","width","height","radius","rx","ry","rotation","fontSize"];for(let l of i)r[l]!==void 0&&!qn(r[l])&&t.push({path:`${e}.${l}`,message:`${l} must be a finite number or a {{variable}} reference`,severity:"error"});let a=["width","height","radius","fontSize"];for(let l of a){let o=r[l];typeof o=="number"&&o<=0&&n.push({path:`${e}.${l}`,message:`${l} should be positive (got ${o})`,severity:"warning"})}}function Kn(r,e,t,n,i){if(r===null||typeof r!="object"){t.push({path:e,message:"Viewbox must be a non-null object",severity:"error"});return}let a=r;typeof a.id!="string"||a.id.length===0?t.push({path:`${e}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):i.has(a.id)?t.push({path:`${e}.id`,message:`Duplicate viewbox id: "${a.id}"`,severity:"error"}):i.add(a.id);for(let l of["x","y","width","height"])(typeof a[l]!="number"||!isFinite(a[l]))&&t.push({path:`${e}.${l}`,message:`${l} must be a finite number`,severity:"error"});typeof a.width=="number"&&a.width<=0&&t.push({path:`${e}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof a.height=="number"&&a.height<=0&&t.push({path:`${e}.height`,message:"Viewbox height must be positive",severity:"error"})}function Qn(r,e,t,n){if(r===null||typeof r!="object"){t.push({path:e,message:"Guide must be a non-null object",severity:"error"});return}let i=r;(typeof i.id!="string"||i.id.length===0)&&t.push({path:`${e}.id`,message:"Guide id must be a non-empty string",severity:"error"}),i.orientation!=="horizontal"&&i.orientation!=="vertical"&&t.push({path:`${e}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof i.position!="number"||!isFinite(i.position))&&t.push({path:`${e}.position`,message:"Guide position must be a finite number",severity:"error"})}function Jn(r,e,t){if(r===null||typeof r!="object"){t.push({path:e,message:"Group must be a non-null object",severity:"error"});return}let n=r;(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${e}.id`,message:"Group id must be a non-empty string",severity:"error"}),n.parentId!==null&&typeof n.parentId!="string"&&t.push({path:`${e}.parentId`,message:"Group parentId must be a string or null",severity:"error"})}function ei(r,e,t){if(r===null||typeof r!="object"){t.push({path:e,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let n=r;(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${e}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),n.type!=="clip"&&n.type!=="mask"&&t.push({path:`${e}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),(typeof n.clipShapeId!="string"||n.clipShapeId.length===0)&&t.push({path:`${e}.clipShapeId`,message:"clipShapeId must be a non-empty string",severity:"error"}),Array.isArray(n.contentShapeIds)||t.push({path:`${e}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function T(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function Ce(r={}){let e={schemaVersion:X,shapes:r.shapes?r.shapes.map(t=>({...t})):[],viewboxes:r.viewboxes?r.viewboxes.map(t=>({...t})):[]};return r.metadata&&(e.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...r.metadata}),e}function Ur(r){let{type:e,id:t,...n}=r,i={};for(let[a,l]of Object.entries(n))l!==void 0&&(i[a]=l);return{id:t??T(),type:e,state:i}}function be(r,e,t,n,i){return{id:i??T(),x:r,y:e,width:t,height:n}}var ti=["schemaVersion","documentMetadata","documentScripts","documentStyles","templateVariables","viewboxes","guides","measurements","groups","clipMaskGroups","customPatterns","symbols","markers","library","colorGlyphLibrary","rawPaintServerDefs","animationTimeline","shapes"];function Ae(r,e={}){let{indent:t=2,trailingNewline:n=!0,validate:i=!1}=e;if(i){let o=ge(r);if(!o.valid){let u=o.errors.map(c=>` ${c.path}: ${c.message}`).join(`
2
2
  `);throw new Error(`Invalid document:
3
- ${u}`)}}let a={};for(let o of In){let u=r[o];if(u!==void 0)switch(o){case"shapes":a[o]=u.map(Dn);break;case"viewboxes":case"guides":case"measurements":case"groups":case"clipMaskGroups":case"symbols":case"markers":case"customPatterns":case"library":case"rawPaintServerDefs":a[o]=Ln(u).map(se);break;case"documentMetadata":a[o]=se(u);break;case"animationTimeline":a[o]=se(u);break;case"colorGlyphLibrary":a[o]=se(u);break;default:a[o]=u}}let l=JSON.stringify(a,null,t);return n?l+`
4
- `:l}function Me(r,e={}){let{validate:t=!0,migrate:n=!0}=e,i;try{i=JSON.parse(r)}catch(l){throw new Error(`Failed to parse .svgs document: ${l.message}`)}if(i===null||typeof i!="object"||Array.isArray(i))throw new Error("Invalid .svgs document: root must be a JSON object");let a=i;if(n&&(a=Te(a)),t){let l=me(a);if(!l.valid){let o=l.errors.map(u=>` ${u.path}: ${u.message}`).join(`
3
+ ${u}`)}}let a={};for(let o of ti){let u=r[o];if(u!==void 0)switch(o){case"shapes":a[o]=u.map(ni);break;case"viewboxes":case"guides":case"measurements":case"groups":case"clipMaskGroups":case"symbols":case"markers":case"customPatterns":case"library":case"rawPaintServerDefs":a[o]=ri(u).map(oe);break;case"documentMetadata":a[o]=oe(u);break;case"animationTimeline":a[o]=oe(u);break;case"colorGlyphLibrary":a[o]=oe(u);break;default:a[o]=u}}let l=JSON.stringify(a,null,t);return n?l+`
4
+ `:l}function Ie(r,e={}){let{validate:t=!0,migrate:n=!0}=e,i;try{i=JSON.parse(r)}catch(l){throw new Error(`Failed to parse .svgs document: ${l.message}`)}if(i===null||typeof i!="object"||Array.isArray(i))throw new Error("Invalid .svgs document: root must be a JSON object");let a=i;if(n&&(a=Me(a)),t){let l=ge(a);if(!l.valid){let o=l.errors.map(u=>` ${u.path}: ${u.message}`).join(`
5
5
  `);throw new Error(`Invalid .svgs document:
6
- ${o}`)}}return a}function Ln(r){return[...r].sort((e,t)=>e.id.localeCompare(t.id))}function se(r){if(r==null)return r;if(Array.isArray(r))return r.map(se);if(typeof r!="object")return r;let e={},t=Object.keys(r).sort();for(let n of t)e[n]=se(r[n]);return e}function Dn(r){let e={};return e.id=r.id,e.type=r.type,e.state=se(r.state),e}var Y=/\{\{\s*([\w.\-]+)\s*\}\}/g;function Ce(r,e){return r.replace(Y,(t,n)=>{let i=e[n];return i!==void 0?String(i):t})}function Le(r,e={}){let t={};if(r.templateVariables)for(let i of r.templateVariables)i.defaultValue!==void 0&&i.defaultValue!==""&&(t[i.name]=i.defaultValue);if(Object.assign(t,e),Object.keys(t).length===0)return JSON.parse(JSON.stringify(r));let n=JSON.parse(JSON.stringify(r));for(let i of n.shapes)Ae(i.state,t);if(n.documentMetadata){let i=n.documentMetadata;Ae(i,t)}return n}function Ae(r,e){for(let t of Object.keys(r)){let n=r[t];if(typeof n=="string"){if(Y.lastIndex=0,Y.test(n)){Y.lastIndex=0;let i=Ce(n,e);if(Bn(n)){let a=Number(i);if(!isNaN(a)&&On(t)){r[t]=a;continue}}r[t]=i}}else if(Array.isArray(n))for(let i=0;i<n.length;i++)typeof n[i]=="string"?(Y.lastIndex=0,Y.test(n[i])&&(Y.lastIndex=0,n[i]=Ce(n[i],e))):n[i]!==null&&typeof n[i]=="object"&&Ae(n[i],e);else n!==null&&typeof n=="object"&&Ae(n,e)}}function Bn(r){return/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/.test(r)}var En=new Set(["x","y","width","height","radius","rx","ry","cx","cy","x1","y1","x2","y2","fontSize","borderWidth","cornerRadius","opacity","fillOpacity","strokeOpacity","rotation","skewX","skewY","scaleX","scaleY","translateX","translateY","letterSpacing","wordSpacing","lineHeight","sides","arms","innerRadiusPercent","armWidthPercent","teeth","toothDepthPercent","holeRadiusPercent","turns","thicknessPercent","direction","headWidthPercent","headLengthPercent","shaftWidthPercent","shiftAngle","dashLength","gapLength","textPathStartOffset","imageOpacity"]);function On(r){return En.has(r)}function De(r){let e=r.templateVariables??[],t=new Set(e.map(a=>a.name)),n=new Set;for(let a of r.shapes)Ie(a.state,n);r.documentMetadata&&Ie(r.documentMetadata,n);let i=[...n].filter(a=>!t.has(a)).sort();return{defined:[...e],undeclared:i}}function Ie(r,e){for(let t of Object.values(r))if(typeof t=="string"){let n;for(Y.lastIndex=0;(n=Y.exec(t))!==null;)e.add(n[1])}else if(Array.isArray(t))for(let n of t)if(typeof n=="string"){let i;for(Y.lastIndex=0;(i=Y.exec(n))!==null;)e.add(i[1])}else n!==null&&typeof n=="object"&&Ie(n,e);else t!==null&&typeof t=="object"&&Ie(t,e)}function Ar(r){let e={};for(let t of r){let n=t.indexOf("=");if(n===-1)throw new Error(`Invalid variable format: "${t}". Expected "name=value".`);let i=t.slice(0,n).trim(),a=t.slice(n+1);if(!i)throw new Error(`Invalid variable format: "${t}". Variable name cannot be empty.`);e[i]=a}return e}var Ir=3,Lr=12;function Dr(r){return r==null||!Number.isFinite(r)?3:r<0?0:r>12?12:Math.floor(r)}function Ee(r,e){if(!Number.isFinite(r))return r;let t=Math.pow(10,e);return Math.round(r*t)/t}var Gn=/-?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?/g;function Zt(r,e){return r.replace(Gn,t=>{let n=parseFloat(t);return Number.isFinite(n)?String(Ee(n,e)):t})}var Un=new Set(["rawTransform","strokeDasharray","filterX","filterY","filterWidth","filterHeight","cssClipPath"]),zn=new Set(["metadata","customMetadata","customAttrs","customData","bindings","richTextData","cssMaskProperties","rawMetadata"]);function Q(r,e,t){if(e==null)return e;if(typeof e=="number")return Ee(e,t);if(typeof e=="string")return Un.has(r)?Zt(e,t):e;if(typeof e=="boolean")return e;if(Array.isArray(e))return e.map(n=>Q(r,n,t));if(typeof e=="object"){if(zn.has(r))return e;if(r==="symbolOverrides"){let i={};for(let[a,l]of Object.entries(e))i[a]=Q("state",l,t);return i}let n={};for(let[i,a]of Object.entries(e))n[i]=Q(i,a,t);return n}return e}function Be(r,e){return{id:r.id,type:r.type,state:Q("state",r.state,e)}}function Br(r,e){let t={...r,shapes:r.shapes.map(n=>Be(n,e)),viewboxes:r.viewboxes.map(n=>Q("viewbox",n,e))};return r.guides&&(t.guides=r.guides.map(n=>Q("guide",n,e))),r.measurements&&(t.measurements=r.measurements.map(n=>Q("measurement",n,e))),r.animationTimeline&&(t.animationTimeline=Q("animationTimeline",r.animationTimeline,e)),r.symbols&&(t.symbols=r.symbols.map(n=>({...n,shapes:n.shapes.map(i=>Be(i,e))}))),r.markers&&(t.markers=r.markers.map(n=>Q("marker",n,e))),r.customPatterns&&(t.customPatterns=r.customPatterns.map(n=>Q("customPattern",n,e))),t}function ye(r,e,t=-90){let n=[],i=t*Math.PI/180;for(let a=0;a<r;a++){let l=i+a*2*Math.PI/r;n.push({x:e*Math.cos(l),y:e*Math.sin(l)})}return n}function Ge(r,e,t,n=-90){let i=[],a=e*(t/100),l=n*Math.PI/180;for(let o=0;o<r*2;o++){let u=l+o*Math.PI/r,c=o%2===0?e:a;i.push({x:c*Math.cos(u),y:c*Math.sin(u)})}return i}function Ue(r,e,t=0){let n=r*(e/100)/2,i=[{x:-n,y:-r},{x:n,y:-r},{x:n,y:-n},{x:r,y:-n},{x:r,y:n},{x:n,y:n},{x:n,y:r},{x:-n,y:r},{x:-n,y:n},{x:-r,y:n},{x:-r,y:-n},{x:-n,y:-n}];if(t===0)return i;let a=Math.cos(t*Math.PI/180),l=Math.sin(t*Math.PI/180);return i.map(o=>({x:o.x*a-o.y*l,y:o.x*l+o.y*a}))}function ze(r,e,t,n,i=-90){let l=r*2*(t/100),o=r*(e/100),u=o*(n/100),c=[{x:r,y:0},{x:r-l,y:-o/2},{x:r-l,y:-u/2},{x:-r,y:-u/2},{x:-r,y:u/2},{x:r-l,y:u/2},{x:r-l,y:o/2}];if(i===0)return c;let h=Math.cos(i*Math.PI/180),d=Math.sin(i*Math.PI/180);return c.map(f=>({x:f.x*h-f.y*d,y:f.x*d+f.y*h}))}function Ne(r,e,t,n,i=0){let a=r,l=a*(t/100),o=a*(n/100),u=o/2,c=e*Math.PI/180,h=Math.cos(c),d=Math.sin(c),f=Math.abs(h),m=Math.abs(d),b=Math.max(f,m)||1,g={x:h*(a/b),y:d*(a/b)},x={x:g.x+h*l,y:g.y+d*l},v=Math.min(o,a-u),_=-a+u+v,S=a-u-v,$={x:-a,y:-a},w={x:a,y:-a},F={x:a,y:a},y={x:-a,y:a},k;if(f>=m&&h>0){let M=Math.max(_,Math.min(S,g.y)),A={x:a,y:M-u},D={x:a,y:M+u};k=[$,w,A,x,D,F,y]}else if(f>=m&&h<=0){let M=Math.max(_,Math.min(S,g.y)),A={x:-a,y:M+u},D={x:-a,y:M-u};k=[$,w,F,y,A,x,D]}else if(d<0){let M=Math.max(_,Math.min(S,g.x)),A={x:M-u,y:-a},D={x:M+u,y:-a};k=[$,A,x,D,w,F,y]}else{let M=Math.max(_,Math.min(S,g.x)),A={x:M+u,y:a},D={x:M-u,y:a};k=[$,w,F,A,x,D,y]}if(i===0)return k;let P=Math.cos(i*Math.PI/180),I=Math.sin(i*Math.PI/180);return k.map(M=>({x:M.x*P-M.y*I,y:M.x*I+M.y*P}))}function Ve(r,e,t,n,i=0){let a=Math.max(2,Math.round(e)),l=r*(t/100),o=r*(n/100)/2,u=a+1,c=[];for(let g=0;g<u;g++){let x=g/(u-1),v=-r+x*2*r,_=0;g>0&&g<u-1&&(_=g%2===1?l:-l),c.push({x:_,y:v})}let h=[],d=[];for(let g=0;g<u;g++){if(g===0||g===u-1){h.push({...c[g]}),d.push({...c[g]});continue}let x=c[g-1],v=c[g],_=c[g+1],S=v.x-x.x,$=v.y-x.y,w=Math.hypot(S,$)||1,F=S/w,y=$/w,k=_.x-v.x,P=_.y-v.y,I=Math.hypot(k,P)||1,M=k/I,A=P/I,D=(F+M)/2,L=(y+A)/2,E=Math.hypot(D,L),C,z;E<1e-6?(C=-y,z=F):(C=-L/E,z=D/E),h.push({x:v.x-C*o,y:v.y-z*o}),d.push({x:v.x+C*o,y:v.y+z*o})}let f=[];f.push(h[0]);for(let g=1;g<u-1;g++)f.push(d[g]);f.push(h[u-1]);for(let g=u-2;g>=1;g--)f.push(h[g]);if(i===0)return f;let m=Math.cos(i*Math.PI/180),b=Math.sin(i*Math.PI/180);return f.map(g=>({x:g.x*m-g.y*b,y:g.x*b+g.y*m}))}function He(r,e,t,n=0){let i=r,a=Math.max(.3,Math.min(.9,e/100)),l=-i*(t/100),o={x:0,y:i},u={x:0,y:l},c={x:-i*a,y:i*.4},h={x:-i*a,y:-i},d={x:i*a,y:-i},f={x:i*a,y:i*.4},m=[o,c,h,u,d,f,o],b=n===0?m:(()=>{let w=Math.cos(n*Math.PI/180),F=Math.sin(n*Math.PI/180);return m.map(y=>({x:y.x*w-y.y*F,y:y.x*F+y.y*w}))})(),[g,x,v,_,S,$]=b;return`M ${g.x} ${g.y} C ${x.x} ${x.y} ${v.x} ${v.y} ${_.x} ${_.y} C ${S.x} ${S.y} ${$.x} ${$.y} ${g.x} ${g.y} Z`}function We(r,e,t,n=0){let i=Math.max(3,Math.round(e)),a=Math.max(.3,Math.min(1,t/100)),l=r,o=l*1.7,u=l*1.15,c=[];for(let y=0;y<i;y++){let P=(90+y/i*360)*Math.PI/180;c.push({x:o/2*Math.cos(P),y:-(u/2)*Math.sin(P)})}let h=.15,d=0;for(let y=0;y<i;y++){let k=c[y],P=c[(y+1)%i];d=Math.max(d,Math.hypot(P.x-k.x,P.y-k.y))}let f=d/(2*(1-h))+.001,m=Math.max(f,d*(.68+a*.35)),b=c.map(y=>{let k=y.y/(u/2);return m*(1-h*k)});function g(y){let k=c[y],P=c[(y+1)%i],I=b[y],M=b[(y+1)%i],A=P.x-k.x,D=P.y-k.y,L=Math.hypot(A,D)||1,E=(I*I-M*M+L*L)/(2*L),C=Math.sqrt(Math.max(0,I*I-E*E)),z=k.x+E/L*A,j=k.y+E/L*D,K=-D/L,le=A/L,Z={x:z+K*C,y:j+le*C},G={x:z-K*C,y:j-le*C};return Z.x*Z.x+Z.y*Z.y>G.x*G.x+G.y*G.y?Z:G}let x=[];for(let y=0;y<i;y++)x.push(g(y));let v=14,_=[];for(let y=0;y<i;y++){let k=c[y],P=b[y],I=x[(y-1+i)%i],M=x[y],A=Math.atan2(I.y-k.y,I.x-k.x),L=Math.atan2(M.y-k.y,M.x-k.x)-A;L<=0&&(L+=2*Math.PI);let E=2*Math.PI-L,C=A+L/2,z=A-E/2,j={x:k.x+P*Math.cos(C),y:k.y+P*Math.sin(C)},K={x:k.x+P*Math.cos(z),y:k.y+P*Math.sin(z)},Z=j.x*j.x+j.y*j.y>K.x*K.x+K.y*K.y?L:-E;for(let G=0;G<v;G++){let ve=G/v,ue=A+ve*Z;_.push({x:k.x+P*Math.cos(ue),y:k.y+P*Math.sin(ue)})}}let S=0;for(let y of _){let k=Math.max(Math.abs(y.x),Math.abs(y.y));k>S&&(S=k)}if(S>0&&S!==l){let y=l/S;for(let k of _)k.x*=y,k.y*=y}let $=y=>{if(n===0)return y;let k=Math.cos(n*Math.PI/180),P=Math.sin(n*Math.PI/180);return{x:y.x*k-y.y*P,y:y.x*P+y.y*k}},w=_.map($),F=`M ${w[0].x} ${w[0].y}`;for(let y=1;y<w.length;y++)F+=` L ${w[y].x} ${w[y].y}`;return F+=" Z",F}function q(r,e=0,t=0){if(r.length<3)return"";if(e<=0)return r.map((a,l)=>(l===0?"M":"L")+`${a.x},${a.y}`).join(" ")+" Z";let n=Math.min(e,t*.4),i="";for(let a=0;a<r.length;a++){let l=r[(a-1+r.length)%r.length],o=r[a],u=r[(a+1)%r.length],c={x:l.x-o.x,y:l.y-o.y},h=Math.hypot(c.x,c.y);c.x/=h,c.y/=h;let d={x:u.x-o.x,y:u.y-o.y},f=Math.hypot(d.x,d.y);d.x/=f,d.y/=f;let m=Math.min(n,h/2),b=Math.min(n,f/2),g={x:o.x+c.x*m,y:o.y+c.y*m},x={x:o.x+d.x*b,y:o.y+d.y*b};i+=a===0?`M${g.x},${g.y}`:` L${g.x},${g.y}`,i+=` Q${o.x},${o.y} ${x.x},${x.y}`}return i+" Z"}function Xe(r,e,t="evenodd"){let n=r*(e/100),i=t==="nonzero"?1:0;return`M ${r} 0 A ${r} ${r} 0 1 1 ${-r} 0 A ${r} ${r} 0 1 1 ${r} 0 Z M ${n} 0 A ${n} ${n} 0 1 ${i} ${-n} 0 A ${n} ${n} 0 1 ${i} ${n} 0 Z`}function je(r,e,t,n=1,i=0){let a=r*(t/100),o=Math.round(e*36),u=e*2*Math.PI,c=(r-a/2)/u,h=i*Math.PI/180,d=[],f=[];for(let g=0;g<=o;g++){let x=g/o,v=x*u*n+h,_=c*(x*u)+a/2,S=a/2;d.push({x:(_+S*.3)*Math.cos(v),y:(_+S*.3)*Math.sin(v)}),f.push({x:Math.max(0,_-S*.3)*Math.cos(v),y:Math.max(0,_-S*.3)*Math.sin(v)})}let m=`M ${d[0].x} ${d[0].y}`;for(let g=1;g<d.length;g++)m+=` L ${d[g].x} ${d[g].y}`;let b=f[f.length-1];m+=` L ${b.x} ${b.y}`;for(let g=f.length-2;g>=0;g--)m+=` L ${f[g].x} ${f[g].y}`;return m+=" Z",m}var Nn=.2;function er(r,e,t,n=0){let i=e*(t/100),a=e,l=e-i,o=2*Math.PI/r,u=o*Nn/2,c=o/4,h=n*Math.PI/180,d=[];for(let f=0;f<r;f++){let m=h+f*o;d.push({x:l*Math.cos(m),y:l*Math.sin(m)}),d.push({x:a*Math.cos(m+c-u),y:a*Math.sin(m+c-u)}),d.push({x:a*Math.cos(m+c+u),y:a*Math.sin(m+c+u)}),d.push({x:l*Math.cos(m+o/2),y:l*Math.sin(m+o/2)})}return d}function Ye(r,e,t,n=0,i=0,a="evenodd",l=0){let o=er(r,e,t,l),u=Math.min(n,e*.1),c=q(o,u,e);if(i>0){let h=e*(i/100),d=a==="nonzero"?1:0;c+=` M ${h} 0 A ${h} ${h} 0 1 ${d} ${-h} 0 A ${h} ${h} 0 1 ${d} ${h} 0 Z`}return c}function qe(r,e,t,n,i,a="round",l="uniform",o){let u=Math.min(t,n)/2,c,h,d,f,m,b,g,x;if(l==="non-uniform"&&o?(c=Math.min(o.radiusTL??i,u),h=Math.min(o.radiusTR??i,u),d=Math.min(o.radiusBR??i,u),f=Math.min(o.radiusBL??i,u),m=o.shapeTL??a,b=o.shapeTR??a,g=o.shapeBR??a,x=o.shapeBL??a):(c=h=d=f=Math.min(i,u),m=b=g=x=a),!(a!=="round"||l==="non-uniform"||c>0&&m!=="round"||h>0&&b!=="round"||d>0&&g!=="round"||f>0&&x!=="round")&&c===h&&h===d&&d===f)return null;let _=`M${r+c},${e}`;return _+=` L${r+t-h},${e}`,_+=Oe(b,h,r+t,e,"tr"),_+=` L${r+t},${e+n-d}`,_+=Oe(g,d,r+t,e+n,"br"),_+=` L${r+f},${e+n}`,_+=Oe(x,f,r,e+n,"bl"),_+=` L${r},${e+c}`,_+=Oe(m,c,r,e,"tl"),_+=" Z",_}function Oe(r,e,t,n,i){if(e<=0)return"";switch(r){case"round":switch(i){case"tr":return` A${e},${e} 0 0 1 ${t},${n+e}`;case"br":return` A${e},${e} 0 0 1 ${t-e},${n}`;case"bl":return` A${e},${e} 0 0 1 ${t},${n-e}`;case"tl":return` A${e},${e} 0 0 1 ${t+e},${n}`}break;case"scoop":switch(i){case"tr":return` A${e},${e} 0 0 0 ${t},${n+e}`;case"br":return` A${e},${e} 0 0 0 ${t-e},${n}`;case"bl":return` A${e},${e} 0 0 0 ${t},${n-e}`;case"tl":return` A${e},${e} 0 0 0 ${t+e},${n}`}break;case"bevel":switch(i){case"tr":return` L${t},${n+e}`;case"br":return` L${t-e},${n}`;case"bl":return` L${t},${n-e}`;case"tl":return` L${t+e},${n}`}break;case"notch":switch(i){case"tr":return` L${t-e},${n+e} L${t},${n+e}`;case"br":return` L${t-e},${n-e} L${t-e},${n}`;case"bl":return` L${t+e},${n-e} L${t},${n-e}`;case"tl":return` L${t+e},${n+e} L${t+e},${n}`}break}return""}function de(r,e,t=!1,n=.5,i){if(r.length<2)return r.length===1?`M ${r[0].x} ${r[0].y}`:"";switch(e){case"CATMULL_ROM":case"catmull-rom":return Xn(r,t,n);case"BASIS":case"basis":return jn(r,t);case"ARC":case"arc":return i&&i.length>0?Vn(r,t,i):be(r,t,"CUBIC");case"LINEAR":case"linear":return be(r,t,"LINEAR");case"QUADRATIC":case"quadratic":return be(r,t,"QUADRATIC");case"CUBIC":case"cubic":return be(r,t,"CUBIC");default:return be(r,t)}}function Vn(r,e,t){let n=`M ${r[0].x} ${r[0].y}`,i=0,a={rx:50,ry:50,rotation:0,largeArc:!1,sweep:!0};for(let l=0;l<r.length-1;l++){let o=r[l+1];if(o.isSubpathStart){if(e&&l-i>=1){let c=r[i],h=t?.[l]??a;n+=` A ${h.rx} ${h.ry} ${h.rotation} ${h.largeArc?1:0} ${h.sweep?1:0} ${c.x} ${c.y} Z`}n+=` M ${o.x} ${o.y}`,i=l+1;continue}let u=t?.[l]??a;n+=` A ${u.rx} ${u.ry} ${u.rotation} ${u.largeArc?1:0} ${u.sweep?1:0} ${o.x} ${o.y}`}if(e&&r.length-i>1){let l=r[i],o=t?.[r.length-1]??a;n+=` A ${o.rx} ${o.ry} ${o.rotation} ${o.largeArc?1:0} ${o.sweep?1:0} ${l.x} ${l.y} Z`}return n}function be(r,e,t){let n=`M ${r[0].x} ${r[0].y}`,i=0,a=null,l=null;for(let o=0;o<r.length-1;o++){let u=r[o],c=r[o+1];if(c.isSubpathStart){if(e&&o-i>=1){let d=r[i];n+=Qt(u,d,d.segmentType,a,l,t),n+=" Z"}n+=` M ${c.x} ${c.y}`,i=o+1,a=null,l=null;continue}n+=Qt(u,c,c.segmentType,a,l,t);let h=Wn(c.segmentType??t,u,c);a=h,h==="quad"?l=u.handleOut??null:l=null}if(e&&r.length-i>1){let o=r[r.length-1],u=r[i];n+=Qt(o,u,u.segmentType,a,l,t),n+=" Z"}return n}var Hn=.001;function ce(r,e){return Math.abs(r-e)<Hn}function Wn(r,e,t){let n=(r??(e.handleOut||t.handleIn?"CUBIC":"LINEAR")).toUpperCase();return n==="CUBIC"||n==="SMOOTH_CUBIC"?"cubic":n==="QUADRATIC"||n==="SMOOTH_QUADRATIC"?"quad":null}function Qt(r,e,t,n,i,a){let l=(t??a??(r.handleOut||e.handleIn?"CUBIC":"LINEAR")).toUpperCase();if(l==="LINEAR"||l==="HORIZONTAL"||l==="VERTICAL")return(l==="HORIZONTAL"||l==="LINEAR")&&ce(r.y,e.y)?` H ${e.x}`:(l==="VERTICAL"||l==="LINEAR")&&ce(r.x,e.x)?` V ${e.y}`:` L ${e.x} ${e.y}`;if(l==="ARC"){let c=e.arcParams;return c?` A ${c.rx} ${c.ry} ${c.rotation} ${c.largeArc?1:0} ${c.sweep?1:0} ${e.x} ${e.y}`:` L ${e.x} ${e.y}`}if(l==="QUADRATIC"||l==="SMOOTH_QUADRATIC"){let c=r.handleOut??{x:(r.x+e.x)/2,y:(r.y+e.y)/2};return n==="quad"&&i&&ce(c.x,2*r.x-i.x)&&ce(c.y,2*r.y-i.y)?` T ${e.x} ${e.y}`:` Q ${c.x} ${c.y} ${e.x} ${e.y}`}let o=r.handleOut??{x:r.x,y:r.y},u=e.handleIn??{x:e.x,y:e.y};return n==="cubic"&&r.handleIn&&r.handleOut&&ce(r.handleOut.x,2*r.x-r.handleIn.x)&&ce(r.handleOut.y,2*r.y-r.handleIn.y)?` S ${u.x} ${u.y} ${e.x} ${e.y}`:` C ${o.x} ${o.y} ${u.x} ${u.y} ${e.x} ${e.y}`}function Xn(r,e,t){if(r.length<2)return r.length===1?`M ${r[0].x} ${r[0].y}`:"";let n=t,i=e?[r[r.length-1],...r,r[0],r[1]]:[r[0],...r,r[r.length-1]],a=`M ${r[0].x} ${r[0].y}`,l=e?r.length:r.length-1;for(let o=0;o<l;o++){let u=i[o],c=i[o+1],h=i[o+2],d=i[o+3],f=Math.hypot(h.x-c.x,h.y-c.y),m=Math.hypot(c.x-u.x,c.y-u.y),b=Math.hypot(d.x-h.x,d.y-h.y),g=Math.pow(m,n),x=Math.pow(f,n),v=Math.pow(b,n),_=Math.pow(m,2*n),S=Math.pow(f,2*n),$=Math.pow(b,2*n),w,F,y,k;m<1e-8?(w=c.x,F=c.y):(w=(_*h.x-S*u.x+(2*_+3*g*x+S)*c.x)/(3*g*(g+x)),F=(_*h.y-S*u.y+(2*_+3*g*x+S)*c.y)/(3*g*(g+x))),b<1e-8?(y=h.x,k=h.y):(y=($*c.x-S*d.x+(2*$+3*v*x+S)*h.x)/(3*v*(v+x)),k=($*c.y-S*d.y+(2*$+3*v*x+S)*h.y)/(3*v*(v+x))),a+=` C ${w} ${F} ${y} ${k} ${h.x} ${h.y}`}return e&&(a+=" Z"),a}function jn(r,e){let t=r.length;if(t<2)return t===1?`M ${r[0].x} ${r[0].y}`:"";if(t===2)return`M ${r[0].x} ${r[0].y} L ${r[1].x} ${r[1].y}`;if(e){let a=(r[0].x+4*r[1].x+r[2].x)/6,l=(r[0].y+4*r[1].y+r[2].y)/6,o=`M ${a} ${l}`;for(let u=0;u<t;u++){let c=r[(u+1)%t],h=r[(u+2)%t],d=r[(u+3)%t];o+=Jt(c,h,d)}return o+=" Z",o}let n=r,i=`M ${n[0].x} ${n[0].y}`;i+=` L ${(5*n[0].x+n[1].x)/6} ${(5*n[0].y+n[1].y)/6}`;for(let a=0;a<=t-3;a++)i+=Jt(n[a],n[a+1],n[a+2]);return i+=Jt(n[t-2],n[t-1],n[t-1]),i+=` L ${n[t-1].x} ${n[t-1].y}`,i}function Jt(r,e,t){return` C ${(2*r.x+e.x)/3} ${(2*r.y+e.y)/3} ${(r.x+2*e.x)/3} ${(r.y+2*e.y)/3} ${(r.x+4*e.x+t.x)/6} ${(r.y+4*e.y+t.y)/6}`}function he(r,e,t){let n=Number.isFinite(e)?Math.max(1,e):8,i=Number.isFinite(t)?Math.max(1,t):4;switch(r){case"dashed":case"dotted":case"custom":return`${n} ${i}`;default:return null}}function O(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function Yn(r){let e=r.fillType;return e||(r.fillGradient?r.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":r.linearGradient?"linear-gradient":r.radialGradient?"radial-gradient":"solid")}function Ke(r){let e=new Map,t=r.state,n=t;switch(r.type){case"circle":e.set("cx",String(t.x??0)),e.set("cy",String(t.y??0)),e.set("r",String(t.radius??50));break;case"ellipse":e.set("cx",String(t.cx??0)),e.set("cy",String(t.cy??0)),e.set("rx",String(t.rx??50)),e.set("ry",String(t.ry??30));break;case"rectangle":case"square":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),e.set("width",String(t.width??100)),e.set("height",String(t.height??100));{let $=t.rx??t.cornerRadius??0,w=t.ry??t.cornerRadius??0;($>0||w>0)&&(e.set("rx",String($)),e.set("ry",String(w)))}break;case"line":e.set("x1",String(t.x1??0)),e.set("y1",String(t.y1??0)),e.set("x2",String(t.x2??0)),e.set("y2",String(t.y2??0));break;case"text":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),t.fontSize&&e.set("font-size",String(t.fontSize)),t.fontFamily&&e.set("font-family",t.fontFamily),t.fontWeight&&e.set("font-weight",t.fontWeight),t.fontStyle&&e.set("font-style",t.fontStyle),t.textAnchor&&e.set("text-anchor",t.textAnchor),t.letterSpacing&&e.set("letter-spacing",String(t.letterSpacing));break;case"image":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),e.set("width",String(t.width??100)),e.set("height",String(t.height??100)),n.href&&e.set("href",String(n.href));break}let i=Yn(n);i==="none"?e.set("fill","none"):i==="linear-gradient"||i==="radial-gradient"?e.set("fill",`url(#gradient-fill-${r.id})`):i==="pattern"?e.set("fill",`url(#pattern-fill-${r.id})`):e.set("fill",t.fillColor??"#000000");let a=t.opacity;a!==void 0&&a<1&&e.set("opacity",String(a));let l=t.fillOpacity;l!==void 0&&l<1&&e.set("fill-opacity",String(l)),t.fillRule&&t.fillRule!=="nonzero"&&e.set("fill-rule",t.fillRule);let o=n.strokeType??"solid";if(o==="none")e.set("stroke","none");else if(o==="linear-gradient"||o==="radial-gradient")e.set("stroke",`url(#gradient-stroke-${r.id})`);else{let $=t.borderColor??"none";$!=="none"&&e.set("stroke",$)}let u=t.borderWidth;u!=null&&u!==0&&e.set("stroke-width",String(u));let c=t.strokeOpacity;c!==void 0&&c<1&&e.set("stroke-opacity",String(c));let h=t.lineStyle??"solid",d=t.dashLength??8,f=t.gapLength??4,m=he(h,d,f);m&&(e.set("stroke-dasharray",m),h==="dotted"&&e.set("stroke-linecap","round"));let b=qn(n);b&&e.set("transform",b);let g=n.filters;g&&g.length>0&&e.set("filter",`url(#filter-${r.id})`);let x=t.shapeRendering;x&&x!=="auto"&&e.set("shape-rendering",x),t.pathLength!==void 0&&e.set("pathLength",String(t.pathLength));let v=n.startEndpoint,_=n.endEndpoint;v&&v!=="none"&&e.set("marker-start",`url(#line-marker-${v})`),_&&_!=="none"&&e.set("marker-end",`url(#line-marker-${_})`);let S=n.metadata;return S&&(S.role&&e.set("role",S.role),S.ariaLabel&&e.set("aria-label",S.ariaLabel)),e}function Er(r){switch(r.type){case"circle":return"circle";case"ellipse":return"ellipse";case"rectangle":case"square":return"rect";case"line":return"line";case"text":return"text";case"image":return"image";case"path":case"polyline":case"triangle":case"ngon":case"star":case"cross":case"ring":case"spiral":case"gear":case"arrow":return"path";default:return"g"}}function qn(r){let e=r.rotation??0,t=r.skewX??0,n=r.skewY??0,i=r.scaleX??1,a=r.scaleY??1,l=r.translateX??0,o=r.translateY??0,u=l!==0||o!==0;if(!u&&e===0&&t===0&&n===0&&i===1&&a===1)return null;let c=r.customPivot;if(!c&&!u)return null;let h=[];return u&&h.push(`translate(${l}, ${o})`),c&&(e!==0||t!==0||n!==0||i!==1||a!==1)&&(h.push(`translate(${c.x}, ${c.y})`),e!==0&&h.push(`rotate(${e})`),(i!==1||a!==1)&&h.push(`scale(${i}, ${a})`),t!==0&&h.push(`skewX(${t})`),n!==0&&h.push(`skewY(${n})`),h.push(`translate(${-c.x}, ${-c.y})`)),h.join(" ")}function J(r,e){let t=r.viewboxes?.[0];return{width:e.width??t?.width??800,height:e.height??t?.height??600}}function s(r,e){return e==null||e===""?"":` ${r}="${O(String(e))}"`}function Qe(r){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);return e?{r:parseInt(e[1],16)/255,g:parseInt(e[2],16)/255,b:parseInt(e[3],16)/255}:{r:0,g:0,b:0}}function Kn(r,e,t){let{offsetX:n,offsetY:i,blurRadius:a,spread:l,color:o,opacity:u}=r,c="";if(l===0)c+=`<feDropShadow${s("in",e)}${s("dx",n)}${s("dy",i)}${s("stdDeviation",a/2)}${s("flood-color",o)}${s("flood-opacity",u)}${s("result",`${t}_shadow`)}/>`,c+=`<feMerge${s("result",t)}><feMergeNode${s("in",`${t}_shadow`)}/><feMergeNode${s("in",e)}/></feMerge>`;else{c+=`<feColorMatrix${s("in",e)}${s("type","matrix")}${s("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${s("result",`${t}_alpha`)}/>`;let h=l>0?"dilate":"erode",d=Math.abs(l);c+=`<feMorphology${s("in",`${t}_alpha`)}${s("operator",h)}${s("radius",d)}${s("result",`${t}_spread`)}/>`,c+=`<feGaussianBlur${s("in",`${t}_spread`)}${s("stdDeviation",a/2)}${s("result",`${t}_blur`)}/>`,c+=`<feOffset${s("in",`${t}_blur`)}${s("dx",n)}${s("dy",i)}${s("result",`${t}_offset`)}/>`,c+=`<feFlood${s("flood-color",o)}${s("flood-opacity",u)}${s("result",`${t}_color`)}/>`,c+=`<feComposite${s("in",`${t}_color`)}${s("in2",`${t}_offset`)}${s("operator","in")}${s("result",`${t}_shadow`)}/>`,c+=`<feMerge${s("result",t)}><feMergeNode${s("in",`${t}_shadow`)}/><feMergeNode${s("in",e)}/></feMerge>`}return c}function Zn(r,e,t){let{offsetX:n,offsetY:i,blurRadius:a,choke:l,color:o,opacity:u}=r,c=a*(1-l/100),h="";return h+=`<feColorMatrix${s("in",e)}${s("type","matrix")}${s("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${s("result",`${t}_alpha`)}/>`,h+=`<feComponentTransfer${s("in",`${t}_alpha`)}${s("result",`${t}_inverted`)}><feFuncA${s("type","table")}${s("tableValues","1 0")}/></feComponentTransfer>`,h+=`<feGaussianBlur${s("in",`${t}_inverted`)}${s("stdDeviation",c/2)}${s("result",`${t}_blur`)}/>`,h+=`<feOffset${s("in",`${t}_blur`)}${s("dx",n)}${s("dy",i)}${s("result",`${t}_offset`)}/>`,h+=`<feFlood${s("flood-color",o)}${s("flood-opacity",u)}${s("result",`${t}_color`)}/>`,h+=`<feComposite${s("in",`${t}_color`)}${s("in2",`${t}_offset`)}${s("operator","in")}${s("result",`${t}_coloredShadow`)}/>`,h+=`<feComposite${s("in",`${t}_coloredShadow`)}${s("in2",`${t}_alpha`)}${s("operator","in")}${s("result",`${t}_innerShadow`)}/>`,h+=`<feComposite${s("in",`${t}_innerShadow`)}${s("in2",e)}${s("operator","over")}${s("result",t)}/>`,h}function Qn(r,e,t){let{blurX:n,blurY:i}=r;return n===0&&i===0?B(e,t):`<feGaussianBlur${s("in",e)}${s("stdDeviation",`${n/2} ${i/2}`)}${s("result",t)}/>`}function Jn(r,e,t){let{distance:n,angle:i}=r;if(n===0)return B(e,t);let a=i*Math.PI/180,l=Math.abs(Math.cos(a)*n),o=Math.abs(Math.sin(a)*n);return`<feGaussianBlur${s("in",e)}${s("stdDeviation",`${l/2} ${o/2}`)}${s("result",t)}/>`}function Or(r,e,t){let{x:n,y:i,z:a,color:l,surfaceScale:o,diffuseConstant:u,specularConstant:c,specularExponent:h}=r,d="";return d+=`<feDiffuseLighting${s("in","SourceAlpha")}${s("surfaceScale",o)}${s("diffuseConstant",u)}${s("lighting-color",l)}${s("result",`${t}_diffuse`)}>`,d+=`<fePointLight${s("x",n)}${s("y",i)}${s("z",a)}/>`,d+="</feDiffuseLighting>",d+=`<feSpecularLighting${s("in","SourceAlpha")}${s("surfaceScale",o)}${s("specularConstant",c)}${s("specularExponent",h)}${s("lighting-color",l)}${s("result",`${t}_specular`)}>`,d+=`<fePointLight${s("x",n)}${s("y",i)}${s("z",a)}/>`,d+="</feSpecularLighting>",d+=`<feComposite${s("in",e)}${s("in2",`${t}_diffuse`)}${s("operator","arithmetic")}${s("k1",1)}${s("k2",0)}${s("k3",0)}${s("k4",0)}${s("result",`${t}_lit`)}/>`,d+=`<feComposite${s("in",`${t}_specular`)}${s("in2",`${t}_lit`)}${s("operator","arithmetic")}${s("k1",0)}${s("k2",1)}${s("k3",1)}${s("k4",0)}${s("result",t)}/>`,d}function Gr(r,e,t){let{x:n,y:i,z:a,pointsAtX:l,pointsAtY:o,pointsAtZ:u,coneAngle:c,color:h,surfaceScale:d,specularConstant:f,specularExponent:m}=r,b="";return b+=`<feSpecularLighting${s("in","SourceAlpha")}${s("surfaceScale",d)}${s("specularConstant",f)}${s("specularExponent",m)}${s("lighting-color",h)}${s("result",`${t}_specular`)}>`,b+=`<feSpotLight${s("x",n)}${s("y",i)}${s("z",a)}${s("pointsAtX",l)}${s("pointsAtY",o)}${s("pointsAtZ",u)}${s("limitingConeAngle",c)}/>`,b+="</feSpecularLighting>",b+=`<feComposite${s("in",`${t}_specular`)}${s("in2","SourceAlpha")}${s("operator","in")}${s("result",`${t}_clipped`)}/>`,b+=`<feComposite${s("in",`${t}_clipped`)}${s("in2",e)}${s("operator","arithmetic")}${s("k1",0)}${s("k2",1)}${s("k3",1)}${s("k4",0)}${s("result",t)}/>`,b}function Ur(r){switch(r.kind){case"point":return`<fePointLight${s("x",r.x)}${s("y",r.y)}${s("z",r.z)}/>`;case"spot":{let e=`<feSpotLight${s("x",r.x)}${s("y",r.y)}${s("z",r.z)}${s("pointsAtX",r.pointsAtX)}${s("pointsAtY",r.pointsAtY)}${s("pointsAtZ",r.pointsAtZ)}`;return r.limitingConeAngle!==void 0&&(e+=s("limitingConeAngle",r.limitingConeAngle)),r.specularExponent!==void 0&&(e+=s("specularExponent",r.specularExponent)),e+"/>"}case"distant":return`<feDistantLight${s("azimuth",r.azimuth)}${s("elevation",r.elevation)}/>`}}function ei(r,e,t){return`<feDiffuseLighting${s("in",e)}${s("surfaceScale",r.surfaceScale)}${s("diffuseConstant",r.diffuseConstant)}${s("lighting-color",r.color)}${s("result",t)}>`+Ur(r.lightSource)+"</feDiffuseLighting>"}function ti(r,e,t){return`<feSpecularLighting${s("in",e)}${s("surfaceScale",r.surfaceScale)}${s("specularConstant",r.specularConstant)}${s("specularExponent",r.specularExponent)}${s("lighting-color",r.color)}${s("result",t)}>`+Ur(r.lightSource)+"</feSpecularLighting>"}function ri(r,e,t){let{width:n,color:i,opacity:a,position:l}=r,o="";if(l==="inside")o+=`<feMorphology${s("in","SourceAlpha")}${s("operator","erode")}${s("radius",n)}${s("result",`${t}_eroded`)}/>`,o+=`<feComposite${s("in","SourceAlpha")}${s("in2",`${t}_eroded`)}${s("operator","out")}${s("result",`${t}_outlineAlpha`)}/>`,o+=`<feFlood${s("flood-color",i)}${s("flood-opacity",a)}${s("result",`${t}_color`)}/>`,o+=`<feComposite${s("in",`${t}_color`)}${s("in2",`${t}_outlineAlpha`)}${s("operator","in")}${s("result",`${t}_outline`)}/>`,o+=`<feComposite${s("in",`${t}_outline`)}${s("in2",e)}${s("operator","over")}${s("result",t)}/>`;else{let u=l==="outside"?n:n/2;o+=`<feMorphology${s("in","SourceAlpha")}${s("operator","dilate")}${s("radius",u)}${s("result",`${t}_dilated`)}/>`,o+=`<feComposite${s("in",`${t}_dilated`)}${s("in2","SourceAlpha")}${s("operator","out")}${s("result",`${t}_outlineAlpha`)}/>`,o+=`<feFlood${s("flood-color",i)}${s("flood-opacity",a)}${s("result",`${t}_color`)}/>`,o+=`<feComposite${s("in",`${t}_color`)}${s("in2",`${t}_outlineAlpha`)}${s("operator","in")}${s("result",`${t}_outline`)}/>`,o+=`<feMerge${s("result",t)}><feMergeNode${s("in",`${t}_outline`)}/><feMergeNode${s("in",e)}/></feMerge>`}return o}function ni(r,e,t){let{amount:n}=r;if(n===0)return B(e,t);let i=1+4*n,a=-n,l=[0,a,0,a,i,a,0,a,0].join(" ");return`<feConvolveMatrix${s("in",e)}${s("order","3")}${s("kernelMatrix",l)}${s("divisor","1")}${s("bias","0")}${s("preserveAlpha","true")}${s("edgeMode","duplicate")}${s("result",t)}/>`}function ii(r,e,t){let{blockSize:n}=r;if(n<=1)return B(e,t);let i=n/2,a="";return a+=`<feMorphology${s("in",e)}${s("operator","erode")}${s("radius",i)}${s("result",`${t}_eroded`)}/>`,a+=`<feMorphology${s("in",`${t}_eroded`)}${s("operator","dilate")}${s("radius",i)}${s("result",t)}/>`,a}function si(r,e,t){let{scale:n,frequency:i,octaves:a,warpType:l}=r;if(n===0)return B(e,t);let o="";return o+=`<feTurbulence${s("type",l)}${s("baseFrequency",i)}${s("numOctaves",a)}${s("seed",0)}${s("result",`${t}_turbulence`)}/>`,o+=`<feDisplacementMap${s("in",e)}${s("in2",`${t}_turbulence`)}${s("scale",n)}${s("xChannelSelector","R")}${s("yChannelSelector","G")}${s("result",t)}/>`,o}function ai(r,e,t){let{operator:n,radiusX:i,radiusY:a}=r;return i===0&&a===0?B(e,t):`<feMorphology${s("in",e)}${s("operator",n)}${s("radius",`${i} ${a}`)}${s("result",t)}/>`}function oi(r,e,t){let{levels:n}=r;if(n<2)return B(e,t);let i=[];for(let o=0;o<n;o++)i.push(o/(n-1));let a=i.join(" "),l=`<feComponentTransfer${s("in",e)}${s("result",t)}>`;return l+=`<feFuncR${s("type","discrete")}${s("tableValues",a)}/>`,l+=`<feFuncG${s("type","discrete")}${s("tableValues",a)}/>`,l+=`<feFuncB${s("type","discrete")}${s("tableValues",a)}/>`,l+="</feComponentTransfer>",l}function li(r,e,t){let{levels:n,contrast:i}=r;if(n<2)return B(e,t);let a=[];for(let u=0;u<n;u++){let c=u/(n-1),h=c;i!==1&&(h=.5+(c-.5)*i,h=Math.max(0,Math.min(1,h))),a.push(h)}let l=a.join(" "),o=`<feComponentTransfer${s("in",e)}${s("result",t)}>`;return o+=`<feFuncR${s("type","table")}${s("tableValues",l)}/>`,o+=`<feFuncG${s("type","table")}${s("tableValues",l)}/>`,o+=`<feFuncB${s("type","table")}${s("tableValues",l)}/>`,o+="</feComponentTransfer>",o}function ui(r,e,t){let{radius:n}=r;if(n===0)return B(e,t);let i="";return i+=`<feGaussianBlur${s("in","SourceAlpha")}${s("stdDeviation",n)}${s("result",`${t}_blurredAlpha`)}/>`,i+=`<feComponentTransfer${s("in",`${t}_blurredAlpha`)}${s("result",`${t}_thresholdAlpha`)}><feFuncA${s("type","linear")}${s("slope",20)}${s("intercept",-9)}/></feComponentTransfer>`,i+=`<feComposite${s("in",e)}${s("in2",`${t}_thresholdAlpha`)}${s("operator","in")}${s("result",t)}/>`,i}function ci(r,e,t){let{amount:n}=r;if(n===0)return B(e,t);let i=1-n;return`<feColorMatrix${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("type","saturate")}${s("values",i)}${s("result",t)}/>`}function di(r,e,t){let{red:n,green:i,blue:a}=r;if(n===1&&i===1&&a===1)return B(e,t);let l=`<feComponentTransfer${s("in",e)}${s("result",t)}>`;return l+=`<feFuncR${s("type","linear")}${s("slope",n)}${s("intercept",0)}/>`,l+=`<feFuncG${s("type","linear")}${s("slope",i)}${s("intercept",0)}/>`,l+=`<feFuncB${s("type","linear")}${s("slope",a)}${s("intercept",0)}/>`,l+="</feComponentTransfer>",l}function hi(r,e,t){let{amount:n}=r;if(n===1)return B(e,t);let i=`<feComponentTransfer${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("result",t)}>`;return i+=`<feFuncR${s("type","linear")}${s("slope",n)}${s("intercept",0)}/>`,i+=`<feFuncG${s("type","linear")}${s("slope",n)}${s("intercept",0)}/>`,i+=`<feFuncB${s("type","linear")}${s("slope",n)}${s("intercept",0)}/>`,i+="</feComponentTransfer>",i}function pi(r,e,t){let{amount:n}=r;if(n===1)return B(e,t);let i=.5*(1-n),a=`<feComponentTransfer${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("result",t)}>`;return a+=`<feFuncR${s("type","linear")}${s("slope",n)}${s("intercept",i)}/>`,a+=`<feFuncG${s("type","linear")}${s("slope",n)}${s("intercept",i)}/>`,a+=`<feFuncB${s("type","linear")}${s("slope",n)}${s("intercept",i)}/>`,a+="</feComponentTransfer>",a}function fi(r,e,t){let{amount:n}=r;if(n===1)return B(e,t);let i=`<feComponentTransfer${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("result",t)}>`;return i+=`<feFuncA${s("type","linear")}${s("slope",n)}${s("intercept",0)}/>`,i+="</feComponentTransfer>",i}function mi(r,e,t){let{amount:n}=r;if(n===0)return B(e,t);let i=n,a=1-n,l=`${i} ${a}`,o=`<feComponentTransfer${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("result",t)}>`;return o+=`<feFuncR${s("type","table")}${s("tableValues",l)}/>`,o+=`<feFuncG${s("type","table")}${s("tableValues",l)}/>`,o+=`<feFuncB${s("type","table")}${s("tableValues",l)}/>`,o+="</feComponentTransfer>",o}function gi(r,e,t){let{angle:n}=r;return n===0||n===360?B(e,t):`<feColorMatrix${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("type","hueRotate")}${s("values",n)}${s("result",t)}/>`}function bi(r,e,t){let{amount:n}=r;return n===1?B(e,t):`<feColorMatrix${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("type","saturate")}${s("values",n)}${s("result",t)}/>`}function yi(r,e,t){let{threshold:n}=r,i="";if(i+=`<feColorMatrix${s("in",e)}${s("type","saturate")}${s("values",0)}${s("result",`${t}_gray`)}/>`,n===.5)i+=`<feComponentTransfer${s("in",`${t}_gray`)}${s("result",t)}>`,i+=`<feFuncR${s("type","discrete")}${s("tableValues","0 1")}/>`,i+=`<feFuncG${s("type","discrete")}${s("tableValues","0 1")}/>`,i+=`<feFuncB${s("type","discrete")}${s("tableValues","0 1")}/>`,i+="</feComponentTransfer>";else{let l=[];for(let u=0;u<256;u++)l.push(u/255<n?0:1);let o=l.join(" ");i+=`<feComponentTransfer${s("in",`${t}_gray`)}${s("result",t)}>`,i+=`<feFuncR${s("type","table")}${s("tableValues",o)}/>`,i+=`<feFuncG${s("type","table")}${s("tableValues",o)}/>`,i+=`<feFuncB${s("type","table")}${s("tableValues",o)}/>`,i+="</feComponentTransfer>"}return i}function $i(r,e,t){let{amount:n}=r;if(n===0)return B(e,t);let i=[.393,.769,.189,0,0],a=[.349,.686,.168,0,0],l=[.272,.534,.131,0,0],o=[1,0,0,0,0],u=[0,1,0,0,0],c=[0,0,1,0,0],h=(g,x)=>g.map((v,_)=>v*(1-n)+x[_]*n),d=h(o,i),f=h(u,a),m=h(c,l),b=[...d,...f,...m,0,0,0,1,0].join(" ");return`<feColorMatrix${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("type","matrix")}${s("values",b)}${s("result",t)}/>`}function xi(r,e,t){let{shadowColor:n,highlightColor:i}=r,a=Qe(n),l=Qe(i),o="";return o+=`<feColorMatrix${s("in",e)}${s("type","saturate")}${s("values",0)}${s("result",`${t}_gray`)}/>`,o+=`<feComponentTransfer${s("in",`${t}_gray`)}${s("result",t)}>`,o+=`<feFuncR${s("type","table")}${s("tableValues",`${a.r} ${l.r}`)}/>`,o+=`<feFuncG${s("type","table")}${s("tableValues",`${a.g} ${l.g}`)}/>`,o+=`<feFuncB${s("type","table")}${s("tableValues",`${a.b} ${l.b}`)}/>`,o+="</feComponentTransfer>",o}function Si(r,e,t){let{intensity:n}=r;if(n===0)return B(e,t);let i="";i+=`<feComponentTransfer${s("in",e)}${s("result",`${t}_invert`)}>`,i+=`<feFuncR${s("type","table")}${s("tableValues","1 0")}/>`,i+=`<feFuncG${s("type","table")}${s("tableValues","1 0")}/>`,i+=`<feFuncB${s("type","table")}${s("tableValues","1 0")}/>`,i+="</feComponentTransfer>",i+=`<feColorMatrix${s("in",`${t}_invert`)}${s("type","saturate")}${s("values",0)}${s("result",`${t}_gray`)}/>`;let a=[.1,.1,.1,0,0],l=[.3,.4,.3,0,0],o=[.5,.5,.8,0,0],u=[1,0,0,0,0],c=[0,1,0,0,0],h=[0,0,1,0,0],d=(x,v)=>x.map((_,S)=>_*(1-n)+v[S]*n),f=d(u,a),m=d(c,l),b=d(h,o),g=[...f,...m,...b,0,0,0,1,0].join(" ");return i+=`<feColorMatrix${s("in",`${t}_gray`)}${s("type","matrix")}${s("values",g)}${s("result",t)}/>`,i}function ki(r,e,t){let{amount:n,scale:i}=r;if(n===0)return B(e,t);let a=1/i,l="";return l+=`<feTurbulence${s("type","fractalNoise")}${s("baseFrequency",a)}${s("numOctaves",3)}${s("seed",0)}${s("result",`${t}_noise`)}/>`,l+=`<feColorMatrix${s("in",`${t}_noise`)}${s("type","saturate")}${s("values",0)}${s("result",`${t}_noiseGray`)}/>`,l+=`<feBlend${s("in",e)}${s("in2",`${t}_noiseGray`)}${s("mode","overlay")}${s("result",`${t}_blended`)}/>`,l+=`<feComposite${s("in",`${t}_blended`)}${s("in2",e)}${s("operator","arithmetic")}${s("k1",0)}${s("k2",n)}${s("k3",1-n)}${s("k4",0)}${s("result",`${t}_amt`)}/>`,l+=`<feComposite${s("in",`${t}_amt`)}${s("in2",e)}${s("operator","in")}${s("result",t)}/>`,l}function _i(r,e,t){let{strength:n,angle:i}=r;if(n===0)return B(e,t);let a=i*Math.PI/180,l=Math.cos(a),o=Math.sin(a),u=n,c=[-(u*(l+o)),-(u*o),u*(-l+o),-(u*l),1,u*l,u*(l-o),u*o,u*(l+o)].join(" ");return`<feConvolveMatrix${s("in",e)}${s("order","3 3")}${s("kernelMatrix",c)}${s("divisor",1)}${s("bias",.5)}${s("preserveAlpha","true")}${s("result",t)}/>`}function vi(r,e,t){let{amount:n,size:i}=r;if(n===0)return B(e,t);let a=.5/i,l="";return l+=`<feTurbulence${s("type","fractalNoise")}${s("baseFrequency",`${a} ${a}`)}${s("numOctaves",5)}${s("seed",0)}${s("stitchTiles","stitch")}${s("result",`${t}_grain`)}/>`,l+=`<feColorMatrix${s("in",`${t}_grain`)}${s("type","saturate")}${s("values",0)}${s("result",`${t}_grainGray`)}/>`,l+=`<feBlend${s("in",e)}${s("in2",`${t}_grainGray`)}${s("mode","soft-light")}${s("result",`${t}_blended`)}/>`,l+=`<feComposite${s("in",`${t}_blended`)}${s("in2",e)}${s("operator","arithmetic")}${s("k1",0)}${s("k2",n)}${s("k3",1-n)}${s("k4",0)}${s("result",`${t}_amt`)}/>`,l+=`<feComposite${s("in",`${t}_amt`)}${s("in2",e)}${s("operator","in")}${s("result",t)}/>`,l}function wi(r,e,t){let{wetness:n,turbulence:i}=r;if(n===0&&i===0)return B(e,t);let a="";return a+=`<feTurbulence${s("type","fractalNoise")}${s("baseFrequency",.02+i*.03)}${s("numOctaves",4)}${s("seed",42)}${s("result",`${t}_turb`)}/>`,a+=`<feDisplacementMap${s("in",e)}${s("in2",`${t}_turb`)}${s("scale",n*15)}${s("xChannelSelector","R")}${s("yChannelSelector","G")}${s("result",`${t}_disp`)}/>`,a+=`<feGaussianBlur${s("in",`${t}_disp`)}${s("stdDeviation",n*2)}${s("result",`${t}_blur`)}/>`,a+=`<feBlend${s("in",`${t}_blur`)}${s("in2",e)}${s("mode","multiply")}${s("result",t)}/>`,a}function Pi(r,e,t){let{thickness:n,texture:i}=r;if(n===0&&i===0)return B(e,t);let a="";a+=`<feTurbulence${s("type","turbulence")}${s("baseFrequency",.03+i*.02)}${s("numOctaves",3)}${s("seed",1e3)}${s("result",`${t}_brush`)}/>`;let l=Math.max(3,8-Math.floor(n*5)),o=Array.from({length:l+1},(u,c)=>c/l).join(" ");a+=`<feComponentTransfer${s("in",e)}${s("result",`${t}_poster`)}>`;for(let u of["R","G","B"])a+=`<feFunc${u}${s("type","discrete")}${s("tableValues",o)}/>`;return a+="</feComponentTransfer>",a+=`<feDisplacementMap${s("in",`${t}_poster`)}${s("in2",`${t}_brush`)}${s("scale",i*4)}${s("xChannelSelector","R")}${s("yChannelSelector","G")}${s("result",`${t}_disp`)}/>`,a+=`<feMorphology${s("in",`${t}_disp`)}${s("operator","dilate")}${s("radius",n*.5)}${s("result",`${t}_thick`)}/>`,a+=`<feComposite${s("in",`${t}_thick`)}${s("in2",e)}${s("operator","in")}${s("result",t)}/>`,a}function Ti(r,e,t){let{spread:n,edges:i}=r;if(n===0&&i===0)return B(e,t);let a="";return a+=`<feTurbulence${s("type","fractalNoise")}${s("baseFrequency",.01+i*.02)}${s("numOctaves",5)}${s("seed",1100)}${s("result",`${t}_ink`)}/>`,a+=`<feMorphology${s("in",e)}${s("operator","dilate")}${s("radius",n*3)}${s("result",`${t}_dilate`)}/>`,a+=`<feDisplacementMap${s("in",`${t}_dilate`)}${s("in2",`${t}_ink`)}${s("scale",i*10)}${s("xChannelSelector","R")}${s("yChannelSelector","G")}${s("result",`${t}_disp`)}/>`,a+=`<feGaussianBlur${s("in",`${t}_disp`)}${s("stdDeviation",n*.5)}${s("result",t)}/>`,a}function Fi(r,e,t){let{wrinkles:n,shine:i}=r;if(n===0&&i===0)return B(e,t);let a="";return a+=`<feTurbulence${s("type","turbulence")}${s("baseFrequency",.02)}${s("numOctaves",4)}${s("seed",1200)}${s("result",`${t}_wrinkle`)}/>`,a+=`<feDisplacementMap${s("in",e)}${s("in2",`${t}_wrinkle`)}${s("scale",n*15)}${s("xChannelSelector","R")}${s("yChannelSelector","G")}${s("result",`${t}_disp`)}/>`,a+=`<feSpecularLighting${s("in",`${t}_wrinkle`)}${s("surfaceScale",n*2)}${s("specularConstant",i*1.5)}${s("specularExponent",20)}${s("result",`${t}_sheen`)}>`,a+=`<feDistantLight${s("azimuth",45)}${s("elevation",60)}/>`,a+="</feSpecularLighting>",a+=`<feBlend${s("in",`${t}_disp`)}${s("in2",`${t}_sheen`)}${s("mode","screen")}${s("result",`${t}_blend`)}/>`,a+=`<feComposite${s("in",`${t}_blend`)}${s("in2",e)}${s("operator","in")}${s("result",t)}/>`,a}function Ri(r,e,t){let{density:n,size:i}=r;if(n===0)return B(e,t);let a="",l=1-n;a+=`<feTurbulence${s("type","turbulence")}${s("baseFrequency",.1/i)}${s("numOctaves",1)}${s("seed",1400)}${s("result",`${t}_hole`)}/>`,a+=`<feComponentTransfer${s("in",`${t}_hole`)}${s("result",`${t}_thresh`)}>`;for(let o of["R","G","B","A"])a+=`<feFunc${o}${s("type","linear")}${s("slope",10)}${s("intercept",-l*10+5)}/>`;a+="</feComponentTransfer>",a+=`<feComponentTransfer${s("in",`${t}_thresh`)}${s("result",`${t}_clamp`)}>`;for(let o of["R","G","B","A"])a+=`<feFunc${o}${s("type","table")}${s("tableValues","0 0 1 1")}/>`;return a+="</feComponentTransfer>",a+=`<feComposite${s("in",e)}${s("in2",`${t}_clamp`)}${s("operator","in")}${s("result",t)}/>`,a}function Mi(r,e,t){let{color:n,radius:i,intensity:a}=r;if(a===0||i===0)return B(e,t);let{r:l,g:o,b:u}=Qe(n),c="";return c+=`<feColorMatrix${s("in",e)}${s("type","matrix")}${s("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${s("result",`${t}_alpha`)}/>`,c+=`<feGaussianBlur${s("in",`${t}_alpha`)}${s("stdDeviation",i/2)}${s("result",`${t}_blur`)}/>`,c+=`<feColorMatrix${s("in",`${t}_blur`)}${s("type","matrix")}${s("values",`0 0 0 0 ${l} 0 0 0 0 ${o} 0 0 0 0 ${u} 0 0 0 ${a} 0`)}${s("result",`${t}_color`)}/>`,c+=`<feMerge${s("result",t)}><feMergeNode${s("in",`${t}_color`)}/><feMergeNode${s("in",e)}/></feMerge>`,c}function Ci(r,e,t){let{color:n,radius:i,intensity:a}=r;if(a===0||i===0)return B(e,t);let{r:l,g:o,b:u}=Qe(n),c="";return c+=`<feColorMatrix${s("in",e)}${s("type","matrix")}${s("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${s("result",`${t}_alpha`)}/>`,c+=`<feMorphology${s("in",`${t}_alpha`)}${s("operator","erode")}${s("radius",i/4)}${s("result",`${t}_erode`)}/>`,c+=`<feComposite${s("in",`${t}_alpha`)}${s("in2",`${t}_erode`)}${s("operator","out")}${s("result",`${t}_edge`)}/>`,c+=`<feGaussianBlur${s("in",`${t}_edge`)}${s("stdDeviation",i/3)}${s("result",`${t}_blur`)}/>`,c+=`<feColorMatrix${s("in",`${t}_blur`)}${s("type","matrix")}${s("values",`0 0 0 0 ${l} 0 0 0 0 ${o} 0 0 0 0 ${u} 0 0 0 ${a*2} 0`)}${s("result",`${t}_color`)}/>`,c+=`<feComposite${s("in",`${t}_color`)}${s("in2",`${t}_alpha`)}${s("operator","in")}${s("result",`${t}_clipped`)}/>`,c+=`<feComposite${s("in",`${t}_clipped`)}${s("in2",e)}${s("operator","over")}${s("result",t)}/>`,c}function B(r,e){return`<feMerge${s("result",e)}><feMergeNode${s("in",r)}/></feMerge>`}function Je(r){switch(r.type){case"feBlend":return Ai(r);case"feColorMatrix":return Ii(r);case"feComponentTransfer":return Li(r);case"feComposite":return Di(r);case"feConvolveMatrix":return Bi(r);case"feDiffuseLighting":return Ei(r);case"feSpecularLighting":return Oi(r);case"feDisplacementMap":return Gi(r);case"feDropShadow":return Ui(r);case"feFlood":return zi(r);case"feGaussianBlur":return Ni(r);case"feImage":return Vi(r);case"feMerge":return Hi(r);case"feMorphology":return Wi(r);case"feOffset":return Xi(r);case"feTile":return ji(r);case"feTurbulence":return Yi(r)}}function N(r){let e="";if(e+=s("in",r.in),e+=s("x",r.x),e+=s("y",r.y),e+=s("width",r.width),e+=s("height",r.height),e+=s("color-interpolation-filters",r.colorInterpolationFilters),e+=s("result",r.result),r.unknownAttrs){let t=Object.keys(r.unknownAttrs).sort();for(let n of t)e+=s(n,r.unknownAttrs[n])}return e}function V(r){return r.animations&&r.animations.length>0?r.animations.join(""):""}function Ai(r){let e=`<feBlend${N(r)}${s("in2",r.in2)}${s("mode",r.mode)}`;r.noComposite&&(e+=' no-composite="no-composite"');let t=V(r);return t?`${e}>${t}</feBlend>`:`${e}/>`}function Ii(r){let e=`<feColorMatrix${N(r)}${s("type",r.matrixType)}${s("values",r.values)}`,t=V(r);return t?`${e}>${t}</feColorMatrix>`:`${e}/>`}function Ze(r,e){if(!e)return"";let t=`feFunc${r}`;switch(e.type){case"identity":return`<${t} type="identity"/>`;case"table":case"discrete":return`<${t} type="${e.type}"${s("tableValues",e.tableValues.join(" "))}/>`;case"linear":return`<${t} type="linear"${s("slope",e.slope)}${s("intercept",e.intercept)}/>`;case"gamma":return`<${t} type="gamma"${s("amplitude",e.amplitude)}${s("exponent",e.exponent)}${s("offset",e.offset)}/>`}}function Li(r){let e="";return e+=Ze("R",r.funcR),e+=Ze("G",r.funcG),e+=Ze("B",r.funcB),e+=Ze("A",r.funcA),e+=V(r),`<feComponentTransfer${N(r)}>${e}</feComponentTransfer>`}function Di(r){let e=`<feComposite${N(r)}${s("in2",r.in2)}${s("operator",r.operator)}`;r.operator==="arithmetic"&&(e+=s("k1",r.k1),e+=s("k2",r.k2),e+=s("k3",r.k3),e+=s("k4",r.k4));let t=V(r);return t?`${e}>${t}</feComposite>`:`${e}/>`}function Bi(r){let e=`<feConvolveMatrix${N(r)}`;e+=s("order",r.order),e+=s("kernelMatrix",r.kernelMatrix),e+=s("divisor",r.divisor),e+=s("bias",r.bias),e+=s("targetX",r.targetX),e+=s("targetY",r.targetY),e+=s("edgeMode",r.edgeMode),e+=s("kernelUnitLength",r.kernelUnitLength),r.preserveAlpha!==void 0&&(e+=s("preserveAlpha",r.preserveAlpha?"true":"false"));let t=V(r);return t?`${e}>${t}</feConvolveMatrix>`:`${e}/>`}function zr(r){switch(r.kind){case"feDistantLight":return`<feDistantLight${s("azimuth",r.azimuth)}${s("elevation",r.elevation)}/>`;case"fePointLight":return`<fePointLight${s("x",r.x)}${s("y",r.y)}${s("z",r.z)}/>`;case"feSpotLight":{let e=`<feSpotLight${s("x",r.x)}${s("y",r.y)}${s("z",r.z)}${s("pointsAtX",r.pointsAtX)}${s("pointsAtY",r.pointsAtY)}${s("pointsAtZ",r.pointsAtZ)}`;return e+=s("specularExponent",r.specularExponent),e+=s("limitingConeAngle",r.limitingConeAngle),e+"/>"}}}function Ei(r){let e=`<feDiffuseLighting${N(r)}`;e+=s("surfaceScale",r.surfaceScale),e+=s("diffuseConstant",r.diffuseConstant),e+=s("kernelUnitLength",r.kernelUnitLength),e+=s("lighting-color",r.lightingColor);let t="";return r.lightSource&&(t+=zr(r.lightSource)),t+=V(r),`${e}>${t}</feDiffuseLighting>`}function Oi(r){let e=`<feSpecularLighting${N(r)}`;e+=s("surfaceScale",r.surfaceScale),e+=s("specularConstant",r.specularConstant),e+=s("specularExponent",r.specularExponent),e+=s("kernelUnitLength",r.kernelUnitLength),e+=s("lighting-color",r.lightingColor);let t="";return r.lightSource&&(t+=zr(r.lightSource)),t+=V(r),`${e}>${t}</feSpecularLighting>`}function Gi(r){let e=`<feDisplacementMap${N(r)}`;e+=s("in2",r.in2),e+=s("scale",r.scale),e+=s("xChannelSelector",r.xChannelSelector),e+=s("yChannelSelector",r.yChannelSelector);let t=V(r);return t?`${e}>${t}</feDisplacementMap>`:`${e}/>`}function Ui(r){let e=`<feDropShadow${N(r)}`;e+=s("dx",r.dx),e+=s("dy",r.dy),e+=s("stdDeviation",r.stdDeviation),e+=s("flood-color",r.floodColor),e+=s("flood-opacity",r.floodOpacity);let t=V(r);return t?`${e}>${t}</feDropShadow>`:`${e}/>`}function zi(r){let e=`<feFlood${N(r)}${s("flood-color",r.floodColor)}${s("flood-opacity",r.floodOpacity)}`,t=V(r);return t?`${e}>${t}</feFlood>`:`${e}/>`}function Ni(r){let e=`<feGaussianBlur${N(r)}${s("stdDeviation",r.stdDeviation)}${s("edgeMode",r.edgeMode)}`,t=V(r);return t?`${e}>${t}</feGaussianBlur>`:`${e}/>`}function Vi(r){let e=`<feImage${N(r)}`;r.href!==void 0?e+=s("href",r.href):r.xlinkHref!==void 0&&(e+=s("xlink:href",r.xlinkHref)),e+=s("preserveAspectRatio",r.preserveAspectRatio),e+=s("crossorigin",r.crossorigin);let t=V(r);return t?`${e}>${t}</feImage>`:`${e}/>`}function Hi(r){let e="";for(let t of r.nodes)e+=`<feMergeNode${s("in",t.in)}/>`;return e+=V(r),`<feMerge${N(r)}>${e}</feMerge>`}function Wi(r){let e=`<feMorphology${N(r)}${s("operator",r.operator)}${s("radius",r.radius)}`,t=V(r);return t?`${e}>${t}</feMorphology>`:`${e}/>`}function Xi(r){let e=`<feOffset${N(r)}${s("dx",r.dx)}${s("dy",r.dy)}`,t=V(r);return t?`${e}>${t}</feOffset>`:`${e}/>`}function ji(r){let e=`<feTile${N(r)}`,t=V(r);return t?`${e}>${t}</feTile>`:`${e}/>`}function Yi(r){let e=`<feTurbulence${N(r)}`;e+=s("baseFrequency",r.baseFrequency),e+=s("numOctaves",r.numOctaves),e+=s("seed",r.seed),e+=s("stitchTiles",r.stitchTiles),e+=s("type",r.turbulenceType);let t=V(r);return t?`${e}>${t}</feTurbulence>`:`${e}/>`}function tr(r,e){let t=`<filter${s("id",r)}`;t+=s("x",e.x),t+=s("y",e.y),t+=s("width",e.width),t+=s("height",e.height),t+=s("filterUnits",e.filterUnits),t+=s("primitiveUnits",e.primitiveUnits),e.filterColorInterpolation&&e.filterColorInterpolation!=="auto"&&(t+=s("color-interpolation-filters",e.filterColorInterpolation)),t+=s("flood-color",e.floodColor),t+=s("flood-opacity",e.floodOpacity),t+=s("lighting-color",e.lightingColor),t+=">",e.filterTitle&&(t+=`<title>${O(e.filterTitle)}</title>`),e.filterDescription&&(t+=`<desc>${O(e.filterDescription)}</desc>`);for(let n of e.primitives)t+=Je(n);if(e.filterAnimations)for(let n of e.filterAnimations)t+=n;return t+="</filter>",t}function rr(r,e,t,n){switch(r.type){case"drop-shadow":return Kn(r,e,t);case"inner-shadow":return Zn(r,e,t);case"gaussian-blur":return Qn(r,e,t);case"motion-blur":return Jn(r,e,t);case"point-light":{let i=r;return Or(n?{...i,x:i.x+n.x,y:i.y+n.y}:i,e,t)}case"spot-light":{let i=r;return Gr(n?{...i,x:i.x+n.x,y:i.y+n.y,pointsAtX:i.pointsAtX+n.x,pointsAtY:i.pointsAtY+n.y}:i,e,t)}case"diffuse-lighting":return ei(r,e,t);case"specular-lighting":return ti(r,e,t);case"outline":return ri(r,e,t);case"sharpen":return ni(r,e,t);case"pixelate":return ii(r,e,t);case"warp":return si(r,e,t);case"morphology":return ai(r,e,t);case"contouring-discrete":return oi(r,e,t);case"contouring-table":return li(r,e,t);case"round-edges":return ui(r,e,t);case"grayscale":return ci(r,e,t);case"channel-painter":return di(r,e,t);case"brightness":return hi(r,e,t);case"contrast":return pi(r,e,t);case"opacity":return fi(r,e,t);case"invert":return mi(r,e,t);case"hue-rotate":return gi(r,e,t);case"saturate":return bi(r,e,t);case"black-and-white":return yi(r,e,t);case"sepia":return $i(r,e,t);case"duotone":return xi(r,e,t);case"xray":return Si(r,e,t);case"noise":return ki(r,e,t);case"emboss":return _i(r,e,t);case"film-grain":return vi(r,e,t);case"watercolor":return wi(r,e,t);case"gouache":return Pi(r,e,t);case"ink-blot":return Ti(r,e,t);case"crumpled-plastic":return Fi(r,e,t);case"riddled":return Ri(r,e,t);case"glow":return Mi(r,e,t);case"inner-glow":return Ci(r,e,t);case"raw-svg":return r.svgContent;case"svg-primitive-chain":return r.primitives.map(Je).join("");default:return B(e,t)}}function qi(r){return r.some(e=>e.type==="gaussian-blur"||e.type==="motion-blur"||e.type==="drop-shadow"||e.type==="inner-shadow"||e.type==="glow"||e.type==="inner-glow"||e.type==="outline"||e.type==="morphology"||e.type==="warp"||e.type==="svg-primitive-chain"&&e.primitives.some(t=>t.type==="feGaussianBlur"||t.type==="feDropShadow"||t.type==="feOffset"||t.type==="feMorphology"||t.type==="feDisplacementMap"||t.type==="feTurbulence"))}function nr(r,e,t={}){let n=e.filter($=>$.enabled);if(n.length===0)return"";let i=t.colorInterpolation&&t.colorInterpolation!=="auto"?s("color-interpolation-filters",t.colorInterpolation):"",a=n.find($=>$.type==="raw-svg");if(a){let $=t.colorInterpolation&&t.colorInterpolation!=="auto"?t.colorInterpolation:a.colorInterpolationFilters,w=t.filterUnits??a.filterUnits,F=t.primitiveUnits??a.primitiveUnits,y=t.x??a.x,k=t.y??a.y,P=t.width??a.width,I=t.height??a.height;return`<filter${s("id",r)}${s("x",y)}${s("y",k)}${s("width",P)}${s("height",I)}${s("filterUnits",w)}${s("primitiveUnits",F)}${s("color-interpolation-filters",$)}${s("flood-color",a.floodColor)}${s("flood-opacity",a.floodOpacity)}${s("lighting-color",a.lightingColor)}>${a.svgContent}</filter>`}let l=n.find($=>$.type==="svg-primitive-chain");if(l){let $={...l,x:t.x??l.x,y:t.y??l.y,width:t.width??l.width,height:t.height??l.height,filterUnits:t.filterUnits??l.filterUnits,primitiveUnits:t.primitiveUnits??l.primitiveUnits,filterColorInterpolation:t.colorInterpolation&&t.colorInterpolation!=="auto"?t.colorInterpolation:l.filterColorInterpolation};return tr(r,$)}let o=n.some($=>$.type==="gaussian-blur"&&$.quality==="high"||$.type==="motion-blur"&&$.quality==="high"),u=qi(n),c=u?o?"-200%":"-100%":"-10%",h=u?o?"500%":"300%":"120%",d="",f="SourceGraphic",m=0;for(let $ of n){let w=`result${m++}`;d+=rr($,f,w),f=w}let b=t.filterUnits??"objectBoundingBox",g=t.primitiveUnits??"userSpaceOnUse",x=t.x??c,v=t.y??c,_=t.width??h,S=t.height??h;return`<filter${s("id",r)}${s("x",x)}${s("y",v)}${s("width",_)}${s("height",S)}${s("filterUnits",b)}${s("primitiveUnits",g)}${i}>${d}</filter>`}function Nr(r){let e="",t=new Set;for(let n of r){let i=n.state.filters;if(!i||i.length===0)continue;let a=i.filter(c=>c.enabled);if(a.length===0)continue;let l=n.state.filterLibraryIds,o=Array.isArray(l)&&l.length>0?l[0]:`filter-${n.id}`;if(t.has(o))continue;t.add(o);let u=n.state;e+=nr(o,a,{colorInterpolation:u.filterColorInterpolation,filterUnits:u.filterUnits,primitiveUnits:u.primitiveUnits,x:u.filterX,y:u.filterY,width:u.filterWidth,height:u.filterHeight})}return e}function et(r,e,t){return!e||e.length===0||e.filter(i=>i.enabled).length===0?"":Array.isArray(t)&&t.length>0?` filter="${t.map(a=>`url(#${O(a)})`).join(" ")}"`:` filter="url(#filter-${O(r)})"`}function $e(r,e,t,n){let i=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/10);switch(r){case"stripes":return[{tag:"rect",attrs:{width:n?.strokeWidth!=null?Math.max(.01,Math.min(1,n.strokeWidth))*e:e/2,height:e,fill:t}}];case"dots":{let a=n?.dotRadius!=null?Math.max(.05,Math.min(.45,n.dotRadius)):.25;return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e*a,fill:t}}]}case"grid":return[{tag:"path",attrs:{d:`M ${e} 0 L 0 0 0 ${e}`,fill:"none",stroke:t,"stroke-width":i}}];case"checkerboard":return[{tag:"rect",attrs:{width:e/2,height:e/2,fill:t}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e/2,height:e/2,fill:t}}];case"diagonal":{let a=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/5);return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0`,stroke:t,"stroke-width":a}}]}case"crosshatch":return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0 M 0 0 L ${e} ${e}`,stroke:t,"stroke-width":i}}];case"zigzag":{let a=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,l=e*a;return[{tag:"path",attrs:{d:`M 0 ${l} L ${e/4} 0 L ${e/2} ${l} L ${e*3/4} 0 L ${e} ${l}`,fill:"none",stroke:t,"stroke-width":i}}]}case"waves":{let a=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,l=e*a,o=e/2;return[{tag:"path",attrs:{d:`M 0 ${o} Q ${e/4} ${o-l} ${e/2} ${o} T ${e} ${o}`,fill:"none",stroke:t,"stroke-width":i}}]}case"triangles":{let a=e*.866;return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${a} L 0 ${a} Z`,fill:"none",stroke:t,"stroke-width":i}}]}case"hexagons":{let a=e*.866;return[{tag:"path",attrs:{d:`M ${e*.25} 0 L ${e*.75} 0 L ${e} ${a*.5} L ${e*.75} ${a} L ${e*.25} ${a} L 0 ${a*.5} Z`,fill:"none",stroke:t,"stroke-width":i}}]}case"diamonds":return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${e/2} L ${e/2} ${e} L 0 ${e/2} Z`,fill:"none",stroke:t,"stroke-width":i}}];case"circles":return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e/3,fill:"none",stroke:t,"stroke-width":i}}];case"bricks":{let a=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/15);return[{tag:"rect",attrs:{x:0,y:0,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":a}},{tag:"rect",attrs:{x:-e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":a}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":a}}]}case"herringbone":return[{tag:"path",attrs:{d:`M 0 0 L ${e/2} ${e/2} L 0 ${e} M ${e/2} ${e/2} L ${e} 0 M ${e/2} ${e/2} L ${e} ${e}`,fill:"none",stroke:t,"stroke-width":i}}];default:return[]}}function Ki(r){let e=Object.entries(r.attrs).map(([t,n])=>` ${t}="${n}"`).join("");return`<${r.tag}${e}/>`}function tt(r,e,t,n,i){let a=10*e,l="";l+=`<rect width="${a}" height="${a}" fill="${n}"/>`;let o=$e(r,a,t,i);for(let u of o)l+=Ki(u);return{svgContent:l,width:a,height:a}}var xe="0 0 10 10",rt=6,nt=6;function ae(){return[{id:"line-marker-arrow",refX:10,refY:5,element:{tag:"path",attrs:{d:"M 0 0 L 10 5 L 0 10 Z",fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-open-arrow",refX:10,refY:5,element:{tag:"path",attrs:{d:"M 0 0 L 10 5 L 0 10",fill:"none",stroke:"context-stroke","stroke-width":1.5,"stroke-linejoin":"round","stroke-linecap":"round"}}},{id:"line-marker-circle",refX:5,refY:5,element:{tag:"circle",attrs:{cx:5,cy:5,r:3.2,fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-diamond",refX:5,refY:5,element:{tag:"path",attrs:{d:"M 5 0 L 10 5 L 5 10 L 0 5 Z",fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-square",refX:5,refY:5,element:{tag:"rect",attrs:{x:1.5,y:1.5,width:7,height:7,fill:"context-stroke",stroke:"context-stroke"}}}]}var ir={"line-marker-arrow":"mkr-builtin-arrow","line-marker-open-arrow":"mkr-builtin-open-arrow","line-marker-circle":"mkr-builtin-circle","line-marker-diamond":"mkr-builtin-diamond","line-marker-square":"mkr-builtin-square"},Zi={"mkr-builtin-arrow":"Arrow","mkr-builtin-open-arrow":"Open Arrow","mkr-builtin-circle":"Circle","mkr-builtin-diamond":"Diamond","mkr-builtin-square":"Square"};function Vr(){return ae().map(r=>{let e=ir[r.id]??r.id;return{kind:"marker",id:e,name:Zi[e]??e,viewBox:xe,refX:r.refX,refY:r.refY,markerWidth:6,markerHeight:6,markerUnits:"strokeWidth",orient:"auto-start-reverse",shapes:[],builtIn:!0}})}function p(r,e){return e==null||e===""?"":` ${r}="${O(String(e))}"`}function Qi(r){if(r&&typeof r=="object"){let e=r;return"dx"in e?{x:typeof e.x=="number"?e.x:null,y:typeof e.y=="number"?e.y:null,dx:typeof e.dx=="number"?e.dx:0,dy:typeof e.dy=="number"?e.dy:0,rotate:typeof e.rotate=="number"?e.rotate:0}:{x:null,y:null,dx:typeof e.x=="number"?e.x:0,dy:typeof e.y=="number"?e.y:0,rotate:typeof e.rotate=="number"?e.rotate:0}}return{x:null,y:null,dx:0,dy:0,rotate:0}}function Hr(r,e){let t=-1;for(let i=r.length-1;i>=0;i--)if(r[i][e]!==null){t=i;break}if(t<0)return[];let n=new Array(t+1);for(let i=0;i<=t;i++)n[i]=r[i][e]??0;return n}function Wr(r,e){let t=-1;for(let i=r.length-1;i>=0;i--)if(r[i][e]!==0){t=i;break}if(t<0)return[];let n=new Array(t+1);for(let i=0;i<=t;i++)n[i]=r[i][e];return n}function Ji(r){if(r.length===0)return[];let e=r.length-1,t=r[e].rotate;for(;e>0&&r[e-1].rotate===t;)e--;if(e===0&&t===0)return[];let n=new Array(e+1);for(let i=0;i<=e;i++)n[i]=r[i].rotate;return n}function Xr(r){let e=r.ancestorTransform;return!e||e.length<6?null:`matrix(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]})`}function ne(r,e){let t=Xr(r),n=r.rawTransform;if(n)return t?`${t} ${n}`:n;let i=r.rotation??0,a=r.skewX??0,l=r.skewY??0,o=r.scaleX??1,u=r.scaleY??1,c=r.translateX??0,h=r.translateY??0,d=c!==0||h!==0;if(!d&&i===0&&a===0&&l===0&&o===1&&u===1)return t;let f=r.customPivot??e;if(!f&&!d)return t;let m=[];return t&&m.push(t),d&&m.push(`translate(${c}, ${h})`),f&&(i!==0||a!==0||l!==0||o!==1||u!==1)&&(m.push(`translate(${f.x}, ${f.y})`),i!==0&&m.push(`rotate(${i})`),(o!==1||u!==1)&&m.push(`scale(${o}, ${u})`),a!==0&&m.push(`skewX(${a})`),l!==0&&m.push(`skewY(${l})`),m.push(`translate(${-f.x}, ${-f.y})`)),m.join(" ")}function es(r,e,t){let n=Xr(r),i=r.rotation??0,a=r.skewX??0,l=r.skewY??0,o=r.scaleX??1,u=r.scaleY??1,c=r.translateX??0,h=r.translateY??0,d=r.customPivot??{x:e,y:t},f=[];return n&&f.push(n),(c!==0||h!==0)&&f.push(`translate(${c}, ${h})`),(i!==0||a!==0||l!==0||o!==1||u!==1)&&(f.push(`translate(${d.x}, ${d.y})`),i!==0&&f.push(`rotate(${i})`),(o!==1||u!==1)&&f.push(`scale(${o}, ${u})`),a!==0&&f.push(`skewX(${a})`),l!==0&&f.push(`skewY(${l})`),f.push(`translate(${-d.x}, ${-d.y})`)),f.push(`translate(${e}, ${t})`),f.join(" ")}function ts(r){if(typeof r=="string"){let n=r.trim();return n.length>0?n:void 0}if(!r||typeof r!="object")return;let e=r,t=[];return e.underline&&t.push("underline"),e.strikethrough&&t.push("line-through"),e.overline&&t.push("overline"),t.length>0?t.join(" "):void 0}function rs(r){if(typeof r.strokeDasharray=="string")return r.strokeDasharray;let e=r.lineStyle??"solid",t=r.dashLength??8,n=r.gapLength??4;return he(e,t,n)}function ns(r){let e=r.fillType;return e||(r.fillGradient?r.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":r.linearGradient?"linear-gradient":r.radialGradient?"radial-gradient":"solid")}function is(r){return r.fillGradient??r.linearGradient??r.radialGradient??void 0}function ee(r,e){let t=p("data-shape-id",e),n=ns(r),i=is(r);if(n==="none")t+=p("fill","none");else if(n==="linear-gradient"||n==="radial-gradient"){let k=r.fillLibraryId??i?.id;t+=p("fill",`url(#${k??`gradient-fill-${e}`})`)}else if(n==="pattern"){let k=r.fillLibraryId??i?.id;t+=p("fill",`url(#${k??`pattern-fill-${e}`})`)}else t+=p("fill",r.fillColor??"#000000");let a=r.opacity;a!==void 0&&a<1&&(t+=p("opacity",a));let l=r.fillOpacity;l!==void 0&&l<1&&(t+=p("fill-opacity",l));let o=r.fillRule;o&&o!=="nonzero"&&(t+=p("fill-rule",o));let u=r.strokeType??"solid",c=r.strokeGradient;if(u==="none")t+=p("stroke","none");else if(u==="linear-gradient"||u==="radial-gradient"){let k=r.strokeLibraryId??c?.id;t+=p("stroke",`url(#${k??`gradient-stroke-${e}`})`)}else if(u==="pattern"){let k=r.strokeLibraryId??c?.id;t+=p("stroke",`url(#${k??`pattern-stroke-${e}`})`)}else t+=p("stroke",r.borderColor??"none");let h=r.borderWidth;h!=null&&(t+=p("stroke-width",h));let d=r.strokeOpacity;d!==void 0&&d<1&&(t+=p("stroke-opacity",d));let f=r.paintOrder;f&&f!=="normal"&&(t+=p("paint-order",f));let m=r.markerStart,b=r.markerMid,g=r.markerEnd;m&&(t+=p("marker-start",`url(#${m})`)),b&&(t+=p("marker-mid",`url(#${b})`)),g&&(t+=p("marker-end",`url(#${g})`));let x=rs(r);x&&(t+=p("stroke-dasharray",x),!r.strokeDasharray&&r.lineStyle==="dotted"&&(t+=p("stroke-linecap","round")));let v=r.dashOffset;v!==void 0&&v!==0&&(t+=p("stroke-dashoffset",v));let _=r.shapeRendering;_&&_!=="auto"&&(t+=p("shape-rendering",_)),t+=et(e,r.filters,r.filterLibraryIds);let S=r.systemLanguage;S&&(t+=p("systemLanguage",S));let $=r.requiredExtensions;$&&(t+=p("requiredExtensions",$));let w=r.vectorEffect;w&&w!=="none"&&(t+=p("vector-effect",w));let F=r.visibility;F&&F!=="visible"&&(t+=p("visibility",F));let y=r.metadata;return y&&(y.role&&(t+=p("role",y.role)),y.ariaLabel&&(t+=p("aria-label",y.ariaLabel))),t}function ss(r){let e=r.metadata;if(!e)return"";let t="";return e.title&&(t+=`<title>${O(e.title)}</title>`),e.description&&(t+=`<desc>${O(e.description)}</desc>`),t}function as(r,e){let t=ss(e);if(!t)return r;let n=r.lastIndexOf("/>");if(n===-1){let l=r.indexOf(">");return l===-1?r:r.slice(0,l+1)+t+r.slice(l+1)}let i=r.match(/^<(\w+)/),a=i?i[1]:"g";return r.slice(0,n)+">"+t+`</${a}>`}function sr(r){let e="",t=r.startEndpoint,n=r.endEndpoint;return t&&t!=="none"&&(e+=p("marker-start",`url(#line-marker-${t})`)),n&&n!=="none"&&(e+=p("marker-end",`url(#line-marker-${n})`)),e}function ar(r){let e=r.state,t=e.x??0,n=e.y??0,i=e.radius??50,a=ne(e,{x:t,y:n});return`<circle${p("cx",t)}${p("cy",n)}${p("r",i)}${ee(e,r.id)}${a?p("transform",a):""}/>`}function or(r){let e=r.state,t=e.cx??0,n=e.cy??0,i=e.rx??50,a=e.ry??30,l=e.pathLength,o=ne(e,{x:t,y:n});return`<ellipse${p("cx",t)}${p("cy",n)}${p("rx",i)}${p("ry",a)}${l!==void 0?p("pathLength",l):""}${ee(e,r.id)}${o?p("transform",o):""}/>`}function lr(r){let e=r.state,t=e,n=e.x??0,i=e.y??0,a=e.width??100,l=e.height??100,o=e.cornerRadius??0,u=e.rx??o,c=e.ry??o,h=t.cornerShape??"round",d=t.cornerMode??"uniform",f={x:n+a/2,y:i+l/2},m=ne(e,f);if(h!=="round"||d==="non-uniform"){let b=qe(n,i,a,l,o,h,d,d==="non-uniform"?{radiusTL:t.cornerRadiusTL,radiusTR:t.cornerRadiusTR,radiusBR:t.cornerRadiusBR,radiusBL:t.cornerRadiusBL,shapeTL:t.cornerShapeTL,shapeTR:t.cornerShapeTR,shapeBR:t.cornerShapeBR,shapeBL:t.cornerShapeBL}:void 0);if(b)return`<path${p("d",b)}${ee(e,r.id)}${m?p("transform",m):""}/>`}return`<rect${p("x",n)}${p("y",i)}${p("width",a)}${p("height",l)}${u>0||c>0?`${p("rx",u)}${p("ry",c)}`:""}${ee(e,r.id)}${m?p("transform",m):""}/>`}function ur(r){let e=r.state,t=e.x1??0,n=e.y1??0,i=e.x2??0,a=e.y2??0,l={x:(t+i)/2,y:(n+a)/2},o=ne(e,l),u={...e,fillType:"none"};return`<line${p("x1",t)}${p("y1",n)}${p("x2",i)}${p("y2",a)}${ee(u,r.id)}${sr(e)}${o?p("transform",o):""}/>`}function cr(r){let e=r.state,t=e.x??0,n=e.y??0,i=e.text??"",a=e.fontSize??16,l=e.fontFamily??"sans-serif",o=e.fontWeight??"normal",u=e.fontStyle??"normal",c=e.textAnchor??"start",h=ts(e.textDecoration),d=e.letterSpacing,m=ne(e,{x:t,y:n}),b=p("x",t)+p("y",n);b+=p("font-size",a),b+=p("font-family",l),o!=="normal"&&(b+=p("font-weight",o)),u!=="normal"&&(b+=p("font-style",u)),c!=="start"&&(b+=p("text-anchor",c)),h&&(b+=p("text-decoration",h)),d&&(b+=p("letter-spacing",d));let g=e.textLength;g!==void 0&&g>0&&(b+=p("textLength",g),e.lengthAdjust==="spacingAndGlyphs"&&(b+=p("lengthAdjust","spacingAndGlyphs")));let x=e.textDirection;x&&x!=="ltr"&&(b+=p("direction",x));let v=e.unicodeBidi;v&&v!=="normal"&&(b+=p("unicode-bidi",v));let _=e.fontVariationSettings;if(_&&Object.keys(_).length>0){let $=Object.entries(_).map(([w,F])=>`'${w}' ${F}`).join(", ");b+=p("style",`font-variation-settings: ${$}`)}if(b+=ee(e,r.id),m&&(b+=p("transform",m)),e.isTextPath&&e.textPathPoints){let $=e.textPathPoints,w=e.textPathStartOffset??0,F=e.textPathSide,y=`text-path-${r.id}`,k="";if($.length>=2)if(F==="right"){let P=$[$.length-1];k=`M ${P.x} ${P.y}`;for(let I=$.length-1;I>0;I--){let M=$[I],A=$[I-1],D=M.handleIn??M,L=A.handleOut??A;k+=` C ${D.x} ${D.y}, ${L.x} ${L.y}, ${A.x} ${A.y}`}}else{k=`M ${$[0].x} ${$[0].y}`;for(let P=0;P<$.length-1;P++){let I=$[P],M=$[P+1],A=I.handleOut??I,D=M.handleIn??M;k+=` C ${A.x} ${A.y}, ${D.x} ${D.y}, ${M.x} ${M.y}`}}return`<defs><path id="${O(y)}"${p("d",k)} fill="none"/></defs><text${b}><textPath href="#${O(y)}"${p("startOffset",`${w}%`)}>${O(i)}</textPath></text>`}if(e.charOffsets&&Array.isArray(e.charOffsets)&&e.charOffsets.length>0){let $=e.charOffsets.map(Qi),w=i.split(`
7
- `),F=e.linePositions??[],y=a*1.25,k="",P=0;return w.forEach((I,M)=>{let A=Array.from(I).length,D=$.slice(P,P+A),L=F[M],E=L?t+L.x:M>0?t:NaN,C=L?L.dy:M>0?y:NaN,z="",j=Hr(D,"x");if(Number.isFinite(E)||j.length>0){let ue=j.length>0?j.slice():[];Number.isFinite(E)&&(ue[0]=ue[0]??E),z+=p("x",ue.join(" "))}let K=Hr(D,"y");K.length>0&&(z+=p("y",K.join(" ")));let le=Wr(D,"dx");le.length>0&&(z+=p("dx",le.join(" ")));let Z=Wr(D,"dy"),G=Z.length>0||Number.isFinite(C)?Z.slice():[];for(Number.isFinite(C)&&(G[0]=(G[0]??0)+C);G.length>0&&G[G.length-1]===0;)G.pop();G.length>0&&(z+=p("dy",G.join(" ")));let ve=Ji(D);ve.length>0&&(z+=p("rotate",ve.join(" "))),k+=`<tspan${z}>${O(I)}</tspan>`,P+=A+1}),`<text${b}>${k}</text>`}if(e.richTextData&&typeof e.richTextData=="object"){let $=e.richTextData;if(Array.isArray($.lines)&&$.lines.length>0){let w=e.linePositions,F=typeof $.lineHeight=="number"?$.lineHeight:1.2,y=a*F,k=$.baseStyle??{},P="";return $.lines.forEach((I,M)=>{I.segments.forEach((A,D)=>{let L="";if(D===0){let E=w?.[M];E?((Math.abs(E.x)>.001||M>0)&&(L+=p("x",t+E.x)),(Math.abs(E.dy)>.001||M>0)&&(L+=p("dy",E.dy))):M>0&&(L+=p("x",t),L+=p("dy",`${y}px`))}L+=os(A.style??{},k),L+=' xml:space="preserve"',P+=`<tspan${L}>${O(A.text)}</tspan>`})}),`<text${b}>${P}</text>`}}return`<text${b}>${O(i)}</text>`}function os(r,e){let t="";r.fontFamily!==void 0&&r.fontFamily!==e.fontFamily&&(t+=p("font-family",String(r.fontFamily))),r.fontSize!==void 0&&r.fontSize!==e.fontSize&&(t+=p("font-size",String(r.fontSize))),r.fontWeight!==void 0&&r.fontWeight!==e.fontWeight&&(t+=p("font-weight",String(r.fontWeight))),r.fontStyle!==void 0&&r.fontStyle!==e.fontStyle&&(t+=p("font-style",String(r.fontStyle)));let n=r.textDecoration,i=e.textDecoration;if(n&&(!i||n.underline!==i.underline||n.strikethrough!==i.strikethrough||n.overline!==i.overline)){let l=[];n.underline&&l.push("underline"),n.strikethrough&&l.push("line-through"),n.overline&&l.push("overline"),l.length>0&&(t+=p("text-decoration",l.join(" ")))}if(r.baselineShift!==void 0&&r.baselineShift!==e.baselineShift){let a=r.baselineShift;a==="super"||a==="sub"?t+=p("baseline-shift",a):typeof a=="number"&&(t+=p("baseline-shift",`${a}px`))}return r.letterSpacing!==void 0&&r.letterSpacing!==e.letterSpacing&&(t+=p("letter-spacing",String(r.letterSpacing))),r.fill!==void 0&&r.fill!==e.fill&&(t+=p("fill",String(r.fill))),r.fillOpacity!==void 0&&r.fillOpacity!==e.fillOpacity&&(t+=p("fill-opacity",String(r.fillOpacity))),r.direction!==void 0&&r.direction!==e.direction&&(t+=p("direction",String(r.direction))),r.unicodeBidi!==void 0&&r.unicodeBidi!==e.unicodeBidi&&(t+=p("unicode-bidi",String(r.unicodeBidi))),t}function dr(r){let e=r.state,t=e.pathPoints??[],n=e.pathCurveType??"CUBIC",i=e.pathClosed??!1,a=e.pathTension??.5,l=e.pathArcParams,o=de(t,n,i,a,l),u=t.length>0?e.customPivot??{x:t[0].x,y:t[0].y}:void 0,c=u?ne(e,u):null;return`<path${p("d",o)}${ee(e,r.id)}${sr(e)}${c?p("transform",c):""}/>`}function hr(r){let e=r.state,t=e.polylinePoints??[],n=e.polylineClosed??!1,i=t.map(u=>`${u.x},${u.y}`).join(" "),a=t.length>0?e.customPivot??{x:t[0].x,y:t[0].y}:void 0,l=a?ne(e,a):null;return`<${n?"polygon":"polyline"}${p("points",i)}${ee(e,r.id)}${sr(e)}${l?p("transform",l):""}/>`}function pr(r){let e=r.state,t=e.x??0,n=e.y??0,i=e.width??100,a=e.height??100,l=e.href??"",o=e.imageOpacity,u=e.preserveAspectRatio?"xMidYMid meet":"none",c={x:t+i/2,y:n+a/2},h=ne(e,c);return`<image${p("x",t)}${p("y",n)}${p("width",i)}${p("height",a)}${p("href",l)}${p("preserveAspectRatio",u)}${o!==void 0&&o<1?p("opacity",o):""}${ee(e,r.id)}${h?p("transform",h):""}/>`}function it(r){return!r||r.length===0?"":r.map(e=>H(e)).join("")}function ls(r){let e=r.state,t=e.href,n=e.hrefXlink,i="<a";return t!==void 0&&(i+=p("href",t)),n!==void 0&&(i+=p("xlink:href",n)),i+=p("target",e.linkTarget),i+=p("rel",e.linkRel),i+=p("download",e.linkDownload),i+=p("ping",e.linkPing),i+=p("hreflang",e.linkHreflang),i+=p("type",e.linkType),i+=p("referrerpolicy",e.linkReferrerPolicy),i+=p("data-shape-id",r.id),i+=">",i+=it(e.children),i+="</a>",i}function us(r){let e=r.state,t="<switch";return t+=p("data-shape-id",r.id),t+=">",t+=it(e.children),t+="</switch>",t}function cs(r){let e=r.state,t=ne(e),n="<g";return n+=p("data-shape-id",r.id),t&&(n+=p("transform",t)),e.opacity!==void 0&&e.opacity<1&&(n+=p("opacity",e.opacity)),e.visibility&&(n+=p("visibility",e.visibility)),e.blendMode&&(n+=p("style",`mix-blend-mode:${e.blendMode}`)),n+=">",n+=it(e.children),n+="</g>",n}function ds(r){let e=r.state,t=e.viewBoxX,n=e.viewBoxY,i=e.viewBoxWidth,a=e.viewBoxHeight,l=t!==void 0&&n!==void 0&&i!==void 0&&a!==void 0?`${t} ${n} ${i} ${a}`:void 0,o="<view";return o+=p("id",r.id),o+=p("viewBox",l),o+=p("preserveAspectRatio",e.viewPreserveAspectRatio),o+=p("zoomAndPan",e.viewZoomAndPan),o+=p("viewTarget",e.viewTarget),e.viewName&&(o+=p("data-view-name",e.viewName)),e.isHomeView&&(o+=p("data-home-view","true")),o+="/>",o}function hs(r){let e=r.state,t=e.svgX,n=e.svgY,i=e.svgWidth,a=e.svgHeight,l=e.svgViewBoxX,o=e.svgViewBoxY,u=e.svgViewBoxWidth,c=e.svgViewBoxHeight,h=l!==void 0&&o!==void 0&&u!==void 0&&c!==void 0?`${l} ${o} ${u} ${c}`:void 0,d="<svg";return d+=p("xmlns","http://www.w3.org/2000/svg"),d+=p("x",t),d+=p("y",n),d+=p("width",i),d+=p("height",a),d+=p("viewBox",h),d+=p("preserveAspectRatio",e.svgPreserveAspectRatio),d+=p("data-shape-id",r.id),d+=">",d+=it(e.children),d+="</svg>",d}function ps(r){let e=r.state,t=e.targetShapeId;if(!t)return`<!-- shape-reference ${O(r.id)} has no targetShapeId -->`;let n=e.offsetX??0,i=e.offsetY??0,a="<use";return a+=p("href",`#${t}`),a+=p("x",n),a+=p("y",i),e.width!==void 0&&(a+=p("width",e.width)),e.height!==void 0&&(a+=p("height",e.height)),a+=p("data-shape-id",r.id),e.opacity!==void 0&&e.opacity<1&&(a+=p("opacity",e.opacity)),a+="/>",a}function fs(r){let e=r.state,t=e.mediaKind??r.type,n=e.x??0,i=e.y??0,a=e.width??320,l=e.height??180,o=e.href??"",u=e.mediaMimeType,c=e.posterHref,h=e.mediaOpacity,d=`<${t} xmlns="http://www.w3.org/1999/xhtml"`;d+=p("src",o),u&&(d+=p("type",u)),c&&t==="video"&&(d+=p("poster",c)),e.muted&&(d+=' muted=""'),e.loop&&(d+=' loop=""'),e.playbackRate!==void 0&&(d+=p("data-playback-rate",e.playbackRate)),e.volume!==void 0&&(d+=p("data-volume",e.volume)),d+=' preload="auto" playsinline=""',d+=t==="video"?' style="width:100%;height:100%;display:block;"></video>':"></audio>";let f="<foreignObject";return f+=p("x",n),f+=p("y",i),f+=p("width",a),f+=p("height",l),f+=p("data-shape-id",r.id),f+=p("data-media-kind",t),e.naturalDuration!==void 0&&(f+=p("data-natural-duration",e.naturalDuration)),e.begin!==void 0&&(f+=p("data-begin",e.begin)),e.trimStart!==void 0&&(f+=p("data-trim-start",e.trimStart)),e.trimEnd!==void 0&&(f+=p("data-trim-end",e.trimEnd)),e.fadeInDuration!==void 0&&(f+=p("data-fade-in",e.fadeInDuration)),e.fadeOutDuration!==void 0&&(f+=p("data-fade-out",e.fadeOutDuration)),e.systemLanguage&&(f+=p("systemLanguage",e.systemLanguage)),e.requiredExtensions&&(f+=p("requiredExtensions",e.requiredExtensions)),h!==void 0&&h<1&&(f+=p("opacity",h)),f+=">",f+=d,f+="</foreignObject>",f}function fr(r){let e=r.state,t=e.cx??0,n=e.cy??0,i=e.radius??50,a=e.cornerRadius??0,l=e.shiftAngle??-90,o=e.fillRule??"nonzero",u=es(e,t,n),c="";switch(r.type){case"triangle":c=q(ye(3,i,l),a,i);break;case"ngon":{let d=e.sides??6;c=q(ye(d,i,l),a,i);break}case"star":{let d=e.arms??5,f=e.innerRadiusPercent??50;c=q(Ge(d,i,f,l),a,i);break}case"cross":{let d=e.armWidthPercent??40;c=q(Ue(i,d,l),a,i);break}case"ring":{let d=e.innerRadiusPercent??50;c=Xe(i,d,o);break}case"spiral":{let d=e.turns??3,f=e.thicknessPercent??20,m=e.spiralDirection??1;c=je(i,d,f,m,l);break}case"gear":{let d=e.teeth??8,f=e.toothDepthPercent??30,m=e.holeRadiusPercent??0;c=Ye(d,i,f,a,m,o,l);break}case"arrow":{let d=e.headWidthPercent??100,f=e.headLengthPercent??30,m=e.shaftWidthPercent??40;c=q(ze(i,d,f,m,l),a,i);break}case"speechBubble":{let d=e.tailAngleDeg??45,f=e.tailLengthPercent??40,m=e.tailWidthPercent??25;c=q(Ne(i,d,f,m,l),a,i);break}case"lightning":{let d=e.boltSegments??3,f=e.boltJaggednessPercent??40,m=e.boltWidthPercent??30;c=q(Ve(i,d,f,m,l),a,i);break}case"heart":{let d=e.lobeRadiusPercent??50,f=e.cleftDepthPercent??25;c=He(i,d,f,l);break}case"cloud":{let d=e.cloudBumps??5,f=e.cloudPuffinessPercent??60;c=We(i,d,f,l);break}default:return`<!-- unsupported polygon shape: ${O(r.type)} -->`}let h="";return(r.type==="ring"||r.type==="gear")&&(h=p("fill-rule",o)),`<path${p("d",c)}${h}${ee(e,r.id)}${p("transform",u)}/>`}function H(r){let e;switch(r.type){case"circle":e=ar(r);break;case"ellipse":e=or(r);break;case"rectangle":case"square":e=lr(r);break;case"line":e=ur(r);break;case"text":e=cr(r);break;case"path":e=dr(r);break;case"polyline":e=hr(r);break;case"image":e=pr(r);break;case"triangle":case"ngon":case"star":case"cross":case"ring":case"spiral":case"gear":case"arrow":case"speechBubble":case"lightning":case"heart":case"cloud":e=fr(r);break;case"hyperlink":e=ls(r);break;case"switch":e=us(r);break;case"container":case"group":e=cs(r);break;case"view":e=ds(r);break;case"svg":e=hs(r);break;case"shape-reference":e=ps(r);break;case"audio":case"video":e=fs(r);break;default:return`<!-- unsupported shape type: ${O(r.type)} -->`}return as(e,r.state)}function jr(r,e){let t=(e.stops??[]).map(l=>{let o=`<stop${p("offset",`${l.offset*100}%`)}${p("stop-color",l.color)}`;return l.opacity!==void 0&&l.opacity<1&&(o+=p("stop-opacity",l.opacity)),o+="/>",o}).join(""),n=e.gradientUnits==="userSpaceOnUse",i=l=>n?String(l):`${l*100}%`,a=n?p("gradientUnits","userSpaceOnUse"):"";return`<linearGradient${p("id",r)}${a}${p("x1",i(e.x1))}${p("y1",i(e.y1))}${p("x2",i(e.x2))}${p("y2",i(e.y2))}${e.spreadMethod?p("spreadMethod",e.spreadMethod):""}>${t}</linearGradient>`}function Yr(r,e){let t=(e.stops??[]).map(h=>{let d=`<stop${p("offset",`${h.offset*100}%`)}${p("stop-color",h.color)}`;return h.opacity!==void 0&&h.opacity<1&&(d+=p("stop-opacity",h.opacity)),d+="/>",d}).join(""),n=e.gradientUnits==="userSpaceOnUse",i=h=>n?String(h):`${h*100}%`,a=n?p("gradientUnits","userSpaceOnUse"):"",l="",o=e.ry!==void 0&&e.ry!==e.r,u=!!e.rotation;if(o||u){let h=e.cx??(n?0:.5),d=e.cy??(n?0:.5),f=[];f.push(`translate(${h}, ${d})`),u&&f.push(`rotate(${e.rotation})`),o&&e.ry!==0&&f.push(`scale(1, ${e.ry/e.r})`),f.push(`translate(-${h}, -${d})`),l=p("gradientTransform",f.join(" "))}let c=e.fr!==void 0&&e.fr>0?p("fr",i(e.fr)):"";return`<radialGradient${p("id",r)}${a}${p("cx",i(e.cx))}${p("cy",i(e.cy))}${p("fx",i(e.fx))}${p("fy",i(e.fy))}${p("r",i(e.r))}${c}${e.spreadMethod?p("spreadMethod",e.spreadMethod):""}${l}>${t}</radialGradient>`}function qr(r,e){if(e.svgContent!=null){let o=e.width??10,u=e.height??10,c=e.patternUnits??"userSpaceOnUse",h=e.patternContentUnits,d=e.patternTransform,f=e.viewBox,m=e.preserveAspectRatio,b=e.x??0,g=e.y??0,x=`<pattern${p("id",r)}`;return x+=p("patternUnits",c),h&&(x+=p("patternContentUnits",h)),b&&(x+=p("x",b)),g&&(x+=p("y",g)),x+=p("width",o),x+=p("height",u),f&&(x+=p("viewBox",f)),m&&(x+=p("preserveAspectRatio",m)),d&&(x+=p("patternTransform",d)),x+=`>${e.svgContent}</pattern>`,x}let t=10*(e.scale??1),n=e.rotation??0,i=e.color||"#000000",a=e.backgroundColor||"#ffffff",l="";return l+=`<rect${p("width",t)}${p("height",t)}${p("fill",a)}/>`,l+=ms(e.patternType,t,i),`<pattern${p("id",r)}${p("patternUnits","userSpaceOnUse")}${p("width",t)}${p("height",t)}${n?p("patternTransform",`rotate(${n})`):""}>${l}</pattern>`}function ms(r,e,t){return $e(r,e,t).map(i=>{let a=Object.entries(i.attrs).map(([l,o])=>p(l,o)).join("");return`<${i.tag}${a}/>`}).join("")}function gs(r){let e=new Set,t=new Set;for(let n of r){let i=n.state;i.markerStart&&e.add(i.markerStart),i.markerMid&&e.add(i.markerMid),i.markerEnd&&e.add(i.markerEnd);let a=i.startEndpoint,l=i.endEndpoint;a&&a!=="none"&&t.add(a),l&&l!=="none"&&t.add(l)}return{ids:e,legacyEndpoints:t}}function te(r){let e=Array.isArray(r)?gs(r):r;if(e.ids.size===0&&e.legacyEndpoints.size===0)return"";let t="",n=ae();for(let i of n){let a=i.id,l=a.replace("line-marker-",""),o=`mkr-builtin-${l}`,u=e.legacyEndpoints.has(l)||e.ids.has(a),c=e.ids.has(o);if(!u&&!c)continue;let h=i.element,d=Object.entries(h.attrs).map(([b,g])=>p(b,g)).join(""),f=`<${h.tag}${d}/>`,m=b=>{t+=`<marker${p("id",b)}${p("viewBox",xe)}${p("refX",i.refX)}${p("refY",i.refY)}${p("markerWidth",6)}${p("markerHeight",6)}${p("orient","auto-start-reverse")}>${f}</marker>`};u&&m(a),c&&m(o)}return t}var oe=r=>r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),mr=["linear-gradient","radial-gradient","pattern","filter","marker","symbol"];function gr(r){switch(r.kind){case"symbol":return br(r);case"marker":return yr(r);case"linear-gradient":return $r(r);case"radial-gradient":return xr(r);case"pattern":return Sr(r);case"filter":return kr(r)}}function br(r){let e=r.shapes.map(t=>H(t)).join("");return`<symbol id="${oe(r.id)}" viewBox="${oe(r.viewBox)}">${e}</symbol>`}function yr(r){let e;if(r.builtIn){let n=ae().find(i=>r.id.includes(i.id)||r.id===i.id);if(n){let i=Object.entries(n.element.attrs).map(([a,l])=>` ${a}="${oe(String(l))}"`).join("");e=`<${n.element.tag}${i}/>`}else e=""}else e=r.shapes.map(n=>H(n)).join("");let t=typeof r.orient=="number"?String(r.orient):r.orient;return`<marker id="${oe(r.id)}" viewBox="${oe(r.viewBox)}" refX="${r.refX}" refY="${r.refY}" markerWidth="${r.markerWidth}" markerHeight="${r.markerHeight}" markerUnits="${oe(r.markerUnits)}" orient="${oe(t)}">${e}</marker>`}function $r(r){let e={...r.gradient,type:"linear-gradient",id:r.id};return jr(r.id,e)}function xr(r){let e={...r.gradient,type:"radial-gradient",id:r.id};return Yr(r.id,e)}function Sr(r){let e={...r.pattern,type:"pattern",id:r.id};return qr(r.id,e)}function kr(r){return nr(r.id,r.filters,{colorInterpolation:r.colorInterpolation,filterUnits:r.filterUnits,primitiveUnits:r.primitiveUnits,x:r.x,y:r.y,width:r.width,height:r.height})}function _r(r){let e=new Map;for(let n of r){let i=e.get(n.kind);i?i.push(n):e.set(n.kind,[n])}let t="";for(let n of mr){let i=e.get(n);if(i)for(let a of i)t+=gr(a)}return t}function Kr(r){let e=new Set,t=n=>{typeof n=="string"&&n&&e.add(n)};for(let n of r){let i=n.state;if(!i)continue;t(i.fillLibraryId),t(i.strokeLibraryId),t(i.markerStart),t(i.markerMid),t(i.markerEnd),t(i.symbolId);let a=i.filterLibraryIds;if(Array.isArray(a))for(let l of a)t(l)}return e}function re(r,e){let t=new Map;for(let o of e)t.set(o.id,o);let n=new Map,i=o=>{if(!o)return;let u=t.get(o);u&&n.set(o,u)},a=(o,u)=>{if(!o||typeof o!="object")return;let c=o;if(!c.id||n.has(c.id))return;let h=u==="linear-gradient"?"linear-gradient":u==="radial-gradient"?"radial-gradient":u==="pattern"?"pattern":null;if(!h)return;let{id:d,sourceId:f,...m}=o,b;if(h==="linear-gradient")b={kind:"linear-gradient",id:c.id,name:f??c.id,sourceId:f,gradient:m};else if(h==="radial-gradient")b={kind:"radial-gradient",id:c.id,name:f??c.id,sourceId:f,gradient:m};else{let{customPatternId:g,...x}=m;b={kind:"pattern",id:c.id,name:f??c.id,sourceId:f,pattern:x}}n.set(c.id,b)},l=(o,u)=>{let c=o.filters;if(!Array.isArray(c)||c.length===0)return;let h=`filter-${u}`;n.has(h)||n.set(h,{kind:"filter",id:h,name:h,filters:c,...o.filterColorInterpolation&&o.filterColorInterpolation!=="auto"?{colorInterpolation:o.filterColorInterpolation}:{},...o.filterUnits?{filterUnits:o.filterUnits}:{},...o.primitiveUnits?{primitiveUnits:o.primitiveUnits}:{},...typeof o.filterX=="string"?{x:o.filterX}:{},...typeof o.filterY=="string"?{y:o.filterY}:{},...typeof o.filterWidth=="string"?{width:o.filterWidth}:{},...typeof o.filterHeight=="string"?{height:o.filterHeight}:{}})};for(let o of r){let u=o.state;if(!u)continue;i(u.fillLibraryId),i(u.strokeLibraryId),i(u.markerStart),i(u.markerMid),i(u.markerEnd),i(u.symbolId);let c=u.filterLibraryIds;if(Array.isArray(c))for(let h of c)typeof h=="string"&&i(h);u.fillLibraryId||a(u.fillGradient,u.fillType),u.strokeLibraryId||a(u.strokeGradient,u.strokeType),(!Array.isArray(c)||c.length===0)&&l(u,o.id)}return n.size===0?"":_r(Array.from(n.values()))}var bs={x:"x",y:"y",cx:"cx",cy:"cy",x1:"x1",y1:"y1",x2:"x2",y2:"y2",posX:"x",posY:"y",radius:"r",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",pathLength:"pathLength",svgX:"x",svgY:"y",svgWidth:"width",svgHeight:"height",opacity:"opacity",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",borderWidth:"stroke-width",cornerRadius:"rx",fontSize:"font-size",letterSpacing:"letter-spacing",wordSpacing:"word-spacing",textLength:"textLength",d:"d",polylinePoints:"points"},ys=new Set(["rotation","skewX","skewY"]);function $s(r){let t=we[r];return t?t.join(" "):"0 0 1 1"}function pe(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vr(r){return r.cycleDuration!==void 0&&r.cycleDuration>0?r.cycleDuration:r.keyframes.length===0?0:r.keyframes[r.keyframes.length-1].time}function wr(r,e){let t=r.keyframes;if(t.length===0)return{values:[],keyTimes:[],keySplines:[]};let n=t.map(l=>String(l.value)),i=t.map(l=>e>0?(l.time/e).toFixed(4):"0"),a=[];for(let l=1;l<t.length;l++)a.push($s(t[l].easing));return{values:n,keyTimes:i,keySplines:a}}function st(r){let e=r.beginTrigger;if(!e)return"0s";switch(e.type){case"time":return`${e.value}s`;case"event":return e.value;default:return"0s"}}function Pr(r){return r.cycleInfinite?"indefinite":r.cycleRepeats&&r.cycleRepeats>1?String(r.cycleRepeats):null}function xs(r){let e=bs[r.property];if(!e)return"";let t=vr(r);if(t<=0)return"";let{values:n,keyTimes:i,keySplines:a}=wr(r,t);if(n.length<2)return"";let l=`<animate attributeName="${pe(e)}"`;l+=` values="${pe(n.join(";"))}"`,l+=` keyTimes="${i.join(";")}"`,a.length>0&&a.some(u=>u!=="0 0 1 1")&&(l+=' calcMode="spline"',l+=` keySplines="${a.join(";")}"`),l+=` dur="${t}s"`,l+=` begin="${st(r)}"`;let o=Pr(r);return o&&(l+=` repeatCount="${o}"`),l+=' fill="freeze"',l+="/>",l}function Ss(r){let e;switch(r.property){case"rotation":e="rotate";break;case"skewX":e="skewX";break;case"skewY":e="skewY";break;default:return""}let t=vr(r);if(t<=0)return"";let{values:n,keyTimes:i,keySplines:a}=wr(r,t);if(n.length<2)return"";let l=e==="rotate"&&r.transformOrigin?n.map(c=>`${c} ${r.transformOrigin.x} ${r.transformOrigin.y}`):n,o='<animateTransform attributeName="transform"';o+=` type="${e}"`,o+=` values="${pe(l.join(";"))}"`,o+=` keyTimes="${i.join(";")}"`,a.length>0&&a.some(c=>c!=="0 0 1 1")&&(o+=' calcMode="spline"',o+=` keySplines="${a.join(";")}"`),o+=` dur="${t}s"`,o+=` begin="${st(r)}"`;let u=Pr(r);return u&&(o+=` repeatCount="${u}"`),o+=` additive="${r.additive??"sum"}"`,o+=' fill="freeze"',o+="/>",o}function ks(r){if(!r.motionPath)return"";let e=vr(r);if(e<=0)return"";let{keyTimes:t,keySplines:n}=wr(r,e),i=r.keyframes.map(c=>{let h=typeof c.value=="number"?c.value:parseFloat(c.value);return Math.max(0,Math.min(1,h))}),a=!!r.motionPathRef&&(r.motionPathRef.mode??"trackShape")==="curveTemplate",l="<animateMotion";a||(l+=` path="${pe(r.motionPath)}"`),l+=` keyTimes="${t.join(";")}"`,l+=` keyPoints="${i.join(";")}"`,n.length>0&&n.some(c=>c!=="0 0 1 1")&&(l+=' calcMode="spline"',l+=` keySplines="${n.join(";")}"`),l+=` dur="${e}s"`,l+=` begin="${st(r)}"`;let o=Pr(r);o&&(l+=` repeatCount="${o}"`),l+=' fill="freeze"';let u=r.motionRotate??"auto";return l+=` rotate="${u}"`,a?l+=`><mpath href="#${pe(r.motionPathRef.shapeId)}"/></animateMotion>`:l+="/>",l}function _s(r){let e=st(r);if(e!=="0s")return e;let t=r.keyframes[0]?.time??0;return t!==0?`${t}s`:""}function vs(r){let e=_s(r);return e?`<discard begin="${pe(e)}"/>`:"<discard/>"}function at(r){let e=new Map;for(let t of r.tracks){if(!t.enabled||t.property!=="discard"&&t.keyframes.length<2)continue;let n=[...t.keyframes].sort((l,o)=>l.time-o.time),i={...t,locked:t.locked??!1,keyframes:n.map(l=>({time:l.time,value:l.value,easing:l.easing}))},a="";if(t.property==="discard"?a=vs(i):t.property==="pathMotion"&&t.motionPath?a=ks(i):ys.has(t.property)?a=Ss(i):a=xs(i),a){let l=e.get(t.shapeId)??[];l.push(a),e.set(t.shapeId,l)}}return e}function fe(r,e={}){let{xmlDeclaration:t=!0,backgroundColor:n,indent:i=!0,className:a}=e,l=r.viewboxes?.[0],o=e.width??l?.width??800,u=e.height??l?.height??600,c=e.viewBox??`0 0 ${o} ${u}`,h=i?`
8
- `:"",d=i?" ":"",f=r.shapes??[],m=f.filter(A=>A.state?.displayMode==="motionOnly"),b=f.filter(A=>A.state?.displayMode!=="motionOnly"),g=Fs(r),x=Rs(r),v=[...Array.isArray(r.library)?r.library:[],...(x??[]).filter(A=>!A.builtIn&&!(Array.isArray(r.library)&&r.library.some(D=>D.id===A.id)))],_=re(b,v),S=te(b),$=Ls(g,b),w=ws(m),F=_.length>0||S.length>0||$.length>0||w.length>0,y="";F&&(y=`${h}${d}<defs>${h}`,_.length>0&&(y+=`${d}${d}${_}${h}`),S.length>0&&(y+=`${d}${d}${S}${h}`),$.length>0&&(y+=`${d}${d}${$}${h}`),w.length>0&&(y+=`${d}${d}${w}${h}`),y+=`${d}</defs>`);let k="";n&&(k=`${h}${d}<rect width="${o}" height="${u}" fill="${n}"/>`);let P=r.animationTimeline?at(r.animationTimeline):null,I=b.map(A=>{let D=A.type==="symbol-instance"?Is(A,g):H(A),L=P?.get(A.id);return L&&L.length>0&&(D=Ds(D,L,d)),`${d}${D}`}).join(h),M="";return t&&(M+=`<?xml version="1.0" encoding="UTF-8"?>${h}`),M+='<svg xmlns="http://www.w3.org/2000/svg"',M+=` width="${o}" height="${u}"`,M+=` viewBox="${c}"`,a&&(M+=` class="${a}"`),M+=">",M+=y,M+=k,b.length>0&&(M+=`${h}${I}`),M+=`${h}</svg>${h}`,M}function ws(r){if(r.length===0)return"";let e=[];for(let t of r){let n=Ps(t);if(!n)continue;let i=Ts(n);e.push(`<path id="${Zr(t.id)}" d="${Zr(i)}"/>`)}return e.join("")}function Ps(r){let e=r.state;if(typeof e?.d=="string")return e.d;switch(r.type){case"rectangle":{let t=e?.x??0,n=e?.y??0,i=e?.width??0,a=e?.height??0;return i<=0||a<=0?null:`M${t},${n}h${i}v${a}h${-i}Z`}case"circle":{let t=e?.cx??0,n=e?.cy??0,i=e?.radius??0;return i<=0?null:`M${t-i},${n}A${i},${i} 0 1 0 ${t+i},${n}A${i},${i} 0 1 0 ${t-i},${n}Z`}case"ellipse":{let t=e?.cx??0,n=e?.cy??0,i=e?.rx??0,a=e?.ry??0;return i<=0||a<=0?null:`M${t-i},${n}A${i},${a} 0 1 0 ${t+i},${n}A${i},${a} 0 1 0 ${t-i},${n}Z`}case"line":{let t=e?.x1??0,n=e?.y1??0,i=e?.x2??0,a=e?.y2??0;return`M${t},${n}L${i},${a}`}default:return null}}function Ts(r){let e=/[Mm]\s*(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)[\s,]+(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/.exec(r);if(!e)return r;let t=parseFloat(e[1]),n=parseFloat(e[2]);if(!isFinite(t)||!isFinite(n)||t===0&&n===0)return r;let i=!0;return r.replace(/([MLCQSTHVAZ])\s*([\d\s.,e+-]*)/gi,(a,l,o)=>{let u=l.toUpperCase(),c=l!==u,h=i;if(i=!1,u==="Z")return a;let d=o.trim().split(/[\s,]+/).filter(m=>m.length>0).map(Number);if(d.length===0||c&&!h)return a;let f=[];if(u==="H")for(let m of d)f.push(m-t);else if(u==="V")for(let m of d)f.push(m-n);else if(u==="A")for(let m=0;m<d.length;m+=7)f.push(d[m],d[m+1],d[m+2],d[m+3],d[m+4]),m+5<d.length&&f.push(d[m+5]-t),m+6<d.length&&f.push(d[m+6]-n);else for(let m=0;m<d.length;m+=2)f.push(d[m]-t),m+1<d.length&&f.push(d[m+1]-n);return`${l} ${f.join(" ")}`})}function Zr(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Fs(r){let t=(Array.isArray(r.library)?r.library:[]).filter(n=>n.kind==="symbol");return t.length>0?t:r.symbols??[]}function Rs(r){let t=(Array.isArray(r.library)?r.library:[]).filter(n=>n.kind==="marker");return t.length>0?t:r.markers}var Tr=r=>r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Ms=r=>r.replace(/[^a-zA-Z0-9_-]/g,"_");function Qr(r){let e=r.state.symbolId??"",t=r.state.variantKey??"";return r.state.symbolOverrides&&Object.keys(r.state.symbolOverrides).length>0?`${e}--ovr-${r.id}`:t?`${e}--${Ms(t)}`:e}function Cs(r,e){return r.map(t=>{let n=e[t.id];return!n||Object.keys(n).length===0?t:{...t,state:{...t.state,...n}}})}function As(r,e){return e?r.variants?.[e]??r.shapes:r.shapes}function Is(r,e){let t=Qr(r),n=r.state.x??0,i=r.state.y??0,a=r.state.width??100,l=r.state.height??100;return`<use href="#${Tr(t)}" x="${n}" y="${i}" width="${a}" height="${l}"/>`}function Ls(r,e){if(r.length===0)return"";let t=new Map;for(let a of r)t.set(a.id,a);let n=new Map;for(let a of e){if(a.type!=="symbol-instance")continue;let l=a.state.symbolId??"",o=t.get(l);if(!o)continue;let u=Qr(a);if(n.has(u))continue;let c=As(o,a.state.variantKey??""),h=a.state.symbolOverrides;h&&Object.keys(h).length>0&&(c=Cs(c,h)),n.set(u,{def:o,resolved:c})}if(n.size===0)return"";let i=[];for(let[a,{def:l,resolved:o}]of n){let u=o.map(c=>H(c)).join("");i.push(`<symbol id="${Tr(a)}" viewBox="${Tr(l.viewBox)}">${u}</symbol>`)}return i.join("")}function Ds(r,e,t){let n=e.join(""),i=0;for(;i<r.length;){let c=r.slice(i);if(!/^<defs[\s>]/.test(c))break;let h=r.indexOf("</defs>",i);if(h===-1)break;i=h+7}let a=r.slice(0,i),l=r.slice(i),o=l.lastIndexOf("/>");if(o!==-1){let c=l.match(/^<(\w+)/),h=c?c[1]:"g";return a+l.slice(0,o)+">"+n+`</${h}>`}let u=l.match(/<\/(\w+)>$/);if(u){let c=l.lastIndexOf(`</${u[1]}>`);return a+l.slice(0,c)+n+l.slice(c)}return a+l+n}function ot(r,e){let t=J(r,e);return fe(r,{width:t.width,height:t.height,xmlDeclaration:e.xmlDeclaration??!1,indent:!0})}function Bs(r){return r==="class"?"className":r==="for"?"htmlFor":r.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Jr(r){return r.replace(/\s([a-z][a-z-]*?)=/g,(e,t)=>t.startsWith("data-")||t.startsWith("aria-")?e:` ${Bs(t)}=`)}function lt(r,e){let t=e.componentName??"SvgComponent",n=J(r,e),i=e.indent??" ",a=r.shapes??[],l=e.typescript??!1,o=Array.isArray(r.library)?r.library:[],u=re(a,o),c=te(a),h=u+c,d=h.length>0,f=a.map(b=>{let g=H(b);return`${i}${i}${i}${Jr(g)}`}),m=[];m.push("import React from 'react';"),m.push(""),l?(m.push(`interface ${t}Props {`),m.push(`${i}className?: string;`),m.push(`${i}style?: React.CSSProperties;`),m.push("}"),m.push(""),m.push(`const ${t}: React.FC<${t}Props> = ({ className, style }) => {`)):m.push(`const ${t} = ({ className, style }) => {`),m.push(`${i}return (`),m.push(`${i}${i}<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" viewBox="0 0 ${n.width} ${n.height}" className={className} style={style}>`),d&&(m.push(`${i}${i}${i}<defs>`),m.push(`${i}${i}${i}${i}${Jr(h)}`),m.push(`${i}${i}${i}</defs>`));for(let b of f)m.push(b);return m.push(`${i}${i}</svg>`),m.push(`${i});`),m.push("};"),m.push(""),m.push(`export default ${t};`),m.push(""),m.join(`
9
- `)}function ut(r,e){let t=e.componentName??"SvgComponent",n=J(r,e),i=e.indent??" ",a=r.shapes??[],l=e.typescript??!1,o=Array.isArray(r.library)?r.library:[],u=re(a,o),c=te(a),h=u+c,d=h.length>0,f=a.map(b=>`${i}${i}${H(b)}`),m=[];m.push("<template>"),m.push(`${i}<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" viewBox="0 0 ${n.width} ${n.height}" :class="className" :style="style">`),d&&(m.push(`${i}${i}<defs>`),m.push(`${i}${i}${i}${h}`),m.push(`${i}${i}</defs>`));for(let b of f)m.push(b);return m.push(`${i}</svg>`),m.push("</template>"),m.push(""),l?m.push('<script setup lang="ts">'):m.push("<script setup>"),m.push(`// ${t}`),l?(m.push("defineProps<{"),m.push(`${i}className?: string;`),m.push(`${i}style?: Record<string, string>;`),m.push("}>();")):(m.push("defineProps({"),m.push(`${i}className: { type: String, default: '' },`),m.push(`${i}style: { type: Object, default: () => ({}) },`),m.push("});")),m.push("</script>"),m.push(""),m.join(`
10
- `)}var Es=new Set(["circle","ellipse","rectangle","square","line","text","image"]);function en(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function tn(r){return r.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function Os(r){if(!Es.has(r.type))return!0;let e=r.state.metadata;return!!(e?.title||e?.description||r.type==="text"&&r.state.isTextPath)}function ct(r,e){let t=e.componentName??"createSvg",n=J(r,e),i=e.indent??" ",a=r.shapes??[],l=e.typescript??!1,o=[];o.push("import * as d3 from 'd3';"),o.push(""),l?o.push(`export function ${t}(container: string | HTMLElement): d3.Selection<SVGSVGElement, unknown, HTMLElement, unknown> {`):o.push(`export function ${t}(container) {`),o.push(`${i}const svg = d3.select(container)`),o.push(`${i}${i}.append('svg')`),o.push(`${i}${i}.attr('xmlns', 'http://www.w3.org/2000/svg')`),o.push(`${i}${i}.attr('width', ${n.width})`),o.push(`${i}${i}.attr('height', ${n.height})`),o.push(`${i}${i}.attr('viewBox', '0 0 ${n.width} ${n.height}');`),o.push("");let u=Array.isArray(r.library)?r.library:[],c=re(a,u),h=te(a),d=`${c}${h}`;d.length>0&&(o.push(`${i}svg.append('defs').html(\`${tn(d)}\`);`),o.push(""));for(let f=0;f<a.length;f++){let m=a[f];if(o.push(`${i}// ${m.type}${m.state.metadata?.name?` \u2014 ${m.state.metadata.name}`:""}`),Os(m)){o.push(`${i}svg.append('g').html(\`${tn(H(m))}\`);`),o.push("");continue}let b=Er(m),g=Ke(m),x=`shape${f+1}`;o.push(`${i}const ${x} = svg.append('${b}')`);for(let[v,_]of g)o.push(`${i}${i}.attr('${v}', '${en(_)}')`);m.type==="text"&&m.state.text&&o.push(`${i}${i}.text('${en(m.state.text)}')`),o[o.length-1]=o[o.length-1]+";",o.push("")}return o.push(`${i}return svg;`),o.push("}"),o.push(""),o.join(`
11
- `)}function rn(r,e){let t=r.state.metadata?.name;return t?t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""):`${r.type}-${e+1}`}var Gs=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linecap","opacity","transform","filter"]);function dt(r,e){let t=J(r,e),n=e.indent??" ",i=r.shapes??[],a=[];for(let u=0;u<i.length;u++){let c=i[u],h=rn(c,u),d=Ke(c),f=[];for(let[m,b]of d)Gs.has(m)&&f.push(`${n}${m}: ${b};`);f.length>0&&a.push(`.${h} {
12
- ${f.join(`
6
+ ${o}`)}}return a}function ri(r){return[...r].sort((e,t)=>e.id.localeCompare(t.id))}function oe(r){if(r==null)return r;if(Array.isArray(r))return r.map(oe);if(typeof r!="object")return r;let e={},t=Object.keys(r).sort();for(let n of t)e[n]=oe(r[n]);return e}function ni(r){let e={};return e.id=r.id,e.type=r.type,e.state=oe(r.state),e}var Z=/\{\{\s*([\w.\-]+)\s*\}\}/g;function Le(r,e){return r.replace(Z,(t,n)=>{let i=e[n];return i!==void 0?String(i):t})}function De(r,e={}){let t={};if(r.templateVariables)for(let i of r.templateVariables)i.defaultValue!==void 0&&i.defaultValue!==""&&(t[i.name]=i.defaultValue);if(Object.assign(t,e),Object.keys(t).length===0)return JSON.parse(JSON.stringify(r));let n=JSON.parse(JSON.stringify(r));for(let i of n.shapes)Ee(i.state,t);if(n.documentMetadata){let i=n.documentMetadata;Ee(i,t)}return n}function Ee(r,e){for(let t of Object.keys(r)){let n=r[t];if(typeof n=="string"){if(Z.lastIndex=0,Z.test(n)){Z.lastIndex=0;let i=Le(n,e);if(ii(n)){let a=Number(i);if(!isNaN(a)&&ai(t)){r[t]=a;continue}}r[t]=i}}else if(Array.isArray(n))for(let i=0;i<n.length;i++)typeof n[i]=="string"?(Z.lastIndex=0,Z.test(n[i])&&(Z.lastIndex=0,n[i]=Le(n[i],e))):n[i]!==null&&typeof n[i]=="object"&&Ee(n[i],e);else n!==null&&typeof n=="object"&&Ee(n,e)}}function ii(r){return/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/.test(r)}var si=new Set(["x","y","width","height","radius","rx","ry","cx","cy","x1","y1","x2","y2","fontSize","borderWidth","cornerRadius","opacity","fillOpacity","strokeOpacity","rotation","skewX","skewY","scaleX","scaleY","translateX","translateY","letterSpacing","wordSpacing","lineHeight","sides","arms","innerRadiusPercent","armWidthPercent","teeth","toothDepthPercent","holeRadiusPercent","turns","thicknessPercent","direction","headWidthPercent","headLengthPercent","shaftWidthPercent","shiftAngle","dashLength","gapLength","textPathStartOffset","imageOpacity"]);function ai(r){return si.has(r)}function Oe(r){let e=r.templateVariables??[],t=new Set(e.map(a=>a.name)),n=new Set;for(let a of r.shapes)Be(a.state,n);r.documentMetadata&&Be(r.documentMetadata,n);let i=[...n].filter(a=>!t.has(a)).sort();return{defined:[...e],undeclared:i}}function Be(r,e){for(let t of Object.values(r))if(typeof t=="string"){let n;for(Z.lastIndex=0;(n=Z.exec(t))!==null;)e.add(n[1])}else if(Array.isArray(t))for(let n of t)if(typeof n=="string"){let i;for(Z.lastIndex=0;(i=Z.exec(n))!==null;)e.add(i[1])}else n!==null&&typeof n=="object"&&Be(n,e);else t!==null&&typeof t=="object"&&Be(t,e)}function Vr(r){let e={};for(let t of r){let n=t.indexOf("=");if(n===-1)throw new Error(`Invalid variable format: "${t}". Expected "name=value".`);let i=t.slice(0,n).trim(),a=t.slice(n+1);if(!i)throw new Error(`Invalid variable format: "${t}". Variable name cannot be empty.`);e[i]=a}return e}var Nr=3,Hr=12;function Wr(r){return r==null||!Number.isFinite(r)?3:r<0?0:r>12?12:Math.floor(r)}function ze(r,e){if(!Number.isFinite(r))return r;let t=Math.pow(10,e);return Math.round(r*t)/t}var oi=/-?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?/g;function tr(r,e){return r.replace(oi,t=>{let n=parseFloat(t);return Number.isFinite(n)?String(ze(n,e)):t})}var li=new Set(["rawTransform","strokeDasharray","filterX","filterY","filterWidth","filterHeight","cssClipPath"]),ui=new Set(["metadata","customMetadata","customAttrs","customData","bindings","richTextData","cssMaskProperties","rawMetadata"]);function J(r,e,t){if(e==null)return e;if(typeof e=="number")return ze(e,t);if(typeof e=="string")return li.has(r)?tr(e,t):e;if(typeof e=="boolean")return e;if(Array.isArray(e))return e.map(n=>J(r,n,t));if(typeof e=="object"){if(ui.has(r))return e;if(r==="symbolOverrides"){let i={};for(let[a,l]of Object.entries(e))i[a]=J("state",l,t);return i}let n={};for(let[i,a]of Object.entries(e))n[i]=J(i,a,t);return n}return e}function Ge(r,e){return{id:r.id,type:r.type,state:J("state",r.state,e)}}function Xr(r,e){let t={...r,shapes:r.shapes.map(n=>Ge(n,e)),viewboxes:r.viewboxes.map(n=>J("viewbox",n,e))};return r.guides&&(t.guides=r.guides.map(n=>J("guide",n,e))),r.measurements&&(t.measurements=r.measurements.map(n=>J("measurement",n,e))),r.animationTimeline&&(t.animationTimeline=J("animationTimeline",r.animationTimeline,e)),r.symbols&&(t.symbols=r.symbols.map(n=>({...n,shapes:n.shapes.map(i=>Ge(i,e))}))),r.markers&&(t.markers=r.markers.map(n=>J("marker",n,e))),r.customPatterns&&(t.customPatterns=r.customPatterns.map(n=>J("customPattern",n,e))),t}function $e(r,e,t=-90){let n=[],i=t*Math.PI/180;for(let a=0;a<r;a++){let l=i+a*2*Math.PI/r;n.push({x:e*Math.cos(l),y:e*Math.sin(l)})}return n}function Ve(r,e,t,n=-90){let i=[],a=e*(t/100),l=n*Math.PI/180;for(let o=0;o<r*2;o++){let u=l+o*Math.PI/r,c=o%2===0?e:a;i.push({x:c*Math.cos(u),y:c*Math.sin(u)})}return i}function Ne(r,e,t=0){let n=r*(e/100)/2,i=[{x:-n,y:-r},{x:n,y:-r},{x:n,y:-n},{x:r,y:-n},{x:r,y:n},{x:n,y:n},{x:n,y:r},{x:-n,y:r},{x:-n,y:n},{x:-r,y:n},{x:-r,y:-n},{x:-n,y:-n}];if(t===0)return i;let a=Math.cos(t*Math.PI/180),l=Math.sin(t*Math.PI/180);return i.map(o=>({x:o.x*a-o.y*l,y:o.x*l+o.y*a}))}function He(r,e,t,n,i=-90){let l=r*2*(t/100),o=r*(e/100),u=o*(n/100),c=[{x:r,y:0},{x:r-l,y:-o/2},{x:r-l,y:-u/2},{x:-r,y:-u/2},{x:-r,y:u/2},{x:r-l,y:u/2},{x:r-l,y:o/2}];if(i===0)return c;let h=Math.cos(i*Math.PI/180),d=Math.sin(i*Math.PI/180);return c.map(p=>({x:p.x*h-p.y*d,y:p.x*d+p.y*h}))}function We(r,e,t,n,i=0){let a=r,l=a*(t/100),o=a*(n/100),u=o/2,c=e*Math.PI/180,h=Math.cos(c),d=Math.sin(c),p=Math.abs(h),m=Math.abs(d),b=Math.max(p,m)||1,g={x:h*(a/b),y:d*(a/b)},y={x:g.x+h*l,y:g.y+d*l},S=Math.min(o,a-u),_=-a+u+S,x=a-u-S,k={x:-a,y:-a},P={x:a,y:-a},v={x:a,y:a},$={x:-a,y:a},w;if(p>=m&&h>0){let C=Math.max(_,Math.min(x,g.y)),A={x:a,y:C-u},L={x:a,y:C+u};w=[k,P,A,y,L,v,$]}else if(p>=m&&h<=0){let C=Math.max(_,Math.min(x,g.y)),A={x:-a,y:C+u},L={x:-a,y:C-u};w=[k,P,v,$,A,y,L]}else if(d<0){let C=Math.max(_,Math.min(x,g.x)),A={x:C-u,y:-a},L={x:C+u,y:-a};w=[k,A,y,L,P,v,$]}else{let C=Math.max(_,Math.min(x,g.x)),A={x:C+u,y:a},L={x:C-u,y:a};w=[k,P,v,A,y,L,$]}if(i===0)return w;let R=Math.cos(i*Math.PI/180),I=Math.sin(i*Math.PI/180);return w.map(C=>({x:C.x*R-C.y*I,y:C.x*I+C.y*R}))}function Xe(r,e,t,n,i=0){let a=Math.max(2,Math.round(e)),l=r*(t/100),o=r*(n/100)/2,u=a+1,c=[];for(let g=0;g<u;g++){let y=g/(u-1),S=-r+y*2*r,_=0;g>0&&g<u-1&&(_=g%2===1?l:-l),c.push({x:_,y:S})}let h=[],d=[];for(let g=0;g<u;g++){if(g===0||g===u-1){h.push({...c[g]}),d.push({...c[g]});continue}let y=c[g-1],S=c[g],_=c[g+1],x=S.x-y.x,k=S.y-y.y,P=Math.hypot(x,k)||1,v=x/P,$=k/P,w=_.x-S.x,R=_.y-S.y,I=Math.hypot(w,R)||1,C=w/I,A=R/I,L=(v+C)/2,E=($+A)/2,D=Math.hypot(L,E),F,G;D<1e-6?(F=-$,G=v):(F=-E/D,G=L/D),h.push({x:S.x-F*o,y:S.y-G*o}),d.push({x:S.x+F*o,y:S.y+G*o})}let p=[];p.push(h[0]);for(let g=1;g<u-1;g++)p.push(d[g]);p.push(h[u-1]);for(let g=u-2;g>=1;g--)p.push(h[g]);if(i===0)return p;let m=Math.cos(i*Math.PI/180),b=Math.sin(i*Math.PI/180);return p.map(g=>({x:g.x*m-g.y*b,y:g.x*b+g.y*m}))}function je(r,e,t,n=0){let i=r,a=Math.max(.3,Math.min(.9,e/100)),l=-i*(t/100),o={x:0,y:i},u={x:0,y:l},c={x:-i*a,y:i*.4},h={x:-i*a,y:-i},d={x:i*a,y:-i},p={x:i*a,y:i*.4},m=[o,c,h,u,d,p,o],b=n===0?m:(()=>{let P=Math.cos(n*Math.PI/180),v=Math.sin(n*Math.PI/180);return m.map($=>({x:$.x*P-$.y*v,y:$.x*v+$.y*P}))})(),[g,y,S,_,x,k]=b;return`M ${g.x} ${g.y} C ${y.x} ${y.y} ${S.x} ${S.y} ${_.x} ${_.y} C ${x.x} ${x.y} ${k.x} ${k.y} ${g.x} ${g.y} Z`}function Ye(r,e,t,n=0){let i=Math.max(3,Math.round(e)),a=Math.max(.3,Math.min(1,t/100)),l=r,o=l*1.7,u=l*1.15,c=[];for(let $=0;$<i;$++){let R=(90+$/i*360)*Math.PI/180;c.push({x:o/2*Math.cos(R),y:-(u/2)*Math.sin(R)})}let h=.15,d=0;for(let $=0;$<i;$++){let w=c[$],R=c[($+1)%i];d=Math.max(d,Math.hypot(R.x-w.x,R.y-w.y))}let p=d/(2*(1-h))+.001,m=Math.max(p,d*(.68+a*.35)),b=c.map($=>{let w=$.y/(u/2);return m*(1-h*w)});function g($){let w=c[$],R=c[($+1)%i],I=b[$],C=b[($+1)%i],A=R.x-w.x,L=R.y-w.y,E=Math.hypot(A,L)||1,D=(I*I-C*C+E*E)/(2*E),F=Math.sqrt(Math.max(0,I*I-D*D)),G=w.x+D/E*A,Y=w.y+D/E*L,H=-L/E,ae=A/E,Q={x:G+H*F,y:Y+ae*F},j={x:G-H*F,y:Y-ae*F};return Q.x*Q.x+Q.y*Q.y>j.x*j.x+j.y*j.y?Q:j}let y=[];for(let $=0;$<i;$++)y.push(g($));let S=14,_=[];for(let $=0;$<i;$++){let w=c[$],R=b[$],I=y[($-1+i)%i],C=y[$],A=Math.atan2(I.y-w.y,I.x-w.x),E=Math.atan2(C.y-w.y,C.x-w.x)-A;E<=0&&(E+=2*Math.PI);let D=2*Math.PI-E,F=A+E/2,G=A-D/2,Y={x:w.x+R*Math.cos(F),y:w.y+R*Math.sin(F)},H={x:w.x+R*Math.cos(G),y:w.y+R*Math.sin(G)},Q=Y.x*Y.x+Y.y*Y.y>H.x*H.x+H.y*H.y?E:-D;for(let j=0;j<S;j++){let Te=j/S,q=A+Te*Q;_.push({x:w.x+R*Math.cos(q),y:w.y+R*Math.sin(q)})}}let x=0;for(let $ of _){let w=Math.max(Math.abs($.x),Math.abs($.y));w>x&&(x=w)}if(x>0&&x!==l){let $=l/x;for(let w of _)w.x*=$,w.y*=$}let k=$=>{if(n===0)return $;let w=Math.cos(n*Math.PI/180),R=Math.sin(n*Math.PI/180);return{x:$.x*w-$.y*R,y:$.x*R+$.y*w}},P=_.map(k),v=`M ${P[0].x} ${P[0].y}`;for(let $=1;$<P.length;$++)v+=` L ${P[$].x} ${P[$].y}`;return v+=" Z",v}function K(r,e=0,t=0){if(r.length<3)return"";if(e<=0)return r.map((a,l)=>(l===0?"M":"L")+`${a.x},${a.y}`).join(" ")+" Z";let n=Math.min(e,t*.4),i="";for(let a=0;a<r.length;a++){let l=r[(a-1+r.length)%r.length],o=r[a],u=r[(a+1)%r.length],c={x:l.x-o.x,y:l.y-o.y},h=Math.hypot(c.x,c.y);c.x/=h,c.y/=h;let d={x:u.x-o.x,y:u.y-o.y},p=Math.hypot(d.x,d.y);d.x/=p,d.y/=p;let m=Math.min(n,h/2),b=Math.min(n,p/2),g={x:o.x+c.x*m,y:o.y+c.y*m},y={x:o.x+d.x*b,y:o.y+d.y*b};i+=a===0?`M${g.x},${g.y}`:` L${g.x},${g.y}`,i+=` Q${o.x},${o.y} ${y.x},${y.y}`}return i+" Z"}function qe(r,e,t="evenodd"){let n=r*(e/100),i=t==="nonzero"?1:0;return`M ${r} 0 A ${r} ${r} 0 1 1 ${-r} 0 A ${r} ${r} 0 1 1 ${r} 0 Z M ${n} 0 A ${n} ${n} 0 1 ${i} ${-n} 0 A ${n} ${n} 0 1 ${i} ${n} 0 Z`}function Ze(r,e,t,n=1,i=0){let a=r*(t/100),o=Math.round(e*36),u=e*2*Math.PI,c=(r-a/2)/u,h=i*Math.PI/180,d=[],p=[];for(let g=0;g<=o;g++){let y=g/o,S=y*u*n+h,_=c*(y*u)+a/2,x=a/2;d.push({x:(_+x*.3)*Math.cos(S),y:(_+x*.3)*Math.sin(S)}),p.push({x:Math.max(0,_-x*.3)*Math.cos(S),y:Math.max(0,_-x*.3)*Math.sin(S)})}let m=`M ${d[0].x} ${d[0].y}`;for(let g=1;g<d.length;g++)m+=` L ${d[g].x} ${d[g].y}`;let b=p[p.length-1];m+=` L ${b.x} ${b.y}`;for(let g=p.length-2;g>=0;g--)m+=` L ${p[g].x} ${p[g].y}`;return m+=" Z",m}var ci=.2;function ir(r,e,t,n=0){let i=e*(t/100),a=e,l=e-i,o=2*Math.PI/r,u=o*ci/2,c=o/4,h=n*Math.PI/180,d=[];for(let p=0;p<r;p++){let m=h+p*o;d.push({x:l*Math.cos(m),y:l*Math.sin(m)}),d.push({x:a*Math.cos(m+c-u),y:a*Math.sin(m+c-u)}),d.push({x:a*Math.cos(m+c+u),y:a*Math.sin(m+c+u)}),d.push({x:l*Math.cos(m+o/2),y:l*Math.sin(m+o/2)})}return d}function Ke(r,e,t,n=0,i=0,a="evenodd",l=0){let o=ir(r,e,t,l),u=Math.min(n,e*.1),c=K(o,u,e);if(i>0){let h=e*(i/100),d=a==="nonzero"?1:0;c+=` M ${h} 0 A ${h} ${h} 0 1 ${d} ${-h} 0 A ${h} ${h} 0 1 ${d} ${h} 0 Z`}return c}function Qe(r,e,t,n,i,a="round",l="uniform",o){let u=Math.min(t,n)/2,c,h,d,p,m,b,g,y;if(l==="non-uniform"&&o?(c=Math.min(o.radiusTL??i,u),h=Math.min(o.radiusTR??i,u),d=Math.min(o.radiusBR??i,u),p=Math.min(o.radiusBL??i,u),m=o.shapeTL??a,b=o.shapeTR??a,g=o.shapeBR??a,y=o.shapeBL??a):(c=h=d=p=Math.min(i,u),m=b=g=y=a),!(a!=="round"||l==="non-uniform"||c>0&&m!=="round"||h>0&&b!=="round"||d>0&&g!=="round"||p>0&&y!=="round")&&c===h&&h===d&&d===p)return null;let _=`M${r+c},${e}`;return _+=` L${r+t-h},${e}`,_+=Ue(b,h,r+t,e,"tr"),_+=` L${r+t},${e+n-d}`,_+=Ue(g,d,r+t,e+n,"br"),_+=` L${r+p},${e+n}`,_+=Ue(y,p,r,e+n,"bl"),_+=` L${r},${e+c}`,_+=Ue(m,c,r,e,"tl"),_+=" Z",_}function Ue(r,e,t,n,i){if(e<=0)return"";switch(r){case"round":switch(i){case"tr":return` A${e},${e} 0 0 1 ${t},${n+e}`;case"br":return` A${e},${e} 0 0 1 ${t-e},${n}`;case"bl":return` A${e},${e} 0 0 1 ${t},${n-e}`;case"tl":return` A${e},${e} 0 0 1 ${t+e},${n}`}break;case"scoop":switch(i){case"tr":return` A${e},${e} 0 0 0 ${t},${n+e}`;case"br":return` A${e},${e} 0 0 0 ${t-e},${n}`;case"bl":return` A${e},${e} 0 0 0 ${t},${n-e}`;case"tl":return` A${e},${e} 0 0 0 ${t+e},${n}`}break;case"bevel":switch(i){case"tr":return` L${t},${n+e}`;case"br":return` L${t-e},${n}`;case"bl":return` L${t},${n-e}`;case"tl":return` L${t+e},${n}`}break;case"notch":switch(i){case"tr":return` L${t-e},${n+e} L${t},${n+e}`;case"br":return` L${t-e},${n-e} L${t-e},${n}`;case"bl":return` L${t+e},${n-e} L${t},${n-e}`;case"tl":return` L${t+e},${n+e} L${t+e},${n}`}break}return""}function de(r,e,t=!1,n=.5,i){if(r.length<2)return r.length===1?`M ${r[0].x} ${r[0].y}`:"";switch(e){case"CATMULL_ROM":case"catmull-rom":return pi(r,t,n);case"BASIS":case"basis":return mi(r,t);case"ARC":case"arc":return i&&i.length>0?di(r,t,i):ye(r,t,"CUBIC");case"LINEAR":case"linear":return ye(r,t,"LINEAR");case"QUADRATIC":case"quadratic":return ye(r,t,"QUADRATIC");case"CUBIC":case"cubic":return ye(r,t,"CUBIC");default:return ye(r,t)}}function di(r,e,t){let n=`M ${r[0].x} ${r[0].y}`,i=0,a={rx:50,ry:50,rotation:0,largeArc:!1,sweep:!0};for(let l=0;l<r.length-1;l++){let o=r[l+1];if(o.isSubpathStart){if(e&&l-i>=1){let c=r[i],h=t?.[l]??a;n+=` A ${h.rx} ${h.ry} ${h.rotation} ${h.largeArc?1:0} ${h.sweep?1:0} ${c.x} ${c.y} Z`}n+=` M ${o.x} ${o.y}`,i=l+1;continue}let u=t?.[l]??a;n+=` A ${u.rx} ${u.ry} ${u.rotation} ${u.largeArc?1:0} ${u.sweep?1:0} ${o.x} ${o.y}`}if(e&&r.length-i>1){let l=r[i],o=t?.[r.length-1]??a;n+=` A ${o.rx} ${o.ry} ${o.rotation} ${o.largeArc?1:0} ${o.sweep?1:0} ${l.x} ${l.y} Z`}return n}function ye(r,e,t){let n=`M ${r[0].x} ${r[0].y}`,i=0,a=null,l=null;for(let o=0;o<r.length-1;o++){let u=r[o],c=r[o+1];if(c.isSubpathStart){if(e&&o-i>=1){let d=r[i];n+=rr(u,d,d.segmentType,a,l,t),n+=" Z"}n+=` M ${c.x} ${c.y}`,i=o+1,a=null,l=null;continue}n+=rr(u,c,c.segmentType,a,l,t);let h=fi(c.segmentType??t,u,c);a=h,h==="quad"?l=u.handleOut??null:l=null}if(e&&r.length-i>1){let o=r[r.length-1],u=r[i];n+=rr(o,u,u.segmentType,a,l,t),n+=" Z"}return n}var hi=.001;function ce(r,e){return Math.abs(r-e)<hi}function fi(r,e,t){let n=(r??(e.handleOut||t.handleIn?"CUBIC":"LINEAR")).toUpperCase();return n==="CUBIC"||n==="SMOOTH_CUBIC"?"cubic":n==="QUADRATIC"||n==="SMOOTH_QUADRATIC"?"quad":null}function rr(r,e,t,n,i,a){let l=(t??a??(r.handleOut||e.handleIn?"CUBIC":"LINEAR")).toUpperCase();if(l==="LINEAR"||l==="HORIZONTAL"||l==="VERTICAL")return(l==="HORIZONTAL"||l==="LINEAR")&&ce(r.y,e.y)?` H ${e.x}`:(l==="VERTICAL"||l==="LINEAR")&&ce(r.x,e.x)?` V ${e.y}`:` L ${e.x} ${e.y}`;if(l==="ARC"){let c=e.arcParams;return c?` A ${c.rx} ${c.ry} ${c.rotation} ${c.largeArc?1:0} ${c.sweep?1:0} ${e.x} ${e.y}`:` L ${e.x} ${e.y}`}if(l==="QUADRATIC"||l==="SMOOTH_QUADRATIC"){let c=r.handleOut??{x:(r.x+e.x)/2,y:(r.y+e.y)/2};return n==="quad"&&i&&ce(c.x,2*r.x-i.x)&&ce(c.y,2*r.y-i.y)?` T ${e.x} ${e.y}`:` Q ${c.x} ${c.y} ${e.x} ${e.y}`}let o=r.handleOut??{x:r.x,y:r.y},u=e.handleIn??{x:e.x,y:e.y};return n==="cubic"&&r.handleIn&&r.handleOut&&ce(r.handleOut.x,2*r.x-r.handleIn.x)&&ce(r.handleOut.y,2*r.y-r.handleIn.y)?` S ${u.x} ${u.y} ${e.x} ${e.y}`:` C ${o.x} ${o.y} ${u.x} ${u.y} ${e.x} ${e.y}`}function pi(r,e,t){if(r.length<2)return r.length===1?`M ${r[0].x} ${r[0].y}`:"";let n=t,i=e?[r[r.length-1],...r,r[0],r[1]]:[r[0],...r,r[r.length-1]],a=`M ${r[0].x} ${r[0].y}`,l=e?r.length:r.length-1;for(let o=0;o<l;o++){let u=i[o],c=i[o+1],h=i[o+2],d=i[o+3],p=Math.hypot(h.x-c.x,h.y-c.y),m=Math.hypot(c.x-u.x,c.y-u.y),b=Math.hypot(d.x-h.x,d.y-h.y),g=Math.pow(m,n),y=Math.pow(p,n),S=Math.pow(b,n),_=Math.pow(m,2*n),x=Math.pow(p,2*n),k=Math.pow(b,2*n),P,v,$,w;m<1e-8?(P=c.x,v=c.y):(P=(_*h.x-x*u.x+(2*_+3*g*y+x)*c.x)/(3*g*(g+y)),v=(_*h.y-x*u.y+(2*_+3*g*y+x)*c.y)/(3*g*(g+y))),b<1e-8?($=h.x,w=h.y):($=(k*c.x-x*d.x+(2*k+3*S*y+x)*h.x)/(3*S*(S+y)),w=(k*c.y-x*d.y+(2*k+3*S*y+x)*h.y)/(3*S*(S+y))),a+=` C ${P} ${v} ${$} ${w} ${h.x} ${h.y}`}return e&&(a+=" Z"),a}function mi(r,e){let t=r.length;if(t<2)return t===1?`M ${r[0].x} ${r[0].y}`:"";if(t===2)return`M ${r[0].x} ${r[0].y} L ${r[1].x} ${r[1].y}`;if(e){let a=(r[0].x+4*r[1].x+r[2].x)/6,l=(r[0].y+4*r[1].y+r[2].y)/6,o=`M ${a} ${l}`;for(let u=0;u<t;u++){let c=r[(u+1)%t],h=r[(u+2)%t],d=r[(u+3)%t];o+=nr(c,h,d)}return o+=" Z",o}let n=r,i=`M ${n[0].x} ${n[0].y}`;i+=` L ${(5*n[0].x+n[1].x)/6} ${(5*n[0].y+n[1].y)/6}`;for(let a=0;a<=t-3;a++)i+=nr(n[a],n[a+1],n[a+2]);return i+=nr(n[t-2],n[t-1],n[t-1]),i+=` L ${n[t-1].x} ${n[t-1].y}`,i}function nr(r,e,t){return` C ${(2*r.x+e.x)/3} ${(2*r.y+e.y)/3} ${(r.x+2*e.x)/3} ${(r.y+2*e.y)/3} ${(r.x+4*e.x+t.x)/6} ${(r.y+4*e.y+t.y)/6}`}function he(r,e,t){let n=Number.isFinite(e)?Math.max(1,e):8,i=Number.isFinite(t)?Math.max(1,t):4;switch(r){case"dashed":case"dotted":case"custom":return`${n} ${i}`;default:return null}}var gi=[["fontVariant","font-variant"],["fontVariantLigatures","font-variant-ligatures"],["fontVariantPosition","font-variant-position"],["fontVariantCaps","font-variant-caps"],["fontVariantNumeric","font-variant-numeric"],["fontVariantEastAsian","font-variant-east-asian"]];function O(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function bi(r){let e=r.fillType;return e||(r.fillGradient?r.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":r.linearGradient?"linear-gradient":r.radialGradient?"radial-gradient":"solid")}function Je(r){let e=new Map,t=r.state,n=t;switch(r.type){case"circle":e.set("cx",String(t.x??0)),e.set("cy",String(t.y??0)),e.set("r",String(t.radius??50));break;case"ellipse":e.set("cx",String(t.cx??0)),e.set("cy",String(t.cy??0)),e.set("rx",String(t.rx??50)),e.set("ry",String(t.ry??30));break;case"rectangle":case"square":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),e.set("width",String(t.width??100)),e.set("height",String(t.height??100));{let k=t.rx??t.cornerRadius??0,P=t.ry??t.cornerRadius??0;(k>0||P>0)&&(e.set("rx",String(k)),e.set("ry",String(P)))}break;case"line":e.set("x1",String(t.x1??0)),e.set("y1",String(t.y1??0)),e.set("x2",String(t.x2??0)),e.set("y2",String(t.y2??0));break;case"text":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),t.fontSize&&e.set("font-size",String(t.fontSize)),t.fontFamily&&e.set("font-family",t.fontFamily),t.fontWeight&&e.set("font-weight",t.fontWeight),t.fontStyle&&e.set("font-style",t.fontStyle),t.textAnchor&&e.set("text-anchor",t.textAnchor),t.letterSpacing&&e.set("letter-spacing",String(t.letterSpacing));{let k=gi.map(([P,v])=>{let $=typeof t[P]=="string"?String(t[P]).trim():"";return $?`${v}: ${$}`:""}).filter(Boolean).join("; ");k&&e.set("style",k)}break;case"image":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),e.set("width",String(t.width??100)),e.set("height",String(t.height??100)),n.href&&e.set("href",String(n.href));break}let i=bi(n);i==="none"?e.set("fill","none"):i==="linear-gradient"||i==="radial-gradient"?e.set("fill",`url(#gradient-fill-${r.id})`):i==="pattern"?e.set("fill",`url(#pattern-fill-${r.id})`):e.set("fill",t.fillColor??"#000000");let a=t.opacity;a!==void 0&&a<1&&e.set("opacity",String(a));let l=t.fillOpacity;l!==void 0&&l<1&&e.set("fill-opacity",String(l)),t.fillRule&&t.fillRule!=="nonzero"&&e.set("fill-rule",t.fillRule);let o=n.strokeType??"solid";if(o==="none")e.set("stroke","none");else if(o==="linear-gradient"||o==="radial-gradient")e.set("stroke",`url(#gradient-stroke-${r.id})`);else{let k=t.borderColor??"none";k!=="none"&&e.set("stroke",k)}let u=t.borderWidth;u!=null&&u!==0&&e.set("stroke-width",String(u));let c=t.strokeOpacity;c!==void 0&&c<1&&e.set("stroke-opacity",String(c));let h=t.lineStyle??"solid",d=t.dashLength??8,p=t.gapLength??4,m=he(h,d,p);m&&(e.set("stroke-dasharray",m),h==="dotted"&&e.set("stroke-linecap","round"));let b=yi(n);b&&e.set("transform",b);let g=n.filters;g&&g.length>0&&e.set("filter",`url(#filter-${r.id})`);let y=t.shapeRendering;y&&y!=="auto"&&e.set("shape-rendering",y),t.pathLength!==void 0&&e.set("pathLength",String(t.pathLength));let S=n.startEndpoint,_=n.endEndpoint;S&&S!=="none"&&e.set("marker-start",`url(#line-marker-${S})`),_&&_!=="none"&&e.set("marker-end",`url(#line-marker-${_})`);let x=n.metadata;return x&&(x.role&&e.set("role",x.role),x.ariaLabel&&e.set("aria-label",x.ariaLabel)),e}function jr(r){switch(r.type){case"circle":return"circle";case"ellipse":return"ellipse";case"rectangle":case"square":return"rect";case"line":return"line";case"text":return"text";case"image":return"image";case"path":case"polyline":case"triangle":case"ngon":case"star":case"cross":case"ring":case"spiral":case"gear":case"arrow":return"path";default:return"g"}}function yi(r){let e=r.rotation??0,t=r.skewX??0,n=r.skewY??0,i=r.scaleX??1,a=r.scaleY??1,l=r.translateX??0,o=r.translateY??0,u=l!==0||o!==0;if(!u&&e===0&&t===0&&n===0&&i===1&&a===1)return null;let c=r.customPivot;if(!c&&!u)return null;let h=[];return u&&h.push(`translate(${l}, ${o})`),c&&(e!==0||t!==0||n!==0||i!==1||a!==1)&&(h.push(`translate(${c.x}, ${c.y})`),e!==0&&h.push(`rotate(${e})`),(i!==1||a!==1)&&h.push(`scale(${i}, ${a})`),t!==0&&h.push(`skewX(${t})`),n!==0&&h.push(`skewY(${n})`),h.push(`translate(${-c.x}, ${-c.y})`)),h.join(" ")}function ee(r,e){let t=r.viewboxes?.[0];return{width:e.width??t?.width??800,height:e.height??t?.height??600}}function s(r,e){return e==null||e===""?"":` ${r}="${O(String(e))}"`}function tt(r){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);return e?{r:parseInt(e[1],16)/255,g:parseInt(e[2],16)/255,b:parseInt(e[3],16)/255}:{r:0,g:0,b:0}}function $i(r,e,t){let{offsetX:n,offsetY:i,blurRadius:a,spread:l,color:o,opacity:u}=r,c="";if(l===0)c+=`<feDropShadow${s("in",e)}${s("dx",n)}${s("dy",i)}${s("stdDeviation",a/2)}${s("flood-color",o)}${s("flood-opacity",u)}${s("result",`${t}_shadow`)}/>`,c+=`<feMerge${s("result",t)}><feMergeNode${s("in",`${t}_shadow`)}/><feMergeNode${s("in",e)}/></feMerge>`;else{c+=`<feColorMatrix${s("in",e)}${s("type","matrix")}${s("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${s("result",`${t}_alpha`)}/>`;let h=l>0?"dilate":"erode",d=Math.abs(l);c+=`<feMorphology${s("in",`${t}_alpha`)}${s("operator",h)}${s("radius",d)}${s("result",`${t}_spread`)}/>`,c+=`<feGaussianBlur${s("in",`${t}_spread`)}${s("stdDeviation",a/2)}${s("result",`${t}_blur`)}/>`,c+=`<feOffset${s("in",`${t}_blur`)}${s("dx",n)}${s("dy",i)}${s("result",`${t}_offset`)}/>`,c+=`<feFlood${s("flood-color",o)}${s("flood-opacity",u)}${s("result",`${t}_color`)}/>`,c+=`<feComposite${s("in",`${t}_color`)}${s("in2",`${t}_offset`)}${s("operator","in")}${s("result",`${t}_shadow`)}/>`,c+=`<feMerge${s("result",t)}><feMergeNode${s("in",`${t}_shadow`)}/><feMergeNode${s("in",e)}/></feMerge>`}return c}function xi(r,e,t){let{offsetX:n,offsetY:i,blurRadius:a,choke:l,color:o,opacity:u}=r,c=a*(1-l/100),h="";return h+=`<feColorMatrix${s("in",e)}${s("type","matrix")}${s("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${s("result",`${t}_alpha`)}/>`,h+=`<feComponentTransfer${s("in",`${t}_alpha`)}${s("result",`${t}_inverted`)}><feFuncA${s("type","table")}${s("tableValues","1 0")}/></feComponentTransfer>`,h+=`<feGaussianBlur${s("in",`${t}_inverted`)}${s("stdDeviation",c/2)}${s("result",`${t}_blur`)}/>`,h+=`<feOffset${s("in",`${t}_blur`)}${s("dx",n)}${s("dy",i)}${s("result",`${t}_offset`)}/>`,h+=`<feFlood${s("flood-color",o)}${s("flood-opacity",u)}${s("result",`${t}_color`)}/>`,h+=`<feComposite${s("in",`${t}_color`)}${s("in2",`${t}_offset`)}${s("operator","in")}${s("result",`${t}_coloredShadow`)}/>`,h+=`<feComposite${s("in",`${t}_coloredShadow`)}${s("in2",`${t}_alpha`)}${s("operator","in")}${s("result",`${t}_innerShadow`)}/>`,h+=`<feComposite${s("in",`${t}_innerShadow`)}${s("in2",e)}${s("operator","over")}${s("result",t)}/>`,h}function Si(r,e,t){let{blurX:n,blurY:i}=r;return n===0&&i===0?B(e,t):`<feGaussianBlur${s("in",e)}${s("stdDeviation",`${n/2} ${i/2}`)}${s("result",t)}/>`}function ki(r,e,t){let{distance:n,angle:i}=r;if(n===0)return B(e,t);let a=i*Math.PI/180,l=Math.abs(Math.cos(a)*n),o=Math.abs(Math.sin(a)*n);return`<feGaussianBlur${s("in",e)}${s("stdDeviation",`${l/2} ${o/2}`)}${s("result",t)}/>`}function Yr(r,e,t){let{x:n,y:i,z:a,color:l,surfaceScale:o,diffuseConstant:u,specularConstant:c,specularExponent:h}=r,d="";return d+=`<feDiffuseLighting${s("in","SourceAlpha")}${s("surfaceScale",o)}${s("diffuseConstant",u)}${s("lighting-color",l)}${s("result",`${t}_diffuse`)}>`,d+=`<fePointLight${s("x",n)}${s("y",i)}${s("z",a)}/>`,d+="</feDiffuseLighting>",d+=`<feSpecularLighting${s("in","SourceAlpha")}${s("surfaceScale",o)}${s("specularConstant",c)}${s("specularExponent",h)}${s("lighting-color",l)}${s("result",`${t}_specular`)}>`,d+=`<fePointLight${s("x",n)}${s("y",i)}${s("z",a)}/>`,d+="</feSpecularLighting>",d+=`<feComposite${s("in",e)}${s("in2",`${t}_diffuse`)}${s("operator","arithmetic")}${s("k1",1)}${s("k2",0)}${s("k3",0)}${s("k4",0)}${s("result",`${t}_lit`)}/>`,d+=`<feComposite${s("in",`${t}_specular`)}${s("in2",`${t}_lit`)}${s("operator","arithmetic")}${s("k1",0)}${s("k2",1)}${s("k3",1)}${s("k4",0)}${s("result",t)}/>`,d}function qr(r,e,t){let{x:n,y:i,z:a,pointsAtX:l,pointsAtY:o,pointsAtZ:u,coneAngle:c,color:h,surfaceScale:d,specularConstant:p,specularExponent:m}=r,b="";return b+=`<feSpecularLighting${s("in","SourceAlpha")}${s("surfaceScale",d)}${s("specularConstant",p)}${s("specularExponent",m)}${s("lighting-color",h)}${s("result",`${t}_specular`)}>`,b+=`<feSpotLight${s("x",n)}${s("y",i)}${s("z",a)}${s("pointsAtX",l)}${s("pointsAtY",o)}${s("pointsAtZ",u)}${s("limitingConeAngle",c)}/>`,b+="</feSpecularLighting>",b+=`<feComposite${s("in",`${t}_specular`)}${s("in2","SourceAlpha")}${s("operator","in")}${s("result",`${t}_clipped`)}/>`,b+=`<feComposite${s("in",`${t}_clipped`)}${s("in2",e)}${s("operator","arithmetic")}${s("k1",0)}${s("k2",1)}${s("k3",1)}${s("k4",0)}${s("result",t)}/>`,b}function Zr(r){switch(r.kind){case"point":return`<fePointLight${s("x",r.x)}${s("y",r.y)}${s("z",r.z)}/>`;case"spot":{let e=`<feSpotLight${s("x",r.x)}${s("y",r.y)}${s("z",r.z)}${s("pointsAtX",r.pointsAtX)}${s("pointsAtY",r.pointsAtY)}${s("pointsAtZ",r.pointsAtZ)}`;return r.limitingConeAngle!==void 0&&(e+=s("limitingConeAngle",r.limitingConeAngle)),r.specularExponent!==void 0&&(e+=s("specularExponent",r.specularExponent)),e+"/>"}case"distant":return`<feDistantLight${s("azimuth",r.azimuth)}${s("elevation",r.elevation)}/>`}}function _i(r,e,t){return`<feDiffuseLighting${s("in",e)}${s("surfaceScale",r.surfaceScale)}${s("diffuseConstant",r.diffuseConstant)}${s("lighting-color",r.color)}${s("result",t)}>`+Zr(r.lightSource)+"</feDiffuseLighting>"}function vi(r,e,t){return`<feSpecularLighting${s("in",e)}${s("surfaceScale",r.surfaceScale)}${s("specularConstant",r.specularConstant)}${s("specularExponent",r.specularExponent)}${s("lighting-color",r.color)}${s("result",t)}>`+Zr(r.lightSource)+"</feSpecularLighting>"}function wi(r,e,t){let{width:n,color:i,opacity:a,position:l}=r,o="";if(l==="inside")o+=`<feMorphology${s("in","SourceAlpha")}${s("operator","erode")}${s("radius",n)}${s("result",`${t}_eroded`)}/>`,o+=`<feComposite${s("in","SourceAlpha")}${s("in2",`${t}_eroded`)}${s("operator","out")}${s("result",`${t}_outlineAlpha`)}/>`,o+=`<feFlood${s("flood-color",i)}${s("flood-opacity",a)}${s("result",`${t}_color`)}/>`,o+=`<feComposite${s("in",`${t}_color`)}${s("in2",`${t}_outlineAlpha`)}${s("operator","in")}${s("result",`${t}_outline`)}/>`,o+=`<feComposite${s("in",`${t}_outline`)}${s("in2",e)}${s("operator","over")}${s("result",t)}/>`;else{let u=l==="outside"?n:n/2;o+=`<feMorphology${s("in","SourceAlpha")}${s("operator","dilate")}${s("radius",u)}${s("result",`${t}_dilated`)}/>`,o+=`<feComposite${s("in",`${t}_dilated`)}${s("in2","SourceAlpha")}${s("operator","out")}${s("result",`${t}_outlineAlpha`)}/>`,o+=`<feFlood${s("flood-color",i)}${s("flood-opacity",a)}${s("result",`${t}_color`)}/>`,o+=`<feComposite${s("in",`${t}_color`)}${s("in2",`${t}_outlineAlpha`)}${s("operator","in")}${s("result",`${t}_outline`)}/>`,o+=`<feMerge${s("result",t)}><feMergeNode${s("in",`${t}_outline`)}/><feMergeNode${s("in",e)}/></feMerge>`}return o}function Pi(r,e,t){let{amount:n}=r;if(n===0)return B(e,t);let i=1+4*n,a=-n,l=[0,a,0,a,i,a,0,a,0].join(" ");return`<feConvolveMatrix${s("in",e)}${s("order","3")}${s("kernelMatrix",l)}${s("divisor","1")}${s("bias","0")}${s("preserveAlpha","true")}${s("edgeMode","duplicate")}${s("result",t)}/>`}function Ti(r,e,t){let{blockSize:n}=r;if(n<=1)return B(e,t);let i=n/2,a="";return a+=`<feMorphology${s("in",e)}${s("operator","erode")}${s("radius",i)}${s("result",`${t}_eroded`)}/>`,a+=`<feMorphology${s("in",`${t}_eroded`)}${s("operator","dilate")}${s("radius",i)}${s("result",t)}/>`,a}function Fi(r,e,t){let{scale:n,frequency:i,octaves:a,warpType:l}=r;if(n===0)return B(e,t);let o="";return o+=`<feTurbulence${s("type",l)}${s("baseFrequency",i)}${s("numOctaves",a)}${s("seed",0)}${s("result",`${t}_turbulence`)}/>`,o+=`<feDisplacementMap${s("in",e)}${s("in2",`${t}_turbulence`)}${s("scale",n)}${s("xChannelSelector","R")}${s("yChannelSelector","G")}${s("result",t)}/>`,o}function Ri(r,e,t){let{operator:n,radiusX:i,radiusY:a}=r;return i===0&&a===0?B(e,t):`<feMorphology${s("in",e)}${s("operator",n)}${s("radius",`${i} ${a}`)}${s("result",t)}/>`}function Mi(r,e,t){let{levels:n}=r;if(n<2)return B(e,t);let i=[];for(let o=0;o<n;o++)i.push(o/(n-1));let a=i.join(" "),l=`<feComponentTransfer${s("in",e)}${s("result",t)}>`;return l+=`<feFuncR${s("type","discrete")}${s("tableValues",a)}/>`,l+=`<feFuncG${s("type","discrete")}${s("tableValues",a)}/>`,l+=`<feFuncB${s("type","discrete")}${s("tableValues",a)}/>`,l+="</feComponentTransfer>",l}function Ci(r,e,t){let{levels:n,contrast:i}=r;if(n<2)return B(e,t);let a=[];for(let u=0;u<n;u++){let c=u/(n-1),h=c;i!==1&&(h=.5+(c-.5)*i,h=Math.max(0,Math.min(1,h))),a.push(h)}let l=a.join(" "),o=`<feComponentTransfer${s("in",e)}${s("result",t)}>`;return o+=`<feFuncR${s("type","table")}${s("tableValues",l)}/>`,o+=`<feFuncG${s("type","table")}${s("tableValues",l)}/>`,o+=`<feFuncB${s("type","table")}${s("tableValues",l)}/>`,o+="</feComponentTransfer>",o}function Ai(r,e,t){let{radius:n}=r;if(n===0)return B(e,t);let i="";return i+=`<feGaussianBlur${s("in","SourceAlpha")}${s("stdDeviation",n)}${s("result",`${t}_blurredAlpha`)}/>`,i+=`<feComponentTransfer${s("in",`${t}_blurredAlpha`)}${s("result",`${t}_thresholdAlpha`)}><feFuncA${s("type","linear")}${s("slope",20)}${s("intercept",-9)}/></feComponentTransfer>`,i+=`<feComposite${s("in",e)}${s("in2",`${t}_thresholdAlpha`)}${s("operator","in")}${s("result",t)}/>`,i}function Ii(r,e,t){let{amount:n}=r;if(n===0)return B(e,t);let i=1-n;return`<feColorMatrix${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("type","saturate")}${s("values",i)}${s("result",t)}/>`}function Li(r,e,t){let{red:n,green:i,blue:a}=r;if(n===1&&i===1&&a===1)return B(e,t);let l=`<feComponentTransfer${s("in",e)}${s("result",t)}>`;return l+=`<feFuncR${s("type","linear")}${s("slope",n)}${s("intercept",0)}/>`,l+=`<feFuncG${s("type","linear")}${s("slope",i)}${s("intercept",0)}/>`,l+=`<feFuncB${s("type","linear")}${s("slope",a)}${s("intercept",0)}/>`,l+="</feComponentTransfer>",l}function Ei(r,e,t){let{amount:n}=r;if(n===1)return B(e,t);let i=`<feComponentTransfer${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("result",t)}>`;return i+=`<feFuncR${s("type","linear")}${s("slope",n)}${s("intercept",0)}/>`,i+=`<feFuncG${s("type","linear")}${s("slope",n)}${s("intercept",0)}/>`,i+=`<feFuncB${s("type","linear")}${s("slope",n)}${s("intercept",0)}/>`,i+="</feComponentTransfer>",i}function Bi(r,e,t){let{amount:n}=r;if(n===1)return B(e,t);let i=.5*(1-n),a=`<feComponentTransfer${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("result",t)}>`;return a+=`<feFuncR${s("type","linear")}${s("slope",n)}${s("intercept",i)}/>`,a+=`<feFuncG${s("type","linear")}${s("slope",n)}${s("intercept",i)}/>`,a+=`<feFuncB${s("type","linear")}${s("slope",n)}${s("intercept",i)}/>`,a+="</feComponentTransfer>",a}function Di(r,e,t){let{amount:n}=r;if(n===1)return B(e,t);let i=`<feComponentTransfer${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("result",t)}>`;return i+=`<feFuncA${s("type","linear")}${s("slope",n)}${s("intercept",0)}/>`,i+="</feComponentTransfer>",i}function Oi(r,e,t){let{amount:n}=r;if(n===0)return B(e,t);let i=n,a=1-n,l=`${i} ${a}`,o=`<feComponentTransfer${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("result",t)}>`;return o+=`<feFuncR${s("type","table")}${s("tableValues",l)}/>`,o+=`<feFuncG${s("type","table")}${s("tableValues",l)}/>`,o+=`<feFuncB${s("type","table")}${s("tableValues",l)}/>`,o+="</feComponentTransfer>",o}function Gi(r,e,t){let{angle:n}=r;return n===0||n===360?B(e,t):`<feColorMatrix${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("type","hueRotate")}${s("values",n)}${s("result",t)}/>`}function zi(r,e,t){let{amount:n}=r;return n===1?B(e,t):`<feColorMatrix${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("type","saturate")}${s("values",n)}${s("result",t)}/>`}function Ui(r,e,t){let{threshold:n}=r,i="";if(i+=`<feColorMatrix${s("in",e)}${s("type","saturate")}${s("values",0)}${s("result",`${t}_gray`)}/>`,n===.5)i+=`<feComponentTransfer${s("in",`${t}_gray`)}${s("result",t)}>`,i+=`<feFuncR${s("type","discrete")}${s("tableValues","0 1")}/>`,i+=`<feFuncG${s("type","discrete")}${s("tableValues","0 1")}/>`,i+=`<feFuncB${s("type","discrete")}${s("tableValues","0 1")}/>`,i+="</feComponentTransfer>";else{let l=[];for(let u=0;u<256;u++)l.push(u/255<n?0:1);let o=l.join(" ");i+=`<feComponentTransfer${s("in",`${t}_gray`)}${s("result",t)}>`,i+=`<feFuncR${s("type","table")}${s("tableValues",o)}/>`,i+=`<feFuncG${s("type","table")}${s("tableValues",o)}/>`,i+=`<feFuncB${s("type","table")}${s("tableValues",o)}/>`,i+="</feComponentTransfer>"}return i}function Vi(r,e,t){let{amount:n}=r;if(n===0)return B(e,t);let i=[.393,.769,.189,0,0],a=[.349,.686,.168,0,0],l=[.272,.534,.131,0,0],o=[1,0,0,0,0],u=[0,1,0,0,0],c=[0,0,1,0,0],h=(g,y)=>g.map((S,_)=>S*(1-n)+y[_]*n),d=h(o,i),p=h(u,a),m=h(c,l),b=[...d,...p,...m,0,0,0,1,0].join(" ");return`<feColorMatrix${s("color-interpolation-filters","sRGB")}${s("in",e)}${s("type","matrix")}${s("values",b)}${s("result",t)}/>`}function Ni(r,e,t){let{shadowColor:n,highlightColor:i}=r,a=tt(n),l=tt(i),o="";return o+=`<feColorMatrix${s("in",e)}${s("type","saturate")}${s("values",0)}${s("result",`${t}_gray`)}/>`,o+=`<feComponentTransfer${s("in",`${t}_gray`)}${s("result",t)}>`,o+=`<feFuncR${s("type","table")}${s("tableValues",`${a.r} ${l.r}`)}/>`,o+=`<feFuncG${s("type","table")}${s("tableValues",`${a.g} ${l.g}`)}/>`,o+=`<feFuncB${s("type","table")}${s("tableValues",`${a.b} ${l.b}`)}/>`,o+="</feComponentTransfer>",o}function Hi(r,e,t){let{intensity:n}=r;if(n===0)return B(e,t);let i="";i+=`<feComponentTransfer${s("in",e)}${s("result",`${t}_invert`)}>`,i+=`<feFuncR${s("type","table")}${s("tableValues","1 0")}/>`,i+=`<feFuncG${s("type","table")}${s("tableValues","1 0")}/>`,i+=`<feFuncB${s("type","table")}${s("tableValues","1 0")}/>`,i+="</feComponentTransfer>",i+=`<feColorMatrix${s("in",`${t}_invert`)}${s("type","saturate")}${s("values",0)}${s("result",`${t}_gray`)}/>`;let a=[.1,.1,.1,0,0],l=[.3,.4,.3,0,0],o=[.5,.5,.8,0,0],u=[1,0,0,0,0],c=[0,1,0,0,0],h=[0,0,1,0,0],d=(y,S)=>y.map((_,x)=>_*(1-n)+S[x]*n),p=d(u,a),m=d(c,l),b=d(h,o),g=[...p,...m,...b,0,0,0,1,0].join(" ");return i+=`<feColorMatrix${s("in",`${t}_gray`)}${s("type","matrix")}${s("values",g)}${s("result",t)}/>`,i}function Wi(r,e,t){let{amount:n,scale:i}=r;if(n===0)return B(e,t);let a=1/i,l="";return l+=`<feTurbulence${s("type","fractalNoise")}${s("baseFrequency",a)}${s("numOctaves",3)}${s("seed",0)}${s("result",`${t}_noise`)}/>`,l+=`<feColorMatrix${s("in",`${t}_noise`)}${s("type","saturate")}${s("values",0)}${s("result",`${t}_noiseGray`)}/>`,l+=`<feBlend${s("in",e)}${s("in2",`${t}_noiseGray`)}${s("mode","overlay")}${s("result",`${t}_blended`)}/>`,l+=`<feComposite${s("in",`${t}_blended`)}${s("in2",e)}${s("operator","arithmetic")}${s("k1",0)}${s("k2",n)}${s("k3",1-n)}${s("k4",0)}${s("result",`${t}_amt`)}/>`,l+=`<feComposite${s("in",`${t}_amt`)}${s("in2",e)}${s("operator","in")}${s("result",t)}/>`,l}function Xi(r,e,t){let{strength:n,angle:i}=r;if(n===0)return B(e,t);let a=i*Math.PI/180,l=Math.cos(a),o=Math.sin(a),u=n,c=[-(u*(l+o)),-(u*o),u*(-l+o),-(u*l),1,u*l,u*(l-o),u*o,u*(l+o)].join(" ");return`<feConvolveMatrix${s("in",e)}${s("order","3 3")}${s("kernelMatrix",c)}${s("divisor",1)}${s("bias",.5)}${s("preserveAlpha","true")}${s("result",t)}/>`}function ji(r,e,t){let{amount:n,size:i}=r;if(n===0)return B(e,t);let a=.5/i,l="";return l+=`<feTurbulence${s("type","fractalNoise")}${s("baseFrequency",`${a} ${a}`)}${s("numOctaves",5)}${s("seed",0)}${s("stitchTiles","stitch")}${s("result",`${t}_grain`)}/>`,l+=`<feColorMatrix${s("in",`${t}_grain`)}${s("type","saturate")}${s("values",0)}${s("result",`${t}_grainGray`)}/>`,l+=`<feBlend${s("in",e)}${s("in2",`${t}_grainGray`)}${s("mode","soft-light")}${s("result",`${t}_blended`)}/>`,l+=`<feComposite${s("in",`${t}_blended`)}${s("in2",e)}${s("operator","arithmetic")}${s("k1",0)}${s("k2",n)}${s("k3",1-n)}${s("k4",0)}${s("result",`${t}_amt`)}/>`,l+=`<feComposite${s("in",`${t}_amt`)}${s("in2",e)}${s("operator","in")}${s("result",t)}/>`,l}function Yi(r,e,t){let{wetness:n,turbulence:i}=r;if(n===0&&i===0)return B(e,t);let a="";return a+=`<feTurbulence${s("type","fractalNoise")}${s("baseFrequency",.02+i*.03)}${s("numOctaves",4)}${s("seed",42)}${s("result",`${t}_turb`)}/>`,a+=`<feDisplacementMap${s("in",e)}${s("in2",`${t}_turb`)}${s("scale",n*15)}${s("xChannelSelector","R")}${s("yChannelSelector","G")}${s("result",`${t}_disp`)}/>`,a+=`<feGaussianBlur${s("in",`${t}_disp`)}${s("stdDeviation",n*2)}${s("result",`${t}_blur`)}/>`,a+=`<feBlend${s("in",`${t}_blur`)}${s("in2",e)}${s("mode","multiply")}${s("result",t)}/>`,a}function qi(r,e,t){let{thickness:n,texture:i}=r;if(n===0&&i===0)return B(e,t);let a="";a+=`<feTurbulence${s("type","turbulence")}${s("baseFrequency",.03+i*.02)}${s("numOctaves",3)}${s("seed",1e3)}${s("result",`${t}_brush`)}/>`;let l=Math.max(3,8-Math.floor(n*5)),o=Array.from({length:l+1},(u,c)=>c/l).join(" ");a+=`<feComponentTransfer${s("in",e)}${s("result",`${t}_poster`)}>`;for(let u of["R","G","B"])a+=`<feFunc${u}${s("type","discrete")}${s("tableValues",o)}/>`;return a+="</feComponentTransfer>",a+=`<feDisplacementMap${s("in",`${t}_poster`)}${s("in2",`${t}_brush`)}${s("scale",i*4)}${s("xChannelSelector","R")}${s("yChannelSelector","G")}${s("result",`${t}_disp`)}/>`,a+=`<feMorphology${s("in",`${t}_disp`)}${s("operator","dilate")}${s("radius",n*.5)}${s("result",`${t}_thick`)}/>`,a+=`<feComposite${s("in",`${t}_thick`)}${s("in2",e)}${s("operator","in")}${s("result",t)}/>`,a}function Zi(r,e,t){let{spread:n,edges:i}=r;if(n===0&&i===0)return B(e,t);let a="";return a+=`<feTurbulence${s("type","fractalNoise")}${s("baseFrequency",.01+i*.02)}${s("numOctaves",5)}${s("seed",1100)}${s("result",`${t}_ink`)}/>`,a+=`<feMorphology${s("in",e)}${s("operator","dilate")}${s("radius",n*3)}${s("result",`${t}_dilate`)}/>`,a+=`<feDisplacementMap${s("in",`${t}_dilate`)}${s("in2",`${t}_ink`)}${s("scale",i*10)}${s("xChannelSelector","R")}${s("yChannelSelector","G")}${s("result",`${t}_disp`)}/>`,a+=`<feGaussianBlur${s("in",`${t}_disp`)}${s("stdDeviation",n*.5)}${s("result",t)}/>`,a}function Ki(r,e,t){let{wrinkles:n,shine:i}=r;if(n===0&&i===0)return B(e,t);let a="";return a+=`<feTurbulence${s("type","turbulence")}${s("baseFrequency",.02)}${s("numOctaves",4)}${s("seed",1200)}${s("result",`${t}_wrinkle`)}/>`,a+=`<feDisplacementMap${s("in",e)}${s("in2",`${t}_wrinkle`)}${s("scale",n*15)}${s("xChannelSelector","R")}${s("yChannelSelector","G")}${s("result",`${t}_disp`)}/>`,a+=`<feSpecularLighting${s("in",`${t}_wrinkle`)}${s("surfaceScale",n*2)}${s("specularConstant",i*1.5)}${s("specularExponent",20)}${s("result",`${t}_sheen`)}>`,a+=`<feDistantLight${s("azimuth",45)}${s("elevation",60)}/>`,a+="</feSpecularLighting>",a+=`<feBlend${s("in",`${t}_disp`)}${s("in2",`${t}_sheen`)}${s("mode","screen")}${s("result",`${t}_blend`)}/>`,a+=`<feComposite${s("in",`${t}_blend`)}${s("in2",e)}${s("operator","in")}${s("result",t)}/>`,a}function Qi(r,e,t){let{density:n,size:i}=r;if(n===0)return B(e,t);let a="",l=1-n;a+=`<feTurbulence${s("type","turbulence")}${s("baseFrequency",.1/i)}${s("numOctaves",1)}${s("seed",1400)}${s("result",`${t}_hole`)}/>`,a+=`<feComponentTransfer${s("in",`${t}_hole`)}${s("result",`${t}_thresh`)}>`;for(let o of["R","G","B","A"])a+=`<feFunc${o}${s("type","linear")}${s("slope",10)}${s("intercept",-l*10+5)}/>`;a+="</feComponentTransfer>",a+=`<feComponentTransfer${s("in",`${t}_thresh`)}${s("result",`${t}_clamp`)}>`;for(let o of["R","G","B","A"])a+=`<feFunc${o}${s("type","table")}${s("tableValues","0 0 1 1")}/>`;return a+="</feComponentTransfer>",a+=`<feComposite${s("in",e)}${s("in2",`${t}_clamp`)}${s("operator","in")}${s("result",t)}/>`,a}function Ji(r,e,t){let{color:n,radius:i,intensity:a}=r;if(a===0||i===0)return B(e,t);let{r:l,g:o,b:u}=tt(n),c="";return c+=`<feColorMatrix${s("in",e)}${s("type","matrix")}${s("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${s("result",`${t}_alpha`)}/>`,c+=`<feGaussianBlur${s("in",`${t}_alpha`)}${s("stdDeviation",i/2)}${s("result",`${t}_blur`)}/>`,c+=`<feColorMatrix${s("in",`${t}_blur`)}${s("type","matrix")}${s("values",`0 0 0 0 ${l} 0 0 0 0 ${o} 0 0 0 0 ${u} 0 0 0 ${a} 0`)}${s("result",`${t}_color`)}/>`,c+=`<feMerge${s("result",t)}><feMergeNode${s("in",`${t}_color`)}/><feMergeNode${s("in",e)}/></feMerge>`,c}function es(r,e,t){let{color:n,radius:i,intensity:a}=r;if(a===0||i===0)return B(e,t);let{r:l,g:o,b:u}=tt(n),c="";return c+=`<feColorMatrix${s("in",e)}${s("type","matrix")}${s("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${s("result",`${t}_alpha`)}/>`,c+=`<feMorphology${s("in",`${t}_alpha`)}${s("operator","erode")}${s("radius",i/4)}${s("result",`${t}_erode`)}/>`,c+=`<feComposite${s("in",`${t}_alpha`)}${s("in2",`${t}_erode`)}${s("operator","out")}${s("result",`${t}_edge`)}/>`,c+=`<feGaussianBlur${s("in",`${t}_edge`)}${s("stdDeviation",i/3)}${s("result",`${t}_blur`)}/>`,c+=`<feColorMatrix${s("in",`${t}_blur`)}${s("type","matrix")}${s("values",`0 0 0 0 ${l} 0 0 0 0 ${o} 0 0 0 0 ${u} 0 0 0 ${a*2} 0`)}${s("result",`${t}_color`)}/>`,c+=`<feComposite${s("in",`${t}_color`)}${s("in2",`${t}_alpha`)}${s("operator","in")}${s("result",`${t}_clipped`)}/>`,c+=`<feComposite${s("in",`${t}_clipped`)}${s("in2",e)}${s("operator","over")}${s("result",t)}/>`,c}function B(r,e){return`<feMerge${s("result",e)}><feMergeNode${s("in",r)}/></feMerge>`}function rt(r){switch(r.type){case"feBlend":return ts(r);case"feColorMatrix":return rs(r);case"feComponentTransfer":return ns(r);case"feComposite":return is(r);case"feConvolveMatrix":return ss(r);case"feDiffuseLighting":return as(r);case"feSpecularLighting":return os(r);case"feDisplacementMap":return ls(r);case"feDropShadow":return us(r);case"feFlood":return cs(r);case"feGaussianBlur":return ds(r);case"feImage":return hs(r);case"feMerge":return fs(r);case"feMorphology":return ps(r);case"feOffset":return ms(r);case"feTile":return gs(r);case"feTurbulence":return bs(r)}}function U(r){let e="";if(e+=s("in",r.in),e+=s("x",r.x),e+=s("y",r.y),e+=s("width",r.width),e+=s("height",r.height),e+=s("color-interpolation-filters",r.colorInterpolationFilters),e+=s("result",r.result),r.unknownAttrs){let t=Object.keys(r.unknownAttrs).sort();for(let n of t)e+=s(n,r.unknownAttrs[n])}return e}function V(r){return r.animations&&r.animations.length>0?r.animations.join(""):""}function ts(r){let e=`<feBlend${U(r)}${s("in2",r.in2)}${s("mode",r.mode)}`;r.noComposite&&(e+=' no-composite="no-composite"');let t=V(r);return t?`${e}>${t}</feBlend>`:`${e}/>`}function rs(r){let e=`<feColorMatrix${U(r)}${s("type",r.matrixType)}${s("values",r.values)}`,t=V(r);return t?`${e}>${t}</feColorMatrix>`:`${e}/>`}function et(r,e){if(!e)return"";let t=`feFunc${r}`;switch(e.type){case"identity":return`<${t} type="identity"/>`;case"table":case"discrete":return`<${t} type="${e.type}"${s("tableValues",e.tableValues.join(" "))}/>`;case"linear":return`<${t} type="linear"${s("slope",e.slope)}${s("intercept",e.intercept)}/>`;case"gamma":return`<${t} type="gamma"${s("amplitude",e.amplitude)}${s("exponent",e.exponent)}${s("offset",e.offset)}/>`}}function ns(r){let e="";return e+=et("R",r.funcR),e+=et("G",r.funcG),e+=et("B",r.funcB),e+=et("A",r.funcA),e+=V(r),`<feComponentTransfer${U(r)}>${e}</feComponentTransfer>`}function is(r){let e=`<feComposite${U(r)}${s("in2",r.in2)}${s("operator",r.operator)}`;r.operator==="arithmetic"&&(e+=s("k1",r.k1),e+=s("k2",r.k2),e+=s("k3",r.k3),e+=s("k4",r.k4));let t=V(r);return t?`${e}>${t}</feComposite>`:`${e}/>`}function ss(r){let e=`<feConvolveMatrix${U(r)}`;e+=s("order",r.order),e+=s("kernelMatrix",r.kernelMatrix),e+=s("divisor",r.divisor),e+=s("bias",r.bias),e+=s("targetX",r.targetX),e+=s("targetY",r.targetY),e+=s("edgeMode",r.edgeMode),e+=s("kernelUnitLength",r.kernelUnitLength),r.preserveAlpha!==void 0&&(e+=s("preserveAlpha",r.preserveAlpha?"true":"false"));let t=V(r);return t?`${e}>${t}</feConvolveMatrix>`:`${e}/>`}function Kr(r){switch(r.kind){case"feDistantLight":return`<feDistantLight${s("azimuth",r.azimuth)}${s("elevation",r.elevation)}/>`;case"fePointLight":return`<fePointLight${s("x",r.x)}${s("y",r.y)}${s("z",r.z)}/>`;case"feSpotLight":{let e=`<feSpotLight${s("x",r.x)}${s("y",r.y)}${s("z",r.z)}${s("pointsAtX",r.pointsAtX)}${s("pointsAtY",r.pointsAtY)}${s("pointsAtZ",r.pointsAtZ)}`;return e+=s("specularExponent",r.specularExponent),e+=s("limitingConeAngle",r.limitingConeAngle),e+"/>"}}}function as(r){let e=`<feDiffuseLighting${U(r)}`;e+=s("surfaceScale",r.surfaceScale),e+=s("diffuseConstant",r.diffuseConstant),e+=s("kernelUnitLength",r.kernelUnitLength),e+=s("lighting-color",r.lightingColor);let t="";return r.lightSource&&(t+=Kr(r.lightSource)),t+=V(r),`${e}>${t}</feDiffuseLighting>`}function os(r){let e=`<feSpecularLighting${U(r)}`;e+=s("surfaceScale",r.surfaceScale),e+=s("specularConstant",r.specularConstant),e+=s("specularExponent",r.specularExponent),e+=s("kernelUnitLength",r.kernelUnitLength),e+=s("lighting-color",r.lightingColor);let t="";return r.lightSource&&(t+=Kr(r.lightSource)),t+=V(r),`${e}>${t}</feSpecularLighting>`}function ls(r){let e=`<feDisplacementMap${U(r)}`;e+=s("in2",r.in2),e+=s("scale",r.scale),e+=s("xChannelSelector",r.xChannelSelector),e+=s("yChannelSelector",r.yChannelSelector);let t=V(r);return t?`${e}>${t}</feDisplacementMap>`:`${e}/>`}function us(r){let e=`<feDropShadow${U(r)}`;e+=s("dx",r.dx),e+=s("dy",r.dy),e+=s("stdDeviation",r.stdDeviation),e+=s("flood-color",r.floodColor),e+=s("flood-opacity",r.floodOpacity);let t=V(r);return t?`${e}>${t}</feDropShadow>`:`${e}/>`}function cs(r){let e=`<feFlood${U(r)}${s("flood-color",r.floodColor)}${s("flood-opacity",r.floodOpacity)}`,t=V(r);return t?`${e}>${t}</feFlood>`:`${e}/>`}function ds(r){let e=`<feGaussianBlur${U(r)}${s("stdDeviation",r.stdDeviation)}${s("edgeMode",r.edgeMode)}`,t=V(r);return t?`${e}>${t}</feGaussianBlur>`:`${e}/>`}function hs(r){let e=`<feImage${U(r)}`;r.href!==void 0?e+=s("href",r.href):r.xlinkHref!==void 0&&(e+=s("xlink:href",r.xlinkHref)),e+=s("preserveAspectRatio",r.preserveAspectRatio),e+=s("crossorigin",r.crossorigin);let t=V(r);return t?`${e}>${t}</feImage>`:`${e}/>`}function fs(r){let e="";for(let t of r.nodes)e+=`<feMergeNode${s("in",t.in)}/>`;return e+=V(r),`<feMerge${U(r)}>${e}</feMerge>`}function ps(r){let e=`<feMorphology${U(r)}${s("operator",r.operator)}${s("radius",r.radius)}`,t=V(r);return t?`${e}>${t}</feMorphology>`:`${e}/>`}function ms(r){let e=`<feOffset${U(r)}${s("dx",r.dx)}${s("dy",r.dy)}`,t=V(r);return t?`${e}>${t}</feOffset>`:`${e}/>`}function gs(r){let e=`<feTile${U(r)}`,t=V(r);return t?`${e}>${t}</feTile>`:`${e}/>`}function bs(r){let e=`<feTurbulence${U(r)}`;e+=s("baseFrequency",r.baseFrequency),e+=s("numOctaves",r.numOctaves),e+=s("seed",r.seed),e+=s("stitchTiles",r.stitchTiles),e+=s("type",r.turbulenceType);let t=V(r);return t?`${e}>${t}</feTurbulence>`:`${e}/>`}function sr(r,e){let t=`<filter${s("id",r)}`;t+=s("x",e.x),t+=s("y",e.y),t+=s("width",e.width),t+=s("height",e.height),t+=s("filterUnits",e.filterUnits),t+=s("primitiveUnits",e.primitiveUnits),e.filterColorInterpolation&&e.filterColorInterpolation!=="auto"&&(t+=s("color-interpolation-filters",e.filterColorInterpolation)),t+=s("flood-color",e.floodColor),t+=s("flood-opacity",e.floodOpacity),t+=s("lighting-color",e.lightingColor),t+=">",e.filterTitle&&(t+=`<title>${O(e.filterTitle)}</title>`),e.filterDescription&&(t+=`<desc>${O(e.filterDescription)}</desc>`);for(let n of e.primitives)t+=rt(n);if(e.filterAnimations)for(let n of e.filterAnimations)t+=n;return t+="</filter>",t}function ar(r,e,t,n){switch(r.type){case"drop-shadow":return $i(r,e,t);case"inner-shadow":return xi(r,e,t);case"gaussian-blur":return Si(r,e,t);case"motion-blur":return ki(r,e,t);case"point-light":{let i=r;return Yr(n?{...i,x:i.x+n.x,y:i.y+n.y}:i,e,t)}case"spot-light":{let i=r;return qr(n?{...i,x:i.x+n.x,y:i.y+n.y,pointsAtX:i.pointsAtX+n.x,pointsAtY:i.pointsAtY+n.y}:i,e,t)}case"diffuse-lighting":return _i(r,e,t);case"specular-lighting":return vi(r,e,t);case"outline":return wi(r,e,t);case"sharpen":return Pi(r,e,t);case"pixelate":return Ti(r,e,t);case"warp":return Fi(r,e,t);case"morphology":return Ri(r,e,t);case"contouring-discrete":return Mi(r,e,t);case"contouring-table":return Ci(r,e,t);case"round-edges":return Ai(r,e,t);case"grayscale":return Ii(r,e,t);case"channel-painter":return Li(r,e,t);case"brightness":return Ei(r,e,t);case"contrast":return Bi(r,e,t);case"opacity":return Di(r,e,t);case"invert":return Oi(r,e,t);case"hue-rotate":return Gi(r,e,t);case"saturate":return zi(r,e,t);case"black-and-white":return Ui(r,e,t);case"sepia":return Vi(r,e,t);case"duotone":return Ni(r,e,t);case"xray":return Hi(r,e,t);case"noise":return Wi(r,e,t);case"emboss":return Xi(r,e,t);case"film-grain":return ji(r,e,t);case"watercolor":return Yi(r,e,t);case"gouache":return qi(r,e,t);case"ink-blot":return Zi(r,e,t);case"crumpled-plastic":return Ki(r,e,t);case"riddled":return Qi(r,e,t);case"glow":return Ji(r,e,t);case"inner-glow":return es(r,e,t);case"raw-svg":return r.svgContent;case"svg-primitive-chain":return r.primitives.map(rt).join("");default:return B(e,t)}}function ys(r){return r.some(e=>e.type==="gaussian-blur"||e.type==="motion-blur"||e.type==="drop-shadow"||e.type==="inner-shadow"||e.type==="glow"||e.type==="inner-glow"||e.type==="outline"||e.type==="morphology"||e.type==="warp"||e.type==="svg-primitive-chain"&&e.primitives.some(t=>t.type==="feGaussianBlur"||t.type==="feDropShadow"||t.type==="feOffset"||t.type==="feMorphology"||t.type==="feDisplacementMap"||t.type==="feTurbulence"))}function or(r,e,t={}){let n=e.filter(k=>k.enabled);if(n.length===0)return"";let i=t.colorInterpolation&&t.colorInterpolation!=="auto"?s("color-interpolation-filters",t.colorInterpolation):"",a=n.find(k=>k.type==="raw-svg");if(a){let k=t.colorInterpolation&&t.colorInterpolation!=="auto"?t.colorInterpolation:a.colorInterpolationFilters,P=t.filterUnits??a.filterUnits,v=t.primitiveUnits??a.primitiveUnits,$=t.x??a.x,w=t.y??a.y,R=t.width??a.width,I=t.height??a.height;return`<filter${s("id",r)}${s("x",$)}${s("y",w)}${s("width",R)}${s("height",I)}${s("filterUnits",P)}${s("primitiveUnits",v)}${s("color-interpolation-filters",k)}${s("flood-color",a.floodColor)}${s("flood-opacity",a.floodOpacity)}${s("lighting-color",a.lightingColor)}>${a.svgContent}</filter>`}let l=n.find(k=>k.type==="svg-primitive-chain");if(l){let k={...l,x:t.x??l.x,y:t.y??l.y,width:t.width??l.width,height:t.height??l.height,filterUnits:t.filterUnits??l.filterUnits,primitiveUnits:t.primitiveUnits??l.primitiveUnits,filterColorInterpolation:t.colorInterpolation&&t.colorInterpolation!=="auto"?t.colorInterpolation:l.filterColorInterpolation};return sr(r,k)}let o=n.some(k=>k.type==="gaussian-blur"&&k.quality==="high"||k.type==="motion-blur"&&k.quality==="high"),u=ys(n),c=u?o?"-200%":"-100%":"-10%",h=u?o?"500%":"300%":"120%",d="",p="SourceGraphic",m=0;for(let k of n){let P=`result${m++}`;d+=ar(k,p,P),p=P}let b=t.filterUnits??"objectBoundingBox",g=t.primitiveUnits??"userSpaceOnUse",y=t.x??c,S=t.y??c,_=t.width??h,x=t.height??h;return`<filter${s("id",r)}${s("x",y)}${s("y",S)}${s("width",_)}${s("height",x)}${s("filterUnits",b)}${s("primitiveUnits",g)}${i}>${d}</filter>`}function Qr(r){let e="",t=new Set;for(let n of r){let i=n.state.filters;if(!i||i.length===0)continue;let a=i.filter(c=>c.enabled);if(a.length===0)continue;let l=n.state.filterLibraryIds,o=Array.isArray(l)&&l.length>0?l[0]:`filter-${n.id}`;if(t.has(o))continue;t.add(o);let u=n.state;e+=or(o,a,{colorInterpolation:u.filterColorInterpolation,filterUnits:u.filterUnits,primitiveUnits:u.primitiveUnits,x:u.filterX,y:u.filterY,width:u.filterWidth,height:u.filterHeight})}return e}function nt(r,e,t){return!e||e.length===0||e.filter(i=>i.enabled).length===0?"":Array.isArray(t)&&t.length>0?` filter="${t.map(a=>`url(#${O(a)})`).join(" ")}"`:` filter="url(#filter-${O(r)})"`}function xe(r,e,t,n){let i=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/10);switch(r){case"stripes":return[{tag:"rect",attrs:{width:n?.strokeWidth!=null?Math.max(.01,Math.min(1,n.strokeWidth))*e:e/2,height:e,fill:t}}];case"dots":{let a=n?.dotRadius!=null?Math.max(.05,Math.min(.45,n.dotRadius)):.25;return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e*a,fill:t}}]}case"grid":return[{tag:"path",attrs:{d:`M ${e} 0 L 0 0 0 ${e}`,fill:"none",stroke:t,"stroke-width":i}}];case"checkerboard":return[{tag:"rect",attrs:{width:e/2,height:e/2,fill:t}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e/2,height:e/2,fill:t}}];case"diagonal":{let a=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/5);return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0`,stroke:t,"stroke-width":a}}]}case"crosshatch":return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0 M 0 0 L ${e} ${e}`,stroke:t,"stroke-width":i}}];case"zigzag":{let a=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,l=e*a;return[{tag:"path",attrs:{d:`M 0 ${l} L ${e/4} 0 L ${e/2} ${l} L ${e*3/4} 0 L ${e} ${l}`,fill:"none",stroke:t,"stroke-width":i}}]}case"waves":{let a=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,l=e*a,o=e/2;return[{tag:"path",attrs:{d:`M 0 ${o} Q ${e/4} ${o-l} ${e/2} ${o} T ${e} ${o}`,fill:"none",stroke:t,"stroke-width":i}}]}case"triangles":{let a=e*.866;return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${a} L 0 ${a} Z`,fill:"none",stroke:t,"stroke-width":i}}]}case"hexagons":{let a=e*.866;return[{tag:"path",attrs:{d:`M ${e*.25} 0 L ${e*.75} 0 L ${e} ${a*.5} L ${e*.75} ${a} L ${e*.25} ${a} L 0 ${a*.5} Z`,fill:"none",stroke:t,"stroke-width":i}}]}case"diamonds":return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${e/2} L ${e/2} ${e} L 0 ${e/2} Z`,fill:"none",stroke:t,"stroke-width":i}}];case"circles":return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e/3,fill:"none",stroke:t,"stroke-width":i}}];case"bricks":{let a=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/15);return[{tag:"rect",attrs:{x:0,y:0,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":a}},{tag:"rect",attrs:{x:-e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":a}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":a}}]}case"herringbone":return[{tag:"path",attrs:{d:`M 0 0 L ${e/2} ${e/2} L 0 ${e} M ${e/2} ${e/2} L ${e} 0 M ${e/2} ${e/2} L ${e} ${e}`,fill:"none",stroke:t,"stroke-width":i}}];default:return[]}}function $s(r){let e=Object.entries(r.attrs).map(([t,n])=>` ${t}="${n}"`).join("");return`<${r.tag}${e}/>`}function it(r,e,t,n,i){let a=10*e,l="";l+=`<rect width="${a}" height="${a}" fill="${n}"/>`;let o=xe(r,a,t,i);for(let u of o)l+=$s(u);return{svgContent:l,width:a,height:a}}var Se="0 0 10 10",st=6,at=6;function le(){return[{id:"line-marker-arrow",refX:10,refY:5,element:{tag:"path",attrs:{d:"M 0 0 L 10 5 L 0 10 Z",fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-open-arrow",refX:10,refY:5,element:{tag:"path",attrs:{d:"M 0 0 L 10 5 L 0 10",fill:"none",stroke:"context-stroke","stroke-width":1.5,"stroke-linejoin":"round","stroke-linecap":"round"}}},{id:"line-marker-circle",refX:5,refY:5,element:{tag:"circle",attrs:{cx:5,cy:5,r:3.2,fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-diamond",refX:5,refY:5,element:{tag:"path",attrs:{d:"M 5 0 L 10 5 L 5 10 L 0 5 Z",fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-square",refX:5,refY:5,element:{tag:"rect",attrs:{x:1.5,y:1.5,width:7,height:7,fill:"context-stroke",stroke:"context-stroke"}}}]}var lr={"line-marker-arrow":"mkr-builtin-arrow","line-marker-open-arrow":"mkr-builtin-open-arrow","line-marker-circle":"mkr-builtin-circle","line-marker-diamond":"mkr-builtin-diamond","line-marker-square":"mkr-builtin-square"},xs={"mkr-builtin-arrow":"Arrow","mkr-builtin-open-arrow":"Open Arrow","mkr-builtin-circle":"Circle","mkr-builtin-diamond":"Diamond","mkr-builtin-square":"Square"};function Jr(){return le().map(r=>{let e=lr[r.id]??r.id;return{kind:"marker",id:e,name:xs[e]??e,viewBox:Se,refX:r.refX,refY:r.refY,markerWidth:6,markerHeight:6,markerUnits:"strokeWidth",orient:"auto-start-reverse",shapes:[],builtIn:!0}})}function f(r,e){return e==null||e===""?"":` ${r}="${O(String(e))}"`}var Ss=[["fontVariant","font-variant"],["fontVariantLigatures","font-variant-ligatures"],["fontVariantPosition","font-variant-position"],["fontVariantCaps","font-variant-caps"],["fontVariantNumeric","font-variant-numeric"],["fontVariantEastAsian","font-variant-east-asian"]];function ur(r){return Ss.map(([e,t])=>{let n=typeof r[e]=="string"?String(r[e]).trim():"";return n?`${t}: ${n}`:""}).filter(Boolean).join("; ")}function rn(r){let e=r.map(t=>(t??"").trim().replace(/;$/,"")).filter(Boolean).join("; ");return e?f("style",e):""}function ks(r){if(r&&typeof r=="object"){let e=r;return"dx"in e?{x:typeof e.x=="number"?e.x:null,y:typeof e.y=="number"?e.y:null,dx:typeof e.dx=="number"?e.dx:0,dy:typeof e.dy=="number"?e.dy:0,rotate:typeof e.rotate=="number"?e.rotate:0}:{x:null,y:null,dx:typeof e.x=="number"?e.x:0,dy:typeof e.y=="number"?e.y:0,rotate:typeof e.rotate=="number"?e.rotate:0}}return{x:null,y:null,dx:0,dy:0,rotate:0}}function en(r,e){let t=-1;for(let i=r.length-1;i>=0;i--)if(r[i][e]!==null){t=i;break}if(t<0)return[];let n=new Array(t+1);for(let i=0;i<=t;i++)n[i]=r[i][e]??0;return n}function tn(r,e){let t=-1;for(let i=r.length-1;i>=0;i--)if(r[i][e]!==0){t=i;break}if(t<0)return[];let n=new Array(t+1);for(let i=0;i<=t;i++)n[i]=r[i][e];return n}function _s(r){if(r.length===0)return[];let e=r.length-1,t=r[e].rotate;for(;e>0&&r[e-1].rotate===t;)e--;if(e===0&&t===0)return[];let n=new Array(e+1);for(let i=0;i<=e;i++)n[i]=r[i].rotate;return n}function nn(r){let e=r.ancestorTransform;return!e||e.length<6?null:`matrix(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]})`}function ie(r,e){let t=nn(r),n=r.rawTransform;if(n)return t?`${t} ${n}`:n;let i=r.rotation??0,a=r.skewX??0,l=r.skewY??0,o=r.scaleX??1,u=r.scaleY??1,c=r.translateX??0,h=r.translateY??0,d=c!==0||h!==0;if(!d&&i===0&&a===0&&l===0&&o===1&&u===1)return t;let p=r.customPivot??e;if(!p&&!d)return t;let m=[];return t&&m.push(t),d&&m.push(`translate(${c}, ${h})`),p&&(i!==0||a!==0||l!==0||o!==1||u!==1)&&(m.push(`translate(${p.x}, ${p.y})`),i!==0&&m.push(`rotate(${i})`),(o!==1||u!==1)&&m.push(`scale(${o}, ${u})`),a!==0&&m.push(`skewX(${a})`),l!==0&&m.push(`skewY(${l})`),m.push(`translate(${-p.x}, ${-p.y})`)),m.join(" ")}function vs(r,e,t){let n=nn(r),i=r.rotation??0,a=r.skewX??0,l=r.skewY??0,o=r.scaleX??1,u=r.scaleY??1,c=r.translateX??0,h=r.translateY??0,d=r.customPivot??{x:e,y:t},p=[];return n&&p.push(n),(c!==0||h!==0)&&p.push(`translate(${c}, ${h})`),(i!==0||a!==0||l!==0||o!==1||u!==1)&&(p.push(`translate(${d.x}, ${d.y})`),i!==0&&p.push(`rotate(${i})`),(o!==1||u!==1)&&p.push(`scale(${o}, ${u})`),a!==0&&p.push(`skewX(${a})`),l!==0&&p.push(`skewY(${l})`),p.push(`translate(${-d.x}, ${-d.y})`)),p.push(`translate(${e}, ${t})`),p.join(" ")}function ws(r){if(typeof r=="string"){let n=r.trim();return n.length>0?n:void 0}if(!r||typeof r!="object")return;let e=r,t=[];return e.underline&&t.push("underline"),e.strikethrough&&t.push("line-through"),e.overline&&t.push("overline"),t.length>0?t.join(" "):void 0}function Ps(r){if(typeof r.strokeDasharray=="string")return r.strokeDasharray;let e=r.lineStyle??"solid",t=r.dashLength??8,n=r.gapLength??4;return he(e,t,n)}function Ts(r){let e=r.fillType;return e||(r.fillGradient?r.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":r.linearGradient?"linear-gradient":r.radialGradient?"radial-gradient":"solid")}function Fs(r){return r.fillGradient??r.linearGradient??r.radialGradient??void 0}function te(r,e){let t=f("data-shape-id",e),n=Ts(r),i=Fs(r);if(n==="none")t+=f("fill","none");else if(n==="linear-gradient"||n==="radial-gradient"){let w=r.fillLibraryId??i?.id;t+=f("fill",`url(#${w??`gradient-fill-${e}`})`)}else if(n==="pattern"){let w=r.fillLibraryId??i?.id;t+=f("fill",`url(#${w??`pattern-fill-${e}`})`)}else t+=f("fill",r.fillColor??"#000000");let a=r.opacity;a!==void 0&&a<1&&(t+=f("opacity",a));let l=r.fillOpacity;l!==void 0&&l<1&&(t+=f("fill-opacity",l));let o=r.fillRule;o&&o!=="nonzero"&&(t+=f("fill-rule",o));let u=r.strokeType??"solid",c=r.strokeGradient;if(u==="none")t+=f("stroke","none");else if(u==="linear-gradient"||u==="radial-gradient"){let w=r.strokeLibraryId??c?.id;t+=f("stroke",`url(#${w??`gradient-stroke-${e}`})`)}else if(u==="pattern"){let w=r.strokeLibraryId??c?.id;t+=f("stroke",`url(#${w??`pattern-stroke-${e}`})`)}else t+=f("stroke",r.borderColor??"none");let h=r.borderWidth;h!=null&&(t+=f("stroke-width",h));let d=r.strokeOpacity;d!==void 0&&d<1&&(t+=f("stroke-opacity",d));let p=r.paintOrder;p&&p!=="normal"&&(t+=f("paint-order",p));let m=r.markerStart,b=r.markerMid,g=r.markerEnd;m&&(t+=f("marker-start",`url(#${m})`)),b&&(t+=f("marker-mid",`url(#${b})`)),g&&(t+=f("marker-end",`url(#${g})`));let y=Ps(r);y&&(t+=f("stroke-dasharray",y),!r.strokeDasharray&&r.lineStyle==="dotted"&&(t+=f("stroke-linecap","round")));let S=r.dashOffset;S!==void 0&&S!==0&&(t+=f("stroke-dashoffset",S));let _=r.shapeRendering;_&&_!=="auto"&&(t+=f("shape-rendering",_)),t+=nt(e,r.filters,r.filterLibraryIds);let x=r.systemLanguage;x&&(t+=f("systemLanguage",x));let k=r.requiredExtensions;k&&(t+=f("requiredExtensions",k));let P=r.vectorEffect;P&&P!=="none"&&(t+=f("vector-effect",P));let v=r.visibility;v&&v!=="visible"&&(t+=f("visibility",v));let $=r.metadata;return $&&($.role&&(t+=f("role",$.role)),$.ariaLabel&&(t+=f("aria-label",$.ariaLabel))),t}function Rs(r){let e=r.metadata;if(!e)return"";let t="";return e.title&&(t+=`<title>${O(e.title)}</title>`),e.description&&(t+=`<desc>${O(e.description)}</desc>`),t}function Ms(r,e){let t=Rs(e);if(!t)return r;let n=r.lastIndexOf("/>");if(n===-1){let l=r.indexOf(">");return l===-1?r:r.slice(0,l+1)+t+r.slice(l+1)}let i=r.match(/^<(\w+)/),a=i?i[1]:"g";return r.slice(0,n)+">"+t+`</${a}>`}function cr(r){let e="",t=r.startEndpoint,n=r.endEndpoint;return t&&t!=="none"&&(e+=f("marker-start",`url(#line-marker-${t})`)),n&&n!=="none"&&(e+=f("marker-end",`url(#line-marker-${n})`)),e}function dr(r){let e=r.state,t=e.x??0,n=e.y??0,i=e.radius??50,a=ie(e,{x:t,y:n});return`<circle${f("cx",t)}${f("cy",n)}${f("r",i)}${te(e,r.id)}${a?f("transform",a):""}/>`}function hr(r){let e=r.state,t=e.cx??0,n=e.cy??0,i=e.rx??50,a=e.ry??30,l=e.pathLength,o=ie(e,{x:t,y:n});return`<ellipse${f("cx",t)}${f("cy",n)}${f("rx",i)}${f("ry",a)}${l!==void 0?f("pathLength",l):""}${te(e,r.id)}${o?f("transform",o):""}/>`}function fr(r){let e=r.state,t=e,n=e.x??0,i=e.y??0,a=e.width??100,l=e.height??100,o=e.cornerRadius??0,u=e.rx??o,c=e.ry??o,h=t.cornerShape??"round",d=t.cornerMode??"uniform",p={x:n+a/2,y:i+l/2},m=ie(e,p);if(h!=="round"||d==="non-uniform"){let b=Qe(n,i,a,l,o,h,d,d==="non-uniform"?{radiusTL:t.cornerRadiusTL,radiusTR:t.cornerRadiusTR,radiusBR:t.cornerRadiusBR,radiusBL:t.cornerRadiusBL,shapeTL:t.cornerShapeTL,shapeTR:t.cornerShapeTR,shapeBR:t.cornerShapeBR,shapeBL:t.cornerShapeBL}:void 0);if(b)return`<path${f("d",b)}${te(e,r.id)}${m?f("transform",m):""}/>`}return`<rect${f("x",n)}${f("y",i)}${f("width",a)}${f("height",l)}${u>0||c>0?`${f("rx",u)}${f("ry",c)}`:""}${te(e,r.id)}${m?f("transform",m):""}/>`}function pr(r){let e=r.state,t=e.x1??0,n=e.y1??0,i=e.x2??0,a=e.y2??0,l={x:(t+i)/2,y:(n+a)/2},o=ie(e,l),u={...e,fillType:"none"};return`<line${f("x1",t)}${f("y1",n)}${f("x2",i)}${f("y2",a)}${te(u,r.id)}${cr(e)}${o?f("transform",o):""}/>`}function mr(r){let e=r.state,t=e.x??0,n=e.y??0,i=e.text??"",a=e.fontSize??16,l=e.fontFamily??"sans-serif",o=e.fontWeight??"normal",u=e.fontStyle??"normal",c=e.textAnchor??"start",h=ws(e.textDecoration),d=e.letterSpacing,m=ie(e,{x:t,y:n}),b=f("x",t)+f("y",n);b+=f("font-size",a),b+=f("font-family",l),o!=="normal"&&(b+=f("font-weight",o)),u!=="normal"&&(b+=f("font-style",u)),c!=="start"&&(b+=f("text-anchor",c)),h&&(b+=f("text-decoration",h)),d&&(b+=f("letter-spacing",d));let g=e.textLength;g!==void 0&&g>0&&(b+=f("textLength",g),e.lengthAdjust==="spacingAndGlyphs"&&(b+=f("lengthAdjust","spacingAndGlyphs")));let y=e.textDirection;y&&y!=="ltr"&&(b+=f("direction",y));let S=e.unicodeBidi;S&&S!=="normal"&&(b+=f("unicode-bidi",S));let _=ur(e),x=e.fontVariationSettings,k="";if(x&&Object.keys(x).length>0&&(k=`font-variation-settings: ${Object.entries(x).map(([$,w])=>`'${$}' ${w}`).join(", ")}`),b+=rn([_,k]),b+=te(e,r.id),m&&(b+=f("transform",m)),e.isTextPath&&e.textPathPoints){let v=e.textPathPoints,$=e.textPathStartOffset??0,w=e.textPathSide,R=`text-path-${r.id}`,I="";if(v.length>=2)if(w==="right"){let C=v[v.length-1];I=`M ${C.x} ${C.y}`;for(let A=v.length-1;A>0;A--){let L=v[A],E=v[A-1],D=L.handleIn??L,F=E.handleOut??E;I+=` C ${D.x} ${D.y}, ${F.x} ${F.y}, ${E.x} ${E.y}`}}else{I=`M ${v[0].x} ${v[0].y}`;for(let C=0;C<v.length-1;C++){let A=v[C],L=v[C+1],E=A.handleOut??A,D=L.handleIn??L;I+=` C ${E.x} ${E.y}, ${D.x} ${D.y}, ${L.x} ${L.y}`}}return`<defs><path id="${O(R)}"${f("d",I)} fill="none"/></defs><text${b}><textPath href="#${O(R)}"${f("startOffset",`${$}%`)}>${O(i)}</textPath></text>`}if(e.charOffsets&&Array.isArray(e.charOffsets)&&e.charOffsets.length>0){let v=e.charOffsets.map(ks),$=i.split(`
7
+ `),w=e.linePositions??[],R=a*1.25,I="",C=0;return $.forEach((A,L)=>{let E=Array.from(A).length,D=v.slice(C,C+E),F=w[L],G=F?t+F.x:L>0?t:NaN,Y=F?F.dy:L>0?R:NaN,H="",ae=en(D,"x");if(Number.isFinite(G)||ae.length>0){let qt=ae.length>0?ae.slice():[];Number.isFinite(G)&&(qt[0]=qt[0]??G),H+=f("x",qt.join(" "))}let Q=en(D,"y");Q.length>0&&(H+=f("y",Q.join(" ")));let j=tn(D,"dx");j.length>0&&(H+=f("dx",j.join(" ")));let Te=tn(D,"dy"),q=Te.length>0||Number.isFinite(Y)?Te.slice():[];for(Number.isFinite(Y)&&(q[0]=(q[0]??0)+Y);q.length>0&&q[q.length-1]===0;)q.pop();q.length>0&&(H+=f("dy",q.join(" ")));let Or=_s(D);Or.length>0&&(H+=f("rotate",Or.join(" "))),I+=`<tspan${H}>${O(A)}</tspan>`,C+=E+1}),`<text${b}>${I}</text>`}if(e.richTextData&&typeof e.richTextData=="object"){let v=e.richTextData;if(Array.isArray(v.lines)&&v.lines.length>0){let $=e.linePositions,w=typeof v.lineHeight=="number"?v.lineHeight:1.2,R=a*w,I=v.baseStyle??{},C="";return v.lines.forEach((A,L)=>{A.segments.forEach((E,D)=>{let F="";if(D===0){let G=$?.[L];G?((Math.abs(G.x)>.001||L>0)&&(F+=f("x",t+G.x)),(Math.abs(G.dy)>.001||L>0)&&(F+=f("dy",G.dy))):L>0&&(F+=f("x",t),F+=f("dy",`${R}px`))}F+=Cs(E.style??{},I),F+=' xml:space="preserve"',C+=`<tspan${F}>${O(E.text)}</tspan>`})}),`<text${b}>${C}</text>`}}return`<text${b}>${O(i)}</text>`}function Cs(r,e){let t="";r.fontFamily!==void 0&&r.fontFamily!==e.fontFamily&&(t+=f("font-family",String(r.fontFamily))),r.fontSize!==void 0&&r.fontSize!==e.fontSize&&(t+=f("font-size",String(r.fontSize))),r.fontWeight!==void 0&&r.fontWeight!==e.fontWeight&&(t+=f("font-weight",String(r.fontWeight))),r.fontStyle!==void 0&&r.fontStyle!==e.fontStyle&&(t+=f("font-style",String(r.fontStyle)));let n=ur(r);n&&n!==ur(e)&&(t+=rn([n]));let i=r.textDecoration,a=e.textDecoration;if(i&&(!a||i.underline!==a.underline||i.strikethrough!==a.strikethrough||i.overline!==a.overline)){let o=[];i.underline&&o.push("underline"),i.strikethrough&&o.push("line-through"),i.overline&&o.push("overline"),o.length>0&&(t+=f("text-decoration",o.join(" ")))}if(r.baselineShift!==void 0&&r.baselineShift!==e.baselineShift){let l=r.baselineShift;l==="super"||l==="sub"?t+=f("baseline-shift",l):typeof l=="number"&&(t+=f("baseline-shift",`${l}px`))}return r.letterSpacing!==void 0&&r.letterSpacing!==e.letterSpacing&&(t+=f("letter-spacing",String(r.letterSpacing))),r.fill!==void 0&&r.fill!==e.fill&&(t+=f("fill",String(r.fill))),r.fillOpacity!==void 0&&r.fillOpacity!==e.fillOpacity&&(t+=f("fill-opacity",String(r.fillOpacity))),r.direction!==void 0&&r.direction!==e.direction&&(t+=f("direction",String(r.direction))),r.unicodeBidi!==void 0&&r.unicodeBidi!==e.unicodeBidi&&(t+=f("unicode-bidi",String(r.unicodeBidi))),t}function gr(r){let e=r.state,t=e.pathPoints??[],n=e.pathCurveType??"CUBIC",i=e.pathClosed??!1,a=e.pathTension??.5,l=e.pathArcParams,o=de(t,n,i,a,l),u=t.length>0?e.customPivot??{x:t[0].x,y:t[0].y}:void 0,c=u?ie(e,u):null;return`<path${f("d",o)}${te(e,r.id)}${cr(e)}${c?f("transform",c):""}/>`}function br(r){let e=r.state,t=e.polylinePoints??[],n=e.polylineClosed??!1,i=t.map(u=>`${u.x},${u.y}`).join(" "),a=t.length>0?e.customPivot??{x:t[0].x,y:t[0].y}:void 0,l=a?ie(e,a):null;return`<${n?"polygon":"polyline"}${f("points",i)}${te(e,r.id)}${cr(e)}${l?f("transform",l):""}/>`}function yr(r){let e=r.state,t=e.x??0,n=e.y??0,i=e.width??100,a=e.height??100,l=e.href??"",o=e.imageOpacity,u=e.preserveAspectRatio?"xMidYMid meet":"none",c={x:t+i/2,y:n+a/2},h=ie(e,c);return`<image${f("x",t)}${f("y",n)}${f("width",i)}${f("height",a)}${f("href",l)}${f("preserveAspectRatio",u)}${o!==void 0&&o<1?f("opacity",o):""}${te(e,r.id)}${h?f("transform",h):""}/>`}function ot(r){return!r||r.length===0?"":r.map(e=>N(e)).join("")}function As(r){let e=r.state,t=e.href,n=e.hrefXlink,i="<a";return t!==void 0&&(i+=f("href",t)),n!==void 0&&(i+=f("xlink:href",n)),i+=f("target",e.linkTarget),i+=f("rel",e.linkRel),i+=f("download",e.linkDownload),i+=f("ping",e.linkPing),i+=f("hreflang",e.linkHreflang),i+=f("type",e.linkType),i+=f("referrerpolicy",e.linkReferrerPolicy),i+=f("data-shape-id",r.id),i+=">",i+=ot(e.children),i+="</a>",i}function Is(r){let e=r.state,t="<switch";return t+=f("data-shape-id",r.id),t+=">",t+=ot(e.children),t+="</switch>",t}function Ls(r){let e=r.state,t=ie(e),n="<g";return n+=f("data-shape-id",r.id),t&&(n+=f("transform",t)),e.opacity!==void 0&&e.opacity<1&&(n+=f("opacity",e.opacity)),e.visibility&&(n+=f("visibility",e.visibility)),e.blendMode&&(n+=f("style",`mix-blend-mode:${e.blendMode}`)),n+=">",n+=ot(e.children),n+="</g>",n}function Es(r){let e=r.state,t=e.viewBoxX,n=e.viewBoxY,i=e.viewBoxWidth,a=e.viewBoxHeight,l=t!==void 0&&n!==void 0&&i!==void 0&&a!==void 0?`${t} ${n} ${i} ${a}`:void 0,o="<view";return o+=f("id",r.id),o+=f("viewBox",l),o+=f("preserveAspectRatio",e.viewPreserveAspectRatio),o+=f("zoomAndPan",e.viewZoomAndPan),o+=f("viewTarget",e.viewTarget),e.viewName&&(o+=f("data-view-name",e.viewName)),e.isHomeView&&(o+=f("data-home-view","true")),o+="/>",o}function Bs(r){let e=r.state,t=e.svgX,n=e.svgY,i=e.svgWidth,a=e.svgHeight,l=e.svgViewBoxX,o=e.svgViewBoxY,u=e.svgViewBoxWidth,c=e.svgViewBoxHeight,h=l!==void 0&&o!==void 0&&u!==void 0&&c!==void 0?`${l} ${o} ${u} ${c}`:void 0,d="<svg";return d+=f("xmlns","http://www.w3.org/2000/svg"),d+=f("x",t),d+=f("y",n),d+=f("width",i),d+=f("height",a),d+=f("viewBox",h),d+=f("preserveAspectRatio",e.svgPreserveAspectRatio),d+=f("data-shape-id",r.id),d+=">",d+=ot(e.children),d+="</svg>",d}function Ds(r){let e=r.state,t=e.targetShapeId;if(!t)return`<!-- shape-reference ${O(r.id)} has no targetShapeId -->`;let n=e.offsetX??0,i=e.offsetY??0,a="<use";return a+=f("href",`#${t}`),a+=f("x",n),a+=f("y",i),e.width!==void 0&&(a+=f("width",e.width)),e.height!==void 0&&(a+=f("height",e.height)),a+=f("data-shape-id",r.id),e.opacity!==void 0&&e.opacity<1&&(a+=f("opacity",e.opacity)),a+="/>",a}function Os(r){let e=r.state,t=e.mediaKind??r.type,n=e.x??0,i=e.y??0,a=e.width??320,l=e.height??180,o=e.href??"",u=e.mediaMimeType,c=e.posterHref,h=e.mediaOpacity,d=`<${t} xmlns="http://www.w3.org/1999/xhtml"`;d+=f("src",o),u&&(d+=f("type",u)),c&&t==="video"&&(d+=f("poster",c)),e.muted&&(d+=' muted=""'),e.loop&&(d+=' loop=""'),e.playbackRate!==void 0&&(d+=f("data-playback-rate",e.playbackRate)),e.volume!==void 0&&(d+=f("data-volume",e.volume)),d+=' preload="auto" playsinline=""',d+=t==="video"?' style="width:100%;height:100%;display:block;"></video>':"></audio>";let p="<foreignObject";return p+=f("x",n),p+=f("y",i),p+=f("width",a),p+=f("height",l),p+=f("data-shape-id",r.id),p+=f("data-media-kind",t),e.naturalDuration!==void 0&&(p+=f("data-natural-duration",e.naturalDuration)),e.begin!==void 0&&(p+=f("data-begin",e.begin)),e.trimStart!==void 0&&(p+=f("data-trim-start",e.trimStart)),e.trimEnd!==void 0&&(p+=f("data-trim-end",e.trimEnd)),e.fadeInDuration!==void 0&&(p+=f("data-fade-in",e.fadeInDuration)),e.fadeOutDuration!==void 0&&(p+=f("data-fade-out",e.fadeOutDuration)),e.systemLanguage&&(p+=f("systemLanguage",e.systemLanguage)),e.requiredExtensions&&(p+=f("requiredExtensions",e.requiredExtensions)),h!==void 0&&h<1&&(p+=f("opacity",h)),p+=">",p+=d,p+="</foreignObject>",p}function $r(r){let e=r.state,t=e.cx??0,n=e.cy??0,i=e.radius??50,a=e.cornerRadius??0,l=e.shiftAngle??-90,o=e.fillRule??"nonzero",u=vs(e,t,n),c="";switch(r.type){case"triangle":c=K($e(3,i,l),a,i);break;case"ngon":{let d=e.sides??6;c=K($e(d,i,l),a,i);break}case"star":{let d=e.arms??5,p=e.innerRadiusPercent??50;c=K(Ve(d,i,p,l),a,i);break}case"cross":{let d=e.armWidthPercent??40;c=K(Ne(i,d,l),a,i);break}case"ring":{let d=e.innerRadiusPercent??50;c=qe(i,d,o);break}case"spiral":{let d=e.turns??3,p=e.thicknessPercent??20,m=e.spiralDirection??1;c=Ze(i,d,p,m,l);break}case"gear":{let d=e.teeth??8,p=e.toothDepthPercent??30,m=e.holeRadiusPercent??0;c=Ke(d,i,p,a,m,o,l);break}case"arrow":{let d=e.headWidthPercent??100,p=e.headLengthPercent??30,m=e.shaftWidthPercent??40;c=K(He(i,d,p,m,l),a,i);break}case"speechBubble":{let d=e.tailAngleDeg??45,p=e.tailLengthPercent??40,m=e.tailWidthPercent??25;c=K(We(i,d,p,m,l),a,i);break}case"lightning":{let d=e.boltSegments??3,p=e.boltJaggednessPercent??40,m=e.boltWidthPercent??30;c=K(Xe(i,d,p,m,l),a,i);break}case"heart":{let d=e.lobeRadiusPercent??50,p=e.cleftDepthPercent??25;c=je(i,d,p,l);break}case"cloud":{let d=e.cloudBumps??5,p=e.cloudPuffinessPercent??60;c=Ye(i,d,p,l);break}default:return`<!-- unsupported polygon shape: ${O(r.type)} -->`}let h="";return(r.type==="ring"||r.type==="gear")&&(h=f("fill-rule",o)),`<path${f("d",c)}${h}${te(e,r.id)}${f("transform",u)}/>`}function N(r){let e;switch(r.type){case"circle":e=dr(r);break;case"ellipse":e=hr(r);break;case"rectangle":case"square":e=fr(r);break;case"line":e=pr(r);break;case"text":e=mr(r);break;case"path":e=gr(r);break;case"polyline":e=br(r);break;case"image":e=yr(r);break;case"triangle":case"ngon":case"star":case"cross":case"ring":case"spiral":case"gear":case"arrow":case"speechBubble":case"lightning":case"heart":case"cloud":e=$r(r);break;case"hyperlink":e=As(r);break;case"switch":e=Is(r);break;case"container":case"group":e=Ls(r);break;case"view":e=Es(r);break;case"svg":e=Bs(r);break;case"shape-reference":e=Ds(r);break;case"audio":case"video":e=Os(r);break;default:return`<!-- unsupported shape type: ${O(r.type)} -->`}return Ms(e,r.state)}function sn(r,e){let t=(e.stops??[]).map(l=>{let o=`<stop${f("offset",`${l.offset*100}%`)}${f("stop-color",l.color)}`;return l.opacity!==void 0&&l.opacity<1&&(o+=f("stop-opacity",l.opacity)),o+="/>",o}).join(""),n=e.gradientUnits==="userSpaceOnUse",i=l=>n?String(l):`${l*100}%`,a=n?f("gradientUnits","userSpaceOnUse"):"";return`<linearGradient${f("id",r)}${a}${f("x1",i(e.x1))}${f("y1",i(e.y1))}${f("x2",i(e.x2))}${f("y2",i(e.y2))}${e.spreadMethod?f("spreadMethod",e.spreadMethod):""}>${t}</linearGradient>`}function an(r,e){let t=(e.stops??[]).map(h=>{let d=`<stop${f("offset",`${h.offset*100}%`)}${f("stop-color",h.color)}`;return h.opacity!==void 0&&h.opacity<1&&(d+=f("stop-opacity",h.opacity)),d+="/>",d}).join(""),n=e.gradientUnits==="userSpaceOnUse",i=h=>n?String(h):`${h*100}%`,a=n?f("gradientUnits","userSpaceOnUse"):"",l="",o=e.ry!==void 0&&e.ry!==e.r,u=!!e.rotation;if(o||u){let h=e.cx??(n?0:.5),d=e.cy??(n?0:.5),p=[];p.push(`translate(${h}, ${d})`),u&&p.push(`rotate(${e.rotation})`),o&&e.ry!==0&&p.push(`scale(1, ${e.ry/e.r})`),p.push(`translate(-${h}, -${d})`),l=f("gradientTransform",p.join(" "))}let c=e.fr!==void 0&&e.fr>0?f("fr",i(e.fr)):"";return`<radialGradient${f("id",r)}${a}${f("cx",i(e.cx))}${f("cy",i(e.cy))}${f("fx",i(e.fx))}${f("fy",i(e.fy))}${f("r",i(e.r))}${c}${e.spreadMethod?f("spreadMethod",e.spreadMethod):""}${l}>${t}</radialGradient>`}function on(r,e){if(e.svgContent!=null){let o=e.width??10,u=e.height??10,c=e.patternUnits??"userSpaceOnUse",h=e.patternContentUnits,d=e.patternTransform,p=e.viewBox,m=e.preserveAspectRatio,b=e.x??0,g=e.y??0,y=`<pattern${f("id",r)}`;return y+=f("patternUnits",c),h&&(y+=f("patternContentUnits",h)),b&&(y+=f("x",b)),g&&(y+=f("y",g)),y+=f("width",o),y+=f("height",u),p&&(y+=f("viewBox",p)),m&&(y+=f("preserveAspectRatio",m)),d&&(y+=f("patternTransform",d)),y+=`>${e.svgContent}</pattern>`,y}let t=10*(e.scale??1),n=e.rotation??0,i=e.color||"#000000",a=e.backgroundColor||"#ffffff",l="";return l+=`<rect${f("width",t)}${f("height",t)}${f("fill",a)}/>`,l+=Gs(e.patternType,t,i),`<pattern${f("id",r)}${f("patternUnits","userSpaceOnUse")}${f("width",t)}${f("height",t)}${n?f("patternTransform",`rotate(${n})`):""}>${l}</pattern>`}function Gs(r,e,t){return xe(r,e,t).map(i=>{let a=Object.entries(i.attrs).map(([l,o])=>f(l,o)).join("");return`<${i.tag}${a}/>`}).join("")}function zs(r){let e=new Set,t=new Set;for(let n of r){let i=n.state;i.markerStart&&e.add(i.markerStart),i.markerMid&&e.add(i.markerMid),i.markerEnd&&e.add(i.markerEnd);let a=i.startEndpoint,l=i.endEndpoint;a&&a!=="none"&&t.add(a),l&&l!=="none"&&t.add(l)}return{ids:e,legacyEndpoints:t}}function re(r){let e=Array.isArray(r)?zs(r):r;if(e.ids.size===0&&e.legacyEndpoints.size===0)return"";let t="",n=le();for(let i of n){let a=i.id,l=a.replace("line-marker-",""),o=`mkr-builtin-${l}`,u=e.legacyEndpoints.has(l)||e.ids.has(a),c=e.ids.has(o);if(!u&&!c)continue;let h=i.element,d=Object.entries(h.attrs).map(([b,g])=>f(b,g)).join(""),p=`<${h.tag}${d}/>`,m=b=>{t+=`<marker${f("id",b)}${f("viewBox",Se)}${f("refX",i.refX)}${f("refY",i.refY)}${f("markerWidth",6)}${f("markerHeight",6)}${f("orient","auto-start-reverse")}>${p}</marker>`};u&&m(a),c&&m(o)}return t}var ue=r=>r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),xr=["linear-gradient","radial-gradient","pattern","filter","marker","symbol"];function Sr(r){switch(r.kind){case"symbol":return kr(r);case"marker":return _r(r);case"linear-gradient":return vr(r);case"radial-gradient":return wr(r);case"pattern":return Pr(r);case"filter":return Tr(r)}}function kr(r){let e=r.shapes.map(t=>N(t)).join("");return`<symbol id="${ue(r.id)}" viewBox="${ue(r.viewBox)}">${e}</symbol>`}function _r(r){let e;if(r.builtIn){let n=le().find(i=>r.id.includes(i.id)||r.id===i.id);if(n){let i=Object.entries(n.element.attrs).map(([a,l])=>` ${a}="${ue(String(l))}"`).join("");e=`<${n.element.tag}${i}/>`}else e=""}else e=r.shapes.map(n=>N(n)).join("");let t=typeof r.orient=="number"?String(r.orient):r.orient;return`<marker id="${ue(r.id)}" viewBox="${ue(r.viewBox)}" refX="${r.refX}" refY="${r.refY}" markerWidth="${r.markerWidth}" markerHeight="${r.markerHeight}" markerUnits="${ue(r.markerUnits)}" orient="${ue(t)}">${e}</marker>`}function vr(r){let e={...r.gradient,type:"linear-gradient",id:r.id};return sn(r.id,e)}function wr(r){let e={...r.gradient,type:"radial-gradient",id:r.id};return an(r.id,e)}function Pr(r){let e={...r.pattern,type:"pattern",id:r.id};return on(r.id,e)}function Tr(r){return or(r.id,r.filters,{colorInterpolation:r.colorInterpolation,filterUnits:r.filterUnits,primitiveUnits:r.primitiveUnits,x:r.x,y:r.y,width:r.width,height:r.height})}function Fr(r){let e=new Map;for(let n of r){let i=e.get(n.kind);i?i.push(n):e.set(n.kind,[n])}let t="";for(let n of xr){let i=e.get(n);if(i)for(let a of i)t+=Sr(a)}return t}function ln(r){let e=new Set,t=n=>{typeof n=="string"&&n&&e.add(n)};for(let n of r){let i=n.state;if(!i)continue;t(i.fillLibraryId),t(i.strokeLibraryId),t(i.markerStart),t(i.markerMid),t(i.markerEnd),t(i.symbolId);let a=i.filterLibraryIds;if(Array.isArray(a))for(let l of a)t(l)}return e}function ne(r,e){let t=new Map;for(let o of e)t.set(o.id,o);let n=new Map,i=o=>{if(!o)return;let u=t.get(o);u&&n.set(o,u)},a=(o,u)=>{if(!o||typeof o!="object")return;let c=o;if(!c.id||n.has(c.id))return;let h=u==="linear-gradient"?"linear-gradient":u==="radial-gradient"?"radial-gradient":u==="pattern"?"pattern":null;if(!h)return;let{id:d,sourceId:p,...m}=o,b;if(h==="linear-gradient")b={kind:"linear-gradient",id:c.id,name:p??c.id,sourceId:p,gradient:m};else if(h==="radial-gradient")b={kind:"radial-gradient",id:c.id,name:p??c.id,sourceId:p,gradient:m};else{let{customPatternId:g,...y}=m;b={kind:"pattern",id:c.id,name:p??c.id,sourceId:p,pattern:y}}n.set(c.id,b)},l=(o,u)=>{let c=o.filters;if(!Array.isArray(c)||c.length===0)return;let h=`filter-${u}`;n.has(h)||n.set(h,{kind:"filter",id:h,name:h,filters:c,...o.filterColorInterpolation&&o.filterColorInterpolation!=="auto"?{colorInterpolation:o.filterColorInterpolation}:{},...o.filterUnits?{filterUnits:o.filterUnits}:{},...o.primitiveUnits?{primitiveUnits:o.primitiveUnits}:{},...typeof o.filterX=="string"?{x:o.filterX}:{},...typeof o.filterY=="string"?{y:o.filterY}:{},...typeof o.filterWidth=="string"?{width:o.filterWidth}:{},...typeof o.filterHeight=="string"?{height:o.filterHeight}:{}})};for(let o of r){let u=o.state;if(!u)continue;i(u.fillLibraryId),i(u.strokeLibraryId),i(u.markerStart),i(u.markerMid),i(u.markerEnd),i(u.symbolId);let c=u.filterLibraryIds;if(Array.isArray(c))for(let h of c)typeof h=="string"&&i(h);u.fillLibraryId||a(u.fillGradient,u.fillType),u.strokeLibraryId||a(u.strokeGradient,u.strokeType),(!Array.isArray(c)||c.length===0)&&l(u,o.id)}return n.size===0?"":Fr(Array.from(n.values()))}var Us={x:"x",y:"y",cx:"cx",cy:"cy",x1:"x1",y1:"y1",x2:"x2",y2:"y2",posX:"x",posY:"y",radius:"r",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",pathLength:"pathLength",svgX:"x",svgY:"y",svgWidth:"width",svgHeight:"height",opacity:"opacity",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",borderWidth:"stroke-width",cornerRadius:"rx",fontSize:"font-size",letterSpacing:"letter-spacing",wordSpacing:"word-spacing",textLength:"textLength",d:"d",polylinePoints:"points"},Vs=new Set(["rotation","skewX","skewY"]);function Ns(r){let t=Fe[r];return t?t.join(" "):"0 0 1 1"}function fe(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rr(r){return r.cycleDuration!==void 0&&r.cycleDuration>0?r.cycleDuration:r.keyframes.length===0?0:r.keyframes[r.keyframes.length-1].time}function Mr(r,e){let t=r.keyframes;if(t.length===0)return{values:[],keyTimes:[],keySplines:[]};let n=t.map(l=>String(l.value)),i=t.map(l=>e>0?(l.time/e).toFixed(4):"0"),a=[];for(let l=1;l<t.length;l++)a.push(Ns(t[l].easing));return{values:n,keyTimes:i,keySplines:a}}function lt(r){let e=r.beginTrigger;if(!e)return"0s";switch(e.type){case"time":return`${e.value}s`;case"event":return e.value;default:return"0s"}}function Cr(r){return r.cycleInfinite?"indefinite":r.cycleRepeats&&r.cycleRepeats>1?String(r.cycleRepeats):null}function Hs(r){let e=Us[r.property];if(!e)return"";let t=Rr(r);if(t<=0)return"";let{values:n,keyTimes:i,keySplines:a}=Mr(r,t);if(n.length<2)return"";let l=`<animate attributeName="${fe(e)}"`;l+=` values="${fe(n.join(";"))}"`,l+=` keyTimes="${i.join(";")}"`,a.length>0&&a.some(u=>u!=="0 0 1 1")&&(l+=' calcMode="spline"',l+=` keySplines="${a.join(";")}"`),l+=` dur="${t}s"`,l+=` begin="${lt(r)}"`;let o=Cr(r);return o&&(l+=` repeatCount="${o}"`),l+=' fill="freeze"',l+="/>",l}function Ws(r){let e;switch(r.property){case"rotation":e="rotate";break;case"skewX":e="skewX";break;case"skewY":e="skewY";break;default:return""}let t=Rr(r);if(t<=0)return"";let{values:n,keyTimes:i,keySplines:a}=Mr(r,t);if(n.length<2)return"";let l=e==="rotate"&&r.transformOrigin?n.map(c=>`${c} ${r.transformOrigin.x} ${r.transformOrigin.y}`):n,o='<animateTransform attributeName="transform"';o+=` type="${e}"`,o+=` values="${fe(l.join(";"))}"`,o+=` keyTimes="${i.join(";")}"`,a.length>0&&a.some(c=>c!=="0 0 1 1")&&(o+=' calcMode="spline"',o+=` keySplines="${a.join(";")}"`),o+=` dur="${t}s"`,o+=` begin="${lt(r)}"`;let u=Cr(r);return u&&(o+=` repeatCount="${u}"`),o+=` additive="${r.additive??"sum"}"`,o+=' fill="freeze"',o+="/>",o}function Xs(r){if(!r.motionPath)return"";let e=Rr(r);if(e<=0)return"";let{keyTimes:t,keySplines:n}=Mr(r,e),i=r.keyframes.map(c=>{let h=typeof c.value=="number"?c.value:parseFloat(c.value);return Math.max(0,Math.min(1,h))}),a=!!r.motionPathRef&&(r.motionPathRef.mode??"trackShape")==="curveTemplate",l="<animateMotion";a||(l+=` path="${fe(r.motionPath)}"`),l+=` keyTimes="${t.join(";")}"`,l+=` keyPoints="${i.join(";")}"`,n.length>0&&n.some(c=>c!=="0 0 1 1")&&(l+=' calcMode="spline"',l+=` keySplines="${n.join(";")}"`),l+=` dur="${e}s"`,l+=` begin="${lt(r)}"`;let o=Cr(r);o&&(l+=` repeatCount="${o}"`),l+=' fill="freeze"';let u=r.motionRotate??"auto";return l+=` rotate="${u}"`,a?l+=`><mpath href="#${fe(r.motionPathRef.shapeId)}"/></animateMotion>`:l+="/>",l}function js(r){let e=lt(r);if(e!=="0s")return e;let t=r.keyframes[0]?.time??0;return t!==0?`${t}s`:""}function Ys(r){let e=js(r);return e?`<discard begin="${fe(e)}"/>`:"<discard/>"}function ut(r){let e=new Map;for(let t of r.tracks){if(!t.enabled||t.property!=="discard"&&t.keyframes.length<2)continue;let n=[...t.keyframes].sort((l,o)=>l.time-o.time),i={...t,locked:t.locked??!1,keyframes:n.map(l=>({time:l.time,value:l.value,easing:l.easing}))},a="";if(t.property==="discard"?a=Ys(i):t.property==="pathMotion"&&t.motionPath?a=Xs(i):Vs.has(t.property)?a=Ws(i):a=Hs(i),a){let l=e.get(t.shapeId)??[];l.push(a),e.set(t.shapeId,l)}}return e}function pe(r,e={}){let{xmlDeclaration:t=!0,backgroundColor:n,indent:i=!0,className:a}=e,l=r.viewboxes?.[0],o=e.width??l?.width??800,u=e.height??l?.height??600,c=e.viewBox??`0 0 ${o} ${u}`,h=i?`
8
+ `:"",d=i?" ":"",p=r.shapes??[],m=p.filter(A=>A.state?.displayMode==="motionOnly"),b=p.filter(A=>A.state?.displayMode!=="motionOnly"),g=Qs(r),y=Js(r),S=[...Array.isArray(r.library)?r.library:[],...(y??[]).filter(A=>!A.builtIn&&!(Array.isArray(r.library)&&r.library.some(L=>L.id===A.id)))],_=ne(b,S),x=re(b),k=ia(g,b),P=qs(m),v=_.length>0||x.length>0||k.length>0||P.length>0,$="";v&&($=`${h}${d}<defs>${h}`,_.length>0&&($+=`${d}${d}${_}${h}`),x.length>0&&($+=`${d}${d}${x}${h}`),k.length>0&&($+=`${d}${d}${k}${h}`),P.length>0&&($+=`${d}${d}${P}${h}`),$+=`${d}</defs>`);let w="";n&&(w=`${h}${d}<rect width="${o}" height="${u}" fill="${n}"/>`);let R=r.animationTimeline?ut(r.animationTimeline):null,I=b.map(A=>{let L=A.type==="symbol-instance"?na(A,g):N(A),E=R?.get(A.id);return E&&E.length>0&&(L=sa(L,E,d)),`${d}${L}`}).join(h),C="";return t&&(C+=`<?xml version="1.0" encoding="UTF-8"?>${h}`),C+='<svg xmlns="http://www.w3.org/2000/svg"',C+=` width="${o}" height="${u}"`,C+=` viewBox="${c}"`,a&&(C+=` class="${a}"`),C+=">",C+=$,C+=w,b.length>0&&(C+=`${h}${I}`),C+=`${h}</svg>${h}`,C}function qs(r){if(r.length===0)return"";let e=[];for(let t of r){let n=Zs(t);if(!n)continue;let i=Ks(n);e.push(`<path id="${un(t.id)}" d="${un(i)}"/>`)}return e.join("")}function Zs(r){let e=r.state;if(typeof e?.d=="string")return e.d;switch(r.type){case"rectangle":{let t=e?.x??0,n=e?.y??0,i=e?.width??0,a=e?.height??0;return i<=0||a<=0?null:`M${t},${n}h${i}v${a}h${-i}Z`}case"circle":{let t=e?.cx??0,n=e?.cy??0,i=e?.radius??0;return i<=0?null:`M${t-i},${n}A${i},${i} 0 1 0 ${t+i},${n}A${i},${i} 0 1 0 ${t-i},${n}Z`}case"ellipse":{let t=e?.cx??0,n=e?.cy??0,i=e?.rx??0,a=e?.ry??0;return i<=0||a<=0?null:`M${t-i},${n}A${i},${a} 0 1 0 ${t+i},${n}A${i},${a} 0 1 0 ${t-i},${n}Z`}case"line":{let t=e?.x1??0,n=e?.y1??0,i=e?.x2??0,a=e?.y2??0;return`M${t},${n}L${i},${a}`}default:return null}}function Ks(r){let e=/[Mm]\s*(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)[\s,]+(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/.exec(r);if(!e)return r;let t=parseFloat(e[1]),n=parseFloat(e[2]);if(!isFinite(t)||!isFinite(n)||t===0&&n===0)return r;let i=!0;return r.replace(/([MLCQSTHVAZ])\s*([\d\s.,e+-]*)/gi,(a,l,o)=>{let u=l.toUpperCase(),c=l!==u,h=i;if(i=!1,u==="Z")return a;let d=o.trim().split(/[\s,]+/).filter(m=>m.length>0).map(Number);if(d.length===0||c&&!h)return a;let p=[];if(u==="H")for(let m of d)p.push(m-t);else if(u==="V")for(let m of d)p.push(m-n);else if(u==="A")for(let m=0;m<d.length;m+=7)p.push(d[m],d[m+1],d[m+2],d[m+3],d[m+4]),m+5<d.length&&p.push(d[m+5]-t),m+6<d.length&&p.push(d[m+6]-n);else for(let m=0;m<d.length;m+=2)p.push(d[m]-t),m+1<d.length&&p.push(d[m+1]-n);return`${l} ${p.join(" ")}`})}function un(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function Qs(r){let t=(Array.isArray(r.library)?r.library:[]).filter(n=>n.kind==="symbol");return t.length>0?t:r.symbols??[]}function Js(r){let t=(Array.isArray(r.library)?r.library:[]).filter(n=>n.kind==="marker");return t.length>0?t:r.markers}var Ar=r=>r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),ea=r=>r.replace(/[^a-zA-Z0-9_-]/g,"_");function cn(r){let e=r.state.symbolId??"",t=r.state.variantKey??"";return r.state.symbolOverrides&&Object.keys(r.state.symbolOverrides).length>0?`${e}--ovr-${r.id}`:t?`${e}--${ea(t)}`:e}function ta(r,e){return r.map(t=>{let n=e[t.id];return!n||Object.keys(n).length===0?t:{...t,state:{...t.state,...n}}})}function ra(r,e){return e?r.variants?.[e]??r.shapes:r.shapes}function na(r,e){let t=cn(r),n=r.state.x??0,i=r.state.y??0,a=r.state.width??100,l=r.state.height??100;return`<use href="#${Ar(t)}" x="${n}" y="${i}" width="${a}" height="${l}"/>`}function ia(r,e){if(r.length===0)return"";let t=new Map;for(let a of r)t.set(a.id,a);let n=new Map;for(let a of e){if(a.type!=="symbol-instance")continue;let l=a.state.symbolId??"",o=t.get(l);if(!o)continue;let u=cn(a);if(n.has(u))continue;let c=ra(o,a.state.variantKey??""),h=a.state.symbolOverrides;h&&Object.keys(h).length>0&&(c=ta(c,h)),n.set(u,{def:o,resolved:c})}if(n.size===0)return"";let i=[];for(let[a,{def:l,resolved:o}]of n){let u=o.map(c=>N(c)).join("");i.push(`<symbol id="${Ar(a)}" viewBox="${Ar(l.viewBox)}">${u}</symbol>`)}return i.join("")}function sa(r,e,t){let n=e.join(""),i=0;for(;i<r.length;){let c=r.slice(i);if(!/^<defs[\s>]/.test(c))break;let h=r.indexOf("</defs>",i);if(h===-1)break;i=h+7}let a=r.slice(0,i),l=r.slice(i),o=l.lastIndexOf("/>");if(o!==-1){let c=l.match(/^<(\w+)/),h=c?c[1]:"g";return a+l.slice(0,o)+">"+n+`</${h}>`}let u=l.match(/<\/(\w+)>$/);if(u){let c=l.lastIndexOf(`</${u[1]}>`);return a+l.slice(0,c)+n+l.slice(c)}return a+l+n}function ct(r,e){let t=ee(r,e);return pe(r,{width:t.width,height:t.height,xmlDeclaration:e.xmlDeclaration??!1,indent:!0})}function aa(r){return r==="class"?"className":r==="for"?"htmlFor":r.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function dn(r){return r.replace(/\s([a-z][a-z-]*?)=/g,(e,t)=>t.startsWith("data-")||t.startsWith("aria-")?e:` ${aa(t)}=`)}function dt(r,e){let t=e.componentName??"SvgComponent",n=ee(r,e),i=e.indent??" ",a=r.shapes??[],l=e.typescript??!1,o=Array.isArray(r.library)?r.library:[],u=ne(a,o),c=re(a),h=u+c,d=h.length>0,p=a.map(b=>{let g=N(b);return`${i}${i}${i}${dn(g)}`}),m=[];m.push("import React from 'react';"),m.push(""),l?(m.push(`interface ${t}Props {`),m.push(`${i}className?: string;`),m.push(`${i}style?: React.CSSProperties;`),m.push("}"),m.push(""),m.push(`const ${t}: React.FC<${t}Props> = ({ className, style }) => {`)):m.push(`const ${t} = ({ className, style }) => {`),m.push(`${i}return (`),m.push(`${i}${i}<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" viewBox="0 0 ${n.width} ${n.height}" className={className} style={style}>`),d&&(m.push(`${i}${i}${i}<defs>`),m.push(`${i}${i}${i}${i}${dn(h)}`),m.push(`${i}${i}${i}</defs>`));for(let b of p)m.push(b);return m.push(`${i}${i}</svg>`),m.push(`${i});`),m.push("};"),m.push(""),m.push(`export default ${t};`),m.push(""),m.join(`
9
+ `)}function ht(r,e){let t=e.componentName??"SvgComponent",n=ee(r,e),i=e.indent??" ",a=r.shapes??[],l=e.typescript??!1,o=Array.isArray(r.library)?r.library:[],u=ne(a,o),c=re(a),h=u+c,d=h.length>0,p=a.map(b=>`${i}${i}${N(b)}`),m=[];m.push("<template>"),m.push(`${i}<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" viewBox="0 0 ${n.width} ${n.height}" :class="className" :style="style">`),d&&(m.push(`${i}${i}<defs>`),m.push(`${i}${i}${i}${h}`),m.push(`${i}${i}</defs>`));for(let b of p)m.push(b);return m.push(`${i}</svg>`),m.push("</template>"),m.push(""),l?m.push('<script setup lang="ts">'):m.push("<script setup>"),m.push(`// ${t}`),l?(m.push("defineProps<{"),m.push(`${i}className?: string;`),m.push(`${i}style?: Record<string, string>;`),m.push("}>();")):(m.push("defineProps({"),m.push(`${i}className: { type: String, default: '' },`),m.push(`${i}style: { type: Object, default: () => ({}) },`),m.push("});")),m.push("</script>"),m.push(""),m.join(`
10
+ `)}var oa=new Set(["circle","ellipse","rectangle","square","line","text","image"]);function hn(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function fn(r){return r.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function la(r){if(!oa.has(r.type))return!0;let e=r.state.metadata;return!!(e?.title||e?.description||r.type==="text"&&r.state.isTextPath)}function ft(r,e){let t=e.componentName??"createSvg",n=ee(r,e),i=e.indent??" ",a=r.shapes??[],l=e.typescript??!1,o=[];o.push("import * as d3 from 'd3';"),o.push(""),l?o.push(`export function ${t}(container: string | HTMLElement): d3.Selection<SVGSVGElement, unknown, HTMLElement, unknown> {`):o.push(`export function ${t}(container) {`),o.push(`${i}const svg = d3.select(container)`),o.push(`${i}${i}.append('svg')`),o.push(`${i}${i}.attr('xmlns', 'http://www.w3.org/2000/svg')`),o.push(`${i}${i}.attr('width', ${n.width})`),o.push(`${i}${i}.attr('height', ${n.height})`),o.push(`${i}${i}.attr('viewBox', '0 0 ${n.width} ${n.height}');`),o.push("");let u=Array.isArray(r.library)?r.library:[],c=ne(a,u),h=re(a),d=`${c}${h}`;d.length>0&&(o.push(`${i}svg.append('defs').html(\`${fn(d)}\`);`),o.push(""));for(let p=0;p<a.length;p++){let m=a[p];if(o.push(`${i}// ${m.type}${m.state.metadata?.name?` \u2014 ${m.state.metadata.name}`:""}`),la(m)){o.push(`${i}svg.append('g').html(\`${fn(N(m))}\`);`),o.push("");continue}let b=jr(m),g=Je(m),y=`shape${p+1}`;o.push(`${i}const ${y} = svg.append('${b}')`);for(let[S,_]of g)o.push(`${i}${i}.attr('${S}', '${hn(_)}')`);m.type==="text"&&m.state.text&&o.push(`${i}${i}.text('${hn(m.state.text)}')`),o[o.length-1]=o[o.length-1]+";",o.push("")}return o.push(`${i}return svg;`),o.push("}"),o.push(""),o.join(`
11
+ `)}function pn(r,e){let t=r.state.metadata?.name;return t?t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""):`${r.type}-${e+1}`}var ua=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linecap","opacity","transform","filter"]);function pt(r,e){let t=ee(r,e),n=e.indent??" ",i=r.shapes??[],a=[];for(let u=0;u<i.length;u++){let c=i[u],h=pn(c,u),d=Je(c),p=[];for(let[m,b]of d)ua.has(m)&&p.push(`${n}${m}: ${b};`);p.length>0&&a.push(`.${h} {
12
+ ${p.join(`
13
13
  `)}
14
- }`)}let l=[];for(let u=0;u<i.length;u++){let c=i[u],h=rn(c,u),d=H(c),f=d.indexOf(" ");f!==-1&&(d=d.slice(0,f)+` class="${h}"`+d.slice(f)),l.push(`${n}${d}`)}let o=[];o.push("<style>");for(let u of a)o.push(u);o.push("</style>"),o.push(""),o.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${t.width}" height="${t.height}" viewBox="0 0 ${t.width} ${t.height}">`);for(let u of l)o.push(u);return o.push("</svg>"),o.push(""),o.join(`
15
- `)}function ht(r,e){let t=Us(r,e),n={...e};switch(n.format){case"svg":return ot(t,n);case"react":return lt(t,n);case"vue":return ut(t,n);case"d3":return ct(t,n);case"css":return dt(t,n);default:throw new Error(`Unsupported code format: ${n.format}`)}}function Us(r,e){return Array.isArray(r)?{shapes:r,viewboxes:[{id:"default",x:0,y:0,width:e.width??800,height:e.height??600}]}:r}var pt=class r{_snapshot;constructor(e={}){let{width:t=800,height:n=600,viewboxId:i}=e,a=ge(0,0,t,n,i);this._snapshot=Fe({viewboxes:[a]})}static fromSnapshot(e){let t=new r;return t._snapshot=JSON.parse(JSON.stringify(e)),t}static fromJSON(e,t){let n=Me(e,t),i=new r;return i._snapshot=n,i}add(e){let t="build"in e&&typeof e.build=="function"?e.build():e;return this._snapshot.shapes.push(t),this}addAll(...e){for(let t of e)this.add(t);return this}remove(e){let t=this._snapshot.shapes.length;return this._snapshot.shapes=this._snapshot.shapes.filter(n=>n.id!==e),this._snapshot.shapes.length<t}get shapes(){return this._snapshot.shapes}findShape(e){return this._snapshot.shapes.find(t=>t.id===e)}size(e,t){return this._snapshot.viewboxes.length>0?(this._snapshot.viewboxes[0].width=e,this._snapshot.viewboxes[0].height=t):this._snapshot.viewboxes=[ge(0,0,e,t)],this}get width(){return this._snapshot.viewboxes[0]?.width??800}get height(){return this._snapshot.viewboxes[0]?.height??600}title(e){return this._ensureMetadata(),this._snapshot.documentMetadata.title=e,this}description(e){return this._ensureMetadata(),this._snapshot.documentMetadata.description=e,this}author(e){return this._ensureMetadata(),this._snapshot.documentMetadata.author=e,this}keywords(...e){return this._ensureMetadata(),this._snapshot.documentMetadata.keywords=e,this}license(e,t){return this._ensureMetadata(),this._snapshot.documentMetadata.license=e,t!==void 0&&(this._snapshot.documentMetadata.licenseUrl=t),this}language(e){return this._ensureMetadata(),this._snapshot.documentMetadata.language=e,this}customMetadata(e){return this._ensureMetadata(),this._snapshot.documentMetadata.customMetadata={...this._snapshot.documentMetadata.customMetadata,...e},this}get meta(){return this._snapshot.documentMetadata}defineSymbol(e,t,n){this._snapshot.symbols||(this._snapshot.symbols=[]);let i=T(),a=t.map(o=>"build"in o&&typeof o.build=="function"?o.build():o),l={kind:"symbol",id:i,name:e,viewBox:n?.viewBox??"0 0 100 100",shapes:a};return n?.groups&&(l.groups=n.groups),n?.thumbnail&&(l.thumbnail=n.thumbnail),n?.defKind&&(l.defKind=n.defKind),n?.wrapperAttrs&&(l.wrapperAttrs=n.wrapperAttrs),n?.variantAxes&&(l.variantAxes=n.variantAxes),n?.variants&&(l.variants=n.variants),n?.variantThumbnails&&(l.variantThumbnails=n.variantThumbnails),this._snapshot.symbols.push(l),i}placeSymbolInstance(e,t,n,i,a){let l,o={};typeof i=="number"||i===void 0?l=i:(o=i,l=o.width,a=o.height??a);let u={symbolId:e,x:t,y:n,width:l??100,height:a??100};o.variantKey&&(u.variantKey=o.variantKey),o.symbolOverrides&&(u.symbolOverrides=o.symbolOverrides),o.instancePresentation&&(u.instancePresentation=o.instancePresentation);let c={id:T(),type:"symbol-instance",state:u};return this._snapshot.shapes.push(c),this}removeSymbol(e){if(!this._snapshot.symbols)return!1;let t=this._snapshot.symbols.length;return this._snapshot.symbols=this._snapshot.symbols.filter(n=>n.id!==e),this._snapshot.symbols.length<t}get symbols(){return this._snapshot.symbols??[]}defineMarker(e,t,n){let i=T(),a=t.map(o=>"build"in o&&typeof o.build=="function"?o.build():o),l={kind:"marker",id:i,name:e,viewBox:n?.viewBox??"0 0 10 10",refX:n?.refX??5,refY:n?.refY??5,markerWidth:n?.markerWidth??10,markerHeight:n?.markerHeight??10,markerUnits:n?.markerUnits??"strokeWidth",orient:n?.orient??"auto",shapes:a};return n?.groups&&(l.groups=n.groups),n?.thumbnail&&(l.thumbnail=n.thumbnail),this._pushLibraryDef(l),i}defineFilter(e,t,n){let i=T(),a={kind:"filter",id:i,name:e,filters:t};return n?.colorInterpolation&&(a.colorInterpolation=n.colorInterpolation),n?.filterUnits&&(a.filterUnits=n.filterUnits),n?.primitiveUnits&&(a.primitiveUnits=n.primitiveUnits),n?.x!==void 0&&(a.x=n.x),n?.y!==void 0&&(a.y=n.y),n?.width!==void 0&&(a.width=n.width),n?.height!==void 0&&(a.height=n.height),n?.thumbnail&&(a.thumbnail=n.thumbnail),this._pushLibraryDef(a),i}defineLinearGradientLibrary(e,t,n){let i=T(),a="build"in t?t.build():t,{id:l,sourceId:o,...u}=a,c={kind:"linear-gradient",id:i,name:e,gradient:u};return n?.thumbnail&&(c.thumbnail=n.thumbnail),this._pushLibraryDef(c),i}defineRadialGradientLibrary(e,t,n){let i=T(),a="build"in t?t.build():t,{id:l,sourceId:o,...u}=a,c={kind:"radial-gradient",id:i,name:e,gradient:u};return n?.thumbnail&&(c.thumbnail=n.thumbnail),this._pushLibraryDef(c),i}definePatternLibrary(e,t,n){let i=T(),a="build"in t?t.build():t,{id:l,sourceId:o,customPatternId:u,...c}=a,h={kind:"pattern",id:i,name:e,pattern:c};return n?.thumbnail&&(h.thumbnail=n.thumbnail),this._pushLibraryDef(h),i}removeLibraryDef(e){if(!this._snapshot.library)return!1;let t=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(n=>n.id!==e),this._snapshot.library.length<t}get library(){return this._snapshot.library??[]}_pushLibraryDef(e){this._snapshot.library||(this._snapshot.library=[]);let t=this._snapshot.library.findIndex(n=>n.id===e.id);t>=0?this._snapshot.library[t]=e:this._snapshot.library.push(e)}addClipGroup(e,t,n){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=T(),a={id:i,type:"clip",clipShapeIds:e,contentShapeIds:t,parentId:null};return n?.clipPathUnits&&(a.clipPathUnits=n.clipPathUnits),n?.rawDefinition&&(a.rawDefinition=n.rawDefinition),this._snapshot.clipMaskGroups.push(a),i}addMaskGroup(e,t,n){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=T(),a={id:i,type:"mask",clipShapeIds:e,contentShapeIds:t,parentId:null};return n?.maskUnits&&(a.maskUnits=n.maskUnits),n?.maskContentUnits&&(a.maskContentUnits=n.maskContentUnits),n?.maskBounds&&(a.maskBounds=n.maskBounds),n?.maskType&&(a.maskType=n.maskType),n?.rawDefinition&&(a.rawDefinition=n.rawDefinition),this._snapshot.clipMaskGroups.push(a),i}removeClipMaskGroup(e){if(!this._snapshot.clipMaskGroups)return!1;let t=this._snapshot.clipMaskGroups.length;return this._snapshot.clipMaskGroups=this._snapshot.clipMaskGroups.filter(n=>n.id!==e),this._snapshot.clipMaskGroups.length<t}addGuide(e,t,n){this._snapshot.guides||(this._snapshot.guides=[]);let i=T(),a={id:i,orientation:e,position:t,controlPointOffset:0};return n?.color&&(a.color=n.color),n?.opacity!==void 0&&(a.opacity=n.opacity),this._snapshot.guides.push(a),i}removeGuide(e){if(!this._snapshot.guides)return!1;let t=this._snapshot.guides.length;return this._snapshot.guides=this._snapshot.guides.filter(n=>n.id!==e),this._snapshot.guides.length<t}clearGuides(){return this._snapshot.guides=[],this}get guides(){return this._snapshot.guides??[]}addMeasurement(e,t,n){this._snapshot.measurements||(this._snapshot.measurements=[]);let i=T(),a={id:i,type:e,points:t,visible:n?.visible??!0,snapDivisions:n?.snapDivisions??1};return n?.color&&(a.color=n.color),n?.opacity!==void 0&&(a.opacity=n.opacity),this._snapshot.measurements.push(a),i}removeMeasurement(e){if(!this._snapshot.measurements)return!1;let t=this._snapshot.measurements.length;return this._snapshot.measurements=this._snapshot.measurements.filter(n=>n.id!==e),this._snapshot.measurements.length<t}get measurements(){return this._snapshot.measurements??[]}addCustomPattern(e,t,n,i){this._snapshot.customPatterns||(this._snapshot.customPatterns=[]);let a=T();return this._snapshot.customPatterns.push({id:a,name:e,svgContent:t,width:n,height:i}),a}removeCustomPattern(e){if(!this._snapshot.customPatterns)return!1;let t=this._snapshot.customPatterns.length;return this._snapshot.customPatterns=this._snapshot.customPatterns.filter(n=>n.id!==e),this._snapshot.customPatterns.length<t}get customPatterns(){return this._snapshot.customPatterns??[]}addGroup(e,t){this._snapshot.groups||(this._snapshot.groups=[]);let n=e??T();return this._snapshot.groups.push({id:n,parentId:t??null}),n}removeGroup(e){if(!this._snapshot.groups)return!1;let t=this._snapshot.groups.length;this._snapshot.groups=this._snapshot.groups.filter(n=>n.id!==e);for(let n of this._snapshot.shapes)n.state.groupId===e&&delete n.state.groupId;return this._snapshot.groups.length<t}moveToGroup(e,t){let n=this._snapshot.shapes.find(i=>i.id===e);return n&&(n.state.groupId=t),this}removeFromGroup(e){let t=this._snapshot.shapes.find(n=>n.id===e);return t&&delete t.state.groupId,this}bringToFront(e){let t=this._snapshot.shapes.findIndex(n=>n.id===e);if(t>=0){let[n]=this._snapshot.shapes.splice(t,1);this._snapshot.shapes.push(n)}return this}sendToBack(e){let t=this._snapshot.shapes.findIndex(n=>n.id===e);if(t>=0){let[n]=this._snapshot.shapes.splice(t,1);this._snapshot.shapes.unshift(n)}return this}reorder(e,t){let n=this._snapshot.shapes.findIndex(i=>i.id===e);if(n>=0){let[i]=this._snapshot.shapes.splice(n,1),a=Math.max(0,Math.min(t,this._snapshot.shapes.length));this._snapshot.shapes.splice(a,0,i)}return this}defineVariable(e,t,n,i){this._snapshot.templateVariables||(this._snapshot.templateVariables=[]);let a=this._snapshot.templateVariables.find(l=>l.name===e);if(a)a.type=t,a.defaultValue=n,i?.label!==void 0&&(a.label=i.label),i?.description!==void 0&&(a.description=i.description);else{let l={name:e,type:t,defaultValue:n};i?.label!==void 0&&(l.label=i.label),i?.description!==void 0&&(l.description=i.description),this._snapshot.templateVariables.push(l)}return this}removeVariable(e){return this._snapshot.templateVariables&&(this._snapshot.templateVariables=this._snapshot.templateVariables.filter(t=>t.name!==e)),this}get variables(){return this._snapshot.templateVariables??[]}inspectVariables(){return De(this._snapshot)}setTimeline(e){return"build"in e&&typeof e.build=="function"?this._snapshot.animationTimeline=e.build():this._snapshot.animationTimeline=e,this}clearTimeline(){return delete this._snapshot.animationTimeline,this}get timeline(){return this._snapshot.animationTimeline}toSVG(e){let{variables:t,...n}=e??{},i=Le(this._snapshot,t);return fe(i,n)}toJSON(e){return Re(this._snapshot,e)}toSnapshot(){return JSON.parse(JSON.stringify(this._snapshot))}toCode(e,t){return ht(this._snapshot,{...t,format:e})}_ensureMetadata(){this._snapshot.documentMetadata||(this._snapshot.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{}})}};var ft=class{_track;constructor(e,t){this._track={id:T(),shapeId:e,property:t,keyframes:[],enabled:!0,locked:!1}}id(e){return this._track.id=e,this}keyframe(e,t,n="linear"){return this._track.keyframes.push({time:e,value:t,easing:n}),this}keyframeBezier(e,t,n){return this._track.keyframes.push({time:e,value:t,easing:"custom-bezier",customBezier:n}),this}keyframeLinear(e,t,n){return this._track.keyframes.push({time:e,value:t,easing:"linear-function",linearPoints:n}),this}keyframes(...e){return this._track.keyframes.push(...e),this}disabled(){return this._track.enabled=!1,this}locked(){return this._track.locked=!0,this}motionPath(e){return this._track.motionPath=e,this}motionPathRef(e,t="trackShape"){return this._track.motionPathRef={shapeId:e,mode:t},this}beginTrigger(e,t){return this._track.beginTrigger={type:e,value:t},this}endTrigger(e,t){return this._track.endTrigger={type:e,value:t},this}cycleDuration(e){return this._track.cycleDuration=e,this}cycleRepeats(e){return this._track.cycleRepeats=e,this}infinite(){return this._track.cycleInfinite=!0,this}cycle(e){return this._track.cycleBehavior=e,this}transformOrigin(e,t){return this._track.transformOrigin={x:e,y:t},this}motionRotate(e){return this._track.motionRotate=e,this}additive(e){return this._track.additive=e,this}build(){let e=[...this._track.keyframes].sort((t,n)=>t.time-n.time);return{...this._track,keyframes:e}}},mt=class{_duration;_loop=!1;_playbackSpeed=1;_tracks=[];constructor(e){this._duration=e}loop(e=!0){return this._loop=e,this}speed(e){return this._playbackSpeed=e,this}duration(e){return this._duration=e,this}addTrack(e){return this._tracks.push(e),this}addTracks(...e){return this._tracks.push(...e),this}buildTimeline(){return{duration:this._duration,loop:this._loop,playbackSpeed:this._playbackSpeed,tracks:this._tracks.map(e=>e.build())}}build(){let e=this.buildTimeline();return{duration:e.duration,loop:e.loop,playbackSpeed:e.playbackSpeed,tracks:e.tracks.map(t=>({id:t.id,shapeId:t.shapeId,property:t.property,enabled:t.enabled,locked:t.locked||void 0,motionPath:t.motionPath,motionPathRef:t.motionPathRef,beginTrigger:t.beginTrigger,endTrigger:t.endTrigger,cycleDuration:t.cycleDuration,cycleRepeats:t.cycleRepeats,cycleInfinite:t.cycleInfinite,cycleBehavior:t.cycleBehavior,transformOrigin:t.transformOrigin,motionRotate:t.motionRotate,additive:t.additive,keyframes:t.keyframes.map(n=>({time:n.time,value:n.value,easing:n.easing,...n.customBezier?{customBezier:n.customBezier}:{},...n.linearPoints?{linearPoints:n.linearPoints}:{}}))}))}}};var U=class{_id;_type;_state={};constructor(e,t){this._type=e,this._id=t??T()}id(e){return this._id=e,this}locked(e=!0){return this._state.locked=e,this}visible(e=!0){return this._state.visible=e,this}displayMode(e){return this._state.displayMode=e,this}motionOnly(){return this._state.displayMode="motionOnly",this}fill(e,t){return this._state.fillColor=e,this._state.fillType="solid",t!==void 0&&(this._state.fillOpacity=t),this}noFill(){return this._state.fillType="none",this}fillGradient(e){let t="build"in e?e.build():e;return this._state.fillType=t.type,this._state.fillGradient=t,this}fillPattern(e){let t="build"in e?e.build():e;return this._state.fillType="pattern",this._state.fillGradient=t,this}fillOpacity(e){return this._state.fillOpacity=e,this}fillRule(e){return this._state.fillRule=e,this}stroke(e,t){return this._state.borderColor=e,t!==void 0&&(this._state.borderWidth=t),this}noStroke(){return this._state.borderColor="none",this._state.borderWidth=0,this}strokeWidth(e){return this._state.borderWidth=e,this}strokeOpacity(e){return this._state.strokeOpacity=e,this}strokeGradient(e){let t="build"in e?e.build():e;return this._state.strokeType=t.type,this._state.strokeGradient=t,this}strokePattern(e){let t="build"in e?e.build():e;return this._state.strokeType="pattern",this._state.strokeGradient=t,this}strokeLinejoin(e){return this._state.strokeLinejoin=e,this}strokeLinecap(e){return this._state.strokeLinecap=e,this}strokeMiterlimit(e){return this._state.strokeMiterlimit=e,this}dashOffset(e){return this._state.dashOffset=e,this}strokeDasharray(e){return this._state.strokeDasharray=e,this}dash(e,t,n){return this._state.lineStyle=e,e==="custom"&&(t!==void 0&&(this._state.dashLength=t),n!==void 0&&(this._state.gapLength=n)),this}opacity(e){return this._state.opacity=e,this}rotate(e){return this._state.rotation=e,this}skew(e,t){return this._state.skewX=e,this._state.skewY=t,this}scale(e,t){return this._state.scaleX=e,this._state.scaleY=t??e,this}pivot(e,t){return this._state.customPivot={x:e,y:t},this}filter(...e){let t=this._state.filters??[];return this._state.filters=[...t,...e],this}dropShadow(e={}){let t={id:`drop-shadow-${T()}`,type:"drop-shadow",enabled:!0,offsetX:e.offsetX??4,offsetY:e.offsetY??4,blurRadius:e.blurRadius??8,spread:e.spread??0,color:e.color??"#000000",opacity:e.opacity??.3};return this.filter(t)}innerShadow(e={}){let t={id:`inner-shadow-${T()}`,type:"inner-shadow",enabled:!0,offsetX:e.offsetX??2,offsetY:e.offsetY??2,blurRadius:e.blurRadius??4,choke:e.choke??0,color:e.color??"#000000",opacity:e.opacity??.5};return this.filter(t)}blur(e,t,n){let i=e??4,a=t??i,l={id:`gaussian-blur-${T()}`,type:"gaussian-blur",enabled:!0,blurX:i,blurY:a,linked:i===a,quality:n?.quality??"normal"};return this.filter(l)}glow(e={}){let t={id:`glow-${T()}`,type:"glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(t)}innerGlow(e={}){let t={id:`inner-glow-${T()}`,type:"inner-glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(t)}grayscale(e=1){let t={id:`grayscale-${T()}`,type:"grayscale",enabled:!0,amount:e};return this.filter(t)}sepia(e=1){let t={id:`sepia-${T()}`,type:"sepia",enabled:!0,amount:e};return this.filter(t)}outline(e={}){return this.filter({id:`outline-${T()}`,type:"outline",enabled:!0,width:e.width??3,color:e.color??"#000000",opacity:e.opacity??1,position:e.position??"outside"})}motionBlur(e={}){let t={id:`motion-blur-${T()}`,type:"motion-blur",enabled:!0,distance:e.distance??10,angle:e.angle??0,quality:e.quality??"normal"};return this.filter(t)}pointLight(e={}){let t={id:`point-light-${T()}`,type:"point-light",enabled:!0,x:e.x??100,y:e.y??100,z:e.z??200,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,diffuseConstant:e.diffuseConstant??1,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(t)}spotLight(e={}){let t={id:`spot-light-${T()}`,type:"spot-light",enabled:!0,x:e.x??100,y:e.y??0,z:e.z??200,pointsAtX:e.pointsAtX??100,pointsAtY:e.pointsAtY??100,pointsAtZ:e.pointsAtZ??0,coneAngle:e.coneAngle??30,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(t)}sharpen(e=1){let t={id:`sharpen-${T()}`,type:"sharpen",enabled:!0,amount:e};return this.filter(t)}pixelate(e=8){let t={id:`pixelate-${T()}`,type:"pixelate",enabled:!0,blockSize:e};return this.filter(t)}warp(e={}){let t={id:`warp-${T()}`,type:"warp",enabled:!0,scale:e.scale??10,frequency:e.frequency??.02,octaves:e.octaves??1,warpType:e.warpType??"turbulence"};return this.filter(t)}morphology(e={}){let t=e.radiusX??2,n=e.radiusY??t,i={id:`morphology-${T()}`,type:"morphology",enabled:!0,operator:e.operator??"dilate",radiusX:t,radiusY:n,linked:e.linked??t===n};return this.filter(i)}contouring(e={}){if((e.mode??"discrete")==="table"){let i={id:`contouring-table-${T()}`,type:"contouring-table",enabled:!0,levels:e.levels??4,contrast:e.contrast??1};return this.filter(i)}let n={id:`contouring-discrete-${T()}`,type:"contouring-discrete",enabled:!0,levels:e.levels??4};return this.filter(n)}roundEdges(e=4){let t={id:`round-edges-${T()}`,type:"round-edges",enabled:!0,radius:e};return this.filter(t)}channelPainter(e={}){let t={id:`channel-painter-${T()}`,type:"channel-painter",enabled:!0,red:e.red??1,green:e.green??1,blue:e.blue??1};return this.filter(t)}brightness(e=1){let t={id:`brightness-${T()}`,type:"brightness",enabled:!0,amount:e};return this.filter(t)}contrast(e=1){let t={id:`contrast-${T()}`,type:"contrast",enabled:!0,amount:e};return this.filter(t)}filterOpacity(e=1){let t={id:`opacity-${T()}`,type:"opacity",enabled:!0,amount:e};return this.filter(t)}invert(e=1){let t={id:`invert-${T()}`,type:"invert",enabled:!0,amount:e};return this.filter(t)}hueRotate(e=0){let t={id:`hue-rotate-${T()}`,type:"hue-rotate",enabled:!0,angle:e};return this.filter(t)}saturate(e=1){let t={id:`saturate-${T()}`,type:"saturate",enabled:!0,amount:e};return this.filter(t)}blackAndWhite(e=.5){let t={id:`black-and-white-${T()}`,type:"black-and-white",enabled:!0,threshold:e};return this.filter(t)}duotone(e={}){let t={id:`duotone-${T()}`,type:"duotone",enabled:!0,shadowColor:e.shadowColor??"#000000",highlightColor:e.highlightColor??"#ffffff"};return this.filter(t)}xray(e=1){let t={id:`xray-${T()}`,type:"xray",enabled:!0,intensity:e};return this.filter(t)}noise(e={}){let t={id:`noise-${T()}`,type:"noise",enabled:!0,amount:e.amount??.3,scale:e.scale??1};return this.filter(t)}emboss(e={}){let t={id:`emboss-${T()}`,type:"emboss",enabled:!0,strength:e.strength??1,angle:e.angle??135};return this.filter(t)}filmGrain(e={}){let t={id:`film-grain-${T()}`,type:"film-grain",enabled:!0,amount:e.amount??.3,size:e.size??1};return this.filter(t)}watercolor(e={}){let t={id:`watercolor-${T()}`,type:"watercolor",enabled:!0,wetness:e.wetness??.5,turbulence:e.turbulence??.5};return this.filter(t)}gouache(e={}){let t={id:`gouache-${T()}`,type:"gouache",enabled:!0,thickness:e.thickness??.5,texture:e.texture??.5};return this.filter(t)}inkBlot(e={}){let t={id:`ink-blot-${T()}`,type:"ink-blot",enabled:!0,spread:e.spread??.5,edges:e.edges??.5};return this.filter(t)}crumpledPlastic(e={}){let t={id:`crumpled-plastic-${T()}`,type:"crumpled-plastic",enabled:!0,wrinkles:e.wrinkles??.5,shine:e.shine??.5};return this.filter(t)}riddled(e={}){let t={id:`riddled-${T()}`,type:"riddled",enabled:!0,density:e.density??.5,size:e.size??1};return this.filter(t)}cssClipPath(e){return this._state.cssClipPath=e,this}cssMaskProperties(e){return this._state.cssMaskProperties=e,this}vectorEffect(e){return this._state.vectorEffect=e,this}transformBox(e){return this._state.transformBox=e,this}paintOrder(e){return this._state.paintOrder=e,this}blendMode(e){return this._state.blendMode=e,this}visibility(e){return this._state.visibility=e,this}shapeRendering(e){return this._state.shapeRendering=e,this}filterColorInterpolation(e){return this._state.filterColorInterpolation=e,this}inheritFill(e=!0){return this._state.inheritFill=e,this}inheritStroke(e=!0){return this._state.inheritStroke=e,this}systemLanguage(e){return this._state.systemLanguage=e,this}requiredExtensions(e){return this._state.requiredExtensions=e,this}fillLibrary(e,t="linear-gradient"){return this._state.fillLibraryId=e,this._state.fillType=t,this}strokeLibrary(e,t="linear-gradient"){return this._state.strokeLibraryId=e,this._state.strokeType=t,this}filterLibrary(...e){let t=this._state.filterLibraryIds??[];return this._state.filterLibraryIds=[...t,...e],this}markerStartRef(e){return this._state.markerStart=e,this}markerMidRef(e){return this._state.markerMid=e,this}markerEndRef(e){return this._state.markerEnd=e,this}bind(e,t){let n=this._state.bindings??{};return this._state.bindings={...n,[e]:t},this}metadata(e){return this._state.metadata={...this._state.metadata,...e},this}group(e){return this._state.groupId=e,this}build(){return{id:this._id,type:this._type,state:{...this._state}}}},gt=class extends U{constructor(e,t,n){if(n<0)throw new RangeError("Circle radius must be non-negative");super("circle"),this._state.x=e,this._state.y=t,this._state.radius=n}position(e,t){return this._state.x=e,this._state.y=t,this}radius(e){return this._state.radius=e,this}},bt=class extends U{constructor(e,t,n,i){if(n<0||i<0)throw new RangeError("Ellipse radii must be non-negative");super("ellipse"),this._state.cx=e,this._state.cy=t,this._state.rx=n,this._state.ry=i}position(e,t){return this._state.cx=e,this._state.cy=t,this}radii(e,t){return this._state.rx=e,this._state.ry=t,this}},yt=class extends U{constructor(e,t,n,i){if(n<0||i<0)throw new RangeError("Rectangle dimensions must be non-negative");super("rectangle"),this._state.x=e,this._state.y=t,this._state.width=n,this._state.height=i}position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,t){return this._state.rx=e,this._state.ry=t,e===t&&(this._state.cornerRadius=e),this}},$t=class extends U{constructor(e,t,n){if(n<0)throw new RangeError("Square size must be non-negative");super("square"),this._state.x=e,this._state.y=t,this._state.width=n,this._state.height=n}position(e,t){return this._state.x=e,this._state.y=t,this}size(e){return this._state.width=e,this._state.height=e,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,t){return this._state.rx=e,this._state.ry=t,e===t&&(this._state.cornerRadius=e),this}},xt=class extends U{constructor(e,t,n,i){super("line"),this._state.x1=e,this._state.y1=t,this._state.x2=n,this._state.y2=i}from(e,t){return this._state.x1=e,this._state.y1=t,this}to(e,t){return this._state.x2=e,this._state.y2=t,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},St=class extends U{constructor(e,t,n){super("text"),this._state.x=e,this._state.y=t,this._state.text=n}position(e,t){return this._state.x=e,this._state.y=t,this}content(e){return this._state.text=e,this}fontSize(e){return this._state.fontSize=e,this}fontFamily(e){return this._state.fontFamily=e,this}fontWeight(e){return this._state.fontWeight=e,this}fontStyle(e){return this._state.fontStyle=e,this}anchor(e){return this._state.textAnchor=e,this}letterSpacing(e){return this._state.letterSpacing=e,this}lineHeight(e){return this._state.lineHeight=e,this}decoration(e){return this._state.textDecoration=e,this}transform(e){return this._state.textTransform=e,this}textPath(e,t=0){return this._state.isTextPath=!0,this._state.textPathPoints=e,this._state.textPathStartOffset=t,this}textPathOffset(e){return this._state.textPathStartOffset=e,this}textPathSide(e){return this._state.textPathSide=e,this}direction(e){return this._state.textDirection=e,this}unicodeBidi(e){return this._state.unicodeBidi=e,this}dominantBaseline(e){return this._state.dominantBaseline=e,this}writingMode(e){return this._state.writingMode=e,this}wordSpacing(e){return this._state.wordSpacing=e,this}baselineShift(e){return this._state.baselineShift=e,this}inlineSize(e){return this._state.inlineSize=e,this}overflowWrap(e){return this._state.overflowWrap=e,this}whiteSpace(e){return this._state.whiteSpace=e,this}fontVariationSettings(e){return this._state.fontVariationSettings=e,this}charOffsets(e){return this._state.charOffsets=e,this}shapeInsideRef(e){return this._state.shapeInsideRef=e,this}shapePadding(e){return this._state.shapePadding=e,this}richTextData(e){return this._state.richTextData=e,this}useRichText(e=!0){return this._state.useRichText=e,this}linePositions(e){return this._state.linePositions=e,this}textLength(e){return this._state.textLength=e,this}lengthAdjust(e){return this._state.lengthAdjust=e,this}},W=class extends U{constructor(e,t,n,i){super(e),this._state.cx=t,this._state.cy=n,this._state.radius=i}position(e,t){return this._state.cx=e,this._state.cy=t,this}radius(e){return this._state.radius=e,this}shiftAngle(e){return this._state.shiftAngle=e,this}cornerRadius(e){return this._state.cornerRadius=e,this}},kt=class extends W{constructor(e,t,n){super("triangle",e,t,n)}},_t=class extends W{constructor(e,t,n,i=5){super("ngon",e,t,n),this._state.sides=i}sides(e){return this._state.sides=e,this}},vt=class extends W{constructor(e,t,n){super("star",e,t,n),this._state.arms=5,this._state.innerRadiusPercent=40}arms(e){return this._state.arms=e,this}innerRadius(e){return this._state.innerRadiusPercent=e,this}},wt=class extends W{constructor(e,t,n){super("cross",e,t,n),this._state.armWidthPercent=35}armWidth(e){return this._state.armWidthPercent=e,this}},Pt=class extends W{constructor(e,t,n){super("ring",e,t,n),this._state.innerRadiusPercent=60}innerRadius(e){return this._state.innerRadiusPercent=e,this}},Tt=class extends W{constructor(e,t,n){super("spiral",e,t,n),this._state.turns=3,this._state.thicknessPercent=15,this._state.spiralDirection=1}turns(e){return this._state.turns=e,this}thickness(e){return this._state.thicknessPercent=e,this}direction(e){return this._state.spiralDirection=e,this}},Ft=class extends W{constructor(e,t,n){super("gear",e,t,n),this._state.teeth=8,this._state.toothDepthPercent=25}teeth(e){return this._state.teeth=e,this}toothDepth(e){return this._state.toothDepthPercent=e,this}holeRadius(e){return this._state.holeRadiusPercent=e,this}},Rt=class extends W{constructor(e,t,n){super("arrow",e,t,n),this._state.headWidthPercent=100,this._state.headLengthPercent=35,this._state.shaftWidthPercent=35}headWidth(e){return this._state.headWidthPercent=e,this}headLength(e){return this._state.headLengthPercent=e,this}shaftWidth(e){return this._state.shaftWidthPercent=e,this}},Mt=class extends W{constructor(e,t,n){super("heart",e,t,n),this._state.lobeRadiusPercent=50,this._state.cleftDepthPercent=25}lobeRadius(e){return this._state.lobeRadiusPercent=e,this}cleftDepth(e){return this._state.cleftDepthPercent=e,this}},Ct=class extends W{constructor(e,t,n){super("lightning",e,t,n),this._state.boltSegments=3,this._state.boltJaggednessPercent=40,this._state.boltWidthPercent=30}segments(e){return this._state.boltSegments=e,this}jaggedness(e){return this._state.boltJaggednessPercent=e,this}thickness(e){return this._state.boltWidthPercent=e,this}},At=class extends W{constructor(e,t,n){super("cloud",e,t,n),this._state.cloudBumps=5,this._state.cloudPuffinessPercent=60}bumps(e){return this._state.cloudBumps=e,this}puffiness(e){return this._state.cloudPuffinessPercent=e,this}},It=class extends W{constructor(e,t,n){super("speechBubble",e,t,n),this._state.tailAngleDeg=45,this._state.tailLengthPercent=40,this._state.tailWidthPercent=25}tailAngle(e){return this._state.tailAngleDeg=e,this}tailLength(e){return this._state.tailLengthPercent=e,this}tailWidth(e){return this._state.tailWidthPercent=e,this}},ie=class extends U{add(e){let t="build"in e&&typeof e.build=="function"?e.build():e,n=this._state.children??[];return this._state.children=[...n,t],this}addAll(...e){for(let t of e)this.add(t);return this}children(e){return this._state.children=e.map(t=>"build"in t&&typeof t.build=="function"?t.build():t),this}},Lt=class extends ie{constructor(e){super("hyperlink"),e!==void 0&&(this._state.href=e)}href(e){return this._state.href=e,this}hrefXlink(e){return this._state.hrefXlink=e,this}target(e){return this._state.linkTarget=e,this}download(e){return this._state.linkDownload=e,this}rel(e){return this._state.linkRel=e,this}ping(e){return this._state.linkPing=e,this}hreflang(e){return this._state.linkHreflang=e,this}type(e){return this._state.linkType=e,this}referrerPolicy(e){return this._state.linkReferrerPolicy=e,this}},Dt=class extends ie{constructor(){super("switch")}},Bt=class extends ie{constructor(){super("container")}},Et=class extends U{constructor(e){super("view"),e&&(this._state.viewBoxX=e.x,this._state.viewBoxY=e.y,this._state.viewBoxWidth=e.width,this._state.viewBoxHeight=e.height)}viewBox(e,t,n,i){return this._state.viewBoxX=e,this._state.viewBoxY=t,this._state.viewBoxWidth=n,this._state.viewBoxHeight=i,this}name(e){return this._state.viewName=e,this}preserveAspectRatio(e){return this._state.viewPreserveAspectRatio=e,this}zoomAndPan(e){return this._state.viewZoomAndPan=e,this}viewTarget(e){return this._state.viewTarget=e,this}asHome(e=!0){return this._state.isHomeView=e,this}},Ot=class extends ie{constructor(e=0,t=0,n=100,i=100){super("svg"),this._state.svgX=e,this._state.svgY=t,this._state.svgWidth=n,this._state.svgHeight=i}position(e,t){return this._state.svgX=e,this._state.svgY=t,this}size(e,t){return this._state.svgWidth=e,this._state.svgHeight=t,this}viewBox(e,t,n,i){return this._state.svgViewBoxX=e,this._state.svgViewBoxY=t,this._state.svgViewBoxWidth=n,this._state.svgViewBoxHeight=i,this}preserveAspectRatio(e){return this._state.svgPreserveAspectRatio=e,this}asRoot(e=!0){return this._state.isRootSvg=e,this}},Gt=class extends U{constructor(e){super("shape-reference"),e!==void 0&&(this._state.targetShapeId=e)}target(e){return this._state.targetShapeId=e,this}offset(e,t){return this._state.offsetX=e,this._state.offsetY=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}},Ut=class extends U{position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}src(e){return this._state.href=e,this}mimeType(e){return this._state.mediaMimeType=e,this}naturalDuration(e){return this._state.naturalDuration=e,this}begin(e){return this._state.begin=e,this}trim(e,t){return this._state.trimStart=e,this._state.trimEnd=t,this}volume(e){return this._state.volume=e,this}muted(e=!0){return this._state.muted=e,this}loop(e=!0){return this._state.loop=e,this}playbackRate(e){return this._state.playbackRate=e,this}fade(e,t){return this._state.fadeInDuration=e,this._state.fadeOutDuration=t,this}language(e){return this._state.systemLanguage=e,this}},zt=class extends Ut{constructor(e){super("video"),this._state.mediaKind="video",e!==void 0&&(this._state.href=e)}poster(e){return this._state.posterHref=e,this}sourceRect(e){return this._state.sourceRect=e,this}},Nt=class extends Ut{constructor(e){super("audio"),this._state.mediaKind="audio",e!==void 0&&(this._state.href=e)}},Vt=class extends U{constructor(e=[]){super("path"),this._state.pathPoints=[...e],this._state.pathCurveType="cubic",this._state.pathClosed=!1}points(e){return this._state.pathPoints=[...e],this}addPoint(e,t){let n=this._state.pathPoints??[];return n.push({x:e,y:t}),this._state.pathPoints=n,this}curveType(e){return this._state.pathCurveType=e,this}closed(e=!0){return this._state.pathClosed=e,this}tension(e){return this._state.pathTension=e,this}arcParams(e){return this._state.pathArcParams=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}toD(){let e=this._state.pathPoints??[],t=this._state.pathCurveType??"CUBIC",n=this._state.pathClosed??!1,i=this._state.pathTension??.5,a=this._state.pathArcParams;return de(e,t,n,i,a)}},Ht=class extends U{constructor(e=[]){super("polyline"),this._state.polylinePoints=[...e],this._state.polylineClosed=!1}points(e){return this._state.polylinePoints=[...e],this}addPoint(e,t){let n=this._state.polylinePoints??[];return n.push({x:e,y:t}),this._state.polylinePoints=n,this}closed(e=!0){return this._state.polylineClosed=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},Wt=class extends U{constructor(e,t,n,i,a){super("image"),this._state.x=e,this._state.y=t,this._state.width=n,this._state.height=i,this._state.href=a}position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}src(e){return this._state.href=e,this}preserveAspectRatio(e){return this._state.preserveAspectRatio=e,this}};var Se=class{_x1;_y1;_x2;_y2;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(e=0,t=0,n=1,i=0){this._x1=e,this._y1=t,this._x2=n,this._y2=i,this._id=T()}stop(e,t,n=1){return this._stops.push({offset:e,color:t,opacity:n}),this}direction(e,t,n,i){return this._x1=e,this._y1=t,this._x2=n,this._y2=i,this}spread(e){return this._spreadMethod=e,this}opacity(e){return this._opacity=e,this}build(){return{type:"linear-gradient",id:this._id,x1:this._x1,y1:this._y1,x2:this._x2,y2:this._y2,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},ke=class{_cx=.5;_cy=.5;_fx=.5;_fy=.5;_r=.5;_ry=.5;_rotation=0;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(){this._id=T()}center(e,t){return this._cx=e,this._cy=t,this}focus(e,t){return this._fx=e,this._fy=t,this}radius(e,t){return this._r=e,this._ry=t??e,this}rotation(e){return this._rotation=e,this}stop(e,t,n=1){return this._stops.push({offset:e,color:t,opacity:n}),this}spread(e){return this._spreadMethod=e,this}opacity(e){return this._opacity=e,this}build(){return{type:"radial-gradient",id:this._id,cx:this._cx,cy:this._cy,fx:this._fx,fy:this._fy,r:this._r,ry:this._ry,rotation:this._rotation,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},_e=class{_patternType;_color;_backgroundColor;_scale=1;_rotation=0;_opacity=1;_patternParams;_id;_svgContent;_width;_height;_patternUnits;_patternContentUnits;_patternTransform;_viewBox;_preserveAspectRatio;_x;_y;_customPatternId;constructor(e="stripes",t="#000000",n="#ffffff"){this._patternType=e,this._color=t,this._backgroundColor=n,this._id=T()}scale(e){return this._scale=e,this}rotation(e){return this._rotation=e,this}opacity(e){return this._opacity=e,this}params(e){return this._patternParams=e,this}svgContent(e){return this._svgContent=e,this}size(e,t){return this._width=e,this._height=t,this}patternUnits(e){return this._patternUnits=e,this}patternContentUnits(e){return this._patternContentUnits=e,this}patternTransform(e){return this._patternTransform=e,this}viewBox(e){return this._viewBox=e,this}preserveAspectRatio(e){return this._preserveAspectRatio=e,this}position(e,t){return this._x=e,this._y=t,this}customPatternId(e){return this._customPatternId=e,this}build(){let e,t,n;if(this._svgContent!==void 0)e=this._svgContent,t=this._width??10,n=this._height??10;else{let a=tt(this._patternType,this._scale,this._color,this._backgroundColor,this._patternParams);e=a.svgContent,t=this._width??a.width,n=this._height??a.height}let i={type:"pattern",id:this._id,patternType:this._svgContent!==void 0?"custom":this._patternType,color:this._color,backgroundColor:this._backgroundColor,scale:this._scale,rotation:this._rotation,opacity:this._opacity,svgContent:e,width:t,height:n,patternUnits:this._patternUnits??"userSpaceOnUse",patternParams:this._patternParams,patternTransform:this._patternTransform??(this._rotation?`rotate(${this._rotation})`:void 0)};return this._patternContentUnits&&(i.patternContentUnits=this._patternContentUnits),this._viewBox&&(i.viewBox=this._viewBox),this._preserveAspectRatio&&(i.preserveAspectRatio=this._preserveAspectRatio),this._x!==void 0&&(i.x=this._x),this._y!==void 0&&(i.y=this._y),this._customPatternId&&(i.customPatternId=this._customPatternId),i}};function nn(r=0,e=0,t=1,n=0){return new Se(r,e,t,n)}function sn(){return new ke}function an(r="stripes",e="#000000",t="#ffffff"){return new _e(r,e,t)}var Fr={rows:4,cols:4,style:"classic",tabDepthPercent:20,tabPattern:"random",seed:1},zs=.04,Ns=0;function Vs(r){let e=r>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function R(r){return Number(r.toFixed(3)).toString()}function Hs(r,e,t,n,i,a,l,o,u,c,h,d){return[[0,0],[.2,o],[.5+u+h,-a+c],[.5-a+u,a+c],[.5-2*a+u-h,3*a+c],[.5+2*a+u-h,3*a+c],[.5+a+u,a+c],[.5+u+h,-a+c],[.8,d],[1,0]].map(([m,b])=>{let g=e+m*n,x=t+b*i*l;return r?{x:g,y:x}:{x,y:g}})}function on(r,e,t,n,i,a,l,o,u,c,h){let d=[],f=(w,F)=>u==="alternating"?0:w+c()*(F-w),m=()=>c()<.5,b=f(-o,o),g=u==="alternating"?h%2===0:m(),x=null,v=b,_=f(-o,o),S=f(-o,o),$=f(-o,o);b=f(-o,o);for(let w=0;w<r;w++){w>0&&(x=g,g=u==="alternating"?(h+w)%2===0:m(),v=g===x?-b:b,_=f(-o,o),S=f(-o,o),$=f(-o,o),b=f(-o,o));let F=g?-1:1,y=t+w*i;d.push(Hs(e,y,n,i,a,l,F,v,_,S,$,b))}return d}function ln(r,e,t,n,i,a,l){let o=2*a;return[[0,0],[.2,0],[.4,0],[.4,o],[.4,o],[.6,o],[.6,o],[.6,0],[.8,0],[1,0]].map(([c,h])=>{let d=e+c*n,f=t+h*i*l;return r?{x:d,y:f}:{x:f,y:d}})}function un(r,e){return r+` C ${R(e[1].x)} ${R(e[1].y)} ${R(e[2].x)} ${R(e[2].y)} ${R(e[3].x)} ${R(e[3].y)} C ${R(e[4].x)} ${R(e[4].y)} ${R(e[5].x)} ${R(e[5].y)} ${R(e[6].x)} ${R(e[6].y)} C ${R(e[7].x)} ${R(e[7].y)} ${R(e[8].x)} ${R(e[8].y)} ${R(e[9].x)} ${R(e[9].y)}`}function cn(r,e){return r+` C ${R(e[8].x)} ${R(e[8].y)} ${R(e[7].x)} ${R(e[7].y)} ${R(e[6].x)} ${R(e[6].y)} C ${R(e[5].x)} ${R(e[5].y)} ${R(e[4].x)} ${R(e[4].y)} ${R(e[3].x)} ${R(e[3].y)} C ${R(e[2].x)} ${R(e[2].y)} ${R(e[1].x)} ${R(e[1].y)} ${R(e[0].x)} ${R(e[0].y)}`}function dn(r,e={}){let t={...Fr,...e};if(t.rows<1||t.cols<1)throw new Error("generatePuzzlePieces: rows and cols must be >= 1");if(!Number.isFinite(r.width)||!Number.isFinite(r.height))throw new Error("generatePuzzlePieces: bounds must have finite width/height");if(r.width<=0||r.height<=0)throw new Error("generatePuzzlePieces: bounds must have positive width/height");let{rows:n,cols:i,style:a,tabDepthPercent:l,tabPattern:o,seed:u}=t,c=Vs(u),h=r.width/i,d=r.height/n,f=Math.max(0,Math.min(.4,l/200)),m=(a==="classic"||a==="curved")&&f>0,b=a==="square-tabs"&&f>0,g=a==="classic"&&o==="random"?zs:Ns,x=[];for(let S=0;S<n-1;S++){let $=r.y+(S+1)*d;if(m)x.push(on(i,!0,r.x,$,h,d,f,g,o,c,S));else if(b){let w=[];for(let F=0;F<i;F++){let y=o==="alternating"?(S+F)%2===0?1:-1:c()<.5?1:-1;w.push(ln(!0,r.x+F*h,$,h,d,f,y))}x.push(w)}else x.push(new Array(i).fill(null))}let v=[];for(let S=0;S<i-1;S++){let $=r.x+(S+1)*h;if(m)v.push(on(n,!1,r.y,$,d,h,f,g,o,c,S));else if(b){let w=[];for(let F=0;F<n;F++){let y=o==="alternating"?(F+S)%2===0?1:-1:c()<.5?1:-1;w.push(ln(!1,r.y+F*d,$,d,h,f,y))}v.push(w)}else v.push(new Array(n).fill(null))}let _=[];for(let S=0;S<n;S++)for(let $=0;$<i;$++){let w=r.x+$*h,F=r.y+S*d,y=w+h,k=F+d,P=`M ${R(w)} ${R(F)}`;if(S===0)P+=` L ${R(y)} ${R(F)}`;else{let I=x[S-1][$];I?P=un(P,I):P+=` L ${R(y)} ${R(F)}`}if($===i-1)P+=` L ${R(y)} ${R(k)}`;else{let I=v[$][S];I?P=un(P,I):P+=` L ${R(y)} ${R(k)}`}if(S===n-1)P+=` L ${R(w)} ${R(k)}`;else{let I=x[S][$];I?P=cn(P,I):P+=` L ${R(w)} ${R(k)}`}if($===0)P+=` L ${R(w)} ${R(F)}`;else{let I=v[$-1][S];I?P=cn(P,I):P+=` L ${R(w)} ${R(F)}`}P+=" Z",_.push({id:`puzzle-${u}-r${S}-c${$}`,row:S,col:$,d:P})}return _}0&&(module.exports={Arrow,Audio,BUILTIN_MARKER_ID_MAP,CURRENT_SCHEMA_VERSION,Circle,Cloud,Container,ContainerShapeBuilder,Cross,DEFAULT_COORDINATE_PRECISION,Document,EASING_CURVES,EVENT_TRIGGER_OPTIONS,EasingType,Ellipse,Gear,Heart,Hyperlink,ImageShape,LIBRARY_EMIT_ORDER,Lightning,Line,LinearGradientBuilder,MARKER_HEIGHT,MARKER_VIEWBOX,MARKER_WIDTH,MAX_COORDINATE_PRECISION,MIGRATIONS,NGon,NestedSvg,PUZZLE_DEFAULTS,Path,PathCurveType,PathPointType,PatternBuilder,Polyline,RadialGradientBuilder,Rectangle,Ring,ShapeBuilder,ShapeReference,SpeechBubble,Spiral,Square,Star,Switch,Text,Timeline,Track,Triangle,Video,View,collectReferencedLibraryIds,computeArrowVertices,computeCloudPath,computeCrossVertices,computeDashArray,computeGearPath,computeGearVertices,computeHeartPath,computeLightningVertices,computePolygonVertices,computeRectanglePath,computeRingPath,computeSpeechBubbleVertices,computeSpiralPath,computeSplinePath,computeStarVertices,createDocument,createShape,createViewbox,defaultVariableMode,escXml,extractVariables,filterAttr,generateCode,generateCssCode,generateD3Code,generateId,generatePatternSvgContent,generatePuzzlePieces,generateReactCode,generateSvgCode,generateVueCode,getBuiltInMarkerDefs,getEasingCubicBezier,getEffectivePrecision,getMarkerDescriptors,getPatternElements,linearGradient,migrateSnapshot,parseDocument,parseVariableArgs,pattern,radialGradient,renderAnimationElements,renderBuiltinMarkerDefs,renderCircle,renderEllipse,renderFilterDefs,renderFilterLibraryDef,renderFilterPrimitive,renderFilterPrimitivesForType,renderImage,renderLibraryDef,renderLibraryDefs,renderLine,renderLinearGradientLibraryDef,renderMarkerLibraryDef,renderPatternLibraryDef,renderPolygonShape,renderPolyline,renderRadialGradientLibraryDef,renderRectangle,renderReferencedLibraryDefs,renderShape,renderSpline,renderSvgPrimitiveChainFilter,renderSymbolLibraryDef,renderText,renderToSvg,roundCoord,roundNumberString,roundSerializedShape,roundSnapshot,stringifyDocument,substituteString,substituteVariables,validateSnapshot,verticesToPath});
14
+ }`)}let l=[];for(let u=0;u<i.length;u++){let c=i[u],h=pn(c,u),d=N(c),p=d.indexOf(" ");p!==-1&&(d=d.slice(0,p)+` class="${h}"`+d.slice(p)),l.push(`${n}${d}`)}let o=[];o.push("<style>");for(let u of a)o.push(u);o.push("</style>"),o.push(""),o.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${t.width}" height="${t.height}" viewBox="0 0 ${t.width} ${t.height}">`);for(let u of l)o.push(u);return o.push("</svg>"),o.push(""),o.join(`
15
+ `)}function mt(r,e){let t=ca(r,e),n={...e};switch(n.format){case"svg":return ct(t,n);case"react":return dt(t,n);case"vue":return ht(t,n);case"d3":return ft(t,n);case"css":return pt(t,n);default:throw new Error(`Unsupported code format: ${n.format}`)}}function ca(r,e){return Array.isArray(r)?{shapes:r,viewboxes:[{id:"default",x:0,y:0,width:e.width??800,height:e.height??600}]}:r}var gt=class r{_snapshot;constructor(e={}){let{width:t=800,height:n=600,viewboxId:i}=e,a=be(0,0,t,n,i);this._snapshot=Ce({viewboxes:[a]})}static fromSnapshot(e){let t=new r;return t._snapshot=JSON.parse(JSON.stringify(e)),t}static fromJSON(e,t){let n=Ie(e,t),i=new r;return i._snapshot=n,i}add(e){let t="build"in e&&typeof e.build=="function"?e.build():e;return this._snapshot.shapes.push(t),this}addAll(...e){for(let t of e)this.add(t);return this}remove(e){let t=this._snapshot.shapes.length;return this._snapshot.shapes=this._snapshot.shapes.filter(n=>n.id!==e),this._snapshot.shapes.length<t}get shapes(){return this._snapshot.shapes}findShape(e){return this._snapshot.shapes.find(t=>t.id===e)}size(e,t){return this._snapshot.viewboxes.length>0?(this._snapshot.viewboxes[0].width=e,this._snapshot.viewboxes[0].height=t):this._snapshot.viewboxes=[be(0,0,e,t)],this}get width(){return this._snapshot.viewboxes[0]?.width??800}get height(){return this._snapshot.viewboxes[0]?.height??600}title(e){return this._ensureMetadata(),this._snapshot.documentMetadata.title=e,this}description(e){return this._ensureMetadata(),this._snapshot.documentMetadata.description=e,this}author(e){return this._ensureMetadata(),this._snapshot.documentMetadata.author=e,this}keywords(...e){return this._ensureMetadata(),this._snapshot.documentMetadata.keywords=e,this}license(e,t){return this._ensureMetadata(),this._snapshot.documentMetadata.license=e,t!==void 0&&(this._snapshot.documentMetadata.licenseUrl=t),this}language(e){return this._ensureMetadata(),this._snapshot.documentMetadata.language=e,this}customMetadata(e){return this._ensureMetadata(),this._snapshot.documentMetadata.customMetadata={...this._snapshot.documentMetadata.customMetadata,...e},this}get meta(){return this._snapshot.documentMetadata}defineSymbol(e,t,n){this._snapshot.symbols||(this._snapshot.symbols=[]);let i=T(),a=t.map(o=>"build"in o&&typeof o.build=="function"?o.build():o),l={kind:"symbol",id:i,name:e,viewBox:n?.viewBox??"0 0 100 100",shapes:a};return n?.groups&&(l.groups=n.groups),n?.thumbnail&&(l.thumbnail=n.thumbnail),n?.defKind&&(l.defKind=n.defKind),n?.wrapperAttrs&&(l.wrapperAttrs=n.wrapperAttrs),n?.variantAxes&&(l.variantAxes=n.variantAxes),n?.variants&&(l.variants=n.variants),n?.variantThumbnails&&(l.variantThumbnails=n.variantThumbnails),this._snapshot.symbols.push(l),i}placeSymbolInstance(e,t,n,i,a){let l,o={};typeof i=="number"||i===void 0?l=i:(o=i,l=o.width,a=o.height??a);let u={symbolId:e,x:t,y:n,width:l??100,height:a??100};o.variantKey&&(u.variantKey=o.variantKey),o.symbolOverrides&&(u.symbolOverrides=o.symbolOverrides),o.instancePresentation&&(u.instancePresentation=o.instancePresentation);let c={id:T(),type:"symbol-instance",state:u};return this._snapshot.shapes.push(c),this}removeSymbol(e){if(!this._snapshot.symbols)return!1;let t=this._snapshot.symbols.length;return this._snapshot.symbols=this._snapshot.symbols.filter(n=>n.id!==e),this._snapshot.symbols.length<t}get symbols(){return this._snapshot.symbols??[]}defineMarker(e,t,n){let i=T(),a=t.map(o=>"build"in o&&typeof o.build=="function"?o.build():o),l={kind:"marker",id:i,name:e,viewBox:n?.viewBox??"0 0 10 10",refX:n?.refX??5,refY:n?.refY??5,markerWidth:n?.markerWidth??10,markerHeight:n?.markerHeight??10,markerUnits:n?.markerUnits??"strokeWidth",orient:n?.orient??"auto",shapes:a};return n?.groups&&(l.groups=n.groups),n?.thumbnail&&(l.thumbnail=n.thumbnail),this._pushLibraryDef(l),i}defineFilter(e,t,n){let i=T(),a={kind:"filter",id:i,name:e,filters:t};return n?.colorInterpolation&&(a.colorInterpolation=n.colorInterpolation),n?.filterUnits&&(a.filterUnits=n.filterUnits),n?.primitiveUnits&&(a.primitiveUnits=n.primitiveUnits),n?.x!==void 0&&(a.x=n.x),n?.y!==void 0&&(a.y=n.y),n?.width!==void 0&&(a.width=n.width),n?.height!==void 0&&(a.height=n.height),n?.thumbnail&&(a.thumbnail=n.thumbnail),this._pushLibraryDef(a),i}defineLinearGradientLibrary(e,t,n){let i=T(),a="build"in t?t.build():t,{id:l,sourceId:o,...u}=a,c={kind:"linear-gradient",id:i,name:e,gradient:u};return n?.thumbnail&&(c.thumbnail=n.thumbnail),this._pushLibraryDef(c),i}defineRadialGradientLibrary(e,t,n){let i=T(),a="build"in t?t.build():t,{id:l,sourceId:o,...u}=a,c={kind:"radial-gradient",id:i,name:e,gradient:u};return n?.thumbnail&&(c.thumbnail=n.thumbnail),this._pushLibraryDef(c),i}definePatternLibrary(e,t,n){let i=T(),a="build"in t?t.build():t,{id:l,sourceId:o,customPatternId:u,...c}=a,h={kind:"pattern",id:i,name:e,pattern:c};return n?.thumbnail&&(h.thumbnail=n.thumbnail),this._pushLibraryDef(h),i}removeLibraryDef(e){if(!this._snapshot.library)return!1;let t=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(n=>n.id!==e),this._snapshot.library.length<t}get library(){return this._snapshot.library??[]}_pushLibraryDef(e){this._snapshot.library||(this._snapshot.library=[]);let t=this._snapshot.library.findIndex(n=>n.id===e.id);t>=0?this._snapshot.library[t]=e:this._snapshot.library.push(e)}addClipGroup(e,t,n){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=T(),a={id:i,type:"clip",clipShapeIds:e,contentShapeIds:t,parentId:null};return n?.clipPathUnits&&(a.clipPathUnits=n.clipPathUnits),n?.rawDefinition&&(a.rawDefinition=n.rawDefinition),this._snapshot.clipMaskGroups.push(a),i}addMaskGroup(e,t,n){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=T(),a={id:i,type:"mask",clipShapeIds:e,contentShapeIds:t,parentId:null};return n?.maskUnits&&(a.maskUnits=n.maskUnits),n?.maskContentUnits&&(a.maskContentUnits=n.maskContentUnits),n?.maskBounds&&(a.maskBounds=n.maskBounds),n?.maskType&&(a.maskType=n.maskType),n?.rawDefinition&&(a.rawDefinition=n.rawDefinition),this._snapshot.clipMaskGroups.push(a),i}removeClipMaskGroup(e){if(!this._snapshot.clipMaskGroups)return!1;let t=this._snapshot.clipMaskGroups.length;return this._snapshot.clipMaskGroups=this._snapshot.clipMaskGroups.filter(n=>n.id!==e),this._snapshot.clipMaskGroups.length<t}addGuide(e,t,n){this._snapshot.guides||(this._snapshot.guides=[]);let i=T(),a={id:i,orientation:e,position:t,controlPointOffset:0};return n?.color&&(a.color=n.color),n?.opacity!==void 0&&(a.opacity=n.opacity),this._snapshot.guides.push(a),i}removeGuide(e){if(!this._snapshot.guides)return!1;let t=this._snapshot.guides.length;return this._snapshot.guides=this._snapshot.guides.filter(n=>n.id!==e),this._snapshot.guides.length<t}clearGuides(){return this._snapshot.guides=[],this}get guides(){return this._snapshot.guides??[]}addMeasurement(e,t,n){this._snapshot.measurements||(this._snapshot.measurements=[]);let i=T(),a={id:i,type:e,points:t,visible:n?.visible??!0,snapDivisions:n?.snapDivisions??1};return n?.color&&(a.color=n.color),n?.opacity!==void 0&&(a.opacity=n.opacity),this._snapshot.measurements.push(a),i}removeMeasurement(e){if(!this._snapshot.measurements)return!1;let t=this._snapshot.measurements.length;return this._snapshot.measurements=this._snapshot.measurements.filter(n=>n.id!==e),this._snapshot.measurements.length<t}get measurements(){return this._snapshot.measurements??[]}addCustomPattern(e,t,n,i){this._snapshot.customPatterns||(this._snapshot.customPatterns=[]);let a=T();return this._snapshot.customPatterns.push({id:a,name:e,svgContent:t,width:n,height:i}),a}removeCustomPattern(e){if(!this._snapshot.customPatterns)return!1;let t=this._snapshot.customPatterns.length;return this._snapshot.customPatterns=this._snapshot.customPatterns.filter(n=>n.id!==e),this._snapshot.customPatterns.length<t}get customPatterns(){return this._snapshot.customPatterns??[]}addGroup(e,t){this._snapshot.groups||(this._snapshot.groups=[]);let n=e??T();return this._snapshot.groups.push({id:n,parentId:t??null}),n}removeGroup(e){if(!this._snapshot.groups)return!1;let t=this._snapshot.groups.length;this._snapshot.groups=this._snapshot.groups.filter(n=>n.id!==e);for(let n of this._snapshot.shapes)n.state.groupId===e&&delete n.state.groupId;return this._snapshot.groups.length<t}moveToGroup(e,t){let n=this._snapshot.shapes.find(i=>i.id===e);return n&&(n.state.groupId=t),this}removeFromGroup(e){let t=this._snapshot.shapes.find(n=>n.id===e);return t&&delete t.state.groupId,this}bringToFront(e){let t=this._snapshot.shapes.findIndex(n=>n.id===e);if(t>=0){let[n]=this._snapshot.shapes.splice(t,1);this._snapshot.shapes.push(n)}return this}sendToBack(e){let t=this._snapshot.shapes.findIndex(n=>n.id===e);if(t>=0){let[n]=this._snapshot.shapes.splice(t,1);this._snapshot.shapes.unshift(n)}return this}reorder(e,t){let n=this._snapshot.shapes.findIndex(i=>i.id===e);if(n>=0){let[i]=this._snapshot.shapes.splice(n,1),a=Math.max(0,Math.min(t,this._snapshot.shapes.length));this._snapshot.shapes.splice(a,0,i)}return this}defineVariable(e,t,n,i){this._snapshot.templateVariables||(this._snapshot.templateVariables=[]);let a=this._snapshot.templateVariables.find(l=>l.name===e);if(a)a.type=t,a.defaultValue=n,i?.label!==void 0&&(a.label=i.label),i?.description!==void 0&&(a.description=i.description);else{let l={name:e,type:t,defaultValue:n};i?.label!==void 0&&(l.label=i.label),i?.description!==void 0&&(l.description=i.description),this._snapshot.templateVariables.push(l)}return this}removeVariable(e){return this._snapshot.templateVariables&&(this._snapshot.templateVariables=this._snapshot.templateVariables.filter(t=>t.name!==e)),this}get variables(){return this._snapshot.templateVariables??[]}inspectVariables(){return Oe(this._snapshot)}setTimeline(e){return"build"in e&&typeof e.build=="function"?this._snapshot.animationTimeline=e.build():this._snapshot.animationTimeline=e,this}clearTimeline(){return delete this._snapshot.animationTimeline,this}get timeline(){return this._snapshot.animationTimeline}toSVG(e){let{variables:t,...n}=e??{},i=De(this._snapshot,t);return pe(i,n)}toJSON(e){return Ae(this._snapshot,e)}toSnapshot(){return JSON.parse(JSON.stringify(this._snapshot))}toCode(e,t){return mt(this._snapshot,{...t,format:e})}_ensureMetadata(){this._snapshot.documentMetadata||(this._snapshot.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{}})}};var bt=class{_track;constructor(e,t){this._track={id:T(),shapeId:e,property:t,keyframes:[],enabled:!0,locked:!1}}id(e){return this._track.id=e,this}keyframe(e,t,n="linear"){return this._track.keyframes.push({time:e,value:t,easing:n}),this}keyframeBezier(e,t,n){return this._track.keyframes.push({time:e,value:t,easing:"custom-bezier",customBezier:n}),this}keyframeLinear(e,t,n){return this._track.keyframes.push({time:e,value:t,easing:"linear-function",linearPoints:n}),this}keyframes(...e){return this._track.keyframes.push(...e),this}disabled(){return this._track.enabled=!1,this}locked(){return this._track.locked=!0,this}motionPath(e){return this._track.motionPath=e,this}motionPathRef(e,t="trackShape"){return this._track.motionPathRef={shapeId:e,mode:t},this}beginTrigger(e,t){return this._track.beginTrigger={type:e,value:t},this}endTrigger(e,t){return this._track.endTrigger={type:e,value:t},this}cycleDuration(e){return this._track.cycleDuration=e,this}cycleRepeats(e){return this._track.cycleRepeats=e,this}infinite(){return this._track.cycleInfinite=!0,this}cycle(e){return this._track.cycleBehavior=e,this}transformOrigin(e,t){return this._track.transformOrigin={x:e,y:t},this}motionRotate(e){return this._track.motionRotate=e,this}additive(e){return this._track.additive=e,this}build(){let e=[...this._track.keyframes].sort((t,n)=>t.time-n.time);return{...this._track,keyframes:e}}},yt=class{_duration;_loop=!1;_playbackSpeed=1;_tracks=[];constructor(e){this._duration=e}loop(e=!0){return this._loop=e,this}speed(e){return this._playbackSpeed=e,this}duration(e){return this._duration=e,this}addTrack(e){return this._tracks.push(e),this}addTracks(...e){return this._tracks.push(...e),this}buildTimeline(){return{duration:this._duration,loop:this._loop,playbackSpeed:this._playbackSpeed,tracks:this._tracks.map(e=>e.build())}}build(){let e=this.buildTimeline();return{duration:e.duration,loop:e.loop,playbackSpeed:e.playbackSpeed,tracks:e.tracks.map(t=>({id:t.id,shapeId:t.shapeId,property:t.property,enabled:t.enabled,locked:t.locked||void 0,motionPath:t.motionPath,motionPathRef:t.motionPathRef,beginTrigger:t.beginTrigger,endTrigger:t.endTrigger,cycleDuration:t.cycleDuration,cycleRepeats:t.cycleRepeats,cycleInfinite:t.cycleInfinite,cycleBehavior:t.cycleBehavior,transformOrigin:t.transformOrigin,motionRotate:t.motionRotate,additive:t.additive,keyframes:t.keyframes.map(n=>({time:n.time,value:n.value,easing:n.easing,...n.customBezier?{customBezier:n.customBezier}:{},...n.linearPoints?{linearPoints:n.linearPoints}:{}}))}))}}};var z=class{_id;_type;_state={};constructor(e,t){this._type=e,this._id=t??T()}id(e){return this._id=e,this}locked(e=!0){return this._state.locked=e,this}visible(e=!0){return this._state.visible=e,this}displayMode(e){return this._state.displayMode=e,this}motionOnly(){return this._state.displayMode="motionOnly",this}fill(e,t){return this._state.fillColor=e,this._state.fillType="solid",t!==void 0&&(this._state.fillOpacity=t),this}noFill(){return this._state.fillType="none",this}fillGradient(e){let t="build"in e?e.build():e;return this._state.fillType=t.type,this._state.fillGradient=t,this}fillPattern(e){let t="build"in e?e.build():e;return this._state.fillType="pattern",this._state.fillGradient=t,this}fillOpacity(e){return this._state.fillOpacity=e,this}fillRule(e){return this._state.fillRule=e,this}stroke(e,t){return this._state.borderColor=e,t!==void 0&&(this._state.borderWidth=t),this}noStroke(){return this._state.borderColor="none",this._state.borderWidth=0,this}strokeWidth(e){return this._state.borderWidth=e,this}strokeOpacity(e){return this._state.strokeOpacity=e,this}strokeGradient(e){let t="build"in e?e.build():e;return this._state.strokeType=t.type,this._state.strokeGradient=t,this}strokePattern(e){let t="build"in e?e.build():e;return this._state.strokeType="pattern",this._state.strokeGradient=t,this}strokeLinejoin(e){return this._state.strokeLinejoin=e,this}strokeLinecap(e){return this._state.strokeLinecap=e,this}strokeMiterlimit(e){return this._state.strokeMiterlimit=e,this}dashOffset(e){return this._state.dashOffset=e,this}strokeDasharray(e){return this._state.strokeDasharray=e,this}dash(e,t,n){return this._state.lineStyle=e,e==="custom"&&(t!==void 0&&(this._state.dashLength=t),n!==void 0&&(this._state.gapLength=n)),this}opacity(e){return this._state.opacity=e,this}rotate(e){return this._state.rotation=e,this}skew(e,t){return this._state.skewX=e,this._state.skewY=t,this}scale(e,t){return this._state.scaleX=e,this._state.scaleY=t??e,this}pivot(e,t){return this._state.customPivot={x:e,y:t},this}filter(...e){let t=this._state.filters??[];return this._state.filters=[...t,...e],this}dropShadow(e={}){let t={id:`drop-shadow-${T()}`,type:"drop-shadow",enabled:!0,offsetX:e.offsetX??4,offsetY:e.offsetY??4,blurRadius:e.blurRadius??8,spread:e.spread??0,color:e.color??"#000000",opacity:e.opacity??.3};return this.filter(t)}innerShadow(e={}){let t={id:`inner-shadow-${T()}`,type:"inner-shadow",enabled:!0,offsetX:e.offsetX??2,offsetY:e.offsetY??2,blurRadius:e.blurRadius??4,choke:e.choke??0,color:e.color??"#000000",opacity:e.opacity??.5};return this.filter(t)}blur(e,t,n){let i=e??4,a=t??i,l={id:`gaussian-blur-${T()}`,type:"gaussian-blur",enabled:!0,blurX:i,blurY:a,linked:i===a,quality:n?.quality??"normal"};return this.filter(l)}glow(e={}){let t={id:`glow-${T()}`,type:"glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(t)}innerGlow(e={}){let t={id:`inner-glow-${T()}`,type:"inner-glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(t)}grayscale(e=1){let t={id:`grayscale-${T()}`,type:"grayscale",enabled:!0,amount:e};return this.filter(t)}sepia(e=1){let t={id:`sepia-${T()}`,type:"sepia",enabled:!0,amount:e};return this.filter(t)}outline(e={}){return this.filter({id:`outline-${T()}`,type:"outline",enabled:!0,width:e.width??3,color:e.color??"#000000",opacity:e.opacity??1,position:e.position??"outside"})}motionBlur(e={}){let t={id:`motion-blur-${T()}`,type:"motion-blur",enabled:!0,distance:e.distance??10,angle:e.angle??0,quality:e.quality??"normal"};return this.filter(t)}pointLight(e={}){let t={id:`point-light-${T()}`,type:"point-light",enabled:!0,x:e.x??100,y:e.y??100,z:e.z??200,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,diffuseConstant:e.diffuseConstant??1,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(t)}spotLight(e={}){let t={id:`spot-light-${T()}`,type:"spot-light",enabled:!0,x:e.x??100,y:e.y??0,z:e.z??200,pointsAtX:e.pointsAtX??100,pointsAtY:e.pointsAtY??100,pointsAtZ:e.pointsAtZ??0,coneAngle:e.coneAngle??30,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(t)}sharpen(e=1){let t={id:`sharpen-${T()}`,type:"sharpen",enabled:!0,amount:e};return this.filter(t)}pixelate(e=8){let t={id:`pixelate-${T()}`,type:"pixelate",enabled:!0,blockSize:e};return this.filter(t)}warp(e={}){let t={id:`warp-${T()}`,type:"warp",enabled:!0,scale:e.scale??10,frequency:e.frequency??.02,octaves:e.octaves??1,warpType:e.warpType??"turbulence"};return this.filter(t)}morphology(e={}){let t=e.radiusX??2,n=e.radiusY??t,i={id:`morphology-${T()}`,type:"morphology",enabled:!0,operator:e.operator??"dilate",radiusX:t,radiusY:n,linked:e.linked??t===n};return this.filter(i)}contouring(e={}){if((e.mode??"discrete")==="table"){let i={id:`contouring-table-${T()}`,type:"contouring-table",enabled:!0,levels:e.levels??4,contrast:e.contrast??1};return this.filter(i)}let n={id:`contouring-discrete-${T()}`,type:"contouring-discrete",enabled:!0,levels:e.levels??4};return this.filter(n)}roundEdges(e=4){let t={id:`round-edges-${T()}`,type:"round-edges",enabled:!0,radius:e};return this.filter(t)}channelPainter(e={}){let t={id:`channel-painter-${T()}`,type:"channel-painter",enabled:!0,red:e.red??1,green:e.green??1,blue:e.blue??1};return this.filter(t)}brightness(e=1){let t={id:`brightness-${T()}`,type:"brightness",enabled:!0,amount:e};return this.filter(t)}contrast(e=1){let t={id:`contrast-${T()}`,type:"contrast",enabled:!0,amount:e};return this.filter(t)}filterOpacity(e=1){let t={id:`opacity-${T()}`,type:"opacity",enabled:!0,amount:e};return this.filter(t)}invert(e=1){let t={id:`invert-${T()}`,type:"invert",enabled:!0,amount:e};return this.filter(t)}hueRotate(e=0){let t={id:`hue-rotate-${T()}`,type:"hue-rotate",enabled:!0,angle:e};return this.filter(t)}saturate(e=1){let t={id:`saturate-${T()}`,type:"saturate",enabled:!0,amount:e};return this.filter(t)}blackAndWhite(e=.5){let t={id:`black-and-white-${T()}`,type:"black-and-white",enabled:!0,threshold:e};return this.filter(t)}duotone(e={}){let t={id:`duotone-${T()}`,type:"duotone",enabled:!0,shadowColor:e.shadowColor??"#000000",highlightColor:e.highlightColor??"#ffffff"};return this.filter(t)}xray(e=1){let t={id:`xray-${T()}`,type:"xray",enabled:!0,intensity:e};return this.filter(t)}noise(e={}){let t={id:`noise-${T()}`,type:"noise",enabled:!0,amount:e.amount??.3,scale:e.scale??1};return this.filter(t)}emboss(e={}){let t={id:`emboss-${T()}`,type:"emboss",enabled:!0,strength:e.strength??1,angle:e.angle??135};return this.filter(t)}filmGrain(e={}){let t={id:`film-grain-${T()}`,type:"film-grain",enabled:!0,amount:e.amount??.3,size:e.size??1};return this.filter(t)}watercolor(e={}){let t={id:`watercolor-${T()}`,type:"watercolor",enabled:!0,wetness:e.wetness??.5,turbulence:e.turbulence??.5};return this.filter(t)}gouache(e={}){let t={id:`gouache-${T()}`,type:"gouache",enabled:!0,thickness:e.thickness??.5,texture:e.texture??.5};return this.filter(t)}inkBlot(e={}){let t={id:`ink-blot-${T()}`,type:"ink-blot",enabled:!0,spread:e.spread??.5,edges:e.edges??.5};return this.filter(t)}crumpledPlastic(e={}){let t={id:`crumpled-plastic-${T()}`,type:"crumpled-plastic",enabled:!0,wrinkles:e.wrinkles??.5,shine:e.shine??.5};return this.filter(t)}riddled(e={}){let t={id:`riddled-${T()}`,type:"riddled",enabled:!0,density:e.density??.5,size:e.size??1};return this.filter(t)}cssClipPath(e){return this._state.cssClipPath=e,this}cssMaskProperties(e){return this._state.cssMaskProperties=e,this}vectorEffect(e){return this._state.vectorEffect=e,this}transformBox(e){return this._state.transformBox=e,this}paintOrder(e){return this._state.paintOrder=e,this}blendMode(e){return this._state.blendMode=e,this}visibility(e){return this._state.visibility=e,this}shapeRendering(e){return this._state.shapeRendering=e,this}filterColorInterpolation(e){return this._state.filterColorInterpolation=e,this}inheritFill(e=!0){return this._state.inheritFill=e,this}inheritStroke(e=!0){return this._state.inheritStroke=e,this}systemLanguage(e){return this._state.systemLanguage=e,this}requiredExtensions(e){return this._state.requiredExtensions=e,this}fillLibrary(e,t="linear-gradient"){return this._state.fillLibraryId=e,this._state.fillType=t,this}strokeLibrary(e,t="linear-gradient"){return this._state.strokeLibraryId=e,this._state.strokeType=t,this}filterLibrary(...e){let t=this._state.filterLibraryIds??[];return this._state.filterLibraryIds=[...t,...e],this}markerStartRef(e){return this._state.markerStart=e,this}markerMidRef(e){return this._state.markerMid=e,this}markerEndRef(e){return this._state.markerEnd=e,this}bind(e,t){let n=this._state.bindings??{};return this._state.bindings={...n,[e]:t},this}metadata(e){return this._state.metadata={...this._state.metadata,...e},this}group(e){return this._state.groupId=e,this}build(){return{id:this._id,type:this._type,state:{...this._state}}}},$t=class extends z{constructor(e,t,n){if(n<0)throw new RangeError("Circle radius must be non-negative");super("circle"),this._state.x=e,this._state.y=t,this._state.radius=n}position(e,t){return this._state.x=e,this._state.y=t,this}radius(e){return this._state.radius=e,this}},xt=class extends z{constructor(e,t,n,i){if(n<0||i<0)throw new RangeError("Ellipse radii must be non-negative");super("ellipse"),this._state.cx=e,this._state.cy=t,this._state.rx=n,this._state.ry=i}position(e,t){return this._state.cx=e,this._state.cy=t,this}radii(e,t){return this._state.rx=e,this._state.ry=t,this}},St=class extends z{constructor(e,t,n,i){if(n<0||i<0)throw new RangeError("Rectangle dimensions must be non-negative");super("rectangle"),this._state.x=e,this._state.y=t,this._state.width=n,this._state.height=i}position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,t){return this._state.rx=e,this._state.ry=t,e===t&&(this._state.cornerRadius=e),this}},kt=class extends z{constructor(e,t,n){if(n<0)throw new RangeError("Square size must be non-negative");super("square"),this._state.x=e,this._state.y=t,this._state.width=n,this._state.height=n}position(e,t){return this._state.x=e,this._state.y=t,this}size(e){return this._state.width=e,this._state.height=e,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,t){return this._state.rx=e,this._state.ry=t,e===t&&(this._state.cornerRadius=e),this}},_t=class extends z{constructor(e,t,n,i){super("line"),this._state.x1=e,this._state.y1=t,this._state.x2=n,this._state.y2=i}from(e,t){return this._state.x1=e,this._state.y1=t,this}to(e,t){return this._state.x2=e,this._state.y2=t,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},vt=class extends z{constructor(e,t,n){super("text"),this._state.x=e,this._state.y=t,this._state.text=n}position(e,t){return this._state.x=e,this._state.y=t,this}content(e){return this._state.text=e,this}fontSize(e){return this._state.fontSize=e,this}fontFamily(e){return this._state.fontFamily=e,this}fontWeight(e){return this._state.fontWeight=e,this}fontStyle(e){return this._state.fontStyle=e,this}fontVariant(e){return this._state.fontVariant=e,this}fontVariantLigatures(e){return this._state.fontVariantLigatures=e,this}fontVariantPosition(e){return this._state.fontVariantPosition=e,this}fontVariantCaps(e){return this._state.fontVariantCaps=e,this}fontVariantNumeric(e){return this._state.fontVariantNumeric=e,this}fontVariantEastAsian(e){return this._state.fontVariantEastAsian=e,this}anchor(e){return this._state.textAnchor=e,this}letterSpacing(e){return this._state.letterSpacing=e,this}lineHeight(e){return this._state.lineHeight=e,this}decoration(e){return this._state.textDecoration=e,this}transform(e){return this._state.textTransform=e,this}textPath(e,t=0){return this._state.isTextPath=!0,this._state.textPathPoints=e,this._state.textPathStartOffset=t,this}textPathOffset(e){return this._state.textPathStartOffset=e,this}textPathSide(e){return this._state.textPathSide=e,this}direction(e){return this._state.textDirection=e,this}unicodeBidi(e){return this._state.unicodeBidi=e,this}dominantBaseline(e){return this._state.dominantBaseline=e,this}writingMode(e){return this._state.writingMode=e,this}wordSpacing(e){return this._state.wordSpacing=e,this}baselineShift(e){return this._state.baselineShift=e,this}inlineSize(e){return this._state.inlineSize=e,this}overflowWrap(e){return this._state.overflowWrap=e,this}whiteSpace(e){return this._state.whiteSpace=e,this}fontVariationSettings(e){return this._state.fontVariationSettings=e,this}charOffsets(e){return this._state.charOffsets=e,this}shapeInsideRef(e){return this._state.shapeInsideRef=e,this}shapePadding(e){return this._state.shapePadding=e,this}richTextData(e){return this._state.richTextData=e,this}useRichText(e=!0){return this._state.useRichText=e,this}linePositions(e){return this._state.linePositions=e,this}textLength(e){return this._state.textLength=e,this}lengthAdjust(e){return this._state.lengthAdjust=e,this}},W=class extends z{constructor(e,t,n,i){super(e),this._state.cx=t,this._state.cy=n,this._state.radius=i}position(e,t){return this._state.cx=e,this._state.cy=t,this}radius(e){return this._state.radius=e,this}shiftAngle(e){return this._state.shiftAngle=e,this}cornerRadius(e){return this._state.cornerRadius=e,this}},wt=class extends W{constructor(e,t,n){super("triangle",e,t,n)}},Pt=class extends W{constructor(e,t,n,i=5){super("ngon",e,t,n),this._state.sides=i}sides(e){return this._state.sides=e,this}},Tt=class extends W{constructor(e,t,n){super("star",e,t,n),this._state.arms=5,this._state.innerRadiusPercent=40}arms(e){return this._state.arms=e,this}innerRadius(e){return this._state.innerRadiusPercent=e,this}},Ft=class extends W{constructor(e,t,n){super("cross",e,t,n),this._state.armWidthPercent=35}armWidth(e){return this._state.armWidthPercent=e,this}},Rt=class extends W{constructor(e,t,n){super("ring",e,t,n),this._state.innerRadiusPercent=60}innerRadius(e){return this._state.innerRadiusPercent=e,this}},Mt=class extends W{constructor(e,t,n){super("spiral",e,t,n),this._state.turns=3,this._state.thicknessPercent=15,this._state.spiralDirection=1}turns(e){return this._state.turns=e,this}thickness(e){return this._state.thicknessPercent=e,this}direction(e){return this._state.spiralDirection=e,this}},Ct=class extends W{constructor(e,t,n){super("gear",e,t,n),this._state.teeth=8,this._state.toothDepthPercent=25}teeth(e){return this._state.teeth=e,this}toothDepth(e){return this._state.toothDepthPercent=e,this}holeRadius(e){return this._state.holeRadiusPercent=e,this}},At=class extends W{constructor(e,t,n){super("arrow",e,t,n),this._state.headWidthPercent=100,this._state.headLengthPercent=35,this._state.shaftWidthPercent=35}headWidth(e){return this._state.headWidthPercent=e,this}headLength(e){return this._state.headLengthPercent=e,this}shaftWidth(e){return this._state.shaftWidthPercent=e,this}},It=class extends W{constructor(e,t,n){super("heart",e,t,n),this._state.lobeRadiusPercent=50,this._state.cleftDepthPercent=25}lobeRadius(e){return this._state.lobeRadiusPercent=e,this}cleftDepth(e){return this._state.cleftDepthPercent=e,this}},Lt=class extends W{constructor(e,t,n){super("lightning",e,t,n),this._state.boltSegments=3,this._state.boltJaggednessPercent=40,this._state.boltWidthPercent=30}segments(e){return this._state.boltSegments=e,this}jaggedness(e){return this._state.boltJaggednessPercent=e,this}thickness(e){return this._state.boltWidthPercent=e,this}},Et=class extends W{constructor(e,t,n){super("cloud",e,t,n),this._state.cloudBumps=5,this._state.cloudPuffinessPercent=60}bumps(e){return this._state.cloudBumps=e,this}puffiness(e){return this._state.cloudPuffinessPercent=e,this}},Bt=class extends W{constructor(e,t,n){super("speechBubble",e,t,n),this._state.tailAngleDeg=45,this._state.tailLengthPercent=40,this._state.tailWidthPercent=25}tailAngle(e){return this._state.tailAngleDeg=e,this}tailLength(e){return this._state.tailLengthPercent=e,this}tailWidth(e){return this._state.tailWidthPercent=e,this}},se=class extends z{add(e){let t="build"in e&&typeof e.build=="function"?e.build():e,n=this._state.children??[];return this._state.children=[...n,t],this}addAll(...e){for(let t of e)this.add(t);return this}children(e){return this._state.children=e.map(t=>"build"in t&&typeof t.build=="function"?t.build():t),this}},Dt=class extends se{constructor(e){super("hyperlink"),e!==void 0&&(this._state.href=e)}href(e){return this._state.href=e,this}hrefXlink(e){return this._state.hrefXlink=e,this}target(e){return this._state.linkTarget=e,this}download(e){return this._state.linkDownload=e,this}rel(e){return this._state.linkRel=e,this}ping(e){return this._state.linkPing=e,this}hreflang(e){return this._state.linkHreflang=e,this}type(e){return this._state.linkType=e,this}referrerPolicy(e){return this._state.linkReferrerPolicy=e,this}},Ot=class extends se{constructor(){super("switch")}},Gt=class extends se{constructor(){super("container")}},zt=class extends z{constructor(e){super("view"),e&&(this._state.viewBoxX=e.x,this._state.viewBoxY=e.y,this._state.viewBoxWidth=e.width,this._state.viewBoxHeight=e.height)}viewBox(e,t,n,i){return this._state.viewBoxX=e,this._state.viewBoxY=t,this._state.viewBoxWidth=n,this._state.viewBoxHeight=i,this}name(e){return this._state.viewName=e,this}preserveAspectRatio(e){return this._state.viewPreserveAspectRatio=e,this}zoomAndPan(e){return this._state.viewZoomAndPan=e,this}viewTarget(e){return this._state.viewTarget=e,this}asHome(e=!0){return this._state.isHomeView=e,this}},Ut=class extends se{constructor(e=0,t=0,n=100,i=100){super("svg"),this._state.svgX=e,this._state.svgY=t,this._state.svgWidth=n,this._state.svgHeight=i}position(e,t){return this._state.svgX=e,this._state.svgY=t,this}size(e,t){return this._state.svgWidth=e,this._state.svgHeight=t,this}viewBox(e,t,n,i){return this._state.svgViewBoxX=e,this._state.svgViewBoxY=t,this._state.svgViewBoxWidth=n,this._state.svgViewBoxHeight=i,this}preserveAspectRatio(e){return this._state.svgPreserveAspectRatio=e,this}asRoot(e=!0){return this._state.isRootSvg=e,this}},Vt=class extends z{constructor(e){super("shape-reference"),e!==void 0&&(this._state.targetShapeId=e)}target(e){return this._state.targetShapeId=e,this}offset(e,t){return this._state.offsetX=e,this._state.offsetY=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}},Nt=class extends z{position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}src(e){return this._state.href=e,this}mimeType(e){return this._state.mediaMimeType=e,this}naturalDuration(e){return this._state.naturalDuration=e,this}begin(e){return this._state.begin=e,this}trim(e,t){return this._state.trimStart=e,this._state.trimEnd=t,this}volume(e){return this._state.volume=e,this}muted(e=!0){return this._state.muted=e,this}loop(e=!0){return this._state.loop=e,this}playbackRate(e){return this._state.playbackRate=e,this}fade(e,t){return this._state.fadeInDuration=e,this._state.fadeOutDuration=t,this}language(e){return this._state.systemLanguage=e,this}},Ht=class extends Nt{constructor(e){super("video"),this._state.mediaKind="video",e!==void 0&&(this._state.href=e)}poster(e){return this._state.posterHref=e,this}sourceRect(e){return this._state.sourceRect=e,this}},Wt=class extends Nt{constructor(e){super("audio"),this._state.mediaKind="audio",e!==void 0&&(this._state.href=e)}},Xt=class extends z{constructor(e=[]){super("path"),this._state.pathPoints=[...e],this._state.pathCurveType="cubic",this._state.pathClosed=!1}points(e){return this._state.pathPoints=[...e],this}addPoint(e,t){let n=this._state.pathPoints??[];return n.push({x:e,y:t}),this._state.pathPoints=n,this}curveType(e){return this._state.pathCurveType=e,this}closed(e=!0){return this._state.pathClosed=e,this}tension(e){return this._state.pathTension=e,this}arcParams(e){return this._state.pathArcParams=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}toD(){let e=this._state.pathPoints??[],t=this._state.pathCurveType??"CUBIC",n=this._state.pathClosed??!1,i=this._state.pathTension??.5,a=this._state.pathArcParams;return de(e,t,n,i,a)}},jt=class extends z{constructor(e=[]){super("polyline"),this._state.polylinePoints=[...e],this._state.polylineClosed=!1}points(e){return this._state.polylinePoints=[...e],this}addPoint(e,t){let n=this._state.polylinePoints??[];return n.push({x:e,y:t}),this._state.polylinePoints=n,this}closed(e=!0){return this._state.polylineClosed=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},Yt=class extends z{constructor(e,t,n,i,a){super("image"),this._state.x=e,this._state.y=t,this._state.width=n,this._state.height=i,this._state.href=a}position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}src(e){return this._state.href=e,this}preserveAspectRatio(e){return this._state.preserveAspectRatio=e,this}};var ke=class{_x1;_y1;_x2;_y2;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(e=0,t=0,n=1,i=0){this._x1=e,this._y1=t,this._x2=n,this._y2=i,this._id=T()}stop(e,t,n=1){return this._stops.push({offset:e,color:t,opacity:n}),this}direction(e,t,n,i){return this._x1=e,this._y1=t,this._x2=n,this._y2=i,this}spread(e){return this._spreadMethod=e,this}opacity(e){return this._opacity=e,this}build(){return{type:"linear-gradient",id:this._id,x1:this._x1,y1:this._y1,x2:this._x2,y2:this._y2,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},_e=class{_cx=.5;_cy=.5;_fx=.5;_fy=.5;_r=.5;_ry=.5;_rotation=0;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(){this._id=T()}center(e,t){return this._cx=e,this._cy=t,this}focus(e,t){return this._fx=e,this._fy=t,this}radius(e,t){return this._r=e,this._ry=t??e,this}rotation(e){return this._rotation=e,this}stop(e,t,n=1){return this._stops.push({offset:e,color:t,opacity:n}),this}spread(e){return this._spreadMethod=e,this}opacity(e){return this._opacity=e,this}build(){return{type:"radial-gradient",id:this._id,cx:this._cx,cy:this._cy,fx:this._fx,fy:this._fy,r:this._r,ry:this._ry,rotation:this._rotation,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},ve=class{_patternType;_color;_backgroundColor;_scale=1;_rotation=0;_opacity=1;_patternParams;_id;_svgContent;_width;_height;_patternUnits;_patternContentUnits;_patternTransform;_viewBox;_preserveAspectRatio;_x;_y;_customPatternId;constructor(e="stripes",t="#000000",n="#ffffff"){this._patternType=e,this._color=t,this._backgroundColor=n,this._id=T()}scale(e){return this._scale=e,this}rotation(e){return this._rotation=e,this}opacity(e){return this._opacity=e,this}params(e){return this._patternParams=e,this}svgContent(e){return this._svgContent=e,this}size(e,t){return this._width=e,this._height=t,this}patternUnits(e){return this._patternUnits=e,this}patternContentUnits(e){return this._patternContentUnits=e,this}patternTransform(e){return this._patternTransform=e,this}viewBox(e){return this._viewBox=e,this}preserveAspectRatio(e){return this._preserveAspectRatio=e,this}position(e,t){return this._x=e,this._y=t,this}customPatternId(e){return this._customPatternId=e,this}build(){let e,t,n;if(this._svgContent!==void 0)e=this._svgContent,t=this._width??10,n=this._height??10;else{let a=it(this._patternType,this._scale,this._color,this._backgroundColor,this._patternParams);e=a.svgContent,t=this._width??a.width,n=this._height??a.height}let i={type:"pattern",id:this._id,patternType:this._svgContent!==void 0?"custom":this._patternType,color:this._color,backgroundColor:this._backgroundColor,scale:this._scale,rotation:this._rotation,opacity:this._opacity,svgContent:e,width:t,height:n,patternUnits:this._patternUnits??"userSpaceOnUse",patternParams:this._patternParams,patternTransform:this._patternTransform??(this._rotation?`rotate(${this._rotation})`:void 0)};return this._patternContentUnits&&(i.patternContentUnits=this._patternContentUnits),this._viewBox&&(i.viewBox=this._viewBox),this._preserveAspectRatio&&(i.preserveAspectRatio=this._preserveAspectRatio),this._x!==void 0&&(i.x=this._x),this._y!==void 0&&(i.y=this._y),this._customPatternId&&(i.customPatternId=this._customPatternId),i}};function mn(r=0,e=0,t=1,n=0){return new ke(r,e,t,n)}function gn(){return new _e}function bn(r="stripes",e="#000000",t="#ffffff"){return new ve(r,e,t)}var Ir={rows:4,cols:4,style:"classic",tabDepthPercent:20,tabPattern:"random",seed:1},da=.04,ha=0;function fa(r){let e=r>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function M(r){return Number(r.toFixed(3)).toString()}function pa(r,e,t,n,i,a,l,o,u,c,h,d){return[[0,0],[.2,o],[.5+u+h,-a+c],[.5-a+u,a+c],[.5-2*a+u-h,3*a+c],[.5+2*a+u-h,3*a+c],[.5+a+u,a+c],[.5+u+h,-a+c],[.8,d],[1,0]].map(([m,b])=>{let g=e+m*n,y=t+b*i*l;return r?{x:g,y}:{x:y,y:g}})}function yn(r,e,t,n,i,a,l,o,u,c,h){let d=[],p=(P,v)=>u==="alternating"?0:P+c()*(v-P),m=()=>c()<.5,b=p(-o,o),g=u==="alternating"?h%2===0:m(),y=null,S=b,_=p(-o,o),x=p(-o,o),k=p(-o,o);b=p(-o,o);for(let P=0;P<r;P++){P>0&&(y=g,g=u==="alternating"?(h+P)%2===0:m(),S=g===y?-b:b,_=p(-o,o),x=p(-o,o),k=p(-o,o),b=p(-o,o));let v=g?-1:1,$=t+P*i;d.push(pa(e,$,n,i,a,l,v,S,_,x,k,b))}return d}function $n(r,e,t,n,i,a,l){let o=2*a;return[[0,0],[.2,0],[.4,0],[.4,o],[.4,o],[.6,o],[.6,o],[.6,0],[.8,0],[1,0]].map(([c,h])=>{let d=e+c*n,p=t+h*i*l;return r?{x:d,y:p}:{x:p,y:d}})}function xn(r,e){return r+` C ${M(e[1].x)} ${M(e[1].y)} ${M(e[2].x)} ${M(e[2].y)} ${M(e[3].x)} ${M(e[3].y)} C ${M(e[4].x)} ${M(e[4].y)} ${M(e[5].x)} ${M(e[5].y)} ${M(e[6].x)} ${M(e[6].y)} C ${M(e[7].x)} ${M(e[7].y)} ${M(e[8].x)} ${M(e[8].y)} ${M(e[9].x)} ${M(e[9].y)}`}function Sn(r,e){return r+` C ${M(e[8].x)} ${M(e[8].y)} ${M(e[7].x)} ${M(e[7].y)} ${M(e[6].x)} ${M(e[6].y)} C ${M(e[5].x)} ${M(e[5].y)} ${M(e[4].x)} ${M(e[4].y)} ${M(e[3].x)} ${M(e[3].y)} C ${M(e[2].x)} ${M(e[2].y)} ${M(e[1].x)} ${M(e[1].y)} ${M(e[0].x)} ${M(e[0].y)}`}function kn(r,e={}){let t={...Ir,...e};if(t.rows<1||t.cols<1)throw new Error("generatePuzzlePieces: rows and cols must be >= 1");if(!Number.isFinite(r.width)||!Number.isFinite(r.height))throw new Error("generatePuzzlePieces: bounds must have finite width/height");if(r.width<=0||r.height<=0)throw new Error("generatePuzzlePieces: bounds must have positive width/height");let{rows:n,cols:i,style:a,tabDepthPercent:l,tabPattern:o,seed:u}=t,c=fa(u),h=r.width/i,d=r.height/n,p=Math.max(0,Math.min(.4,l/200)),m=(a==="classic"||a==="curved")&&p>0,b=a==="square-tabs"&&p>0,g=a==="classic"&&o==="random"?da:ha,y=[];for(let x=0;x<n-1;x++){let k=r.y+(x+1)*d;if(m)y.push(yn(i,!0,r.x,k,h,d,p,g,o,c,x));else if(b){let P=[];for(let v=0;v<i;v++){let $=o==="alternating"?(x+v)%2===0?1:-1:c()<.5?1:-1;P.push($n(!0,r.x+v*h,k,h,d,p,$))}y.push(P)}else y.push(new Array(i).fill(null))}let S=[];for(let x=0;x<i-1;x++){let k=r.x+(x+1)*h;if(m)S.push(yn(n,!1,r.y,k,d,h,p,g,o,c,x));else if(b){let P=[];for(let v=0;v<n;v++){let $=o==="alternating"?(v+x)%2===0?1:-1:c()<.5?1:-1;P.push($n(!1,r.y+v*d,k,d,h,p,$))}S.push(P)}else S.push(new Array(n).fill(null))}let _=[];for(let x=0;x<n;x++)for(let k=0;k<i;k++){let P=r.x+k*h,v=r.y+x*d,$=P+h,w=v+d,R=`M ${M(P)} ${M(v)}`;if(x===0)R+=` L ${M($)} ${M(v)}`;else{let I=y[x-1][k];I?R=xn(R,I):R+=` L ${M($)} ${M(v)}`}if(k===i-1)R+=` L ${M($)} ${M(w)}`;else{let I=S[k][x];I?R=xn(R,I):R+=` L ${M($)} ${M(w)}`}if(x===n-1)R+=` L ${M(P)} ${M(w)}`;else{let I=y[x][k];I?R=Sn(R,I):R+=` L ${M(P)} ${M(w)}`}if(k===0)R+=` L ${M(P)} ${M(v)}`;else{let I=S[k-1][x];I?R=Sn(R,I):R+=` L ${M(P)} ${M(v)}`}R+=" Z",_.push({id:`puzzle-${u}-r${x}-c${k}`,row:x,col:k,d:R})}return _}var wn=[1,2,3,4,5,6,7,8,9],ma={easy:{minGivens:40,maxGivens:45,maxRating:"singles"},medium:{minGivens:34,maxGivens:39,maxRating:"hidden-singles"},hard:{minGivens:28,maxGivens:33,maxRating:"search"},expert:{minGivens:24,maxGivens:27,maxRating:"search"}};function we(r){return r.map(e=>[...e])}function ga(){return Array.from({length:9},()=>Array.from({length:9},()=>0))}function Pn(r){let e=r>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function Tn(r,e){let t=[...r];for(let n=t.length-1;n>0;n--){let i=Math.floor(e()*(n+1));[t[n],t[i]]=[t[i],t[n]]}return t}function me(r){return 1<<r-1}function Fn(r){let e=0,t=r;for(;t;)t&=t-1,e++;return e}function ba(r){for(let e=1;e<=9;e++)if(r===me(e))return e;return 0}function Er(r,e){return Math.floor(r/3)*3+Math.floor(e/3)}function Lr(r){let e=0;for(let t of r)for(let n of t)n!==0&&e++;return e}function ya(r){if(!Number.isFinite(r))return 1;let e=Math.floor(r);return e===0?1:e}function Rn(r,e){if(!Array.isArray(r)||r.length!==9)return e.push("Grid must contain 9 rows."),!1;let t=!0;for(let n=0;n<9;n++){if(!Array.isArray(r[n])||r[n].length!==9){e.push(`Row ${n+1} must contain 9 cells.`),t=!1;continue}for(let i=0;i<9;i++){let a=r[n][i];(!Number.isInteger(a)||a<0||a>9)&&(e.push(`Cell R${n+1}C${i+1} must be a digit from 0 to 9.`),t=!1)}}return t}function Mn(r,e){let t=!0,n=(i,a)=>{let l=0;for(let o of a){if(o===0)continue;let u=me(o);if(l&u){e.push(`${i} contains duplicate ${o}.`),t=!1;return}l|=u}};for(let i=0;i<9;i++)n(`Row ${i+1}`,r[i]);for(let i=0;i<9;i++)n(`Column ${i+1}`,r.map(a=>a[i]));for(let i=0;i<9;i+=3)for(let a=0;a<9;a+=3){let l=[];for(let o=i;o<i+3;o++)for(let u=a;u<a+3;u++)l.push(r[o][u]);n(`Box ${Math.floor(i/3)*3+Math.floor(a/3)+1}`,l)}return t}function Br(r){let e=Array.from({length:9},()=>0),t=Array.from({length:9},()=>0),n=Array.from({length:9},()=>0);for(let i=0;i<9;i++)for(let a=0;a<9;a++){let l=r[i][a];if(l===0)continue;let o=me(l),u=Er(i,a);if(e[i]&o||t[a]&o||n[u]&o)return null;e[i]|=o,t[a]|=o,n[u]|=o}return{rows:e,cols:t,boxes:n}}function Dr(r,e,t,n,i){return 511&~(t[r]|n[e]|i[Er(r,e)])}function Cn(r,e,t){let n=Br(r);if(!n)return[];let i=we(r),a=[],{rows:l,cols:o,boxes:u}=n,c=()=>{if(a.length>=e)return;let h=-1,d=-1,p=0,m=10;for(let g=0;g<9;g++){for(let y=0;y<9;y++){if(i[g][y]!==0)continue;let S=Dr(g,y,l,o,u),_=Fn(S);if(_===0)return;if(_<m&&(h=g,d=y,p=S,m=_,_===1))break}if(m===1)break}if(h===-1){a.push(we(i));return}let b=wn.filter(g=>p&me(g));t&&(b=Tn(b,t));for(let g of b){let y=me(g),S=Er(h,d);if(i[h][d]=g,l[h]|=y,o[d]|=y,u[S]|=y,c(),u[S]&=~y,o[d]&=~y,l[h]&=~y,i[h][d]=0,a.length>=e)return}};return c(),a}function $a(r){let e=ga(),t=Pn(r),[n]=Cn(e,1,t);if(!n)throw new Error("generateSudokuPuzzle: failed to generate solved grid");return n}function xa(r){let e=Br(r);if(!e)return null;for(let t=0;t<9;t++)for(let n=0;n<9;n++){if(r[t][n]!==0)continue;let i=Dr(t,n,e.rows,e.cols,e.boxes);if(Fn(i)===1)return{row:t,col:n,value:ba(i)}}return null}function Sa(r){let e=Br(r);if(!e)return null;let t=n=>{for(let i of wn){let a=me(i),l=null;for(let o of n)if(!(r[o.row][o.col]!==0||!(Dr(o.row,o.col,e.rows,e.cols,e.boxes)&a))){if(l){l=null;break}l=o}if(l)return{...l,value:i}}return null};for(let n=0;n<9;n++){let i=t(Array.from({length:9},(a,l)=>({row:n,col:l})));if(i)return i}for(let n=0;n<9;n++){let i=t(Array.from({length:9},(a,l)=>({row:l,col:n})));if(i)return i}for(let n=0;n<9;n+=3)for(let i=0;i<9;i+=3){let a=[];for(let o=n;o<n+3;o++)for(let u=i;u<i+3;u++)a.push({row:o,col:u});let l=t(a);if(l)return l}return null}function _n(r){let e=we(r),t=!1;for(;Lr(e)<81;){let n=xa(e);if(n){e[n.row][n.col]=n.value;continue}let i=Sa(e);if(i){t=!0,e[i.row][i.col]=i.value;continue}return"search"}return t?"hidden-singles":"singles"}function vn(r,e){let t={singles:0,"hidden-singles":1,search:2};return t[r]<=t[e]}function Pe(r,e={}){let t=[];return Rn(r,t)?Mn(r,t)?Cn(r,Math.max(1,Math.floor(e.maxSolutions??2))):[]:[]}function An(r){let e=[];if(!Rn(r,e))return{valid:!1,unique:!1,solution:null,errors:e};if(Mn(r,e),e.length>0)return{valid:!1,unique:!1,solution:null,errors:e};let n=Pe(r,{maxSolutions:2});return n.length===0?e.push("Puzzle has no solution."):n.length>1&&e.push("Puzzle has more than one solution."),{valid:e.length===0,unique:n.length===1,solution:n[0]?we(n[0]):null,errors:e}}function In(r){let e=r.difficulty,t=ma[e];if(!t)throw new Error(`generateSudokuPuzzle: unsupported difficulty "${e}"`);let n=ya(r.seed);for(let i=0;i<30;i++){let a=n+i*104729>>>0,l=Pn(a),o=$a(a),u=we(o),c=t.minGivens+Math.floor(l()*(t.maxGivens-t.minGivens+1)),h=Tn(Array.from({length:81},(b,g)=>({row:Math.floor(g/9),col:g%9})),l);for(let b of h){if(Lr(u)<=c)break;let g=u[b.row][b.col];if(u[b.row][b.col]=0,Pe(u,{maxSolutions:2}).length!==1){u[b.row][b.col]=g;continue}let S=_n(u);vn(S,t.maxRating)||(u[b.row][b.col]=g)}let d=Lr(u),p=_n(u);if(Pe(u,{maxSolutions:2}).length===1&&d>=t.minGivens&&d<=t.maxGivens&&vn(p,t.maxRating))return{puzzle:u,solution:o,difficulty:e,seed:n,givens:d,rating:p}}throw new Error(`generateSudokuPuzzle: unable to generate a ${e} puzzle`)}0&&(module.exports={Arrow,Audio,BUILTIN_MARKER_ID_MAP,CURRENT_SCHEMA_VERSION,Circle,Cloud,Container,ContainerShapeBuilder,Cross,DEFAULT_COORDINATE_PRECISION,Document,EASING_CURVES,EVENT_TRIGGER_OPTIONS,EasingType,Ellipse,Gear,Heart,Hyperlink,ImageShape,LIBRARY_EMIT_ORDER,Lightning,Line,LinearGradientBuilder,MARKER_HEIGHT,MARKER_VIEWBOX,MARKER_WIDTH,MAX_COORDINATE_PRECISION,MIGRATIONS,NGon,NestedSvg,PUZZLE_DEFAULTS,Path,PathCurveType,PathPointType,PatternBuilder,Polyline,RadialGradientBuilder,Rectangle,Ring,ShapeBuilder,ShapeReference,SpeechBubble,Spiral,Square,Star,Switch,Text,Timeline,Track,Triangle,Video,View,collectReferencedLibraryIds,computeArrowVertices,computeCloudPath,computeCrossVertices,computeDashArray,computeGearPath,computeGearVertices,computeHeartPath,computeLightningVertices,computePolygonVertices,computeRectanglePath,computeRingPath,computeSpeechBubbleVertices,computeSpiralPath,computeSplinePath,computeStarVertices,createDocument,createShape,createViewbox,defaultVariableMode,escXml,extractVariables,filterAttr,generateCode,generateCssCode,generateD3Code,generateId,generatePatternSvgContent,generatePuzzlePieces,generateReactCode,generateSudokuPuzzle,generateSvgCode,generateVueCode,getBuiltInMarkerDefs,getEasingCubicBezier,getEffectivePrecision,getMarkerDescriptors,getPatternElements,linearGradient,migrateSnapshot,parseDocument,parseVariableArgs,pattern,radialGradient,renderAnimationElements,renderBuiltinMarkerDefs,renderCircle,renderEllipse,renderFilterDefs,renderFilterLibraryDef,renderFilterPrimitive,renderFilterPrimitivesForType,renderImage,renderLibraryDef,renderLibraryDefs,renderLine,renderLinearGradientLibraryDef,renderMarkerLibraryDef,renderPatternLibraryDef,renderPolygonShape,renderPolyline,renderRadialGradientLibraryDef,renderRectangle,renderReferencedLibraryDefs,renderShape,renderSpline,renderSvgPrimitiveChainFilter,renderSymbolLibraryDef,renderText,renderToSvg,roundCoord,roundNumberString,roundSerializedShape,roundSnapshot,solveSudoku,stringifyDocument,substituteString,substituteVariables,validateSnapshot,validateSudokuPuzzle,verticesToPath});