@svgsketch/core 2.0.0 → 2.1.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.d.mts +315 -38
- package/dist/index.d.ts +315 -38
- package/dist/index.js +16 -16
- package/dist/index.mjs +16 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";var pi=Object.defineProperty;var No=Object.getOwnPropertyDescriptor;var Oo=Object.getOwnPropertyNames;var zo=Object.prototype.hasOwnProperty;var Go=(t,e)=>{for(var r in e)pi(t,r,{get:e[r],enumerable:!0})},Vo=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oo(e))!zo.call(t,i)&&i!==r&&pi(t,i,{get:()=>e[i],enumerable:!(n=No(e,i))||n.enumerable});return t};var Uo=t=>Vo(pi({},"__esModule",{value:!0}),t);var ef={};Go(ef,{Arrow:()=>qn,Audio:()=>ui,BUILTIN_MARKER_ID_MAP:()=>Xi,COMMON_PROP_DEFAULTS:()=>H,COMMON_TRANSFORM_NODE_DEFAULTS:()=>bi,CURRENT_SCHEMA_VERSION:()=>ae,Circle:()=>Bn,Cloud:()=>Jn,Container:()=>ni,ContainerShapeBuilder:()=>Oe,Cross:()=>jn,DEFAULT_COORDINATE_PRECISION:()=>Aa,DEFAULT_RICH_TEXT_STYLE:()=>Tt,Document:()=>Qt,DocumentBuilder:()=>Qt,EASING_CURVES:()=>sr,EasingType:()=>ir,Ellipse:()=>Nn,Gear:()=>Yn,Heart:()=>Zn,Hyperlink:()=>ti,IDENTITY_AFFINE:()=>Ct,ImageShape:()=>fi,KNOWN_STATE_KEYS:()=>$i,LIBRARY_EMIT_ORDER:()=>as,Lightning:()=>Qn,Line:()=>Gn,LinearGradientBuilder:()=>Jt,MARKER_HEIGHT:()=>an,MARKER_VIEWBOX:()=>jt,MARKER_WIDTH:()=>sn,MAX_COORDINATE_PRECISION:()=>Ma,MIGRATIONS:()=>Oi,NGon:()=>Wn,NON_WIRE_PROP_KEYS:()=>Us,NUMERIC_SHAPE_TRANSFORM_STATE_KEYS:()=>mt,NestedSvg:()=>si,NodeSchemaRegistry:()=>St,PUZZLE_DEFAULTS:()=>Ps,Path:()=>ci,PathCurveType:()=>mi,PathPointType:()=>Ns,PatternBuilder:()=>tr,Polyline:()=>di,RICH_TEXT_STYLE_KEYS:()=>et,RadialGradientBuilder:()=>er,Rectangle:()=>On,Ring:()=>Xn,SERIALIZED_SHAPE_STATE_KEYS:()=>gi,SHAPE_TRANSFORM_STATE_KEYS:()=>yi,SceneGraph:()=>dr,SceneNode:()=>ke,ShapeBuilder:()=>q,ShapeReference:()=>ai,SpeechBubble:()=>ei,Spiral:()=>Kn,Square:()=>zn,Star:()=>Hn,Switch:()=>ri,Text:()=>Vn,Timeline:()=>Ln,Track:()=>En,Triangle:()=>Un,Video:()=>li,View:()=>ii,affine:()=>Re,affineFromArray:()=>wr,affineToArray:()=>De,almostEqualAffine:()=>yl,applyAffineToPoint:()=>xl,applyAffineToVector:()=>Sl,applyOpToSnapshot:()=>Ai,applyOpsToSnapshot:()=>ua,applyRichTextFormat:()=>wt,applyTextSplice:()=>Hs,applyTextTransform:()=>Xt,arcEndpointToCenter:()=>vs,areTracksTimingEquivalent:()=>bs,around:()=>Fi,buildCompoundTransformValues:()=>$n,buildSmilKeyframeData:()=>Ne,canonicalPolygonTransformString:()=>Li,canonicalTransformString:()=>at,collectMarkerReferences:()=>Wt,collectReferencedLibraryDefs:()=>Yt,collectReferencedMarkerIds:()=>Ua,compareOrderKeys:()=>xt,composeLegacyTransformMatrix:()=>Et,computeArrowVertices:()=>Vr,computeCloudPath:()=>jr,computeCrossVertices:()=>Gr,computeDashArray:()=>lt,computeFlowchartBoxPath:()=>Zr,computeGearPath:()=>Yr,computeGearVertices:()=>Ui,computeHeartPath:()=>Hr,computeLightningVertices:()=>Wr,computePolygonVertices:()=>Gt,computeRectanglePath:()=>qr,computeRingPath:()=>Xr,computeSpeechBubbleVertices:()=>Ur,computeSpiralPath:()=>Kr,computeSplinePath:()=>Fe,computeStarVertices:()=>zr,createDocument:()=>Ar,createSceneNode:()=>Ge,createShape:()=>_a,createViewbox:()=>Ot,createWordSearchPrimitiveMask:()=>Bo,cubicBezierExtent1D:()=>_n,customPatternDefToLibraryDef:()=>rt,declaredRichTextDeltaKeys:()=>pr,decomposeAffine2D:()=>Ul,defaultVariableMode:()=>Ho,deriveRichTextFormatRanges:()=>Qs,deriveSegments:()=>_e,deriveTextSplice:()=>Ws,downTranslateAnimationKeyframeOps:()=>fa,downTranslateCollectionMoveOps:()=>pa,downTranslateScenePlaceOps:()=>da,downTranslateTextFormatOps:()=>ha,ellipticalArcBounds:()=>Ts,escXml:()=>W,extractVariables:()=>Lr,filterAttr:()=>rn,findShapeById:()=>tt,flattenShapeStateTree:()=>$t,flattenStateExtra:()=>Te,foldLegacyAncestorTransformIntoMatrix:()=>Ei,forEachLibraryRefInState:()=>Va,forEachMarkerRefInState:()=>Ga,forEachReachableShape:()=>Ut,forEachShapeInLibraryDefs:()=>za,formatSmilKeySpline:()=>fn,formatSmilKeyTime:()=>ie,freezeSiblingOrderKeys:()=>Rt,generateCode:()=>Fn,generateCssCode:()=>Dn,generateD3Code:()=>In,generateId:()=>_,generatePatternSvgContent:()=>nn,generatePuzzlePieces:()=>yo,generateReactCode:()=>Mn,generateSudokuPuzzle:()=>Ro,generateSvgCode:()=>An,generateVueCode:()=>Cn,generateWordSearch:()=>Lo,getBuiltInMarkerDefs:()=>Wa,getEasingCubicBezier:()=>Wo,getEffectivePrecision:()=>Ca,getKeyframeCubicBezier:()=>ps,getMarkerDescriptors:()=>je,getPatternElements:()=>Ht,getSmilAdditive:()=>bn,getSmilBeginValue:()=>Xe,getSmilFillMode:()=>Ke,getSmilMotionKeyPoints:()=>xn,getSmilRepeatCount:()=>yn,getSmilSetBeginValue:()=>gn,getSmilTrackDuration:()=>Be,getWordSearchDirections:()=>Is,initialOrderKeys:()=>ur,invertAffine:()=>bl,isDefaultKeyPoints:()=>hn,isDefaultKeyTimes:()=>qt,isFiniteAffineArray:()=>it,isIdentityAffine:()=>Di,isIdentityLinearSplines:()=>ys,isIndefiniteSetTrack:()=>pn,isReusablePatternTile:()=>Mi,isSetSequenceTrack:()=>mn,isValidOrderKey:()=>bt,keyBetween:()=>Ze,keysBetween:()=>lr,legacyEndpointMarkerId:()=>Vt,linearGradient:()=>uo,lintWordSearchOptions:()=>Ds,materializeSceneTreeOrderKeys:()=>ca,matrixTransformPart:()=>Ii,mergeRichTextStyle:()=>fr,migrateSnapshot:()=>Rr,moveResourceById:()=>Sr,multiplyAffine:()=>K,nodeSchemas:()=>D,normalizeRichTextRuns:()=>Ve,normalizeRichTextStyle:()=>ge,normalizeRichTextStyleDelta:()=>kt,orderSiblings:()=>We,parseDocument:()=>Cr,parseSvgTransformList:()=>Pr,parseVariableArgs:()=>Ra,parseWordSearchWords:()=>Fo,partitionShapeStateTree:()=>ze,partitionStateExtra:()=>cr,pathDataBounds:()=>ws,pattern:()=>fo,patternLibraryDefToCustomPatternDef:()=>Tr,patternTileSize:()=>Ci,planTransformFusion:()=>Sn,projectSceneTreeOntoClipMaskGroups:()=>Pt,projectSceneTreeOntoShapes:()=>$r,quadraticBezierExtent1D:()=>Rn,radialGradient:()=>co,rebaseRichTextFormatRanges:()=>Zs,rebaseRichTextRuns:()=>Js,reflectCubicBezier:()=>gs,removeTrackKeyframe:()=>Ri,renderAnimationElements:()=>kn,renderBuiltinMarkerDefs:()=>Se,renderCircle:()=>Yi,renderEllipse:()=>qi,renderFilterDefs:()=>Na,renderFilterLibraryDef:()=>hs,renderFilterPrimitive:()=>tn,renderFilterPrimitivesForType:()=>Hi,renderFlowchartBox:()=>is,renderImage:()=>rs,renderLibraryDef:()=>os,renderLibraryDefs:()=>Kt,renderLine:()=>Qi,renderLinearGradientLibraryDef:()=>cs,renderMarkerLibraryDef:()=>us,renderPatternLibraryDef:()=>fs,renderPolygonShape:()=>ss,renderPolyline:()=>ts,renderRadialGradientLibraryDef:()=>ds,renderRectangle:()=>Zi,renderReferencedLibraryDefs:()=>Ee,renderShape:()=>ee,renderSpline:()=>es,renderSvgPrimitiveChainFilter:()=>Wi,renderSymbolInstance:()=>ns,renderSymbolLibraryDef:()=>ls,renderText:()=>Ji,renderToSvg:()=>dt,resolveRichTextStyleAt:()=>qs,resolveSymbolInstanceShapes:()=>on,richTextFontVariantCss:()=>ct,richTextLineSpans:()=>ki,richTextRunsFromState:()=>yr,richTextStyleDelta:()=>hr,richTextStyleDeltasEqual:()=>gr,richTextStylesEqual:()=>mr,richTextTspanAttributes:()=>ln,rotateAffine:()=>st,roundCoord:()=>Nr,roundNumberString:()=>zi,roundSerializedShape:()=>Br,roundSnapshot:()=>Ia,runsFromSegments:()=>Ue,sanitizeRichTextFormatRanges:()=>br,scaleAffine:()=>It,skewXAffine:()=>Dt,skewYAffine:()=>Ft,smilKeyframeAttributes:()=>Zt,solveCubicBezier:()=>ms,solveSudoku:()=>nr,splinePathBounds:()=>io,stringifyDocument:()=>Mr,substituteString:()=>Ir,substituteVariables:()=>Er,symbolInstanceTargetId:()=>ut,transformSplice:()=>vt,translateAffine:()=>de,tryParseSvgTransformList:()=>Sa,upsertTrackKeyframe:()=>_i,validateSnapshot:()=>Nt,validateSudokuPuzzle:()=>_o,verticesToPath:()=>he});module.exports=Uo(ef);var ir=(A=>(A.LINEAR="linear",A.EASE="ease",A.EASE_IN="ease-in",A.EASE_OUT="ease-out",A.EASE_IN_OUT="ease-in-out",A.EASE_IN_QUAD="ease-in-quad",A.EASE_OUT_QUAD="ease-out-quad",A.EASE_IN_OUT_QUAD="ease-in-out-quad",A.EASE_IN_CUBIC="ease-in-cubic",A.EASE_OUT_CUBIC="ease-out-cubic",A.EASE_IN_OUT_CUBIC="ease-in-out-cubic",A.EASE_IN_QUART="ease-in-quart",A.EASE_OUT_QUART="ease-out-quart",A.EASE_IN_OUT_QUART="ease-in-out-quart",A.EASE_IN_SINE="ease-in-sine",A.EASE_OUT_SINE="ease-out-sine",A.EASE_IN_OUT_SINE="ease-in-out-sine",A.EASE_IN_QUINT="ease-in-quint",A.EASE_OUT_QUINT="ease-out-quint",A.EASE_IN_OUT_QUINT="ease-in-out-quint",A.EASE_IN_EXPO="ease-in-expo",A.EASE_OUT_EXPO="ease-out-expo",A.EASE_IN_OUT_EXPO="ease-in-out-expo",A.EASE_IN_CIRC="ease-in-circ",A.EASE_OUT_CIRC="ease-out-circ",A.EASE_IN_OUT_CIRC="ease-in-out-circ",A.EASE_IN_BACK="ease-in-back",A.EASE_OUT_BACK="ease-out-back",A.EASE_IN_OUT_BACK="ease-in-out-back",A.CUSTOM_BEZIER="custom-bezier",A.LINEAR_FUNCTION="linear-function",A.STEPS="steps",A))(ir||{}),sr={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 Wo(t){let e=sr[t];return e?`cubic-bezier(${e.join(", ")})`:"linear"}var mi=(a=>(a.LINEAR="linear",a.QUADRATIC="quadratic",a.CUBIC="cubic",a.CATMULL_ROM="catmull-rom",a.ARC="arc",a.BASIS="basis",a.MIXED="mixed",a))(mi||{}),Ns=(n=>(n.SMOOTH="smooth",n.CORNER="corner",n.SYMMETRIC="symmetric",n))(Ns||{});function Ho(t){return t==="color"?"live":"stamped"}var gi=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform","ancestorTransform","layerName","fillColor","borderColor","borderWidth","opacity","fillOpacity","strokeOpacity","locked","visible","fillType","fillGradient","strokeType","strokeGradient","fillRule","strokeLinejoin","strokeLinecap","strokeMiterlimit","lineStyle","dashLength","gapLength","dashOffset","strokeDasharray","colorInterpolation","filters","filterColorInterpolation","filterUnits","primitiveUnits","filterX","filterY","filterWidth","filterHeight","metadata","cssClipPath","cssMaskProperties","groupId","structural","displayMode","display","visibility","inheritFill","inheritStroke","preserveFillOpacity","preserveStrokeOpacity","fillLibraryId","strokeLibraryId","filterLibraryIds","fillRuleExplicit","paintOrder","vectorEffect","transformBox","pathLength","markerStart","markerMid","markerEnd","blendMode","shapeRendering","textRendering","imageRendering","colorRendering","systemLanguage","requiredExtensions","inlineStyle","bindings","scripts","lastSolidFillColor","lastSolidStrokeColor","connectionPoints","isRootSvg","x","y","width","height","rx","ry","cornerRadius","cornerShape","cornerMode","cornerRadiusTL","cornerRadiusTR","cornerRadiusBL","cornerRadiusBR","cornerShapeTL","cornerShapeTR","cornerShapeBL","cornerShapeBR","size","radius","cx","cy","shiftAngle","x1","y1","x2","y2","startEndpoint","endEndpoint","routingMode","sourceRef","targetRef","sourcePoint","targetPoint","waypoints","label","labelPosition","labelOffset","mermaidEdgeStyle","textX","textY","fontSize","text","fontFamily","fontWeight","fontStyle","fontVariant","fontVariantLigatures","fontVariantPosition","fontVariantCaps","fontVariantNumeric","fontVariantEastAsian","textDecoration","textTransform","baselineShift","dominantBaseline","writingMode","textAnchor","letterSpacing","wordSpacing","lineHeight","inlineSize","overflowWrap","whiteSpace","textDirection","unicodeBidi","useRichText","richTextRuns","richTextData","charOffsets","fontVariationSettings","linePositions","textLength","lengthAdjust","shapeInsideRef","shapePadding","isTextPath","textPathPoints","textPathStartOffset","textPathStartOffsetUnit","textPathSide","textPathMethod","textPathSpacing","textPathLengthAdjust","textPathLength","textPathLengthUnit","textPathPathLength","textPathCurveType","textPathInlineFormat","textPathRefShapeId","textPathImportRefId","href","originalWidth","originalHeight","preserveAspectRatio","specPreserveAspectRatio","imageOpacity","pathPoints","pathArcParams","pathControlBounds","pathCurveType","pathClosed","pathTension","polylinePoints","polylineClosed","sides","arms","innerRadiusPercent","armWidthPercent","turns","thicknessPercent","spiralDirection","teeth","toothDepthPercent","holeRadiusPercent","headWidthPercent","headLengthPercent","shaftWidthPercent","tailAngleDeg","tailLengthPercent","tailWidthPercent","lobeRadiusPercent","cleftDepthPercent","boltSegments","boltJaggednessPercent","boltWidthPercent","cloudBumps","cloudPuffinessPercent","slantPercent","topWidthPercent","capHeightPercent","waveAmplitudePercent","symbolId","symbolOverrides","variantKey","instancePresentation","scaleContentToViewport","groupData","mediaKind","mediaMimeType","naturalDuration","begin","trimStart","trimEnd","volume","muted","loop","playbackRate","mediaOpacity","fadeInDuration","fadeOutDuration","posterHref","sourceRect","hrefXlink","linkTarget","linkRel","linkDownload","linkPing","linkHreflang","linkType","linkReferrerPolicy","targetShapeId","offsetX","offsetY","targetWidth","targetHeight","broken","switchSystemLanguage","switchRequiredExtensions","svgX","svgY","svgWidth","svgHeight","svgViewBoxX","svgViewBoxY","svgViewBoxWidth","svgViewBoxHeight","svgPreserveAspectRatio","viewBoxX","viewBoxY","viewBoxWidth","viewBoxHeight","viewName","viewPreserveAspectRatio","viewZoomAndPan","viewTarget","isHomeView","children","viewLinkedSvgId"],ae=6;var yi=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform"],mt=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY"],bi={transformMatrix:null,translateX:0,translateY:0,rotation:0,skewX:0,skewY:0,customPivot:null,rawTransform:null};var $e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",or=$e.length,ve=$e[0],Os=$e[or-1],Gs=$e[Math.floor(or/2)],xi=97,jo=122;function qe(t){let e=$e.indexOf(t);if(e===-1)throw new Error(`order-key: invalid digit '${t}'`);return e}function Xo(t){let e=t.charCodeAt(0);if(e<xi||e>jo)throw new Error(`order-key: invalid head '${t}'`);return e-xi+1}function Ce(t){if(t<1||t>26)throw new Error(`order-key: integer length ${t} out of range`);return String.fromCharCode(xi+t-1)}function gt(t){let e=Xo(t[0]);if(t.length<1+e)throw new Error(`order-key: '${t}' shorter than its integer part`);let r=t.slice(1,1+e),n=t.slice(1+e);for(let i of r)qe(i);for(let i of n)qe(i);return{integer:r,fraction:n}}function ar(t){for(let e of t)if(e!==ve)return!1;return!0}function bt(t){if(t.length===0)return!1;try{let{integer:e,fraction:r}=gt(t);return!(r.endsWith(ve)||ar(e)&&r.length===0||e.length>1&&e[0]===ve)}catch{return!1}}function zs(t,e){if(!bt(t))throw new Error(`order-key: invalid ${e} '${t}'`)}function xt(t,e){return t<e?-1:t>e?1:0}function Ko(t){let e=t.split("");for(let r=e.length-1;r>=0;r--){let n=qe(e[r]);if(n<or-1){e[r]=$e[n+1];for(let i=r+1;i<e.length;i++)e[i]=ve;return e.join("")}}return null}function Si(t){let{integer:e}=gt(t),r=Ko(e);if(r!==null)return Ce(e.length)+r;let n="1"+ve.repeat(e.length);return Ce(n.length)+n}function Yo(t){let e=t.split("");for(let r=e.length-1;r>=0;r--){let n=qe(e[r]);if(n>0){e[r]=$e[n-1];for(let i=r+1;i<e.length;i++)e[i]=Os;return e.join("")}e[r]=Os}throw new Error(`order-key: cannot decrement zero integer '${t}'`)}function qo(t){let e=0;for(;e<t.length-1&&t[e]===ve;)e++;return t.slice(e)}function Zo(t){let{integer:e,fraction:r}=gt(t);if(!ar(e)){let n=Yo(e);if(!ar(n)){let i=qo(n);return Ce(i.length)+i}return Ce(1)+ve+Gs}return Ce(1)+ve+yt("",r)}function yt(t,e){if(e!==null){if(e.length===0||t>=e)throw new Error(`order-key: fraction bounds out of order ('${t}' >= '${e}')`);let i=0;for(;i<e.length&&(t[i]??ve)===e[i];)i++;if(i>0)return e.slice(0,i)+yt(t.slice(i),e.slice(i))}let r=t.length>0?qe(t[0]):0,n=e!==null?qe(e[0]):or;return n-r>1?$e[Math.floor((r+n)/2)]:$e[r]+yt(t.slice(1),null)}function Ze(t,e){if(t!==null&&zs(t,"lower bound"),e!==null&&zs(e,"upper bound"),t!==null&&e!==null&&t>=e)throw new Error(`order-key: bounds out of order ('${t}' >= '${e}')`);if(t===null&&e===null)return Ce(1)+"1";if(t===null)return Zo(e);if(e===null)return Si(t);let r=gt(t),n=gt(e),i=Ce(r.integer.length)+r.integer,s=Ce(n.integer.length)+n.integer;if(i===s)return i+yt(r.fraction,n.fraction);let o=Si(i+(ar(r.integer)?Gs:""));return xt(o,e)<0?o:i+yt(r.fraction,null)}function lr(t,e,r){if(r<=0)return[];let n=[],i=t;for(let s=0;s<r;s++){let o=Ze(i,e);n.push(o),i=o}return n}function ur(t){if(t<=0)return[];let e=[],r=Ze(null,null);e.push(r);for(let n=1;n<t;n++)r=Si(r),e.push(r);return e}var St=class{schemas=new Map;register(e,r){this.schemas.set(e,r)}get(e){return this.schemas.get(e)}typeIds(){return[...this.schemas.keys()]}getDefaults(e){let r=this.schemas.get(e);if(!r)return{};let n={};for(let i of Object.keys(r))n[i]=r[i].default;return n}validate(e,r,n){let i=this.schemas.get(e);if(!i)return n;let s=i[r];return s?.validate?s.validate(n):n}},I=t=>Math.max(0,t),Qe=t=>Math.max(0,Math.min(1,t)),X=t=>Math.max(0,Math.min(100,t)),Qo=t=>Math.max(1,t),Jo=t=>Math.max(3,Math.min(100,Math.floor(t))),el=t=>Math.max(3,Math.min(50,Math.floor(t))),tl=t=>Math.max(3,Math.min(30,Math.floor(t))),rl=t=>Math.max(1,Math.min(10,t));function nl(t){return Object.fromEntries(Object.entries(t).map(([e,r])=>[e,{default:r}]))}var il=nl(bi),H={layerName:{default:null},fillColor:{default:"#ffffff"},borderColor:{default:"#000000"},borderWidth:{default:1},opacity:{default:1,validate:Qe},fillOpacity:{default:1,validate:Qe},strokeOpacity:{default:1,validate:Qe},...il,locked:{default:!1},visible:{default:!0},fillType:{default:"solid"},fillGradient:{default:null},strokeType:{default:"solid"},strokeGradient:{default:null},fillRule:{default:"nonzero"},strokeLinejoin:{default:"miter"},strokeLinecap:{default:"butt"},strokeMiterlimit:{default:4,validate:Qo},lineStyle:{default:"solid"},dashLength:{default:8},gapLength:{default:4},dashOffset:{default:0},strokeDasharray:{default:null},colorInterpolation:{default:null},filters:{default:[]},filterColorInterpolation:{default:null},filterUnits:{default:null},primitiveUnits:{default:null},filterX:{default:null},filterY:{default:null},filterWidth:{default:null},filterHeight:{default:null},metadata:{default:null},cssClipPath:{default:null},cssMaskProperties:{default:null},groupId:{default:null}},le={...H,cx:{default:0},cy:{default:0},radius:{default:50,validate:I},cornerRadius:{default:0,validate:I},shiftAngle:{default:0}},Je={...H,x:{default:0},y:{default:0},width:{default:100,validate:I},height:{default:60,validate:I}},Vs={...H,x:{default:0},y:{default:0},width:{default:0,validate:I},height:{default:0,validate:I},href:{default:""},mediaMimeType:{default:""},originalWidth:{default:0},originalHeight:{default:0},naturalDuration:{default:0},preserveAspectRatio:{default:!0},begin:{default:0},trimStart:{default:0},volume:{default:1,validate:Qe},muted:{default:!1},loop:{default:!1},playbackRate:{default:1},mediaOpacity:{default:1,validate:Qe},fadeInDuration:{default:0,validate:I},fadeOutDuration:{default:0,validate:I},posterHref:{default:""},sourceRect:{default:null}},D=new St;D.register("rectangle",{...H,x:{default:0},y:{default:0},width:{default:100,validate:I},height:{default:100,validate:I},rx:{default:0,validate:I},ry:{default:0,validate:I},cornerRadius:{default:0,validate:I},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:I},cornerRadiusTR:{default:0,validate:I},cornerRadiusBL:{default:0,validate:I},cornerRadiusBR:{default:0,validate:I},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});D.register("square",{...H,x:{default:0},y:{default:0},width:{default:100,validate:I},height:{default:100,validate:I},rx:{default:0,validate:I},ry:{default:0,validate:I},cornerRadius:{default:0,validate:I},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:I},cornerRadiusTR:{default:0,validate:I},cornerRadiusBL:{default:0,validate:I},cornerRadiusBR:{default:0,validate:I},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});D.register("circle",{...H,x:{default:0},y:{default:0},radius:{default:50,validate:I}});D.register("ellipse",{...H,cx:{default:0},cy:{default:0},rx:{default:50,validate:I},ry:{default:30,validate:I}});D.register("line",{...H,x1:{default:0},y1:{default:0},x2:{default:100},y2:{default:0},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});D.register("text",{...H,x:{default:0},y:{default:0},width:{default:0,validate:I},height:{default:0,validate:I},textX:{default:0},textY:{default:0},fontSize:{default:24},text:{default:""},fontFamily:{default:"Arial"},fontWeight:{default:"normal"},fontStyle:{default:"normal"},fontVariant:{default:""},fontVariantLigatures:{default:""},fontVariantPosition:{default:""},fontVariantCaps:{default:""},fontVariantNumeric:{default:""},fontVariantEastAsian:{default:""},textDecoration:{default:{}},textTransform:{default:"none"},baselineShift:{default:"baseline"},dominantBaseline:{default:"auto"},writingMode:{default:"horizontal-tb"},textAnchor:{default:"start"},letterSpacing:{default:0},wordSpacing:{default:0},lineHeight:{default:1.2},inlineSize:{default:0},overflowWrap:{default:"normal"},whiteSpace:{default:"pre-wrap"},textDirection:{default:"ltr"},unicodeBidi:{default:"normal"},scaleX:{default:1},scaleY:{default:1},scaleAnchor:{default:null},useRichText:{default:!1},richTextRuns:{default:null},richTextData:{default:null},charOffsets:{default:null},fontVariationSettings:{default:{}},isTextPath:{default:!1},textPathPoints:{default:null},textPathStartOffset:{default:0},textPathSide:{default:"left"},shapeInsideRef:{default:null},shapePadding:{default:0}});D.register("image",{...H,x:{default:0},y:{default:0},width:{default:100,validate:I},height:{default:100,validate:I},href:{default:""},originalWidth:{default:0},originalHeight:{default:0},preserveAspectRatio:{default:!0},imageOpacity:{default:1,validate:Qe}});D.register("path",{...H,x:{default:0},y:{default:0},width:{default:0,validate:I},height:{default:0,validate:I},pathPoints:{default:[]},pathArcParams:{default:[]},pathControlBounds:{default:null},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});D.register("polyline",{...H,x:{default:0},y:{default:0},width:{default:0,validate:I},height:{default:0,validate:I},polylinePoints:{default:[]},polylineClosed:{default:!1}});D.register("triangle",{...le,sides:{default:3}});D.register("ngon",{...le,sides:{default:6,validate:Jo}});D.register("star",{...le,arms:{default:5,validate:el},innerRadiusPercent:{default:40,validate:X}});D.register("cross",{...le,armWidthPercent:{default:30,validate:X}});D.register("ring",{...le,innerRadiusPercent:{default:50,validate:X}});D.register("spiral",{...le,turns:{default:3,validate:rl},thicknessPercent:{default:15,validate:X},spiralDirection:{default:1}});D.register("gear",{...le,teeth:{default:8,validate:tl},toothDepthPercent:{default:25,validate:X},holeRadiusPercent:{default:20,validate:X}});D.register("arrow",{...le,headWidthPercent:{default:100,validate:X},headLengthPercent:{default:40,validate:X},shaftWidthPercent:{default:40,validate:X}});D.register("symbol-instance",{...H,x:{default:0},y:{default:0},width:{default:100,validate:I},height:{default:100,validate:I},symbolId:{default:""}});D.register("group",{...H,groupId:{default:null}});D.register("cloud",{...le,cloudBumps:{default:5},cloudPuffinessPercent:{default:60,validate:X}});D.register("heart",{...le,lobeRadiusPercent:{default:50,validate:X},cleftDepthPercent:{default:25,validate:X}});D.register("lightning",{...le,boltSegments:{default:3},boltWidthPercent:{default:30,validate:X},boltJaggednessPercent:{default:40,validate:X}});D.register("speechBubble",{...le,tailAngleDeg:{default:45},tailLengthPercent:{default:40,validate:X},tailWidthPercent:{default:25,validate:X}});D.register("diamond",{...Je});D.register("parallelogram",{...Je,slantPercent:{default:20,validate:X}});D.register("trapezoid",{...Je,topWidthPercent:{default:70,validate:X}});D.register("terminator",{...Je});D.register("cylinder",{...Je,capHeightPercent:{default:15,validate:X}});D.register("document-shape",{...Je,waveAmplitudePercent:{default:15,validate:X}});D.register("hyperlink",{...H,href:{default:""},hrefXlink:{default:""},linkTarget:{default:""},linkDownload:{default:""},linkPing:{default:""},linkRel:{default:""},linkHreflang:{default:""},linkType:{default:""},linkReferrerPolicy:{default:""}});D.register("switch",{...H,switchSystemLanguage:{default:""},switchRequiredExtensions:{default:""}});D.register("svg",{...H,svgX:{default:0},svgY:{default:0},svgWidth:{default:0,validate:I},svgHeight:{default:0,validate:I},svgViewBoxX:{default:0},svgViewBoxY:{default:0},svgViewBoxWidth:{default:0,validate:I},svgViewBoxHeight:{default:0,validate:I},svgPreserveAspectRatio:{default:""}});D.register("view",{...H,viewBoxX:{default:0},viewBoxY:{default:0},viewBoxWidth:{default:0,validate:I},viewBoxHeight:{default:0,validate:I},viewName:{default:""},viewPreserveAspectRatio:{default:""},viewTarget:{default:""}});D.register("shape-reference",{...H,targetShapeId:{default:""},offsetX:{default:0},offsetY:{default:0},targetWidth:{default:0,validate:I},targetHeight:{default:0,validate:I},broken:{default:!1}});D.register("video",{...Vs,mediaKind:{default:"video"}});D.register("audio",{...Vs,mediaKind:{default:"audio"}});D.register("document",{});function sl(){let t=new Set(gi);for(let e of yi)t.add(e);for(let e of D.typeIds())for(let r of Object.keys(D.getDefaults(e)))t.add(r);return t.delete("scaleAnchor"),t.delete("extra"),t}var $i=sl(),Us=new Set(["scaleAnchor","displayAttr"]);function cr(t){let e=t.extra&&typeof t.extra=="object"&&!Array.isArray(t.extra)?t.extra:void 0;for(let r of Object.keys(t)){if(r==="extra"||$i.has(r))continue;let n=t[r];delete t[r],n!==void 0&&((e??={})[r]=n)}return e&&Object.keys(e).length>0?t.extra=e:delete t.extra,t}function ze(t){if(!t?.state||typeof t.state!="object")return t;let e=t.state,r=e.children;if(Array.isArray(r))for(let i of r)ze(i);let n=e.symbolOverrides;if(n&&typeof n=="object"&&!Array.isArray(n))for(let i of Object.values(n))i&&typeof i=="object"&&!Array.isArray(i)&&cr(i);return cr(e),t}function $t(t){if(!t?.state||typeof t.state!="object")return t;let e=t.state,r=e.children;if(Array.isArray(r))for(let i of r)$t(i);let n=e.symbolOverrides;if(n&&typeof n=="object"&&!Array.isArray(n))for(let i of Object.values(n))i&&typeof i=="object"&&!Array.isArray(i)&&Te(i);return Te(e),t}function Te(t){let e=t.extra;if(!e||typeof e!="object"||Array.isArray(e))return delete t.extra,t;for(let[r,n]of Object.entries(e))r!=="extra"&&(r in t||(t[r]=n));return delete t.extra,t}function Ge(t,e,r,n="verbatim"){if(n==="verbatim")return new ke(t,e,r&&"extra"in r?Te({...r}):r);let i={...D.getDefaults(e),...r},s=D.get(e);if(s)for(let o of Object.keys(i)){let a=s[o];a?.validate&&i[o]!==void 0&&(i[o]=a.validate(i[o]))}return new ke(t,e,i)}var ke=class t{static writeHook=null;static _baseReadDepth=0;static withBaseProps(e){t._baseReadDepth++;try{return e()}finally{t._baseReadDepth--}}id;type;parent=null;children=[];onChange=null;_props;_dirty=new Set;_overlay=null;_propTimestamps=new Map;constructor(e,r,n){this.id=e,this.type=r,this._props=n?{...n}:{}}get(e){return this._overlay!==null&&t._baseReadDepth===0&&this._overlay.has(e)?this._overlay.get(e):this._props[e]}set(e,r){this._props[e]!==r&&(t.writeHook?.(this,e),this._props[e]=r,this._dirty.add(e),this.onChange?.(this,this._dirty))}getProp(e){return this._overlay!==null&&t._baseReadDepth===0&&this._overlay.has(e)?this._overlay.get(e):this._props[e]}getBaseProp(e){return this._props[e]}setProp(e,r){this._props[e]!==r&&(t.writeHook?.(this,e),this._props[e]=r,this._dirty.add(e),this.onChange?.(this,this._dirty))}setMany(e){let r=!1;for(let[n,i]of Object.entries(e))this._props[n]!==i&&(t.writeHook?.(this,n),this._props[n]=i,this._dirty.add(n),r=!0);r&&this.onChange?.(this,this._dirty)}setOverlayValue(e,r){this._overlay===null&&(this._overlay=new Map),this._overlay.set(e,r)}deleteOverlayValue(e){if(this._overlay===null)return!1;let r=this._overlay.delete(e);return this._overlay.size===0&&(this._overlay=null),r}getOverlayValue(e){return this._overlay?.get(e)}hasOverlayValue(e){return this._overlay?.has(e)??!1}overlayKeys(){return this._overlay?[...this._overlay.keys()]:[]}clearOverlay(){if(this._overlay===null)return[];let e=[...this._overlay.keys()];return this._overlay=null,e}get hasOverlay(){return this._overlay!==null}getDirtyKeys(){return this._dirty}clearDirty(){this._dirty.clear()}isDirty(){return this._dirty.size>0}getProps(){return this._props}snapshotProps(){return structuredClone(this._props)}restoreProps(e){this._props=structuredClone(e);for(let r of Object.keys(this._props))this._dirty.add(r);this.onChange?.(this,this._dirty)}getPropStamp(e){return this._propTimestamps.get(e)??null}stampProp(e,r,n){this._propTimestamps.set(e,{ts:r,clientId:n})}stampProps(e,r,n){let i={ts:r,clientId:n};for(let s of e)this._propTimestamps.set(s,i)}getPropStampsForKeys(e){let r={};for(let n of e){let i=this._propTimestamps.get(n);i&&(r[n]=i.ts)}return r}setPropIfWins(e,r,n,i){let s=this._propTimestamps.get(e),o=s?.ts??0,a=s?.clientId??"";return n>o||n===o&&i>a?(this._props[e]=r,this._propTimestamps.set(e,{ts:n,clientId:i}),this._dirty.add(e),!0):!1}snapshotPropTimestamps(){return new Map(this._propTimestamps)}restorePropTimestamps(e){this._propTimestamps=new Map(e)}toSerialized(){return{id:this.id,type:this.type,state:{...this._props}}}static fromSerialized(e){return Ge(e.id,e.type,e.state,"verbatim")}static create(e,r,n){return Ge(e,r,n,"authoring")}};var al=5e3,ol=1e4;function ll(t){return t===null||t.size===0?"":[...t.entries()].sort((e,r)=>r[1].count-e[1].count).slice(0,5).map(([e,r])=>`${e.type}#${e.id} x${r.count} keys=[${[...r.keys].join(",")}]`).join("; ")}var dr=class t{static _pendingGraphs=new Set;static flushAllPending(){if(t._pendingGraphs.size!==0)for(let e of[...t._pendingGraphs])e.flushBatched()}static get pendingGraphCount(){return t._pendingGraphs.size}root;_nodesById=new Map;_batchDepth=0;_batchDirtyNodes=new Map;_draining=!1;_changeListeners=[];_structureListeners=[];constructor(){this.root=Ge("__root__","document"),this._nodesById.set(this.root.id,this.root)}onNodeChange(e){return this._changeListeners.push(e),()=>{let r=this._changeListeners.indexOf(e);r>=0&&this._changeListeners.splice(r,1)}}onStructureChange(e){return this._structureListeners.push(e),()=>{let r=this._structureListeners.indexOf(e);r>=0&&this._structureListeners.splice(r,1)}}addNode(e,r,n){let i=r??this.root;n!==void 0&&n>=0&&n<i.children.length?i.children.splice(n,0,e):i.children.push(e),e.parent=i,this._nodesById.set(e.id,e),e.onChange=this._handleNodeChange.bind(this),this._emitStructure("add",e,null,i)}removeNode(e){let r=this._nodesById.get(e);if(!r||r===this.root)return null;let n=r.parent,i=null;if(n){let s=n.children.indexOf(r);i={parentId:n===this.root?null:n.id,index:s},s>=0&&n.children.splice(s,1)}return r.parent=null,r.onChange=null,this._nodesById.delete(e),this._batchDirtyNodes.delete(r),this._removeDescendants(r),this._batchDirtyNodes.size===0&&t._pendingGraphs.delete(this),this._emitStructure("remove",r,n,null,i),r}getNode(e){return this._nodesById.get(e)??null}moveNode(e,r,n){let i=this._nodesById.get(e);if(!i||i===this.root)return;let s=i.parent,o=null;if(s){let a=s.children.indexOf(i);o={parentId:s===this.root?null:s.id,index:a},a>=0&&s.children.splice(a,1)}n!==void 0&&n>=0&&n<r.children.length?r.children.splice(n,0,i):r.children.push(i),i.parent=r,this._emitStructure("move",i,s,r,o)}moveNodeToParentId(e,r,n){let i=r?this._nodesById.get(r):this.root;i&&this.moveNode(e,i,n)}getChildren(e){let r=e?this._nodesById.get(e):this.root;return r?[...r.children]:[]}getRootShapes(){return[...this.root.children]}getParentId(e){let r=this._nodesById.get(e);return!r||!r.parent||r.parent===this.root?null:r.parent.id}getSiblingIndex(e){let r=this._nodesById.get(e);return!r||!r.parent?-1:r.parent.children.indexOf(r)}getAncestorIds(e){let r=[],n=this.getParentId(e);for(;n;)r.push(n),n=this.getParentId(n);return r}isAncestor(e,r){if(e===r)return!1;let n=this.getParentId(r);for(;n;){if(n===e)return!0;n=this.getParentId(n)}return!1}isDocumentRootNode(e){let r=this._nodesById.get(e);return!!r&&r!==this.root&&r.getProp("isRootSvg")===!0}contains(e,r){if(e===r)return!1;if(this.isDocumentRootNode(e)){let n=this._nodesById.get(r);return!!n&&n!==this.root&&!this.isDocumentRootNode(r)}return this.isAncestor(e,r)}getDepth(e){let r=this._nodesById.get(e);if(!r||r===this.root)return-1;let n=0,i=r.parent;for(;i&&i!==this.root;)n++,i=i.parent;return n}getAllNodes(){let e=[];for(let r of this._nodesById.values())r!==this.root&&e.push(r);return e}getDirtyNodes(){let e=[];for(let r of this._nodesById.values())r.isDirty()&&e.push(r);return e}clearAllDirty(){for(let e of this._nodesById.values())e.clearDirty()}beginBatch(){this._batchDepth++}commitBatch(){this._batchDepth=Math.max(0,this._batchDepth-1),this._batchDepth===0&&this._drainBatched()}flushBatched(){this._batchDirtyNodes.size>0&&this._drainBatched()}get hasPendingBatched(){return this._batchDirtyNodes.size>0}get isBatching(){return this._batchDepth>0}get isDraining(){return this._draining}dispose(){t._pendingGraphs.delete(this),this._batchDirtyNodes.clear(),this._changeListeners.length=0,this._structureListeners.length=0}notifyNodeChanged(e,r){this._handleNodeChange(e,r)}_handleNodeChange(e,r){if(this._batchDepth>0){let n=this._batchDirtyNodes.get(e);n||(n=new Set,this._batchDirtyNodes.set(e,n),t._pendingGraphs.add(this));for(let i of r)n.add(i);return}this._fireChangeListeners(e,r)}_drainBatched(){if(this._draining)return;this._draining=!0;let e=0,r=null;try{for(;this._batchDirtyNodes.size>0;){if(++e>ol){console.error("[SceneGraph] batched-notification drain did not converge \u2014 render loop?",ll(r)),this._batchDirtyNodes.clear();break}let[n,i]=this._batchDirtyNodes.entries().next().value;if(this._batchDirtyNodes.delete(n),this._batchDirtyNodes.size===0&&t._pendingGraphs.delete(this),e>al){r===null&&(r=new Map);let s=r.get(n);if(s){s.count++;for(let o of i)s.keys.add(o)}else r.set(n,{count:1,keys:new Set(i)})}this._fireChangeListeners(n,i)}}finally{this._draining=!1,this._batchDirtyNodes.size===0&&t._pendingGraphs.delete(this)}}_fireChangeListeners(e,r){let n=[...this._changeListeners];for(let i of n)i(e,r)}_emitStructure(e,r,n,i,s=null){let o=[...this._structureListeners];for(let a of o)a(e,r,n,i,s)}_removeDescendants(e){for(let r of e.children)r.onChange=null,this._nodesById.delete(r.id),this._batchDirtyNodes.delete(r),this._removeDescendants(r)}serializeShapes(){let e=[],r=n=>{for(let i of n)i.type!=="document"&&i.type!=="group"&&i.getProp("structural")!==!0&&e.push(i.toSerialized()),i.children.length>0&&r(i.children)};return r(this.root.children),e}static fromShapes(e){let r=new t;for(let n of e){let i=ke.fromSerialized(n);r.addNode(i)}return r}};function ce(t,e,r){let n=typeof e.id=="string"?e.id:"",i=(t??[]).filter(o=>o.id!==n),s=typeof r=="number"&&Number.isFinite(r)?Math.max(0,Math.min(r,i.length)):i.length;return i.splice(s,0,e),i}function me(t,e){return(t??[]).filter(r=>r.id!==e)}function Ws(t,e){if(t===e)return null;let r=0,n=Math.min(t.length,e.length);for(;r<n&&t.charCodeAt(r)===e.charCodeAt(r);)r++;let i=0,s=Math.min(t.length,e.length)-r;for(;i<s&&t.charCodeAt(t.length-1-i)===e.charCodeAt(e.length-1-i);)i++;return{start:r,deleteCount:t.length-r-i,insert:e.slice(r,e.length-i)}}function Hs(t,e){return t.slice(0,e.start)+e.insert+t.slice(e.start+e.deleteCount)}function vt(t,e){let r=e.start,n=e.start+e.deleteCount,i=e.insert.length-e.deleteCount,s=t.start,o=t.start+t.deleteCount;return n<=s?{start:s+i,deleteCount:t.deleteCount,insert:t.insert}:r>=o?{start:s,deleteCount:t.deleteCount,insert:t.insert}:r<=s&&n>=o?{start:r+e.insert.length,deleteCount:0,insert:t.insert}:r>=s&&n<=o?{start:s,deleteCount:t.deleteCount+i,insert:t.insert}:r<s?{start:r+e.insert.length,deleteCount:t.deleteCount-(n-s),insert:t.insert}:{start:s,deleteCount:r-s,insert:t.insert}}var Tt={fontFamily:"Arial",fontSize:16,fontWeight:"normal",fontStyle:"normal",fontVariant:"",fontVariantLigatures:"",fontVariantPosition:"",fontVariantCaps:"",fontVariantNumeric:"",fontVariantEastAsian:"",textDecoration:{underline:!1,strikethrough:!1,overline:!1},textTransform:"none",baselineShift:"baseline",dominantBaseline:"auto",writingMode:"horizontal-tb",whiteSpace:"pre-wrap",direction:"ltr",unicodeBidi:"normal",textAnchor:"start",letterSpacing:0,wordSpacing:0,lineHeight:1.2,fontVariationSettings:{},fill:"#000000",fillOpacity:1,stroke:"none",strokeWidth:0,strokeOpacity:1},et=Object.keys(Tt);function Pe(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function we(t){return typeof t=="string"?t:void 0}function Z(t){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t=="string"&&t.trim()!==""){let e=Number.parseFloat(t);return Number.isFinite(e)?e:void 0}}function Ie(t){return e=>typeof e=="string"&&t.includes(e)?e:void 0}function ul(t){return t==="normal"||t==="bold"?t:Z(t)}function cl(t){return t==="baseline"||t==="super"||t==="sub"?t:Z(t)}function Xs(t){if(typeof t=="string"){let r=t.toLowerCase();return{underline:r.includes("underline"),strikethrough:r.includes("line-through")||r.includes("strikethrough"),overline:r.includes("overline")}}if(!Pe(t))return;let e={};return typeof t.underline=="boolean"&&(e.underline=t.underline),typeof t.strikethrough=="boolean"&&(e.strikethrough=t.strikethrough),typeof t.overline=="boolean"&&(e.overline=t.overline),e}function Ks(t){if(!Pe(t))return;let e={};for(let[r,n]of Object.entries(t)){let i=Z(n);i!==void 0&&(e[r]=i)}return e}var Ys={fontFamily:we,fontSize:Z,fontWeight:ul,fontStyle:Ie(["normal","italic","oblique"]),fontVariant:we,fontVariantLigatures:we,fontVariantPosition:we,fontVariantCaps:we,fontVariantNumeric:we,fontVariantEastAsian:we,textTransform:Ie(["none","capitalize","uppercase","lowercase"]),baselineShift:cl,dominantBaseline:Ie(["auto","alphabetic","central","middle","hanging","ideographic","mathematical","text-top","text-bottom"]),writingMode:Ie(["horizontal-tb","vertical-rl","vertical-lr"]),whiteSpace:Ie(["normal","nowrap","pre","pre-wrap","pre-line","break-spaces"]),direction:Ie(["ltr","rtl"]),unicodeBidi:Ie(["normal","embed","bidi-override","isolate","isolate-override","plaintext"]),textAnchor:Ie(["start","middle","end"]),letterSpacing:Z,wordSpacing:Z,lineHeight:Z,fill:we,fillOpacity:Z,stroke:we,strokeWidth:Z,strokeOpacity:Z};function fr(t,e){return{...t,...e,textDecoration:{...t.textDecoration,...e.textDecoration??{}},fontVariationSettings:{...e.fontVariationSettings??t.fontVariationSettings}}}function Ti(t,e){let r=Object.keys(t);return r.length!==Object.keys(e).length?!1:r.every(n=>Object.prototype.hasOwnProperty.call(e,n)&&t[n]===e[n])}function mr(t,e){for(let r of et)if(r==="textDecoration"){if(t.textDecoration.underline!==e.textDecoration.underline||t.textDecoration.strikethrough!==e.textDecoration.strikethrough||t.textDecoration.overline!==e.textDecoration.overline)return!1}else if(r==="fontVariationSettings"){if(!Ti(t.fontVariationSettings,e.fontVariationSettings))return!1}else if(t[r]!==e[r])return!1;return!0}function gr(t,e){let r=Object.keys(t).sort(),n=Object.keys(e).sort();if(r.length!==n.length||r.some((i,s)=>i!==n[s]))return!1;for(let i of r)if(i==="textDecoration"){let s=t.textDecoration??{},o=e.textDecoration??{},a=new Set([...Object.keys(s),...Object.keys(o)]);for(let u of a){let c=u;if(s[c]!==o[c])return!1}}else if(i==="fontVariationSettings"){if(!Ti(t.fontVariationSettings??{},e.fontVariationSettings??{}))return!1}else{let s=i;if(t[s]!==e[s])return!1}return!0}function hr(t,e){let r={};for(let i of et)i==="textDecoration"||i==="fontVariationSettings"||t[i]!==e[i]&&(r[i]=t[i]);let n={};return t.textDecoration.underline!==e.textDecoration.underline&&(n.underline=t.textDecoration.underline),t.textDecoration.strikethrough!==e.textDecoration.strikethrough&&(n.strikethrough=t.textDecoration.strikethrough),t.textDecoration.overline!==e.textDecoration.overline&&(n.overline=t.textDecoration.overline),Object.keys(n).length>0&&(r.textDecoration=n),Ti(t.fontVariationSettings,e.fontVariationSettings)||(r.fontVariationSettings={...t.fontVariationSettings}),r}function ge(t,e=Tt){let r=Pe(t)?t:{},n={...e};for(let i of et){if(i==="textDecoration"||i==="fontVariationSettings")continue;let s=Ys[i](r[i]);s!==void 0&&(n[i]=s)}return n.textDecoration={...e.textDecoration,...Xs(r.textDecoration)??{}},n.fontVariationSettings={...Ks(r.fontVariationSettings)??e.fontVariationSettings},n}function kt(t){let e=Pe(t)?t:{},r={};for(let n of et){if(n==="textDecoration"||n==="fontVariationSettings"||e[n]===void 0)continue;let i=Ys[n](e[n]);i!==void 0&&(r[n]=i)}if(e.textDecoration!==void 0){let n=Xs(e.textDecoration);n&&Object.keys(n).length>0&&(r.textDecoration=n)}if(e.fontVariationSettings!==void 0){let n=Ks(e.fontVariationSettings);n&&(r.fontVariationSettings=n)}return r}function ki(t){let e=[],r=0;for(;;){let n=t.indexOf(`
|
|
2
|
-
`,r);if(n===-1)return e.push({text:t.slice(r),start:r,end:t.length}),e;e.push({text:t.slice(r,n),start:r,end:n}),r=n+1}}function
|
|
3
|
-
`),a+=1);let d=i[f]?.segments,
|
|
4
|
-
`)&&
|
|
1
|
+
"use strict";var Hi=Object.defineProperty;var tu=Object.getOwnPropertyDescriptor;var ru=Object.getOwnPropertyNames;var nu=Object.prototype.hasOwnProperty;var iu=(t,e)=>{for(var r in e)Hi(t,r,{get:e[r],enumerable:!0})},su=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ru(e))!nu.call(t,i)&&i!==r&&Hi(t,i,{get:()=>e[i],enumerable:!(n=tu(e,i))||n.enumerable});return t};var au=t=>su(Hi({},"__esModule",{value:!0}),t);var _p={};iu(_p,{Arrow:()=>_i,Audio:()=>zi,BUILTIN_MARKER_ID_MAP:()=>Fs,COLLAB_PROTOCOL_VERSION:()=>Io,COMMON_PROP_DEFAULTS:()=>J,COMMON_TRANSFORM_NODE_DEFAULTS:()=>Yi,CURRENT_SCHEMA_VERSION:()=>xe,Circle:()=>mi,Cloud:()=>Ii,Container:()=>Fi,ContainerShapeBuilder:()=>et,Cross:()=>ki,DEFAULT_COORDINATE_PRECISION:()=>Ko,DEFAULT_RICH_TEXT_STYLE:()=>jt,Document:()=>$r,DocumentBuilder:()=>$r,EASING_CURVES:()=>Rr,EasingType:()=>_r,Ellipse:()=>hi,Gear:()=>Pi,Heart:()=>Ri,Hyperlink:()=>Ci,IDENTITY_AFFINE:()=>er,ImageShape:()=>Ui,KNOWN_STATE_KEYS:()=>Ji,LIBRARY_EMIT_ORDER:()=>Ks,Lightning:()=>Ai,Line:()=>bi,LinearGradientBuilder:()=>vr,MARKER_HEIGHT:()=>Ln,MARKER_VIEWBOX:()=>hr,MARKER_WIDTH:()=>On,MAX_COORDINATE_PRECISION:()=>Xo,MIGRATIONS:()=>Ts,NGon:()=>$i,NON_WIRE_PROP_KEYS:()=>Ia,NUMERIC_SHAPE_TRANSFORM_STATE_KEYS:()=>Lt,NestedSvg:()=>Oi,NodeSchemaRegistry:()=>Vt,PUZZLE_DEFAULTS:()=>pa,Path:()=>Gi,PathCurveType:()=>ji,PathPointType:()=>wa,PatternBuilder:()=>Tr,Polyline:()=>Vi,RICH_TEXT_STYLE_KEYS:()=>St,RadialGradientBuilder:()=>kr,Rectangle:()=>gi,Ring:()=>Ti,SERIALIZED_SHAPE_STATE_KEYS:()=>Ki,SHAPE_TRANSFORM_STATE_KEYS:()=>Xi,SceneGraph:()=>Fr,SceneNode:()=>Ne,ShapeBuilder:()=>ae,ShapeReference:()=>Li,SpeechBubble:()=>Mi,Spiral:()=>wi,Square:()=>yi,Star:()=>vi,Switch:()=>Di,Text:()=>xi,Timeline:()=>pi,Track:()=>fi,Triangle:()=>Si,Video:()=>Bi,View:()=>Ei,affine:()=>Ue,affineFromArray:()=>tn,affineToArray:()=>Xe,almostEqualAffine:()=>Uu,applyAffineToPoint:()=>Hu,applyAffineToVector:()=>ju,applyOpToSnapshot:()=>hs,applyOpsToSnapshot:()=>To,applyOpsToSnapshotWithAccepted:()=>gs,applyRichTextFormat:()=>Xt,applyTextSplice:()=>Ja,applyTextTransform:()=>gr,arcEndpointToCenter:()=>ua,areTracksTimingEquivalent:()=>sa,around:()=>xs,buildCompoundTransformValues:()=>Jn,buildSmilKeyframeData:()=>Qe,canonicalPolygonTransformString:()=>$s,canonicalTransformString:()=>Rt,collaborationResourceKey:()=>ls,collectMarkerReferences:()=>pr,collectReferencedLibraryDefs:()=>br,collectReferencedMarkerIds:()=>ol,compareOrderKeys:()=>Gt,composeLegacyTransformMatrix:()=>ir,computeArrowVertices:()=>Sn,computeCloudPath:()=>Tn,computeCrossVertices:()=>xn,computeDashArray:()=>It,computeFlowchartBoxPath:()=>An,computeGearPath:()=>_n,computeGearVertices:()=>Is,computeHeartPath:()=>kn,computeLightningVertices:()=>vn,computePolygonVertices:()=>cr,computeRectanglePath:()=>Rn,computeRingPath:()=>wn,computeSpeechBubbleVertices:()=>$n,computeSpiralPath:()=>Pn,computeSplinePath:()=>Ye,computeStarVertices:()=>bn,createDocument:()=>on,createSceneNode:()=>rt,createShape:()=>Ho,createViewbox:()=>lr,createWordSearchPrimitiveMask:()=>eu,cubicBezierExtent1D:()=>ii,customPatternDefToLibraryDef:()=>Ve,declaredRichTextDeltaKeys:()=>Wr,decomposeAffine2D:()=>hc,defaultVariableMode:()=>lu,deriveRichTextFormatRanges:()=>so,deriveSegments:()=>Ge,deriveTextSplice:()=>Za,downTranslateAnimationKeyframeOps:()=>_o,downTranslateCollectionMoveOps:()=>Ao,downTranslateDocumentFieldOps:()=>Mo,downTranslateScenePlaceOps:()=>Po,downTranslateTextFormatOps:()=>Ro,ellipticalArcBounds:()=>ca,escXml:()=>Z,extractVariables:()=>mn,filterAttr:()=>Fn,findShapeById:()=>lt,flattenShapeStateTree:()=>Ut,flattenStateExtra:()=>Le,foldLegacyAncestorTransformIntoMatrix:()=>Ss,forEachLibraryRefInState:()=>al,forEachMarkerRefInState:()=>sl,forEachReachableShape:()=>fr,forEachShapeInLibraryDefs:()=>il,formatOperationValidationIssues:()=>qa,formatSmilKeySpline:()=>Un,formatSmilKeyTime:()=>ye,freezeSiblingOrderKeys:()=>Jt,generateCode:()=>di,generateCssCode:()=>ci,generateD3Code:()=>ui,generateId:()=>_,generatePatternSvgContent:()=>En,generatePuzzlePieces:()=>Fl,generateReactCode:()=>oi,generateSudokuPuzzle:()=>Hl,generateSvgCode:()=>ai,generateVueCode:()=>li,generateWordSearch:()=>Ql,getBuiltInMarkerDefs:()=>ll,getEasingCubicBezier:()=>ou,getEffectivePrecision:()=>Yo,getKeyframeCubicBezier:()=>ta,getMarkerDescriptors:()=>dt,getPatternElements:()=>mr,getSmilAdditive:()=>Yn,getSmilBeginValue:()=>ft,getSmilFillMode:()=>pt,getSmilMotionKeyPoints:()=>qn,getSmilRepeatCount:()=>Xn,getSmilSetBeginValue:()=>Kn,getSmilTrackDuration:()=>Je,getWordSearchDirections:()=>xa,initialOrderKeys:()=>Cr,invertAffine:()=>Wu,isDefaultKeyPoints:()=>Wn,isDefaultKeyTimes:()=>xr,isFiniteAffineArray:()=>Pt,isIdentityAffine:()=>bs,isIdentityLinearSplines:()=>ia,isIndefiniteSetTrack:()=>Hn,isReusablePatternTile:()=>Yt,isSetSequenceTrack:()=>jn,isValidOrderKey:()=>zt,keyBetween:()=>gt,keysBetween:()=>Mr,legacyEndpointMarkerId:()=>dr,linearGradient:()=>_l,lintWordSearchOptions:()=>Sa,materializeSceneTreeOrderKeys:()=>wo,matrixTransformPart:()=>ys,maxCollaborationTimestamp:()=>ho,mergeRichTextStyle:()=>Vr,migrateSnapshot:()=>sn,moveResourceById:()=>Jr,multiplyAffine:()=>re,nodeSchemas:()=>O,normalizeRichTextRuns:()=>it,normalizeRichTextStyle:()=>Ie,normalizeRichTextStyleDelta:()=>Kt,orderSiblings:()=>Te,parseDocument:()=>un,parseSvgTransformList:()=>rn,parseVariableArgs:()=>jo,parseWordSearchWords:()=>Zl,partitionShapeStateTree:()=>tt,partitionStateExtra:()=>Dr,pathDataBounds:()=>fa,pattern:()=>Al,patternLibraryDefToCustomPatternDef:()=>$t,patternTileSize:()=>ss,planTransformFusion:()=>Zn,projectSceneTreeOntoClipMaskGroups:()=>kt,projectSceneTreeOntoShapes:()=>vt,promoteRebasedShapeUpdateClock:()=>go,quadraticBezierExtent1D:()=>si,radialGradient:()=>Rl,rebaseRichTextFormatRanges:()=>io,rebaseRichTextRuns:()=>ao,reflectCubicBezier:()=>na,removeResourceById:()=>ge,removeResourceByKey:()=>Br,removeResourceByName:()=>Gr,removeTrackKeyframe:()=>ps,renderAnimationElements:()=>ti,renderBuiltinMarkerDefs:()=>Fe,renderCircle:()=>Os,renderEllipse:()=>Ls,renderFilterDefs:()=>rl,renderFilterLibraryDef:()=>ea,renderFilterPrimitive:()=>Dn,renderFilterPrimitivesForType:()=>Cs,renderFlowchartBox:()=>Hs,renderImage:()=>Us,renderLibraryDef:()=>Xs,renderLibraryDefs:()=>yr,renderLine:()=>Bs,renderLinearGradientLibraryDef:()=>Zs,renderMarkerLibraryDef:()=>qs,renderPatternLibraryDef:()=>Qs,renderPolygonShape:()=>js,renderPolyline:()=>Vs,renderRadialGradientLibraryDef:()=>Js,renderRectangle:()=>Ns,renderReferencedLibraryDefs:()=>qe,renderShape:()=>de,renderSpline:()=>Gs,renderSvgPrimitiveChainFilter:()=>Ms,renderSymbolInstance:()=>Ws,renderSymbolLibraryDef:()=>Ys,renderText:()=>zs,renderToSvg:()=>Dt,resolveRichTextStyleAt:()=>no,resolveSymbolInstanceShapes:()=>Nn,rewriteDocumentEmbeddedPayloads:()=>Vo,rewriteShapeStateEmbeddedPayloads:()=>an,richTextFontVariantCss:()=>Ct,richTextLineSpans:()=>ns,richTextRunsFromState:()=>Kr,richTextStyleDelta:()=>Ur,richTextStyleDeltasEqual:()=>jr,richTextStylesEqual:()=>Hr,richTextTspanAttributes:()=>Bn,rotateAffine:()=>_t,roundCoord:()=>gn,roundNumberString:()=>_s,roundSerializedShape:()=>hn,roundSnapshot:()=>qo,runsFromSegments:()=>st,sanitizeRichTextFormatRanges:()=>Xr,scaleAffine:()=>tr,skewXAffine:()=>rr,skewYAffine:()=>nr,smilKeyframeAttributes:()=>Sr,solveCubicBezier:()=>ra,solveSudoku:()=>Pr,splinePathBounds:()=>vl,stringifyDocument:()=>ln,substituteString:()=>cn,substituteVariables:()=>pn,symbolInstanceTargetId:()=>Mt,transformSplice:()=>Ht,translateAffine:()=>Pe,tryParseSvgTransformList:()=>Lo,upsertResourceById:()=>he,upsertResourceByKey:()=>Nr,upsertResourceByName:()=>zr,upsertTrackKeyframe:()=>fs,validateDocumentOperations:()=>Xa,validateOperation:()=>Lr,validatePresenceOperation:()=>Ya,validateSnapshot:()=>or,validateSudokuPuzzle:()=>Wl,verticesToPath:()=>Re});module.exports=au(_p);var _r=(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))(_r||{}),Rr={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 ou(t){let e=Rr[t];return e?`cubic-bezier(${e.join(", ")})`:"linear"}var ji=(a=>(a.LINEAR="linear",a.QUADRATIC="quadratic",a.CUBIC="cubic",a.CATMULL_ROM="catmull-rom",a.ARC="arc",a.BASIS="basis",a.MIXED="mixed",a))(ji||{}),wa=(n=>(n.SMOOTH="smooth",n.CORNER="corner",n.SYMMETRIC="symmetric",n))(wa||{});function lu(t){return t==="color"?"live":"stamped"}var Ki=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform","ancestorTransform","layerName","fillColor","borderColor","borderWidth","opacity","fillOpacity","strokeOpacity","locked","visible","fillType","fillGradient","strokeType","strokeGradient","fillRule","strokeLinejoin","strokeLinecap","strokeMiterlimit","lineStyle","dashLength","gapLength","dashOffset","strokeDasharray","colorInterpolation","filters","filterColorInterpolation","filterUnits","primitiveUnits","filterX","filterY","filterWidth","filterHeight","metadata","cssClipPath","cssMaskProperties","groupId","structural","displayMode","display","visibility","inheritFill","inheritStroke","preserveFillOpacity","preserveStrokeOpacity","fillLibraryId","strokeLibraryId","filterLibraryIds","fillRuleExplicit","paintOrder","vectorEffect","transformBox","pathLength","markerStart","markerMid","markerEnd","blendMode","shapeRendering","textRendering","imageRendering","colorRendering","systemLanguage","requiredExtensions","inlineStyle","authoredAttributes","bindings","scripts","lastSolidFillColor","lastSolidStrokeColor","connectionPoints","isRootSvg","x","y","width","height","rx","ry","cornerRadius","cornerShape","cornerMode","cornerRadiusTL","cornerRadiusTR","cornerRadiusBL","cornerRadiusBR","cornerShapeTL","cornerShapeTR","cornerShapeBL","cornerShapeBR","size","radius","cx","cy","shiftAngle","x1","y1","x2","y2","startEndpoint","endEndpoint","routingMode","sourceRef","targetRef","sourcePoint","targetPoint","waypoints","label","labelPosition","labelOffset","mermaidEdgeStyle","textX","textY","fontSize","text","fontFamily","fontWeight","fontStyle","fontVariant","fontVariantLigatures","fontVariantPosition","fontVariantCaps","fontVariantNumeric","fontVariantEastAsian","textDecoration","textTransform","baselineShift","dominantBaseline","writingMode","textAnchor","letterSpacing","wordSpacing","lineHeight","inlineSize","overflowWrap","whiteSpace","textDirection","unicodeBidi","useRichText","richTextRuns","richTextData","charOffsets","fontVariationSettings","linePositions","textLength","lengthAdjust","shapeInsideRef","shapePadding","isTextPath","textPathPoints","textPathStartOffset","textPathStartOffsetUnit","textPathSide","textPathMethod","textPathSpacing","textPathLengthAdjust","textPathLength","textPathLengthUnit","textPathPathLength","textPathCurveType","textPathInlineFormat","textPathRefShapeId","textPathImportRefId","href","originalWidth","originalHeight","preserveAspectRatio","specPreserveAspectRatio","imageOpacity","pathPoints","pathArcParams","pathControlBounds","pathCurveType","pathClosed","pathTension","polylinePoints","polylineClosed","sides","arms","innerRadiusPercent","armWidthPercent","turns","thicknessPercent","spiralDirection","teeth","toothDepthPercent","holeRadiusPercent","headWidthPercent","headLengthPercent","shaftWidthPercent","tailAngleDeg","tailLengthPercent","tailWidthPercent","lobeRadiusPercent","cleftDepthPercent","boltSegments","boltJaggednessPercent","boltWidthPercent","cloudBumps","cloudPuffinessPercent","slantPercent","topWidthPercent","capHeightPercent","waveAmplitudePercent","symbolId","symbolOverrides","variantKey","instancePresentation","scaleContentToViewport","groupData","mediaKind","mediaMimeType","naturalDuration","begin","trimStart","trimEnd","volume","muted","loop","playbackRate","mediaOpacity","fadeInDuration","fadeOutDuration","posterHref","sourceRect","hrefXlink","linkTarget","linkRel","linkDownload","linkPing","linkHreflang","linkType","linkReferrerPolicy","targetShapeId","offsetX","offsetY","targetWidth","targetHeight","broken","switchSystemLanguage","switchRequiredExtensions","svgX","svgY","svgWidth","svgHeight","svgViewBoxX","svgViewBoxY","svgViewBoxWidth","svgViewBoxHeight","svgPreserveAspectRatio","viewBoxX","viewBoxY","viewBoxWidth","viewBoxHeight","viewName","viewPreserveAspectRatio","viewZoomAndPan","viewTarget","isHomeView","children","viewLinkedSvgId"],xe=6;var Xi=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform"],Lt=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY"],Yi={transformMatrix:null,translateX:0,translateY:0,rotation:0,skewX:0,skewY:0,customPivot:null,rawTransform:null};var Ee="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ir=Ee.length,Oe=Ee[0],Pa=Ee[Ir-1],Ra=Ee[Math.floor(Ir/2)],qi=97,uu=122;function ht(t){let e=Ee.indexOf(t);if(e===-1)throw new Error(`order-key: invalid digit '${t}'`);return e}function cu(t){let e=t.charCodeAt(0);if(e<qi||e>uu)throw new Error(`order-key: invalid head '${t}'`);return e-qi+1}function je(t){if(t<1||t>26)throw new Error(`order-key: integer length ${t} out of range`);return String.fromCharCode(qi+t-1)}function Nt(t){let e=cu(t[0]);if(t.length<1+e)throw new Error(`order-key: '${t}' shorter than its integer part`);let r=t.slice(1,1+e),n=t.slice(1+e);for(let i of r)ht(i);for(let i of n)ht(i);return{integer:r,fraction:n}}function Ar(t){for(let e of t)if(e!==Oe)return!1;return!0}function zt(t){if(t.length===0)return!1;try{let{integer:e,fraction:r}=Nt(t);return!(r.endsWith(Oe)||Ar(e)&&r.length===0||e.length>1&&e[0]===Oe)}catch{return!1}}function _a(t,e){if(!zt(t))throw new Error(`order-key: invalid ${e} '${t}'`)}function Gt(t,e){return t<e?-1:t>e?1:0}function du(t){let e=t.split("");for(let r=e.length-1;r>=0;r--){let n=ht(e[r]);if(n<Ir-1){e[r]=Ee[n+1];for(let i=r+1;i<e.length;i++)e[i]=Oe;return e.join("")}}return null}function Zi(t){let{integer:e}=Nt(t),r=du(e);if(r!==null)return je(e.length)+r;let n="1"+Oe.repeat(e.length);return je(n.length)+n}function fu(t){let e=t.split("");for(let r=e.length-1;r>=0;r--){let n=ht(e[r]);if(n>0){e[r]=Ee[n-1];for(let i=r+1;i<e.length;i++)e[i]=Pa;return e.join("")}e[r]=Pa}throw new Error(`order-key: cannot decrement zero integer '${t}'`)}function pu(t){let e=0;for(;e<t.length-1&&t[e]===Oe;)e++;return t.slice(e)}function mu(t){let{integer:e,fraction:r}=Nt(t);if(!Ar(e)){let n=fu(e);if(!Ar(n)){let i=pu(n);return je(i.length)+i}return je(1)+Oe+Ra}return je(1)+Oe+Bt("",r)}function Bt(t,e){if(e!==null){if(e.length===0||t>=e)throw new Error(`order-key: fraction bounds out of order ('${t}' >= '${e}')`);let i=0;for(;i<e.length&&(t[i]??Oe)===e[i];)i++;if(i>0)return e.slice(0,i)+Bt(t.slice(i),e.slice(i))}let r=t.length>0?ht(t[0]):0,n=e!==null?ht(e[0]):Ir;return n-r>1?Ee[Math.floor((r+n)/2)]:Ee[r]+Bt(t.slice(1),null)}function gt(t,e){if(t!==null&&_a(t,"lower bound"),e!==null&&_a(e,"upper bound"),t!==null&&e!==null&&t>=e)throw new Error(`order-key: bounds out of order ('${t}' >= '${e}')`);if(t===null&&e===null)return je(1)+"1";if(t===null)return mu(e);if(e===null)return Zi(t);let r=Nt(t),n=Nt(e),i=je(r.integer.length)+r.integer,s=je(n.integer.length)+n.integer;if(i===s)return i+Bt(r.fraction,n.fraction);let o=Zi(i+(Ar(r.integer)?Ra:""));return Gt(o,e)<0?o:i+Bt(r.fraction,null)}function Mr(t,e,r){if(r<=0)return[];let n=[],i=t;for(let s=0;s<r;s++){let o=gt(i,e);n.push(o),i=o}return n}function Cr(t){if(t<=0)return[];let e=[],r=gt(null,null);e.push(r);for(let n=1;n<t;n++)r=Zi(r),e.push(r);return e}var Vt=class{schemas=new Map;register(e,r){this.schemas.set(e,r)}get(e){return this.schemas.get(e)}typeIds(){return[...this.schemas.keys()]}getDefaults(e){let r=this.schemas.get(e);if(!r)return{};let n={};for(let i of Object.keys(r))n[i]=r[i].default;return n}validate(e,r,n){let i=this.schemas.get(e);if(!i)return n;let s=i[r];return s?.validate?s.validate(n):n}},E=t=>Math.max(0,t),yt=t=>Math.max(0,Math.min(1,t)),te=t=>Math.max(0,Math.min(100,t)),hu=t=>Math.max(1,t),gu=t=>Math.max(3,Math.min(100,Math.floor(t))),yu=t=>Math.max(3,Math.min(50,Math.floor(t))),bu=t=>Math.max(3,Math.min(30,Math.floor(t))),xu=t=>Math.max(1,Math.min(10,t));function Su(t){return Object.fromEntries(Object.entries(t).map(([e,r])=>[e,{default:r}]))}var $u=Su(Yi),J={layerName:{default:null},fillColor:{default:"#ffffff"},borderColor:{default:"#000000"},borderWidth:{default:1},opacity:{default:1,validate:yt},fillOpacity:{default:1,validate:yt},strokeOpacity:{default:1,validate:yt},...$u,locked:{default:!1},visible:{default:!0},fillType:{default:"solid"},fillGradient:{default:null},strokeType:{default:"solid"},strokeGradient:{default:null},fillRule:{default:"nonzero"},strokeLinejoin:{default:"miter"},strokeLinecap:{default:"butt"},strokeMiterlimit:{default:4,validate:hu},lineStyle:{default:"solid"},dashLength:{default:8},gapLength:{default:4},dashOffset:{default:0},strokeDasharray:{default:null},colorInterpolation:{default:null},filters:{default:[]},filterColorInterpolation:{default:null},filterUnits:{default:null},primitiveUnits:{default:null},filterX:{default:null},filterY:{default:null},filterWidth:{default:null},filterHeight:{default:null},metadata:{default:null},cssClipPath:{default:null},cssMaskProperties:{default:null},groupId:{default:null}},$e={...J,cx:{default:0},cy:{default:0},radius:{default:50,validate:E},cornerRadius:{default:0,validate:E},shiftAngle:{default:0}},bt={...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:60,validate:E}},Aa={...J,x:{default:0},y:{default:0},width:{default:0,validate:E},height:{default:0,validate:E},href:{default:""},mediaMimeType:{default:""},originalWidth:{default:0},originalHeight:{default:0},naturalDuration:{default:0},preserveAspectRatio:{default:!0},begin:{default:0},trimStart:{default:0},volume:{default:1,validate:yt},muted:{default:!1},loop:{default:!1},playbackRate:{default:1},mediaOpacity:{default:1,validate:yt},fadeInDuration:{default:0,validate:E},fadeOutDuration:{default:0,validate:E},posterHref:{default:""},sourceRect:{default:null}},O=new Vt;O.register("rectangle",{...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:100,validate:E},rx:{default:0,validate:E},ry:{default:0,validate:E},cornerRadius:{default:0,validate:E},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:E},cornerRadiusTR:{default:0,validate:E},cornerRadiusBL:{default:0,validate:E},cornerRadiusBR:{default:0,validate:E},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});O.register("square",{...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:100,validate:E},rx:{default:0,validate:E},ry:{default:0,validate:E},cornerRadius:{default:0,validate:E},cornerShape:{default:"round"},cornerMode:{default:"uniform"},cornerRadiusTL:{default:0,validate:E},cornerRadiusTR:{default:0,validate:E},cornerRadiusBL:{default:0,validate:E},cornerRadiusBR:{default:0,validate:E},cornerShapeTL:{default:"round"},cornerShapeTR:{default:"round"},cornerShapeBL:{default:"round"},cornerShapeBR:{default:"round"}});O.register("circle",{...J,x:{default:0},y:{default:0},radius:{default:50,validate:E}});O.register("ellipse",{...J,cx:{default:0},cy:{default:0},rx:{default:50,validate:E},ry:{default:30,validate:E}});O.register("line",{...J,x1:{default:0},y1:{default:0},x2:{default:100},y2:{default:0},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});O.register("text",{...J,x:{default:0},y:{default:0},width:{default:0,validate:E},height:{default:0,validate:E},textX:{default:0},textY:{default:0},fontSize:{default:24},text:{default:""},fontFamily:{default:"Arial"},fontWeight:{default:"normal"},fontStyle:{default:"normal"},fontVariant:{default:""},fontVariantLigatures:{default:""},fontVariantPosition:{default:""},fontVariantCaps:{default:""},fontVariantNumeric:{default:""},fontVariantEastAsian:{default:""},textDecoration:{default:{}},textTransform:{default:"none"},baselineShift:{default:"baseline"},dominantBaseline:{default:"auto"},writingMode:{default:"horizontal-tb"},textAnchor:{default:"start"},letterSpacing:{default:0},wordSpacing:{default:0},lineHeight:{default:1.2},inlineSize:{default:0},overflowWrap:{default:"normal"},whiteSpace:{default:"pre-wrap"},textDirection:{default:"ltr"},unicodeBidi:{default:"normal"},scaleX:{default:1},scaleY:{default:1},scaleAnchor:{default:null},useRichText:{default:!1},richTextRuns:{default:null},richTextData:{default:null},charOffsets:{default:null},fontVariationSettings:{default:{}},isTextPath:{default:!1},textPathPoints:{default:null},textPathStartOffset:{default:0},textPathSide:{default:"left"},shapeInsideRef:{default:null},shapePadding:{default:0}});O.register("image",{...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:100,validate:E},href:{default:""},originalWidth:{default:0},originalHeight:{default:0},preserveAspectRatio:{default:!0},imageOpacity:{default:1,validate:yt}});O.register("path",{...J,x:{default:0},y:{default:0},width:{default:0,validate:E},height:{default:0,validate:E},pathPoints:{default:[]},pathArcParams:{default:[]},pathControlBounds:{default:null},startEndpoint:{default:"none"},endEndpoint:{default:"none"}});O.register("polyline",{...J,x:{default:0},y:{default:0},width:{default:0,validate:E},height:{default:0,validate:E},polylinePoints:{default:[]},polylineClosed:{default:!1}});O.register("triangle",{...$e,sides:{default:3}});O.register("ngon",{...$e,sides:{default:6,validate:gu}});O.register("star",{...$e,arms:{default:5,validate:yu},innerRadiusPercent:{default:40,validate:te}});O.register("cross",{...$e,armWidthPercent:{default:30,validate:te}});O.register("ring",{...$e,innerRadiusPercent:{default:50,validate:te}});O.register("spiral",{...$e,turns:{default:3,validate:xu},thicknessPercent:{default:15,validate:te},spiralDirection:{default:1}});O.register("gear",{...$e,teeth:{default:8,validate:bu},toothDepthPercent:{default:25,validate:te},holeRadiusPercent:{default:20,validate:te}});O.register("arrow",{...$e,headWidthPercent:{default:100,validate:te},headLengthPercent:{default:40,validate:te},shaftWidthPercent:{default:40,validate:te}});O.register("symbol-instance",{...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:100,validate:E},symbolId:{default:""}});O.register("group",{...J,groupId:{default:null}});O.register("cloud",{...$e,cloudBumps:{default:5},cloudPuffinessPercent:{default:60,validate:te}});O.register("heart",{...$e,lobeRadiusPercent:{default:50,validate:te},cleftDepthPercent:{default:25,validate:te}});O.register("lightning",{...$e,boltSegments:{default:3},boltWidthPercent:{default:30,validate:te},boltJaggednessPercent:{default:40,validate:te}});O.register("speechBubble",{...$e,tailAngleDeg:{default:45},tailLengthPercent:{default:40,validate:te},tailWidthPercent:{default:25,validate:te}});O.register("diamond",{...bt});O.register("parallelogram",{...bt,slantPercent:{default:20,validate:te}});O.register("trapezoid",{...bt,topWidthPercent:{default:70,validate:te}});O.register("terminator",{...bt});O.register("cylinder",{...bt,capHeightPercent:{default:15,validate:te}});O.register("document-shape",{...bt,waveAmplitudePercent:{default:15,validate:te}});O.register("hyperlink",{...J,href:{default:""},hrefXlink:{default:""},linkTarget:{default:""},linkDownload:{default:""},linkPing:{default:""},linkRel:{default:""},linkHreflang:{default:""},linkType:{default:""},linkReferrerPolicy:{default:""}});O.register("switch",{...J,switchSystemLanguage:{default:""},switchRequiredExtensions:{default:""}});O.register("svg",{...J,svgX:{default:0},svgY:{default:0},svgWidth:{default:0,validate:E},svgHeight:{default:0,validate:E},svgViewBoxX:{default:0},svgViewBoxY:{default:0},svgViewBoxWidth:{default:0,validate:E},svgViewBoxHeight:{default:0,validate:E},svgPreserveAspectRatio:{default:""}});O.register("view",{...J,viewBoxX:{default:0},viewBoxY:{default:0},viewBoxWidth:{default:0,validate:E},viewBoxHeight:{default:0,validate:E},viewName:{default:""},viewPreserveAspectRatio:{default:""},viewTarget:{default:""}});O.register("shape-reference",{...J,targetShapeId:{default:""},offsetX:{default:0},offsetY:{default:0},targetWidth:{default:0,validate:E},targetHeight:{default:0,validate:E},broken:{default:!1}});O.register("video",{...Aa,mediaKind:{default:"video"}});O.register("audio",{...Aa,mediaKind:{default:"audio"}});O.register("document",{});function vu(){let t=new Set(Ki);for(let e of Xi)t.add(e);for(let e of O.typeIds())for(let r of Object.keys(O.getDefaults(e)))t.add(r);return t.delete("scaleAnchor"),t.delete("extra"),t}var Ji=vu(),Ia=new Set(["scaleAnchor","displayAttr"]);function Dr(t){let e=t.extra&&typeof t.extra=="object"&&!Array.isArray(t.extra)?t.extra:void 0;for(let r of Object.keys(t)){if(r==="extra"||Ji.has(r))continue;let n=t[r];delete t[r],n!==void 0&&((e??={})[r]=n)}return e&&Object.keys(e).length>0?t.extra=e:delete t.extra,t}function tt(t){if(!t?.state||typeof t.state!="object")return t;let e=t.state,r=e.children;if(Array.isArray(r))for(let i of r)tt(i);let n=e.symbolOverrides;if(n&&typeof n=="object"&&!Array.isArray(n))for(let i of Object.values(n))i&&typeof i=="object"&&!Array.isArray(i)&&Dr(i);return Dr(e),t}function Ut(t){if(!t?.state||typeof t.state!="object")return t;let e=t.state,r=e.children;if(Array.isArray(r))for(let i of r)Ut(i);let n=e.symbolOverrides;if(n&&typeof n=="object"&&!Array.isArray(n))for(let i of Object.values(n))i&&typeof i=="object"&&!Array.isArray(i)&&Le(i);return Le(e),t}function Le(t){let e=t.extra;if(!e||typeof e!="object"||Array.isArray(e))return delete t.extra,t;for(let[r,n]of Object.entries(e))r!=="extra"&&(r in t||(t[r]=n));return delete t.extra,t}function rt(t,e,r,n="verbatim"){if(n==="verbatim")return new Ne(t,e,r&&"extra"in r?Le({...r}):r);let i={...O.getDefaults(e),...r},s=O.get(e);if(s)for(let o of Object.keys(i)){let a=s[o];a?.validate&&i[o]!==void 0&&(i[o]=a.validate(i[o]))}return new Ne(t,e,i)}var Ne=class t{static writeHook=null;static _baseReadDepth=0;static withBaseProps(e){t._baseReadDepth++;try{return e()}finally{t._baseReadDepth--}}id;type;parent=null;children=[];onChange=null;_props;_dirty=new Set;_overlay=null;_propTimestamps=new Map;constructor(e,r,n){this.id=e,this.type=r,this._props=n?{...n}:{}}get(e){return this._overlay!==null&&t._baseReadDepth===0&&this._overlay.has(e)?this._overlay.get(e):this._props[e]}set(e,r){this._props[e]!==r&&(t.writeHook?.(this,e),this._props[e]=r,this._dirty.add(e),this.onChange?.(this,this._dirty))}getProp(e){return this._overlay!==null&&t._baseReadDepth===0&&this._overlay.has(e)?this._overlay.get(e):this._props[e]}getBaseProp(e){return this._props[e]}setProp(e,r){this._props[e]!==r&&(t.writeHook?.(this,e),this._props[e]=r,this._dirty.add(e),this.onChange?.(this,this._dirty))}deleteProp(e){e in this._props&&(t.writeHook?.(this,e),delete this._props[e],this._dirty.add(e),this.onChange?.(this,this._dirty))}setMany(e){let r=!1;for(let[n,i]of Object.entries(e))this._props[n]!==i&&(t.writeHook?.(this,n),this._props[n]=i,this._dirty.add(n),r=!0);r&&this.onChange?.(this,this._dirty)}setOverlayValue(e,r){this._overlay===null&&(this._overlay=new Map),this._overlay.set(e,r)}deleteOverlayValue(e){if(this._overlay===null)return!1;let r=this._overlay.delete(e);return this._overlay.size===0&&(this._overlay=null),r}getOverlayValue(e){return this._overlay?.get(e)}hasOverlayValue(e){return this._overlay?.has(e)??!1}overlayKeys(){return this._overlay?[...this._overlay.keys()]:[]}clearOverlay(){if(this._overlay===null)return[];let e=[...this._overlay.keys()];return this._overlay=null,e}get hasOverlay(){return this._overlay!==null}getDirtyKeys(){return this._dirty}clearDirty(){this._dirty.clear()}isDirty(){return this._dirty.size>0}getProps(){return this._props}snapshotProps(){return structuredClone(this._props)}restoreProps(e){this._props=structuredClone(e);for(let r of Object.keys(this._props))this._dirty.add(r);this.onChange?.(this,this._dirty)}getPropStamp(e){return this._propTimestamps.get(e)??null}stampProp(e,r,n){this._propTimestamps.set(e,{ts:r,clientId:n})}stampProps(e,r,n){let i={ts:r,clientId:n};for(let s of e)this._propTimestamps.set(s,i)}getPropStampsForKeys(e){let r={};for(let n of e){let i=this._propTimestamps.get(n);i&&(r[n]=i.ts)}return r}setPropIfWins(e,r,n,i){let s=this._propTimestamps.get(e),o=s?.ts??0,a=s?.clientId??"";return n>o||n===o&&i>a?(r===null?delete this._props[e]:this._props[e]=r,this._propTimestamps.set(e,{ts:n,clientId:i}),this._dirty.add(e),!0):!1}snapshotPropTimestamps(){return new Map(this._propTimestamps)}restorePropTimestamps(e){this._propTimestamps=new Map(e)}toSerialized(){return{id:this.id,type:this.type,state:{...this._props}}}static fromSerialized(e){return rt(e.id,e.type,e.state,"verbatim")}static create(e,r,n){return rt(e,r,n,"authoring")}};var ku=5e3,Tu=1e4;function wu(t){return t===null||t.size===0?"":[...t.entries()].sort((e,r)=>r[1].count-e[1].count).slice(0,5).map(([e,r])=>`${e.type}#${e.id} x${r.count} keys=[${[...r.keys].join(",")}]`).join("; ")}var Fr=class t{static _pendingGraphs=new Set;static flushAllPending(){if(t._pendingGraphs.size!==0)for(let e of[...t._pendingGraphs])e.flushBatched()}static get pendingGraphCount(){return t._pendingGraphs.size}root;_nodesById=new Map;_batchDepth=0;_batchDirtyNodes=new Map;_draining=!1;_changeListeners=[];_structureListeners=[];constructor(){this.root=rt("__root__","document"),this._nodesById.set(this.root.id,this.root)}onNodeChange(e){return this._changeListeners.push(e),()=>{let r=this._changeListeners.indexOf(e);r>=0&&this._changeListeners.splice(r,1)}}onStructureChange(e){return this._structureListeners.push(e),()=>{let r=this._structureListeners.indexOf(e);r>=0&&this._structureListeners.splice(r,1)}}addNode(e,r,n){let i=r??this.root;n!==void 0&&n>=0&&n<i.children.length?i.children.splice(n,0,e):i.children.push(e),e.parent=i,this._nodesById.set(e.id,e),e.onChange=this._handleNodeChange.bind(this),this._emitStructure("add",e,null,i)}removeNode(e){let r=this._nodesById.get(e);if(!r||r===this.root)return null;let n=r.parent,i=null;if(n){let s=n.children.indexOf(r);i={parentId:n===this.root?null:n.id,index:s},s>=0&&n.children.splice(s,1)}return r.parent=null,r.onChange=null,this._nodesById.delete(e),this._batchDirtyNodes.delete(r),this._removeDescendants(r),this._batchDirtyNodes.size===0&&t._pendingGraphs.delete(this),this._emitStructure("remove",r,n,null,i),r}getNode(e){return this._nodesById.get(e)??null}moveNode(e,r,n){let i=this._nodesById.get(e);if(!i||i===this.root)return;let s=i.parent,o=null;if(s){let a=s.children.indexOf(i);o={parentId:s===this.root?null:s.id,index:a},a>=0&&s.children.splice(a,1)}n!==void 0&&n>=0&&n<r.children.length?r.children.splice(n,0,i):r.children.push(i),i.parent=r,this._emitStructure("move",i,s,r,o)}moveNodeToParentId(e,r,n){let i=r?this._nodesById.get(r):this.root;i&&this.moveNode(e,i,n)}getChildren(e){let r=e?this._nodesById.get(e):this.root;return r?[...r.children]:[]}getRootShapes(){return[...this.root.children]}getParentId(e){let r=this._nodesById.get(e);return!r||!r.parent||r.parent===this.root?null:r.parent.id}getSiblingIndex(e){let r=this._nodesById.get(e);return!r||!r.parent?-1:r.parent.children.indexOf(r)}getAncestorIds(e){let r=[],n=this.getParentId(e);for(;n;)r.push(n),n=this.getParentId(n);return r}isAncestor(e,r){if(e===r)return!1;let n=this.getParentId(r);for(;n;){if(n===e)return!0;n=this.getParentId(n)}return!1}isDocumentRootNode(e){let r=this._nodesById.get(e);return!!r&&r!==this.root&&r.getProp("isRootSvg")===!0}contains(e,r){if(e===r)return!1;if(this.isDocumentRootNode(e)){let n=this._nodesById.get(r);return!!n&&n!==this.root&&!this.isDocumentRootNode(r)}return this.isAncestor(e,r)}getDepth(e){let r=this._nodesById.get(e);if(!r||r===this.root)return-1;let n=0,i=r.parent;for(;i&&i!==this.root;)n++,i=i.parent;return n}getAllNodes(){let e=[];for(let r of this._nodesById.values())r!==this.root&&e.push(r);return e}getDirtyNodes(){let e=[];for(let r of this._nodesById.values())r.isDirty()&&e.push(r);return e}clearAllDirty(){for(let e of this._nodesById.values())e.clearDirty()}beginBatch(){this._batchDepth++}commitBatch(){this._batchDepth=Math.max(0,this._batchDepth-1),this._batchDepth===0&&this._drainBatched()}flushBatched(){this._batchDirtyNodes.size>0&&this._drainBatched()}get hasPendingBatched(){return this._batchDirtyNodes.size>0}get isBatching(){return this._batchDepth>0}get isDraining(){return this._draining}dispose(){t._pendingGraphs.delete(this),this._batchDirtyNodes.clear(),this._changeListeners.length=0,this._structureListeners.length=0}notifyNodeChanged(e,r){this._handleNodeChange(e,r)}_handleNodeChange(e,r){if(this._batchDepth>0){let n=this._batchDirtyNodes.get(e);n||(n=new Set,this._batchDirtyNodes.set(e,n),t._pendingGraphs.add(this));for(let i of r)n.add(i);return}this._fireChangeListeners(e,r)}_drainBatched(){if(this._draining)return;this._draining=!0;let e=0,r=null;try{for(;this._batchDirtyNodes.size>0;){if(++e>Tu){console.error("[SceneGraph] batched-notification drain did not converge \u2014 render loop?",wu(r)),this._batchDirtyNodes.clear();break}let[n,i]=this._batchDirtyNodes.entries().next().value;if(this._batchDirtyNodes.delete(n),this._batchDirtyNodes.size===0&&t._pendingGraphs.delete(this),e>ku){r===null&&(r=new Map);let s=r.get(n);if(s){s.count++;for(let o of i)s.keys.add(o)}else r.set(n,{count:1,keys:new Set(i)})}this._fireChangeListeners(n,i)}}finally{this._draining=!1,this._batchDirtyNodes.size===0&&t._pendingGraphs.delete(this)}}_fireChangeListeners(e,r){let n=[...this._changeListeners];for(let i of n)i(e,r)}_emitStructure(e,r,n,i,s=null){let o=[...this._structureListeners];for(let a of o)a(e,r,n,i,s)}_removeDescendants(e){for(let r of e.children)r.onChange=null,this._nodesById.delete(r.id),this._batchDirtyNodes.delete(r),this._removeDescendants(r)}serializeShapes(){let e=[],r=n=>{for(let i of n)i.type!=="document"&&i.type!=="group"&&i.getProp("structural")!==!0&&e.push(i.toSerialized()),i.children.length>0&&r(i.children)};return r(this.root.children),e}static fromShapes(e){let r=new t;for(let n of e){let i=Ne.fromSerialized(n);r.addNode(i)}return r}};var G=["updatedAt","clientId"];function z(t,e,r){t.push({path:e,message:r})}function Ua(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function U(t,e,r){return Ua(t)?t:(z(r,e,"must be an object"),null)}function I(t,e,r,n=[],i,s=!0){let o=new Set([...s?["type"]:[],...r,...n]);for(let a of r)Object.hasOwn(t,a)||z(i,`${e}.${a}`,"is required");for(let a of Object.keys(t))o.has(a)||z(i,`${e}.${a}`,"is not allowed")}function A(t,e,r,n=!1){return typeof t!="string"||!n&&t.length===0?(z(r,e,n?"must be a string":"must be a non-empty string"),!1):!0}function oe(t,e,r,n){return typeof t!="number"||!Number.isFinite(t)?(z(r,e,"must be a finite number"),!1):n!==void 0&&t<n?(z(r,e,`must be at least ${n}`),!1):!0}function ke(t,e,r,n=0){return oe(t,e,r,n)?Number.isInteger(t)?!0:(z(r,e,"must be an integer"),!1):!1}function xt(t,e,r){return typeof t!="boolean"?(z(r,e,"must be a boolean"),!1):!0}function Q(t,e,r,n,i=!1){t[e]!==void 0&&A(t[e],`${r}.${e}`,n,i)}function Qi(t,e,r,n,i){t[e]!==void 0&&oe(t[e],`${r}.${e}`,n,i)}function se(t,e,r,n,i=0){t[e]!==void 0&&ke(t[e],`${r}.${e}`,n,i)}function Er(t,e,r,n){t[e]!==void 0&&xt(t[e],`${r}.${e}`,n)}function nt(t,e,r){return Array.isArray(t)?(t.forEach((n,i)=>A(n,`${e}[${i}]`,r)),!0):(z(r,e,"must be an array"),!1)}function X(t,e,r,n){return Array.isArray(t)?(t.forEach((i,s)=>n(i,`${e}[${s}]`,r)),!0):(z(r,e,"must be an array"),!1)}function ie(t,e,r){let n=[{value:t,path:e,depth:0}],i=0;for(;n.length>0;){let s=n.pop();if(i++,i>25e4){z(r,e,"exceeds the 250000-node validation limit");return}if(s.depth>64){z(r,s.path,"exceeds the 64-level nesting limit");continue}let o=s.value;if(!(o===null||typeof o=="string"||typeof o=="boolean")){if(typeof o=="number"){Number.isFinite(o)||z(r,s.path,"must be a finite JSON number");continue}if(Array.isArray(o)){o.forEach((a,l)=>n.push({value:a,path:`${s.path}[${l}]`,depth:s.depth+1}));continue}if(Ua(o)){for(let[a,l]of Object.entries(o))n.push({value:l,path:`${s.path}.${a}`,depth:s.depth+1});continue}z(r,s.path,"must be JSON-serializable")}}}function V(t,e,r){Qi(t,"updatedAt",e,r,0),Q(t,"clientId",e,r)}function Or(t,e,r){let n=U(t,e,r);if(n)for(let[i,s]of Object.entries(n))A(s,`${e}.${i}`,r,!0)}function Wt(t,e,r,n=0){if(n>64){z(r,e,"exceeds the 64-level shape nesting limit");return}let i=U(t,e,r);if(!i)return;I(i,e,["id","type","state"],[],r),A(i.id,`${e}.id`,r),A(i.type,`${e}.type`,r);let s=U(i.state,`${e}.state`,r);s&&(Object.hasOwn(s,"extra")&&z(r,`${e}.state.extra`,"is an at-rest field and is not allowed in operations"),ie(s,`${e}.state`,r),s.children!==void 0&&X(s.children,`${e}.state.children`,r,(o,a,l)=>Wt(o,a,l,n+1)))}function Pu(t,e,r){let n=U(t,e,r);n&&(Object.hasOwn(n,"extra")&&z(r,`${e}.extra`,"is an at-rest field and is not allowed in operations"),ie(n,e,r),n.children!==void 0&&X(n.children,`${e}.children`,r,(i,s,o)=>Wt(i,s,o)))}function es(t,e,r){let n=U(t,e,r);n&&(A(n.id,`${e}.id`,r),n.parentId!==null&&A(n.parentId,`${e}.parentId`,r),se(n,"siblingIndex",e,r),Q(n,"pluginId",e,r),Q(n,"pluginData",e,r,!0),n.attributes!==void 0&&Or(n.attributes,`${e}.attributes`,r),ie(n,e,r))}function Ma(t,e,r){let n=U(t,e,r);n&&(A(n.id,`${e}.id`,r),n.type!=="clip"&&n.type!=="mask"&&z(r,`${e}.type`,'must be "clip" or "mask"'),n.clipShapeIds!==void 0&&nt(n.clipShapeIds,`${e}.clipShapeIds`,r),n.clipShapeId!==void 0&&Q(n,"clipShapeId",e,r),n.clipShapeIds===void 0&&n.clipShapeId===void 0&&z(r,`${e}.clipShapeIds`,"or clipShapeId is required"),nt(n.contentShapeIds,`${e}.contentShapeIds`,r),n.parentId!==null&&A(n.parentId,`${e}.parentId`,r),se(n,"siblingIndex",e,r),ie(n,e,r))}function Ca(t,e,r){let n=U(t,e,r);if(!n)return;A(n.id,`${e}.id`,r);let i=n.orientation==="horizontal"||n.orientation==="vertical",s=n.axis==="x"||n.axis==="y";!i&&!s&&z(r,`${e}.orientation`,'must be "horizontal" or "vertical" (legacy axis "x" or "y" is also accepted)'),oe(n.position,`${e}.position`,r),i&&oe(n.controlPointOffset,`${e}.controlPointOffset`,r),Q(n,"color",e,r,!0),Qi(n,"opacity",e,r),ie(n,e,r)}function Da(t,e,r){let n=U(t,e,r);if(!n)return;A(n.id,`${e}.id`,r);let i=n.type==="distance"||n.type==="angle",s=["startX","startY","endX","endY"].every(o=>typeof n[o]=="number"&&Number.isFinite(n[o]));i?(X(n.points,`${e}.points`,r,(o,a,l)=>{let c=U(o,a,l);c&&(oe(c.x,`${a}.x`,l),oe(c.y,`${a}.y`,l))}),xt(n.visible,`${e}.visible`,r),ke(n.snapDivisions,`${e}.snapDivisions`,r,1)):s||z(r,e,"must be a current or legacy measurement payload"),Q(n,"color",e,r,!0),Qi(n,"opacity",e,r),ie(n,e,r)}var Fa=["title","description","author","keywords","license","licenseUrl","language","customMetadata","rawMetadata","rawDescription","rawHtmlMetadata","coordinatePrecision"];function Ea(t,e,r,n){let i=U(t,e,r);if(!i)return;I(i,e,n?[]:["title","description","author","keywords","license","licenseUrl","language","customMetadata"],n?Fa:Fa.slice(8),r,!1);for(let o of["title","description","author","license","licenseUrl","language"])(!n||i[o]!==void 0)&&A(i[o],`${e}.${o}`,r,!0);(!n||i.keywords!==void 0)&&nt(i.keywords,`${e}.keywords`,r),(!n||i.customMetadata!==void 0)&&Or(i.customMetadata,`${e}.customMetadata`,r),Q(i,"rawMetadata",e,r,!0),Q(i,"rawDescription",e,r,!0),Q(i,"rawHtmlMetadata",e,r,!0),se(i,"coordinatePrecision",e,r)}function Oa(t,e,r){let n=U(t,e,r);n&&(A(n.id,`${e}.id`,r),n.source!=="inline"&&n.source!=="external"&&z(r,`${e}.source`,'must be "inline" or "external"'),A(n.content,`${e}.content`,r,!0),A(n.type,`${e}.type`,r,!0),Q(n,"svgId",e,r,!0),Q(n,"href",e,r,!0),Er(n,"async",e,r),Er(n,"defer",e,r),n.customAttrs!==void 0&&Or(n.customAttrs,`${e}.customAttrs`,r),ie(n,e,r))}function La(t,e,r){let n=U(t,e,r);n&&(A(n.id,`${e}.id`,r),A(n.css,`${e}.css`,r,!0),xt(n.preserved,`${e}.preserved`,r),Q(n,"svgId",e,r,!0),Q(n,"type",e,r,!0),Q(n,"media",e,r,!0),n.customAttrs!==void 0&&Or(n.customAttrs,`${e}.customAttrs`,r),ie(n,e,r))}function Na(t,e,r){let n=U(t,e,r);if(n){if(A(n.name,`${e}.name`,r),["string","color","number"].includes(String(n.type))||z(r,`${e}.type`,'must be "string", "color", or "number"'),A(n.defaultValue,`${e}.defaultValue`,r,!0),Q(n,"label",e,r,!0),Q(n,"description",e,r,!0),n.mode!==void 0&&n.mode!=="live"&&n.mode!=="stamped"&&z(r,`${e}.mode`,'must be "live" or "stamped"'),n.source!==void 0){let i=U(n.source,`${e}.source`,r);i&&i.kind!=="user"&&z(r,`${e}.source.kind`,'must be "user"')}ie(n,e,r)}}function Ba(t,e,r){let n=U(t,e,r);n&&(A(n.id,`${e}.id`,r),A(n.filename,`${e}.filename`,r,!0),A(n.format,`${e}.format`,r),ie(n,e,r))}function _u(t,e,r){let n=U(t,e,r);n&&(ke(n.glyphId,`${e}.glyphId`,r),Array.isArray(n.codepoints)?n.codepoints.forEach((i,s)=>ke(i,`${e}.codepoints[${s}]`,r)):z(r,`${e}.codepoints`,"must be an array"),A(n.svgDocument,`${e}.svgDocument`,r,!0),Q(n,"glyphName",e,r,!0),se(n,"advanceWidth",e,r),Q(n,"sourceFamily",e,r,!0),se(n,"sourceGlyphId",e,r),Q(n,"label",e,r,!0),ie(n,e,r))}function za(t,e,r){let n=U(t,e,r);n&&(A(n.id,`${e}.id`,r),A(n.name,`${e}.name`,r,!0),A(n.svgContent,`${e}.svgContent`,r,!0),oe(n.width,`${e}.width`,r,0),oe(n.height,`${e}.height`,r,0),ie(n,e,r))}function Ga(t,e,r){let n=U(t,e,r);n&&(A(n.id,`${e}.id`,r),["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"].includes(String(n.type))||z(r,`${e}.type`,"is not a supported paint-server type"),A(n.markup,`${e}.markup`,r),Er(n,"passthrough",e,r),ie(n,e,r))}function Va(t,e,r){let n=U(t,e,r);if(!n)return;A(n.id,`${e}.id`,r),A(n.name,`${e}.name`,r,!0);let i=n.kind;if(["symbol","marker","linear-gradient","radial-gradient","pattern","filter"].includes(String(i))||z(r,`${e}.kind`,"is not a supported library kind"),(i==="symbol"||i==="marker")&&(X(n.shapes,`${e}.shapes`,r,Wt),n.groups!==void 0&&X(n.groups,`${e}.groups`,r,es)),i==="symbol"&&A(n.viewBox,`${e}.viewBox`,r,!0),i==="marker"){for(let s of["refX","refY","markerWidth","markerHeight"])oe(n[s],`${e}.${s}`,r);n.markerUnits!=="strokeWidth"&&n.markerUnits!=="userSpaceOnUse"&&z(r,`${e}.markerUnits`,'must be "strokeWidth" or "userSpaceOnUse"'),n.orient!=="auto"&&n.orient!=="auto-start-reverse"&&!(typeof n.orient=="number"&&Number.isFinite(n.orient))&&z(r,`${e}.orient`,"must be an orientation keyword or finite number")}(i==="linear-gradient"||i==="radial-gradient")&&U(n.gradient,`${e}.gradient`,r),i==="pattern"&&U(n.pattern,`${e}.pattern`,r),i==="filter"&&X(n.filters,`${e}.filters`,r,(s,o,a)=>{U(s,o,a)}),ie(n,e,r)}function Ru(t,e,r){let n=U(t,e,r);n&&(A(n.id,`${e}.id`,r),Q(n,"viewBox",e,r,!0),n.shapes!==void 0&&X(n.shapes,`${e}.shapes`,r,Wt),n.groups!==void 0&&X(n.groups,`${e}.groups`,r,es),ie(n,e,r))}function Wa(t,e,r,n){let i=U(t,e,r);i&&((n||i.id!==void 0)&&A(i.id,`${e}.id`,r),oe(i.time,`${e}.time`,r,0),typeof i.value!="string"&&!(typeof i.value=="number"&&Number.isFinite(i.value))&&!(Array.isArray(i.value)&&i.value.every(s=>typeof s=="number"&&Number.isFinite(s)))&&z(r,`${e}.value`,"must be a string, finite number, or finite number array"),A(i.easing,`${e}.easing`,r),ie(i,e,r))}function Ha(t,e,r){let n=U(t,e,r);n&&(A(n.id,`${e}.id`,r),A(n.shapeId,`${e}.shapeId`,r),A(n.property,`${e}.property`,r),xt(n.enabled,`${e}.enabled`,r),Er(n,"locked",e,r),X(n.keyframes,`${e}.keyframes`,r,(i,s,o)=>Wa(i,s,o,!1)),ie(n,e,r))}function Au(t,e,r){let n=U(t,e,r);n&&(oe(n.duration,`${e}.duration`,r,0),xt(n.loop,`${e}.loop`,r),oe(n.playbackSpeed,`${e}.playbackSpeed`,r,0),X(n.tracks,`${e}.tracks`,r,Ha))}function Iu(t,e,r){let n=U(t,e,r);if(!n)return;ke(n.start,`${e}.start`,r),ke(n.end,`${e}.end`,r),typeof n.start=="number"&&typeof n.end=="number"&&n.end<=n.start&&z(r,`${e}.end`,"must be greater than start");let i=U(n.style,`${e}.style`,r);i&&Object.keys(i).length===0&&z(r,`${e}.style`,"must not be empty"),ie(n,e,r)}function Mu(t,e,r){let n=U(t,e,r);n&&(I(n,e,["start","deleteCount","insert"],[],r,!1),ke(n.start,`${e}.start`,r),ke(n.deleteCount,`${e}.deleteCount`,r),A(n.insert,`${e}.insert`,r,!0))}var ja={"shape:add":(t,e,r)=>{I(t,e,["shape"],[],r),Wt(t.shape,`${e}.shape`,r)},"shape:update":(t,e,r)=>{if(I(t,e,["id","state"],["propTimestamps","clientId","textSplices","baseSeq"],r),A(t.id,`${e}.id`,r),Pu(t.state,`${e}.state`,r),t.propTimestamps!==void 0){let n=U(t.propTimestamps,`${e}.propTimestamps`,r);if(n)for(let[i,s]of Object.entries(n))oe(s,`${e}.propTimestamps.${i}`,r,0)}Q(t,"clientId",e,r),t.textSplices!==void 0&&X(t.textSplices,`${e}.textSplices`,r,Mu),se(t,"baseSeq",e,r)},"shape:remove":(t,e,r)=>{I(t,e,["id"],[],r),A(t.id,`${e}.id`,r)},"text:format":(t,e,r)=>{I(t,e,["id","ranges"],["baseSeq",...G],r),A(t.id,`${e}.id`,r),X(t.ranges,`${e}.ranges`,r,Iu),se(t,"baseSeq",e,r),V(t,e,r)},"scene:move":(t,e,r)=>{I(t,e,["id","parentId","index"],G,r),A(t.id,`${e}.id`,r),t.parentId!==null&&A(t.parentId,`${e}.parentId`,r),ke(t.index,`${e}.index`,r),V(t,e,r)},"scene:place":(t,e,r)=>{I(t,e,["id","parentId","orderKey"],G,r),A(t.id,`${e}.id`,r),t.parentId!==null&&A(t.parentId,`${e}.parentId`,r),A(t.orderKey,`${e}.orderKey`,r),V(t,e,r)},"shapes:reorder":(t,e,r)=>{I(t,e,["ids"],[],r),nt(t.ids,`${e}.ids`,r)},"groups:set":(t,e,r)=>{I(t,e,["groups"],[],r),X(t.groups,`${e}.groups`,r,es)},"clipmasks:set":(t,e,r)=>{I(t,e,["clipMaskGroups"],[],r),X(t.clipMaskGroups,`${e}.clipMaskGroups`,r,Ma)},"clipMask:upsert":(t,e,r)=>{I(t,e,["clipMaskGroup"],["index",...G],r),Ma(t.clipMaskGroup,`${e}.clipMaskGroup`,r),se(t,"index",e,r),V(t,e,r)},"clipMask:remove":(t,e,r)=>{I(t,e,["id"],G,r),A(t.id,`${e}.id`,r),V(t,e,r)},"guides:set":(t,e,r)=>{I(t,e,["guides"],[],r),X(t.guides,`${e}.guides`,r,Ca)},"guide:upsert":(t,e,r)=>{I(t,e,["guide"],["index",...G],r),Ca(t.guide,`${e}.guide`,r),se(t,"index",e,r),V(t,e,r)},"guide:remove":(t,e,r)=>{I(t,e,["id"],G,r),A(t.id,`${e}.id`,r),V(t,e,r)},"guide:move":(t,e,r)=>{I(t,e,["id","index"],G,r),A(t.id,`${e}.id`,r),ke(t.index,`${e}.index`,r),V(t,e,r)},"measurements:set":(t,e,r)=>{I(t,e,["measurements"],[],r),X(t.measurements,`${e}.measurements`,r,Da)},"measurement:upsert":(t,e,r)=>{I(t,e,["measurement"],["index",...G],r),Da(t.measurement,`${e}.measurement`,r),se(t,"index",e,r),V(t,e,r)},"measurement:remove":(t,e,r)=>{I(t,e,["id"],G,r),A(t.id,`${e}.id`,r),V(t,e,r)},"measurement:move":(t,e,r)=>{I(t,e,["id","index"],G,r),A(t.id,`${e}.id`,r),ke(t.index,`${e}.index`,r),V(t,e,r)},"metadata:set":(t,e,r)=>{I(t,e,["metadata"],[],r),Ea(t.metadata,`${e}.metadata`,r,!1)},"metadata:patch":(t,e,r)=>{I(t,e,["patch"],["removeKeys",...G],r),Ea(t.patch,`${e}.patch`,r,!0),t.removeKeys!==void 0&&nt(t.removeKeys,`${e}.removeKeys`,r),V(t,e,r)},"documentScripts:set":(t,e,r)=>{I(t,e,["documentScripts"],[],r),X(t.documentScripts,`${e}.documentScripts`,r,Oa)},"documentScript:upsert":(t,e,r)=>{I(t,e,["documentScript"],["index",...G],r),Oa(t.documentScript,`${e}.documentScript`,r),se(t,"index",e,r),V(t,e,r)},"documentScript:remove":(t,e,r)=>{I(t,e,["id"],G,r),A(t.id,`${e}.id`,r),V(t,e,r)},"documentStyles:set":(t,e,r)=>{I(t,e,["documentStyles"],[],r),X(t.documentStyles,`${e}.documentStyles`,r,La)},"documentStyle:upsert":(t,e,r)=>{I(t,e,["documentStyle"],["index",...G],r),La(t.documentStyle,`${e}.documentStyle`,r),se(t,"index",e,r),V(t,e,r)},"documentStyle:remove":(t,e,r)=>{I(t,e,["id"],G,r),A(t.id,`${e}.id`,r),V(t,e,r)},"templateVariables:set":(t,e,r)=>{I(t,e,["templateVariables"],G,r),X(t.templateVariables,`${e}.templateVariables`,r,Na),V(t,e,r)},"templateVariable:upsert":(t,e,r)=>{I(t,e,["templateVariable"],["index",...G],r),Na(t.templateVariable,`${e}.templateVariable`,r),se(t,"index",e,r),V(t,e,r)},"templateVariable:remove":(t,e,r)=>{I(t,e,["name"],G,r),A(t.name,`${e}.name`,r),V(t,e,r)},"exportItems:set":(t,e,r)=>{I(t,e,["exportItems"],G,r),X(t.exportItems,`${e}.exportItems`,r,Ba),V(t,e,r)},"exportItem:upsert":(t,e,r)=>{I(t,e,["exportItem"],["index",...G],r),Ba(t.exportItem,`${e}.exportItem`,r),se(t,"index",e,r),V(t,e,r)},"exportItem:remove":(t,e,r)=>{I(t,e,["id"],G,r),A(t.id,`${e}.id`,r),V(t,e,r)},"colorGlyphLibrary:set":(t,e,r)=>{if(I(t,e,["colorGlyphLibrary"],G,r),t.colorGlyphLibrary!==null){let n=U(t.colorGlyphLibrary,`${e}.colorGlyphLibrary`,r);n&&(n.version!==1&&z(r,`${e}.colorGlyphLibrary.version`,"must be 1"),X(n.entries,`${e}.colorGlyphLibrary.entries`,r,_u),ie(n,`${e}.colorGlyphLibrary`,r))}V(t,e,r)},"animation:set":(t,e,r)=>{I(t,e,["animationTimeline"],[],r),t.animationTimeline!==void 0&&Au(t.animationTimeline,`${e}.animationTimeline`,r)},"animation:config":(t,e,r)=>{I(t,e,["config"],G,r);let n=U(t.config,`${e}.config`,r);n&&(I(n,`${e}.config`,["duration","loop","playbackSpeed"],[],r,!1),oe(n.duration,`${e}.config.duration`,r,0),xt(n.loop,`${e}.config.loop`,r),oe(n.playbackSpeed,`${e}.config.playbackSpeed`,r,0)),V(t,e,r)},"animation:clear":(t,e,r)=>{I(t,e,[],G,r),V(t,e,r)},"animationTrack:upsert":(t,e,r)=>{I(t,e,["track"],["index",...G],r),Ha(t.track,`${e}.track`,r),se(t,"index",e,r),V(t,e,r)},"animationTrack:remove":(t,e,r)=>{I(t,e,["id"],G,r),A(t.id,`${e}.id`,r),V(t,e,r)},"animationKeyframe:upsert":(t,e,r)=>{I(t,e,["trackId","keyframe"],G,r),A(t.trackId,`${e}.trackId`,r),Wa(t.keyframe,`${e}.keyframe`,r,!0),V(t,e,r)},"animationKeyframe:remove":(t,e,r)=>{I(t,e,["trackId","keyframeId"],G,r),A(t.trackId,`${e}.trackId`,r),A(t.keyframeId,`${e}.keyframeId`,r),V(t,e,r)},"symbols:set":(t,e,r)=>{I(t,e,["symbols"],[],r),X(t.symbols,`${e}.symbols`,r,Ru)},"customPatterns:set":(t,e,r)=>{I(t,e,["customPatterns"],[],r),X(t.customPatterns,`${e}.customPatterns`,r,za)},"customPattern:upsert":(t,e,r)=>{I(t,e,["customPattern"],["index",...G],r),za(t.customPattern,`${e}.customPattern`,r),se(t,"index",e,r),V(t,e,r)},"customPattern:remove":(t,e,r)=>{I(t,e,["id"],G,r),A(t.id,`${e}.id`,r),V(t,e,r)},"library:set":(t,e,r)=>{I(t,e,["library"],[],r),X(t.library,`${e}.library`,r,Va)},"library:upsert":(t,e,r)=>{I(t,e,["def"],["index",...G],r),Va(t.def,`${e}.def`,r),se(t,"index",e,r),V(t,e,r)},"library:remove":(t,e,r)=>{I(t,e,["id"],G,r),A(t.id,`${e}.id`,r),V(t,e,r)},"rawPaintServerDefs:set":(t,e,r)=>{I(t,e,["rawPaintServerDefs"],[],r),nt(t.rawPaintServerDefs,`${e}.rawPaintServerDefs`,r)},"paintServerDefs:set":(t,e,r)=>{I(t,e,["paintServerDefs"],[],r),X(t.paintServerDefs,`${e}.paintServerDefs`,r,Ga)},"paintServerDef:upsert":(t,e,r)=>{I(t,e,["paintServerDef"],["index",...G],r),Ga(t.paintServerDef,`${e}.paintServerDef`,r),se(t,"index",e,r),V(t,e,r)},"paintServerDef:remove":(t,e,r)=>{I(t,e,["id"],G,r),A(t.id,`${e}.id`,r),V(t,e,r)},"presence:cursor":(t,e,r)=>{I(t,e,["position"],[],r);let n=U(t.position,`${e}.position`,r);n&&(I(n,`${e}.position`,["x","y"],[],r,!1),oe(n.x,`${e}.position.x`,r),oe(n.y,`${e}.position.y`,r))},"presence:selection":(t,e,r)=>{I(t,e,["shapeIds"],[],r),nt(t.shapeIds,`${e}.shapeIds`,r)}},Cu=new Set(Object.keys(ja)),Ka=new Set(["presence:cursor","presence:selection"]);function Lr(t,e="operation"){let r=[],n=U(t,e,r);return n?!A(n.type,`${e}.type`,r)||!Cu.has(n.type)?(typeof n.type=="string"&&n.type.length>0&&z(r,`${e}.type`,`unknown operation type "${n.type}"`),{valid:!1,issues:r}):(ja[n.type](n,e,r),r.length===0?{valid:!0,value:n}:{valid:!1,issues:r}):{valid:!1,issues:r}}function Xa(t,e={}){let r=[];if(!Array.isArray(t))return{valid:!1,issues:[{path:"ops",message:"must be an array"}]};let n=e.minItems??1,i=e.maxItems??5e3;(t.length<n||t.length>i)&&z(r,"ops",`must contain ${n}-${i} operations`);let s=[];return t.forEach((o,a)=>{let l=Lr(o,`ops[${a}]`);if(!l.valid){r.push(...l.issues);return}if(Ka.has(l.value.type)){z(r,`ops[${a}].type`,"presence operations are not document operations");return}s.push(l.value)}),r.length===0?{valid:!0,value:s}:{valid:!1,issues:r}}function Ya(t){let e=Lr(t,"op");return e.valid?Ka.has(e.value.type)?{valid:!0,value:e.value}:{valid:!1,issues:[{path:"op.type",message:"must be a presence operation"}]}:e}function qa(t){return t.slice(0,5).map(({path:e,message:r})=>`${e} ${r}`).join("; ")}function Nr(t,e,r,n){let i=e[r],s=typeof i=="string"?i:"",o=(t??[]).filter(l=>l[r]!==s),a=typeof n=="number"&&Number.isFinite(n)?Math.max(0,Math.min(n,o.length)):o.length;return o.splice(a,0,e),o}function Br(t,e,r){return(t??[]).filter(n=>n[e]!==r)}function he(t,e,r){return Nr(t,e,"id",r)}function ge(t,e){return Br(t,"id",e)}function zr(t,e,r){return Nr(t,e,"name",r)}function Gr(t,e){return Br(t,"name",e)}function Za(t,e){if(t===e)return null;let r=0,n=Math.min(t.length,e.length);for(;r<n&&t.charCodeAt(r)===e.charCodeAt(r);)r++;let i=0,s=Math.min(t.length,e.length)-r;for(;i<s&&t.charCodeAt(t.length-1-i)===e.charCodeAt(e.length-1-i);)i++;return{start:r,deleteCount:t.length-r-i,insert:e.slice(r,e.length-i)}}function Ja(t,e){return t.slice(0,e.start)+e.insert+t.slice(e.start+e.deleteCount)}function Ht(t,e){let r=e.start,n=e.start+e.deleteCount,i=e.insert.length-e.deleteCount,s=t.start,o=t.start+t.deleteCount;return n<=s?{start:s+i,deleteCount:t.deleteCount,insert:t.insert}:r>=o?{start:s,deleteCount:t.deleteCount,insert:t.insert}:r<=s&&n>=o?{start:r+e.insert.length,deleteCount:0,insert:t.insert}:r>=s&&n<=o?{start:s,deleteCount:t.deleteCount+i,insert:t.insert}:r<s?{start:r+e.insert.length,deleteCount:t.deleteCount-(n-s),insert:t.insert}:{start:s,deleteCount:r-s,insert:t.insert}}var jt=Object.freeze({fontFamily:"Arial",fontSize:16,fontWeight:"normal",fontStyle:"normal",fontVariant:"",fontVariantLigatures:"",fontVariantPosition:"",fontVariantCaps:"",fontVariantNumeric:"",fontVariantEastAsian:"",textDecoration:Object.freeze({underline:!1,strikethrough:!1,overline:!1}),textTransform:"none",baselineShift:"baseline",dominantBaseline:"auto",writingMode:"horizontal-tb",whiteSpace:"pre-wrap",direction:"ltr",unicodeBidi:"normal",textAnchor:"start",letterSpacing:0,wordSpacing:0,lineHeight:1.2,fontVariationSettings:Object.freeze({}),fill:"#000000",fillOpacity:1,stroke:"none",strokeWidth:0,strokeOpacity:1}),St=Object.keys(jt);function ze(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Be(t){return typeof t=="string"?t:void 0}function le(t){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t=="string"&&t.trim()!==""){let e=Number.parseFloat(t);return Number.isFinite(e)?e:void 0}}function Ke(t){return e=>typeof e=="string"&&t.includes(e)?e:void 0}function Du(t){return t==="normal"||t==="bold"?t:le(t)}function Fu(t){return t==="baseline"||t==="super"||t==="sub"?t:le(t)}function eo(t){if(typeof t=="string"){let r=t.toLowerCase();return{underline:r.includes("underline"),strikethrough:r.includes("line-through")||r.includes("strikethrough"),overline:r.includes("overline")}}if(!ze(t))return;let e={};return typeof t.underline=="boolean"&&(e.underline=t.underline),typeof t.strikethrough=="boolean"&&(e.strikethrough=t.strikethrough),typeof t.overline=="boolean"&&(e.overline=t.overline),e}function to(t){if(!ze(t))return;let e={};for(let[r,n]of Object.entries(t)){let i=le(n);i!==void 0&&(e[r]=i)}return e}var ro={fontFamily:Be,fontSize:le,fontWeight:Du,fontStyle:Ke(["normal","italic","oblique"]),fontVariant:Be,fontVariantLigatures:Be,fontVariantPosition:Be,fontVariantCaps:Be,fontVariantNumeric:Be,fontVariantEastAsian:Be,textTransform:Ke(["none","capitalize","uppercase","lowercase"]),baselineShift:Fu,dominantBaseline:Ke(["auto","alphabetic","central","middle","hanging","ideographic","mathematical","text-top","text-bottom"]),writingMode:Ke(["horizontal-tb","vertical-rl","vertical-lr"]),whiteSpace:Ke(["normal","nowrap","pre","pre-wrap","pre-line","break-spaces"]),direction:Ke(["ltr","rtl"]),unicodeBidi:Ke(["normal","embed","bidi-override","isolate","isolate-override","plaintext"]),textAnchor:Ke(["start","middle","end"]),letterSpacing:le,wordSpacing:le,lineHeight:le,fill:Be,fillOpacity:le,stroke:Be,strokeWidth:le,strokeOpacity:le};function Vr(t,e){return{...t,...e,textDecoration:{...t.textDecoration,...e.textDecoration??{}},fontVariationSettings:{...e.fontVariationSettings??t.fontVariationSettings}}}function rs(t,e){let r=Object.keys(t);return r.length!==Object.keys(e).length?!1:r.every(n=>Object.prototype.hasOwnProperty.call(e,n)&&t[n]===e[n])}function Hr(t,e){for(let r of St)if(r==="textDecoration"){if(t.textDecoration.underline!==e.textDecoration.underline||t.textDecoration.strikethrough!==e.textDecoration.strikethrough||t.textDecoration.overline!==e.textDecoration.overline)return!1}else if(r==="fontVariationSettings"){if(!rs(t.fontVariationSettings,e.fontVariationSettings))return!1}else if(t[r]!==e[r])return!1;return!0}function jr(t,e){let r=Object.keys(t).sort(),n=Object.keys(e).sort();if(r.length!==n.length||r.some((i,s)=>i!==n[s]))return!1;for(let i of r)if(i==="textDecoration"){let s=t.textDecoration??{},o=e.textDecoration??{},a=new Set([...Object.keys(s),...Object.keys(o)]);for(let l of a){let c=l;if(s[c]!==o[c])return!1}}else if(i==="fontVariationSettings"){if(!rs(t.fontVariationSettings??{},e.fontVariationSettings??{}))return!1}else{let s=i;if(t[s]!==e[s])return!1}return!0}function Ur(t,e){let r={};for(let i of St)i==="textDecoration"||i==="fontVariationSettings"||t[i]!==e[i]&&(r[i]=t[i]);let n={};return t.textDecoration.underline!==e.textDecoration.underline&&(n.underline=t.textDecoration.underline),t.textDecoration.strikethrough!==e.textDecoration.strikethrough&&(n.strikethrough=t.textDecoration.strikethrough),t.textDecoration.overline!==e.textDecoration.overline&&(n.overline=t.textDecoration.overline),Object.keys(n).length>0&&(r.textDecoration=n),rs(t.fontVariationSettings,e.fontVariationSettings)||(r.fontVariationSettings={...t.fontVariationSettings}),r}function Ie(t,e=jt){let r=ze(t)?t:{},n={...e};for(let i of St){if(i==="textDecoration"||i==="fontVariationSettings")continue;let s=ro[i](r[i]);s!==void 0&&(n[i]=s)}return n.textDecoration={...e.textDecoration,...eo(r.textDecoration)??{}},n.fontVariationSettings={...to(r.fontVariationSettings)??e.fontVariationSettings},n}function Kt(t){let e=ze(t)?t:{},r={};for(let n of St){if(n==="textDecoration"||n==="fontVariationSettings"||e[n]===void 0)continue;let i=ro[n](e[n]);i!==void 0&&(r[n]=i)}if(e.textDecoration!==void 0){let n=eo(e.textDecoration);n&&Object.keys(n).length>0&&(r.textDecoration=n)}if(e.fontVariationSettings!==void 0){let n=to(e.fontVariationSettings);n&&(r.fontVariationSettings=n)}return r}function ns(t){let e=[],r=0;for(;;){let n=t.indexOf(`
|
|
2
|
+
`,r);if(n===-1)return e.push({text:t.slice(r),start:r,end:t.length}),e;e.push({text:t.slice(r,n),start:r,end:n}),r=n+1}}function Eu(t,e,r){return t.start===t.end?r&&t.start===e:t.start<=e&&e<t.end}function ts(t,e,r,n){let i=t;for(let s of e)Eu(s,r,n)&&(i=Vr(i,s.style));return i===t?Vr(t,{}):i}function no(t,e,r={}){let n=Ie(t.baseStyle),i=typeof t.text=="string"?t.text:"";return ts(n,is(t.runs,i.length),e,r.collapsed===!0)}function it(t,e=jt){let r=ze(t)?t:{},n=Ie(r.baseStyle,e),i=typeof r.text=="string"?r.text:"";return{text:i,runs:is(r.runs,i.length),baseStyle:n,lineHeight:le(r.lineHeight)??n.lineHeight}}function is(t,e){if(!Array.isArray(t))return[];let r=[];for(let n of t){if(!ze(n))continue;let i=le(n.start),s=le(n.end);if(i===void 0||s===void 0)continue;let o=Math.min(Math.max(Math.trunc(i),0),e),a=Math.min(Math.max(Math.trunc(s),0),e);o>a||r.push({start:o,end:a,style:Kt(n.style)})}return r}function Ge(t){let e=typeof t.text=="string"?t.text:"",r=Ie(t.baseStyle),n=is(t.runs,e.length),i=le(t.lineHeight)??r.lineHeight;return{lines:ns(e).map(o=>{if(o.text.length===0)return{segments:[{text:"",style:ts(r,n,o.start,!0)}]};let a=new Set([o.start,o.end]);for(let f of n)f.start!==f.end&&(f.start>o.start&&f.start<o.end&&a.add(f.start),f.end>o.start&&f.end<o.end&&a.add(f.end));let l=[...a].sort((f,d)=>f-d),c=[];for(let f=0;f<l.length-1;f++){let d=l[f],p=l[f+1],m=ts(r,n,d,!1),g=c[c.length-1];g&&Hr(g.style,m)?g.text+=e.slice(d,p):c.push({text:e.slice(d,p),style:m})}return{segments:c}}),baseStyle:r,lineHeight:i}}function st(t){let e=Ie(t?.baseStyle),r=le(t?.lineHeight)??e.lineHeight,n=Array.isArray(t?.lines)?t.lines:[],i=n.length>0?n:[{segments:[]}],s=[],o=[],a=0;for(let f=0;f<i.length;f++){f>0&&(s.push(`
|
|
3
|
+
`),a+=1);let d=i[f]?.segments,p=Array.isArray(d)?d:[],m=a;for(let g of p){let h=typeof g?.text=="string"?g.text:"";if(h.length===0)continue;let b=Ie(g?.style,e),$=Ur(b,e);Object.keys($).length>0&&o.push({start:a,end:a+h.length,style:$}),s.push(h),a+=h.length}if(a===m){let g=Ie(p[0]?.style,e),h=Ur(g,e);Object.keys(h).length>0&&o.push({start:m,end:m,style:h})}}let l=s.join(""),c=[];for(let f of o){let d=c[c.length-1];d!==void 0&&d.start!==d.end&&f.start!==f.end&&(d.end===f.start||d.end+1===f.start&&l.charAt(d.end)===`
|
|
4
|
+
`)&&jr(d.style,f.style)&&d?d.end=f.end:c.push({start:f.start,end:f.end,style:f.style})}return{text:l,runs:c,baseStyle:e,lineHeight:r}}function Kr(t){let e=t.richTextRuns;if(ze(e))return it(e);let r=t.richTextData;return ze(r)&&Array.isArray(r.lines)&&r.lines.length>0?st(r):null}function Wr(t){let e=new Set;for(let r of Object.keys(t))if(r==="textDecoration")for(let n of Object.keys(t.textDecoration??{}))e.add(`textDecoration.${n}`);else e.add(r);return e}function Ou(t,e){if(t.start===t.end||e.start>=e.end||t.start<e.start||t.end>e.end)return!1;let r=Wr(e.style);for(let n of Wr(t.style))if(!r.has(n))return!1;return!0}function Xt(t,e){let r=[...t];for(let n of e)n.start>=n.end||Object.keys(n.style).length!==0&&(r=r.filter(i=>!Ou(i,n)),r.push({start:n.start,end:n.end,style:n.style}));return r}function Xr(t,e){if(!Array.isArray(t))return[];let r=[];for(let n of t){if(!ze(n))continue;let i=le(n.start),s=le(n.end);if(i===void 0||s===void 0)continue;let o=Math.min(Math.max(Math.trunc(i),0),e),a=Math.min(Math.max(Math.trunc(s),0),e);if(o>=a)continue;let l=Kt(n.style);Object.keys(l).length!==0&&r.push({start:o,end:a,style:l})}return r}function io(t,e){let r=[];for(let n of t){let i=Ht({start:n.start,deleteCount:n.end-n.start,insert:""},e),s=i.start,o=s+i.deleteCount;s>=o||r.push({start:s,end:o,style:n.style})}return r}function Qa(t,e){return t.start===e.start&&t.end===e.end&&jr(t.style,e.style)}function so(t,e){if(t.text!==e.text||t.lineHeight!==e.lineHeight||!Hr(Ie(t.baseStyle),Ie(e.baseStyle)))return null;let r=Array.isArray(t.runs)?t.runs:[],n=Array.isArray(e.runs)?e.runs:[],i=0,s=0;for(;s<n.length;){let l=-1;for(let c=i;c<r.length;c++)if(Qa(r[c],n[s])){l=c;break}if(l===-1)break;i=l+1,s++}let o=n.slice(s);if(o.length===0)return null;for(let l of o)if(l.start>=l.end||Object.keys(l.style).length===0)return null;let a=Xt(r,o);if(a.length!==n.length)return null;for(let l=0;l<a.length;l++)if(!Qa(a[l],n[l]))return null;return o.map(l=>({start:l.start,end:l.end,style:Kt(l.style)}))}function Lu(t,e){let r=e===0||t.charAt(e-1)===`
|
|
5
5
|
`,n=e===t.length||t.charAt(e)===`
|
|
6
|
-
`;return r&&n}function Js(t,e,r){let n=[];for(let i of t){let s=i.start===i.end,o=vt({start:i.start,deleteCount:i.end-i.start,insert:""},e),a=o.start,u=o.start+o.deleteCount;a===u&&(!s||!hl(r,a))||n.push({start:a,end:u,style:i.style})}return n}function na(t,e=null){let r=[];return t.forEach((n,i)=>{r.push({id:n.id,parentId:e,index:i});let s=n.state.children;Array.isArray(s)&&r.push(...na(s,n.id))}),r}function xr(t){return t.sceneTree&&t.sceneTree.length>0?t.sceneTree:na(t.shapes)}function _t(t){let e=new Map;for(let n of t){let i=e.get(n.parentId)??[];i.push(n),e.set(n.parentId,i)}let r=[];for(let n of e.values())We(n).forEach((i,s)=>r.push({...i,index:s}));return r}function We(t){let e=[...t].sort((i,s)=>i.index-s.index);if(!e.some(i=>i.orderKey))return e;let r=ur(e.length),n=new Map;return e.forEach((i,s)=>{n.set(i.id,i.orderKey??r[s])}),e.sort((i,s)=>{let o=xt(n.get(i.id)??"",n.get(s.id)??"");return o!==0?o:i.id<s.id?-1:i.id>s.id?1:0})}function Rt(t,e){let r=t.filter(u=>u.parentId===e);if(r.every(u=>u.orderKey))return t;let n=We(r),i=new Map,s=[],o=null,a=u=>{if(s.length===0)return;let c=lr(o,u,s.length);s.forEach((f,d)=>i.set(f.id,c[d])),s=[]};for(let u of n)u.orderKey?(a(u.orderKey),o=u.orderKey):s.push(u);return a(null),t.map(u=>i.has(u.id)?{...u,orderKey:i.get(u.id)}:u)}function ea(t,e){let r=t.find(a=>a.id===e.id);if(r&&!ia(e,r))return t;let n=t.filter(a=>a.id!==e.id),i=n.filter(a=>a.parentId!==e.parentId);if(n.some(a=>a.parentId===e.parentId&&a.orderKey)){let a=Rt(n,e.parentId),u=We(a.filter(p=>p.parentId===e.parentId)),c=Math.min(Math.max(0,e.index),u.length),f=c>0?u[c-1].orderKey??null:null,d=c<u.length?u[c].orderKey??null:null,h=f!==null&&d!==null&&f>=d?f:Ze(f,d);return _t([...i,...u,{...e,orderKey:h}])}let s=n.filter(a=>a.parentId===e.parentId).sort((a,u)=>a.index-u.index).map((a,u)=>({...a,index:u})),o=Math.min(Math.max(0,e.index),s.length);return _t([...i,...s,{...e,index:o-.5}])}function Sr(t,e,r){let n=t?[...t]:[],i=n.find(s=>s.id===e);return i?ce(n,i,r):n}function pl(t){t.keyframes.sort((e,r)=>{if(e.time!==r.time)return e.time-r.time;let n=e.id??"",i=r.id??"";return n<i?-1:n>i?1:0})}function _i(t,e){let r=t.keyframes.findIndex(n=>n.id===e.id);r>=0?t.keyframes[r]=e:t.keyframes.push(e),pl(t)}function Ri(t,e){t.keyframes=t.keyframes.filter(r=>r.id!==e)}function ta(t,e){let r=t.animationTimeline?.tracks;return Array.isArray(r)?r.find(n=>n.id===e)??null:null}function ia(t,e){let r=t.updatedAt??0,n=e.updatedAt??0;return r!==n?r>n:(t.clientId??"")>=(e.clientId??"")}function At(t){let e=t.state.children;return Array.isArray(e)?e:void 0}var Pi=new Set(["group","hyperlink","switch","container","svg"]);function sa(t,e,r,n){for(let i of t){r.set(i.id,e),n.set(i.id,i);let s=At(i);s&&sa(s,i.id,r,n)}}function $r(t){let e=t.sceneTree;if(!e||e.length===0)return;let r=new Map,n=new Map;if(sa(t.shapes,null,r,n),n.size===0)return;let i=new Map;for(let d of e){let h=i.get(d.parentId)??[];h.push(d),i.set(d.parentId,h)}let s=new Map,o=(d,h)=>{let p=s.get(d);p?p.push(h):s.set(d,[h])},a=new Set,u=new Set,c=(d,h)=>{for(let p of We(i.get(d)??[])){if(u.has(p.id))continue;u.add(p.id);let g=n.get(p.id);if(!g){c(p.id,h);continue}o(h,g),a.add(g.id),Pi.has(g.type)&&c(p.id,g.id)}};if(c(null,null),a.size===0)return;let f=d=>{let h=r.get(d)??null,p=new Set;for(;h!==null&&!p.has(h);){p.add(h);let g=n.get(h);if(g&&Pi.has(g.type))return h;h=r.get(h)??null}return null};for(let[d,h]of n)a.has(d)||o(f(d),h);for(let[d,h]of n){if(!Pi.has(h.type))continue;let p=h.state,g=s.get(d);g&&g.length>0?p.children=g:"children"in p&&delete p.children}t.shapes=s.get(null)??[]}function ml(t){let e=`structural:${t.type}:${t.id}`;return{group:`${e}:group`,path:`${e}:path`,content:`${e}:content`}}function Pt(t){let e=t.clipMaskGroups;if(!e||e.length===0)return;let r=t.sceneTree;if(!r||r.length===0)return;let n=new Set(r.map(o=>o.id)),i=new Map;for(let o of r){if(o.parentId===null)continue;let a=i.get(o.parentId);a?a.push(o):i.set(o.parentId,[o])}let s=o=>We(i.get(o)??[]).map(a=>a.id).filter(a=>!a.startsWith("structural:"));t.clipMaskGroups=e.map(o=>{let a=ml(o);if(!n.has(a.group))return o;let u=n.has(a.path)?s(a.path):o.clipShapeIds,c=n.has(a.content)?s(a.content):o.contentShapeIds;if(ra(u,o.clipShapeIds)&&ra(c,o.contentShapeIds))return o;let f={...o,clipShapeIds:u,contentShapeIds:c};return(f.clipShapeId!==void 0||u.length>0)&&(f.clipShapeId=u[0]),f})}function ra(t,e){return!e||t.length!==e.length?!1:t.every((r,n)=>r===e[n])}function aa(t,e){e.add(t.id);let r=At(t);if(r)for(let n of r)aa(n,e)}function tt(t,e){for(let r of t){if(r.id===e)return r;let n=At(r);if(!n)continue;let i=tt(n,e);if(i)return i}return null}function vr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function gl(t){let e=t.richTextRuns;return!vr(e)||typeof e.text!="string"?null:Ve(e)}function oa(t,e,r){for(let n of t){if(n.id===e){let s=n.state;"extra"in s&&Te(s);let o=new Set;for(let[a,u]of Object.entries(r))u===null?o.add(a):s[a]=u;if(o.size>0){let a={};for(let[u,c]of Object.entries(s))o.has(u)||(a[u]=c);n.state=a}return!0}let i=At(n);if(i&&oa(i,e,r))return!0}return!1}function la(t,e,r){let n=[];for(let i of t){if(i.id===e){aa(i,r);continue}let s=At(i);if(s){let o=la(s,e,r),a=i.state;o.length>0?a.children=o:delete a.children}n.push(i)}return n}function Ai(t,e){switch(e.type){case"shape:add":{if(!(tt(t.shapes,e.shape.id)!==null)){t.shapes.push($t(structuredClone(e.shape)));let n=xr(t),i=Math.max(0,n.filter(s=>s.parentId===null).length-1);t.sceneTree=ea(n,{id:e.shape.id,parentId:null,index:i})}break}case"shape:update":{oa(t.shapes,e.id,e.state);break}case"text:format":{let r=tt(t.shapes,e.id);if(!r)break;let n=r.state;"extra"in n&&Te(n);let i=gl(n);if(!i)break;let s=br(e.ranges,i.text.length);if(s.length===0)break;let o={...i,runs:wt(i.runs,s)};n.richTextRuns=o,vr(n.richTextData)&&(n.richTextData=_e(o));break}case"shape:remove":{let r=new Set;t.shapes=la(t.shapes,e.id,r),r.size===0&&r.add(e.id),t.sceneTree=xr(t).filter(n=>!r.has(n.id)),Pt(t);break}case"scene:move":t.sceneTree=ea(xr(t),{id:e.id,parentId:e.parentId,index:e.index,updatedAt:e.updatedAt,clientId:e.clientId}),$r(t),Pt(t);break;case"scene:place":{if(!bt(e.orderKey))break;let r=xr(t),n=r.find(o=>o.id===e.id),i={id:e.id,parentId:e.parentId,index:n?.index??Number.MAX_SAFE_INTEGER,orderKey:e.orderKey,updatedAt:e.updatedAt,clientId:e.clientId};if(n&&!ia(i,n))break;let s=Rt(r,e.parentId);t.sceneTree=_t([...s.filter(o=>o.id!==e.id),i]),$r(t),Pt(t);break}case"shapes:reorder":{let r=new Map(t.shapes.map(i=>[i.id,i])),n=e.ids.map(i=>r.get(i)).filter(i=>i!==void 0);for(let i of t.shapes)e.ids.includes(i.id)||n.push(i);if(t.shapes=n,t.sceneTree){let i=new Map(e.ids.map((s,o)=>[s,o]));t.sceneTree=t.sceneTree.map(s=>{let o=i.get(s.id);return s.parentId===null&&o!==void 0?{...s,index:o}:s}),t.sceneTree=_t(t.sceneTree)}break}case"groups:set":t.groups=e.groups;break;case"clipmasks:set":t.clipMaskGroups=e.clipMaskGroups;break;case"clipMask:upsert":t.clipMaskGroups=ce(t.clipMaskGroups,e.clipMaskGroup,e.index);break;case"clipMask:remove":t.clipMaskGroups=me(t.clipMaskGroups,e.id);break;case"guides:set":t.guides=e.guides;break;case"guide:upsert":t.guides=ce(t.guides,e.guide,e.index);break;case"guide:remove":t.guides=me(t.guides,e.id);break;case"guide:move":t.guides=Sr(t.guides,e.id,e.index);break;case"measurements:set":t.measurements=e.measurements;break;case"measurement:upsert":t.measurements=ce(t.measurements,e.measurement,e.index);break;case"measurement:remove":t.measurements=me(t.measurements,e.id);break;case"measurement:move":t.measurements=Sr(t.measurements,e.id,e.index);break;case"metadata:set":t.documentMetadata=e.metadata;break;case"metadata:patch":{let r=Object.fromEntries(Object.entries({...t.documentMetadata??{},...e.patch}).filter(([n])=>!(e.removeKeys??[]).includes(n)));t.documentMetadata=r;break}case"documentScripts:set":t.documentScripts=e.documentScripts;break;case"documentScript:upsert":t.documentScripts=ce(t.documentScripts,e.documentScript,e.index);break;case"documentScript:remove":t.documentScripts=me(t.documentScripts,e.id);break;case"documentStyles:set":t.documentStyles=e.documentStyles;break;case"documentStyle:upsert":t.documentStyles=ce(t.documentStyles,e.documentStyle,e.index);break;case"documentStyle:remove":t.documentStyles=me(t.documentStyles,e.id);break;case"animation:set":t.animationTimeline=e.animationTimeline;break;case"animation:config":t.animationTimeline={duration:e.config.duration,loop:e.config.loop,playbackSpeed:e.config.playbackSpeed,tracks:Array.isArray(t.animationTimeline?.tracks)?t.animationTimeline.tracks:[]};break;case"animation:clear":delete t.animationTimeline;break;case"animationTrack:upsert":t.animationTimeline={duration:typeof t.animationTimeline?.duration=="number"?t.animationTimeline.duration:0,loop:typeof t.animationTimeline?.loop=="boolean"?t.animationTimeline.loop:!1,playbackSpeed:typeof t.animationTimeline?.playbackSpeed=="number"?t.animationTimeline.playbackSpeed:1,tracks:ce(Array.isArray(t.animationTimeline?.tracks)?t.animationTimeline.tracks:[],e.track,e.index)};break;case"animationTrack:remove":{let r=me(Array.isArray(t.animationTimeline?.tracks)?t.animationTimeline.tracks:[],e.id);r.length>0&&t.animationTimeline?t.animationTimeline={...t.animationTimeline,tracks:r}:delete t.animationTimeline;break}case"animationKeyframe:upsert":{let r=ta(t,e.trackId);if(!r)break;_i(r,structuredClone(e.keyframe));break}case"animationKeyframe:remove":{let r=ta(t,e.trackId);if(!r)break;Ri(r,e.keyframeId);break}case"symbols:set":t.symbols=e.symbols,t.library=e.symbols.map(r=>({...r,kind:"symbol"}));break;case"customPatterns:set":t.customPatterns=e.customPatterns;break;case"customPattern:upsert":t.customPatterns=ce(t.customPatterns,e.customPattern,e.index);break;case"customPattern:remove":t.customPatterns=me(t.customPatterns,e.id);break;case"library:set":t.library=e.library;break;case"library:upsert":t.library=ce(t.library,e.def,e.index);break;case"library:remove":t.library=me(t.library,e.id);break;case"rawPaintServerDefs:set":t.rawPaintServerDefs=e.rawPaintServerDefs,delete t.paintServerDefs;break;case"paintServerDefs:set":t.paintServerDefs=e.paintServerDefs,t.rawPaintServerDefs=e.paintServerDefs.map(r=>r.markup);break;case"paintServerDef:upsert":t.paintServerDefs=ce(t.paintServerDefs,e.paintServerDef,e.index),t.rawPaintServerDefs=t.paintServerDefs.map(r=>r.markup);break;case"paintServerDef:remove":t.paintServerDefs=me(t.paintServerDefs,e.id),t.rawPaintServerDefs=t.paintServerDefs.map(r=>r.markup);break;case"presence:cursor":case"presence:selection":break}}function ua(t,e){let r=structuredClone(t);for(let n of e)Ai(r,n);return r}function ca(t){if(!t||t.length===0||t.every(r=>r.orderKey))return t;let e=t;for(let r of new Set(t.map(n=>n.parentId)))e=Rt(e,r);return _t(e)}function da(t,e){if(!t.some(n=>n.type==="scene:place"))return t;let r=new Map((e??[]).map(n=>[n.id,n]));return t.map(n=>{if(n.type!=="scene:place")return n;let i=r.get(n.id);return{type:"scene:move",id:n.id,parentId:i?.parentId??n.parentId,index:i?.index??0,updatedAt:n.updatedAt,clientId:n.clientId}})}function fa(t,e){if(!t.some(i=>i.type==="animationKeyframe:upsert"||i.type==="animationKeyframe:remove"))return t;let r=Array.isArray(e?.tracks)?e.tracks:[],n=[];for(let i of t){if(i.type!=="animationKeyframe:upsert"&&i.type!=="animationKeyframe:remove"){n.push(i);continue}let s=r.findIndex(o=>o.id===i.trackId);s!==-1&&n.push({type:"animationTrack:upsert",track:structuredClone(r[s]),index:s,updatedAt:i.updatedAt,clientId:i.clientId})}return n}function ha(t,e){if(!t.some(n=>n.type==="text:format"))return t;let r=[];for(let n of t){if(n.type!=="text:format"){r.push(n);continue}let i=tt(e,n.id);if(!i)continue;let s=i.state.richTextRuns;if(!vr(s))continue;let o={richTextRuns:structuredClone(s)},a=i.state.richTextData;vr(a)&&(o.richTextData=structuredClone(a)),r.push({type:"shape:update",id:n.id,state:o,...typeof n.updatedAt=="number"?{propTimestamps:Object.fromEntries(Object.keys(o).map(u=>[u,n.updatedAt]))}:{},...n.clientId!==void 0?{clientId:n.clientId}:{}})}return r}function pa(t,e){if(!t.some(n=>n.type==="guide:move"||n.type==="measurement:move"))return t;let r=[];for(let n of t)if(n.type==="guide:move"){let i=e.guides??[],s=i.findIndex(o=>o.id===n.id);if(s===-1)continue;r.push({type:"guide:upsert",guide:structuredClone(i[s]),index:s,updatedAt:n.updatedAt,clientId:n.clientId})}else if(n.type==="measurement:move"){let i=e.measurements??[],s=i.findIndex(o=>o.id===n.id);if(s===-1)continue;r.push({type:"measurement:upsert",measurement:structuredClone(i[s]),index:s,updatedAt:n.updatedAt,clientId:n.clientId})}else r.push(n);return r}function rt(t,e=t.id){return{kind:"pattern",id:e,name:t.name??e,pattern:{type:"pattern",svgContent:t.svgContent,width:t.width,height:t.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function Mi(t){if(t.builtIn)return!1;let e=t.pattern;return e.patternType==="custom"&&typeof e.svgContent=="string"}function Ci(t){let e=(t.viewBox??"").trim().split(/[\s,]+/).filter(s=>s.length>0).map(Number),r=e.length===4&&e.every(s=>Number.isFinite(s)),n=r&&e[2]>0?e[2]:t.width??10,i=r&&e[3]>0?e[3]:t.height??10;return{width:n,height:i}}function Tr(t){if(!Mi(t))return null;let{width:e,height:r}=Ci(t.pattern);return{id:t.id,name:t.name,svgContent:t.pattern.svgContent??"",width:e,height:r}}var Ct=Object.freeze([1,0,0,1,0,0]);function Re(t,e,r,n,i,s){return[t,e,r,n,i,s]}function wr(t){return Re(t[0]??1,t[1]??0,t[2]??0,t[3]??1,t[4]??0,t[5]??0)}function De(t){return[t[0],t[1],t[2],t[3],t[4],t[5]]}function it(t){return Array.isArray(t)&&t.length>=6&&t.slice(0,6).every(Number.isFinite)}function Di(t,e=1e-9){return Math.abs((t[0]??1)-1)<=e&&Math.abs(t[1]??0)<=e&&Math.abs(t[2]??0)<=e&&Math.abs((t[3]??1)-1)<=e&&Math.abs(t[4]??0)<=e&&Math.abs(t[5]??0)<=e}function yl(t,e,r=1e-9){for(let n=0;n<6;n++)if(Math.abs(t[n]-e[n])>r)return!1;return!0}function K(t,e){return Re(t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5])}function bl(t){let e=t[0]*t[3]-t[2]*t[1];if(Math.abs(e)<1e-10)return null;let r=1/e;return Re(t[3]*r,-t[1]*r,-t[2]*r,t[0]*r,(t[2]*t[5]-t[3]*t[4])*r,(t[1]*t[4]-t[0]*t[5])*r)}function xl(t,e){return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}function Sl(t,e){return{x:t[0]*e.x+t[2]*e.y,y:t[1]*e.x+t[3]*e.y}}function de(t,e=0){return Re(1,0,0,1,t,e)}function It(t,e=t){return Re(t,0,0,e,0,0)}function st(t){let e=t*Math.PI/180,r=Math.cos(e),n=Math.sin(e);return Re(r,n,-n,r,0,0)}function Dt(t){return Re(1,0,Math.tan(t*Math.PI/180),1,0,0)}function Ft(t){return Re(1,Math.tan(t*Math.PI/180),0,1,0,0)}function Fi(t,e){return K(K(de(t.x,t.y),e),de(-t.x,-t.y))}var $l=9,vl=10,Tl=12,kl=13,wl=32,ma=43,Pl=44,ga=45,_l=46,Rl=48,Al=57,Ml=40,Cl=41,Il=69,Dl=101,Fl=0,El=1,ba=2,Ll=new Map([["matrix",[6]],["translate",[1,2]],["scale",[1,2]],["rotate",[1,3]],["skewX",[1]],["skewY",[1]]]);function Bl(t){return t===wl||t===$l||t===vl||t===kl||t===Tl}function kr(t){return t>=Rl&&t<=Al}function Nl(t){let e=t>=65&&t<=90,r=t>=97&&t<=122;return e||r||kr(t)}function nt(t){for(;t.pos<t.src.length&&Bl(t.src.charCodeAt(t.pos));)t.pos++}function xa(t){let e=t.pos;return nt(t),t.src.charCodeAt(t.pos)===Pl?(t.pos++,nt(t),ba):t.pos>e?El:Fl}function ya(t){let e=t.src,r=t.pos,n=r,i=e.charCodeAt(n);(i===ma||i===ga)&&n++;let s=!1;for(;n<e.length&&kr(e.charCodeAt(n));)n++,s=!0;if(e.charCodeAt(n)===_l){let u=n+1;for(;u<e.length&&kr(e.charCodeAt(u));)u++;u>n+1&&(n=u,s=!0)}if(!s)return null;let o=e.charCodeAt(n);if(o===Dl||o===Il){let u=n+1,c=e.charCodeAt(u);(c===ma||c===ga)&&u++;let f=u;for(;f<e.length&&kr(e.charCodeAt(f));)f++;f>u&&(n=f)}let a=Number(e.slice(r,n));return Number.isFinite(a)?(t.pos=n,a):null}function Ol(t,e){switch(t){case"matrix":return wr(e);case"translate":return de(e[0],e[1]??0);case"scale":return It(e[0],e[1]??e[0]);case"rotate":return e.length===3?Fi({x:e[1],y:e[2]},st(e[0])):st(e[0]);case"skewX":return Dt(e[0]);case"skewY":return Ft(e[0]);default:return null}}function zl(t){let e=t.src,r=t.pos;for(;t.pos<e.length&&Nl(e.charCodeAt(t.pos));)t.pos++;if(t.pos===r)return null;let n=e.slice(r,t.pos),i=Ll.get(n);if(!i||(nt(t),e.charCodeAt(t.pos)!==Ml))return null;t.pos++,nt(t);let s=i[i.length-1],o=ya(t);if(o===null)return null;let a=[o];for(;;){let u=t.pos;xa(t);let c=ya(t);if(c===null){t.pos=u;break}if(a.push(c),a.length>s)return null}return nt(t),e.charCodeAt(t.pos)!==Cl||(t.pos++,!i.includes(a.length))?null:Ol(n,a)}function Gl(t){let e={src:t,pos:0};if(nt(e),e.pos>=t.length)return Ct;let r=Ct;for(;;){let n=zl(e);if(n===null)return null;r=K(r,n);let i=xa(e);if(e.pos>=t.length)return i===ba?null:r}}var Vl=2048,Mt=new Map;function Sa(t){if(!t)return Ct;let e=Mt.get(t);if(e!==void 0)return e;let r=Gl(t),n=r===null?null:Object.freeze(r);if(Mt.size>=Vl){let i=Mt.keys().next().value;i!==void 0&&Mt.delete(i)}return Mt.set(t,n),n}function Pr(t){return Sa(t)??Ct}function Ul(t){let e=t[0],r=t[1],n=t[2],i=t[3],s=Math.sqrt(e*e+r*r);if(s<1e-12)return{rotation:0,scaleX:0,scaleY:Math.sqrt(n*n+i*i),skewX:0};let o=Math.atan2(r,e),u=(e*i-r*n)/s,c=u!==0?(e*n+r*i)/(s*s):0,f=Math.atan(c),d=180/Math.PI;return{rotation:o*d,scaleX:s,scaleY:u,skewX:f*d}}function Ii(t){return!it(t)||Di(t)?null:`matrix(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}, ${t[4]}, ${t[5]})`}function Et(t,e){let r=t.translateX??0,n=t.translateY??0,i=typeof t.rawTransform=="string"?t.rawTransform:"",s=de(r,n);if(i)return K(s,Pr(i));let o=t.rotation??0,a=t.skewX??0,u=t.skewY??0,c=t.scaleX??1,f=t.scaleY??1;if(o===0&&a===0&&u===0&&c===1&&f===1)return s;let d=t.customPivot??e;if(!d)return s;let h=K(K(K(st(o),It(c,f)),Dt(a)),Ft(u));return K(s,Fi(d,h))}function at(t,e){let r=Ii(t.transformMatrix);return r||(Ii(De(Et(t,e)))??null)}function Ei(t,e){let r=t.ancestorTransform;if(!it(r)){delete t.ancestorTransform;return}if(Di(r)){delete t.ancestorTransform;return}let n=it(t.transformMatrix)?wr(t.transformMatrix):Et(t,e);t.transformMatrix=De(K(wr(r),n)),delete t.ancestorTransform}function Li(t,e,r){let n=at(t,{x:e,y:r});return n?`${n} translate(${e}, ${r})`:`translate(${e}, ${r})`}function Ta(t){let e=t.customPivot;if(e)return e;let r=t.x,n=t.y,i=t.width,s=t.height;if(typeof r=="number"&&typeof n=="number"&&typeof i=="number"&&typeof s=="number")return{x:r+i/2,y:n+s/2};let o=t.radius;if(typeof r=="number"&&typeof n=="number"&&typeof o=="number")return{x:r,y:n};let a=t.cx,u=t.cy;if(typeof a=="number"&&typeof u=="number")return{x:a,y:u};let c=t.x1,f=t.y1,d=t.x2,h=t.y2;if(typeof c=="number"&&typeof f=="number"&&typeof d=="number"&&typeof h=="number")return{x:(c+d)/2,y:(f+h)/2};let p=t.pathPoints;if(p?.[0])return{x:p[0].x,y:p[0].y};let g=t.polylinePoints;if(g?.[0])return{x:g[0].x,y:g[0].y}}function Lt(t){if(Array.isArray(t))for(let e of t){let r=e.state;Ei(r,Ta(r));let n=e.state.children;Lt(n)}}function Wl(t){Lt(t.shapes);for(let e of t.library??[])if(e.kind==="symbol"){Lt(e.shapes);for(let r of Object.values(e.variants??{}))Lt(r)}else e.kind==="marker"&&Lt(e.shapes);return t.schemaVersion=3,t}function Bi(t){let e=t;return e&&typeof e.x=="number"&&Number.isFinite(e.x)&&typeof e.y=="number"&&Number.isFinite(e.y)?{x:e.x,y:e.y}:null}function Hl(t,e){let r=t.translateX??0,n=t.translateY??0,i=typeof t.rawTransform=="string"?t.rawTransform:"",s=de(r,n);if(i)return De(K(s,Pr(i)));let o=t.rotation??0,a=t.skewX??0,u=t.skewY??0;if(o!==0||a!==0||u!==0){let d=Bi(t.customPivot)??e??Bi(t.scaleAnchor);d&&(s=K(s,de(d.x,d.y)),o!==0&&(s=K(s,st(o))),a!==0&&(s=K(s,Dt(a))),u!==0&&(s=K(s,Ft(u))),s=K(s,de(-d.x,-d.y)))}let c=t.scaleX??1,f=t.scaleY??1;if(c!==1||f!==1){let d=Bi(t.scaleAnchor)??e;d&&(s=K(s,de(d.x,d.y)),s=K(s,It(c,f)),s=K(s,de(-d.x,-d.y)))}return De(s)}function Bt(t){if(Array.isArray(t))for(let e of t){let r=e.state;"scaleAnchor"in r&&(e.type==="text"&&!it(r.transformMatrix)&&(r.transformMatrix=Hl(r,Ta(r))),delete r.scaleAnchor);let n=e.state.children;Bt(n)}}function jl(t){Bt(t.shapes);for(let e of t.library??[])if(e.kind==="symbol"){Bt(e.shapes);for(let r of Object.values(e.variants??{}))Bt(r)}else e.kind==="marker"&&Bt(e.shapes);return t.schemaVersion=4,t}function Xl(t){let e=Array.isArray(t.library)?[...t.library]:[],r=new Set(e.map(u=>u.id));if(Array.isArray(t.symbols))for(let u of t.symbols)!u||r.has(u.id)||(e.push({...u,kind:"symbol"}),r.add(u.id));if(Array.isArray(t.markers))for(let u of t.markers)!u||r.has(u.id)||(e.push({...u,kind:"marker"}),r.add(u.id));let n=new Map,i=(u,c)=>{let{id:f,sourceId:d,...h}=u,p=JSON.stringify({kind:c,...h}),g=n.get(p);if(g)return g;let m=r.has(u.id)?`grd-${_r()}`:u.id;r.add(m),n.set(p,m);let b=c==="linear-gradient"?{kind:"linear-gradient",id:m,name:u.sourceId??m,sourceId:u.sourceId,gradient:$a(u)}:{kind:"radial-gradient",id:m,name:u.sourceId??m,sourceId:u.sourceId,gradient:$a(u)};return e.push(b),m},s=new Map;if(Array.isArray(t.customPatterns))for(let u of t.customPatterns){if(!u)continue;let c=r.has(u.id)?`pat-${_r()}`:u.id;r.add(c),s.set(u.id,c),e.push(rt(u,c))}let o=u=>{if(u.customPatternId){let x=s.get(u.customPatternId);if(x)return x}let{id:c,sourceId:f,customPatternId:d,...h}=u,p=JSON.stringify({kind:"pattern",...h}),g=n.get(p);if(g)return g;let m=r.has(u.id)?`pat-${_r()}`:u.id;r.add(m),n.set(p,m);let b={kind:"pattern",id:m,name:u.sourceId??m,sourceId:u.sourceId,pattern:h};return e.push(b),m};for(let u of t.shapes??[]){let c=u.state;if(!c)continue;let f=c.fillGradient;f&&(f.type==="linear-gradient"||f.type==="radial-gradient"?c.fillLibraryId=i(f,f.type):f.type==="pattern"&&(c.fillLibraryId=o(f)));let d=c.strokeGradient;d&&(d.type==="linear-gradient"||d.type==="radial-gradient"?c.strokeLibraryId=i(d,d.type):d.type==="pattern"&&(c.strokeLibraryId=o(d)));let h=c.filters;if(Array.isArray(h)&&h.length>0){let p=a(h,c,u.id);c.filterLibraryIds=[p]}}return t.library=e,t;function a(u,c,f){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},h=JSON.stringify({kind:"filter",...d}),p=n.get(h);if(p)return p;let g=`filter-${f}`,m=r.has(g)?`flt-${_r()}`:g;r.add(m),n.set(h,m);let b={kind:"filter",id:m,name:m,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(b),m}}function $a(t){let{id:e,sourceId:r,...n}=t;return n}var Ni=0;function _r(){return Ni=Ni+1&65535,`${Date.now().toString(36)}-${Ni.toString(36)}`}function Kl(t){let e=r=>{if(Array.isArray(r))for(let n of r)ze(n)};e(t.shapes);for(let r of t.library??[])if(r.kind==="symbol"){e(r.shapes);for(let n of Object.values(r.variants??{}))e(n)}else r.kind==="marker"&&e(r.shapes);return t.schemaVersion=5,t}function va(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e=t;if(e.richTextRuns!==void 0&&e.richTextRuns!==null)return;let r=e.richTextData;!r||typeof r!="object"||Array.isArray(r)||Array.isArray(r.lines)&&(e.richTextRuns=Ue(r))}function ka(t){if(!t?.state||typeof t.state!="object")return;let e=t.state,r=e.children;if(Array.isArray(r))for(let i of r)ka(i);let n=e.symbolOverrides;if(n&&typeof n=="object"&&!Array.isArray(n))for(let i of Object.values(n))va(i);va(e)}function Yl(t){let e=r=>{if(Array.isArray(r))for(let n of r)ka(n)};e(t.shapes);for(let r of t.library??[])if(r.kind==="symbol"){e(r.shapes);for(let n of Object.values(r.variants??{}))e(n)}else r.kind==="marker"&&e(r.shapes);return t.schemaVersion=6,t}var Oi=Object.freeze({1:Xl,2:Wl,3:jl,4:Kl,5:Yl});function ql(t){let e=t.schemaVersion;return typeof e!="number"||!Number.isFinite(e)||e<1?1:Math.floor(e)}function Rr(t,e=Oi){let r=JSON.parse(JSON.stringify(t)),n=ql(r);if(n>ae)return r;if(n===ae)return r.schemaVersion=ae,r;for(;n<ae;){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 ${ae}.`);r=i(r),n+=1}return r.schemaVersion=ae,r}var Zl=new Set(["circle","rectangle","square","ellipse","text","triangle","ngon","star","cross","ring","spiral","gear","arrow","line","path","polyline","image"]);function Nt(t){let e=[],r=[];if(t==null||typeof t!="object")return e.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:e,warnings:r};let n=t;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>ae&&r.push({path:"schemaVersion",message:`schemaVersion ${n.schemaVersion} is newer than supported (${ae})`,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((s,o)=>{ru(s,`shapes[${o}]`,e,r,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((s,o)=>{su(s,`viewboxes[${o}]`,e,r,i)})}if(n.guides!==void 0&&(Array.isArray(n.guides)?n.guides.forEach((i,s)=>{au(i,`guides[${s}]`,e,r)}):e.push({path:"guides",message:"guides must be an array",severity:"error"})),n.groups!==void 0&&(Array.isArray(n.groups)?n.groups.forEach((i,s)=>{ou(i,`groups[${s}]`,e)}):e.push({path:"groups",message:"groups must be an array",severity:"error"})),n.sceneTree!==void 0)if(!Array.isArray(n.sceneTree))e.push({path:"sceneTree",message:"sceneTree must be an array",severity:"error"});else{let i=Ql(n.shapes),s=new Set;n.sceneTree.forEach((o,a)=>{Jl(o,`sceneTree[${a}]`,e,r,i,s)})}if(n.clipMaskGroups!==void 0&&(Array.isArray(n.clipMaskGroups)?n.clipMaskGroups.forEach((i,s)=>{lu(i,`clipMaskGroups[${s}]`,e)}):e.push({path:"clipMaskGroups",message:"clipMaskGroups must be an array",severity:"error"})),n.paintServerDefs!==void 0)if(!Array.isArray(n.paintServerDefs))e.push({path:"paintServerDefs",message:"paintServerDefs must be an array",severity:"error"});else{let i=new Set;n.paintServerDefs.forEach((s,o)=>{tu(s,`paintServerDefs[${o}]`,e,i)})}return 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:r}}function Ql(t){let e=new Set;if(!Array.isArray(t))return e;let r=n=>{if(n===null||typeof n!="object")return;let i=n;typeof i.id=="string"&&i.id.length>0&&e.add(i.id);let o=i.state?.children;if(Array.isArray(o))for(let a of o)r(a)};for(let n of t)r(n);return e}function wa(t){return t.startsWith("structural:")}function Jl(t,e,r,n,i,s){if(t===null||typeof t!="object"){r.push({path:e,message:"Scene tree entry must be a non-null object",severity:"error"});return}let o=t;typeof o.id!="string"||o.id.length===0?r.push({path:`${e}.id`,message:"Scene tree id must be a non-empty string",severity:"error"}):(s.has(o.id)&&r.push({path:`${e}.id`,message:`Duplicate scene tree id: "${o.id}"`,severity:"error"}),s.add(o.id),!i.has(o.id)&&!wa(o.id)&&n.push({path:`${e}.id`,message:`Scene tree id "${o.id}" is not present in shapes`,severity:"warning"})),o.parentId!==null&&typeof o.parentId!="string"?r.push({path:`${e}.parentId`,message:"Scene tree parentId must be a string or null",severity:"error"}):typeof o.parentId=="string"&&!i.has(o.parentId)&&!wa(o.parentId)&&n.push({path:`${e}.parentId`,message:`Scene tree parentId "${o.parentId}" is not present in shapes`,severity:"warning"}),(typeof o.index!="number"||!Number.isInteger(o.index)||o.index<0)&&r.push({path:`${e}.index`,message:"Scene tree index must be a non-negative integer",severity:"error"}),o.updatedAt!==void 0&&(typeof o.updatedAt!="number"||!Number.isFinite(o.updatedAt)||o.updatedAt<0)&&r.push({path:`${e}.updatedAt`,message:"Scene tree updatedAt must be a non-negative finite number",severity:"error"}),o.clientId!==void 0&&typeof o.clientId!="string"&&r.push({path:`${e}.clientId`,message:"Scene tree clientId must be a string",severity:"error"})}var eu=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]);function tu(t,e,r,n){if(t===null||typeof t!="object"){r.push({path:e,message:"Paint server def must be a non-null object",severity:"error"});return}let i=t;typeof i.id!="string"||i.id.length===0?r.push({path:`${e}.id`,message:"Paint server def id must be a non-empty string",severity:"error"}):n.has(i.id)?r.push({path:`${e}.id`,message:`Duplicate paint server def id: "${i.id}"`,severity:"error"}):n.add(i.id),(typeof i.type!="string"||!eu.has(i.type))&&r.push({path:`${e}.type`,message:"Paint server def type must be a supported SVG defs element type",severity:"error"}),(typeof i.markup!="string"||i.markup.length===0)&&r.push({path:`${e}.markup`,message:"Paint server def markup must be a non-empty string",severity:"error"}),i.passthrough!==void 0&&typeof i.passthrough!="boolean"&&r.push({path:`${e}.passthrough`,message:"Paint server def passthrough must be a boolean when present",severity:"error"})}function ru(t,e,r,n,i){if(t===null||typeof t!="object"){r.push({path:e,message:"Shape must be a non-null object",severity:"error"});return}let s=t;typeof s.id!="string"||s.id.length===0?r.push({path:`${e}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(s.id)?r.push({path:`${e}.id`,message:`Duplicate shape id: "${s.id}"`,severity:"error"}):i.add(s.id),typeof s.type!="string"?r.push({path:`${e}.type`,message:"Shape type must be a string",severity:"error"}):Zl.has(s.type)||n.push({path:`${e}.type`,message:`Unknown shape type: "${s.type}"`,severity:"warning"}),s.state===void 0||s.state===null||typeof s.state!="object"?r.push({path:`${e}.state`,message:"Shape state must be a non-null object",severity:"error"}):iu(s.state,`${e}.state`,r,n)}var nu=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function Pa(t){return typeof t=="number"?isFinite(t):typeof t=="string"?nu.test(t):!1}function iu(t,e,r,n){let i=["x","y","width","height","radius","rx","ry","fontSize"];for(let o of i)t[o]!==void 0&&!Pa(t[o])&&r.push({path:`${e}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"});for(let o of mt){let a=t[o];if(a!=null){if(o==="transformMatrix"){(!Array.isArray(a)||a.length<6||!a.slice(0,6).every(u=>typeof u=="number"&&Number.isFinite(u)))&&r.push({path:`${e}.${o}`,message:`${o} must be a 6-element finite affine matrix`,severity:"error"});continue}Pa(a)||r.push({path:`${e}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"})}}let s=["width","height","radius","fontSize"];for(let o of s){let a=t[o];typeof a=="number"&&a<=0&&n.push({path:`${e}.${o}`,message:`${o} should be positive (got ${a})`,severity:"warning"})}}function su(t,e,r,n,i){if(t===null||typeof t!="object"){r.push({path:e,message:"Viewbox must be a non-null object",severity:"error"});return}let s=t;typeof s.id!="string"||s.id.length===0?r.push({path:`${e}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):i.has(s.id)?r.push({path:`${e}.id`,message:`Duplicate viewbox id: "${s.id}"`,severity:"error"}):i.add(s.id);for(let o of["x","y","width","height"])(typeof s[o]!="number"||!isFinite(s[o]))&&r.push({path:`${e}.${o}`,message:`${o} must be a finite number`,severity:"error"});typeof s.width=="number"&&s.width<=0&&r.push({path:`${e}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof s.height=="number"&&s.height<=0&&r.push({path:`${e}.height`,message:"Viewbox height must be positive",severity:"error"})}function au(t,e,r,n){if(t===null||typeof t!="object"){r.push({path:e,message:"Guide must be a non-null object",severity:"error"});return}let i=t;(typeof i.id!="string"||i.id.length===0)&&r.push({path:`${e}.id`,message:"Guide id must be a non-empty string",severity:"error"}),i.orientation!=="horizontal"&&i.orientation!=="vertical"&&r.push({path:`${e}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof i.position!="number"||!isFinite(i.position))&&r.push({path:`${e}.position`,message:"Guide position must be a finite number",severity:"error"})}function ou(t,e,r){if(t===null||typeof t!="object"){r.push({path:e,message:"Group must be a non-null object",severity:"error"});return}let n=t;(typeof n.id!="string"||n.id.length===0)&&r.push({path:`${e}.id`,message:"Group id must be a non-empty string",severity:"error"}),n.parentId!==null&&typeof n.parentId!="string"&&r.push({path:`${e}.parentId`,message:"Group parentId must be a string or null",severity:"error"})}function lu(t,e,r){if(t===null||typeof t!="object"){r.push({path:e,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let n=t;(typeof n.id!="string"||n.id.length===0)&&r.push({path:`${e}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),n.type!=="clip"&&n.type!=="mask"&&r.push({path:`${e}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),(typeof n.clipShapeId!="string"||n.clipShapeId.length===0)&&r.push({path:`${e}.clipShapeId`,message:"clipShapeId must be a non-empty string",severity:"error"}),Array.isArray(n.contentShapeIds)||r.push({path:`${e}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function _(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function Ar(t={}){let e={schemaVersion:ae,shapes:t.shapes?t.shapes.map(r=>({...r})):[],viewboxes:t.viewboxes?t.viewboxes.map(r=>({...r})):[]};return t.metadata&&(e.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...t.metadata}),e}function _a(t){let{type:e,id:r,...n}=t,i={};for(let[s,o]of Object.entries(n))o!==void 0&&(i[s]=o);return{id:r??_(),type:e,state:i}}function Ot(t,e,r,n,i){return{id:i??_(),x:t,y:e,width:r,height:n}}var uu=["schemaVersion","documentMetadata","documentScripts","documentStyles","templateVariables","viewboxes","guides","measurements","groups","sceneTree","clipMaskGroups","customPatterns","symbols","markers","library","colorGlyphLibrary","paintServerDefs","rawPaintServerDefs","animationTimeline","shapes"];function Mr(t,e={}){let{indent:r=2,trailingNewline:n=!0,validate:i=!1}=e;if(i){let a=Nt(t);if(!a.valid){let u=a.errors.map(c=>` ${c.path}: ${c.message}`).join(`
|
|
6
|
+
`;return r&&n}function ao(t,e,r){let n=[];for(let i of t){let s=i.start===i.end,o=Ht({start:i.start,deleteCount:i.end-i.start,insert:""},e),a=o.start,l=o.start+o.deleteCount;a===l&&(!s||!Lu(r,a))||n.push({start:a,end:l,style:i.style})}return n}function Ve(t,e=t.id){return{kind:"pattern",id:e,name:t.name??e,pattern:{type:"pattern",svgContent:t.svgContent,width:t.width,height:t.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function Yt(t){if(t.builtIn)return!1;let e=t.pattern;return!e||typeof e!="object"?!1:e.patternType==="custom"&&typeof e.svgContent=="string"}function ss(t){let e=(t.viewBox??"").trim().split(/[\s,]+/).filter(s=>s.length>0).map(Number),r=e.length===4&&e.every(s=>Number.isFinite(s)),n=r&&e[2]>0?e[2]:t.width??10,i=r&&e[3]>0?e[3]:t.height??10;return{width:n,height:i}}function $t(t){if(!Yt(t))return null;let{width:e,height:r}=ss(t.pattern);return{id:t.id,name:t.name,svgContent:t.pattern.svgContent??"",width:e,height:r}}function Te(t){let e=[...t].sort((i,s)=>i.index-s.index);if(!e.some(i=>i.orderKey))return e;let r=Cr(e.length),n=new Map;return e.forEach((i,s)=>{n.set(i.id,i.orderKey??r[s])}),e.sort((i,s)=>{let o=Gt(n.get(i.id)??"",n.get(s.id)??"");return o!==0?o:i.id<s.id?-1:i.id>s.id?1:0})}var Nu=/^structural:(clip|mask):(.+):(group|path|content)$/;function oo(t,e){let r=`structural:${t}:${e}`;return{group:`${r}:group`,path:`${r}:path`,content:`${r}:content`}}function lo(t,e){for(let r of t){e.add(r.id);let n=r.state.children;Array.isArray(n)&&lo(n,e)}}function uo(t,e=null){let r=[];return t.forEach((n,i)=>{r.push({id:n.id,parentId:e,index:i});let s=n.state.children;Array.isArray(s)&&r.push(...uo(s,n.id))}),r}function Yr(t){let e=t.sceneTree&&t.sceneTree.length>0?t.sceneTree:uo(t.shapes),r=new Map(e.map(x=>[x.id,x])),n=new Map;for(let x of e){let S=n.get(x.parentId)??[];S.push(x),n.set(x.parentId,S)}for(let[x,S]of n)n.set(x,Te(S));let i=x=>Nu.test(x),s=new Set(e.filter(x=>!i(x.id)).map(x=>x.id)),o=new Set;lo(t.shapes,o);let a=new Map,l=new Set,c=(x,S)=>{let k=[];for(let w of n.get(x)??[]){if(!i(w.id)){l.has(w.id)||(l.add(w.id),k.push(w.id));continue}if(S.has(w.id))continue;let T=new Set(S);T.add(w.id),k.push(...c(w.id,T))}return k},f=[null,...s];for(let x of f){let S=c(x,new Set);S.length>0&&a.set(x,S)}for(let x of s){if(l.has(x))continue;let S=r.get(x)?.parentId??null,k=S!==null&&s.has(S)?S:null,w=a.get(k)??[];w.push(x),a.set(k,w),l.add(x)}let d=x=>{for(let[S,k]of a){let w=k.indexOf(x);if(w>=0)return{parentId:S,index:w}}return null},p=x=>{for(let S of a.values()){let k=S.indexOf(x);k>=0&&S.splice(k,1)}},m=t.clipMaskGroups??[],g=new Map(m.map(x=>[oo(x.type,x.id).content,x])),h=(x,S=new Set)=>{if(S.has(x.id))return Number.MAX_SAFE_INTEGER;let k=x.parentId?g.get(x.parentId):void 0;if(!k)return 0;let w=new Set(S);return w.add(x.id),1+h(k,w)},b=[...m].sort((x,S)=>h(x)-h(S)||(x.siblingIndex??0)-(S.siblingIndex??0)),$=new Map;for(let x of b){let S=(x.clipShapeIds.length>0?x.clipShapeIds:x.clipShapeId?[x.clipShapeId]:[]).filter(L=>o.has(L)),k=x.contentShapeIds.filter(L=>o.has(L));if(k.length===0||S.length===0&&!x.rawDefinition)continue;let w=[...k,...S].map(d).filter(L=>L!==null),T=w[0]?.parentId??null,P=w.length>0?Math.min(...w.map(L=>L.index)):void 0,R=x.parentId===null||s.has(x.parentId)||g.has(x.parentId)?x.parentId:T;for(let L of[...S,...k])p(L);let M=oo(x.type,x.id),N=a.get(R)??[],B=x.siblingIndex??P??N.length,D=Math.min(Math.max(0,B),N.length);N.splice(D,0,M.group),a.set(R,N),a.set(M.group,[M.path,M.content]),a.set(M.path,[...S]),a.set(M.content,[...k]),$.set(M.group,{id:M.group,parentId:R,index:0}),$.set(M.path,{id:M.path,parentId:M.group,index:0}),$.set(M.content,{id:M.content,parentId:M.group,index:1})}let v=[];for(let[x,S]of a)S.forEach((k,w)=>{let T=$.get(k);if(T){v.push({...T,parentId:x,index:w});return}let P=r.get(k);P&&P.parentId===x?v.push({...P,index:w}):v.push({id:k,parentId:x,index:w})});t.sceneTree=v}function we(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function as(t){return we(t)&&typeof t.updatedAt=="number"&&Number.isSafeInteger(t.updatedAt)&&t.updatedAt>=0&&typeof t.clientId=="string"}function at(t,e){return{updatedAt:typeof t=="number"&&Number.isSafeInteger(t)&&t>=0?t:0,clientId:e??""}}function qt(t,e){return as(e)?t.updatedAt>e.updatedAt||t.updatedAt===e.updatedAt&&t.clientId>=e.clientId:!0}function co(t){return we(t.collaborationState)||(t.collaborationState={}),t.collaborationState}function fo(t,e){let r=co(t);we(r.shapeProps)||(r.shapeProps={});let n=r.shapeProps;return we(n[e])||(n[e]={}),n[e]}function qr(t,e){let r=t.collaborationState?.shapeProps;if(!we(r))return{};let n=r[e];return we(n)?n:{}}function po(t,e,r,n){if(r.length===0)return;let i=fo(t,e);for(let s of r)qt(n,i[s])&&(i[s]=n)}function os(t,e){let r=t.collaborationState?.shapeProps;if(we(r))for(let n of e)delete r[n]}function ls(t){switch(t.type){case"guide:upsert":return`guide:${t.guide.id}`;case"guide:remove":case"guide:move":return`guide:${t.id}`;case"measurement:upsert":return`measurement:${t.measurement.id}`;case"measurement:remove":case"measurement:move":return`measurement:${t.id}`;case"metadata:patch":return"metadata:document";case"documentScript:upsert":return`documentScript:${t.documentScript.id}`;case"documentScript:remove":return`documentScript:${t.id}`;case"documentStyle:upsert":return`documentStyle:${t.documentStyle.id}`;case"documentStyle:remove":return`documentStyle:${t.id}`;case"templateVariable:upsert":return`templateVariable:${t.templateVariable.name}`;case"templateVariable:remove":return`templateVariable:${t.name}`;case"exportItem:upsert":return`exportItem:${t.exportItem.id}`;case"exportItem:remove":return`exportItem:${t.id}`;case"colorGlyphLibrary:set":return"colorGlyphLibrary";case"animation:config":case"animation:clear":case"animationTrack:upsert":case"animationTrack:remove":return"animation:timeline";case"animationKeyframe:upsert":return`animationKeyframe:${t.trackId}:${t.keyframe.id}`;case"animationKeyframe:remove":return`animationKeyframe:${t.trackId}:${t.keyframeId}`;case"clipMask:upsert":return`clipMask:${t.clipMaskGroup.id}`;case"clipMask:remove":return`clipMask:${t.id}`;case"library:upsert":return`library:${t.def.id}`;case"library:remove":return`library:${t.id}`;case"customPattern:upsert":return`customPattern:${t.customPattern.id}`;case"customPattern:remove":return`customPattern:${t.id}`;case"paintServerDef:upsert":return`paintServerDef:${t.paintServerDef.id}`;case"paintServerDef:remove":return`paintServerDef:${t.id}`;default:return null}}function mo(t,e,r){if(e.type==="shape:update"&&e.propTimestamps){if(!r)return null;let a=qr(t,e.id),l={},c={},f=[];for(let[p,m]of Object.entries(e.state)){let g=at(e.propTimestamps[p],e.clientId);qt(g,a[p])&&(l[p]=m,c[p]=g.updatedAt,f.push([p,g]))}if(f.length===0)return null;let d=fo(t,e.id);for(let[p,m]of f)d[p]=m;return{...e,state:l,propTimestamps:c}}let n=ls(e);if(n===null||!("updatedAt"in e)||e.updatedAt===void 0)return e;let i=at(e.updatedAt,e.clientId),s=co(t);we(s.resources)||(s.resources={});let o=s.resources;return qt(i,o[n])?(o[n]=i,{...e,updatedAt:i.updatedAt,clientId:i.clientId}):null}function ho(t){let e=0,r=t.collaborationState?.shapeProps;if(we(r)){for(let i of Object.values(r))if(we(i))for(let s of Object.values(i))as(s)&&(e=Math.max(e,s.updatedAt))}let n=t.collaborationState?.resources;if(we(n))for(let i of Object.values(n))as(i)&&(e=Math.max(e,i.updatedAt));for(let i of t.sceneTree??[])typeof i.updatedAt=="number"&&Number.isSafeInteger(i.updatedAt)&&i.updatedAt>=0&&(e=Math.max(e,i.updatedAt));return e}function go(t,e){let r=Object.keys(e.state);if(r.length===0)return;let n=qr(t,e.id),i=0;for(let o of r){let a=at(e.propTimestamps?.[o],e.clientId);i=Math.max(i,n[o]?.updatedAt??0,a.updatedAt)}let s=i+1;e.propTimestamps=Object.fromEntries(r.map(o=>[o,s]))}function ot(t){t.symbols!==void 0&&(t.symbols=(t.library??[]).filter(e=>e.kind==="symbol").map(({kind:e,...r})=>r)),t.customPatterns!==void 0&&(t.customPatterns=(t.library??[]).filter(e=>e.kind==="pattern").map(e=>$t(e)).filter(e=>e!==null))}function So(t,e=null){let r=[];return t.forEach((n,i)=>{r.push({id:n.id,parentId:e,index:i});let s=n.state.children;Array.isArray(s)&&r.push(...So(s,n.id))}),r}function Zt(t){return t.sceneTree&&t.sceneTree.length>0?t.sceneTree:So(t.shapes)}function Bu(t,e){let r=t,n=new Set(t.map(o=>o.id)),i=(o,a,l)=>{n.has(o.id)||(r=cs(r,{id:o.id,parentId:a,index:l}),n.add(o.id)),Tt(o)?.forEach((f,d)=>i(f,o.id,d))},s=r.filter(o=>o.parentId===null).length;return i(e,null,s),r}function Zr(t){let e=new Map;for(let n of t){let i=e.get(n.parentId)??[];i.push(n),e.set(n.parentId,i)}let r=[];for(let n of e.values())Te(n).forEach((i,s)=>r.push({...i,index:s}));return r}function Jt(t,e){let r=t.filter(l=>l.parentId===e);if(r.every(l=>l.orderKey))return t;let n=Te(r),i=new Map,s=[],o=null,a=l=>{if(s.length===0)return;let c=Mr(o,l,s.length);s.forEach((f,d)=>i.set(f.id,c[d])),s=[]};for(let l of n)l.orderKey?(a(l.orderKey),o=l.orderKey):s.push(l);return a(null),t.map(l=>i.has(l.id)?{...l,orderKey:i.get(l.id)}:l)}function cs(t,e){let r=t.find(a=>a.id===e.id);if(r&&!ds(e,r))return t;let n=t.filter(a=>a.id!==e.id),i=n.filter(a=>a.parentId!==e.parentId);if(n.some(a=>a.parentId===e.parentId&&a.orderKey)){let a=Jt(n,e.parentId),l=Te(a.filter(m=>m.parentId===e.parentId)),c=Math.min(Math.max(0,e.index),l.length),f=c>0?l[c-1].orderKey??null:null,d=c<l.length?l[c].orderKey??null:null,p=f!==null&&d!==null&&f>=d?f:gt(f,d);return Zr([...i,...l,{...e,orderKey:p}])}let s=n.filter(a=>a.parentId===e.parentId).sort((a,l)=>a.index-l.index).map((a,l)=>({...a,index:l})),o=Math.min(Math.max(0,e.index),s.length);return Zr([...i,...s,{...e,index:o-.5}])}function Jr(t,e,r){let n=t?[...t]:[],i=n.find(s=>s.id===e);return i?he(n,i,r):n}function zu(t){t.keyframes.sort((e,r)=>{if(e.time!==r.time)return e.time-r.time;let n=e.id??"",i=r.id??"";return n<i?-1:n>i?1:0})}function fs(t,e){let r=t.keyframes.findIndex(n=>n.id===e.id);r>=0?t.keyframes[r]=e:t.keyframes.push(e),zu(t)}function ps(t,e){t.keyframes=t.keyframes.filter(r=>r.id!==e)}function yo(t,e){let r=t.animationTimeline?.tracks;return Array.isArray(r)?r.find(n=>n.id===e)??null:null}function ds(t,e){let r=t.updatedAt??0,n=e.updatedAt??0;return r!==n?r>n:(t.clientId??"")>=(e.clientId??"")}function Tt(t){let e=t.state.children;return Array.isArray(e)?e:void 0}var us=new Set(["group","hyperlink","switch","container","svg"]);function $o(t,e,r,n){for(let i of t){r.set(i.id,e),n.set(i.id,i);let s=Tt(i);s&&$o(s,i.id,r,n)}}function vt(t){let e=t.sceneTree;if(!e||e.length===0)return;let r=new Map,n=new Map;if($o(t.shapes,null,r,n),n.size===0)return;for(let d of n.values())delete d.state.groupId;let i=new Map;for(let d of e){let p=i.get(d.parentId)??[];p.push(d),i.set(d.parentId,p)}let s=new Map,o=(d,p)=>{let m=s.get(d);m?m.push(p):s.set(d,[p])},a=new Set,l=new Set,c=(d,p)=>{for(let m of Te(i.get(d)??[])){if(l.has(m.id))continue;l.add(m.id);let g=n.get(m.id);if(!g){c(m.id,p);continue}o(p,g),a.add(g.id),us.has(g.type)&&c(m.id,g.id)}};if(c(null,null),a.size===0)return;let f=d=>{let p=r.get(d)??null,m=new Set;for(;p!==null&&!m.has(p);){m.add(p);let g=n.get(p);if(g&&us.has(g.type))return p;p=r.get(p)??null}return null};for(let[d,p]of n)a.has(d)||o(f(d),p);for(let[d,p]of n){if(!us.has(p.type))continue;let m=p.state,g=s.get(d);g&&g.length>0?m.children=g:"children"in m&&delete m.children}t.shapes=s.get(null)??[]}function Gu(t){let e=`structural:${t.type}:${t.id}`;return{group:`${e}:group`,path:`${e}:path`,content:`${e}:content`}}function kt(t){let e=t.clipMaskGroups;if(!e||e.length===0)return;let r=t.sceneTree;if(!r||r.length===0)return;let n=new Set(r.map(o=>o.id)),i=new Map;for(let o of r){if(o.parentId===null)continue;let a=i.get(o.parentId);a?a.push(o):i.set(o.parentId,[o])}let s=o=>Te(i.get(o)??[]).map(a=>a.id).filter(a=>!a.startsWith("structural:"));t.clipMaskGroups=e.map(o=>{let a=Gu(o);if(!n.has(a.group))return o;let l=n.has(a.path)?s(a.path):o.clipShapeIds,c=n.has(a.content)?s(a.content):o.contentShapeIds;if(bo(l,o.clipShapeIds)&&bo(c,o.contentShapeIds))return o;let f={...o,clipShapeIds:l,contentShapeIds:c};return(f.clipShapeId!==void 0||l.length>0)&&(f.clipShapeId=l[0]),f})}function bo(t,e){return!e||t.length!==e.length?!1:t.every((r,n)=>r===e[n])}function ms(t,e){e.add(t.id);let r=Tt(t);if(r)for(let n of r)ms(n,e)}function lt(t,e){for(let r of t){if(r.id===e)return r;let n=Tt(r);if(!n)continue;let i=lt(n,e);if(i)return i}return null}function Qr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Vu(t){let e=t.richTextRuns;return!Qr(e)||typeof e.text!="string"?null:it(e)}function vo(t,e,r){for(let n of t){if(n.id===e){let s=n.state;"extra"in s&&Le(s);let o=new Set;for(let[a,l]of Object.entries(r))l===null?o.add(a):s[a]=l;if(o.size>0){let a={};for(let[l,c]of Object.entries(s))o.has(l)||(a[l]=c);n.state=a}return!0}let i=Tt(n);if(i&&vo(i,e,r))return!0}return!1}function ko(t,e,r){let n=[];for(let i of t){if(i.id===e){ms(i,r);continue}let s=Tt(i);if(s){let o=ko(s,e,r),a=i.state;o.length>0?a.children=o:delete a.children}n.push(i)}return n}function hs(t,e){let r=t,n=mo(r,e,e.type!=="shape:update"||lt(t.shapes,e.id)!==null);if(n===null)return null;let i=n,s=i;switch(i.type){case"shape:add":{if(!(lt(t.shapes,i.shape.id)!==null)){let a=Zt(t),l=Ut(structuredClone(i.shape));t.shapes.push(l),t.sceneTree=Bu(a,l),vt(t);let c=new Set;ms(l,c),os(r,c)}break}case"shape:update":{vo(t.shapes,i.id,i.state);break}case"text:format":{let o=lt(t.shapes,i.id);if(!o)break;let a=o.state;"extra"in a&&Le(a);let l=Vu(a);if(!l)break;let c=Xr(i.ranges,l.text.length);if(c.length===0)break;let f={...l,runs:Xt(l.runs,c)};a.richTextRuns=f;let d=["richTextRuns"];if(Qr(a.richTextData)&&(a.richTextData=Ge(f),d.push("richTextData")),i.updatedAt!==void 0){let p=at(i.updatedAt,i.clientId),m=qr(r,i.id);if(d.some(h=>!qt(p,m?.[h]))){let h=Math.max(0,...d.map(b=>m?.[b]?.updatedAt??0));p={updatedAt:Math.max(p.updatedAt,h)+1,clientId:p.clientId},s={...i,updatedAt:p.updatedAt,clientId:p.clientId}}po(r,i.id,d,p)}break}case"shape:remove":{let o=new Set;t.shapes=ko(t.shapes,i.id,o),o.size===0&&o.add(i.id),t.sceneTree=Zt(t).filter(a=>!o.has(a.id)),os(r,o),kt(t);break}case"scene:move":{let o=Zt(t),a=o.find(f=>f.id===i.id),l=i.updatedAt===void 0?void 0:at(i.updatedAt,i.clientId),c={id:i.id,parentId:i.parentId,index:i.index,updatedAt:l?.updatedAt,clientId:l?.clientId};if(a&&!ds(c,a))return null;t.sceneTree=cs(o,c),l&&(s={...i,...l}),vt(t),kt(t);break}case"scene:place":{if(!zt(i.orderKey))return null;let o=Zt(t),a=o.find(d=>d.id===i.id),l=i.updatedAt===void 0?void 0:at(i.updatedAt,i.clientId),c={id:i.id,parentId:i.parentId,index:a?.index??Number.MAX_SAFE_INTEGER,orderKey:i.orderKey,updatedAt:l?.updatedAt,clientId:l?.clientId};if(a&&!ds(c,a))return null;let f=Jt(o,i.parentId);t.sceneTree=Zr([...f.filter(d=>d.id!==i.id),c]),vt(t),kt(t),l&&(s={...i,...l});break}case"shapes:reorder":{let o=Zt(t);i.ids.forEach((a,l)=>{o.some(c=>c.id===a&&c.parentId===null)&&(o=cs(o,{id:a,parentId:null,index:l}))}),t.sceneTree=o,vt(t),kt(t);break}case"groups:set":t.groups=i.groups;break;case"clipmasks:set":t.clipMaskGroups=i.clipMaskGroups,Yr(t);break;case"clipMask:upsert":t.clipMaskGroups=he(t.clipMaskGroups,i.clipMaskGroup,i.index),Yr(t);break;case"clipMask:remove":t.clipMaskGroups=ge(t.clipMaskGroups,i.id),Yr(t);break;case"guides:set":t.guides=i.guides;break;case"guide:upsert":t.guides=he(t.guides,i.guide,i.index);break;case"guide:remove":t.guides=ge(t.guides,i.id);break;case"guide:move":t.guides=Jr(t.guides,i.id,i.index);break;case"measurements:set":t.measurements=i.measurements;break;case"measurement:upsert":t.measurements=he(t.measurements,i.measurement,i.index);break;case"measurement:remove":t.measurements=ge(t.measurements,i.id);break;case"measurement:move":t.measurements=Jr(t.measurements,i.id,i.index);break;case"metadata:set":t.documentMetadata=i.metadata;break;case"metadata:patch":{let o=Object.fromEntries(Object.entries({...t.documentMetadata??{},...i.patch}).filter(([a])=>!(i.removeKeys??[]).includes(a)));t.documentMetadata=o;break}case"documentScripts:set":t.documentScripts=i.documentScripts;break;case"documentScript:upsert":t.documentScripts=he(t.documentScripts,i.documentScript,i.index);break;case"documentScript:remove":t.documentScripts=ge(t.documentScripts,i.id);break;case"documentStyles:set":t.documentStyles=i.documentStyles;break;case"documentStyle:upsert":t.documentStyles=he(t.documentStyles,i.documentStyle,i.index);break;case"documentStyle:remove":t.documentStyles=ge(t.documentStyles,i.id);break;case"templateVariables:set":t.templateVariables=i.templateVariables;break;case"templateVariable:upsert":t.templateVariables=zr(t.templateVariables,i.templateVariable,i.index);break;case"templateVariable:remove":t.templateVariables=Gr(t.templateVariables,i.name);break;case"exportItems:set":t.exportItems=i.exportItems;break;case"exportItem:upsert":t.exportItems=he(t.exportItems,i.exportItem,i.index);break;case"exportItem:remove":t.exportItems=ge(t.exportItems,i.id);break;case"colorGlyphLibrary:set":i.colorGlyphLibrary===null?delete t.colorGlyphLibrary:t.colorGlyphLibrary=i.colorGlyphLibrary;break;case"animation:set":t.animationTimeline=i.animationTimeline;break;case"animation:config":t.animationTimeline={duration:i.config.duration,loop:i.config.loop,playbackSpeed:i.config.playbackSpeed,tracks:Array.isArray(t.animationTimeline?.tracks)?t.animationTimeline.tracks:[]};break;case"animation:clear":delete t.animationTimeline;break;case"animationTrack:upsert":t.animationTimeline={duration:typeof t.animationTimeline?.duration=="number"?t.animationTimeline.duration:0,loop:typeof t.animationTimeline?.loop=="boolean"?t.animationTimeline.loop:!1,playbackSpeed:typeof t.animationTimeline?.playbackSpeed=="number"?t.animationTimeline.playbackSpeed:1,tracks:he(Array.isArray(t.animationTimeline?.tracks)?t.animationTimeline.tracks:[],i.track,i.index)};break;case"animationTrack:remove":{let o=ge(Array.isArray(t.animationTimeline?.tracks)?t.animationTimeline.tracks:[],i.id);o.length>0&&t.animationTimeline?t.animationTimeline={...t.animationTimeline,tracks:o}:delete t.animationTimeline;break}case"animationKeyframe:upsert":{let o=yo(t,i.trackId);if(!o)break;fs(o,structuredClone(i.keyframe));break}case"animationKeyframe:remove":{let o=yo(t,i.trackId);if(!o)break;ps(o,i.keyframeId);break}case"symbols:set":{t.symbols=i.symbols;let o=i.symbols.map(l=>({...l,kind:"symbol"})),a=(t.library??[]).filter(l=>l.kind!=="symbol");t.library=[...o,...a],ot(t);break}case"customPatterns:set":t.customPatterns=i.customPatterns;{let o=new Set(i.customPatterns.map(l=>l.id)),a=(t.library??[]).filter(l=>!o.has(l.id)&&(l.kind!=="pattern"||!Yt(l)));t.library=[...a,...i.customPatterns.map(l=>Ve(l))]}ot(t);break;case"customPattern:upsert":{t.customPatterns=he(t.customPatterns,i.customPattern,i.index);let o=Ve(i.customPattern),a=[...t.library??[]],l=a.findIndex(c=>c.id===o.id);l>=0?a[l]=o:a.push(o),t.library=a,ot(t);break}case"customPattern:remove":t.customPatterns=ge(t.customPatterns,i.id),t.library=ge(t.library,i.id),ot(t);break;case"library:set":t.library=i.library,ot(t);break;case"library:upsert":t.library=he(t.library,i.def,i.index),ot(t);break;case"library:remove":t.library=ge(t.library,i.id),ot(t);break;case"rawPaintServerDefs:set":t.rawPaintServerDefs=i.rawPaintServerDefs,delete t.paintServerDefs;break;case"paintServerDefs:set":t.paintServerDefs=i.paintServerDefs,t.rawPaintServerDefs=i.paintServerDefs.map(o=>o.markup);break;case"paintServerDef:upsert":t.paintServerDefs=he(t.paintServerDefs,i.paintServerDef,i.index),t.rawPaintServerDefs=t.paintServerDefs.map(o=>o.markup);break;case"paintServerDef:remove":t.paintServerDefs=ge(t.paintServerDefs,i.id),t.rawPaintServerDefs=t.paintServerDefs.map(o=>o.markup);break;case"presence:cursor":case"presence:selection":break}return s}function gs(t,e){let r=structuredClone(t),n=[];for(let i of e){let s=hs(r,i);s&&n.push(s)}return{snapshot:r,acceptedOps:n}}function To(t,e){return gs(t,e).snapshot}function wo(t){if(!t||t.length===0||t.every(r=>r.orderKey))return t;let e=t;for(let r of new Set(t.map(n=>n.parentId)))e=Jt(e,r);return Zr(e)}function Po(t,e){if(!t.some(n=>n.type==="scene:place"))return t;let r=new Map((e??[]).map(n=>[n.id,n]));return t.map(n=>{if(n.type!=="scene:place")return n;let i=r.get(n.id);return{type:"scene:move",id:n.id,parentId:i?.parentId??n.parentId,index:i?.index??0,updatedAt:n.updatedAt,clientId:n.clientId}})}function _o(t,e){if(!t.some(i=>i.type==="animationKeyframe:upsert"||i.type==="animationKeyframe:remove"))return t;let r=Array.isArray(e?.tracks)?e.tracks:[],n=[];for(let i of t){if(i.type!=="animationKeyframe:upsert"&&i.type!=="animationKeyframe:remove"){n.push(i);continue}let s=r.findIndex(o=>o.id===i.trackId);s!==-1&&n.push({type:"animationTrack:upsert",track:structuredClone(r[s]),index:s,updatedAt:i.updatedAt,clientId:i.clientId})}return n}function Ro(t,e){if(!t.some(n=>n.type==="text:format"))return t;let r=[];for(let n of t){if(n.type!=="text:format"){r.push(n);continue}let i=lt(e,n.id);if(!i)continue;let s=i.state.richTextRuns;if(!Qr(s))continue;let o={richTextRuns:structuredClone(s)},a=i.state.richTextData;Qr(a)&&(o.richTextData=structuredClone(a)),r.push({type:"shape:update",id:n.id,state:o,...typeof n.updatedAt=="number"?{propTimestamps:Object.fromEntries(Object.keys(o).map(l=>[l,n.updatedAt]))}:{},...n.clientId!==void 0?{clientId:n.clientId}:{}})}return r}function Ao(t,e){if(!t.some(n=>n.type==="guide:move"||n.type==="measurement:move"))return t;let r=[];for(let n of t)if(n.type==="guide:move"){let i=e.guides??[],s=i.findIndex(o=>o.id===n.id);if(s===-1)continue;r.push({type:"guide:upsert",guide:structuredClone(i[s]),index:s,updatedAt:n.updatedAt,clientId:n.clientId})}else if(n.type==="measurement:move"){let i=e.measurements??[],s=i.findIndex(o=>o.id===n.id);if(s===-1)continue;r.push({type:"measurement:upsert",measurement:structuredClone(i[s]),index:s,updatedAt:n.updatedAt,clientId:n.clientId})}else r.push(n);return r}var Io=6,xo=new Set(["templateVariables:set","templateVariable:upsert","templateVariable:remove","exportItems:set","exportItem:upsert","exportItem:remove","colorGlyphLibrary:set"]);function Mo(t){return t.some(e=>xo.has(e.type))?t.filter(e=>!xo.has(e.type)):t}var er=Object.freeze([1,0,0,1,0,0]);function Ue(t,e,r,n,i,s){return[t,e,r,n,i,s]}function tn(t){return Ue(t[0]??1,t[1]??0,t[2]??0,t[3]??1,t[4]??0,t[5]??0)}function Xe(t){return[t[0],t[1],t[2],t[3],t[4],t[5]]}function Pt(t){return Array.isArray(t)&&t.length>=6&&t.slice(0,6).every(Number.isFinite)}function bs(t,e=1e-9){return Math.abs((t[0]??1)-1)<=e&&Math.abs(t[1]??0)<=e&&Math.abs(t[2]??0)<=e&&Math.abs((t[3]??1)-1)<=e&&Math.abs(t[4]??0)<=e&&Math.abs(t[5]??0)<=e}function Uu(t,e,r=1e-9){for(let n=0;n<6;n++)if(Math.abs(t[n]-e[n])>r)return!1;return!0}function re(t,e){return Ue(t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5])}function Wu(t){let e=t[0]*t[3]-t[2]*t[1];if(Math.abs(e)<1e-10)return null;let r=1/e;return Ue(t[3]*r,-t[1]*r,-t[2]*r,t[0]*r,(t[2]*t[5]-t[3]*t[4])*r,(t[1]*t[4]-t[0]*t[5])*r)}function Hu(t,e){return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}function ju(t,e){return{x:t[0]*e.x+t[2]*e.y,y:t[1]*e.x+t[3]*e.y}}function Pe(t,e=0){return Ue(1,0,0,1,t,e)}function tr(t,e=t){return Ue(t,0,0,e,0,0)}function _t(t){let e=t*Math.PI/180,r=Math.cos(e),n=Math.sin(e);return Ue(r,n,-n,r,0,0)}function rr(t){return Ue(1,0,Math.tan(t*Math.PI/180),1,0,0)}function nr(t){return Ue(1,Math.tan(t*Math.PI/180),0,1,0,0)}function xs(t,e){return re(re(Pe(t.x,t.y),e),Pe(-t.x,-t.y))}var Ku=9,Xu=10,Yu=12,qu=13,Zu=32,Co=43,Ju=44,Do=45,Qu=46,ec=48,tc=57,rc=40,nc=41,ic=69,sc=101,ac=0,oc=1,Eo=2,lc=new Map([["matrix",[6]],["translate",[1,2]],["scale",[1,2]],["rotate",[1,3]],["skewX",[1]],["skewY",[1]]]);function uc(t){return t===Zu||t===Ku||t===Xu||t===qu||t===Yu}function en(t){return t>=ec&&t<=tc}function cc(t){let e=t>=65&&t<=90,r=t>=97&&t<=122;return e||r||en(t)}function wt(t){for(;t.pos<t.src.length&&uc(t.src.charCodeAt(t.pos));)t.pos++}function Oo(t){let e=t.pos;return wt(t),t.src.charCodeAt(t.pos)===Ju?(t.pos++,wt(t),Eo):t.pos>e?oc:ac}function Fo(t){let e=t.src,r=t.pos,n=r,i=e.charCodeAt(n);(i===Co||i===Do)&&n++;let s=!1;for(;n<e.length&&en(e.charCodeAt(n));)n++,s=!0;if(e.charCodeAt(n)===Qu){let l=n+1;for(;l<e.length&&en(e.charCodeAt(l));)l++;l>n+1&&(n=l,s=!0)}if(!s)return null;let o=e.charCodeAt(n);if(o===sc||o===ic){let l=n+1,c=e.charCodeAt(l);(c===Co||c===Do)&&l++;let f=l;for(;f<e.length&&en(e.charCodeAt(f));)f++;f>l&&(n=f)}let a=Number(e.slice(r,n));return Number.isFinite(a)?(t.pos=n,a):null}function dc(t,e){switch(t){case"matrix":return tn(e);case"translate":return Pe(e[0],e[1]??0);case"scale":return tr(e[0],e[1]??e[0]);case"rotate":return e.length===3?xs({x:e[1],y:e[2]},_t(e[0])):_t(e[0]);case"skewX":return rr(e[0]);case"skewY":return nr(e[0]);default:return null}}function fc(t){let e=t.src,r=t.pos;for(;t.pos<e.length&&cc(e.charCodeAt(t.pos));)t.pos++;if(t.pos===r)return null;let n=e.slice(r,t.pos),i=lc.get(n);if(!i||(wt(t),e.charCodeAt(t.pos)!==rc))return null;t.pos++,wt(t);let s=i[i.length-1],o=Fo(t);if(o===null)return null;let a=[o];for(;;){let l=t.pos;Oo(t);let c=Fo(t);if(c===null){t.pos=l;break}if(a.push(c),a.length>s)return null}return wt(t),e.charCodeAt(t.pos)!==nc||(t.pos++,!i.includes(a.length))?null:dc(n,a)}function pc(t){let e={src:t,pos:0};if(wt(e),e.pos>=t.length)return er;let r=er;for(;;){let n=fc(e);if(n===null)return null;r=re(r,n);let i=Oo(e);if(e.pos>=t.length)return i===Eo?null:r}}var mc=2048,Qt=new Map;function Lo(t){if(!t)return er;let e=Qt.get(t);if(e!==void 0)return e;let r=pc(t),n=r===null?null:Object.freeze(r);if(Qt.size>=mc){let i=Qt.keys().next().value;i!==void 0&&Qt.delete(i)}return Qt.set(t,n),n}function rn(t){return Lo(t)??er}function hc(t){let e=t[0],r=t[1],n=t[2],i=t[3],s=Math.sqrt(e*e+r*r);if(s<1e-12)return{rotation:0,scaleX:0,scaleY:Math.sqrt(n*n+i*i),skewX:0};let o=Math.atan2(r,e),l=(e*i-r*n)/s,c=l!==0?(e*n+r*i)/(s*s):0,f=Math.atan(c),d=180/Math.PI;return{rotation:o*d,scaleX:s,scaleY:l,skewX:f*d}}function ys(t){return!Pt(t)||bs(t)?null:`matrix(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]}, ${t[4]}, ${t[5]})`}function ir(t,e){let r=t.translateX??0,n=t.translateY??0,i=typeof t.rawTransform=="string"?t.rawTransform:"",s=Pe(r,n);if(i)return re(s,rn(i));let o=t.rotation??0,a=t.skewX??0,l=t.skewY??0,c=t.scaleX??1,f=t.scaleY??1;if(o===0&&a===0&&l===0&&c===1&&f===1)return s;let d=t.customPivot??e;if(!d)return s;let p=re(re(re(_t(o),tr(c,f)),rr(a)),nr(l));return re(s,xs(d,p))}function Rt(t,e){let r=ys(t.transformMatrix);return r||(ys(Xe(ir(t,e)))??null)}function Ss(t,e){let r=t.ancestorTransform;if(!Pt(r)){delete t.ancestorTransform;return}if(bs(r)){delete t.ancestorTransform;return}let n=Pt(t.transformMatrix)?tn(t.transformMatrix):ir(t,e);t.transformMatrix=Xe(re(tn(r),n)),delete t.ancestorTransform}function $s(t,e,r){let n=Rt(t,{x:e,y:r});return n?`${n} translate(${e}, ${r})`:`translate(${e}, ${r})`}function zo(t){let e=t.customPivot;if(e)return e;let r=t.x,n=t.y,i=t.width,s=t.height;if(typeof r=="number"&&typeof n=="number"&&typeof i=="number"&&typeof s=="number")return{x:r+i/2,y:n+s/2};let o=t.radius;if(typeof r=="number"&&typeof n=="number"&&typeof o=="number")return{x:r,y:n};let a=t.cx,l=t.cy;if(typeof a=="number"&&typeof l=="number")return{x:a,y:l};let c=t.x1,f=t.y1,d=t.x2,p=t.y2;if(typeof c=="number"&&typeof f=="number"&&typeof d=="number"&&typeof p=="number")return{x:(c+d)/2,y:(f+p)/2};let m=t.pathPoints;if(m?.[0])return{x:m[0].x,y:m[0].y};let g=t.polylinePoints;if(g?.[0])return{x:g[0].x,y:g[0].y}}function sr(t){if(Array.isArray(t))for(let e of t){let r=e.state;Ss(r,zo(r));let n=e.state.children;sr(n)}}function gc(t){sr(t.shapes);for(let e of t.library??[])if(e.kind==="symbol"){sr(e.shapes);for(let r of Object.values(e.variants??{}))sr(r)}else e.kind==="marker"&&sr(e.shapes);return t.schemaVersion=3,t}function vs(t){let e=t;return e&&typeof e.x=="number"&&Number.isFinite(e.x)&&typeof e.y=="number"&&Number.isFinite(e.y)?{x:e.x,y:e.y}:null}function yc(t,e){let r=t.translateX??0,n=t.translateY??0,i=typeof t.rawTransform=="string"?t.rawTransform:"",s=Pe(r,n);if(i)return Xe(re(s,rn(i)));let o=t.rotation??0,a=t.skewX??0,l=t.skewY??0;if(o!==0||a!==0||l!==0){let d=vs(t.customPivot)??e??vs(t.scaleAnchor);d&&(s=re(s,Pe(d.x,d.y)),o!==0&&(s=re(s,_t(o))),a!==0&&(s=re(s,rr(a))),l!==0&&(s=re(s,nr(l))),s=re(s,Pe(-d.x,-d.y)))}let c=t.scaleX??1,f=t.scaleY??1;if(c!==1||f!==1){let d=vs(t.scaleAnchor)??e;d&&(s=re(s,Pe(d.x,d.y)),s=re(s,tr(c,f)),s=re(s,Pe(-d.x,-d.y)))}return Xe(s)}function ar(t){if(Array.isArray(t))for(let e of t){let r=e.state;"scaleAnchor"in r&&(e.type==="text"&&!Pt(r.transformMatrix)&&(r.transformMatrix=yc(r,zo(r))),delete r.scaleAnchor);let n=e.state.children;ar(n)}}function bc(t){ar(t.shapes);for(let e of t.library??[])if(e.kind==="symbol"){ar(e.shapes);for(let r of Object.values(e.variants??{}))ar(r)}else e.kind==="marker"&&ar(e.shapes);return t.schemaVersion=4,t}function xc(t){let e=Array.isArray(t.library)?[...t.library]:[],r=new Set(e.map(l=>l.id));if(Array.isArray(t.symbols))for(let l of t.symbols)!l||r.has(l.id)||(e.push({...l,kind:"symbol"}),r.add(l.id));if(Array.isArray(t.markers))for(let l of t.markers)!l||r.has(l.id)||(e.push({...l,kind:"marker"}),r.add(l.id));let n=new Map,i=(l,c)=>{let{id:f,sourceId:d,...p}=l,m=JSON.stringify({kind:c,...p}),g=n.get(m);if(g)return g;let h=r.has(l.id)?`grd-${nn()}`:l.id;r.add(h),n.set(m,h);let b=c==="linear-gradient"?{kind:"linear-gradient",id:h,name:l.sourceId??h,sourceId:l.sourceId,gradient:No(l)}:{kind:"radial-gradient",id:h,name:l.sourceId??h,sourceId:l.sourceId,gradient:No(l)};return e.push(b),h},s=new Map;if(Array.isArray(t.customPatterns))for(let l of t.customPatterns){if(!l)continue;let c=r.has(l.id)?`pat-${nn()}`:l.id;r.add(c),s.set(l.id,c),e.push(Ve(l,c))}let o=l=>{if(l.customPatternId){let $=s.get(l.customPatternId);if($)return $}let{id:c,sourceId:f,customPatternId:d,...p}=l,m=JSON.stringify({kind:"pattern",...p}),g=n.get(m);if(g)return g;let h=r.has(l.id)?`pat-${nn()}`:l.id;r.add(h),n.set(m,h);let b={kind:"pattern",id:h,name:l.sourceId??h,sourceId:l.sourceId,pattern:p};return e.push(b),h};for(let l of t.shapes??[]){let c=l.state;if(!c)continue;let f=c.fillGradient;f&&(f.type==="linear-gradient"||f.type==="radial-gradient"?c.fillLibraryId=i(f,f.type):f.type==="pattern"&&(c.fillLibraryId=o(f)));let d=c.strokeGradient;d&&(d.type==="linear-gradient"||d.type==="radial-gradient"?c.strokeLibraryId=i(d,d.type):d.type==="pattern"&&(c.strokeLibraryId=o(d)));let p=c.filters;if(Array.isArray(p)&&p.length>0){let m=a(p,c,l.id);c.filterLibraryIds=[m]}}return t.library=e,t;function a(l,c,f){let d={filters:l,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 g=`filter-${f}`,h=r.has(g)?`flt-${nn()}`:g;r.add(h),n.set(p,h);let b={kind:"filter",id:h,name:h,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(b),h}}function No(t){let{id:e,sourceId:r,...n}=t;return n}var ks=0;function nn(){return ks=ks+1&65535,`${Date.now().toString(36)}-${ks.toString(36)}`}function Sc(t){let e=r=>{if(Array.isArray(r))for(let n of r)tt(n)};e(t.shapes);for(let r of t.library??[])if(r.kind==="symbol"){e(r.shapes);for(let n of Object.values(r.variants??{}))e(n)}else r.kind==="marker"&&e(r.shapes);return t.schemaVersion=5,t}function Bo(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e=t;if(e.richTextRuns!==void 0&&e.richTextRuns!==null)return;let r=e.richTextData;!r||typeof r!="object"||Array.isArray(r)||Array.isArray(r.lines)&&(e.richTextRuns=st(r))}function Go(t){if(!t?.state||typeof t.state!="object")return;let e=t.state,r=e.children;if(Array.isArray(r))for(let i of r)Go(i);let n=e.symbolOverrides;if(n&&typeof n=="object"&&!Array.isArray(n))for(let i of Object.values(n))Bo(i);Bo(e)}function $c(t){let e=r=>{if(Array.isArray(r))for(let n of r)Go(n)};e(t.shapes);for(let r of t.library??[])if(r.kind==="symbol"){e(r.shapes);for(let n of Object.values(r.variants??{}))e(n)}else r.kind==="marker"&&e(r.shapes);return t.schemaVersion=6,t}var Ts=Object.freeze({1:xc,2:gc,3:bc,4:Sc,5:$c});function vc(t){let e=t.schemaVersion;return typeof e!="number"||!Number.isFinite(e)||e<1?1:Math.floor(e)}function sn(t,e=Ts){let r=JSON.parse(JSON.stringify(t)),n=vc(r);if(n>xe)return r;if(n===xe)return r.schemaVersion=xe,r;for(;n<xe;){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 ${xe}.`);r=i(r),n+=1}return r.schemaVersion=xe,r}function ut(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}async function Ps(t,e,r,n){let i=t[e];typeof i=="string"&&(t[e]=await n(i,r))}async function ws(t,e){ut(t)&&await Ps(t,"svgContent","svgMarkup",e)}async function an(t,e){if(!ut(t))return;await Ps(t,"href","href",e),await ws(t.fillGradient,e),await ws(t.strokeGradient,e);let r=t.children;if(Array.isArray(r))for(let n of r)ut(n)&&await an(n.state,e)}async function Vo(t,e){if(!ut(t))return;let r=t.shapes;if(Array.isArray(r))for(let s of r)ut(s)&&await an(s.state,e);let n=t.library;if(Array.isArray(n))for(let s of n)ut(s)&&s.kind==="pattern"&&await ws(s.pattern,e);let i=t.customPatterns;if(Array.isArray(i))for(let s of i)ut(s)&&await Ps(s,"svgContent","svgMarkup",e)}var kc=new Set(["circle","rectangle","square","ellipse","text","triangle","ngon","star","cross","ring","spiral","gear","arrow","line","path","polyline","image"]);function or(t){let e=[],r=[];if(t==null||typeof t!="object")return e.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:e,warnings:r};let n=t;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>xe&&r.push({path:"schemaVersion",message:`schemaVersion ${n.schemaVersion} is newer than supported (${xe})`,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((s,o)=>{Rc(s,`shapes[${o}]`,e,r,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((s,o)=>{Mc(s,`viewboxes[${o}]`,e,r,i)})}if(n.guides!==void 0&&(Array.isArray(n.guides)?n.guides.forEach((i,s)=>{Cc(i,`guides[${s}]`,e,r)}):e.push({path:"guides",message:"guides must be an array",severity:"error"})),n.groups!==void 0&&(Array.isArray(n.groups)?n.groups.forEach((i,s)=>{Dc(i,`groups[${s}]`,e)}):e.push({path:"groups",message:"groups must be an array",severity:"error"})),n.sceneTree!==void 0)if(!Array.isArray(n.sceneTree))e.push({path:"sceneTree",message:"sceneTree must be an array",severity:"error"});else{let i=Tc(n.shapes),s=new Set;n.sceneTree.forEach((o,a)=>{wc(o,`sceneTree[${a}]`,e,r,i,s)})}if(n.clipMaskGroups!==void 0&&(Array.isArray(n.clipMaskGroups)?n.clipMaskGroups.forEach((i,s)=>{Fc(i,`clipMaskGroups[${s}]`,e)}):e.push({path:"clipMaskGroups",message:"clipMaskGroups must be an array",severity:"error"})),n.paintServerDefs!==void 0)if(!Array.isArray(n.paintServerDefs))e.push({path:"paintServerDefs",message:"paintServerDefs must be an array",severity:"error"});else{let i=new Set;n.paintServerDefs.forEach((s,o)=>{_c(s,`paintServerDefs[${o}]`,e,i)})}return 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:r}}function Tc(t){let e=new Set;if(!Array.isArray(t))return e;let r=n=>{if(n===null||typeof n!="object")return;let i=n;typeof i.id=="string"&&i.id.length>0&&e.add(i.id);let o=i.state?.children;if(Array.isArray(o))for(let a of o)r(a)};for(let n of t)r(n);return e}function Uo(t){return t.startsWith("structural:")}function wc(t,e,r,n,i,s){if(t===null||typeof t!="object"){r.push({path:e,message:"Scene tree entry must be a non-null object",severity:"error"});return}let o=t;typeof o.id!="string"||o.id.length===0?r.push({path:`${e}.id`,message:"Scene tree id must be a non-empty string",severity:"error"}):(s.has(o.id)&&r.push({path:`${e}.id`,message:`Duplicate scene tree id: "${o.id}"`,severity:"error"}),s.add(o.id),!i.has(o.id)&&!Uo(o.id)&&n.push({path:`${e}.id`,message:`Scene tree id "${o.id}" is not present in shapes`,severity:"warning"})),o.parentId!==null&&typeof o.parentId!="string"?r.push({path:`${e}.parentId`,message:"Scene tree parentId must be a string or null",severity:"error"}):typeof o.parentId=="string"&&!i.has(o.parentId)&&!Uo(o.parentId)&&n.push({path:`${e}.parentId`,message:`Scene tree parentId "${o.parentId}" is not present in shapes`,severity:"warning"}),(typeof o.index!="number"||!Number.isInteger(o.index)||o.index<0)&&r.push({path:`${e}.index`,message:"Scene tree index must be a non-negative integer",severity:"error"}),o.updatedAt!==void 0&&(typeof o.updatedAt!="number"||!Number.isFinite(o.updatedAt)||o.updatedAt<0)&&r.push({path:`${e}.updatedAt`,message:"Scene tree updatedAt must be a non-negative finite number",severity:"error"}),o.clientId!==void 0&&typeof o.clientId!="string"&&r.push({path:`${e}.clientId`,message:"Scene tree clientId must be a string",severity:"error"})}var Pc=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]);function _c(t,e,r,n){if(t===null||typeof t!="object"){r.push({path:e,message:"Paint server def must be a non-null object",severity:"error"});return}let i=t;typeof i.id!="string"||i.id.length===0?r.push({path:`${e}.id`,message:"Paint server def id must be a non-empty string",severity:"error"}):n.has(i.id)?r.push({path:`${e}.id`,message:`Duplicate paint server def id: "${i.id}"`,severity:"error"}):n.add(i.id),(typeof i.type!="string"||!Pc.has(i.type))&&r.push({path:`${e}.type`,message:"Paint server def type must be a supported SVG defs element type",severity:"error"}),(typeof i.markup!="string"||i.markup.length===0)&&r.push({path:`${e}.markup`,message:"Paint server def markup must be a non-empty string",severity:"error"}),i.passthrough!==void 0&&typeof i.passthrough!="boolean"&&r.push({path:`${e}.passthrough`,message:"Paint server def passthrough must be a boolean when present",severity:"error"})}function Rc(t,e,r,n,i){if(t===null||typeof t!="object"){r.push({path:e,message:"Shape must be a non-null object",severity:"error"});return}let s=t;typeof s.id!="string"||s.id.length===0?r.push({path:`${e}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(s.id)?r.push({path:`${e}.id`,message:`Duplicate shape id: "${s.id}"`,severity:"error"}):i.add(s.id),typeof s.type!="string"?r.push({path:`${e}.type`,message:"Shape type must be a string",severity:"error"}):kc.has(s.type)||n.push({path:`${e}.type`,message:`Unknown shape type: "${s.type}"`,severity:"warning"}),s.state===void 0||s.state===null||typeof s.state!="object"?r.push({path:`${e}.state`,message:"Shape state must be a non-null object",severity:"error"}):Ic(s.state,`${e}.state`,r,n)}var Ac=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function Wo(t){return typeof t=="number"?isFinite(t):typeof t=="string"?Ac.test(t):!1}function Ic(t,e,r,n){let i=["x","y","width","height","radius","rx","ry","fontSize"];for(let o of i)t[o]!==void 0&&!Wo(t[o])&&r.push({path:`${e}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"});for(let o of Lt){let a=t[o];if(a!=null){if(o==="transformMatrix"){(!Array.isArray(a)||a.length<6||!a.slice(0,6).every(l=>typeof l=="number"&&Number.isFinite(l)))&&r.push({path:`${e}.${o}`,message:`${o} must be a 6-element finite affine matrix`,severity:"error"});continue}Wo(a)||r.push({path:`${e}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"})}}let s=["width","height","radius","fontSize"];for(let o of s){let a=t[o];typeof a=="number"&&a<=0&&n.push({path:`${e}.${o}`,message:`${o} should be positive (got ${a})`,severity:"warning"})}}function Mc(t,e,r,n,i){if(t===null||typeof t!="object"){r.push({path:e,message:"Viewbox must be a non-null object",severity:"error"});return}let s=t;typeof s.id!="string"||s.id.length===0?r.push({path:`${e}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):i.has(s.id)?r.push({path:`${e}.id`,message:`Duplicate viewbox id: "${s.id}"`,severity:"error"}):i.add(s.id);for(let o of["x","y","width","height"])(typeof s[o]!="number"||!isFinite(s[o]))&&r.push({path:`${e}.${o}`,message:`${o} must be a finite number`,severity:"error"});typeof s.width=="number"&&s.width<=0&&r.push({path:`${e}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof s.height=="number"&&s.height<=0&&r.push({path:`${e}.height`,message:"Viewbox height must be positive",severity:"error"})}function Cc(t,e,r,n){if(t===null||typeof t!="object"){r.push({path:e,message:"Guide must be a non-null object",severity:"error"});return}let i=t;(typeof i.id!="string"||i.id.length===0)&&r.push({path:`${e}.id`,message:"Guide id must be a non-empty string",severity:"error"}),i.orientation!=="horizontal"&&i.orientation!=="vertical"&&r.push({path:`${e}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof i.position!="number"||!isFinite(i.position))&&r.push({path:`${e}.position`,message:"Guide position must be a finite number",severity:"error"})}function Dc(t,e,r){if(t===null||typeof t!="object"){r.push({path:e,message:"Group must be a non-null object",severity:"error"});return}let n=t;(typeof n.id!="string"||n.id.length===0)&&r.push({path:`${e}.id`,message:"Group id must be a non-empty string",severity:"error"}),n.parentId!==null&&typeof n.parentId!="string"&&r.push({path:`${e}.parentId`,message:"Group parentId must be a string or null",severity:"error"})}function Fc(t,e,r){if(t===null||typeof t!="object"){r.push({path:e,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let n=t;(typeof n.id!="string"||n.id.length===0)&&r.push({path:`${e}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),n.type!=="clip"&&n.type!=="mask"&&r.push({path:`${e}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),(typeof n.clipShapeId!="string"||n.clipShapeId.length===0)&&r.push({path:`${e}.clipShapeId`,message:"clipShapeId must be a non-empty string",severity:"error"}),Array.isArray(n.contentShapeIds)||r.push({path:`${e}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function _(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function on(t={}){let e={schemaVersion:xe,shapes:t.shapes?t.shapes.map(r=>({...r})):[],viewboxes:t.viewboxes?t.viewboxes.map(r=>({...r})):[]};return t.metadata&&(e.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...t.metadata}),e}function Ho(t){let{type:e,id:r,...n}=t,i={};for(let[s,o]of Object.entries(n))o!==void 0&&(i[s]=o);return{id:r??_(),type:e,state:i}}function lr(t,e,r,n,i){return{id:i??_(),x:t,y:e,width:r,height:n}}var Ec=["schemaVersion","documentMetadata","documentScripts","documentStyles","templateVariables","viewboxes","guides","measurements","groups","sceneTree","clipMaskGroups","customPatterns","symbols","markers","library","colorGlyphLibrary","paintServerDefs","rawPaintServerDefs","animationTimeline","shapes"];function ln(t,e={}){let{indent:r=2,trailingNewline:n=!0,validate:i=!1}=e;if(i){let a=or(t);if(!a.valid){let l=a.errors.map(c=>` ${c.path}: ${c.message}`).join(`
|
|
7
7
|
`);throw new Error(`Invalid document:
|
|
8
|
-
${
|
|
9
|
-
`:o}function
|
|
8
|
+
${l}`)}}let s={};for(let a of Ec){let l=t[a];if(l!==void 0)switch(a){case"shapes":s[a]=l.map(c=>Lc(tt(structuredClone(c))));break;case"viewboxes":case"guides":case"measurements":case"groups":case"sceneTree":case"clipMaskGroups":case"symbols":case"markers":case"customPatterns":case"library":case"paintServerDefs":case"rawPaintServerDefs":s[a]=Array.isArray(l)&&typeof l[0]=="string"?l:Oc(l).map(ct);break;case"documentMetadata":s[a]=ct(l);break;case"animationTimeline":s[a]=ct(l);break;case"colorGlyphLibrary":s[a]=ct(l);break;default:s[a]=l}}let o=JSON.stringify(s,null,r);return n?o+`
|
|
9
|
+
`:o}function un(t,e={}){let{validate:r=!0,migrate:n=!0}=e,i;try{i=JSON.parse(t)}catch(o){throw new Error(`Failed to parse .svgs document: ${o.message}`)}if(i===null||typeof i!="object"||Array.isArray(i))throw new Error("Invalid .svgs document: root must be a JSON object");let s=i;if(n&&(s=sn(s)),r){let o=or(s);if(!o.valid){let a=o.errors.map(l=>` ${l.path}: ${l.message}`).join(`
|
|
10
10
|
`);throw new Error(`Invalid .svgs document:
|
|
11
|
-
${a}`)}}return s}function cu(t){return[...t].sort((e,r)=>e.id.localeCompare(r.id))}function He(t){if(t==null)return t;if(Array.isArray(t))return t.map(He);if(typeof t!="object")return t;let e={},r=Object.keys(t).sort();for(let n of r)e[n]=He(t[n]);return e}function du(t){let e={};return e.id=t.id,e.type=t.type,e.state=He(t.state),e}var fe=/\{\{\s*([\w.\-]+)\s*\}\}/g;function Ir(t,e){return t.replace(fe,(r,n)=>{let i=e[n];return i!==void 0?String(i):r})}function Er(t,e={}){let r={};if(t.templateVariables)for(let i of t.templateVariables)i.defaultValue!==void 0&&i.defaultValue!==""&&(r[i.name]=i.defaultValue);if(Object.assign(r,e),Object.keys(r).length===0)return JSON.parse(JSON.stringify(t));let n=JSON.parse(JSON.stringify(t));for(let i of n.shapes)Dr(i.state,r);if(n.documentMetadata){let i=n.documentMetadata;Dr(i,r)}return n}function Dr(t,e){for(let r of Object.keys(t)){let n=t[r];if(typeof n=="string"){if(fe.lastIndex=0,fe.test(n)){fe.lastIndex=0;let i=Ir(n,e);if(fu(n)){let s=Number(i);if(!isNaN(s)&&pu(r)){t[r]=s;continue}}t[r]=i}}else if(Array.isArray(n))for(let i=0;i<n.length;i++)typeof n[i]=="string"?(fe.lastIndex=0,fe.test(n[i])&&(fe.lastIndex=0,n[i]=Ir(n[i],e))):n[i]!==null&&typeof n[i]=="object"&&Dr(n[i],e);else n!==null&&typeof n=="object"&&Dr(n,e)}}function fu(t){return/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/.test(t)}var hu=new Set(["x","y","width","height","radius","rx","ry","cx","cy","x1","y1","x2","y2","fontSize","borderWidth","cornerRadius","opacity","fillOpacity","strokeOpacity",...mt,"letterSpacing","wordSpacing","lineHeight","sides","arms","innerRadiusPercent","armWidthPercent","teeth","toothDepthPercent","holeRadiusPercent","turns","thicknessPercent","direction","headWidthPercent","headLengthPercent","shaftWidthPercent","shiftAngle","dashLength","gapLength","textPathStartOffset","imageOpacity"]);function pu(t){return hu.has(t)}function Lr(t){let e=t.templateVariables??[],r=new Set(e.map(s=>s.name)),n=new Set;for(let s of t.shapes)Fr(s.state,n);t.documentMetadata&&Fr(t.documentMetadata,n);let i=[...n].filter(s=>!r.has(s)).sort();return{defined:[...e],undeclared:i}}function Fr(t,e){for(let r of Object.values(t))if(typeof r=="string"){let n;for(fe.lastIndex=0;(n=fe.exec(r))!==null;)e.add(n[1])}else if(Array.isArray(r))for(let n of r)if(typeof n=="string"){let i;for(fe.lastIndex=0;(i=fe.exec(n))!==null;)e.add(i[1])}else n!==null&&typeof n=="object"&&Fr(n,e);else r!==null&&typeof r=="object"&&Fr(r,e)}function Ra(t){let e={};for(let r of t){let n=r.indexOf("=");if(n===-1)throw new Error(`Invalid variable format: "${r}". Expected "name=value".`);let i=r.slice(0,n).trim(),s=r.slice(n+1);if(!i)throw new Error(`Invalid variable format: "${r}". Variable name cannot be empty.`);e[i]=s}return e}var Aa=3,Ma=12;function Ca(t){return t==null||!Number.isFinite(t)?3:t<0?0:t>12?12:Math.floor(t)}function Nr(t,e){if(!Number.isFinite(t))return t;let r=Math.pow(10,e);return Math.round(t*r)/r}var mu=/-?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?/g;function zi(t,e){return t.replace(mu,r=>{let n=parseFloat(r);return Number.isFinite(n)?String(Nr(n,e)):r})}var gu=new Set(["rawTransform","strokeDasharray","filterX","filterY","filterWidth","filterHeight","cssClipPath"]),yu=new Set(["metadata","customMetadata","customAttrs","customData","bindings","richTextRuns","richTextData","cssMaskProperties","rawMetadata"]);function ye(t,e,r){if(e==null)return e;if(typeof e=="number")return Nr(e,r);if(typeof e=="string")return gu.has(t)?zi(e,r):e;if(typeof e=="boolean")return e;if(Array.isArray(e))return e.map(n=>ye(t,n,r));if(typeof e=="object"){if(yu.has(t))return e;if(t==="symbolOverrides"){let i={};for(let[s,o]of Object.entries(e))i[s]=ye("state",o,r);return i}let n={};for(let[i,s]of Object.entries(e))n[i]=ye(i,s,r);return n}return e}function Br(t,e){return{id:t.id,type:t.type,state:ye("state",t.state,e)}}function Ia(t,e){let r={...t,shapes:t.shapes.map(n=>Br(n,e)),viewboxes:t.viewboxes.map(n=>ye("viewbox",n,e))};return t.guides&&(r.guides=t.guides.map(n=>ye("guide",n,e))),t.measurements&&(r.measurements=t.measurements.map(n=>ye("measurement",n,e))),t.animationTimeline&&(r.animationTimeline=ye("animationTimeline",t.animationTimeline,e)),t.symbols&&(r.symbols=t.symbols.map(n=>({...n,shapes:n.shapes.map(i=>Br(i,e))}))),t.markers&&(r.markers=t.markers.map(n=>ye("marker",n,e))),t.customPatterns&&(r.customPatterns=t.customPatterns.map(n=>ye("customPattern",n,e))),r}function Gt(t,e,r=-90){let n=[],i=r*Math.PI/180;for(let s=0;s<t;s++){let o=i+s*2*Math.PI/t;n.push({x:e*Math.cos(o),y:e*Math.sin(o)})}return n}function zr(t,e,r,n=-90){let i=[],s=e*(r/100),o=n*Math.PI/180;for(let a=0;a<t*2;a++){let u=o+a*Math.PI/t,c=a%2===0?e:s;i.push({x:c*Math.cos(u),y:c*Math.sin(u)})}return i}function Gr(t,e,r=0){let n=t*(e/100)/2,i=[{x:-n,y:-t},{x:n,y:-t},{x:n,y:-n},{x:t,y:-n},{x:t,y:n},{x:n,y:n},{x:n,y:t},{x:-n,y:t},{x:-n,y:n},{x:-t,y:n},{x:-t,y:-n},{x:-n,y:-n}];if(r===0)return i;let s=Math.cos(r*Math.PI/180),o=Math.sin(r*Math.PI/180);return i.map(a=>({x:a.x*s-a.y*o,y:a.x*o+a.y*s}))}function Vr(t,e,r,n,i=-90){let o=t*2*(r/100),a=t*(e/100),u=a*(n/100),c=[{x:t,y:0},{x:t-o,y:-a/2},{x:t-o,y:-u/2},{x:-t,y:-u/2},{x:-t,y:u/2},{x:t-o,y:u/2},{x:t-o,y:a/2}];if(i===0)return c;let f=Math.cos(i*Math.PI/180),d=Math.sin(i*Math.PI/180);return c.map(h=>({x:h.x*f-h.y*d,y:h.x*d+h.y*f}))}function Ur(t,e,r,n,i=0){let s=t,o=s*(r/100),a=s*(n/100),u=a/2,c=e*Math.PI/180,f=Math.cos(c),d=Math.sin(c),h=Math.abs(f),p=Math.abs(d),g=Math.max(h,p)||1,m={x:f*(s/g),y:d*(s/g)},b={x:m.x+f*o,y:m.y+d*o},x=Math.min(a,s-u),S=-s+u+x,$=s-u-x,v={x:-s,y:-s},k={x:s,y:-s},P={x:s,y:s},T={x:-s,y:s},w;if(h>=p&&f>0){let B=Math.max(S,Math.min($,m.y)),E={x:s,y:B-u},C={x:s,y:B+u};w=[v,k,E,b,C,P,T]}else if(h>=p&&f<=0){let B=Math.max(S,Math.min($,m.y)),E={x:-s,y:B+u},C={x:-s,y:B-u};w=[v,k,P,T,E,b,C]}else if(d<0){let B=Math.max(S,Math.min($,m.x)),E={x:B-u,y:-s},C={x:B+u,y:-s};w=[v,E,b,C,k,P,T]}else{let B=Math.max(S,Math.min($,m.x)),E={x:B+u,y:s},C={x:B-u,y:s};w=[v,k,P,E,b,C,T]}if(i===0)return w;let R=Math.cos(i*Math.PI/180),F=Math.sin(i*Math.PI/180);return w.map(B=>({x:B.x*R-B.y*F,y:B.x*F+B.y*R}))}function Wr(t,e,r,n,i=0){let s=Math.max(2,Math.round(e)),o=t*(r/100),a=t*(n/100)/2,u=s+1,c=[];for(let m=0;m<u;m++){let b=m/(u-1),x=-t+b*2*t,S=0;m>0&&m<u-1&&(S=m%2===1?o:-o),c.push({x:S,y:x})}let f=[],d=[];for(let m=0;m<u;m++){if(m===0||m===u-1){f.push({...c[m]}),d.push({...c[m]});continue}let b=c[m-1],x=c[m],S=c[m+1],$=x.x-b.x,v=x.y-b.y,k=Math.hypot($,v)||1,P=$/k,T=v/k,w=S.x-x.x,R=S.y-x.y,F=Math.hypot(w,R)||1,B=w/F,E=R/F,C=(P+B)/2,L=(T+E)/2,G=Math.hypot(C,L),A,Y;G<1e-6?(A=-T,Y=P):(A=-L/G,Y=C/G),f.push({x:x.x-A*a,y:x.y-Y*a}),d.push({x:x.x+A*a,y:x.y+Y*a})}let h=[];h.push(f[0]);for(let m=1;m<u-1;m++)h.push(d[m]);h.push(f[u-1]);for(let m=u-2;m>=1;m--)h.push(f[m]);if(i===0)return h;let p=Math.cos(i*Math.PI/180),g=Math.sin(i*Math.PI/180);return h.map(m=>({x:m.x*p-m.y*g,y:m.x*g+m.y*p}))}function Hr(t,e,r,n=0){let i=t,s=Math.max(.3,Math.min(.9,e/100)),o=-i*(r/100),a={x:0,y:i},u={x:0,y:o},c={x:-i*s,y:i*.4},f={x:-i*s,y:-i},d={x:i*s,y:-i},h={x:i*s,y:i*.4},p=[a,c,f,u,d,h,a],g=n===0?p:(()=>{let k=Math.cos(n*Math.PI/180),P=Math.sin(n*Math.PI/180);return p.map(T=>({x:T.x*k-T.y*P,y:T.x*P+T.y*k}))})(),[m,b,x,S,$,v]=g;return`M ${m.x} ${m.y} C ${b.x} ${b.y} ${x.x} ${x.y} ${S.x} ${S.y} C ${$.x} ${$.y} ${v.x} ${v.y} ${m.x} ${m.y} Z`}function jr(t,e,r,n=0){let i=Math.max(3,Math.round(e)),s=Math.max(.3,Math.min(1,r/100)),o=t,a=o*1.7,u=o*1.15,c=[];for(let T=0;T<i;T++){let R=(90+T/i*360)*Math.PI/180;c.push({x:a/2*Math.cos(R),y:-(u/2)*Math.sin(R)})}let f=.15,d=0;for(let T=0;T<i;T++){let w=c[T],R=c[(T+1)%i];d=Math.max(d,Math.hypot(R.x-w.x,R.y-w.y))}let h=d/(2*(1-f))+.001,p=Math.max(h,d*(.68+s*.35)),g=c.map(T=>{let w=T.y/(u/2);return p*(1-f*w)});function m(T){let w=c[T],R=c[(T+1)%i],F=g[T],B=g[(T+1)%i],E=R.x-w.x,C=R.y-w.y,L=Math.hypot(E,C)||1,G=(F*F-B*B+L*L)/(2*L),A=Math.sqrt(Math.max(0,F*F-G*G)),Y=w.x+G/L*E,j=w.y+G/L*C,U=-C/L,re=E/L,V={x:Y+U*A,y:j+re*A},N={x:Y-U*A,y:j-re*A};return V.x*V.x+V.y*V.y>N.x*N.x+N.y*N.y?V:N}let b=[];for(let T=0;T<i;T++)b.push(m(T));let x=14,S=[];for(let T=0;T<i;T++){let w=c[T],R=g[T],F=b[(T-1+i)%i],B=b[T],E=Math.atan2(F.y-w.y,F.x-w.x),L=Math.atan2(B.y-w.y,B.x-w.x)-E;L<=0&&(L+=2*Math.PI);let G=2*Math.PI-L,A=E+L/2,Y=E-G/2,j={x:w.x+R*Math.cos(A),y:w.y+R*Math.sin(A)},U={x:w.x+R*Math.cos(Y),y:w.y+R*Math.sin(Y)},V=j.x*j.x+j.y*j.y>U.x*U.x+U.y*U.y?L:-G;for(let N=0;N<x;N++){let te=N/x,ne=E+te*V;S.push({x:w.x+R*Math.cos(ne),y:w.y+R*Math.sin(ne)})}}let $=0;for(let T of S){let w=Math.max(Math.abs(T.x),Math.abs(T.y));w>$&&($=w)}if($>0&&$!==o){let T=o/$;for(let w of S)w.x*=T,w.y*=T}let v=T=>{if(n===0)return T;let w=Math.cos(n*Math.PI/180),R=Math.sin(n*Math.PI/180);return{x:T.x*w-T.y*R,y:T.x*R+T.y*w}},k=S.map(v),P=`M ${k[0].x} ${k[0].y}`;for(let T=1;T<k.length;T++)P+=` L ${k[T].x} ${k[T].y}`;return P+=" Z",P}function he(t,e=0,r=0){if(t.length<3)return"";if(e<=0)return t.map((s,o)=>(o===0?"M":"L")+`${s.x},${s.y}`).join(" ")+" Z";let n=Math.min(e,r*.4),i="";for(let s=0;s<t.length;s++){let o=t[(s-1+t.length)%t.length],a=t[s],u=t[(s+1)%t.length],c={x:o.x-a.x,y:o.y-a.y},f=Math.hypot(c.x,c.y);c.x/=f,c.y/=f;let d={x:u.x-a.x,y:u.y-a.y},h=Math.hypot(d.x,d.y);d.x/=h,d.y/=h;let p=Math.min(n,f/2),g=Math.min(n,h/2),m={x:a.x+c.x*p,y:a.y+c.y*p},b={x:a.x+d.x*g,y:a.y+d.y*g};i+=s===0?`M${m.x},${m.y}`:` L${m.x},${m.y}`,i+=` Q${a.x},${a.y} ${b.x},${b.y}`}return i+" Z"}function Xr(t,e,r="evenodd"){let n=t*(e/100),i=r==="nonzero"?1:0;return`M ${t} 0 A ${t} ${t} 0 1 1 ${-t} 0 A ${t} ${t} 0 1 1 ${t} 0 Z M ${n} 0 A ${n} ${n} 0 1 ${i} ${-n} 0 A ${n} ${n} 0 1 ${i} ${n} 0 Z`}function Kr(t,e,r,n=1,i=0){let s=t*(r/100),a=Math.round(e*36),u=e*2*Math.PI,c=(t-s/2)/u,f=i*Math.PI/180,d=[],h=[];for(let m=0;m<=a;m++){let b=m/a,x=b*u*n+f,S=c*(b*u)+s/2,$=s/2;d.push({x:(S+$*.3)*Math.cos(x),y:(S+$*.3)*Math.sin(x)}),h.push({x:Math.max(0,S-$*.3)*Math.cos(x),y:Math.max(0,S-$*.3)*Math.sin(x)})}let p=`M ${d[0].x} ${d[0].y}`;for(let m=1;m<d.length;m++)p+=` L ${d[m].x} ${d[m].y}`;let g=h[h.length-1];p+=` L ${g.x} ${g.y}`;for(let m=h.length-2;m>=0;m--)p+=` L ${h[m].x} ${h[m].y}`;return p+=" Z",p}var bu=.2;function Ui(t,e,r,n=0){let i=e*(r/100),s=e,o=e-i,a=2*Math.PI/t,u=a*bu/2,c=a/4,f=n*Math.PI/180,d=[];for(let h=0;h<t;h++){let p=f+h*a;d.push({x:o*Math.cos(p),y:o*Math.sin(p)}),d.push({x:s*Math.cos(p+c-u),y:s*Math.sin(p+c-u)}),d.push({x:s*Math.cos(p+c+u),y:s*Math.sin(p+c+u)}),d.push({x:o*Math.cos(p+a/2),y:o*Math.sin(p+a/2)})}return d}function Yr(t,e,r,n=0,i=0,s="evenodd",o=0){let a=Ui(t,e,r,o),u=Math.min(n,e*.1),c=he(a,u,e);if(i>0){let f=e*(i/100),d=s==="nonzero"?1:0;c+=` M ${f} 0 A ${f} ${f} 0 1 ${d} ${-f} 0 A ${f} ${f} 0 1 ${d} ${f} 0 Z`}return c}function qr(t,e,r,n,i,s="round",o="uniform",a){let u=Math.min(r,n)/2,c,f,d,h,p,g,m,b;if(o==="non-uniform"&&a?(c=Math.min(a.radiusTL??i,u),f=Math.min(a.radiusTR??i,u),d=Math.min(a.radiusBR??i,u),h=Math.min(a.radiusBL??i,u),p=a.shapeTL??s,g=a.shapeTR??s,m=a.shapeBR??s,b=a.shapeBL??s):(c=f=d=h=Math.min(i,u),p=g=m=b=s),!(s!=="round"||o==="non-uniform"||c>0&&p!=="round"||f>0&&g!=="round"||d>0&&m!=="round"||h>0&&b!=="round")&&c===f&&f===d&&d===h)return null;let S=`M${t+c},${e}`;return S+=` L${t+r-f},${e}`,S+=Or(g,f,t+r,e,"tr"),S+=` L${t+r},${e+n-d}`,S+=Or(m,d,t+r,e+n,"br"),S+=` L${t+h},${e+n}`,S+=Or(b,h,t,e+n,"bl"),S+=` L${t},${e+c}`,S+=Or(p,c,t,e,"tl"),S+=" Z",S}function Or(t,e,r,n,i){if(e<=0)return"";switch(t){case"round":switch(i){case"tr":return` A${e},${e} 0 0 1 ${r},${n+e}`;case"br":return` A${e},${e} 0 0 1 ${r-e},${n}`;case"bl":return` A${e},${e} 0 0 1 ${r},${n-e}`;case"tl":return` A${e},${e} 0 0 1 ${r+e},${n}`}break;case"scoop":switch(i){case"tr":return` A${e},${e} 0 0 0 ${r},${n+e}`;case"br":return` A${e},${e} 0 0 0 ${r-e},${n}`;case"bl":return` A${e},${e} 0 0 0 ${r},${n-e}`;case"tl":return` A${e},${e} 0 0 0 ${r+e},${n}`}break;case"bevel":switch(i){case"tr":return` L${r},${n+e}`;case"br":return` L${r-e},${n}`;case"bl":return` L${r},${n-e}`;case"tl":return` L${r+e},${n}`}break;case"notch":switch(i){case"tr":return` L${r-e},${n+e} L${r},${n+e}`;case"br":return` L${r-e},${n-e} L${r-e},${n}`;case"bl":return` L${r+e},${n-e} L${r},${n-e}`;case"tl":return` L${r+e},${n+e} L${r+e},${n}`}break}return""}function Zr(t,e,r,n,i,s={}){let o=e+n/2,a=r+i/2;switch(t){case"diamond":return`M${o},${r} L${e+n},${a} L${o},${r+i} L${e},${a} Z`;case"parallelogram":{let u=(s.slantPercent??20)/100*n;return`M${e+u},${r} L${e+n},${r} L${e+n-u},${r+i} L${e},${r+i} Z`}case"trapezoid":{let u=(s.topWidthPercent??70)/100*n,c=(n-u)/2;return`M${e+c},${r} L${e+c+u},${r} L${e+n},${r+i} L${e},${r+i} Z`}case"terminator":{let u=i/2;return`M${e+u},${r} L${e+n-u},${r} A${u},${u} 0 0 1 ${e+n-u},${r+i} L${e+u},${r+i} A${u},${u} 0 0 1 ${e+u},${r} Z`}case"cylinder":{let u=n/2,c=Math.min((s.capHeightPercent??15)/100*i,i/2);return`M${e},${r+c} A${u},${c} 0 0 1 ${e+n},${r+c} A${u},${c} 0 0 1 ${e},${r+c} L${e},${r+i-c} A${u},${c} 0 0 0 ${e+n},${r+i-c} L${e+n},${r+c} M${o-u},${r+c} A${u},${c} 0 0 0 ${o+u},${r+c}`}case"document-shape":{let u=(s.waveAmplitudePercent??15)/100*i;return`M${e},${r} L${e+n},${r} L${e+n},${r+i} C${e+n*.75},${r+i-u*2} ${o+n*.25},${r+i+u} ${o},${r+i} C${o-n*.25},${r+i-u} ${e+n*.25},${r+i+u*.5} ${e},${r+i} Z`}}}function Fe(t,e,r=!1,n=.5,i){if(t.length<2)return t.length===1?`M ${t[0].x} ${t[0].y}`:"";switch(e){case"CATMULL_ROM":case"catmull-rom":return vu(t,r,n);case"BASIS":case"basis":return Tu(t,r);case"ARC":case"arc":return i&&i.length>0?xu(t,r,i):zt(t,r,"CUBIC");case"LINEAR":case"linear":return zt(t,r,"LINEAR");case"QUADRATIC":case"quadratic":return zt(t,r,"QUADRATIC");case"CUBIC":case"cubic":return zt(t,r,"CUBIC");default:return zt(t,r)}}function xu(t,e,r){let n=`M ${t[0].x} ${t[0].y}`,i=0,s={rx:50,ry:50,rotation:0,largeArc:!1,sweep:!0};for(let o=0;o<t.length-1;o++){let a=t[o+1];if(a.isSubpathStart){if(e&&o-i>=1){let c=t[i],f=r?.[o]??s;n+=` A ${f.rx} ${f.ry} ${f.rotation} ${f.largeArc?1:0} ${f.sweep?1:0} ${c.x} ${c.y} Z`}n+=` M ${a.x} ${a.y}`,i=o+1;continue}let u=r?.[o]??s;n+=` A ${u.rx} ${u.ry} ${u.rotation} ${u.largeArc?1:0} ${u.sweep?1:0} ${a.x} ${a.y}`}if(e&&t.length-i>1){let o=t[i],a=r?.[t.length-1]??s;n+=` A ${a.rx} ${a.ry} ${a.rotation} ${a.largeArc?1:0} ${a.sweep?1:0} ${o.x} ${o.y} Z`}return n}function zt(t,e,r){let n=`M ${t[0].x} ${t[0].y}`,i=0,s=null,o=null;for(let a=0;a<t.length-1;a++){let u=t[a],c=t[a+1];if(c.isSubpathStart){if(e&&a-i>=1){let d=t[i];n+=Gi(u,d,d.segmentType,s,o,r),n+=" Z"}n+=` M ${c.x} ${c.y}`,i=a+1,s=null,o=null;continue}n+=Gi(u,c,c.segmentType,s,o,r);let f=$u(c.segmentType??r,u,c);s=f,f==="quad"?o=u.handleOut??null:o=null}if(e&&t.length-i>1){let a=t[t.length-1],u=t[i],c=(u.segmentType??r??(a.handleOut||u.handleIn?"CUBIC":"LINEAR")).toUpperCase();c==="LINEAR"||c==="HORIZONTAL"||c==="VERTICAL"||(n+=Gi(a,u,u.segmentType,s,o,r)),n+=" Z"}return n}var Su=.001;function ot(t,e){return Math.abs(t-e)<Su}function $u(t,e,r){let n=(t??(e.handleOut||r.handleIn?"CUBIC":"LINEAR")).toUpperCase();return n==="CUBIC"||n==="SMOOTH_CUBIC"?"cubic":n==="QUADRATIC"||n==="SMOOTH_QUADRATIC"?"quad":null}function Gi(t,e,r,n,i,s){let o=(r??s??(t.handleOut||e.handleIn?"CUBIC":"LINEAR")).toUpperCase();if(o==="LINEAR"||o==="HORIZONTAL"||o==="VERTICAL")return(o==="HORIZONTAL"||o==="LINEAR")&&ot(t.y,e.y)?` H ${e.x}`:(o==="VERTICAL"||o==="LINEAR")&&ot(t.x,e.x)?` V ${e.y}`:` L ${e.x} ${e.y}`;if(o==="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(o==="QUADRATIC"||o==="SMOOTH_QUADRATIC"){let c=t.handleOut??{x:(t.x+e.x)/2,y:(t.y+e.y)/2};return n==="quad"&&i&&ot(c.x,2*t.x-i.x)&&ot(c.y,2*t.y-i.y)?` T ${e.x} ${e.y}`:` Q ${c.x} ${c.y} ${e.x} ${e.y}`}let a=t.handleOut??{x:t.x,y:t.y},u=e.handleIn??{x:e.x,y:e.y};return n==="cubic"&&t.handleIn&&t.handleOut&&ot(t.handleOut.x,2*t.x-t.handleIn.x)&&ot(t.handleOut.y,2*t.y-t.handleIn.y)?` S ${u.x} ${u.y} ${e.x} ${e.y}`:` C ${a.x} ${a.y} ${u.x} ${u.y} ${e.x} ${e.y}`}function vu(t,e,r){if(t.length<2)return t.length===1?`M ${t[0].x} ${t[0].y}`:"";let n=r,i=e?[t[t.length-1],...t,t[0],t[1]]:[t[0],...t,t[t.length-1]],s=`M ${t[0].x} ${t[0].y}`,o=e?t.length:t.length-1;for(let a=0;a<o;a++){let u=i[a],c=i[a+1],f=i[a+2],d=i[a+3],h=Math.hypot(f.x-c.x,f.y-c.y),p=Math.hypot(c.x-u.x,c.y-u.y),g=Math.hypot(d.x-f.x,d.y-f.y),m=Math.pow(p,n),b=Math.pow(h,n),x=Math.pow(g,n),S=Math.pow(p,2*n),$=Math.pow(h,2*n),v=Math.pow(g,2*n),k,P,T,w;p<1e-8?(k=c.x,P=c.y):(k=(S*f.x-$*u.x+(2*S+3*m*b+$)*c.x)/(3*m*(m+b)),P=(S*f.y-$*u.y+(2*S+3*m*b+$)*c.y)/(3*m*(m+b))),g<1e-8?(T=f.x,w=f.y):(T=(v*c.x-$*d.x+(2*v+3*x*b+$)*f.x)/(3*x*(x+b)),w=(v*c.y-$*d.y+(2*v+3*x*b+$)*f.y)/(3*x*(x+b))),s+=` C ${k} ${P} ${T} ${w} ${f.x} ${f.y}`}return e&&(s+=" Z"),s}function Tu(t,e){let r=t.length;if(r<2)return r===1?`M ${t[0].x} ${t[0].y}`:"";if(r===2)return`M ${t[0].x} ${t[0].y} L ${t[1].x} ${t[1].y}`;if(e){let s=(t[0].x+4*t[1].x+t[2].x)/6,o=(t[0].y+4*t[1].y+t[2].y)/6,a=`M ${s} ${o}`;for(let u=0;u<r;u++){let c=t[(u+1)%r],f=t[(u+2)%r],d=t[(u+3)%r];a+=Vi(c,f,d)}return a+=" Z",a}let n=t,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 s=0;s<=r-3;s++)i+=Vi(n[s],n[s+1],n[s+2]);return i+=Vi(n[r-2],n[r-1],n[r-1]),i+=` L ${n[r-1].x} ${n[r-1].y}`,i}function Vi(t,e,r){return` C ${(2*t.x+e.x)/3} ${(2*t.y+e.y)/3} ${(t.x+2*e.x)/3} ${(t.y+2*e.y)/3} ${(t.x+4*e.x+r.x)/6} ${(t.y+4*e.y+r.y)/6}`}function lt(t,e,r){let n=Number.isFinite(e)?Math.max(1,e):8,i=Number.isFinite(r)?Math.max(1,r):4;switch(t){case"dashed":case"dotted":case"custom":return`${n} ${i}`;default:return null}}var ku=[["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 W(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function wu(t){let e=t.fillType;return e||(t.fillGradient?t.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":t.linearGradient?"linear-gradient":t.radialGradient?"radial-gradient":"solid")}function Qr(t){let e=new Map,r=t.state,n=r;switch(t.type){case"circle":e.set("cx",String(r.x??0)),e.set("cy",String(r.y??0)),e.set("r",String(r.radius??50));break;case"ellipse":e.set("cx",String(r.cx??0)),e.set("cy",String(r.cy??0)),e.set("rx",String(r.rx??50)),e.set("ry",String(r.ry??30));break;case"rectangle":case"square":e.set("x",String(r.x??0)),e.set("y",String(r.y??0)),e.set("width",String(r.width??100)),e.set("height",String(r.height??100));{let v=r.rx??r.cornerRadius??0,k=r.ry??r.cornerRadius??0;(v>0||k>0)&&(e.set("rx",String(v)),e.set("ry",String(k)))}break;case"line":e.set("x1",String(r.x1??0)),e.set("y1",String(r.y1??0)),e.set("x2",String(r.x2??0)),e.set("y2",String(r.y2??0));break;case"text":e.set("x",String(r.x??0)),e.set("y",String(r.y??0)),r.fontSize&&e.set("font-size",String(r.fontSize)),r.fontFamily&&e.set("font-family",r.fontFamily),r.fontWeight&&e.set("font-weight",r.fontWeight),r.fontStyle&&e.set("font-style",r.fontStyle),r.textAnchor&&e.set("text-anchor",r.textAnchor),r.letterSpacing&&e.set("letter-spacing",String(r.letterSpacing));{let v=ku.map(([k,P])=>{let T=typeof r[k]=="string"?String(r[k]).trim():"";return T?`${P}: ${T}`:""}).filter(Boolean).join("; ");v&&e.set("style",v)}break;case"image":e.set("x",String(r.x??0)),e.set("y",String(r.y??0)),e.set("width",String(r.width??100)),e.set("height",String(r.height??100)),n.href&&e.set("href",String(n.href));break}let i=wu(n);i==="none"?e.set("fill","none"):i==="linear-gradient"||i==="radial-gradient"?e.set("fill",`url(#gradient-fill-${t.id})`):i==="pattern"?e.set("fill",`url(#pattern-fill-${t.id})`):e.set("fill",r.fillColor??"#000000");let s=r.opacity;s!==void 0&&s<1&&e.set("opacity",String(s));let o=r.fillOpacity;o!==void 0&&o<1&&e.set("fill-opacity",String(o)),r.fillRule&&r.fillRule!=="nonzero"&&e.set("fill-rule",r.fillRule);let a=n.strokeType??"solid";if(a==="none")e.set("stroke","none");else if(a==="linear-gradient"||a==="radial-gradient")e.set("stroke",`url(#gradient-stroke-${t.id})`);else{let v=r.borderColor??"none";v!=="none"&&e.set("stroke",v)}let u=r.borderWidth;u!=null&&u!==0&&e.set("stroke-width",String(u));let c=r.strokeOpacity;c!==void 0&&c<1&&e.set("stroke-opacity",String(c));let f=r.lineStyle??"solid",d=r.dashLength??8,h=r.gapLength??4,p=lt(f,d,h);p&&(e.set("stroke-dasharray",p),f==="dotted"&&e.set("stroke-linecap","round"));let g=Pu(n);g&&e.set("transform",g);let m=n.filters;m&&m.length>0&&e.set("filter",`url(#filter-${t.id})`);let b=r.shapeRendering;b&&b!=="auto"&&e.set("shape-rendering",b),r.pathLength!==void 0&&e.set("pathLength",String(r.pathLength));let x=n.startEndpoint,S=n.endEndpoint;x&&x!=="none"&&e.set("marker-start",`url(#line-marker-${x})`),S&&S!=="none"&&e.set("marker-end",`url(#line-marker-${S})`);let $=n.metadata;return $&&($.role&&e.set("role",$.role),$.ariaLabel&&e.set("aria-label",$.ariaLabel)),e}function Da(t){switch(t.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 Pu(t){return at(t)}function be(t,e){let r=t.viewboxes?.[0];return{width:e.width??r?.width??800,height:e.height??r?.height??600}}function l(t,e){return e==null||e===""?"":` ${t}="${W(String(e))}"`}function en(t){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);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 _u(t,e,r){let{offsetX:n,offsetY:i,blurRadius:s,spread:o,color:a,opacity:u}=t,c="";if(o===0)c+=`<feDropShadow${l("in",e)}${l("dx",n)}${l("dy",i)}${l("stdDeviation",s/2)}${l("flood-color",a)}${l("flood-opacity",u)}${l("result",`${r}_shadow`)}/>`,c+=`<feMerge${l("result",r)}><feMergeNode${l("in",`${r}_shadow`)}/><feMergeNode${l("in",e)}/></feMerge>`;else{c+=`<feColorMatrix${l("in",e)}${l("type","matrix")}${l("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${l("result",`${r}_alpha`)}/>`;let f=o>0?"dilate":"erode",d=Math.abs(o);c+=`<feMorphology${l("in",`${r}_alpha`)}${l("operator",f)}${l("radius",d)}${l("result",`${r}_spread`)}/>`,c+=`<feGaussianBlur${l("in",`${r}_spread`)}${l("stdDeviation",s/2)}${l("result",`${r}_blur`)}/>`,c+=`<feOffset${l("in",`${r}_blur`)}${l("dx",n)}${l("dy",i)}${l("result",`${r}_offset`)}/>`,c+=`<feFlood${l("flood-color",a)}${l("flood-opacity",u)}${l("result",`${r}_color`)}/>`,c+=`<feComposite${l("in",`${r}_color`)}${l("in2",`${r}_offset`)}${l("operator","in")}${l("result",`${r}_shadow`)}/>`,c+=`<feMerge${l("result",r)}><feMergeNode${l("in",`${r}_shadow`)}/><feMergeNode${l("in",e)}/></feMerge>`}return c}function Ru(t,e,r){let{offsetX:n,offsetY:i,blurRadius:s,choke:o,color:a,opacity:u}=t,c=s*(1-o/100),f="";return f+=`<feColorMatrix${l("in",e)}${l("type","matrix")}${l("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${l("result",`${r}_alpha`)}/>`,f+=`<feComponentTransfer${l("in",`${r}_alpha`)}${l("result",`${r}_inverted`)}><feFuncA${l("type","table")}${l("tableValues","1 0")}/></feComponentTransfer>`,f+=`<feGaussianBlur${l("in",`${r}_inverted`)}${l("stdDeviation",c/2)}${l("result",`${r}_blur`)}/>`,f+=`<feOffset${l("in",`${r}_blur`)}${l("dx",n)}${l("dy",i)}${l("result",`${r}_offset`)}/>`,f+=`<feFlood${l("flood-color",a)}${l("flood-opacity",u)}${l("result",`${r}_color`)}/>`,f+=`<feComposite${l("in",`${r}_color`)}${l("in2",`${r}_offset`)}${l("operator","in")}${l("result",`${r}_coloredShadow`)}/>`,f+=`<feComposite${l("in",`${r}_coloredShadow`)}${l("in2",`${r}_alpha`)}${l("operator","in")}${l("result",`${r}_innerShadow`)}/>`,f+=`<feComposite${l("in",`${r}_innerShadow`)}${l("in2",e)}${l("operator","over")}${l("result",r)}/>`,f}function Au(t,e,r){let{blurX:n,blurY:i}=t;return n===0&&i===0?O(e,r):`<feGaussianBlur${l("in",e)}${l("stdDeviation",`${n/2} ${i/2}`)}${l("result",r)}/>`}function Mu(t,e,r){let{distance:n,angle:i}=t;if(n===0)return O(e,r);let s=i*Math.PI/180,o=Math.abs(Math.cos(s)*n),a=Math.abs(Math.sin(s)*n);return`<feGaussianBlur${l("in",e)}${l("stdDeviation",`${o/2} ${a/2}`)}${l("result",r)}/>`}function Fa(t,e,r){let{x:n,y:i,z:s,color:o,surfaceScale:a,diffuseConstant:u,specularConstant:c,specularExponent:f}=t,d="";return d+=`<feDiffuseLighting${l("in","SourceAlpha")}${l("surfaceScale",a)}${l("diffuseConstant",u)}${l("lighting-color",o)}${l("result",`${r}_diffuse`)}>`,d+=`<fePointLight${l("x",n)}${l("y",i)}${l("z",s)}/>`,d+="</feDiffuseLighting>",d+=`<feSpecularLighting${l("in","SourceAlpha")}${l("surfaceScale",a)}${l("specularConstant",c)}${l("specularExponent",f)}${l("lighting-color",o)}${l("result",`${r}_specular`)}>`,d+=`<fePointLight${l("x",n)}${l("y",i)}${l("z",s)}/>`,d+="</feSpecularLighting>",d+=`<feComposite${l("in",e)}${l("in2",`${r}_diffuse`)}${l("operator","arithmetic")}${l("k1",1)}${l("k2",0)}${l("k3",0)}${l("k4",0)}${l("result",`${r}_lit`)}/>`,d+=`<feComposite${l("in",`${r}_specular`)}${l("in2",`${r}_lit`)}${l("operator","arithmetic")}${l("k1",0)}${l("k2",1)}${l("k3",1)}${l("k4",0)}${l("result",r)}/>`,d}function Ea(t,e,r){let{x:n,y:i,z:s,pointsAtX:o,pointsAtY:a,pointsAtZ:u,coneAngle:c,color:f,surfaceScale:d,specularConstant:h,specularExponent:p}=t,g="";return g+=`<feSpecularLighting${l("in","SourceAlpha")}${l("surfaceScale",d)}${l("specularConstant",h)}${l("specularExponent",p)}${l("lighting-color",f)}${l("result",`${r}_specular`)}>`,g+=`<feSpotLight${l("x",n)}${l("y",i)}${l("z",s)}${l("pointsAtX",o)}${l("pointsAtY",a)}${l("pointsAtZ",u)}${l("limitingConeAngle",c)}/>`,g+="</feSpecularLighting>",g+=`<feComposite${l("in",`${r}_specular`)}${l("in2","SourceAlpha")}${l("operator","in")}${l("result",`${r}_clipped`)}/>`,g+=`<feComposite${l("in",`${r}_clipped`)}${l("in2",e)}${l("operator","arithmetic")}${l("k1",0)}${l("k2",1)}${l("k3",1)}${l("k4",0)}${l("result",r)}/>`,g}function La(t){switch(t.kind){case"point":return`<fePointLight${l("x",t.x)}${l("y",t.y)}${l("z",t.z)}/>`;case"spot":{let e=`<feSpotLight${l("x",t.x)}${l("y",t.y)}${l("z",t.z)}${l("pointsAtX",t.pointsAtX)}${l("pointsAtY",t.pointsAtY)}${l("pointsAtZ",t.pointsAtZ)}`;return t.limitingConeAngle!==void 0&&(e+=l("limitingConeAngle",t.limitingConeAngle)),t.specularExponent!==void 0&&(e+=l("specularExponent",t.specularExponent)),e+"/>"}case"distant":return`<feDistantLight${l("azimuth",t.azimuth)}${l("elevation",t.elevation)}/>`}}function Cu(t,e,r){return`<feDiffuseLighting${l("in",e)}${l("surfaceScale",t.surfaceScale)}${l("diffuseConstant",t.diffuseConstant)}${l("lighting-color",t.color)}${l("result",r)}>`+La(t.lightSource)+"</feDiffuseLighting>"}function Iu(t,e,r){return`<feSpecularLighting${l("in",e)}${l("surfaceScale",t.surfaceScale)}${l("specularConstant",t.specularConstant)}${l("specularExponent",t.specularExponent)}${l("lighting-color",t.color)}${l("result",r)}>`+La(t.lightSource)+"</feSpecularLighting>"}function Du(t,e,r){let{width:n,color:i,opacity:s,position:o}=t,a="";if(o==="inside")a+=`<feMorphology${l("in","SourceAlpha")}${l("operator","erode")}${l("radius",n)}${l("result",`${r}_eroded`)}/>`,a+=`<feComposite${l("in","SourceAlpha")}${l("in2",`${r}_eroded`)}${l("operator","out")}${l("result",`${r}_outlineAlpha`)}/>`,a+=`<feFlood${l("flood-color",i)}${l("flood-opacity",s)}${l("result",`${r}_color`)}/>`,a+=`<feComposite${l("in",`${r}_color`)}${l("in2",`${r}_outlineAlpha`)}${l("operator","in")}${l("result",`${r}_outline`)}/>`,a+=`<feComposite${l("in",`${r}_outline`)}${l("in2",e)}${l("operator","over")}${l("result",r)}/>`;else{let u=o==="outside"?n:n/2;a+=`<feMorphology${l("in","SourceAlpha")}${l("operator","dilate")}${l("radius",u)}${l("result",`${r}_dilated`)}/>`,a+=`<feComposite${l("in",`${r}_dilated`)}${l("in2","SourceAlpha")}${l("operator","out")}${l("result",`${r}_outlineAlpha`)}/>`,a+=`<feFlood${l("flood-color",i)}${l("flood-opacity",s)}${l("result",`${r}_color`)}/>`,a+=`<feComposite${l("in",`${r}_color`)}${l("in2",`${r}_outlineAlpha`)}${l("operator","in")}${l("result",`${r}_outline`)}/>`,a+=`<feMerge${l("result",r)}><feMergeNode${l("in",`${r}_outline`)}/><feMergeNode${l("in",e)}/></feMerge>`}return a}function Fu(t,e,r){let{amount:n}=t;if(n===0)return O(e,r);let i=1+4*n,s=-n,o=[0,s,0,s,i,s,0,s,0].join(" ");return`<feConvolveMatrix${l("in",e)}${l("order","3")}${l("kernelMatrix",o)}${l("divisor","1")}${l("bias","0")}${l("preserveAlpha","true")}${l("edgeMode","duplicate")}${l("result",r)}/>`}function Eu(t,e,r){let{blockSize:n}=t;if(n<=1)return O(e,r);let i=n/2,s="";return s+=`<feMorphology${l("in",e)}${l("operator","erode")}${l("radius",i)}${l("result",`${r}_eroded`)}/>`,s+=`<feMorphology${l("in",`${r}_eroded`)}${l("operator","dilate")}${l("radius",i)}${l("result",r)}/>`,s}function Lu(t,e,r){let{scale:n,frequency:i,octaves:s,warpType:o}=t;if(n===0)return O(e,r);let a="";return a+=`<feTurbulence${l("type",o)}${l("baseFrequency",i)}${l("numOctaves",s)}${l("seed",0)}${l("result",`${r}_turbulence`)}/>`,a+=`<feDisplacementMap${l("in",e)}${l("in2",`${r}_turbulence`)}${l("scale",n)}${l("xChannelSelector","R")}${l("yChannelSelector","G")}${l("result",r)}/>`,a}function Bu(t,e,r){let{operator:n,radiusX:i,radiusY:s}=t;return i===0&&s===0?O(e,r):`<feMorphology${l("in",e)}${l("operator",n)}${l("radius",`${i} ${s}`)}${l("result",r)}/>`}function Nu(t,e,r){let{levels:n}=t;if(n<2)return O(e,r);let i=[];for(let a=0;a<n;a++)i.push(a/(n-1));let s=i.join(" "),o=`<feComponentTransfer${l("in",e)}${l("result",r)}>`;return o+=`<feFuncR${l("type","discrete")}${l("tableValues",s)}/>`,o+=`<feFuncG${l("type","discrete")}${l("tableValues",s)}/>`,o+=`<feFuncB${l("type","discrete")}${l("tableValues",s)}/>`,o+="</feComponentTransfer>",o}function Ou(t,e,r){let{levels:n,contrast:i}=t;if(n<2)return O(e,r);let s=[];for(let u=0;u<n;u++){let c=u/(n-1),f=c;i!==1&&(f=.5+(c-.5)*i,f=Math.max(0,Math.min(1,f))),s.push(f)}let o=s.join(" "),a=`<feComponentTransfer${l("in",e)}${l("result",r)}>`;return a+=`<feFuncR${l("type","table")}${l("tableValues",o)}/>`,a+=`<feFuncG${l("type","table")}${l("tableValues",o)}/>`,a+=`<feFuncB${l("type","table")}${l("tableValues",o)}/>`,a+="</feComponentTransfer>",a}function zu(t,e,r){let{radius:n}=t;if(n===0)return O(e,r);let i="";return i+=`<feGaussianBlur${l("in","SourceAlpha")}${l("stdDeviation",n)}${l("result",`${r}_blurredAlpha`)}/>`,i+=`<feComponentTransfer${l("in",`${r}_blurredAlpha`)}${l("result",`${r}_thresholdAlpha`)}><feFuncA${l("type","linear")}${l("slope",20)}${l("intercept",-9)}/></feComponentTransfer>`,i+=`<feComposite${l("in",e)}${l("in2",`${r}_thresholdAlpha`)}${l("operator","in")}${l("result",r)}/>`,i}function Gu(t,e,r){let{amount:n}=t;if(n===0)return O(e,r);let i=1-n;return`<feColorMatrix${l("color-interpolation-filters","sRGB")}${l("in",e)}${l("type","saturate")}${l("values",i)}${l("result",r)}/>`}function Vu(t,e,r){let{red:n,green:i,blue:s}=t;if(n===1&&i===1&&s===1)return O(e,r);let o=`<feComponentTransfer${l("in",e)}${l("result",r)}>`;return o+=`<feFuncR${l("type","linear")}${l("slope",n)}${l("intercept",0)}/>`,o+=`<feFuncG${l("type","linear")}${l("slope",i)}${l("intercept",0)}/>`,o+=`<feFuncB${l("type","linear")}${l("slope",s)}${l("intercept",0)}/>`,o+="</feComponentTransfer>",o}function Uu(t,e,r){let{amount:n}=t;if(n===1)return O(e,r);let i=`<feComponentTransfer${l("color-interpolation-filters","sRGB")}${l("in",e)}${l("result",r)}>`;return i+=`<feFuncR${l("type","linear")}${l("slope",n)}${l("intercept",0)}/>`,i+=`<feFuncG${l("type","linear")}${l("slope",n)}${l("intercept",0)}/>`,i+=`<feFuncB${l("type","linear")}${l("slope",n)}${l("intercept",0)}/>`,i+="</feComponentTransfer>",i}function Wu(t,e,r){let{amount:n}=t;if(n===1)return O(e,r);let i=.5*(1-n),s=`<feComponentTransfer${l("color-interpolation-filters","sRGB")}${l("in",e)}${l("result",r)}>`;return s+=`<feFuncR${l("type","linear")}${l("slope",n)}${l("intercept",i)}/>`,s+=`<feFuncG${l("type","linear")}${l("slope",n)}${l("intercept",i)}/>`,s+=`<feFuncB${l("type","linear")}${l("slope",n)}${l("intercept",i)}/>`,s+="</feComponentTransfer>",s}function Hu(t,e,r){let{amount:n}=t;if(n===1)return O(e,r);let i=`<feComponentTransfer${l("color-interpolation-filters","sRGB")}${l("in",e)}${l("result",r)}>`;return i+=`<feFuncA${l("type","linear")}${l("slope",n)}${l("intercept",0)}/>`,i+="</feComponentTransfer>",i}function ju(t,e,r){let{amount:n}=t;if(n===0)return O(e,r);let i=n,s=1-n,o=`${i} ${s}`,a=`<feComponentTransfer${l("color-interpolation-filters","sRGB")}${l("in",e)}${l("result",r)}>`;return a+=`<feFuncR${l("type","table")}${l("tableValues",o)}/>`,a+=`<feFuncG${l("type","table")}${l("tableValues",o)}/>`,a+=`<feFuncB${l("type","table")}${l("tableValues",o)}/>`,a+="</feComponentTransfer>",a}function Xu(t,e,r){let{angle:n}=t;return n===0||n===360?O(e,r):`<feColorMatrix${l("color-interpolation-filters","sRGB")}${l("in",e)}${l("type","hueRotate")}${l("values",n)}${l("result",r)}/>`}function Ku(t,e,r){let{amount:n}=t;return n===1?O(e,r):`<feColorMatrix${l("color-interpolation-filters","sRGB")}${l("in",e)}${l("type","saturate")}${l("values",n)}${l("result",r)}/>`}function Yu(t,e,r){let{threshold:n}=t,i="";if(i+=`<feColorMatrix${l("in",e)}${l("type","saturate")}${l("values",0)}${l("result",`${r}_gray`)}/>`,n===.5)i+=`<feComponentTransfer${l("in",`${r}_gray`)}${l("result",r)}>`,i+=`<feFuncR${l("type","discrete")}${l("tableValues","0 1")}/>`,i+=`<feFuncG${l("type","discrete")}${l("tableValues","0 1")}/>`,i+=`<feFuncB${l("type","discrete")}${l("tableValues","0 1")}/>`,i+="</feComponentTransfer>";else{let o=[];for(let u=0;u<256;u++)o.push(u/255<n?0:1);let a=o.join(" ");i+=`<feComponentTransfer${l("in",`${r}_gray`)}${l("result",r)}>`,i+=`<feFuncR${l("type","table")}${l("tableValues",a)}/>`,i+=`<feFuncG${l("type","table")}${l("tableValues",a)}/>`,i+=`<feFuncB${l("type","table")}${l("tableValues",a)}/>`,i+="</feComponentTransfer>"}return i}function qu(t,e,r){let{amount:n}=t;if(n===0)return O(e,r);let i=[.393,.769,.189,0,0],s=[.349,.686,.168,0,0],o=[.272,.534,.131,0,0],a=[1,0,0,0,0],u=[0,1,0,0,0],c=[0,0,1,0,0],f=(m,b)=>m.map((x,S)=>x*(1-n)+b[S]*n),d=f(a,i),h=f(u,s),p=f(c,o),g=[...d,...h,...p,0,0,0,1,0].join(" ");return`<feColorMatrix${l("color-interpolation-filters","sRGB")}${l("in",e)}${l("type","matrix")}${l("values",g)}${l("result",r)}/>`}function Zu(t,e,r){let{shadowColor:n,highlightColor:i}=t,s=en(n),o=en(i),a="";return a+=`<feColorMatrix${l("in",e)}${l("type","saturate")}${l("values",0)}${l("result",`${r}_gray`)}/>`,a+=`<feComponentTransfer${l("in",`${r}_gray`)}${l("result",r)}>`,a+=`<feFuncR${l("type","table")}${l("tableValues",`${s.r} ${o.r}`)}/>`,a+=`<feFuncG${l("type","table")}${l("tableValues",`${s.g} ${o.g}`)}/>`,a+=`<feFuncB${l("type","table")}${l("tableValues",`${s.b} ${o.b}`)}/>`,a+="</feComponentTransfer>",a}function Qu(t,e,r){let{intensity:n}=t;if(n===0)return O(e,r);let i="";i+=`<feComponentTransfer${l("in",e)}${l("result",`${r}_invert`)}>`,i+=`<feFuncR${l("type","table")}${l("tableValues","1 0")}/>`,i+=`<feFuncG${l("type","table")}${l("tableValues","1 0")}/>`,i+=`<feFuncB${l("type","table")}${l("tableValues","1 0")}/>`,i+="</feComponentTransfer>",i+=`<feColorMatrix${l("in",`${r}_invert`)}${l("type","saturate")}${l("values",0)}${l("result",`${r}_gray`)}/>`;let s=[.1,.1,.1,0,0],o=[.3,.4,.3,0,0],a=[.5,.5,.8,0,0],u=[1,0,0,0,0],c=[0,1,0,0,0],f=[0,0,1,0,0],d=(b,x)=>b.map((S,$)=>S*(1-n)+x[$]*n),h=d(u,s),p=d(c,o),g=d(f,a),m=[...h,...p,...g,0,0,0,1,0].join(" ");return i+=`<feColorMatrix${l("in",`${r}_gray`)}${l("type","matrix")}${l("values",m)}${l("result",r)}/>`,i}function Ju(t,e,r){let{amount:n,scale:i}=t;if(n===0)return O(e,r);let s=1/i,o="";return o+=`<feTurbulence${l("type","fractalNoise")}${l("baseFrequency",s)}${l("numOctaves",3)}${l("seed",0)}${l("result",`${r}_noise`)}/>`,o+=`<feColorMatrix${l("in",`${r}_noise`)}${l("type","saturate")}${l("values",0)}${l("result",`${r}_noiseGray`)}/>`,o+=`<feBlend${l("in",e)}${l("in2",`${r}_noiseGray`)}${l("mode","overlay")}${l("result",`${r}_blended`)}/>`,o+=`<feComposite${l("in",`${r}_blended`)}${l("in2",e)}${l("operator","arithmetic")}${l("k1",0)}${l("k2",n)}${l("k3",1-n)}${l("k4",0)}${l("result",`${r}_amt`)}/>`,o+=`<feComposite${l("in",`${r}_amt`)}${l("in2",e)}${l("operator","in")}${l("result",r)}/>`,o}function ec(t,e,r){let{strength:n,angle:i}=t;if(n===0)return O(e,r);let s=i*Math.PI/180,o=Math.cos(s),a=Math.sin(s),u=n,c=[-(u*(o+a)),-(u*a),u*(-o+a),-(u*o),1,u*o,u*(o-a),u*a,u*(o+a)].join(" ");return`<feConvolveMatrix${l("in",e)}${l("order","3 3")}${l("kernelMatrix",c)}${l("divisor",1)}${l("bias",.5)}${l("preserveAlpha","true")}${l("result",r)}/>`}function tc(t,e,r){let{amount:n,size:i}=t;if(n===0)return O(e,r);let s=.5/i,o="";return o+=`<feTurbulence${l("type","fractalNoise")}${l("baseFrequency",`${s} ${s}`)}${l("numOctaves",5)}${l("seed",0)}${l("stitchTiles","stitch")}${l("result",`${r}_grain`)}/>`,o+=`<feColorMatrix${l("in",`${r}_grain`)}${l("type","saturate")}${l("values",0)}${l("result",`${r}_grainGray`)}/>`,o+=`<feBlend${l("in",e)}${l("in2",`${r}_grainGray`)}${l("mode","soft-light")}${l("result",`${r}_blended`)}/>`,o+=`<feComposite${l("in",`${r}_blended`)}${l("in2",e)}${l("operator","arithmetic")}${l("k1",0)}${l("k2",n)}${l("k3",1-n)}${l("k4",0)}${l("result",`${r}_amt`)}/>`,o+=`<feComposite${l("in",`${r}_amt`)}${l("in2",e)}${l("operator","in")}${l("result",r)}/>`,o}function rc(t,e,r){let{wetness:n,turbulence:i}=t;if(n===0&&i===0)return O(e,r);let s="";return s+=`<feTurbulence${l("type","fractalNoise")}${l("baseFrequency",.02+i*.03)}${l("numOctaves",4)}${l("seed",42)}${l("result",`${r}_turb`)}/>`,s+=`<feDisplacementMap${l("in",e)}${l("in2",`${r}_turb`)}${l("scale",n*15)}${l("xChannelSelector","R")}${l("yChannelSelector","G")}${l("result",`${r}_disp`)}/>`,s+=`<feGaussianBlur${l("in",`${r}_disp`)}${l("stdDeviation",n*2)}${l("result",`${r}_blur`)}/>`,s+=`<feBlend${l("in",`${r}_blur`)}${l("in2",e)}${l("mode","multiply")}${l("result",r)}/>`,s}function nc(t,e,r){let{thickness:n,texture:i}=t;if(n===0&&i===0)return O(e,r);let s="";s+=`<feTurbulence${l("type","turbulence")}${l("baseFrequency",.03+i*.02)}${l("numOctaves",3)}${l("seed",1e3)}${l("result",`${r}_brush`)}/>`;let o=Math.max(3,8-Math.floor(n*5)),a=Array.from({length:o+1},(u,c)=>c/o).join(" ");s+=`<feComponentTransfer${l("in",e)}${l("result",`${r}_poster`)}>`;for(let u of["R","G","B"])s+=`<feFunc${u}${l("type","discrete")}${l("tableValues",a)}/>`;return s+="</feComponentTransfer>",s+=`<feDisplacementMap${l("in",`${r}_poster`)}${l("in2",`${r}_brush`)}${l("scale",i*4)}${l("xChannelSelector","R")}${l("yChannelSelector","G")}${l("result",`${r}_disp`)}/>`,s+=`<feMorphology${l("in",`${r}_disp`)}${l("operator","dilate")}${l("radius",n*.5)}${l("result",`${r}_thick`)}/>`,s+=`<feComposite${l("in",`${r}_thick`)}${l("in2",e)}${l("operator","in")}${l("result",r)}/>`,s}function ic(t,e,r){let{spread:n,edges:i}=t;if(n===0&&i===0)return O(e,r);let s="";return s+=`<feTurbulence${l("type","fractalNoise")}${l("baseFrequency",.01+i*.02)}${l("numOctaves",5)}${l("seed",1100)}${l("result",`${r}_ink`)}/>`,s+=`<feMorphology${l("in",e)}${l("operator","dilate")}${l("radius",n*3)}${l("result",`${r}_dilate`)}/>`,s+=`<feDisplacementMap${l("in",`${r}_dilate`)}${l("in2",`${r}_ink`)}${l("scale",i*10)}${l("xChannelSelector","R")}${l("yChannelSelector","G")}${l("result",`${r}_disp`)}/>`,s+=`<feGaussianBlur${l("in",`${r}_disp`)}${l("stdDeviation",n*.5)}${l("result",r)}/>`,s}function sc(t,e,r){let{wrinkles:n,shine:i}=t;if(n===0&&i===0)return O(e,r);let s="";return s+=`<feTurbulence${l("type","turbulence")}${l("baseFrequency",.02)}${l("numOctaves",4)}${l("seed",1200)}${l("result",`${r}_wrinkle`)}/>`,s+=`<feDisplacementMap${l("in",e)}${l("in2",`${r}_wrinkle`)}${l("scale",n*15)}${l("xChannelSelector","R")}${l("yChannelSelector","G")}${l("result",`${r}_disp`)}/>`,s+=`<feSpecularLighting${l("in",`${r}_wrinkle`)}${l("surfaceScale",n*2)}${l("specularConstant",i*1.5)}${l("specularExponent",20)}${l("result",`${r}_sheen`)}>`,s+=`<feDistantLight${l("azimuth",45)}${l("elevation",60)}/>`,s+="</feSpecularLighting>",s+=`<feBlend${l("in",`${r}_disp`)}${l("in2",`${r}_sheen`)}${l("mode","screen")}${l("result",`${r}_blend`)}/>`,s+=`<feComposite${l("in",`${r}_blend`)}${l("in2",e)}${l("operator","in")}${l("result",r)}/>`,s}function ac(t,e,r){let{density:n,size:i}=t;if(n===0)return O(e,r);let s="",o=1-n;s+=`<feTurbulence${l("type","turbulence")}${l("baseFrequency",.1/i)}${l("numOctaves",1)}${l("seed",1400)}${l("result",`${r}_hole`)}/>`,s+=`<feComponentTransfer${l("in",`${r}_hole`)}${l("result",`${r}_thresh`)}>`;for(let a of["R","G","B","A"])s+=`<feFunc${a}${l("type","linear")}${l("slope",10)}${l("intercept",-o*10+5)}/>`;s+="</feComponentTransfer>",s+=`<feComponentTransfer${l("in",`${r}_thresh`)}${l("result",`${r}_clamp`)}>`;for(let a of["R","G","B","A"])s+=`<feFunc${a}${l("type","table")}${l("tableValues","0 0 1 1")}/>`;return s+="</feComponentTransfer>",s+=`<feComposite${l("in",e)}${l("in2",`${r}_clamp`)}${l("operator","in")}${l("result",r)}/>`,s}function oc(t,e,r){let{color:n,radius:i,intensity:s}=t;if(s===0||i===0)return O(e,r);let{r:o,g:a,b:u}=en(n),c="";return c+=`<feColorMatrix${l("in",e)}${l("type","matrix")}${l("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${l("result",`${r}_alpha`)}/>`,c+=`<feGaussianBlur${l("in",`${r}_alpha`)}${l("stdDeviation",i/2)}${l("result",`${r}_blur`)}/>`,c+=`<feColorMatrix${l("in",`${r}_blur`)}${l("type","matrix")}${l("values",`0 0 0 0 ${o} 0 0 0 0 ${a} 0 0 0 0 ${u} 0 0 0 ${s} 0`)}${l("result",`${r}_color`)}/>`,c+=`<feMerge${l("result",r)}><feMergeNode${l("in",`${r}_color`)}/><feMergeNode${l("in",e)}/></feMerge>`,c}function lc(t,e,r){let{color:n,radius:i,intensity:s}=t;if(s===0||i===0)return O(e,r);let{r:o,g:a,b:u}=en(n),c="";return c+=`<feColorMatrix${l("in",e)}${l("type","matrix")}${l("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${l("result",`${r}_alpha`)}/>`,c+=`<feMorphology${l("in",`${r}_alpha`)}${l("operator","erode")}${l("radius",i/4)}${l("result",`${r}_erode`)}/>`,c+=`<feComposite${l("in",`${r}_alpha`)}${l("in2",`${r}_erode`)}${l("operator","out")}${l("result",`${r}_edge`)}/>`,c+=`<feGaussianBlur${l("in",`${r}_edge`)}${l("stdDeviation",i/3)}${l("result",`${r}_blur`)}/>`,c+=`<feColorMatrix${l("in",`${r}_blur`)}${l("type","matrix")}${l("values",`0 0 0 0 ${o} 0 0 0 0 ${a} 0 0 0 0 ${u} 0 0 0 ${s*2} 0`)}${l("result",`${r}_color`)}/>`,c+=`<feComposite${l("in",`${r}_color`)}${l("in2",`${r}_alpha`)}${l("operator","in")}${l("result",`${r}_clipped`)}/>`,c+=`<feComposite${l("in",`${r}_clipped`)}${l("in2",e)}${l("operator","over")}${l("result",r)}/>`,c}function O(t,e){return`<feMerge${l("result",e)}><feMergeNode${l("in",t)}/></feMerge>`}function tn(t){switch(t.type){case"feBlend":return uc(t);case"feColorMatrix":return cc(t);case"feComponentTransfer":return dc(t);case"feComposite":return fc(t);case"feConvolveMatrix":return hc(t);case"feDiffuseLighting":return pc(t);case"feSpecularLighting":return mc(t);case"feDisplacementMap":return gc(t);case"feDropShadow":return yc(t);case"feFlood":return bc(t);case"feGaussianBlur":return xc(t);case"feImage":return Sc(t);case"feMerge":return $c(t);case"feMorphology":return vc(t);case"feOffset":return Tc(t);case"feTile":return kc(t);case"feTurbulence":return wc(t)}}function Q(t){let e="";if(e+=l("in",t.in),e+=l("x",t.x),e+=l("y",t.y),e+=l("width",t.width),e+=l("height",t.height),e+=l("color-interpolation-filters",t.colorInterpolationFilters),e+=l("result",t.result),t.unknownAttrs){let r=Object.keys(t.unknownAttrs).sort();for(let n of r)e+=l(n,t.unknownAttrs[n])}return e}function J(t){return t.animations&&t.animations.length>0?t.animations.join(""):""}function uc(t){let e=`<feBlend${Q(t)}${l("in2",t.in2)}${l("mode",t.mode)}`;t.noComposite&&(e+=' no-composite="no-composite"');let r=J(t);return r?`${e}>${r}</feBlend>`:`${e}/>`}function cc(t){let e=`<feColorMatrix${Q(t)}${l("type",t.matrixType)}${l("values",t.values)}`,r=J(t);return r?`${e}>${r}</feColorMatrix>`:`${e}/>`}function Jr(t,e){if(!e)return"";let r=`feFunc${t}`;switch(e.type){case"identity":return`<${r} type="identity"/>`;case"table":case"discrete":return`<${r} type="${e.type}"${l("tableValues",e.tableValues.join(" "))}/>`;case"linear":return`<${r} type="linear"${l("slope",e.slope)}${l("intercept",e.intercept)}/>`;case"gamma":return`<${r} type="gamma"${l("amplitude",e.amplitude)}${l("exponent",e.exponent)}${l("offset",e.offset)}/>`}}function dc(t){let e="";return e+=Jr("R",t.funcR),e+=Jr("G",t.funcG),e+=Jr("B",t.funcB),e+=Jr("A",t.funcA),e+=J(t),`<feComponentTransfer${Q(t)}>${e}</feComponentTransfer>`}function fc(t){let e=`<feComposite${Q(t)}${l("in2",t.in2)}${l("operator",t.operator)}`;t.operator==="arithmetic"&&(e+=l("k1",t.k1),e+=l("k2",t.k2),e+=l("k3",t.k3),e+=l("k4",t.k4));let r=J(t);return r?`${e}>${r}</feComposite>`:`${e}/>`}function hc(t){let e=`<feConvolveMatrix${Q(t)}`;e+=l("order",t.order),e+=l("kernelMatrix",t.kernelMatrix),e+=l("divisor",t.divisor),e+=l("bias",t.bias),e+=l("targetX",t.targetX),e+=l("targetY",t.targetY),e+=l("edgeMode",t.edgeMode),e+=l("kernelUnitLength",t.kernelUnitLength),t.preserveAlpha!==void 0&&(e+=l("preserveAlpha",t.preserveAlpha?"true":"false"));let r=J(t);return r?`${e}>${r}</feConvolveMatrix>`:`${e}/>`}function Ba(t){switch(t.kind){case"feDistantLight":return`<feDistantLight${l("azimuth",t.azimuth)}${l("elevation",t.elevation)}/>`;case"fePointLight":return`<fePointLight${l("x",t.x)}${l("y",t.y)}${l("z",t.z)}/>`;case"feSpotLight":{let e=`<feSpotLight${l("x",t.x)}${l("y",t.y)}${l("z",t.z)}${l("pointsAtX",t.pointsAtX)}${l("pointsAtY",t.pointsAtY)}${l("pointsAtZ",t.pointsAtZ)}`;return e+=l("specularExponent",t.specularExponent),e+=l("limitingConeAngle",t.limitingConeAngle),e+"/>"}}}function pc(t){let e=`<feDiffuseLighting${Q(t)}`;e+=l("surfaceScale",t.surfaceScale),e+=l("diffuseConstant",t.diffuseConstant),e+=l("kernelUnitLength",t.kernelUnitLength),e+=l("lighting-color",t.lightingColor);let r="";return t.lightSource&&(r+=Ba(t.lightSource)),r+=J(t),`${e}>${r}</feDiffuseLighting>`}function mc(t){let e=`<feSpecularLighting${Q(t)}`;e+=l("surfaceScale",t.surfaceScale),e+=l("specularConstant",t.specularConstant),e+=l("specularExponent",t.specularExponent),e+=l("kernelUnitLength",t.kernelUnitLength),e+=l("lighting-color",t.lightingColor);let r="";return t.lightSource&&(r+=Ba(t.lightSource)),r+=J(t),`${e}>${r}</feSpecularLighting>`}function gc(t){let e=`<feDisplacementMap${Q(t)}`;e+=l("in2",t.in2),e+=l("scale",t.scale),e+=l("xChannelSelector",t.xChannelSelector),e+=l("yChannelSelector",t.yChannelSelector);let r=J(t);return r?`${e}>${r}</feDisplacementMap>`:`${e}/>`}function yc(t){let e=`<feDropShadow${Q(t)}`;e+=l("dx",t.dx),e+=l("dy",t.dy),e+=l("stdDeviation",t.stdDeviation),e+=l("flood-color",t.floodColor),e+=l("flood-opacity",t.floodOpacity);let r=J(t);return r?`${e}>${r}</feDropShadow>`:`${e}/>`}function bc(t){let e=`<feFlood${Q(t)}${l("flood-color",t.floodColor)}${l("flood-opacity",t.floodOpacity)}`,r=J(t);return r?`${e}>${r}</feFlood>`:`${e}/>`}function xc(t){let e=`<feGaussianBlur${Q(t)}${l("stdDeviation",t.stdDeviation)}${l("edgeMode",t.edgeMode)}`,r=J(t);return r?`${e}>${r}</feGaussianBlur>`:`${e}/>`}function Sc(t){let e=`<feImage${Q(t)}`;t.href!==void 0?e+=l("href",t.href):t.xlinkHref!==void 0&&(e+=l("xlink:href",t.xlinkHref)),e+=l("preserveAspectRatio",t.preserveAspectRatio),e+=l("crossorigin",t.crossorigin);let r=J(t);return r?`${e}>${r}</feImage>`:`${e}/>`}function $c(t){let e="";for(let r of t.nodes)e+=`<feMergeNode${l("in",r.in)}/>`;return e+=J(t),`<feMerge${Q(t)}>${e}</feMerge>`}function vc(t){let e=`<feMorphology${Q(t)}${l("operator",t.operator)}${l("radius",t.radius)}`,r=J(t);return r?`${e}>${r}</feMorphology>`:`${e}/>`}function Tc(t){let e=`<feOffset${Q(t)}${l("dx",t.dx)}${l("dy",t.dy)}`,r=J(t);return r?`${e}>${r}</feOffset>`:`${e}/>`}function kc(t){let e=`<feTile${Q(t)}`,r=J(t);return r?`${e}>${r}</feTile>`:`${e}/>`}function wc(t){let e=`<feTurbulence${Q(t)}`;e+=l("baseFrequency",t.baseFrequency),e+=l("numOctaves",t.numOctaves),e+=l("seed",t.seed),e+=l("stitchTiles",t.stitchTiles),e+=l("type",t.turbulenceType);let r=J(t);return r?`${e}>${r}</feTurbulence>`:`${e}/>`}function Wi(t,e){let r=`<filter${l("id",t)}`;r+=l("x",e.x),r+=l("y",e.y),r+=l("width",e.width),r+=l("height",e.height),r+=l("filterUnits",e.filterUnits),r+=l("primitiveUnits",e.primitiveUnits),e.filterColorInterpolation&&e.filterColorInterpolation!=="auto"&&(r+=l("color-interpolation-filters",e.filterColorInterpolation)),r+=l("flood-color",e.floodColor),r+=l("flood-opacity",e.floodOpacity),r+=l("lighting-color",e.lightingColor),r+=">",e.filterTitle&&(r+=`<title>${W(e.filterTitle)}</title>`),e.filterDescription&&(r+=`<desc>${W(e.filterDescription)}</desc>`);for(let n of e.primitives)r+=tn(n);if(e.filterAnimations)for(let n of e.filterAnimations)r+=n;return r+="</filter>",r}function Hi(t,e,r,n){switch(t.type){case"drop-shadow":return _u(t,e,r);case"inner-shadow":return Ru(t,e,r);case"gaussian-blur":return Au(t,e,r);case"motion-blur":return Mu(t,e,r);case"point-light":{let i=t;return Fa(n?{...i,x:i.x+n.x,y:i.y+n.y}:i,e,r)}case"spot-light":{let i=t;return Ea(n?{...i,x:i.x+n.x,y:i.y+n.y,pointsAtX:i.pointsAtX+n.x,pointsAtY:i.pointsAtY+n.y}:i,e,r)}case"diffuse-lighting":return Cu(t,e,r);case"specular-lighting":return Iu(t,e,r);case"outline":return Du(t,e,r);case"sharpen":return Fu(t,e,r);case"pixelate":return Eu(t,e,r);case"warp":return Lu(t,e,r);case"morphology":return Bu(t,e,r);case"contouring-discrete":return Nu(t,e,r);case"contouring-table":return Ou(t,e,r);case"round-edges":return zu(t,e,r);case"grayscale":return Gu(t,e,r);case"channel-painter":return Vu(t,e,r);case"brightness":return Uu(t,e,r);case"contrast":return Wu(t,e,r);case"opacity":return Hu(t,e,r);case"invert":return ju(t,e,r);case"hue-rotate":return Xu(t,e,r);case"saturate":return Ku(t,e,r);case"black-and-white":return Yu(t,e,r);case"sepia":return qu(t,e,r);case"duotone":return Zu(t,e,r);case"xray":return Qu(t,e,r);case"noise":return Ju(t,e,r);case"emboss":return ec(t,e,r);case"film-grain":return tc(t,e,r);case"watercolor":return rc(t,e,r);case"gouache":return nc(t,e,r);case"ink-blot":return ic(t,e,r);case"crumpled-plastic":return sc(t,e,r);case"riddled":return ac(t,e,r);case"glow":return oc(t,e,r);case"inner-glow":return lc(t,e,r);case"raw-svg":return t.svgContent;case"svg-primitive-chain":return t.primitives.map(tn).join("");default:return O(e,r)}}function Pc(t){return t.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(r=>r.type==="feGaussianBlur"||r.type==="feDropShadow"||r.type==="feOffset"||r.type==="feMorphology"||r.type==="feDisplacementMap"||r.type==="feTurbulence"))}function ji(t,e,r={}){let n=e.filter(v=>v.enabled);if(n.length===0)return"";let i=r.colorInterpolation&&r.colorInterpolation!=="auto"?l("color-interpolation-filters",r.colorInterpolation):"",s=n.find(v=>v.type==="raw-svg");if(s){let v=r.colorInterpolation&&r.colorInterpolation!=="auto"?r.colorInterpolation:s.colorInterpolationFilters,k=r.filterUnits??s.filterUnits,P=r.primitiveUnits??s.primitiveUnits,T=r.x??s.x,w=r.y??s.y,R=r.width??s.width,F=r.height??s.height;return`<filter${l("id",t)}${l("x",T)}${l("y",w)}${l("width",R)}${l("height",F)}${l("filterUnits",k)}${l("primitiveUnits",P)}${l("color-interpolation-filters",v)}${l("flood-color",s.floodColor)}${l("flood-opacity",s.floodOpacity)}${l("lighting-color",s.lightingColor)}${l("display",s.display)}>${s.svgContent}</filter>`}let o=n.find(v=>v.type==="svg-primitive-chain");if(o){let v={...o,x:r.x??o.x,y:r.y??o.y,width:r.width??o.width,height:r.height??o.height,filterUnits:r.filterUnits??o.filterUnits,primitiveUnits:r.primitiveUnits??o.primitiveUnits,filterColorInterpolation:r.colorInterpolation&&r.colorInterpolation!=="auto"?r.colorInterpolation:o.filterColorInterpolation};return Wi(t,v)}let a=n.some(v=>v.type==="gaussian-blur"&&v.quality==="high"||v.type==="motion-blur"&&v.quality==="high"),u=Pc(n),c=u?a?"-200%":"-100%":"-10%",f=u?a?"500%":"300%":"120%",d="",h="SourceGraphic",p=0;for(let v of n){let k=`result${p++}`;d+=Hi(v,h,k),h=k}let g=r.filterUnits??"objectBoundingBox",m=r.primitiveUnits??"userSpaceOnUse",b=r.x??c,x=r.y??c,S=r.width??f,$=r.height??f;return`<filter${l("id",t)}${l("x",b)}${l("y",x)}${l("width",S)}${l("height",$)}${l("filterUnits",g)}${l("primitiveUnits",m)}${i}>${d}</filter>`}function Na(t){let e="",r=new Set;for(let n of t){let i=n.state.filters;if(!i||i.length===0)continue;let s=i.filter(c=>c.enabled);if(s.length===0)continue;let o=n.state.filterLibraryIds,a=Array.isArray(o)&&o.length>0?o[0]:`filter-${n.id}`;if(r.has(a))continue;r.add(a);let u=n.state;e+=ji(a,s,{colorInterpolation:u.filterColorInterpolation,filterUnits:u.filterUnits,primitiveUnits:u.primitiveUnits,x:u.filterX,y:u.filterY,width:u.filterWidth,height:u.filterHeight})}return e}function rn(t,e,r){return!e||e.length===0||e.filter(i=>i.enabled).length===0?"":Array.isArray(r)&&r.length>0?` filter="${r.map(s=>`url(#${W(s)})`).join(" ")}"`:` filter="url(#filter-${W(t)})"`}function _c(t){if(t instanceof Map)return t;let e=new Map;for(let r of t)e.set(r.id,r);return e}function Rc(t){if(t.kind==="marker")return t.shapes;if(t.kind!=="symbol")return[];if(!t.variants)return t.shapes;let e=[...t.shapes];for(let r of Object.values(t.variants))e.push(...r);return e}function Oa(t,e,r,n){let i=_c(r),s=new Set,o=[],a=[],u=d=>{if(typeof d!="string"||!d||s.has(d))return;let h=i.get(d);h&&(h.kind!=="symbol"&&h.kind!=="marker"||(s.add(d),o.push(h)))},c=d=>{a.push(d)},f=d=>{let h=d.state;if(!h)return;u(h.symbolId),u(h.markerStart),u(h.markerMid),u(h.markerEnd);let p=h.children;if(Array.isArray(p))for(let m of p)c(m);let g=h.symbolOverrides;if(g&&typeof g=="object"&&!Array.isArray(g))for(let[m,b]of Object.entries(g))!b||typeof b!="object"||Array.isArray(b)||c({id:m,type:"symbol-override",state:b})};for(let d of t)c(d);for(let d of e)u(d);for(;;){let d=a.shift();if(d){n(d),f(d);continue}let h=o.shift();if(!h)break;for(let p of Rc(h))c(p)}}var Ac=[],Mc=[];function Ut(t,e,r){Oa(t,Mc,e,r)}function za(t,e,r){Oa(Ac,t,e,r)}function Ga(t,e){if(!t)return;let r=t,n=r.markerStart;typeof n=="string"&&n&&e(n);let i=r.markerMid;typeof i=="string"&&i&&e(i);let s=r.markerEnd;typeof s=="string"&&s&&e(s);let o=r.startEndpoint;typeof o=="string"&&o&&o!=="none"&&e(Vt(o));let a=r.endEndpoint;typeof a=="string"&&a&&a!=="none"&&e(Vt(a))}function Vt(t){return`line-marker-${t}`}function Va(t,e,r){if(!t)return;let n=t,i=o=>{typeof o=="string"&&o&&r(o)};i(n.fillLibraryId),i(n.strokeLibraryId),i(n.markerStart),i(n.markerMid),i(n.markerEnd),i(n.symbolId);let s=n.filterLibraryIds;if(Array.isArray(s)&&s.length>0)for(let o of s)i(o);else Array.isArray(n.filters)&&n.filters.length>0&&r(`filter-${e}`);n.fillLibraryId||i(n.fillGradient?.id),n.strokeLibraryId||i(n.strokeGradient?.id)}function Wt(t,e=[]){let r=new Set,n=new Set;return Ut(t,e,i=>{let s=i.state;if(!s)return;typeof s.markerStart=="string"&&s.markerStart&&r.add(s.markerStart),typeof s.markerMid=="string"&&s.markerMid&&r.add(s.markerMid),typeof s.markerEnd=="string"&&s.markerEnd&&r.add(s.markerEnd);let o=s.startEndpoint,a=s.endEndpoint;typeof o=="string"&&o&&o!=="none"&&n.add(o),typeof a=="string"&&a&&a!=="none"&&n.add(a)}),{ids:r,legacyEndpoints:n}}function Ua(t,e){let{ids:r,legacyEndpoints:n}=Wt(t,e);for(let i of n)r.add(Vt(i));return r}function Ht(t,e,r,n){let i=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/10);switch(t){case"stripes":return[{tag:"rect",attrs:{width:n?.strokeWidth!=null?Math.max(.01,Math.min(1,n.strokeWidth))*e:e/2,height:e,fill:r}}];case"dots":{let s=n?.dotRadius!=null?Math.max(.05,Math.min(.45,n.dotRadius)):.25;return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e*s,fill:r}}]}case"grid":return[{tag:"path",attrs:{d:`M ${e} 0 L 0 0 0 ${e}`,fill:"none",stroke:r,"stroke-width":i}}];case"checkerboard":return[{tag:"rect",attrs:{width:e/2,height:e/2,fill:r}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e/2,height:e/2,fill:r}}];case"diagonal":{let s=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:r,"stroke-width":s}}]}case"crosshatch":return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0 M 0 0 L ${e} ${e}`,stroke:r,"stroke-width":i}}];case"zigzag":{let s=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,o=e*s;return[{tag:"path",attrs:{d:`M 0 ${o} L ${e/4} 0 L ${e/2} ${o} L ${e*3/4} 0 L ${e} ${o}`,fill:"none",stroke:r,"stroke-width":i}}]}case"waves":{let s=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,o=e*s,a=e/2;return[{tag:"path",attrs:{d:`M 0 ${a} Q ${e/4} ${a-o} ${e/2} ${a} T ${e} ${a}`,fill:"none",stroke:r,"stroke-width":i}}]}case"triangles":{let s=e*.866;return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${s} L 0 ${s} Z`,fill:"none",stroke:r,"stroke-width":i}}]}case"hexagons":{let s=e*.866;return[{tag:"path",attrs:{d:`M ${e*.25} 0 L ${e*.75} 0 L ${e} ${s*.5} L ${e*.75} ${s} L ${e*.25} ${s} L 0 ${s*.5} Z`,fill:"none",stroke:r,"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:r,"stroke-width":i}}];case"circles":return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e/3,fill:"none",stroke:r,"stroke-width":i}}];case"bricks":{let s=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:r,"stroke-width":s}},{tag:"rect",attrs:{x:-e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:r,"stroke-width":s}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:r,"stroke-width":s}}]}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:r,"stroke-width":i}}];default:return[]}}function Cc(t){let e=Object.entries(t.attrs).map(([r,n])=>` ${r}="${n}"`).join("");return`<${t.tag}${e}/>`}function nn(t,e,r,n,i){let s=10*e,o="";o+=`<rect width="${s}" height="${s}" fill="${n}"/>`;let a=Ht(t,s,r,i);for(let u of a)o+=Cc(u);return{svgContent:o,width:s,height:s}}var jt="0 0 10 10",sn=6,an=6;function je(){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 Xi={"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"},Ic={"mkr-builtin-arrow":"Arrow","mkr-builtin-open-arrow":"Open Arrow","mkr-builtin-circle":"Circle","mkr-builtin-diamond":"Diamond","mkr-builtin-square":"Square"};function Wa(){return je().map(t=>{let e=Xi[t.id]??t.id;return{kind:"marker",id:e,name:Ic[e]??e,viewBox:jt,refX:t.refX,refY:t.refY,markerWidth:6,markerHeight:6,markerUnits:"strokeWidth",orient:"auto-start-reverse",shapes:[],builtIn:!0}})}function Dc(t){return t.replace(/[^a-zA-Z0-9_-]/g,"_")}function Fc(t){let e=t.state.symbolOverrides;return!!e&&Object.keys(e).length>0}function ut(t){let e=t.state.symbolId??"",r=t.state.variantKey??"";return Fc(t)?`${e}--ovr-${t.id}`:r?`${e}--${Dc(r)}`:e}function on(t,e){let r=e.state.variantKey??"",n=r?t.variants?.[r]??t.shapes:t.shapes,i=e.state.symbolOverrides;return!i||Object.keys(i).length===0?n:n.map(s=>{let o=i[s.id];return!o||Object.keys(o).length===0?s:{...s,state:{...s.state,...o}}})}function Xt(t,e){switch(e){case"uppercase":return t.toLocaleUpperCase();case"lowercase":return t.toLocaleLowerCase();case"capitalize":return t.replace(/\b\p{L}/gu,r=>r.toLocaleUpperCase());default:return t}}var Ec=[["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 ct(t){return Ec.map(([e,r])=>{let n=t[e],i=typeof n=="string"?n.trim():"";return i?`${r}: ${i}`:""}).filter(Boolean).join("; ")}function ln(t,e){let r=[],n=(a,u)=>{u!==""&&r.push({name:a,value:u})};t.fontFamily!==e.fontFamily&&n("font-family",String(t.fontFamily)),t.fontSize!==e.fontSize&&n("font-size",String(t.fontSize)),t.fontWeight!==e.fontWeight&&n("font-weight",String(t.fontWeight)),t.fontStyle!==e.fontStyle&&n("font-style",String(t.fontStyle));let i=ct(t);i&&i!==ct(e)&&n("style",i);let s=t.textDecoration,o=e.textDecoration;if(s.underline!==o.underline||s.strikethrough!==o.strikethrough||s.overline!==o.overline){let a=[];s.underline&&a.push("underline"),s.strikethrough&&a.push("line-through"),s.overline&&a.push("overline"),n("text-decoration",a.join(" "))}if(t.baselineShift!==e.baselineShift){let a=t.baselineShift;a==="super"||a==="sub"?n("baseline-shift",a):typeof a=="number"&&n("baseline-shift",`${a}px`)}return t.letterSpacing!==e.letterSpacing&&n("letter-spacing",String(t.letterSpacing)),t.fill!==e.fill&&n("fill",String(t.fill)),t.fillOpacity!==e.fillOpacity&&n("fill-opacity",String(t.fillOpacity)),t.direction!==e.direction&&n("direction",String(t.direction)),t.unicodeBidi!==e.unicodeBidi&&n("unicode-bidi",String(t.unicodeBidi)),r}function y(t,e){return e==null||e===""?"":` ${t}="${W(String(e))}"`}function Lc(t){let e=t.map(r=>(r??"").trim().replace(/;$/,"")).filter(Boolean).join("; ");return e?y("style",e):""}function Bc(t,e){return typeof e=="number"&&e>0?`${t}: ${e}px`:""}function Nc(t){if(t&&typeof t=="object"){let e=t;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 Ha(t,e){let r=-1;for(let i=t.length-1;i>=0;i--)if(t[i][e]!==null){r=i;break}if(r<0)return[];let n=new Array(r+1);for(let i=0;i<=r;i++)n[i]=t[i][e]??0;return n}function ja(t,e){let r=-1;for(let i=t.length-1;i>=0;i--)if(t[i][e]!==0){r=i;break}if(r<0)return[];let n=new Array(r+1);for(let i=0;i<=r;i++)n[i]=t[i][e];return n}function Oc(t){if(t.length===0)return[];let e=t.length-1,r=t[e].rotate;for(;e>0&&t[e-1].rotate===r;)e--;if(e===0&&r===0)return[];let n=new Array(e+1);for(let i=0;i<=e;i++)n[i]=t[i].rotate;return n}function xe(t,e){return at(t,e)}function zc(t,e,r){return Li(t,e,r)}function Gc(t){if(typeof t=="string"){let n=t.trim();return n.length>0?n:void 0}if(!t||typeof t!="object")return;let e=t,r=[];return e.underline&&r.push("underline"),e.strikethrough&&r.push("line-through"),e.overline&&r.push("overline"),r.length>0?r.join(" "):void 0}function Vc(t){if(typeof t.strokeDasharray=="string")return t.strokeDasharray;let e=t.lineStyle??"solid",r=t.dashLength??8,n=t.gapLength??4;return lt(e,r,n)}function un(t,e){let r=t[e];return r!==void 0?r:t.extra?.[e]}function Uc(t){let e=t.fillType;return e||(t.fillGradient?t.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":un(t,"linearGradient")?"linear-gradient":un(t,"radialGradient")?"radial-gradient":"solid")}function Wc(t){return t.fillGradient??un(t,"linearGradient")??un(t,"radialGradient")??void 0}function pe(t,e){let r=y("data-shape-id",e),n=Uc(t),i=Wc(t);if(n==="none")r+=y("fill","none");else if(n==="linear-gradient"||n==="radial-gradient"){let w=t.fillLibraryId??i?.id;r+=y("fill",`url(#${w??`gradient-fill-${e}`})`)}else if(n==="pattern"){let w=t.fillLibraryId??i?.id;r+=y("fill",`url(#${w??`pattern-fill-${e}`})`)}else r+=y("fill",t.fillColor??"#000000");let s=t.opacity;s!==void 0&&s<1&&(r+=y("opacity",s));let o=t.fillOpacity;o!==void 0&&o<1&&(r+=y("fill-opacity",o));let a=t.fillRule;a&&a!=="nonzero"&&(r+=y("fill-rule",a));let u=t.strokeType??"solid",c=t.strokeGradient;if(u==="none")r+=y("stroke","none");else if(u==="linear-gradient"||u==="radial-gradient"){let w=t.strokeLibraryId??c?.id;r+=y("stroke",`url(#${w??`gradient-stroke-${e}`})`)}else if(u==="pattern"){let w=t.strokeLibraryId??c?.id;r+=y("stroke",`url(#${w??`pattern-stroke-${e}`})`)}else r+=y("stroke",t.borderColor??"none");let f=t.borderWidth;f!=null&&(r+=y("stroke-width",f));let d=t.strokeOpacity;d!==void 0&&d<1&&(r+=y("stroke-opacity",d));let h=t.paintOrder;h&&h!=="normal"&&(r+=y("paint-order",h));let p=t.markerStart,g=t.markerMid,m=t.markerEnd;p&&(r+=y("marker-start",`url(#${p})`)),g&&(r+=y("marker-mid",`url(#${g})`)),m&&(r+=y("marker-end",`url(#${m})`));let b=Vc(t);b&&(r+=y("stroke-dasharray",b),!t.strokeDasharray&&t.lineStyle==="dotted"&&(r+=y("stroke-linecap","round")));let x=t.dashOffset;x!==void 0&&x!==0&&(r+=y("stroke-dashoffset",x));let S=t.shapeRendering;S&&S!=="auto"&&(r+=y("shape-rendering",S)),r+=rn(e,t.filters,t.filterLibraryIds);let $=t.systemLanguage;$&&(r+=y("systemLanguage",$));let v=t.requiredExtensions;v&&(r+=y("requiredExtensions",v));let k=t.vectorEffect;k&&k!=="none"&&(r+=y("vector-effect",k));let P=t.visibility;P&&P!=="visible"&&(r+=y("visibility",P));let T=t.metadata;return T&&(T.role&&(r+=y("role",T.role)),T.ariaLabel&&(r+=y("aria-label",T.ariaLabel))),r}function Hc(t){let e=t.metadata;if(!e)return"";let r="";return e.title&&(r+=`<title>${W(e.title)}</title>`),e.description&&(r+=`<desc>${W(e.description)}</desc>`),r}function jc(t,e){let r=Hc(e);if(!r)return t;let n=t.lastIndexOf("/>");if(n===-1){let o=t.indexOf(">");return o===-1?t:t.slice(0,o+1)+r+t.slice(o+1)}let i=t.match(/^<(\w+)/),s=i?i[1]:"g";return t.slice(0,n)+">"+r+`</${s}>`}function Ki(t){let e="",r=t.startEndpoint,n=t.endEndpoint;return r&&r!=="none"&&(e+=y("marker-start",`url(#line-marker-${r})`)),n&&n!=="none"&&(e+=y("marker-end",`url(#line-marker-${n})`)),e}function Yi(t){let e=t.state,r=e.x??0,n=e.y??0,i=e.radius??50,s=xe(e,{x:r,y:n});return`<circle${y("cx",r)}${y("cy",n)}${y("r",i)}${pe(e,t.id)}${s?y("transform",s):""}/>`}function qi(t){let e=t.state,r=e.cx??0,n=e.cy??0,i=e.rx??50,s=e.ry??30,o=e.pathLength,a=xe(e,{x:r,y:n});return`<ellipse${y("cx",r)}${y("cy",n)}${y("rx",i)}${y("ry",s)}${o!==void 0?y("pathLength",o):""}${pe(e,t.id)}${a?y("transform",a):""}/>`}function Zi(t){let e=t.state,r=e,n=e.x??0,i=e.y??0,s=e.width??100,o=e.height??100,a=e.cornerRadius??0,u=e.rx??a,c=e.ry??a,f=r.cornerShape??"round",d=r.cornerMode??"uniform",h={x:n+s/2,y:i+o/2},p=xe(e,h);if(f!=="round"||d==="non-uniform"){let g=qr(n,i,s,o,a,f,d,d==="non-uniform"?{radiusTL:r.cornerRadiusTL,radiusTR:r.cornerRadiusTR,radiusBR:r.cornerRadiusBR,radiusBL:r.cornerRadiusBL,shapeTL:r.cornerShapeTL,shapeTR:r.cornerShapeTR,shapeBR:r.cornerShapeBR,shapeBL:r.cornerShapeBL}:void 0);if(g)return`<path${y("d",g)}${pe(e,t.id)}${p?y("transform",p):""}/>`}return`<rect${y("x",n)}${y("y",i)}${y("width",s)}${y("height",o)}${u>0||c>0?`${y("rx",u)}${y("ry",c)}`:""}${pe(e,t.id)}${p?y("transform",p):""}/>`}function Qi(t){let e=t.state,r=e.x1??0,n=e.y1??0,i=e.x2??0,s=e.y2??0,o={x:(r+i)/2,y:(n+s)/2},a=xe(e,o),u={...e,fillType:"none"};return`<line${y("x1",r)}${y("y1",n)}${y("x2",i)}${y("y2",s)}${pe(u,t.id)}${Ki(e)}${a?y("transform",a):""}/>`}function Ji(t){let e=t.state,r=e.x??0,n=e.y??0,i=Xt(e.text??"",e.textTransform),s=e.fontSize??16,o=e.fontFamily??"sans-serif",a=e.fontWeight??"normal",u=e.fontStyle??"normal",c=e.textAnchor??"start",f=Gc(e.textDecoration),d=e.letterSpacing,h=e.wordSpacing,p=e.lineHeight??1.25,m=xe(e,{x:r,y:n}),b=y("x",r)+y("y",n);b+=y("font-size",s),b+=y("font-family",o),a!=="normal"&&(b+=y("font-weight",a)),u!=="normal"&&(b+=y("font-style",u)),c!=="start"&&(b+=y("text-anchor",c)),f&&(b+=y("text-decoration",f)),d&&(b+=y("letter-spacing",d)),h&&(b+=y("word-spacing",h));let x=e.baselineShift;x&&x!=="baseline"&&(b+=y("baseline-shift",x));let S=e.dominantBaseline;S&&S!=="auto"&&(b+=y("dominant-baseline",S));let $=e.writingMode;$&&$!=="horizontal-tb"&&(b+=y("writing-mode",$));let v=e.textLength;v!==void 0&&v>0&&(b+=y("textLength",v),e.lengthAdjust==="spacingAndGlyphs"&&(b+=y("lengthAdjust","spacingAndGlyphs")));let k=e.textDirection;k&&k!=="ltr"&&(b+=y("direction",k));let P=e.unicodeBidi;P&&P!=="normal"&&(b+=y("unicode-bidi",P));let T=e.shapeInsideRef;if(T){b+=y("shape-inside",`url(#${T})`);let C=e.shapePadding;C!==void 0&&(b+=y("shape-padding",C))}let w=ct(e),R=e.fontVariationSettings,F="";if(R&&Object.keys(R).length>0&&(F=`font-variation-settings: ${Object.entries(R).map(([L,G])=>`'${L}' ${G}`).join(", ")}`),b+=Lc([w,F,Bc("inline-size",e.inlineSize),typeof e.overflowWrap=="string"?`overflow-wrap: ${e.overflowWrap}`:"",typeof e.whiteSpace=="string"?`white-space: ${e.whiteSpace}`:"",typeof e.lineHeight=="number"?`line-height: ${e.lineHeight}`:""]),b+=pe(e,t.id),m&&(b+=y("transform",m)),e.isTextPath&&e.textPathPoints){let C=e.textPathPoints,L=e.textPathStartOffset??0,G=e.textPathSide,A=`text-path-${t.id}`,Y=e.textPathMethod,j=e.textPathSpacing,U=e.textPathLengthAdjust,re=e.textPathLength,V="";if(C.length>=2)if(G==="right"){let N=C[C.length-1];V=`M ${N.x} ${N.y}`;for(let te=C.length-1;te>0;te--){let ne=C[te],ue=C[te-1],oe=ne.handleIn??ne,Ye=ue.handleOut??ue;V+=` C ${oe.x} ${oe.y}, ${Ye.x} ${Ye.y}, ${ue.x} ${ue.y}`}}else{V=`M ${C[0].x} ${C[0].y}`;for(let N=0;N<C.length-1;N++){let te=C[N],ne=C[N+1],ue=te.handleOut??te,oe=ne.handleIn??ne;V+=` C ${ue.x} ${ue.y}, ${oe.x} ${oe.y}, ${ne.x} ${ne.y}`}}return`<defs><path id="${W(A)}"${y("d",V)} fill="none"/></defs><text${b}><textPath href="#${W(A)}"${y("startOffset",`${L}%`)}${y("method",Y)}${y("spacing",j)}${y("lengthAdjust",U)}${y("textLength",re)}>${W(i)}</textPath></text>`}if(e.charOffsets&&Array.isArray(e.charOffsets)&&e.charOffsets.length>0){let C=e.charOffsets.map(Nc),L=i.split(`
|
|
12
|
-
`),G=e.linePositions??[],A=s*p,Y="",j=0;return L.forEach((U,re)=>{let V=Array.from(U).length,N=C.slice(j,j+V),te=G[re],ne=te?r+te.x:re>0?r:NaN,ue=te?te.dy:re>0?A:NaN,oe="",Ye=Ha(N,"x");if(Number.isFinite(ne)||Ye.length>0){let hi=Ye.length>0?Ye.slice():[];Number.isFinite(ne)&&(hi[0]=hi[0]??ne),oe+=y("x",hi.join(" "))}let Fs=Ha(N,"y");Fs.length>0&&(oe+=y("y",Fs.join(" ")));let Es=ja(N,"dx");Es.length>0&&(oe+=y("dx",Es.join(" ")));let Ls=ja(N,"dy"),Me=Ls.length>0||Number.isFinite(ue)?Ls.slice():[];for(Number.isFinite(ue)&&(Me[0]=(Me[0]??0)+ue);Me.length>0&&Me[Me.length-1]===0;)Me.pop();Me.length>0&&(oe+=y("dy",Me.join(" ")));let Bs=Oc(N);Bs.length>0&&(oe+=y("rotate",Bs.join(" "))),Y+=`<tspan${oe}>${W(U)}</tspan>`,j+=V+1}),`<text${b}>${Y}</text>`}let E=yr(e);if(E){let C=_e(E),L=e.linePositions,G=s*C.lineHeight,A="";return C.lines.forEach((Y,j)=>{Y.segments.forEach((U,re)=>{let V="";if(re===0){let N=L?.[j];N?((Math.abs(N.x)>.001||j>0)&&(V+=y("x",r+N.x)),(Math.abs(N.dy)>.001||j>0)&&(V+=y("dy",N.dy))):j>0&&(V+=y("x",r),V+=y("dy",`${G}px`))}for(let{name:N,value:te}of ln(U.style,C.baseStyle))V+=y(N,te);V+=' xml:space="preserve"',A+=`<tspan${V}>${W(Xt(U.text,U.style.textTransform))}</tspan>`})}),`<text${b}>${A}</text>`}return`<text${b}>${W(i)}</text>`}function es(t){let e=t.state,r=e.pathPoints??[],n=e.pathCurveType??"CUBIC",i=e.pathClosed??!1,s=e.pathTension??.5,o=e.pathArcParams,a=Fe(r,n,i,s,o),u=r.length>0?e.customPivot??{x:r[0].x,y:r[0].y}:void 0,c=u?xe(e,u):null;return`<path${y("d",a)}${pe(e,t.id)}${Ki(e)}${c?y("transform",c):""}/>`}function ts(t){let e=t.state,r=e.polylinePoints??[],n=e.polylineClosed??!1,i=r.map(u=>`${u.x},${u.y}`).join(" "),s=r.length>0?e.customPivot??{x:r[0].x,y:r[0].y}:void 0,o=s?xe(e,s):null;return`<${n?"polygon":"polyline"}${y("points",i)}${pe(e,t.id)}${Ki(e)}${o?y("transform",o):""}/>`}function rs(t){let e=t.state,r=e.x??0,n=e.y??0,i=e.width??100,s=e.height??100,o=e.href??"",a=e.imageOpacity,u=e.preserveAspectRatio?"xMidYMid meet":"none",c={x:r+i/2,y:n+s/2},f=xe(e,c);return`<image${y("x",r)}${y("y",n)}${y("width",i)}${y("height",s)}${y("href",o)}${y("preserveAspectRatio",u)}${a!==void 0&&a<1?y("opacity",a):""}${pe(e,t.id)}${f?y("transform",f):""}/>`}function cn(t){return!t||t.length===0?"":t.map(e=>ee(e)).join("")}function Xc(t){let e=t.state,r=e.href,n=e.hrefXlink,i="<a";return r!==void 0&&(i+=y("href",r)),n!==void 0&&(i+=y("xlink:href",n)),i+=y("target",e.linkTarget),i+=y("rel",e.linkRel),i+=y("download",e.linkDownload),i+=y("ping",e.linkPing),i+=y("hreflang",e.linkHreflang),i+=y("type",e.linkType),i+=y("referrerpolicy",e.linkReferrerPolicy),i+=y("data-shape-id",t.id),i+=">",i+=cn(e.children),i+="</a>",i}function Kc(t){let e=t.state,r="<switch";return r+=y("data-shape-id",t.id),r+=">",r+=cn(e.children),r+="</switch>",r}function Yc(t){let e=t.state,r=xe(e),n="<g";return n+=y("data-shape-id",t.id),r&&(n+=y("transform",r)),e.opacity!==void 0&&e.opacity<1&&(n+=y("opacity",e.opacity)),e.visibility&&(n+=y("visibility",e.visibility)),e.blendMode&&(n+=y("style",`mix-blend-mode:${e.blendMode}`)),n+=">",n+=cn(e.children),n+="</g>",n}function qc(t){let e=t.state,r=e.viewBoxX,n=e.viewBoxY,i=e.viewBoxWidth,s=e.viewBoxHeight,o=r!==void 0&&n!==void 0&&i!==void 0&&s!==void 0?`${r} ${n} ${i} ${s}`:void 0,a="<view";return a+=y("id",t.id),a+=y("viewBox",o),a+=y("preserveAspectRatio",e.viewPreserveAspectRatio),a+=y("zoomAndPan",e.viewZoomAndPan),a+=y("viewTarget",e.viewTarget),e.viewName&&(a+=y("data-view-name",e.viewName)),a+="/>",a}function Zc(t){let e=t.state,r=e.svgX,n=e.svgY,i=e.svgWidth,s=e.svgHeight,o=e.svgViewBoxX,a=e.svgViewBoxY,u=e.svgViewBoxWidth,c=e.svgViewBoxHeight,f=o!==void 0&&a!==void 0&&u!==void 0&&c!==void 0?`${o} ${a} ${u} ${c}`:void 0,d="<svg";return d+=y("xmlns","http://www.w3.org/2000/svg"),d+=y("x",r),d+=y("y",n),d+=y("width",i),d+=y("height",s),d+=y("viewBox",f),d+=y("preserveAspectRatio",e.svgPreserveAspectRatio),d+=y("data-shape-id",t.id),d+=">",d+=cn(e.children),d+="</svg>",d}function Qc(t){let e=t.state,r=e.targetShapeId;if(!r)return`<!-- shape-reference ${W(t.id)} has no targetShapeId -->`;let n=e.offsetX??0,i=e.offsetY??0,s="<use";return s+=y("href",`#${r}`),s+=y("x",n),s+=y("y",i),e.width!==void 0&&(s+=y("width",e.width)),e.height!==void 0&&(s+=y("height",e.height)),s+=y("data-shape-id",t.id),e.opacity!==void 0&&e.opacity<1&&(s+=y("opacity",e.opacity)),s+="/>",s}function ns(t){let e=t.state,r=ut(t),n=e.x??0,i=e.y??0,s=e.width??100,o=e.height??100;return`<use href="#${W(r)}" x="${n}" y="${i}" width="${s}" height="${o}"/>`}function Jc(t){let e=t.state,r=e.mediaKind??t.type,n=e.x??0,i=e.y??0,s=e.width??320,o=e.height??180,a=e.href??"",u=e.mediaMimeType,c=e.posterHref,f=e.mediaOpacity,d=`<${r} xmlns="http://www.w3.org/1999/xhtml"`;d+=y("src",a),u&&(d+=y("type",u)),c&&r==="video"&&(d+=y("poster",c)),e.muted&&(d+=' muted=""'),e.loop&&(d+=' loop=""'),e.playbackRate!==void 0&&(d+=y("data-playback-rate",e.playbackRate)),e.volume!==void 0&&(d+=y("data-volume",e.volume)),d+=' preload="auto" playsinline=""',d+=r==="video"?' style="width:100%;height:100%;display:block;"></video>':"></audio>";let h="<foreignObject";return h+=y("x",n),h+=y("y",i),h+=y("width",s),h+=y("height",o),h+=y("data-shape-id",t.id),h+=y("data-media-kind",r),e.naturalDuration!==void 0&&(h+=y("data-natural-duration",e.naturalDuration)),e.begin!==void 0&&(h+=y("data-begin",e.begin)),e.trimStart!==void 0&&(h+=y("data-trim-start",e.trimStart)),e.trimEnd!==void 0&&(h+=y("data-trim-end",e.trimEnd)),e.fadeInDuration!==void 0&&(h+=y("data-fade-in",e.fadeInDuration)),e.fadeOutDuration!==void 0&&(h+=y("data-fade-out",e.fadeOutDuration)),e.systemLanguage&&(h+=y("systemLanguage",e.systemLanguage)),e.requiredExtensions&&(h+=y("requiredExtensions",e.requiredExtensions)),f!==void 0&&f<1&&(h+=y("opacity",f)),h+=">",h+=d,h+="</foreignObject>",h}function is(t){let e=t.state,r=e.x??0,n=e.y??0,i=e.width??100,s=e.height??60,o={x:r+i/2,y:n+s/2},a=xe(e,o),u=Zr(t.type,r,n,i,s,{slantPercent:e.slantPercent,topWidthPercent:e.topWidthPercent,capHeightPercent:e.capHeightPercent,waveAmplitudePercent:e.waveAmplitudePercent});return`<path${y("d",u)}${pe(e,t.id)}${a?y("transform",a):""}/>`}function ss(t){let e=t.state,r=e.cx??0,n=e.cy??0,i=e.radius??50,s=e.cornerRadius??0,o=e.shiftAngle??-90,a=e.fillRule??"nonzero",u=zc(e,r,n),c="";switch(t.type){case"triangle":c=he(Gt(3,i,o),s,i);break;case"ngon":{let d=e.sides??6;c=he(Gt(d,i,o),s,i);break}case"star":{let d=e.arms??5,h=e.innerRadiusPercent??50;c=he(zr(d,i,h,o),s,i);break}case"cross":{let d=e.armWidthPercent??40;c=he(Gr(i,d,o),s,i);break}case"ring":{let d=e.innerRadiusPercent??50;c=Xr(i,d,a);break}case"spiral":{let d=e.turns??3,h=e.thicknessPercent??20,p=e.spiralDirection??1;c=Kr(i,d,h,p,o);break}case"gear":{let d=e.teeth??8,h=e.toothDepthPercent??30,p=e.holeRadiusPercent??0;c=Yr(d,i,h,s,p,a,o);break}case"arrow":{let d=e.headWidthPercent??100,h=e.headLengthPercent??30,p=e.shaftWidthPercent??40;c=he(Vr(i,d,h,p,o),s,i);break}case"speechBubble":{let d=e.tailAngleDeg??45,h=e.tailLengthPercent??40,p=e.tailWidthPercent??25;c=he(Ur(i,d,h,p,o),s,i);break}case"lightning":{let d=e.boltSegments??3,h=e.boltJaggednessPercent??40,p=e.boltWidthPercent??30;c=he(Wr(i,d,h,p,o),s,i);break}case"heart":{let d=e.lobeRadiusPercent??50,h=e.cleftDepthPercent??25;c=Hr(i,d,h,o);break}case"cloud":{let d=e.cloudBumps??5,h=e.cloudPuffinessPercent??60;c=jr(i,d,h,o);break}default:return`<!-- unsupported polygon shape: ${W(t.type)} -->`}let f="";return(t.type==="ring"||t.type==="gear")&&(f=y("fill-rule",a)),`<path${y("d",c)}${f}${pe(e,t.id)}${y("transform",u)}/>`}function ee(t){let e;switch(t.type){case"circle":e=Yi(t);break;case"ellipse":e=qi(t);break;case"rectangle":case"square":e=Zi(t);break;case"line":e=Qi(t);break;case"text":e=Ji(t);break;case"path":e=es(t);break;case"polyline":e=ts(t);break;case"image":e=rs(t);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=ss(t);break;case"diamond":case"parallelogram":case"trapezoid":case"terminator":case"cylinder":case"document-shape":e=is(t);break;case"hyperlink":e=Xc(t);break;case"switch":e=Kc(t);break;case"container":case"group":e=Yc(t);break;case"view":e=qc(t);break;case"svg":e=Zc(t);break;case"shape-reference":e=Qc(t);break;case"symbol-instance":e=ns(t);break;case"audio":case"video":e=Jc(t);break;default:return`<!-- unsupported shape type: ${W(t.type)} -->`}return jc(e,t.state)}function Xa(t,e){let r=(e.stops??[]).map(o=>{let a=`<stop${y("offset",`${o.offset*100}%`)}${y("stop-color",o.color)}`;return o.opacity!==void 0&&o.opacity<1&&(a+=y("stop-opacity",o.opacity)),a+="/>",a}).join(""),n=e.gradientUnits==="userSpaceOnUse",i=o=>n?String(o):`${o*100}%`,s=n?y("gradientUnits","userSpaceOnUse"):"";return`<linearGradient${y("id",t)}${s}${y("x1",i(e.x1))}${y("y1",i(e.y1))}${y("x2",i(e.x2))}${y("y2",i(e.y2))}${e.spreadMethod?y("spreadMethod",e.spreadMethod):""}>${r}</linearGradient>`}function Ka(t,e){let r=(e.stops??[]).map(f=>{let d=`<stop${y("offset",`${f.offset*100}%`)}${y("stop-color",f.color)}`;return f.opacity!==void 0&&f.opacity<1&&(d+=y("stop-opacity",f.opacity)),d+="/>",d}).join(""),n=e.gradientUnits==="userSpaceOnUse",i=f=>n?String(f):`${f*100}%`,s=n?y("gradientUnits","userSpaceOnUse"):"",o="",a=e.ry!==void 0&&e.ry!==e.r,u=!!e.rotation;if(a||u){let f=e.cx??(n?0:.5),d=e.cy??(n?0:.5),h=[];h.push(`translate(${f}, ${d})`),u&&h.push(`rotate(${e.rotation})`),a&&e.ry!==0&&h.push(`scale(1, ${e.ry/e.r})`),h.push(`translate(-${f}, -${d})`),o=y("gradientTransform",h.join(" "))}let c=e.fr!==void 0&&e.fr>0?y("fr",i(e.fr)):"";return`<radialGradient${y("id",t)}${s}${y("cx",i(e.cx))}${y("cy",i(e.cy))}${y("fx",i(e.fx))}${y("fy",i(e.fy))}${y("r",i(e.r))}${c}${e.spreadMethod?y("spreadMethod",e.spreadMethod):""}${o}>${r}</radialGradient>`}function Ya(t,e){if(e.svgContent!=null){let a=e.width??10,u=e.height??10,c=e.patternUnits??"userSpaceOnUse",f=e.patternContentUnits,d=e.patternTransform,h=e.viewBox,p=e.preserveAspectRatio,g=e.x??0,m=e.y??0,b=`<pattern${y("id",t)}`;return b+=y("patternUnits",c),f&&(b+=y("patternContentUnits",f)),g&&(b+=y("x",g)),m&&(b+=y("y",m)),b+=y("width",a),b+=y("height",u),h&&(b+=y("viewBox",h)),p&&(b+=y("preserveAspectRatio",p)),d&&(b+=y("patternTransform",d)),b+=`>${e.svgContent}</pattern>`,b}let r=10*(e.scale??1),n=e.rotation??0,i=e.color||"#000000",s=e.backgroundColor||"#ffffff",o="";return o+=`<rect${y("width",r)}${y("height",r)}${y("fill",s)}/>`,o+=ed(e.patternType,r,i),`<pattern${y("id",t)}${y("patternUnits","userSpaceOnUse")}${y("width",r)}${y("height",r)}${n?y("patternTransform",`rotate(${n})`):""}>${o}</pattern>`}function ed(t,e,r){return Ht(t,e,r).map(i=>{let s=Object.entries(i.attrs).map(([o,a])=>y(o,a)).join("");return`<${i.tag}${s}/>`}).join("")}function Se(t,e=[]){let r=Array.isArray(t)?Wt(t,e):t;if(r.ids.size===0&&r.legacyEndpoints.size===0)return"";let n="",i=je();for(let s of i){let o=s.id,a=o.replace("line-marker-",""),u=`mkr-builtin-${a}`,c=r.legacyEndpoints.has(a)||r.ids.has(o),f=r.ids.has(u);if(!c&&!f)continue;let d=s.element,h=Object.entries(d.attrs).map(([m,b])=>y(m,b)).join(""),p=`<${d.tag}${h}/>`,g=m=>{n+=`<marker${y("id",m)}${y("viewBox",jt)}${y("refX",s.refX)}${y("refY",s.refY)}${y("markerWidth",6)}${y("markerHeight",6)}${y("orient","auto-start-reverse")}>${p}</marker>`};c&&g(o),f&&g(u)}return n}var Ae=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),as=["linear-gradient","radial-gradient","pattern","filter","marker","symbol"];function os(t){switch(t.kind){case"symbol":return ls(t);case"marker":return us(t);case"linear-gradient":return cs(t);case"radial-gradient":return ds(t);case"pattern":return fs(t);case"filter":return hs(t)}}function ls(t){let e=t.shapes.map(i=>ee(i)).join(""),r=t.viewBox?` viewBox="${Ae(t.viewBox)}"`:"",n=t.overflow?` overflow="${Ae(t.overflow)}"`:"";return`<symbol id="${Ae(t.id)}"${r}${n}>${e}</symbol>`}function us(t){let e;if(t.builtIn){let s=je().find(o=>t.id.includes(o.id)||t.id===o.id);if(s){let o=Object.entries(s.element.attrs).map(([a,u])=>` ${a}="${Ae(String(u))}"`).join("");e=`<${s.element.tag}${o}/>`}else e=""}else e=t.shapes.map(s=>ee(s)).join("");let r=typeof t.orient=="number"?String(t.orient):t.orient,n=t.viewBox?` viewBox="${Ae(t.viewBox)}"`:"",i=t.overflow?` overflow="${Ae(t.overflow)}"`:"";return`<marker id="${Ae(t.id)}"${n} refX="${t.refX}" refY="${t.refY}" markerWidth="${t.markerWidth}" markerHeight="${t.markerHeight}" markerUnits="${Ae(t.markerUnits)}" orient="${Ae(r)}"${i}>${e}</marker>`}function cs(t){let e={...t.gradient,type:"linear-gradient",id:t.id};return Xa(t.id,e)}function ds(t){let e={...t.gradient,type:"radial-gradient",id:t.id};return Ka(t.id,e)}function fs(t){let e={...t.pattern,type:"pattern",id:t.id};return Ya(t.id,e)}function hs(t){return ji(t.id,t.filters,{colorInterpolation:t.colorInterpolation,filterUnits:t.filterUnits,primitiveUnits:t.primitiveUnits,x:t.x,y:t.y,width:t.width,height:t.height})}function Kt(t){let e=new Map;for(let n of t){let i=e.get(n.kind);i?i.push(n):e.set(n.kind,[n])}let r="";for(let n of as){let i=e.get(n);if(i)for(let s of i)r+=os(s)}return r}function Ee(t,e){let r=Yt(t,e);return r.length===0?"":Kt(r)}function Yt(t,e){let r=new Map;for(let u of e)r.set(u.id,u);let n=new Map,i=u=>{if(!u)return;let c=r.get(u);c&&n.set(u,c)},s=(u,c)=>{if(!u||typeof u!="object")return;let f=u;if(!f.id||n.has(f.id))return;let d=c==="linear-gradient"?"linear-gradient":c==="radial-gradient"?"radial-gradient":c==="pattern"?"pattern":null;if(!d)return;let{id:h,sourceId:p,...g}=u,m;if(d==="linear-gradient")m={kind:"linear-gradient",id:f.id,name:p??f.id,sourceId:p,gradient:g};else if(d==="radial-gradient")m={kind:"radial-gradient",id:f.id,name:p??f.id,sourceId:p,gradient:g};else{let{customPatternId:b,...x}=g;m={kind:"pattern",id:f.id,name:p??f.id,sourceId:p,pattern:x}}n.set(f.id,m)},o=(u,c)=>{let f=u.filters;if(!Array.isArray(f)||f.length===0)return;let d=`filter-${c}`;n.has(d)||n.set(d,{kind:"filter",id:d,name:d,filters:f,...u.filterColorInterpolation&&u.filterColorInterpolation!=="auto"?{colorInterpolation:u.filterColorInterpolation}:{},...u.filterUnits?{filterUnits:u.filterUnits}:{},...u.primitiveUnits?{primitiveUnits:u.primitiveUnits}:{},...typeof u.filterX=="string"?{x:u.filterX}:{},...typeof u.filterY=="string"?{y:u.filterY}:{},...typeof u.filterWidth=="string"?{width:u.filterWidth}:{},...typeof u.filterHeight=="string"?{height:u.filterHeight}:{}})},a=u=>{let c=u.state;if(!c)return;i(c.fillLibraryId),i(c.strokeLibraryId),i(c.markerStart),i(c.markerMid),i(c.markerEnd),i(c.symbolId);let f=c.filterLibraryIds;if(Array.isArray(f))for(let d of f)typeof d=="string"&&i(d);c.fillLibraryId||s(c.fillGradient,c.fillType),c.strokeLibraryId||s(c.strokeGradient,c.strokeType),(!Array.isArray(f)||f.length===0)&&o(c,u.id)};for(let u of t)a(u);return Ut(t,e,a),Array.from(n.values())}function ps(t){return t.easing==="custom-bezier"&&t.customBezier?t.customBezier:sr[t.easing]??null}function ms(t,e,r,n,i){if(t===e&&r===n)return i;let s=1e-6,o=8,a=p=>(((1-3*r+3*t)*p+(3*r-6*t))*p+3*t)*p,u=p=>(((1-3*n+3*e)*p+(3*n-6*e))*p+3*e)*p,c=p=>(3*(1-3*r+3*t)*p+2*(3*r-6*t))*p+3*t,f=i;for(let p=0;p<o;p++){let g=a(f)-i;if(Math.abs(g)<s)return u(f);let m=c(f);if(Math.abs(m)<s)break;f-=g/m}let d=0,h=1;for(f=i;d<h;){let p=a(f);if(Math.abs(p-i)<s)return u(f);i>p?d=f:h=f;let g=(h-d)*.5+d;if(g===f)break;f=g}return u(f)}function gs(t){let e=t.split(/\s+/).map(parseFloat);if(e.length!==4||e.some(o=>!Number.isFinite(o)))return t;let[r,n,i,s]=e;return`${1-i} ${1-s} ${1-r} ${1-n}`}function ie(t){return!Number.isFinite(t)||Math.abs(t)<1e-9?"0":Math.abs(t-1)<1e-9?"1":parseFloat(t.toFixed(6)).toString()}function fn([t,e,r,n]){let i=s=>Number.isFinite(s)?parseFloat(s.toFixed(6)).toString():"0";return`${i(t)} ${i(e)} ${i(r)} ${i(n)}`}function ys(t){return t.length>0&&t.every(e=>e==="0 0 1 1")}function qt(t){if(t.length<2)return!1;let e=t.length-1,r=1e-4;for(let n=0;n<t.length;n++){let i=n/e,s=parseFloat(t[n]);if(!Number.isFinite(s)||Math.abs(s-i)>r)return!1}return!0}function hn(t){if(t.length<2)return!1;let e=t.length-1,r=1e-4;for(let n=0;n<t.length;n++)if(Math.abs(t[n]-n/e)>r)return!1;return!0}function Be(t){let e=t.cycleDuration??(t.keyframes.length>0?t.keyframes[t.keyframes.length-1].time:0);return t.cycleBehavior==="alternate"?e*2:e}function Xe(t){let e=t.beginTrigger;if(e)switch(e.type){case"time":{let n=parseFloat(e.value);return Number.isNaN(n)?"":Number.isFinite(n)?n!==0?`${n}s`:"":"indefinite"}case"event":return e.value;case"expression":return"";default:break}let r=t.keyframes[0]?.time??0;return r!==0?`${r}s`:""}function pn(t){return t.keyframes.length===1&&t.cycleDuration===void 0}function mn(t){return t.calcMode!=="discrete"?!1:t.sourceSmilElement==="set"?!0:!t.sourceSmilElement&&!t.cycleInfinite&&t.keyframes.every(e=>e.easing!=="steps")}function gn(t,e){if(e<=0)return Xe(t);if(Xe(t)==="indefinite")return"indefinite";let r=t.keyframes[e]?.time??0;return r!==0?`${r}s`:""}function yn(t){return t.cycleInfinite?"indefinite":t.cycleRepeats&&t.cycleRepeats>1?String(t.cycleRepeats):null}function Ke(t){return t.cycleInfinite||t.fill==="remove"?null:"freeze"}function bn(t){return t.additive==="sum"?"sum":null}function xn(t){return t.keyframes.map(e=>{let r=typeof e.value=="number"?e.value:parseFloat(String(e.value));return Number.isFinite(r)?Math.max(0,Math.min(1,r)):0})}function td(t){let e=r=>Math.max(0,Math.min(1,r));return[t[0],e(t[1]),t[2],e(t[3])]}function rd(t){let[e,r,n,i]=t,s=new Set,o=8;for(let d=1;d<=o;d++)s.add(d/o);let a=r-2*i+1,u=2*(i-2*r),c=r,f=d=>{if(!Number.isFinite(d)||d<=0||d>=1)return;let h=3*(1-d)**2*d*e+3*(1-d)*d**2*n+d**3;h>0&&h<1&&s.add(Number(h.toFixed(6)))};if(Math.abs(a)<1e-9)Math.abs(u)>=1e-9&&f(-c/u);else{let d=u*u-4*a*c;if(d>=0){let h=Math.sqrt(d);f((-u+h)/(2*a)),f((-u-h)/(2*a))}}return[...s].sort((d,h)=>d-h)}function nd(t,e,r,n,i,s){let o=typeof t.value=="number"&&typeof e.value=="number",a=Le(e.value);if(e.easing==="linear-function"&&e.linearPoints&&e.linearPoints.length>=2){if(o){let b=e.linearPoints;for(let x=1;x<b.length;x++){let S=b[x],$=t.time+(e.time-t.time)*S.position,v=t.value+(e.value-t.value)*S.value;n.push(v),i.push(ie(r($))),s.push("0 0 1 1")}return}n.push(a),i.push(ie(r(e.time))),s.push("0 0 1 1");return}if(e.easing==="steps"){n.push(a),i.push(ie(r(e.time))),s.push("0 0 1 1");return}let u=ps(e);if(!u){n.push(a),i.push(ie(r(e.time))),s.push("0 0 1 1");return}let[,c,,f]=u;if(!(c<0||c>1||f<0||f>1)){n.push(a),i.push(ie(r(e.time))),s.push(fn(u));return}if(!o){n.push(a),i.push(ie(r(e.time))),s.push(fn(td(u)));return}let h=rd(u),p=t.value,g=e.value,m=e.time-t.time;for(let b of h){let x=ms(u[0],u[1],u[2],u[3],b),S=t.time+m*b,$=p+(g-p)*x;n.push($),i.push(ie(r(S))),s.push("0 0 1 1")}}function Le(t){return Array.isArray(t)?t.join(" "):t}function id(t,e,r){let n=[],{count:i,position:s}=r,o=e.time-t.time,a=Le(t.value),u=Le(e.value),c=typeof a=="number"&&typeof u=="number",f=typeof a=="string"&&typeof u=="string",d=g=>f?g<.5?a:u:c?a+(u-a)*g:g>=1?u:a,h=g=>{let m=Math.floor(g*i);(s==="jump-start"||s==="jump-both")&&(m+=1);let b;switch(s){case"jump-start":case"jump-end":b=i;break;case"jump-none":b=i-1;break;case"jump-both":b=i+1;break}return m>b&&(m=b),m<0&&(m=0),m/b},p=h(0);for(let g=1;g<=i;g++){let m=g/i,b=h(m);if(b===p)continue;let x=t.time+m*o;n.push({value:d(b),time:x}),p=b}return n.length===0||n[n.length-1].time<e.time?n.push({value:u,time:e.time}):n[n.length-1]={value:u,time:e.time},n}function sd(t,e){let r=[],n=[],i=(s,o)=>{r.push(s),n.push(ie(e(o)))};i(Le(t[0].value),t[0].time);for(let s=1;s<t.length;s++){let o=t[s-1],a=t[s];if(a.easing==="steps"&&a.stepsParams){let u=id(o,a,a.stepsParams);for(let c of u)i(c.value,c.time)}else i(Le(a.value),a.time)}return{values:r,keyTimes:n}}function dn(t,e,r,n,i){if(i.cycleBehavior!=="alternate"||t.length<2)return{values:t,keyTimes:e,keySplines:r,calcMode:n};let s=t.slice(0,-1).reverse(),o=e.slice(0,-1).reverse().map(u=>ie(1-parseFloat(u))),a=r.slice().reverse().map(gs);return{values:[...t,...s],keyTimes:[...e,...o],keySplines:[...r,...a],calcMode:n}}function Ne(t){let e=t.keyframes;if(e.length===0)return{values:[],keyTimes:[],keySplines:[],calcMode:"spline"};let r=Be(t),n=e[0]?.time??0,i=c=>r>0?(c-n)/r:0;if(e.some(c=>c.easing==="steps")){let{values:c,keyTimes:f}=sd(e,i);return dn(c,f,[],"discrete",t)}if(t.calcMode==="discrete"){let c=e.map(d=>Le(d.value)),f=e.map(d=>ie(i(d.time)));return dn(c,f,[],"discrete",t)}if(t.calcMode==="paced"){let c=e.map(d=>Le(d.value)),f=e.map(d=>ie(i(d.time)));return dn(c,f,[],"paced",t)}let o=[Le(e[0].value)],a=[ie(i(e[0].time))],u=[];for(let c=1;c<e.length;c++)nd(e[c-1],e[c],i,o,a,u);return dn(o,a,u,"spline",t)}function Zt(t,e={}){let r=e.defaultCalcMode??"linear",n={};if(t.calcMode==="paced")return r!=="paced"&&(n.calcMode="paced"),n;if(t.calcMode==="discrete")return n.keyTimes=t.keyTimes.join(";"),n.calcMode="discrete",n;let i=t.keySplines.length>0&&!ys(t.keySplines);return qt(t.keyTimes)||(n.keyTimes=t.keyTimes.join(";")),i&&(n.calcMode="spline",n.keySplines=t.keySplines.join(";")),n}function bs(t,e){if(t.shapeId!==e.shapeId||t.keyframes.length!==e.keyframes.length||(t.cycleDuration??-1)!==(e.cycleDuration??-1)||(t.cycleRepeats??1)!==(e.cycleRepeats??1)||!!t.cycleInfinite!=!!e.cycleInfinite||(t.cycleBehavior??"restart")!==(e.cycleBehavior??"restart")||(t.additive??"replace")!==(e.additive??"replace")||(t.calcMode??"linear")!==(e.calcMode??"linear")||!!t.locked!=!!e.locked)return!1;let r=(n,i)=>!n&&!i||!!n&&!!i&&n.type===i.type&&n.value===i.value;if(!r(t.beginTrigger,e.beginTrigger)||!r(t.endTrigger,e.endTrigger))return!1;for(let n=0;n<t.keyframes.length;n++){let i=t.keyframes[n],s=e.keyframes[n];if(i.time!==s.time||i.easing!==s.easing)return!1;let o=i.customBezier,a=s.customBezier;if(!!o!=!!a)return!1;if(o&&a){for(let u=0;u<4;u++)if(o[u]!==a[u])return!1}if(JSON.stringify(i.linearPoints??null)!==JSON.stringify(s.linearPoints??null)||JSON.stringify(i.stepsParams??null)!==JSON.stringify(s.stepsParams??null))return!1}return!0}function Sn(t){let e=new Map,r=new Set,n=new Map;for(let i of t){if(!i.enabled||i.keyframes.length<2||i.property!=="translateX"&&i.property!=="translateY"&&i.property!=="scaleX"&&i.property!=="scaleY")continue;let s=n.get(i.shapeId)??[];s.push(i),n.set(i.shapeId,s)}for(let i of n.values()){let s=new Set;for(let o=0;o<i.length;o++){let a=i[o];if(s.has(a.id))continue;let u=a.property==="translateX"||a.property==="translateY",c=u?"translateX":"scaleX",f=u?"translateY":"scaleY";if(!(a.property!==c&&a.property!==f))for(let d=o+1;d<i.length;d++){let h=i[d];if(s.has(h.id)||!(a.property===c&&h.property===f||a.property===f&&h.property===c)||!bs(a,h))continue;let p=a.property===c?a:h,g=a.property===f?a:h;e.set(p.id,g),r.add(g.id),s.add(p.id),s.add(g.id);break}}}return{partner:e,skip:r}}function $n(t,e,r,n){if(n){let s=e?n.values:t.values,o=e?t.values:n.values,a=Math.min(s.length,o.length),u=[];for(let c=0;c<a;c++)u.push(`${s[c]} ${o[c]}`);return u}let i=r?"1":"0";return t.values.map(s=>e?`${i} ${s}`:`${s} ${i}`)}var Za={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",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",display:"display",visibility:"visibility",borderWidth:"stroke-width",cornerRadius:"rx",fontSize:"font-size",letterSpacing:"letter-spacing",wordSpacing:"word-spacing",textLength:"textLength",d:"d",pathMorph:"d",polylinePoints:"points"},Qa=new Set(["transformMatrix","rotation","skewX","skewY"]),Ja=new Set(["translateX","translateY","scaleX","scaleY"]);function vn(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function z(t,e){return e==null?"":` ${t}="${vn(e)}"`}function xs(t,e){let r=Zt(t,e);return z("keyTimes",r.keyTimes)+z("calcMode",r.calcMode)+z("keySplines",r.keySplines)}function Tn(t,e){return z("dur",`${e}s`)+z("begin",Xe(t)||null)+z("repeatCount",yn(t))}function ad(t){let e=Za[t.property];if(!e)return"";let r=Be(t);if(r<=0)return"";let n=Ne(t);return n.values.length<2?"":"<animate"+z("attributeName",e)+z("values",n.values.join(";"))+xs(n)+Tn(t,r)+z("fill",Ke(t))+"/>"}function od(t){let e;switch(t.property){case"transformMatrix":e="matrix";break;case"rotation":e="rotate";break;case"skewX":e="skewX";break;case"skewY":e="skewY";break;default:return""}let r=Be(t);if(r<=0)return"";let n=Ne(t),i=e==="matrix"?n.values.map(o=>ud(o)):n.values.map(o=>String(o));if(i.length<2||i.some(o=>o.length===0))return"";let s=e==="rotate"&&t.transformOrigin?i.map(o=>`${o} ${t.transformOrigin.x} ${t.transformOrigin.y}`):i;return'<animateTransform attributeName="transform"'+z("type",e)+z("values",s.join(";"))+xs(n)+Tn(t,r)+z("additive",bn(t))+z("fill",Ke(t))+"/>"}function ld(t,e,r){let n=t.property==="scaleX"||t.property==="scaleY",i=t.property==="translateY"||t.property==="scaleY",s=n?"scale":"translate",o=Be(t);if(o<=0)return"";let a=Ne(t);if(a.values.length<2)return"";let u=e?Ne(e):void 0,c=$n(a,i,n,u);if(c.length<2)return"";let f=!t.replacesCarrierBase||r?"sum":null;return'<animateTransform attributeName="transform"'+z("type",s)+z("values",c.join(";"))+xs(a)+Tn(t,o)+z("additive",f)+z("fill",Ke(t))+"/>"}function ud(t){if(Array.isArray(t)&&t.length>=6){let e=t.slice(0,6);if(e.every(r=>typeof r=="number"&&Number.isFinite(r)))return e.join(" ")}if(typeof t=="string"){let e=t.trim(),r=/^matrix\(([^)]+)\)$/i.exec(e),i=(r?r[1]:e).split(/[\s,]+/).filter(Boolean).map(Number);if(i.length>=6&&i.slice(0,6).every(Number.isFinite))return i.slice(0,6).join(" ")}return""}function cd(t){if(!t.motionPath)return"";let e=Be(t);if(e<=0)return"";let r=Ne(t),n=xn(t),i=!!t.motionPathRef&&(t.motionPathRef.mode??"trackShape")==="curveTemplate",s=Zt(r,{defaultCalcMode:"paced"}),o=hn(n)&&qt(r.keyTimes)&&r.calcMode!=="discrete"&&s.calcMode===void 0,a="<animateMotion";return i||(a+=z("path",t.motionPath)),a+=z("keyTimes",s.keyTimes),o||(a+=z("keyPoints",n.join(";"))),a+=z("calcMode",s.calcMode)+z("keySplines",s.keySplines),a+=Tn(t,e),a+=z("fill",Ke(t)),t.motionRotate!==void 0&&(a+=z("rotate",typeof t.motionRotate=="number"?String(t.motionRotate):t.motionRotate)),i?a+=`><mpath href="#${vn(t.motionPathRef.shapeId)}"/></animateMotion>`:a+="/>",a}function qa(t,e){if(Qa.has(t.property)||Ja.has(t.property)||t.property==="pathMotion")return"";let r=Za[t.property];if(!r)return"";let n=t.keyframes[e];return n?"<set"+z("attributeName",r)+z("to",Array.isArray(n.value)?n.value.join(" "):String(n.value))+z("begin",gn(t,e)||null)+"/>":""}function dd(t){let e=Xe(t);return e?`<discard begin="${vn(e)}"/>`:"<discard/>"}function kn(t){let e=new Map,r=t.tracks.map(a=>({...a,locked:a.locked??!1,keyframes:[...a.keyframes].sort((u,c)=>u.time-c.time).map(u=>({...u,time:u.time,value:u.value,easing:u.easing}))})),n=Sn(r),i=new Set,s=new Set,o=(a,u,c)=>{if(!u)return;let f=u;c.sourceSmilId&&!i.has(c.sourceSmilId)&&(i.add(c.sourceSmilId),f=u.replace(/^(<[a-zA-Z]+)/,`$1 id="${vn(c.sourceSmilId)}"`));let d=e.get(a)??[];d.push(f),e.set(a,d)};for(let a of r){if(!a.enabled||n.skip.has(a.id)||a.keyframes.length<1)continue;if(a.property==="discard"){o(a.shapeId,dd(a),a);continue}if(pn(a)){o(a.shapeId,qa(a,0),a);continue}if(mn(a)){for(let c=0;c<a.keyframes.length;c++)o(a.shapeId,qa(a,c),a);continue}if(a.keyframes.length<2)continue;let u="";a.property==="pathMotion"&&a.motionPath?u=cd(a):Qa.has(a.property)?(u=od(a),u&&s.add(a.shapeId)):Ja.has(a.property)?(u=ld(a,n.partner.get(a.id),s.has(a.shapeId)),u&&s.add(a.shapeId)):u=ad(a),o(a.shapeId,u,a)}return e}function dt(t,e={}){let{xmlDeclaration:r=!0,backgroundColor:n,indent:i=!0,className:s}=e,o=t.viewboxes?.[0],a=e.width??o?.width??800,u=e.height??o?.height??600,c=e.viewBox??`0 0 ${a} ${u}`,f=i?`
|
|
13
|
-
`:"",d=i?" ":"",h=t.shapes??[],p=h.filter(C=>C.state?.displayMode==="motionOnly"),g=h.filter(C=>C.state?.displayMode!=="motionOnly"),m=md(t),b=gd(t),x=[...Array.isArray(t.library)?t.library:[],...(b??[]).filter(C=>!C.builtIn&&!(Array.isArray(t.library)&&t.library.some(L=>L.id===C.id)))],S=Yt(g,x),$=S.length>0?Kt(S):"",v=Se(g,x),k=yd(m,g,new Set(S.map(C=>C.id))),P=fd(p),T=$.length>0||v.length>0||k.length>0||P.length>0,w="";T&&(w=`${f}${d}<defs>${f}`,$.length>0&&(w+=`${d}${d}${$}${f}`),v.length>0&&(w+=`${d}${d}${v}${f}`),k.length>0&&(w+=`${d}${d}${k}${f}`),P.length>0&&(w+=`${d}${d}${P}${f}`),w+=`${d}</defs>`);let R="";n&&(R=`${f}${d}<rect width="${a}" height="${u}" fill="${n}"/>`);let F=t.animationTimeline?kn(t.animationTimeline):null,B=g.map(C=>{let L=ee(C),G=F?.get(C.id);return G&&G.length>0&&(L=bd(L,G,d)),`${d}${L}`}).join(f),E="";return r&&(E+=`<?xml version="1.0" encoding="UTF-8"?>${f}`),E+='<svg xmlns="http://www.w3.org/2000/svg"',E+=` width="${a}" height="${u}"`,E+=` viewBox="${c}"`,s&&(E+=` class="${s}"`),E+=">",E+=w,E+=R,g.length>0&&(E+=`${f}${B}`),E+=`${f}</svg>${f}`,E}function fd(t){if(t.length===0)return"";let e=[];for(let r of t){let n=hd(r);if(!n)continue;let i=pd(n);e.push(`<path id="${eo(r.id)}" d="${eo(i)}"/>`)}return e.join("")}function hd(t){let e=t.state;if(typeof e?.d=="string")return e.d;switch(t.type){case"rectangle":{let r=e?.x??0,n=e?.y??0,i=e?.width??0,s=e?.height??0;return i<=0||s<=0?null:`M${r},${n}h${i}v${s}h${-i}Z`}case"circle":{let r=e?.cx??0,n=e?.cy??0,i=e?.radius??0;return i<=0?null:`M${r-i},${n}A${i},${i} 0 1 0 ${r+i},${n}A${i},${i} 0 1 0 ${r-i},${n}Z`}case"ellipse":{let r=e?.cx??0,n=e?.cy??0,i=e?.rx??0,s=e?.ry??0;return i<=0||s<=0?null:`M${r-i},${n}A${i},${s} 0 1 0 ${r+i},${n}A${i},${s} 0 1 0 ${r-i},${n}Z`}case"line":{let r=e?.x1??0,n=e?.y1??0,i=e?.x2??0,s=e?.y2??0;return`M${r},${n}L${i},${s}`}default:return null}}function pd(t){let e=/[Mm]\s*(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)[\s,]+(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/.exec(t);if(!e)return t;let r=parseFloat(e[1]),n=parseFloat(e[2]);if(!isFinite(r)||!isFinite(n)||r===0&&n===0)return t;let i=!0;return t.replace(/([MLCQSTHVAZ])\s*([\d\s.,e+-]*)/gi,(s,o,a)=>{let u=o.toUpperCase(),c=o!==u,f=i;if(i=!1,u==="Z")return s;let d=a.trim().split(/[\s,]+/).filter(p=>p.length>0).map(Number);if(d.length===0||c&&!f)return s;let h=[];if(u==="H")for(let p of d)h.push(p-r);else if(u==="V")for(let p of d)h.push(p-n);else if(u==="A")for(let p=0;p<d.length;p+=7)h.push(d[p],d[p+1],d[p+2],d[p+3],d[p+4]),p+5<d.length&&h.push(d[p+5]-r),p+6<d.length&&h.push(d[p+6]-n);else for(let p=0;p<d.length;p+=2)h.push(d[p]-r),p+1<d.length&&h.push(d[p+1]-n);return`${o} ${h.join(" ")}`})}function eo(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}function md(t){let r=(Array.isArray(t.library)?t.library:[]).filter(n=>n.kind==="symbol");return r.length>0?r:t.symbols??[]}function gd(t){let r=(Array.isArray(t.library)?t.library:[]).filter(n=>n.kind==="marker");return r.length>0?r:t.markers}var Ss=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function yd(t,e,r=new Set){if(t.length===0)return"";let n=new Map;for(let u of t)n.set(u.id,u);let i=new Map,s=new Set,o=[...e];for(let u=0;u<o.length;u++){let c=o[u],f=c.state?.children;if(Array.isArray(f)&&o.push(...f),c.type!=="symbol-instance")continue;let d=n.get(c.state.symbolId??"");if(!d)continue;let h=ut(c);if(s.has(h))continue;s.add(h);let p=on(d,c);o.push(...p),!r.has(h)&&i.set(h,{def:d,resolved:p})}if(i.size===0)return"";let a=[];for(let[u,{def:c,resolved:f}]of i){let d=f.map(g=>ee(g)).join(""),h=c.viewBox?` viewBox="${Ss(c.viewBox)}"`:"",p=c.overflow?` overflow="${Ss(c.overflow)}"`:"";a.push(`<symbol id="${Ss(u)}"${h}${p}>${d}</symbol>`)}return a.join("")}function bd(t,e,r){let n=e.join(""),i=0;for(;i<t.length;){let c=t.slice(i);if(!/^<defs[\s>]/.test(c))break;let f=t.indexOf("</defs>",i);if(f===-1)break;i=f+7}let s=t.slice(0,i),o=t.slice(i),a=o.lastIndexOf("/>");if(a!==-1){let c=o.match(/^<(\w+)/),f=c?c[1]:"g";return s+o.slice(0,a)+">"+n+`</${f}>`}let u=o.match(/<\/(\w+)>$/);if(u){let c=o.lastIndexOf(`</${u[1]}>`);return s+o.slice(0,c)+n+o.slice(c)}return s+o+n}var ft=Math.PI*2;function xd(t,e,r,n){let i=e*e-4*t*r;if(!(i>=0))return;let s=Math.sqrt(i),o=-.5*(e+(e>=0?s:-s));if(t!==0){let a=o/t;a>0&&a<1&&n.push(a)}if(o!==0){let a=r/o;a>0&&a<1&&n.push(a)}}function Sd(t,e,r,n,i){let s=1-i;return s*s*s*t+3*s*s*i*e+3*s*i*i*r+i*i*i*n}function $d(t,e,r,n){let i=1-n;return i*i*t+2*i*n*e+n*n*r}function _n(t,e,r,n){let i=t<n?t:n,s=t>n?t:n,o=-t+3*e-3*r+n,a=2*(t-2*e+r),u=e-t,c=[];xd(o,a,u,c);for(let f of c){let d=Sd(t,e,r,n,f);d<i&&(i=d),d>s&&(s=d)}return{min:i,max:s}}function Rn(t,e,r){let n=t<r?t:r,i=t>r?t:r,s=t-2*e+r;if(s!==0){let o=(t-e)/s;if(o>0&&o<1){let a=$d(t,e,r,o);a<n&&(n=a),a>i&&(i=a)}}return{min:n,max:i}}function to(t,e,r,n){let i=t*n-e*r>=0?1:-1,s=Math.sqrt((t*t+e*e)*(r*r+n*n));if(s===0)return 0;let o=(t*r+e*n)/s;return o<-1?o=-1:o>1&&(o=1),i*Math.acos(o)}function vs(t,e,r,n,i,s,o,a,u){if(t===a&&e===u||r===0||n===0)return null;let c=Math.abs(r),f=Math.abs(n),d=i%360*Math.PI/180,h=Math.cos(d),p=Math.sin(d),g=(t-a)/2,m=(e-u)/2,b=h*g+p*m,x=-p*g+h*m,S=b*b,$=x*x,v=c*c,k=f*f,P=S/v+$/k;if(P>1){let re=Math.sqrt(P);c*=re,f*=re,v=c*c,k=f*f}let T=v*$+k*S;if(T===0)return null;let w=(v*k-T)/T;w<0&&(w=0);let R=Math.sqrt(w);s===o&&(R=-R);let F=R*(c*x/f),B=R*(-(f*b)/c),E=h*F-p*B+(t+a)/2,C=p*F+h*B+(e+u)/2,L=(b-F)/c,G=(x-B)/f,A=(-b-F)/c,Y=(-x-B)/f,j=to(1,0,L,G),U=to(L,G,A,Y);return!o&&U>0?U-=ft:o&&U<0&&(U+=ft),{cx:E,cy:C,rx:c,ry:f,phi:d,theta1:j,deltaTheta:U}}function vd(t,e){let r=Math.cos(t.phi),n=Math.sin(t.phi),i=Math.cos(e),s=Math.sin(e);return{x:t.cx+t.rx*r*i-t.ry*n*s,y:t.cy+t.rx*n*i+t.ry*r*s}}function Td(t,e,r){if(r>=0){let i=(t-e)%ft;return i<0&&(i+=ft),i<=r}let n=(e-t)%ft;return n<0&&(n+=ft),n<=-r}function Ts(t,e,r,n,i,s,o,a,u){let c={minX:Math.min(t,a),minY:Math.min(e,u),maxX:Math.max(t,a),maxY:Math.max(e,u)},f=vs(t,e,r,n,i,s,o,a,u);if(!f)return c;let d=Math.cos(f.phi),h=Math.sin(f.phi),p=Math.atan2(-f.ry*h,f.rx*d),g=Math.atan2(f.ry*d,f.rx*h),m=[p,p+Math.PI,g,g+Math.PI];for(let b of m){if(!Td(b,f.theta1,f.deltaTheta))continue;let x=vd(f,b);x.x<c.minX&&(c.minX=x.x),x.x>c.maxX&&(c.maxX=x.x),x.y<c.minY&&(c.minY=x.y),x.y>c.maxY&&(c.maxY=x.y)}return c}var kd="MmLlHhVvCcSsQqTtAaZz";function wn(t){return t>=48&&t<=57}function wd(t){return t===32||t===9||t===10||t===12||t===13}var $s=class{constructor(e){this.d=e}d;i=0;skipWsp(){for(;this.i<this.d.length&&wd(this.d.charCodeAt(this.i));)this.i++}skipCommaWsp(){this.skipWsp(),this.d.charCodeAt(this.i)===44&&(this.i++,this.skipWsp())}atEnd(){return this.skipWsp(),this.i>=this.d.length}readCommand(){this.skipWsp();let e=this.d[this.i];return e!==void 0&&kd.indexOf(e)>=0?(this.i++,e):null}nextIsNumber(){this.skipCommaWsp();let e=this.d.charCodeAt(this.i);return wn(e)||e===43||e===45||e===46}readNumber(){this.skipCommaWsp();let e=this.d,r=this.i,n=this.i,i=e.charCodeAt(n);(i===43||i===45)&&n++;let s=0;for(;n<e.length&&wn(e.charCodeAt(n));)n++,s++;if(e.charCodeAt(n)===46)for(n++;n<e.length&&wn(e.charCodeAt(n));)n++,s++;if(s===0)return null;let o=e.charCodeAt(n);if(o===101||o===69){let u=n+1,c=e.charCodeAt(u);(c===43||c===45)&&u++;let f=0;for(;u<e.length&&wn(e.charCodeAt(u));)u++,f++;f>0&&(n=u)}let a=Number.parseFloat(e.slice(r,n));return Number.isFinite(a)?(this.i=n,a):null}readFlag(){this.skipCommaWsp();let e=this.d[this.i];return e==="0"?(this.i++,!1):e==="1"?(this.i++,!0):null}};function Pn(t,e,r){e<t.minX&&(t.minX=e),e>t.maxX&&(t.maxX=e),r<t.minY&&(t.minY=r),r>t.maxY&&(t.maxY=r),t.any=!0}function ks(t,e){e.minX<t.minX&&(t.minX=e.minX),e.maxX>t.maxX&&(t.maxX=e.maxX),e.minY<t.minY&&(t.minY=e.minY),e.maxY>t.maxY&&(t.maxY=e.maxY),t.any=!0}function ro(t,e,r,n,i,s,o,a,u){let c=_n(e,n,s,a),f=_n(r,i,o,u);ks(t,{minX:c.min,maxX:c.max,minY:f.min,maxY:f.max})}function no(t,e,r,n,i,s,o){let a=Rn(e,n,s),u=Rn(r,i,o);ks(t,{minX:a.min,maxX:a.max,minY:u.min,maxY:u.max})}function ws(t){if(!t)return null;let e=new $s(t),r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,any:!1},n=0,i=0,s=0,o=0,a=0,u=0,c=null,f="",d=!1,h=()=>r.any?{minX:r.minX,minY:r.minY,maxX:r.maxX,maxY:r.maxY}:null;for(;!e.atEnd();){let p=e.readCommand();if(p!==null)f=p;else if(f===""||f==="Z"||f==="z"||!e.nextIsNumber())break;if(!d){if(f!=="M"&&f!=="m")return null;d=!0}let g=f>="a"&&f<="z";switch(f){case"M":case"m":{let m=e.readNumber(),b=e.readNumber();if(m===null||b===null)return h();n=g?n+m:m,i=g?i+b:b,s=n,o=i,Pn(r,n,i),c=null,f=g?"l":"L";break}case"L":case"l":{let m=e.readNumber(),b=e.readNumber();if(m===null||b===null)return h();n=g?n+m:m,i=g?i+b:b,Pn(r,n,i),c=null;break}case"H":case"h":{let m=e.readNumber();if(m===null)return h();n=g?n+m:m,Pn(r,n,i),c=null;break}case"V":case"v":{let m=e.readNumber();if(m===null)return h();i=g?i+m:m,Pn(r,n,i),c=null;break}case"C":case"c":{let m=e.readNumber(),b=e.readNumber(),x=e.readNumber(),S=e.readNumber(),$=e.readNumber(),v=e.readNumber();if(m===null||b===null||x===null||S===null||$===null||v===null)return h();let k=g?n+m:m,P=g?i+b:b,T=g?n+x:x,w=g?i+S:S,R=g?n+$:$,F=g?i+v:v;ro(r,n,i,k,P,T,w,R,F),a=T,u=w,c="cubic",n=R,i=F;break}case"S":case"s":{let m=e.readNumber(),b=e.readNumber(),x=e.readNumber(),S=e.readNumber();if(m===null||b===null||x===null||S===null)return h();let $=c==="cubic"?2*n-a:n,v=c==="cubic"?2*i-u:i,k=g?n+m:m,P=g?i+b:b,T=g?n+x:x,w=g?i+S:S;ro(r,n,i,$,v,k,P,T,w),a=k,u=P,c="cubic",n=T,i=w;break}case"Q":case"q":{let m=e.readNumber(),b=e.readNumber(),x=e.readNumber(),S=e.readNumber();if(m===null||b===null||x===null||S===null)return h();let $=g?n+m:m,v=g?i+b:b,k=g?n+x:x,P=g?i+S:S;no(r,n,i,$,v,k,P),a=$,u=v,c="quad",n=k,i=P;break}case"T":case"t":{let m=e.readNumber(),b=e.readNumber();if(m===null||b===null)return h();let x=c==="quad"?2*n-a:n,S=c==="quad"?2*i-u:i,$=g?n+m:m,v=g?i+b:b;no(r,n,i,x,S,$,v),a=x,u=S,c="quad",n=$,i=v;break}case"A":case"a":{let m=e.readNumber(),b=e.readNumber(),x=e.readNumber(),S=e.readFlag(),$=e.readFlag(),v=e.readNumber(),k=e.readNumber();if(m===null||b===null||x===null||S===null||$===null||v===null||k===null)return h();let P=g?n+v:v,T=g?i+k:k;ks(r,Ts(n,i,m,b,x,S,$,P,T)),n=P,i=T,c=null;break}case"Z":case"z":{n=s,i=o,c=null;break}default:return h()}}return h()}function io(t,e,r=!1,n=.5,i){return t.length===0?null:ws(Fe(t,e,r,n,i))}function An(t,e){let r=be(t,e);return dt(t,{width:r.width,height:r.height,xmlDeclaration:e.xmlDeclaration??!1,indent:!0})}function Pd(t){return t==="class"?"className":t==="for"?"htmlFor":t.replace(/-([a-z])/g,(e,r)=>r.toUpperCase())}function so(t){return t.replace(/\s([a-z][a-z-]*?)=/g,(e,r)=>r.startsWith("data-")||r.startsWith("aria-")?e:` ${Pd(r)}=`)}function Mn(t,e){let r=e.componentName??"SvgComponent",n=be(t,e),i=e.indent??" ",s=t.shapes??[],o=e.typescript??!1,a=Array.isArray(t.library)?t.library:[],u=Ee(s,a),c=Se(s,a),f=u+c,d=f.length>0,h=s.map(g=>{let m=ee(g);return`${i}${i}${i}${so(m)}`}),p=[];p.push("import React from 'react';"),p.push(""),o?(p.push(`interface ${r}Props {`),p.push(`${i}className?: string;`),p.push(`${i}style?: React.CSSProperties;`),p.push("}"),p.push(""),p.push(`const ${r}: React.FC<${r}Props> = ({ className, style }) => {`)):p.push(`const ${r} = ({ className, style }) => {`),p.push(`${i}return (`),p.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&&(p.push(`${i}${i}${i}<defs>`),p.push(`${i}${i}${i}${i}${so(f)}`),p.push(`${i}${i}${i}</defs>`));for(let g of h)p.push(g);return p.push(`${i}${i}</svg>`),p.push(`${i});`),p.push("};"),p.push(""),p.push(`export default ${r};`),p.push(""),p.join(`
|
|
14
|
-
`)}function
|
|
15
|
-
`)}var
|
|
16
|
-
`)}function
|
|
17
|
-
${
|
|
11
|
+
${a}`)}}return s}function Oc(t){return[...t].sort((e,r)=>e.id.localeCompare(r.id))}function ct(t){if(t==null)return t;if(Array.isArray(t))return t.map(ct);if(typeof t!="object")return t;let e={},r=Object.keys(t).sort();for(let n of r)e[n]=ct(t[n]);return e}function Lc(t){let e={};return e.id=t.id,e.type=t.type,e.state=ct(t.state),e}var _e=/\{\{\s*([\w.\-]+)\s*\}\}/g;function cn(t,e){return t.replace(_e,(r,n)=>{let i=e[n];return i!==void 0?String(i):r})}function pn(t,e={}){let r={};if(t.templateVariables)for(let i of t.templateVariables)i.defaultValue!==void 0&&i.defaultValue!==""&&(r[i.name]=i.defaultValue);if(Object.assign(r,e),Object.keys(r).length===0)return JSON.parse(JSON.stringify(t));let n=JSON.parse(JSON.stringify(t));for(let i of n.shapes)dn(i.state,r);if(n.documentMetadata){let i=n.documentMetadata;dn(i,r)}return n}function dn(t,e){for(let r of Object.keys(t)){let n=t[r];if(typeof n=="string"){if(_e.lastIndex=0,_e.test(n)){_e.lastIndex=0;let i=cn(n,e);if(Nc(n)){let s=Number(i);if(!isNaN(s)&&zc(r)){t[r]=s;continue}}t[r]=i}}else if(Array.isArray(n))for(let i=0;i<n.length;i++)typeof n[i]=="string"?(_e.lastIndex=0,_e.test(n[i])&&(_e.lastIndex=0,n[i]=cn(n[i],e))):n[i]!==null&&typeof n[i]=="object"&&dn(n[i],e);else n!==null&&typeof n=="object"&&dn(n,e)}}function Nc(t){return/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/.test(t)}var Bc=new Set(["x","y","width","height","radius","rx","ry","cx","cy","x1","y1","x2","y2","fontSize","borderWidth","cornerRadius","opacity","fillOpacity","strokeOpacity",...Lt,"letterSpacing","wordSpacing","lineHeight","sides","arms","innerRadiusPercent","armWidthPercent","teeth","toothDepthPercent","holeRadiusPercent","turns","thicknessPercent","direction","headWidthPercent","headLengthPercent","shaftWidthPercent","shiftAngle","dashLength","gapLength","textPathStartOffset","imageOpacity"]);function zc(t){return Bc.has(t)}function mn(t){let e=t.templateVariables??[],r=new Set(e.map(s=>s.name)),n=new Set;for(let s of t.shapes)fn(s.state,n);t.documentMetadata&&fn(t.documentMetadata,n);let i=[...n].filter(s=>!r.has(s)).sort();return{defined:[...e],undeclared:i}}function fn(t,e){for(let r of Object.values(t))if(typeof r=="string"){let n;for(_e.lastIndex=0;(n=_e.exec(r))!==null;)e.add(n[1])}else if(Array.isArray(r))for(let n of r)if(typeof n=="string"){let i;for(_e.lastIndex=0;(i=_e.exec(n))!==null;)e.add(i[1])}else n!==null&&typeof n=="object"&&fn(n,e);else r!==null&&typeof r=="object"&&fn(r,e)}function jo(t){let e={};for(let r of t){let n=r.indexOf("=");if(n===-1)throw new Error(`Invalid variable format: "${r}". Expected "name=value".`);let i=r.slice(0,n).trim(),s=r.slice(n+1);if(!i)throw new Error(`Invalid variable format: "${r}". Variable name cannot be empty.`);e[i]=s}return e}var Ko=3,Xo=12;function Yo(t){return t==null||!Number.isFinite(t)?3:t<0?0:t>12?12:Math.floor(t)}function gn(t,e){if(!Number.isFinite(t))return t;let r=Math.pow(10,e);return Math.round(t*r)/r}var Gc=/-?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?/g;function _s(t,e){return t.replace(Gc,r=>{let n=parseFloat(r);return Number.isFinite(n)?String(gn(n,e)):r})}var Vc=new Set(["rawTransform","strokeDasharray","filterX","filterY","filterWidth","filterHeight","cssClipPath"]),Uc=new Set(["metadata","customMetadata","customAttrs","customData","bindings","richTextRuns","richTextData","cssMaskProperties","rawMetadata"]);function Me(t,e,r){if(e==null)return e;if(typeof e=="number")return gn(e,r);if(typeof e=="string")return Vc.has(t)?_s(e,r):e;if(typeof e=="boolean")return e;if(Array.isArray(e))return e.map(n=>Me(t,n,r));if(typeof e=="object"){if(Uc.has(t))return e;if(t==="symbolOverrides"){let i={};for(let[s,o]of Object.entries(e))i[s]=Me("state",o,r);return i}let n={};for(let[i,s]of Object.entries(e))n[i]=Me(i,s,r);return n}return e}function hn(t,e){return{id:t.id,type:t.type,state:Me("state",t.state,e)}}function qo(t,e){let r={...t,shapes:t.shapes.map(n=>hn(n,e)),viewboxes:t.viewboxes.map(n=>Me("viewbox",n,e))};return t.guides&&(r.guides=t.guides.map(n=>Me("guide",n,e))),t.measurements&&(r.measurements=t.measurements.map(n=>Me("measurement",n,e))),t.animationTimeline&&(r.animationTimeline=Me("animationTimeline",t.animationTimeline,e)),t.symbols&&(r.symbols=t.symbols.map(n=>({...n,shapes:n.shapes.map(i=>hn(i,e))}))),t.markers&&(r.markers=t.markers.map(n=>Me("marker",n,e))),t.customPatterns&&(r.customPatterns=t.customPatterns.map(n=>Me("customPattern",n,e))),r}function cr(t,e,r=-90){let n=[],i=r*Math.PI/180;for(let s=0;s<t;s++){let o=i+s*2*Math.PI/t;n.push({x:e*Math.cos(o),y:e*Math.sin(o)})}return n}function bn(t,e,r,n=-90){let i=[],s=e*(r/100),o=n*Math.PI/180;for(let a=0;a<t*2;a++){let l=o+a*Math.PI/t,c=a%2===0?e:s;i.push({x:c*Math.cos(l),y:c*Math.sin(l)})}return i}function xn(t,e,r=0){let n=t*(e/100)/2,i=[{x:-n,y:-t},{x:n,y:-t},{x:n,y:-n},{x:t,y:-n},{x:t,y:n},{x:n,y:n},{x:n,y:t},{x:-n,y:t},{x:-n,y:n},{x:-t,y:n},{x:-t,y:-n},{x:-n,y:-n}];if(r===0)return i;let s=Math.cos(r*Math.PI/180),o=Math.sin(r*Math.PI/180);return i.map(a=>({x:a.x*s-a.y*o,y:a.x*o+a.y*s}))}function Sn(t,e,r,n,i=-90){let o=t*2*(r/100),a=t*(e/100),l=a*(n/100),c=[{x:t,y:0},{x:t-o,y:-a/2},{x:t-o,y:-l/2},{x:-t,y:-l/2},{x:-t,y:l/2},{x:t-o,y:l/2},{x:t-o,y:a/2}];if(i===0)return c;let f=Math.cos(i*Math.PI/180),d=Math.sin(i*Math.PI/180);return c.map(p=>({x:p.x*f-p.y*d,y:p.x*d+p.y*f}))}function $n(t,e,r,n,i=0){let s=t,o=s*(r/100),a=s*(n/100),l=a/2,c=e*Math.PI/180,f=Math.cos(c),d=Math.sin(c),p=Math.abs(f),m=Math.abs(d),g=Math.max(p,m)||1,h={x:f*(s/g),y:d*(s/g)},b={x:h.x+f*o,y:h.y+d*o},$=Math.min(a,s-l),v=-s+l+$,x=s-l-$,S={x:-s,y:-s},k={x:s,y:-s},w={x:s,y:s},T={x:-s,y:s},P;if(p>=m&&f>0){let N=Math.max(v,Math.min(x,h.y)),B={x:s,y:N-l},D={x:s,y:N+l};P=[S,k,B,b,D,w,T]}else if(p>=m&&f<=0){let N=Math.max(v,Math.min(x,h.y)),B={x:-s,y:N+l},D={x:-s,y:N-l};P=[S,k,w,T,B,b,D]}else if(d<0){let N=Math.max(v,Math.min(x,h.x)),B={x:N-l,y:-s},D={x:N+l,y:-s};P=[S,B,b,D,k,w,T]}else{let N=Math.max(v,Math.min(x,h.x)),B={x:N+l,y:s},D={x:N-l,y:s};P=[S,k,w,B,b,D,T]}if(i===0)return P;let R=Math.cos(i*Math.PI/180),M=Math.sin(i*Math.PI/180);return P.map(N=>({x:N.x*R-N.y*M,y:N.x*M+N.y*R}))}function vn(t,e,r,n,i=0){let s=Math.max(2,Math.round(e)),o=t*(r/100),a=t*(n/100)/2,l=s+1,c=[];for(let h=0;h<l;h++){let b=h/(l-1),$=-t+b*2*t,v=0;h>0&&h<l-1&&(v=h%2===1?o:-o),c.push({x:v,y:$})}let f=[],d=[];for(let h=0;h<l;h++){if(h===0||h===l-1){f.push({...c[h]}),d.push({...c[h]});continue}let b=c[h-1],$=c[h],v=c[h+1],x=$.x-b.x,S=$.y-b.y,k=Math.hypot(x,S)||1,w=x/k,T=S/k,P=v.x-$.x,R=v.y-$.y,M=Math.hypot(P,R)||1,N=P/M,B=R/M,D=(w+N)/2,L=(T+B)/2,K=Math.hypot(D,L),C,ne;K<1e-6?(C=-T,ne=w):(C=-L/K,ne=D/K),f.push({x:$.x-C*a,y:$.y-ne*a}),d.push({x:$.x+C*a,y:$.y+ne*a})}let p=[];p.push(f[0]);for(let h=1;h<l-1;h++)p.push(d[h]);p.push(f[l-1]);for(let h=l-2;h>=1;h--)p.push(f[h]);if(i===0)return p;let m=Math.cos(i*Math.PI/180),g=Math.sin(i*Math.PI/180);return p.map(h=>({x:h.x*m-h.y*g,y:h.x*g+h.y*m}))}function kn(t,e,r,n=0){let i=t,s=Math.max(.3,Math.min(.9,e/100)),o=-i*(r/100),a={x:0,y:i},l={x:0,y:o},c={x:-i*s,y:i*.4},f={x:-i*s,y:-i},d={x:i*s,y:-i},p={x:i*s,y:i*.4},m=[a,c,f,l,d,p,a],g=n===0?m:(()=>{let k=Math.cos(n*Math.PI/180),w=Math.sin(n*Math.PI/180);return m.map(T=>({x:T.x*k-T.y*w,y:T.x*w+T.y*k}))})(),[h,b,$,v,x,S]=g;return`M ${h.x} ${h.y} C ${b.x} ${b.y} ${$.x} ${$.y} ${v.x} ${v.y} C ${x.x} ${x.y} ${S.x} ${S.y} ${h.x} ${h.y} Z`}function Tn(t,e,r,n=0){let i=Math.max(3,Math.round(e)),s=Math.max(.3,Math.min(1,r/100)),o=t,a=o*1.7,l=o*1.15,c=[];for(let T=0;T<i;T++){let R=(90+T/i*360)*Math.PI/180;c.push({x:a/2*Math.cos(R),y:-(l/2)*Math.sin(R)})}let f=.15,d=0;for(let T=0;T<i;T++){let P=c[T],R=c[(T+1)%i];d=Math.max(d,Math.hypot(R.x-P.x,R.y-P.y))}let p=d/(2*(1-f))+.001,m=Math.max(p,d*(.68+s*.35)),g=c.map(T=>{let P=T.y/(l/2);return m*(1-f*P)});function h(T){let P=c[T],R=c[(T+1)%i],M=g[T],N=g[(T+1)%i],B=R.x-P.x,D=R.y-P.y,L=Math.hypot(B,D)||1,K=(M*M-N*N+L*L)/(2*L),C=Math.sqrt(Math.max(0,M*M-K*K)),ne=P.x+K/L*B,ee=P.y+K/L*D,q=-D/L,pe=B/L,Y={x:ne+q*C,y:ee+pe*C},W={x:ne-q*C,y:ee-pe*C};return Y.x*Y.x+Y.y*Y.y>W.x*W.x+W.y*W.y?Y:W}let b=[];for(let T=0;T<i;T++)b.push(h(T));let $=14,v=[];for(let T=0;T<i;T++){let P=c[T],R=g[T],M=b[(T-1+i)%i],N=b[T],B=Math.atan2(M.y-P.y,M.x-P.x),L=Math.atan2(N.y-P.y,N.x-P.x)-B;L<=0&&(L+=2*Math.PI);let K=2*Math.PI-L,C=B+L/2,ne=B-K/2,ee={x:P.x+R*Math.cos(C),y:P.y+R*Math.sin(C)},q={x:P.x+R*Math.cos(ne),y:P.y+R*Math.sin(ne)},Y=ee.x*ee.x+ee.y*ee.y>q.x*q.x+q.y*q.y?L:-K;for(let W=0;W<$;W++){let fe=W/$,me=B+fe*Y;v.push({x:P.x+R*Math.cos(me),y:P.y+R*Math.sin(me)})}}let x=0;for(let T of v){let P=Math.max(Math.abs(T.x),Math.abs(T.y));P>x&&(x=P)}if(x>0&&x!==o){let T=o/x;for(let P of v)P.x*=T,P.y*=T}let S=T=>{if(n===0)return T;let P=Math.cos(n*Math.PI/180),R=Math.sin(n*Math.PI/180);return{x:T.x*P-T.y*R,y:T.x*R+T.y*P}},k=v.map(S),w=`M ${k[0].x} ${k[0].y}`;for(let T=1;T<k.length;T++)w+=` L ${k[T].x} ${k[T].y}`;return w+=" Z",w}function Re(t,e=0,r=0){if(t.length<3)return"";if(e<=0)return t.map((s,o)=>(o===0?"M":"L")+`${s.x},${s.y}`).join(" ")+" Z";let n=Math.min(e,r*.4),i="";for(let s=0;s<t.length;s++){let o=t[(s-1+t.length)%t.length],a=t[s],l=t[(s+1)%t.length],c={x:o.x-a.x,y:o.y-a.y},f=Math.hypot(c.x,c.y);c.x/=f,c.y/=f;let d={x:l.x-a.x,y:l.y-a.y},p=Math.hypot(d.x,d.y);d.x/=p,d.y/=p;let m=Math.min(n,f/2),g=Math.min(n,p/2),h={x:a.x+c.x*m,y:a.y+c.y*m},b={x:a.x+d.x*g,y:a.y+d.y*g};i+=s===0?`M${h.x},${h.y}`:` L${h.x},${h.y}`,i+=` Q${a.x},${a.y} ${b.x},${b.y}`}return i+" Z"}function wn(t,e,r="evenodd"){let n=t*(e/100),i=r==="nonzero"?1:0;return`M ${t} 0 A ${t} ${t} 0 1 1 ${-t} 0 A ${t} ${t} 0 1 1 ${t} 0 Z M ${n} 0 A ${n} ${n} 0 1 ${i} ${-n} 0 A ${n} ${n} 0 1 ${i} ${n} 0 Z`}function Pn(t,e,r,n=1,i=0){let s=t*(r/100),a=Math.round(e*36),l=e*2*Math.PI,c=(t-s/2)/l,f=i*Math.PI/180,d=[],p=[];for(let h=0;h<=a;h++){let b=h/a,$=b*l*n+f,v=c*(b*l)+s/2,x=s/2;d.push({x:(v+x*.3)*Math.cos($),y:(v+x*.3)*Math.sin($)}),p.push({x:Math.max(0,v-x*.3)*Math.cos($),y:Math.max(0,v-x*.3)*Math.sin($)})}let m=`M ${d[0].x} ${d[0].y}`;for(let h=1;h<d.length;h++)m+=` L ${d[h].x} ${d[h].y}`;let g=p[p.length-1];m+=` L ${g.x} ${g.y}`;for(let h=p.length-2;h>=0;h--)m+=` L ${p[h].x} ${p[h].y}`;return m+=" Z",m}var Wc=.2;function Is(t,e,r,n=0){let i=e*(r/100),s=e,o=e-i,a=2*Math.PI/t,l=a*Wc/2,c=a/4,f=n*Math.PI/180,d=[];for(let p=0;p<t;p++){let m=f+p*a;d.push({x:o*Math.cos(m),y:o*Math.sin(m)}),d.push({x:s*Math.cos(m+c-l),y:s*Math.sin(m+c-l)}),d.push({x:s*Math.cos(m+c+l),y:s*Math.sin(m+c+l)}),d.push({x:o*Math.cos(m+a/2),y:o*Math.sin(m+a/2)})}return d}function _n(t,e,r,n=0,i=0,s="evenodd",o=0){let a=Is(t,e,r,o),l=Math.min(n,e*.1),c=Re(a,l,e);if(i>0){let f=e*(i/100),d=s==="nonzero"?1:0;c+=` M ${f} 0 A ${f} ${f} 0 1 ${d} ${-f} 0 A ${f} ${f} 0 1 ${d} ${f} 0 Z`}return c}function Rn(t,e,r,n,i,s="round",o="uniform",a){let l=Math.min(r,n)/2,c,f,d,p,m,g,h,b;if(o==="non-uniform"&&a?(c=Math.min(a.radiusTL??i,l),f=Math.min(a.radiusTR??i,l),d=Math.min(a.radiusBR??i,l),p=Math.min(a.radiusBL??i,l),m=a.shapeTL??s,g=a.shapeTR??s,h=a.shapeBR??s,b=a.shapeBL??s):(c=f=d=p=Math.min(i,l),m=g=h=b=s),!(s!=="round"||o==="non-uniform"||c>0&&m!=="round"||f>0&&g!=="round"||d>0&&h!=="round"||p>0&&b!=="round")&&c===f&&f===d&&d===p)return null;let v=`M${t+c},${e}`;return v+=` L${t+r-f},${e}`,v+=yn(g,f,t+r,e,"tr"),v+=` L${t+r},${e+n-d}`,v+=yn(h,d,t+r,e+n,"br"),v+=` L${t+p},${e+n}`,v+=yn(b,p,t,e+n,"bl"),v+=` L${t},${e+c}`,v+=yn(m,c,t,e,"tl"),v+=" Z",v}function yn(t,e,r,n,i){if(e<=0)return"";switch(t){case"round":switch(i){case"tr":return` A${e},${e} 0 0 1 ${r},${n+e}`;case"br":return` A${e},${e} 0 0 1 ${r-e},${n}`;case"bl":return` A${e},${e} 0 0 1 ${r},${n-e}`;case"tl":return` A${e},${e} 0 0 1 ${r+e},${n}`}break;case"scoop":switch(i){case"tr":return` A${e},${e} 0 0 0 ${r},${n+e}`;case"br":return` A${e},${e} 0 0 0 ${r-e},${n}`;case"bl":return` A${e},${e} 0 0 0 ${r},${n-e}`;case"tl":return` A${e},${e} 0 0 0 ${r+e},${n}`}break;case"bevel":switch(i){case"tr":return` L${r},${n+e}`;case"br":return` L${r-e},${n}`;case"bl":return` L${r},${n-e}`;case"tl":return` L${r+e},${n}`}break;case"notch":switch(i){case"tr":return` L${r-e},${n+e} L${r},${n+e}`;case"br":return` L${r-e},${n-e} L${r-e},${n}`;case"bl":return` L${r+e},${n-e} L${r},${n-e}`;case"tl":return` L${r+e},${n+e} L${r+e},${n}`}break}return""}function An(t,e,r,n,i,s={}){let o=e+n/2,a=r+i/2;switch(t){case"diamond":return`M${o},${r} L${e+n},${a} L${o},${r+i} L${e},${a} Z`;case"parallelogram":{let l=(s.slantPercent??20)/100*n;return`M${e+l},${r} L${e+n},${r} L${e+n-l},${r+i} L${e},${r+i} Z`}case"trapezoid":{let l=(s.topWidthPercent??70)/100*n,c=(n-l)/2;return`M${e+c},${r} L${e+c+l},${r} L${e+n},${r+i} L${e},${r+i} Z`}case"terminator":{let l=i/2;return`M${e+l},${r} L${e+n-l},${r} A${l},${l} 0 0 1 ${e+n-l},${r+i} L${e+l},${r+i} A${l},${l} 0 0 1 ${e+l},${r} Z`}case"cylinder":{let l=n/2,c=Math.min((s.capHeightPercent??15)/100*i,i/2);return`M${e},${r+c} A${l},${c} 0 0 1 ${e+n},${r+c} A${l},${c} 0 0 1 ${e},${r+c} L${e},${r+i-c} A${l},${c} 0 0 0 ${e+n},${r+i-c} L${e+n},${r+c} M${o-l},${r+c} A${l},${c} 0 0 0 ${o+l},${r+c}`}case"document-shape":{let l=(s.waveAmplitudePercent??15)/100*i;return`M${e},${r} L${e+n},${r} L${e+n},${r+i} C${e+n*.75},${r+i-l*2} ${o+n*.25},${r+i+l} ${o},${r+i} C${o-n*.25},${r+i-l} ${e+n*.25},${r+i+l*.5} ${e},${r+i} Z`}}}function Ye(t,e,r=!1,n=.5,i){if(t.length<2)return t.length===1?`M ${t[0].x} ${t[0].y}`:"";switch(e){case"CATMULL_ROM":case"catmull-rom":return Xc(t,r,n);case"BASIS":case"basis":return Yc(t,r);case"ARC":case"arc":return i&&i.length>0?Hc(t,r,i):ur(t,r,"CUBIC");case"LINEAR":case"linear":return ur(t,r,"LINEAR");case"QUADRATIC":case"quadratic":return ur(t,r,"QUADRATIC");case"CUBIC":case"cubic":return ur(t,r,"CUBIC");default:return ur(t,r)}}function Hc(t,e,r){let n=`M ${t[0].x} ${t[0].y}`,i=0,s={rx:50,ry:50,rotation:0,largeArc:!1,sweep:!0};for(let o=0;o<t.length-1;o++){let a=t[o+1];if(a.isSubpathStart){if(e&&o-i>=1){let c=t[i],f=r?.[o]??s;n+=` A ${f.rx} ${f.ry} ${f.rotation} ${f.largeArc?1:0} ${f.sweep?1:0} ${c.x} ${c.y} Z`}n+=` M ${a.x} ${a.y}`,i=o+1;continue}let l=r?.[o]??s;n+=` A ${l.rx} ${l.ry} ${l.rotation} ${l.largeArc?1:0} ${l.sweep?1:0} ${a.x} ${a.y}`}if(e&&t.length-i>1){let o=t[i],a=r?.[t.length-1]??s;n+=` A ${a.rx} ${a.ry} ${a.rotation} ${a.largeArc?1:0} ${a.sweep?1:0} ${o.x} ${o.y} Z`}return n}function ur(t,e,r){let n=`M ${t[0].x} ${t[0].y}`,i=0,s=null,o=null;for(let a=0;a<t.length-1;a++){let l=t[a],c=t[a+1];if(c.isSubpathStart){if(e&&a-i>=1){let d=t[i];n+=Rs(l,d,d.segmentType,s,o,r),n+=" Z"}n+=` M ${c.x} ${c.y}`,i=a+1,s=null,o=null;continue}n+=Rs(l,c,c.segmentType,s,o,r);let f=Kc(c.segmentType??r,l,c);s=f,f==="quad"?o=l.handleOut??null:o=null}if(e&&t.length-i>1){let a=t[t.length-1],l=t[i],c=(l.segmentType??r??(a.handleOut||l.handleIn?"CUBIC":"LINEAR")).toUpperCase();c==="LINEAR"||c==="HORIZONTAL"||c==="VERTICAL"||(n+=Rs(a,l,l.segmentType,s,o,r)),n+=" Z"}return n}var jc=.001;function At(t,e){return Math.abs(t-e)<jc}function Kc(t,e,r){let n=(t??(e.handleOut||r.handleIn?"CUBIC":"LINEAR")).toUpperCase();return n==="CUBIC"||n==="SMOOTH_CUBIC"?"cubic":n==="QUADRATIC"||n==="SMOOTH_QUADRATIC"?"quad":null}function Rs(t,e,r,n,i,s){let o=(r??s??(t.handleOut||e.handleIn?"CUBIC":"LINEAR")).toUpperCase();if(o==="LINEAR"||o==="HORIZONTAL"||o==="VERTICAL")return(o==="HORIZONTAL"||o==="LINEAR")&&At(t.y,e.y)?` H ${e.x}`:(o==="VERTICAL"||o==="LINEAR")&&At(t.x,e.x)?` V ${e.y}`:` L ${e.x} ${e.y}`;if(o==="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(o==="QUADRATIC"||o==="SMOOTH_QUADRATIC"){let c=t.handleOut??{x:(t.x+e.x)/2,y:(t.y+e.y)/2};return n==="quad"&&i&&At(c.x,2*t.x-i.x)&&At(c.y,2*t.y-i.y)?` T ${e.x} ${e.y}`:` Q ${c.x} ${c.y} ${e.x} ${e.y}`}let a=t.handleOut??{x:t.x,y:t.y},l=e.handleIn??{x:e.x,y:e.y};return n==="cubic"&&t.handleIn&&t.handleOut&&At(t.handleOut.x,2*t.x-t.handleIn.x)&&At(t.handleOut.y,2*t.y-t.handleIn.y)?` S ${l.x} ${l.y} ${e.x} ${e.y}`:` C ${a.x} ${a.y} ${l.x} ${l.y} ${e.x} ${e.y}`}function Xc(t,e,r){if(t.length<2)return t.length===1?`M ${t[0].x} ${t[0].y}`:"";let n=r,i=e?[t[t.length-1],...t,t[0],t[1]]:[t[0],...t,t[t.length-1]],s=`M ${t[0].x} ${t[0].y}`,o=e?t.length:t.length-1;for(let a=0;a<o;a++){let l=i[a],c=i[a+1],f=i[a+2],d=i[a+3],p=Math.hypot(f.x-c.x,f.y-c.y),m=Math.hypot(c.x-l.x,c.y-l.y),g=Math.hypot(d.x-f.x,d.y-f.y),h=Math.pow(m,n),b=Math.pow(p,n),$=Math.pow(g,n),v=Math.pow(m,2*n),x=Math.pow(p,2*n),S=Math.pow(g,2*n),k,w,T,P;m<1e-8?(k=c.x,w=c.y):(k=(v*f.x-x*l.x+(2*v+3*h*b+x)*c.x)/(3*h*(h+b)),w=(v*f.y-x*l.y+(2*v+3*h*b+x)*c.y)/(3*h*(h+b))),g<1e-8?(T=f.x,P=f.y):(T=(S*c.x-x*d.x+(2*S+3*$*b+x)*f.x)/(3*$*($+b)),P=(S*c.y-x*d.y+(2*S+3*$*b+x)*f.y)/(3*$*($+b))),s+=` C ${k} ${w} ${T} ${P} ${f.x} ${f.y}`}return e&&(s+=" Z"),s}function Yc(t,e){let r=t.length;if(r<2)return r===1?`M ${t[0].x} ${t[0].y}`:"";if(r===2)return`M ${t[0].x} ${t[0].y} L ${t[1].x} ${t[1].y}`;if(e){let s=(t[0].x+4*t[1].x+t[2].x)/6,o=(t[0].y+4*t[1].y+t[2].y)/6,a=`M ${s} ${o}`;for(let l=0;l<r;l++){let c=t[(l+1)%r],f=t[(l+2)%r],d=t[(l+3)%r];a+=As(c,f,d)}return a+=" Z",a}let n=t,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 s=0;s<=r-3;s++)i+=As(n[s],n[s+1],n[s+2]);return i+=As(n[r-2],n[r-1],n[r-1]),i+=` L ${n[r-1].x} ${n[r-1].y}`,i}function As(t,e,r){return` C ${(2*t.x+e.x)/3} ${(2*t.y+e.y)/3} ${(t.x+2*e.x)/3} ${(t.y+2*e.y)/3} ${(t.x+4*e.x+r.x)/6} ${(t.y+4*e.y+r.y)/6}`}function It(t,e,r){let n=Number.isFinite(e)?Math.max(1,e):8,i=Number.isFinite(r)?Math.max(1,r):4;switch(t){case"dashed":case"dotted":case"custom":return`${n} ${i}`;default:return null}}var qc=[["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 Z(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Zc(t){let e=t.fillType;return e||(t.fillGradient?t.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":t.linearGradient?"linear-gradient":t.radialGradient?"radial-gradient":"solid")}function In(t){let e=new Map,r=t.state,n=r;switch(t.type){case"circle":e.set("cx",String(r.x??0)),e.set("cy",String(r.y??0)),e.set("r",String(r.radius??50));break;case"ellipse":e.set("cx",String(r.cx??0)),e.set("cy",String(r.cy??0)),e.set("rx",String(r.rx??50)),e.set("ry",String(r.ry??30));break;case"rectangle":case"square":e.set("x",String(r.x??0)),e.set("y",String(r.y??0)),e.set("width",String(r.width??100)),e.set("height",String(r.height??100));{let S=r.rx??r.cornerRadius??0,k=r.ry??r.cornerRadius??0;(S>0||k>0)&&(e.set("rx",String(S)),e.set("ry",String(k)))}break;case"line":e.set("x1",String(r.x1??0)),e.set("y1",String(r.y1??0)),e.set("x2",String(r.x2??0)),e.set("y2",String(r.y2??0));break;case"text":e.set("x",String(r.x??0)),e.set("y",String(r.y??0)),r.fontSize&&e.set("font-size",String(r.fontSize)),r.fontFamily&&e.set("font-family",r.fontFamily),r.fontWeight&&e.set("font-weight",r.fontWeight),r.fontStyle&&e.set("font-style",r.fontStyle),r.textAnchor&&e.set("text-anchor",r.textAnchor),r.letterSpacing&&e.set("letter-spacing",String(r.letterSpacing));{let S=qc.map(([k,w])=>{let T=typeof r[k]=="string"?String(r[k]).trim():"";return T?`${w}: ${T}`:""}).filter(Boolean).join("; ");S&&e.set("style",S)}break;case"image":e.set("x",String(r.x??0)),e.set("y",String(r.y??0)),e.set("width",String(r.width??100)),e.set("height",String(r.height??100)),n.href&&e.set("href",String(n.href));break}let i=Zc(n);i==="none"?e.set("fill","none"):i==="linear-gradient"||i==="radial-gradient"?e.set("fill",`url(#gradient-fill-${t.id})`):i==="pattern"?e.set("fill",`url(#pattern-fill-${t.id})`):e.set("fill",r.fillColor??"#000000");let s=r.opacity;s!==void 0&&s<1&&e.set("opacity",String(s));let o=r.fillOpacity;o!==void 0&&o<1&&e.set("fill-opacity",String(o)),r.fillRule&&r.fillRule!=="nonzero"&&e.set("fill-rule",r.fillRule);let a=n.strokeType??"solid";if(a==="none")e.set("stroke","none");else if(a==="linear-gradient"||a==="radial-gradient")e.set("stroke",`url(#gradient-stroke-${t.id})`);else{let S=r.borderColor??"none";S!=="none"&&e.set("stroke",S)}let l=r.borderWidth;l!=null&&l!==0&&e.set("stroke-width",String(l));let c=r.strokeOpacity;c!==void 0&&c<1&&e.set("stroke-opacity",String(c));let f=r.lineStyle??"solid",d=r.dashLength??8,p=r.gapLength??4,m=It(f,d,p);m&&(e.set("stroke-dasharray",m),f==="dotted"&&e.set("stroke-linecap","round"));let g=Jc(n);g&&e.set("transform",g);let h=n.filters;h&&h.length>0&&e.set("filter",`url(#filter-${t.id})`);let b=r.shapeRendering;b&&b!=="auto"&&e.set("shape-rendering",b),r.pathLength!==void 0&&e.set("pathLength",String(r.pathLength));let $=n.startEndpoint,v=n.endEndpoint;$&&$!=="none"&&e.set("marker-start",`url(#line-marker-${$})`),v&&v!=="none"&&e.set("marker-end",`url(#line-marker-${v})`);let x=n.metadata;return x&&(x.role&&e.set("role",x.role),x.ariaLabel&&e.set("aria-label",x.ariaLabel)),e}function Zo(t){switch(t.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 Jc(t){return Rt(t)}function Ce(t,e){let r=t.viewboxes?.[0];return{width:e.width??r?.width??800,height:e.height??r?.height??600}}function u(t,e){return e==null||e===""?"":` ${t}="${Z(String(e))}"`}function Cn(t){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);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 Qc(t,e,r){let{offsetX:n,offsetY:i,blurRadius:s,spread:o,color:a,opacity:l}=t,c="";if(o===0)c+=`<feDropShadow${u("in",e)}${u("dx",n)}${u("dy",i)}${u("stdDeviation",s/2)}${u("flood-color",a)}${u("flood-opacity",l)}${u("result",`${r}_shadow`)}/>`,c+=`<feMerge${u("result",r)}><feMergeNode${u("in",`${r}_shadow`)}/><feMergeNode${u("in",e)}/></feMerge>`;else{c+=`<feColorMatrix${u("in",e)}${u("type","matrix")}${u("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${u("result",`${r}_alpha`)}/>`;let f=o>0?"dilate":"erode",d=Math.abs(o);c+=`<feMorphology${u("in",`${r}_alpha`)}${u("operator",f)}${u("radius",d)}${u("result",`${r}_spread`)}/>`,c+=`<feGaussianBlur${u("in",`${r}_spread`)}${u("stdDeviation",s/2)}${u("result",`${r}_blur`)}/>`,c+=`<feOffset${u("in",`${r}_blur`)}${u("dx",n)}${u("dy",i)}${u("result",`${r}_offset`)}/>`,c+=`<feFlood${u("flood-color",a)}${u("flood-opacity",l)}${u("result",`${r}_color`)}/>`,c+=`<feComposite${u("in",`${r}_color`)}${u("in2",`${r}_offset`)}${u("operator","in")}${u("result",`${r}_shadow`)}/>`,c+=`<feMerge${u("result",r)}><feMergeNode${u("in",`${r}_shadow`)}/><feMergeNode${u("in",e)}/></feMerge>`}return c}function ed(t,e,r){let{offsetX:n,offsetY:i,blurRadius:s,choke:o,color:a,opacity:l}=t,c=s*(1-o/100),f="";return f+=`<feColorMatrix${u("in",e)}${u("type","matrix")}${u("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${u("result",`${r}_alpha`)}/>`,f+=`<feComponentTransfer${u("in",`${r}_alpha`)}${u("result",`${r}_inverted`)}><feFuncA${u("type","table")}${u("tableValues","1 0")}/></feComponentTransfer>`,f+=`<feGaussianBlur${u("in",`${r}_inverted`)}${u("stdDeviation",c/2)}${u("result",`${r}_blur`)}/>`,f+=`<feOffset${u("in",`${r}_blur`)}${u("dx",n)}${u("dy",i)}${u("result",`${r}_offset`)}/>`,f+=`<feFlood${u("flood-color",a)}${u("flood-opacity",l)}${u("result",`${r}_color`)}/>`,f+=`<feComposite${u("in",`${r}_color`)}${u("in2",`${r}_offset`)}${u("operator","in")}${u("result",`${r}_coloredShadow`)}/>`,f+=`<feComposite${u("in",`${r}_coloredShadow`)}${u("in2",`${r}_alpha`)}${u("operator","in")}${u("result",`${r}_innerShadow`)}/>`,f+=`<feComposite${u("in",`${r}_innerShadow`)}${u("in2",e)}${u("operator","over")}${u("result",r)}/>`,f}function td(t,e,r){let{blurX:n,blurY:i}=t;return n===0&&i===0?H(e,r):`<feGaussianBlur${u("in",e)}${u("stdDeviation",`${n/2} ${i/2}`)}${u("result",r)}/>`}function rd(t,e,r){let{distance:n,angle:i}=t;if(n===0)return H(e,r);let s=i*Math.PI/180,o=Math.abs(Math.cos(s)*n),a=Math.abs(Math.sin(s)*n);return`<feGaussianBlur${u("in",e)}${u("stdDeviation",`${o/2} ${a/2}`)}${u("result",r)}/>`}function Jo(t,e,r){let{x:n,y:i,z:s,color:o,surfaceScale:a,diffuseConstant:l,specularConstant:c,specularExponent:f}=t,d="";return d+=`<feDiffuseLighting${u("in","SourceAlpha")}${u("surfaceScale",a)}${u("diffuseConstant",l)}${u("lighting-color",o)}${u("result",`${r}_diffuse`)}>`,d+=`<fePointLight${u("x",n)}${u("y",i)}${u("z",s)}/>`,d+="</feDiffuseLighting>",d+=`<feSpecularLighting${u("in","SourceAlpha")}${u("surfaceScale",a)}${u("specularConstant",c)}${u("specularExponent",f)}${u("lighting-color",o)}${u("result",`${r}_specular`)}>`,d+=`<fePointLight${u("x",n)}${u("y",i)}${u("z",s)}/>`,d+="</feSpecularLighting>",d+=`<feComposite${u("in",e)}${u("in2",`${r}_diffuse`)}${u("operator","arithmetic")}${u("k1",1)}${u("k2",0)}${u("k3",0)}${u("k4",0)}${u("result",`${r}_lit`)}/>`,d+=`<feComposite${u("in",`${r}_specular`)}${u("in2",`${r}_lit`)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",1)}${u("k3",1)}${u("k4",0)}${u("result",r)}/>`,d}function Qo(t,e,r){let{x:n,y:i,z:s,pointsAtX:o,pointsAtY:a,pointsAtZ:l,coneAngle:c,color:f,surfaceScale:d,specularConstant:p,specularExponent:m}=t,g="";return g+=`<feSpecularLighting${u("in","SourceAlpha")}${u("surfaceScale",d)}${u("specularConstant",p)}${u("specularExponent",m)}${u("lighting-color",f)}${u("result",`${r}_specular`)}>`,g+=`<feSpotLight${u("x",n)}${u("y",i)}${u("z",s)}${u("pointsAtX",o)}${u("pointsAtY",a)}${u("pointsAtZ",l)}${u("limitingConeAngle",c)}/>`,g+="</feSpecularLighting>",g+=`<feComposite${u("in",`${r}_specular`)}${u("in2","SourceAlpha")}${u("operator","in")}${u("result",`${r}_clipped`)}/>`,g+=`<feComposite${u("in",`${r}_clipped`)}${u("in2",e)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",1)}${u("k3",1)}${u("k4",0)}${u("result",r)}/>`,g}function el(t){switch(t.kind){case"point":return`<fePointLight${u("x",t.x)}${u("y",t.y)}${u("z",t.z)}/>`;case"spot":{let e=`<feSpotLight${u("x",t.x)}${u("y",t.y)}${u("z",t.z)}${u("pointsAtX",t.pointsAtX)}${u("pointsAtY",t.pointsAtY)}${u("pointsAtZ",t.pointsAtZ)}`;return t.limitingConeAngle!==void 0&&(e+=u("limitingConeAngle",t.limitingConeAngle)),t.specularExponent!==void 0&&(e+=u("specularExponent",t.specularExponent)),e+"/>"}case"distant":return`<feDistantLight${u("azimuth",t.azimuth)}${u("elevation",t.elevation)}/>`}}function nd(t,e,r){return`<feDiffuseLighting${u("in",e)}${u("surfaceScale",t.surfaceScale)}${u("diffuseConstant",t.diffuseConstant)}${u("lighting-color",t.color)}${u("result",r)}>`+el(t.lightSource)+"</feDiffuseLighting>"}function id(t,e,r){return`<feSpecularLighting${u("in",e)}${u("surfaceScale",t.surfaceScale)}${u("specularConstant",t.specularConstant)}${u("specularExponent",t.specularExponent)}${u("lighting-color",t.color)}${u("result",r)}>`+el(t.lightSource)+"</feSpecularLighting>"}function sd(t,e,r){let{width:n,color:i,opacity:s,position:o}=t,a="";if(o==="inside")a+=`<feMorphology${u("in","SourceAlpha")}${u("operator","erode")}${u("radius",n)}${u("result",`${r}_eroded`)}/>`,a+=`<feComposite${u("in","SourceAlpha")}${u("in2",`${r}_eroded`)}${u("operator","out")}${u("result",`${r}_outlineAlpha`)}/>`,a+=`<feFlood${u("flood-color",i)}${u("flood-opacity",s)}${u("result",`${r}_color`)}/>`,a+=`<feComposite${u("in",`${r}_color`)}${u("in2",`${r}_outlineAlpha`)}${u("operator","in")}${u("result",`${r}_outline`)}/>`,a+=`<feComposite${u("in",`${r}_outline`)}${u("in2",e)}${u("operator","over")}${u("result",r)}/>`;else{let l=o==="outside"?n:n/2;a+=`<feMorphology${u("in","SourceAlpha")}${u("operator","dilate")}${u("radius",l)}${u("result",`${r}_dilated`)}/>`,a+=`<feComposite${u("in",`${r}_dilated`)}${u("in2","SourceAlpha")}${u("operator","out")}${u("result",`${r}_outlineAlpha`)}/>`,a+=`<feFlood${u("flood-color",i)}${u("flood-opacity",s)}${u("result",`${r}_color`)}/>`,a+=`<feComposite${u("in",`${r}_color`)}${u("in2",`${r}_outlineAlpha`)}${u("operator","in")}${u("result",`${r}_outline`)}/>`,a+=`<feMerge${u("result",r)}><feMergeNode${u("in",`${r}_outline`)}/><feMergeNode${u("in",e)}/></feMerge>`}return a}function ad(t,e,r){let{amount:n}=t;if(n===0)return H(e,r);let i=1+4*n,s=-n,o=[0,s,0,s,i,s,0,s,0].join(" ");return`<feConvolveMatrix${u("in",e)}${u("order","3")}${u("kernelMatrix",o)}${u("divisor","1")}${u("bias","0")}${u("preserveAlpha","true")}${u("edgeMode","duplicate")}${u("result",r)}/>`}function od(t,e,r){let{blockSize:n}=t;if(n<=1)return H(e,r);let i=n/2,s="";return s+=`<feMorphology${u("in",e)}${u("operator","erode")}${u("radius",i)}${u("result",`${r}_eroded`)}/>`,s+=`<feMorphology${u("in",`${r}_eroded`)}${u("operator","dilate")}${u("radius",i)}${u("result",r)}/>`,s}function ld(t,e,r){let{scale:n,frequency:i,octaves:s,warpType:o}=t;if(n===0)return H(e,r);let a="";return a+=`<feTurbulence${u("type",o)}${u("baseFrequency",i)}${u("numOctaves",s)}${u("seed",0)}${u("result",`${r}_turbulence`)}/>`,a+=`<feDisplacementMap${u("in",e)}${u("in2",`${r}_turbulence`)}${u("scale",n)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",r)}/>`,a}function ud(t,e,r){let{operator:n,radiusX:i,radiusY:s}=t;return i===0&&s===0?H(e,r):`<feMorphology${u("in",e)}${u("operator",n)}${u("radius",`${i} ${s}`)}${u("result",r)}/>`}function cd(t,e,r){let{levels:n}=t;if(n<2)return H(e,r);let i=[];for(let a=0;a<n;a++)i.push(a/(n-1));let s=i.join(" "),o=`<feComponentTransfer${u("in",e)}${u("result",r)}>`;return o+=`<feFuncR${u("type","discrete")}${u("tableValues",s)}/>`,o+=`<feFuncG${u("type","discrete")}${u("tableValues",s)}/>`,o+=`<feFuncB${u("type","discrete")}${u("tableValues",s)}/>`,o+="</feComponentTransfer>",o}function dd(t,e,r){let{levels:n,contrast:i}=t;if(n<2)return H(e,r);let s=[];for(let l=0;l<n;l++){let c=l/(n-1),f=c;i!==1&&(f=.5+(c-.5)*i,f=Math.max(0,Math.min(1,f))),s.push(f)}let o=s.join(" "),a=`<feComponentTransfer${u("in",e)}${u("result",r)}>`;return a+=`<feFuncR${u("type","table")}${u("tableValues",o)}/>`,a+=`<feFuncG${u("type","table")}${u("tableValues",o)}/>`,a+=`<feFuncB${u("type","table")}${u("tableValues",o)}/>`,a+="</feComponentTransfer>",a}function fd(t,e,r){let{radius:n}=t;if(n===0)return H(e,r);let i="";return i+=`<feGaussianBlur${u("in","SourceAlpha")}${u("stdDeviation",n)}${u("result",`${r}_blurredAlpha`)}/>`,i+=`<feComponentTransfer${u("in",`${r}_blurredAlpha`)}${u("result",`${r}_thresholdAlpha`)}><feFuncA${u("type","linear")}${u("slope",20)}${u("intercept",-9)}/></feComponentTransfer>`,i+=`<feComposite${u("in",e)}${u("in2",`${r}_thresholdAlpha`)}${u("operator","in")}${u("result",r)}/>`,i}function pd(t,e,r){let{amount:n}=t;if(n===0)return H(e,r);let i=1-n;return`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","saturate")}${u("values",i)}${u("result",r)}/>`}function md(t,e,r){let{red:n,green:i,blue:s}=t;if(n===1&&i===1&&s===1)return H(e,r);let o=`<feComponentTransfer${u("in",e)}${u("result",r)}>`;return o+=`<feFuncR${u("type","linear")}${u("slope",n)}${u("intercept",0)}/>`,o+=`<feFuncG${u("type","linear")}${u("slope",i)}${u("intercept",0)}/>`,o+=`<feFuncB${u("type","linear")}${u("slope",s)}${u("intercept",0)}/>`,o+="</feComponentTransfer>",o}function hd(t,e,r){let{amount:n}=t;if(n===1)return H(e,r);let i=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",r)}>`;return i+=`<feFuncR${u("type","linear")}${u("slope",n)}${u("intercept",0)}/>`,i+=`<feFuncG${u("type","linear")}${u("slope",n)}${u("intercept",0)}/>`,i+=`<feFuncB${u("type","linear")}${u("slope",n)}${u("intercept",0)}/>`,i+="</feComponentTransfer>",i}function gd(t,e,r){let{amount:n}=t;if(n===1)return H(e,r);let i=.5*(1-n),s=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",r)}>`;return s+=`<feFuncR${u("type","linear")}${u("slope",n)}${u("intercept",i)}/>`,s+=`<feFuncG${u("type","linear")}${u("slope",n)}${u("intercept",i)}/>`,s+=`<feFuncB${u("type","linear")}${u("slope",n)}${u("intercept",i)}/>`,s+="</feComponentTransfer>",s}function yd(t,e,r){let{amount:n}=t;if(n===1)return H(e,r);let i=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",r)}>`;return i+=`<feFuncA${u("type","linear")}${u("slope",n)}${u("intercept",0)}/>`,i+="</feComponentTransfer>",i}function bd(t,e,r){let{amount:n}=t;if(n===0)return H(e,r);let i=n,s=1-n,o=`${i} ${s}`,a=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",r)}>`;return a+=`<feFuncR${u("type","table")}${u("tableValues",o)}/>`,a+=`<feFuncG${u("type","table")}${u("tableValues",o)}/>`,a+=`<feFuncB${u("type","table")}${u("tableValues",o)}/>`,a+="</feComponentTransfer>",a}function xd(t,e,r){let{angle:n}=t;return n===0||n===360?H(e,r):`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","hueRotate")}${u("values",n)}${u("result",r)}/>`}function Sd(t,e,r){let{amount:n}=t;return n===1?H(e,r):`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","saturate")}${u("values",n)}${u("result",r)}/>`}function $d(t,e,r){let{threshold:n}=t,i="";if(i+=`<feColorMatrix${u("in",e)}${u("type","saturate")}${u("values",0)}${u("result",`${r}_gray`)}/>`,n===.5)i+=`<feComponentTransfer${u("in",`${r}_gray`)}${u("result",r)}>`,i+=`<feFuncR${u("type","discrete")}${u("tableValues","0 1")}/>`,i+=`<feFuncG${u("type","discrete")}${u("tableValues","0 1")}/>`,i+=`<feFuncB${u("type","discrete")}${u("tableValues","0 1")}/>`,i+="</feComponentTransfer>";else{let o=[];for(let l=0;l<256;l++)o.push(l/255<n?0:1);let a=o.join(" ");i+=`<feComponentTransfer${u("in",`${r}_gray`)}${u("result",r)}>`,i+=`<feFuncR${u("type","table")}${u("tableValues",a)}/>`,i+=`<feFuncG${u("type","table")}${u("tableValues",a)}/>`,i+=`<feFuncB${u("type","table")}${u("tableValues",a)}/>`,i+="</feComponentTransfer>"}return i}function vd(t,e,r){let{amount:n}=t;if(n===0)return H(e,r);let i=[.393,.769,.189,0,0],s=[.349,.686,.168,0,0],o=[.272,.534,.131,0,0],a=[1,0,0,0,0],l=[0,1,0,0,0],c=[0,0,1,0,0],f=(h,b)=>h.map(($,v)=>$*(1-n)+b[v]*n),d=f(a,i),p=f(l,s),m=f(c,o),g=[...d,...p,...m,0,0,0,1,0].join(" ");return`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","matrix")}${u("values",g)}${u("result",r)}/>`}function kd(t,e,r){let{shadowColor:n,highlightColor:i}=t,s=Cn(n),o=Cn(i),a="";return a+=`<feColorMatrix${u("in",e)}${u("type","saturate")}${u("values",0)}${u("result",`${r}_gray`)}/>`,a+=`<feComponentTransfer${u("in",`${r}_gray`)}${u("result",r)}>`,a+=`<feFuncR${u("type","table")}${u("tableValues",`${s.r} ${o.r}`)}/>`,a+=`<feFuncG${u("type","table")}${u("tableValues",`${s.g} ${o.g}`)}/>`,a+=`<feFuncB${u("type","table")}${u("tableValues",`${s.b} ${o.b}`)}/>`,a+="</feComponentTransfer>",a}function Td(t,e,r){let{intensity:n}=t;if(n===0)return H(e,r);let i="";i+=`<feComponentTransfer${u("in",e)}${u("result",`${r}_invert`)}>`,i+=`<feFuncR${u("type","table")}${u("tableValues","1 0")}/>`,i+=`<feFuncG${u("type","table")}${u("tableValues","1 0")}/>`,i+=`<feFuncB${u("type","table")}${u("tableValues","1 0")}/>`,i+="</feComponentTransfer>",i+=`<feColorMatrix${u("in",`${r}_invert`)}${u("type","saturate")}${u("values",0)}${u("result",`${r}_gray`)}/>`;let s=[.1,.1,.1,0,0],o=[.3,.4,.3,0,0],a=[.5,.5,.8,0,0],l=[1,0,0,0,0],c=[0,1,0,0,0],f=[0,0,1,0,0],d=(b,$)=>b.map((v,x)=>v*(1-n)+$[x]*n),p=d(l,s),m=d(c,o),g=d(f,a),h=[...p,...m,...g,0,0,0,1,0].join(" ");return i+=`<feColorMatrix${u("in",`${r}_gray`)}${u("type","matrix")}${u("values",h)}${u("result",r)}/>`,i}function wd(t,e,r){let{amount:n,scale:i}=t;if(n===0)return H(e,r);let s=1/i,o="";return o+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",s)}${u("numOctaves",3)}${u("seed",0)}${u("result",`${r}_noise`)}/>`,o+=`<feColorMatrix${u("in",`${r}_noise`)}${u("type","saturate")}${u("values",0)}${u("result",`${r}_noiseGray`)}/>`,o+=`<feBlend${u("in",e)}${u("in2",`${r}_noiseGray`)}${u("mode","overlay")}${u("result",`${r}_blended`)}/>`,o+=`<feComposite${u("in",`${r}_blended`)}${u("in2",e)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",n)}${u("k3",1-n)}${u("k4",0)}${u("result",`${r}_amt`)}/>`,o+=`<feComposite${u("in",`${r}_amt`)}${u("in2",e)}${u("operator","in")}${u("result",r)}/>`,o}function Pd(t,e,r){let{strength:n,angle:i}=t;if(n===0)return H(e,r);let s=i*Math.PI/180,o=Math.cos(s),a=Math.sin(s),l=n,c=[-(l*(o+a)),-(l*a),l*(-o+a),-(l*o),1,l*o,l*(o-a),l*a,l*(o+a)].join(" ");return`<feConvolveMatrix${u("in",e)}${u("order","3 3")}${u("kernelMatrix",c)}${u("divisor",1)}${u("bias",.5)}${u("preserveAlpha","true")}${u("result",r)}/>`}function _d(t,e,r){let{amount:n,size:i}=t;if(n===0)return H(e,r);let s=.5/i,o="";return o+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",`${s} ${s}`)}${u("numOctaves",5)}${u("seed",0)}${u("stitchTiles","stitch")}${u("result",`${r}_grain`)}/>`,o+=`<feColorMatrix${u("in",`${r}_grain`)}${u("type","saturate")}${u("values",0)}${u("result",`${r}_grainGray`)}/>`,o+=`<feBlend${u("in",e)}${u("in2",`${r}_grainGray`)}${u("mode","soft-light")}${u("result",`${r}_blended`)}/>`,o+=`<feComposite${u("in",`${r}_blended`)}${u("in2",e)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",n)}${u("k3",1-n)}${u("k4",0)}${u("result",`${r}_amt`)}/>`,o+=`<feComposite${u("in",`${r}_amt`)}${u("in2",e)}${u("operator","in")}${u("result",r)}/>`,o}function Rd(t,e,r){let{wetness:n,turbulence:i}=t;if(n===0&&i===0)return H(e,r);let s="";return s+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",.02+i*.03)}${u("numOctaves",4)}${u("seed",42)}${u("result",`${r}_turb`)}/>`,s+=`<feDisplacementMap${u("in",e)}${u("in2",`${r}_turb`)}${u("scale",n*15)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${r}_disp`)}/>`,s+=`<feGaussianBlur${u("in",`${r}_disp`)}${u("stdDeviation",n*2)}${u("result",`${r}_blur`)}/>`,s+=`<feBlend${u("in",`${r}_blur`)}${u("in2",e)}${u("mode","multiply")}${u("result",r)}/>`,s}function Ad(t,e,r){let{thickness:n,texture:i}=t;if(n===0&&i===0)return H(e,r);let s="";s+=`<feTurbulence${u("type","turbulence")}${u("baseFrequency",.03+i*.02)}${u("numOctaves",3)}${u("seed",1e3)}${u("result",`${r}_brush`)}/>`;let o=Math.max(3,8-Math.floor(n*5)),a=Array.from({length:o+1},(l,c)=>c/o).join(" ");s+=`<feComponentTransfer${u("in",e)}${u("result",`${r}_poster`)}>`;for(let l of["R","G","B"])s+=`<feFunc${l}${u("type","discrete")}${u("tableValues",a)}/>`;return s+="</feComponentTransfer>",s+=`<feDisplacementMap${u("in",`${r}_poster`)}${u("in2",`${r}_brush`)}${u("scale",i*4)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${r}_disp`)}/>`,s+=`<feMorphology${u("in",`${r}_disp`)}${u("operator","dilate")}${u("radius",n*.5)}${u("result",`${r}_thick`)}/>`,s+=`<feComposite${u("in",`${r}_thick`)}${u("in2",e)}${u("operator","in")}${u("result",r)}/>`,s}function Id(t,e,r){let{spread:n,edges:i}=t;if(n===0&&i===0)return H(e,r);let s="";return s+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",.01+i*.02)}${u("numOctaves",5)}${u("seed",1100)}${u("result",`${r}_ink`)}/>`,s+=`<feMorphology${u("in",e)}${u("operator","dilate")}${u("radius",n*3)}${u("result",`${r}_dilate`)}/>`,s+=`<feDisplacementMap${u("in",`${r}_dilate`)}${u("in2",`${r}_ink`)}${u("scale",i*10)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${r}_disp`)}/>`,s+=`<feGaussianBlur${u("in",`${r}_disp`)}${u("stdDeviation",n*.5)}${u("result",r)}/>`,s}function Md(t,e,r){let{wrinkles:n,shine:i}=t;if(n===0&&i===0)return H(e,r);let s="";return s+=`<feTurbulence${u("type","turbulence")}${u("baseFrequency",.02)}${u("numOctaves",4)}${u("seed",1200)}${u("result",`${r}_wrinkle`)}/>`,s+=`<feDisplacementMap${u("in",e)}${u("in2",`${r}_wrinkle`)}${u("scale",n*15)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${r}_disp`)}/>`,s+=`<feSpecularLighting${u("in",`${r}_wrinkle`)}${u("surfaceScale",n*2)}${u("specularConstant",i*1.5)}${u("specularExponent",20)}${u("result",`${r}_sheen`)}>`,s+=`<feDistantLight${u("azimuth",45)}${u("elevation",60)}/>`,s+="</feSpecularLighting>",s+=`<feBlend${u("in",`${r}_disp`)}${u("in2",`${r}_sheen`)}${u("mode","screen")}${u("result",`${r}_blend`)}/>`,s+=`<feComposite${u("in",`${r}_blend`)}${u("in2",e)}${u("operator","in")}${u("result",r)}/>`,s}function Cd(t,e,r){let{density:n,size:i}=t;if(n===0)return H(e,r);let s="",o=1-n;s+=`<feTurbulence${u("type","turbulence")}${u("baseFrequency",.1/i)}${u("numOctaves",1)}${u("seed",1400)}${u("result",`${r}_hole`)}/>`,s+=`<feComponentTransfer${u("in",`${r}_hole`)}${u("result",`${r}_thresh`)}>`;for(let a of["R","G","B","A"])s+=`<feFunc${a}${u("type","linear")}${u("slope",10)}${u("intercept",-o*10+5)}/>`;s+="</feComponentTransfer>",s+=`<feComponentTransfer${u("in",`${r}_thresh`)}${u("result",`${r}_clamp`)}>`;for(let a of["R","G","B","A"])s+=`<feFunc${a}${u("type","table")}${u("tableValues","0 0 1 1")}/>`;return s+="</feComponentTransfer>",s+=`<feComposite${u("in",e)}${u("in2",`${r}_clamp`)}${u("operator","in")}${u("result",r)}/>`,s}function Dd(t,e,r){let{color:n,radius:i,intensity:s}=t;if(s===0||i===0)return H(e,r);let{r:o,g:a,b:l}=Cn(n),c="";return c+=`<feColorMatrix${u("in",e)}${u("type","matrix")}${u("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${u("result",`${r}_alpha`)}/>`,c+=`<feGaussianBlur${u("in",`${r}_alpha`)}${u("stdDeviation",i/2)}${u("result",`${r}_blur`)}/>`,c+=`<feColorMatrix${u("in",`${r}_blur`)}${u("type","matrix")}${u("values",`0 0 0 0 ${o} 0 0 0 0 ${a} 0 0 0 0 ${l} 0 0 0 ${s} 0`)}${u("result",`${r}_color`)}/>`,c+=`<feMerge${u("result",r)}><feMergeNode${u("in",`${r}_color`)}/><feMergeNode${u("in",e)}/></feMerge>`,c}function Fd(t,e,r){let{color:n,radius:i,intensity:s}=t;if(s===0||i===0)return H(e,r);let{r:o,g:a,b:l}=Cn(n),c="";return c+=`<feColorMatrix${u("in",e)}${u("type","matrix")}${u("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${u("result",`${r}_alpha`)}/>`,c+=`<feMorphology${u("in",`${r}_alpha`)}${u("operator","erode")}${u("radius",i/4)}${u("result",`${r}_erode`)}/>`,c+=`<feComposite${u("in",`${r}_alpha`)}${u("in2",`${r}_erode`)}${u("operator","out")}${u("result",`${r}_edge`)}/>`,c+=`<feGaussianBlur${u("in",`${r}_edge`)}${u("stdDeviation",i/3)}${u("result",`${r}_blur`)}/>`,c+=`<feColorMatrix${u("in",`${r}_blur`)}${u("type","matrix")}${u("values",`0 0 0 0 ${o} 0 0 0 0 ${a} 0 0 0 0 ${l} 0 0 0 ${s*2} 0`)}${u("result",`${r}_color`)}/>`,c+=`<feComposite${u("in",`${r}_color`)}${u("in2",`${r}_alpha`)}${u("operator","in")}${u("result",`${r}_clipped`)}/>`,c+=`<feComposite${u("in",`${r}_clipped`)}${u("in2",e)}${u("operator","over")}${u("result",r)}/>`,c}function H(t,e){return`<feMerge${u("result",e)}><feMergeNode${u("in",t)}/></feMerge>`}function Dn(t){switch(t.type){case"feBlend":return Ed(t);case"feColorMatrix":return Od(t);case"feComponentTransfer":return Ld(t);case"feComposite":return Nd(t);case"feConvolveMatrix":return Bd(t);case"feDiffuseLighting":return zd(t);case"feSpecularLighting":return Gd(t);case"feDisplacementMap":return Vd(t);case"feDropShadow":return Ud(t);case"feFlood":return Wd(t);case"feGaussianBlur":return Hd(t);case"feImage":return jd(t);case"feMerge":return Kd(t);case"feMorphology":return Xd(t);case"feOffset":return Yd(t);case"feTile":return qd(t);case"feTurbulence":return Zd(t)}}function ue(t){let e="";if(e+=u("in",t.in),e+=u("x",t.x),e+=u("y",t.y),e+=u("width",t.width),e+=u("height",t.height),e+=u("color-interpolation-filters",t.colorInterpolationFilters),e+=u("result",t.result),t.unknownAttrs){let r=Object.keys(t.unknownAttrs).sort();for(let n of r)e+=u(n,t.unknownAttrs[n])}return e}function ce(t){return t.animations&&t.animations.length>0?t.animations.join(""):""}function Ed(t){let e=`<feBlend${ue(t)}${u("in2",t.in2)}${u("mode",t.mode)}`;t.noComposite&&(e+=' no-composite="no-composite"');let r=ce(t);return r?`${e}>${r}</feBlend>`:`${e}/>`}function Od(t){let e=`<feColorMatrix${ue(t)}${u("type",t.matrixType)}${u("values",t.values)}`,r=ce(t);return r?`${e}>${r}</feColorMatrix>`:`${e}/>`}function Mn(t,e){if(!e)return"";let r=`feFunc${t}`;switch(e.type){case"identity":return`<${r} type="identity"/>`;case"table":case"discrete":return`<${r} type="${e.type}"${u("tableValues",e.tableValues.join(" "))}/>`;case"linear":return`<${r} type="linear"${u("slope",e.slope)}${u("intercept",e.intercept)}/>`;case"gamma":return`<${r} type="gamma"${u("amplitude",e.amplitude)}${u("exponent",e.exponent)}${u("offset",e.offset)}/>`}}function Ld(t){let e="";return e+=Mn("R",t.funcR),e+=Mn("G",t.funcG),e+=Mn("B",t.funcB),e+=Mn("A",t.funcA),e+=ce(t),`<feComponentTransfer${ue(t)}>${e}</feComponentTransfer>`}function Nd(t){let e=`<feComposite${ue(t)}${u("in2",t.in2)}${u("operator",t.operator)}`;t.operator==="arithmetic"&&(e+=u("k1",t.k1),e+=u("k2",t.k2),e+=u("k3",t.k3),e+=u("k4",t.k4));let r=ce(t);return r?`${e}>${r}</feComposite>`:`${e}/>`}function Bd(t){let e=`<feConvolveMatrix${ue(t)}`;e+=u("order",t.order),e+=u("kernelMatrix",t.kernelMatrix),e+=u("divisor",t.divisor),e+=u("bias",t.bias),e+=u("targetX",t.targetX),e+=u("targetY",t.targetY),e+=u("edgeMode",t.edgeMode),e+=u("kernelUnitLength",t.kernelUnitLength),t.preserveAlpha!==void 0&&(e+=u("preserveAlpha",t.preserveAlpha?"true":"false"));let r=ce(t);return r?`${e}>${r}</feConvolveMatrix>`:`${e}/>`}function tl(t){switch(t.kind){case"feDistantLight":return`<feDistantLight${u("azimuth",t.azimuth)}${u("elevation",t.elevation)}/>`;case"fePointLight":return`<fePointLight${u("x",t.x)}${u("y",t.y)}${u("z",t.z)}/>`;case"feSpotLight":{let e=`<feSpotLight${u("x",t.x)}${u("y",t.y)}${u("z",t.z)}${u("pointsAtX",t.pointsAtX)}${u("pointsAtY",t.pointsAtY)}${u("pointsAtZ",t.pointsAtZ)}`;return e+=u("specularExponent",t.specularExponent),e+=u("limitingConeAngle",t.limitingConeAngle),e+"/>"}}}function zd(t){let e=`<feDiffuseLighting${ue(t)}`;e+=u("surfaceScale",t.surfaceScale),e+=u("diffuseConstant",t.diffuseConstant),e+=u("kernelUnitLength",t.kernelUnitLength),e+=u("lighting-color",t.lightingColor);let r="";return t.lightSource&&(r+=tl(t.lightSource)),r+=ce(t),`${e}>${r}</feDiffuseLighting>`}function Gd(t){let e=`<feSpecularLighting${ue(t)}`;e+=u("surfaceScale",t.surfaceScale),e+=u("specularConstant",t.specularConstant),e+=u("specularExponent",t.specularExponent),e+=u("kernelUnitLength",t.kernelUnitLength),e+=u("lighting-color",t.lightingColor);let r="";return t.lightSource&&(r+=tl(t.lightSource)),r+=ce(t),`${e}>${r}</feSpecularLighting>`}function Vd(t){let e=`<feDisplacementMap${ue(t)}`;e+=u("in2",t.in2),e+=u("scale",t.scale),e+=u("xChannelSelector",t.xChannelSelector),e+=u("yChannelSelector",t.yChannelSelector);let r=ce(t);return r?`${e}>${r}</feDisplacementMap>`:`${e}/>`}function Ud(t){let e=`<feDropShadow${ue(t)}`;e+=u("dx",t.dx),e+=u("dy",t.dy),e+=u("stdDeviation",t.stdDeviation),e+=u("flood-color",t.floodColor),e+=u("flood-opacity",t.floodOpacity);let r=ce(t);return r?`${e}>${r}</feDropShadow>`:`${e}/>`}function Wd(t){let e=`<feFlood${ue(t)}${u("flood-color",t.floodColor)}${u("flood-opacity",t.floodOpacity)}`,r=ce(t);return r?`${e}>${r}</feFlood>`:`${e}/>`}function Hd(t){let e=`<feGaussianBlur${ue(t)}${u("stdDeviation",t.stdDeviation)}${u("edgeMode",t.edgeMode)}`,r=ce(t);return r?`${e}>${r}</feGaussianBlur>`:`${e}/>`}function jd(t){let e=`<feImage${ue(t)}`;t.href!==void 0?e+=u("href",t.href):t.xlinkHref!==void 0&&(e+=u("xlink:href",t.xlinkHref)),e+=u("preserveAspectRatio",t.preserveAspectRatio),e+=u("crossorigin",t.crossorigin);let r=ce(t);return r?`${e}>${r}</feImage>`:`${e}/>`}function Kd(t){let e="";for(let r of t.nodes)e+=`<feMergeNode${u("in",r.in)}/>`;return e+=ce(t),`<feMerge${ue(t)}>${e}</feMerge>`}function Xd(t){let e=`<feMorphology${ue(t)}${u("operator",t.operator)}${u("radius",t.radius)}`,r=ce(t);return r?`${e}>${r}</feMorphology>`:`${e}/>`}function Yd(t){let e=`<feOffset${ue(t)}${u("dx",t.dx)}${u("dy",t.dy)}`,r=ce(t);return r?`${e}>${r}</feOffset>`:`${e}/>`}function qd(t){let e=`<feTile${ue(t)}`,r=ce(t);return r?`${e}>${r}</feTile>`:`${e}/>`}function Zd(t){let e=`<feTurbulence${ue(t)}`;e+=u("baseFrequency",t.baseFrequency),e+=u("numOctaves",t.numOctaves),e+=u("seed",t.seed),e+=u("stitchTiles",t.stitchTiles),e+=u("type",t.turbulenceType);let r=ce(t);return r?`${e}>${r}</feTurbulence>`:`${e}/>`}function Ms(t,e){let r=`<filter${u("id",t)}`;r+=u("x",e.x),r+=u("y",e.y),r+=u("width",e.width),r+=u("height",e.height),r+=u("filterUnits",e.filterUnits),r+=u("primitiveUnits",e.primitiveUnits),e.filterColorInterpolation&&e.filterColorInterpolation!=="auto"&&(r+=u("color-interpolation-filters",e.filterColorInterpolation)),r+=u("flood-color",e.floodColor),r+=u("flood-opacity",e.floodOpacity),r+=u("lighting-color",e.lightingColor),r+=">",e.filterTitle&&(r+=`<title>${Z(e.filterTitle)}</title>`),e.filterDescription&&(r+=`<desc>${Z(e.filterDescription)}</desc>`);for(let n of e.primitives)r+=Dn(n);if(e.filterAnimations)for(let n of e.filterAnimations)r+=n;return r+="</filter>",r}function Cs(t,e,r,n){switch(t.type){case"drop-shadow":return Qc(t,e,r);case"inner-shadow":return ed(t,e,r);case"gaussian-blur":return td(t,e,r);case"motion-blur":return rd(t,e,r);case"point-light":{let i=t;return Jo(n?{...i,x:i.x+n.x,y:i.y+n.y}:i,e,r)}case"spot-light":{let i=t;return Qo(n?{...i,x:i.x+n.x,y:i.y+n.y,pointsAtX:i.pointsAtX+n.x,pointsAtY:i.pointsAtY+n.y}:i,e,r)}case"diffuse-lighting":return nd(t,e,r);case"specular-lighting":return id(t,e,r);case"outline":return sd(t,e,r);case"sharpen":return ad(t,e,r);case"pixelate":return od(t,e,r);case"warp":return ld(t,e,r);case"morphology":return ud(t,e,r);case"contouring-discrete":return cd(t,e,r);case"contouring-table":return dd(t,e,r);case"round-edges":return fd(t,e,r);case"grayscale":return pd(t,e,r);case"channel-painter":return md(t,e,r);case"brightness":return hd(t,e,r);case"contrast":return gd(t,e,r);case"opacity":return yd(t,e,r);case"invert":return bd(t,e,r);case"hue-rotate":return xd(t,e,r);case"saturate":return Sd(t,e,r);case"black-and-white":return $d(t,e,r);case"sepia":return vd(t,e,r);case"duotone":return kd(t,e,r);case"xray":return Td(t,e,r);case"noise":return wd(t,e,r);case"emboss":return Pd(t,e,r);case"film-grain":return _d(t,e,r);case"watercolor":return Rd(t,e,r);case"gouache":return Ad(t,e,r);case"ink-blot":return Id(t,e,r);case"crumpled-plastic":return Md(t,e,r);case"riddled":return Cd(t,e,r);case"glow":return Dd(t,e,r);case"inner-glow":return Fd(t,e,r);case"raw-svg":return t.svgContent;case"svg-primitive-chain":return t.primitives.map(Dn).join("");default:return H(e,r)}}function Jd(t){return t.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(r=>r.type==="feGaussianBlur"||r.type==="feDropShadow"||r.type==="feOffset"||r.type==="feMorphology"||r.type==="feDisplacementMap"||r.type==="feTurbulence"))}function Ds(t,e,r={}){let n=e.filter(S=>S.enabled);if(n.length===0)return"";let i=r.colorInterpolation&&r.colorInterpolation!=="auto"?u("color-interpolation-filters",r.colorInterpolation):"",s=n.find(S=>S.type==="raw-svg");if(s){let S=r.colorInterpolation&&r.colorInterpolation!=="auto"?r.colorInterpolation:s.colorInterpolationFilters,k=r.filterUnits??s.filterUnits,w=r.primitiveUnits??s.primitiveUnits,T=r.x??s.x,P=r.y??s.y,R=r.width??s.width,M=r.height??s.height;return`<filter${u("id",t)}${u("x",T)}${u("y",P)}${u("width",R)}${u("height",M)}${u("filterUnits",k)}${u("primitiveUnits",w)}${u("color-interpolation-filters",S)}${u("flood-color",s.floodColor)}${u("flood-opacity",s.floodOpacity)}${u("lighting-color",s.lightingColor)}${u("display",s.display)}>${s.svgContent}</filter>`}let o=n.find(S=>S.type==="svg-primitive-chain");if(o){let S={...o,x:r.x??o.x,y:r.y??o.y,width:r.width??o.width,height:r.height??o.height,filterUnits:r.filterUnits??o.filterUnits,primitiveUnits:r.primitiveUnits??o.primitiveUnits,filterColorInterpolation:r.colorInterpolation&&r.colorInterpolation!=="auto"?r.colorInterpolation:o.filterColorInterpolation};return Ms(t,S)}let a=n.some(S=>S.type==="gaussian-blur"&&S.quality==="high"||S.type==="motion-blur"&&S.quality==="high"),l=Jd(n),c=l?a?"-200%":"-100%":"-10%",f=l?a?"500%":"300%":"120%",d="",p="SourceGraphic",m=0;for(let S of n){let k=`result${m++}`;d+=Cs(S,p,k),p=k}let g=r.filterUnits??"objectBoundingBox",h=r.primitiveUnits??"userSpaceOnUse",b=r.x??c,$=r.y??c,v=r.width??f,x=r.height??f;return`<filter${u("id",t)}${u("x",b)}${u("y",$)}${u("width",v)}${u("height",x)}${u("filterUnits",g)}${u("primitiveUnits",h)}${i}>${d}</filter>`}function rl(t){let e="",r=new Set;for(let n of t){let i=n.state.filters;if(!i||i.length===0)continue;let s=i.filter(c=>c.enabled);if(s.length===0)continue;let o=n.state.filterLibraryIds,a=Array.isArray(o)&&o.length>0?o[0]:`filter-${n.id}`;if(r.has(a))continue;r.add(a);let l=n.state;e+=Ds(a,s,{colorInterpolation:l.filterColorInterpolation,filterUnits:l.filterUnits,primitiveUnits:l.primitiveUnits,x:l.filterX,y:l.filterY,width:l.filterWidth,height:l.filterHeight})}return e}function Fn(t,e,r){return!e||e.length===0||e.filter(i=>i.enabled).length===0?"":Array.isArray(r)&&r.length>0?` filter="${r.map(s=>`url(#${Z(s)})`).join(" ")}"`:` filter="url(#filter-${Z(t)})"`}function Qd(t){if(t instanceof Map)return t;let e=new Map;for(let r of t)e.set(r.id,r);return e}function ef(t){if(t.kind==="marker")return t.shapes;if(t.kind!=="symbol")return[];if(!t.variants)return t.shapes;let e=[...t.shapes];for(let r of Object.values(t.variants))e.push(...r);return e}function nl(t,e,r,n){let i=Qd(r),s=new Set,o=[],a=[],l=d=>{if(typeof d!="string"||!d||s.has(d))return;let p=i.get(d);p&&(p.kind!=="symbol"&&p.kind!=="marker"||(s.add(d),o.push(p)))},c=d=>{a.push(d)},f=d=>{let p=d.state;if(!p)return;l(p.symbolId),l(p.markerStart),l(p.markerMid),l(p.markerEnd);let m=p.children;if(Array.isArray(m))for(let h of m)c(h);let g=p.symbolOverrides;if(g&&typeof g=="object"&&!Array.isArray(g))for(let[h,b]of Object.entries(g))!b||typeof b!="object"||Array.isArray(b)||c({id:h,type:"symbol-override",state:b})};for(let d of t)c(d);for(let d of e)l(d);for(;;){let d=a.shift();if(d){n(d),f(d);continue}let p=o.shift();if(!p)break;for(let m of ef(p))c(m)}}var tf=[],rf=[];function fr(t,e,r){nl(t,rf,e,r)}function il(t,e,r){nl(tf,t,e,r)}function sl(t,e){if(!t)return;let r=t,n=r.markerStart;typeof n=="string"&&n&&e(n);let i=r.markerMid;typeof i=="string"&&i&&e(i);let s=r.markerEnd;typeof s=="string"&&s&&e(s);let o=r.startEndpoint;typeof o=="string"&&o&&o!=="none"&&e(dr(o));let a=r.endEndpoint;typeof a=="string"&&a&&a!=="none"&&e(dr(a))}function dr(t){return`line-marker-${t}`}function al(t,e,r){if(!t)return;let n=t,i=o=>{typeof o=="string"&&o&&r(o)};i(n.fillLibraryId),i(n.strokeLibraryId),i(n.markerStart),i(n.markerMid),i(n.markerEnd),i(n.symbolId);let s=n.filterLibraryIds;if(Array.isArray(s)&&s.length>0)for(let o of s)i(o);else Array.isArray(n.filters)&&n.filters.length>0&&r(`filter-${e}`);n.fillLibraryId||i(n.fillGradient?.id),n.strokeLibraryId||i(n.strokeGradient?.id)}function pr(t,e=[]){let r=new Set,n=new Set;return fr(t,e,i=>{let s=i.state;if(!s)return;typeof s.markerStart=="string"&&s.markerStart&&r.add(s.markerStart),typeof s.markerMid=="string"&&s.markerMid&&r.add(s.markerMid),typeof s.markerEnd=="string"&&s.markerEnd&&r.add(s.markerEnd);let o=s.startEndpoint,a=s.endEndpoint;typeof o=="string"&&o&&o!=="none"&&n.add(o),typeof a=="string"&&a&&a!=="none"&&n.add(a)}),{ids:r,legacyEndpoints:n}}function ol(t,e){let{ids:r,legacyEndpoints:n}=pr(t,e);for(let i of n)r.add(dr(i));return r}function mr(t,e,r,n){let i=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/10);switch(t){case"stripes":return[{tag:"rect",attrs:{width:n?.strokeWidth!=null?Math.max(.01,Math.min(1,n.strokeWidth))*e:e/2,height:e,fill:r}}];case"dots":{let s=n?.dotRadius!=null?Math.max(.05,Math.min(.45,n.dotRadius)):.25;return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e*s,fill:r}}]}case"grid":return[{tag:"path",attrs:{d:`M ${e} 0 L 0 0 0 ${e}`,fill:"none",stroke:r,"stroke-width":i}}];case"checkerboard":return[{tag:"rect",attrs:{width:e/2,height:e/2,fill:r}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e/2,height:e/2,fill:r}}];case"diagonal":{let s=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:r,"stroke-width":s}}]}case"crosshatch":return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0 M 0 0 L ${e} ${e}`,stroke:r,"stroke-width":i}}];case"zigzag":{let s=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,o=e*s;return[{tag:"path",attrs:{d:`M 0 ${o} L ${e/4} 0 L ${e/2} ${o} L ${e*3/4} 0 L ${e} ${o}`,fill:"none",stroke:r,"stroke-width":i}}]}case"waves":{let s=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,o=e*s,a=e/2;return[{tag:"path",attrs:{d:`M 0 ${a} Q ${e/4} ${a-o} ${e/2} ${a} T ${e} ${a}`,fill:"none",stroke:r,"stroke-width":i}}]}case"triangles":{let s=e*.866;return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${s} L 0 ${s} Z`,fill:"none",stroke:r,"stroke-width":i}}]}case"hexagons":{let s=e*.866;return[{tag:"path",attrs:{d:`M ${e*.25} 0 L ${e*.75} 0 L ${e} ${s*.5} L ${e*.75} ${s} L ${e*.25} ${s} L 0 ${s*.5} Z`,fill:"none",stroke:r,"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:r,"stroke-width":i}}];case"circles":return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e/3,fill:"none",stroke:r,"stroke-width":i}}];case"bricks":{let s=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:r,"stroke-width":s}},{tag:"rect",attrs:{x:-e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:r,"stroke-width":s}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:r,"stroke-width":s}}]}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:r,"stroke-width":i}}];default:return[]}}function nf(t){let e=Object.entries(t.attrs).map(([r,n])=>` ${r}="${n}"`).join("");return`<${t.tag}${e}/>`}function En(t,e,r,n,i){let s=10*e,o="";o+=`<rect width="${s}" height="${s}" fill="${n}"/>`;let a=mr(t,s,r,i);for(let l of a)o+=nf(l);return{svgContent:o,width:s,height:s}}var hr="0 0 10 10",On=6,Ln=6;function dt(){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 Fs={"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"},sf={"mkr-builtin-arrow":"Arrow","mkr-builtin-open-arrow":"Open Arrow","mkr-builtin-circle":"Circle","mkr-builtin-diamond":"Diamond","mkr-builtin-square":"Square"};function ll(){return dt().map(t=>{let e=Fs[t.id]??t.id;return{kind:"marker",id:e,name:sf[e]??e,viewBox:hr,refX:t.refX,refY:t.refY,markerWidth:6,markerHeight:6,markerUnits:"strokeWidth",orient:"auto-start-reverse",shapes:[],builtIn:!0}})}function af(t){return t.replace(/[^a-zA-Z0-9_-]/g,"_")}function of(t){let e=t.state.symbolOverrides;return!!e&&Object.keys(e).length>0}function Mt(t){let e=t.state.symbolId??"",r=t.state.variantKey??"";return of(t)?`${e}--ovr-${t.id}`:r?`${e}--${af(r)}`:e}function Nn(t,e){let r=e.state.variantKey??"",n=r?t.variants?.[r]??t.shapes:t.shapes,i=e.state.symbolOverrides;return!i||Object.keys(i).length===0?n:n.map(s=>{let o=i[s.id];return!o||Object.keys(o).length===0?s:{...s,state:{...s.state,...o}}})}function gr(t,e){switch(e){case"uppercase":return t.toLocaleUpperCase();case"lowercase":return t.toLocaleLowerCase();case"capitalize":return t.replace(/\b\p{L}/gu,r=>r.toLocaleUpperCase());default:return t}}var lf=[["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 Ct(t){return lf.map(([e,r])=>{let n=t[e],i=typeof n=="string"?n.trim():"";return i?`${r}: ${i}`:""}).filter(Boolean).join("; ")}function Bn(t,e){let r=[],n=(a,l)=>{l!==""&&r.push({name:a,value:l})};t.fontFamily!==e.fontFamily&&n("font-family",String(t.fontFamily)),t.fontSize!==e.fontSize&&n("font-size",String(t.fontSize)),t.fontWeight!==e.fontWeight&&n("font-weight",String(t.fontWeight)),t.fontStyle!==e.fontStyle&&n("font-style",String(t.fontStyle));let i=Ct(t);i&&i!==Ct(e)&&n("style",i);let s=t.textDecoration,o=e.textDecoration;if(s.underline!==o.underline||s.strikethrough!==o.strikethrough||s.overline!==o.overline){let a=[];s.underline&&a.push("underline"),s.strikethrough&&a.push("line-through"),s.overline&&a.push("overline"),n("text-decoration",a.join(" "))}if(t.baselineShift!==e.baselineShift){let a=t.baselineShift;a==="super"||a==="sub"?n("baseline-shift",a):typeof a=="number"&&n("baseline-shift",`${a}px`)}return t.letterSpacing!==e.letterSpacing&&n("letter-spacing",String(t.letterSpacing)),t.fill!==e.fill&&n("fill",String(t.fill)),t.fillOpacity!==e.fillOpacity&&n("fill-opacity",String(t.fillOpacity)),t.direction!==e.direction&&n("direction",String(t.direction)),t.unicodeBidi!==e.unicodeBidi&&n("unicode-bidi",String(t.unicodeBidi)),r}function y(t,e){return e==null||e===""?"":` ${t}="${Z(String(e))}"`}function uf(t){let e=t.map(r=>(r??"").trim().replace(/;$/,"")).filter(Boolean).join("; ");return e?y("style",e):""}function cf(t,e){return typeof e=="number"&&e>0?`${t}: ${e}px`:""}function df(t){if(t&&typeof t=="object"){let e=t;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 ul(t,e){let r=-1;for(let i=t.length-1;i>=0;i--)if(t[i][e]!==null){r=i;break}if(r<0)return[];let n=new Array(r+1);for(let i=0;i<=r;i++)n[i]=t[i][e]??0;return n}function cl(t,e){let r=-1;for(let i=t.length-1;i>=0;i--)if(t[i][e]!==0){r=i;break}if(r<0)return[];let n=new Array(r+1);for(let i=0;i<=r;i++)n[i]=t[i][e];return n}function ff(t){if(t.length===0)return[];let e=t.length-1,r=t[e].rotate;for(;e>0&&t[e-1].rotate===r;)e--;if(e===0&&r===0)return[];let n=new Array(e+1);for(let i=0;i<=e;i++)n[i]=t[i].rotate;return n}function De(t,e){return Rt(t,e)}function pf(t,e,r){return $s(t,e,r)}function mf(t){if(typeof t=="string"){let n=t.trim();return n.length>0?n:void 0}if(!t||typeof t!="object")return;let e=t,r=[];return e.underline&&r.push("underline"),e.strikethrough&&r.push("line-through"),e.overline&&r.push("overline"),r.length>0?r.join(" "):void 0}function hf(t){if(typeof t.strokeDasharray=="string")return t.strokeDasharray;let e=t.lineStyle??"solid",r=t.dashLength??8,n=t.gapLength??4;return It(e,r,n)}function zn(t,e){let r=t[e];return r!==void 0?r:t.extra?.[e]}function gf(t){let e=t.fillType;return e||(t.fillGradient?t.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":zn(t,"linearGradient")?"linear-gradient":zn(t,"radialGradient")?"radial-gradient":"solid")}function yf(t){return t.fillGradient??zn(t,"linearGradient")??zn(t,"radialGradient")??void 0}function Ae(t,e){let r=y("data-shape-id",e),n=gf(t),i=yf(t);if(n==="none")r+=y("fill","none");else if(n==="linear-gradient"||n==="radial-gradient"){let P=t.fillLibraryId??i?.id;r+=y("fill",`url(#${P??`gradient-fill-${e}`})`)}else if(n==="pattern"){let P=t.fillLibraryId??i?.id;r+=y("fill",`url(#${P??`pattern-fill-${e}`})`)}else r+=y("fill",t.fillColor??"#000000");let s=t.opacity;s!==void 0&&s<1&&(r+=y("opacity",s));let o=t.fillOpacity;o!==void 0&&o<1&&(r+=y("fill-opacity",o));let a=t.fillRule;a&&a!=="nonzero"&&(r+=y("fill-rule",a));let l=t.strokeType??"solid",c=t.strokeGradient;if(l==="none")r+=y("stroke","none");else if(l==="linear-gradient"||l==="radial-gradient"){let P=t.strokeLibraryId??c?.id;r+=y("stroke",`url(#${P??`gradient-stroke-${e}`})`)}else if(l==="pattern"){let P=t.strokeLibraryId??c?.id;r+=y("stroke",`url(#${P??`pattern-stroke-${e}`})`)}else r+=y("stroke",t.borderColor??"none");let f=t.borderWidth;f!=null&&(r+=y("stroke-width",f));let d=t.strokeOpacity;d!==void 0&&d<1&&(r+=y("stroke-opacity",d));let p=t.paintOrder;p&&p!=="normal"&&(r+=y("paint-order",p));let m=t.markerStart,g=t.markerMid,h=t.markerEnd;m&&(r+=y("marker-start",`url(#${m})`)),g&&(r+=y("marker-mid",`url(#${g})`)),h&&(r+=y("marker-end",`url(#${h})`));let b=hf(t);b&&(r+=y("stroke-dasharray",b),!t.strokeDasharray&&t.lineStyle==="dotted"&&(r+=y("stroke-linecap","round")));let $=t.dashOffset;$!==void 0&&$!==0&&(r+=y("stroke-dashoffset",$));let v=t.shapeRendering;v&&v!=="auto"&&(r+=y("shape-rendering",v)),r+=Fn(e,t.filters,t.filterLibraryIds);let x=t.systemLanguage;x&&(r+=y("systemLanguage",x));let S=t.requiredExtensions;S&&(r+=y("requiredExtensions",S));let k=t.vectorEffect;k&&k!=="none"&&(r+=y("vector-effect",k));let w=t.visibility;w&&w!=="visible"&&(r+=y("visibility",w));let T=t.metadata;return T&&(T.role&&(r+=y("role",T.role)),T.ariaLabel&&(r+=y("aria-label",T.ariaLabel))),r}function bf(t){let e=t.metadata;if(!e)return"";let r="";return e.title&&(r+=`<title>${Z(e.title)}</title>`),e.description&&(r+=`<desc>${Z(e.description)}</desc>`),r}function xf(t,e){let r=bf(e);if(!r)return t;let n=t.lastIndexOf("/>");if(n===-1){let o=t.indexOf(">");return o===-1?t:t.slice(0,o+1)+r+t.slice(o+1)}let i=t.match(/^<(\w+)/),s=i?i[1]:"g";return t.slice(0,n)+">"+r+`</${s}>`}function Es(t){let e="",r=t.startEndpoint,n=t.endEndpoint;return r&&r!=="none"&&(e+=y("marker-start",`url(#line-marker-${r})`)),n&&n!=="none"&&(e+=y("marker-end",`url(#line-marker-${n})`)),e}function Os(t){let e=t.state,r=e.x??0,n=e.y??0,i=e.radius??50,s=De(e,{x:r,y:n});return`<circle${y("cx",r)}${y("cy",n)}${y("r",i)}${Ae(e,t.id)}${s?y("transform",s):""}/>`}function Ls(t){let e=t.state,r=e.cx??0,n=e.cy??0,i=e.rx??50,s=e.ry??30,o=e.pathLength,a=De(e,{x:r,y:n});return`<ellipse${y("cx",r)}${y("cy",n)}${y("rx",i)}${y("ry",s)}${o!==void 0?y("pathLength",o):""}${Ae(e,t.id)}${a?y("transform",a):""}/>`}function Ns(t){let e=t.state,r=e,n=e.x??0,i=e.y??0,s=e.width??100,o=e.height??100,a=e.cornerRadius??0,l=e.rx??a,c=e.ry??a,f=r.cornerShape??"round",d=r.cornerMode??"uniform",p={x:n+s/2,y:i+o/2},m=De(e,p);if(f!=="round"||d==="non-uniform"){let g=Rn(n,i,s,o,a,f,d,d==="non-uniform"?{radiusTL:r.cornerRadiusTL,radiusTR:r.cornerRadiusTR,radiusBR:r.cornerRadiusBR,radiusBL:r.cornerRadiusBL,shapeTL:r.cornerShapeTL,shapeTR:r.cornerShapeTR,shapeBR:r.cornerShapeBR,shapeBL:r.cornerShapeBL}:void 0);if(g)return`<path${y("d",g)}${Ae(e,t.id)}${m?y("transform",m):""}/>`}return`<rect${y("x",n)}${y("y",i)}${y("width",s)}${y("height",o)}${l>0||c>0?`${y("rx",l)}${y("ry",c)}`:""}${Ae(e,t.id)}${m?y("transform",m):""}/>`}function Bs(t){let e=t.state,r=e.x1??0,n=e.y1??0,i=e.x2??0,s=e.y2??0,o={x:(r+i)/2,y:(n+s)/2},a=De(e,o),l={...e,fillType:"none"};return`<line${y("x1",r)}${y("y1",n)}${y("x2",i)}${y("y2",s)}${Ae(l,t.id)}${Es(e)}${a?y("transform",a):""}/>`}function zs(t){let e=t.state,r=e.x??0,n=e.y??0,i=gr(e.text??"",e.textTransform),s=e.fontSize??16,o=e.fontFamily??"sans-serif",a=e.fontWeight??"normal",l=e.fontStyle??"normal",c=e.textAnchor??"start",f=mf(e.textDecoration),d=e.letterSpacing,p=e.wordSpacing,m=e.lineHeight??1.25,h=De(e,{x:r,y:n}),b=y("x",r)+y("y",n);b+=y("font-size",s),b+=y("font-family",o),a!=="normal"&&(b+=y("font-weight",a)),l!=="normal"&&(b+=y("font-style",l)),c!=="start"&&(b+=y("text-anchor",c)),f&&(b+=y("text-decoration",f)),d&&(b+=y("letter-spacing",d)),p&&(b+=y("word-spacing",p));let $=e.baselineShift;$&&$!=="baseline"&&(b+=y("baseline-shift",$));let v=e.dominantBaseline;v&&v!=="auto"&&(b+=y("dominant-baseline",v));let x=e.writingMode;x&&x!=="horizontal-tb"&&(b+=y("writing-mode",x));let S=e.textLength;S!==void 0&&S>0&&(b+=y("textLength",S),e.lengthAdjust==="spacingAndGlyphs"&&(b+=y("lengthAdjust","spacingAndGlyphs")));let k=e.textDirection;k&&k!=="ltr"&&(b+=y("direction",k));let w=e.unicodeBidi;w&&w!=="normal"&&(b+=y("unicode-bidi",w));let T=e.shapeInsideRef;if(T){b+=y("shape-inside",`url(#${T})`);let D=e.shapePadding;D!==void 0&&(b+=y("shape-padding",D))}let P=Ct(e),R=e.fontVariationSettings,M="";if(R&&Object.keys(R).length>0&&(M=`font-variation-settings: ${Object.entries(R).map(([L,K])=>`'${L}' ${K}`).join(", ")}`),b+=uf([P,M,cf("inline-size",e.inlineSize),typeof e.overflowWrap=="string"?`overflow-wrap: ${e.overflowWrap}`:"",typeof e.whiteSpace=="string"?`white-space: ${e.whiteSpace}`:"",typeof e.lineHeight=="number"?`line-height: ${e.lineHeight}`:""]),b+=Ae(e,t.id),h&&(b+=y("transform",h)),e.isTextPath&&e.textPathPoints){let D=e.textPathPoints,L=e.textPathStartOffset??0,K=e.textPathSide,C=`text-path-${t.id}`,ne=e.textPathMethod,ee=e.textPathSpacing,q=e.textPathLengthAdjust,pe=e.textPathLength,Y="";if(D.length>=2)if(K==="right"){let W=D[D.length-1];Y=`M ${W.x} ${W.y}`;for(let fe=D.length-1;fe>0;fe--){let me=D[fe],ve=D[fe-1],Se=me.handleIn??me,mt=ve.handleOut??ve;Y+=` C ${Se.x} ${Se.y}, ${mt.x} ${mt.y}, ${ve.x} ${ve.y}`}}else{Y=`M ${D[0].x} ${D[0].y}`;for(let W=0;W<D.length-1;W++){let fe=D[W],me=D[W+1],ve=fe.handleOut??fe,Se=me.handleIn??me;Y+=` C ${ve.x} ${ve.y}, ${Se.x} ${Se.y}, ${me.x} ${me.y}`}}return`<defs><path id="${Z(C)}"${y("d",Y)} fill="none"/></defs><text${b}><textPath href="#${Z(C)}"${y("startOffset",`${L}%`)}${y("method",ne)}${y("spacing",ee)}${y("lengthAdjust",q)}${y("textLength",pe)}>${Z(i)}</textPath></text>`}if(e.charOffsets&&Array.isArray(e.charOffsets)&&e.charOffsets.length>0){let D=e.charOffsets.map(df),L=i.split(`
|
|
12
|
+
`),K=e.linePositions??[],C=s*m,ne="",ee=0;return L.forEach((q,pe)=>{let Y=Array.from(q).length,W=D.slice(ee,ee+Y),fe=K[pe],me=fe?r+fe.x:pe>0?r:NaN,ve=fe?fe.dy:pe>0?C:NaN,Se="",mt=ul(W,"x");if(Number.isFinite(me)||mt.length>0){let Wi=mt.length>0?mt.slice():[];Number.isFinite(me)&&(Wi[0]=Wi[0]??me),Se+=y("x",Wi.join(" "))}let $a=ul(W,"y");$a.length>0&&(Se+=y("y",$a.join(" ")));let va=cl(W,"dx");va.length>0&&(Se+=y("dx",va.join(" ")));let ka=cl(W,"dy"),He=ka.length>0||Number.isFinite(ve)?ka.slice():[];for(Number.isFinite(ve)&&(He[0]=(He[0]??0)+ve);He.length>0&&He[He.length-1]===0;)He.pop();He.length>0&&(Se+=y("dy",He.join(" ")));let Ta=ff(W);Ta.length>0&&(Se+=y("rotate",Ta.join(" "))),ne+=`<tspan${Se}>${Z(q)}</tspan>`,ee+=Y+1}),`<text${b}>${ne}</text>`}let B=Kr(e);if(B){let D=Ge(B),L=e.linePositions,K=s*D.lineHeight,C="";return D.lines.forEach((ne,ee)=>{ne.segments.forEach((q,pe)=>{let Y="";if(pe===0){let W=L?.[ee];W?((Math.abs(W.x)>.001||ee>0)&&(Y+=y("x",r+W.x)),(Math.abs(W.dy)>.001||ee>0)&&(Y+=y("dy",W.dy))):ee>0&&(Y+=y("x",r),Y+=y("dy",`${K}px`))}for(let{name:W,value:fe}of Bn(q.style,D.baseStyle))Y+=y(W,fe);Y+=' xml:space="preserve"',C+=`<tspan${Y}>${Z(gr(q.text,q.style.textTransform))}</tspan>`})}),`<text${b}>${C}</text>`}return`<text${b}>${Z(i)}</text>`}function Gs(t){let e=t.state,r=e.pathPoints??[],n=e.pathCurveType??"CUBIC",i=e.pathClosed??!1,s=e.pathTension??.5,o=e.pathArcParams,a=Ye(r,n,i,s,o),l=r.length>0?e.customPivot??{x:r[0].x,y:r[0].y}:void 0,c=l?De(e,l):null;return`<path${y("d",a)}${Ae(e,t.id)}${Es(e)}${c?y("transform",c):""}/>`}function Vs(t){let e=t.state,r=e.polylinePoints??[],n=e.polylineClosed??!1,i=r.map(l=>`${l.x},${l.y}`).join(" "),s=r.length>0?e.customPivot??{x:r[0].x,y:r[0].y}:void 0,o=s?De(e,s):null;return`<${n?"polygon":"polyline"}${y("points",i)}${Ae(e,t.id)}${Es(e)}${o?y("transform",o):""}/>`}function Us(t){let e=t.state,r=e.x??0,n=e.y??0,i=e.width??100,s=e.height??100,o=e.href??"",a=e.imageOpacity,l=e.preserveAspectRatio?"xMidYMid meet":"none",c={x:r+i/2,y:n+s/2},f=De(e,c);return`<image${y("x",r)}${y("y",n)}${y("width",i)}${y("height",s)}${y("href",o)}${y("preserveAspectRatio",l)}${a!==void 0&&a<1?y("opacity",a):""}${Ae(e,t.id)}${f?y("transform",f):""}/>`}function Gn(t){return!t||t.length===0?"":t.map(e=>de(e)).join("")}function Sf(t){let e=t.state,r=e.href,n=e.hrefXlink,i="<a";return r!==void 0&&(i+=y("href",r)),n!==void 0&&(i+=y("xlink:href",n)),i+=y("target",e.linkTarget),i+=y("rel",e.linkRel),i+=y("download",e.linkDownload),i+=y("ping",e.linkPing),i+=y("hreflang",e.linkHreflang),i+=y("type",e.linkType),i+=y("referrerpolicy",e.linkReferrerPolicy),i+=y("data-shape-id",t.id),i+=">",i+=Gn(e.children),i+="</a>",i}function $f(t){let e=t.state,r="<switch";return r+=y("data-shape-id",t.id),r+=">",r+=Gn(e.children),r+="</switch>",r}function vf(t){let e=t.state,r=De(e),n="<g";return n+=y("data-shape-id",t.id),r&&(n+=y("transform",r)),e.opacity!==void 0&&e.opacity<1&&(n+=y("opacity",e.opacity)),e.visibility&&(n+=y("visibility",e.visibility)),e.blendMode&&(n+=y("style",`mix-blend-mode:${e.blendMode}`)),n+=">",n+=Gn(e.children),n+="</g>",n}function kf(t){let e=t.state,r=e.viewBoxX,n=e.viewBoxY,i=e.viewBoxWidth,s=e.viewBoxHeight,o=r!==void 0&&n!==void 0&&i!==void 0&&s!==void 0?`${r} ${n} ${i} ${s}`:void 0,a="<view";return a+=y("id",t.id),a+=y("viewBox",o),a+=y("preserveAspectRatio",e.viewPreserveAspectRatio),a+=y("zoomAndPan",e.viewZoomAndPan),a+=y("viewTarget",e.viewTarget),e.viewName&&(a+=y("data-view-name",e.viewName)),a+="/>",a}function Tf(t){let e=t.state,r=e.svgX,n=e.svgY,i=e.svgWidth,s=e.svgHeight,o=e.svgViewBoxX,a=e.svgViewBoxY,l=e.svgViewBoxWidth,c=e.svgViewBoxHeight,f=o!==void 0&&a!==void 0&&l!==void 0&&c!==void 0?`${o} ${a} ${l} ${c}`:void 0,d="<svg";return d+=y("xmlns","http://www.w3.org/2000/svg"),d+=y("x",r),d+=y("y",n),d+=y("width",i),d+=y("height",s),d+=y("viewBox",f),d+=y("preserveAspectRatio",e.svgPreserveAspectRatio),d+=y("data-shape-id",t.id),d+=">",d+=Gn(e.children),d+="</svg>",d}function wf(t){let e=t.state,r=e.targetShapeId;if(!r)return`<!-- shape-reference ${Z(t.id)} has no targetShapeId -->`;let n=e.offsetX??0,i=e.offsetY??0,s="<use";return s+=y("href",`#${r}`),s+=y("x",n),s+=y("y",i),e.width!==void 0&&(s+=y("width",e.width)),e.height!==void 0&&(s+=y("height",e.height)),s+=y("data-shape-id",t.id),e.opacity!==void 0&&e.opacity<1&&(s+=y("opacity",e.opacity)),s+="/>",s}function Ws(t){let e=t.state,r=Mt(t),n=e.x??0,i=e.y??0,s=e.width??100,o=e.height??100;return`<use href="#${Z(r)}" x="${n}" y="${i}" width="${s}" height="${o}"/>`}function Pf(t){let e=t.state,r=e.mediaKind??t.type,n=e.x??0,i=e.y??0,s=e.width??320,o=e.height??180,a=e.href??"",l=e.mediaMimeType,c=e.posterHref,f=e.mediaOpacity,d=`<${r} xmlns="http://www.w3.org/1999/xhtml"`;d+=y("src",a),l&&(d+=y("type",l)),c&&r==="video"&&(d+=y("poster",c)),e.muted&&(d+=' muted=""'),e.loop&&(d+=' loop=""'),e.playbackRate!==void 0&&(d+=y("data-playback-rate",e.playbackRate)),e.volume!==void 0&&(d+=y("data-volume",e.volume)),d+=' preload="auto" playsinline=""',d+=r==="video"?' style="width:100%;height:100%;display:block;"></video>':"></audio>";let p="<foreignObject";return p+=y("x",n),p+=y("y",i),p+=y("width",s),p+=y("height",o),p+=y("data-shape-id",t.id),p+=y("data-media-kind",r),e.naturalDuration!==void 0&&(p+=y("data-natural-duration",e.naturalDuration)),e.begin!==void 0&&(p+=y("data-begin",e.begin)),e.trimStart!==void 0&&(p+=y("data-trim-start",e.trimStart)),e.trimEnd!==void 0&&(p+=y("data-trim-end",e.trimEnd)),e.fadeInDuration!==void 0&&(p+=y("data-fade-in",e.fadeInDuration)),e.fadeOutDuration!==void 0&&(p+=y("data-fade-out",e.fadeOutDuration)),e.systemLanguage&&(p+=y("systemLanguage",e.systemLanguage)),e.requiredExtensions&&(p+=y("requiredExtensions",e.requiredExtensions)),f!==void 0&&f<1&&(p+=y("opacity",f)),p+=">",p+=d,p+="</foreignObject>",p}function Hs(t){let e=t.state,r=e.x??0,n=e.y??0,i=e.width??100,s=e.height??60,o={x:r+i/2,y:n+s/2},a=De(e,o),l=An(t.type,r,n,i,s,{slantPercent:e.slantPercent,topWidthPercent:e.topWidthPercent,capHeightPercent:e.capHeightPercent,waveAmplitudePercent:e.waveAmplitudePercent});return`<path${y("d",l)}${Ae(e,t.id)}${a?y("transform",a):""}/>`}function js(t){let e=t.state,r=e.cx??0,n=e.cy??0,i=e.radius??50,s=e.cornerRadius??0,o=e.shiftAngle??-90,a=e.fillRule??"nonzero",l=pf(e,r,n),c="";switch(t.type){case"triangle":c=Re(cr(3,i,o),s,i);break;case"ngon":{let d=e.sides??6;c=Re(cr(d,i,o),s,i);break}case"star":{let d=e.arms??5,p=e.innerRadiusPercent??50;c=Re(bn(d,i,p,o),s,i);break}case"cross":{let d=e.armWidthPercent??40;c=Re(xn(i,d,o),s,i);break}case"ring":{let d=e.innerRadiusPercent??50;c=wn(i,d,a);break}case"spiral":{let d=e.turns??3,p=e.thicknessPercent??20,m=e.spiralDirection??1;c=Pn(i,d,p,m,o);break}case"gear":{let d=e.teeth??8,p=e.toothDepthPercent??30,m=e.holeRadiusPercent??0;c=_n(d,i,p,s,m,a,o);break}case"arrow":{let d=e.headWidthPercent??100,p=e.headLengthPercent??30,m=e.shaftWidthPercent??40;c=Re(Sn(i,d,p,m,o),s,i);break}case"speechBubble":{let d=e.tailAngleDeg??45,p=e.tailLengthPercent??40,m=e.tailWidthPercent??25;c=Re($n(i,d,p,m,o),s,i);break}case"lightning":{let d=e.boltSegments??3,p=e.boltJaggednessPercent??40,m=e.boltWidthPercent??30;c=Re(vn(i,d,p,m,o),s,i);break}case"heart":{let d=e.lobeRadiusPercent??50,p=e.cleftDepthPercent??25;c=kn(i,d,p,o);break}case"cloud":{let d=e.cloudBumps??5,p=e.cloudPuffinessPercent??60;c=Tn(i,d,p,o);break}default:return`<!-- unsupported polygon shape: ${Z(t.type)} -->`}let f="";return(t.type==="ring"||t.type==="gear")&&(f=y("fill-rule",a)),`<path${y("d",c)}${f}${Ae(e,t.id)}${y("transform",l)}/>`}function de(t){let e;switch(t.type){case"circle":e=Os(t);break;case"ellipse":e=Ls(t);break;case"rectangle":case"square":e=Ns(t);break;case"line":e=Bs(t);break;case"text":e=zs(t);break;case"path":e=Gs(t);break;case"polyline":e=Vs(t);break;case"image":e=Us(t);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=js(t);break;case"diamond":case"parallelogram":case"trapezoid":case"terminator":case"cylinder":case"document-shape":e=Hs(t);break;case"hyperlink":e=Sf(t);break;case"switch":e=$f(t);break;case"container":case"group":e=vf(t);break;case"view":e=kf(t);break;case"svg":e=Tf(t);break;case"shape-reference":e=wf(t);break;case"symbol-instance":e=Ws(t);break;case"audio":case"video":e=Pf(t);break;default:return`<!-- unsupported shape type: ${Z(t.type)} -->`}return xf(e,t.state)}function dl(t,e){let r=(e.stops??[]).map(o=>{let a=`<stop${y("offset",`${o.offset*100}%`)}${y("stop-color",o.color)}`;return o.opacity!==void 0&&o.opacity<1&&(a+=y("stop-opacity",o.opacity)),a+="/>",a}).join(""),n=e.gradientUnits==="userSpaceOnUse",i=o=>n?String(o):`${o*100}%`,s=n?y("gradientUnits","userSpaceOnUse"):"";return`<linearGradient${y("id",t)}${s}${y("x1",i(e.x1))}${y("y1",i(e.y1))}${y("x2",i(e.x2))}${y("y2",i(e.y2))}${e.spreadMethod?y("spreadMethod",e.spreadMethod):""}>${r}</linearGradient>`}function fl(t,e){let r=(e.stops??[]).map(f=>{let d=`<stop${y("offset",`${f.offset*100}%`)}${y("stop-color",f.color)}`;return f.opacity!==void 0&&f.opacity<1&&(d+=y("stop-opacity",f.opacity)),d+="/>",d}).join(""),n=e.gradientUnits==="userSpaceOnUse",i=f=>n?String(f):`${f*100}%`,s=n?y("gradientUnits","userSpaceOnUse"):"",o="",a=e.ry!==void 0&&e.ry!==e.r,l=!!e.rotation;if(a||l){let f=e.cx??(n?0:.5),d=e.cy??(n?0:.5),p=[];p.push(`translate(${f}, ${d})`),l&&p.push(`rotate(${e.rotation})`),a&&e.ry!==0&&p.push(`scale(1, ${e.ry/e.r})`),p.push(`translate(-${f}, -${d})`),o=y("gradientTransform",p.join(" "))}let c=e.fr!==void 0&&e.fr>0?y("fr",i(e.fr)):"";return`<radialGradient${y("id",t)}${s}${y("cx",i(e.cx))}${y("cy",i(e.cy))}${y("fx",i(e.fx))}${y("fy",i(e.fy))}${y("r",i(e.r))}${c}${e.spreadMethod?y("spreadMethod",e.spreadMethod):""}${o}>${r}</radialGradient>`}function pl(t,e){if(e.svgContent!=null){let a=e.width??10,l=e.height??10,c=e.patternUnits??"userSpaceOnUse",f=e.patternContentUnits,d=e.patternTransform,p=e.viewBox,m=e.preserveAspectRatio,g=e.x??0,h=e.y??0,b=`<pattern${y("id",t)}`;return b+=y("patternUnits",c),f&&(b+=y("patternContentUnits",f)),g&&(b+=y("x",g)),h&&(b+=y("y",h)),b+=y("width",a),b+=y("height",l),p&&(b+=y("viewBox",p)),m&&(b+=y("preserveAspectRatio",m)),d&&(b+=y("patternTransform",d)),b+=`>${e.svgContent}</pattern>`,b}let r=10*(e.scale??1),n=e.rotation??0,i=e.color||"#000000",s=e.backgroundColor||"#ffffff",o="";return o+=`<rect${y("width",r)}${y("height",r)}${y("fill",s)}/>`,o+=_f(e.patternType,r,i),`<pattern${y("id",t)}${y("patternUnits","userSpaceOnUse")}${y("width",r)}${y("height",r)}${n?y("patternTransform",`rotate(${n})`):""}>${o}</pattern>`}function _f(t,e,r){return mr(t,e,r).map(i=>{let s=Object.entries(i.attrs).map(([o,a])=>y(o,a)).join("");return`<${i.tag}${s}/>`}).join("")}function Fe(t,e=[]){let r=Array.isArray(t)?pr(t,e):t;if(r.ids.size===0&&r.legacyEndpoints.size===0)return"";let n="",i=dt();for(let s of i){let o=s.id,a=o.replace("line-marker-",""),l=`mkr-builtin-${a}`,c=r.legacyEndpoints.has(a)||r.ids.has(o),f=r.ids.has(l);if(!c&&!f)continue;let d=s.element,p=Object.entries(d.attrs).map(([h,b])=>y(h,b)).join(""),m=`<${d.tag}${p}/>`,g=h=>{n+=`<marker${y("id",h)}${y("viewBox",hr)}${y("refX",s.refX)}${y("refY",s.refY)}${y("markerWidth",6)}${y("markerHeight",6)}${y("orient","auto-start-reverse")}>${m}</marker>`};c&&g(o),f&&g(l)}return n}var We=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),Ks=["linear-gradient","radial-gradient","pattern","filter","marker","symbol"];function Xs(t){switch(t.kind){case"symbol":return Ys(t);case"marker":return qs(t);case"linear-gradient":return Zs(t);case"radial-gradient":return Js(t);case"pattern":return Qs(t);case"filter":return ea(t)}}function Ys(t){let e=t.shapes.map(i=>de(i)).join(""),r=t.viewBox?` viewBox="${We(t.viewBox)}"`:"",n=t.overflow?` overflow="${We(t.overflow)}"`:"";return`<symbol id="${We(t.id)}"${r}${n}>${e}</symbol>`}function qs(t){let e;if(t.builtIn){let s=dt().find(o=>t.id.includes(o.id)||t.id===o.id);if(s){let o=Object.entries(s.element.attrs).map(([a,l])=>` ${a}="${We(String(l))}"`).join("");e=`<${s.element.tag}${o}/>`}else e=""}else e=t.shapes.map(s=>de(s)).join("");let r=typeof t.orient=="number"?String(t.orient):t.orient,n=t.viewBox?` viewBox="${We(t.viewBox)}"`:"",i=t.overflow?` overflow="${We(t.overflow)}"`:"";return`<marker id="${We(t.id)}"${n} refX="${t.refX}" refY="${t.refY}" markerWidth="${t.markerWidth}" markerHeight="${t.markerHeight}" markerUnits="${We(t.markerUnits)}" orient="${We(r)}"${i}>${e}</marker>`}function Zs(t){let e={...t.gradient,type:"linear-gradient",id:t.id};return dl(t.id,e)}function Js(t){let e={...t.gradient,type:"radial-gradient",id:t.id};return fl(t.id,e)}function Qs(t){let e={...t.pattern,type:"pattern",id:t.id};return pl(t.id,e)}function ea(t){return Ds(t.id,t.filters,{colorInterpolation:t.colorInterpolation,filterUnits:t.filterUnits,primitiveUnits:t.primitiveUnits,x:t.x,y:t.y,width:t.width,height:t.height})}function yr(t){let e=new Map;for(let n of t){let i=e.get(n.kind);i?i.push(n):e.set(n.kind,[n])}let r="";for(let n of Ks){let i=e.get(n);if(i)for(let s of i)r+=Xs(s)}return r}function qe(t,e){let r=br(t,e);return r.length===0?"":yr(r)}function br(t,e){let r=new Map;for(let l of e)r.set(l.id,l);let n=new Map,i=l=>{if(!l)return;let c=r.get(l);c&&n.set(l,c)},s=(l,c)=>{if(!l||typeof l!="object")return;let f=l;if(!f.id||n.has(f.id))return;let d=c==="linear-gradient"?"linear-gradient":c==="radial-gradient"?"radial-gradient":c==="pattern"?"pattern":null;if(!d)return;let{id:p,sourceId:m,...g}=l,h;if(d==="linear-gradient")h={kind:"linear-gradient",id:f.id,name:m??f.id,sourceId:m,gradient:g};else if(d==="radial-gradient")h={kind:"radial-gradient",id:f.id,name:m??f.id,sourceId:m,gradient:g};else{let{customPatternId:b,...$}=g;h={kind:"pattern",id:f.id,name:m??f.id,sourceId:m,pattern:$}}n.set(f.id,h)},o=(l,c)=>{let f=l.filters;if(!Array.isArray(f)||f.length===0)return;let d=`filter-${c}`;n.has(d)||n.set(d,{kind:"filter",id:d,name:d,filters:f,...l.filterColorInterpolation&&l.filterColorInterpolation!=="auto"?{colorInterpolation:l.filterColorInterpolation}:{},...l.filterUnits?{filterUnits:l.filterUnits}:{},...l.primitiveUnits?{primitiveUnits:l.primitiveUnits}:{},...typeof l.filterX=="string"?{x:l.filterX}:{},...typeof l.filterY=="string"?{y:l.filterY}:{},...typeof l.filterWidth=="string"?{width:l.filterWidth}:{},...typeof l.filterHeight=="string"?{height:l.filterHeight}:{}})},a=l=>{let c=l.state;if(!c)return;i(c.fillLibraryId),i(c.strokeLibraryId),i(c.markerStart),i(c.markerMid),i(c.markerEnd),i(c.symbolId);let f=c.filterLibraryIds;if(Array.isArray(f))for(let d of f)typeof d=="string"&&i(d);c.fillLibraryId||s(c.fillGradient,c.fillType),c.strokeLibraryId||s(c.strokeGradient,c.strokeType),(!Array.isArray(f)||f.length===0)&&o(c,l.id)};for(let l of t)a(l);return fr(t,e,a),Array.from(n.values())}function ta(t){return t.easing==="custom-bezier"&&t.customBezier?t.customBezier:Rr[t.easing]??null}function ra(t,e,r,n,i){if(t===e&&r===n)return i;let s=1e-6,o=8,a=m=>(((1-3*r+3*t)*m+(3*r-6*t))*m+3*t)*m,l=m=>(((1-3*n+3*e)*m+(3*n-6*e))*m+3*e)*m,c=m=>(3*(1-3*r+3*t)*m+2*(3*r-6*t))*m+3*t,f=i;for(let m=0;m<o;m++){let g=a(f)-i;if(Math.abs(g)<s)return l(f);let h=c(f);if(Math.abs(h)<s)break;f-=g/h}let d=0,p=1;for(f=i;d<p;){let m=a(f);if(Math.abs(m-i)<s)return l(f);i>m?d=f:p=f;let g=(p-d)*.5+d;if(g===f)break;f=g}return l(f)}function na(t){let e=t.split(/\s+/).map(parseFloat);if(e.length!==4||e.some(o=>!Number.isFinite(o)))return t;let[r,n,i,s]=e;return`${1-i} ${1-s} ${1-r} ${1-n}`}function ye(t){return!Number.isFinite(t)||Math.abs(t)<1e-9?"0":Math.abs(t-1)<1e-9?"1":parseFloat(t.toFixed(6)).toString()}function Un([t,e,r,n]){let i=s=>Number.isFinite(s)?parseFloat(s.toFixed(6)).toString():"0";return`${i(t)} ${i(e)} ${i(r)} ${i(n)}`}function ia(t){return t.length>0&&t.every(e=>e==="0 0 1 1")}function xr(t){if(t.length<2)return!1;let e=t.length-1,r=1e-4;for(let n=0;n<t.length;n++){let i=n/e,s=parseFloat(t[n]);if(!Number.isFinite(s)||Math.abs(s-i)>r)return!1}return!0}function Wn(t){if(t.length<2)return!1;let e=t.length-1,r=1e-4;for(let n=0;n<t.length;n++)if(Math.abs(t[n]-n/e)>r)return!1;return!0}function Je(t){let e=t.cycleDuration??(t.keyframes.length>0?t.keyframes[t.keyframes.length-1].time:0);return t.cycleBehavior==="alternate"?e*2:e}function ft(t){let e=t.beginTrigger;if(e)switch(e.type){case"time":{let n=parseFloat(e.value);return Number.isNaN(n)?"":Number.isFinite(n)?n!==0?`${n}s`:"":"indefinite"}case"event":return e.value;case"expression":return"";default:break}let r=t.keyframes[0]?.time??0;return r!==0?`${r}s`:""}function Hn(t){return t.keyframes.length===1&&t.cycleDuration===void 0}function jn(t){return t.calcMode!=="discrete"?!1:t.sourceSmilElement==="set"?!0:!t.sourceSmilElement&&!t.cycleInfinite&&t.keyframes.every(e=>e.easing!=="steps")}function Kn(t,e){if(e<=0)return ft(t);if(ft(t)==="indefinite")return"indefinite";let r=t.keyframes[e]?.time??0;return r!==0?`${r}s`:""}function Xn(t){return t.cycleInfinite?"indefinite":t.cycleRepeats&&t.cycleRepeats>1?String(t.cycleRepeats):null}function pt(t){return t.cycleInfinite||t.fill==="remove"?null:"freeze"}function Yn(t){return t.additive==="sum"?"sum":null}function qn(t){return t.keyframes.map(e=>{let r=typeof e.value=="number"?e.value:parseFloat(String(e.value));return Number.isFinite(r)?Math.max(0,Math.min(1,r)):0})}function Rf(t){let e=r=>Math.max(0,Math.min(1,r));return[t[0],e(t[1]),t[2],e(t[3])]}function Af(t){let[e,r,n,i]=t,s=new Set,o=8;for(let d=1;d<=o;d++)s.add(d/o);let a=r-2*i+1,l=2*(i-2*r),c=r,f=d=>{if(!Number.isFinite(d)||d<=0||d>=1)return;let p=3*(1-d)**2*d*e+3*(1-d)*d**2*n+d**3;p>0&&p<1&&s.add(Number(p.toFixed(6)))};if(Math.abs(a)<1e-9)Math.abs(l)>=1e-9&&f(-c/l);else{let d=l*l-4*a*c;if(d>=0){let p=Math.sqrt(d);f((-l+p)/(2*a)),f((-l-p)/(2*a))}}return[...s].sort((d,p)=>d-p)}function If(t,e,r,n,i,s){let o=typeof t.value=="number"&&typeof e.value=="number",a=Ze(e.value);if(e.easing==="linear-function"&&e.linearPoints&&e.linearPoints.length>=2){if(o){let b=e.linearPoints;for(let $=1;$<b.length;$++){let v=b[$],x=t.time+(e.time-t.time)*v.position,S=t.value+(e.value-t.value)*v.value;n.push(S),i.push(ye(r(x))),s.push("0 0 1 1")}return}n.push(a),i.push(ye(r(e.time))),s.push("0 0 1 1");return}if(e.easing==="steps"){n.push(a),i.push(ye(r(e.time))),s.push("0 0 1 1");return}let l=ta(e);if(!l){n.push(a),i.push(ye(r(e.time))),s.push("0 0 1 1");return}let[,c,,f]=l;if(!(c<0||c>1||f<0||f>1)){n.push(a),i.push(ye(r(e.time))),s.push(Un(l));return}if(!o){n.push(a),i.push(ye(r(e.time))),s.push(Un(Rf(l)));return}let p=Af(l),m=t.value,g=e.value,h=e.time-t.time;for(let b of p){let $=ra(l[0],l[1],l[2],l[3],b),v=t.time+h*b,x=m+(g-m)*$;n.push(x),i.push(ye(r(v))),s.push("0 0 1 1")}}function Ze(t){return Array.isArray(t)?t.join(" "):t}function Mf(t,e,r){let n=[],{count:i,position:s}=r,o=e.time-t.time,a=Ze(t.value),l=Ze(e.value),c=typeof a=="number"&&typeof l=="number",f=typeof a=="string"&&typeof l=="string",d=g=>f?g<.5?a:l:c?a+(l-a)*g:g>=1?l:a,p=g=>{let h=Math.floor(g*i);(s==="jump-start"||s==="jump-both")&&(h+=1);let b;switch(s){case"jump-start":case"jump-end":b=i;break;case"jump-none":b=i-1;break;case"jump-both":b=i+1;break}return h>b&&(h=b),h<0&&(h=0),h/b},m=p(0);for(let g=1;g<=i;g++){let h=g/i,b=p(h);if(b===m)continue;let $=t.time+h*o;n.push({value:d(b),time:$}),m=b}return n.length===0||n[n.length-1].time<e.time?n.push({value:l,time:e.time}):n[n.length-1]={value:l,time:e.time},n}function Cf(t,e){let r=[],n=[],i=(s,o)=>{r.push(s),n.push(ye(e(o)))};i(Ze(t[0].value),t[0].time);for(let s=1;s<t.length;s++){let o=t[s-1],a=t[s];if(a.easing==="steps"&&a.stepsParams){let l=Mf(o,a,a.stepsParams);for(let c of l)i(c.value,c.time)}else i(Ze(a.value),a.time)}return{values:r,keyTimes:n}}function Vn(t,e,r,n,i){if(i.cycleBehavior!=="alternate"||t.length<2)return{values:t,keyTimes:e,keySplines:r,calcMode:n};let s=t.slice(0,-1).reverse(),o=e.slice(0,-1).reverse().map(l=>ye(1-parseFloat(l))),a=r.slice().reverse().map(na);return{values:[...t,...s],keyTimes:[...e,...o],keySplines:[...r,...a],calcMode:n}}function Qe(t){let e=t.keyframes;if(e.length===0)return{values:[],keyTimes:[],keySplines:[],calcMode:"spline"};let r=Je(t),n=e[0]?.time??0,i=c=>r>0?(c-n)/r:0;if(e.some(c=>c.easing==="steps")){let{values:c,keyTimes:f}=Cf(e,i);return Vn(c,f,[],"discrete",t)}if(t.calcMode==="discrete"){let c=e.map(d=>Ze(d.value)),f=e.map(d=>ye(i(d.time)));return Vn(c,f,[],"discrete",t)}if(t.calcMode==="paced"){let c=e.map(d=>Ze(d.value)),f=e.map(d=>ye(i(d.time)));return Vn(c,f,[],"paced",t)}let o=[Ze(e[0].value)],a=[ye(i(e[0].time))],l=[];for(let c=1;c<e.length;c++)If(e[c-1],e[c],i,o,a,l);return Vn(o,a,l,"spline",t)}function Sr(t,e={}){let r=e.defaultCalcMode??"linear",n={};if(t.calcMode==="paced")return r!=="paced"&&(n.calcMode="paced"),n;if(t.calcMode==="discrete")return n.keyTimes=t.keyTimes.join(";"),n.calcMode="discrete",n;let i=t.keySplines.length>0&&!ia(t.keySplines);return xr(t.keyTimes)||(n.keyTimes=t.keyTimes.join(";")),i&&(n.calcMode="spline",n.keySplines=t.keySplines.join(";")),n}function sa(t,e){if(t.shapeId!==e.shapeId||t.keyframes.length!==e.keyframes.length||(t.cycleDuration??-1)!==(e.cycleDuration??-1)||(t.cycleRepeats??1)!==(e.cycleRepeats??1)||!!t.cycleInfinite!=!!e.cycleInfinite||(t.cycleBehavior??"restart")!==(e.cycleBehavior??"restart")||(t.additive??"replace")!==(e.additive??"replace")||(t.calcMode??"linear")!==(e.calcMode??"linear")||!!t.locked!=!!e.locked)return!1;let r=(n,i)=>!n&&!i||!!n&&!!i&&n.type===i.type&&n.value===i.value;if(!r(t.beginTrigger,e.beginTrigger)||!r(t.endTrigger,e.endTrigger))return!1;for(let n=0;n<t.keyframes.length;n++){let i=t.keyframes[n],s=e.keyframes[n];if(i.time!==s.time||i.easing!==s.easing)return!1;let o=i.customBezier,a=s.customBezier;if(!!o!=!!a)return!1;if(o&&a){for(let l=0;l<4;l++)if(o[l]!==a[l])return!1}if(JSON.stringify(i.linearPoints??null)!==JSON.stringify(s.linearPoints??null)||JSON.stringify(i.stepsParams??null)!==JSON.stringify(s.stepsParams??null))return!1}return!0}function Zn(t){let e=new Map,r=new Set,n=new Map;for(let i of t){if(!i.enabled||i.keyframes.length<2||i.property!=="translateX"&&i.property!=="translateY"&&i.property!=="scaleX"&&i.property!=="scaleY")continue;let s=n.get(i.shapeId)??[];s.push(i),n.set(i.shapeId,s)}for(let i of n.values()){let s=new Set;for(let o=0;o<i.length;o++){let a=i[o];if(s.has(a.id))continue;let l=a.property==="translateX"||a.property==="translateY",c=l?"translateX":"scaleX",f=l?"translateY":"scaleY";if(!(a.property!==c&&a.property!==f))for(let d=o+1;d<i.length;d++){let p=i[d];if(s.has(p.id)||!(a.property===c&&p.property===f||a.property===f&&p.property===c)||!sa(a,p))continue;let m=a.property===c?a:p,g=a.property===f?a:p;e.set(m.id,g),r.add(g.id),s.add(m.id),s.add(g.id);break}}}return{partner:e,skip:r}}function Jn(t,e,r,n){if(n){let s=e?n.values:t.values,o=e?t.values:n.values,a=Math.min(s.length,o.length),l=[];for(let c=0;c<a;c++)l.push(`${s[c]} ${o[c]}`);return l}let i=r?"1":"0";return t.values.map(s=>e?`${i} ${s}`:`${s} ${i}`)}var hl={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",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",display:"display",visibility:"visibility",borderWidth:"stroke-width",cornerRadius:"rx",fontSize:"font-size",letterSpacing:"letter-spacing",wordSpacing:"word-spacing",textLength:"textLength",d:"d",pathMorph:"d",polylinePoints:"points"},gl=new Set(["transformMatrix","rotation","skewX","skewY"]),yl=new Set(["translateX","translateY","scaleX","scaleY"]);function Qn(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function j(t,e){return e==null?"":` ${t}="${Qn(e)}"`}function aa(t,e){let r=Sr(t,e);return j("keyTimes",r.keyTimes)+j("calcMode",r.calcMode)+j("keySplines",r.keySplines)}function ei(t,e){return j("dur",`${e}s`)+j("begin",ft(t)||null)+j("repeatCount",Xn(t))}function Df(t){let e=hl[t.property];if(!e)return"";let r=Je(t);if(r<=0)return"";let n=Qe(t);return n.values.length<2?"":"<animate"+j("attributeName",e)+j("values",n.values.join(";"))+aa(n)+ei(t,r)+j("fill",pt(t))+"/>"}function Ff(t){let e;switch(t.property){case"transformMatrix":e="matrix";break;case"rotation":e="rotate";break;case"skewX":e="skewX";break;case"skewY":e="skewY";break;default:return""}let r=Je(t);if(r<=0)return"";let n=Qe(t),i=e==="matrix"?n.values.map(o=>Of(o)):n.values.map(o=>String(o));if(i.length<2||i.some(o=>o.length===0))return"";let s=e==="rotate"&&t.transformOrigin?i.map(o=>`${o} ${t.transformOrigin.x} ${t.transformOrigin.y}`):i;return'<animateTransform attributeName="transform"'+j("type",e)+j("values",s.join(";"))+aa(n)+ei(t,r)+j("additive",Yn(t))+j("fill",pt(t))+"/>"}function Ef(t,e,r){let n=t.property==="scaleX"||t.property==="scaleY",i=t.property==="translateY"||t.property==="scaleY",s=n?"scale":"translate",o=Je(t);if(o<=0)return"";let a=Qe(t);if(a.values.length<2)return"";let l=e?Qe(e):void 0,c=Jn(a,i,n,l);if(c.length<2)return"";let f=!t.replacesCarrierBase||r?"sum":null;return'<animateTransform attributeName="transform"'+j("type",s)+j("values",c.join(";"))+aa(a)+ei(t,o)+j("additive",f)+j("fill",pt(t))+"/>"}function Of(t){if(Array.isArray(t)&&t.length>=6){let e=t.slice(0,6);if(e.every(r=>typeof r=="number"&&Number.isFinite(r)))return e.join(" ")}if(typeof t=="string"){let e=t.trim(),r=/^matrix\(([^)]+)\)$/i.exec(e),i=(r?r[1]:e).split(/[\s,]+/).filter(Boolean).map(Number);if(i.length>=6&&i.slice(0,6).every(Number.isFinite))return i.slice(0,6).join(" ")}return""}function Lf(t){if(!t.motionPath)return"";let e=Je(t);if(e<=0)return"";let r=Qe(t),n=qn(t),i=!!t.motionPathRef&&(t.motionPathRef.mode??"trackShape")==="curveTemplate",s=Sr(r,{defaultCalcMode:"paced"}),o=Wn(n)&&xr(r.keyTimes)&&r.calcMode!=="discrete"&&s.calcMode===void 0,a="<animateMotion";return i||(a+=j("path",t.motionPath)),a+=j("keyTimes",s.keyTimes),o||(a+=j("keyPoints",n.join(";"))),a+=j("calcMode",s.calcMode)+j("keySplines",s.keySplines),a+=ei(t,e),a+=j("fill",pt(t)),t.motionRotate!==void 0&&(a+=j("rotate",typeof t.motionRotate=="number"?String(t.motionRotate):t.motionRotate)),i?a+=`><mpath href="#${Qn(t.motionPathRef.shapeId)}"/></animateMotion>`:a+="/>",a}function ml(t,e){if(gl.has(t.property)||yl.has(t.property)||t.property==="pathMotion")return"";let r=hl[t.property];if(!r)return"";let n=t.keyframes[e];return n?"<set"+j("attributeName",r)+j("to",Array.isArray(n.value)?n.value.join(" "):String(n.value))+j("begin",Kn(t,e)||null)+"/>":""}function Nf(t){let e=ft(t);return e?`<discard begin="${Qn(e)}"/>`:"<discard/>"}function ti(t){let e=new Map,r=t.tracks.map(a=>({...a,locked:a.locked??!1,keyframes:[...a.keyframes].sort((l,c)=>l.time-c.time).map(l=>({...l,time:l.time,value:l.value,easing:l.easing}))})),n=Zn(r),i=new Set,s=new Set,o=(a,l,c)=>{if(!l)return;let f=l;c.sourceSmilId&&!i.has(c.sourceSmilId)&&(i.add(c.sourceSmilId),f=l.replace(/^(<[a-zA-Z]+)/,`$1 id="${Qn(c.sourceSmilId)}"`));let d=e.get(a)??[];d.push(f),e.set(a,d)};for(let a of r){if(!a.enabled||n.skip.has(a.id)||a.keyframes.length<1)continue;if(a.property==="discard"){o(a.shapeId,Nf(a),a);continue}if(Hn(a)){o(a.shapeId,ml(a,0),a);continue}if(jn(a)){for(let c=0;c<a.keyframes.length;c++)o(a.shapeId,ml(a,c),a);continue}if(a.keyframes.length<2)continue;let l="";a.property==="pathMotion"&&a.motionPath?l=Lf(a):gl.has(a.property)?(l=Ff(a),l&&s.add(a.shapeId)):yl.has(a.property)?(l=Ef(a,n.partner.get(a.id),s.has(a.shapeId)),l&&s.add(a.shapeId)):l=Df(a),o(a.shapeId,l,a)}return e}function Dt(t,e={}){let{xmlDeclaration:r=!0,backgroundColor:n,indent:i=!0,className:s}=e,o=t.viewboxes?.[0],a=e.width??o?.width??800,l=e.height??o?.height??600,c=e.viewBox??`0 0 ${a} ${l}`,f=i?`
|
|
13
|
+
`:"",d=i?" ":"",p=t.shapes??[],m=p.filter(D=>D.state?.displayMode==="motionOnly"),g=p.filter(D=>D.state?.displayMode!=="motionOnly"),h=Vf(t),b=Uf(t),$=[...Array.isArray(t.library)?t.library:[],...(b??[]).filter(D=>!D.builtIn&&!(Array.isArray(t.library)&&t.library.some(L=>L.id===D.id)))],v=br(g,$),x=v.length>0?yr(v):"",S=Fe(g,$),k=Wf(h,g,new Set(v.map(D=>D.id))),w=Bf(m),T=x.length>0||S.length>0||k.length>0||w.length>0,P="";T&&(P=`${f}${d}<defs>${f}`,x.length>0&&(P+=`${d}${d}${x}${f}`),S.length>0&&(P+=`${d}${d}${S}${f}`),k.length>0&&(P+=`${d}${d}${k}${f}`),w.length>0&&(P+=`${d}${d}${w}${f}`),P+=`${d}</defs>`);let R="";n&&(R=`${f}${d}<rect width="${a}" height="${l}" fill="${n}"/>`);let M=t.animationTimeline?ti(t.animationTimeline):null,N=g.map(D=>{let L=de(D),K=M?.get(D.id);return K&&K.length>0&&(L=Hf(L,K,d)),`${d}${L}`}).join(f),B="";return r&&(B+=`<?xml version="1.0" encoding="UTF-8"?>${f}`),B+='<svg xmlns="http://www.w3.org/2000/svg"',B+=` width="${a}" height="${l}"`,B+=` viewBox="${c}"`,s&&(B+=` class="${s}"`),B+=">",B+=P,B+=R,g.length>0&&(B+=`${f}${N}`),B+=`${f}</svg>${f}`,B}function Bf(t){if(t.length===0)return"";let e=[];for(let r of t){let n=zf(r);if(!n)continue;let i=Gf(n);e.push(`<path id="${bl(r.id)}" d="${bl(i)}"/>`)}return e.join("")}function zf(t){let e=t.state;if(typeof e?.d=="string")return e.d;switch(t.type){case"rectangle":{let r=e?.x??0,n=e?.y??0,i=e?.width??0,s=e?.height??0;return i<=0||s<=0?null:`M${r},${n}h${i}v${s}h${-i}Z`}case"circle":{let r=e?.cx??0,n=e?.cy??0,i=e?.radius??0;return i<=0?null:`M${r-i},${n}A${i},${i} 0 1 0 ${r+i},${n}A${i},${i} 0 1 0 ${r-i},${n}Z`}case"ellipse":{let r=e?.cx??0,n=e?.cy??0,i=e?.rx??0,s=e?.ry??0;return i<=0||s<=0?null:`M${r-i},${n}A${i},${s} 0 1 0 ${r+i},${n}A${i},${s} 0 1 0 ${r-i},${n}Z`}case"line":{let r=e?.x1??0,n=e?.y1??0,i=e?.x2??0,s=e?.y2??0;return`M${r},${n}L${i},${s}`}default:return null}}function Gf(t){let e=/[Mm]\s*(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)[\s,]+(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/.exec(t);if(!e)return t;let r=parseFloat(e[1]),n=parseFloat(e[2]);if(!isFinite(r)||!isFinite(n)||r===0&&n===0)return t;let i=!0;return t.replace(/([MLCQSTHVAZ])\s*([\d\s.,e+-]*)/gi,(s,o,a)=>{let l=o.toUpperCase(),c=o!==l,f=i;if(i=!1,l==="Z")return s;let d=a.trim().split(/[\s,]+/).filter(m=>m.length>0).map(Number);if(d.length===0||c&&!f)return s;let p=[];if(l==="H")for(let m of d)p.push(m-r);else if(l==="V")for(let m of d)p.push(m-n);else if(l==="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]-r),m+6<d.length&&p.push(d[m+6]-n);else for(let m=0;m<d.length;m+=2)p.push(d[m]-r),m+1<d.length&&p.push(d[m+1]-n);return`${o} ${p.join(" ")}`})}function bl(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}function Vf(t){let r=(Array.isArray(t.library)?t.library:[]).filter(n=>n.kind==="symbol");return r.length>0?r:t.symbols??[]}function Uf(t){let r=(Array.isArray(t.library)?t.library:[]).filter(n=>n.kind==="marker");return r.length>0?r:t.markers}var oa=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function Wf(t,e,r=new Set){if(t.length===0)return"";let n=new Map;for(let l of t)n.set(l.id,l);let i=new Map,s=new Set,o=[...e];for(let l=0;l<o.length;l++){let c=o[l],f=c.state?.children;if(Array.isArray(f)&&o.push(...f),c.type!=="symbol-instance")continue;let d=n.get(c.state.symbolId??"");if(!d)continue;let p=Mt(c);if(s.has(p))continue;s.add(p);let m=Nn(d,c);o.push(...m),!r.has(p)&&i.set(p,{def:d,resolved:m})}if(i.size===0)return"";let a=[];for(let[l,{def:c,resolved:f}]of i){let d=f.map(g=>de(g)).join(""),p=c.viewBox?` viewBox="${oa(c.viewBox)}"`:"",m=c.overflow?` overflow="${oa(c.overflow)}"`:"";a.push(`<symbol id="${oa(l)}"${p}${m}>${d}</symbol>`)}return a.join("")}function Hf(t,e,r){let n=e.join(""),i=0;for(;i<t.length;){let c=t.slice(i);if(!/^<defs[\s>]/.test(c))break;let f=t.indexOf("</defs>",i);if(f===-1)break;i=f+7}let s=t.slice(0,i),o=t.slice(i),a=o.lastIndexOf("/>");if(a!==-1){let c=o.match(/^<(\w+)/),f=c?c[1]:"g";return s+o.slice(0,a)+">"+n+`</${f}>`}let l=o.match(/<\/(\w+)>$/);if(l){let c=o.lastIndexOf(`</${l[1]}>`);return s+o.slice(0,c)+n+o.slice(c)}return s+o+n}var Ft=Math.PI*2;function jf(t,e,r,n){let i=e*e-4*t*r;if(!(i>=0))return;let s=Math.sqrt(i),o=-.5*(e+(e>=0?s:-s));if(t!==0){let a=o/t;a>0&&a<1&&n.push(a)}if(o!==0){let a=r/o;a>0&&a<1&&n.push(a)}}function Kf(t,e,r,n,i){let s=1-i;return s*s*s*t+3*s*s*i*e+3*s*i*i*r+i*i*i*n}function Xf(t,e,r,n){let i=1-n;return i*i*t+2*i*n*e+n*n*r}function ii(t,e,r,n){let i=t<n?t:n,s=t>n?t:n,o=-t+3*e-3*r+n,a=2*(t-2*e+r),l=e-t,c=[];jf(o,a,l,c);for(let f of c){let d=Kf(t,e,r,n,f);d<i&&(i=d),d>s&&(s=d)}return{min:i,max:s}}function si(t,e,r){let n=t<r?t:r,i=t>r?t:r,s=t-2*e+r;if(s!==0){let o=(t-e)/s;if(o>0&&o<1){let a=Xf(t,e,r,o);a<n&&(n=a),a>i&&(i=a)}}return{min:n,max:i}}function xl(t,e,r,n){let i=t*n-e*r>=0?1:-1,s=Math.sqrt((t*t+e*e)*(r*r+n*n));if(s===0)return 0;let o=(t*r+e*n)/s;return o<-1?o=-1:o>1&&(o=1),i*Math.acos(o)}function ua(t,e,r,n,i,s,o,a,l){if(t===a&&e===l||r===0||n===0)return null;let c=Math.abs(r),f=Math.abs(n),d=i%360*Math.PI/180,p=Math.cos(d),m=Math.sin(d),g=(t-a)/2,h=(e-l)/2,b=p*g+m*h,$=-m*g+p*h,v=b*b,x=$*$,S=c*c,k=f*f,w=v/S+x/k;if(w>1){let pe=Math.sqrt(w);c*=pe,f*=pe,S=c*c,k=f*f}let T=S*x+k*v;if(T===0)return null;let P=(S*k-T)/T;P<0&&(P=0);let R=Math.sqrt(P);s===o&&(R=-R);let M=R*(c*$/f),N=R*(-(f*b)/c),B=p*M-m*N+(t+a)/2,D=m*M+p*N+(e+l)/2,L=(b-M)/c,K=($-N)/f,C=(-b-M)/c,ne=(-$-N)/f,ee=xl(1,0,L,K),q=xl(L,K,C,ne);return!o&&q>0?q-=Ft:o&&q<0&&(q+=Ft),{cx:B,cy:D,rx:c,ry:f,phi:d,theta1:ee,deltaTheta:q}}function Yf(t,e){let r=Math.cos(t.phi),n=Math.sin(t.phi),i=Math.cos(e),s=Math.sin(e);return{x:t.cx+t.rx*r*i-t.ry*n*s,y:t.cy+t.rx*n*i+t.ry*r*s}}function qf(t,e,r){if(r>=0){let i=(t-e)%Ft;return i<0&&(i+=Ft),i<=r}let n=(e-t)%Ft;return n<0&&(n+=Ft),n<=-r}function ca(t,e,r,n,i,s,o,a,l){let c={minX:Math.min(t,a),minY:Math.min(e,l),maxX:Math.max(t,a),maxY:Math.max(e,l)},f=ua(t,e,r,n,i,s,o,a,l);if(!f)return c;let d=Math.cos(f.phi),p=Math.sin(f.phi),m=Math.atan2(-f.ry*p,f.rx*d),g=Math.atan2(f.ry*d,f.rx*p),h=[m,m+Math.PI,g,g+Math.PI];for(let b of h){if(!qf(b,f.theta1,f.deltaTheta))continue;let $=Yf(f,b);$.x<c.minX&&(c.minX=$.x),$.x>c.maxX&&(c.maxX=$.x),$.y<c.minY&&(c.minY=$.y),$.y>c.maxY&&(c.maxY=$.y)}return c}var Zf="MmLlHhVvCcSsQqTtAaZz";function ri(t){return t>=48&&t<=57}function Jf(t){return t===32||t===9||t===10||t===12||t===13}var la=class{constructor(e){this.d=e}d;i=0;skipWsp(){for(;this.i<this.d.length&&Jf(this.d.charCodeAt(this.i));)this.i++}skipCommaWsp(){this.skipWsp(),this.d.charCodeAt(this.i)===44&&(this.i++,this.skipWsp())}atEnd(){return this.skipWsp(),this.i>=this.d.length}readCommand(){this.skipWsp();let e=this.d[this.i];return e!==void 0&&Zf.indexOf(e)>=0?(this.i++,e):null}nextIsNumber(){this.skipCommaWsp();let e=this.d.charCodeAt(this.i);return ri(e)||e===43||e===45||e===46}readNumber(){this.skipCommaWsp();let e=this.d,r=this.i,n=this.i,i=e.charCodeAt(n);(i===43||i===45)&&n++;let s=0;for(;n<e.length&&ri(e.charCodeAt(n));)n++,s++;if(e.charCodeAt(n)===46)for(n++;n<e.length&&ri(e.charCodeAt(n));)n++,s++;if(s===0)return null;let o=e.charCodeAt(n);if(o===101||o===69){let l=n+1,c=e.charCodeAt(l);(c===43||c===45)&&l++;let f=0;for(;l<e.length&&ri(e.charCodeAt(l));)l++,f++;f>0&&(n=l)}let a=Number.parseFloat(e.slice(r,n));return Number.isFinite(a)?(this.i=n,a):null}readFlag(){this.skipCommaWsp();let e=this.d[this.i];return e==="0"?(this.i++,!1):e==="1"?(this.i++,!0):null}};function ni(t,e,r){e<t.minX&&(t.minX=e),e>t.maxX&&(t.maxX=e),r<t.minY&&(t.minY=r),r>t.maxY&&(t.maxY=r),t.any=!0}function da(t,e){e.minX<t.minX&&(t.minX=e.minX),e.maxX>t.maxX&&(t.maxX=e.maxX),e.minY<t.minY&&(t.minY=e.minY),e.maxY>t.maxY&&(t.maxY=e.maxY),t.any=!0}function Sl(t,e,r,n,i,s,o,a,l){let c=ii(e,n,s,a),f=ii(r,i,o,l);da(t,{minX:c.min,maxX:c.max,minY:f.min,maxY:f.max})}function $l(t,e,r,n,i,s,o){let a=si(e,n,s),l=si(r,i,o);da(t,{minX:a.min,maxX:a.max,minY:l.min,maxY:l.max})}function fa(t){if(!t)return null;let e=new la(t),r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,any:!1},n=0,i=0,s=0,o=0,a=0,l=0,c=null,f="",d=!1,p=()=>r.any?{minX:r.minX,minY:r.minY,maxX:r.maxX,maxY:r.maxY}:null;for(;!e.atEnd();){let m=e.readCommand();if(m!==null)f=m;else if(f===""||f==="Z"||f==="z"||!e.nextIsNumber())break;if(!d){if(f!=="M"&&f!=="m")return null;d=!0}let g=f>="a"&&f<="z";switch(f){case"M":case"m":{let h=e.readNumber(),b=e.readNumber();if(h===null||b===null)return p();n=g?n+h:h,i=g?i+b:b,s=n,o=i,ni(r,n,i),c=null,f=g?"l":"L";break}case"L":case"l":{let h=e.readNumber(),b=e.readNumber();if(h===null||b===null)return p();n=g?n+h:h,i=g?i+b:b,ni(r,n,i),c=null;break}case"H":case"h":{let h=e.readNumber();if(h===null)return p();n=g?n+h:h,ni(r,n,i),c=null;break}case"V":case"v":{let h=e.readNumber();if(h===null)return p();i=g?i+h:h,ni(r,n,i),c=null;break}case"C":case"c":{let h=e.readNumber(),b=e.readNumber(),$=e.readNumber(),v=e.readNumber(),x=e.readNumber(),S=e.readNumber();if(h===null||b===null||$===null||v===null||x===null||S===null)return p();let k=g?n+h:h,w=g?i+b:b,T=g?n+$:$,P=g?i+v:v,R=g?n+x:x,M=g?i+S:S;Sl(r,n,i,k,w,T,P,R,M),a=T,l=P,c="cubic",n=R,i=M;break}case"S":case"s":{let h=e.readNumber(),b=e.readNumber(),$=e.readNumber(),v=e.readNumber();if(h===null||b===null||$===null||v===null)return p();let x=c==="cubic"?2*n-a:n,S=c==="cubic"?2*i-l:i,k=g?n+h:h,w=g?i+b:b,T=g?n+$:$,P=g?i+v:v;Sl(r,n,i,x,S,k,w,T,P),a=k,l=w,c="cubic",n=T,i=P;break}case"Q":case"q":{let h=e.readNumber(),b=e.readNumber(),$=e.readNumber(),v=e.readNumber();if(h===null||b===null||$===null||v===null)return p();let x=g?n+h:h,S=g?i+b:b,k=g?n+$:$,w=g?i+v:v;$l(r,n,i,x,S,k,w),a=x,l=S,c="quad",n=k,i=w;break}case"T":case"t":{let h=e.readNumber(),b=e.readNumber();if(h===null||b===null)return p();let $=c==="quad"?2*n-a:n,v=c==="quad"?2*i-l:i,x=g?n+h:h,S=g?i+b:b;$l(r,n,i,$,v,x,S),a=$,l=v,c="quad",n=x,i=S;break}case"A":case"a":{let h=e.readNumber(),b=e.readNumber(),$=e.readNumber(),v=e.readFlag(),x=e.readFlag(),S=e.readNumber(),k=e.readNumber();if(h===null||b===null||$===null||v===null||x===null||S===null||k===null)return p();let w=g?n+S:S,T=g?i+k:k;da(r,ca(n,i,h,b,$,v,x,w,T)),n=w,i=T,c=null;break}case"Z":case"z":{n=s,i=o,c=null;break}default:return p()}}return p()}function vl(t,e,r=!1,n=.5,i){return t.length===0?null:fa(Ye(t,e,r,n,i))}function ai(t,e){let r=Ce(t,e);return Dt(t,{width:r.width,height:r.height,xmlDeclaration:e.xmlDeclaration??!1,indent:!0})}function Qf(t){return t==="class"?"className":t==="for"?"htmlFor":t.replace(/-([a-z])/g,(e,r)=>r.toUpperCase())}function kl(t){return t.replace(/\s([a-z][a-z-]*?)=/g,(e,r)=>r.startsWith("data-")||r.startsWith("aria-")?e:` ${Qf(r)}=`)}function oi(t,e){let r=e.componentName??"SvgComponent",n=Ce(t,e),i=e.indent??" ",s=t.shapes??[],o=e.typescript??!1,a=Array.isArray(t.library)?t.library:[],l=qe(s,a),c=Fe(s,a),f=l+c,d=f.length>0,p=s.map(g=>{let h=de(g);return`${i}${i}${i}${kl(h)}`}),m=[];m.push("import React from 'react';"),m.push(""),o?(m.push(`interface ${r}Props {`),m.push(`${i}className?: string;`),m.push(`${i}style?: React.CSSProperties;`),m.push("}"),m.push(""),m.push(`const ${r}: React.FC<${r}Props> = ({ className, style }) => {`)):m.push(`const ${r} = ({ 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}${kl(f)}`),m.push(`${i}${i}${i}</defs>`));for(let g of p)m.push(g);return m.push(`${i}${i}</svg>`),m.push(`${i});`),m.push("};"),m.push(""),m.push(`export default ${r};`),m.push(""),m.join(`
|
|
14
|
+
`)}function li(t,e){let r=e.componentName??"SvgComponent",n=Ce(t,e),i=e.indent??" ",s=t.shapes??[],o=e.typescript??!1,a=Array.isArray(t.library)?t.library:[],l=qe(s,a),c=Fe(s,a),f=l+c,d=f.length>0,p=s.map(g=>`${i}${i}${de(g)}`),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}${f}`),m.push(`${i}${i}</defs>`));for(let g of p)m.push(g);return m.push(`${i}</svg>`),m.push("</template>"),m.push(""),o?m.push('<script setup lang="ts">'):m.push("<script setup>"),m.push(`// ${r}`),o?(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(`
|
|
15
|
+
`)}var ep=new Set(["circle","ellipse","rectangle","square","line","text","image"]);function Tl(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function wl(t){return t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function tp(t){if(!ep.has(t.type))return!0;let e=t.state.metadata;return!!(e?.title||e?.description||t.type==="text"&&t.state.isTextPath)}function ui(t,e){let r=e.componentName??"createSvg",n=Ce(t,e),i=e.indent??" ",s=t.shapes??[],o=e.typescript??!1,a=[];a.push("import * as d3 from 'd3';"),a.push(""),o?a.push(`export function ${r}(container: string | HTMLElement): d3.Selection<SVGSVGElement, unknown, HTMLElement, unknown> {`):a.push(`export function ${r}(container) {`),a.push(`${i}const svg = d3.select(container)`),a.push(`${i}${i}.append('svg')`),a.push(`${i}${i}.attr('xmlns', 'http://www.w3.org/2000/svg')`),a.push(`${i}${i}.attr('width', ${n.width})`),a.push(`${i}${i}.attr('height', ${n.height})`),a.push(`${i}${i}.attr('viewBox', '0 0 ${n.width} ${n.height}');`),a.push("");let l=Array.isArray(t.library)?t.library:[],c=qe(s,l),f=Fe(s,l),d=`${c}${f}`;d.length>0&&(a.push(`${i}svg.append('defs').html(\`${wl(d)}\`);`),a.push(""));for(let p=0;p<s.length;p++){let m=s[p];if(a.push(`${i}// ${m.type}${m.state.metadata?.name?` \u2014 ${m.state.metadata.name}`:""}`),tp(m)){a.push(`${i}svg.append('g').html(\`${wl(de(m))}\`);`),a.push("");continue}let g=Zo(m),h=In(m),b=`shape${p+1}`;a.push(`${i}const ${b} = svg.append('${g}')`);for(let[$,v]of h)a.push(`${i}${i}.attr('${$}', '${Tl(v)}')`);m.type==="text"&&m.state.text&&a.push(`${i}${i}.text('${Tl(m.state.text)}')`),a[a.length-1]=a[a.length-1]+";",a.push("")}return a.push(`${i}return svg;`),a.push("}"),a.push(""),a.join(`
|
|
16
|
+
`)}function Pl(t,e){let r=t.state.metadata?.name;return r?r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""):`${t.type}-${e+1}`}var rp=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linecap","opacity","transform","filter"]);function ci(t,e){let r=Ce(t,e),n=e.indent??" ",i=t.shapes??[],s=[];for(let l=0;l<i.length;l++){let c=i[l],f=Pl(c,l),d=In(c),p=[];for(let[m,g]of d)rp.has(m)&&p.push(`${n}${m}: ${g};`);p.length>0&&s.push(`.${f} {
|
|
17
|
+
${p.join(`
|
|
18
18
|
`)}
|
|
19
|
-
}`)}let o=[];for(let
|
|
20
|
-
`)}function Fn(t,e){let r=Md(t,e),n={...e};switch(n.format){case"svg":return An(r,n);case"react":return Mn(r,n);case"vue":return Cn(r,n);case"d3":return In(r,n);case"css":return Dn(r,n);default:throw new Error(`Unsupported code format: ${n.format}`)}}function Md(t,e){return Array.isArray(t)?{shapes:t,viewboxes:[{id:"default",x:0,y:0,width:e.width??800,height:e.height??600}]}:t}var Qt=class t{_snapshot;constructor(e={}){let{width:r=800,height:n=600,viewboxId:i}=e,s=Ot(0,0,r,n,i);this._snapshot=Ar({viewboxes:[s]})}static fromSnapshot(e){let r=new t;return r._snapshot=JSON.parse(JSON.stringify(e)),r}static fromJSON(e,r){let n=Cr(e,r),i=new t;return i._snapshot=n,i}add(e){let r="build"in e&&typeof e.build=="function"?e.build():e;return this._snapshot.shapes.push(r),this}addAll(...e){for(let r of e)this.add(r);return this}remove(e){let r=this._snapshot.shapes.length;return this._snapshot.shapes=this._snapshot.shapes.filter(n=>n.id!==e),this._snapshot.shapes.length<r}get shapes(){return this._snapshot.shapes}findShape(e){return this._snapshot.shapes.find(r=>r.id===e)}size(e,r){return this._snapshot.viewboxes.length>0?(this._snapshot.viewboxes[0].width=e,this._snapshot.viewboxes[0].height=r):this._snapshot.viewboxes=[Ot(0,0,e,r)],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,r){return this._ensureMetadata(),this._snapshot.documentMetadata.license=e,r!==void 0&&(this._snapshot.documentMetadata.licenseUrl=r),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,r,n){this._snapshot.symbols||(this._snapshot.symbols=[]);let i=_(),s=r.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o={kind:"symbol",id:i,name:e,viewBox:n?.viewBox??"0 0 100 100",shapes:s};return n?.groups&&(o.groups=n.groups),n?.thumbnail&&(o.thumbnail=n.thumbnail),n?.defKind&&(o.defKind=n.defKind),n?.wrapperAttrs&&(o.wrapperAttrs=n.wrapperAttrs),n?.variantAxes&&(o.variantAxes=n.variantAxes),n?.variants&&(o.variants=n.variants),n?.variantThumbnails&&(o.variantThumbnails=n.variantThumbnails),this._snapshot.symbols.push(o),i}placeSymbolInstance(e,r,n,i,s){let o,a={};typeof i=="number"||i===void 0?o=i:(a=i,o=a.width,s=a.height??s);let u={symbolId:e,x:r,y:n,width:o??100,height:s??100};a.variantKey&&(u.variantKey=a.variantKey),a.symbolOverrides&&(u.symbolOverrides=a.symbolOverrides),a.instancePresentation&&(u.instancePresentation=a.instancePresentation);let c={id:_(),type:"symbol-instance",state:u};return this._snapshot.shapes.push(c),this}removeSymbol(e){if(!this._snapshot.symbols)return!1;let r=this._snapshot.symbols.length;return this._snapshot.symbols=this._snapshot.symbols.filter(n=>n.id!==e),this._snapshot.symbols.length<r}get symbols(){return this._snapshot.symbols??[]}defineMarker(e,r,n){let i=_(),s=r.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o={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:s};return n?.groups&&(o.groups=n.groups),n?.thumbnail&&(o.thumbnail=n.thumbnail),this._pushLibraryDef(o),i}defineFilter(e,r,n){let i=_(),s={kind:"filter",id:i,name:e,filters:r};return n?.colorInterpolation&&(s.colorInterpolation=n.colorInterpolation),n?.filterUnits&&(s.filterUnits=n.filterUnits),n?.primitiveUnits&&(s.primitiveUnits=n.primitiveUnits),n?.x!==void 0&&(s.x=n.x),n?.y!==void 0&&(s.y=n.y),n?.width!==void 0&&(s.width=n.width),n?.height!==void 0&&(s.height=n.height),n?.thumbnail&&(s.thumbnail=n.thumbnail),this._pushLibraryDef(s),i}defineLinearGradientLibrary(e,r,n){let i=_(),s="build"in r?r.build():r,{id:o,sourceId:a,...u}=s,c={kind:"linear-gradient",id:i,name:e,gradient:u};return n?.thumbnail&&(c.thumbnail=n.thumbnail),this._pushLibraryDef(c),i}defineRadialGradientLibrary(e,r,n){let i=_(),s="build"in r?r.build():r,{id:o,sourceId:a,...u}=s,c={kind:"radial-gradient",id:i,name:e,gradient:u};return n?.thumbnail&&(c.thumbnail=n.thumbnail),this._pushLibraryDef(c),i}definePatternLibrary(e,r,n){let i=_(),s="build"in r?r.build():r,{id:o,sourceId:a,customPatternId:u,...c}=s,f={kind:"pattern",id:i,name:e,pattern:c};return n?.thumbnail&&(f.thumbnail=n.thumbnail),this._pushLibraryDef(f),i}removeLibraryDef(e){if(!this._snapshot.library)return!1;let r=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(n=>n.id!==e),this._snapshot.library.length<r}get library(){return this._snapshot.library??[]}_pushLibraryDef(e){this._snapshot.library||(this._snapshot.library=[]);let r=this._snapshot.library.findIndex(n=>n.id===e.id);r>=0?this._snapshot.library[r]=e:this._snapshot.library.push(e)}addClipGroup(e,r,n){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=_(),s={id:i,type:"clip",clipShapeIds:e,contentShapeIds:r,parentId:null};return n?.clipPathUnits&&(s.clipPathUnits=n.clipPathUnits),n?.clipRule&&(s.clipRule=n.clipRule),n?.rawDefinition&&(s.rawDefinition=n.rawDefinition),this._snapshot.clipMaskGroups.push(s),i}addMaskGroup(e,r,n){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=_(),s={id:i,type:"mask",clipShapeIds:e,contentShapeIds:r,parentId:null};return n?.maskUnits&&(s.maskUnits=n.maskUnits),n?.maskContentUnits&&(s.maskContentUnits=n.maskContentUnits),n?.maskBounds&&(s.maskBounds=n.maskBounds),n?.maskType&&(s.maskType=n.maskType),n?.rawDefinition&&(s.rawDefinition=n.rawDefinition),this._snapshot.clipMaskGroups.push(s),i}removeClipMaskGroup(e){if(!this._snapshot.clipMaskGroups)return!1;let r=this._snapshot.clipMaskGroups.length;return this._snapshot.clipMaskGroups=this._snapshot.clipMaskGroups.filter(n=>n.id!==e),this._snapshot.clipMaskGroups.length<r}addGuide(e,r,n){this._snapshot.guides||(this._snapshot.guides=[]);let i=_(),s={id:i,orientation:e,position:r,controlPointOffset:0};return n?.color&&(s.color=n.color),n?.opacity!==void 0&&(s.opacity=n.opacity),this._snapshot.guides.push(s),i}removeGuide(e){if(!this._snapshot.guides)return!1;let r=this._snapshot.guides.length;return this._snapshot.guides=this._snapshot.guides.filter(n=>n.id!==e),this._snapshot.guides.length<r}clearGuides(){return this._snapshot.guides=[],this}get guides(){return this._snapshot.guides??[]}addMeasurement(e,r,n){this._snapshot.measurements||(this._snapshot.measurements=[]);let i=_(),s={id:i,type:e,points:r,visible:n?.visible??!0,snapDivisions:n?.snapDivisions??1};return n?.color&&(s.color=n.color),n?.opacity!==void 0&&(s.opacity=n.opacity),this._snapshot.measurements.push(s),i}removeMeasurement(e){if(!this._snapshot.measurements)return!1;let r=this._snapshot.measurements.length;return this._snapshot.measurements=this._snapshot.measurements.filter(n=>n.id!==e),this._snapshot.measurements.length<r}get measurements(){return this._snapshot.measurements??[]}addCustomPattern(e,r,n,i){let s=_();return this._pushLibraryDef(rt({id:s,name:e,svgContent:r,width:n,height:i})),s}removeCustomPattern(e){let r=this._snapshot.library;if(!r)return!1;let n=r.length;return this._snapshot.library=r.filter(i=>!(i.kind==="pattern"&&i.id===e)),this._snapshot.library.length<n}get customPatterns(){let e=[];for(let r of this._snapshot.library??[]){if(r.kind!=="pattern")continue;let n=Tr(r);n&&e.push(n)}return e}addGroup(e,r){this._snapshot.groups||(this._snapshot.groups=[]);let n=e??_();return this._snapshot.groups.push({id:n,parentId:r??null}),n}removeGroup(e){if(!this._snapshot.groups)return!1;let r=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<r}moveToGroup(e,r){let n=this._snapshot.shapes.find(i=>i.id===e);return n&&(n.state.groupId=r),this}removeFromGroup(e){let r=this._snapshot.shapes.find(n=>n.id===e);return r&&delete r.state.groupId,this}bringToFront(e){let r=this._snapshot.shapes.findIndex(n=>n.id===e);if(r>=0){let[n]=this._snapshot.shapes.splice(r,1);this._snapshot.shapes.push(n)}return this}sendToBack(e){let r=this._snapshot.shapes.findIndex(n=>n.id===e);if(r>=0){let[n]=this._snapshot.shapes.splice(r,1);this._snapshot.shapes.unshift(n)}return this}reorder(e,r){let n=this._snapshot.shapes.findIndex(i=>i.id===e);if(n>=0){let[i]=this._snapshot.shapes.splice(n,1),s=Math.max(0,Math.min(r,this._snapshot.shapes.length));this._snapshot.shapes.splice(s,0,i)}return this}defineVariable(e,r,n,i){this._snapshot.templateVariables||(this._snapshot.templateVariables=[]);let s=this._snapshot.templateVariables.find(o=>o.name===e);if(s)s.type=r,s.defaultValue=n,i?.label!==void 0&&(s.label=i.label),i?.description!==void 0&&(s.description=i.description);else{let o={name:e,type:r,defaultValue:n};i?.label!==void 0&&(o.label=i.label),i?.description!==void 0&&(o.description=i.description),this._snapshot.templateVariables.push(o)}return this}removeVariable(e){return this._snapshot.templateVariables&&(this._snapshot.templateVariables=this._snapshot.templateVariables.filter(r=>r.name!==e)),this}get variables(){return this._snapshot.templateVariables??[]}inspectVariables(){return Lr(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:r,...n}=e??{},i=Er(this._snapshot,r);return dt(i,n)}toJSON(e){return Mr(this._snapshot,e)}toSnapshot(){return JSON.parse(JSON.stringify(this._snapshot))}toCode(e,r){return Fn(this._snapshot,{...r,format:e})}_ensureMetadata(){this._snapshot.documentMetadata||(this._snapshot.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{}})}};var En=class{_track;constructor(e,r){this._track={id:_(),shapeId:e,property:r,keyframes:[],enabled:!0,locked:!1}}id(e){return this._track.id=e,this}keyframe(e,r,n="linear"){return this._track.keyframes.push({id:_(),time:e,value:r,easing:n}),this}keyframeBezier(e,r,n){return this._track.keyframes.push({id:_(),time:e,value:r,easing:"custom-bezier",customBezier:n}),this}keyframeLinear(e,r,n){return this._track.keyframes.push({id:_(),time:e,value:r,easing:"linear-function",linearPoints:n}),this}keyframes(...e){return this._track.keyframes.push(...e.map(r=>r.id?r:{...r,id:_()})),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,r="trackShape"){return this._track.motionPathRef={shapeId:e,mode:r},this}beginTrigger(e,r){return this._track.beginTrigger={type:e,value:r},this}endTrigger(e,r){return this._track.endTrigger={type:e,value:r},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,r){return this._track.transformOrigin={x:e,y:r},this}motionRotate(e){return this._track.motionRotate=e,this}additive(e){return this._track.additive=e,this}build(){let e=[...this._track.keyframes].sort((r,n)=>r.time-n.time);return{...this._track,keyframes:e}}},Ln=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(r=>({id:r.id,shapeId:r.shapeId,property:r.property,enabled:r.enabled,locked:r.locked||void 0,motionPath:r.motionPath,motionPathRef:r.motionPathRef,beginTrigger:r.beginTrigger,endTrigger:r.endTrigger,cycleDuration:r.cycleDuration,cycleRepeats:r.cycleRepeats,cycleInfinite:r.cycleInfinite,cycleBehavior:r.cycleBehavior,transformOrigin:r.transformOrigin,motionRotate:r.motionRotate,additive:r.additive,keyframes:r.keyframes.map(n=>({...n.id?{id:n.id}:{},time:n.time,value:n.value,easing:n.easing,...n.customBezier?{customBezier:n.customBezier}:{},...n.linearPoints?{linearPoints:n.linearPoints}:{}}))}))}}};var q=class{_id;_type;_state={};constructor(e,r){this._type=e,this._id=r??_()}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,r){return this._state.fillColor=e,this._state.fillType="solid",r!==void 0&&(this._state.fillOpacity=r),this}noFill(){return this._state.fillType="none",this}fillGradient(e){let r="build"in e?e.build():e;return this._state.fillType=r.type,this._state.fillGradient=r,this}fillPattern(e){let r="build"in e?e.build():e;return this._state.fillType="pattern",this._state.fillGradient=r,this}fillOpacity(e){return this._state.fillOpacity=e,this}fillRule(e){return this._state.fillRule=e,this}stroke(e,r){return this._state.borderColor=e,r!==void 0&&(this._state.borderWidth=r),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 r="build"in e?e.build():e;return this._state.strokeType=r.type,this._state.strokeGradient=r,this}strokePattern(e){let r="build"in e?e.build():e;return this._state.strokeType="pattern",this._state.strokeGradient=r,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,r,n){return this._state.lineStyle=e,e==="custom"&&(r!==void 0&&(this._state.dashLength=r),n!==void 0&&(this._state.gapLength=n)),this}opacity(e){return this._state.opacity=e,this}rotate(e){return this._state.rotation=e,this.refreshTransformMatrix(),this}skew(e,r){return this._state.skewX=e,this._state.skewY=r,this.refreshTransformMatrix(),this}scale(e,r){return this._state.scaleX=e,this._state.scaleY=r??e,this.refreshTransformMatrix(),this}pivot(e,r){return this._state.customPivot={x:e,y:r},this.refreshTransformMatrix(),this}transformMatrix(e){if(e.length<6||!e.slice(0,6).every(Number.isFinite))throw new RangeError("transformMatrix must contain six finite numbers");return this._state.transformMatrix=e.slice(0,6),this}refreshTransformMatrix(){this._state.transformMatrix=De(Et(this._state,this.defaultTransformPivot()))}defaultTransformPivot(){let e=this._state.customPivot;if(e)return e;let r=this._state.x,n=this._state.y,i=this._state.width,s=this._state.height;if(r!==void 0&&n!==void 0&&i!==void 0&&s!==void 0)return{x:r+i/2,y:n+s/2};let o=this._state.radius;if(r!==void 0&&n!==void 0&&o!==void 0)return{x:r,y:n};let a=this._state.cx,u=this._state.cy;if(a!==void 0&&u!==void 0)return{x:a,y:u};let c=this._state.x1,f=this._state.y1,d=this._state.x2,h=this._state.y2;if(c!==void 0&&f!==void 0&&d!==void 0&&h!==void 0)return{x:(c+d)/2,y:(f+h)/2};let p=this._state.pathPoints;if(p?.[0])return{x:p[0].x,y:p[0].y};let g=this._state.polylinePoints;if(g?.[0])return g[0]}filter(...e){let r=this._state.filters??[];return this._state.filters=[...r,...e],this}dropShadow(e={}){let r={id:`drop-shadow-${_()}`,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(r)}innerShadow(e={}){let r={id:`inner-shadow-${_()}`,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(r)}blur(e,r,n){let i=e??4,s=r??i,o={id:`gaussian-blur-${_()}`,type:"gaussian-blur",enabled:!0,blurX:i,blurY:s,linked:i===s,quality:n?.quality??"normal"};return this.filter(o)}glow(e={}){let r={id:`glow-${_()}`,type:"glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(r)}innerGlow(e={}){let r={id:`inner-glow-${_()}`,type:"inner-glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(r)}grayscale(e=1){let r={id:`grayscale-${_()}`,type:"grayscale",enabled:!0,amount:e};return this.filter(r)}sepia(e=1){let r={id:`sepia-${_()}`,type:"sepia",enabled:!0,amount:e};return this.filter(r)}outline(e={}){return this.filter({id:`outline-${_()}`,type:"outline",enabled:!0,width:e.width??3,color:e.color??"#000000",opacity:e.opacity??1,position:e.position??"outside"})}motionBlur(e={}){let r={id:`motion-blur-${_()}`,type:"motion-blur",enabled:!0,distance:e.distance??10,angle:e.angle??0,quality:e.quality??"normal"};return this.filter(r)}pointLight(e={}){let r={id:`point-light-${_()}`,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(r)}spotLight(e={}){let r={id:`spot-light-${_()}`,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(r)}sharpen(e=1){let r={id:`sharpen-${_()}`,type:"sharpen",enabled:!0,amount:e};return this.filter(r)}pixelate(e=8){let r={id:`pixelate-${_()}`,type:"pixelate",enabled:!0,blockSize:e};return this.filter(r)}warp(e={}){let r={id:`warp-${_()}`,type:"warp",enabled:!0,scale:e.scale??10,frequency:e.frequency??.02,octaves:e.octaves??1,warpType:e.warpType??"turbulence"};return this.filter(r)}morphology(e={}){let r=e.radiusX??2,n=e.radiusY??r,i={id:`morphology-${_()}`,type:"morphology",enabled:!0,operator:e.operator??"dilate",radiusX:r,radiusY:n,linked:e.linked??r===n};return this.filter(i)}contouring(e={}){if((e.mode??"discrete")==="table"){let i={id:`contouring-table-${_()}`,type:"contouring-table",enabled:!0,levels:e.levels??4,contrast:e.contrast??1};return this.filter(i)}let n={id:`contouring-discrete-${_()}`,type:"contouring-discrete",enabled:!0,levels:e.levels??4};return this.filter(n)}roundEdges(e=4){let r={id:`round-edges-${_()}`,type:"round-edges",enabled:!0,radius:e};return this.filter(r)}channelPainter(e={}){let r={id:`channel-painter-${_()}`,type:"channel-painter",enabled:!0,red:e.red??1,green:e.green??1,blue:e.blue??1};return this.filter(r)}brightness(e=1){let r={id:`brightness-${_()}`,type:"brightness",enabled:!0,amount:e};return this.filter(r)}contrast(e=1){let r={id:`contrast-${_()}`,type:"contrast",enabled:!0,amount:e};return this.filter(r)}filterOpacity(e=1){let r={id:`opacity-${_()}`,type:"opacity",enabled:!0,amount:e};return this.filter(r)}invert(e=1){let r={id:`invert-${_()}`,type:"invert",enabled:!0,amount:e};return this.filter(r)}hueRotate(e=0){let r={id:`hue-rotate-${_()}`,type:"hue-rotate",enabled:!0,angle:e};return this.filter(r)}saturate(e=1){let r={id:`saturate-${_()}`,type:"saturate",enabled:!0,amount:e};return this.filter(r)}blackAndWhite(e=.5){let r={id:`black-and-white-${_()}`,type:"black-and-white",enabled:!0,threshold:e};return this.filter(r)}duotone(e={}){let r={id:`duotone-${_()}`,type:"duotone",enabled:!0,shadowColor:e.shadowColor??"#000000",highlightColor:e.highlightColor??"#ffffff"};return this.filter(r)}xray(e=1){let r={id:`xray-${_()}`,type:"xray",enabled:!0,intensity:e};return this.filter(r)}noise(e={}){let r={id:`noise-${_()}`,type:"noise",enabled:!0,amount:e.amount??.3,scale:e.scale??1};return this.filter(r)}emboss(e={}){let r={id:`emboss-${_()}`,type:"emboss",enabled:!0,strength:e.strength??1,angle:e.angle??135};return this.filter(r)}filmGrain(e={}){let r={id:`film-grain-${_()}`,type:"film-grain",enabled:!0,amount:e.amount??.3,size:e.size??1};return this.filter(r)}watercolor(e={}){let r={id:`watercolor-${_()}`,type:"watercolor",enabled:!0,wetness:e.wetness??.5,turbulence:e.turbulence??.5};return this.filter(r)}gouache(e={}){let r={id:`gouache-${_()}`,type:"gouache",enabled:!0,thickness:e.thickness??.5,texture:e.texture??.5};return this.filter(r)}inkBlot(e={}){let r={id:`ink-blot-${_()}`,type:"ink-blot",enabled:!0,spread:e.spread??.5,edges:e.edges??.5};return this.filter(r)}crumpledPlastic(e={}){let r={id:`crumpled-plastic-${_()}`,type:"crumpled-plastic",enabled:!0,wrinkles:e.wrinkles??.5,shine:e.shine??.5};return this.filter(r)}riddled(e={}){let r={id:`riddled-${_()}`,type:"riddled",enabled:!0,density:e.density??.5,size:e.size??1};return this.filter(r)}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,r="linear-gradient"){return this._state.fillLibraryId=e,this._state.fillType=r,this}strokeLibrary(e,r="linear-gradient"){return this._state.strokeLibraryId=e,this._state.strokeType=r,this}filterLibrary(...e){let r=this._state.filterLibraryIds??[];return this._state.filterLibraryIds=[...r,...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,r){let n=this._state.bindings??{};return this._state.bindings={...n,[e]:r},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}}}},Bn=class extends q{constructor(e,r,n){if(n<0)throw new RangeError("Circle radius must be non-negative");super("circle"),this._state.x=e,this._state.y=r,this._state.radius=n}position(e,r){return this._state.x=e,this._state.y=r,this}radius(e){return this._state.radius=e,this}},Nn=class extends q{constructor(e,r,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=r,this._state.rx=n,this._state.ry=i}position(e,r){return this._state.cx=e,this._state.cy=r,this}radii(e,r){return this._state.rx=e,this._state.ry=r,this}},On=class extends q{constructor(e,r,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=r,this._state.width=n,this._state.height=i}position(e,r){return this._state.x=e,this._state.y=r,this}size(e,r){return this._state.width=e,this._state.height=r,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,r){return this._state.rx=e,this._state.ry=r,e===r&&(this._state.cornerRadius=e),this}},zn=class extends q{constructor(e,r,n){if(n<0)throw new RangeError("Square size must be non-negative");super("square"),this._state.x=e,this._state.y=r,this._state.width=n,this._state.height=n}position(e,r){return this._state.x=e,this._state.y=r,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,r){return this._state.rx=e,this._state.ry=r,e===r&&(this._state.cornerRadius=e),this}},Gn=class extends q{constructor(e,r,n,i){super("line"),this._state.x1=e,this._state.y1=r,this._state.x2=n,this._state.y2=i}from(e,r){return this._state.x1=e,this._state.y1=r,this}to(e,r){return this._state.x2=e,this._state.y2=r,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,r){return this._state.startEndpoint=e,this._state.endEndpoint=r,this}},Vn=class extends q{constructor(e,r,n){super("text"),this._state.x=e,this._state.y=r,this._state.text=n}position(e,r){return this._state.x=e,this._state.y=r,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,r=0){return this._state.isTextPath=!0,this._state.textPathPoints=e,this._state.textPathStartOffset=r,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){let r=Ue(e);return this._state.richTextRuns=r,this._state.richTextData=_e(r),this}richTextRuns(e){let r=Ve(e);return this._state.richTextRuns=r,this._state.richTextData=_e(r),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}},se=class extends q{constructor(e,r,n,i){super(e),this._state.cx=r,this._state.cy=n,this._state.radius=i}position(e,r){return this._state.cx=e,this._state.cy=r,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}},Un=class extends se{constructor(e,r,n){super("triangle",e,r,n)}},Wn=class extends se{constructor(e,r,n,i=5){super("ngon",e,r,n),this._state.sides=i}sides(e){return this._state.sides=e,this}},Hn=class extends se{constructor(e,r,n){super("star",e,r,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}},jn=class extends se{constructor(e,r,n){super("cross",e,r,n),this._state.armWidthPercent=35}armWidth(e){return this._state.armWidthPercent=e,this}},Xn=class extends se{constructor(e,r,n){super("ring",e,r,n),this._state.innerRadiusPercent=60}innerRadius(e){return this._state.innerRadiusPercent=e,this}},Kn=class extends se{constructor(e,r,n){super("spiral",e,r,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}},Yn=class extends se{constructor(e,r,n){super("gear",e,r,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}},qn=class extends se{constructor(e,r,n){super("arrow",e,r,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}},Zn=class extends se{constructor(e,r,n){super("heart",e,r,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}},Qn=class extends se{constructor(e,r,n){super("lightning",e,r,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}},Jn=class extends se{constructor(e,r,n){super("cloud",e,r,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}},ei=class extends se{constructor(e,r,n){super("speechBubble",e,r,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}},Oe=class extends q{add(e){let r="build"in e&&typeof e.build=="function"?e.build():e,n=this._state.children??[];return this._state.children=[...n,r],this}addAll(...e){for(let r of e)this.add(r);return this}children(e){return this._state.children=e.map(r=>"build"in r&&typeof r.build=="function"?r.build():r),this}},ti=class extends Oe{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}},ri=class extends Oe{constructor(){super("switch")}},ni=class extends Oe{constructor(){super("container")}},ii=class extends q{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,r,n,i){return this._state.viewBoxX=e,this._state.viewBoxY=r,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}},si=class extends Oe{constructor(e=0,r=0,n=100,i=100){super("svg"),this._state.svgX=e,this._state.svgY=r,this._state.svgWidth=n,this._state.svgHeight=i}position(e,r){return this._state.svgX=e,this._state.svgY=r,this}size(e,r){return this._state.svgWidth=e,this._state.svgHeight=r,this}viewBox(e,r,n,i){return this._state.svgViewBoxX=e,this._state.svgViewBoxY=r,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}},ai=class extends q{constructor(e){super("shape-reference"),e!==void 0&&(this._state.targetShapeId=e)}target(e){return this._state.targetShapeId=e,this}offset(e,r){return this._state.offsetX=e,this._state.offsetY=r,this}size(e,r){return this._state.width=e,this._state.height=r,this}},oi=class extends q{position(e,r){return this._state.x=e,this._state.y=r,this}size(e,r){return this._state.width=e,this._state.height=r,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,r){return this._state.trimStart=e,this._state.trimEnd=r,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,r){return this._state.fadeInDuration=e,this._state.fadeOutDuration=r,this}language(e){return this._state.systemLanguage=e,this}},li=class extends oi{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}},ui=class extends oi{constructor(e){super("audio"),this._state.mediaKind="audio",e!==void 0&&(this._state.href=e)}},ci=class extends q{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,r){let n=this._state.pathPoints??[];return n.push({x:e,y:r}),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,r){return this._state.startEndpoint=e,this._state.endEndpoint=r,this}toD(){let e=this._state.pathPoints??[],r=this._state.pathCurveType??"CUBIC",n=this._state.pathClosed??!1,i=this._state.pathTension??.5,s=this._state.pathArcParams;return Fe(e,r,n,i,s)}},di=class extends q{constructor(e=[]){super("polyline"),this._state.polylinePoints=[...e],this._state.polylineClosed=!1}points(e){return this._state.polylinePoints=[...e],this}addPoint(e,r){let n=this._state.polylinePoints??[];return n.push({x:e,y:r}),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,r){return this._state.startEndpoint=e,this._state.endEndpoint=r,this}},fi=class extends q{constructor(e,r,n,i,s){super("image"),this._state.x=e,this._state.y=r,this._state.width=n,this._state.height=i,this._state.href=s}position(e,r){return this._state.x=e,this._state.y=r,this}size(e,r){return this._state.width=e,this._state.height=r,this}src(e){return this._state.href=e,this}preserveAspectRatio(e){return this._state.preserveAspectRatio=e,this}};var Jt=class{_x1;_y1;_x2;_y2;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(e=0,r=0,n=1,i=0){this._x1=e,this._y1=r,this._x2=n,this._y2=i,this._id=_()}stop(e,r,n=1){return this._stops.push({offset:e,color:r,opacity:n}),this}direction(e,r,n,i){return this._x1=e,this._y1=r,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}}},er=class{_cx=.5;_cy=.5;_fx=.5;_fy=.5;_r=.5;_ry=.5;_rotation=0;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(){this._id=_()}center(e,r){return this._cx=e,this._cy=r,this}focus(e,r){return this._fx=e,this._fy=r,this}radius(e,r){return this._r=e,this._ry=r??e,this}rotation(e){return this._rotation=e,this}stop(e,r,n=1){return this._stops.push({offset:e,color:r,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}}},tr=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",r="#000000",n="#ffffff"){this._patternType=e,this._color=r,this._backgroundColor=n,this._id=_()}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,r){return this._width=e,this._height=r,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,r){return this._x=e,this._y=r,this}customPatternId(e){return this._customPatternId=e,this}build(){let e,r,n;if(this._svgContent!==void 0)e=this._svgContent,r=this._width??10,n=this._height??10;else{let s=nn(this._patternType,this._scale,this._color,this._backgroundColor,this._patternParams);e=s.svgContent,r=this._width??s.width,n=this._height??s.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:r,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 uo(t=0,e=0,r=1,n=0){return new Jt(t,e,r,n)}function co(){return new er}function fo(t="stripes",e="#000000",r="#ffffff"){return new tr(t,e,r)}var Ps={rows:4,cols:4,style:"classic",tabDepthPercent:20,tabPattern:"random",seed:1},Cd=.04,Id=0;function Dd(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let r=e;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}function M(t){return Number(t.toFixed(3)).toString()}function Fd(t,e,r,n,i,s,o,a,u,c,f,d){return[[0,0],[.2,a],[.5+u+f,-s+c],[.5-s+u,s+c],[.5-2*s+u-f,3*s+c],[.5+2*s+u-f,3*s+c],[.5+s+u,s+c],[.5+u+f,-s+c],[.8,d],[1,0]].map(([p,g])=>{let m=e+p*n,b=r+g*i*o;return t?{x:m,y:b}:{x:b,y:m}})}function ho(t,e,r,n,i,s,o,a,u,c,f){let d=[],h=(k,P)=>u==="alternating"?0:k+c()*(P-k),p=()=>c()<.5,g=h(-a,a),m=u==="alternating"?f%2===0:p(),b=null,x=g,S=h(-a,a),$=h(-a,a),v=h(-a,a);g=h(-a,a);for(let k=0;k<t;k++){k>0&&(b=m,m=u==="alternating"?(f+k)%2===0:p(),x=m===b?-g:g,S=h(-a,a),$=h(-a,a),v=h(-a,a),g=h(-a,a));let P=m?-1:1,T=r+k*i;d.push(Fd(e,T,n,i,s,o,P,x,S,$,v,g))}return d}function po(t,e,r,n,i,s,o){let a=2*s;return[[0,0],[.2,0],[.4,0],[.4,a],[.4,a],[.6,a],[.6,a],[.6,0],[.8,0],[1,0]].map(([c,f])=>{let d=e+c*n,h=r+f*i*o;return t?{x:d,y:h}:{x:h,y:d}})}function mo(t,e){return t+` 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 go(t,e){return t+` 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 yo(t,e={}){let r={...Ps,...e};if(r.rows<1||r.cols<1)throw new Error("generatePuzzlePieces: rows and cols must be >= 1");if(!Number.isFinite(t.width)||!Number.isFinite(t.height))throw new Error("generatePuzzlePieces: bounds must have finite width/height");if(t.width<=0||t.height<=0)throw new Error("generatePuzzlePieces: bounds must have positive width/height");let{rows:n,cols:i,style:s,tabDepthPercent:o,tabPattern:a,seed:u}=r,c=Dd(u),f=t.width/i,d=t.height/n,h=Math.max(0,Math.min(.4,o/200)),p=(s==="classic"||s==="curved")&&h>0,g=s==="square-tabs"&&h>0,m=s==="classic"&&a==="random"?Cd:Id,b=[];for(let $=0;$<n-1;$++){let v=t.y+($+1)*d;if(p)b.push(ho(i,!0,t.x,v,f,d,h,m,a,c,$));else if(g){let k=[];for(let P=0;P<i;P++){let T=a==="alternating"?($+P)%2===0?1:-1:c()<.5?1:-1;k.push(po(!0,t.x+P*f,v,f,d,h,T))}b.push(k)}else b.push(new Array(i).fill(null))}let x=[];for(let $=0;$<i-1;$++){let v=t.x+($+1)*f;if(p)x.push(ho(n,!1,t.y,v,d,f,h,m,a,c,$));else if(g){let k=[];for(let P=0;P<n;P++){let T=a==="alternating"?(P+$)%2===0?1:-1:c()<.5?1:-1;k.push(po(!1,t.y+P*d,v,d,f,h,T))}x.push(k)}else x.push(new Array(n).fill(null))}let S=[];for(let $=0;$<n;$++)for(let v=0;v<i;v++){let k=t.x+v*f,P=t.y+$*d,T=k+f,w=P+d,R=`M ${M(k)} ${M(P)}`;if($===0)R+=` L ${M(T)} ${M(P)}`;else{let F=b[$-1][v];F?R=mo(R,F):R+=` L ${M(T)} ${M(P)}`}if(v===i-1)R+=` L ${M(T)} ${M(w)}`;else{let F=x[v][$];F?R=mo(R,F):R+=` L ${M(T)} ${M(w)}`}if($===n-1)R+=` L ${M(k)} ${M(w)}`;else{let F=b[$][v];F?R=go(R,F):R+=` L ${M(k)} ${M(w)}`}if(v===0)R+=` L ${M(k)} ${M(P)}`;else{let F=x[v-1][$];F?R=go(R,F):R+=` L ${M(k)} ${M(P)}`}R+=" Z",S.push({id:`puzzle-${u}-r${$}-c${v}`,row:$,col:v,d:R})}return S}var So=[1,2,3,4,5,6,7,8,9],Ed={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 rr(t){return t.map(e=>[...e])}function Ld(){return Array.from({length:9},()=>Array.from({length:9},()=>0))}function $o(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let r=e;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}function vo(t,e){let r=[...t];for(let n=r.length-1;n>0;n--){let i=Math.floor(e()*(n+1));[r[n],r[i]]=[r[i],r[n]]}return r}function ht(t){return 1<<t-1}function To(t){let e=0,r=t;for(;r;)r&=r-1,e++;return e}function Bd(t){for(let e=1;e<=9;e++)if(t===ht(e))return e;return 0}function Rs(t,e){return Math.floor(t/3)*3+Math.floor(e/3)}function _s(t){let e=0;for(let r of t)for(let n of r)n!==0&&e++;return e}function Nd(t){if(!Number.isFinite(t))return 1;let e=Math.floor(t);return e===0?1:e}function ko(t,e){if(!Array.isArray(t)||t.length!==9)return e.push("Grid must contain 9 rows."),!1;let r=!0;for(let n=0;n<9;n++){if(!Array.isArray(t[n])||t[n].length!==9){e.push(`Row ${n+1} must contain 9 cells.`),r=!1;continue}for(let i=0;i<9;i++){let s=t[n][i];(!Number.isInteger(s)||s<0||s>9)&&(e.push(`Cell R${n+1}C${i+1} must be a digit from 0 to 9.`),r=!1)}}return r}function wo(t,e){let r=!0,n=(i,s)=>{let o=0;for(let a of s){if(a===0)continue;let u=ht(a);if(o&u){e.push(`${i} contains duplicate ${a}.`),r=!1;return}o|=u}};for(let i=0;i<9;i++)n(`Row ${i+1}`,t[i]);for(let i=0;i<9;i++)n(`Column ${i+1}`,t.map(s=>s[i]));for(let i=0;i<9;i+=3)for(let s=0;s<9;s+=3){let o=[];for(let a=i;a<i+3;a++)for(let u=s;u<s+3;u++)o.push(t[a][u]);n(`Box ${Math.floor(i/3)*3+Math.floor(s/3)+1}`,o)}return r}function As(t){let e=Array.from({length:9},()=>0),r=Array.from({length:9},()=>0),n=Array.from({length:9},()=>0);for(let i=0;i<9;i++)for(let s=0;s<9;s++){let o=t[i][s];if(o===0)continue;let a=ht(o),u=Rs(i,s);if(e[i]&a||r[s]&a||n[u]&a)return null;e[i]|=a,r[s]|=a,n[u]|=a}return{rows:e,cols:r,boxes:n}}function Ms(t,e,r,n,i){return 511&~(r[t]|n[e]|i[Rs(t,e)])}function Po(t,e,r){let n=As(t);if(!n)return[];let i=rr(t),s=[],{rows:o,cols:a,boxes:u}=n,c=()=>{if(s.length>=e)return;let f=-1,d=-1,h=0,p=10;for(let m=0;m<9;m++){for(let b=0;b<9;b++){if(i[m][b]!==0)continue;let x=Ms(m,b,o,a,u),S=To(x);if(S===0)return;if(S<p&&(f=m,d=b,h=x,p=S,S===1))break}if(p===1)break}if(f===-1){s.push(rr(i));return}let g=So.filter(m=>h&ht(m));r&&(g=vo(g,r));for(let m of g){let b=ht(m),x=Rs(f,d);if(i[f][d]=m,o[f]|=b,a[d]|=b,u[x]|=b,c(),u[x]&=~b,a[d]&=~b,o[f]&=~b,i[f][d]=0,s.length>=e)return}};return c(),s}function Od(t){let e=Ld(),r=$o(t),[n]=Po(e,1,r);if(!n)throw new Error("generateSudokuPuzzle: failed to generate solved grid");return n}function zd(t){let e=As(t);if(!e)return null;for(let r=0;r<9;r++)for(let n=0;n<9;n++){if(t[r][n]!==0)continue;let i=Ms(r,n,e.rows,e.cols,e.boxes);if(To(i)===1)return{row:r,col:n,value:Bd(i)}}return null}function Gd(t){let e=As(t);if(!e)return null;let r=n=>{for(let i of So){let s=ht(i),o=null;for(let a of n)if(!(t[a.row][a.col]!==0||!(Ms(a.row,a.col,e.rows,e.cols,e.boxes)&s))){if(o){o=null;break}o=a}if(o)return{...o,value:i}}return null};for(let n=0;n<9;n++){let i=r(Array.from({length:9},(s,o)=>({row:n,col:o})));if(i)return i}for(let n=0;n<9;n++){let i=r(Array.from({length:9},(s,o)=>({row:o,col:n})));if(i)return i}for(let n=0;n<9;n+=3)for(let i=0;i<9;i+=3){let s=[];for(let a=n;a<n+3;a++)for(let u=i;u<i+3;u++)s.push({row:a,col:u});let o=r(s);if(o)return o}return null}function bo(t){let e=rr(t),r=!1;for(;_s(e)<81;){let n=zd(e);if(n){e[n.row][n.col]=n.value;continue}let i=Gd(e);if(i){r=!0,e[i.row][i.col]=i.value;continue}return"search"}return r?"hidden-singles":"singles"}function xo(t,e){let r={singles:0,"hidden-singles":1,search:2};return r[t]<=r[e]}function nr(t,e={}){let r=[];return ko(t,r)?wo(t,r)?Po(t,Math.max(1,Math.floor(e.maxSolutions??2))):[]:[]}function _o(t){let e=[];if(!ko(t,e))return{valid:!1,unique:!1,solution:null,errors:e};if(wo(t,e),e.length>0)return{valid:!1,unique:!1,solution:null,errors:e};let n=nr(t,{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]?rr(n[0]):null,errors:e}}function Ro(t){let e=t.difficulty,r=Ed[e];if(!r)throw new Error(`generateSudokuPuzzle: unsupported difficulty "${e}"`);let n=Nd(t.seed);for(let i=0;i<30;i++){let s=n+i*104729>>>0,o=$o(s),a=Od(s),u=rr(a),c=r.minGivens+Math.floor(o()*(r.maxGivens-r.minGivens+1)),f=vo(Array.from({length:81},(g,m)=>({row:Math.floor(m/9),col:m%9})),o);for(let g of f){if(_s(u)<=c)break;let m=u[g.row][g.col];if(u[g.row][g.col]=0,nr(u,{maxSolutions:2}).length!==1){u[g.row][g.col]=m;continue}let x=bo(u);xo(x,r.maxRating)||(u[g.row][g.col]=m)}let d=_s(u),h=bo(u);if(nr(u,{maxSolutions:2}).length===1&&d>=r.minGivens&&d<=r.maxGivens&&xo(h,r.maxRating))return{puzzle:u,solution:a,difficulty:e,seed:n,givens:d,rating:h}}throw new Error(`generateSudokuPuzzle: unable to generate a ${e} puzzle`)}var Ao="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Vd={E:{direction:"E",dr:0,dc:1},S:{direction:"S",dr:1,dc:0},SE:{direction:"SE",dr:1,dc:1},NE:{direction:"NE",dr:-1,dc:1},W:{direction:"W",dr:0,dc:-1},N:{direction:"N",dr:-1,dc:0},NW:{direction:"NW",dr:-1,dc:-1},SW:{direction:"SW",dr:1,dc:-1}};function Co(t){if(!Number.isFinite(t))return 1;let e=Math.floor(t);return e===0?1:e}function Io(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let r=e;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}function pt(t){let e=globalThis.Intl.Segmenter;return e?Array.from(new e(void 0,{granularity:"grapheme"}).segment(t),r=>r.segment.normalize("NFC")):Array.from(t.normalize("NFC"))}function Ud(t,e,r,n){return t>=0&&e>=0&&t<n&&e<r}function Cs(t,e){return Array.from({length:e},()=>Array.from({length:t},()=>!0))}function Do(t,e,r,n){if(!r)return Cs(t,e);if(!Array.isArray(r)||r.length!==e)return n.push(`Mask must contain exactly ${e} rows.`),Cs(t,e);let i=[];for(let s=0;s<e;s++){if(!Array.isArray(r[s])||r[s].length!==t)return n.push(`Mask row ${s+1} must contain exactly ${t} cells.`),Cs(t,e);i.push(r[s].map(Boolean))}return i}function Wd(t){let e=0;for(let r of t)for(let n of r)n&&e++;return e}function Hd(t){return t.trim().normalize("NFC")}function Fo(t){return t.replace(/\r/g,"").split(/[,\n]+/).map(e=>e.trim()).filter(e=>e.length>0)}function Is(t,e){let r=[];return t.across&&(r.push("E"),e&&r.push("W")),t.down&&(r.push("S"),e&&r.push("N")),t.diagonal&&(r.push("SE","NE"),e&&r.push("NW","SW")),r}function jd(t,e,r,n,i,s,o,a){let u=pt(t),c=[];for(let f=0;f<u.length;f++){let d=e+n.dr*f,h=r+n.dc*f;if(!Ud(d,h,s,o)||!i[d][h])return null;c.push({row:d,col:h,grapheme:u[f]})}return{word:t,graphemes:u,row:e,col:r,direction:n.direction,dr:n.dr,dc:n.dc,cells:c,jitter:a}}function Eo(t,e,r,n,i,s){let o=[];for(let a of e){let u=Vd[a];for(let c=0;c<i;c++)for(let f=0;f<n;f++){let d=jd(t,c,f,u,r,n,i,s());d&&o.push(d)}}return o}function Ds(t){let e=[],r=[],n=[],i=Math.floor(t.width),s=Math.floor(t.height);(!Number.isInteger(i)||i<2||i>64)&&e.push("Width must be an integer from 2 to 64."),(!Number.isInteger(s)||s<2||s>64)&&e.push("Height must be an integer from 2 to 64.");let o=Is(t.axes,t.allowBackwards);o.length===0&&e.push("At least one word direction must be enabled.");let a=Do(Math.max(1,i),Math.max(1,s),t.mask,e),u=Wd(a);u===0&&e.push("Mask must contain at least one active cell.");let c=new Set,f=[];for(let p of t.words){let g=Hd(p);if(g){if(/\s/u.test(g)){n.push({input:p,reason:"Words cannot contain whitespace."});continue}if(c.has(g)){n.push({input:p,reason:"Duplicate word."});continue}c.add(g),f.push(g)}}f.length===0&&e.push("Enter at least one word.");let d=Io(Co(t.seed));if(e.length===0)for(let p=f.length-1;p>=0;p--){let g=f[p];Eo(g,o,a,i,s,d).length===0&&(n.push({input:g,reason:"No legal placement exists for the current size, mask, and directions."}),f.splice(p,1))}n.length>0&&e.push(`${n.length} word${n.length===1?"":"s"} rejected.`);let h=Math.max(0,u);return f.length>h&&r.push("The word count exceeds the active cell count; overlaps may be required for this puzzle."),{valid:e.length===0,acceptedWords:f,rejectedWords:n,errors:e,warnings:r,minWords:1,maxWords:h,activeCells:u,directions:o}}function Xd(t,e){for(let r of e.cells){let n=t[r.row][r.col];if(n!==null&&n!==r.grapheme)return!0}return!1}function Kd(t,e){let r=[];for(let n of e.cells)t[n.row][n.col]===null&&(r.push({row:n.row,col:n.col}),t[n.row][n.col]=n.grapheme);return r}function Yd(t,e){for(let r of e)t[r.row][r.col]=null}function Mo(t,e){let r=0;for(let n of e.cells)t[n.row][n.col]===n.grapheme&&r++;return r}function qd(t){return{word:t.word,row:t.row,col:t.col,direction:t.direction,path:t.cells.map(e=>({...e}))}}function Zd(t){let e=t.fillerAlphabet??Ao,r=typeof e=="string"?pt(e):e.flatMap(i=>pt(i)),n=r.filter((i,s)=>i.trim()&&r.indexOf(i)===s);return n.length>0?n:pt(Ao)}function Lo(t){let e=Math.floor(t.width),r=Math.floor(t.height),n=Co(t.seed),i=Ds({...t,width:e,height:r,seed:n});if(!i.valid)throw new Error(`generateWordSearch: ${i.errors[0]??"invalid options"}`);let s=Do(e,r,t.mask,[]),o=Math.max(1,Math.floor(t.maxBacktrackNodes??15e4));for(let a=0;a<24;a++){let u=Io(n+a*104729>>>0),c=i.directions,f=new Map;for(let S of i.acceptedWords)f.set(S,Eo(S,c,s,e,r,u));let d=[...i.acceptedWords].sort((S,$)=>{let v=f.get(S)?.length??0,k=f.get($)?.length??0;return v!==k?v-k:pt($).length-pt(S).length}),h=Array.from({length:r},(S,$)=>Array.from({length:e},(v,k)=>s[$][k]?null:"")),p=[],g=new Map,m=0,b=S=>{if(++m>o)return!1;if(S>=d.length)return!0;let $=d[S],v=[...f.get($)??[]].filter(k=>!Xd(h,k)).sort((k,P)=>{let T=Mo(h,P)-Mo(h,k);if(T!==0)return T;let w=(g.get(k.direction)??0)-(g.get(P.direction)??0);return w!==0?w:k.jitter-P.jitter});for(let k of v){let P=Kd(h,k);if(p.push(qd(k)),g.set(k.direction,(g.get(k.direction)??0)+1),b(S+1))return!0;g.set(k.direction,(g.get(k.direction)??1)-1),p.pop(),Yd(h,P)}return!1};if(!b(0))continue;let x=Zd(t);for(let S=0;S<r;S++)for(let $=0;$<e;$++)s[S][$]?h[S][$]===null&&(h[S][$]=x[Math.floor(u()*x.length)]):h[S][$]="";return{width:e,height:r,grid:h,mask:s.map(S=>[...S]),normalizedWords:[...i.acceptedWords],placements:[...p],seed:n,title:t.title,creator:t.creator,lint:i}}throw new Error("generateWordSearch: unable to place all words with the current settings")}function Qd(t,e,r){let n=!1;for(let i=0,s=r.length-1;i<r.length;s=i++){let o=r[i],a=r[s];o.y>e!=a.y>e&&t<(a.x-o.x)*(e-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n}function Jd(){let t=[];for(let e=0;e<10;e++){let r=e%2===0?.5:.23,n=-Math.PI/2+e*Math.PI/5;t.push({x:.5+Math.cos(n)*r,y:.5+Math.sin(n)*r})}return t}function Bo(t,e,r){let n=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(e)),s=Jd();return Array.from({length:i},(o,a)=>Array.from({length:n},(u,c)=>{let f=(c+.5)/n,d=(a+.5)/i,h=f*2-1,p=d*2-1;switch(r){case"rectangle":return!0;case"circle":return h*h+p*p<=1;case"triangle":return d>=.08&&d<=.95&&Math.abs(h)<=d;case"diamond":return Math.abs(h)+Math.abs(p)<=1;case"star":return Qd(f,d,s);case"heart":{let g=h*1.25,m=-p*1.25;return Math.pow(g*g+m*m-1,3)-g*g*m*m*m<=0}case"cross":return Math.abs(h)<=.32||Math.abs(p)<=.32;default:return!0}}))}0&&(module.exports={Arrow,Audio,BUILTIN_MARKER_ID_MAP,COMMON_PROP_DEFAULTS,COMMON_TRANSFORM_NODE_DEFAULTS,CURRENT_SCHEMA_VERSION,Circle,Cloud,Container,ContainerShapeBuilder,Cross,DEFAULT_COORDINATE_PRECISION,DEFAULT_RICH_TEXT_STYLE,Document,DocumentBuilder,EASING_CURVES,EasingType,Ellipse,Gear,Heart,Hyperlink,IDENTITY_AFFINE,ImageShape,KNOWN_STATE_KEYS,LIBRARY_EMIT_ORDER,Lightning,Line,LinearGradientBuilder,MARKER_HEIGHT,MARKER_VIEWBOX,MARKER_WIDTH,MAX_COORDINATE_PRECISION,MIGRATIONS,NGon,NON_WIRE_PROP_KEYS,NUMERIC_SHAPE_TRANSFORM_STATE_KEYS,NestedSvg,NodeSchemaRegistry,PUZZLE_DEFAULTS,Path,PathCurveType,PathPointType,PatternBuilder,Polyline,RICH_TEXT_STYLE_KEYS,RadialGradientBuilder,Rectangle,Ring,SERIALIZED_SHAPE_STATE_KEYS,SHAPE_TRANSFORM_STATE_KEYS,SceneGraph,SceneNode,ShapeBuilder,ShapeReference,SpeechBubble,Spiral,Square,Star,Switch,Text,Timeline,Track,Triangle,Video,View,affine,affineFromArray,affineToArray,almostEqualAffine,applyAffineToPoint,applyAffineToVector,applyOpToSnapshot,applyOpsToSnapshot,applyRichTextFormat,applyTextSplice,applyTextTransform,arcEndpointToCenter,areTracksTimingEquivalent,around,buildCompoundTransformValues,buildSmilKeyframeData,canonicalPolygonTransformString,canonicalTransformString,collectMarkerReferences,collectReferencedLibraryDefs,collectReferencedMarkerIds,compareOrderKeys,composeLegacyTransformMatrix,computeArrowVertices,computeCloudPath,computeCrossVertices,computeDashArray,computeFlowchartBoxPath,computeGearPath,computeGearVertices,computeHeartPath,computeLightningVertices,computePolygonVertices,computeRectanglePath,computeRingPath,computeSpeechBubbleVertices,computeSpiralPath,computeSplinePath,computeStarVertices,createDocument,createSceneNode,createShape,createViewbox,createWordSearchPrimitiveMask,cubicBezierExtent1D,customPatternDefToLibraryDef,declaredRichTextDeltaKeys,decomposeAffine2D,defaultVariableMode,deriveRichTextFormatRanges,deriveSegments,deriveTextSplice,downTranslateAnimationKeyframeOps,downTranslateCollectionMoveOps,downTranslateScenePlaceOps,downTranslateTextFormatOps,ellipticalArcBounds,escXml,extractVariables,filterAttr,findShapeById,flattenShapeStateTree,flattenStateExtra,foldLegacyAncestorTransformIntoMatrix,forEachLibraryRefInState,forEachMarkerRefInState,forEachReachableShape,forEachShapeInLibraryDefs,formatSmilKeySpline,formatSmilKeyTime,freezeSiblingOrderKeys,generateCode,generateCssCode,generateD3Code,generateId,generatePatternSvgContent,generatePuzzlePieces,generateReactCode,generateSudokuPuzzle,generateSvgCode,generateVueCode,generateWordSearch,getBuiltInMarkerDefs,getEasingCubicBezier,getEffectivePrecision,getKeyframeCubicBezier,getMarkerDescriptors,getPatternElements,getSmilAdditive,getSmilBeginValue,getSmilFillMode,getSmilMotionKeyPoints,getSmilRepeatCount,getSmilSetBeginValue,getSmilTrackDuration,getWordSearchDirections,initialOrderKeys,invertAffine,isDefaultKeyPoints,isDefaultKeyTimes,isFiniteAffineArray,isIdentityAffine,isIdentityLinearSplines,isIndefiniteSetTrack,isReusablePatternTile,isSetSequenceTrack,isValidOrderKey,keyBetween,keysBetween,legacyEndpointMarkerId,linearGradient,lintWordSearchOptions,materializeSceneTreeOrderKeys,matrixTransformPart,mergeRichTextStyle,migrateSnapshot,moveResourceById,multiplyAffine,nodeSchemas,normalizeRichTextRuns,normalizeRichTextStyle,normalizeRichTextStyleDelta,orderSiblings,parseDocument,parseSvgTransformList,parseVariableArgs,parseWordSearchWords,partitionShapeStateTree,partitionStateExtra,pathDataBounds,pattern,patternLibraryDefToCustomPatternDef,patternTileSize,planTransformFusion,projectSceneTreeOntoClipMaskGroups,projectSceneTreeOntoShapes,quadraticBezierExtent1D,radialGradient,rebaseRichTextFormatRanges,rebaseRichTextRuns,reflectCubicBezier,removeTrackKeyframe,renderAnimationElements,renderBuiltinMarkerDefs,renderCircle,renderEllipse,renderFilterDefs,renderFilterLibraryDef,renderFilterPrimitive,renderFilterPrimitivesForType,renderFlowchartBox,renderImage,renderLibraryDef,renderLibraryDefs,renderLine,renderLinearGradientLibraryDef,renderMarkerLibraryDef,renderPatternLibraryDef,renderPolygonShape,renderPolyline,renderRadialGradientLibraryDef,renderRectangle,renderReferencedLibraryDefs,renderShape,renderSpline,renderSvgPrimitiveChainFilter,renderSymbolInstance,renderSymbolLibraryDef,renderText,renderToSvg,resolveRichTextStyleAt,resolveSymbolInstanceShapes,richTextFontVariantCss,richTextLineSpans,richTextRunsFromState,richTextStyleDelta,richTextStyleDeltasEqual,richTextStylesEqual,richTextTspanAttributes,rotateAffine,roundCoord,roundNumberString,roundSerializedShape,roundSnapshot,runsFromSegments,sanitizeRichTextFormatRanges,scaleAffine,skewXAffine,skewYAffine,smilKeyframeAttributes,solveCubicBezier,solveSudoku,splinePathBounds,stringifyDocument,substituteString,substituteVariables,symbolInstanceTargetId,transformSplice,translateAffine,tryParseSvgTransformList,upsertTrackKeyframe,validateSnapshot,validateSudokuPuzzle,verticesToPath});
|
|
19
|
+
}`)}let o=[];for(let l=0;l<i.length;l++){let c=i[l],f=Pl(c,l),d=de(c),p=d.indexOf(" ");p!==-1&&(d=d.slice(0,p)+` class="${f}"`+d.slice(p)),o.push(`${n}${d}`)}let a=[];a.push("<style>");for(let l of s)a.push(l);a.push("</style>"),a.push(""),a.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${r.width}" height="${r.height}" viewBox="0 0 ${r.width} ${r.height}">`);for(let l of o)a.push(l);return a.push("</svg>"),a.push(""),a.join(`
|
|
20
|
+
`)}function di(t,e){let r=np(t,e),n={...e};switch(n.format){case"svg":return ai(r,n);case"react":return oi(r,n);case"vue":return li(r,n);case"d3":return ui(r,n);case"css":return ci(r,n);default:throw new Error(`Unsupported code format: ${n.format}`)}}function np(t,e){return Array.isArray(t)?{shapes:t,viewboxes:[{id:"default",x:0,y:0,width:e.width??800,height:e.height??600}]}:t}var $r=class t{_snapshot;constructor(e={}){let{width:r=800,height:n=600,viewboxId:i}=e,s=lr(0,0,r,n,i);this._snapshot=on({viewboxes:[s]})}static fromSnapshot(e){let r=new t;return r._snapshot=JSON.parse(JSON.stringify(e)),r}static fromJSON(e,r){let n=un(e,r),i=new t;return i._snapshot=n,i}add(e){let r="build"in e&&typeof e.build=="function"?e.build():e;return this._snapshot.shapes.push(r),this}addAll(...e){for(let r of e)this.add(r);return this}remove(e){let r=this._snapshot.shapes.length;return this._snapshot.shapes=this._snapshot.shapes.filter(n=>n.id!==e),this._snapshot.shapes.length<r}get shapes(){return this._snapshot.shapes}findShape(e){return this._snapshot.shapes.find(r=>r.id===e)}size(e,r){return this._snapshot.viewboxes.length>0?(this._snapshot.viewboxes[0].width=e,this._snapshot.viewboxes[0].height=r):this._snapshot.viewboxes=[lr(0,0,e,r)],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,r){return this._ensureMetadata(),this._snapshot.documentMetadata.license=e,r!==void 0&&(this._snapshot.documentMetadata.licenseUrl=r),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,r,n){this._snapshot.symbols||(this._snapshot.symbols=[]);let i=_(),s=r.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o={kind:"symbol",id:i,name:e,viewBox:n?.viewBox??"0 0 100 100",shapes:s};return n?.groups&&(o.groups=n.groups),n?.thumbnail&&(o.thumbnail=n.thumbnail),n?.defKind&&(o.defKind=n.defKind),n?.wrapperAttrs&&(o.wrapperAttrs=n.wrapperAttrs),n?.variantAxes&&(o.variantAxes=n.variantAxes),n?.variants&&(o.variants=n.variants),n?.variantThumbnails&&(o.variantThumbnails=n.variantThumbnails),this._snapshot.symbols.push(o),i}placeSymbolInstance(e,r,n,i,s){let o,a={};typeof i=="number"||i===void 0?o=i:(a=i,o=a.width,s=a.height??s);let l={symbolId:e,x:r,y:n,width:o??100,height:s??100};a.variantKey&&(l.variantKey=a.variantKey),a.symbolOverrides&&(l.symbolOverrides=a.symbolOverrides),a.instancePresentation&&(l.instancePresentation=a.instancePresentation);let c={id:_(),type:"symbol-instance",state:l};return this._snapshot.shapes.push(c),this}removeSymbol(e){if(!this._snapshot.symbols)return!1;let r=this._snapshot.symbols.length;return this._snapshot.symbols=this._snapshot.symbols.filter(n=>n.id!==e),this._snapshot.symbols.length<r}get symbols(){return this._snapshot.symbols??[]}defineMarker(e,r,n){let i=_(),s=r.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o={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:s};return n?.groups&&(o.groups=n.groups),n?.thumbnail&&(o.thumbnail=n.thumbnail),this._pushLibraryDef(o),i}defineFilter(e,r,n){let i=_(),s={kind:"filter",id:i,name:e,filters:r};return n?.colorInterpolation&&(s.colorInterpolation=n.colorInterpolation),n?.filterUnits&&(s.filterUnits=n.filterUnits),n?.primitiveUnits&&(s.primitiveUnits=n.primitiveUnits),n?.x!==void 0&&(s.x=n.x),n?.y!==void 0&&(s.y=n.y),n?.width!==void 0&&(s.width=n.width),n?.height!==void 0&&(s.height=n.height),n?.thumbnail&&(s.thumbnail=n.thumbnail),this._pushLibraryDef(s),i}defineLinearGradientLibrary(e,r,n){let i=_(),s="build"in r?r.build():r,{id:o,sourceId:a,...l}=s,c={kind:"linear-gradient",id:i,name:e,gradient:l};return n?.thumbnail&&(c.thumbnail=n.thumbnail),this._pushLibraryDef(c),i}defineRadialGradientLibrary(e,r,n){let i=_(),s="build"in r?r.build():r,{id:o,sourceId:a,...l}=s,c={kind:"radial-gradient",id:i,name:e,gradient:l};return n?.thumbnail&&(c.thumbnail=n.thumbnail),this._pushLibraryDef(c),i}definePatternLibrary(e,r,n){let i=_(),s="build"in r?r.build():r,{id:o,sourceId:a,customPatternId:l,...c}=s,f={kind:"pattern",id:i,name:e,pattern:c};return n?.thumbnail&&(f.thumbnail=n.thumbnail),this._pushLibraryDef(f),i}removeLibraryDef(e){if(!this._snapshot.library)return!1;let r=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(n=>n.id!==e),this._snapshot.library.length<r}get library(){return this._snapshot.library??[]}_pushLibraryDef(e){this._snapshot.library||(this._snapshot.library=[]);let r=this._snapshot.library.findIndex(n=>n.id===e.id);r>=0?this._snapshot.library[r]=e:this._snapshot.library.push(e)}addClipGroup(e,r,n){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=_(),s={id:i,type:"clip",clipShapeIds:e,contentShapeIds:r,parentId:null};return n?.clipPathUnits&&(s.clipPathUnits=n.clipPathUnits),n?.clipRule&&(s.clipRule=n.clipRule),n?.rawDefinition&&(s.rawDefinition=n.rawDefinition),this._snapshot.clipMaskGroups.push(s),i}addMaskGroup(e,r,n){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=_(),s={id:i,type:"mask",clipShapeIds:e,contentShapeIds:r,parentId:null};return n?.maskUnits&&(s.maskUnits=n.maskUnits),n?.maskContentUnits&&(s.maskContentUnits=n.maskContentUnits),n?.maskBounds&&(s.maskBounds=n.maskBounds),n?.maskType&&(s.maskType=n.maskType),n?.rawDefinition&&(s.rawDefinition=n.rawDefinition),this._snapshot.clipMaskGroups.push(s),i}removeClipMaskGroup(e){if(!this._snapshot.clipMaskGroups)return!1;let r=this._snapshot.clipMaskGroups.length;return this._snapshot.clipMaskGroups=this._snapshot.clipMaskGroups.filter(n=>n.id!==e),this._snapshot.clipMaskGroups.length<r}addGuide(e,r,n){this._snapshot.guides||(this._snapshot.guides=[]);let i=_(),s={id:i,orientation:e,position:r,controlPointOffset:0};return n?.color&&(s.color=n.color),n?.opacity!==void 0&&(s.opacity=n.opacity),this._snapshot.guides.push(s),i}removeGuide(e){if(!this._snapshot.guides)return!1;let r=this._snapshot.guides.length;return this._snapshot.guides=this._snapshot.guides.filter(n=>n.id!==e),this._snapshot.guides.length<r}clearGuides(){return this._snapshot.guides=[],this}get guides(){return this._snapshot.guides??[]}addMeasurement(e,r,n){this._snapshot.measurements||(this._snapshot.measurements=[]);let i=_(),s={id:i,type:e,points:r,visible:n?.visible??!0,snapDivisions:n?.snapDivisions??1};return n?.color&&(s.color=n.color),n?.opacity!==void 0&&(s.opacity=n.opacity),this._snapshot.measurements.push(s),i}removeMeasurement(e){if(!this._snapshot.measurements)return!1;let r=this._snapshot.measurements.length;return this._snapshot.measurements=this._snapshot.measurements.filter(n=>n.id!==e),this._snapshot.measurements.length<r}get measurements(){return this._snapshot.measurements??[]}addCustomPattern(e,r,n,i){let s=_();return this._pushLibraryDef(Ve({id:s,name:e,svgContent:r,width:n,height:i})),s}removeCustomPattern(e){let r=this._snapshot.library;if(!r)return!1;let n=r.length;return this._snapshot.library=r.filter(i=>!(i.kind==="pattern"&&i.id===e)),this._snapshot.library.length<n}get customPatterns(){let e=[];for(let r of this._snapshot.library??[]){if(r.kind!=="pattern")continue;let n=$t(r);n&&e.push(n)}return e}addGroup(e,r){this._snapshot.groups||(this._snapshot.groups=[]);let n=e??_();return this._snapshot.groups.push({id:n,parentId:r??null}),n}removeGroup(e){if(!this._snapshot.groups)return!1;let r=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<r}moveToGroup(e,r){let n=this._snapshot.shapes.find(i=>i.id===e);return n&&(n.state.groupId=r),this}removeFromGroup(e){let r=this._snapshot.shapes.find(n=>n.id===e);return r&&delete r.state.groupId,this}bringToFront(e){let r=this._snapshot.shapes.findIndex(n=>n.id===e);if(r>=0){let[n]=this._snapshot.shapes.splice(r,1);this._snapshot.shapes.push(n)}return this}sendToBack(e){let r=this._snapshot.shapes.findIndex(n=>n.id===e);if(r>=0){let[n]=this._snapshot.shapes.splice(r,1);this._snapshot.shapes.unshift(n)}return this}reorder(e,r){let n=this._snapshot.shapes.findIndex(i=>i.id===e);if(n>=0){let[i]=this._snapshot.shapes.splice(n,1),s=Math.max(0,Math.min(r,this._snapshot.shapes.length));this._snapshot.shapes.splice(s,0,i)}return this}defineVariable(e,r,n,i){this._snapshot.templateVariables||(this._snapshot.templateVariables=[]);let s=this._snapshot.templateVariables.find(o=>o.name===e);if(s)s.type=r,s.defaultValue=n,i?.label!==void 0&&(s.label=i.label),i?.description!==void 0&&(s.description=i.description);else{let o={name:e,type:r,defaultValue:n};i?.label!==void 0&&(o.label=i.label),i?.description!==void 0&&(o.description=i.description),this._snapshot.templateVariables.push(o)}return this}removeVariable(e){return this._snapshot.templateVariables&&(this._snapshot.templateVariables=this._snapshot.templateVariables.filter(r=>r.name!==e)),this}get variables(){return this._snapshot.templateVariables??[]}inspectVariables(){return mn(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:r,...n}=e??{},i=pn(this._snapshot,r);return Dt(i,n)}toJSON(e){return ln(this._snapshot,e)}toSnapshot(){return JSON.parse(JSON.stringify(this._snapshot))}toCode(e,r){return di(this._snapshot,{...r,format:e})}_ensureMetadata(){this._snapshot.documentMetadata||(this._snapshot.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{}})}};var fi=class{_track;constructor(e,r){this._track={id:_(),shapeId:e,property:r,keyframes:[],enabled:!0,locked:!1}}id(e){return this._track.id=e,this}keyframe(e,r,n="linear"){return this._track.keyframes.push({id:_(),time:e,value:r,easing:n}),this}keyframeBezier(e,r,n){return this._track.keyframes.push({id:_(),time:e,value:r,easing:"custom-bezier",customBezier:n}),this}keyframeLinear(e,r,n){return this._track.keyframes.push({id:_(),time:e,value:r,easing:"linear-function",linearPoints:n}),this}keyframes(...e){return this._track.keyframes.push(...e.map(r=>r.id?r:{...r,id:_()})),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,r="trackShape"){return this._track.motionPathRef={shapeId:e,mode:r},this}beginTrigger(e,r){return this._track.beginTrigger={type:e,value:r},this}endTrigger(e,r){return this._track.endTrigger={type:e,value:r},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,r){return this._track.transformOrigin={x:e,y:r},this}motionRotate(e){return this._track.motionRotate=e,this}additive(e){return this._track.additive=e,this}build(){let e=[...this._track.keyframes].sort((r,n)=>r.time-n.time);return{...this._track,keyframes:e}}},pi=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(r=>({id:r.id,shapeId:r.shapeId,property:r.property,enabled:r.enabled,locked:r.locked||void 0,motionPath:r.motionPath,motionPathRef:r.motionPathRef,beginTrigger:r.beginTrigger,endTrigger:r.endTrigger,cycleDuration:r.cycleDuration,cycleRepeats:r.cycleRepeats,cycleInfinite:r.cycleInfinite,cycleBehavior:r.cycleBehavior,transformOrigin:r.transformOrigin,motionRotate:r.motionRotate,additive:r.additive,keyframes:r.keyframes.map(n=>({...n.id?{id:n.id}:{},time:n.time,value:n.value,easing:n.easing,...n.customBezier?{customBezier:n.customBezier}:{},...n.linearPoints?{linearPoints:n.linearPoints}:{}}))}))}}};var ae=class{_id;_type;_state={};constructor(e,r){this._type=e,this._id=r??_()}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,r){return this._state.fillColor=e,this._state.fillType="solid",r!==void 0&&(this._state.fillOpacity=r),this}noFill(){return this._state.fillType="none",this}fillGradient(e){let r="build"in e?e.build():e;return this._state.fillType=r.type,this._state.fillGradient=r,this}fillPattern(e){let r="build"in e?e.build():e;return this._state.fillType="pattern",this._state.fillGradient=r,this}fillOpacity(e){return this._state.fillOpacity=e,this}fillRule(e){return this._state.fillRule=e,this}stroke(e,r){return this._state.borderColor=e,r!==void 0&&(this._state.borderWidth=r),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 r="build"in e?e.build():e;return this._state.strokeType=r.type,this._state.strokeGradient=r,this}strokePattern(e){let r="build"in e?e.build():e;return this._state.strokeType="pattern",this._state.strokeGradient=r,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,r,n){return this._state.lineStyle=e,e==="custom"&&(r!==void 0&&(this._state.dashLength=r),n!==void 0&&(this._state.gapLength=n)),this}opacity(e){return this._state.opacity=e,this}rotate(e){return this._state.rotation=e,this.refreshTransformMatrix(),this}skew(e,r){return this._state.skewX=e,this._state.skewY=r,this.refreshTransformMatrix(),this}scale(e,r){return this._state.scaleX=e,this._state.scaleY=r??e,this.refreshTransformMatrix(),this}pivot(e,r){return this._state.customPivot={x:e,y:r},this.refreshTransformMatrix(),this}transformMatrix(e){if(e.length<6||!e.slice(0,6).every(Number.isFinite))throw new RangeError("transformMatrix must contain six finite numbers");return this._state.transformMatrix=e.slice(0,6),this}refreshTransformMatrix(){this._state.transformMatrix=Xe(ir(this._state,this.defaultTransformPivot()))}defaultTransformPivot(){let e=this._state.customPivot;if(e)return e;let r=this._state.x,n=this._state.y,i=this._state.width,s=this._state.height;if(r!==void 0&&n!==void 0&&i!==void 0&&s!==void 0)return{x:r+i/2,y:n+s/2};let o=this._state.radius;if(r!==void 0&&n!==void 0&&o!==void 0)return{x:r,y:n};let a=this._state.cx,l=this._state.cy;if(a!==void 0&&l!==void 0)return{x:a,y:l};let c=this._state.x1,f=this._state.y1,d=this._state.x2,p=this._state.y2;if(c!==void 0&&f!==void 0&&d!==void 0&&p!==void 0)return{x:(c+d)/2,y:(f+p)/2};let m=this._state.pathPoints;if(m?.[0])return{x:m[0].x,y:m[0].y};let g=this._state.polylinePoints;if(g?.[0])return g[0]}filter(...e){let r=this._state.filters??[];return this._state.filters=[...r,...e],this}dropShadow(e={}){let r={id:`drop-shadow-${_()}`,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(r)}innerShadow(e={}){let r={id:`inner-shadow-${_()}`,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(r)}blur(e,r,n){let i=e??4,s=r??i,o={id:`gaussian-blur-${_()}`,type:"gaussian-blur",enabled:!0,blurX:i,blurY:s,linked:i===s,quality:n?.quality??"normal"};return this.filter(o)}glow(e={}){let r={id:`glow-${_()}`,type:"glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(r)}innerGlow(e={}){let r={id:`inner-glow-${_()}`,type:"inner-glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(r)}grayscale(e=1){let r={id:`grayscale-${_()}`,type:"grayscale",enabled:!0,amount:e};return this.filter(r)}sepia(e=1){let r={id:`sepia-${_()}`,type:"sepia",enabled:!0,amount:e};return this.filter(r)}outline(e={}){return this.filter({id:`outline-${_()}`,type:"outline",enabled:!0,width:e.width??3,color:e.color??"#000000",opacity:e.opacity??1,position:e.position??"outside"})}motionBlur(e={}){let r={id:`motion-blur-${_()}`,type:"motion-blur",enabled:!0,distance:e.distance??10,angle:e.angle??0,quality:e.quality??"normal"};return this.filter(r)}pointLight(e={}){let r={id:`point-light-${_()}`,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(r)}spotLight(e={}){let r={id:`spot-light-${_()}`,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(r)}sharpen(e=1){let r={id:`sharpen-${_()}`,type:"sharpen",enabled:!0,amount:e};return this.filter(r)}pixelate(e=8){let r={id:`pixelate-${_()}`,type:"pixelate",enabled:!0,blockSize:e};return this.filter(r)}warp(e={}){let r={id:`warp-${_()}`,type:"warp",enabled:!0,scale:e.scale??10,frequency:e.frequency??.02,octaves:e.octaves??1,warpType:e.warpType??"turbulence"};return this.filter(r)}morphology(e={}){let r=e.radiusX??2,n=e.radiusY??r,i={id:`morphology-${_()}`,type:"morphology",enabled:!0,operator:e.operator??"dilate",radiusX:r,radiusY:n,linked:e.linked??r===n};return this.filter(i)}contouring(e={}){if((e.mode??"discrete")==="table"){let i={id:`contouring-table-${_()}`,type:"contouring-table",enabled:!0,levels:e.levels??4,contrast:e.contrast??1};return this.filter(i)}let n={id:`contouring-discrete-${_()}`,type:"contouring-discrete",enabled:!0,levels:e.levels??4};return this.filter(n)}roundEdges(e=4){let r={id:`round-edges-${_()}`,type:"round-edges",enabled:!0,radius:e};return this.filter(r)}channelPainter(e={}){let r={id:`channel-painter-${_()}`,type:"channel-painter",enabled:!0,red:e.red??1,green:e.green??1,blue:e.blue??1};return this.filter(r)}brightness(e=1){let r={id:`brightness-${_()}`,type:"brightness",enabled:!0,amount:e};return this.filter(r)}contrast(e=1){let r={id:`contrast-${_()}`,type:"contrast",enabled:!0,amount:e};return this.filter(r)}filterOpacity(e=1){let r={id:`opacity-${_()}`,type:"opacity",enabled:!0,amount:e};return this.filter(r)}invert(e=1){let r={id:`invert-${_()}`,type:"invert",enabled:!0,amount:e};return this.filter(r)}hueRotate(e=0){let r={id:`hue-rotate-${_()}`,type:"hue-rotate",enabled:!0,angle:e};return this.filter(r)}saturate(e=1){let r={id:`saturate-${_()}`,type:"saturate",enabled:!0,amount:e};return this.filter(r)}blackAndWhite(e=.5){let r={id:`black-and-white-${_()}`,type:"black-and-white",enabled:!0,threshold:e};return this.filter(r)}duotone(e={}){let r={id:`duotone-${_()}`,type:"duotone",enabled:!0,shadowColor:e.shadowColor??"#000000",highlightColor:e.highlightColor??"#ffffff"};return this.filter(r)}xray(e=1){let r={id:`xray-${_()}`,type:"xray",enabled:!0,intensity:e};return this.filter(r)}noise(e={}){let r={id:`noise-${_()}`,type:"noise",enabled:!0,amount:e.amount??.3,scale:e.scale??1};return this.filter(r)}emboss(e={}){let r={id:`emboss-${_()}`,type:"emboss",enabled:!0,strength:e.strength??1,angle:e.angle??135};return this.filter(r)}filmGrain(e={}){let r={id:`film-grain-${_()}`,type:"film-grain",enabled:!0,amount:e.amount??.3,size:e.size??1};return this.filter(r)}watercolor(e={}){let r={id:`watercolor-${_()}`,type:"watercolor",enabled:!0,wetness:e.wetness??.5,turbulence:e.turbulence??.5};return this.filter(r)}gouache(e={}){let r={id:`gouache-${_()}`,type:"gouache",enabled:!0,thickness:e.thickness??.5,texture:e.texture??.5};return this.filter(r)}inkBlot(e={}){let r={id:`ink-blot-${_()}`,type:"ink-blot",enabled:!0,spread:e.spread??.5,edges:e.edges??.5};return this.filter(r)}crumpledPlastic(e={}){let r={id:`crumpled-plastic-${_()}`,type:"crumpled-plastic",enabled:!0,wrinkles:e.wrinkles??.5,shine:e.shine??.5};return this.filter(r)}riddled(e={}){let r={id:`riddled-${_()}`,type:"riddled",enabled:!0,density:e.density??.5,size:e.size??1};return this.filter(r)}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,r="linear-gradient"){return this._state.fillLibraryId=e,this._state.fillType=r,this}strokeLibrary(e,r="linear-gradient"){return this._state.strokeLibraryId=e,this._state.strokeType=r,this}filterLibrary(...e){let r=this._state.filterLibraryIds??[];return this._state.filterLibraryIds=[...r,...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,r){let n=this._state.bindings??{};return this._state.bindings={...n,[e]:r},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}}}},mi=class extends ae{constructor(e,r,n){if(n<0)throw new RangeError("Circle radius must be non-negative");super("circle"),this._state.x=e,this._state.y=r,this._state.radius=n}position(e,r){return this._state.x=e,this._state.y=r,this}radius(e){return this._state.radius=e,this}},hi=class extends ae{constructor(e,r,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=r,this._state.rx=n,this._state.ry=i}position(e,r){return this._state.cx=e,this._state.cy=r,this}radii(e,r){return this._state.rx=e,this._state.ry=r,this}},gi=class extends ae{constructor(e,r,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=r,this._state.width=n,this._state.height=i}position(e,r){return this._state.x=e,this._state.y=r,this}size(e,r){return this._state.width=e,this._state.height=r,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,r){return this._state.rx=e,this._state.ry=r,e===r&&(this._state.cornerRadius=e),this}},yi=class extends ae{constructor(e,r,n){if(n<0)throw new RangeError("Square size must be non-negative");super("square"),this._state.x=e,this._state.y=r,this._state.width=n,this._state.height=n}position(e,r){return this._state.x=e,this._state.y=r,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,r){return this._state.rx=e,this._state.ry=r,e===r&&(this._state.cornerRadius=e),this}},bi=class extends ae{constructor(e,r,n,i){super("line"),this._state.x1=e,this._state.y1=r,this._state.x2=n,this._state.y2=i}from(e,r){return this._state.x1=e,this._state.y1=r,this}to(e,r){return this._state.x2=e,this._state.y2=r,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,r){return this._state.startEndpoint=e,this._state.endEndpoint=r,this}},xi=class extends ae{constructor(e,r,n){super("text"),this._state.x=e,this._state.y=r,this._state.text=n}position(e,r){return this._state.x=e,this._state.y=r,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,r=0){return this._state.isTextPath=!0,this._state.textPathPoints=e,this._state.textPathStartOffset=r,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){let r=st(e);return this._state.richTextRuns=r,this._state.richTextData=Ge(r),this}richTextRuns(e){let r=it(e);return this._state.richTextRuns=r,this._state.richTextData=Ge(r),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}},be=class extends ae{constructor(e,r,n,i){super(e),this._state.cx=r,this._state.cy=n,this._state.radius=i}position(e,r){return this._state.cx=e,this._state.cy=r,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}},Si=class extends be{constructor(e,r,n){super("triangle",e,r,n)}},$i=class extends be{constructor(e,r,n,i=5){super("ngon",e,r,n),this._state.sides=i}sides(e){return this._state.sides=e,this}},vi=class extends be{constructor(e,r,n){super("star",e,r,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}},ki=class extends be{constructor(e,r,n){super("cross",e,r,n),this._state.armWidthPercent=35}armWidth(e){return this._state.armWidthPercent=e,this}},Ti=class extends be{constructor(e,r,n){super("ring",e,r,n),this._state.innerRadiusPercent=60}innerRadius(e){return this._state.innerRadiusPercent=e,this}},wi=class extends be{constructor(e,r,n){super("spiral",e,r,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}},Pi=class extends be{constructor(e,r,n){super("gear",e,r,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}},_i=class extends be{constructor(e,r,n){super("arrow",e,r,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}},Ri=class extends be{constructor(e,r,n){super("heart",e,r,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}},Ai=class extends be{constructor(e,r,n){super("lightning",e,r,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}},Ii=class extends be{constructor(e,r,n){super("cloud",e,r,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}},Mi=class extends be{constructor(e,r,n){super("speechBubble",e,r,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}},et=class extends ae{add(e){let r="build"in e&&typeof e.build=="function"?e.build():e,n=this._state.children??[];return this._state.children=[...n,r],this}addAll(...e){for(let r of e)this.add(r);return this}children(e){return this._state.children=e.map(r=>"build"in r&&typeof r.build=="function"?r.build():r),this}},Ci=class extends et{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}},Di=class extends et{constructor(){super("switch")}},Fi=class extends et{constructor(){super("container")}},Ei=class extends ae{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,r,n,i){return this._state.viewBoxX=e,this._state.viewBoxY=r,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}},Oi=class extends et{constructor(e=0,r=0,n=100,i=100){super("svg"),this._state.svgX=e,this._state.svgY=r,this._state.svgWidth=n,this._state.svgHeight=i}position(e,r){return this._state.svgX=e,this._state.svgY=r,this}size(e,r){return this._state.svgWidth=e,this._state.svgHeight=r,this}viewBox(e,r,n,i){return this._state.svgViewBoxX=e,this._state.svgViewBoxY=r,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}},Li=class extends ae{constructor(e){super("shape-reference"),e!==void 0&&(this._state.targetShapeId=e)}target(e){return this._state.targetShapeId=e,this}offset(e,r){return this._state.offsetX=e,this._state.offsetY=r,this}size(e,r){return this._state.width=e,this._state.height=r,this}},Ni=class extends ae{position(e,r){return this._state.x=e,this._state.y=r,this}size(e,r){return this._state.width=e,this._state.height=r,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,r){return this._state.trimStart=e,this._state.trimEnd=r,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,r){return this._state.fadeInDuration=e,this._state.fadeOutDuration=r,this}language(e){return this._state.systemLanguage=e,this}},Bi=class extends Ni{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}},zi=class extends Ni{constructor(e){super("audio"),this._state.mediaKind="audio",e!==void 0&&(this._state.href=e)}},Gi=class extends ae{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,r){let n=this._state.pathPoints??[];return n.push({x:e,y:r}),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,r){return this._state.startEndpoint=e,this._state.endEndpoint=r,this}toD(){let e=this._state.pathPoints??[],r=this._state.pathCurveType??"CUBIC",n=this._state.pathClosed??!1,i=this._state.pathTension??.5,s=this._state.pathArcParams;return Ye(e,r,n,i,s)}},Vi=class extends ae{constructor(e=[]){super("polyline"),this._state.polylinePoints=[...e],this._state.polylineClosed=!1}points(e){return this._state.polylinePoints=[...e],this}addPoint(e,r){let n=this._state.polylinePoints??[];return n.push({x:e,y:r}),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,r){return this._state.startEndpoint=e,this._state.endEndpoint=r,this}},Ui=class extends ae{constructor(e,r,n,i,s){super("image"),this._state.x=e,this._state.y=r,this._state.width=n,this._state.height=i,this._state.href=s}position(e,r){return this._state.x=e,this._state.y=r,this}size(e,r){return this._state.width=e,this._state.height=r,this}src(e){return this._state.href=e,this}preserveAspectRatio(e){return this._state.preserveAspectRatio=e,this}};var vr=class{_x1;_y1;_x2;_y2;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(e=0,r=0,n=1,i=0){this._x1=e,this._y1=r,this._x2=n,this._y2=i,this._id=_()}stop(e,r,n=1){return this._stops.push({offset:e,color:r,opacity:n}),this}direction(e,r,n,i){return this._x1=e,this._y1=r,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}}},kr=class{_cx=.5;_cy=.5;_fx=.5;_fy=.5;_r=.5;_ry=.5;_rotation=0;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(){this._id=_()}center(e,r){return this._cx=e,this._cy=r,this}focus(e,r){return this._fx=e,this._fy=r,this}radius(e,r){return this._r=e,this._ry=r??e,this}rotation(e){return this._rotation=e,this}stop(e,r,n=1){return this._stops.push({offset:e,color:r,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}}},Tr=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",r="#000000",n="#ffffff"){this._patternType=e,this._color=r,this._backgroundColor=n,this._id=_()}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,r){return this._width=e,this._height=r,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,r){return this._x=e,this._y=r,this}customPatternId(e){return this._customPatternId=e,this}build(){let e,r,n;if(this._svgContent!==void 0)e=this._svgContent,r=this._width??10,n=this._height??10;else{let s=En(this._patternType,this._scale,this._color,this._backgroundColor,this._patternParams);e=s.svgContent,r=this._width??s.width,n=this._height??s.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:r,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 _l(t=0,e=0,r=1,n=0){return new vr(t,e,r,n)}function Rl(){return new kr}function Al(t="stripes",e="#000000",r="#ffffff"){return new Tr(t,e,r)}var pa={rows:4,cols:4,style:"classic",tabDepthPercent:20,tabPattern:"random",seed:1},ip=.04,sp=0;function ap(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let r=e;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}function F(t){return Number(t.toFixed(3)).toString()}function op(t,e,r,n,i,s,o,a,l,c,f,d){return[[0,0],[.2,a],[.5+l+f,-s+c],[.5-s+l,s+c],[.5-2*s+l-f,3*s+c],[.5+2*s+l-f,3*s+c],[.5+s+l,s+c],[.5+l+f,-s+c],[.8,d],[1,0]].map(([m,g])=>{let h=e+m*n,b=r+g*i*o;return t?{x:h,y:b}:{x:b,y:h}})}function Il(t,e,r,n,i,s,o,a,l,c,f){let d=[],p=(k,w)=>l==="alternating"?0:k+c()*(w-k),m=()=>c()<.5,g=p(-a,a),h=l==="alternating"?f%2===0:m(),b=null,$=g,v=p(-a,a),x=p(-a,a),S=p(-a,a);g=p(-a,a);for(let k=0;k<t;k++){k>0&&(b=h,h=l==="alternating"?(f+k)%2===0:m(),$=h===b?-g:g,v=p(-a,a),x=p(-a,a),S=p(-a,a),g=p(-a,a));let w=h?-1:1,T=r+k*i;d.push(op(e,T,n,i,s,o,w,$,v,x,S,g))}return d}function Ml(t,e,r,n,i,s,o){let a=2*s;return[[0,0],[.2,0],[.4,0],[.4,a],[.4,a],[.6,a],[.6,a],[.6,0],[.8,0],[1,0]].map(([c,f])=>{let d=e+c*n,p=r+f*i*o;return t?{x:d,y:p}:{x:p,y:d}})}function Cl(t,e){return t+` C ${F(e[1].x)} ${F(e[1].y)} ${F(e[2].x)} ${F(e[2].y)} ${F(e[3].x)} ${F(e[3].y)} C ${F(e[4].x)} ${F(e[4].y)} ${F(e[5].x)} ${F(e[5].y)} ${F(e[6].x)} ${F(e[6].y)} C ${F(e[7].x)} ${F(e[7].y)} ${F(e[8].x)} ${F(e[8].y)} ${F(e[9].x)} ${F(e[9].y)}`}function Dl(t,e){return t+` C ${F(e[8].x)} ${F(e[8].y)} ${F(e[7].x)} ${F(e[7].y)} ${F(e[6].x)} ${F(e[6].y)} C ${F(e[5].x)} ${F(e[5].y)} ${F(e[4].x)} ${F(e[4].y)} ${F(e[3].x)} ${F(e[3].y)} C ${F(e[2].x)} ${F(e[2].y)} ${F(e[1].x)} ${F(e[1].y)} ${F(e[0].x)} ${F(e[0].y)}`}function Fl(t,e={}){let r={...pa,...e};if(r.rows<1||r.cols<1)throw new Error("generatePuzzlePieces: rows and cols must be >= 1");if(!Number.isFinite(t.width)||!Number.isFinite(t.height))throw new Error("generatePuzzlePieces: bounds must have finite width/height");if(t.width<=0||t.height<=0)throw new Error("generatePuzzlePieces: bounds must have positive width/height");let{rows:n,cols:i,style:s,tabDepthPercent:o,tabPattern:a,seed:l}=r,c=ap(l),f=t.width/i,d=t.height/n,p=Math.max(0,Math.min(.4,o/200)),m=(s==="classic"||s==="curved")&&p>0,g=s==="square-tabs"&&p>0,h=s==="classic"&&a==="random"?ip:sp,b=[];for(let x=0;x<n-1;x++){let S=t.y+(x+1)*d;if(m)b.push(Il(i,!0,t.x,S,f,d,p,h,a,c,x));else if(g){let k=[];for(let w=0;w<i;w++){let T=a==="alternating"?(x+w)%2===0?1:-1:c()<.5?1:-1;k.push(Ml(!0,t.x+w*f,S,f,d,p,T))}b.push(k)}else b.push(new Array(i).fill(null))}let $=[];for(let x=0;x<i-1;x++){let S=t.x+(x+1)*f;if(m)$.push(Il(n,!1,t.y,S,d,f,p,h,a,c,x));else if(g){let k=[];for(let w=0;w<n;w++){let T=a==="alternating"?(w+x)%2===0?1:-1:c()<.5?1:-1;k.push(Ml(!1,t.y+w*d,S,d,f,p,T))}$.push(k)}else $.push(new Array(n).fill(null))}let v=[];for(let x=0;x<n;x++)for(let S=0;S<i;S++){let k=t.x+S*f,w=t.y+x*d,T=k+f,P=w+d,R=`M ${F(k)} ${F(w)}`;if(x===0)R+=` L ${F(T)} ${F(w)}`;else{let M=b[x-1][S];M?R=Cl(R,M):R+=` L ${F(T)} ${F(w)}`}if(S===i-1)R+=` L ${F(T)} ${F(P)}`;else{let M=$[S][x];M?R=Cl(R,M):R+=` L ${F(T)} ${F(P)}`}if(x===n-1)R+=` L ${F(k)} ${F(P)}`;else{let M=b[x][S];M?R=Dl(R,M):R+=` L ${F(k)} ${F(P)}`}if(S===0)R+=` L ${F(k)} ${F(w)}`;else{let M=$[S-1][x];M?R=Dl(R,M):R+=` L ${F(k)} ${F(w)}`}R+=" Z",v.push({id:`puzzle-${l}-r${x}-c${S}`,row:x,col:S,d:R})}return v}var Ll=[1,2,3,4,5,6,7,8,9],lp={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 wr(t){return t.map(e=>[...e])}function up(){return Array.from({length:9},()=>Array.from({length:9},()=>0))}function Nl(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let r=e;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}function Bl(t,e){let r=[...t];for(let n=r.length-1;n>0;n--){let i=Math.floor(e()*(n+1));[r[n],r[i]]=[r[i],r[n]]}return r}function Et(t){return 1<<t-1}function zl(t){let e=0,r=t;for(;r;)r&=r-1,e++;return e}function cp(t){for(let e=1;e<=9;e++)if(t===Et(e))return e;return 0}function ha(t,e){return Math.floor(t/3)*3+Math.floor(e/3)}function ma(t){let e=0;for(let r of t)for(let n of r)n!==0&&e++;return e}function dp(t){if(!Number.isFinite(t))return 1;let e=Math.floor(t);return e===0?1:e}function Gl(t,e){if(!Array.isArray(t)||t.length!==9)return e.push("Grid must contain 9 rows."),!1;let r=!0;for(let n=0;n<9;n++){if(!Array.isArray(t[n])||t[n].length!==9){e.push(`Row ${n+1} must contain 9 cells.`),r=!1;continue}for(let i=0;i<9;i++){let s=t[n][i];(!Number.isInteger(s)||s<0||s>9)&&(e.push(`Cell R${n+1}C${i+1} must be a digit from 0 to 9.`),r=!1)}}return r}function Vl(t,e){let r=!0,n=(i,s)=>{let o=0;for(let a of s){if(a===0)continue;let l=Et(a);if(o&l){e.push(`${i} contains duplicate ${a}.`),r=!1;return}o|=l}};for(let i=0;i<9;i++)n(`Row ${i+1}`,t[i]);for(let i=0;i<9;i++)n(`Column ${i+1}`,t.map(s=>s[i]));for(let i=0;i<9;i+=3)for(let s=0;s<9;s+=3){let o=[];for(let a=i;a<i+3;a++)for(let l=s;l<s+3;l++)o.push(t[a][l]);n(`Box ${Math.floor(i/3)*3+Math.floor(s/3)+1}`,o)}return r}function ga(t){let e=Array.from({length:9},()=>0),r=Array.from({length:9},()=>0),n=Array.from({length:9},()=>0);for(let i=0;i<9;i++)for(let s=0;s<9;s++){let o=t[i][s];if(o===0)continue;let a=Et(o),l=ha(i,s);if(e[i]&a||r[s]&a||n[l]&a)return null;e[i]|=a,r[s]|=a,n[l]|=a}return{rows:e,cols:r,boxes:n}}function ya(t,e,r,n,i){return 511&~(r[t]|n[e]|i[ha(t,e)])}function Ul(t,e,r){let n=ga(t);if(!n)return[];let i=wr(t),s=[],{rows:o,cols:a,boxes:l}=n,c=()=>{if(s.length>=e)return;let f=-1,d=-1,p=0,m=10;for(let h=0;h<9;h++){for(let b=0;b<9;b++){if(i[h][b]!==0)continue;let $=ya(h,b,o,a,l),v=zl($);if(v===0)return;if(v<m&&(f=h,d=b,p=$,m=v,v===1))break}if(m===1)break}if(f===-1){s.push(wr(i));return}let g=Ll.filter(h=>p&Et(h));r&&(g=Bl(g,r));for(let h of g){let b=Et(h),$=ha(f,d);if(i[f][d]=h,o[f]|=b,a[d]|=b,l[$]|=b,c(),l[$]&=~b,a[d]&=~b,o[f]&=~b,i[f][d]=0,s.length>=e)return}};return c(),s}function fp(t){let e=up(),r=Nl(t),[n]=Ul(e,1,r);if(!n)throw new Error("generateSudokuPuzzle: failed to generate solved grid");return n}function pp(t){let e=ga(t);if(!e)return null;for(let r=0;r<9;r++)for(let n=0;n<9;n++){if(t[r][n]!==0)continue;let i=ya(r,n,e.rows,e.cols,e.boxes);if(zl(i)===1)return{row:r,col:n,value:cp(i)}}return null}function mp(t){let e=ga(t);if(!e)return null;let r=n=>{for(let i of Ll){let s=Et(i),o=null;for(let a of n)if(!(t[a.row][a.col]!==0||!(ya(a.row,a.col,e.rows,e.cols,e.boxes)&s))){if(o){o=null;break}o=a}if(o)return{...o,value:i}}return null};for(let n=0;n<9;n++){let i=r(Array.from({length:9},(s,o)=>({row:n,col:o})));if(i)return i}for(let n=0;n<9;n++){let i=r(Array.from({length:9},(s,o)=>({row:o,col:n})));if(i)return i}for(let n=0;n<9;n+=3)for(let i=0;i<9;i+=3){let s=[];for(let a=n;a<n+3;a++)for(let l=i;l<i+3;l++)s.push({row:a,col:l});let o=r(s);if(o)return o}return null}function El(t){let e=wr(t),r=!1;for(;ma(e)<81;){let n=pp(e);if(n){e[n.row][n.col]=n.value;continue}let i=mp(e);if(i){r=!0,e[i.row][i.col]=i.value;continue}return"search"}return r?"hidden-singles":"singles"}function Ol(t,e){let r={singles:0,"hidden-singles":1,search:2};return r[t]<=r[e]}function Pr(t,e={}){let r=[];return Gl(t,r)?Vl(t,r)?Ul(t,Math.max(1,Math.floor(e.maxSolutions??2))):[]:[]}function Wl(t){let e=[];if(!Gl(t,e))return{valid:!1,unique:!1,solution:null,errors:e};if(Vl(t,e),e.length>0)return{valid:!1,unique:!1,solution:null,errors:e};let n=Pr(t,{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]?wr(n[0]):null,errors:e}}function Hl(t){let e=t.difficulty,r=lp[e];if(!r)throw new Error(`generateSudokuPuzzle: unsupported difficulty "${e}"`);let n=dp(t.seed);for(let i=0;i<30;i++){let s=n+i*104729>>>0,o=Nl(s),a=fp(s),l=wr(a),c=r.minGivens+Math.floor(o()*(r.maxGivens-r.minGivens+1)),f=Bl(Array.from({length:81},(g,h)=>({row:Math.floor(h/9),col:h%9})),o);for(let g of f){if(ma(l)<=c)break;let h=l[g.row][g.col];if(l[g.row][g.col]=0,Pr(l,{maxSolutions:2}).length!==1){l[g.row][g.col]=h;continue}let $=El(l);Ol($,r.maxRating)||(l[g.row][g.col]=h)}let d=ma(l),p=El(l);if(Pr(l,{maxSolutions:2}).length===1&&d>=r.minGivens&&d<=r.maxGivens&&Ol(p,r.maxRating))return{puzzle:l,solution:a,difficulty:e,seed:n,givens:d,rating:p}}throw new Error(`generateSudokuPuzzle: unable to generate a ${e} puzzle`)}var jl="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var hp={E:{direction:"E",dr:0,dc:1},S:{direction:"S",dr:1,dc:0},SE:{direction:"SE",dr:1,dc:1},NE:{direction:"NE",dr:-1,dc:1},W:{direction:"W",dr:0,dc:-1},N:{direction:"N",dr:-1,dc:0},NW:{direction:"NW",dr:-1,dc:-1},SW:{direction:"SW",dr:1,dc:-1}};function Xl(t){if(!Number.isFinite(t))return 1;let e=Math.floor(t);return e===0?1:e}function Yl(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let r=e;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}function Ot(t){let e=globalThis.Intl.Segmenter;return e?Array.from(new e(void 0,{granularity:"grapheme"}).segment(t),r=>r.segment.normalize("NFC")):Array.from(t.normalize("NFC"))}function gp(t,e,r,n){return t>=0&&e>=0&&t<n&&e<r}function ba(t,e){return Array.from({length:e},()=>Array.from({length:t},()=>!0))}function ql(t,e,r,n){if(!r)return ba(t,e);if(!Array.isArray(r)||r.length!==e)return n.push(`Mask must contain exactly ${e} rows.`),ba(t,e);let i=[];for(let s=0;s<e;s++){if(!Array.isArray(r[s])||r[s].length!==t)return n.push(`Mask row ${s+1} must contain exactly ${t} cells.`),ba(t,e);i.push(r[s].map(Boolean))}return i}function yp(t){let e=0;for(let r of t)for(let n of r)n&&e++;return e}function bp(t){return t.trim().normalize("NFC")}function Zl(t){return t.replace(/\r/g,"").split(/[,\n]+/).map(e=>e.trim()).filter(e=>e.length>0)}function xa(t,e){let r=[];return t.across&&(r.push("E"),e&&r.push("W")),t.down&&(r.push("S"),e&&r.push("N")),t.diagonal&&(r.push("SE","NE"),e&&r.push("NW","SW")),r}function xp(t,e,r,n,i,s,o,a){let l=Ot(t),c=[];for(let f=0;f<l.length;f++){let d=e+n.dr*f,p=r+n.dc*f;if(!gp(d,p,s,o)||!i[d][p])return null;c.push({row:d,col:p,grapheme:l[f]})}return{word:t,graphemes:l,row:e,col:r,direction:n.direction,dr:n.dr,dc:n.dc,cells:c,jitter:a}}function Jl(t,e,r,n,i,s){let o=[];for(let a of e){let l=hp[a];for(let c=0;c<i;c++)for(let f=0;f<n;f++){let d=xp(t,c,f,l,r,n,i,s());d&&o.push(d)}}return o}function Sa(t){let e=[],r=[],n=[],i=Math.floor(t.width),s=Math.floor(t.height);(!Number.isInteger(i)||i<2||i>64)&&e.push("Width must be an integer from 2 to 64."),(!Number.isInteger(s)||s<2||s>64)&&e.push("Height must be an integer from 2 to 64.");let o=xa(t.axes,t.allowBackwards);o.length===0&&e.push("At least one word direction must be enabled.");let a=ql(Math.max(1,i),Math.max(1,s),t.mask,e),l=yp(a);l===0&&e.push("Mask must contain at least one active cell.");let c=new Set,f=[];for(let m of t.words){let g=bp(m);if(g){if(/\s/u.test(g)){n.push({input:m,reason:"Words cannot contain whitespace."});continue}if(c.has(g)){n.push({input:m,reason:"Duplicate word."});continue}c.add(g),f.push(g)}}f.length===0&&e.push("Enter at least one word.");let d=Yl(Xl(t.seed));if(e.length===0)for(let m=f.length-1;m>=0;m--){let g=f[m];Jl(g,o,a,i,s,d).length===0&&(n.push({input:g,reason:"No legal placement exists for the current size, mask, and directions."}),f.splice(m,1))}n.length>0&&e.push(`${n.length} word${n.length===1?"":"s"} rejected.`);let p=Math.max(0,l);return f.length>p&&r.push("The word count exceeds the active cell count; overlaps may be required for this puzzle."),{valid:e.length===0,acceptedWords:f,rejectedWords:n,errors:e,warnings:r,minWords:1,maxWords:p,activeCells:l,directions:o}}function Sp(t,e){for(let r of e.cells){let n=t[r.row][r.col];if(n!==null&&n!==r.grapheme)return!0}return!1}function $p(t,e){let r=[];for(let n of e.cells)t[n.row][n.col]===null&&(r.push({row:n.row,col:n.col}),t[n.row][n.col]=n.grapheme);return r}function vp(t,e){for(let r of e)t[r.row][r.col]=null}function Kl(t,e){let r=0;for(let n of e.cells)t[n.row][n.col]===n.grapheme&&r++;return r}function kp(t){return{word:t.word,row:t.row,col:t.col,direction:t.direction,path:t.cells.map(e=>({...e}))}}function Tp(t){let e=t.fillerAlphabet??jl,r=typeof e=="string"?Ot(e):e.flatMap(i=>Ot(i)),n=r.filter((i,s)=>i.trim()&&r.indexOf(i)===s);return n.length>0?n:Ot(jl)}function Ql(t){let e=Math.floor(t.width),r=Math.floor(t.height),n=Xl(t.seed),i=Sa({...t,width:e,height:r,seed:n});if(!i.valid)throw new Error(`generateWordSearch: ${i.errors[0]??"invalid options"}`);let s=ql(e,r,t.mask,[]),o=Math.max(1,Math.floor(t.maxBacktrackNodes??15e4));for(let a=0;a<24;a++){let l=Yl(n+a*104729>>>0),c=i.directions,f=new Map;for(let v of i.acceptedWords)f.set(v,Jl(v,c,s,e,r,l));let d=[...i.acceptedWords].sort((v,x)=>{let S=f.get(v)?.length??0,k=f.get(x)?.length??0;return S!==k?S-k:Ot(x).length-Ot(v).length}),p=Array.from({length:r},(v,x)=>Array.from({length:e},(S,k)=>s[x][k]?null:"")),m=[],g=new Map,h=0,b=v=>{if(++h>o)return!1;if(v>=d.length)return!0;let x=d[v],S=[...f.get(x)??[]].filter(k=>!Sp(p,k)).sort((k,w)=>{let T=Kl(p,w)-Kl(p,k);if(T!==0)return T;let P=(g.get(k.direction)??0)-(g.get(w.direction)??0);return P!==0?P:k.jitter-w.jitter});for(let k of S){let w=$p(p,k);if(m.push(kp(k)),g.set(k.direction,(g.get(k.direction)??0)+1),b(v+1))return!0;g.set(k.direction,(g.get(k.direction)??1)-1),m.pop(),vp(p,w)}return!1};if(!b(0))continue;let $=Tp(t);for(let v=0;v<r;v++)for(let x=0;x<e;x++)s[v][x]?p[v][x]===null&&(p[v][x]=$[Math.floor(l()*$.length)]):p[v][x]="";return{width:e,height:r,grid:p,mask:s.map(v=>[...v]),normalizedWords:[...i.acceptedWords],placements:[...m],seed:n,title:t.title,creator:t.creator,lint:i}}throw new Error("generateWordSearch: unable to place all words with the current settings")}function wp(t,e,r){let n=!1;for(let i=0,s=r.length-1;i<r.length;s=i++){let o=r[i],a=r[s];o.y>e!=a.y>e&&t<(a.x-o.x)*(e-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n}function Pp(){let t=[];for(let e=0;e<10;e++){let r=e%2===0?.5:.23,n=-Math.PI/2+e*Math.PI/5;t.push({x:.5+Math.cos(n)*r,y:.5+Math.sin(n)*r})}return t}function eu(t,e,r){let n=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(e)),s=Pp();return Array.from({length:i},(o,a)=>Array.from({length:n},(l,c)=>{let f=(c+.5)/n,d=(a+.5)/i,p=f*2-1,m=d*2-1;switch(r){case"rectangle":return!0;case"circle":return p*p+m*m<=1;case"triangle":return d>=.08&&d<=.95&&Math.abs(p)<=d;case"diamond":return Math.abs(p)+Math.abs(m)<=1;case"star":return wp(f,d,s);case"heart":{let g=p*1.25,h=-m*1.25;return Math.pow(g*g+h*h-1,3)-g*g*h*h*h<=0}case"cross":return Math.abs(p)<=.32||Math.abs(m)<=.32;default:return!0}}))}0&&(module.exports={Arrow,Audio,BUILTIN_MARKER_ID_MAP,COLLAB_PROTOCOL_VERSION,COMMON_PROP_DEFAULTS,COMMON_TRANSFORM_NODE_DEFAULTS,CURRENT_SCHEMA_VERSION,Circle,Cloud,Container,ContainerShapeBuilder,Cross,DEFAULT_COORDINATE_PRECISION,DEFAULT_RICH_TEXT_STYLE,Document,DocumentBuilder,EASING_CURVES,EasingType,Ellipse,Gear,Heart,Hyperlink,IDENTITY_AFFINE,ImageShape,KNOWN_STATE_KEYS,LIBRARY_EMIT_ORDER,Lightning,Line,LinearGradientBuilder,MARKER_HEIGHT,MARKER_VIEWBOX,MARKER_WIDTH,MAX_COORDINATE_PRECISION,MIGRATIONS,NGon,NON_WIRE_PROP_KEYS,NUMERIC_SHAPE_TRANSFORM_STATE_KEYS,NestedSvg,NodeSchemaRegistry,PUZZLE_DEFAULTS,Path,PathCurveType,PathPointType,PatternBuilder,Polyline,RICH_TEXT_STYLE_KEYS,RadialGradientBuilder,Rectangle,Ring,SERIALIZED_SHAPE_STATE_KEYS,SHAPE_TRANSFORM_STATE_KEYS,SceneGraph,SceneNode,ShapeBuilder,ShapeReference,SpeechBubble,Spiral,Square,Star,Switch,Text,Timeline,Track,Triangle,Video,View,affine,affineFromArray,affineToArray,almostEqualAffine,applyAffineToPoint,applyAffineToVector,applyOpToSnapshot,applyOpsToSnapshot,applyOpsToSnapshotWithAccepted,applyRichTextFormat,applyTextSplice,applyTextTransform,arcEndpointToCenter,areTracksTimingEquivalent,around,buildCompoundTransformValues,buildSmilKeyframeData,canonicalPolygonTransformString,canonicalTransformString,collaborationResourceKey,collectMarkerReferences,collectReferencedLibraryDefs,collectReferencedMarkerIds,compareOrderKeys,composeLegacyTransformMatrix,computeArrowVertices,computeCloudPath,computeCrossVertices,computeDashArray,computeFlowchartBoxPath,computeGearPath,computeGearVertices,computeHeartPath,computeLightningVertices,computePolygonVertices,computeRectanglePath,computeRingPath,computeSpeechBubbleVertices,computeSpiralPath,computeSplinePath,computeStarVertices,createDocument,createSceneNode,createShape,createViewbox,createWordSearchPrimitiveMask,cubicBezierExtent1D,customPatternDefToLibraryDef,declaredRichTextDeltaKeys,decomposeAffine2D,defaultVariableMode,deriveRichTextFormatRanges,deriveSegments,deriveTextSplice,downTranslateAnimationKeyframeOps,downTranslateCollectionMoveOps,downTranslateDocumentFieldOps,downTranslateScenePlaceOps,downTranslateTextFormatOps,ellipticalArcBounds,escXml,extractVariables,filterAttr,findShapeById,flattenShapeStateTree,flattenStateExtra,foldLegacyAncestorTransformIntoMatrix,forEachLibraryRefInState,forEachMarkerRefInState,forEachReachableShape,forEachShapeInLibraryDefs,formatOperationValidationIssues,formatSmilKeySpline,formatSmilKeyTime,freezeSiblingOrderKeys,generateCode,generateCssCode,generateD3Code,generateId,generatePatternSvgContent,generatePuzzlePieces,generateReactCode,generateSudokuPuzzle,generateSvgCode,generateVueCode,generateWordSearch,getBuiltInMarkerDefs,getEasingCubicBezier,getEffectivePrecision,getKeyframeCubicBezier,getMarkerDescriptors,getPatternElements,getSmilAdditive,getSmilBeginValue,getSmilFillMode,getSmilMotionKeyPoints,getSmilRepeatCount,getSmilSetBeginValue,getSmilTrackDuration,getWordSearchDirections,initialOrderKeys,invertAffine,isDefaultKeyPoints,isDefaultKeyTimes,isFiniteAffineArray,isIdentityAffine,isIdentityLinearSplines,isIndefiniteSetTrack,isReusablePatternTile,isSetSequenceTrack,isValidOrderKey,keyBetween,keysBetween,legacyEndpointMarkerId,linearGradient,lintWordSearchOptions,materializeSceneTreeOrderKeys,matrixTransformPart,maxCollaborationTimestamp,mergeRichTextStyle,migrateSnapshot,moveResourceById,multiplyAffine,nodeSchemas,normalizeRichTextRuns,normalizeRichTextStyle,normalizeRichTextStyleDelta,orderSiblings,parseDocument,parseSvgTransformList,parseVariableArgs,parseWordSearchWords,partitionShapeStateTree,partitionStateExtra,pathDataBounds,pattern,patternLibraryDefToCustomPatternDef,patternTileSize,planTransformFusion,projectSceneTreeOntoClipMaskGroups,projectSceneTreeOntoShapes,promoteRebasedShapeUpdateClock,quadraticBezierExtent1D,radialGradient,rebaseRichTextFormatRanges,rebaseRichTextRuns,reflectCubicBezier,removeResourceById,removeResourceByKey,removeResourceByName,removeTrackKeyframe,renderAnimationElements,renderBuiltinMarkerDefs,renderCircle,renderEllipse,renderFilterDefs,renderFilterLibraryDef,renderFilterPrimitive,renderFilterPrimitivesForType,renderFlowchartBox,renderImage,renderLibraryDef,renderLibraryDefs,renderLine,renderLinearGradientLibraryDef,renderMarkerLibraryDef,renderPatternLibraryDef,renderPolygonShape,renderPolyline,renderRadialGradientLibraryDef,renderRectangle,renderReferencedLibraryDefs,renderShape,renderSpline,renderSvgPrimitiveChainFilter,renderSymbolInstance,renderSymbolLibraryDef,renderText,renderToSvg,resolveRichTextStyleAt,resolveSymbolInstanceShapes,rewriteDocumentEmbeddedPayloads,rewriteShapeStateEmbeddedPayloads,richTextFontVariantCss,richTextLineSpans,richTextRunsFromState,richTextStyleDelta,richTextStyleDeltasEqual,richTextStylesEqual,richTextTspanAttributes,rotateAffine,roundCoord,roundNumberString,roundSerializedShape,roundSnapshot,runsFromSegments,sanitizeRichTextFormatRanges,scaleAffine,skewXAffine,skewYAffine,smilKeyframeAttributes,solveCubicBezier,solveSudoku,splinePathBounds,stringifyDocument,substituteString,substituteVariables,symbolInstanceTargetId,transformSplice,translateAffine,tryParseSvgTransformList,upsertResourceById,upsertResourceByKey,upsertResourceByName,upsertTrackKeyframe,validateDocumentOperations,validateOperation,validatePresenceOperation,validateSnapshot,validateSudokuPuzzle,verticesToPath});
|