@svgsketch/core 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +105 -16
- package/dist/index.d.ts +105 -16
- 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 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
|
-
`,
|
|
3
|
-
`),a+=1);let d=i[f]?.segments,p=Array.isArray(d)?d:[],m=a;for(let
|
|
4
|
-
`)&&
|
|
5
|
-
`,
|
|
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(`
|
|
1
|
+
"use strict";var ji=Object.defineProperty;var fu=Object.getOwnPropertyDescriptor;var pu=Object.getOwnPropertyNames;var mu=Object.prototype.hasOwnProperty;var hu=(n,e)=>{for(var t in e)ji(n,t,{get:e[t],enumerable:!0})},gu=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of pu(e))!mu.call(n,i)&&i!==t&&ji(n,i,{get:()=>e[i],enumerable:!(r=fu(e,i))||r.enumerable});return n};var yu=n=>gu(ji({},"__esModule",{value:!0}),n);var zp={};hu(zp,{Arrow:()=>Ri,Audio:()=>Gi,BUILTIN_MARKER_ID_MAP:()=>Ls,COLLAB_PROTOCOL_VERSION:()=>zo,COMMON_PROP_DEFAULTS:()=>J,COMMON_TRANSFORM_NODE_DEFAULTS:()=>qi,CURRENT_SCHEMA_VERSION:()=>xe,Circle:()=>hi,Cloud:()=>Mi,Container:()=>Ei,ContainerShapeBuilder:()=>tt,Cross:()=>Ti,DEFAULT_COORDINATE_PRECISION:()=>rl,DEFAULT_RICH_TEXT_STYLE:()=>Xt,Document:()=>wn,DocumentBuilder:()=>wn,EASING_CURVES:()=>Cn,EasingType:()=>Mn,Ellipse:()=>gi,Gear:()=>_i,Heart:()=>Ai,Hyperlink:()=>Di,IDENTITY_AFFINE:()=>rn,ImageShape:()=>Wi,KNOWN_STATE_KEYS:()=>Qi,LIBRARY_EMIT_ORDER:()=>Zs,Lightning:()=>Ii,Line:()=>Si,LinearGradientBuilder:()=>Pn,MARKER_HEIGHT:()=>Nr,MARKER_VIEWBOX:()=>Sn,MARKER_WIDTH:()=>Lr,MAX_COORDINATE_PRECISION:()=>il,MIGRATIONS:()=>_s,NGon:()=>vi,NON_WIRE_PROP_KEYS:()=>Fa,NUMERIC_SHAPE_TRANSFORM_STATE_KEYS:()=>Bt,NestedSvg:()=>Li,NodeSchemaRegistry:()=>Wt,PUZZLE_DEFAULTS:()=>ya,Path:()=>Vi,PathCurveType:()=>Ki,PathPointType:()=>Aa,PatternBuilder:()=>Rn,Polyline:()=>Ui,RICH_TEXT_STYLE_KEYS:()=>vt,RadialGradientBuilder:()=>_n,Rectangle:()=>yi,Ring:()=>wi,SERIALIZED_SHAPE_STATE_KEYS:()=>Xi,SHAPE_TRANSFORM_STATE_KEYS:()=>Yi,SceneGraph:()=>Nn,SceneNode:()=>Be,ShapeBuilder:()=>ae,ShapeReference:()=>Ni,SpeechBubble:()=>Ci,Spiral:()=>Pi,Square:()=>bi,Star:()=>ki,Switch:()=>Fi,Text:()=>xi,Timeline:()=>mi,Track:()=>pi,Triangle:()=>$i,Video:()=>zi,View:()=>Oi,affine:()=>We,affineFromArray:()=>rr,affineToArray:()=>Ye,almostEqualAffine:()=>rc,applyAffineToPoint:()=>sc,applyAffineToVector:()=>ac,applyOpToSnapshot:()=>Do,applyOpsInPlace:()=>bs,applyOpsToSnapshot:()=>Fo,applyOpsToSnapshotWithAccepted:()=>Ss,applyRichTextFormat:()=>qt,applyTextSplice:()=>no,applyTextTransform:()=>xn,arcEndpointToCenter:()=>pa,areTracksTimingEquivalent:()=>ua,around:()=>vs,buildCompoundTransformValues:()=>Qr,buildSmilKeyframeData:()=>et,canonicalPolygonTransformString:()=>Ts,canonicalTransformString:()=>At,collaborationResourceKey:()=>us,collectMarkerReferences:()=>yn,collectReferencedLibraryDefs:()=>vn,collectReferencedMarkerIds:()=>yl,compareOrderKeys:()=>Ut,composeLegacyTransformMatrix:()=>ln,computeArrowVertices:()=>$r,computeCloudPath:()=>wr,computeCrossVertices:()=>xr,computeDashArray:()=>Mt,computeFlowchartBoxPath:()=>Ir,computeGearPath:()=>Rr,computeGearVertices:()=>Ds,computeHeartPath:()=>Tr,computeLightningVertices:()=>kr,computePolygonVertices:()=>mn,computeRectanglePath:()=>Ar,computeRingPath:()=>Pr,computeSpeechBubbleVertices:()=>vr,computeSpiralPath:()=>_r,computeSplinePath:()=>qe,computeStarVertices:()=>Sr,createDocument:()=>lr,createSceneNode:()=>rt,createShape:()=>tl,createViewbox:()=>fn,createWordSearchPrimitiveMask:()=>du,cubicBezierExtent1D:()=>si,customPatternDefToLibraryDef:()=>Ue,declaredRichTextDeltaKeys:()=>Xn,decomposeAffine2D:()=>Ac,defaultVariableMode:()=>Su,deriveRichTextFormatRanges:()=>uo,deriveSegments:()=>Ve,deriveTextSplice:()=>to,downTranslateAnimationKeyframeOps:()=>Lo,downTranslateCollectionMoveOps:()=>Bo,downTranslateDocumentFieldOps:()=>Go,downTranslateScenePlaceOps:()=>Oo,downTranslateTextFormatOps:()=>No,ellipticalArcBounds:()=>ma,escXml:()=>Y,extractVariables:()=>hr,filterAttr:()=>Er,findShapeById:()=>ct,flattenShapeStateTree:()=>Ht,flattenStateExtra:()=>Ne,foldLegacyAncestorTransformIntoMatrix:()=>ks,forEachLibraryRefInState:()=>gl,forEachMarkerRefInState:()=>hl,forEachReachableShape:()=>gn,forEachShapeInLibraryDefs:()=>ml,formatOperationValidationIssues:()=>eo,formatSmilKeySpline:()=>Wr,formatSmilKeyTime:()=>be,freezeSiblingOrderKeys:()=>tn,generateCode:()=>fi,generateCssCode:()=>di,generateD3Code:()=>ci,generateId:()=>_,generatePatternSvgContent:()=>Or,generatePuzzlePieces:()=>Hl,generateReactCode:()=>li,generateSudokuPuzzle:()=>nu,generateSvgCode:()=>oi,generateVueCode:()=>ui,generateWordSearch:()=>cu,getBuiltInMarkerDefs:()=>bl,getEasingCubicBezier:()=>bu,getEffectivePrecision:()=>sl,getKeyframeCubicBezier:()=>sa,getMarkerDescriptors:()=>pt,getPatternElements:()=>bn,getSmilAdditive:()=>qr,getSmilBeginValue:()=>mt,getSmilFillMode:()=>ht,getSmilMotionKeyPoints:()=>Zr,getSmilRepeatCount:()=>Yr,getSmilSetBeginValue:()=>Xr,getSmilTrackDuration:()=>Qe,getWordSearchDirections:()=>ka,initialOrderKeys:()=>On,invertAffine:()=>ic,isDefaultKeyPoints:()=>Hr,isDefaultKeyTimes:()=>kn,isFiniteAffineArray:()=>_t,isIdentityAffine:()=>$s,isIdentityLinearSplines:()=>la,isIndefiniteSetTrack:()=>jr,isReusablePatternTile:()=>Zt,isSetSequenceTrack:()=>Kr,isValidOrderKey:()=>Vt,keyBetween:()=>bt,keysBetween:()=>En,legacyEndpointMarkerId:()=>hn,linearGradient:()=>Nl,lintWordSearchOptions:()=>Ta,materializeSceneTreeOrderKeys:()=>Eo,matrixTransformPart:()=>xs,maxCollaborationTimestamp:()=>So,mergeRichTextStyle:()=>jn,migrateSnapshot:()=>ar,moveResourceById:()=>er,multiplyAffine:()=>ne,nodeSchemas:()=>O,normalizeRichTextRuns:()=>st,normalizeRichTextStyle:()=>Ce,normalizeRichTextStyleDelta:()=>Yt,orderSiblings:()=>Pe,parseDocument:()=>cr,parseSvgTransformList:()=>ir,parseVariableArgs:()=>nl,parseWordSearchWords:()=>lu,partitionShapeStateTree:()=>nt,partitionStateExtra:()=>Ln,pathDataBounds:()=>ga,pattern:()=>zl,patternLibraryDefToCustomPatternDef:()=>kt,patternTileSize:()=>as,planTransformFusion:()=>Jr,projectSceneTreeOntoClipMaskGroups:()=>Tt,projectSceneTreeOntoShapes:()=>gs,promoteRebasedShapeUpdateClock:()=>xo,quadraticBezierExtent1D:()=>ai,radialGradient:()=>Bl,rebaseRichTextFormatRanges:()=>lo,rebaseRichTextRuns:()=>co,reflectCubicBezier:()=>oa,removeResourceById:()=>ye,removeResourceByKey:()=>Un,removeResourceByName:()=>Hn,removeTrackKeyframe:()=>hs,renderAnimationElements:()=>ni,renderBuiltinMarkerDefs:()=>Ee,renderCircle:()=>zs,renderEllipse:()=>Gs,renderFilterDefs:()=>fl,renderFilterLibraryDef:()=>ia,renderFilterPrimitive:()=>Fr,renderFilterPrimitivesForType:()=>Es,renderFlowchartBox:()=>Ys,renderImage:()=>Ks,renderLibraryDef:()=>Js,renderLibraryDefs:()=>$n,renderLine:()=>Us,renderLinearGradientLibraryDef:()=>ta,renderMarkerLibraryDef:()=>ea,renderPatternLibraryDef:()=>ra,renderPolygonShape:()=>qs,renderPolyline:()=>js,renderRadialGradientLibraryDef:()=>na,renderRectangle:()=>Vs,renderReferencedLibraryDefs:()=>Ze,renderShape:()=>de,renderSpline:()=>Hs,renderSvgPrimitiveChainFilter:()=>Fs,renderSymbolInstance:()=>Xs,renderSymbolLibraryDef:()=>Qs,renderText:()=>Ws,renderToSvg:()=>Et,resolveRichTextStyleAt:()=>oo,resolveSymbolInstanceShapes:()=>Br,rewriteDocumentEmbeddedPayloads:()=>Jo,rewriteShapeStateEmbeddedPayloads:()=>or,richTextFontVariantCss:()=>Dt,richTextLineSpans:()=>is,richTextRunsFromState:()=>Zn,richTextStyleDelta:()=>Kn,richTextStyleDeltasEqual:()=>qn,richTextStylesEqual:()=>Yn,richTextTspanAttributes:()=>zr,rotateAffine:()=>Rt,roundCoord:()=>yr,roundNumberString:()=>Is,roundSerializedShape:()=>gr,roundSnapshot:()=>al,runsFromSegments:()=>at,sanitizeRichTextFormatRanges:()=>Jn,scaleAffine:()=>sn,senderCorrectionsForOp:()=>Mo,skewXAffine:()=>an,skewYAffine:()=>on,smilKeyframeAttributes:()=>Tn,solveCubicBezier:()=>aa,solveSudoku:()=>In,splinePathBounds:()=>Dl,stringifyDocument:()=>ur,substituteString:()=>dr,substituteVariables:()=>mr,symbolInstanceTargetId:()=>Ct,transformSplice:()=>Kt,translateAffine:()=>_e,tryParseSvgTransformList:()=>Ko,upsertResourceById:()=>ge,upsertResourceByKey:()=>Vn,upsertResourceByName:()=>Wn,upsertTrackKeyframe:()=>ms,validateDocumentOperations:()=>Ja,validateOperation:()=>Gn,validatePresenceOperation:()=>Qa,validateSnapshot:()=>dn,validateSudokuPuzzle:()=>tu,verticesToPath:()=>Ae});module.exports=yu(zp);var Mn=(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))(Mn||{}),Cn={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 bu(n){let e=Cn[n];return e?`cubic-bezier(${e.join(", ")})`:"linear"}var Ki=(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))(Ki||{}),Aa=(r=>(r.SMOOTH="smooth",r.CORNER="corner",r.SYMMETRIC="symmetric",r))(Aa||{});function Su(n){return n==="color"?"live":"stamped"}var Xi=["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","containerPresentation","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 Yi=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY","customPivot","rawTransform"],Bt=["transformMatrix","scaleX","scaleY","translateX","translateY","rotation","skewX","skewY"],qi={transformMatrix:null,translateX:0,translateY:0,rotation:0,skewX:0,skewY:0,customPivot:null,rawTransform:null};var Oe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Fn=Oe.length,Le=Oe[0],Ia=Oe[Fn-1],Ca=Oe[Math.floor(Fn/2)],Zi=97,xu=122;function yt(n){let e=Oe.indexOf(n);if(e===-1)throw new Error(`order-key: invalid digit '${n}'`);return e}function $u(n){let e=n.charCodeAt(0);if(e<Zi||e>xu)throw new Error(`order-key: invalid head '${n}'`);return e-Zi+1}function Ke(n){if(n<1||n>26)throw new Error(`order-key: integer length ${n} out of range`);return String.fromCharCode(Zi+n-1)}function zt(n){let e=$u(n[0]);if(n.length<1+e)throw new Error(`order-key: '${n}' shorter than its integer part`);let t=n.slice(1,1+e),r=n.slice(1+e);for(let i of t)yt(i);for(let i of r)yt(i);return{integer:t,fraction:r}}function Dn(n){for(let e of n)if(e!==Le)return!1;return!0}function Vt(n){if(n.length===0)return!1;try{let{integer:e,fraction:t}=zt(n);return!(t.endsWith(Le)||Dn(e)&&t.length===0||e.length>1&&e[0]===Le)}catch{return!1}}function Ma(n,e){if(!Vt(n))throw new Error(`order-key: invalid ${e} '${n}'`)}function Ut(n,e){return n<e?-1:n>e?1:0}function vu(n){let e=n.split("");for(let t=e.length-1;t>=0;t--){let r=yt(e[t]);if(r<Fn-1){e[t]=Oe[r+1];for(let i=t+1;i<e.length;i++)e[i]=Le;return e.join("")}}return null}function Ji(n){let{integer:e}=zt(n),t=vu(e);if(t!==null)return Ke(e.length)+t;let r="1"+Le.repeat(e.length);return Ke(r.length)+r}function ku(n){let e=n.split("");for(let t=e.length-1;t>=0;t--){let r=yt(e[t]);if(r>0){e[t]=Oe[r-1];for(let i=t+1;i<e.length;i++)e[i]=Ia;return e.join("")}e[t]=Ia}throw new Error(`order-key: cannot decrement zero integer '${n}'`)}function Tu(n){let e=0;for(;e<n.length-1&&n[e]===Le;)e++;return n.slice(e)}function wu(n){let{integer:e,fraction:t}=zt(n);if(!Dn(e)){let r=ku(e);if(!Dn(r)){let i=Tu(r);return Ke(i.length)+i}return Ke(1)+Le+Ca}return Ke(1)+Le+Gt("",t)}function Gt(n,e){if(e!==null){if(e.length===0||n>=e)throw new Error(`order-key: fraction bounds out of order ('${n}' >= '${e}')`);let i=0;for(;i<e.length&&(n[i]??Le)===e[i];)i++;if(i>0)return e.slice(0,i)+Gt(n.slice(i),e.slice(i))}let t=n.length>0?yt(n[0]):0,r=e!==null?yt(e[0]):Fn;return r-t>1?Oe[Math.floor((t+r)/2)]:Oe[t]+Gt(n.slice(1),null)}function bt(n,e){if(n!==null&&Ma(n,"lower bound"),e!==null&&Ma(e,"upper bound"),n!==null&&e!==null&&n>=e)throw new Error(`order-key: bounds out of order ('${n}' >= '${e}')`);if(n===null&&e===null)return Ke(1)+"1";if(n===null)return wu(e);if(e===null)return Ji(n);let t=zt(n),r=zt(e),i=Ke(t.integer.length)+t.integer,s=Ke(r.integer.length)+r.integer;if(i===s)return i+Gt(t.fraction,r.fraction);let o=Ji(i+(Dn(t.integer)?Ca:""));return Ut(o,e)<0?o:i+Gt(t.fraction,null)}function En(n,e,t){if(t<=0)return[];let r=[],i=n;for(let s=0;s<t;s++){let o=bt(i,e);r.push(o),i=o}return r}function On(n){if(n<=0)return[];let e=[],t=bt(null,null);e.push(t);for(let r=1;r<n;r++)t=Ji(t),e.push(t);return e}var Wt=class{schemas=new Map;register(e,t){this.schemas.set(e,t)}get(e){return this.schemas.get(e)}typeIds(){return[...this.schemas.keys()]}getDefaults(e){let t=this.schemas.get(e);if(!t)return{};let r={};for(let i of Object.keys(t))r[i]=t[i].default;return r}validate(e,t,r){let i=this.schemas.get(e);if(!i)return r;let s=i[t];return s?.validate?s.validate(r):r}},E=n=>Math.max(0,n),St=n=>Math.max(0,Math.min(1,n)),te=n=>Math.max(0,Math.min(100,n)),Pu=n=>Math.max(1,n),_u=n=>Math.max(3,Math.min(100,Math.floor(n))),Ru=n=>Math.max(3,Math.min(50,Math.floor(n))),Au=n=>Math.max(3,Math.min(30,Math.floor(n))),Iu=n=>Math.max(1,Math.min(10,n));function Mu(n){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,{default:t}]))}var Cu=Mu(qi),J={layerName:{default:null},fillColor:{default:"#ffffff"},borderColor:{default:"#000000"},borderWidth:{default:1},opacity:{default:1,validate:St},fillOpacity:{default:1,validate:St},strokeOpacity:{default:1,validate:St},...Cu,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:Pu},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}},ke={...J,cx:{default:0},cy:{default:0},radius:{default:50,validate:E},cornerRadius:{default:0,validate:E},shiftAngle:{default:0}},xt={...J,x:{default:0},y:{default:0},width:{default:100,validate:E},height:{default:60,validate:E}},Da={...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:St},muted:{default:!1},loop:{default:!1},playbackRate:{default:1},mediaOpacity:{default:1,validate:St},fadeInDuration:{default:0,validate:E},fadeOutDuration:{default:0,validate:E},posterHref:{default:""},sourceRect:{default:null}},O=new Wt;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:St}});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",{...ke,sides:{default:3}});O.register("ngon",{...ke,sides:{default:6,validate:_u}});O.register("star",{...ke,arms:{default:5,validate:Ru},innerRadiusPercent:{default:40,validate:te}});O.register("cross",{...ke,armWidthPercent:{default:30,validate:te}});O.register("ring",{...ke,innerRadiusPercent:{default:50,validate:te}});O.register("spiral",{...ke,turns:{default:3,validate:Iu},thicknessPercent:{default:15,validate:te},spiralDirection:{default:1}});O.register("gear",{...ke,teeth:{default:8,validate:Au},toothDepthPercent:{default:25,validate:te},holeRadiusPercent:{default:20,validate:te}});O.register("arrow",{...ke,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",{...ke,cloudBumps:{default:5},cloudPuffinessPercent:{default:60,validate:te}});O.register("heart",{...ke,lobeRadiusPercent:{default:50,validate:te},cleftDepthPercent:{default:25,validate:te}});O.register("lightning",{...ke,boltSegments:{default:3},boltWidthPercent:{default:30,validate:te},boltJaggednessPercent:{default:40,validate:te}});O.register("speechBubble",{...ke,tailAngleDeg:{default:45},tailLengthPercent:{default:40,validate:te},tailWidthPercent:{default:25,validate:te}});O.register("diamond",{...xt});O.register("parallelogram",{...xt,slantPercent:{default:20,validate:te}});O.register("trapezoid",{...xt,topWidthPercent:{default:70,validate:te}});O.register("terminator",{...xt});O.register("cylinder",{...xt,capHeightPercent:{default:15,validate:te}});O.register("document-shape",{...xt,waveAmplitudePercent:{default:15,validate:te}});O.register("hyperlink",{...J,href:{default:""},hrefXlink:{default:""},linkTarget:{default:""},linkPing:{default:""},linkRel:{default:""},linkHreflang:{default:""},linkType:{default:""},linkReferrerPolicy:{default:""}});O.register("switch",{...J,switchSystemLanguage:{default:null},switchRequiredExtensions:{default:null}});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",{...Da,mediaKind:{default:"video"}});O.register("audio",{...Da,mediaKind:{default:"audio"}});O.register("document",{});function Du(){let n=new Set(Xi);for(let e of Yi)n.add(e);for(let e of O.typeIds())for(let t of Object.keys(O.getDefaults(e)))n.add(t);return n.delete("scaleAnchor"),n.delete("extra"),n}var Qi=Du(),Fa=new Set(["scaleAnchor","displayAttr"]);function Ln(n){let e=n.extra&&typeof n.extra=="object"&&!Array.isArray(n.extra)?n.extra:void 0;for(let t of Object.keys(n)){if(t==="extra"||Qi.has(t))continue;let r=n[t];delete n[t],r!==void 0&&((e??={})[t]=r)}return e&&Object.keys(e).length>0?n.extra=e:delete n.extra,n}function nt(n){if(!n?.state||typeof n.state!="object")return n;let e=n.state,t=e.children;if(Array.isArray(t))for(let i of t)nt(i);let r=e.symbolOverrides;if(r&&typeof r=="object"&&!Array.isArray(r))for(let i of Object.values(r))i&&typeof i=="object"&&!Array.isArray(i)&&Ln(i);return Ln(e),n}function Ht(n){if(!n?.state||typeof n.state!="object")return n;let e=n.state,t=e.children;if(Array.isArray(t))for(let i of t)Ht(i);let r=e.symbolOverrides;if(r&&typeof r=="object"&&!Array.isArray(r))for(let i of Object.values(r))i&&typeof i=="object"&&!Array.isArray(i)&&Ne(i);return Ne(e),n}function Ne(n){let e=n.extra;if(!e||typeof e!="object"||Array.isArray(e))return delete n.extra,n;for(let[t,r]of Object.entries(e))t!=="extra"&&(t in n||(n[t]=r));return delete n.extra,n}function rt(n,e,t,r="verbatim"){if(r==="verbatim")return new Be(n,e,t&&"extra"in t?Ne({...t}):t);let i={...O.getDefaults(e),...t},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 Be(n,e,i)}var Be=class n{static writeHook=null;static _baseReadDepth=0;static withBaseProps(e){n._baseReadDepth++;try{return e()}finally{n._baseReadDepth--}}id;type;parent=null;children=[];onChange=null;_props;_dirty=new Set;_overlay=null;_propTimestamps=new Map;constructor(e,t,r){this.id=e,this.type=t,this._props=r?{...r}:{}}get(e){return this._overlay!==null&&n._baseReadDepth===0&&this._overlay.has(e)?this._overlay.get(e):this._props[e]}set(e,t){this._props[e]!==t&&(n.writeHook?.(this,e),this._props[e]=t,this._dirty.add(e),this.onChange?.(this,this._dirty))}getProp(e){return this._overlay!==null&&n._baseReadDepth===0&&this._overlay.has(e)?this._overlay.get(e):this._props[e]}getBaseProp(e){return this._props[e]}setProp(e,t){this._props[e]!==t&&(n.writeHook?.(this,e),this._props[e]=t,this._dirty.add(e),this.onChange?.(this,this._dirty))}deleteProp(e){e in this._props&&(n.writeHook?.(this,e),delete this._props[e],this._dirty.add(e),this.onChange?.(this,this._dirty))}setMany(e){let t=!1;for(let[r,i]of Object.entries(e))this._props[r]!==i&&(n.writeHook?.(this,r),this._props[r]=i,this._dirty.add(r),t=!0);t&&this.onChange?.(this,this._dirty)}setOverlayValue(e,t){this._overlay===null&&(this._overlay=new Map),this._overlay.set(e,t)}deleteOverlayValue(e){if(this._overlay===null)return!1;let t=this._overlay.delete(e);return this._overlay.size===0&&(this._overlay=null),t}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 t of Object.keys(this._props))this._dirty.add(t);this.onChange?.(this,this._dirty)}getPropStamp(e){return this._propTimestamps.get(e)??null}stampProp(e,t,r){this._propTimestamps.set(e,{ts:t,clientId:r})}stampProps(e,t,r){let i={ts:t,clientId:r};for(let s of e)this._propTimestamps.set(s,i)}getPropStampsForKeys(e){let t={};for(let r of e){let i=this._propTimestamps.get(r);i&&(t[r]=i.ts)}return t}setPropIfWins(e,t,r,i){let s=this._propTimestamps.get(e),o=s?.ts??0,a=s?.clientId??"";return r>o||r===o&&i>a?(t===null?delete this._props[e]:this._props[e]=t,this._propTimestamps.set(e,{ts:r,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,t,r){return rt(e,t,r,"authoring")}};var Fu=5e3,Eu=1e4;function Ou(n){return n===null||n.size===0?"":[...n.entries()].sort((e,t)=>t[1].count-e[1].count).slice(0,5).map(([e,t])=>`${e.type}#${e.id} x${t.count} keys=[${[...t.keys].join(",")}]`).join("; ")}var Nn=class n{static _pendingGraphs=new Set;static flushAllPending(){if(n._pendingGraphs.size!==0)for(let e of[...n._pendingGraphs])e.flushBatched()}static get pendingGraphCount(){return n._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 t=this._changeListeners.indexOf(e);t>=0&&this._changeListeners.splice(t,1)}}onStructureChange(e){return this._structureListeners.push(e),()=>{let t=this._structureListeners.indexOf(e);t>=0&&this._structureListeners.splice(t,1)}}addNode(e,t,r){let i=t??this.root;r!==void 0&&r>=0&&r<i.children.length?i.children.splice(r,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 t=this._nodesById.get(e);if(!t||t===this.root)return null;let r=t.parent,i=null;if(r){let s=r.children.indexOf(t);i={parentId:r===this.root?null:r.id,index:s},s>=0&&r.children.splice(s,1)}return t.parent=null,t.onChange=null,this._nodesById.delete(e),this._batchDirtyNodes.delete(t),this._removeDescendants(t),this._batchDirtyNodes.size===0&&n._pendingGraphs.delete(this),this._emitStructure("remove",t,r,null,i),t}getNode(e){return this._nodesById.get(e)??null}moveNode(e,t,r){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)}r!==void 0&&r>=0&&r<t.children.length?t.children.splice(r,0,i):t.children.push(i),i.parent=t,this._emitStructure("move",i,s,t,o)}moveNodeToParentId(e,t,r){let i=t?this._nodesById.get(t):this.root;i&&this.moveNode(e,i,r)}getChildren(e){let t=e?this._nodesById.get(e):this.root;return t?[...t.children]:[]}getRootShapes(){return[...this.root.children]}getParentId(e){let t=this._nodesById.get(e);return!t||!t.parent||t.parent===this.root?null:t.parent.id}getSiblingIndex(e){let t=this._nodesById.get(e);return!t||!t.parent?-1:t.parent.children.indexOf(t)}getAncestorIds(e){let t=[],r=this.getParentId(e);for(;r;)t.push(r),r=this.getParentId(r);return t}isAncestor(e,t){if(e===t)return!1;let r=this.getParentId(t);for(;r;){if(r===e)return!0;r=this.getParentId(r)}return!1}isDocumentRootNode(e){let t=this._nodesById.get(e);return!!t&&t!==this.root&&t.getProp("isRootSvg")===!0}contains(e,t){if(e===t)return!1;if(this.isDocumentRootNode(e)){let r=this._nodesById.get(t);return!!r&&r!==this.root&&!this.isDocumentRootNode(t)}return this.isAncestor(e,t)}getDepth(e){let t=this._nodesById.get(e);if(!t||t===this.root)return-1;let r=0,i=t.parent;for(;i&&i!==this.root;)r++,i=i.parent;return r}getAllNodes(){let e=[];for(let t of this._nodesById.values())t!==this.root&&e.push(t);return e}getDirtyNodes(){let e=[];for(let t of this._nodesById.values())t.isDirty()&&e.push(t);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(){n._pendingGraphs.delete(this),this._batchDirtyNodes.clear(),this._changeListeners.length=0,this._structureListeners.length=0}notifyNodeChanged(e,t){this._handleNodeChange(e,t)}_handleNodeChange(e,t){if(this._batchDepth>0){let r=this._batchDirtyNodes.get(e);r||(r=new Set,this._batchDirtyNodes.set(e,r),n._pendingGraphs.add(this));for(let i of t)r.add(i);return}this._fireChangeListeners(e,t)}_drainBatched(){if(this._draining)return;this._draining=!0;let e=0,t=null;try{for(;this._batchDirtyNodes.size>0;){if(++e>Eu){console.error("[SceneGraph] batched-notification drain did not converge \u2014 render loop?",Ou(t)),this._batchDirtyNodes.clear();break}let[r,i]=this._batchDirtyNodes.entries().next().value;if(this._batchDirtyNodes.delete(r),this._batchDirtyNodes.size===0&&n._pendingGraphs.delete(this),e>Fu){t===null&&(t=new Map);let s=t.get(r);if(s){s.count++;for(let o of i)s.keys.add(o)}else t.set(r,{count:1,keys:new Set(i)})}this._fireChangeListeners(r,i)}}finally{this._draining=!1,this._batchDirtyNodes.size===0&&n._pendingGraphs.delete(this)}}_fireChangeListeners(e,t){let r=[...this._changeListeners];for(let i of r)i(e,t)}_emitStructure(e,t,r,i,s=null){let o=[...this._structureListeners];for(let a of o)a(e,t,r,i,s)}_removeDescendants(e){for(let t of e.children)t.onChange=null,this._nodesById.delete(t.id),this._batchDirtyNodes.delete(t),this._removeDescendants(t)}serializeShapes(){let e=[],t=r=>{for(let i of r)i.type!=="document"&&i.type!=="group"&&i.getProp("structural")!==!0&&e.push(i.toSerialized()),i.children.length>0&&t(i.children)};return t(this.root.children),e}static fromShapes(e){let t=new n;for(let r of e){let i=Be.fromSerialized(r);t.addNode(i)}return t}};var G=["updatedAt","clientId"];function z(n,e,t){n.push({path:e,message:t})}function Ka(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function U(n,e,t){return Ka(n)?n:(z(t,e,"must be an object"),null)}function I(n,e,t,r=[],i,s=!0){let o=new Set([...s?["type"]:[],...t,...r]);for(let a of t)Object.hasOwn(n,a)||z(i,`${e}.${a}`,"is required");for(let a of Object.keys(n))o.has(a)||z(i,`${e}.${a}`,"is not allowed")}function A(n,e,t,r=!1){return typeof n!="string"||!r&&n.length===0?(z(t,e,r?"must be a string":"must be a non-empty string"),!1):!0}function oe(n,e,t,r){return typeof n!="number"||!Number.isFinite(n)?(z(t,e,"must be a finite number"),!1):r!==void 0&&n<r?(z(t,e,`must be at least ${r}`),!1):!0}function we(n,e,t,r=0){return oe(n,e,t,r)?Number.isInteger(n)?!0:(z(t,e,"must be an integer"),!1):!1}function $t(n,e,t){return typeof n!="boolean"?(z(t,e,"must be a boolean"),!1):!0}function Q(n,e,t,r,i=!1){n[e]!==void 0&&A(n[e],`${t}.${e}`,r,i)}function es(n,e,t,r,i){n[e]!==void 0&&oe(n[e],`${t}.${e}`,r,i)}function se(n,e,t,r,i=0){n[e]!==void 0&&we(n[e],`${t}.${e}`,r,i)}function Bn(n,e,t,r){n[e]!==void 0&&$t(n[e],`${t}.${e}`,r)}function it(n,e,t){return Array.isArray(n)?(n.forEach((r,i)=>A(r,`${e}[${i}]`,t)),!0):(z(t,e,"must be an array"),!1)}function X(n,e,t,r){return Array.isArray(n)?(n.forEach((i,s)=>r(i,`${e}[${s}]`,t)),!0):(z(t,e,"must be an array"),!1)}function ie(n,e,t){let r=[{value:n,path:e,depth:0}],i=0;for(;r.length>0;){let s=r.pop();if(i++,i>25e4){z(t,e,"exceeds the 250000-node validation limit");return}if(s.depth>64){z(t,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(t,s.path,"must be a finite JSON number");continue}if(Array.isArray(o)){o.forEach((a,l)=>r.push({value:a,path:`${s.path}[${l}]`,depth:s.depth+1}));continue}if(Ka(o)){for(let[a,l]of Object.entries(o))r.push({value:l,path:`${s.path}.${a}`,depth:s.depth+1});continue}z(t,s.path,"must be JSON-serializable")}}}function V(n,e,t){es(n,"updatedAt",e,t,0),Q(n,"clientId",e,t)}function zn(n,e,t){let r=U(n,e,t);if(r)for(let[i,s]of Object.entries(r))A(s,`${e}.${i}`,t,!0)}function jt(n,e,t,r=0){if(r>64){z(t,e,"exceeds the 64-level shape nesting limit");return}let i=U(n,e,t);if(!i)return;I(i,e,["id","type","state"],[],t),A(i.id,`${e}.id`,t),A(i.type,`${e}.type`,t);let s=U(i.state,`${e}.state`,t);s&&(Object.hasOwn(s,"extra")&&z(t,`${e}.state.extra`,"is an at-rest field and is not allowed in operations"),ie(s,`${e}.state`,t),s.children!==void 0&&X(s.children,`${e}.state.children`,t,(o,a,l)=>jt(o,a,l,r+1)))}function Lu(n,e,t){let r=U(n,e,t);r&&(Object.hasOwn(r,"extra")&&z(t,`${e}.extra`,"is an at-rest field and is not allowed in operations"),ie(r,e,t),r.children!==void 0&&X(r.children,`${e}.children`,t,(i,s,o)=>jt(i,s,o)))}function ts(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),r.parentId!==null&&A(r.parentId,`${e}.parentId`,t),se(r,"siblingIndex",e,t),Q(r,"pluginId",e,t),Q(r,"pluginData",e,t,!0),r.attributes!==void 0&&zn(r.attributes,`${e}.attributes`,t),ie(r,e,t))}function Ea(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),r.type!=="clip"&&r.type!=="mask"&&z(t,`${e}.type`,'must be "clip" or "mask"'),r.clipShapeIds!==void 0&&it(r.clipShapeIds,`${e}.clipShapeIds`,t),r.clipShapeId!==void 0&&Q(r,"clipShapeId",e,t),r.clipShapeIds===void 0&&r.clipShapeId===void 0&&z(t,`${e}.clipShapeIds`,"or clipShapeId is required"),it(r.contentShapeIds,`${e}.contentShapeIds`,t),r.parentId!==null&&A(r.parentId,`${e}.parentId`,t),se(r,"siblingIndex",e,t),ie(r,e,t))}function Oa(n,e,t){let r=U(n,e,t);if(!r)return;A(r.id,`${e}.id`,t);let i=r.orientation==="horizontal"||r.orientation==="vertical",s=r.axis==="x"||r.axis==="y";!i&&!s&&z(t,`${e}.orientation`,'must be "horizontal" or "vertical" (legacy axis "x" or "y" is also accepted)'),oe(r.position,`${e}.position`,t),i&&oe(r.controlPointOffset,`${e}.controlPointOffset`,t),Q(r,"color",e,t,!0),es(r,"opacity",e,t),ie(r,e,t)}function La(n,e,t){let r=U(n,e,t);if(!r)return;A(r.id,`${e}.id`,t);let i=r.type==="distance"||r.type==="angle",s=["startX","startY","endX","endY"].every(o=>typeof r[o]=="number"&&Number.isFinite(r[o]));i?(X(r.points,`${e}.points`,t,(o,a,l)=>{let c=U(o,a,l);c&&(oe(c.x,`${a}.x`,l),oe(c.y,`${a}.y`,l))}),$t(r.visible,`${e}.visible`,t),we(r.snapDivisions,`${e}.snapDivisions`,t,1)):s||z(t,e,"must be a current or legacy measurement payload"),Q(r,"color",e,t,!0),es(r,"opacity",e,t),ie(r,e,t)}var Na=["title","description","author","keywords","license","licenseUrl","language","customMetadata","rawMetadata","rawDescription","rawHtmlMetadata","coordinatePrecision"];function Ba(n,e,t,r){let i=U(n,e,t);if(!i)return;I(i,e,r?[]:["title","description","author","keywords","license","licenseUrl","language","customMetadata"],r?Na:Na.slice(8),t,!1);for(let o of["title","description","author","license","licenseUrl","language"])(!r||i[o]!==void 0)&&A(i[o],`${e}.${o}`,t,!0);(!r||i.keywords!==void 0)&&it(i.keywords,`${e}.keywords`,t),(!r||i.customMetadata!==void 0)&&zn(i.customMetadata,`${e}.customMetadata`,t),Q(i,"rawMetadata",e,t,!0),Q(i,"rawDescription",e,t,!0),Q(i,"rawHtmlMetadata",e,t,!0),se(i,"coordinatePrecision",e,t)}function za(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),r.source!=="inline"&&r.source!=="external"&&z(t,`${e}.source`,'must be "inline" or "external"'),A(r.content,`${e}.content`,t,!0),A(r.type,`${e}.type`,t,!0),Q(r,"svgId",e,t,!0),Q(r,"href",e,t,!0),Bn(r,"async",e,t),Bn(r,"defer",e,t),r.customAttrs!==void 0&&zn(r.customAttrs,`${e}.customAttrs`,t),ie(r,e,t))}function Ga(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),A(r.css,`${e}.css`,t,!0),$t(r.preserved,`${e}.preserved`,t),Q(r,"svgId",e,t,!0),Q(r,"type",e,t,!0),Q(r,"media",e,t,!0),r.customAttrs!==void 0&&zn(r.customAttrs,`${e}.customAttrs`,t),ie(r,e,t))}function Va(n,e,t){let r=U(n,e,t);if(r){if(A(r.name,`${e}.name`,t),["string","color","number"].includes(String(r.type))||z(t,`${e}.type`,'must be "string", "color", or "number"'),A(r.defaultValue,`${e}.defaultValue`,t,!0),Q(r,"label",e,t,!0),Q(r,"description",e,t,!0),r.mode!==void 0&&r.mode!=="live"&&r.mode!=="stamped"&&z(t,`${e}.mode`,'must be "live" or "stamped"'),r.source!==void 0){let i=U(r.source,`${e}.source`,t);i&&i.kind!=="user"&&z(t,`${e}.source.kind`,'must be "user"')}ie(r,e,t)}}function Ua(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),A(r.filename,`${e}.filename`,t,!0),A(r.format,`${e}.format`,t),ie(r,e,t))}function Nu(n,e,t){let r=U(n,e,t);r&&(we(r.glyphId,`${e}.glyphId`,t),Array.isArray(r.codepoints)?r.codepoints.forEach((i,s)=>we(i,`${e}.codepoints[${s}]`,t)):z(t,`${e}.codepoints`,"must be an array"),A(r.svgDocument,`${e}.svgDocument`,t,!0),Q(r,"glyphName",e,t,!0),se(r,"advanceWidth",e,t),Q(r,"sourceFamily",e,t,!0),se(r,"sourceGlyphId",e,t),Q(r,"label",e,t,!0),ie(r,e,t))}function Wa(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),A(r.name,`${e}.name`,t,!0),A(r.svgContent,`${e}.svgContent`,t,!0),oe(r.width,`${e}.width`,t,0),oe(r.height,`${e}.height`,t,0),ie(r,e,t))}function Ha(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"].includes(String(r.type))||z(t,`${e}.type`,"is not a supported paint-server type"),A(r.markup,`${e}.markup`,t),Bn(r,"passthrough",e,t),ie(r,e,t))}function ja(n,e,t){let r=U(n,e,t);if(!r)return;A(r.id,`${e}.id`,t),A(r.name,`${e}.name`,t,!0);let i=r.kind;if(["symbol","marker","linear-gradient","radial-gradient","pattern","filter"].includes(String(i))||z(t,`${e}.kind`,"is not a supported library kind"),(i==="symbol"||i==="marker")&&(X(r.shapes,`${e}.shapes`,t,jt),r.groups!==void 0&&X(r.groups,`${e}.groups`,t,ts)),i==="symbol"&&A(r.viewBox,`${e}.viewBox`,t,!0),i==="marker"){for(let s of["refX","refY","markerWidth","markerHeight"])oe(r[s],`${e}.${s}`,t);r.markerUnits!=="strokeWidth"&&r.markerUnits!=="userSpaceOnUse"&&z(t,`${e}.markerUnits`,'must be "strokeWidth" or "userSpaceOnUse"'),r.orient!=="auto"&&r.orient!=="auto-start-reverse"&&!(typeof r.orient=="number"&&Number.isFinite(r.orient))&&z(t,`${e}.orient`,"must be an orientation keyword or finite number")}(i==="linear-gradient"||i==="radial-gradient")&&U(r.gradient,`${e}.gradient`,t),i==="pattern"&&U(r.pattern,`${e}.pattern`,t),i==="filter"&&X(r.filters,`${e}.filters`,t,(s,o,a)=>{U(s,o,a)}),ie(r,e,t)}function Bu(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),Q(r,"viewBox",e,t,!0),r.shapes!==void 0&&X(r.shapes,`${e}.shapes`,t,jt),r.groups!==void 0&&X(r.groups,`${e}.groups`,t,ts),ie(r,e,t))}function Xa(n,e,t,r){let i=U(n,e,t);i&&((r||i.id!==void 0)&&A(i.id,`${e}.id`,t),oe(i.time,`${e}.time`,t,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(t,`${e}.value`,"must be a string, finite number, or finite number array"),A(i.easing,`${e}.easing`,t),ie(i,e,t))}function Ya(n,e,t){let r=U(n,e,t);r&&(A(r.id,`${e}.id`,t),A(r.shapeId,`${e}.shapeId`,t),A(r.property,`${e}.property`,t),$t(r.enabled,`${e}.enabled`,t),Bn(r,"locked",e,t),X(r.keyframes,`${e}.keyframes`,t,(i,s,o)=>Xa(i,s,o,!1)),ie(r,e,t))}function zu(n,e,t){let r=U(n,e,t);r&&(oe(r.duration,`${e}.duration`,t,0),$t(r.loop,`${e}.loop`,t),oe(r.playbackSpeed,`${e}.playbackSpeed`,t,0),X(r.tracks,`${e}.tracks`,t,Ya))}function Gu(n,e,t){let r=U(n,e,t);if(!r)return;we(r.start,`${e}.start`,t),we(r.end,`${e}.end`,t),typeof r.start=="number"&&typeof r.end=="number"&&r.end<=r.start&&z(t,`${e}.end`,"must be greater than start");let i=U(r.style,`${e}.style`,t);i&&Object.keys(i).length===0&&z(t,`${e}.style`,"must not be empty"),ie(r,e,t)}function Vu(n,e,t){let r=U(n,e,t);r&&(I(r,e,["start","deleteCount","insert"],[],t,!1),we(r.start,`${e}.start`,t),we(r.deleteCount,`${e}.deleteCount`,t),A(r.insert,`${e}.insert`,t,!0))}var qa={"shape:add":(n,e,t)=>{I(n,e,["shape"],[],t),jt(n.shape,`${e}.shape`,t)},"shape:update":(n,e,t)=>{if(I(n,e,["id","state"],["propTimestamps","clientId","textSplices","baseSeq"],t),A(n.id,`${e}.id`,t),Lu(n.state,`${e}.state`,t),n.propTimestamps!==void 0){let r=U(n.propTimestamps,`${e}.propTimestamps`,t);if(r)for(let[i,s]of Object.entries(r))oe(s,`${e}.propTimestamps.${i}`,t,0)}Q(n,"clientId",e,t),n.textSplices!==void 0&&X(n.textSplices,`${e}.textSplices`,t,Vu),se(n,"baseSeq",e,t)},"shape:remove":(n,e,t)=>{I(n,e,["id"],[],t),A(n.id,`${e}.id`,t)},"text:format":(n,e,t)=>{I(n,e,["id","ranges"],["baseSeq",...G],t),A(n.id,`${e}.id`,t),X(n.ranges,`${e}.ranges`,t,Gu),se(n,"baseSeq",e,t),V(n,e,t)},"scene:move":(n,e,t)=>{I(n,e,["id","parentId","index"],G,t),A(n.id,`${e}.id`,t),n.parentId!==null&&A(n.parentId,`${e}.parentId`,t),we(n.index,`${e}.index`,t),V(n,e,t)},"scene:place":(n,e,t)=>{I(n,e,["id","parentId","orderKey"],G,t),A(n.id,`${e}.id`,t),n.parentId!==null&&A(n.parentId,`${e}.parentId`,t),A(n.orderKey,`${e}.orderKey`,t),V(n,e,t)},"shapes:reorder":(n,e,t)=>{I(n,e,["ids"],[],t),it(n.ids,`${e}.ids`,t)},"groups:set":(n,e,t)=>{I(n,e,["groups"],[],t),X(n.groups,`${e}.groups`,t,ts)},"clipmasks:set":(n,e,t)=>{I(n,e,["clipMaskGroups"],[],t),X(n.clipMaskGroups,`${e}.clipMaskGroups`,t,Ea)},"clipMask:upsert":(n,e,t)=>{I(n,e,["clipMaskGroup"],["index",...G],t),Ea(n.clipMaskGroup,`${e}.clipMaskGroup`,t),se(n,"index",e,t),V(n,e,t)},"clipMask:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"guides:set":(n,e,t)=>{I(n,e,["guides"],[],t),X(n.guides,`${e}.guides`,t,Oa)},"guide:upsert":(n,e,t)=>{I(n,e,["guide"],["index",...G],t),Oa(n.guide,`${e}.guide`,t),se(n,"index",e,t),V(n,e,t)},"guide:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"guide:move":(n,e,t)=>{I(n,e,["id","index"],G,t),A(n.id,`${e}.id`,t),we(n.index,`${e}.index`,t),V(n,e,t)},"measurements:set":(n,e,t)=>{I(n,e,["measurements"],[],t),X(n.measurements,`${e}.measurements`,t,La)},"measurement:upsert":(n,e,t)=>{I(n,e,["measurement"],["index",...G],t),La(n.measurement,`${e}.measurement`,t),se(n,"index",e,t),V(n,e,t)},"measurement:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"measurement:move":(n,e,t)=>{I(n,e,["id","index"],G,t),A(n.id,`${e}.id`,t),we(n.index,`${e}.index`,t),V(n,e,t)},"metadata:set":(n,e,t)=>{I(n,e,["metadata"],[],t),Ba(n.metadata,`${e}.metadata`,t,!1)},"metadata:patch":(n,e,t)=>{I(n,e,["patch"],["removeKeys",...G],t),Ba(n.patch,`${e}.patch`,t,!0),n.removeKeys!==void 0&&it(n.removeKeys,`${e}.removeKeys`,t),V(n,e,t)},"documentScripts:set":(n,e,t)=>{I(n,e,["documentScripts"],[],t),X(n.documentScripts,`${e}.documentScripts`,t,za)},"documentScript:upsert":(n,e,t)=>{I(n,e,["documentScript"],["index",...G],t),za(n.documentScript,`${e}.documentScript`,t),se(n,"index",e,t),V(n,e,t)},"documentScript:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"documentStyles:set":(n,e,t)=>{I(n,e,["documentStyles"],[],t),X(n.documentStyles,`${e}.documentStyles`,t,Ga)},"documentStyle:upsert":(n,e,t)=>{I(n,e,["documentStyle"],["index",...G],t),Ga(n.documentStyle,`${e}.documentStyle`,t),se(n,"index",e,t),V(n,e,t)},"documentStyle:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"templateVariables:set":(n,e,t)=>{I(n,e,["templateVariables"],G,t),X(n.templateVariables,`${e}.templateVariables`,t,Va),V(n,e,t)},"templateVariable:upsert":(n,e,t)=>{I(n,e,["templateVariable"],["index",...G],t),Va(n.templateVariable,`${e}.templateVariable`,t),se(n,"index",e,t),V(n,e,t)},"templateVariable:remove":(n,e,t)=>{I(n,e,["name"],G,t),A(n.name,`${e}.name`,t),V(n,e,t)},"exportItems:set":(n,e,t)=>{I(n,e,["exportItems"],G,t),X(n.exportItems,`${e}.exportItems`,t,Ua),V(n,e,t)},"exportItem:upsert":(n,e,t)=>{I(n,e,["exportItem"],["index",...G],t),Ua(n.exportItem,`${e}.exportItem`,t),se(n,"index",e,t),V(n,e,t)},"exportItem:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"colorGlyphLibrary:set":(n,e,t)=>{if(I(n,e,["colorGlyphLibrary"],G,t),n.colorGlyphLibrary!==null){let r=U(n.colorGlyphLibrary,`${e}.colorGlyphLibrary`,t);r&&(r.version!==1&&z(t,`${e}.colorGlyphLibrary.version`,"must be 1"),X(r.entries,`${e}.colorGlyphLibrary.entries`,t,Nu),ie(r,`${e}.colorGlyphLibrary`,t))}V(n,e,t)},"animation:set":(n,e,t)=>{I(n,e,["animationTimeline"],[],t),n.animationTimeline!==void 0&&zu(n.animationTimeline,`${e}.animationTimeline`,t)},"animation:config":(n,e,t)=>{I(n,e,["config"],G,t);let r=U(n.config,`${e}.config`,t);r&&(I(r,`${e}.config`,["duration","loop","playbackSpeed"],[],t,!1),oe(r.duration,`${e}.config.duration`,t,0),$t(r.loop,`${e}.config.loop`,t),oe(r.playbackSpeed,`${e}.config.playbackSpeed`,t,0)),V(n,e,t)},"animation:clear":(n,e,t)=>{I(n,e,[],G,t),V(n,e,t)},"animationTrack:upsert":(n,e,t)=>{I(n,e,["track"],["index",...G],t),Ya(n.track,`${e}.track`,t),se(n,"index",e,t),V(n,e,t)},"animationTrack:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"animationKeyframe:upsert":(n,e,t)=>{I(n,e,["trackId","keyframe"],G,t),A(n.trackId,`${e}.trackId`,t),Xa(n.keyframe,`${e}.keyframe`,t,!0),V(n,e,t)},"animationKeyframe:remove":(n,e,t)=>{I(n,e,["trackId","keyframeId"],G,t),A(n.trackId,`${e}.trackId`,t),A(n.keyframeId,`${e}.keyframeId`,t),V(n,e,t)},"symbols:set":(n,e,t)=>{I(n,e,["symbols"],[],t),X(n.symbols,`${e}.symbols`,t,Bu)},"customPatterns:set":(n,e,t)=>{I(n,e,["customPatterns"],[],t),X(n.customPatterns,`${e}.customPatterns`,t,Wa)},"customPattern:upsert":(n,e,t)=>{I(n,e,["customPattern"],["index",...G],t),Wa(n.customPattern,`${e}.customPattern`,t),se(n,"index",e,t),V(n,e,t)},"customPattern:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"library:set":(n,e,t)=>{I(n,e,["library"],[],t),X(n.library,`${e}.library`,t,ja)},"library:upsert":(n,e,t)=>{I(n,e,["def"],["index",...G],t),ja(n.def,`${e}.def`,t),se(n,"index",e,t),V(n,e,t)},"library:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"rawPaintServerDefs:set":(n,e,t)=>{I(n,e,["rawPaintServerDefs"],[],t),it(n.rawPaintServerDefs,`${e}.rawPaintServerDefs`,t)},"paintServerDefs:set":(n,e,t)=>{I(n,e,["paintServerDefs"],[],t),X(n.paintServerDefs,`${e}.paintServerDefs`,t,Ha)},"paintServerDef:upsert":(n,e,t)=>{I(n,e,["paintServerDef"],["index",...G],t),Ha(n.paintServerDef,`${e}.paintServerDef`,t),se(n,"index",e,t),V(n,e,t)},"paintServerDef:remove":(n,e,t)=>{I(n,e,["id"],G,t),A(n.id,`${e}.id`,t),V(n,e,t)},"presence:cursor":(n,e,t)=>{I(n,e,["position"],[],t);let r=U(n.position,`${e}.position`,t);r&&(I(r,`${e}.position`,["x","y"],[],t,!1),oe(r.x,`${e}.position.x`,t),oe(r.y,`${e}.position.y`,t))},"presence:selection":(n,e,t)=>{I(n,e,["shapeIds"],[],t),it(n.shapeIds,`${e}.shapeIds`,t)}},Uu=new Set(Object.keys(qa)),Za=new Set(["presence:cursor","presence:selection"]);function Gn(n,e="operation"){let t=[],r=U(n,e,t);return r?!A(r.type,`${e}.type`,t)||!Uu.has(r.type)?(typeof r.type=="string"&&r.type.length>0&&z(t,`${e}.type`,`unknown operation type "${r.type}"`),{valid:!1,issues:t}):(qa[r.type](r,e,t),t.length===0?{valid:!0,value:r}:{valid:!1,issues:t}):{valid:!1,issues:t}}function Ja(n,e={}){let t=[];if(!Array.isArray(n))return{valid:!1,issues:[{path:"ops",message:"must be an array"}]};let r=e.minItems??1,i=e.maxItems??5e3;(n.length<r||n.length>i)&&z(t,"ops",`must contain ${r}-${i} operations`);let s=[];return n.forEach((o,a)=>{let l=Gn(o,`ops[${a}]`);if(!l.valid){t.push(...l.issues);return}if(Za.has(l.value.type)){z(t,`ops[${a}].type`,"presence operations are not document operations");return}s.push(l.value)}),t.length===0?{valid:!0,value:s}:{valid:!1,issues:t}}function Qa(n){let e=Gn(n,"op");return e.valid?Za.has(e.value.type)?{valid:!0,value:e.value}:{valid:!1,issues:[{path:"op.type",message:"must be a presence operation"}]}:e}function eo(n){return n.slice(0,5).map(({path:e,message:t})=>`${e} ${t}`).join("; ")}function Vn(n,e,t,r){let i=e[t],s=typeof i=="string"?i:"",o=(n??[]).filter(l=>l[t]!==s),a=typeof r=="number"&&Number.isFinite(r)?Math.max(0,Math.min(r,o.length)):o.length;return o.splice(a,0,e),o}function Un(n,e,t){return(n??[]).filter(r=>r[e]!==t)}function ge(n,e,t){return Vn(n,e,"id",t)}function ye(n,e){return Un(n,"id",e)}function Wn(n,e,t){return Vn(n,e,"name",t)}function Hn(n,e){return Un(n,"name",e)}function to(n,e){if(n===e)return null;let t=0,r=Math.min(n.length,e.length);for(;t<r&&n.charCodeAt(t)===e.charCodeAt(t);)t++;let i=0,s=Math.min(n.length,e.length)-t;for(;i<s&&n.charCodeAt(n.length-1-i)===e.charCodeAt(e.length-1-i);)i++;return{start:t,deleteCount:n.length-t-i,insert:e.slice(t,e.length-i)}}function no(n,e){return n.slice(0,e.start)+e.insert+n.slice(e.start+e.deleteCount)}function Kt(n,e){let t=e.start,r=e.start+e.deleteCount,i=e.insert.length-e.deleteCount,s=n.start,o=n.start+n.deleteCount;return r<=s?{start:s+i,deleteCount:n.deleteCount,insert:n.insert}:t>=o?{start:s,deleteCount:n.deleteCount,insert:n.insert}:t<=s&&r>=o?{start:t+e.insert.length,deleteCount:0,insert:n.insert}:t>=s&&r<=o?{start:s,deleteCount:n.deleteCount+i,insert:n.insert}:t<s?{start:t+e.insert.length,deleteCount:n.deleteCount-(r-s),insert:n.insert}:{start:s,deleteCount:t-s,insert:n.insert}}var Xt=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}),vt=Object.keys(Xt);function Ge(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function ze(n){return typeof n=="string"?n:void 0}function le(n){if(typeof n=="number")return Number.isFinite(n)?n:void 0;if(typeof n=="string"&&n.trim()!==""){let e=Number.parseFloat(n);return Number.isFinite(e)?e:void 0}}function Xe(n){return e=>typeof e=="string"&&n.includes(e)?e:void 0}function Wu(n){return n==="normal"||n==="bold"?n:le(n)}function Hu(n){return n==="baseline"||n==="super"||n==="sub"?n:le(n)}function io(n){if(typeof n=="string"){let t=n.toLowerCase();return{underline:t.includes("underline"),strikethrough:t.includes("line-through")||t.includes("strikethrough"),overline:t.includes("overline")}}if(!Ge(n))return;let e={};return typeof n.underline=="boolean"&&(e.underline=n.underline),typeof n.strikethrough=="boolean"&&(e.strikethrough=n.strikethrough),typeof n.overline=="boolean"&&(e.overline=n.overline),e}function so(n){if(!Ge(n))return;let e={};for(let[t,r]of Object.entries(n)){let i=le(r);i!==void 0&&(e[t]=i)}return e}var ao={fontFamily:ze,fontSize:le,fontWeight:Wu,fontStyle:Xe(["normal","italic","oblique"]),fontVariant:ze,fontVariantLigatures:ze,fontVariantPosition:ze,fontVariantCaps:ze,fontVariantNumeric:ze,fontVariantEastAsian:ze,textTransform:Xe(["none","capitalize","uppercase","lowercase"]),baselineShift:Hu,dominantBaseline:Xe(["auto","alphabetic","central","middle","hanging","ideographic","mathematical","text-top","text-bottom"]),writingMode:Xe(["horizontal-tb","vertical-rl","vertical-lr"]),whiteSpace:Xe(["normal","nowrap","pre","pre-wrap","pre-line","break-spaces"]),direction:Xe(["ltr","rtl"]),unicodeBidi:Xe(["normal","embed","bidi-override","isolate","isolate-override","plaintext"]),textAnchor:Xe(["start","middle","end"]),letterSpacing:le,wordSpacing:le,lineHeight:le,fill:ze,fillOpacity:le,stroke:ze,strokeWidth:le,strokeOpacity:le};function jn(n,e){return{...n,...e,textDecoration:{...n.textDecoration,...e.textDecoration??{}},fontVariationSettings:{...e.fontVariationSettings??n.fontVariationSettings}}}function rs(n,e){let t=Object.keys(n);return t.length!==Object.keys(e).length?!1:t.every(r=>Object.prototype.hasOwnProperty.call(e,r)&&n[r]===e[r])}function Yn(n,e){for(let t of vt)if(t==="textDecoration"){if(n.textDecoration.underline!==e.textDecoration.underline||n.textDecoration.strikethrough!==e.textDecoration.strikethrough||n.textDecoration.overline!==e.textDecoration.overline)return!1}else if(t==="fontVariationSettings"){if(!rs(n.fontVariationSettings,e.fontVariationSettings))return!1}else if(n[t]!==e[t])return!1;return!0}function qn(n,e){let t=Object.keys(n).sort(),r=Object.keys(e).sort();if(t.length!==r.length||t.some((i,s)=>i!==r[s]))return!1;for(let i of t)if(i==="textDecoration"){let s=n.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(n.fontVariationSettings??{},e.fontVariationSettings??{}))return!1}else{let s=i;if(n[s]!==e[s])return!1}return!0}function Kn(n,e){let t={};for(let i of vt)i==="textDecoration"||i==="fontVariationSettings"||n[i]!==e[i]&&(t[i]=n[i]);let r={};return n.textDecoration.underline!==e.textDecoration.underline&&(r.underline=n.textDecoration.underline),n.textDecoration.strikethrough!==e.textDecoration.strikethrough&&(r.strikethrough=n.textDecoration.strikethrough),n.textDecoration.overline!==e.textDecoration.overline&&(r.overline=n.textDecoration.overline),Object.keys(r).length>0&&(t.textDecoration=r),rs(n.fontVariationSettings,e.fontVariationSettings)||(t.fontVariationSettings={...n.fontVariationSettings}),t}function Ce(n,e=Xt){let t=Ge(n)?n:{},r={...e};for(let i of vt){if(i==="textDecoration"||i==="fontVariationSettings")continue;let s=ao[i](t[i]);s!==void 0&&(r[i]=s)}return r.textDecoration={...e.textDecoration,...io(t.textDecoration)??{}},r.fontVariationSettings={...so(t.fontVariationSettings)??e.fontVariationSettings},r}function Yt(n){let e=Ge(n)?n:{},t={};for(let r of vt){if(r==="textDecoration"||r==="fontVariationSettings"||e[r]===void 0)continue;let i=ao[r](e[r]);i!==void 0&&(t[r]=i)}if(e.textDecoration!==void 0){let r=io(e.textDecoration);r&&Object.keys(r).length>0&&(t.textDecoration=r)}if(e.fontVariationSettings!==void 0){let r=so(e.fontVariationSettings);r&&(t.fontVariationSettings=r)}return t}function is(n){let e=[],t=0;for(;;){let r=n.indexOf(`
|
|
2
|
+
`,t);if(r===-1)return e.push({text:n.slice(t),start:t,end:n.length}),e;e.push({text:n.slice(t,r),start:t,end:r}),t=r+1}}function ju(n,e,t){return n.start===n.end?t&&n.start===e:n.start<=e&&e<n.end}function ns(n,e,t,r){let i=n;for(let s of e)ju(s,t,r)&&(i=jn(i,s.style));return i===n?jn(n,{}):i}function oo(n,e,t={}){let r=Ce(n.baseStyle),i=typeof n.text=="string"?n.text:"";return ns(r,ss(n.runs,i.length),e,t.collapsed===!0)}function st(n,e=Xt){let t=Ge(n)?n:{},r=Ce(t.baseStyle,e),i=typeof t.text=="string"?t.text:"";return{text:i,runs:ss(t.runs,i.length),baseStyle:r,lineHeight:le(t.lineHeight)??r.lineHeight}}function ss(n,e){if(!Array.isArray(n))return[];let t=[];for(let r of n){if(!Ge(r))continue;let i=le(r.start),s=le(r.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||t.push({start:o,end:a,style:Yt(r.style)})}return t}function Ve(n){let e=typeof n.text=="string"?n.text:"",t=Ce(n.baseStyle),r=ss(n.runs,e.length),i=le(n.lineHeight)??t.lineHeight;return{lines:is(e).map(o=>{if(o.text.length===0)return{segments:[{text:"",style:ns(t,r,o.start,!0)}]};let a=new Set([o.start,o.end]);for(let f of r)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=ns(t,r,d,!1),h=c[c.length-1];h&&Yn(h.style,m)?h.text+=e.slice(d,p):c.push({text:e.slice(d,p),style:m})}return{segments:c}}),baseStyle:t,lineHeight:i}}function at(n){let e=Ce(n?.baseStyle),t=le(n?.lineHeight)??e.lineHeight,r=Array.isArray(n?.lines)?n.lines:[],i=r.length>0?r:[{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 h of p){let g=typeof h?.text=="string"?h.text:"";if(g.length===0)continue;let b=Ce(h?.style,e),$=Kn(b,e);Object.keys($).length>0&&o.push({start:a,end:a+g.length,style:$}),s.push(g),a+=g.length}if(a===m){let h=Ce(p[0]?.style,e),g=Kn(h,e);Object.keys(g).length>0&&o.push({start:m,end:m,style:g})}}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
|
+
`)&&qn(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:t}}function Zn(n){let e=n.richTextRuns;if(Ge(e))return st(e);let t=n.richTextData;return Ge(t)&&Array.isArray(t.lines)&&t.lines.length>0?at(t):null}function Xn(n){let e=new Set;for(let t of Object.keys(n))if(t==="textDecoration")for(let r of Object.keys(n.textDecoration??{}))e.add(`textDecoration.${r}`);else e.add(t);return e}function Ku(n,e){if(n.start===n.end||e.start>=e.end||n.start<e.start||n.end>e.end)return!1;let t=Xn(e.style);for(let r of Xn(n.style))if(!t.has(r))return!1;return!0}function qt(n,e){let t=[...n];for(let r of e)r.start>=r.end||Object.keys(r.style).length!==0&&(t=t.filter(i=>!Ku(i,r)),t.push({start:r.start,end:r.end,style:r.style}));return t}function Jn(n,e){if(!Array.isArray(n))return[];let t=[];for(let r of n){if(!Ge(r))continue;let i=le(r.start),s=le(r.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=Yt(r.style);Object.keys(l).length!==0&&t.push({start:o,end:a,style:l})}return t}function lo(n,e){let t=[];for(let r of n){let i=Kt({start:r.start,deleteCount:r.end-r.start,insert:""},e),s=i.start,o=s+i.deleteCount;s>=o||t.push({start:s,end:o,style:r.style})}return t}function ro(n,e){return n.start===e.start&&n.end===e.end&&qn(n.style,e.style)}function uo(n,e){if(n.text!==e.text||n.lineHeight!==e.lineHeight||!Yn(Ce(n.baseStyle),Ce(e.baseStyle)))return null;let t=Array.isArray(n.runs)?n.runs:[],r=Array.isArray(e.runs)?e.runs:[],i=0,s=0;for(;s<r.length;){let l=-1;for(let c=i;c<t.length;c++)if(ro(t[c],r[s])){l=c;break}if(l===-1)break;i=l+1,s++}let o=r.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=qt(t,o);if(a.length!==r.length)return null;for(let l=0;l<a.length;l++)if(!ro(a[l],r[l]))return null;return o.map(l=>({start:l.start,end:l.end,style:Yt(l.style)}))}function Xu(n,e){let t=e===0||n.charAt(e-1)===`
|
|
5
|
+
`,r=e===n.length||n.charAt(e)===`
|
|
6
|
+
`;return t&&r}function co(n,e,t){let r=[];for(let i of n){let s=i.start===i.end,o=Kt({start:i.start,deleteCount:i.end-i.start,insert:""},e),a=o.start,l=o.start+o.deleteCount;a===l&&(!s||!Xu(t,a))||r.push({start:a,end:l,style:i.style})}return r}function Ue(n,e=n.id){return{kind:"pattern",id:e,name:n.name??e,pattern:{type:"pattern",svgContent:n.svgContent,width:n.width,height:n.height,patternType:"custom",color:"#000000",backgroundColor:"transparent",scale:1,rotation:0,opacity:1,patternUnits:"userSpaceOnUse"}}}function Zt(n){if(n.builtIn)return!1;let e=n.pattern;return!e||typeof e!="object"?!1:e.patternType==="custom"&&typeof e.svgContent=="string"}function as(n){let e=(n.viewBox??"").trim().split(/[\s,]+/).filter(s=>s.length>0).map(Number),t=e.length===4&&e.every(s=>Number.isFinite(s)),r=t&&e[2]>0?e[2]:n.width??10,i=t&&e[3]>0?e[3]:n.height??10;return{width:r,height:i}}function kt(n){if(!Zt(n))return null;let{width:e,height:t}=as(n.pattern);return{id:n.id,name:n.name,svgContent:n.pattern.svgContent??"",width:e,height:t}}function Pe(n){let e=[...n].sort((i,s)=>i.index-s.index);if(!e.some(i=>i.orderKey))return e;let t=On(e.length),r=new Map;return e.forEach((i,s)=>{r.set(i.id,i.orderKey??t[s])}),e.sort((i,s)=>{let o=Ut(r.get(i.id)??"",r.get(s.id)??"");return o!==0?o:i.id<s.id?-1:i.id>s.id?1:0})}var Yu=/^structural:(clip|mask):(.+):(group|path|content)$/;function fo(n,e){let t=`structural:${n}:${e}`;return{group:`${t}:group`,path:`${t}:path`,content:`${t}:content`}}function po(n,e){for(let t of n){e.add(t.id);let r=t.state.children;Array.isArray(r)&&po(r,e)}}function mo(n,e=null){let t=[];return n.forEach((r,i)=>{t.push({id:r.id,parentId:e,index:i});let s=r.state.children;Array.isArray(s)&&t.push(...mo(s,r.id))}),t}function Qn(n){let e=n.sceneTree&&n.sceneTree.length>0?n.sceneTree:mo(n.shapes),t=new Map(e.map(S=>[S.id,S])),r=new Map;for(let S of e){let x=r.get(S.parentId)??[];x.push(S),r.set(S.parentId,x)}for(let[S,x]of r)r.set(S,Pe(x));let i=S=>Yu.test(S),s=new Set(e.filter(S=>!i(S.id)).map(S=>S.id)),o=new Set;po(n.shapes,o);let a=new Map,l=new Set,c=(S,x)=>{let v=[];for(let w of r.get(S)??[]){if(!i(w.id)){l.has(w.id)||(l.add(w.id),v.push(w.id));continue}if(x.has(w.id))continue;let T=new Set(x);T.add(w.id),v.push(...c(w.id,T))}return v},f=[null,...s];for(let S of f){let x=c(S,new Set);x.length>0&&a.set(S,x)}for(let S of s){if(l.has(S))continue;let x=t.get(S)?.parentId??null,v=x!==null&&s.has(x)?x:null,w=a.get(v)??[];w.push(S),a.set(v,w),l.add(S)}let d=S=>{for(let[x,v]of a){let w=v.indexOf(S);if(w>=0)return{parentId:x,index:w}}return null},p=S=>{for(let x of a.values()){let v=x.indexOf(S);v>=0&&x.splice(v,1)}},m=n.clipMaskGroups??[],h=new Map(m.map(S=>[fo(S.type,S.id).content,S])),g=(S,x=new Set)=>{if(x.has(S.id))return Number.MAX_SAFE_INTEGER;let v=S.parentId?h.get(S.parentId):void 0;if(!v)return 0;let w=new Set(x);return w.add(S.id),1+g(v,w)},b=[...m].sort((S,x)=>g(S)-g(x)||(S.siblingIndex??0)-(x.siblingIndex??0)),$=new Map;for(let S of b){let x=(S.clipShapeIds.length>0?S.clipShapeIds:S.clipShapeId?[S.clipShapeId]:[]).filter(L=>o.has(L)),v=S.contentShapeIds.filter(L=>o.has(L));if(v.length===0||x.length===0&&!S.rawDefinition)continue;let w=[...v,...x].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=S.parentId===null||s.has(S.parentId)||h.has(S.parentId)?S.parentId:T;for(let L of[...x,...v])p(L);let M=fo(S.type,S.id),N=a.get(R)??[],B=S.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,[...x]),a.set(M.content,[...v]),$.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 k=[];for(let[S,x]of a)x.forEach((v,w)=>{let T=$.get(v);if(T){k.push({...T,parentId:S,index:w});return}let P=t.get(v);P&&P.parentId===S?k.push({...P,index:w}):k.push({id:v,parentId:S,index:w})});n.sceneTree=k}function $e(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function os(n){return $e(n)&&typeof n.updatedAt=="number"&&Number.isSafeInteger(n.updatedAt)&&n.updatedAt>=0&&typeof n.clientId=="string"}function ot(n,e){return{updatedAt:typeof n=="number"&&Number.isSafeInteger(n)&&n>=0?n:0,clientId:e??""}}function Jt(n,e){return os(e)?n.updatedAt>e.updatedAt||n.updatedAt===e.updatedAt&&n.clientId>=e.clientId:!0}function ho(n){return $e(n.collaborationState)||(n.collaborationState={}),n.collaborationState}function go(n,e){let t=ho(n);$e(t.shapeProps)||(t.shapeProps={});let r=t.shapeProps;return $e(r[e])||(r[e]={}),r[e]}function Qt(n,e){let t=n.collaborationState?.shapeProps;if(!$e(t))return{};let r=t[e];return $e(r)?r:{}}function yo(n,e,t,r){if(t.length===0)return;let i=go(n,e);for(let s of t)Jt(r,i[s])&&(i[s]=r)}function ls(n,e){let t=n.collaborationState?.shapeProps;if($e(t)){for(let r of e)delete t[r];qu(n)}}function qu(n){let e=n.collaborationState;if($e(e)){for(let t of["shapeProps","resources"]){let r=e[t];$e(r)&&Object.keys(r).length===0&&delete e[t]}Object.keys(e).length===0&&delete n.collaborationState}}function us(n){switch(n.type){case"guide:upsert":return`guide:${n.guide.id}`;case"guide:remove":case"guide:move":return`guide:${n.id}`;case"measurement:upsert":return`measurement:${n.measurement.id}`;case"measurement:remove":case"measurement:move":return`measurement:${n.id}`;case"metadata:patch":return"metadata:document";case"documentScript:upsert":return`documentScript:${n.documentScript.id}`;case"documentScript:remove":return`documentScript:${n.id}`;case"documentStyle:upsert":return`documentStyle:${n.documentStyle.id}`;case"documentStyle:remove":return`documentStyle:${n.id}`;case"templateVariable:upsert":return`templateVariable:${n.templateVariable.name}`;case"templateVariable:remove":return`templateVariable:${n.name}`;case"exportItem:upsert":return`exportItem:${n.exportItem.id}`;case"exportItem:remove":return`exportItem:${n.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:${n.trackId}:${n.keyframe.id}`;case"animationKeyframe:remove":return`animationKeyframe:${n.trackId}:${n.keyframeId}`;case"clipMask:upsert":return`clipMask:${n.clipMaskGroup.id}`;case"clipMask:remove":return`clipMask:${n.id}`;case"library:upsert":return`library:${n.def.id}`;case"library:remove":return`library:${n.id}`;case"customPattern:upsert":return`customPattern:${n.customPattern.id}`;case"customPattern:remove":return`customPattern:${n.id}`;case"paintServerDef:upsert":return`paintServerDef:${n.paintServerDef.id}`;case"paintServerDef:remove":return`paintServerDef:${n.id}`;default:return null}}function bo(n,e,t){if(e.type==="shape:update"&&e.propTimestamps){if(!t)return null;let a=Qt(n,e.id),l={},c={},f=[];for(let[p,m]of Object.entries(e.state)){let h=ot(e.propTimestamps[p],e.clientId);Jt(h,a[p])&&(l[p]=m,c[p]=h.updatedAt,f.push([p,h]))}if(f.length===0)return null;let d=go(n,e.id);for(let[p,m]of f)d[p]=m;return{...e,state:l,propTimestamps:c}}let r=us(e);if(r===null||!("updatedAt"in e)||e.updatedAt===void 0)return e;let i=ot(e.updatedAt,e.clientId),s=ho(n);$e(s.resources)||(s.resources={});let o=s.resources;return Jt(i,o[r])?(o[r]=i,{...e,updatedAt:i.updatedAt,clientId:i.clientId}):null}function So(n){let e=0,t=n.collaborationState?.shapeProps;if($e(t)){for(let i of Object.values(t))if($e(i))for(let s of Object.values(i))os(s)&&(e=Math.max(e,s.updatedAt))}let r=n.collaborationState?.resources;if($e(r))for(let i of Object.values(r))os(i)&&(e=Math.max(e,i.updatedAt));for(let i of n.sceneTree??[])typeof i.updatedAt=="number"&&Number.isSafeInteger(i.updatedAt)&&i.updatedAt>=0&&(e=Math.max(e,i.updatedAt));return e}function xo(n,e){let t=Object.keys(e.state);if(t.length===0)return;let r=Qt(n,e.id),i=0;for(let o of t){let a=ot(e.propTimestamps?.[o],e.clientId);i=Math.max(i,r[o]?.updatedAt??0,a.updatedAt)}let s=i+1;e.propTimestamps=Object.fromEntries(t.map(o=>[o,s]))}function lt(n){n.symbols!==void 0&&(n.symbols=(n.library??[]).filter(e=>e.kind==="symbol").map(({kind:e,...t})=>t)),n.customPatterns!==void 0&&(n.customPatterns=(n.library??[]).filter(e=>e.kind==="pattern").map(e=>kt(e)).filter(e=>e!==null))}function Po(n,e=null){let t=[];return n.forEach((r,i)=>{t.push({id:r.id,parentId:e,index:i});let s=r.state.children;Array.isArray(s)&&t.push(...Po(s,r.id))}),t}function pe(n,e){if(n===e)return!0;let t=n??$o,r=e??$o;if(t.length!==r.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==r[i])return!1;return!0}var $o=[];function en(n){return n.sceneTree&&n.sceneTree.length>0?n.sceneTree:Po(n.shapes)}function Zu(n,e){let t=n,r=new Set(n.map(o=>o.id)),i=(o,a,l)=>{r.has(o.id)||(t=ds(t,{id:o.id,parentId:a,index:l}),r.add(o.id)),wt(o)?.forEach((f,d)=>i(f,o.id,d))},s=t.filter(o=>o.parentId===null).length;return i(e,null,s),t}function _o(n){let e=new Map;for(let r of n){let i=e.get(r.parentId)??[];i.push(r),e.set(r.parentId,i)}let t=[];for(let r of e.values())Pe(r).forEach((i,s)=>t.push({...i,index:s}));return t}function tn(n,e){let t=n.filter(l=>l.parentId===e);if(t.every(l=>l.orderKey))return n;let r=Pe(t),i=new Map,s=[],o=null,a=l=>{if(s.length===0)return;let c=En(o,l,s.length);s.forEach((f,d)=>i.set(f.id,c[d])),s=[]};for(let l of r)l.orderKey?(a(l.orderKey),o=l.orderKey):s.push(l);return a(null),n.map(l=>i.has(l.id)?{...l,orderKey:i.get(l.id)}:l)}function ds(n,e){let t,r=[],i=[],s=!1;for(let l of n){if(l.id===e.id){if(t=l,!fs(e,t))return n;continue}l.parentId===e.parentId?(r.push(l),l.orderKey&&(s=!0)):i.push(l)}if(s){let l=tn([...i,...r],e.parentId),c=Pe(l.filter(h=>h.parentId===e.parentId)),f=Math.min(Math.max(0,e.index),c.length),d=f>0?c[f-1].orderKey??null:null,p=f<c.length?c[f].orderKey??null:null,m=d!==null&&p!==null&&d>=p?d:bt(d,p);return[...i,...c,{...e,orderKey:m}]}let o=r.sort((l,c)=>l.index-c.index).map((l,c)=>({...l,index:c})),a=Math.min(Math.max(0,e.index),o.length);return[...i,...o,{...e,index:a-.5}]}function er(n,e,t){let r=n?[...n]:[],i=r.find(s=>s.id===e);return i?ge(r,i,t):r}function Ju(n){n.keyframes.sort((e,t)=>{if(e.time!==t.time)return e.time-t.time;let r=e.id??"",i=t.id??"";return r<i?-1:r>i?1:0})}function ms(n,e){let t=n.keyframes.findIndex(r=>r.id===e.id);t>=0?n.keyframes[t]=e:n.keyframes.push(e),Ju(n)}function hs(n,e){n.keyframes=n.keyframes.filter(t=>t.id!==e)}function vo(n,e){let t=n.animationTimeline?.tracks;return Array.isArray(t)?t.find(r=>r.id===e)??null:null}function fs(n,e){let t=n.updatedAt??0,r=e.updatedAt??0;return t!==r?t>r:(n.clientId??"")>=(e.clientId??"")}function wt(n){let e=n.state.children;return Array.isArray(e)?e:void 0}var cs=new Set(["group","hyperlink","switch","container","svg"]);function Ro(n,e,t,r){for(let i of n){t.set(i.id,e),r.set(i.id,i);let s=wt(i);s&&Ro(s,i.id,t,r)}}function gs(n){let e=n.sceneTree;if(!e||e.length===0)return;let t=new Map,r=new Map;if(Ro(n.shapes,null,t,r),r.size===0)return;for(let d of r.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 Pe(i.get(d)??[])){if(l.has(m.id))continue;l.add(m.id);let h=r.get(m.id);if(!h){c(m.id,p);continue}o(p,h),a.add(h.id),cs.has(h.type)&&c(m.id,h.id)}};if(c(null,null),a.size===0)return;let f=d=>{let p=t.get(d)??null,m=new Set;for(;p!==null&&!m.has(p);){m.add(p);let h=r.get(p);if(h&&cs.has(h.type))return p;p=t.get(p)??null}return null};for(let[d,p]of r)a.has(d)||o(f(d),p);for(let[d,p]of r){if(!cs.has(p.type))continue;let m=p.state,h=s.get(d);h&&h.length>0?m.children=h:"children"in m&&delete m.children}n.shapes=s.get(null)??[]}function Qu(n){let e=`structural:${n.type}:${n.id}`;return{group:`${e}:group`,path:`${e}:path`,content:`${e}:content`}}function Tt(n){let e=n.clipMaskGroups;if(!e||e.length===0)return;let t=n.sceneTree;if(!t||t.length===0)return;let r=new Set(t.map(o=>o.id)),i=new Map;for(let o of t){if(o.parentId===null)continue;let a=i.get(o.parentId);a?a.push(o):i.set(o.parentId,[o])}let s=o=>Pe(i.get(o)??[]).map(a=>a.id).filter(a=>!a.startsWith("structural:"));n.clipMaskGroups=e.map(o=>{let a=Qu(o);if(!r.has(a.group))return o;let l=r.has(a.path)?s(a.path):o.clipShapeIds,c=r.has(a.content)?s(a.content):o.contentShapeIds;if(ko(l,o.clipShapeIds)&&ko(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 ko(n,e){return!e||n.length!==e.length?!1:n.every((t,r)=>t===e[r])}function ys(n,e){e.add(n.id);let t=wt(n);if(t)for(let r of t)ys(r,e)}function ps(n,e){for(let t of n){e.set(t.id,t);let r=wt(t);r&&ps(r,e)}}var tr=class{constructor(e,t){this.snapshot=e;this.indexed=t}snapshot;indexed;shapeIndex=null;inlineProjectionPending=!1;sceneTreeNormalizePending=!1;memoId=null;memoShape=null;findShape(e){if(this.memoId===e)return this.memoShape;let t;return this.indexed?(this.shapeIndex===null&&(this.shapeIndex=new Map,ps(this.snapshot.shapes,this.shapeIndex)),t=this.shapeIndex.get(e)??null):t=ct(this.snapshot.shapes,e),this.memoId=e,this.memoShape=t,t}noteShapesAdded(e){this.memoId=null,this.memoShape=null,this.shapeIndex!==null&&ps([e],this.shapeIndex)}noteShapesRemoved(){this.shapeIndex=null,this.memoId=null,this.memoShape=null}requestInlineProjection(){this.inlineProjectionPending=!0}requestSceneTreeNormalize(){this.sceneTreeNormalizePending=!0}settle(){if(this.sceneTreeNormalizePending){this.sceneTreeNormalizePending=!1;let e=this.snapshot.sceneTree;e&&e.length>0&&(this.snapshot.sceneTree=_o(e))}this.inlineProjectionPending&&(this.inlineProjectionPending=!1,gs(this.snapshot))}};function ct(n,e){for(let t of n){if(t.id===e)return t;let r=wt(t);if(!r)continue;let i=ct(r,e);if(i)return i}return null}function ut(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function ec(n){let e=n.richTextRuns;return!ut(e)||typeof e.text!="string"?null:st(e)}function tc(n,e){let t=n.state;"extra"in t&&Ne(t);let r=new Set;for(let[i,s]of Object.entries(e))s===null?r.add(i):t[i]=s;if(r.size>0){let i={};for(let[s,o]of Object.entries(t))r.has(s)||(i[s]=o);n.state=i}}function Ao(n,e,t){let r=[];for(let i of n){if(i.id===e){ys(i,t);continue}let s=wt(i);if(s){let o=Ao(s,e,t),a=i.state;o.length>0?a.children=o:delete a.children}r.push(i)}return r}function Io(n,e){let t=n.snapshot,r=t,i=bo(t,e,e.type!=="shape:update"||n.findShape(e.id)!==null);if(i===null)return null;let s=i,o=s;switch(s.type){case"shape:add":{if(!(n.findShape(s.shape.id)!==null)){let l=en(r),c=Ht(structuredClone(s.shape));r.shapes.push(c),r.sceneTree=Zu(l,c),n.noteShapesAdded(c),n.requestSceneTreeNormalize(),n.requestInlineProjection();let f=new Set;ys(c,f),ls(t,f)}break}case"shape:update":{let a=n.findShape(s.id);if(!a)return null;tc(a,s.state);break}case"text:format":{let a=n.findShape(s.id);if(!a)return null;let l=a.state;"extra"in l&&Ne(l);let c=ec(l);if(!c)return null;let f=Jn(s.ranges,c.text.length);if(f.length===0)return null;let d={...c,runs:qt(c.runs,f)};l.richTextRuns=d;let p=["richTextRuns"];if(ut(l.richTextData)&&(l.richTextData=Ve(d),p.push("richTextData")),s.updatedAt!==void 0){let m=ot(s.updatedAt,s.clientId),h=Qt(t,s.id);if(p.some(b=>!Jt(m,h?.[b]))){let b=Math.max(0,...p.map($=>h?.[$]?.updatedAt??0));m={updatedAt:Math.max(m.updatedAt,b)+1,clientId:m.clientId},o={...s,updatedAt:m.updatedAt,clientId:m.clientId}}yo(t,s.id,p,m)}break}case"shape:remove":{let a=new Set,l=Ao(r.shapes,s.id,a),c=a.size>0;c||a.add(s.id);let f=en(r),d=f.filter(p=>!a.has(p.id));if(!c&&d.length===f.length)return null;r.shapes=l,r.sceneTree=d,n.noteShapesRemoved(),ls(t,a),Tt(r);break}case"scene:move":{let a=en(r),l=a.find(d=>d.id===s.id),c=s.updatedAt===void 0?void 0:ot(s.updatedAt,s.clientId),f={id:s.id,parentId:s.parentId,index:s.index,updatedAt:c?.updatedAt,clientId:c?.clientId};if(l&&!fs(f,l))return null;r.sceneTree=ds(a,f),n.requestSceneTreeNormalize(),c&&(o={...s,...c}),n.requestInlineProjection(),Tt(r);break}case"scene:place":{if(!Vt(s.orderKey))return null;let a=en(r),l=a.find(p=>p.id===s.id),c=s.updatedAt===void 0?void 0:ot(s.updatedAt,s.clientId),f={id:s.id,parentId:s.parentId,index:l?.index??Number.MAX_SAFE_INTEGER,orderKey:s.orderKey,updatedAt:c?.updatedAt,clientId:c?.clientId};if(l&&!fs(f,l))return null;let d=tn(a,s.parentId);r.sceneTree=[...d.filter(p=>p.id!==s.id),f],n.requestSceneTreeNormalize(),n.requestInlineProjection(),Tt(r),c&&(o={...s,...c});break}case"shapes:reorder":{let a=en(r);s.ids.forEach((l,c)=>{a.some(f=>f.id===l&&f.parentId===null)&&(a=ds(a,{id:l,parentId:null,index:c}))}),r.sceneTree=a,n.requestSceneTreeNormalize(),n.requestInlineProjection(),Tt(r);break}case"groups:set":r.groups=s.groups;break;case"clipmasks:set":r.clipMaskGroups=s.clipMaskGroups,Qn(r);break;case"clipMask:upsert":r.clipMaskGroups=ge(r.clipMaskGroups,s.clipMaskGroup,s.index),Qn(r);break;case"clipMask:remove":{let a=ye(r.clipMaskGroups,s.id);if(pe(r.clipMaskGroups,a))return null;r.clipMaskGroups=a,Qn(r);break}case"guides:set":r.guides=s.guides;break;case"guide:upsert":r.guides=ge(r.guides,s.guide,s.index);break;case"guide:remove":{let a=ye(r.guides,s.id);if(pe(r.guides,a))return null;r.guides=a;break}case"guide:move":{let a=er(r.guides,s.id,s.index);if(pe(r.guides,a))return null;r.guides=a;break}case"measurements:set":r.measurements=s.measurements;break;case"measurement:upsert":r.measurements=ge(r.measurements,s.measurement,s.index);break;case"measurement:remove":{let a=ye(r.measurements,s.id);if(pe(r.measurements,a))return null;r.measurements=a;break}case"measurement:move":{let a=er(r.measurements,s.id,s.index);if(pe(r.measurements,a))return null;r.measurements=a;break}case"metadata:set":r.documentMetadata=s.metadata;break;case"metadata:patch":{let a=Object.fromEntries(Object.entries({...r.documentMetadata??{},...s.patch}).filter(([l])=>!(s.removeKeys??[]).includes(l)));r.documentMetadata=a;break}case"documentScripts:set":r.documentScripts=s.documentScripts;break;case"documentScript:upsert":r.documentScripts=ge(r.documentScripts,s.documentScript,s.index);break;case"documentScript:remove":{let a=ye(r.documentScripts,s.id);if(pe(r.documentScripts,a))return null;r.documentScripts=a;break}case"documentStyles:set":r.documentStyles=s.documentStyles;break;case"documentStyle:upsert":r.documentStyles=ge(r.documentStyles,s.documentStyle,s.index);break;case"documentStyle:remove":{let a=ye(r.documentStyles,s.id);if(pe(r.documentStyles,a))return null;r.documentStyles=a;break}case"templateVariables:set":r.templateVariables=s.templateVariables;break;case"templateVariable:upsert":r.templateVariables=Wn(r.templateVariables,s.templateVariable,s.index);break;case"templateVariable:remove":{let a=Hn(r.templateVariables,s.name);if(pe(r.templateVariables,a))return null;r.templateVariables=a;break}case"exportItems:set":r.exportItems=s.exportItems;break;case"exportItem:upsert":r.exportItems=ge(r.exportItems,s.exportItem,s.index);break;case"exportItem:remove":{let a=ye(r.exportItems,s.id);if(pe(r.exportItems,a))return null;r.exportItems=a;break}case"colorGlyphLibrary:set":s.colorGlyphLibrary===null?delete r.colorGlyphLibrary:r.colorGlyphLibrary=s.colorGlyphLibrary;break;case"animation:set":r.animationTimeline=s.animationTimeline;break;case"animation:config":r.animationTimeline={duration:s.config.duration,loop:s.config.loop,playbackSpeed:s.config.playbackSpeed,tracks:Array.isArray(r.animationTimeline?.tracks)?r.animationTimeline.tracks:[]};break;case"animation:clear":delete r.animationTimeline;break;case"animationTrack:upsert":r.animationTimeline={duration:typeof r.animationTimeline?.duration=="number"?r.animationTimeline.duration:0,loop:typeof r.animationTimeline?.loop=="boolean"?r.animationTimeline.loop:!1,playbackSpeed:typeof r.animationTimeline?.playbackSpeed=="number"?r.animationTimeline.playbackSpeed:1,tracks:ge(Array.isArray(r.animationTimeline?.tracks)?r.animationTimeline.tracks:[],s.track,s.index)};break;case"animationTrack:remove":{let a=Array.isArray(r.animationTimeline?.tracks)?r.animationTimeline.tracks:[],l=ye(a,s.id);if(pe(a,l)&&!r.animationTimeline)return null;l.length>0&&r.animationTimeline?r.animationTimeline={...r.animationTimeline,tracks:l}:delete r.animationTimeline;break}case"animationKeyframe:upsert":{let a=vo(r,s.trackId);if(!a)return null;ms(a,structuredClone(s.keyframe));break}case"animationKeyframe:remove":{let a=vo(r,s.trackId);if(!a)return null;let l=a.keyframes;if(hs(a,s.keyframeId),pe(l,a.keyframes))return null;break}case"symbols:set":{r.symbols=s.symbols;let a=s.symbols.map(c=>({...c,kind:"symbol"})),l=(r.library??[]).filter(c=>c.kind!=="symbol");r.library=[...a,...l],lt(r);break}case"customPatterns:set":r.customPatterns=s.customPatterns;{let a=new Set(s.customPatterns.map(c=>c.id)),l=(r.library??[]).filter(c=>!a.has(c.id)&&(c.kind!=="pattern"||!Zt(c)));r.library=[...l,...s.customPatterns.map(c=>Ue(c))]}lt(r);break;case"customPattern:upsert":{r.customPatterns=ge(r.customPatterns,s.customPattern,s.index);let a=Ue(s.customPattern),l=[...r.library??[]],c=l.findIndex(f=>f.id===a.id);c>=0?l[c]=a:l.push(a),r.library=l,lt(r);break}case"customPattern:remove":{let a=ye(r.customPatterns,s.id),l=ye(r.library,s.id);if(pe(r.customPatterns,a)&&pe(r.library,l))return null;r.customPatterns=a,r.library=l,lt(r);break}case"library:set":r.library=s.library,lt(r);break;case"library:upsert":r.library=ge(r.library,s.def,s.index),lt(r);break;case"library:remove":{let a=ye(r.library,s.id);if(pe(r.library,a))return null;r.library=a,lt(r);break}case"rawPaintServerDefs:set":r.rawPaintServerDefs=s.rawPaintServerDefs,delete r.paintServerDefs;break;case"paintServerDefs:set":r.paintServerDefs=s.paintServerDefs,r.rawPaintServerDefs=s.paintServerDefs.map(a=>a.markup);break;case"paintServerDef:upsert":r.paintServerDefs=ge(r.paintServerDefs,s.paintServerDef,s.index),r.rawPaintServerDefs=r.paintServerDefs.map(a=>a.markup);break;case"paintServerDef:remove":{let a=ye(r.paintServerDefs,s.id);if(pe(r.paintServerDefs,a))return null;r.paintServerDefs=a,r.rawPaintServerDefs=a.map(l=>l.markup);break}case"presence:cursor":case"presence:selection":break;default:{let a=s;return null}}return o}function Mo(n,e,t){if(e.type==="shape:update"&&e.propTimestamps){let r=t?.type==="shape:update"?new Set(Object.keys(t.state)):new Set,i=Object.keys(e.state).filter(s=>!r.has(s));return To(n,e.id,i)}if(e.type==="text:format"&&t?.type==="text:format"){if(!(t.updatedAt!==e.updatedAt||t.clientId!==e.clientId))return[];let i=ct(n.shapes,e.id)?.state,s=i&&ut(Co(i,"richTextData"))?["richTextRuns","richTextData"]:["richTextRuns"];return To(n,e.id,s)}return[]}function Co(n,e){if(e in n)return n[e];let t=n.extra;return ut(t)?t[e]:void 0}function nc(n,e){if(e in n)return!0;let t=n.extra;return ut(t)&&e in t}function To(n,e,t){if(t.length===0)return[];let r=ct(n.shapes,e);if(!r)return[];let i=r.state,s=Qt(n,e),o=new Map;for(let l of t){let c=s[l];if(!c)continue;let f=o.get(c.clientId);f?f.push(l):o.set(c.clientId,[l])}let a=[];for(let[l,c]of o){let f={},d={};for(let p of c)f[p]=nc(i,p)?structuredClone(Co(i,p)):null,d[p]=s[p].updatedAt;a.push({type:"shape:update",id:e,state:f,propTimestamps:d,clientId:l})}return a}function Do(n,e){let t=new tr(n,!1),r=Io(t,e);return t.settle(),r}function bs(n,e){let t=new tr(n,e.length>1),r=[];for(let i of e){let s=Io(t,i);s&&r.push(s)}return t.settle(),r}function Ss(n,e){let t=structuredClone(n);return{snapshot:t,acceptedOps:bs(t,e)}}function Fo(n,e){return Ss(n,e).snapshot}function Eo(n){if(!n||n.length===0||n.every(t=>t.orderKey))return n;let e=n;for(let t of new Set(n.map(r=>r.parentId)))e=tn(e,t);return _o(e)}function Oo(n,e){if(!n.some(r=>r.type==="scene:place"))return n;let t=new Map((e??[]).map(r=>[r.id,r]));return n.map(r=>{if(r.type!=="scene:place")return r;let i=t.get(r.id);return{type:"scene:move",id:r.id,parentId:i?.parentId??r.parentId,index:i?.index??0,updatedAt:r.updatedAt,clientId:r.clientId}})}function Lo(n,e){if(!n.some(i=>i.type==="animationKeyframe:upsert"||i.type==="animationKeyframe:remove"))return n;let t=Array.isArray(e?.tracks)?e.tracks:[],r=[];for(let i of n){if(i.type!=="animationKeyframe:upsert"&&i.type!=="animationKeyframe:remove"){r.push(i);continue}let s=t.findIndex(o=>o.id===i.trackId);s!==-1&&r.push({type:"animationTrack:upsert",track:structuredClone(t[s]),index:s,updatedAt:i.updatedAt,clientId:i.clientId})}return r}function No(n,e){if(!n.some(r=>r.type==="text:format"))return n;let t=[];for(let r of n){if(r.type!=="text:format"){t.push(r);continue}let i=ct(e,r.id);if(!i)continue;let s=i.state.richTextRuns;if(!ut(s))continue;let o={richTextRuns:structuredClone(s)},a=i.state.richTextData;ut(a)&&(o.richTextData=structuredClone(a)),t.push({type:"shape:update",id:r.id,state:o,...typeof r.updatedAt=="number"?{propTimestamps:Object.fromEntries(Object.keys(o).map(l=>[l,r.updatedAt]))}:{},...r.clientId!==void 0?{clientId:r.clientId}:{}})}return t}function Bo(n,e){if(!n.some(r=>r.type==="guide:move"||r.type==="measurement:move"))return n;let t=[];for(let r of n)if(r.type==="guide:move"){let i=e.guides??[],s=i.findIndex(o=>o.id===r.id);if(s===-1)continue;t.push({type:"guide:upsert",guide:structuredClone(i[s]),index:s,updatedAt:r.updatedAt,clientId:r.clientId})}else if(r.type==="measurement:move"){let i=e.measurements??[],s=i.findIndex(o=>o.id===r.id);if(s===-1)continue;t.push({type:"measurement:upsert",measurement:structuredClone(i[s]),index:s,updatedAt:r.updatedAt,clientId:r.clientId})}else t.push(r);return t}var zo=6,wo=new Set(["templateVariables:set","templateVariable:upsert","templateVariable:remove","exportItems:set","exportItem:upsert","exportItem:remove","colorGlyphLibrary:set"]);function Go(n){return n.some(e=>wo.has(e.type))?n.filter(e=>!wo.has(e.type)):n}var rn=Object.freeze([1,0,0,1,0,0]);function We(n,e,t,r,i,s){return[n,e,t,r,i,s]}function rr(n){return We(n[0]??1,n[1]??0,n[2]??0,n[3]??1,n[4]??0,n[5]??0)}function Ye(n){return[n[0],n[1],n[2],n[3],n[4],n[5]]}function _t(n){return Array.isArray(n)&&n.length>=6&&n.slice(0,6).every(Number.isFinite)}function $s(n,e=1e-9){return Math.abs((n[0]??1)-1)<=e&&Math.abs(n[1]??0)<=e&&Math.abs(n[2]??0)<=e&&Math.abs((n[3]??1)-1)<=e&&Math.abs(n[4]??0)<=e&&Math.abs(n[5]??0)<=e}function rc(n,e,t=1e-9){for(let r=0;r<6;r++)if(Math.abs(n[r]-e[r])>t)return!1;return!0}function ne(n,e){return We(n[0]*e[0]+n[2]*e[1],n[1]*e[0]+n[3]*e[1],n[0]*e[2]+n[2]*e[3],n[1]*e[2]+n[3]*e[3],n[0]*e[4]+n[2]*e[5]+n[4],n[1]*e[4]+n[3]*e[5]+n[5])}function ic(n){let e=n[0]*n[3]-n[2]*n[1];if(Math.abs(e)<1e-10)return null;let t=1/e;return We(n[3]*t,-n[1]*t,-n[2]*t,n[0]*t,(n[2]*n[5]-n[3]*n[4])*t,(n[1]*n[4]-n[0]*n[5])*t)}function sc(n,e){return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}function ac(n,e){return{x:n[0]*e.x+n[2]*e.y,y:n[1]*e.x+n[3]*e.y}}function _e(n,e=0){return We(1,0,0,1,n,e)}function sn(n,e=n){return We(n,0,0,e,0,0)}function Rt(n){let e=n*Math.PI/180,t=Math.cos(e),r=Math.sin(e);return We(t,r,-r,t,0,0)}function an(n){return We(1,0,Math.tan(n*Math.PI/180),1,0,0)}function on(n){return We(1,Math.tan(n*Math.PI/180),0,1,0,0)}function vs(n,e){return ne(ne(_e(n.x,n.y),e),_e(-n.x,-n.y))}var oc=9,lc=10,uc=12,cc=13,dc=32,Vo=43,fc=44,Uo=45,pc=46,mc=48,hc=57,gc=40,yc=41,bc=69,Sc=101,xc=0,$c=1,Ho=2,vc=new Map([["matrix",[6]],["translate",[1,2]],["scale",[1,2]],["rotate",[1,3]],["skewX",[1]],["skewY",[1]]]);function kc(n){return n===dc||n===oc||n===lc||n===cc||n===uc}function nr(n){return n>=mc&&n<=hc}function Tc(n){let e=n>=65&&n<=90,t=n>=97&&n<=122;return e||t||nr(n)}function Pt(n){for(;n.pos<n.src.length&&kc(n.src.charCodeAt(n.pos));)n.pos++}function jo(n){let e=n.pos;return Pt(n),n.src.charCodeAt(n.pos)===fc?(n.pos++,Pt(n),Ho):n.pos>e?$c:xc}function Wo(n){let e=n.src,t=n.pos,r=t,i=e.charCodeAt(r);(i===Vo||i===Uo)&&r++;let s=!1;for(;r<e.length&&nr(e.charCodeAt(r));)r++,s=!0;if(e.charCodeAt(r)===pc){let l=r+1;for(;l<e.length&&nr(e.charCodeAt(l));)l++;l>r+1&&(r=l,s=!0)}if(!s)return null;let o=e.charCodeAt(r);if(o===Sc||o===bc){let l=r+1,c=e.charCodeAt(l);(c===Vo||c===Uo)&&l++;let f=l;for(;f<e.length&&nr(e.charCodeAt(f));)f++;f>l&&(r=f)}let a=Number(e.slice(t,r));return Number.isFinite(a)?(n.pos=r,a):null}function wc(n,e){switch(n){case"matrix":return rr(e);case"translate":return _e(e[0],e[1]??0);case"scale":return sn(e[0],e[1]??e[0]);case"rotate":return e.length===3?vs({x:e[1],y:e[2]},Rt(e[0])):Rt(e[0]);case"skewX":return an(e[0]);case"skewY":return on(e[0]);default:return null}}function Pc(n){let e=n.src,t=n.pos;for(;n.pos<e.length&&Tc(e.charCodeAt(n.pos));)n.pos++;if(n.pos===t)return null;let r=e.slice(t,n.pos),i=vc.get(r);if(!i||(Pt(n),e.charCodeAt(n.pos)!==gc))return null;n.pos++,Pt(n);let s=i[i.length-1],o=Wo(n);if(o===null)return null;let a=[o];for(;;){let l=n.pos;jo(n);let c=Wo(n);if(c===null){n.pos=l;break}if(a.push(c),a.length>s)return null}return Pt(n),e.charCodeAt(n.pos)!==yc||(n.pos++,!i.includes(a.length))?null:wc(r,a)}function _c(n){let e={src:n,pos:0};if(Pt(e),e.pos>=n.length)return rn;let t=rn;for(;;){let r=Pc(e);if(r===null)return null;t=ne(t,r);let i=jo(e);if(e.pos>=n.length)return i===Ho?null:t}}var Rc=2048,nn=new Map;function Ko(n){if(!n)return rn;let e=nn.get(n);if(e!==void 0)return e;let t=_c(n),r=t===null?null:Object.freeze(t);if(nn.size>=Rc){let i=nn.keys().next().value;i!==void 0&&nn.delete(i)}return nn.set(n,r),r}function ir(n){return Ko(n)??rn}function Ac(n){let e=n[0],t=n[1],r=n[2],i=n[3],s=Math.sqrt(e*e+t*t);if(s<1e-12)return{rotation:0,scaleX:0,scaleY:Math.sqrt(r*r+i*i),skewX:0};let o=Math.atan2(t,e),l=(e*i-t*r)/s,c=l!==0?(e*r+t*i)/(s*s):0,f=Math.atan(c),d=180/Math.PI;return{rotation:o*d,scaleX:s,scaleY:l,skewX:f*d}}function xs(n){return!_t(n)||$s(n)?null:`matrix(${n[0]}, ${n[1]}, ${n[2]}, ${n[3]}, ${n[4]}, ${n[5]})`}function ln(n,e){let t=n.translateX??0,r=n.translateY??0,i=typeof n.rawTransform=="string"?n.rawTransform:"",s=n.rotation??0,o=n.skewX??0,a=n.skewY??0,l=n.scaleX??1,c=n.scaleY??1,f=_e(t,r);if(i)return ne(f,ir(i));if(s===0&&o===0&&a===0&&l===1&&c===1)return f;let d=n.customPivot??e;if(!d)return f;let p=ne(ne(ne(Rt(s),sn(l,c)),an(o)),on(a));return ne(f,vs(d,p))}function At(n,e){let t=xs(n.transformMatrix);return t||(xs(Ye(ln(n,e)))??null)}function ks(n,e){let t=n.ancestorTransform;if(!_t(t)){delete n.ancestorTransform;return}if($s(t)){delete n.ancestorTransform;return}let r=_t(n.transformMatrix)?rr(n.transformMatrix):ln(n,e);n.transformMatrix=Ye(ne(rr(t),r)),delete n.ancestorTransform}function Ts(n,e,t){let r=At(n,{x:e,y:t});return r?`${r} translate(${e}, ${t})`:`translate(${e}, ${t})`}function qo(n){let e=n.customPivot;if(e)return e;let t=n.x,r=n.y,i=n.width,s=n.height;if(typeof t=="number"&&typeof r=="number"&&typeof i=="number"&&typeof s=="number")return{x:t+i/2,y:r+s/2};let o=n.radius;if(typeof t=="number"&&typeof r=="number"&&typeof o=="number")return{x:t,y:r};let a=n.cx,l=n.cy;if(typeof a=="number"&&typeof l=="number")return{x:a,y:l};let c=n.x1,f=n.y1,d=n.x2,p=n.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=n.pathPoints;if(m?.[0])return{x:m[0].x,y:m[0].y};let h=n.polylinePoints;if(h?.[0])return{x:h[0].x,y:h[0].y}}function un(n){if(Array.isArray(n))for(let e of n){let t=e.state;ks(t,qo(t));let r=e.state.children;un(r)}}function Ic(n){un(n.shapes);for(let e of n.library??[])if(e.kind==="symbol"){un(e.shapes);for(let t of Object.values(e.variants??{}))un(t)}else e.kind==="marker"&&un(e.shapes);return n.schemaVersion=3,n}function ws(n){let e=n;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 Mc(n,e){let t=n.translateX??0,r=n.translateY??0,i=typeof n.rawTransform=="string"?n.rawTransform:"",s=_e(t,r);if(i)return Ye(ne(s,ir(i)));let o=n.rotation??0,a=n.skewX??0,l=n.skewY??0;if(o!==0||a!==0||l!==0){let d=ws(n.customPivot)??e??ws(n.scaleAnchor);d&&(s=ne(s,_e(d.x,d.y)),o!==0&&(s=ne(s,Rt(o))),a!==0&&(s=ne(s,an(a))),l!==0&&(s=ne(s,on(l))),s=ne(s,_e(-d.x,-d.y)))}let c=n.scaleX??1,f=n.scaleY??1;if(c!==1||f!==1){let d=ws(n.scaleAnchor)??e;d&&(s=ne(s,_e(d.x,d.y)),s=ne(s,sn(c,f)),s=ne(s,_e(-d.x,-d.y)))}return Ye(s)}function cn(n){if(Array.isArray(n))for(let e of n){let t=e.state;"scaleAnchor"in t&&(e.type==="text"&&!_t(t.transformMatrix)&&(t.transformMatrix=Mc(t,qo(t))),delete t.scaleAnchor);let r=e.state.children;cn(r)}}function Cc(n){cn(n.shapes);for(let e of n.library??[])if(e.kind==="symbol"){cn(e.shapes);for(let t of Object.values(e.variants??{}))cn(t)}else e.kind==="marker"&&cn(e.shapes);return n.schemaVersion=4,n}function Dc(n){let e=Array.isArray(n.library)?[...n.library]:[],t=new Set(e.map(l=>l.id));if(Array.isArray(n.symbols))for(let l of n.symbols)!l||t.has(l.id)||(e.push({...l,kind:"symbol"}),t.add(l.id));if(Array.isArray(n.markers))for(let l of n.markers)!l||t.has(l.id)||(e.push({...l,kind:"marker"}),t.add(l.id));let r=new Map,i=(l,c)=>{let{id:f,sourceId:d,...p}=l,m=JSON.stringify({kind:c,...p}),h=r.get(m);if(h)return h;let g=t.has(l.id)?`grd-${sr()}`:l.id;t.add(g),r.set(m,g);let b=c==="linear-gradient"?{kind:"linear-gradient",id:g,name:l.sourceId??g,sourceId:l.sourceId,gradient:Xo(l)}:{kind:"radial-gradient",id:g,name:l.sourceId??g,sourceId:l.sourceId,gradient:Xo(l)};return e.push(b),g},s=new Map;if(Array.isArray(n.customPatterns))for(let l of n.customPatterns){if(!l)continue;let c=t.has(l.id)?`pat-${sr()}`:l.id;t.add(c),s.set(l.id,c),e.push(Ue(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}),h=r.get(m);if(h)return h;let g=t.has(l.id)?`pat-${sr()}`:l.id;t.add(g),r.set(m,g);let b={kind:"pattern",id:g,name:l.sourceId??g,sourceId:l.sourceId,pattern:p};return e.push(b),g};for(let l of n.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 n.library=e,n;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=r.get(p);if(m)return m;let h=`filter-${f}`,g=t.has(h)?`flt-${sr()}`:h;t.add(g),r.set(p,g);let b={kind:"filter",id:g,name:g,filters:d.filters,...d.colorInterpolation?{colorInterpolation:d.colorInterpolation}:{},...d.filterUnits?{filterUnits:d.filterUnits}:{},...d.primitiveUnits?{primitiveUnits:d.primitiveUnits}:{},...d.x!==void 0?{x:d.x}:{},...d.y!==void 0?{y:d.y}:{},...d.width!==void 0?{width:d.width}:{},...d.height!==void 0?{height:d.height}:{}};return e.push(b),g}}function Xo(n){let{id:e,sourceId:t,...r}=n;return r}var Ps=0;function sr(){return Ps=Ps+1&65535,`${Date.now().toString(36)}-${Ps.toString(36)}`}function Fc(n){let e=t=>{if(Array.isArray(t))for(let r of t)nt(r)};e(n.shapes);for(let t of n.library??[])if(t.kind==="symbol"){e(t.shapes);for(let r of Object.values(t.variants??{}))e(r)}else t.kind==="marker"&&e(t.shapes);return n.schemaVersion=5,n}function Yo(n){if(!n||typeof n!="object"||Array.isArray(n))return;let e=n;if(e.richTextRuns!==void 0&&e.richTextRuns!==null)return;let t=e.richTextData;!t||typeof t!="object"||Array.isArray(t)||Array.isArray(t.lines)&&(e.richTextRuns=at(t))}function Zo(n){if(!n?.state||typeof n.state!="object")return;let e=n.state,t=e.children;if(Array.isArray(t))for(let i of t)Zo(i);let r=e.symbolOverrides;if(r&&typeof r=="object"&&!Array.isArray(r))for(let i of Object.values(r))Yo(i);Yo(e)}function Ec(n){let e=t=>{if(Array.isArray(t))for(let r of t)Zo(r)};e(n.shapes);for(let t of n.library??[])if(t.kind==="symbol"){e(t.shapes);for(let r of Object.values(t.variants??{}))e(r)}else t.kind==="marker"&&e(t.shapes);return n.schemaVersion=6,n}var _s=Object.freeze({1:Dc,2:Ic,3:Cc,4:Fc,5:Ec});function Oc(n){let e=n.schemaVersion;return typeof e!="number"||!Number.isFinite(e)||e<1?1:Math.floor(e)}function ar(n,e=_s){let t=JSON.parse(JSON.stringify(n)),r=Oc(t);if(r>xe)return t;if(r===xe)return t.schemaVersion=xe,t;for(;r<xe;){let i=e[r];if(!i)throw new Error(`[svgsketch/core] No migration registered for schema version ${r} \u2192 ${r+1}. Cannot safely upgrade this document to version ${xe}.`);t=i(t),r+=1}return t.schemaVersion=xe,t}function dt(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}async function As(n,e,t,r){let i=n[e];typeof i=="string"&&(n[e]=await r(i,t))}async function Rs(n,e){dt(n)&&await As(n,"svgContent","svgMarkup",e)}async function or(n,e){if(!dt(n))return;await As(n,"href","href",e),await Rs(n.fillGradient,e),await Rs(n.strokeGradient,e);let t=n.children;if(Array.isArray(t))for(let r of t)dt(r)&&await or(r.state,e)}async function Jo(n,e){if(!dt(n))return;let t=n.shapes;if(Array.isArray(t))for(let s of t)dt(s)&&await or(s.state,e);let r=n.library;if(Array.isArray(r))for(let s of r)dt(s)&&s.kind==="pattern"&&await Rs(s.pattern,e);let i=n.customPatterns;if(Array.isArray(i))for(let s of i)dt(s)&&await As(s,"svgContent","svgMarkup",e)}var Lc=new Set(["circle","rectangle","square","ellipse","text","triangle","ngon","star","cross","ring","spiral","gear","arrow","line","path","polyline","image"]);function dn(n){let e=[],t=[];if(n==null||typeof n!="object")return e.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:e,warnings:t};let r=n;if(r.schemaVersion!==void 0&&(typeof r.schemaVersion!="number"||!Number.isInteger(r.schemaVersion)?e.push({path:"schemaVersion",message:"schemaVersion must be an integer",severity:"error"}):r.schemaVersion>xe&&t.push({path:"schemaVersion",message:`schemaVersion ${r.schemaVersion} is newer than supported (${xe})`,severity:"warning"})),!Array.isArray(r.shapes))e.push({path:"shapes",message:"shapes must be an array",severity:"error"});else{let i=new Set;r.shapes.forEach((s,o)=>{Vc(s,`shapes[${o}]`,e,t,i)})}if(!Array.isArray(r.viewboxes))e.push({path:"viewboxes",message:"viewboxes must be an array",severity:"error"});else{let i=new Set;r.viewboxes.forEach((s,o)=>{Hc(s,`viewboxes[${o}]`,e,t,i)})}if(r.guides!==void 0&&(Array.isArray(r.guides)?r.guides.forEach((i,s)=>{jc(i,`guides[${s}]`,e,t)}):e.push({path:"guides",message:"guides must be an array",severity:"error"})),r.groups!==void 0&&(Array.isArray(r.groups)?r.groups.forEach((i,s)=>{Kc(i,`groups[${s}]`,e)}):e.push({path:"groups",message:"groups must be an array",severity:"error"})),r.sceneTree!==void 0)if(!Array.isArray(r.sceneTree))e.push({path:"sceneTree",message:"sceneTree must be an array",severity:"error"});else{let i=Nc(r.shapes),s=new Set;r.sceneTree.forEach((o,a)=>{Bc(o,`sceneTree[${a}]`,e,t,i,s)})}if(r.clipMaskGroups!==void 0&&(Array.isArray(r.clipMaskGroups)?r.clipMaskGroups.forEach((i,s)=>{Xc(i,`clipMaskGroups[${s}]`,e)}):e.push({path:"clipMaskGroups",message:"clipMaskGroups must be an array",severity:"error"})),r.paintServerDefs!==void 0)if(!Array.isArray(r.paintServerDefs))e.push({path:"paintServerDefs",message:"paintServerDefs must be an array",severity:"error"});else{let i=new Set;r.paintServerDefs.forEach((s,o)=>{Gc(s,`paintServerDefs[${o}]`,e,i)})}return r.measurements!==void 0&&(Array.isArray(r.measurements)||e.push({path:"measurements",message:"measurements must be an array",severity:"error"})),{valid:e.length===0,errors:e,warnings:t}}function Nc(n){let e=new Set;if(!Array.isArray(n))return e;let t=r=>{if(r===null||typeof r!="object")return;let i=r;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)t(a)};for(let r of n)t(r);return e}function Qo(n){return n.startsWith("structural:")}function Bc(n,e,t,r,i,s){if(n===null||typeof n!="object"){t.push({path:e,message:"Scene tree entry must be a non-null object",severity:"error"});return}let o=n;typeof o.id!="string"||o.id.length===0?t.push({path:`${e}.id`,message:"Scene tree id must be a non-empty string",severity:"error"}):(s.has(o.id)&&t.push({path:`${e}.id`,message:`Duplicate scene tree id: "${o.id}"`,severity:"error"}),s.add(o.id),!i.has(o.id)&&!Qo(o.id)&&r.push({path:`${e}.id`,message:`Scene tree id "${o.id}" is not present in shapes`,severity:"warning"})),o.parentId!==null&&typeof o.parentId!="string"?t.push({path:`${e}.parentId`,message:"Scene tree parentId must be a string or null",severity:"error"}):typeof o.parentId=="string"&&!i.has(o.parentId)&&!Qo(o.parentId)&&r.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)&&t.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)&&t.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"&&t.push({path:`${e}.clientId`,message:"Scene tree clientId must be a string",severity:"error"})}var zc=new Set(["mask","clipPath","filter","linearGradient","radialGradient","pattern","symbol"]);function Gc(n,e,t,r){if(n===null||typeof n!="object"){t.push({path:e,message:"Paint server def must be a non-null object",severity:"error"});return}let i=n;typeof i.id!="string"||i.id.length===0?t.push({path:`${e}.id`,message:"Paint server def id must be a non-empty string",severity:"error"}):r.has(i.id)?t.push({path:`${e}.id`,message:`Duplicate paint server def id: "${i.id}"`,severity:"error"}):r.add(i.id),(typeof i.type!="string"||!zc.has(i.type))&&t.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)&&t.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"&&t.push({path:`${e}.passthrough`,message:"Paint server def passthrough must be a boolean when present",severity:"error"})}function Vc(n,e,t,r,i){if(n===null||typeof n!="object"){t.push({path:e,message:"Shape must be a non-null object",severity:"error"});return}let s=n;typeof s.id!="string"||s.id.length===0?t.push({path:`${e}.id`,message:"Shape id must be a non-empty string",severity:"error"}):i.has(s.id)?t.push({path:`${e}.id`,message:`Duplicate shape id: "${s.id}"`,severity:"error"}):i.add(s.id),typeof s.type!="string"?t.push({path:`${e}.type`,message:"Shape type must be a string",severity:"error"}):Lc.has(s.type)||r.push({path:`${e}.type`,message:`Unknown shape type: "${s.type}"`,severity:"warning"}),s.state===void 0||s.state===null||typeof s.state!="object"?t.push({path:`${e}.state`,message:"Shape state must be a non-null object",severity:"error"}):Wc(s.state,`${e}.state`,t,r)}var Uc=/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/;function el(n){return typeof n=="number"?isFinite(n):typeof n=="string"?Uc.test(n):!1}function Wc(n,e,t,r){let i=["x","y","width","height","radius","rx","ry","fontSize"];for(let o of i)n[o]!==void 0&&!el(n[o])&&t.push({path:`${e}.${o}`,message:`${o} must be a finite number or a {{variable}} reference`,severity:"error"});for(let o of Bt){let a=n[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)))&&t.push({path:`${e}.${o}`,message:`${o} must be a 6-element finite affine matrix`,severity:"error"});continue}el(a)||t.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=n[o];typeof a=="number"&&a<=0&&r.push({path:`${e}.${o}`,message:`${o} should be positive (got ${a})`,severity:"warning"})}}function Hc(n,e,t,r,i){if(n===null||typeof n!="object"){t.push({path:e,message:"Viewbox must be a non-null object",severity:"error"});return}let s=n;typeof s.id!="string"||s.id.length===0?t.push({path:`${e}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):i.has(s.id)?t.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]))&&t.push({path:`${e}.${o}`,message:`${o} must be a finite number`,severity:"error"});typeof s.width=="number"&&s.width<=0&&t.push({path:`${e}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof s.height=="number"&&s.height<=0&&t.push({path:`${e}.height`,message:"Viewbox height must be positive",severity:"error"})}function jc(n,e,t,r){if(n===null||typeof n!="object"){t.push({path:e,message:"Guide must be a non-null object",severity:"error"});return}let i=n;(typeof i.id!="string"||i.id.length===0)&&t.push({path:`${e}.id`,message:"Guide id must be a non-empty string",severity:"error"}),i.orientation!=="horizontal"&&i.orientation!=="vertical"&&t.push({path:`${e}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof i.position!="number"||!isFinite(i.position))&&t.push({path:`${e}.position`,message:"Guide position must be a finite number",severity:"error"})}function Kc(n,e,t){if(n===null||typeof n!="object"){t.push({path:e,message:"Group must be a non-null object",severity:"error"});return}let r=n;(typeof r.id!="string"||r.id.length===0)&&t.push({path:`${e}.id`,message:"Group id must be a non-empty string",severity:"error"}),r.parentId!==null&&typeof r.parentId!="string"&&t.push({path:`${e}.parentId`,message:"Group parentId must be a string or null",severity:"error"})}function Xc(n,e,t){if(n===null||typeof n!="object"){t.push({path:e,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let r=n;(typeof r.id!="string"||r.id.length===0)&&t.push({path:`${e}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),r.type!=="clip"&&r.type!=="mask"&&t.push({path:`${e}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),(typeof r.clipShapeId!="string"||r.clipShapeId.length===0)&&t.push({path:`${e}.clipShapeId`,message:"clipShapeId must be a non-empty string",severity:"error"}),Array.isArray(r.contentShapeIds)||t.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 lr(n={}){let e={schemaVersion:xe,shapes:n.shapes?n.shapes.map(t=>({...t})):[],viewboxes:n.viewboxes?n.viewboxes.map(t=>({...t})):[]};return n.metadata&&(e.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...n.metadata}),e}function tl(n){let{type:e,id:t,...r}=n,i={};for(let[s,o]of Object.entries(r))o!==void 0&&(i[s]=o);return{id:t??_(),type:e,state:i}}function fn(n,e,t,r,i){return{id:i??_(),x:n,y:e,width:t,height:r}}var Yc=["schemaVersion","documentMetadata","documentScripts","documentStyles","templateVariables","viewboxes","guides","measurements","groups","sceneTree","clipMaskGroups","customPatterns","symbols","markers","library","colorGlyphLibrary","paintServerDefs","rawPaintServerDefs","animationTimeline","shapes"];function ur(n,e={}){let{indent:t=2,trailingNewline:r=!0,validate:i=!1}=e;if(i){let a=dn(n);if(!a.valid){let l=a.errors.map(c=>` ${c.path}: ${c.message}`).join(`
|
|
7
7
|
`);throw new Error(`Invalid document:
|
|
8
|
-
${l}`)}}let s={};for(let a of
|
|
9
|
-
`:o}function
|
|
8
|
+
${l}`)}}let s={};for(let a of Yc){let l=n[a];if(l!==void 0)switch(a){case"shapes":s[a]=l.map(c=>Zc(nt(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:qc(l).map(ft);break;case"documentMetadata":s[a]=ft(l);break;case"animationTimeline":s[a]=ft(l);break;case"colorGlyphLibrary":s[a]=ft(l);break;default:s[a]=l}}let o=JSON.stringify(s,null,t);return r?o+`
|
|
9
|
+
`:o}function cr(n,e={}){let{validate:t=!0,migrate:r=!0}=e,i;try{i=JSON.parse(n)}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(r&&(s=ar(s)),t){let o=dn(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 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
|
|
15
|
-
`)}var
|
|
16
|
-
`)}function
|
|
11
|
+
${a}`)}}return s}function qc(n){return[...n].sort((e,t)=>e.id.localeCompare(t.id))}function ft(n){if(n==null)return n;if(Array.isArray(n))return n.map(ft);if(typeof n!="object")return n;let e={},t=Object.keys(n).sort();for(let r of t)e[r]=ft(n[r]);return e}function Zc(n){let e={};return e.id=n.id,e.type=n.type,e.state=ft(n.state),e}var Re=/\{\{\s*([\w.\-]+)\s*\}\}/g;function dr(n,e){return n.replace(Re,(t,r)=>{let i=e[r];return i!==void 0?String(i):t})}function mr(n,e={}){let t={};if(n.templateVariables)for(let i of n.templateVariables)i.defaultValue!==void 0&&i.defaultValue!==""&&(t[i.name]=i.defaultValue);if(Object.assign(t,e),Object.keys(t).length===0)return JSON.parse(JSON.stringify(n));let r=JSON.parse(JSON.stringify(n));for(let i of r.shapes)fr(i.state,t);if(r.documentMetadata){let i=r.documentMetadata;fr(i,t)}return r}function fr(n,e){for(let t of Object.keys(n)){let r=n[t];if(typeof r=="string"){if(Re.lastIndex=0,Re.test(r)){Re.lastIndex=0;let i=dr(r,e);if(Jc(r)){let s=Number(i);if(!isNaN(s)&&ed(t)){n[t]=s;continue}}n[t]=i}}else if(Array.isArray(r))for(let i=0;i<r.length;i++)typeof r[i]=="string"?(Re.lastIndex=0,Re.test(r[i])&&(Re.lastIndex=0,r[i]=dr(r[i],e))):r[i]!==null&&typeof r[i]=="object"&&fr(r[i],e);else r!==null&&typeof r=="object"&&fr(r,e)}}function Jc(n){return/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/.test(n)}var Qc=new Set(["x","y","width","height","radius","rx","ry","cx","cy","x1","y1","x2","y2","fontSize","borderWidth","cornerRadius","opacity","fillOpacity","strokeOpacity",...Bt,"letterSpacing","wordSpacing","lineHeight","sides","arms","innerRadiusPercent","armWidthPercent","teeth","toothDepthPercent","holeRadiusPercent","turns","thicknessPercent","direction","headWidthPercent","headLengthPercent","shaftWidthPercent","shiftAngle","dashLength","gapLength","textPathStartOffset","imageOpacity"]);function ed(n){return Qc.has(n)}function hr(n){let e=n.templateVariables??[],t=new Set(e.map(s=>s.name)),r=new Set;for(let s of n.shapes)pr(s.state,r);n.documentMetadata&&pr(n.documentMetadata,r);let i=[...r].filter(s=>!t.has(s)).sort();return{defined:[...e],undeclared:i}}function pr(n,e){for(let t of Object.values(n))if(typeof t=="string"){let r;for(Re.lastIndex=0;(r=Re.exec(t))!==null;)e.add(r[1])}else if(Array.isArray(t))for(let r of t)if(typeof r=="string"){let i;for(Re.lastIndex=0;(i=Re.exec(r))!==null;)e.add(i[1])}else r!==null&&typeof r=="object"&&pr(r,e);else t!==null&&typeof t=="object"&&pr(t,e)}function nl(n){let e={};for(let t of n){let r=t.indexOf("=");if(r===-1)throw new Error(`Invalid variable format: "${t}". Expected "name=value".`);let i=t.slice(0,r).trim(),s=t.slice(r+1);if(!i)throw new Error(`Invalid variable format: "${t}". Variable name cannot be empty.`);e[i]=s}return e}var rl=3,il=12;function sl(n){return n==null||!Number.isFinite(n)?3:n<0?0:n>12?12:Math.floor(n)}function yr(n,e){if(!Number.isFinite(n))return n;let t=Math.pow(10,e);return Math.round(n*t)/t}var td=/-?\d+(?:\.\d+)?(?:[eE][-+]?\d+)?/g;function Is(n,e){return n.replace(td,t=>{let r=parseFloat(t);return Number.isFinite(r)?String(yr(r,e)):t})}var nd=new Set(["rawTransform","strokeDasharray","filterX","filterY","filterWidth","filterHeight","cssClipPath"]),rd=new Set(["metadata","customMetadata","customAttrs","customData","bindings","richTextRuns","richTextData","cssMaskProperties","rawMetadata"]);function De(n,e,t){if(e==null)return e;if(typeof e=="number")return yr(e,t);if(typeof e=="string")return nd.has(n)?Is(e,t):e;if(typeof e=="boolean")return e;if(Array.isArray(e))return e.map(r=>De(n,r,t));if(typeof e=="object"){if(rd.has(n))return e;if(n==="symbolOverrides"){let i={};for(let[s,o]of Object.entries(e))i[s]=De("state",o,t);return i}let r={};for(let[i,s]of Object.entries(e))r[i]=De(i,s,t);return r}return e}function gr(n,e){return{id:n.id,type:n.type,state:De("state",n.state,e)}}function al(n,e){let t={...n,shapes:n.shapes.map(r=>gr(r,e)),viewboxes:n.viewboxes.map(r=>De("viewbox",r,e))};return n.guides&&(t.guides=n.guides.map(r=>De("guide",r,e))),n.measurements&&(t.measurements=n.measurements.map(r=>De("measurement",r,e))),n.animationTimeline&&(t.animationTimeline=De("animationTimeline",n.animationTimeline,e)),n.symbols&&(t.symbols=n.symbols.map(r=>({...r,shapes:r.shapes.map(i=>gr(i,e))}))),n.markers&&(t.markers=n.markers.map(r=>De("marker",r,e))),n.customPatterns&&(t.customPatterns=n.customPatterns.map(r=>De("customPattern",r,e))),t}function mn(n,e,t=-90){let r=[],i=t*Math.PI/180;for(let s=0;s<n;s++){let o=i+s*2*Math.PI/n;r.push({x:e*Math.cos(o),y:e*Math.sin(o)})}return r}function Sr(n,e,t,r=-90){let i=[],s=e*(t/100),o=r*Math.PI/180;for(let a=0;a<n*2;a++){let l=o+a*Math.PI/n,c=a%2===0?e:s;i.push({x:c*Math.cos(l),y:c*Math.sin(l)})}return i}function xr(n,e,t=0){let r=n*(e/100)/2,i=[{x:-r,y:-n},{x:r,y:-n},{x:r,y:-r},{x:n,y:-r},{x:n,y:r},{x:r,y:r},{x:r,y:n},{x:-r,y:n},{x:-r,y:r},{x:-n,y:r},{x:-n,y:-r},{x:-r,y:-r}];if(t===0)return i;let s=Math.cos(t*Math.PI/180),o=Math.sin(t*Math.PI/180);return i.map(a=>({x:a.x*s-a.y*o,y:a.x*o+a.y*s}))}function $r(n,e,t,r,i=-90){let o=n*2*(t/100),a=n*(e/100),l=a*(r/100),c=[{x:n,y:0},{x:n-o,y:-a/2},{x:n-o,y:-l/2},{x:-n,y:-l/2},{x:-n,y:l/2},{x:n-o,y:l/2},{x:n-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 vr(n,e,t,r,i=0){let s=n,o=s*(t/100),a=s*(r/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),h=Math.max(p,m)||1,g={x:f*(s/h),y:d*(s/h)},b={x:g.x+f*o,y:g.y+d*o},$=Math.min(a,s-l),k=-s+l+$,S=s-l-$,x={x:-s,y:-s},v={x:s,y:-s},w={x:s,y:s},T={x:-s,y:s},P;if(p>=m&&f>0){let N=Math.max(k,Math.min(S,g.y)),B={x:s,y:N-l},D={x:s,y:N+l};P=[x,v,B,b,D,w,T]}else if(p>=m&&f<=0){let N=Math.max(k,Math.min(S,g.y)),B={x:-s,y:N+l},D={x:-s,y:N-l};P=[x,v,w,T,B,b,D]}else if(d<0){let N=Math.max(k,Math.min(S,g.x)),B={x:N-l,y:-s},D={x:N+l,y:-s};P=[x,B,b,D,v,w,T]}else{let N=Math.max(k,Math.min(S,g.x)),B={x:N+l,y:s},D={x:N-l,y:s};P=[x,v,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 kr(n,e,t,r,i=0){let s=Math.max(2,Math.round(e)),o=n*(t/100),a=n*(r/100)/2,l=s+1,c=[];for(let g=0;g<l;g++){let b=g/(l-1),$=-n+b*2*n,k=0;g>0&&g<l-1&&(k=g%2===1?o:-o),c.push({x:k,y:$})}let f=[],d=[];for(let g=0;g<l;g++){if(g===0||g===l-1){f.push({...c[g]}),d.push({...c[g]});continue}let b=c[g-1],$=c[g],k=c[g+1],S=$.x-b.x,x=$.y-b.y,v=Math.hypot(S,x)||1,w=S/v,T=x/v,P=k.x-$.x,R=k.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,re;K<1e-6?(C=-T,re=w):(C=-L/K,re=D/K),f.push({x:$.x-C*a,y:$.y-re*a}),d.push({x:$.x+C*a,y:$.y+re*a})}let p=[];p.push(f[0]);for(let g=1;g<l-1;g++)p.push(d[g]);p.push(f[l-1]);for(let g=l-2;g>=1;g--)p.push(f[g]);if(i===0)return p;let m=Math.cos(i*Math.PI/180),h=Math.sin(i*Math.PI/180);return p.map(g=>({x:g.x*m-g.y*h,y:g.x*h+g.y*m}))}function Tr(n,e,t,r=0){let i=n,s=Math.max(.3,Math.min(.9,e/100)),o=-i*(t/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],h=r===0?m:(()=>{let v=Math.cos(r*Math.PI/180),w=Math.sin(r*Math.PI/180);return m.map(T=>({x:T.x*v-T.y*w,y:T.x*w+T.y*v}))})(),[g,b,$,k,S,x]=h;return`M ${g.x} ${g.y} C ${b.x} ${b.y} ${$.x} ${$.y} ${k.x} ${k.y} C ${S.x} ${S.y} ${x.x} ${x.y} ${g.x} ${g.y} Z`}function wr(n,e,t,r=0){let i=Math.max(3,Math.round(e)),s=Math.max(.3,Math.min(1,t/100)),o=n,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)),h=c.map(T=>{let P=T.y/(l/2);return m*(1-f*P)});function g(T){let P=c[T],R=c[(T+1)%i],M=h[T],N=h[(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)),re=P.x+K/L*B,ee=P.y+K/L*D,Z=-D/L,me=B/L,q={x:re+Z*C,y:ee+me*C},W={x:re-Z*C,y:ee-me*C};return q.x*q.x+q.y*q.y>W.x*W.x+W.y*W.y?q:W}let b=[];for(let T=0;T<i;T++)b.push(g(T));let $=14,k=[];for(let T=0;T<i;T++){let P=c[T],R=h[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,re=B-K/2,ee={x:P.x+R*Math.cos(C),y:P.y+R*Math.sin(C)},Z={x:P.x+R*Math.cos(re),y:P.y+R*Math.sin(re)},q=ee.x*ee.x+ee.y*ee.y>Z.x*Z.x+Z.y*Z.y?L:-K;for(let W=0;W<$;W++){let fe=W/$,he=B+fe*q;k.push({x:P.x+R*Math.cos(he),y:P.y+R*Math.sin(he)})}}let S=0;for(let T of k){let P=Math.max(Math.abs(T.x),Math.abs(T.y));P>S&&(S=P)}if(S>0&&S!==o){let T=o/S;for(let P of k)P.x*=T,P.y*=T}let x=T=>{if(r===0)return T;let P=Math.cos(r*Math.PI/180),R=Math.sin(r*Math.PI/180);return{x:T.x*P-T.y*R,y:T.x*R+T.y*P}},v=k.map(x),w=`M ${v[0].x} ${v[0].y}`;for(let T=1;T<v.length;T++)w+=` L ${v[T].x} ${v[T].y}`;return w+=" Z",w}function Ae(n,e=0,t=0){if(n.length<3)return"";if(e<=0)return n.map((s,o)=>(o===0?"M":"L")+`${s.x},${s.y}`).join(" ")+" Z";let r=Math.min(e,t*.4),i="";for(let s=0;s<n.length;s++){let o=n[(s-1+n.length)%n.length],a=n[s],l=n[(s+1)%n.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(r,f/2),h=Math.min(r,p/2),g={x:a.x+c.x*m,y:a.y+c.y*m},b={x:a.x+d.x*h,y:a.y+d.y*h};i+=s===0?`M${g.x},${g.y}`:` L${g.x},${g.y}`,i+=` Q${a.x},${a.y} ${b.x},${b.y}`}return i+" Z"}function Pr(n,e,t="evenodd"){let r=n*(e/100),i=t==="nonzero"?1:0;return`M ${n} 0 A ${n} ${n} 0 1 1 ${-n} 0 A ${n} ${n} 0 1 1 ${n} 0 Z M ${r} 0 A ${r} ${r} 0 1 ${i} ${-r} 0 A ${r} ${r} 0 1 ${i} ${r} 0 Z`}function _r(n,e,t,r=1,i=0){let s=n*(t/100),a=Math.round(e*36),l=e*2*Math.PI,c=(n-s/2)/l,f=i*Math.PI/180,d=[],p=[];for(let g=0;g<=a;g++){let b=g/a,$=b*l*r+f,k=c*(b*l)+s/2,S=s/2;d.push({x:(k+S*.3)*Math.cos($),y:(k+S*.3)*Math.sin($)}),p.push({x:Math.max(0,k-S*.3)*Math.cos($),y:Math.max(0,k-S*.3)*Math.sin($)})}let m=`M ${d[0].x} ${d[0].y}`;for(let g=1;g<d.length;g++)m+=` L ${d[g].x} ${d[g].y}`;let h=p[p.length-1];m+=` L ${h.x} ${h.y}`;for(let g=p.length-2;g>=0;g--)m+=` L ${p[g].x} ${p[g].y}`;return m+=" Z",m}var id=.2;function Ds(n,e,t,r=0){let i=e*(t/100),s=e,o=e-i,a=2*Math.PI/n,l=a*id/2,c=a/4,f=r*Math.PI/180,d=[];for(let p=0;p<n;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 Rr(n,e,t,r=0,i=0,s="evenodd",o=0){let a=Ds(n,e,t,o),l=Math.min(r,e*.1),c=Ae(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 Ar(n,e,t,r,i,s="round",o="uniform",a){let l=Math.min(t,r)/2,c,f,d,p,m,h,g,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,h=a.shapeTR??s,g=a.shapeBR??s,b=a.shapeBL??s):(c=f=d=p=Math.min(i,l),m=h=g=b=s),!(s!=="round"||o==="non-uniform"||c>0&&m!=="round"||f>0&&h!=="round"||d>0&&g!=="round"||p>0&&b!=="round")&&c===f&&f===d&&d===p)return null;let k=`M${n+c},${e}`;return k+=` L${n+t-f},${e}`,k+=br(h,f,n+t,e,"tr"),k+=` L${n+t},${e+r-d}`,k+=br(g,d,n+t,e+r,"br"),k+=` L${n+p},${e+r}`,k+=br(b,p,n,e+r,"bl"),k+=` L${n},${e+c}`,k+=br(m,c,n,e,"tl"),k+=" Z",k}function br(n,e,t,r,i){if(e<=0)return"";switch(n){case"round":switch(i){case"tr":return` A${e},${e} 0 0 1 ${t},${r+e}`;case"br":return` A${e},${e} 0 0 1 ${t-e},${r}`;case"bl":return` A${e},${e} 0 0 1 ${t},${r-e}`;case"tl":return` A${e},${e} 0 0 1 ${t+e},${r}`}break;case"scoop":switch(i){case"tr":return` A${e},${e} 0 0 0 ${t},${r+e}`;case"br":return` A${e},${e} 0 0 0 ${t-e},${r}`;case"bl":return` A${e},${e} 0 0 0 ${t},${r-e}`;case"tl":return` A${e},${e} 0 0 0 ${t+e},${r}`}break;case"bevel":switch(i){case"tr":return` L${t},${r+e}`;case"br":return` L${t-e},${r}`;case"bl":return` L${t},${r-e}`;case"tl":return` L${t+e},${r}`}break;case"notch":switch(i){case"tr":return` L${t-e},${r+e} L${t},${r+e}`;case"br":return` L${t-e},${r-e} L${t-e},${r}`;case"bl":return` L${t+e},${r-e} L${t},${r-e}`;case"tl":return` L${t+e},${r+e} L${t+e},${r}`}break}return""}function Ir(n,e,t,r,i,s={}){let o=e+r/2,a=t+i/2;switch(n){case"diamond":return`M${o},${t} L${e+r},${a} L${o},${t+i} L${e},${a} Z`;case"parallelogram":{let l=(s.slantPercent??20)/100*r;return`M${e+l},${t} L${e+r},${t} L${e+r-l},${t+i} L${e},${t+i} Z`}case"trapezoid":{let l=(s.topWidthPercent??70)/100*r,c=(r-l)/2;return`M${e+c},${t} L${e+c+l},${t} L${e+r},${t+i} L${e},${t+i} Z`}case"terminator":{let l=i/2;return`M${e+l},${t} L${e+r-l},${t} A${l},${l} 0 0 1 ${e+r-l},${t+i} L${e+l},${t+i} A${l},${l} 0 0 1 ${e+l},${t} Z`}case"cylinder":{let l=r/2,c=Math.min((s.capHeightPercent??15)/100*i,i/2);return`M${e},${t+c} A${l},${c} 0 0 1 ${e+r},${t+c} A${l},${c} 0 0 1 ${e},${t+c} L${e},${t+i-c} A${l},${c} 0 0 0 ${e+r},${t+i-c} L${e+r},${t+c} M${o-l},${t+c} A${l},${c} 0 0 0 ${o+l},${t+c}`}case"document-shape":{let l=(s.waveAmplitudePercent??15)/100*i;return`M${e},${t} L${e+r},${t} L${e+r},${t+i} C${e+r*.75},${t+i-l*2} ${o+r*.25},${t+i+l} ${o},${t+i} C${o-r*.25},${t+i-l} ${e+r*.25},${t+i+l*.5} ${e},${t+i} Z`}}}function qe(n,e,t=!1,r=.5,i){if(n.length<2)return n.length===1?`M ${n[0].x} ${n[0].y}`:"";switch(e){case"CATMULL_ROM":case"catmull-rom":return ld(n,t,r);case"BASIS":case"basis":return ud(n,t);case"ARC":case"arc":return i&&i.length>0?sd(n,t,i):pn(n,t,"CUBIC");case"LINEAR":case"linear":return pn(n,t,"LINEAR");case"QUADRATIC":case"quadratic":return pn(n,t,"QUADRATIC");case"CUBIC":case"cubic":return pn(n,t,"CUBIC");default:return pn(n,t)}}function sd(n,e,t){let r=`M ${n[0].x} ${n[0].y}`,i=0,s={rx:50,ry:50,rotation:0,largeArc:!1,sweep:!0};for(let o=0;o<n.length-1;o++){let a=n[o+1];if(a.isSubpathStart){if(e&&o-i>=1){let c=n[i],f=t?.[o]??s;r+=` A ${f.rx} ${f.ry} ${f.rotation} ${f.largeArc?1:0} ${f.sweep?1:0} ${c.x} ${c.y} Z`}r+=` M ${a.x} ${a.y}`,i=o+1;continue}let l=t?.[o]??s;r+=` A ${l.rx} ${l.ry} ${l.rotation} ${l.largeArc?1:0} ${l.sweep?1:0} ${a.x} ${a.y}`}if(e&&n.length-i>1){let o=n[i],a=t?.[n.length-1]??s;r+=` A ${a.rx} ${a.ry} ${a.rotation} ${a.largeArc?1:0} ${a.sweep?1:0} ${o.x} ${o.y} Z`}return r}function pn(n,e,t){let r=`M ${n[0].x} ${n[0].y}`,i=0,s=null,o=null;for(let a=0;a<n.length-1;a++){let l=n[a],c=n[a+1];if(c.isSubpathStart){if(e&&a-i>=1){let d=n[i];r+=Ms(l,d,d.segmentType,s,o,t),r+=" Z"}r+=` M ${c.x} ${c.y}`,i=a+1,s=null,o=null;continue}r+=Ms(l,c,c.segmentType,s,o,t);let f=od(c.segmentType??t,l,c);s=f,f==="quad"?o=l.handleOut??null:o=null}if(e&&n.length-i>1){let a=n[n.length-1],l=n[i],c=(l.segmentType??t??(a.handleOut||l.handleIn?"CUBIC":"LINEAR")).toUpperCase();c==="LINEAR"||c==="HORIZONTAL"||c==="VERTICAL"||(r+=Ms(a,l,l.segmentType,s,o,t)),r+=" Z"}return r}var ad=.001;function It(n,e){return Math.abs(n-e)<ad}function od(n,e,t){let r=(n??(e.handleOut||t.handleIn?"CUBIC":"LINEAR")).toUpperCase();return r==="CUBIC"||r==="SMOOTH_CUBIC"?"cubic":r==="QUADRATIC"||r==="SMOOTH_QUADRATIC"?"quad":null}function Ms(n,e,t,r,i,s){let o=(t??s??(n.handleOut||e.handleIn?"CUBIC":"LINEAR")).toUpperCase();if(o==="LINEAR"||o==="HORIZONTAL"||o==="VERTICAL")return(o==="HORIZONTAL"||o==="LINEAR")&&It(n.y,e.y)?` H ${e.x}`:(o==="VERTICAL"||o==="LINEAR")&&It(n.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=n.handleOut??{x:(n.x+e.x)/2,y:(n.y+e.y)/2};return r==="quad"&&i&&It(c.x,2*n.x-i.x)&&It(c.y,2*n.y-i.y)?` T ${e.x} ${e.y}`:` Q ${c.x} ${c.y} ${e.x} ${e.y}`}let a=n.handleOut??{x:n.x,y:n.y},l=e.handleIn??{x:e.x,y:e.y};return r==="cubic"&&n.handleIn&&n.handleOut&&It(n.handleOut.x,2*n.x-n.handleIn.x)&&It(n.handleOut.y,2*n.y-n.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 ld(n,e,t){if(n.length<2)return n.length===1?`M ${n[0].x} ${n[0].y}`:"";let r=t,i=e?[n[n.length-1],...n,n[0],n[1]]:[n[0],...n,n[n.length-1]],s=`M ${n[0].x} ${n[0].y}`,o=e?n.length:n.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),h=Math.hypot(d.x-f.x,d.y-f.y),g=Math.pow(m,r),b=Math.pow(p,r),$=Math.pow(h,r),k=Math.pow(m,2*r),S=Math.pow(p,2*r),x=Math.pow(h,2*r),v,w,T,P;m<1e-8?(v=c.x,w=c.y):(v=(k*f.x-S*l.x+(2*k+3*g*b+S)*c.x)/(3*g*(g+b)),w=(k*f.y-S*l.y+(2*k+3*g*b+S)*c.y)/(3*g*(g+b))),h<1e-8?(T=f.x,P=f.y):(T=(x*c.x-S*d.x+(2*x+3*$*b+S)*f.x)/(3*$*($+b)),P=(x*c.y-S*d.y+(2*x+3*$*b+S)*f.y)/(3*$*($+b))),s+=` C ${v} ${w} ${T} ${P} ${f.x} ${f.y}`}return e&&(s+=" Z"),s}function ud(n,e){let t=n.length;if(t<2)return t===1?`M ${n[0].x} ${n[0].y}`:"";if(t===2)return`M ${n[0].x} ${n[0].y} L ${n[1].x} ${n[1].y}`;if(e){let s=(n[0].x+4*n[1].x+n[2].x)/6,o=(n[0].y+4*n[1].y+n[2].y)/6,a=`M ${s} ${o}`;for(let l=0;l<t;l++){let c=n[(l+1)%t],f=n[(l+2)%t],d=n[(l+3)%t];a+=Cs(c,f,d)}return a+=" Z",a}let r=n,i=`M ${r[0].x} ${r[0].y}`;i+=` L ${(5*r[0].x+r[1].x)/6} ${(5*r[0].y+r[1].y)/6}`;for(let s=0;s<=t-3;s++)i+=Cs(r[s],r[s+1],r[s+2]);return i+=Cs(r[t-2],r[t-1],r[t-1]),i+=` L ${r[t-1].x} ${r[t-1].y}`,i}function Cs(n,e,t){return` C ${(2*n.x+e.x)/3} ${(2*n.y+e.y)/3} ${(n.x+2*e.x)/3} ${(n.y+2*e.y)/3} ${(n.x+4*e.x+t.x)/6} ${(n.y+4*e.y+t.y)/6}`}function Mt(n,e,t){let r=Number.isFinite(e)?Math.max(1,e):8,i=Number.isFinite(t)?Math.max(1,t):4;switch(n){case"dashed":case"dotted":case"custom":return`${r} ${i}`;default:return null}}var cd=[["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 Y(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function dd(n){let e=n.fillType;return e||(n.fillGradient?n.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":n.linearGradient?"linear-gradient":n.radialGradient?"radial-gradient":"solid")}function Mr(n){let e=new Map,t=n.state,r=t;switch(n.type){case"circle":e.set("cx",String(t.x??0)),e.set("cy",String(t.y??0)),e.set("r",String(t.radius??50));break;case"ellipse":e.set("cx",String(t.cx??0)),e.set("cy",String(t.cy??0)),e.set("rx",String(t.rx??50)),e.set("ry",String(t.ry??30));break;case"rectangle":case"square":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),e.set("width",String(t.width??100)),e.set("height",String(t.height??100));{let x=t.rx??t.cornerRadius??0,v=t.ry??t.cornerRadius??0;(x>0||v>0)&&(e.set("rx",String(x)),e.set("ry",String(v)))}break;case"line":e.set("x1",String(t.x1??0)),e.set("y1",String(t.y1??0)),e.set("x2",String(t.x2??0)),e.set("y2",String(t.y2??0));break;case"text":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),t.fontSize&&e.set("font-size",String(t.fontSize)),t.fontFamily&&e.set("font-family",t.fontFamily),t.fontWeight&&e.set("font-weight",String(t.fontWeight)),t.fontStyle&&e.set("font-style",t.fontStyle),t.textAnchor&&e.set("text-anchor",t.textAnchor),t.letterSpacing&&e.set("letter-spacing",String(t.letterSpacing));{let x=cd.map(([v,w])=>{let T=typeof t[v]=="string"?String(t[v]).trim():"";return T?`${w}: ${T}`:""}).filter(Boolean).join("; ");x&&e.set("style",x)}break;case"image":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),e.set("width",String(t.width??100)),e.set("height",String(t.height??100)),r.href&&e.set("href",String(r.href));break}let i=dd(r);i==="none"?e.set("fill","none"):i==="linear-gradient"||i==="radial-gradient"?e.set("fill",`url(#gradient-fill-${n.id})`):i==="pattern"?e.set("fill",`url(#pattern-fill-${n.id})`):e.set("fill",t.fillColor??"#000000");let s=t.opacity;s!==void 0&&s<1&&e.set("opacity",String(s));let o=t.fillOpacity;o!==void 0&&o<1&&e.set("fill-opacity",String(o)),t.fillRule&&t.fillRule!=="nonzero"&&e.set("fill-rule",t.fillRule);let a=r.strokeType??"solid";if(a==="none")e.set("stroke","none");else if(a==="linear-gradient"||a==="radial-gradient")e.set("stroke",`url(#gradient-stroke-${n.id})`);else{let x=t.borderColor??"none";x!=="none"&&e.set("stroke",x)}let l=t.borderWidth;l!=null&&l!==0&&e.set("stroke-width",String(l));let c=t.strokeOpacity;c!==void 0&&c<1&&e.set("stroke-opacity",String(c));let f=t.lineStyle??"solid",d=t.dashLength??8,p=t.gapLength??4,m=Mt(f,d,p);m&&(e.set("stroke-dasharray",m),f==="dotted"&&e.set("stroke-linecap","round"));let h=fd(r);h&&e.set("transform",h);let g=r.filters;g&&g.length>0&&e.set("filter",`url(#filter-${n.id})`);let b=t.shapeRendering;b&&b!=="auto"&&e.set("shape-rendering",b),t.pathLength!==void 0&&e.set("pathLength",String(t.pathLength));let $=r.startEndpoint,k=r.endEndpoint;$&&$!=="none"&&e.set("marker-start",`url(#line-marker-${$})`),k&&k!=="none"&&e.set("marker-end",`url(#line-marker-${k})`);let S=r.metadata;return S&&(S.role&&e.set("role",S.role),S.ariaLabel&&e.set("aria-label",S.ariaLabel)),e}function ol(n){switch(n.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 fd(n){return At(n)}function Fe(n,e){let t=n.viewboxes?.[0];return{width:e.width??t?.width??800,height:e.height??t?.height??600}}function u(n,e){return e==null||e===""?"":` ${n}="${Y(String(e))}"`}function Dr(n){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);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 pd(n,e,t){let{offsetX:r,offsetY:i,blurRadius:s,spread:o,color:a,opacity:l}=n,c="";if(o===0)c+=`<feDropShadow${u("in",e)}${u("dx",r)}${u("dy",i)}${u("stdDeviation",s/2)}${u("flood-color",a)}${u("flood-opacity",l)}${u("result",`${t}_shadow`)}/>`,c+=`<feMerge${u("result",t)}><feMergeNode${u("in",`${t}_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",`${t}_alpha`)}/>`;let f=o>0?"dilate":"erode",d=Math.abs(o);c+=`<feMorphology${u("in",`${t}_alpha`)}${u("operator",f)}${u("radius",d)}${u("result",`${t}_spread`)}/>`,c+=`<feGaussianBlur${u("in",`${t}_spread`)}${u("stdDeviation",s/2)}${u("result",`${t}_blur`)}/>`,c+=`<feOffset${u("in",`${t}_blur`)}${u("dx",r)}${u("dy",i)}${u("result",`${t}_offset`)}/>`,c+=`<feFlood${u("flood-color",a)}${u("flood-opacity",l)}${u("result",`${t}_color`)}/>`,c+=`<feComposite${u("in",`${t}_color`)}${u("in2",`${t}_offset`)}${u("operator","in")}${u("result",`${t}_shadow`)}/>`,c+=`<feMerge${u("result",t)}><feMergeNode${u("in",`${t}_shadow`)}/><feMergeNode${u("in",e)}/></feMerge>`}return c}function md(n,e,t){let{offsetX:r,offsetY:i,blurRadius:s,choke:o,color:a,opacity:l}=n,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",`${t}_alpha`)}/>`,f+=`<feComponentTransfer${u("in",`${t}_alpha`)}${u("result",`${t}_inverted`)}><feFuncA${u("type","table")}${u("tableValues","1 0")}/></feComponentTransfer>`,f+=`<feGaussianBlur${u("in",`${t}_inverted`)}${u("stdDeviation",c/2)}${u("result",`${t}_blur`)}/>`,f+=`<feOffset${u("in",`${t}_blur`)}${u("dx",r)}${u("dy",i)}${u("result",`${t}_offset`)}/>`,f+=`<feFlood${u("flood-color",a)}${u("flood-opacity",l)}${u("result",`${t}_color`)}/>`,f+=`<feComposite${u("in",`${t}_color`)}${u("in2",`${t}_offset`)}${u("operator","in")}${u("result",`${t}_coloredShadow`)}/>`,f+=`<feComposite${u("in",`${t}_coloredShadow`)}${u("in2",`${t}_alpha`)}${u("operator","in")}${u("result",`${t}_innerShadow`)}/>`,f+=`<feComposite${u("in",`${t}_innerShadow`)}${u("in2",e)}${u("operator","over")}${u("result",t)}/>`,f}function hd(n,e,t){let{blurX:r,blurY:i}=n;return r===0&&i===0?H(e,t):`<feGaussianBlur${u("in",e)}${u("stdDeviation",`${r/2} ${i/2}`)}${u("result",t)}/>`}function gd(n,e,t){let{distance:r,angle:i}=n;if(r===0)return H(e,t);let s=i*Math.PI/180,o=Math.abs(Math.cos(s)*r),a=Math.abs(Math.sin(s)*r);return`<feGaussianBlur${u("in",e)}${u("stdDeviation",`${o/2} ${a/2}`)}${u("result",t)}/>`}function ll(n,e,t){let{x:r,y:i,z:s,color:o,surfaceScale:a,diffuseConstant:l,specularConstant:c,specularExponent:f}=n,d="";return d+=`<feDiffuseLighting${u("in","SourceAlpha")}${u("surfaceScale",a)}${u("diffuseConstant",l)}${u("lighting-color",o)}${u("result",`${t}_diffuse`)}>`,d+=`<fePointLight${u("x",r)}${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",`${t}_specular`)}>`,d+=`<fePointLight${u("x",r)}${u("y",i)}${u("z",s)}/>`,d+="</feSpecularLighting>",d+=`<feComposite${u("in",e)}${u("in2",`${t}_diffuse`)}${u("operator","arithmetic")}${u("k1",1)}${u("k2",0)}${u("k3",0)}${u("k4",0)}${u("result",`${t}_lit`)}/>`,d+=`<feComposite${u("in",`${t}_specular`)}${u("in2",`${t}_lit`)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",1)}${u("k3",1)}${u("k4",0)}${u("result",t)}/>`,d}function ul(n,e,t){let{x:r,y:i,z:s,pointsAtX:o,pointsAtY:a,pointsAtZ:l,coneAngle:c,color:f,surfaceScale:d,specularConstant:p,specularExponent:m}=n,h="";return h+=`<feSpecularLighting${u("in","SourceAlpha")}${u("surfaceScale",d)}${u("specularConstant",p)}${u("specularExponent",m)}${u("lighting-color",f)}${u("result",`${t}_specular`)}>`,h+=`<feSpotLight${u("x",r)}${u("y",i)}${u("z",s)}${u("pointsAtX",o)}${u("pointsAtY",a)}${u("pointsAtZ",l)}${u("limitingConeAngle",c)}/>`,h+="</feSpecularLighting>",h+=`<feComposite${u("in",`${t}_specular`)}${u("in2","SourceAlpha")}${u("operator","in")}${u("result",`${t}_clipped`)}/>`,h+=`<feComposite${u("in",`${t}_clipped`)}${u("in2",e)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",1)}${u("k3",1)}${u("k4",0)}${u("result",t)}/>`,h}function cl(n){switch(n.kind){case"point":return`<fePointLight${u("x",n.x)}${u("y",n.y)}${u("z",n.z)}/>`;case"spot":{let e=`<feSpotLight${u("x",n.x)}${u("y",n.y)}${u("z",n.z)}${u("pointsAtX",n.pointsAtX)}${u("pointsAtY",n.pointsAtY)}${u("pointsAtZ",n.pointsAtZ)}`;return n.limitingConeAngle!==void 0&&(e+=u("limitingConeAngle",n.limitingConeAngle)),n.specularExponent!==void 0&&(e+=u("specularExponent",n.specularExponent)),e+"/>"}case"distant":return`<feDistantLight${u("azimuth",n.azimuth)}${u("elevation",n.elevation)}/>`}}function yd(n,e,t){return`<feDiffuseLighting${u("in",e)}${u("surfaceScale",n.surfaceScale)}${u("diffuseConstant",n.diffuseConstant)}${u("lighting-color",n.color)}${u("result",t)}>`+cl(n.lightSource)+"</feDiffuseLighting>"}function bd(n,e,t){return`<feSpecularLighting${u("in",e)}${u("surfaceScale",n.surfaceScale)}${u("specularConstant",n.specularConstant)}${u("specularExponent",n.specularExponent)}${u("lighting-color",n.color)}${u("result",t)}>`+cl(n.lightSource)+"</feSpecularLighting>"}function Sd(n,e,t){let{width:r,color:i,opacity:s,position:o}=n,a="";if(o==="inside")a+=`<feMorphology${u("in","SourceAlpha")}${u("operator","erode")}${u("radius",r)}${u("result",`${t}_eroded`)}/>`,a+=`<feComposite${u("in","SourceAlpha")}${u("in2",`${t}_eroded`)}${u("operator","out")}${u("result",`${t}_outlineAlpha`)}/>`,a+=`<feFlood${u("flood-color",i)}${u("flood-opacity",s)}${u("result",`${t}_color`)}/>`,a+=`<feComposite${u("in",`${t}_color`)}${u("in2",`${t}_outlineAlpha`)}${u("operator","in")}${u("result",`${t}_outline`)}/>`,a+=`<feComposite${u("in",`${t}_outline`)}${u("in2",e)}${u("operator","over")}${u("result",t)}/>`;else{let l=o==="outside"?r:r/2;a+=`<feMorphology${u("in","SourceAlpha")}${u("operator","dilate")}${u("radius",l)}${u("result",`${t}_dilated`)}/>`,a+=`<feComposite${u("in",`${t}_dilated`)}${u("in2","SourceAlpha")}${u("operator","out")}${u("result",`${t}_outlineAlpha`)}/>`,a+=`<feFlood${u("flood-color",i)}${u("flood-opacity",s)}${u("result",`${t}_color`)}/>`,a+=`<feComposite${u("in",`${t}_color`)}${u("in2",`${t}_outlineAlpha`)}${u("operator","in")}${u("result",`${t}_outline`)}/>`,a+=`<feMerge${u("result",t)}><feMergeNode${u("in",`${t}_outline`)}/><feMergeNode${u("in",e)}/></feMerge>`}return a}function xd(n,e,t){let{amount:r}=n;if(r===0)return H(e,t);let i=1+4*r,s=-r,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",t)}/>`}function $d(n,e,t){let{blockSize:r}=n;if(r<=1)return H(e,t);let i=r/2,s="";return s+=`<feMorphology${u("in",e)}${u("operator","erode")}${u("radius",i)}${u("result",`${t}_eroded`)}/>`,s+=`<feMorphology${u("in",`${t}_eroded`)}${u("operator","dilate")}${u("radius",i)}${u("result",t)}/>`,s}function vd(n,e,t){let{scale:r,frequency:i,octaves:s,warpType:o}=n;if(r===0)return H(e,t);let a="";return a+=`<feTurbulence${u("type",o)}${u("baseFrequency",i)}${u("numOctaves",s)}${u("seed",0)}${u("result",`${t}_turbulence`)}/>`,a+=`<feDisplacementMap${u("in",e)}${u("in2",`${t}_turbulence`)}${u("scale",r)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",t)}/>`,a}function kd(n,e,t){let{operator:r,radiusX:i,radiusY:s}=n;return i===0&&s===0?H(e,t):`<feMorphology${u("in",e)}${u("operator",r)}${u("radius",`${i} ${s}`)}${u("result",t)}/>`}function Td(n,e,t){let{levels:r}=n;if(r<2)return H(e,t);let i=[];for(let a=0;a<r;a++)i.push(a/(r-1));let s=i.join(" "),o=`<feComponentTransfer${u("in",e)}${u("result",t)}>`;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 wd(n,e,t){let{levels:r,contrast:i}=n;if(r<2)return H(e,t);let s=[];for(let l=0;l<r;l++){let c=l/(r-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",t)}>`;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 Pd(n,e,t){let{radius:r}=n;if(r===0)return H(e,t);let i="";return i+=`<feGaussianBlur${u("in","SourceAlpha")}${u("stdDeviation",r)}${u("result",`${t}_blurredAlpha`)}/>`,i+=`<feComponentTransfer${u("in",`${t}_blurredAlpha`)}${u("result",`${t}_thresholdAlpha`)}><feFuncA${u("type","linear")}${u("slope",20)}${u("intercept",-9)}/></feComponentTransfer>`,i+=`<feComposite${u("in",e)}${u("in2",`${t}_thresholdAlpha`)}${u("operator","in")}${u("result",t)}/>`,i}function _d(n,e,t){let{amount:r}=n;if(r===0)return H(e,t);let i=1-r;return`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","saturate")}${u("values",i)}${u("result",t)}/>`}function Rd(n,e,t){let{red:r,green:i,blue:s}=n;if(r===1&&i===1&&s===1)return H(e,t);let o=`<feComponentTransfer${u("in",e)}${u("result",t)}>`;return o+=`<feFuncR${u("type","linear")}${u("slope",r)}${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 Ad(n,e,t){let{amount:r}=n;if(r===1)return H(e,t);let i=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",t)}>`;return i+=`<feFuncR${u("type","linear")}${u("slope",r)}${u("intercept",0)}/>`,i+=`<feFuncG${u("type","linear")}${u("slope",r)}${u("intercept",0)}/>`,i+=`<feFuncB${u("type","linear")}${u("slope",r)}${u("intercept",0)}/>`,i+="</feComponentTransfer>",i}function Id(n,e,t){let{amount:r}=n;if(r===1)return H(e,t);let i=.5*(1-r),s=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",t)}>`;return s+=`<feFuncR${u("type","linear")}${u("slope",r)}${u("intercept",i)}/>`,s+=`<feFuncG${u("type","linear")}${u("slope",r)}${u("intercept",i)}/>`,s+=`<feFuncB${u("type","linear")}${u("slope",r)}${u("intercept",i)}/>`,s+="</feComponentTransfer>",s}function Md(n,e,t){let{amount:r}=n;if(r===1)return H(e,t);let i=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",t)}>`;return i+=`<feFuncA${u("type","linear")}${u("slope",r)}${u("intercept",0)}/>`,i+="</feComponentTransfer>",i}function Cd(n,e,t){let{amount:r}=n;if(r===0)return H(e,t);let i=r,s=1-r,o=`${i} ${s}`,a=`<feComponentTransfer${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("result",t)}>`;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 Dd(n,e,t){let{angle:r}=n;return r===0||r===360?H(e,t):`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","hueRotate")}${u("values",r)}${u("result",t)}/>`}function Fd(n,e,t){let{amount:r}=n;return r===1?H(e,t):`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","saturate")}${u("values",r)}${u("result",t)}/>`}function Ed(n,e,t){let{threshold:r}=n,i="";if(i+=`<feColorMatrix${u("in",e)}${u("type","saturate")}${u("values",0)}${u("result",`${t}_gray`)}/>`,r===.5)i+=`<feComponentTransfer${u("in",`${t}_gray`)}${u("result",t)}>`,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<r?0:1);let a=o.join(" ");i+=`<feComponentTransfer${u("in",`${t}_gray`)}${u("result",t)}>`,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 Od(n,e,t){let{amount:r}=n;if(r===0)return H(e,t);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=(g,b)=>g.map(($,k)=>$*(1-r)+b[k]*r),d=f(a,i),p=f(l,s),m=f(c,o),h=[...d,...p,...m,0,0,0,1,0].join(" ");return`<feColorMatrix${u("color-interpolation-filters","sRGB")}${u("in",e)}${u("type","matrix")}${u("values",h)}${u("result",t)}/>`}function Ld(n,e,t){let{shadowColor:r,highlightColor:i}=n,s=Dr(r),o=Dr(i),a="";return a+=`<feColorMatrix${u("in",e)}${u("type","saturate")}${u("values",0)}${u("result",`${t}_gray`)}/>`,a+=`<feComponentTransfer${u("in",`${t}_gray`)}${u("result",t)}>`,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 Nd(n,e,t){let{intensity:r}=n;if(r===0)return H(e,t);let i="";i+=`<feComponentTransfer${u("in",e)}${u("result",`${t}_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",`${t}_invert`)}${u("type","saturate")}${u("values",0)}${u("result",`${t}_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((k,S)=>k*(1-r)+$[S]*r),p=d(l,s),m=d(c,o),h=d(f,a),g=[...p,...m,...h,0,0,0,1,0].join(" ");return i+=`<feColorMatrix${u("in",`${t}_gray`)}${u("type","matrix")}${u("values",g)}${u("result",t)}/>`,i}function Bd(n,e,t){let{amount:r,scale:i}=n;if(r===0)return H(e,t);let s=1/i,o="";return o+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",s)}${u("numOctaves",3)}${u("seed",0)}${u("result",`${t}_noise`)}/>`,o+=`<feColorMatrix${u("in",`${t}_noise`)}${u("type","saturate")}${u("values",0)}${u("result",`${t}_noiseGray`)}/>`,o+=`<feBlend${u("in",e)}${u("in2",`${t}_noiseGray`)}${u("mode","overlay")}${u("result",`${t}_blended`)}/>`,o+=`<feComposite${u("in",`${t}_blended`)}${u("in2",e)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",r)}${u("k3",1-r)}${u("k4",0)}${u("result",`${t}_amt`)}/>`,o+=`<feComposite${u("in",`${t}_amt`)}${u("in2",e)}${u("operator","in")}${u("result",t)}/>`,o}function zd(n,e,t){let{strength:r,angle:i}=n;if(r===0)return H(e,t);let s=i*Math.PI/180,o=Math.cos(s),a=Math.sin(s),l=r,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",t)}/>`}function Gd(n,e,t){let{amount:r,size:i}=n;if(r===0)return H(e,t);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",`${t}_grain`)}/>`,o+=`<feColorMatrix${u("in",`${t}_grain`)}${u("type","saturate")}${u("values",0)}${u("result",`${t}_grainGray`)}/>`,o+=`<feBlend${u("in",e)}${u("in2",`${t}_grainGray`)}${u("mode","soft-light")}${u("result",`${t}_blended`)}/>`,o+=`<feComposite${u("in",`${t}_blended`)}${u("in2",e)}${u("operator","arithmetic")}${u("k1",0)}${u("k2",r)}${u("k3",1-r)}${u("k4",0)}${u("result",`${t}_amt`)}/>`,o+=`<feComposite${u("in",`${t}_amt`)}${u("in2",e)}${u("operator","in")}${u("result",t)}/>`,o}function Vd(n,e,t){let{wetness:r,turbulence:i}=n;if(r===0&&i===0)return H(e,t);let s="";return s+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",.02+i*.03)}${u("numOctaves",4)}${u("seed",42)}${u("result",`${t}_turb`)}/>`,s+=`<feDisplacementMap${u("in",e)}${u("in2",`${t}_turb`)}${u("scale",r*15)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${t}_disp`)}/>`,s+=`<feGaussianBlur${u("in",`${t}_disp`)}${u("stdDeviation",r*2)}${u("result",`${t}_blur`)}/>`,s+=`<feBlend${u("in",`${t}_blur`)}${u("in2",e)}${u("mode","multiply")}${u("result",t)}/>`,s}function Ud(n,e,t){let{thickness:r,texture:i}=n;if(r===0&&i===0)return H(e,t);let s="";s+=`<feTurbulence${u("type","turbulence")}${u("baseFrequency",.03+i*.02)}${u("numOctaves",3)}${u("seed",1e3)}${u("result",`${t}_brush`)}/>`;let o=Math.max(3,8-Math.floor(r*5)),a=Array.from({length:o+1},(l,c)=>c/o).join(" ");s+=`<feComponentTransfer${u("in",e)}${u("result",`${t}_poster`)}>`;for(let l of["R","G","B"])s+=`<feFunc${l}${u("type","discrete")}${u("tableValues",a)}/>`;return s+="</feComponentTransfer>",s+=`<feDisplacementMap${u("in",`${t}_poster`)}${u("in2",`${t}_brush`)}${u("scale",i*4)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${t}_disp`)}/>`,s+=`<feMorphology${u("in",`${t}_disp`)}${u("operator","dilate")}${u("radius",r*.5)}${u("result",`${t}_thick`)}/>`,s+=`<feComposite${u("in",`${t}_thick`)}${u("in2",e)}${u("operator","in")}${u("result",t)}/>`,s}function Wd(n,e,t){let{spread:r,edges:i}=n;if(r===0&&i===0)return H(e,t);let s="";return s+=`<feTurbulence${u("type","fractalNoise")}${u("baseFrequency",.01+i*.02)}${u("numOctaves",5)}${u("seed",1100)}${u("result",`${t}_ink`)}/>`,s+=`<feMorphology${u("in",e)}${u("operator","dilate")}${u("radius",r*3)}${u("result",`${t}_dilate`)}/>`,s+=`<feDisplacementMap${u("in",`${t}_dilate`)}${u("in2",`${t}_ink`)}${u("scale",i*10)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${t}_disp`)}/>`,s+=`<feGaussianBlur${u("in",`${t}_disp`)}${u("stdDeviation",r*.5)}${u("result",t)}/>`,s}function Hd(n,e,t){let{wrinkles:r,shine:i}=n;if(r===0&&i===0)return H(e,t);let s="";return s+=`<feTurbulence${u("type","turbulence")}${u("baseFrequency",.02)}${u("numOctaves",4)}${u("seed",1200)}${u("result",`${t}_wrinkle`)}/>`,s+=`<feDisplacementMap${u("in",e)}${u("in2",`${t}_wrinkle`)}${u("scale",r*15)}${u("xChannelSelector","R")}${u("yChannelSelector","G")}${u("result",`${t}_disp`)}/>`,s+=`<feSpecularLighting${u("in",`${t}_wrinkle`)}${u("surfaceScale",r*2)}${u("specularConstant",i*1.5)}${u("specularExponent",20)}${u("result",`${t}_sheen`)}>`,s+=`<feDistantLight${u("azimuth",45)}${u("elevation",60)}/>`,s+="</feSpecularLighting>",s+=`<feBlend${u("in",`${t}_disp`)}${u("in2",`${t}_sheen`)}${u("mode","screen")}${u("result",`${t}_blend`)}/>`,s+=`<feComposite${u("in",`${t}_blend`)}${u("in2",e)}${u("operator","in")}${u("result",t)}/>`,s}function jd(n,e,t){let{density:r,size:i}=n;if(r===0)return H(e,t);let s="",o=1-r;s+=`<feTurbulence${u("type","turbulence")}${u("baseFrequency",.1/i)}${u("numOctaves",1)}${u("seed",1400)}${u("result",`${t}_hole`)}/>`,s+=`<feComponentTransfer${u("in",`${t}_hole`)}${u("result",`${t}_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",`${t}_thresh`)}${u("result",`${t}_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",`${t}_clamp`)}${u("operator","in")}${u("result",t)}/>`,s}function Kd(n,e,t){let{color:r,radius:i,intensity:s}=n;if(s===0||i===0)return H(e,t);let{r:o,g:a,b:l}=Dr(r),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",`${t}_alpha`)}/>`,c+=`<feGaussianBlur${u("in",`${t}_alpha`)}${u("stdDeviation",i/2)}${u("result",`${t}_blur`)}/>`,c+=`<feColorMatrix${u("in",`${t}_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",`${t}_color`)}/>`,c+=`<feMerge${u("result",t)}><feMergeNode${u("in",`${t}_color`)}/><feMergeNode${u("in",e)}/></feMerge>`,c}function Xd(n,e,t){let{color:r,radius:i,intensity:s}=n;if(s===0||i===0)return H(e,t);let{r:o,g:a,b:l}=Dr(r),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",`${t}_alpha`)}/>`,c+=`<feMorphology${u("in",`${t}_alpha`)}${u("operator","erode")}${u("radius",i/4)}${u("result",`${t}_erode`)}/>`,c+=`<feComposite${u("in",`${t}_alpha`)}${u("in2",`${t}_erode`)}${u("operator","out")}${u("result",`${t}_edge`)}/>`,c+=`<feGaussianBlur${u("in",`${t}_edge`)}${u("stdDeviation",i/3)}${u("result",`${t}_blur`)}/>`,c+=`<feColorMatrix${u("in",`${t}_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",`${t}_color`)}/>`,c+=`<feComposite${u("in",`${t}_color`)}${u("in2",`${t}_alpha`)}${u("operator","in")}${u("result",`${t}_clipped`)}/>`,c+=`<feComposite${u("in",`${t}_clipped`)}${u("in2",e)}${u("operator","over")}${u("result",t)}/>`,c}function H(n,e){return`<feMerge${u("result",e)}><feMergeNode${u("in",n)}/></feMerge>`}function Fr(n){switch(n.type){case"feBlend":return Yd(n);case"feColorMatrix":return qd(n);case"feComponentTransfer":return Zd(n);case"feComposite":return Jd(n);case"feConvolveMatrix":return Qd(n);case"feDiffuseLighting":return ef(n);case"feSpecularLighting":return tf(n);case"feDisplacementMap":return nf(n);case"feDropShadow":return rf(n);case"feFlood":return sf(n);case"feGaussianBlur":return af(n);case"feImage":return of(n);case"feMerge":return lf(n);case"feMorphology":return uf(n);case"feOffset":return cf(n);case"feTile":return df(n);case"feTurbulence":return ff(n)}}function ue(n){let e="";if(e+=u("in",n.in),e+=u("x",n.x),e+=u("y",n.y),e+=u("width",n.width),e+=u("height",n.height),e+=u("color-interpolation-filters",n.colorInterpolationFilters),e+=u("result",n.result),n.unknownAttrs){let t=Object.keys(n.unknownAttrs).sort();for(let r of t)e+=u(r,n.unknownAttrs[r])}return e}function ce(n){return n.animations&&n.animations.length>0?n.animations.join(""):""}function Yd(n){let e=`<feBlend${ue(n)}${u("in2",n.in2)}${u("mode",n.mode)}`;n.noComposite&&(e+=' no-composite="no-composite"');let t=ce(n);return t?`${e}>${t}</feBlend>`:`${e}/>`}function qd(n){let e=`<feColorMatrix${ue(n)}${u("type",n.matrixType)}${u("values",n.values)}`,t=ce(n);return t?`${e}>${t}</feColorMatrix>`:`${e}/>`}function Cr(n,e){if(!e)return"";let t=`feFunc${n}`;switch(e.type){case"identity":return`<${t} type="identity"/>`;case"table":case"discrete":return`<${t} type="${e.type}"${u("tableValues",e.tableValues.join(" "))}/>`;case"linear":return`<${t} type="linear"${u("slope",e.slope)}${u("intercept",e.intercept)}/>`;case"gamma":return`<${t} type="gamma"${u("amplitude",e.amplitude)}${u("exponent",e.exponent)}${u("offset",e.offset)}/>`}}function Zd(n){let e="";return e+=Cr("R",n.funcR),e+=Cr("G",n.funcG),e+=Cr("B",n.funcB),e+=Cr("A",n.funcA),e+=ce(n),`<feComponentTransfer${ue(n)}>${e}</feComponentTransfer>`}function Jd(n){let e=`<feComposite${ue(n)}${u("in2",n.in2)}${u("operator",n.operator)}`;n.operator==="arithmetic"&&(e+=u("k1",n.k1),e+=u("k2",n.k2),e+=u("k3",n.k3),e+=u("k4",n.k4));let t=ce(n);return t?`${e}>${t}</feComposite>`:`${e}/>`}function Qd(n){let e=`<feConvolveMatrix${ue(n)}`;e+=u("order",n.order),e+=u("kernelMatrix",n.kernelMatrix),e+=u("divisor",n.divisor),e+=u("bias",n.bias),e+=u("targetX",n.targetX),e+=u("targetY",n.targetY),e+=u("edgeMode",n.edgeMode),e+=u("kernelUnitLength",n.kernelUnitLength),n.preserveAlpha!==void 0&&(e+=u("preserveAlpha",n.preserveAlpha?"true":"false"));let t=ce(n);return t?`${e}>${t}</feConvolveMatrix>`:`${e}/>`}function dl(n){switch(n.kind){case"feDistantLight":return`<feDistantLight${u("azimuth",n.azimuth)}${u("elevation",n.elevation)}/>`;case"fePointLight":return`<fePointLight${u("x",n.x)}${u("y",n.y)}${u("z",n.z)}/>`;case"feSpotLight":{let e=`<feSpotLight${u("x",n.x)}${u("y",n.y)}${u("z",n.z)}${u("pointsAtX",n.pointsAtX)}${u("pointsAtY",n.pointsAtY)}${u("pointsAtZ",n.pointsAtZ)}`;return e+=u("specularExponent",n.specularExponent),e+=u("limitingConeAngle",n.limitingConeAngle),e+"/>"}}}function ef(n){let e=`<feDiffuseLighting${ue(n)}`;e+=u("surfaceScale",n.surfaceScale),e+=u("diffuseConstant",n.diffuseConstant),e+=u("kernelUnitLength",n.kernelUnitLength),e+=u("lighting-color",n.lightingColor);let t="";return n.lightSource&&(t+=dl(n.lightSource)),t+=ce(n),`${e}>${t}</feDiffuseLighting>`}function tf(n){let e=`<feSpecularLighting${ue(n)}`;e+=u("surfaceScale",n.surfaceScale),e+=u("specularConstant",n.specularConstant),e+=u("specularExponent",n.specularExponent),e+=u("kernelUnitLength",n.kernelUnitLength),e+=u("lighting-color",n.lightingColor);let t="";return n.lightSource&&(t+=dl(n.lightSource)),t+=ce(n),`${e}>${t}</feSpecularLighting>`}function nf(n){let e=`<feDisplacementMap${ue(n)}`;e+=u("in2",n.in2),e+=u("scale",n.scale),e+=u("xChannelSelector",n.xChannelSelector),e+=u("yChannelSelector",n.yChannelSelector);let t=ce(n);return t?`${e}>${t}</feDisplacementMap>`:`${e}/>`}function rf(n){let e=`<feDropShadow${ue(n)}`;e+=u("dx",n.dx),e+=u("dy",n.dy),e+=u("stdDeviation",n.stdDeviation),e+=u("flood-color",n.floodColor),e+=u("flood-opacity",n.floodOpacity);let t=ce(n);return t?`${e}>${t}</feDropShadow>`:`${e}/>`}function sf(n){let e=`<feFlood${ue(n)}${u("flood-color",n.floodColor)}${u("flood-opacity",n.floodOpacity)}`,t=ce(n);return t?`${e}>${t}</feFlood>`:`${e}/>`}function af(n){let e=`<feGaussianBlur${ue(n)}${u("stdDeviation",n.stdDeviation)}${u("edgeMode",n.edgeMode)}`,t=ce(n);return t?`${e}>${t}</feGaussianBlur>`:`${e}/>`}function of(n){let e=`<feImage${ue(n)}`;n.href!==void 0?e+=u("href",n.href):n.xlinkHref!==void 0&&(e+=u("xlink:href",n.xlinkHref)),e+=u("preserveAspectRatio",n.preserveAspectRatio),e+=u("crossorigin",n.crossorigin);let t=ce(n);return t?`${e}>${t}</feImage>`:`${e}/>`}function lf(n){let e="";for(let t of n.nodes)e+=`<feMergeNode${u("in",t.in)}/>`;return e+=ce(n),`<feMerge${ue(n)}>${e}</feMerge>`}function uf(n){let e=`<feMorphology${ue(n)}${u("operator",n.operator)}${u("radius",n.radius)}`,t=ce(n);return t?`${e}>${t}</feMorphology>`:`${e}/>`}function cf(n){let e=`<feOffset${ue(n)}${u("dx",n.dx)}${u("dy",n.dy)}`,t=ce(n);return t?`${e}>${t}</feOffset>`:`${e}/>`}function df(n){let e=`<feTile${ue(n)}`,t=ce(n);return t?`${e}>${t}</feTile>`:`${e}/>`}function ff(n){let e=`<feTurbulence${ue(n)}`;e+=u("baseFrequency",n.baseFrequency),e+=u("numOctaves",n.numOctaves),e+=u("seed",n.seed),e+=u("stitchTiles",n.stitchTiles),e+=u("type",n.turbulenceType);let t=ce(n);return t?`${e}>${t}</feTurbulence>`:`${e}/>`}function Fs(n,e){let t=`<filter${u("id",n)}`;t+=u("x",e.x),t+=u("y",e.y),t+=u("width",e.width),t+=u("height",e.height),t+=u("filterUnits",e.filterUnits),t+=u("primitiveUnits",e.primitiveUnits),e.filterColorInterpolation&&e.filterColorInterpolation!=="auto"&&(t+=u("color-interpolation-filters",e.filterColorInterpolation)),t+=u("flood-color",e.floodColor),t+=u("flood-opacity",e.floodOpacity),t+=u("lighting-color",e.lightingColor),t+=">",e.filterTitle&&(t+=`<title>${Y(e.filterTitle)}</title>`),e.filterDescription&&(t+=`<desc>${Y(e.filterDescription)}</desc>`);for(let r of e.primitives)t+=Fr(r);if(e.filterAnimations)for(let r of e.filterAnimations)t+=r;return t+="</filter>",t}function Es(n,e,t,r){switch(n.type){case"drop-shadow":return pd(n,e,t);case"inner-shadow":return md(n,e,t);case"gaussian-blur":return hd(n,e,t);case"motion-blur":return gd(n,e,t);case"point-light":{let i=n;return ll(r?{...i,x:i.x+r.x,y:i.y+r.y}:i,e,t)}case"spot-light":{let i=n;return ul(r?{...i,x:i.x+r.x,y:i.y+r.y,pointsAtX:i.pointsAtX+r.x,pointsAtY:i.pointsAtY+r.y}:i,e,t)}case"diffuse-lighting":return yd(n,e,t);case"specular-lighting":return bd(n,e,t);case"outline":return Sd(n,e,t);case"sharpen":return xd(n,e,t);case"pixelate":return $d(n,e,t);case"warp":return vd(n,e,t);case"morphology":return kd(n,e,t);case"contouring-discrete":return Td(n,e,t);case"contouring-table":return wd(n,e,t);case"round-edges":return Pd(n,e,t);case"grayscale":return _d(n,e,t);case"channel-painter":return Rd(n,e,t);case"brightness":return Ad(n,e,t);case"contrast":return Id(n,e,t);case"opacity":return Md(n,e,t);case"invert":return Cd(n,e,t);case"hue-rotate":return Dd(n,e,t);case"saturate":return Fd(n,e,t);case"black-and-white":return Ed(n,e,t);case"sepia":return Od(n,e,t);case"duotone":return Ld(n,e,t);case"xray":return Nd(n,e,t);case"noise":return Bd(n,e,t);case"emboss":return zd(n,e,t);case"film-grain":return Gd(n,e,t);case"watercolor":return Vd(n,e,t);case"gouache":return Ud(n,e,t);case"ink-blot":return Wd(n,e,t);case"crumpled-plastic":return Hd(n,e,t);case"riddled":return jd(n,e,t);case"glow":return Kd(n,e,t);case"inner-glow":return Xd(n,e,t);case"raw-svg":return n.svgContent;case"svg-primitive-chain":return n.primitives.map(Fr).join("");default:return H(e,t)}}function pf(n){return n.some(e=>e.type==="gaussian-blur"||e.type==="motion-blur"||e.type==="drop-shadow"||e.type==="inner-shadow"||e.type==="glow"||e.type==="inner-glow"||e.type==="outline"||e.type==="morphology"||e.type==="warp"||e.type==="svg-primitive-chain"&&e.primitives.some(t=>t.type==="feGaussianBlur"||t.type==="feDropShadow"||t.type==="feOffset"||t.type==="feMorphology"||t.type==="feDisplacementMap"||t.type==="feTurbulence"))}function Os(n,e,t={}){let r=e.filter(x=>x.enabled);if(r.length===0)return"";let i=t.colorInterpolation&&t.colorInterpolation!=="auto"?u("color-interpolation-filters",t.colorInterpolation):"",s=r.find(x=>x.type==="raw-svg");if(s){let x=t.colorInterpolation&&t.colorInterpolation!=="auto"?t.colorInterpolation:s.colorInterpolationFilters,v=t.filterUnits??s.filterUnits,w=t.primitiveUnits??s.primitiveUnits,T=t.x??s.x,P=t.y??s.y,R=t.width??s.width,M=t.height??s.height;return`<filter${u("id",n)}${u("x",T)}${u("y",P)}${u("width",R)}${u("height",M)}${u("filterUnits",v)}${u("primitiveUnits",w)}${u("color-interpolation-filters",x)}${u("flood-color",s.floodColor)}${u("flood-opacity",s.floodOpacity)}${u("lighting-color",s.lightingColor)}${u("display",s.display)}>${s.svgContent}</filter>`}let o=r.find(x=>x.type==="svg-primitive-chain");if(o){let x={...o,x:t.x??o.x,y:t.y??o.y,width:t.width??o.width,height:t.height??o.height,filterUnits:t.filterUnits??o.filterUnits,primitiveUnits:t.primitiveUnits??o.primitiveUnits,filterColorInterpolation:t.colorInterpolation&&t.colorInterpolation!=="auto"?t.colorInterpolation:o.filterColorInterpolation};return Fs(n,x)}let a=r.some(x=>x.type==="gaussian-blur"&&x.quality==="high"||x.type==="motion-blur"&&x.quality==="high"),l=pf(r),c=l?a?"-200%":"-100%":"-10%",f=l?a?"500%":"300%":"120%",d="",p="SourceGraphic",m=0;for(let x of r){let v=`result${m++}`;d+=Es(x,p,v),p=v}let h=t.filterUnits??"objectBoundingBox",g=t.primitiveUnits??"userSpaceOnUse",b=t.x??c,$=t.y??c,k=t.width??f,S=t.height??f;return`<filter${u("id",n)}${u("x",b)}${u("y",$)}${u("width",k)}${u("height",S)}${u("filterUnits",h)}${u("primitiveUnits",g)}${i}>${d}</filter>`}function fl(n){let e="",t=new Set;for(let r of n){let i=r.state.filters;if(!i||i.length===0)continue;let s=i.filter(c=>c.enabled);if(s.length===0)continue;let o=r.state.filterLibraryIds,a=Array.isArray(o)&&o.length>0?o[0]:`filter-${r.id}`;if(t.has(a))continue;t.add(a);let l=r.state;e+=Os(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 Er(n,e,t){return!e||e.length===0||e.filter(i=>i.enabled).length===0?"":Array.isArray(t)&&t.length>0?` filter="${t.map(s=>`url(#${Y(s)})`).join(" ")}"`:` filter="url(#filter-${Y(n)})"`}function mf(n){if(n instanceof Map)return n;let e=new Map;for(let t of n)e.set(t.id,t);return e}function hf(n){if(n.kind==="marker")return n.shapes;if(n.kind!=="symbol")return[];if(!n.variants)return n.shapes;let e=[...n.shapes];for(let t of Object.values(n.variants))e.push(...t);return e}function pl(n,e,t,r){let i=mf(t),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 g of m)c(g);let h=p.symbolOverrides;if(h&&typeof h=="object"&&!Array.isArray(h))for(let[g,b]of Object.entries(h))!b||typeof b!="object"||Array.isArray(b)||c({id:g,type:"symbol-override",state:b})};for(let d of n)c(d);for(let d of e)l(d);for(;;){let d=a.shift();if(d){r(d),f(d);continue}let p=o.shift();if(!p)break;for(let m of hf(p))c(m)}}var gf=[],yf=[];function gn(n,e,t){pl(n,yf,e,t)}function ml(n,e,t){pl(gf,n,e,t)}function hl(n,e){if(!n)return;let t=n,r=t.markerStart;typeof r=="string"&&r&&e(r);let i=t.markerMid;typeof i=="string"&&i&&e(i);let s=t.markerEnd;typeof s=="string"&&s&&e(s);let o=t.startEndpoint;typeof o=="string"&&o&&o!=="none"&&e(hn(o));let a=t.endEndpoint;typeof a=="string"&&a&&a!=="none"&&e(hn(a))}function hn(n){return`line-marker-${n}`}function gl(n,e,t){if(!n)return;let r=n,i=o=>{typeof o=="string"&&o&&t(o)};i(r.fillLibraryId),i(r.strokeLibraryId),i(r.markerStart),i(r.markerMid),i(r.markerEnd),i(r.symbolId);let s=r.filterLibraryIds;if(Array.isArray(s)&&s.length>0)for(let o of s)i(o);else Array.isArray(r.filters)&&r.filters.length>0&&t(`filter-${e}`);r.fillLibraryId||i(r.fillGradient?.id),r.strokeLibraryId||i(r.strokeGradient?.id)}function yn(n,e=[]){let t=new Set,r=new Set;return gn(n,e,i=>{let s=i.state;if(!s)return;typeof s.markerStart=="string"&&s.markerStart&&t.add(s.markerStart),typeof s.markerMid=="string"&&s.markerMid&&t.add(s.markerMid),typeof s.markerEnd=="string"&&s.markerEnd&&t.add(s.markerEnd);let o=s.startEndpoint,a=s.endEndpoint;typeof o=="string"&&o&&o!=="none"&&r.add(o),typeof a=="string"&&a&&a!=="none"&&r.add(a)}),{ids:t,legacyEndpoints:r}}function yl(n,e){let{ids:t,legacyEndpoints:r}=yn(n,e);for(let i of r)t.add(hn(i));return t}function bn(n,e,t,r){let i=r?.strokeWidth!=null?Math.max(.5,e*r.strokeWidth):Math.max(1,e/10);switch(n){case"stripes":return[{tag:"rect",attrs:{width:r?.strokeWidth!=null?Math.max(.01,Math.min(1,r.strokeWidth))*e:e/2,height:e,fill:t}}];case"dots":{let s=r?.dotRadius!=null?Math.max(.05,Math.min(.45,r.dotRadius)):.25;return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e*s,fill:t}}]}case"grid":return[{tag:"path",attrs:{d:`M ${e} 0 L 0 0 0 ${e}`,fill:"none",stroke:t,"stroke-width":i}}];case"checkerboard":return[{tag:"rect",attrs:{width:e/2,height:e/2,fill:t}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e/2,height:e/2,fill:t}}];case"diagonal":{let s=r?.strokeWidth!=null?Math.max(.5,e*r.strokeWidth):Math.max(1,e/5);return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0`,stroke:t,"stroke-width":s}}]}case"crosshatch":return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0 M 0 0 L ${e} ${e}`,stroke:t,"stroke-width":i}}];case"zigzag":{let s=r?.amplitude!=null?Math.max(.05,Math.min(.5,r.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:t,"stroke-width":i}}]}case"waves":{let s=r?.amplitude!=null?Math.max(.05,Math.min(.5,r.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:t,"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:t,"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:t,"stroke-width":i}}]}case"diamonds":return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${e/2} L ${e/2} ${e} L 0 ${e/2} Z`,fill:"none",stroke:t,"stroke-width":i}}];case"circles":return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e/3,fill:"none",stroke:t,"stroke-width":i}}];case"bricks":{let s=r?.strokeWidth!=null?Math.max(.5,e*r.strokeWidth):Math.max(1,e/15);return[{tag:"rect",attrs:{x:0,y:0,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":s}},{tag:"rect",attrs:{x:-e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":s}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:t,"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:t,"stroke-width":i}}];default:return[]}}function bf(n){let e=Object.entries(n.attrs).map(([t,r])=>` ${t}="${r}"`).join("");return`<${n.tag}${e}/>`}function Or(n,e,t,r,i){let s=10*e,o="";o+=`<rect width="${s}" height="${s}" fill="${r}"/>`;let a=bn(n,s,t,i);for(let l of a)o+=bf(l);return{svgContent:o,width:s,height:s}}var Sn="0 0 10 10",Lr=6,Nr=6;function pt(){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 Ls={"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 bl(){return pt().map(n=>{let e=Ls[n.id]??n.id;return{kind:"marker",id:e,name:Sf[e]??e,viewBox:Sn,refX:n.refX,refY:n.refY,markerWidth:6,markerHeight:6,markerUnits:"strokeWidth",orient:"auto-start-reverse",shapes:[],builtIn:!0}})}function xf(n){return n.replace(/[^a-zA-Z0-9_-]/g,"_")}function $f(n){let e=n.state.symbolOverrides;return!!e&&Object.keys(e).length>0}function Ct(n){let e=n.state.symbolId??"",t=n.state.variantKey??"";return $f(n)?`${e}--ovr-${n.id}`:t?`${e}--${xf(t)}`:e}function Br(n,e){let t=e.state.variantKey??"",r=t?n.variants?.[t]??n.shapes:n.shapes,i=e.state.symbolOverrides;return!i||Object.keys(i).length===0?r:r.map(s=>{let o=i[s.id];return!o||Object.keys(o).length===0?s:{...s,state:{...s.state,...o}}})}function xn(n,e){switch(e){case"uppercase":return n.toLocaleUpperCase();case"lowercase":return n.toLocaleLowerCase();case"capitalize":return n.replace(/\b\p{L}/gu,t=>t.toLocaleUpperCase());default:return n}}var vf=[["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 Dt(n){return vf.map(([e,t])=>{let r=n[e],i=typeof r=="string"?r.trim():"";return i?`${t}: ${i}`:""}).filter(Boolean).join("; ")}function zr(n,e){let t=[],r=(a,l)=>{l!==""&&t.push({name:a,value:l})};n.fontFamily!==e.fontFamily&&r("font-family",String(n.fontFamily)),n.fontSize!==e.fontSize&&r("font-size",String(n.fontSize)),n.fontWeight!==e.fontWeight&&r("font-weight",String(n.fontWeight)),n.fontStyle!==e.fontStyle&&r("font-style",String(n.fontStyle));let i=Dt(n);i&&i!==Dt(e)&&r("style",i);let s=n.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"),r("text-decoration",a.join(" "))}if(n.baselineShift!==e.baselineShift){let a=n.baselineShift;a==="super"||a==="sub"?r("baseline-shift",a):typeof a=="number"&&r("baseline-shift",`${a}px`)}return n.letterSpacing!==e.letterSpacing&&r("letter-spacing",String(n.letterSpacing)),n.fill!==e.fill&&r("fill",String(n.fill)),n.fillOpacity!==e.fillOpacity&&r("fill-opacity",String(n.fillOpacity)),n.direction!==e.direction&&r("direction",String(n.direction)),n.unicodeBidi!==e.unicodeBidi&&r("unicode-bidi",String(n.unicodeBidi)),t}function y(n,e){return e==null||e===""?"":` ${n}="${Y(String(e))}"`}function Ft(n,e){return e==null?"":` ${n}="${Y(e)}"`}function kf(n){let e=n.map(t=>(t??"").trim().replace(/;$/,"")).filter(Boolean).join("; ");return e?y("style",e):""}function Tf(n,e){return typeof e=="number"&&e>0?`${n}: ${e}px`:""}function wf(n){if(n&&typeof n=="object"){let e=n;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 Sl(n,e){let t=-1;for(let i=n.length-1;i>=0;i--)if(n[i][e]!==null){t=i;break}if(t<0)return[];let r=new Array(t+1);for(let i=0;i<=t;i++)r[i]=n[i][e]??0;return r}function xl(n,e){let t=-1;for(let i=n.length-1;i>=0;i--)if(n[i][e]!==0){t=i;break}if(t<0)return[];let r=new Array(t+1);for(let i=0;i<=t;i++)r[i]=n[i][e];return r}function Pf(n){if(n.length===0)return[];let e=n.length-1,t=n[e].rotate;for(;e>0&&n[e-1].rotate===t;)e--;if(e===0&&t===0)return[];let r=new Array(e+1);for(let i=0;i<=e;i++)r[i]=n[i].rotate;return r}function Me(n,e){return At(n,e)}function _f(n,e,t){return Ts(n,e,t)}function Rf(n){if(typeof n=="string"){let r=n.trim();return r.length>0?r:void 0}if(!n||typeof n!="object")return;let e=n,t=[];return e.underline&&t.push("underline"),e.strikethrough&&t.push("line-through"),e.overline&&t.push("overline"),t.length>0?t.join(" "):void 0}function Af(n){if(typeof n.strokeDasharray=="string")return n.strokeDasharray;let e=n.lineStyle??"solid",t=n.dashLength??8,r=n.gapLength??4;return Mt(e,t,r)}function Gr(n,e){let t=n[e];return t!==void 0?t:n.extra?.[e]}function If(n){let e=n.fillType;return e||(n.fillGradient?n.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":Gr(n,"linearGradient")?"linear-gradient":Gr(n,"radialGradient")?"radial-gradient":"solid")}function Mf(n){return n.fillGradient??Gr(n,"linearGradient")??Gr(n,"radialGradient")??void 0}function Ie(n,e){let t=y("data-shape-id",e),r=If(n),i=Mf(n);if(r==="none")t+=y("fill","none");else if(r==="linear-gradient"||r==="radial-gradient"){let w=n.fillLibraryId??i?.id;t+=y("fill",`url(#${w??`gradient-fill-${e}`})`)}else if(r==="pattern"){let w=n.fillLibraryId??i?.id;t+=y("fill",`url(#${w??`pattern-fill-${e}`})`)}else t+=y("fill",n.fillColor??"#000000");let s=n.opacity;s!==void 0&&s<1&&(t+=y("opacity",s));let o=n.fillOpacity;o!==void 0&&o<1&&(t+=y("fill-opacity",o));let a=n.fillRule;a&&a!=="nonzero"&&(t+=y("fill-rule",a));let l=n.strokeType??"solid",c=n.strokeGradient;if(l==="none")t+=y("stroke","none");else if(l==="linear-gradient"||l==="radial-gradient"){let w=n.strokeLibraryId??c?.id;t+=y("stroke",`url(#${w??`gradient-stroke-${e}`})`)}else if(l==="pattern"){let w=n.strokeLibraryId??c?.id;t+=y("stroke",`url(#${w??`pattern-stroke-${e}`})`)}else t+=y("stroke",n.borderColor??"none");let f=n.borderWidth;f!=null&&(t+=y("stroke-width",f));let d=n.strokeOpacity;d!==void 0&&d<1&&(t+=y("stroke-opacity",d));let p=n.paintOrder;p&&p!=="normal"&&(t+=y("paint-order",p));let m=n.markerStart,h=n.markerMid,g=n.markerEnd;m&&(t+=y("marker-start",`url(#${m})`)),h&&(t+=y("marker-mid",`url(#${h})`)),g&&(t+=y("marker-end",`url(#${g})`));let b=Af(n);b&&(t+=y("stroke-dasharray",b),!n.strokeDasharray&&n.lineStyle==="dotted"&&(t+=y("stroke-linecap","round")));let $=n.dashOffset;$!==void 0&&$!==0&&(t+=y("stroke-dashoffset",$));let k=n.shapeRendering;k&&k!=="auto"&&(t+=y("shape-rendering",k)),t+=Er(e,n.filters,n.filterLibraryIds),t+=Ft("systemLanguage",n.systemLanguage),t+=Ft("requiredExtensions",n.requiredExtensions);let S=n.vectorEffect;S&&S!=="none"&&(t+=y("vector-effect",S));let x=n.visibility;x&&x!=="visible"&&(t+=y("visibility",x));let v=n.metadata;return v&&(v.role&&(t+=y("role",v.role)),v.ariaLabel&&(t+=y("aria-label",v.ariaLabel))),t}function Ns(n){let e=n.metadata;if(!e)return"";let t="";return e.title&&(t+=`<title>${Y(e.title)}</title>`),e.description&&(t+=`<desc>${Y(e.description)}</desc>`),t}function Cf(n,e){let t=Ns(e);if(!t)return n;let r=n.lastIndexOf("/>");if(r===-1){let o=n.indexOf(">");return o===-1?n:n.slice(0,o+1)+t+n.slice(o+1)}let i=n.match(/^<(\w+)/),s=i?i[1]:"g";return n.slice(0,r)+">"+t+`</${s}>`}function Bs(n){let e="",t=n.startEndpoint,r=n.endEndpoint;return t&&t!=="none"&&(e+=y("marker-start",`url(#line-marker-${t})`)),r&&r!=="none"&&(e+=y("marker-end",`url(#line-marker-${r})`)),e}function zs(n){let e=n.state,t=e.x??0,r=e.y??0,i=e.radius??50,s=Me(e,{x:t,y:r});return`<circle${y("cx",t)}${y("cy",r)}${y("r",i)}${Ie(e,n.id)}${s?y("transform",s):""}/>`}function Gs(n){let e=n.state,t=e.cx??0,r=e.cy??0,i=e.rx??50,s=e.ry??30,o=e.pathLength,a=Me(e,{x:t,y:r});return`<ellipse${y("cx",t)}${y("cy",r)}${y("rx",i)}${y("ry",s)}${o!==void 0?y("pathLength",o):""}${Ie(e,n.id)}${a?y("transform",a):""}/>`}function Vs(n){let e=n.state,t=e,r=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=t.cornerShape??"round",d=t.cornerMode??"uniform",p={x:r+s/2,y:i+o/2},m=Me(e,p);if(f!=="round"||d==="non-uniform"){let h=Ar(r,i,s,o,a,f,d,d==="non-uniform"?{radiusTL:t.cornerRadiusTL,radiusTR:t.cornerRadiusTR,radiusBR:t.cornerRadiusBR,radiusBL:t.cornerRadiusBL,shapeTL:t.cornerShapeTL,shapeTR:t.cornerShapeTR,shapeBR:t.cornerShapeBR,shapeBL:t.cornerShapeBL}:void 0);if(h)return`<path${y("d",h)}${Ie(e,n.id)}${m?y("transform",m):""}/>`}return`<rect${y("x",r)}${y("y",i)}${y("width",s)}${y("height",o)}${l>0||c>0?`${y("rx",l)}${y("ry",c)}`:""}${Ie(e,n.id)}${m?y("transform",m):""}/>`}function Us(n){let e=n.state,t=e.x1??0,r=e.y1??0,i=e.x2??0,s=e.y2??0,o={x:(t+i)/2,y:(r+s)/2},a=Me(e,o),l={...e,fillType:"none"};return`<line${y("x1",t)}${y("y1",r)}${y("x2",i)}${y("y2",s)}${Ie(l,n.id)}${Bs(e)}${a?y("transform",a):""}/>`}function Ws(n){let e=n.state,t=e.x??0,r=e.y??0,i=xn(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=Rf(e.textDecoration),d=e.letterSpacing,p=e.wordSpacing,m=e.lineHeight??1.25,g=Me(e,{x:t,y:r}),b=y("x",t)+y("y",r);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 k=e.dominantBaseline;k&&k!=="auto"&&(b+=y("dominant-baseline",k));let S=e.writingMode;S&&S!=="horizontal-tb"&&(b+=y("writing-mode",S));let x=e.textLength;x!==void 0&&x>0&&(b+=y("textLength",x),e.lengthAdjust==="spacingAndGlyphs"&&(b+=y("lengthAdjust","spacingAndGlyphs")));let v=e.textDirection;v&&v!=="ltr"&&(b+=y("direction",v));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=Dt(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+=kf([P,M,Tf("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+=Ie(e,n.id),g&&(b+=y("transform",g)),e.isTextPath&&e.textPathPoints){let D=e.textPathPoints,L=e.textPathStartOffset??0,K=e.textPathSide,C=`text-path-${n.id}`,re=e.textPathMethod,ee=e.textPathSpacing,Z=e.textPathLengthAdjust,me=e.textPathLength,q="";if(D.length>=2)if(K==="right"){let W=D[D.length-1];q=`M ${W.x} ${W.y}`;for(let fe=D.length-1;fe>0;fe--){let he=D[fe],Te=D[fe-1],ve=he.handleIn??he,gt=Te.handleOut??Te;q+=` C ${ve.x} ${ve.y}, ${gt.x} ${gt.y}, ${Te.x} ${Te.y}`}}else{q=`M ${D[0].x} ${D[0].y}`;for(let W=0;W<D.length-1;W++){let fe=D[W],he=D[W+1],Te=fe.handleOut??fe,ve=he.handleIn??he;q+=` C ${Te.x} ${Te.y}, ${ve.x} ${ve.y}, ${he.x} ${he.y}`}}return`<defs><path id="${Y(C)}"${y("d",q)} fill="none"/></defs><text${b}><textPath href="#${Y(C)}"${y("startOffset",`${L}%`)}${y("method",re)}${y("spacing",ee)}${y("lengthAdjust",Z)}${y("textLength",me)}>${Y(i)}</textPath></text>`}if(e.charOffsets&&Array.isArray(e.charOffsets)&&e.charOffsets.length>0){let D=e.charOffsets.map(wf),L=i.split(`
|
|
12
|
+
`),K=e.linePositions??[],C=s*m,re="",ee=0;return L.forEach((Z,me)=>{let q=Array.from(Z).length,W=D.slice(ee,ee+q),fe=K[me],he=fe?t+fe.x:me>0?t:NaN,Te=fe?fe.dy:me>0?C:NaN,ve="",gt=Sl(W,"x");if(Number.isFinite(he)||gt.length>0){let Hi=gt.length>0?gt.slice():[];Number.isFinite(he)&&(Hi[0]=Hi[0]??he),ve+=y("x",Hi.join(" "))}let wa=Sl(W,"y");wa.length>0&&(ve+=y("y",wa.join(" ")));let Pa=xl(W,"dx");Pa.length>0&&(ve+=y("dx",Pa.join(" ")));let _a=xl(W,"dy"),je=_a.length>0||Number.isFinite(Te)?_a.slice():[];for(Number.isFinite(Te)&&(je[0]=(je[0]??0)+Te);je.length>0&&je[je.length-1]===0;)je.pop();je.length>0&&(ve+=y("dy",je.join(" ")));let Ra=Pf(W);Ra.length>0&&(ve+=y("rotate",Ra.join(" "))),re+=`<tspan${ve}>${Y(Z)}</tspan>`,ee+=q+1}),`<text${b}>${re}</text>`}let B=Zn(e);if(B){let D=Ve(B),L=e.linePositions,K=s*D.lineHeight,C="";return D.lines.forEach((re,ee)=>{re.segments.forEach((Z,me)=>{let q="";if(me===0){let W=L?.[ee];W?((Math.abs(W.x)>.001||ee>0)&&(q+=y("x",t+W.x)),(Math.abs(W.dy)>.001||ee>0)&&(q+=y("dy",W.dy))):ee>0&&(q+=y("x",t),q+=y("dy",`${K}px`))}for(let{name:W,value:fe}of zr(Z.style,D.baseStyle))q+=y(W,fe);q+=' xml:space="preserve"',C+=`<tspan${q}>${Y(xn(Z.text,Z.style.textTransform))}</tspan>`})}),`<text${b}>${C}</text>`}return`<text${b}>${Y(i)}</text>`}function Hs(n){let e=n.state,t=e.pathPoints??[],r=e.pathCurveType??"CUBIC",i=e.pathClosed??!1,s=e.pathTension??.5,o=e.pathArcParams,a=qe(t,r,i,s,o),l=t.length>0?e.customPivot??{x:t[0].x,y:t[0].y}:void 0,c=l?Me(e,l):null;return`<path${y("d",a)}${Ie(e,n.id)}${Bs(e)}${c?y("transform",c):""}/>`}function js(n){let e=n.state,t=e.polylinePoints??[],r=e.polylineClosed??!1,i=t.map(l=>`${l.x},${l.y}`).join(" "),s=t.length>0?e.customPivot??{x:t[0].x,y:t[0].y}:void 0,o=s?Me(e,s):null;return`<${r?"polygon":"polyline"}${y("points",i)}${Ie(e,n.id)}${Bs(e)}${o?y("transform",o):""}/>`}function Ks(n){let e=n.state,t=e.x??0,r=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:t+i/2,y:r+s/2},f=Me(e,c);return`<image${y("x",t)}${y("y",r)}${y("width",i)}${y("height",s)}${y("href",o)}${y("preserveAspectRatio",l)}${a!==void 0&&a<1?y("opacity",a):""}${Ie(e,n.id)}${f?y("transform",f):""}/>`}function Vr(n){return!n||n.length===0?"":n.map(e=>de(e)).join("")}function $l(n){let e=n.state,t="",r=Me(e);r&&(t+=y("transform",r));let i=e.opacity;i!==void 0&&i<1&&(t+=y("opacity",i));let s=e.metadata;s&&(s.role&&(t+=y("role",s.role)),s.ariaLabel&&(t+=y("aria-label",s.ariaLabel)));let o=e.containerPresentation;if(o)for(let[l,c]of Object.entries(o))/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(l)&&(t+=` ${l}="${Y(c)}"`);let a=e.authoredAttributes;if(a)for(let[l,c]of Object.entries(a))c===null||!/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/.test(l)||(t+=` ${l}="${Y(c)}"`);return t}function Df(n){let e=n.state,t=e.href,r=e.hrefXlink,i="<a";return t!==void 0&&(i+=y("href",t)),r!==void 0&&(i+=y("xlink:href",r)),i+=y("target",e.linkTarget),i+=y("rel",e.linkRel),e.linkDownload===""?i+=' download=""':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+=$l(n),i+=y("data-shape-id",n.id),i+=">",i+=Ns(e),i+=Vr(e.children),i+="</a>",i}function Ff(n){let e=n.state,t="<switch";return t+=Ft("systemLanguage",e.switchSystemLanguage),t+=Ft("requiredExtensions",e.switchRequiredExtensions),t+=$l(n),t+=y("data-shape-id",n.id),t+=">",t+=Ns(e),t+=Vr(e.children),t+="</switch>",t}function Ef(n){let e=n.state,t=Me(e),r="<g";return r+=y("data-shape-id",n.id),t&&(r+=y("transform",t)),e.opacity!==void 0&&e.opacity<1&&(r+=y("opacity",e.opacity)),e.visibility&&(r+=y("visibility",e.visibility)),e.blendMode&&(r+=y("style",`mix-blend-mode:${e.blendMode}`)),r+=">",r+=Vr(e.children),r+="</g>",r}function Of(n){let e=n.state,t=e.viewBoxX,r=e.viewBoxY,i=e.viewBoxWidth,s=e.viewBoxHeight,o=t!==void 0&&r!==void 0&&i!==void 0&&s!==void 0?`${t} ${r} ${i} ${s}`:void 0,a="<view";return a+=y("id",n.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 Lf(n){let e=n.state,t=e.svgX,r=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",t),d+=y("y",r),d+=y("width",i),d+=y("height",s),d+=y("viewBox",f),d+=y("preserveAspectRatio",e.svgPreserveAspectRatio),d+=y("data-shape-id",n.id),d+=">",d+=Vr(e.children),d+="</svg>",d}function Nf(n){let e=n.state,t=e.targetShapeId;if(!t)return`<!-- shape-reference ${Y(n.id)} has no targetShapeId -->`;let r=e.offsetX??0,i=e.offsetY??0,s="<use";return s+=y("href",`#${t}`),s+=y("x",r),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",n.id),e.opacity!==void 0&&e.opacity<1&&(s+=y("opacity",e.opacity)),s+="/>",s}function Xs(n){let e=n.state,t=Ct(n),r=e.x??0,i=e.y??0,s=e.width??100,o=e.height??100;return`<use href="#${Y(t)}" x="${r}" y="${i}" width="${s}" height="${o}"/>`}function Bf(n){let e=n.state,t=e.mediaKind??n.type,r=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=`<${t} xmlns="http://www.w3.org/1999/xhtml"`;d+=y("src",a),l&&(d+=y("type",l)),c&&t==="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+=t==="video"?' style="width:100%;height:100%;display:block;"></video>':"></audio>";let p="<foreignObject";return p+=y("x",r),p+=y("y",i),p+=y("width",s),p+=y("height",o),p+=y("data-shape-id",n.id),p+=y("data-media-kind",t),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)),p+=Ft("systemLanguage",e.systemLanguage),p+=Ft("requiredExtensions",e.requiredExtensions),f!==void 0&&f<1&&(p+=y("opacity",f)),p+=">",p+=d,p+="</foreignObject>",p}function Ys(n){let e=n.state,t=e.x??0,r=e.y??0,i=e.width??100,s=e.height??60,o={x:t+i/2,y:r+s/2},a=Me(e,o),l=Ir(n.type,t,r,i,s,{slantPercent:e.slantPercent,topWidthPercent:e.topWidthPercent,capHeightPercent:e.capHeightPercent,waveAmplitudePercent:e.waveAmplitudePercent});return`<path${y("d",l)}${Ie(e,n.id)}${a?y("transform",a):""}/>`}function qs(n){let e=n.state,t=e.cx??0,r=e.cy??0,i=e.radius??50,s=e.cornerRadius??0,o=e.shiftAngle??-90,a=e.fillRule??"nonzero",l=_f(e,t,r),c="";switch(n.type){case"triangle":c=Ae(mn(3,i,o),s,i);break;case"ngon":{let d=e.sides??6;c=Ae(mn(d,i,o),s,i);break}case"star":{let d=e.arms??5,p=e.innerRadiusPercent??50;c=Ae(Sr(d,i,p,o),s,i);break}case"cross":{let d=e.armWidthPercent??40;c=Ae(xr(i,d,o),s,i);break}case"ring":{let d=e.innerRadiusPercent??50;c=Pr(i,d,a);break}case"spiral":{let d=e.turns??3,p=e.thicknessPercent??20,m=e.spiralDirection??1;c=_r(i,d,p,m,o);break}case"gear":{let d=e.teeth??8,p=e.toothDepthPercent??30,m=e.holeRadiusPercent??0;c=Rr(d,i,p,s,m,a,o);break}case"arrow":{let d=e.headWidthPercent??100,p=e.headLengthPercent??30,m=e.shaftWidthPercent??40;c=Ae($r(i,d,p,m,o),s,i);break}case"speechBubble":{let d=e.tailAngleDeg??45,p=e.tailLengthPercent??40,m=e.tailWidthPercent??25;c=Ae(vr(i,d,p,m,o),s,i);break}case"lightning":{let d=e.boltSegments??3,p=e.boltJaggednessPercent??40,m=e.boltWidthPercent??30;c=Ae(kr(i,d,p,m,o),s,i);break}case"heart":{let d=e.lobeRadiusPercent??50,p=e.cleftDepthPercent??25;c=Tr(i,d,p,o);break}case"cloud":{let d=e.cloudBumps??5,p=e.cloudPuffinessPercent??60;c=wr(i,d,p,o);break}default:return`<!-- unsupported polygon shape: ${Y(n.type)} -->`}let f="";return(n.type==="ring"||n.type==="gear")&&(f=y("fill-rule",a)),`<path${y("d",c)}${f}${Ie(e,n.id)}${y("transform",l)}/>`}function de(n){let e;switch(n.type){case"circle":e=zs(n);break;case"ellipse":e=Gs(n);break;case"rectangle":case"square":e=Vs(n);break;case"line":e=Us(n);break;case"text":e=Ws(n);break;case"path":e=Hs(n);break;case"polyline":e=js(n);break;case"image":e=Ks(n);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=qs(n);break;case"diamond":case"parallelogram":case"trapezoid":case"terminator":case"cylinder":case"document-shape":e=Ys(n);break;case"hyperlink":e=Df(n);break;case"switch":e=Ff(n);break;case"container":case"group":e=Ef(n);break;case"view":e=Of(n);break;case"svg":e=Lf(n);break;case"shape-reference":e=Nf(n);break;case"symbol-instance":e=Xs(n);break;case"audio":case"video":e=Bf(n);break;default:return`<!-- unsupported shape type: ${Y(n.type)} -->`}return Cf(e,n.state)}function vl(n,e){let t=(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(""),r=e.gradientUnits==="userSpaceOnUse",i=o=>r?String(o):`${o*100}%`,s=r?y("gradientUnits","userSpaceOnUse"):"";return`<linearGradient${y("id",n)}${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):""}>${t}</linearGradient>`}function kl(n,e){let t=(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(""),r=e.gradientUnits==="userSpaceOnUse",i=f=>r?String(f):`${f*100}%`,s=r?y("gradientUnits","userSpaceOnUse"):"",o="",a=e.ry!==void 0&&e.ry!==e.r,l=!!e.rotation;if(a||l){let f=e.cx??(r?0:.5),d=e.cy??(r?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",n)}${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}>${t}</radialGradient>`}function Tl(n,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,h=e.x??0,g=e.y??0,b=`<pattern${y("id",n)}`;return b+=y("patternUnits",c),f&&(b+=y("patternContentUnits",f)),h&&(b+=y("x",h)),g&&(b+=y("y",g)),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 t=10*(e.scale??1),r=e.rotation??0,i=e.color||"#000000",s=e.backgroundColor||"#ffffff",o="";return o+=`<rect${y("width",t)}${y("height",t)}${y("fill",s)}/>`,o+=zf(e.patternType,t,i),`<pattern${y("id",n)}${y("patternUnits","userSpaceOnUse")}${y("width",t)}${y("height",t)}${r?y("patternTransform",`rotate(${r})`):""}>${o}</pattern>`}function zf(n,e,t){return bn(n,e,t).map(i=>{let s=Object.entries(i.attrs).map(([o,a])=>y(o,a)).join("");return`<${i.tag}${s}/>`}).join("")}function Ee(n,e=[]){let t=Array.isArray(n)?yn(n,e):n;if(t.ids.size===0&&t.legacyEndpoints.size===0)return"";let r="",i=pt();for(let s of i){let o=s.id,a=o.replace("line-marker-",""),l=`mkr-builtin-${a}`,c=t.legacyEndpoints.has(a)||t.ids.has(o),f=t.ids.has(l);if(!c&&!f)continue;let d=s.element,p=Object.entries(d.attrs).map(([g,b])=>y(g,b)).join(""),m=`<${d.tag}${p}/>`,h=g=>{r+=`<marker${y("id",g)}${y("viewBox",Sn)}${y("refX",s.refX)}${y("refY",s.refY)}${y("markerWidth",6)}${y("markerHeight",6)}${y("orient","auto-start-reverse")}>${m}</marker>`};c&&h(o),f&&h(l)}return r}var He=n=>n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),Zs=["linear-gradient","radial-gradient","pattern","filter","marker","symbol"];function Js(n){switch(n.kind){case"symbol":return Qs(n);case"marker":return ea(n);case"linear-gradient":return ta(n);case"radial-gradient":return na(n);case"pattern":return ra(n);case"filter":return ia(n)}}function Qs(n){let e=n.shapes.map(i=>de(i)).join(""),t=n.viewBox?` viewBox="${He(n.viewBox)}"`:"",r=n.overflow?` overflow="${He(n.overflow)}"`:"";return`<symbol id="${He(n.id)}"${t}${r}>${e}</symbol>`}function ea(n){let e;if(n.builtIn){let s=pt().find(o=>n.id.includes(o.id)||n.id===o.id);if(s){let o=Object.entries(s.element.attrs).map(([a,l])=>` ${a}="${He(String(l))}"`).join("");e=`<${s.element.tag}${o}/>`}else e=""}else e=n.shapes.map(s=>de(s)).join("");let t=typeof n.orient=="number"?String(n.orient):n.orient,r=n.viewBox?` viewBox="${He(n.viewBox)}"`:"",i=n.overflow?` overflow="${He(n.overflow)}"`:"";return`<marker id="${He(n.id)}"${r} refX="${n.refX}" refY="${n.refY}" markerWidth="${n.markerWidth}" markerHeight="${n.markerHeight}" markerUnits="${He(n.markerUnits)}" orient="${He(t)}"${i}>${e}</marker>`}function ta(n){let e={...n.gradient,type:"linear-gradient",id:n.id};return vl(n.id,e)}function na(n){let e={...n.gradient,type:"radial-gradient",id:n.id};return kl(n.id,e)}function ra(n){let e={...n.pattern,type:"pattern",id:n.id};return Tl(n.id,e)}function ia(n){return Os(n.id,n.filters,{colorInterpolation:n.colorInterpolation,filterUnits:n.filterUnits,primitiveUnits:n.primitiveUnits,x:n.x,y:n.y,width:n.width,height:n.height})}function $n(n){let e=new Map;for(let r of n){let i=e.get(r.kind);i?i.push(r):e.set(r.kind,[r])}let t="";for(let r of Zs){let i=e.get(r);if(i)for(let s of i)t+=Js(s)}return t}function Ze(n,e){let t=vn(n,e);return t.length===0?"":$n(t)}function vn(n,e){let t=new Map;for(let l of e)t.set(l.id,l);let r=new Map,i=l=>{if(!l)return;let c=t.get(l);c&&r.set(l,c)},s=(l,c)=>{if(!l||typeof l!="object")return;let f=l;if(!f.id||r.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,...h}=l,g;if(d==="linear-gradient")g={kind:"linear-gradient",id:f.id,name:m??f.id,sourceId:m,gradient:h};else if(d==="radial-gradient")g={kind:"radial-gradient",id:f.id,name:m??f.id,sourceId:m,gradient:h};else{let{customPatternId:b,...$}=h;g={kind:"pattern",id:f.id,name:m??f.id,sourceId:m,pattern:$}}r.set(f.id,g)},o=(l,c)=>{let f=l.filters;if(!Array.isArray(f)||f.length===0)return;let d=`filter-${c}`;r.has(d)||r.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 n)a(l);return gn(n,e,a),Array.from(r.values())}function sa(n){return n.easing==="custom-bezier"&&n.customBezier?n.customBezier:Cn[n.easing]??null}function aa(n,e,t,r,i){if(n===e&&t===r)return i;let s=1e-6,o=8,a=m=>(((1-3*t+3*n)*m+(3*t-6*n))*m+3*n)*m,l=m=>(((1-3*r+3*e)*m+(3*r-6*e))*m+3*e)*m,c=m=>(3*(1-3*t+3*n)*m+2*(3*t-6*n))*m+3*n,f=i;for(let m=0;m<o;m++){let h=a(f)-i;if(Math.abs(h)<s)return l(f);let g=c(f);if(Math.abs(g)<s)break;f-=h/g}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 h=(p-d)*.5+d;if(h===f)break;f=h}return l(f)}function oa(n){let e=n.split(/\s+/).map(parseFloat);if(e.length!==4||e.some(o=>!Number.isFinite(o)))return n;let[t,r,i,s]=e;return`${1-i} ${1-s} ${1-t} ${1-r}`}function be(n){return!Number.isFinite(n)||Math.abs(n)<1e-9?"0":Math.abs(n-1)<1e-9?"1":parseFloat(n.toFixed(6)).toString()}function Wr([n,e,t,r]){let i=s=>Number.isFinite(s)?parseFloat(s.toFixed(6)).toString():"0";return`${i(n)} ${i(e)} ${i(t)} ${i(r)}`}function la(n){return n.length>0&&n.every(e=>e==="0 0 1 1")}function kn(n){if(n.length<2)return!1;let e=n.length-1,t=1e-4;for(let r=0;r<n.length;r++){let i=r/e,s=parseFloat(n[r]);if(!Number.isFinite(s)||Math.abs(s-i)>t)return!1}return!0}function Hr(n){if(n.length<2)return!1;let e=n.length-1,t=1e-4;for(let r=0;r<n.length;r++)if(Math.abs(n[r]-r/e)>t)return!1;return!0}function Qe(n){let e=n.cycleDuration??(n.keyframes.length>0?n.keyframes[n.keyframes.length-1].time:0);return n.cycleBehavior==="alternate"?e*2:e}function mt(n){let e=n.beginTrigger;if(e)switch(e.type){case"time":{let r=parseFloat(e.value);return Number.isNaN(r)?"":Number.isFinite(r)?r!==0?`${r}s`:"":"indefinite"}case"event":return e.value;case"expression":return"";default:break}let t=n.keyframes[0]?.time??0;return t!==0?`${t}s`:""}function jr(n){return n.keyframes.length===1&&n.cycleDuration===void 0}function Kr(n){return n.calcMode!=="discrete"?!1:n.sourceSmilElement==="set"?!0:!n.sourceSmilElement&&!n.cycleInfinite&&n.keyframes.every(e=>e.easing!=="steps")}function Xr(n,e){if(e<=0)return mt(n);if(mt(n)==="indefinite")return"indefinite";let t=n.keyframes[e]?.time??0;return t!==0?`${t}s`:""}function Yr(n){return n.cycleInfinite?"indefinite":n.cycleRepeats&&n.cycleRepeats>1?String(n.cycleRepeats):null}function ht(n){return n.cycleInfinite||n.fill==="remove"?null:"freeze"}function qr(n){return n.additive==="sum"?"sum":null}function Zr(n){return n.keyframes.map(e=>{let t=typeof e.value=="number"?e.value:parseFloat(String(e.value));return Number.isFinite(t)?Math.max(0,Math.min(1,t)):0})}function Gf(n){let e=t=>Math.max(0,Math.min(1,t));return[n[0],e(n[1]),n[2],e(n[3])]}function Vf(n){let[e,t,r,i]=n,s=new Set,o=8;for(let d=1;d<=o;d++)s.add(d/o);let a=t-2*i+1,l=2*(i-2*t),c=t,f=d=>{if(!Number.isFinite(d)||d<=0||d>=1)return;let p=3*(1-d)**2*d*e+3*(1-d)*d**2*r+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 Uf(n,e,t,r,i,s){let o=typeof n.value=="number"&&typeof e.value=="number",a=Je(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 k=b[$],S=n.time+(e.time-n.time)*k.position,x=n.value+(e.value-n.value)*k.value;r.push(x),i.push(be(t(S))),s.push("0 0 1 1")}return}r.push(a),i.push(be(t(e.time))),s.push("0 0 1 1");return}if(e.easing==="steps"){r.push(a),i.push(be(t(e.time))),s.push("0 0 1 1");return}let l=sa(e);if(!l){r.push(a),i.push(be(t(e.time))),s.push("0 0 1 1");return}let[,c,,f]=l;if(!(c<0||c>1||f<0||f>1)){r.push(a),i.push(be(t(e.time))),s.push(Wr(l));return}if(!o){r.push(a),i.push(be(t(e.time))),s.push(Wr(Gf(l)));return}let p=Vf(l),m=n.value,h=e.value,g=e.time-n.time;for(let b of p){let $=aa(l[0],l[1],l[2],l[3],b),k=n.time+g*b,S=m+(h-m)*$;r.push(S),i.push(be(t(k))),s.push("0 0 1 1")}}function Je(n){return Array.isArray(n)?n.join(" "):n}function Wf(n,e,t){let r=[],{count:i,position:s}=t,o=e.time-n.time,a=Je(n.value),l=Je(e.value),c=typeof a=="number"&&typeof l=="number",f=typeof a=="string"&&typeof l=="string",d=h=>f?h<.5?a:l:c?a+(l-a)*h:h>=1?l:a,p=h=>{let g=Math.floor(h*i);(s==="jump-start"||s==="jump-both")&&(g+=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 g>b&&(g=b),g<0&&(g=0),g/b},m=p(0);for(let h=1;h<=i;h++){let g=h/i,b=p(g);if(b===m)continue;let $=n.time+g*o;r.push({value:d(b),time:$}),m=b}return r.length===0||r[r.length-1].time<e.time?r.push({value:l,time:e.time}):r[r.length-1]={value:l,time:e.time},r}function Hf(n,e){let t=[],r=[],i=(s,o)=>{t.push(s),r.push(be(e(o)))};i(Je(n[0].value),n[0].time);for(let s=1;s<n.length;s++){let o=n[s-1],a=n[s];if(a.easing==="steps"&&a.stepsParams){let l=Wf(o,a,a.stepsParams);for(let c of l)i(c.value,c.time)}else i(Je(a.value),a.time)}return{values:t,keyTimes:r}}function Ur(n,e,t,r,i){if(i.cycleBehavior!=="alternate"||n.length<2)return{values:n,keyTimes:e,keySplines:t,calcMode:r};let s=n.slice(0,-1).reverse(),o=e.slice(0,-1).reverse().map(l=>be(1-parseFloat(l))),a=t.slice().reverse().map(oa);return{values:[...n,...s],keyTimes:[...e,...o],keySplines:[...t,...a],calcMode:r}}function et(n){let e=n.keyframes;if(e.length===0)return{values:[],keyTimes:[],keySplines:[],calcMode:"spline"};let t=Qe(n),r=e[0]?.time??0,i=c=>t>0?(c-r)/t:0;if(e.some(c=>c.easing==="steps")){let{values:c,keyTimes:f}=Hf(e,i);return Ur(c,f,[],"discrete",n)}if(n.calcMode==="discrete"){let c=e.map(d=>Je(d.value)),f=e.map(d=>be(i(d.time)));return Ur(c,f,[],"discrete",n)}if(n.calcMode==="paced"){let c=e.map(d=>Je(d.value)),f=e.map(d=>be(i(d.time)));return Ur(c,f,[],"paced",n)}let o=[Je(e[0].value)],a=[be(i(e[0].time))],l=[];for(let c=1;c<e.length;c++)Uf(e[c-1],e[c],i,o,a,l);return Ur(o,a,l,"spline",n)}function Tn(n,e={}){let t=e.defaultCalcMode??"linear",r={};if(n.calcMode==="paced")return t!=="paced"&&(r.calcMode="paced"),r;if(n.calcMode==="discrete")return r.keyTimes=n.keyTimes.join(";"),r.calcMode="discrete",r;let i=n.keySplines.length>0&&!la(n.keySplines);return kn(n.keyTimes)||(r.keyTimes=n.keyTimes.join(";")),i&&(r.calcMode="spline",r.keySplines=n.keySplines.join(";")),r}function ua(n,e){if(n.shapeId!==e.shapeId||n.keyframes.length!==e.keyframes.length||(n.cycleDuration??-1)!==(e.cycleDuration??-1)||(n.cycleRepeats??1)!==(e.cycleRepeats??1)||!!n.cycleInfinite!=!!e.cycleInfinite||(n.cycleBehavior??"restart")!==(e.cycleBehavior??"restart")||(n.additive??"replace")!==(e.additive??"replace")||(n.calcMode??"linear")!==(e.calcMode??"linear")||!!n.locked!=!!e.locked)return!1;let t=(r,i)=>!r&&!i||!!r&&!!i&&r.type===i.type&&r.value===i.value;if(!t(n.beginTrigger,e.beginTrigger)||!t(n.endTrigger,e.endTrigger))return!1;for(let r=0;r<n.keyframes.length;r++){let i=n.keyframes[r],s=e.keyframes[r];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 Jr(n){let e=new Map,t=new Set,r=new Map;for(let i of n){if(!i.enabled||i.keyframes.length<2||i.property!=="translateX"&&i.property!=="translateY"&&i.property!=="scaleX"&&i.property!=="scaleY")continue;let s=r.get(i.shapeId)??[];s.push(i),r.set(i.shapeId,s)}for(let i of r.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)||!ua(a,p))continue;let m=a.property===c?a:p,h=a.property===f?a:p;e.set(m.id,h),t.add(h.id),s.add(m.id),s.add(h.id);break}}}return{partner:e,skip:t}}function Qr(n,e,t,r){if(r){let s=e?r.values:n.values,o=e?n.values:r.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=t?"1":"0";return n.values.map(s=>e?`${i} ${s}`:`${s} ${i}`)}var Pl={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"},_l=new Set(["transformMatrix","rotation","skewX","skewY"]),Rl=new Set(["translateX","translateY","scaleX","scaleY"]);function ei(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function j(n,e){return e==null?"":` ${n}="${ei(e)}"`}function ca(n,e){let t=Tn(n,e);return j("keyTimes",t.keyTimes)+j("calcMode",t.calcMode)+j("keySplines",t.keySplines)}function ti(n,e){return j("dur",`${e}s`)+j("begin",mt(n)||null)+j("repeatCount",Yr(n))}function jf(n){let e=Pl[n.property];if(!e)return"";let t=Qe(n);if(t<=0)return"";let r=et(n);return r.values.length<2?"":"<animate"+j("attributeName",e)+j("values",r.values.join(";"))+ca(r)+ti(n,t)+j("fill",ht(n))+"/>"}function Kf(n){let e;switch(n.property){case"transformMatrix":e="matrix";break;case"rotation":e="rotate";break;case"skewX":e="skewX";break;case"skewY":e="skewY";break;default:return""}let t=Qe(n);if(t<=0)return"";let r=et(n),i=e==="matrix"?r.values.map(o=>Yf(o)):r.values.map(o=>String(o));if(i.length<2||i.some(o=>o.length===0))return"";let s=e==="rotate"&&n.transformOrigin?i.map(o=>`${o} ${n.transformOrigin.x} ${n.transformOrigin.y}`):i;return'<animateTransform attributeName="transform"'+j("type",e)+j("values",s.join(";"))+ca(r)+ti(n,t)+j("additive",qr(n))+j("fill",ht(n))+"/>"}function Xf(n,e,t){let r=n.property==="scaleX"||n.property==="scaleY",i=n.property==="translateY"||n.property==="scaleY",s=r?"scale":"translate",o=Qe(n);if(o<=0)return"";let a=et(n);if(a.values.length<2)return"";let l=e?et(e):void 0,c=Qr(a,i,r,l);if(c.length<2)return"";let f=!n.replacesCarrierBase||t?"sum":null;return'<animateTransform attributeName="transform"'+j("type",s)+j("values",c.join(";"))+ca(a)+ti(n,o)+j("additive",f)+j("fill",ht(n))+"/>"}function Yf(n){if(Array.isArray(n)&&n.length>=6){let e=n.slice(0,6);if(e.every(t=>typeof t=="number"&&Number.isFinite(t)))return e.join(" ")}if(typeof n=="string"){let e=n.trim(),t=/^matrix\(([^)]+)\)$/i.exec(e),i=(t?t[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 qf(n){if(!n.motionPath)return"";let e=Qe(n);if(e<=0)return"";let t=et(n),r=Zr(n),i=!!n.motionPathRef&&(n.motionPathRef.mode??"trackShape")==="curveTemplate",s=Tn(t,{defaultCalcMode:"paced"}),o=Hr(r)&&kn(t.keyTimes)&&t.calcMode!=="discrete"&&s.calcMode===void 0,a="<animateMotion";return i||(a+=j("path",n.motionPath)),a+=j("keyTimes",s.keyTimes),o||(a+=j("keyPoints",r.join(";"))),a+=j("calcMode",s.calcMode)+j("keySplines",s.keySplines),a+=ti(n,e),a+=j("fill",ht(n)),n.motionRotate!==void 0&&(a+=j("rotate",typeof n.motionRotate=="number"?String(n.motionRotate):n.motionRotate)),i?a+=`><mpath href="#${ei(n.motionPathRef.shapeId)}"/></animateMotion>`:a+="/>",a}function wl(n,e){if(_l.has(n.property)||Rl.has(n.property)||n.property==="pathMotion")return"";let t=Pl[n.property];if(!t)return"";let r=n.keyframes[e];return r?"<set"+j("attributeName",t)+j("to",Array.isArray(r.value)?r.value.join(" "):String(r.value))+j("begin",Xr(n,e)||null)+"/>":""}function Zf(n){let e=mt(n);return e?`<discard begin="${ei(e)}"/>`:"<discard/>"}function ni(n){let e=new Map,t=n.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}))})),r=Jr(t),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="${ei(c.sourceSmilId)}"`));let d=e.get(a)??[];d.push(f),e.set(a,d)};for(let a of t){if(!a.enabled||r.skip.has(a.id)||a.keyframes.length<1)continue;if(a.property==="discard"){o(a.shapeId,Zf(a),a);continue}if(jr(a)){o(a.shapeId,wl(a,0),a);continue}if(Kr(a)){for(let c=0;c<a.keyframes.length;c++)o(a.shapeId,wl(a,c),a);continue}if(a.keyframes.length<2)continue;let l="";a.property==="pathMotion"&&a.motionPath?l=qf(a):_l.has(a.property)?(l=Kf(a),l&&s.add(a.shapeId)):Rl.has(a.property)?(l=Xf(a,r.partner.get(a.id),s.has(a.shapeId)),l&&s.add(a.shapeId)):l=jf(a),o(a.shapeId,l,a)}return e}function Et(n,e={}){let{xmlDeclaration:t=!0,backgroundColor:r,indent:i=!0,className:s}=e,o=n.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=n.shapes??[],m=p.filter(D=>D.state?.displayMode==="motionOnly"),h=p.filter(D=>D.state?.displayMode!=="motionOnly"),g=tp(n),b=np(n),$=[...Array.isArray(n.library)?n.library:[],...(b??[]).filter(D=>!D.builtIn&&!(Array.isArray(n.library)&&n.library.some(L=>L.id===D.id)))],k=vn(h,$),S=k.length>0?$n(k):"",x=Ee(h,$),v=rp(g,h,new Set(k.map(D=>D.id))),w=Jf(m),T=S.length>0||x.length>0||v.length>0||w.length>0,P="";T&&(P=`${f}${d}<defs>${f}`,S.length>0&&(P+=`${d}${d}${S}${f}`),x.length>0&&(P+=`${d}${d}${x}${f}`),v.length>0&&(P+=`${d}${d}${v}${f}`),w.length>0&&(P+=`${d}${d}${w}${f}`),P+=`${d}</defs>`);let R="";r&&(R=`${f}${d}<rect width="${a}" height="${l}" fill="${r}"/>`);let M=n.animationTimeline?ni(n.animationTimeline):null,N=h.map(D=>{let L=de(D),K=M?.get(D.id);return K&&K.length>0&&(L=ip(L,K,d)),`${d}${L}`}).join(f),B="";return t&&(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,h.length>0&&(B+=`${f}${N}`),B+=`${f}</svg>${f}`,B}function Jf(n){if(n.length===0)return"";let e=[];for(let t of n){let r=Qf(t);if(!r)continue;let i=ep(r);e.push(`<path id="${Al(t.id)}" d="${Al(i)}"/>`)}return e.join("")}function Qf(n){let e=n.state;if(typeof e?.d=="string")return e.d;switch(n.type){case"rectangle":{let t=e?.x??0,r=e?.y??0,i=e?.width??0,s=e?.height??0;return i<=0||s<=0?null:`M${t},${r}h${i}v${s}h${-i}Z`}case"circle":{let t=e?.cx??0,r=e?.cy??0,i=e?.radius??0;return i<=0?null:`M${t-i},${r}A${i},${i} 0 1 0 ${t+i},${r}A${i},${i} 0 1 0 ${t-i},${r}Z`}case"ellipse":{let t=e?.cx??0,r=e?.cy??0,i=e?.rx??0,s=e?.ry??0;return i<=0||s<=0?null:`M${t-i},${r}A${i},${s} 0 1 0 ${t+i},${r}A${i},${s} 0 1 0 ${t-i},${r}Z`}case"line":{let t=e?.x1??0,r=e?.y1??0,i=e?.x2??0,s=e?.y2??0;return`M${t},${r}L${i},${s}`}default:return null}}function ep(n){let e=/[Mm]\s*(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)[\s,]+(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/.exec(n);if(!e)return n;let t=parseFloat(e[1]),r=parseFloat(e[2]);if(!isFinite(t)||!isFinite(r)||t===0&&r===0)return n;let i=!0;return n.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-t);else if(l==="V")for(let m of d)p.push(m-r);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]-t),m+6<d.length&&p.push(d[m+6]-r);else for(let m=0;m<d.length;m+=2)p.push(d[m]-t),m+1<d.length&&p.push(d[m+1]-r);return`${o} ${p.join(" ")}`})}function Al(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}function tp(n){let t=(Array.isArray(n.library)?n.library:[]).filter(r=>r.kind==="symbol");return t.length>0?t:n.symbols??[]}function np(n){let t=(Array.isArray(n.library)?n.library:[]).filter(r=>r.kind==="marker");return t.length>0?t:n.markers}var da=n=>n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function rp(n,e,t=new Set){if(n.length===0)return"";let r=new Map;for(let l of n)r.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=r.get(c.state.symbolId??"");if(!d)continue;let p=Ct(c);if(s.has(p))continue;s.add(p);let m=Br(d,c);o.push(...m),!t.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(h=>de(h)).join(""),p=c.viewBox?` viewBox="${da(c.viewBox)}"`:"",m=c.overflow?` overflow="${da(c.overflow)}"`:"";a.push(`<symbol id="${da(l)}"${p}${m}>${d}</symbol>`)}return a.join("")}function ip(n,e,t){let r=e.join(""),i=0;for(;i<n.length;){let c=n.slice(i);if(!/^<defs[\s>]/.test(c))break;let f=n.indexOf("</defs>",i);if(f===-1)break;i=f+7}let s=n.slice(0,i),o=n.slice(i),a=o.lastIndexOf("/>");if(a!==-1){let c=o.match(/^<(\w+)/),f=c?c[1]:"g";return s+o.slice(0,a)+">"+r+`</${f}>`}let l=o.match(/<\/(\w+)>$/);if(l){let c=o.lastIndexOf(`</${l[1]}>`);return s+o.slice(0,c)+r+o.slice(c)}return s+o+r}var Ot=Math.PI*2;function sp(n,e,t,r){let i=e*e-4*n*t;if(!(i>=0))return;let s=Math.sqrt(i),o=-.5*(e+(e>=0?s:-s));if(n!==0){let a=o/n;a>0&&a<1&&r.push(a)}if(o!==0){let a=t/o;a>0&&a<1&&r.push(a)}}function ap(n,e,t,r,i){let s=1-i;return s*s*s*n+3*s*s*i*e+3*s*i*i*t+i*i*i*r}function op(n,e,t,r){let i=1-r;return i*i*n+2*i*r*e+r*r*t}function si(n,e,t,r){let i=n<r?n:r,s=n>r?n:r,o=-n+3*e-3*t+r,a=2*(n-2*e+t),l=e-n,c=[];sp(o,a,l,c);for(let f of c){let d=ap(n,e,t,r,f);d<i&&(i=d),d>s&&(s=d)}return{min:i,max:s}}function ai(n,e,t){let r=n<t?n:t,i=n>t?n:t,s=n-2*e+t;if(s!==0){let o=(n-e)/s;if(o>0&&o<1){let a=op(n,e,t,o);a<r&&(r=a),a>i&&(i=a)}}return{min:r,max:i}}function Il(n,e,t,r){let i=n*r-e*t>=0?1:-1,s=Math.sqrt((n*n+e*e)*(t*t+r*r));if(s===0)return 0;let o=(n*t+e*r)/s;return o<-1?o=-1:o>1&&(o=1),i*Math.acos(o)}function pa(n,e,t,r,i,s,o,a,l){if(n===a&&e===l||t===0||r===0)return null;let c=Math.abs(t),f=Math.abs(r),d=i%360*Math.PI/180,p=Math.cos(d),m=Math.sin(d),h=(n-a)/2,g=(e-l)/2,b=p*h+m*g,$=-m*h+p*g,k=b*b,S=$*$,x=c*c,v=f*f,w=k/x+S/v;if(w>1){let me=Math.sqrt(w);c*=me,f*=me,x=c*c,v=f*f}let T=x*S+v*k;if(T===0)return null;let P=(x*v-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+(n+a)/2,D=m*M+p*N+(e+l)/2,L=(b-M)/c,K=($-N)/f,C=(-b-M)/c,re=(-$-N)/f,ee=Il(1,0,L,K),Z=Il(L,K,C,re);return!o&&Z>0?Z-=Ot:o&&Z<0&&(Z+=Ot),{cx:B,cy:D,rx:c,ry:f,phi:d,theta1:ee,deltaTheta:Z}}function lp(n,e){let t=Math.cos(n.phi),r=Math.sin(n.phi),i=Math.cos(e),s=Math.sin(e);return{x:n.cx+n.rx*t*i-n.ry*r*s,y:n.cy+n.rx*r*i+n.ry*t*s}}function up(n,e,t){if(t>=0){let i=(n-e)%Ot;return i<0&&(i+=Ot),i<=t}let r=(e-n)%Ot;return r<0&&(r+=Ot),r<=-t}function ma(n,e,t,r,i,s,o,a,l){let c={minX:Math.min(n,a),minY:Math.min(e,l),maxX:Math.max(n,a),maxY:Math.max(e,l)},f=pa(n,e,t,r,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),h=Math.atan2(f.ry*d,f.rx*p),g=[m,m+Math.PI,h,h+Math.PI];for(let b of g){if(!up(b,f.theta1,f.deltaTheta))continue;let $=lp(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 cp="MmLlHhVvCcSsQqTtAaZz";function ri(n){return n>=48&&n<=57}function dp(n){return n===32||n===9||n===10||n===12||n===13}var fa=class{constructor(e){this.d=e}d;i=0;skipWsp(){for(;this.i<this.d.length&&dp(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&&cp.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,t=this.i,r=this.i,i=e.charCodeAt(r);(i===43||i===45)&&r++;let s=0;for(;r<e.length&&ri(e.charCodeAt(r));)r++,s++;if(e.charCodeAt(r)===46)for(r++;r<e.length&&ri(e.charCodeAt(r));)r++,s++;if(s===0)return null;let o=e.charCodeAt(r);if(o===101||o===69){let l=r+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&&(r=l)}let a=Number.parseFloat(e.slice(t,r));return Number.isFinite(a)?(this.i=r,a):null}readFlag(){this.skipCommaWsp();let e=this.d[this.i];return e==="0"?(this.i++,!1):e==="1"?(this.i++,!0):null}};function ii(n,e,t){e<n.minX&&(n.minX=e),e>n.maxX&&(n.maxX=e),t<n.minY&&(n.minY=t),t>n.maxY&&(n.maxY=t),n.any=!0}function ha(n,e){e.minX<n.minX&&(n.minX=e.minX),e.maxX>n.maxX&&(n.maxX=e.maxX),e.minY<n.minY&&(n.minY=e.minY),e.maxY>n.maxY&&(n.maxY=e.maxY),n.any=!0}function Ml(n,e,t,r,i,s,o,a,l){let c=si(e,r,s,a),f=si(t,i,o,l);ha(n,{minX:c.min,maxX:c.max,minY:f.min,maxY:f.max})}function Cl(n,e,t,r,i,s,o){let a=ai(e,r,s),l=ai(t,i,o);ha(n,{minX:a.min,maxX:a.max,minY:l.min,maxY:l.max})}function ga(n){if(!n)return null;let e=new fa(n),t={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,any:!1},r=0,i=0,s=0,o=0,a=0,l=0,c=null,f="",d=!1,p=()=>t.any?{minX:t.minX,minY:t.minY,maxX:t.maxX,maxY:t.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 h=f>="a"&&f<="z";switch(f){case"M":case"m":{let g=e.readNumber(),b=e.readNumber();if(g===null||b===null)return p();r=h?r+g:g,i=h?i+b:b,s=r,o=i,ii(t,r,i),c=null,f=h?"l":"L";break}case"L":case"l":{let g=e.readNumber(),b=e.readNumber();if(g===null||b===null)return p();r=h?r+g:g,i=h?i+b:b,ii(t,r,i),c=null;break}case"H":case"h":{let g=e.readNumber();if(g===null)return p();r=h?r+g:g,ii(t,r,i),c=null;break}case"V":case"v":{let g=e.readNumber();if(g===null)return p();i=h?i+g:g,ii(t,r,i),c=null;break}case"C":case"c":{let g=e.readNumber(),b=e.readNumber(),$=e.readNumber(),k=e.readNumber(),S=e.readNumber(),x=e.readNumber();if(g===null||b===null||$===null||k===null||S===null||x===null)return p();let v=h?r+g:g,w=h?i+b:b,T=h?r+$:$,P=h?i+k:k,R=h?r+S:S,M=h?i+x:x;Ml(t,r,i,v,w,T,P,R,M),a=T,l=P,c="cubic",r=R,i=M;break}case"S":case"s":{let g=e.readNumber(),b=e.readNumber(),$=e.readNumber(),k=e.readNumber();if(g===null||b===null||$===null||k===null)return p();let S=c==="cubic"?2*r-a:r,x=c==="cubic"?2*i-l:i,v=h?r+g:g,w=h?i+b:b,T=h?r+$:$,P=h?i+k:k;Ml(t,r,i,S,x,v,w,T,P),a=v,l=w,c="cubic",r=T,i=P;break}case"Q":case"q":{let g=e.readNumber(),b=e.readNumber(),$=e.readNumber(),k=e.readNumber();if(g===null||b===null||$===null||k===null)return p();let S=h?r+g:g,x=h?i+b:b,v=h?r+$:$,w=h?i+k:k;Cl(t,r,i,S,x,v,w),a=S,l=x,c="quad",r=v,i=w;break}case"T":case"t":{let g=e.readNumber(),b=e.readNumber();if(g===null||b===null)return p();let $=c==="quad"?2*r-a:r,k=c==="quad"?2*i-l:i,S=h?r+g:g,x=h?i+b:b;Cl(t,r,i,$,k,S,x),a=$,l=k,c="quad",r=S,i=x;break}case"A":case"a":{let g=e.readNumber(),b=e.readNumber(),$=e.readNumber(),k=e.readFlag(),S=e.readFlag(),x=e.readNumber(),v=e.readNumber();if(g===null||b===null||$===null||k===null||S===null||x===null||v===null)return p();let w=h?r+x:x,T=h?i+v:v;ha(t,ma(r,i,g,b,$,k,S,w,T)),r=w,i=T,c=null;break}case"Z":case"z":{r=s,i=o,c=null;break}default:return p()}}return p()}function Dl(n,e,t=!1,r=.5,i){return n.length===0?null:ga(qe(n,e,t,r,i))}function oi(n,e){let t=Fe(n,e);return Et(n,{width:t.width,height:t.height,xmlDeclaration:e.xmlDeclaration??!1,indent:!0})}function fp(n){return n==="class"?"className":n==="for"?"htmlFor":n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Fl(n){return n.replace(/\s([a-z][a-z-]*?)=/g,(e,t)=>t.startsWith("data-")||t.startsWith("aria-")?e:` ${fp(t)}=`)}function li(n,e){let t=e.componentName??"SvgComponent",r=Fe(n,e),i=e.indent??" ",s=n.shapes??[],o=e.typescript??!1,a=Array.isArray(n.library)?n.library:[],l=Ze(s,a),c=Ee(s,a),f=l+c,d=f.length>0,p=s.map(h=>{let g=de(h);return`${i}${i}${i}${Fl(g)}`}),m=[];m.push("import React from 'react';"),m.push(""),o?(m.push(`interface ${t}Props {`),m.push(`${i}className?: string;`),m.push(`${i}style?: React.CSSProperties;`),m.push("}"),m.push(""),m.push(`const ${t}: React.FC<${t}Props> = ({ className, style }) => {`)):m.push(`const ${t} = ({ className, style }) => {`),m.push(`${i}return (`),m.push(`${i}${i}<svg xmlns="http://www.w3.org/2000/svg" width="${r.width}" height="${r.height}" viewBox="0 0 ${r.width} ${r.height}" className={className} style={style}>`),d&&(m.push(`${i}${i}${i}<defs>`),m.push(`${i}${i}${i}${i}${Fl(f)}`),m.push(`${i}${i}${i}</defs>`));for(let h of p)m.push(h);return m.push(`${i}${i}</svg>`),m.push(`${i});`),m.push("};"),m.push(""),m.push(`export default ${t};`),m.push(""),m.join(`
|
|
14
|
+
`)}function ui(n,e){let t=e.componentName??"SvgComponent",r=Fe(n,e),i=e.indent??" ",s=n.shapes??[],o=e.typescript??!1,a=Array.isArray(n.library)?n.library:[],l=Ze(s,a),c=Ee(s,a),f=l+c,d=f.length>0,p=s.map(h=>`${i}${i}${de(h)}`),m=[];m.push("<template>"),m.push(`${i}<svg xmlns="http://www.w3.org/2000/svg" width="${r.width}" height="${r.height}" viewBox="0 0 ${r.width} ${r.height}" :class="className" :style="style">`),d&&(m.push(`${i}${i}<defs>`),m.push(`${i}${i}${i}${f}`),m.push(`${i}${i}</defs>`));for(let h of p)m.push(h);return m.push(`${i}</svg>`),m.push("</template>"),m.push(""),o?m.push('<script setup lang="ts">'):m.push("<script setup>"),m.push(`// ${t}`),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 pp=new Set(["circle","ellipse","rectangle","square","line","text","image"]);function El(n){return n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function Ol(n){return n.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function mp(n){if(!pp.has(n.type))return!0;let e=n.state.metadata;return!!(e?.title||e?.description||n.type==="text"&&n.state.isTextPath)}function ci(n,e){let t=e.componentName??"createSvg",r=Fe(n,e),i=e.indent??" ",s=n.shapes??[],o=e.typescript??!1,a=[];a.push("import * as d3 from 'd3';"),a.push(""),o?a.push(`export function ${t}(container: string | HTMLElement): d3.Selection<SVGSVGElement, unknown, HTMLElement, unknown> {`):a.push(`export function ${t}(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', ${r.width})`),a.push(`${i}${i}.attr('height', ${r.height})`),a.push(`${i}${i}.attr('viewBox', '0 0 ${r.width} ${r.height}');`),a.push("");let l=Array.isArray(n.library)?n.library:[],c=Ze(s,l),f=Ee(s,l),d=`${c}${f}`;d.length>0&&(a.push(`${i}svg.append('defs').html(\`${Ol(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}`:""}`),mp(m)){a.push(`${i}svg.append('g').html(\`${Ol(de(m))}\`);`),a.push("");continue}let h=ol(m),g=Mr(m),b=`shape${p+1}`;a.push(`${i}const ${b} = svg.append('${h}')`);for(let[$,k]of g)a.push(`${i}${i}.attr('${$}', '${El(k)}')`);m.type==="text"&&m.state.text&&a.push(`${i}${i}.text('${El(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 Ll(n,e){let t=n.state.metadata?.name;return t?t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""):`${n.type}-${e+1}`}var hp=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linecap","opacity","transform","filter"]);function di(n,e){let t=Fe(n,e),r=e.indent??" ",i=n.shapes??[],s=[];for(let l=0;l<i.length;l++){let c=i[l],f=Ll(c,l),d=Mr(c),p=[];for(let[m,h]of d)hp.has(m)&&p.push(`${r}${m}: ${h};`);p.length>0&&s.push(`.${f} {
|
|
17
17
|
${p.join(`
|
|
18
18
|
`)}
|
|
19
|
-
}`)}let o=[];for(let l=0;l<i.length;l++){let c=i[l],f=
|
|
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});
|
|
19
|
+
}`)}let o=[];for(let l=0;l<i.length;l++){let c=i[l],f=Ll(c,l),d=de(c),p=d.indexOf(" ");p!==-1&&(d=d.slice(0,p)+` class="${f}"`+d.slice(p)),o.push(`${r}${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="${t.width}" height="${t.height}" viewBox="0 0 ${t.width} ${t.height}">`);for(let l of o)a.push(l);return a.push("</svg>"),a.push(""),a.join(`
|
|
20
|
+
`)}function fi(n,e){let t=gp(n,e),r={...e};switch(r.format){case"svg":return oi(t,r);case"react":return li(t,r);case"vue":return ui(t,r);case"d3":return ci(t,r);case"css":return di(t,r);default:throw new Error(`Unsupported code format: ${r.format}`)}}function gp(n,e){return Array.isArray(n)?{shapes:n,viewboxes:[{id:"default",x:0,y:0,width:e.width??800,height:e.height??600}]}:n}var wn=class n{_snapshot;constructor(e={}){let{width:t=800,height:r=600,viewboxId:i}=e,s=fn(0,0,t,r,i);this._snapshot=lr({viewboxes:[s]})}static fromSnapshot(e){let t=new n;return t._snapshot=JSON.parse(JSON.stringify(e)),t}static fromJSON(e,t){let r=cr(e,t),i=new n;return i._snapshot=r,i}add(e){let t="build"in e&&typeof e.build=="function"?e.build():e;return this._snapshot.shapes.push(t),this}addAll(...e){for(let t of e)this.add(t);return this}remove(e){let t=this._snapshot.shapes.length;return this._snapshot.shapes=this._snapshot.shapes.filter(r=>r.id!==e),this._snapshot.shapes.length<t}get shapes(){return this._snapshot.shapes}findShape(e){return this._snapshot.shapes.find(t=>t.id===e)}size(e,t){return this._snapshot.viewboxes.length>0?(this._snapshot.viewboxes[0].width=e,this._snapshot.viewboxes[0].height=t):this._snapshot.viewboxes=[fn(0,0,e,t)],this}get width(){return this._snapshot.viewboxes[0]?.width??800}get height(){return this._snapshot.viewboxes[0]?.height??600}title(e){return this._ensureMetadata(),this._snapshot.documentMetadata.title=e,this}description(e){return this._ensureMetadata(),this._snapshot.documentMetadata.description=e,this}author(e){return this._ensureMetadata(),this._snapshot.documentMetadata.author=e,this}keywords(...e){return this._ensureMetadata(),this._snapshot.documentMetadata.keywords=e,this}license(e,t){return this._ensureMetadata(),this._snapshot.documentMetadata.license=e,t!==void 0&&(this._snapshot.documentMetadata.licenseUrl=t),this}language(e){return this._ensureMetadata(),this._snapshot.documentMetadata.language=e,this}customMetadata(e){return this._ensureMetadata(),this._snapshot.documentMetadata.customMetadata={...this._snapshot.documentMetadata.customMetadata,...e},this}get meta(){return this._snapshot.documentMetadata}defineSymbol(e,t,r){let i=_(),s=t.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o={kind:"symbol",id:i,name:e,viewBox:r?.viewBox??"0 0 100 100",shapes:s};return r?.groups&&(o.groups=r.groups),r?.thumbnail&&(o.thumbnail=r.thumbnail),r?.defKind&&(o.defKind=r.defKind),r?.wrapperAttrs&&(o.wrapperAttrs=r.wrapperAttrs),r?.variantAxes&&(o.variantAxes=r.variantAxes),r?.variants&&(o.variants=r.variants),r?.variantThumbnails&&(o.variantThumbnails=r.variantThumbnails),this._pushLibraryDef(o),i}placeSymbolInstance(e,t,r,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:t,y:r,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.library)return!1;let t=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(r=>!(r.kind==="symbol"&&r.id===e)),this._snapshot.library.length<t}get symbols(){return(this._snapshot.library??[]).filter(e=>e.kind==="symbol")}defineMarker(e,t,r){let i=_(),s=t.map(a=>"build"in a&&typeof a.build=="function"?a.build():a),o={kind:"marker",id:i,name:e,viewBox:r?.viewBox??"0 0 10 10",refX:r?.refX??5,refY:r?.refY??5,markerWidth:r?.markerWidth??10,markerHeight:r?.markerHeight??10,markerUnits:r?.markerUnits??"strokeWidth",orient:r?.orient??"auto",shapes:s};return r?.groups&&(o.groups=r.groups),r?.thumbnail&&(o.thumbnail=r.thumbnail),this._pushLibraryDef(o),i}defineFilter(e,t,r){let i=_(),s={kind:"filter",id:i,name:e,filters:t};return r?.colorInterpolation&&(s.colorInterpolation=r.colorInterpolation),r?.filterUnits&&(s.filterUnits=r.filterUnits),r?.primitiveUnits&&(s.primitiveUnits=r.primitiveUnits),r?.x!==void 0&&(s.x=r.x),r?.y!==void 0&&(s.y=r.y),r?.width!==void 0&&(s.width=r.width),r?.height!==void 0&&(s.height=r.height),r?.thumbnail&&(s.thumbnail=r.thumbnail),this._pushLibraryDef(s),i}defineLinearGradientLibrary(e,t,r){let i=_(),s="build"in t?t.build():t,{id:o,sourceId:a,...l}=s,c={kind:"linear-gradient",id:i,name:e,gradient:l};return r?.thumbnail&&(c.thumbnail=r.thumbnail),this._pushLibraryDef(c),i}defineRadialGradientLibrary(e,t,r){let i=_(),s="build"in t?t.build():t,{id:o,sourceId:a,...l}=s,c={kind:"radial-gradient",id:i,name:e,gradient:l};return r?.thumbnail&&(c.thumbnail=r.thumbnail),this._pushLibraryDef(c),i}definePatternLibrary(e,t,r){let i=_(),s="build"in t?t.build():t,{id:o,sourceId:a,customPatternId:l,...c}=s,f={kind:"pattern",id:i,name:e,pattern:c};return r?.thumbnail&&(f.thumbnail=r.thumbnail),this._pushLibraryDef(f),i}removeLibraryDef(e){if(!this._snapshot.library)return!1;let t=this._snapshot.library.length;return this._snapshot.library=this._snapshot.library.filter(r=>r.id!==e),this._snapshot.library.length<t}get library(){return this._snapshot.library??[]}_pushLibraryDef(e){this._snapshot.library||(this._snapshot.library=[]);let t=this._snapshot.library.findIndex(r=>r.id===e.id);t>=0?this._snapshot.library[t]=e:this._snapshot.library.push(e)}addClipGroup(e,t,r){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=_(),s={id:i,type:"clip",clipShapeIds:e,contentShapeIds:t,parentId:null};return r?.clipPathUnits&&(s.clipPathUnits=r.clipPathUnits),r?.clipRule&&(s.clipRule=r.clipRule),r?.rawDefinition&&(s.rawDefinition=r.rawDefinition),this._snapshot.clipMaskGroups.push(s),i}addMaskGroup(e,t,r){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let i=_(),s={id:i,type:"mask",clipShapeIds:e,contentShapeIds:t,parentId:null};return r?.maskUnits&&(s.maskUnits=r.maskUnits),r?.maskContentUnits&&(s.maskContentUnits=r.maskContentUnits),r?.maskBounds&&(s.maskBounds=r.maskBounds),r?.maskType&&(s.maskType=r.maskType),r?.rawDefinition&&(s.rawDefinition=r.rawDefinition),this._snapshot.clipMaskGroups.push(s),i}removeClipMaskGroup(e){if(!this._snapshot.clipMaskGroups)return!1;let t=this._snapshot.clipMaskGroups.length;return this._snapshot.clipMaskGroups=this._snapshot.clipMaskGroups.filter(r=>r.id!==e),this._snapshot.clipMaskGroups.length<t}addGuide(e,t,r){this._snapshot.guides||(this._snapshot.guides=[]);let i=_(),s={id:i,orientation:e,position:t,controlPointOffset:0};return r?.color&&(s.color=r.color),r?.opacity!==void 0&&(s.opacity=r.opacity),this._snapshot.guides.push(s),i}removeGuide(e){if(!this._snapshot.guides)return!1;let t=this._snapshot.guides.length;return this._snapshot.guides=this._snapshot.guides.filter(r=>r.id!==e),this._snapshot.guides.length<t}clearGuides(){return this._snapshot.guides=[],this}get guides(){return this._snapshot.guides??[]}addMeasurement(e,t,r){this._snapshot.measurements||(this._snapshot.measurements=[]);let i=_(),s={id:i,type:e,points:t,visible:r?.visible??!0,snapDivisions:r?.snapDivisions??1};return r?.color&&(s.color=r.color),r?.opacity!==void 0&&(s.opacity=r.opacity),this._snapshot.measurements.push(s),i}removeMeasurement(e){if(!this._snapshot.measurements)return!1;let t=this._snapshot.measurements.length;return this._snapshot.measurements=this._snapshot.measurements.filter(r=>r.id!==e),this._snapshot.measurements.length<t}get measurements(){return this._snapshot.measurements??[]}addCustomPattern(e,t,r,i){let s=_();return this._pushLibraryDef(Ue({id:s,name:e,svgContent:t,width:r,height:i})),s}removeCustomPattern(e){let t=this._snapshot.library;if(!t)return!1;let r=t.length;return this._snapshot.library=t.filter(i=>!(i.kind==="pattern"&&i.id===e)),this._snapshot.library.length<r}get customPatterns(){let e=[];for(let t of this._snapshot.library??[]){if(t.kind!=="pattern")continue;let r=kt(t);r&&e.push(r)}return e}addGroup(e,t){this._snapshot.groups||(this._snapshot.groups=[]);let r=e??_();return this._snapshot.groups.push({id:r,parentId:t??null}),r}removeGroup(e){if(!this._snapshot.groups)return!1;let t=this._snapshot.groups.length;this._snapshot.groups=this._snapshot.groups.filter(r=>r.id!==e);for(let r of this._snapshot.shapes)r.state.groupId===e&&delete r.state.groupId;return this._snapshot.groups.length<t}moveToGroup(e,t){let r=this._snapshot.shapes.find(i=>i.id===e);return r&&(r.state.groupId=t),this}removeFromGroup(e){let t=this._snapshot.shapes.find(r=>r.id===e);return t&&delete t.state.groupId,this}bringToFront(e){let t=this._snapshot.shapes.findIndex(r=>r.id===e);if(t>=0){let[r]=this._snapshot.shapes.splice(t,1);this._snapshot.shapes.push(r)}return this}sendToBack(e){let t=this._snapshot.shapes.findIndex(r=>r.id===e);if(t>=0){let[r]=this._snapshot.shapes.splice(t,1);this._snapshot.shapes.unshift(r)}return this}reorder(e,t){let r=this._snapshot.shapes.findIndex(i=>i.id===e);if(r>=0){let[i]=this._snapshot.shapes.splice(r,1),s=Math.max(0,Math.min(t,this._snapshot.shapes.length));this._snapshot.shapes.splice(s,0,i)}return this}defineVariable(e,t,r,i){this._snapshot.templateVariables||(this._snapshot.templateVariables=[]);let s=this._snapshot.templateVariables.find(o=>o.name===e);if(s)s.type=t,s.defaultValue=r,i?.label!==void 0&&(s.label=i.label),i?.description!==void 0&&(s.description=i.description);else{let o={name:e,type:t,defaultValue:r};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(t=>t.name!==e)),this}get variables(){return this._snapshot.templateVariables??[]}inspectVariables(){return hr(this._snapshot)}setTimeline(e){return"build"in e&&typeof e.build=="function"?this._snapshot.animationTimeline=e.build():this._snapshot.animationTimeline=e,this}clearTimeline(){return delete this._snapshot.animationTimeline,this}get timeline(){return this._snapshot.animationTimeline}toSVG(e){let{variables:t,...r}=e??{},i=mr(this._snapshot,t);return Et(i,r)}toJSON(e){return ur(this._snapshot,e)}toSnapshot(){return JSON.parse(JSON.stringify(this._snapshot))}toCode(e,t){return fi(this._snapshot,{...t,format:e})}_ensureMetadata(){this._snapshot.documentMetadata||(this._snapshot.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{}})}};var pi=class{_track;constructor(e,t){this._track={id:_(),shapeId:e,property:t,keyframes:[],enabled:!0,locked:!1}}id(e){return this._track.id=e,this}keyframe(e,t,r="linear"){return this._track.keyframes.push({id:_(),time:e,value:t,easing:r}),this}keyframeBezier(e,t,r){return this._track.keyframes.push({id:_(),time:e,value:t,easing:"custom-bezier",customBezier:r}),this}keyframeLinear(e,t,r){return this._track.keyframes.push({id:_(),time:e,value:t,easing:"linear-function",linearPoints:r}),this}keyframes(...e){return this._track.keyframes.push(...e.map(t=>t.id?t:{...t,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,t="trackShape"){return this._track.motionPathRef={shapeId:e,mode:t},this}beginTrigger(e,t){return this._track.beginTrigger={type:e,value:t},this}endTrigger(e,t){return this._track.endTrigger={type:e,value:t},this}cycleDuration(e){return this._track.cycleDuration=e,this}cycleRepeats(e){return this._track.cycleRepeats=e,this}infinite(){return this._track.cycleInfinite=!0,this}cycle(e){return this._track.cycleBehavior=e,this}transformOrigin(e,t){return this._track.transformOrigin={x:e,y:t},this}motionRotate(e){return this._track.motionRotate=e,this}additive(e){return this._track.additive=e,this}build(){let e=[...this._track.keyframes].sort((t,r)=>t.time-r.time);return{...this._track,keyframes:e}}},mi=class{_duration;_loop=!1;_playbackSpeed=1;_tracks=[];constructor(e){this._duration=e}loop(e=!0){return this._loop=e,this}speed(e){return this._playbackSpeed=e,this}duration(e){return this._duration=e,this}addTrack(e){return this._tracks.push(e),this}addTracks(...e){return this._tracks.push(...e),this}buildTimeline(){return{duration:this._duration,loop:this._loop,playbackSpeed:this._playbackSpeed,tracks:this._tracks.map(e=>e.build())}}build(){let e=this.buildTimeline();return{duration:e.duration,loop:e.loop,playbackSpeed:e.playbackSpeed,tracks:e.tracks.map(t=>({id:t.id,shapeId:t.shapeId,property:t.property,enabled:t.enabled,locked:t.locked||void 0,motionPath:t.motionPath,motionPathRef:t.motionPathRef,beginTrigger:t.beginTrigger,endTrigger:t.endTrigger,cycleDuration:t.cycleDuration,cycleRepeats:t.cycleRepeats,cycleInfinite:t.cycleInfinite,cycleBehavior:t.cycleBehavior,transformOrigin:t.transformOrigin,motionRotate:t.motionRotate,additive:t.additive,keyframes:t.keyframes.map(r=>({...r.id?{id:r.id}:{},time:r.time,value:r.value,easing:r.easing,...r.customBezier?{customBezier:r.customBezier}:{},...r.linearPoints?{linearPoints:r.linearPoints}:{}}))}))}}};var ae=class{_id;_type;_state={};constructor(e,t){this._type=e,this._id=t??_()}id(e){return this._id=e,this}locked(e=!0){return this._state.locked=e,this}visible(e=!0){return this._state.visible=e,this}displayMode(e){return this._state.displayMode=e,this}motionOnly(){return this._state.displayMode="motionOnly",this}fill(e,t){return this._state.fillColor=e,this._state.fillType="solid",t!==void 0&&(this._state.fillOpacity=t),this}noFill(){return this._state.fillType="none",this}fillGradient(e){let t="build"in e?e.build():e;return this._state.fillType=t.type,this._state.fillGradient=t,this}fillPattern(e){let t="build"in e?e.build():e;return this._state.fillType="pattern",this._state.fillGradient=t,this}fillOpacity(e){return this._state.fillOpacity=e,this}fillRule(e){return this._state.fillRule=e,this}stroke(e,t){return this._state.borderColor=e,t!==void 0&&(this._state.borderWidth=t),this}noStroke(){return this._state.borderColor="none",this._state.borderWidth=0,this}strokeWidth(e){return this._state.borderWidth=e,this}strokeOpacity(e){return this._state.strokeOpacity=e,this}strokeGradient(e){let t="build"in e?e.build():e;return this._state.strokeType=t.type,this._state.strokeGradient=t,this}strokePattern(e){let t="build"in e?e.build():e;return this._state.strokeType="pattern",this._state.strokeGradient=t,this}strokeLinejoin(e){return this._state.strokeLinejoin=e,this}strokeLinecap(e){return this._state.strokeLinecap=e,this}strokeMiterlimit(e){return this._state.strokeMiterlimit=e,this}dashOffset(e){return this._state.dashOffset=e,this}strokeDasharray(e){return this._state.strokeDasharray=e,this}dash(e,t,r){return this._state.lineStyle=e,e==="custom"&&(t!==void 0&&(this._state.dashLength=t),r!==void 0&&(this._state.gapLength=r)),this}opacity(e){return this._state.opacity=e,this}rotate(e){return this._state.rotation=e,this.refreshTransformMatrix(),this}skew(e,t){return this._state.skewX=e,this._state.skewY=t,this.refreshTransformMatrix(),this}scale(e,t){return this._state.scaleX=e,this._state.scaleY=t??e,this.refreshTransformMatrix(),this}pivot(e,t){return this._state.customPivot={x:e,y:t},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=Ye(ln(this._state,this.defaultTransformPivot()))}defaultTransformPivot(){let e=this._state.customPivot;if(e)return e;let t=this._state.x,r=this._state.y,i=this._state.width,s=this._state.height;if(t!==void 0&&r!==void 0&&i!==void 0&&s!==void 0)return{x:t+i/2,y:r+s/2};let o=this._state.radius;if(t!==void 0&&r!==void 0&&o!==void 0)return{x:t,y:r};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 h=this._state.polylinePoints;if(h?.[0])return h[0]}filter(...e){let t=this._state.filters??[];return this._state.filters=[...t,...e],this}dropShadow(e={}){let t={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(t)}innerShadow(e={}){let t={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(t)}blur(e,t,r){let i=e??4,s=t??i,o={id:`gaussian-blur-${_()}`,type:"gaussian-blur",enabled:!0,blurX:i,blurY:s,linked:i===s,quality:r?.quality??"normal"};return this.filter(o)}glow(e={}){let t={id:`glow-${_()}`,type:"glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(t)}innerGlow(e={}){let t={id:`inner-glow-${_()}`,type:"inner-glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(t)}grayscale(e=1){let t={id:`grayscale-${_()}`,type:"grayscale",enabled:!0,amount:e};return this.filter(t)}sepia(e=1){let t={id:`sepia-${_()}`,type:"sepia",enabled:!0,amount:e};return this.filter(t)}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 t={id:`motion-blur-${_()}`,type:"motion-blur",enabled:!0,distance:e.distance??10,angle:e.angle??0,quality:e.quality??"normal"};return this.filter(t)}pointLight(e={}){let t={id:`point-light-${_()}`,type:"point-light",enabled:!0,x:e.x??100,y:e.y??100,z:e.z??200,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,diffuseConstant:e.diffuseConstant??1,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(t)}spotLight(e={}){let t={id:`spot-light-${_()}`,type:"spot-light",enabled:!0,x:e.x??100,y:e.y??0,z:e.z??200,pointsAtX:e.pointsAtX??100,pointsAtY:e.pointsAtY??100,pointsAtZ:e.pointsAtZ??0,coneAngle:e.coneAngle??30,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(t)}sharpen(e=1){let t={id:`sharpen-${_()}`,type:"sharpen",enabled:!0,amount:e};return this.filter(t)}pixelate(e=8){let t={id:`pixelate-${_()}`,type:"pixelate",enabled:!0,blockSize:e};return this.filter(t)}warp(e={}){let t={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(t)}morphology(e={}){let t=e.radiusX??2,r=e.radiusY??t,i={id:`morphology-${_()}`,type:"morphology",enabled:!0,operator:e.operator??"dilate",radiusX:t,radiusY:r,linked:e.linked??t===r};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 r={id:`contouring-discrete-${_()}`,type:"contouring-discrete",enabled:!0,levels:e.levels??4};return this.filter(r)}roundEdges(e=4){let t={id:`round-edges-${_()}`,type:"round-edges",enabled:!0,radius:e};return this.filter(t)}channelPainter(e={}){let t={id:`channel-painter-${_()}`,type:"channel-painter",enabled:!0,red:e.red??1,green:e.green??1,blue:e.blue??1};return this.filter(t)}brightness(e=1){let t={id:`brightness-${_()}`,type:"brightness",enabled:!0,amount:e};return this.filter(t)}contrast(e=1){let t={id:`contrast-${_()}`,type:"contrast",enabled:!0,amount:e};return this.filter(t)}filterOpacity(e=1){let t={id:`opacity-${_()}`,type:"opacity",enabled:!0,amount:e};return this.filter(t)}invert(e=1){let t={id:`invert-${_()}`,type:"invert",enabled:!0,amount:e};return this.filter(t)}hueRotate(e=0){let t={id:`hue-rotate-${_()}`,type:"hue-rotate",enabled:!0,angle:e};return this.filter(t)}saturate(e=1){let t={id:`saturate-${_()}`,type:"saturate",enabled:!0,amount:e};return this.filter(t)}blackAndWhite(e=.5){let t={id:`black-and-white-${_()}`,type:"black-and-white",enabled:!0,threshold:e};return this.filter(t)}duotone(e={}){let t={id:`duotone-${_()}`,type:"duotone",enabled:!0,shadowColor:e.shadowColor??"#000000",highlightColor:e.highlightColor??"#ffffff"};return this.filter(t)}xray(e=1){let t={id:`xray-${_()}`,type:"xray",enabled:!0,intensity:e};return this.filter(t)}noise(e={}){let t={id:`noise-${_()}`,type:"noise",enabled:!0,amount:e.amount??.3,scale:e.scale??1};return this.filter(t)}emboss(e={}){let t={id:`emboss-${_()}`,type:"emboss",enabled:!0,strength:e.strength??1,angle:e.angle??135};return this.filter(t)}filmGrain(e={}){let t={id:`film-grain-${_()}`,type:"film-grain",enabled:!0,amount:e.amount??.3,size:e.size??1};return this.filter(t)}watercolor(e={}){let t={id:`watercolor-${_()}`,type:"watercolor",enabled:!0,wetness:e.wetness??.5,turbulence:e.turbulence??.5};return this.filter(t)}gouache(e={}){let t={id:`gouache-${_()}`,type:"gouache",enabled:!0,thickness:e.thickness??.5,texture:e.texture??.5};return this.filter(t)}inkBlot(e={}){let t={id:`ink-blot-${_()}`,type:"ink-blot",enabled:!0,spread:e.spread??.5,edges:e.edges??.5};return this.filter(t)}crumpledPlastic(e={}){let t={id:`crumpled-plastic-${_()}`,type:"crumpled-plastic",enabled:!0,wrinkles:e.wrinkles??.5,shine:e.shine??.5};return this.filter(t)}riddled(e={}){let t={id:`riddled-${_()}`,type:"riddled",enabled:!0,density:e.density??.5,size:e.size??1};return this.filter(t)}cssClipPath(e){return this._state.cssClipPath=e,this}cssMaskProperties(e){return this._state.cssMaskProperties=e,this}vectorEffect(e){return this._state.vectorEffect=e,this}transformBox(e){return this._state.transformBox=e,this}paintOrder(e){return this._state.paintOrder=e,this}blendMode(e){return this._state.blendMode=e,this}visibility(e){return this._state.visibility=e,this}shapeRendering(e){return this._state.shapeRendering=e,this}filterColorInterpolation(e){return this._state.filterColorInterpolation=e,this}inheritFill(e=!0){return this._state.inheritFill=e,this}inheritStroke(e=!0){return this._state.inheritStroke=e,this}systemLanguage(e){return this._state.systemLanguage=e,this}requiredExtensions(e){return this._state.requiredExtensions=e,this}fillLibrary(e,t="linear-gradient"){return this._state.fillLibraryId=e,this._state.fillType=t,this}strokeLibrary(e,t="linear-gradient"){return this._state.strokeLibraryId=e,this._state.strokeType=t,this}filterLibrary(...e){let t=this._state.filterLibraryIds??[];return this._state.filterLibraryIds=[...t,...e],this}markerStartRef(e){return this._state.markerStart=e,this}markerMidRef(e){return this._state.markerMid=e,this}markerEndRef(e){return this._state.markerEnd=e,this}bind(e,t){let r=this._state.bindings??{};return this._state.bindings={...r,[e]:t},this}metadata(e){return this._state.metadata={...this._state.metadata,...e},this}group(e){return this._state.groupId=e,this}build(){return{id:this._id,type:this._type,state:{...this._state}}}},hi=class extends ae{constructor(e,t,r){if(r<0)throw new RangeError("Circle radius must be non-negative");super("circle"),this._state.x=e,this._state.y=t,this._state.radius=r}position(e,t){return this._state.x=e,this._state.y=t,this}radius(e){return this._state.radius=e,this}},gi=class extends ae{constructor(e,t,r,i){if(r<0||i<0)throw new RangeError("Ellipse radii must be non-negative");super("ellipse"),this._state.cx=e,this._state.cy=t,this._state.rx=r,this._state.ry=i}position(e,t){return this._state.cx=e,this._state.cy=t,this}radii(e,t){return this._state.rx=e,this._state.ry=t,this}},yi=class extends ae{constructor(e,t,r,i){if(r<0||i<0)throw new RangeError("Rectangle dimensions must be non-negative");super("rectangle"),this._state.x=e,this._state.y=t,this._state.width=r,this._state.height=i}position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,t){return this._state.rx=e,this._state.ry=t,e===t&&(this._state.cornerRadius=e),this}},bi=class extends ae{constructor(e,t,r){if(r<0)throw new RangeError("Square size must be non-negative");super("square"),this._state.x=e,this._state.y=t,this._state.width=r,this._state.height=r}position(e,t){return this._state.x=e,this._state.y=t,this}size(e){return this._state.width=e,this._state.height=e,this}cornerRadius(e){return this._state.cornerRadius=e,this._state.rx=e,this._state.ry=e,this}radii(e,t){return this._state.rx=e,this._state.ry=t,e===t&&(this._state.cornerRadius=e),this}},Si=class extends ae{constructor(e,t,r,i){super("line"),this._state.x1=e,this._state.y1=t,this._state.x2=r,this._state.y2=i}from(e,t){return this._state.x1=e,this._state.y1=t,this}to(e,t){return this._state.x2=e,this._state.y2=t,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},xi=class extends ae{constructor(e,t,r){super("text"),this._state.x=e,this._state.y=t,this._state.text=r}position(e,t){return this._state.x=e,this._state.y=t,this}content(e){return this._state.text=e,this}fontSize(e){return this._state.fontSize=e,this}fontFamily(e){return this._state.fontFamily=e,this}fontWeight(e){return this._state.fontWeight=e,this}fontStyle(e){return this._state.fontStyle=e,this}fontVariant(e){return this._state.fontVariant=e,this}fontVariantLigatures(e){return this._state.fontVariantLigatures=e,this}fontVariantPosition(e){return this._state.fontVariantPosition=e,this}fontVariantCaps(e){return this._state.fontVariantCaps=e,this}fontVariantNumeric(e){return this._state.fontVariantNumeric=e,this}fontVariantEastAsian(e){return this._state.fontVariantEastAsian=e,this}anchor(e){return this._state.textAnchor=e,this}letterSpacing(e){return this._state.letterSpacing=e,this}lineHeight(e){return this._state.lineHeight=e,this}decoration(e){return this._state.textDecoration=e,this}transform(e){return this._state.textTransform=e,this}textPath(e,t=0){return this._state.isTextPath=!0,this._state.textPathPoints=e,this._state.textPathStartOffset=t,this}textPathOffset(e){return this._state.textPathStartOffset=e,this}textPathSide(e){return this._state.textPathSide=e,this}direction(e){return this._state.textDirection=e,this}unicodeBidi(e){return this._state.unicodeBidi=e,this}dominantBaseline(e){return this._state.dominantBaseline=e,this}writingMode(e){return this._state.writingMode=e,this}wordSpacing(e){return this._state.wordSpacing=e,this}baselineShift(e){return this._state.baselineShift=e,this}inlineSize(e){return this._state.inlineSize=e,this}overflowWrap(e){return this._state.overflowWrap=e,this}whiteSpace(e){return this._state.whiteSpace=e,this}fontVariationSettings(e){return this._state.fontVariationSettings=e,this}charOffsets(e){return this._state.charOffsets=e,this}shapeInsideRef(e){return this._state.shapeInsideRef=e,this}shapePadding(e){return this._state.shapePadding=e,this}richTextData(e){let t=at(e);return this._state.richTextRuns=t,this._state.richTextData=Ve(t),this}richTextRuns(e){let t=st(e);return this._state.richTextRuns=t,this._state.richTextData=Ve(t),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 ae{constructor(e,t,r,i){super(e),this._state.cx=t,this._state.cy=r,this._state.radius=i}position(e,t){return this._state.cx=e,this._state.cy=t,this}radius(e){return this._state.radius=e,this}shiftAngle(e){return this._state.shiftAngle=e,this}cornerRadius(e){return this._state.cornerRadius=e,this}},$i=class extends Se{constructor(e,t,r){super("triangle",e,t,r)}},vi=class extends Se{constructor(e,t,r,i=5){super("ngon",e,t,r),this._state.sides=i}sides(e){return this._state.sides=e,this}},ki=class extends Se{constructor(e,t,r){super("star",e,t,r),this._state.arms=5,this._state.innerRadiusPercent=40}arms(e){return this._state.arms=e,this}innerRadius(e){return this._state.innerRadiusPercent=e,this}},Ti=class extends Se{constructor(e,t,r){super("cross",e,t,r),this._state.armWidthPercent=35}armWidth(e){return this._state.armWidthPercent=e,this}},wi=class extends Se{constructor(e,t,r){super("ring",e,t,r),this._state.innerRadiusPercent=60}innerRadius(e){return this._state.innerRadiusPercent=e,this}},Pi=class extends Se{constructor(e,t,r){super("spiral",e,t,r),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}},_i=class extends Se{constructor(e,t,r){super("gear",e,t,r),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}},Ri=class extends Se{constructor(e,t,r){super("arrow",e,t,r),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}},Ai=class extends Se{constructor(e,t,r){super("heart",e,t,r),this._state.lobeRadiusPercent=50,this._state.cleftDepthPercent=25}lobeRadius(e){return this._state.lobeRadiusPercent=e,this}cleftDepth(e){return this._state.cleftDepthPercent=e,this}},Ii=class extends Se{constructor(e,t,r){super("lightning",e,t,r),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}},Mi=class extends Se{constructor(e,t,r){super("cloud",e,t,r),this._state.cloudBumps=5,this._state.cloudPuffinessPercent=60}bumps(e){return this._state.cloudBumps=e,this}puffiness(e){return this._state.cloudPuffinessPercent=e,this}},Ci=class extends Se{constructor(e,t,r){super("speechBubble",e,t,r),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}},tt=class extends ae{add(e){let t="build"in e&&typeof e.build=="function"?e.build():e,r=this._state.children??[];return this._state.children=[...r,t],this}addAll(...e){for(let t of e)this.add(t);return this}children(e){return this._state.children=e.map(t=>"build"in t&&typeof t.build=="function"?t.build():t),this}},Di=class extends tt{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}},Fi=class extends tt{constructor(){super("switch")}},Ei=class extends tt{constructor(){super("container")}},Oi=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,t,r,i){return this._state.viewBoxX=e,this._state.viewBoxY=t,this._state.viewBoxWidth=r,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}},Li=class extends tt{constructor(e=0,t=0,r=100,i=100){super("svg"),this._state.svgX=e,this._state.svgY=t,this._state.svgWidth=r,this._state.svgHeight=i}position(e,t){return this._state.svgX=e,this._state.svgY=t,this}size(e,t){return this._state.svgWidth=e,this._state.svgHeight=t,this}viewBox(e,t,r,i){return this._state.svgViewBoxX=e,this._state.svgViewBoxY=t,this._state.svgViewBoxWidth=r,this._state.svgViewBoxHeight=i,this}preserveAspectRatio(e){return this._state.svgPreserveAspectRatio=e,this}asRoot(e=!0){return this._state.isRootSvg=e,this}},Ni=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,t){return this._state.offsetX=e,this._state.offsetY=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}},Bi=class extends ae{position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}src(e){return this._state.href=e,this}mimeType(e){return this._state.mediaMimeType=e,this}naturalDuration(e){return this._state.naturalDuration=e,this}begin(e){return this._state.begin=e,this}trim(e,t){return this._state.trimStart=e,this._state.trimEnd=t,this}volume(e){return this._state.volume=e,this}muted(e=!0){return this._state.muted=e,this}loop(e=!0){return this._state.loop=e,this}playbackRate(e){return this._state.playbackRate=e,this}fade(e,t){return this._state.fadeInDuration=e,this._state.fadeOutDuration=t,this}language(e){return this._state.systemLanguage=e,this}},zi=class extends Bi{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}},Gi=class extends Bi{constructor(e){super("audio"),this._state.mediaKind="audio",e!==void 0&&(this._state.href=e)}},Vi=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,t){let r=this._state.pathPoints??[];return r.push({x:e,y:t}),this._state.pathPoints=r,this}curveType(e){return this._state.pathCurveType=e,this}closed(e=!0){return this._state.pathClosed=e,this}tension(e){return this._state.pathTension=e,this}arcParams(e){return this._state.pathArcParams=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}toD(){let e=this._state.pathPoints??[],t=this._state.pathCurveType??"CUBIC",r=this._state.pathClosed??!1,i=this._state.pathTension??.5,s=this._state.pathArcParams;return qe(e,t,r,i,s)}},Ui=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,t){let r=this._state.polylinePoints??[];return r.push({x:e,y:t}),this._state.polylinePoints=r,this}closed(e=!0){return this._state.polylineClosed=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},Wi=class extends ae{constructor(e,t,r,i,s){super("image"),this._state.x=e,this._state.y=t,this._state.width=r,this._state.height=i,this._state.href=s}position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}src(e){return this._state.href=e,this}preserveAspectRatio(e){return this._state.preserveAspectRatio=e,this}};var Pn=class{_x1;_y1;_x2;_y2;_stops=[];_spreadMethod="pad";_opacity=1;_id;constructor(e=0,t=0,r=1,i=0){this._x1=e,this._y1=t,this._x2=r,this._y2=i,this._id=_()}stop(e,t,r=1){return this._stops.push({offset:e,color:t,opacity:r}),this}direction(e,t,r,i){return this._x1=e,this._y1=t,this._x2=r,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}}},_n=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,t){return this._cx=e,this._cy=t,this}focus(e,t){return this._fx=e,this._fy=t,this}radius(e,t){return this._r=e,this._ry=t??e,this}rotation(e){return this._rotation=e,this}stop(e,t,r=1){return this._stops.push({offset:e,color:t,opacity:r}),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}}},Rn=class{_patternType;_color;_backgroundColor;_scale=1;_rotation=0;_opacity=1;_patternParams;_id;_svgContent;_width;_height;_patternUnits;_patternContentUnits;_patternTransform;_viewBox;_preserveAspectRatio;_x;_y;_customPatternId;constructor(e="stripes",t="#000000",r="#ffffff"){this._patternType=e,this._color=t,this._backgroundColor=r,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,t){return this._width=e,this._height=t,this}patternUnits(e){return this._patternUnits=e,this}patternContentUnits(e){return this._patternContentUnits=e,this}patternTransform(e){return this._patternTransform=e,this}viewBox(e){return this._viewBox=e,this}preserveAspectRatio(e){return this._preserveAspectRatio=e,this}position(e,t){return this._x=e,this._y=t,this}customPatternId(e){return this._customPatternId=e,this}build(){let e,t,r;if(this._svgContent!==void 0)e=this._svgContent,t=this._width??10,r=this._height??10;else{let s=Or(this._patternType,this._scale,this._color,this._backgroundColor,this._patternParams);e=s.svgContent,t=this._width??s.width,r=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:t,height:r,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 Nl(n=0,e=0,t=1,r=0){return new Pn(n,e,t,r)}function Bl(){return new _n}function zl(n="stripes",e="#000000",t="#ffffff"){return new Rn(n,e,t)}var ya={rows:4,cols:4,style:"classic",tabDepthPercent:20,tabPattern:"random",seed:1},yp=.04,bp=0;function Sp(n){let e=n>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function F(n){return Number(n.toFixed(3)).toString()}function xp(n,e,t,r,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,h])=>{let g=e+m*r,b=t+h*i*o;return n?{x:g,y:b}:{x:b,y:g}})}function Gl(n,e,t,r,i,s,o,a,l,c,f){let d=[],p=(v,w)=>l==="alternating"?0:v+c()*(w-v),m=()=>c()<.5,h=p(-a,a),g=l==="alternating"?f%2===0:m(),b=null,$=h,k=p(-a,a),S=p(-a,a),x=p(-a,a);h=p(-a,a);for(let v=0;v<n;v++){v>0&&(b=g,g=l==="alternating"?(f+v)%2===0:m(),$=g===b?-h:h,k=p(-a,a),S=p(-a,a),x=p(-a,a),h=p(-a,a));let w=g?-1:1,T=t+v*i;d.push(xp(e,T,r,i,s,o,w,$,k,S,x,h))}return d}function Vl(n,e,t,r,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*r,p=t+f*i*o;return n?{x:d,y:p}:{x:p,y:d}})}function Ul(n,e){return n+` 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 Wl(n,e){return n+` 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 Hl(n,e={}){let t={...ya,...e};if(t.rows<1||t.cols<1)throw new Error("generatePuzzlePieces: rows and cols must be >= 1");if(!Number.isFinite(n.width)||!Number.isFinite(n.height))throw new Error("generatePuzzlePieces: bounds must have finite width/height");if(n.width<=0||n.height<=0)throw new Error("generatePuzzlePieces: bounds must have positive width/height");let{rows:r,cols:i,style:s,tabDepthPercent:o,tabPattern:a,seed:l}=t,c=Sp(l),f=n.width/i,d=n.height/r,p=Math.max(0,Math.min(.4,o/200)),m=(s==="classic"||s==="curved")&&p>0,h=s==="square-tabs"&&p>0,g=s==="classic"&&a==="random"?yp:bp,b=[];for(let S=0;S<r-1;S++){let x=n.y+(S+1)*d;if(m)b.push(Gl(i,!0,n.x,x,f,d,p,g,a,c,S));else if(h){let v=[];for(let w=0;w<i;w++){let T=a==="alternating"?(S+w)%2===0?1:-1:c()<.5?1:-1;v.push(Vl(!0,n.x+w*f,x,f,d,p,T))}b.push(v)}else b.push(new Array(i).fill(null))}let $=[];for(let S=0;S<i-1;S++){let x=n.x+(S+1)*f;if(m)$.push(Gl(r,!1,n.y,x,d,f,p,g,a,c,S));else if(h){let v=[];for(let w=0;w<r;w++){let T=a==="alternating"?(w+S)%2===0?1:-1:c()<.5?1:-1;v.push(Vl(!1,n.y+w*d,x,d,f,p,T))}$.push(v)}else $.push(new Array(r).fill(null))}let k=[];for(let S=0;S<r;S++)for(let x=0;x<i;x++){let v=n.x+x*f,w=n.y+S*d,T=v+f,P=w+d,R=`M ${F(v)} ${F(w)}`;if(S===0)R+=` L ${F(T)} ${F(w)}`;else{let M=b[S-1][x];M?R=Ul(R,M):R+=` L ${F(T)} ${F(w)}`}if(x===i-1)R+=` L ${F(T)} ${F(P)}`;else{let M=$[x][S];M?R=Ul(R,M):R+=` L ${F(T)} ${F(P)}`}if(S===r-1)R+=` L ${F(v)} ${F(P)}`;else{let M=b[S][x];M?R=Wl(R,M):R+=` L ${F(v)} ${F(P)}`}if(x===0)R+=` L ${F(v)} ${F(w)}`;else{let M=$[x-1][S];M?R=Wl(R,M):R+=` L ${F(v)} ${F(w)}`}R+=" Z",k.push({id:`puzzle-${l}-r${S}-c${x}`,row:S,col:x,d:R})}return k}var Xl=[1,2,3,4,5,6,7,8,9],$p={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 An(n){return n.map(e=>[...e])}function vp(){return Array.from({length:9},()=>Array.from({length:9},()=>0))}function Yl(n){let e=n>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function ql(n,e){let t=[...n];for(let r=t.length-1;r>0;r--){let i=Math.floor(e()*(r+1));[t[r],t[i]]=[t[i],t[r]]}return t}function Lt(n){return 1<<n-1}function Zl(n){let e=0,t=n;for(;t;)t&=t-1,e++;return e}function kp(n){for(let e=1;e<=9;e++)if(n===Lt(e))return e;return 0}function Sa(n,e){return Math.floor(n/3)*3+Math.floor(e/3)}function ba(n){let e=0;for(let t of n)for(let r of t)r!==0&&e++;return e}function Tp(n){if(!Number.isFinite(n))return 1;let e=Math.floor(n);return e===0?1:e}function Jl(n,e){if(!Array.isArray(n)||n.length!==9)return e.push("Grid must contain 9 rows."),!1;let t=!0;for(let r=0;r<9;r++){if(!Array.isArray(n[r])||n[r].length!==9){e.push(`Row ${r+1} must contain 9 cells.`),t=!1;continue}for(let i=0;i<9;i++){let s=n[r][i];(!Number.isInteger(s)||s<0||s>9)&&(e.push(`Cell R${r+1}C${i+1} must be a digit from 0 to 9.`),t=!1)}}return t}function Ql(n,e){let t=!0,r=(i,s)=>{let o=0;for(let a of s){if(a===0)continue;let l=Lt(a);if(o&l){e.push(`${i} contains duplicate ${a}.`),t=!1;return}o|=l}};for(let i=0;i<9;i++)r(`Row ${i+1}`,n[i]);for(let i=0;i<9;i++)r(`Column ${i+1}`,n.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(n[a][l]);r(`Box ${Math.floor(i/3)*3+Math.floor(s/3)+1}`,o)}return t}function xa(n){let e=Array.from({length:9},()=>0),t=Array.from({length:9},()=>0),r=Array.from({length:9},()=>0);for(let i=0;i<9;i++)for(let s=0;s<9;s++){let o=n[i][s];if(o===0)continue;let a=Lt(o),l=Sa(i,s);if(e[i]&a||t[s]&a||r[l]&a)return null;e[i]|=a,t[s]|=a,r[l]|=a}return{rows:e,cols:t,boxes:r}}function $a(n,e,t,r,i){return 511&~(t[n]|r[e]|i[Sa(n,e)])}function eu(n,e,t){let r=xa(n);if(!r)return[];let i=An(n),s=[],{rows:o,cols:a,boxes:l}=r,c=()=>{if(s.length>=e)return;let f=-1,d=-1,p=0,m=10;for(let g=0;g<9;g++){for(let b=0;b<9;b++){if(i[g][b]!==0)continue;let $=$a(g,b,o,a,l),k=Zl($);if(k===0)return;if(k<m&&(f=g,d=b,p=$,m=k,k===1))break}if(m===1)break}if(f===-1){s.push(An(i));return}let h=Xl.filter(g=>p&Lt(g));t&&(h=ql(h,t));for(let g of h){let b=Lt(g),$=Sa(f,d);if(i[f][d]=g,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 wp(n){let e=vp(),t=Yl(n),[r]=eu(e,1,t);if(!r)throw new Error("generateSudokuPuzzle: failed to generate solved grid");return r}function Pp(n){let e=xa(n);if(!e)return null;for(let t=0;t<9;t++)for(let r=0;r<9;r++){if(n[t][r]!==0)continue;let i=$a(t,r,e.rows,e.cols,e.boxes);if(Zl(i)===1)return{row:t,col:r,value:kp(i)}}return null}function _p(n){let e=xa(n);if(!e)return null;let t=r=>{for(let i of Xl){let s=Lt(i),o=null;for(let a of r)if(!(n[a.row][a.col]!==0||!($a(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 r=0;r<9;r++){let i=t(Array.from({length:9},(s,o)=>({row:r,col:o})));if(i)return i}for(let r=0;r<9;r++){let i=t(Array.from({length:9},(s,o)=>({row:o,col:r})));if(i)return i}for(let r=0;r<9;r+=3)for(let i=0;i<9;i+=3){let s=[];for(let a=r;a<r+3;a++)for(let l=i;l<i+3;l++)s.push({row:a,col:l});let o=t(s);if(o)return o}return null}function jl(n){let e=An(n),t=!1;for(;ba(e)<81;){let r=Pp(e);if(r){e[r.row][r.col]=r.value;continue}let i=_p(e);if(i){t=!0,e[i.row][i.col]=i.value;continue}return"search"}return t?"hidden-singles":"singles"}function Kl(n,e){let t={singles:0,"hidden-singles":1,search:2};return t[n]<=t[e]}function In(n,e={}){let t=[];return Jl(n,t)?Ql(n,t)?eu(n,Math.max(1,Math.floor(e.maxSolutions??2))):[]:[]}function tu(n){let e=[];if(!Jl(n,e))return{valid:!1,unique:!1,solution:null,errors:e};if(Ql(n,e),e.length>0)return{valid:!1,unique:!1,solution:null,errors:e};let r=In(n,{maxSolutions:2});return r.length===0?e.push("Puzzle has no solution."):r.length>1&&e.push("Puzzle has more than one solution."),{valid:e.length===0,unique:r.length===1,solution:r[0]?An(r[0]):null,errors:e}}function nu(n){let e=n.difficulty,t=$p[e];if(!t)throw new Error(`generateSudokuPuzzle: unsupported difficulty "${e}"`);let r=Tp(n.seed);for(let i=0;i<30;i++){let s=r+i*104729>>>0,o=Yl(s),a=wp(s),l=An(a),c=t.minGivens+Math.floor(o()*(t.maxGivens-t.minGivens+1)),f=ql(Array.from({length:81},(h,g)=>({row:Math.floor(g/9),col:g%9})),o);for(let h of f){if(ba(l)<=c)break;let g=l[h.row][h.col];if(l[h.row][h.col]=0,In(l,{maxSolutions:2}).length!==1){l[h.row][h.col]=g;continue}let $=jl(l);Kl($,t.maxRating)||(l[h.row][h.col]=g)}let d=ba(l),p=jl(l);if(In(l,{maxSolutions:2}).length===1&&d>=t.minGivens&&d<=t.maxGivens&&Kl(p,t.maxRating))return{puzzle:l,solution:a,difficulty:e,seed:r,givens:d,rating:p}}throw new Error(`generateSudokuPuzzle: unable to generate a ${e} puzzle`)}var ru="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var Rp={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 su(n){if(!Number.isFinite(n))return 1;let e=Math.floor(n);return e===0?1:e}function au(n){let e=n>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function Nt(n){let e=globalThis.Intl.Segmenter;return e?Array.from(new e(void 0,{granularity:"grapheme"}).segment(n),t=>t.segment.normalize("NFC")):Array.from(n.normalize("NFC"))}function Ap(n,e,t,r){return n>=0&&e>=0&&n<r&&e<t}function va(n,e){return Array.from({length:e},()=>Array.from({length:n},()=>!0))}function ou(n,e,t,r){if(!t)return va(n,e);if(!Array.isArray(t)||t.length!==e)return r.push(`Mask must contain exactly ${e} rows.`),va(n,e);let i=[];for(let s=0;s<e;s++){if(!Array.isArray(t[s])||t[s].length!==n)return r.push(`Mask row ${s+1} must contain exactly ${n} cells.`),va(n,e);i.push(t[s].map(Boolean))}return i}function Ip(n){let e=0;for(let t of n)for(let r of t)r&&e++;return e}function Mp(n){return n.trim().normalize("NFC")}function lu(n){return n.replace(/\r/g,"").split(/[,\n]+/).map(e=>e.trim()).filter(e=>e.length>0)}function ka(n,e){let t=[];return n.across&&(t.push("E"),e&&t.push("W")),n.down&&(t.push("S"),e&&t.push("N")),n.diagonal&&(t.push("SE","NE"),e&&t.push("NW","SW")),t}function Cp(n,e,t,r,i,s,o,a){let l=Nt(n),c=[];for(let f=0;f<l.length;f++){let d=e+r.dr*f,p=t+r.dc*f;if(!Ap(d,p,s,o)||!i[d][p])return null;c.push({row:d,col:p,grapheme:l[f]})}return{word:n,graphemes:l,row:e,col:t,direction:r.direction,dr:r.dr,dc:r.dc,cells:c,jitter:a}}function uu(n,e,t,r,i,s){let o=[];for(let a of e){let l=Rp[a];for(let c=0;c<i;c++)for(let f=0;f<r;f++){let d=Cp(n,c,f,l,t,r,i,s());d&&o.push(d)}}return o}function Ta(n){let e=[],t=[],r=[],i=Math.floor(n.width),s=Math.floor(n.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=ka(n.axes,n.allowBackwards);o.length===0&&e.push("At least one word direction must be enabled.");let a=ou(Math.max(1,i),Math.max(1,s),n.mask,e),l=Ip(a);l===0&&e.push("Mask must contain at least one active cell.");let c=new Set,f=[];for(let m of n.words){let h=Mp(m);if(h){if(/\s/u.test(h)){r.push({input:m,reason:"Words cannot contain whitespace."});continue}if(c.has(h)){r.push({input:m,reason:"Duplicate word."});continue}c.add(h),f.push(h)}}f.length===0&&e.push("Enter at least one word.");let d=au(su(n.seed));if(e.length===0)for(let m=f.length-1;m>=0;m--){let h=f[m];uu(h,o,a,i,s,d).length===0&&(r.push({input:h,reason:"No legal placement exists for the current size, mask, and directions."}),f.splice(m,1))}r.length>0&&e.push(`${r.length} word${r.length===1?"":"s"} rejected.`);let p=Math.max(0,l);return f.length>p&&t.push("The word count exceeds the active cell count; overlaps may be required for this puzzle."),{valid:e.length===0,acceptedWords:f,rejectedWords:r,errors:e,warnings:t,minWords:1,maxWords:p,activeCells:l,directions:o}}function Dp(n,e){for(let t of e.cells){let r=n[t.row][t.col];if(r!==null&&r!==t.grapheme)return!0}return!1}function Fp(n,e){let t=[];for(let r of e.cells)n[r.row][r.col]===null&&(t.push({row:r.row,col:r.col}),n[r.row][r.col]=r.grapheme);return t}function Ep(n,e){for(let t of e)n[t.row][t.col]=null}function iu(n,e){let t=0;for(let r of e.cells)n[r.row][r.col]===r.grapheme&&t++;return t}function Op(n){return{word:n.word,row:n.row,col:n.col,direction:n.direction,path:n.cells.map(e=>({...e}))}}function Lp(n){let e=n.fillerAlphabet??ru,t=typeof e=="string"?Nt(e):e.flatMap(i=>Nt(i)),r=t.filter((i,s)=>i.trim()&&t.indexOf(i)===s);return r.length>0?r:Nt(ru)}function cu(n){let e=Math.floor(n.width),t=Math.floor(n.height),r=su(n.seed),i=Ta({...n,width:e,height:t,seed:r});if(!i.valid)throw new Error(`generateWordSearch: ${i.errors[0]??"invalid options"}`);let s=ou(e,t,n.mask,[]),o=Math.max(1,Math.floor(n.maxBacktrackNodes??15e4));for(let a=0;a<24;a++){let l=au(r+a*104729>>>0),c=i.directions,f=new Map;for(let k of i.acceptedWords)f.set(k,uu(k,c,s,e,t,l));let d=[...i.acceptedWords].sort((k,S)=>{let x=f.get(k)?.length??0,v=f.get(S)?.length??0;return x!==v?x-v:Nt(S).length-Nt(k).length}),p=Array.from({length:t},(k,S)=>Array.from({length:e},(x,v)=>s[S][v]?null:"")),m=[],h=new Map,g=0,b=k=>{if(++g>o)return!1;if(k>=d.length)return!0;let S=d[k],x=[...f.get(S)??[]].filter(v=>!Dp(p,v)).sort((v,w)=>{let T=iu(p,w)-iu(p,v);if(T!==0)return T;let P=(h.get(v.direction)??0)-(h.get(w.direction)??0);return P!==0?P:v.jitter-w.jitter});for(let v of x){let w=Fp(p,v);if(m.push(Op(v)),h.set(v.direction,(h.get(v.direction)??0)+1),b(k+1))return!0;h.set(v.direction,(h.get(v.direction)??1)-1),m.pop(),Ep(p,w)}return!1};if(!b(0))continue;let $=Lp(n);for(let k=0;k<t;k++)for(let S=0;S<e;S++)s[k][S]?p[k][S]===null&&(p[k][S]=$[Math.floor(l()*$.length)]):p[k][S]="";return{width:e,height:t,grid:p,mask:s.map(k=>[...k]),normalizedWords:[...i.acceptedWords],placements:[...m],seed:r,title:n.title,creator:n.creator,lint:i}}throw new Error("generateWordSearch: unable to place all words with the current settings")}function Np(n,e,t){let r=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){let o=t[i],a=t[s];o.y>e!=a.y>e&&n<(a.x-o.x)*(e-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function Bp(){let n=[];for(let e=0;e<10;e++){let t=e%2===0?.5:.23,r=-Math.PI/2+e*Math.PI/5;n.push({x:.5+Math.cos(r)*t,y:.5+Math.sin(r)*t})}return n}function du(n,e,t){let r=Math.max(1,Math.floor(n)),i=Math.max(1,Math.floor(e)),s=Bp();return Array.from({length:i},(o,a)=>Array.from({length:r},(l,c)=>{let f=(c+.5)/r,d=(a+.5)/i,p=f*2-1,m=d*2-1;switch(t){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 Np(f,d,s);case"heart":{let h=p*1.25,g=-m*1.25;return Math.pow(h*h+g*g-1,3)-h*h*g*g*g<=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,applyOpsInPlace,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,senderCorrectionsForOp,skewXAffine,skewYAffine,smilKeyframeAttributes,solveCubicBezier,solveSudoku,splinePathBounds,stringifyDocument,substituteString,substituteVariables,symbolInstanceTargetId,transformSplice,translateAffine,tryParseSvgTransformList,upsertResourceById,upsertResourceByKey,upsertResourceByName,upsertTrackKeyframe,validateDocumentOperations,validateOperation,validatePresenceOperation,validateSnapshot,validateSudokuPuzzle,verticesToPath});
|