@myoc/excalidraw 0.19.514 → 0.19.515
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/CHANGELOG.md +53 -0
- package/dist/dev/{chunk-FW62QUKV.js → chunk-743OUYY5.js} +2 -2
- package/dist/dev/{chunk-BI6BDZVY.js → chunk-WIJ675EZ.js} +4 -3
- package/dist/dev/{chunk-BI6BDZVY.js.map → chunk-WIJ675EZ.js.map} +2 -2
- package/dist/dev/data/{image-WGZL7YPK.js → image-DAAZ7YY4.js} +3 -3
- package/dist/dev/index.js +10 -7
- package/dist/dev/index.js.map +2 -2
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-NVT4BTJO.js → chunk-5ADLKOJQ.js} +1 -1
- package/dist/prod/{chunk-56AUOKVR.js → chunk-B2SJBHTC.js} +2 -2
- package/dist/prod/data/image-GWMHT2EN.js +1 -0
- package/dist/prod/index.js +3 -3
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/element/src/newElement.d.ts +1 -0
- package/dist/types/element/src/types.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +1 -0
- package/dist/types/excalidraw/scene/Renderer.d.ts +1 -0
- package/package.json +4 -4
- package/dist/prod/data/image-ZQZIDAZL.js +0 -1
- /package/dist/dev/{chunk-FW62QUKV.js.map → chunk-743OUYY5.js.map} +0 -0
- /package/dist/dev/data/{image-WGZL7YPK.js.map → image-DAAZ7YY4.js.map} +0 -0
package/dist/prod/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{$ as P1,A as b1,B as gs,C as Ca,D as fs,E as Es,F as Sa,G as y1,H as w1,I as v1,J as xs,K as or,L as T1,M as kS,N as nr,O as Fr,Q as I1,S as C1,T as S1,U as bs,V as k1,W as Lm,X as ka,Y as Ma,Z as M1,_ as Dm,a as h1,aa as A1,b as tr,ba as _m,c as Gt,ca as L1,d as g1,da as D1,e as we,ea as _1,f as f1,fa as Pa,g as te,h as Rr,i as fo,j as wa,k as va,l as Nr,m as Ta,n as us,o as E1,p as Mm,q as Uo,r as gn,s as wt,t as ro,u as Br,v as x1,w as Pm,x as Ia,y as hs,z as Am}from"./chunk-56AUOKVR.js";import{a as C}from"./chunk-NVT4BTJO.js";import{F as km}from"./chunk-VHQT4IVX.js";import{c as u1}from"./chunk-3PELD44J.js";import{b as p1,c as SS,d as I}from"./chunk-SRAX5OIU.js";import aU,{useCallback as lU,useContext as sU,useEffect as cU,useRef as dU,useState as mU}from"react";import{DEFAULT_IMAGE_OPTIONS as xa,DEFAULT_UI_OPTIONS as TS,isShallowEqual as pU}from"@excalidraw/common";import ZI from"clsx";import Pz from"lodash.throttle";import to,{useContext as mn}from"react";import{flushSync as Ot}from"react-dom";import Az from"roughjs/bin/rough";import{nanoid as Lz}from"nanoid";import{clamp as bf,pointFrom as Q,pointDistance as sn,vector as $I,pointRotateRads as yf,vectorFromPoint as wf,vectorSubtract as jI,vectorDot as qI,vectorNormalize as JI}from"@excalidraw/math";import{COLOR_PALETTE as Dz,CODES as QI,shouldResizeFromCenter as eC,shouldMaintainAspectRatio as jl,shouldRotateWithDiscreteAngle as tC,isArrowKey as dm,KEYS as Y,APP_NAME as _z,CURSOR_TYPE as Ce,DEFAULT_TRANSFORM_HANDLE_SPACING as Rz,DEFAULT_VERTICAL_ALIGN as oC,DRAGGING_THRESHOLD as nC,ELEMENT_SHIFT_TRANSLATE_AMOUNT as Nz,ELEMENT_TRANSLATE_AMOUNT as rC,EVENT as q,FRAME_STYLE as No,IMAGE_MIME_TYPES as Bz,IMAGE_RENDER_TIMEOUT as Fz,LINE_CONFIRM_THRESHOLD as vf,MIME_TYPES as sa,MQ_RIGHT_SIDEBAR_MIN_WIDTH as Oz,POINTER_BUTTON as Bo,ROUNDNESS as mm,SCROLL_TIMEOUT as zz,TAP_TWICE_TIMEOUT as iC,TEXT_TO_CENTER_SNAP_THRESHOLD as Hz,THEME as ca,TOUCH_CTX_MENU_TIMEOUT as Gz,VERTICAL_ALIGN as Uz,YOUTUBE_STATES as pm,ZOOM_STEP as Wz,POINTER_EVENTS as da,TOOL_TYPE as Fo,supportsResizeObserver as Yz,DEFAULT_COLLISION_THRESHOLD as aC,DEFAULT_TEXT_ALIGN as Vz,ARROW_TYPE as $n,DEFAULT_REDUCED_GLOBAL_ALPHA as Xz,isLocalLink as Kz,normalizeLink as Tf,toValidURL as Zz,getGridPoint as dt,getLineHeight as lC,debounce as sC,distance as ma,getFontString as If,getNearestScrollableContainer as $z,isInputLike as cC,isToolIcon as jz,isWritableElement as ql,sceneCoordsToViewportCoords as um,tupleToCoors as Cf,viewportCoordsToSceneCoords as De,wrapEvent as qz,updateObject as Sf,updateActiveTool as Oo,isTransparent as Jz,easeToValuesRAF as Qz,muteFSAbortError as eH,isTestEnv as QC,isDevEnv as eS,easeOut as tH,updateStable as Jl,addEventListener as Ge,normalizeEOL as oH,getDateTime as dC,isShallowEqual as mC,arrayToMap as hm,applyDarkModeFilter as nH,AppEventBus as rH,randomInteger as iH,CLASSES as kf,Emitter as Ar,MINIMUM_ARROW_SIZE as aH,DOUBLE_TAP_POSITION_THRESHOLD as pC,BIND_MODE_TIMEOUT as lH,invariant as zo,getFeatureFlag as cn,createUserAgentDescriptor as tS,getFormFactor as sH,deriveStylesPanelMode as ym,isIOS as cH,isBrave as dH,isSafari as mH,loadDesktopUIModePreference as pH,setDesktopUIMode as uH,isSelectionLikeTool as Ql,oneOf as hH,matchKey as uC}from"@excalidraw/common";import{getObservedAppState as gH,getCommonBounds as pa,getElementAbsoluteCoords as hC,bindOrUnbindBindingElements as gC,fixBindingsAfterDeletion as fH,getHoveredElementForBinding as Ho,isBindingEnabled as es,updateBoundElements as gm,newElementWith as jn,newFrameElement as EH,newFreeDrawElement as xH,newEmbeddableElement as fC,newMagicFrameElement as EC,newIframeElement as bH,newArrowElement as yH,newElement as wH,newImageElement as vH,newLinearElement as TH,newTextElement as xC,refreshTextDimensions as IH,deepCopyElement as bC,duplicateElements as yC,hasBoundTextElement as wC,isArrowElement as ua,isBindingElement as Go,isBindingElementType as CH,isBoundToContainer as Mf,isFrameLikeElement as at,isImageElement as qn,isEmbeddableElement as dn,isInitializedImageElement as ts,isLinearElement as bt,isLinearElementType as SH,isUsingAdaptiveRadius as kH,isIframeElement as ha,isIframeLikeElement as Pf,isMagicFrameElement as vC,isTextBindableContainer as TC,isElbowArrow as Lt,isFlowchartNodeElement as MH,isBindableElement as Af,isTextElement as zt,getNormalizedDimensions as PH,isElementCompletelyInViewport as Lf,isElementInViewport as IC,isInvisiblySmallElement as CC,getCornerRadius as AH,isPathALoop as SC,createSrcDoc as kC,embeddableURLValidator as Df,maybeParseEmbedSrc as LH,getEmbedLink as fm,getInitializedImageElements as DH,normalizeSVG as MC,updateImageCache as _H,getBoundTextElement as _f,getContainerCenter as Rf,getContainerElement as PC,isValidTextContainer as AC,redrawTextBoundingBox as RH,hasBoundingBox as NH,getCommonFrameId as LC,getFrameChildren as Nf,getFrameChildrenInsertionIndex as BH,isCursorInFrame as DC,addElementsToFrame as Bf,replaceAllElementsInFrame as FH,removeElementsFromFrame as OH,getElementsInResizingFrame as Ff,getElementsInNewFrame as zH,getContainingFrame as Of,elementOverlapsWithFrame as HH,updateFrameMembershipOfSelectedElements as _C,isElementInFrame as RC,getFrameLikeTitle as GH,getElementsOverlappingFrame as UH,filterElementsEligibleAsFrameChildren as WH,hitElementBoundText as YH,hitElementBoundingBoxOnly as VH,hitElementItself as os,getVisibleSceneBounds as XH,FlowChartCreator as KH,FlowChartNavigator as ZH,getLinkDirectionFromKey as NC,cropElement as $H,wrapText as jH,isElementLink as zf,parseElementLinkFromURL as qH,isMeasureTextSupported as JH,normalizeText as QH,measureText as BC,getLineHeightInPx as FC,getApproxMinLineWidth as eG,getApproxMinLineHeight as tG,getMinTextElementWidth as oG,ShapeCache as ns,getRenderOpacity as nG,editGroupForSelectedElement as rG,getElementsInGroup as Lr,getSelectedGroupIdForElement as iG,getSelectedGroupIds as aG,isElementInGroup as OC,isSelectedViaGroup as lG,selectGroupsForSelectedElements as eo,syncInvalidIndices as oS,syncMovedIndices as zC,excludeElementsInFramesFromSelection as sG,getSelectionStateForElements as cG,makeNextSelectedElementIds as ye,getResizeOffsetXY as dG,getResizeArrowDirection as mG,transformElements as pG,getCursorForResizingElement as HC,getElementWithTransformHandleType as GC,getTransformHandleTypeFromCoords as UC,dragNewElement as WC,dragSelectedElements as uG,getDragOffsetXY as hG,isNonDeletedElement as YC,Scene as VC,Store as gG,CaptureUpdateAction as yt,hitElementBoundingBox as fG,isLineElement as Hf,isSimpleArrow as Gf,StoreDelta as XC,positionElementsOnGrid as KC,calculateFixedPointForNonElbowArrowBinding as ZC,bindOrUnbindBindingElement as EG,mutateElement as Em,getElementBounds as $C,doBoundsIntersect as xG,isPointInElement as bG,maxBindingDistance_simple as Uf,convertToExcalidrawElements as yG,getSnapOutlineMidPoint as Wf,handleFocusPointDrag as wG,handleFocusPointHover as vG,handleFocusPointPointerDown as TG,handleFocusPointPointerUp as IG,maybeHandleArrowPointlikeDrag as xm,getUncroppedWidthAndHeight as CG,getActiveTextElement as jC,isEligibleFrameChildType as SG}from"@excalidraw/element";import{LinearElementEditor as se}from"@excalidraw/element/linearElementEditor";import{findShapeByKey as kG}from"@excalidraw/element/shapes";import{KEYS as ap,MOBILE_ACTION_BUTTON_BG as US,updateActiveTool as WS}from"@excalidraw/common";import{getNonDeletedElements as lp}from"@excalidraw/element";import{fixBindingsAfterDeletion as YS}from"@excalidraw/element";import{LinearElementEditor as P0}from"@excalidraw/element/linearElementEditor";import{newElementWith as Ys}from"@excalidraw/element";import{getContainerElement as A0}from"@excalidraw/element";import{isBoundToContainer as Us,isElbowArrow as VS,isFrameLikeElement as XS}from"@excalidraw/element";import{getFrameChildren as KS}from"@excalidraw/element";import{getElementsInGroup as sp,selectGroupsForSelectedElements as ZS}from"@excalidraw/element";import{CaptureUpdateAction as Ws}from"@excalidraw/element";import{isDevEnv as LS}from"@excalidraw/common";import{atom as je,createStore as MS}from"jotai";import{createIsolation as PS}from"jotai-scope";var R1=PS();var{useAtom:He,useSetAtom:N1,useAtomValue:ys,useStore:xU}=R1,B1=R1.Provider,Ut=MS();var AS=p1({"./locales/ar-SA.json":()=>import("./locales/ar-SA-3G7FTBZJ.js"),"./locales/az-AZ.json":()=>import("./locales/az-AZ-HMFZUPFL.js"),"./locales/bg-BG.json":()=>import("./locales/bg-BG-Y7OZ2DXF.js"),"./locales/bn-BD.json":()=>import("./locales/bn-BD-36TGMEAF.js"),"./locales/bn-IN.json":()=>import("./locales/bn-IN-FALW4RB5.js"),"./locales/ca-ES.json":()=>import("./locales/ca-ES-MJRJ6GTN.js"),"./locales/cs-CZ.json":()=>import("./locales/cs-CZ-52YM52ZO.js"),"./locales/da-DK.json":()=>import("./locales/da-DK-QEP42HP6.js"),"./locales/de-CH.json":()=>import("./locales/de-CH-LGHSGO4X.js"),"./locales/de-DE.json":()=>import("./locales/de-DE-GHNPPGTN.js"),"./locales/el-GR.json":()=>import("./locales/el-GR-2UZLGABX.js"),"./locales/en.json":()=>import("./locales/en-6UCVDQQ7.js"),"./locales/es-ES.json":()=>import("./locales/es-ES-2NUH2FTW.js"),"./locales/eu-ES.json":()=>import("./locales/eu-ES-LW4CGHUU.js"),"./locales/fa-IR.json":()=>import("./locales/fa-IR-U32PFECK.js"),"./locales/fi-FI.json":()=>import("./locales/fi-FI-G7756HAK.js"),"./locales/fr-FR.json":()=>import("./locales/fr-FR-VIEH4DTC.js"),"./locales/gl-ES.json":()=>import("./locales/gl-ES-JWQDRMPC.js"),"./locales/he-IL.json":()=>import("./locales/he-IL-YYBNMYP4.js"),"./locales/hi-IN.json":()=>import("./locales/hi-IN-4J4RW5AN.js"),"./locales/hu-HU.json":()=>import("./locales/hu-HU-MBXXMHSF.js"),"./locales/id-ID.json":()=>import("./locales/id-ID-5U764SVL.js"),"./locales/it-IT.json":()=>import("./locales/it-IT-7BNDK63V.js"),"./locales/ja-JP.json":()=>import("./locales/ja-JP-4SLEHWLA.js"),"./locales/kaa.json":()=>import("./locales/kaa-YHCGFUY5.js"),"./locales/kab-KAB.json":()=>import("./locales/kab-KAB-LSGAIMUB.js"),"./locales/kk-KZ.json":()=>import("./locales/kk-KZ-3YNSB7GZ.js"),"./locales/km-KH.json":()=>import("./locales/km-KH-7GXC5R4I.js"),"./locales/ko-KR.json":()=>import("./locales/ko-KR-B6Q6YTFE.js"),"./locales/ku-TR.json":()=>import("./locales/ku-TR-FBC7A657.js"),"./locales/lt-LT.json":()=>import("./locales/lt-LT-NTZ3RRBU.js"),"./locales/lv-LV.json":()=>import("./locales/lv-LV-G24LH3KG.js"),"./locales/mr-IN.json":()=>import("./locales/mr-IN-FMZEIYNW.js"),"./locales/my-MM.json":()=>import("./locales/my-MM-B6EJQIQF.js"),"./locales/nb-NO.json":()=>import("./locales/nb-NO-GEP6ZOEM.js"),"./locales/nl-NL.json":()=>import("./locales/nl-NL-4QUIWSVP.js"),"./locales/nn-NO.json":()=>import("./locales/nn-NO-P32L2VHA.js"),"./locales/oc-FR.json":()=>import("./locales/oc-FR-QRACY6JR.js"),"./locales/pa-IN.json":()=>import("./locales/pa-IN-GBDTCDVG.js"),"./locales/percentages.json":()=>import("./locales/percentages-5DKR754L.js"),"./locales/pl-PL.json":()=>import("./locales/pl-PL-2Y6CXCHK.js"),"./locales/pt-BR.json":()=>import("./locales/pt-BR-FKWT7UFL.js"),"./locales/pt-PT.json":()=>import("./locales/pt-PT-6EMD7SCZ.js"),"./locales/ro-RO.json":()=>import("./locales/ro-RO-XERO3Y25.js"),"./locales/ru-RU.json":()=>import("./locales/ru-RU-XKTTT4QL.js"),"./locales/si-LK.json":()=>import("./locales/si-LK-MGLC5APF.js"),"./locales/sk-SK.json":()=>import("./locales/sk-SK-BMCDJLZC.js"),"./locales/sl-SI.json":()=>import("./locales/sl-SI-LAWKY4LU.js"),"./locales/sv-SE.json":()=>import("./locales/sv-SE-X2ORO3SG.js"),"./locales/ta-IN.json":()=>import("./locales/ta-IN-RZDP4ZDC.js"),"./locales/th-TH.json":()=>import("./locales/th-TH-GY4Y5ENV.js"),"./locales/tr-TR.json":()=>import("./locales/tr-TR-CT4QTEX3.js"),"./locales/uk-UA.json":()=>import("./locales/uk-UA-XEPSQF3S.js"),"./locales/uz-UZ.json":()=>import("./locales/uz-UZ-WM3HHDOU.js"),"./locales/vi-VN.json":()=>import("./locales/vi-VN-RFG3SAMP.js"),"./locales/zh-CN.json":()=>import("./locales/zh-CN-2WGTQQH5.js"),"./locales/zh-HK.json":()=>import("./locales/zh-HK-J64WV2A2.js"),"./locales/zh-TW.json":()=>import("./locales/zh-TW-4JITCNYX.js")});var DS=85,Eo={code:"en",label:"English"},zr=[Eo,...[{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",rtl:!0},{code:"bg-BG",label:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"},{code:"ca-ES",label:"Catal\xE0"},{code:"cs-CZ",label:"\u010Cesky"},{code:"de-DE",label:"Deutsch"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"},{code:"es-ES",label:"Espa\xF1ol"},{code:"eu-ES",label:"Euskara"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",rtl:!0},{code:"fi-FI",label:"Suomi"},{code:"fr-FR",label:"Fran\xE7ais"},{code:"gl-ES",label:"Galego"},{code:"he-IL",label:"\u05E2\u05D1\u05E8\u05D9\u05EA",rtl:!0},{code:"hi-IN",label:"\u0939\u093F\u0928\u094D\u0926\u0940"},{code:"hu-HU",label:"Magyar"},{code:"id-ID",label:"Bahasa Indonesia"},{code:"it-IT",label:"Italiano"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E"},{code:"kab-KAB",label:"Taqbaylit"},{code:"kk-KZ",label:"\u049A\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4"},{code:"ku-TR",label:"Kurd\xEE"},{code:"lt-LT",label:"Lietuvi\u0173"},{code:"lv-LV",label:"Latvie\u0161u"},{code:"my-MM",label:"Burmese"},{code:"nb-NO",label:"Norsk bokm\xE5l"},{code:"nl-NL",label:"Nederlands"},{code:"nn-NO",label:"Norsk nynorsk"},{code:"oc-FR",label:"Occitan"},{code:"pa-IN",label:"\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40"},{code:"pl-PL",label:"Polski"},{code:"pt-BR",label:"Portugu\xEAs Brasileiro"},{code:"pt-PT",label:"Portugu\xEAs"},{code:"ro-RO",label:"Rom\xE2n\u0103"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},{code:"sk-SK",label:"Sloven\u010Dina"},{code:"sv-SE",label:"Svenska"},{code:"sl-SI",label:"Sloven\u0161\u010Dina"},{code:"tr-TR",label:"T\xFCrk\xE7e"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"},{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t"},{code:"mr-IN",label:"\u092E\u0930\u093E\u0920\u0940"}].filter(e=>u1[e.code]>=DS).sort((e,o)=>e.label>o.label?1:-1)],vs="__test__";LS()&&zr.unshift({code:vs,label:"test language"},{code:`${vs}.rtl`,label:"\u202Atest language (rtl)\u202C",rtl:!0});var Or=Eo,ws={},Ts=async e=>{if(Or=e,document.documentElement.dir=Or.rtl?"rtl":"ltr",document.documentElement.lang=Or.code,e.code.startsWith(vs))ws={};else try{ws=await AS(`./locales/${Or.code}.json`)}catch(o){console.error(`Failed to load language ${e.code}:`,o.message),ws=km}Ut.set(O1,e.code)},Wo=()=>Or,F1=(e,o)=>{for(let t=0;t<o.length;++t){let n=o[t];if(e[n]===void 0)return;e=e[n]}if(typeof e=="string")return e},E=(e,o,t)=>{if(Or.code.startsWith(vs))return`\u202A[[${o?`${e}(${JSON.stringify(o).slice(1,-1)})`:e}]]\u202C`;let n=e.split("."),r=F1(ws,n)||F1(km,n)||t;if(r===void 0){let i=`Can't find translation for ${e}`;if(C.PROD)return console.warn(i),"";throw new Error(i)}if(o)for(let i in o)r=r.replace(`{{${i}}}`,String(o[i]));return r},O1=je(Eo.code),Te=()=>{let e=ys(O1);return{t:E,langCode:e}};import _S from"clsx";import Xe from"react";import{THEME as RS}from"@excalidraw/common";import{Fragment as ve,jsx as u,jsxs as D}from"react/jsx-runtime";var io=e=>"var(--icon-fill-color)",z1=e=>e===RS.LIGHT?"#fff":"#1e1e1e",k=(e,o=512)=>{let{width:t=512,height:n=t,mirror:r,style:i,...l}=typeof o=="number"?{width:o}:o;return u("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${t} ${n}`,className:_S({"rtl-mirror":r}),style:i,...l,children:typeof e=="string"?u("path",{fill:"currentColor",d:e}):e})},O={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},ne={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},mt={width:40,height:20},_U=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("rect",{x:3,y:8,width:18,height:4,rx:1}),u("line",{x1:12,y1:8,x2:12,y2:21}),u("path",{d:"M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7"}),u("path",{d:"M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5"})]}),O),RU=k(D("svg",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),u("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),O),NU=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("circle",{cx:"12",cy:"12",r:"1"}),u("circle",{cx:"12",cy:"19",r:"1"}),u("circle",{cx:"12",cy:"5",r:"1"})]}),O),H1=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),u("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),u("path",{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]}),O),G1=k(D("svg",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6"}),u("line",{x1:"12",y1:"16",x2:"12",y2:"21"}),u("line",{x1:"8",y1:"4",x2:"16",y2:"4"})]}),O),Rm=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M6.5 9.5l3.5 -3"}),u("path",{d:"M14 5.5l3 1.5"}),u("path",{d:"M18.5 10l-2.5 7"}),u("path",{d:"M13.5 17.5l-7 -5"})]}),O),rr=k(D("g",{children:[u("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z",stroke:"currentColor",strokeWidth:"1.25"}),u("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z",stroke:"currentColor",strokeWidth:"1.25"}),u("mask",{id:"UnlockedIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:6,y:1,width:9,height:9,children:u("path",{stroke:"none",d:"M6.399 9.561V5.175c0-.93.401-1.823 1.116-2.48a3.981 3.981 0 0 1 2.693-1.028c1.01 0 1.98.37 2.694 1.027.715.658 1.116 1.55 1.116 2.481",fill:"#fff"})}),u("g",{mask:"url(#UnlockedIcon)",children:u("path",{stroke:"none",d:"M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z",fill:"currentColor"})})]}),ne),Hr=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z"}),u("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z"}),u("path",{d:"M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916"})]}),ne),U1=k(u("g",{fill:"currentColor",children:u("path",{d:"M12 2a5 5 0 0 1 5 5v3a3 3 0 0 1 3 3v6a3 3 0 0 1 -3 3h-10a3 3 0 0 1 -3 -3v-6a3 3 0 0 1 3 -3v-3a5 5 0 0 1 5 -5m0 12a2 2 0 0 0 -1.995 1.85l-.005 .15a2 2 0 1 0 2 -2m0 -10a3 3 0 0 0 -3 3v3h6v-3a3 3 0 0 0 -3 -3"})}),{width:24,height:24}),W1=k(D(ve,{children:[u("path",{d:"M38.5 83.5c-14-2-17.833-10.473-21-22.5C14.333 48.984 12 22 12 12.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),u("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z",fill:"currentColor"}),u("path",{d:"M12.005 10.478c1.92 3.495 3.838 7 7.905 14.423m-7.905-14.423c3.11 5.683 6.23 11.368 7.905 14.423m0 0c-3.68.226-7.35.455-13.91.85m13.91-.85c-5.279.33-10.566.647-13.91.85m0 0c1.936-4.931 3.882-9.86 6.005-15.273M6 25.75c2.069-5.257 4.135-10.505 6.005-15.272",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:41,height:94,fill:"none"}),Y1=k(D(ve,{children:[u("path",{d:"M18.026 1.232c-5.268 13.125-5.548 33.555 3.285 42.311 8.823 8.75 33.31 12.304 42.422 13.523",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),u("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m72.181 59.247-13.058-10-2.948 13.62 16.006-3.62Z",fill:"currentColor"}),u("path",{d:"M72.181 59.247c-3.163-2.429-6.337-4.856-13.058-10m13.058 10c-5.145-3.936-10.292-7.882-13.058-10m0 0c-.78 3.603-1.563 7.196-2.948 13.62m2.948-13.62c-1.126 5.168-2.24 10.346-2.948 13.62m0 0c5.168-1.166 10.334-2.343 16.006-3.62m-16.006 3.62c5.51-1.248 11.01-2.495 16.006-3.62",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:85,height:71,fill:"none"}),V1=k(D(ve,{children:[u("path",{d:"M1 77c14-2 31.833-11.973 35-24 3.167-12.016-6-35-9.5-43.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),u("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m24.165 1.093-2.132 16.309 13.27-4.258-11.138-12.05Z",fill:"currentColor"}),u("path",{d:"M24.165 1.093c-.522 3.953-1.037 7.916-2.132 16.309m2.131-16.309c-.835 6.424-1.68 12.854-2.13 16.308m0 0c3.51-1.125 7.013-2.243 13.27-4.257m-13.27 4.257c5.038-1.608 10.08-3.232 13.27-4.257m0 0c-3.595-3.892-7.197-7.777-11.14-12.05m11.14 12.05c-3.837-4.148-7.667-8.287-11.14-12.05",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:38,height:78,fill:"none"}),BU=k(u("g",{fill:"currentColor",children:u("path",{d:"M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z",fill:"currentColor"})}),{width:40,height:40,fill:"none"}),Is=k(D("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 6l4.153 11.793a0.365 .365 0 0 0 .331 .207a0.366 .366 0 0 0 .332 -.207l2.184 -4.793l4.787 -1.994a0.355 .355 0 0 0 .213 -.323a0.355 .355 0 0 0 -.213 -.323l-11.787 -4.36z"}),u("path",{d:"M13.5 13.5l4.5 4.5"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),fn=k(D("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,children:[u("path",{d:"M4.028 13.252c-.657 -.972 -1.028 -2.078 -1.028 -3.252c0 -3.866 4.03 -7 9 -7s9 3.134 9 7s-4.03 7 -9 7c-1.913 0 -3.686 -.464 -5.144 -1.255"}),u("path",{d:"M5 15m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M5 17c0 1.42 .316 2.805 1 4"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),Cs=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})]}),O),Ss=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10.5 20.4l-6.9 -6.9c-.781 -.781 -.781 -2.219 0 -3l6.9 -6.9c.781 -.781 2.219 -.781 3 0l6.9 6.9c.781 .781 .781 2.219 0 3l-6.9 6.9c-.781 .781 -2.219 .781 -3 0z"})]}),O),ks=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("circle",{cx:"12",cy:"12",r:"9"})]}),O),X1=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),u("line",{x1:"15",y1:"16",x2:"19",y2:"12"}),u("line",{x1:"15",y1:"8",x2:"19",y2:"12"})]}),O),Ms=k(u("path",{d:"M4.167 10h11.666",strokeWidth:"1.5"}),ne),K1=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z"}),u("path",{d:"M16 7h4"}),u("path",{d:"M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3"})]}),O),En=k(D("g",{strokeWidth:"1.25",children:[u("path",{clipRule:"evenodd",d:"m7.643 15.69 7.774-7.773a2.357 2.357 0 1 0-3.334-3.334L4.31 12.357a3.333 3.333 0 0 0-.977 2.357v1.953h1.953c.884 0 1.732-.352 2.357-.977Z"}),u("path",{d:"m11.25 5.417 3.333 3.333"})]}),ne),xn=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"20",x2:"7",y2:"20"}),u("line",{x1:"14",y1:"20",x2:"21",y2:"20"}),u("line",{x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),u("line",{x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),u("polyline",{points:"5 20 11 4 13 4 20 20"})]}),O),Z1=k(D("g",{stroke:"currentColor",strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 7v-2h13v2"}),u("path",{d:"M10 5v14"}),u("path",{d:"M12 19h-4"}),u("path",{d:"M15 13v-1h6v1"}),u("path",{d:"M18 12v7"}),u("path",{d:"M17 19h2"})]}),O),Ps=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M12.5 6.667h.01"}),u("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z"}),u("path",{d:"m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166"}),u("path",{d:"m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667"})]}),ne),$1=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3"}),u("path",{d:"M18 13.3l-6.3 -6.3"})]}),O),Nm=k(u("path",{strokeWidth:"1.25",d:"M10 4.167v11.666M4.167 10h11.666"}),ne),Bm=k(u("path",{d:"M5 10h10",strokeWidth:"1.25"}),ne),j1=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M21 21l-6 -6"}),u("path",{d:"M3.268 12.043a7.017 7.017 0 0 0 6.634 4.957a7.012 7.012 0 0 0 7.043 -6.131a7 7 0 0 0 -5.314 -7.672a7.021 7.021 0 0 0 -8.241 4.403"}),u("path",{d:"M3 4v4h4"})]}),O),ir=k(u("path",{strokeWidth:"1.25",d:"M3.333 5.833h13.334M8.333 9.167v5M11.667 9.167v5M4.167 5.833l.833 10c0 .92.746 1.667 1.667 1.667h6.666c.92 0 1.667-.746 1.667-1.667l.833-10M7.5 5.833v-2.5c0-.46.373-.833.833-.833h3.334c.46 0 .833.373.833.833v2.5"}),ne),As=k(D("g",{strokeWidth:"1.5",children:[u("polyline",{points:"12 16 18 10 12 4"}),u("polyline",{points:"8 4 2 10 8 16"})]}),ne),Aa=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M14.375 6.458H8.958a2.5 2.5 0 0 0-2.5 2.5v5.417a2.5 2.5 0 0 0 2.5 2.5h5.417a2.5 2.5 0 0 0 2.5-2.5V8.958a2.5 2.5 0 0 0-2.5-2.5Z"}),u("path",{clipRule:"evenodd",d:"M11.667 3.125c.517 0 .986.21 1.325.55.34.338.55.807.55 1.325v1.458H8.333c-.485 0-.927.185-1.26.487-.343.312-.57.75-.609 1.24l-.005 5.357H5a1.87 1.87 0 0 1-1.326-.55 1.87 1.87 0 0 1-.549-1.325V5c0-.518.21-.987.55-1.326.338-.34.807-.549 1.325-.549h6.667Z"})]}),ne),La=k(u("path",{clipRule:"evenodd",d:"M10 2.5h.328a6.25 6.25 0 0 0 6.6 10.372A7.5 7.5 0 1 1 10 2.493V2.5Z",stroke:"currentColor"}),ne),Da=k(u("g",{stroke:"currentColor",strokeLinejoin:"round",children:u("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM10 4.167V2.5M14.167 5.833l1.166-1.166M15.833 10H17.5M14.167 14.167l1.166 1.166M10 15.833V17.5M5.833 14.167l-1.166 1.166M5 10H3.333M5.833 5.833 4.667 4.667"})}),{...ne,strokeWidth:1.5}),q1=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),u("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),u("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),O),_a=k(u("path",{strokeWidth:"1.25",d:"M3.333 14.167v1.666c0 .92.747 1.667 1.667 1.667h10c.92 0 1.667-.746 1.667-1.667v-1.666M5.833 9.167 10 13.333l4.167-4.166M10 3.333v10"}),ne),Gr=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("circle",{cx:"12",cy:"12",r:"9"}),u("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),u("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),O),J1=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("circle",{cx:"12",cy:"12",r:"9"}),u("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),u("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),O),FU=k(u("path",{strokeWidth:"1.25",d:"M9.167 5.833H5.833c-1.254 0-2.5 1.282-2.5 2.5v5.834c0 1.283 1.252 2.5 2.5 2.5h5.834c1.251 0 2.5-1.25 2.5-2.5v-3.334M8.333 11.667l8.334-8.334M12.5 3.333h4.167V7.5"}),ne),Q1=k(u("path",{d:"M7.5 15.833c-3.583 1.167-3.583-2.083-5-2.5m10 4.167v-2.917c0-.833.083-1.166-.417-1.666 2.334-.25 4.584-1.167 4.584-5a3.833 3.833 0 0 0-1.084-2.667 3.5 3.5 0 0 0-.083-2.667s-.917-.25-2.917 1.084a10.25 10.25 0 0 0-5.166 0C5.417 2.333 4.5 2.583 4.5 2.583a3.5 3.5 0 0 0-.083 2.667 3.833 3.833 0 0 0-1.084 2.667c0 3.833 2.25 4.75 4.584 5-.5.5-.5 1-.417 1.666V17.5",strokeWidth:"1.25"}),ne),eE=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M7.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM12.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM6.25 6.25c2.917-.833 4.583-.833 7.5 0M5.833 13.75c2.917.833 5.417.833 8.334 0"}),u("path",{d:"M12.917 14.167c0 .833 1.25 2.5 1.666 2.5 1.25 0 2.361-1.39 2.917-2.5.556-1.39.417-4.861-1.25-9.584-1.214-.846-2.5-1.116-3.75-1.25l-.833 2.084M7.083 14.167c0 .833-1.13 2.5-1.526 2.5-1.191 0-2.249-1.39-2.778-2.5-.529-1.39-.397-4.861 1.19-9.584 1.157-.846 2.318-1.116 3.531-1.25l.833 2.084"})]}),ne),tE=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 4l11.733 16h4.267l-11.733 -16z"}),u("path",{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"})]}),O),Ls=k(u("polyline",{fill:"none",stroke:"currentColor",points:"20 6 9 17 4 12"}),{width:24,height:24}),Ra=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M8.333 11.667a2.917 2.917 0 0 0 4.167 0l3.333-3.334a2.946 2.946 0 1 0-4.166-4.166l-.417.416"}),u("path",{d:"M11.667 8.333a2.917 2.917 0 0 0-4.167 0l-3.333 3.334a2.946 2.946 0 0 0 4.166 4.166l.417-.416"})]}),ne),oE=k("M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z",{width:448,height:512}),nE=k("M252 54L203 8a28 27 0 00-20-8H28C12 0 0 12 0 27v195c0 15 12 26 28 26h204c15 0 28-11 28-26V73a28 27 0 00-8-19zM130 213c-21 0-37-16-37-36 0-19 16-35 37-35 20 0 37 16 37 35 0 20-17 36-37 36zm56-169v56c0 4-4 6-7 6H44c-4 0-7-2-7-6V42c0-4 3-7 7-7h133l4 2 3 2a7 7 0 012 5z M296 201l87 95-188 205-78 9c-10 1-19-8-18-20l9-84zm141-14l-41-44a31 31 0 00-46 0l-38 41 87 95 38-42c13-14 13-36 0-50z",{width:448,height:512}),Ds=k(u("path",{d:"m9.257 6.351.183.183H15.819c.34 0 .727.182 1.051.506.323.323.505.708.505 1.05v5.819c0 .316-.183.7-.52 1.035-.337.338-.723.522-1.037.522H4.182c-.352 0-.74-.181-1.058-.5-.318-.318-.499-.705-.499-1.057V5.182c0-.351.181-.736.5-1.054.32-.321.71-.503 1.057-.503H6.53l2.726 2.726Z",strokeWidth:"1.25"}),ne),OU=k("M384 112v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h80c0-35.29 28.71-64 64-64s64 28.71 64 64h80c26.51 0 48 21.49 48 48zM192 40c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24m96 114v-20a6 6 0 0 0-6-6H102a6 6 0 0 0-6 6v20a6 6 0 0 0 6 6h180a6 6 0 0 0 6-6z",{width:384,height:512}),zU=k("M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"),rE=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z"}),u("path",{d:"M13.737 9.737c2.299 -2.3 3.23 -5.095 2.081 -6.245c-1.15 -1.15 -3.945 -.217 -6.244 2.082c-2.3 2.299 -3.231 5.095 -2.082 6.244c1.15 1.15 3.946 .218 6.245 -2.081z"}),u("path",{d:"M7.492 11.818c.362 .362 .768 .676 1.208 .934l6.895 4.047c1.078 .557 2.255 -.075 3.692 -1.512c1.437 -1.437 2.07 -2.614 1.512 -3.692c-.372 -.718 -1.72 -3.017 -4.047 -6.895a6.015 6.015 0 0 0 -.934 -1.208"})]}),O),iE=k(u("g",{strokeWidth:1.5,children:u("path",{d:"M6 18l12 -12"})}),O),aE=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15 8h.01"}),u("path",{d:"M12 20h-5a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v5"}),u("path",{d:"M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4"}),u("path",{d:"M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598"}),u("path",{d:"M19 16v6"}),u("path",{d:"M22 19l-3 3l-3 -3"})]}),O),lE=k("M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z",{width:512,height:512}),HU=k("M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),GU=k("M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),sE=k("M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"),UU=k("M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"),Fm=k(u("path",{d:"M7.5 10.833 4.167 7.5 7.5 4.167M4.167 7.5h9.166a3.333 3.333 0 0 1 0 6.667H12.5",strokeWidth:"1.25"}),ne),Om=k(u("path",{d:"M12.5 10.833 15.833 7.5 12.5 4.167M15.833 7.5H6.667a3.333 3.333 0 1 0 0 6.667H7.5",strokeWidth:"1.25"}),ne),cE=k("M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z",{mirror:!0}),dE=k(u("path",{d:"M5 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 17.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM7.25 8.917l5.5-2.834M7.25 11.083l5.5 2.834",strokeWidth:"1.5"}),ne),WU=k("M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"),YU=k("M16 5l-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z",{width:24,height:24}),VU=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1"}),u("path",{d:"M12 14v-11"}),u("path",{d:"M9 6l3 -3l3 3"})]}),O),XU=k(D(ve,{children:[u("path",{fill:"currentColor",d:"M40 5.6v6.1l-4.1.7c-8.9 1.4-16.5 6.9-20.6 15C13 32 10.9 43 12.4 43c.4 0 2.4-1.3 4.4-3 5-3.9 12.1-7 18.2-7.7l5-.6v12.8l11.2-11.3L62.5 22 51.2 10.8 40-.5v6.1zm10.2 22.6L44 34.5v-6.8l-6.9.6c-3.9.3-9.8 1.7-13.2 3.1-3.5 1.4-6.5 2.4-6.7 2.2-.9-1 3-7.5 6.4-10.8C28 18.6 34.4 16 40.1 16c3.7 0 3.9-.1 3.9-3.2V9.5l6.2 6.3 6.3 6.2-6.3 6.2z"}),u("path",{stroke:"currentColor",fill:"currentColor",d:"M0 36v20h48v-6.2c0-6 0-6.1-2-4.3-1.1 1-2 2.9-2 4.2V52H4V34c0-17.3-.1-18-2-18s-2 .7-2 20z"})]}),{width:64,height:64}),KU=k(u("path",{stroke:"currentColor",strokeWidth:"40",fill:"currentColor",d:"M148 560a318 318 0 0 0 522 110 316 316 0 0 0 0-450 316 316 0 0 0-450 0c-11 11-21 22-30 34v4h47c25 0 46 21 46 46s-21 45-46 45H90c-13 0-25-6-33-14-9-9-14-20-14-33V156c0-25 20-45 45-45s45 20 45 45v32l1 1a401 401 0 0 1 623 509l212 212a42 42 0 0 1-59 59L698 757A401 401 0 0 1 65 570a42 42 0 0 1 83-10z"}),{width:1024}),mE=D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 10l0 10"}),u("path",{d:"M12 10l4 4"}),u("path",{d:"M12 10l-4 4"}),u("path",{d:"M4 4l16 0"})]}),pE=D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 5l0 14"}),u("path",{d:"M16 9l-4 -4"}),u("path",{d:"M8 9l4 -4"})]}),zm=k(pE,O),Hm=k(pE,{...O,style:{transform:"rotate(180deg)"}}),Gm=k(mE,O),Um=k(mE,{...O,style:{transform:"rotate(180deg)"}}),Wm=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M3.333 3.333h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v7.083c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V8.125c0-.92-.746-1.667-1.666-1.667ZM6.875 6.458h-.417c-.92 0-1.666.747-1.666 1.667v3.75c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667v-3.75c0-.92-.747-1.667-1.667-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),Ym=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M6.875 3.125h-.417c-.92 0-1.666.746-1.666 1.667v7.083c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667V4.792c0-.92-.747-1.667-1.667-1.667ZM13.542 5.817h-.417c-.92 0-1.667.747-1.667 1.667v4.391c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V7.484c0-.92-.746-1.667-1.666-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),Vm=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M15.208 4.792H8.125c-.92 0-1.667.746-1.667 1.666v.417c0 .92.747 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM12.516 11.458H8.125c-.92 0-1.667.746-1.667 1.667v.417c0 .92.747 1.666 1.667 1.666h4.391c.92 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.667-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),Xm=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M16.667 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M11.875 4.792H4.792c-.92 0-1.667.746-1.667 1.666v.417c0 .92.746 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM11.683 11.458H7.292c-.92 0-1.667.746-1.667 1.667v.417c0 .92.746 1.666 1.667 1.666h4.39c.921 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.666-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),uE=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M16.667 3.333v13.334M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M14.375 10.208v-.416c0-.92-.746-1.667-1.667-1.667H7.292c-.92 0-1.667.746-1.667 1.667v.416c0 .92.746 1.667 1.667 1.667h5.416c.92 0 1.667-.746 1.667-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),hE=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M3.333 3.333h13.334M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M10.208 5.625h-.416c-.92 0-1.667.746-1.667 1.667v5.416c0 .92.746 1.667 1.667 1.667h.416c.92 0 1.667-.746 1.667-1.667V7.292c0-.92-.746-1.667-1.667-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),Km=k(D("g",{stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M1.667 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M8.333 10h3.334",strokeLinejoin:"round"}),u("path",{d:"M15.417 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M6.875 4.792h-.417c-.92 0-1.666.746-1.666 1.666v7.084c0 .92.746 1.666 1.666 1.666h.417c.92 0 1.667-.746 1.667-1.666V6.458c0-.92-.747-1.666-1.667-1.666ZM13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v3.75c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667v-3.75c0-.92-.746-1.667-1.666-1.667Z"})]}),ne),Zm=k(D("g",{stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M10 18.333v-2.916",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M10 11.667V8.333",strokeLinejoin:"round"}),u("path",{d:"M10 4.583V1.667",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M4.792 13.125v.417c0 .92.746 1.666 1.666 1.666h7.084c.92 0 1.666-.746 1.666-1.666v-.417c0-.92-.746-1.667-1.666-1.667H6.458c-.92 0-1.666.746-1.666 1.667ZM6.458 6.458v.417c0 .92.747 1.667 1.667 1.667h3.75c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666h-3.75c-.92 0-1.667.746-1.667 1.666Z"})]}),ne),_s=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("circle",{cx:"9",cy:"7",r:"4"}),u("path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"}),u("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"}),u("path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85"})]}),O),ZU=k("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z"),$U=k("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z"),xo=k(D(ve,{children:[u("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:u("path",{d:"M15 5 5 15M5 5l10 10"})}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),jU=k("M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z",{mirror:!0}),qU=k("M11.553 22.894a.998.998 0 00.894 0s3.037-1.516 5.465-4.097C19.616 16.987 21 14.663 21 12V5a1 1 0 00-.649-.936l-8-3a.998.998 0 00-.702 0l-8 3A1 1 0 003 5v7c0 2.663 1.384 4.987 3.088 6.797 2.428 2.581 5.465 4.097 5.465 4.097zm-1.303-8.481l6.644-6.644a.856.856 0 111.212 1.212l-7.25 7.25a.856.856 0 01-1.212 0l-3.75-3.75a.856.856 0 111.212-1.212l3.144 3.144z",{width:24}),JU=k("M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z",{width:384,height:512}),$m=Xe.memo(({theme:e})=>k(D(ve,{children:[u("path",{d:"M25 26H111V111H25",fill:io(e)}),u("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:io(e),strokeWidth:"2"}),u("path",{d:"M100 100H160V160H100",fill:io(e)}),u("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:io(e),strokeWidth:"2"}),D("g",{fill:z1(e),stroke:io(e),strokeWidth:"6",children:[u("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),u("rect",{x:"2.5",y:"149.5",width:"30",height:"30"}),u("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),u("rect",{x:"147.5",y:"2.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),jm=Xe.memo(({theme:e})=>k(D(ve,{children:[u("path",{d:"M25 26H111V111H25",fill:io(e)}),u("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:io(e),strokeWidth:"2"}),u("path",{d:"M100 100H160V160H100",fill:io(e)}),u("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:io(e),strokeWidth:"2"}),D("g",{fill:z1(e),stroke:io(e),strokeWidth:"6",children:[u("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),u("rect",{x:"78.5",y:"149.5",width:"30",height:"30"}),u("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),u("rect",{x:"147.5",y:"78.5",width:"30",height:"30"}),u("rect",{x:"105.5",y:"2.5",width:"30",height:"30"}),u("rect",{x:"2.5",y:"102.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),gE=k(u("g",{strokeWidth:1.25,children:u("path",{d:"M5.879 2.625h8.242a3.27 3.27 0 0 1 3.254 3.254v8.242a3.27 3.27 0 0 1-3.254 3.254H5.88a3.27 3.27 0 0 1-3.254-3.254V5.88A3.27 3.27 0 0 1 5.88 2.626l-.001-.001ZM4.518 16.118l7.608-12.83m.198 13.934 5.051-9.897M2.778 9.675l9.348-6.387m-7.608 12.83 12.857-8.793"})}),ne),fE=k(D(ve,{children:[u("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),u("mask",{id:"FillHachureIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:2,y:2,width:16,height:16,children:u("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.25"})}),u("g",{mask:"url(#FillHachureIcon)",children:u("path",{d:"M2.258 15.156 15.156 2.258M7.324 20.222 20.222 7.325m-20.444 5.35L12.675-.222m-8.157 18.34L17.416 5.22",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})]}),ne),EE=k(D(ve,{children:[D("g",{clipPath:"url(#a)",children:[u("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),u("mask",{id:"FillCrossHatchIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:-1,y:-1,width:22,height:22,children:u("path",{d:"M2.426 15.044 15.044 2.426M7.383 20 20 7.383M0 12.617 12.617 0m-7.98 17.941L17.256 5.324m-2.211 12.25L2.426 4.956M20 12.617 7.383 0m5.234 20L0 7.383m17.941 7.98L5.324 2.745",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),u("g",{mask:"url(#FillCrossHatchIcon)",children:u("path",{d:"M14.121 2H5.88A3.879 3.879 0 0 0 2 5.879v8.242A3.879 3.879 0 0 0 5.879 18h8.242A3.879 3.879 0 0 0 18 14.121V5.88A3.879 3.879 0 0 0 14.121 2Z",fill:"currentColor"})})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),xE=k(D(ve,{children:[u("g",{clipPath:"url(#a)",children:u("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z",stroke:"currentColor",strokeWidth:"1.25"})}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),{...ne,fill:"currentColor"}),qm=k(u(ve,{children:u("path",{d:"M4.167 10h11.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),ne),bE=k(u("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),ne),yE=k(u("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"3.75",strokeLinecap:"round",strokeLinejoin:"round"}),ne),QU=Xe.memo(({theme:e})=>k(u("path",{d:"M6 10H34",stroke:io(e),strokeWidth:2,fill:"none",strokeLinecap:"round"}),{width:40,height:20})),wE=k(D("g",{strokeWidth:"2",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 12h2"}),u("path",{d:"M17 12h2"}),u("path",{d:"M11 12h2"})]}),O),vE=k(D("g",{strokeWidth:"2",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 12v.01"}),u("path",{d:"M8 12v.01"}),u("path",{d:"M12 12v.01"}),u("path",{d:"M16 12v.01"}),u("path",{d:"M20 12v.01"})]}),O),TE=k(u("path",{d:"M2.5 12.038c1.655-.885 5.9-3.292 8.568-4.354 2.668-1.063.101 2.821 1.32 3.104 1.218.283 5.112-1.814 5.112-1.814",strokeWidth:"1.25"}),ne),IE=k(u("path",{d:"M2.5 12.563c1.655-.886 5.9-3.293 8.568-4.355 2.668-1.062.101 2.822 1.32 3.105 1.218.283 5.112-1.814 5.112-1.814m-13.469 2.23c2.963-1.586 6.13-5.62 7.468-4.998 1.338.623-1.153 4.11-.132 5.595 1.02 1.487 6.133-1.43 6.133-1.43",strokeWidth:"1.25"}),ne),CE=k(u("path",{d:"M2.5 11.936c1.737-.879 8.627-5.346 10.42-5.268 1.795.078-.418 5.138.345 5.736.763.598 3.53-1.789 4.235-2.147M2.929 9.788c1.164-.519 5.47-3.28 6.987-3.114 1.519.165 1 3.827 2.121 4.109 1.122.281 3.839-2.016 4.606-2.42",strokeWidth:"1.25"}),ne),SE=k(D("svg",{strokeWidth:"1.5",children:[u("path",{d:"M3.33334 9.99998V6.66665C3.33334 6.04326 3.33403 4.9332 3.33539 3.33646C4.95233 3.33436 6.06276 3.33331 6.66668 3.33331H10"}),u("path",{d:"M13.3333 3.33331V3.34331"}),u("path",{d:"M16.6667 3.33331V3.34331"}),u("path",{d:"M16.6667 6.66669V6.67669"}),u("path",{d:"M16.6667 10V10.01"}),u("path",{d:"M3.33334 13.3333V13.3433"}),u("path",{d:"M16.6667 13.3333V13.3433"}),u("path",{d:"M3.33334 16.6667V16.6767"}),u("path",{d:"M6.66666 16.6667V16.6767"}),u("path",{d:"M10 16.6667V16.6767"}),u("path",{d:"M13.3333 16.6667V16.6767"}),u("path",{d:"M16.6667 16.6667V16.6767"})]}),ne),kE=k(D("g",{strokeWidth:"1.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 12v-4a4 4 0 0 1 4 -4h4"}),u("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),u("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),u("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),u("line",{x1:"20",y1:"12",x2:"20",y2:"12.01"}),u("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),u("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),u("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),u("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),u("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),u("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),u("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})]}),O),ME=Xe.memo(({flip:e=!1})=>k(D("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",opacity:.3,strokeWidth:2,fill:"none",strokeLinecap:"round",children:[u("path",{d:"M7,11 H19"}),u("path",{d:"M25,6 L33,16 M33,6 L25,16"})]}),mt)),PE=Xe.memo(({flip:e=!1})=>k(u("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:u("path",{d:"M7,11 H33 M23,5 L33,11 L23,17"})}),mt)),AE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",children:[u("path",{d:"M7,11 H23",strokeWidth:2,strokeLinecap:"round"}),u("path",{d:"M23,5 L35,11 L23,17 Z"})]}),mt)),LE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",children:[u("path",{d:"M7,11 H23"}),u("path",{d:"M23,5 L35,11 L23,17 Z"})]}),mt)),DE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[u("path",{d:"M7,11 H25",strokeWidth:2,strokeLinecap:"round"}),u("circle",{cx:"29",cy:"11",r:"4"})]}),mt)),_E=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,children:[u("path",{d:"M7,11 H25",strokeLinecap:"round"}),u("circle",{cx:"29",cy:"11",r:"4"})]}),mt)),RE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",children:[u("path",{d:"M7,11 H21",strokeWidth:2,strokeLinecap:"round"}),u("path",{d:"M21,11 L28,5 L35,11 L28,17 Z"})]}),mt)),NE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,strokeLinecap:"round",children:[u("path",{d:"M7,11 H21"}),u("path",{d:"M21,11 L28,5 L35,11 L28,17 Z"})]}),mt)),BE=Xe.memo(({flip:e=!1})=>k(u("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",strokeLinecap:"round",children:u("path",{d:"M11,11 H31 M31,5 V17"})}),mt)),FE=Xe.memo(({flip:e=!1})=>k(u("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:u("path",{d:"M35,11 H7 M15,5 V17"})}),mt)),OE=Xe.memo(({flip:e=!1})=>k(u("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:u("path",{d:"M35,11 H7 M15,11 L7,5 M15,11 L7,17"})}),mt)),zE=Xe.memo(({flip:e=!1})=>k(u("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:u("path",{d:"M35,11 H7 M23,5 V17 M15,11 L7,5 M15,11 L7,17"})}),mt)),HE=Xe.memo(({flip:e=!1})=>k(u("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:u("path",{d:"M35,11 H7 M15,5 V17 M7,5 V17"})}),mt)),GE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:[u("path",{d:"M35,11 H19 M11,11 H7 M7,5 V17"}),u("circle",{cx:"15",cy:"11",r:"4"})]}),mt)),UE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:[u("path",{d:"M35,11 H27 M19,11 H7 M15,11 L7,5 M15,11 L7,17"}),u("circle",{cx:"23",cy:"11",r:"4"})]}),mt)),WE=k(D(ve,{children:[u("g",{clipPath:"url(#a)",children:u("path",{d:"M14.167 6.667a3.333 3.333 0 0 0-3.334-3.334H9.167a3.333 3.333 0 0 0 0 6.667h1.666a3.333 3.333 0 0 1 0 6.667H9.167a3.333 3.333 0 0 1-3.334-3.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),YE=k(D(ve,{children:[u("g",{clipPath:"url(#a)",children:u("path",{d:"M5 16.667V3.333L10 15l5-11.667v13.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),VE=k(D(ve,{children:[u("g",{clipPath:"url(#a)",children:u("path",{d:"M5.833 3.333v13.334h8.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),XE=k(u(ve,{children:u("path",{d:"m1.667 3.333 6.666 13.334M8.333 3.333 1.667 16.667M11.667 3.333v13.334h6.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),ne),ar=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 7v-2h13v2"}),u("path",{d:"M10 5v14"}),u("path",{d:"M12 19h-4"}),u("path",{d:"M15 13v-1h6v1"}),u("path",{d:"M18 12v7"}),u("path",{d:"M17 19h2"})]}),O),KE=k(u(ve,{children:D("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M7 12h10"}),u("path",{d:"M7 5v14"}),u("path",{d:"M17 5v14"}),u("path",{d:"M15 19h4"}),u("path",{d:"M15 5h4"}),u("path",{d:"M5 19h4"}),u("path",{d:"M5 5h4"})]})}),O),Na=k(u(ve,{children:u("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:u("path",{d:"M5.833 16.667v-10a3.333 3.333 0 0 1 3.334-3.334h1.666a3.333 3.333 0 0 1 3.334 3.334v10M5.833 10.833h8.334"})})}),ne),NS=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M7 8l-4 4l4 4"}),u("path",{d:"M17 8l4 4l-4 4"}),u("path",{d:"M14 4l-4 16"})]}),O),Rs=NS,ZE=k(D("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),u("line",{x1:"4",y1:"12",x2:"12",y2:"12"}),u("line",{x1:"4",y1:"16",x2:"16",y2:"16"})]}),O),$E=k(D("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),u("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),u("line",{x1:"6",y1:"16",x2:"18",y2:"16"})]}),O),jE=k(D("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),u("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),u("line",{x1:"8",y1:"16",x2:"20",y2:"16"})]}),O),qE=Xe.memo(({theme:e})=>k(D("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"4",x2:"20",y2:"4"}),u("rect",{x:"9",y:"8",width:"6",height:"12",rx:"2"})]}),O)),JE=Xe.memo(({theme:e})=>k(D("g",{strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"20",x2:"20",y2:"20"}),u("rect",{x:"9",y:"4",width:"6",height:"12",rx:"2"})]}),O)),QE=Xe.memo(({theme:e})=>k(D("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"12",x2:"9",y2:"12"}),u("line",{x1:"15",y1:"12",x2:"20",y2:"12"}),u("rect",{x:"9",y:"6",width:"6",height:"12",rx:"2"})]}),O)),Ns=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M21 19h-18l9 -15"}),u("path",{d:"M20.615 15.171h.015"}),u("path",{d:"M19.515 11.771h.015"}),u("path",{d:"M17.715 8.671h.015"}),u("path",{d:"M15.415 5.971h.015"})]}),O),eW=k(u("path",{d:"M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z",fill:"currentColor"}),{width:640,height:512}),tW=k(u("path",{d:"M480 416C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H150.6C133.7 480 117.4 473.3 105.4 461.3L25.37 381.3C.3786 356.3 .3786 315.7 25.37 290.7L258.7 57.37C283.7 32.38 324.3 32.38 349.3 57.37L486.6 194.7C511.6 219.7 511.6 260.3 486.6 285.3L355.9 416H480zM265.4 416L332.7 348.7L195.3 211.3L70.63 336L150.6 416L265.4 416z"})),Bs=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),u("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),u("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),u("path",{d:"M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47"})]}),O),Jm=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),u("path",{d:"M7 11l5 5l5 -5"}),u("path",{d:"M12 4l0 12"})]}),O),Ur=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"}),u("path",{d:"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"})]}),O),e0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),u("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),u("path",{d:"M9.15 14.85l8.85 -10.85"}),u("path",{d:"M6 4l8.85 10.85"})]}),O),t0=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),u("path",{d:"M12 17l0 .01"}),u("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),O),oW=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M7 4v16l13 -8z"})]}),O),nW=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",strokeWidth:"0",fill:"currentColor"})]}),O),o0=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 12l5 5l10 -10"})]}),O),n0=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z"}),u("path",{d:"M12 9v4"}),u("path",{d:"M12 17h.01"})]}),O),r0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M11 7l6 6"}),u("path",{d:"M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z"})]}),O),Wr=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 3l-4 7h8z"}),u("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),u("path",{d:"M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"})]}),O),bn=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 7l16 0"}),u("path",{d:"M4 17l16 0"}),u("path",{d:"M7 4l0 16"}),u("path",{d:"M17 4l0 16"})]}),O),rW=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"}),u("path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"})]}),O),iW=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 10l-2 1l8 4l8 -4l-2 -1"}),u("path",{d:"M4 15l8 4l8 -4"}),u("path",{d:"M12 4v7"}),u("path",{d:"M15 8l-3 3l-3 -3"})]}),O),aW=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M4.16602 10H15.8327"}),u("path",{d:"M12.5 13.3333L15.8333 10"}),u("path",{d:"M12.5 6.66666L15.8333 9.99999"})]}),ne),Yr=k(D("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(90 10 10)",children:[u("path",{clipRule:"evenodd",d:"m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z"}),u("path",{d:"m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13"})]}),20),i0=k(D("g",{stroke:"currentColor",fill:"none",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z"}),u("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),u("path",{d:"M15 6l3 3"}),u("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),u("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),O),lW=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z"}),u("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),u("path",{d:"M15 6l3 3"}),u("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),u("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),O),sW=k(D("g",{stroke:"currentColor",fill:"none",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35"}),u("path",{d:"M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946"}),u("path",{d:"M6 7.63c-1.391 -.236 -2.787 .395 -3.534 1.689a3.474 3.474 0 0 0 1.271 4.745l4.263 2.514l6 -3.348"}),u("path",{d:"M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45"}),u("path",{d:"M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946"}),u("path",{d:"M18 16.302c1.391 .236 2.787 -.395 3.534 -1.689a3.474 3.474 0 0 0 -1.271 -4.745l-4.308 -2.514l-5.955 3.42"})]}),O),a0=k(D("g",{stroke:"currentColor",fill:"none",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),u("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),u("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),u("path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2"})]}),O),lr=k(D("g",{stroke:"currentColor",fill:"none",strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"}),u("path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"})]}),O),l0=k(D("g",{stroke:"currentColor",fill:"none",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"}),u("path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"}),u("path",{d:"M3 3l18 18"})]}),O),cW=k(D("g",{stroke:"currentColor",fill:"none",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),u("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),u("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),u("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),u("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),u("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),O),dW=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),u("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),u("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),u("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),u("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),u("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),O),bo=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),u("path",{d:"M21 21l-6 -6"})]}),O),mW=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M20.984 12.53a9 9 0 1 0 -7.552 8.355"}),u("path",{d:"M12 7v5l3 3"}),u("path",{d:"M19 16l-2 3h4l-2 3"})]}),O),pW=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 8l0 4l2 2"}),u("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]}),O),s0=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M9 2m0 3a3 3 0 0 1 3 -3h0a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3h0a3 3 0 0 1 -3 -3z"}),u("path",{d:"M5 10a7 7 0 0 0 14 0"}),u("path",{d:"M8 21l8 0"}),u("path",{d:"M12 17l0 4"})]}),O),c0=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 3l18 18"}),u("path",{d:"M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1 -.13 .874m-2 2a3 3 0 0 1 -3.87 -2.872v-1"}),u("path",{d:"M5 10a7 7 0 0 0 10.846 5.85m2 -2a6.967 6.967 0 0 0 1.152 -3.85"}),u("path",{d:"M8 21l8 0"}),u("path",{d:"M12 17l0 4"})]}),O),uW=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11"})]}),O),d0=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M8 8m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z"}),u("path",{d:"M12 20v.01"}),u("path",{d:"M16 20v.01"}),u("path",{d:"M8 20v.01"}),u("path",{d:"M4 20v.01"}),u("path",{d:"M4 16v.01"}),u("path",{d:"M4 12v.01"}),u("path",{d:"M4 8v.01"}),u("path",{d:"M4 4v.01"}),u("path",{d:"M8 4v.01"}),u("path",{d:"M12 4v.01"}),u("path",{d:"M16 4v.01"}),u("path",{d:"M20 4v.01"}),u("path",{d:"M20 8v.01"}),u("path",{d:"M20 12v.01"}),u("path",{d:"M20 16v.01"}),u("path",{d:"M20 20v.01"})]}),O),m0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 3v18"}),u("path",{d:"M19 21v-18"}),u("path",{d:"M5 7h14"}),u("path",{d:"M5 15h14"}),u("path",{d:"M8 13v4"}),u("path",{d:"M11 13v4"}),u("path",{d:"M16 13v4"}),u("path",{d:"M14 5v4"}),u("path",{d:"M11 5v4"}),u("path",{d:"M8 5v4"}),u("path",{d:"M3 21h18"})]}),O),p0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 12l18 0"}),u("path",{d:"M7 16l10 0l-10 5l0 -5"}),u("path",{d:"M7 8l10 0l-10 -5l0 5"})]}),O),u0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 3l0 18"}),u("path",{d:"M16 7l0 10l5 0l-5 -10"}),u("path",{d:"M8 7l0 10l-5 0l5 -10"})]}),O),Qm=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z"}),u("path",{d:"M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2"}),u("path",{d:"M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"})]}),O),Fs=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),u("path",{d:"M22 22l-3 -3"}),u("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),u("path",{d:"M3 11v-1"}),u("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),u("path",{d:"M10 3h1"}),u("path",{d:"M15 3h1a2 2 0 0 1 2 2v1"})]}),O),h0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),u("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),u("path",{d:"M4 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75"}),u("path",{d:"M10 15l2 6l2 -6"}),u("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"})]}),O),g0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),u("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),u("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"}),u("path",{d:"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6"}),u("path",{d:"M11 21v-6l3 6v-6"})]}),O),Vr=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 13v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a2 2 0 0 0 6 0v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a8 8 0 0 1 -16 0"}),u("path",{d:"M4 8l5 0"}),u("path",{d:"M15 8l4 0"})]}),O),f0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 14c.83 .642 2.077 1.017 3.5 1c1.423 .017 2.67 -.358 3.5 -1c.83 -.642 2.077 -1.017 3.5 -1c1.423 -.017 2.67 .358 3.5 1"}),u("path",{d:"M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),u("path",{d:"M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),u("path",{d:"M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z"}),u("path",{d:"M16.746 16.726a3 3 0 1 0 .252 -5.555"})]}),O),E0=k(D("g",{stroke:"currentColor",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-16a1 1 0 0 1-1-1v-10zM7 20h10M9 16v4M15 16v4"})]}),{...O,strokeWidth:1.5}),hW=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"}),u("path",{d:"M21 12h-13l3 -3"}),u("path",{d:"M11 15l-3 -3"})]}),O),gW=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z"}),u("path",{d:"M10 9l5 3l-5 3z"})]}),O),x0=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 6h18"}),u("path",{d:"M3 12h18"}),u("path",{d:"M3 18h18"}),u("path",{d:"M6 3v18"}),u("path",{d:"M12 3v18"}),u("path",{d:"M18 3v18"})]}),O),b0=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M17 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}),u("path",{d:"M3 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}),u("path",{d:"M17 5c-6.627 0 -12 5.373 -12 12"})]}),O),Xr=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 18l12 -12"}),u("path",{d:"M18 10v-4h-4"})]}),O),Kr=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4,19L10,19C11.097,19 12,18.097 12,17L12,9C12,7.903 12.903,7 14,7L21,7"}),u("path",{d:"M18 4l3 3l-3 3"})]}),O),Zr=k(D("g",{children:[u("path",{d:"M16,12L20,9L16,6"}),u("path",{d:"M6 20c0 -6.075 4.925 -11 11 -11h3"})]}),O),Os=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 9l6 6l6 -6"})]}),O),y0=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 15l6 -6l6 6"})]}),O),w0=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 15l6 -6l6 6"})]}),O),ep=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M8 5v10a1 1 0 0 0 1 1h10"}),u("path",{d:"M5 8h10a1 1 0 0 1 1 1v10"})]}),O),zs=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M19 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M5 7l0 10"}),u("path",{d:"M7 5l10 0"}),u("path",{d:"M7 19l10 0"}),u("path",{d:"M19 7l0 10"})]}),O),tp=k(D("g",{strokeWidth:"1.25",children:[u("rect",{x:"4",y:"4",width:"4",height:"4",rx:"1"}),u("rect",{x:"10",y:"4",width:"4",height:"4",rx:"1"}),u("rect",{x:"16",y:"4",width:"4",height:"4",rx:"1"}),u("rect",{x:"4",y:"10",width:"4",height:"4",rx:"1"}),u("rect",{x:"10",y:"10",width:"4",height:"4",rx:"1"}),u("rect",{x:"16",y:"10",width:"4",height:"4",rx:"1"}),u("rect",{x:"4",y:"16",width:"4",height:"4",rx:"1"}),u("rect",{x:"10",y:"16",width:"4",height:"4",rx:"1"}),u("rect",{x:"16",y:"16",width:"4",height:"4",rx:"1"})]}),O),op=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("rect",{x:"7",y:"6",width:"10",height:"8",rx:"1",strokeDasharray:"2 2"}),u("line",{x1:"3",y1:"6",x2:"3",y2:"14"}),u("polyline",{points:"2 8 3 6 4 8"}),u("polyline",{points:"2 12 3 14 4 12"}),u("line",{x1:"7",y1:"18",x2:"17",y2:"18"}),u("polyline",{points:"9 17 7 18 9 19"}),u("polyline",{points:"15 17 17 18 15 19"})]}),O),fW=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 11v8a1 1 0 0 0 1 1h8m-9 -14v-1a1 1 0 0 1 1 -1h1m5 0h2m5 0h1a1 1 0 0 1 1 1v1m0 5v2m0 5v1a1 1 0 0 1 -1 1h-1"}),u("path",{d:"M4 12h7a1 1 0 0 1 1 1v7"})]}),O),np=k(u("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:.5,viewBox:"0 0 640 512",children:u("path",{d:"M15 15C24.4 5.7 39.6 5.7 49 15l63 63L112 40c0-13.3 10.7-24 24-24s24 10.7 24 24l0 96c0 13.3-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l38.1 0L15 49C5.7 39.6 5.7 24.4 15 15zM133.5 243.9C158.6 193.6 222.7 112 320 112s161.4 81.6 186.5 131.9c3.8 7.6 3.8 16.5 0 24.2C481.4 318.4 417.3 400 320 400s-161.4-81.6-186.5-131.9c-3.8-7.6-3.8-16.5 0-24.2zM320 320a64 64 0 1 0 0-128 64 64 0 1 0 0 128zM591 15c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-63 63 38.1 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24l0-96c0-13.3 10.7-24 24-24s24 10.7 24 24l0 38.1 63-63zM15 497c-9.4-9.4-9.4-24.6 0-33.9l63-63L40 400c-13.3 0-24-10.7-24-24s10.7-24 24-24l96 0c13.3 0 24 10.7 24 24l0 96c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-38.1L49 497c-9.4 9.4-24.6 9.4-33.9 0zm576 0l-63-63 0 38.1c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-96c0-13.3 10.7-24 24-24l96 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-38.1 0 63 63c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0z"})})),v0=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 6l8 0"}),u("path",{d:"M16 6l4 0"}),u("path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 12l2 0"}),u("path",{d:"M10 12l10 0"}),u("path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 18l11 0"}),u("path",{d:"M19 18l1 0"})]}),O),T0=k(D("g",{strokeWidth:1,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 10l4 -4 L6 14l8 -8 L6 18l12 -12 L10 18l8 -8 L14 18l4 -4"})]}),O),BS=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),u("path",{d:"M13.5 6.5l4 4"})]}),O),EW=k(D("g",{strokeWidth:1,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M11 7l-5 5l5 5"}),u("path",{d:"M17 7l-5 5l5 5"})]}),O),I0=k(D("g",{strokeWidth:"1.75",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"}),u("path",{d:"M15 4l0 16"})]}),O),xW=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1"})]}),O),bW=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 4l18 0"}),u("path",{d:"M4 4v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-10"}),u("path",{d:"M12 16l0 4"}),u("path",{d:"M9 20l6 0"}),u("path",{d:"M8 12l3 -3l2 2l3 -3"})]}),O),Hs=u("div",{style:{width:"1rem",height:"1rem"}}),C0=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("polyline",{points:"9 6 15 12 9 18"})]}),O),S0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 6l8 0"}),u("path",{d:"M16 6l4 0"}),u("path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 12l2 0"}),u("path",{d:"M10 12l10 0"}),u("path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 18l11 0"}),u("path",{d:"M19 18l1 0"})]}),O);import k0 from"clsx";import ip,{useEffect as zS,useRef as M0,useState as HS}from"react";import{isPromiseLike as GS}from"@excalidraw/common";import FS from"react";import{jsx as rp}from"react/jsx-runtime";var OS=({size:e="1em",circleWidth:o=8,synchronized:t=!1,className:n=""})=>{let i=-(FS.useRef(Date.now()).current%1600);return rp("div",{className:`Spinner ${n}`,children:rp("svg",{viewBox:"0 0 100 100",style:{width:e,height:e,"--spinner-delay":t?`${i}ms`:0},children:rp("circle",{cx:"50",cy:"50",r:50-o/2,strokeWidth:o,fill:"none",strokeMiterlimit:"10"})})})},Yo=OS;import{jsx as Ba,jsxs as Fa}from"react/jsx-runtime";var V=ip.forwardRef(({size:e="medium",visible:o=!0,className:t="",...n},r)=>{let{id:i}=_e(),l=ip.useRef(null);ip.useImperativeHandle(r,()=>l.current);let a=`ToolIcon_size_${e}`,[s,c]=HS(!1),m=M0(!0),p=async h=>{let f="onClick"in n&&n.onClick?.(h);if(GS(f))try{c(!0),await f}catch(g){if(g instanceof us)console.warn(g);else throw g}finally{m.current&&c(!1)}};zS(()=>(m.current=!0,()=>{m.current=!1}),[]);let d=M0(null);if(n.type==="button"||n.type==="icon"||n.type==="submit"){let h=n.type==="icon"?"button":n.type;return Fa("button",{className:k0("ToolIcon_type_button",a,t,o&&!n.hidden?"ToolIcon_type_button--show":"ToolIcon_type_button--hide",{ToolIcon:!n.hidden,"ToolIcon--selected":n.selected,"ToolIcon--plain":n.type==="icon"}),style:n.style,"data-testid":n["data-testid"],hidden:n.hidden,title:n.title,"aria-label":n["aria-label"],type:h,onClick:p,ref:l,disabled:s||n.isLoading||!!n.disabled,children:[(n.icon||n.label)&&Fa("div",{className:"ToolIcon__icon","aria-hidden":"true","aria-disabled":!!n.disabled,children:[n.icon||n.label,n.keyBindingLabel&&Ba("span",{className:"ToolIcon__keybinding",children:n.keyBindingLabel}),n.isLoading&&Ba(Yo,{})]}),n.showAriaLabel&&Fa("div",{className:"ToolIcon__label",children:[n["aria-label"]," ",s&&Ba(Yo,{})]}),n.children]})}return Fa("label",{className:k0("ToolIcon",t),title:n.title,onPointerDown:h=>{d.current=h.pointerType||null,n.onPointerDown?.({pointerType:h.pointerType||null})},onPointerUp:()=>{requestAnimationFrame(()=>{d.current=null})},children:[Ba("input",{className:`ToolIcon_type_radio ${a}`,type:"radio",name:n.name,"aria-label":n["aria-label"],"aria-keyshortcuts":n["aria-keyshortcuts"],"data-testid":n["data-testid"],id:`${i}-${n.id}`,onChange:()=>{n.onChange?.({pointerType:d.current})},checked:n.checked,ref:l}),Fa("div",{className:"ToolIcon__icon",children:[n.icon,n.keyBindingLabel&&Ba("span",{className:"ToolIcon__keybinding",children:n.keyBindingLabel})]})]})});V.displayName="ToolButton";var Gs=[],N=e=>(Gs=Gs.concat(e),e);import{jsx as jS}from"react/jsx-runtime";var $S=(e,o,t)=>{let n=new Set(te(e.filter(m=>XS(m)),o).map(m=>m.id)),r={},i=t.scene.getNonDeletedElementsMap(),l=new Set;for(let m of n){let p=KS(e,m);for(let d of p)if(!l.has(d.id)){if(Us(d)){let h=A0(d,i);h&&(r[h.id]=!0)}else r[d.id]=!0;l.add(d.id)}}let a=!0,s=e.map(m=>{if(o.selectedElementIds[m.id]){let p=Us(m)?A0(m,i):null;return m.frameId&&n.has(m.frameId)?(a=!1,r[m.id]=!0,m):p?.frameId&&n.has(p?.frameId)?m:(m.boundElements&&m.boundElements.forEach(d=>{let h=t.scene.getNonDeletedElementsMap().get(d.id);h&&VS(h)&&t.scene.mutateElement(h,{startBinding:m.id===h.startBinding?.elementId?null:h.startBinding,endBinding:m.id===h.endBinding?.elementId?null:h.endBinding})}),Ys(m,{isDeleted:!0}))}return m.frameId&&n.has(m.frameId)?(a=!1,Us(m)||(r[m.id]=!0),Ys(m,{frameId:null})):Us(m)&&o.selectedElementIds[m.containerId]?Ys(m,{isDeleted:!0}):m}),c=o.editingGroupId;if(a&&o.editingGroupId){let m=sp(s,o.editingGroupId).filter(p=>!p.isDeleted);if(m.length>1)m[0]&&(r[m[0].id]=!0);else{c=null,m[0]&&(r[m[0].id]=!0);let p=m[0];if(p){let d=p.groupIds.findIndex(f=>f===o.editingGroupId),h=p.groupIds[d+1];if(h){let f=sp(s,h).filter(g=>!g.isDeleted);f.length>1&&(c=h,f.forEach(g=>{r[g.id]=!0}))}}}}return{elements:s,appState:{...o,...ZS({selectedElementIds:r,editingGroupId:c},s,o,null)}}},L0=(e,o)=>{if(e.editingGroupId){let t=sp(lp(o),e.editingGroupId);if(t.length)return{...e,selectedElementIds:{[t[0].id]:!0}}}return e},Oa=N({name:"deleteSelectedElements",label:"labels.delete",icon:ir,trackEvent:{category:"element",action:"delete"},perform:(e,o,t,n)=>{if(o.selectedLinearElement?.isEditing){let{elementId:l,selectedPointsIndices:a}=o.selectedLinearElement,s=n.scene.getNonDeletedElementsMap(),c=P0.getElement(l,s);if(!c||a==null)return!1;if(a.length>=c.points.length){let m=e.map(d=>d.id===c.id?Ys(d,{isDeleted:!0}):d),p=L0(o,m);return{elements:m,appState:{...p,selectedLinearElement:null},captureUpdate:Ws.IMMEDIATELY}}return P0.deletePoints(c,n,a),{elements:e,appState:{...o,selectedLinearElement:{...o.selectedLinearElement,selectedPointsIndices:a?.[0]>0?[a[0]-1]:[0]}},captureUpdate:Ws.IMMEDIATELY}}let{elements:r,appState:i}=$S(e,o,n);return YS(r,r.filter(l=>l.isDeleted)),i=L0(i,r),{elements:r,appState:{...i,activeTool:WS(o,{type:n.state.preferredSelectionTool.type}),multiElement:null,newElement:null,activeEmbeddable:null,selectedLinearElement:null},captureUpdate:we(lp(e),o)?Ws.IMMEDIATELY:Ws.EVENTUALLY}},keyTest:(e,o,t)=>(e.key===ap.BACKSPACE||e.key===ap.DELETE)&&!e[ap.CTRL_OR_CMD],PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>{let r=et()==="mobile";return jS(V,{type:"button",icon:ir,title:E("labels.delete"),"aria-label":E("labels.delete"),onClick:()=>t(null),disabled:!we(lp(e),o),style:{...r&&o.openPopup!=="compactOtherProperties"?US:{}}})}});import{KEYS as $r,CODES as jr,isDarwin as Vs}from"@excalidraw/common";import{moveOneLeft as qS,moveOneRight as JS,moveAllLeft as QS,moveAllRight as e5}from"@excalidraw/element";import{CaptureUpdateAction as Xs}from"@excalidraw/element";import{isDarwin as D0}from"@excalidraw/common";var L=e=>e.replace(/\b(Opt(?:ion)?|Alt)\b/i,D0?E("keys.option"):E("keys.alt")).replace(/\bShift\b/i,E("keys.shift")).replace(/\b(Enter|Return)\b/i,E("keys.enter")).replace(/\b(Ctrl|Cmd|Command|CtrlOrCmd)\b/gi,D0?E("keys.cmd"):E("keys.ctrl")).replace(/\b(Esc(?:ape)?)\b/i,E("keys.escape")).replace(/\b(Space(?:bar)?)\b/i,E("keys.spacebar")).replace(/\b(Del(?:ete)?)\b/i,E("keys.delete"));import{jsx as Ks}from"react/jsx-runtime";var cp=N({name:"sendBackward",label:"labels.sendBackward",keywords:["move down","zindex","layer"],icon:Hm,trackEvent:{category:"element"},perform:(e,o,t,n)=>({elements:qS(e,o,n.scene),appState:o,captureUpdate:Xs.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[$r.CTRL_OR_CMD]&&!e.shiftKey&&e.code===jr.BRACKET_LEFT,PanelComponent:({updateData:e,appState:o})=>Ks("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${E("labels.sendBackward")} \u2014 ${L("CtrlOrCmd+[")}`,children:Hm})}),dp=N({name:"bringForward",label:"labels.bringForward",keywords:["move up","zindex","layer"],icon:zm,trackEvent:{category:"element"},perform:(e,o,t,n)=>({elements:JS(e,o,n.scene),appState:o,captureUpdate:Xs.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[$r.CTRL_OR_CMD]&&!e.shiftKey&&e.code===jr.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:o})=>Ks("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${E("labels.bringForward")} \u2014 ${L("CtrlOrCmd+]")}`,children:zm})}),mp=N({name:"sendToBack",label:"labels.sendToBack",keywords:["move down","zindex","layer"],icon:Um,trackEvent:{category:"element"},perform:(e,o)=>({elements:QS(e,o),appState:o,captureUpdate:Xs.IMMEDIATELY}),keyTest:e=>Vs?e[$r.CTRL_OR_CMD]&&e.altKey&&e.code===jr.BRACKET_LEFT:e[$r.CTRL_OR_CMD]&&e.shiftKey&&e.code===jr.BRACKET_LEFT,PanelComponent:({updateData:e,appState:o})=>Ks("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${E("labels.sendToBack")} \u2014 ${Vs?L("CtrlOrCmd+Alt+["):L("CtrlOrCmd+Shift+[")}`,children:Um})}),pp=N({name:"bringToFront",label:"labels.bringToFront",keywords:["move up","zindex","layer"],icon:Gm,trackEvent:{category:"element"},perform:(e,o)=>({elements:e5(e,o),appState:o,captureUpdate:Xs.IMMEDIATELY}),keyTest:e=>Vs?e[$r.CTRL_OR_CMD]&&e.altKey&&e.code===jr.BRACKET_RIGHT:e[$r.CTRL_OR_CMD]&&e.shiftKey&&e.code===jr.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:o})=>Ks("button",{type:"button",className:"zIndexButton",onClick:t=>e(null),title:`${E("labels.bringToFront")} \u2014 ${Vs?L("CtrlOrCmd+Alt+]"):L("CtrlOrCmd+Shift+]")}`,children:Gm})});import{getNonDeletedElements as t5}from"@excalidraw/element";import{LinearElementEditor as o5}from"@excalidraw/element/linearElementEditor";import{isLinearElement as n5,isTextElement as r5}from"@excalidraw/element";import{arrayToMap as i5,KEYS as _0}from"@excalidraw/common";import{selectGroupsForSelectedElements as a5}from"@excalidraw/element";import{CaptureUpdateAction as l5}from"@excalidraw/element";var up=N({name:"selectAll",label:"labels.selectAll",icon:d0,trackEvent:{category:"canvas"},viewMode:!1,perform:(e,o,t,n)=>{if(o.selectedLinearElement?.isEditing)return!1;let r=e.filter(i=>!i.isDeleted&&!(r5(i)&&i.containerId)&&!i.locked).reduce((i,l)=>(i[l.id]=!0,i),{});return{appState:{...o,...a5({editingGroupId:null,selectedElementIds:r},t5(e),o,n),selectedLinearElement:Object.keys(r).length===1&&n5(e[0])?new o5(e[0],i5(e)):null},captureUpdate:l5.IMMEDIATELY}},keyTest:e=>e[_0.CTRL_OR_CMD]&&e.key===_0.A});import{DEFAULT_GRID_SIZE as R0,KEYS as N0,MOBILE_ACTION_BUTTON_BG as s5,arrayToMap as B0}from"@excalidraw/common";import{getNonDeletedElements as F0}from"@excalidraw/element";import{LinearElementEditor as c5}from"@excalidraw/element/linearElementEditor";import{getSelectedElements as d5,getSelectionStateForElements as m5}from"@excalidraw/element";import{syncMovedIndices as p5}from"@excalidraw/element";import{duplicateElements as u5}from"@excalidraw/element";import{CaptureUpdateAction as O0}from"@excalidraw/element";import{jsx as h5}from"react/jsx-runtime";var hp=N({name:"duplicateSelection",label:"labels.duplicateSelection",icon:Aa,trackEvent:{category:"element"},perform:(e,o,t,n)=>{if(o.selectedElementsAreBeingDragged)return!1;if(o.selectedLinearElement?.isEditing)try{let l=c5.duplicateSelectedPoints(o,n.scene);return{elements:e,appState:l,captureUpdate:O0.IMMEDIATELY}}catch{return!1}let{duplicatedElements:r,elementsWithDuplicates:i}=u5({type:"in-place",elements:e,idsOfElementsToDuplicate:B0(d5(e,o,{includeBoundTextElement:!0,includeElementsInFrames:!0})),appState:o,randomizeSeed:!0,overrides:({origElement:l,origIdToDuplicateId:a})=>{let s=l.frameId&&a.get(l.frameId);return{x:l.x+R0/2,y:l.y+R0/2,frameId:s??l.frameId}}});if(n.props.onDuplicate&&i){let l=n.props.onDuplicate(i,e);l&&(i=l)}return{elements:p5(i,B0(r)),appState:{...o,...m5(r,F0(i),o)},captureUpdate:O0.IMMEDIATELY}},keyTest:e=>e[N0.CTRL_OR_CMD]&&e.key===N0.D,PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>{let r=et()==="mobile";return h5(V,{type:"button",icon:Aa,title:`${E("labels.duplicateSelection")} \u2014 ${L("CtrlOrCmd+D")}`,"aria-label":E("labels.duplicateSelection"),onClick:()=>t(null),disabled:!we(F0(e),o),style:{...r&&o.openPopup!=="compactOtherProperties"?s5:{}}})}});import{pointFrom as y6}from"@excalidraw/math";import{useEffect as Bp,useMemo as Hp,useRef as Fp,useState as w6}from"react";import{DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE as v6,DEFAULT_ELEMENT_BACKGROUND_PICKS as T6,DEFAULT_ELEMENT_STROKE_COLOR_PALETTE as I6,DEFAULT_ELEMENT_STROKE_PICKS as C6,ARROW_TYPE as Xt,DEFAULT_FONT_FAMILY as S6,DEFAULT_FONT_SIZE as k6,FONT_FAMILY as M6,ROUNDNESS as pc,STROKE_WIDTH as Op,VERTICAL_ALIGN as dc,KEYS as li,randomInteger as P6,arrayToMap as Gp,getFontFamilyString as A6,getLineHeight as L6,isTransparent as D6,reduceToCommonValue as _6,invariant as Up,FONT_SIZES as mc}from"@excalidraw/common";import{canBecomePolygon as R6,getNonDeletedElements as Lx}from"@excalidraw/element";import{bindBindingElement as Sx,calculateFixedPointForElbowArrowBinding as kx,updateBoundElements as N6}from"@excalidraw/element";import{LinearElementEditor as sr}from"@excalidraw/element/linearElementEditor";import{newElementWith as qe}from"@excalidraw/element";import{getArrowheadForPicker as Mx}from"@excalidraw/element";import{getBoundTextElement as Mn,redrawTextBoundingBox as ja}from"@excalidraw/element";import{isArrowElement as uc,isBoundToContainer as B6,isElbowArrow as Dx,isLinearElement as zp,isLineElement as Px,isTextElement as Tt,isUsingAdaptiveRadius as F6}from"@excalidraw/element";import{hasStrokeColor as O6}from"@excalidraw/element";import{updateElbowArrowPoints as z6,CaptureUpdateAction as Je,toggleLinePolygonState as H6}from"@excalidraw/element";import{deriveStylesPanelMode as G6}from"@excalidraw/common";import{isDevEnv as g5}from"@excalidraw/common";var f5=new Set(["command_palette","export"]),de=(e,o,t,n)=>{try{if(typeof window>"u"||C.VITE_WORKER_ID||C.VITE_APP_ENABLE_TRACKING!=="true"||!f5.has(e)||g5())return;C.PROD||console.info("trackEvent",{category:e,action:o,label:t,value:n}),window.sa_event&&window.sa_event(o,{category:e,label:t,value:n})}catch(r){console.error("error during analytics",r)}};import y5 from"clsx";import E5 from"clsx";import{forwardRef as x5}from"react";import{jsx as b5}from"react/jsx-runtime";var qr=x5((e,o)=>{let{title:t,className:n,testId:r,active:i,standalone:l,icon:a,onClick:s}=e;return b5("button",{type:"button",ref:o,title:t,"data-testid":r,className:E5(n,{standalone:l,active:i}),onClick:s,style:e.style,children:a},t)});import{Fragment as v5,jsx as gp,jsxs as w5}from"react/jsx-runtime";var Wt=e=>gp(v5,{children:e.options.map(o=>e.type==="button"?gp(qr,{icon:o.icon,title:o.text,testId:o.testId,active:o.active??e.value===o.value,onClick:t=>e.onClick(o.value,t)},o.text):w5("label",{className:y5({active:e.value===o.value}),title:o.text,children:[gp("input",{type:"radio",name:e.group,onChange:()=>e.onChange(o.value),checked:e.value===o.value,"data-testid":o.testId}),o.icon]},o.text))});import{Popover as rx}from"radix-ui";import ix from"clsx";import{useRef as ax,useEffect as I4}from"react";import{COLOR_OUTLINE_CONTRAST_THRESHOLD as ox,COLOR_PALETTE as lx,isColorDark as nx,isWritableElement as C4}from"@excalidraw/common";import{jsx as T5}from"react/jsx-runtime";var Zs=()=>T5("div",{style:{width:1,height:"1rem",backgroundColor:"var(--default-border-color)",margin:"0 auto"}});import{useEffect as M5,useRef as P5}from"react";import{createPortal as A5}from"react-dom";import{EVENT as yn,KEYS as L5,rgbToHex as D5}from"@excalidraw/common";import z0 from"react";var fp=z0.createContext(null),he=()=>z0.useContext(fp);import{useState as I5,useLayoutEffect as H0}from"react";import{THEME as C5}from"@excalidraw/common";var $s=e=>{let[o,t]=I5(null),n=me(),{theme:r}=he(),{container:i}=_e();return H0(()=>{o&&(o.className="",o.classList.add("excalidraw",...e?.className?.split(/\s+/)||[]),o.classList.toggle("excalidraw--mobile",n.formFactor==="phone"),o.classList.toggle("theme--dark",r===C5.DARK))},[o,r,n.formFactor,e?.className]),H0(()=>{let l=e?.parentSelector?i?.querySelector(e.parentSelector):document.body;if(!l)return;let a=document.createElement("div");return l.appendChild(a),t(a),()=>{l.removeChild(a)}},[i,e?.parentSelector]),o};import{useEffect as S5}from"react";import{EVENT as js}from"@excalidraw/common";function Jr(e,o,t){S5(()=>{function n(r){let i=r;if(!e.current)return;let l=t?.(i,e.current);if(l===!0)return;if(l===!1)return o(i);e.current.contains(i.target)||!document.documentElement.contains(i.target)||i.target.closest("[data-radix-portal]")||i.target===document.documentElement&&document.body.style.pointerEvents==="none"||i.target.closest("[data-prevent-outside-click]")||o(i)}return document.addEventListener(js.POINTER_DOWN,n),document.addEventListener(js.TOUCH_START,n),()=>{document.removeEventListener(js.POINTER_DOWN,n),document.removeEventListener(js.TOUCH_START,n)}},[e,o,t])}import{useRef as k5}from"react";var Qr=e=>{let o=k5(e);return Object.assign(o.current,e),o.current};import{jsx as _5}from"react/jsx-runtime";var wn=je(null),G0=({onCancel:e,onChange:o,onSelect:t,colorPickerType:n})=>{let r=$s({className:"excalidraw-eye-dropper-backdrop",parentSelector:".excalidraw-eye-dropper-container"}),i=he(),l=ei(),a=vt(),s=te(l,i),c=Qr({app:a,onCancel:e,onChange:o,onSelect:t,selectedElements:s}),{container:m}=_e();M5(()=>{let d=p.current;if(!d||!a.canvas||!r)return;let h=!1,f=a.canvas.getContext("2d"),g=({clientX:S,clientY:P})=>{let M=f.getImageData((S-i.offsetLeft)*window.devicePixelRatio,(P-i.offsetTop)*window.devicePixelRatio,1,1).data;return D5(M[0],M[1],M[2])},b=({clientX:S,clientY:P,altKey:M})=>{d.style.top=`${P+20}px`,d.style.left=`${S+20}px`;let _=g({clientX:S,clientY:P});h&&c.onChange(n,_,c.selectedElements,{altKey:M}),d.style.background=_},y=()=>{c.onCancel()},v=(S,P)=>{c.onSelect(S,P)},x=S=>{h=!0,S.stopImmediatePropagation()},w=S=>{h=!1,m?.focus(),S.stopImmediatePropagation(),S.preventDefault(),v(g(S),S)},T=S=>{S.key===L5.ESCAPE&&(S.preventDefault(),S.stopImmediatePropagation(),y())};return r.tabIndex=-1,r.focus(),b({clientX:c.app.lastViewportPosition.x,clientY:c.app.lastViewportPosition.y,altKey:!1}),r.addEventListener(yn.KEYDOWN,T),r.addEventListener(yn.POINTER_DOWN,x),r.addEventListener(yn.POINTER_UP,w),window.addEventListener("pointermove",b,{passive:!0}),window.addEventListener(yn.BLUR,y),()=>{h=!1,r.removeEventListener(yn.KEYDOWN,T),r.removeEventListener(yn.POINTER_DOWN,x),r.removeEventListener(yn.POINTER_UP,w),window.removeEventListener("pointermove",b),window.removeEventListener(yn.BLUR,y)}},[c,a.canvas,r,n,m,i.offsetLeft,i.offsetTop]);let p=P5(null);return Jr(p,()=>{e()},d=>!!d.target.closest(".excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop")),r?A5(_5("div",{ref:p,className:"excalidraw-eye-dropper-preview"}),r):null};import{Popover as Ep}from"radix-ui";import F5 from"clsx";import O5 from"react";import{isInteractive as z5}from"@excalidraw/common";import R5 from"react";import N5 from"clsx";import{jsx as B5}from"react/jsx-runtime";var Oe=R5.forwardRef(({children:e,padding:o,className:t,style:n},r)=>B5("div",{className:N5("Island",t),style:{"--padding":o,...n},ref:r,children:e}));import{jsx as xp,jsxs as H5}from"react/jsx-runtime";var Vo=O5.forwardRef(({className:e,container:o,children:t,style:n,onClose:r,onKeyDown:i,onFocusOutside:l,onPointerLeave:a,onPointerDownOutside:s,preventAutoFocusOnTouch:c=!1},m)=>{let p=me(),d=p.formFactor==="phone"&&!p.isLandscape;return xp(Ep.Portal,{container:o,children:H5(Ep.Content,{ref:m,className:F5("focus-visible-none",e),"data-prevent-outside-click":!0,side:d?"bottom":"right",align:d?"center":"start",alignOffset:-16,sideOffset:20,collisionBoundary:o??void 0,style:{zIndex:"var(--zIndex-ui-styles-popup)",marginLeft:p.formFactor==="phone"?"0.5rem":void 0},onPointerLeave:a,onKeyDown:i,onFocusOutside:l,onPointerDownOutside:s,onOpenAutoFocus:h=>{c&&p.isTouchScreen&&h.preventDefault()},onCloseAutoFocus:h=>{h.stopPropagation(),h.preventDefault(),o&&!z5(document.activeElement)&&o.focus(),r()},children:[xp(Oe,{padding:3,style:n,children:t}),xp(Ep.Arrow,{width:20,height:10,style:{fill:"var(--popup-bg-color)",filter:"drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)"}})]})})});import{useState as G5,useCallback as bp}from"react";var qs=()=>document.querySelector(".excalidraw-wysiwyg"),Js=()=>{let e=qs();return e?{start:e.selectionStart,end:e.selectionEnd}:null},za=e=>{setTimeout(()=>{let o=qs();o&&(o.focus(),e&&(o.selectionStart=e.start,o.selectionEnd=e.end))},0)},Ha=(e,o,t,n)=>{o&&n&&n();let r=o&&t?Js():null;e(),o&&t&&za(r)},U0=()=>{let[e,o]=G5(null),t=bp(()=>{let i=Js();o(i)},[]),n=bp(()=>{setTimeout(()=>{let i=qs();i&&(i.focus(),e&&(i.selectionStart=e.start,i.selectionEnd=e.end,o(null)))},0)},[e]),r=bp(()=>{o(null)},[]);return{saveCaretPosition:t,restoreCaretPosition:n,clearSavedPosition:r,hasSavedPosition:!!e}},W0=(e=100)=>{let o=qs();if(o){let t=o.onblur;o.onblur=null,setTimeout(()=>{o.onblur=t},e)}};import W5 from"clsx";import{useCallback as Y5,useEffect as wp,useRef as V0,useState as V5}from"react";import{KEYS as vp,normalizeInputColor as X5}from"@excalidraw/common";import{MAX_CUSTOM_COLORS_USED_IN_CANVAS as U5}from"@excalidraw/common";var vn=({palette:e,color:o})=>{if(!o)return null;for(let[t,n]of Object.entries(e))if(Array.isArray(n)){let r=n.indexOf(o);if(r>-1)return{colorName:t,shade:r}}else if(n===o)return{colorName:t,shade:null};return null},Ga=[["q","w","e","r","t"],["a","s","d","f","g"],["z","x","c","v","b"]].flat(),yp=({color:e,palette:o})=>!Object.values(o).flat().includes(e),Y0=(e,o,t)=>{let n={elementBackground:"backgroundColor",elementStroke:"strokeColor"},r=e.filter(l=>{if(l.isDeleted)return!1;let a=l[n[o]];return yp({color:a,palette:t})}),i=new Map;return r.forEach(l=>{let a=l[n[o]];i.has(a)?i.set(a,i.get(a)+1):i.set(a,1)}),[...i.entries()].sort((l,a)=>a[1]-l[1]).map(l=>l[0]).slice(0,U5)},Yt=je(null);import{Fragment as K5,jsx as Qs,jsxs as X0}from"react/jsx-runtime";var K0=({color:e,onChange:o,label:t,colorPickerType:n,placeholder:r})=>{let i=me(),[l,a]=V5(e),[s,c]=He(Yt);wp(()=>{a(e)},[e]);let m=Y5(g=>{let b=g.toLowerCase(),y=X5(b);y&&o(y),a(b)},[o]),p=V0(null),d=V0(null);wp(()=>{p.current&&p.current.focus()},[s]);let[h,f]=He(wn);return wp(()=>()=>{f(null)},[f]),X0("div",{className:"color-picker__input-label",children:[Qs("div",{className:"color-picker__input-hash",children:"#"}),Qs("input",{ref:s==="hex"?p:void 0,style:{border:0,padding:0},spellCheck:!1,className:"color-picker-input","aria-label":t,onChange:g=>{m(g.target.value)},value:(l||"").replace(/^#/,""),onBlur:()=>{a(e)},tabIndex:-1,onFocus:()=>c("hex"),onKeyDown:g=>{g.key!==vp.TAB&&(g.key===vp.ESCAPE&&d.current?.focus(),g.stopPropagation())},placeholder:r}),i.formFactor!=="phone"&&X0(K5,{children:[Qs("div",{style:{width:"1px",height:"1.25rem",backgroundColor:"var(--default-border-color)"}}),Qs("div",{ref:d,className:W5("excalidraw-eye-dropper-trigger",{selected:h}),onClick:()=>f(g=>g?null:{keepOpenOnAlt:!1,onSelect:b=>o(b),colorPickerType:n}),title:`${E("labels.eyeDropper")} \u2014 ${vp.I.toLocaleUpperCase()} or ${L("Alt")} `,children:r0})]})]})};import Sp,{useEffect as kp,useImperativeHandle as u4,useState as h4}from"react";import{EVENT as Q0}from"@excalidraw/common";import{DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX as g4,DEFAULT_ELEMENT_STROKE_COLOR_INDEX as f4,KEYS as E4}from"@excalidraw/common";import q5 from"clsx";import{useEffect as J5,useRef as Q5}from"react";import{isColorDark as Z5}from"@excalidraw/common";import{jsxs as j5}from"react/jsx-runtime";var $5=({color:e,keyLabel:o,isShade:t=!1})=>j5("div",{className:"color-picker__button__hotkey-label",style:{color:Z5(e)?"#fff":"#000"},children:[t&&"\u21E7",o]}),ti=$5;import{jsx as Tp,jsxs as e4}from"react/jsx-runtime";var Z0=({colors:e,color:o,onChange:t,label:n})=>{let[r,i]=He(Yt),l=Q5(null);return J5(()=>{l.current&&l.current.focus()},[o,r]),Tp("div",{className:"color-picker-content--default",children:e.map((a,s)=>e4("button",{ref:o===a?l:void 0,tabIndex:-1,type:"button",className:q5("color-picker__button color-picker__button--large has-outline",{active:o===a,"is-transparent":a==="transparent"||!a}),onClick:()=>{t(a),i("custom")},title:a,"aria-label":n,style:{"--swatch-color":a},children:[Tp("div",{className:"color-picker__button-outline"}),Tp(ti,{color:a,keyLabel:s+1})]},s))})};import t4 from"clsx";import{useEffect as o4,useRef as n4}from"react";import{jsx as Ip,jsxs as i4}from"react/jsx-runtime";var r4=({palette:e,color:o,onChange:t,activeShade:n,showHotKey:r=!0})=>{let i=vn({color:o,palette:e}),[l,a]=He(Yt),s=n4(null);return o4(()=>{s.current&&l==="baseColors"&&s.current.focus()},[i?.colorName,l]),Ip("div",{className:"color-picker-content--default",children:Object.entries(e).map(([c,m],p)=>{let d=(Array.isArray(m)?m[n]:m)||"transparent",h=Ga[p],f=E(`colors.${c.replace(/\d+/,"")}`,null,"");return i4("button",{ref:i?.colorName===c?s:void 0,tabIndex:-1,type:"button",className:t4("color-picker__button color-picker__button--large has-outline",{active:i?.colorName===c,"is-transparent":d==="transparent"||!d}),onClick:()=>{t(d),a("baseColors")},title:`${f}${d.startsWith("#")?` ${d}`:""} \u2014 ${h}`,"aria-label":`${f} \u2014 ${h}`,style:d?{"--swatch-color":d}:void 0,"data-testid":`color-${c}`,children:[Ip("div",{className:"color-picker__button-outline"}),r&&Ip(ti,{color:d,keyLabel:h})]},c)})})},$0=r4;import{jsx as l4}from"react/jsx-runtime";var a4=({children:e})=>l4("div",{className:"color-picker__heading",children:e}),oi=a4;import s4 from"clsx";import{useEffect as c4,useRef as d4}from"react";import{jsx as Ua,jsxs as j0}from"react/jsx-runtime";var q0=({color:e,onChange:o,palette:t,showHotKey:n})=>{let r=vn({color:e||"transparent",palette:t}),[i,l]=He(Yt),a=d4(null);if(c4(()=>{a.current&&i==="shades"&&a.current.focus()},[r,i]),r){let{colorName:s,shade:c}=r,m=t[s];if(Array.isArray(m))return Ua("div",{className:"color-picker-content--default shades",children:m.map((p,d)=>j0("button",{ref:d===c&&i==="shades"?a:void 0,tabIndex:-1,type:"button",className:s4("color-picker__button color-picker__button--large has-outline",{active:d===c}),"aria-label":"Shade",title:`${s} - ${d+1}`,style:p?{"--swatch-color":p}:void 0,onClick:()=>{o(p),l("shades")},children:[Ua("div",{className:"color-picker__button-outline"}),n&&Ua(ti,{color:p,keyLabel:d+1,isShade:!0})]},d))})}return j0("div",{className:"color-picker-content--default",style:{position:"relative"},tabIndex:-1,children:[Ua("button",{type:"button",tabIndex:-1,className:"color-picker__button color-picker__button--large color-picker__button--no-focus-visible"}),Ua("div",{tabIndex:-1,style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",fontSize:"0.75rem"},children:E("colorPicker.noShades")})]})};import{COLORS_PER_ROW as ni,COLOR_PALETTE as m4,KEYS as Wa}from"@excalidraw/common";var Cp=(e,o,t)=>{let n=Math.ceil(t/ni);switch(o=o??-1,e){case"ArrowLeft":{let r=o-1;return r<0?t-1:r}case"ArrowRight":return(o+1)%t;case"ArrowDown":{let r=o+ni;return r>=t?o%ni:r}case"ArrowUp":{let r=o-ni,i=r<0?ni*n+r:r;return i>=t?void 0:i}}},p4=({e,colorObj:o,onChange:t,palette:n,customColors:r,setActiveColorPickerSection:i,activeShade:l})=>{if(o?.shade!=null&&["Digit1","Digit2","Digit3","Digit4","Digit5"].includes(e.code)&&e.shiftKey){let a=Number(e.code.slice(-1))-1;return t(n[o.colorName][a]),i("shades"),!0}if(["1","2","3","4","5"].includes(e.key)&&r[Number(e.key)-1])return t(r[Number(e.key)-1]),i("custom"),!0;if(Ga.includes(e.key)){let a=Ga.indexOf(e.key),s=Object.keys(n)[a],c=n[s],m=Array.isArray(c)?c[l]:c;return t(m),i("baseColors"),!0}return!1},J0=({event:e,activeColorPickerSection:o,palette:t,color:n,onChange:r,customColors:i,setActiveColorPickerSection:l,updateData:a,activeShade:s,onEyeDropperToggle:c,onEscape:m})=>{if(e[Wa.CTRL_OR_CMD])return!1;if(e.key===Wa.ESCAPE)return m(e),!0;if(e.key===Wa.ALT)return c(!0),!0;if(e.key===Wa.I)return c(),!0;let p=vn({color:n,palette:t});if(e.key===Wa.TAB){let d={custom:!!i.length,baseColors:!0,shades:p?.shade!=null,hex:!0},h=Object.entries(d).reduce((v,[x,w])=>(w&&v.push(x),v),[]),f=h.indexOf(o),g=e.shiftKey?-1:1,b=f+g>h.length-1?0:f+g<0?h.length-1:f+g,y=h[b];return y&&l(y),y==="custom"?r(i[0]):y==="baseColors"&&(Object.entries(t).find(([x,w])=>Array.isArray(w)?w.includes(n):w===n?x:null)||r(m4.black)),e.preventDefault(),e.stopPropagation(),!0}if(p4({e,colorObj:p,onChange:r,palette:t,customColors:i,setActiveColorPickerSection:l,activeShade:s}))return!0;if(o==="shades"&&p){let{shade:d}=p,h=Cp(e.key,d,ni);if(h!==void 0)return r(t[p.colorName][h]),!0}if(o==="baseColors"&&p){let{colorName:d}=p,h=Object.keys(t),f=h.indexOf(d),g=Cp(e.key,f,h.length);if(g!==void 0){let b=h[g],y=t[b];return r(Array.isArray(y)?y[s]:y),!0}}if(o==="custom"){let d=n!=null?i.indexOf(n):0,h=Cp(e.key,d,i.length);if(h!==void 0){let f=i[h];return r(f),!0}}return!1};import{jsx as Tn,jsxs as ec}from"react/jsx-runtime";var ex=Sp.forwardRef(({color:e,onChange:o,type:t,elements:n,palette:r,updateData:i,children:l,showTitle:a,onEyeDropperToggle:s,onEscape:c,showHotKey:m=!0},p)=>{let d=a?t==="elementStroke"?E("labels.stroke"):t==="elementBackground"?E("labels.background"):null:null,[h]=Sp.useState(()=>t==="canvasBackground"?[]:Y0(n,t,r)),[f,g]=He(Yt),b=vn({color:e,palette:r});kp(()=>{if(!f){let w=!!e&&yp({color:e,palette:r}),T=w&&!h.includes(e);g(T?null:w?"custom":b?.shade!=null?"shades":"baseColors")}},[f,e,r,g,b,h]);let[y,v]=h4(b?.shade??(t==="elementBackground"?g4:f4));kp(()=>{b?.shade!=null&&v(b.shade);let w=T=>{T.key===E4.ALT&&s(!1)};return document.addEventListener(Q0.KEYUP,w,{capture:!0}),()=>{document.removeEventListener(Q0.KEYUP,w,{capture:!0})}},[b,s]);let x=Sp.useRef(null);return u4(p,()=>x.current),kp(()=>{x?.current?.focus()},[]),Tn("div",{role:"dialog","aria-modal":"true","aria-label":E("labels.colorPicker"),children:ec("div",{ref:x,onKeyDown:w=>{J0({event:w,activeColorPickerSection:f,palette:r,color:e,onChange:o,onEyeDropperToggle:s,customColors:h,setActiveColorPickerSection:g,updateData:i,activeShade:y,onEscape:c})&&(w.preventDefault(),w.stopPropagation())},className:"color-picker-content properties-content",tabIndex:-1,children:[d&&Tn("div",{className:"color-picker__title",children:d}),!!h.length&&ec("div",{children:[Tn(oi,{children:E("colorPicker.mostUsedCustomColors")}),Tn(Z0,{colors:h,color:e,label:E("colorPicker.mostUsedCustomColors"),onChange:o})]}),ec("div",{children:[Tn(oi,{children:E("colorPicker.colors")}),Tn($0,{color:e,palette:r,onChange:o,activeShade:y,showHotKey:m})]}),ec("div",{children:[Tn(oi,{children:E("colorPicker.shades")}),Tn(q0,{color:e,onChange:o,palette:r,showHotKey:m})]}),l]})})});import x4 from"clsx";import{COLOR_OUTLINE_CONTRAST_THRESHOLD as b4,DEFAULT_CANVAS_BACKGROUND_PICKS as y4,DEFAULT_ELEMENT_BACKGROUND_PICKS as w4,DEFAULT_ELEMENT_STROKE_PICKS as v4,isColorDark as T4}from"@excalidraw/common";import{jsx as Mp}from"react/jsx-runtime";var tx=({onChange:e,type:o,activeColor:t,topPicks:n})=>{let r;return o==="elementStroke"&&(r=v4),o==="elementBackground"&&(r=w4),o==="canvasBackground"&&(r=y4),n&&(r=n),r?Mp("div",{className:"color-picker__top-picks",children:r.map(i=>Mp("button",{className:x4("color-picker__button",{active:i===t,"is-transparent":i==="transparent"||!i,"has-outline":!T4(i,b4)}),style:{"--swatch-color":i},type:"button",title:i,onClick:()=>e(i),"data-testid":`color-top-pick-${i}`,children:Mp("div",{className:"color-picker__button-outline"})},i))}):(console.error("Invalid type for TopPicks"),null)};import{jsx as Vt,jsxs as tc}from"react/jsx-runtime";var S4=({type:e,color:o,onChange:t,label:n,elements:r,palette:i=lx,updateData:l,getOpenPopup:a,appState:s})=>{let{container:c}=_e(),m=et(),p=m!=="full",d=m==="mobile",[,h]=He(Yt),[f,g]=He(wn),b=tc("div",{children:[Vt(oi,{children:E("colorPicker.hexCode")}),Vt(K0,{color:o||"",label:n,onChange:x=>{t(x)},colorPickerType:e,placeholder:E("colorPicker.color")})]}),y=ax(null),v=()=>{y.current?.focus()};return Vt(Vo,{container:c,style:{maxWidth:"13rem"},preventAutoFocusOnTouch:!!s.editingTextElement,onFocusOutside:x=>{C4(x.target)||v(),x.preventDefault()},onPointerDownOutside:x=>{f&&x.preventDefault()},onClose:()=>{a()===e&&l({openPopup:null}),h(null),s.editingTextElement&&setTimeout(()=>{let x=document.querySelector(".excalidraw-wysiwyg");x&&x.focus()},0)},children:i?Vt(ex,{ref:y,palette:i,color:o,onChange:x=>{let w=s.editingTextElement?Js():null;t(x),s.editingTextElement&&w&&za(w)},onEyeDropperToggle:x=>{g(w=>x?(w=w||{keepOpenOnAlt:!0,onSelect:t,colorPickerType:e},w.keepOpenOnAlt=!0,w):x===!1||w?null:{keepOpenOnAlt:!1,onSelect:t,colorPickerType:e})},onEscape:x=>{f?g(null):l({openPopup:null})},type:e,elements:r,updateData:l,showTitle:p,showHotKey:!d,children:b}):b})},k4=({label:e,color:o,type:t,mode:n="background",onToggle:r,editingTextElement:i})=>{let l=et(),a=l!=="full",s=l==="mobile",c=m=>{m.preventDefault(),m.stopPropagation(),i&&W0(),r()};return tc(rx.Trigger,{type:"button",className:ix("color-picker__button active-color properties-trigger",{"is-transparent":!o||o==="transparent","has-outline":!o||!nx(o,ox),"compact-sizing":a,"mobile-border":s}),"aria-label":e,style:o?{"--swatch-color":o}:void 0,title:t==="elementStroke"?E("labels.showStroke"):E("labels.showBackground"),"data-openpopup":t,onClick:c,children:[Vt("div",{className:"color-picker__button-outline",children:!o&&iE}),a&&o&&n==="stroke"&&Vt("div",{className:"color-picker__button-background",children:Vt("span",{style:{color:o&&nx(o,ox)?"#fff":"#111"},children:T0})})]})},Ya=({type:e,color:o,onChange:t,label:n,elements:r,palette:i=lx,topPicks:l,updateData:a,appState:s})=>{let c=ax(s.openPopup);I4(()=>{c.current=s.openPopup},[s.openPopup]);let p=et()!=="full";return Vt("div",{children:tc("div",{role:"dialog","aria-modal":"true",className:ix("color-picker-container",{"color-picker-container--no-top-picks":p}),children:[!p&&Vt(tx,{activeColor:o,onChange:t,type:e,topPicks:l}),!p&&Vt(Zs,{}),tc(rx.Root,{open:s.openPopup===e,onOpenChange:d=>{d&&a({openPopup:e})},children:[Vt(k4,{color:o,label:n,type:e,mode:e==="elementStroke"?"stroke":"background",editingTextElement:!!s.editingTextElement,onToggle:()=>{s.openPopup===e?a({openPopup:null}):s.openPopup?a({openPopup:e}):a({openPopup:e})}}),s.openPopup===e&&Vt(S4,{type:e,color:o,onChange:t,label:n,elements:r,palette:i,updateData:a,getOpenPopup:()=>c.current,appState:s})]})]})})};import{Popover as t6}from"radix-ui";import o6 from"clsx";import n6,{useCallback as r6,useMemo as i6}from"react";import{FONT_FAMILY as Dp}from"@excalidraw/common";import V4,{useMemo as Sn,useState as X4,useRef as mx,useEffect as px,useCallback as ux}from"react";import{arrayToList as K4,debounce as Z4,FONT_FAMILY as kn,getFontFamilyString as $4}from"@excalidraw/common";import M4 from"clsx";import P4 from"react";import{jsx as A4,jsxs as L4}from"react/jsx-runtime";var oc=P4.forwardRef(({className:e,placeholder:o,onChange:t},n)=>L4("div",{className:M4("QuickSearch__wrapper",e),children:[bo,A4("input",{ref:n,className:"QuickSearch__input",type:"text",placeholder:o,onChange:r=>t(r.target.value.trim().toLowerCase())})]}));import D4 from"clsx";import{Children as _4}from"react";import{jsx as sx}from"react/jsx-runtime";var nc=({className:e,placeholder:o,children:t})=>{let n=!_4.count(t);return sx("div",{className:D4("ScrollableList__wrapper",e),role:"menu",children:n?sx("div",{className:"empty",children:o}):t})};import{jsx as R4,jsxs as N4}from"react/jsx-runtime";var cx=({children:e,className:o="",style:t,title:n})=>N4("div",{className:`dropdown-menu-group ${o}`,style:t,children:[n&&R4("p",{className:"dropdown-menu-group-title",children:n}),e]}),Va=cx;cx.displayName="DropdownMenuGroup";import{THEME as W4}from"@excalidraw/common";import{DropdownMenu as Y4}from"radix-ui";import B4,{useContext as F4}from"react";import{composeEventHandlers as O4}from"@excalidraw/common";var Pp=B4.createContext({}),In=(e="",o=!1,t=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e} ${o?"dropdown-menu-item--selected":""} ${t?"dropdown-menu-item--hovered":""}`.trim(),rc=e=>{let o=F4(Pp);return O4(e,t=>{o.onSelect?.(t)})};import{jsx as z4}from"react/jsx-runtime";var Xa=({children:e,...o})=>z4("span",{...o,style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",...o.style},children:e});import{Fragment as G4,jsx as Ka,jsxs as U4}from"react/jsx-runtime";var H4=({textStyle:e,icon:o,shortcut:t,children:n,badge:r})=>{let i=me();return U4(G4,{children:[o&&Ka("div",{className:"dropdown-menu-item__icon",children:o}),Ka("div",{style:e,className:"dropdown-menu-item__text",children:Ka(Xa,{children:n})}),r&&Ka("div",{className:"dropdown-menu-item__badge",children:r}),t&&i.formFactor!=="phone"&&Ka("div",{className:"dropdown-menu-item__shortcut",children:t})]})},Cn=H4;import{jsx as ic}from"react/jsx-runtime";var Ap=({icon:e,badge:o,value:t,children:n,shortcut:r,className:i,selected:l,onSelect:a,...s})=>{let c=rc(a);return ic(Y4.Item,{className:"radix-menu-item",onSelect:c,asChild:!0,children:ic("button",{...s,value:t,className:In(i,l),title:s.title??s["aria-label"],children:ic(Cn,{icon:e,shortcut:r,badge:o,children:n})})})};Ap.displayName="DropdownMenuItem";var ri={GREEN:"green",RED:"red",BLUE:"blue"},ac=({type:e=ri.BLUE,children:o})=>{let{theme:t}=yo(),n={display:"inline-flex",marginLeft:"auto",padding:"2px 4px",borderRadius:6,fontSize:9,fontFamily:"Cascadia, monospace",border:t===W4.LIGHT?"1.5px solid white":"none"};switch(e){case ri.GREEN:Object.assign(n,{backgroundColor:"var(--background-color-badge)",color:"var(--color-badge)"});break;case ri.RED:Object.assign(n,{backgroundColor:"pink",color:"darkred"});break;case ri.BLUE:default:Object.assign(n,{background:"var(--color-promo)",color:"var(--color-surface-lowest)"})}return ic("div",{className:"DropDownMenuItemBadge",style:n,children:o})};ac.displayName="DropdownMenuItemBadge";Ap.Badge=ac;var Dt=Ap;import{KEYS as ii}from"@excalidraw/common";var dx=({event:e,inputRef:o,hoveredFont:t,filteredFonts:n,onClose:r,onSelect:i,onHover:l})=>{if(!e[ii.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===ii.F)return o.current?.focus(),!0;if(e.key===ii.ESCAPE)return r(),!0;if(e.key===ii.ENTER)return t?.value&&i(t.value),!0;if(e.key===ii.ARROW_DOWN)return t?.next?l(t.next.value):n[0]?.value&&l(n[0].value),!0;if(e.key===ii.ARROW_UP)return t?.prev?l(t.prev.value):n[n.length-1]?.value&&l(n[n.length-1].value),!0};import{jsx as Xo,jsxs as J4}from"react/jsx-runtime";var j4=e=>{switch(e){case kn.Excalifont:case kn.Virgil:return En;case kn.Nunito:case kn.Helvetica:return Na;case kn["Lilita One"]:return KE;case kn["Comic Shanns"]:case kn.Cascadia:return Rs;default:return Na}},q4=(e,o)=>Object.entries(kn).find(([,t])=>t===e)?.[0]??o[0]?.fontFace?.family??"Unknown",hx=V4.memo(({selectedFontFamily:e,hoveredFontFamily:o,onSelect:t,onHover:n,onLeave:r,onOpen:i,onClose:l})=>{let{container:a}=_e(),s=vt(),{fonts:c}=s,{showDeprecatedFonts:m}=ai(),p=et(),[d,h]=X4(""),f=mx(null),g=Sn(()=>Array.from(Uo.registered.entries()).filter(([A,{metadata:F}])=>!F.private&&!F.fallback).map(([A,{metadata:F,fontFaces:U}])=>{let j={value:A,icon:j4(A),text:q4(A,U)};return F.deprecated&&Object.assign(j,{deprecated:F.deprecated,badge:{type:ri.RED,placeholder:E("fontList.badge.old")}}),j}).sort((A,F)=>A.text.toLowerCase()>F.text.toLowerCase()?1:-1),[]),b=Sn(()=>new Set(c.getSceneFamilies()),[e]),y=Sn(()=>g.filter(A=>b.has(A.value)),[g,b]),v=Sn(()=>g.filter(A=>!b.has(A.value)&&(m||!A.deprecated)),[g,b,m]),x=Sn(()=>K4([...y,...v].filter(A=>A.text?.toLowerCase().includes(d))),[y,v,d]),w=Sn(()=>{let A;return o?A=x.find(F=>F.value===o):e&&(A=x.find(F=>F.value===e)),!A&&d&&(x[0]?.value?n(x[0].value):r()),A},[o,e,d,x,n,r]),T=ux(A=>{let F=null;if(s.state.editingTextElement){let U=document.querySelector(".excalidraw-wysiwyg");U&&(F={start:U.selectionStart,end:U.selectionEnd})}t(A),s.state.editingTextElement&&F&&setTimeout(()=>{let U=document.querySelector(".excalidraw-wysiwyg");U&&F&&(U.focus(),U.selectionStart=F.start,U.selectionEnd=F.end)},0)},[t,s.state.editingTextElement]),S=ux(A=>{dx({event:A,inputRef:f,hoveredFont:w,filteredFonts:x,onSelect:T,onHover:n,onClose:l})&&(A.preventDefault(),A.stopPropagation())},[w,x,T,n,l]);px(()=>(i(),()=>{l()}),[]);let P=Sn(()=>x.filter(A=>b.has(A.value)),[x,b]),M=Sn(()=>x.filter(A=>!b.has(A.value)),[x,b]),_=({font:A,order:F})=>{let U=mx(null),j=A.value===w?.value,z=A.value===e;return px(()=>{j&&(F===0?U.current?.scrollIntoView?.({block:"end"}):U.current?.scrollIntoView?.({block:"nearest"}))},[j,F]),Xo("button",{ref:U,type:"button",value:A.value,className:In("",z,j),title:A.text,tabIndex:z?0:-1,onClick:Z=>{T(Number(Z.currentTarget.value))},onMouseMove:()=>{w?.value!==A.value&&n(A.value)},children:Xo(Cn,{icon:A.icon,badge:A.badge&&Xo(ac,{type:A.badge.type,children:A.badge.placeholder}),textStyle:{fontFamily:$4({fontFamily:A.value})},children:A.text})})},R=[];return P.length&&R.push(Xo(Va,{title:E("fontList.sceneFonts"),children:P.map((A,F)=>Xo(_,{font:A,order:F},A.value))},"group_1")),M.length&&R.push(Xo(Va,{title:E("fontList.availableFonts"),children:M.map((A,F)=>Xo(_,{font:A,order:F+P.length},A.value))},"group_2")),J4(Vo,{className:"properties-content",container:a,style:{width:"15rem"},onClose:()=>{l(),s.state.editingTextElement&&setTimeout(()=>{let A=document.querySelector(".excalidraw-wysiwyg");A&&A.focus()},0)},onPointerLeave:r,onKeyDown:S,preventAutoFocusOnTouch:!!s.state.editingTextElement,children:[p==="full"&&Xo(oc,{ref:f,placeholder:E("quickSearch.placeholder"),onChange:Z4(h,20)}),Xo(nc,{className:"dropdown-menu fonts manual-hover",placeholder:E("fontList.empty"),children:R.length?R:null})]})},(e,o)=>e.selectedFontFamily===o.selectedFontFamily&&e.hoveredFontFamily===o.hoveredFontFamily);import{Popover as Q4}from"radix-ui";import{MOBILE_ACTION_BUTTON_BG as e6}from"@excalidraw/common";import{jsx as Lp}from"react/jsx-runtime";var gx=({selectedFontFamily:e,isOpened:o=!1,compactMode:t=!1})=>{let n=Me(),r=t?{...e6,width:"2rem",height:"2rem"}:{};return Lp(Q4.Trigger,{asChild:!0,children:Lp("div",{"data-openpopup":"fontFamily",className:"properties-trigger",children:Lp(qr,{standalone:!0,icon:xn,title:E("labels.showFonts"),className:"properties-trigger",testId:"font-family-show-fonts",active:o,onClick:()=>{n(i=>({openPopup:i.openPopup==="fontFamily"?null:i.openPopup}))},style:{border:"none",...r}})})})};import{jsx as Za,jsxs as fx}from"react/jsx-runtime";var Ex=[{value:Dp.Excalifont,icon:En,text:E("labels.handDrawn"),testId:"font-family-hand-drawn"},{value:Dp.Nunito,icon:Na,text:E("labels.normal"),testId:"font-family-normal"},{value:Dp["Comic Shanns"],icon:Rs,text:E("labels.code"),testId:"font-family-code"}],P$=new Set(Ex.map(e=>e.value));var xx=n6.memo(({isOpened:e,selectedFontFamily:o,hoveredFontFamily:t,onSelect:n,onHover:r,onLeave:i,onPopupChange:l,compactMode:a=!1})=>{let s=i6(()=>Ex,[]),c=r6(m=>{m&&n(m)},[n]);return fx("div",{role:"dialog","aria-modal":"true",className:o6("FontPicker__container",{"FontPicker__container--compact":a}),children:[!a&&Za("div",{className:"buttonList",children:Za(Wt,{type:"button",options:s,value:o,onClick:c})}),!a&&Za(Zs,{}),fx(t6.Root,{open:e,onOpenChange:l,children:[Za(gx,{selectedFontFamily:o,isOpened:e,compactMode:a}),e&&Za(hx,{selectedFontFamily:o,hoveredFontFamily:t,onSelect:c,onHover:r,onLeave:i,onOpen:()=>l(!0),onClose:()=>l(!1)})]})]})},(e,o)=>e.isOpened===o.isOpened&&e.selectedFontFamily===o.selectedFontFamily&&e.hoveredFontFamily===o.hoveredFontFamily);import{Popover as _p}from"radix-ui";import c6 from"clsx";import vx,{useEffect as d6,useMemo as m6}from"react";import{isArrowKey as p6,KEYS as Ko}from"@excalidraw/common";import{jsx as a6}from"react/jsx-runtime";var lc=({className:e,icon:o,size:t="1em"})=>a6("span",{className:e,style:{width:t,height:"100%",margin:"0 0.5ex 0 0.5ex",display:"inline-flex",lineHeight:0,verticalAlign:"middle",flex:"0 0 auto"},children:o});import{Fragment as s6,jsx as bx,jsxs as yx}from"react/jsx-runtime";var l6=({label:e,open:o,openTrigger:t,children:n,className:r,showCollapsedIcon:i=!0})=>yx(s6,{children:[yx("div",{style:{cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center"},className:r,onClick:t,children:[e,i&&bx(lc,{icon:o?y0:Os})]}),o&&bx("div",{style:{display:"flex",flexDirection:"column"},children:n})]}),$a=l6;import{jsx as wo,jsxs as cc}from"react/jsx-runtime";var u6=je(!1),sc=4,h6="default",g6=e=>e.flatMap(o=>o.options),wx=(e,o)=>{for(let t of e){let n=t.options.find(o);if(n)return n}return null},f6=(e,o)=>e.some(t=>t.options.some(o)),E6=e=>e.flatMap(o=>Array.from({length:Math.ceil(o.options.length/sc)},(t,n)=>o.options.slice(n*sc,n*sc+sc)));function x6({visibleSections:e,hiddenSections:o=[],value:t,label:n,onChange:r,onClose:i}){let{container:l}=_e(),[a,s]=He(u6),c=[...e,...o],m=g6(c),p=E6([...e,...a?o:[]]),d=g=>{let b=m.find(y=>y.keyBinding===g.key.toLowerCase());if(!(g.metaKey||g.altKey||g.ctrlKey)&&b)r(b.value),g.preventDefault();else if(g.key===Ko.TAB){let y=m.findIndex(x=>x.value===t),v=g.shiftKey?(m.length+y-1)%m.length:(y+1)%m.length;r(m[v].value)}else if(p6(g.key)){let y=Wo().rtl,v=m.findIndex(x=>x.value===t);if(v!==-1){let x=m.length,w=v;switch(g.key){case(y?Ko.ARROW_LEFT:Ko.ARROW_RIGHT):w=(v+1)%x;break;case(y?Ko.ARROW_RIGHT:Ko.ARROW_LEFT):w=(x+v-1)%x;break;case Ko.ARROW_DOWN:{let T=p.findIndex(P=>P.some(M=>M.value===t)),S=p[T];if(T!==-1&&S){let P=S.findIndex(R=>R.value===t),M=p[(T+1)%p.length],_=M[Math.min(P,M.length-1)]??m[v];r(_.value),g.preventDefault(),g.nativeEvent.stopImmediatePropagation(),g.stopPropagation();return}break}case Ko.ARROW_UP:{let T=p.findIndex(P=>P.some(M=>M.value===t)),S=p[T];if(T!==-1&&S){let P=S.findIndex(R=>R.value===t),M=p[(p.length+T-1)%p.length],_=M[Math.min(P,M.length-1)]??m[v];r(_.value),g.preventDefault(),g.nativeEvent.stopImmediatePropagation(),g.stopPropagation();return}break}}r(m[w].value)}g.preventDefault()}else(g.key===Ko.ESCAPE||g.key===Ko.ENTER)&&(g.preventDefault(),i());g.nativeEvent.stopImmediatePropagation(),g.stopPropagation()};d6(()=>{f6(o,g=>g.value===t)&&s(!0)},[t,o,s]);let h=g=>wo("div",{className:"picker-content",children:g.map(b=>cc("button",{type:"button",className:c6("picker-option",{active:t===b.value}),onClick:()=>{r(b.value)},title:b.keyBinding?`${b.text} \u2014 ${b.keyBinding.toUpperCase()}`:b.text,"aria-label":b.text||"none","aria-keyshortcuts":b.keyBinding||void 0,ref:y=>{t===b.value&&setTimeout(()=>{y?.focus()},0)},children:[b.icon,b.keyBinding&&wo("span",{className:"picker-keybinding",children:b.keyBinding})]},b.text))}),f=g=>g.map((b,y)=>b.name===h6?wo(vx.Fragment,{children:h(b.options)},`${b.name}-${y}`):cc("div",{className:"picker-section",children:[wo("div",{className:"picker-section-label",children:b.name}),h(b.options)]},`${b.name}-${y}`));return wo(_p.Content,{className:"picker",role:"dialog","aria-modal":"true","aria-label":n,side:"bottom",align:"start",sideOffset:12,alignOffset:12,style:{zIndex:"var(--zIndex-ui-styles-popup)"},onKeyDown:d,collisionBoundary:l??void 0,children:cc("div",{className:"picker-sections",children:[f(e),o.length>0&&wo($a,{label:E("labels.more_options"),open:a,openTrigger:()=>{s(g=>!g)},className:"picker-collapsible",children:wo("div",{className:"picker-sections",children:f(o)})})]})})}function Rp({value:e,label:o,visibleSections:t,hiddenSections:n,onChange:r}){let[i,l]=vx.useState(!1),a=m6(()=>wx(t,s=>s.value===e)??wx(n??[],s=>s.value===e),[t,n,e]);return wo("div",{children:cc(_p.Root,{open:i,onOpenChange:s=>l(s),children:[wo(_p.Trigger,{type:"button","aria-label":o,onClick:()=>l(!i),className:i?"active":"",children:a?.icon}),i&&wo(x6,{visibleSections:t,hiddenSections:n,value:e,label:o,onChange:r,onClose:()=>{l(!1)}})]})})}import Tx,{useEffect as b6}from"react";import{jsx as Np,jsxs as Ix}from"react/jsx-runtime";var Cx=({label:e,value:o,onChange:t,min:n=0,max:r=100,step:i=10,minLabel:l=n,hasCommonValue:a=!0,testId:s})=>{let c=Tx.useRef(null),m=Tx.useRef(null);return b6(()=>{if(c.current&&m.current){let p=c.current,d=m.current,h=p.offsetWidth,f=parseFloat(getComputedStyle(p).getPropertyValue("--slider-thumb-size"))||16,g=(o-n)/(r-n||1)*100,b=g/100*(h-f)+f/2;d.style.left=`${b}px`,p.style.background=`linear-gradient(to right, var(--color-slider-track) 0%, var(--color-slider-track) ${g}%, var(--button-bg) ${g}%, var(--button-bg) 100%)`}},[r,n,o]),Ix("label",{className:"control-label",children:[e,Ix("div",{className:"range-wrapper",children:[Np("input",{style:{"--color-slider-track":a?void 0:"var(--button-bg)"},ref:c,type:"range",min:n,max:r,step:i,onChange:p=>{t(+p.target.value)},value:o,className:"range-input","data-testid":s}),Np("div",{className:"value-bubble",ref:m,children:o!==n?o:null}),Np("div",{className:"zero-label",children:l})]})]})};import{Fragment as Xp,jsx as J,jsxs as ut}from"react/jsx-runtime";var _x=.1,si=e=>{let o=G6(e.editorInterface);return{stylesPanelMode:o,isCompact:o!=="full",isMobile:o==="mobile"}},pt=(e,o,t,n=!1)=>{let r=Gp(te(e,o,{includeBoundTextElement:n}));return e.map(i=>r.get(i.id)||i.id===o.editingTextElement?.id?t(i):i)},nt=function(e,o,t,n,r){let i=o.state.editingTextElement,l=Lx(e),a=null;if(i&&(a=t(i)),!a)if(we(l,o.state)){let c=o.scene.getSelectedElements(o.state),m=n===!0?c:c.filter(p=>n(p));a=_6(m,t)??(typeof r=="function"?r(!0):r)}else a=typeof r=="function"?r(!1):r;return a},U6=(e,o,t)=>B6(o)||!o.autoResize?o:t.mutateElement(o,{x:e.textAlign==="left"?e.x:e.x+(e.width-o.width)/(e.textAlign==="center"?2:1),y:e.y+(e.height-o.height)/2}),Wp=(e,o,t,n,r)=>{let i=new Set,l=pt(e,o,a=>{if(Tt(a)){let s=n(a);i.add(s);let c=qe(a,{fontSize:s});return ja(c,t.scene.getContainerElement(a),t.scene),c=U6(a,c,t.scene),c}return a},!0);return te(e,o,{includeBoundTextElement:!0}).forEach(a=>{Tt(a)&&N6(a,t.scene)}),{elements:l,appState:{...o,currentItemFontSize:i.size===1?[...i][0]:r??o.currentItemFontSize},captureUpdate:Je.IMMEDIATELY}},W6=N({name:"changeStrokeColor",label:"labels.stroke",trackEvent:!1,perform:(e,o,t)=>({...t?.currentItemStrokeColor&&{elements:pt(e,o,n=>O6(n.type)?qe(n,{strokeColor:t.currentItemStrokeColor}):n,!0)},appState:{...o,...t},captureUpdate:t?.currentItemStrokeColor?Je.IMMEDIATELY:Je.EVENTUALLY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>{let{stylesPanelMode:i}=si(n);return ut(Xp,{children:[i==="full"&&J("h3",{"aria-hidden":"true",children:E("labels.stroke")}),J(Ya,{topPicks:C6,palette:I6,type:"elementStroke",label:E("labels.stroke"),color:nt(e,n,l=>l.strokeColor,!0,l=>l?null:o.currentItemStrokeColor),onChange:l=>t({currentItemStrokeColor:l}),elements:e,appState:o,updateData:t})]})}}),Y6=N({name:"changeBackgroundColor",label:"labels.changeBackground",trackEvent:!1,perform:(e,o,t,n)=>{if(!t?.currentItemBackgroundColor)return{appState:{...o,...t},captureUpdate:Je.EVENTUALLY};let r,i=n.scene.getSelectedElements(o);if(!D6(t.currentItemBackgroundColor)&&i.every(a=>Px(a)&&R6(a.points))){let a=Gp(i);r=e.map(s=>a.has(s.id)&&Px(s)?qe(s,{backgroundColor:t.currentItemBackgroundColor,...H6(s,!0)}):s)}else r=pt(e,o,a=>qe(a,{backgroundColor:t.currentItemBackgroundColor}));return{elements:r,appState:{...o,...t},captureUpdate:Je.IMMEDIATELY}},PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>{let{stylesPanelMode:i}=si(n);return ut(Xp,{children:[i==="full"&&J("h3",{"aria-hidden":"true",children:E("labels.background")}),J(Ya,{topPicks:T6,palette:v6,type:"elementBackground",label:E("labels.background"),color:nt(e,n,l=>l.backgroundColor,!0,l=>l?null:o.currentItemBackgroundColor),onChange:l=>t({currentItemBackgroundColor:l}),elements:e,appState:o,updateData:t})]})}}),V6=N({name:"changeFillStyle",label:"labels.fill",trackEvent:!1,perform:(e,o,t,n)=>(de("element","changeFillStyle",`${t} (${n.editorInterface.formFactor==="phone"?"mobile":"desktop"})`),{elements:pt(e,o,r=>qe(r,{fillStyle:t})),appState:{...o,currentItemFillStyle:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>{let r=te(e,o),i=r.length>0&&r.every(l=>l.fillStyle==="zigzag");return ut("fieldset",{children:[J("legend",{children:E("labels.fill")}),J("div",{className:"buttonList",children:J(Wt,{type:"button",options:[{value:"hachure",text:`${i?E("labels.zigzag"):E("labels.hachure")} (${L("Alt-Click")})`,icon:i?gE:fE,active:i?!0:void 0,testId:"fill-hachure"},{value:"cross-hatch",text:E("labels.crossHatch"),icon:EE,testId:"fill-cross-hatch"},{value:"solid",text:E("labels.solid"),icon:xE,testId:"fill-solid"}],value:nt(e,n,l=>l.fillStyle,l=>l.hasOwnProperty("fillStyle"),l=>l?null:o.currentItemFillStyle),onClick:(l,a)=>{let s=a.altKey&&l==="hachure"&&r.every(c=>c.fillStyle==="hachure")?"zigzag":l;t(s)}})})]})}}),X6=N({name:"changeStrokeWidth",label:"labels.strokeWidth",trackEvent:!1,perform:(e,o,t)=>({elements:pt(e,o,n=>qe(n,{strokeWidth:t})),appState:{...o,currentItemStrokeWidth:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>ut("fieldset",{children:[J("legend",{children:E("labels.strokeWidth")}),J("div",{className:"buttonList",children:J(Wt,{group:"stroke-width",options:[{value:Op.thin,text:E("labels.thin"),icon:qm,testId:"strokeWidth-thin"},{value:Op.bold,text:E("labels.bold"),icon:bE,testId:"strokeWidth-bold"},{value:Op.extraBold,text:E("labels.extraBold"),icon:yE,testId:"strokeWidth-extraBold"}],value:nt(e,n,i=>i.strokeWidth,i=>i.hasOwnProperty("strokeWidth"),i=>i?null:o.currentItemStrokeWidth),onChange:i=>t(i)})})]})}),K6=N({name:"changeSloppiness",label:"labels.sloppiness",trackEvent:!1,perform:(e,o,t)=>({elements:pt(e,o,n=>qe(n,{seed:P6(),roughness:t})),appState:{...o,currentItemRoughness:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>ut("fieldset",{children:[J("legend",{children:E("labels.sloppiness")}),J("div",{className:"buttonList",children:J(Wt,{group:"sloppiness",options:[{value:0,text:E("labels.architect"),icon:TE},{value:1,text:E("labels.artist"),icon:IE},{value:2,text:E("labels.cartoonist"),icon:CE}],value:nt(e,n,i=>i.roughness,i=>i.hasOwnProperty("roughness"),i=>i?null:o.currentItemRoughness),onChange:i=>t(i)})})]})}),Rj=N({name:"changeStrokeStyle",label:"labels.strokeStyle",trackEvent:!1,perform:(e,o,t)=>({elements:pt(e,o,n=>qe(n,{strokeStyle:t})),appState:{...o,currentItemStrokeStyle:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>ut("fieldset",{children:[J("legend",{children:E("labels.strokeStyle")}),J("div",{className:"buttonList",children:J(Wt,{group:"strokeStyle",options:[{value:"solid",text:E("labels.strokeStyle_solid"),icon:qm},{value:"dashed",text:E("labels.strokeStyle_dashed"),icon:wE},{value:"dotted",text:E("labels.strokeStyle_dotted"),icon:vE}],value:nt(e,n,i=>i.strokeStyle,i=>i.hasOwnProperty("strokeStyle"),i=>i?null:o.currentItemStrokeStyle),onChange:i=>t(i)})})]})}),Z6=N({name:"changeOpacity",label:"labels.opacity",trackEvent:!1,perform:(e,o,t)=>({elements:pt(e,o,n=>qe(n,{opacity:t}),!0),appState:{...o,currentItemOpacity:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,app:t,updateData:n})=>{let r=nt(e,t,i=>i.opacity,!0,i=>i?null:o.currentItemOpacity);return J(Cx,{label:E("labels.opacity"),value:r??o.currentItemOpacity,hasCommonValue:r!==null,onChange:n,min:0,max:100,step:10,testId:"opacity"})}}),$6=N({name:"changeFontSize",label:"labels.fontSize",trackEvent:!1,perform:(e,o,t,n)=>Wp(e,o,n,()=>(Up(t,"actionChangeFontSize: Expected a font size value"),t),t),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>{let{isCompact:i}=si(n);return ut("fieldset",{children:[J("legend",{children:E("labels.fontSize")}),J("div",{className:"buttonList",children:J(Wt,{group:"font-size",options:[{value:mc.sm,text:E("labels.small"),icon:WE,testId:"fontSize-small"},{value:mc.md,text:E("labels.medium"),icon:YE,testId:"fontSize-medium"},{value:mc.lg,text:E("labels.large"),icon:VE,testId:"fontSize-large"},{value:mc.xl,text:E("labels.veryLarge"),icon:XE,testId:"fontSize-veryLarge"}],value:nt(e,n,l=>{if(Tt(l))return l.fontSize;let a=Mn(l,n.scene.getNonDeletedElementsMap());return a?a.fontSize:null},l=>Tt(l)||Mn(l,n.scene.getNonDeletedElementsMap())!==null,l=>l?null:o.currentItemFontSize||k6),onChange:l=>{Ha(()=>t(l),i,!!o.editingTextElement,r?.onPreventClose)}})})]})}}),Yp=N({name:"decreaseFontSize",label:"labels.decreaseFontSize",icon:ar,trackEvent:!1,perform:(e,o,t,n)=>Wp(e,o,n,r=>Math.round(1/(1+_x)*r.fontSize)),keyTest:e=>e[li.CTRL_OR_CMD]&&e.shiftKey&&(e.key===li.CHEVRON_LEFT||e.key===li.COMMA)}),Vp=N({name:"increaseFontSize",label:"labels.increaseFontSize",icon:ar,trackEvent:!1,perform:(e,o,t,n)=>Wp(e,o,n,r=>Math.round(r.fontSize*(1+_x))),keyTest:e=>e[li.CTRL_OR_CMD]&&e.shiftKey&&(e.key===li.CHEVRON_RIGHT||e.key===li.PERIOD)}),j6=N({name:"changeFontFamily",label:"labels.fontFamily",trackEvent:!1,perform:(e,o,t,n)=>{let{cachedElements:r,resetAll:i,resetContainers:l,...a}=t;if(i)return{elements:pt(e,o,g=>{let b=r?.get(g.id);return b?qe(g,{...b}):g},!0),appState:{...o,...a},captureUpdate:Je.NEVER};Up(t,"actionChangeFontFamily: value must be defined");let{currentItemFontFamily:s,currentHoveredFontFamily:c}=t,m=Je.EVENTUALLY,p,d=!1;if(s)p=s,m=Je.IMMEDIATELY;else if(c){p=c,m=Je.EVENTUALLY;let f=te(e,o,{includeBoundTextElement:!0}).filter(g=>Tt(g));if(f.length>200)d=!0;else{let g=0,b=0;for(;g<f.length&&b<5e3;){let y=f[g];b+=y?.originalText.length||0,g++}b>5e3&&(d=!0)}}let h={appState:{...o,...a},captureUpdate:m};if(p&&!d){let f=new Map,g=new Set,b=!1,y=Array.from(Uo.loadedFontsCache.values()),v=Object.entries(M6).find(([T,S])=>S===p)?.[0];c&&v&&y.some(T=>T.startsWith(v))&&(b=!0),Object.assign(h,{elements:pt(e,o,T=>{if(Tt(T)&&(T.fontFamily!==p||s)){let S=qe(T,{fontFamily:p,lineHeight:L6(p)}),P=r?.get(T.containerId||"")||{},M=n.scene.getContainerElement(T);return l&&M&&P&&n.scene.mutateElement(M,{...P}),b||(g=new Set([...g,...Array.from(S.originalText)])),f.set(S,M),S}return T},!0)});let x=`10px ${A6({fontFamily:p})}`,w=Array.from(g.values()).join();if(b||window.document.fonts.check(x,w))for(let[T,S]of f)ja(T,S,n.scene);else window.document.fonts.load(x,w).then(T=>{for(let[S,P]of f){let M=n.scene.getElement(S.id),_=P?n.scene.getElement(P.id):null;M&&ja(M,_,n.scene)}n.fonts.onLoaded(T)})}return h},PanelComponent:({elements:e,appState:o,app:t,updateData:n})=>{let r=Fp(new Map),i=Fp(null),[l,a]=w6({}),s=Fp(!0),{stylesPanelMode:c,isCompact:m}=si(t),p=Hp(()=>{let d=(h,f)=>nt(h,t,g=>{if(Tt(g))return g.fontFamily;let b=Mn(g,f);return b?b.fontFamily:null},g=>Tt(g)||Mn(g,f)!==null,g=>g?null:o.currentItemFontFamily||S6);return l.openPopup==="fontFamily"&&o.openPopup==="fontFamily"?d(Array.from(r.current?.values()??[]),r.current):!l.openPopup&&o.openPopup!=="fontFamily"?d(e,t.scene.getNonDeletedElementsMap()):i.current},[l.openPopup,o,e,t]);return Bp(()=>{i.current=p},[p]),Bp(()=>{Object.keys(l).length&&(n(l),a({}))},[l]),Bp(()=>(s.current=!1,()=>{s.current=!0}),[]),ut(Xp,{children:[c==="full"&&J("legend",{children:E("labels.fontFamily")}),J(xx,{isOpened:o.openPopup==="fontFamily",selectedFontFamily:p,hoveredFontFamily:o.currentHoveredFontFamily,compactMode:c!=="full",onSelect:d=>{Ha(()=>{a({openPopup:null,currentHoveredFontFamily:null,currentItemFontFamily:d}),r.current.clear()},m,!!o.editingTextElement)},onHover:d=>{a({currentHoveredFontFamily:d,cachedElements:new Map(r.current),resetContainers:!0})},onLeave:()=>{a({currentHoveredFontFamily:null,cachedElements:new Map(r.current),resetAll:!0})},onPopupChange:d=>{if(d){r.current.clear();let{editingTextElement:h}=o;if(h?.type==="text"){let f=t.scene.getElement(h.id);r.current.set(h.id,qe(f||h,{},!0))}else{let f=te(e,o,{includeBoundTextElement:!0});for(let g of f)r.current.set(g.id,qe(g,{},!0))}a({...l,openPopup:"fontFamily"})}else{let h={currentHoveredFontFamily:null,cachedElements:new Map(r.current),resetAll:!0};a({...h}),r.current.clear(),m&&o.editingTextElement&&za(null)}}})]})}}),q6=N({name:"changeTextAlign",label:"Change text alignment",trackEvent:!1,perform:(e,o,t,n)=>({elements:pt(e,o,r=>{if(Tt(r)){let i=qe(r,{textAlign:t});return ja(i,n.scene.getContainerElement(r),n.scene),i}return r},!0),appState:{...o,currentItemTextAlign:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>{let i=n.scene.getNonDeletedElementsMap(),{isCompact:l}=si(n);return ut("fieldset",{children:[J("legend",{children:E("labels.textAlign")}),J("div",{className:"buttonList",children:J(Wt,{group:"text-align",options:[{value:"left",text:E("labels.left"),icon:ZE,testId:"align-left"},{value:"center",text:E("labels.center"),icon:$E,testId:"align-horizontal-center"},{value:"right",text:E("labels.right"),icon:jE,testId:"align-right"}],value:nt(e,n,a=>{if(Tt(a))return a.textAlign;let s=Mn(a,i);return s?s.textAlign:null},a=>Tt(a)||Mn(a,i)!==null,a=>a?null:o.currentItemTextAlign),onChange:a=>{Ha(()=>t(a),l,!!o.editingTextElement,r?.onPreventClose)}})})]})}}),J6=N({name:"changeVerticalAlign",label:"Change vertical alignment",trackEvent:{category:"element"},perform:(e,o,t,n)=>({elements:pt(e,o,r=>{if(Tt(r)){let i=qe(r,{verticalAlign:t});return ja(i,n.scene.getContainerElement(r),n.scene),i}return r},!0),appState:{...o},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>{let{isCompact:i}=si(n);return J("fieldset",{children:J("div",{className:"buttonList",children:J(Wt,{group:"text-align",options:[{value:dc.TOP,text:E("labels.alignTop"),icon:J(qE,{theme:o.theme}),testId:"align-top"},{value:dc.MIDDLE,text:E("labels.centerVertically"),icon:J(QE,{theme:o.theme}),testId:"align-middle"},{value:dc.BOTTOM,text:E("labels.alignBottom"),icon:J(JE,{theme:o.theme}),testId:"align-bottom"}],value:nt(e,n,l=>{if(Tt(l)&&l.containerId)return l.verticalAlign;let a=Mn(l,n.scene.getNonDeletedElementsMap());return a?a.verticalAlign:null},l=>Tt(l)||Mn(l,n.scene.getNonDeletedElementsMap())!==null,l=>l?null:dc.MIDDLE),onChange:l=>{Ha(()=>t(l),i,!!o.editingTextElement,r?.onPreventClose)}})})})}}),Nj=N({name:"changeRoundness",label:"Change edge roundness",trackEvent:!1,perform:(e,o,t)=>({elements:pt(e,o,n=>Dx(n)?n:qe(n,{roundness:t==="round"?{type:F6(n.type)?pc.ADAPTIVE_RADIUS:pc.PROPORTIONAL_RADIUS}:null})),appState:{...o,currentItemRoundness:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,renderAction:r})=>{let l=Rr(Lx(e),o).some(a=>a.roundness?.type===pc.LEGACY);return ut("fieldset",{children:[J("legend",{children:E("labels.edges")}),ut("div",{className:"buttonList",children:[J(Wt,{group:"edges",options:[{value:"sharp",text:E("labels.sharp"),icon:SE},{value:"round",text:E("labels.round"),icon:kE}],value:nt(e,n,a=>l?null:a.roundness?"round":"sharp",a=>!uc(a)&&a.hasOwnProperty("roundness"),a=>a?null:o.currentItemRoundness),onChange:a=>t(a)}),r("togglePolygon")]})]})}}),Ax=e=>({visibleSections:[{name:"default",options:[{value:null,text:E("labels.arrowhead_none"),keyBinding:"q",icon:J(ME,{flip:e})},{value:"arrow",text:E("labels.arrowhead_arrow"),keyBinding:"w",icon:J(PE,{flip:e})},{value:"triangle",text:E("labels.arrowhead_triangle"),icon:J(AE,{flip:e}),keyBinding:"e"},{value:"triangle_outline",text:E("labels.arrowhead_triangle_outline"),icon:J(LE,{flip:e}),keyBinding:"r"}]}],hiddenSections:[{name:"default",options:[{value:"circle",text:E("labels.arrowhead_circle"),keyBinding:"a",icon:J(DE,{flip:e})},{value:"circle_outline",text:E("labels.arrowhead_circle_outline"),keyBinding:"s",icon:J(_E,{flip:e})},{value:"diamond",text:E("labels.arrowhead_diamond"),icon:J(RE,{flip:e}),keyBinding:"d"},{value:"diamond_outline",text:E("labels.arrowhead_diamond_outline"),icon:J(NE,{flip:e}),keyBinding:"f"},{value:"bar",text:E("labels.arrowhead_bar"),keyBinding:"z",icon:J(BE,{flip:e})}]},{name:E("labels.cardinality"),options:[{value:"cardinality_one",text:E("labels.arrowhead_cardinality_one"),icon:J(FE,{flip:e}),keyBinding:"x"},{value:"cardinality_many",text:E("labels.arrowhead_cardinality_many"),icon:J(OE,{flip:e}),keyBinding:"c"},{value:"cardinality_one_or_many",text:E("labels.arrowhead_cardinality_one_or_many"),icon:J(zE,{flip:e}),keyBinding:"v"},{value:"cardinality_exactly_one",text:E("labels.arrowhead_cardinality_exactly_one"),icon:J(HE,{flip:e}),keyBinding:null},{value:"cardinality_zero_or_one",text:E("labels.arrowhead_cardinality_zero_or_one"),icon:J(GE,{flip:e}),keyBinding:null},{value:"cardinality_zero_or_many",text:E("labels.arrowhead_cardinality_zero_or_many"),icon:J(UE,{flip:e}),keyBinding:null}]}]}),Bj=N({name:"changeArrowhead",label:"Change arrowheads",trackEvent:!1,perform:(e,o,t)=>(Up(t,"actionChangeArrowhead: value must be defined"),{elements:pt(e,o,n=>{if(zp(n)){let{position:r,type:i}=t;if(r==="start")return qe(n,{startArrowhead:i});if(r==="end")return qe(n,{endArrowhead:i})}return n}),appState:{...o,[t.position==="start"?"currentItemStartArrowhead":"currentItemEndArrowhead"]:t.type},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>{let r=Wo().rtl,i=Hp(()=>Ax(!r),[r]),l=Hp(()=>Ax(!!r),[r]);return ut("fieldset",{children:[J("legend",{children:E("labels.arrowheads")}),ut("div",{className:"iconSelectList buttonList",children:[J(Rp,{visibleSections:i.visibleSections,hiddenSections:i.hiddenSections,label:"arrowhead_start",value:nt(e,n,a=>zp(a)&&Nr(a.type)?Mx(a.startArrowhead):o.currentItemStartArrowhead,!0,a=>a?null:o.currentItemStartArrowhead),onChange:a=>t({position:"start",type:a})}),J(Rp,{visibleSections:l.visibleSections,hiddenSections:l.hiddenSections,label:"arrowhead_end",value:nt(e,n,a=>zp(a)&&Nr(a.type)?Mx(a.endArrowhead):o.currentItemEndArrowhead,!0,a=>a?null:o.currentItemEndArrowhead),onChange:a=>t({position:"end",type:a})})]})]})}}),Q6=N({name:"changeArrowProperties",label:"Change arrow properties",trackEvent:!1,perform:(e,o,t,n)=>!1,PanelComponent:({elements:e,appState:o,updateData:t,app:n,renderAction:r})=>ut("div",{className:"selected-shape-actions",children:[r("changeArrowhead"),r("changeArrowType")]})}),Fj=N({name:"changeArrowType",label:"Change arrow types",trackEvent:!1,perform:(e,o,t,n)=>{let r=pt(e,o,a=>{if(!uc(a))return a;let s=n.scene.getNonDeletedElementsMap(),c=sr.getPointAtIndexGlobalCoordinates(a,0,s),m=sr.getPointAtIndexGlobalCoordinates(a,-1,s),p=qe(a,{x:t===Xt.elbow?c[0]:a.x,y:t===Xt.elbow?c[1]:a.y,roundness:t===Xt.round?{type:pc.PROPORTIONAL_RADIUS}:null,elbowed:t===Xt.elbow,angle:t===Xt.elbow?0:a.angle,points:t===Xt.elbow||a.elbowed?[sr.pointFromAbsoluteCoords({...a,x:c[0],y:c[1],angle:0},c,s),sr.pointFromAbsoluteCoords({...a,x:c[0],y:c[1],angle:0},m,s)]:a.points});if(Dx(p)){p.fixedSegments=null;let d=n.scene.getNonDeletedElementsMap();n.dismissLinearEditor();let h=sr.getPointAtIndexGlobalCoordinates(p,0,d),f=sr.getPointAtIndexGlobalCoordinates(p,-1,d),g=p.startBinding&&d.get(p.startBinding.elementId),b=p.endBinding&&d.get(p.endBinding.elementId),y=g&&p.startBinding?{...p.startBinding,...kx(p,g,"start",d,o.isBindingEnabled)}:null,v=b&&p.endBinding?{...p.endBinding,...kx(p,b,"end",d,o.isBindingEnabled)}:null;p={...p,startBinding:y,endBinding:v,...z6(p,d,{points:[h,f].map(x=>y6(x[0]-p.x,x[1]-p.y)),startBinding:y,endBinding:v,fixedSegments:null})}}else{let d=n.scene.getNonDeletedElementsMap();if(p.startBinding){let h=d.get(p.startBinding.elementId);h&&Sx(p,h,o.bindMode==="inside"?"inside":"orbit","start",n.scene)}if(p.endBinding){let h=d.get(p.endBinding.elementId);h&&Sx(p,h,o.bindMode==="inside"?"inside":"orbit","end",n.scene)}}return p}),i={...o,currentItemArrowType:t},l=o.selectedLinearElement?.elementId;if(l){let a=r.find(s=>s.id===l);a&&(i.selectedLinearElement=new sr(a,Gp(e)))}return{elements:r,appState:i,captureUpdate:Je.IMMEDIATELY}},PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>ut("fieldset",{children:[J("legend",{children:E("labels.arrowtypes")}),J("div",{className:"buttonList",children:J(Wt,{group:"arrowtypes",options:[{value:Xt.sharp,text:E("labels.arrowtype_sharp"),icon:Xr,testId:"sharp-arrow"},{value:Xt.round,text:E("labels.arrowtype_round"),icon:Zr,testId:"round-arrow"},{value:Xt.elbow,text:E("labels.arrowtype_elbowed"),icon:Kr,testId:"elbow-arrow"}],value:nt(e,n,r=>uc(r)?r.elbowed?Xt.elbow:r.roundness?Xt.round:Xt.sharp:null,r=>uc(r),r=>r?null:o.currentItemArrowType),onChange:r=>t(r)})})]})});import{clamp as qp,roundToStep as ak}from"@excalidraw/math";import{DEFAULT_CANVAS_BACKGROUND_PICKS as lk,CURSOR_TYPE as Ox,MAX_ZOOM as zx,MIN_ZOOM as Hx,THEME as qa,ZOOM_STEP as Jp,updateActiveTool as di,CODES as Io,KEYS as Zo}from"@excalidraw/common";import{getNonDeletedElements as sk}from"@excalidraw/element";import{getCommonBounds as ck}from"@excalidraw/element";import{CaptureUpdateAction as Co}from"@excalidraw/element";import{useEffect as ek}from"react";import{jsx as ok}from"react/jsx-runtime";var ci=()=>{let e=document.querySelector(".excalidraw-tooltip");if(e)return e;let o=document.createElement("div");return document.body.appendChild(o),o.classList.add("excalidraw-tooltip"),o},Kp=(e,o,t="bottom")=>{let n=e.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,l=5,a=o.left+o.width/2-n.width/2;a<0?a=l:a+n.width>=r&&(a=r-n.width-l);let s;t==="bottom"?(s=o.top+o.height+l,s+n.height>=i&&(s=o.top-n.height-l)):(s=o.top-n.height-l,s<0&&(s=o.top+o.height+l)),Object.assign(e.style,{top:`${s}px`,left:`${a}px`})},tk=(e,o,t,n)=>{o.classList.add("excalidraw-tooltip--visible"),o.style.minWidth=n?"50ch":"10ch",o.style.maxWidth=n?"50ch":"15ch",o.textContent=t;let r=e.getBoundingClientRect();Kp(o,r)},st=({children:e,label:o,long:t=!1,style:n,disabled:r})=>(ek(()=>()=>ci().classList.remove("excalidraw-tooltip--visible"),[]),r?null:ok("div",{className:"excalidraw-tooltip-wrapper",onPointerEnter:i=>tk(i.currentTarget,ci(),o,t),onPointerLeave:()=>ci().classList.remove("excalidraw-tooltip--visible"),style:n,children:e}));import{CURSOR_TYPE as Zp,MIME_TYPES as $p,THEME as Nx}from"@excalidraw/common";var Bx='<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">',nk='<path d="M6.164 11.755a5.314 5.314 0 0 1-4.932-5.298 5.314 5.314 0 0 1 5.311-5.311 5.314 5.314 0 0 1 5.307 5.113l8.773 8.773a3.322 3.322 0 0 1 0 4.696l-.895.895a3.322 3.322 0 0 1-4.696 0l-8.868-8.868Z" style="fill:#fff"/>',Fx='<path stroke="#1b1b1f" fill="#fff" d="m7.868 11.113 7.773 7.774a2.359 2.359 0 0 0 1.667.691 2.368 2.368 0 0 0 2.357-2.358c0-.625-.248-1.225-.69-1.667L11.201 7.78 9.558 9.469l-1.69 1.643v.001Zm10.273 3.606-3.333 3.333m-3.25-6.583 2 2m-7-7 3 3M3.664 3.625l1 1M2.529 6.922l1.407-.144m5.735-2.932-1.118.866M4.285 9.823l.758-1.194m1.863-6.207-.13 1.408"/>',rk=`data:${$p.svg},${encodeURIComponent(`${Bx}${Fx}</svg>`)}`,ik=`data:${$p.svg},${encodeURIComponent(`${Bx}${nk}${Fx}</svg>`)}`,It=e=>{e&&(e.style.cursor="")},pe=(e,o)=>{e&&(e.style.cursor=o)},vo,Rx,jp=(e,o)=>{let n=()=>{let r=o===Nx.DARK;vo=document.createElement("canvas"),vo.theme=o,vo.height=20,vo.width=20;let i=vo.getContext("2d");i.lineWidth=1,i.beginPath(),i.arc(vo.width/2,vo.height/2,5,0,2*Math.PI),i.fillStyle=r?"#000":"#fff",i.fill(),i.strokeStyle=r?"#fff":"#000",i.stroke(),Rx=vo.toDataURL($p.svg)};(!vo||vo.theme!==o)&&n(),pe(e,`url(${Rx}) ${20/2} ${20/2}, auto`)},Ct=(e,o)=>{if(e)if(o.activeTool.type==="selection")It(e);else if(ro(o))e.style.cursor=Zp.GRAB;else if(wt(o))jp(e,o.theme);else if(o.activeTool.type==="laser"){let t=o.theme===Nx.LIGHT?rk:ik;e.style.cursor=`url(${t}), auto`}else["image","custom"].includes(o.activeTool.type)?o.activeTool.type!=="image"&&(e.style.cursor=Zp.AUTO):e.style.cursor=Zp.CROSSHAIR};var To=({viewportX:e,viewportY:o,nextZoom:t},n)=>{let r=e-n.offsetLeft,i=o-n.offsetTop,l=n.zoom.value,a=n.scrollX+(r-r/l),s=n.scrollY+(i-i/l),c=-(r-r/t),m=-(i-i/t);return{scrollX:a+c,scrollY:s+m,zoom:{value:t}}};import{jsx as xc,jsxs as uk}from"react/jsx-runtime";var dk=N({name:"changeViewBackgroundColor",label:"labels.canvasBackground",trackEvent:!1,predicate:(e,o,t,n)=>!!n.props.UIOptions.canvasActions.changeViewBackgroundColor&&!o.viewModeEnabled,perform:(e,o,t)=>({appState:{...o,...t},captureUpdate:t?.viewBackgroundColor?Co.IMMEDIATELY:Co.EVENTUALLY}),PanelComponent:({elements:e,appState:o,updateData:t,appProps:n,data:r})=>xc(Ya,{palette:null,topPicks:lk,label:E("labels.canvasBackground"),type:"canvasBackground",color:o.viewBackgroundColor,onChange:i=>t({viewBackgroundColor:i}),"data-testid":"canvas-background-picker",elements:e,appState:o,updateData:t})}),hc=N({name:"zoomIn",label:"buttons.zoomIn",viewMode:!0,icon:Nm,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>({appState:{...o,...To({viewportX:o.width/2+o.offsetLeft,viewportY:o.height/2+o.offsetTop,nextZoom:Gt(o.zoom.value+Jp)},o),userToFollow:null},captureUpdate:Co.EVENTUALLY}),PanelComponent:({updateData:e,appState:o})=>xc(V,{type:"button",className:"zoom-in-button zoom-button",icon:Nm,title:`${E("buttons.zoomIn")} \u2014 ${L("CtrlOrCmd++")}`,"aria-label":E("buttons.zoomIn"),disabled:o.zoom.value>=zx,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Io.EQUAL||e.code===Io.NUM_ADD)&&(e[Zo.CTRL_OR_CMD]||e.shiftKey)}),gc=N({name:"zoomOut",label:"buttons.zoomOut",icon:Bm,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>({appState:{...o,...To({viewportX:o.width/2+o.offsetLeft,viewportY:o.height/2+o.offsetTop,nextZoom:Gt(o.zoom.value-Jp)},o),userToFollow:null},captureUpdate:Co.EVENTUALLY}),PanelComponent:({updateData:e,appState:o})=>xc(V,{type:"button",className:"zoom-out-button zoom-button",icon:Bm,title:`${E("buttons.zoomOut")} \u2014 ${L("CtrlOrCmd+-")}`,"aria-label":E("buttons.zoomOut"),disabled:o.zoom.value<=Hx,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Io.MINUS||e.code===Io.NUM_SUBTRACT)&&(e[Zo.CTRL_OR_CMD]||e.shiftKey)}),fc=N({name:"resetZoom",label:"buttons.resetZoom",icon:j1,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>({appState:{...o,...To({viewportX:o.width/2+o.offsetLeft,viewportY:o.height/2+o.offsetTop,nextZoom:Gt(1)},o),userToFollow:null},captureUpdate:Co.EVENTUALLY}),PanelComponent:({updateData:e,appState:o})=>xc(st,{label:E("buttons.resetZoom"),style:{height:"100%"},children:uk(V,{type:"button",className:"reset-zoom-button zoom-button",title:E("buttons.resetZoom"),"aria-label":E("buttons.resetZoom"),onClick:()=>{e(null)},children:[(o.zoom.value*100).toFixed(0),"%"]})}),keyTest:e=>(e.code===Io.ZERO||e.code===Io.NUM_ZERO)&&(e[Zo.CTRL_OR_CMD]||e.shiftKey)}),mk=(e,o,t=1)=>{let[n,r,i,l]=e,a=i-n,s=o.width/a,c=l-r,m=o.height/c,d=Math.min(s,m)*qp(t,.1,1);return Math.min(d,1)},Gx=({bounds:e,appState:o,canvasOffsets:t,fitToViewport:n=!1,viewportZoomFactor:r=1,minZoom:i=-1/0,maxZoom:l=1/0})=>{r=qp(r,Hx,zx);let[a,s,c,m]=e,p=(a+c)/2,d=(s+m)/2,h=t?.left??0,f=t?.top??0,g=t?.right??0,b=t?.bottom??0,y=o.width-h-g,v=o.height-f-b,x;if(n){let S=c-a,P=m-s;x=Math.min(y/S,v/P)*r}else x=mk(e,{width:y,height:v},r);let w=Gt(qp(ak(x,Jp,"floor"),i,l)),T=h1({scenePoint:{x:p,y:d},viewportDimensions:{width:o.width,height:o.height},offsets:t,zoom:{value:w}});return{appState:{...o,scrollX:T.scrollX,scrollY:T.scrollY,zoom:{value:w}},captureUpdate:Co.EVENTUALLY}},Ja=({canvasOffsets:e,targetElements:o,appState:t,fitToViewport:n,viewportZoomFactor:r,minZoom:i,maxZoom:l})=>{let a=ck(sk(o));return Gx({canvasOffsets:e,bounds:a,appState:t,fitToViewport:n,viewportZoomFactor:r,minZoom:i,maxZoom:l})},xq=N({name:"zoomToFitSelectionInViewport",label:"labels.zoomToFitViewport",icon:Fs,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>{let r=n.scene.getSelectedElements(o);return Ja({targetElements:r.length?r:e,appState:{...o,userToFollow:null},fitToViewport:!1,canvasOffsets:n.getEditorUIOffsets()})},keyTest:e=>e.code===Io.TWO&&e.shiftKey&&!e.altKey&&!e[Zo.CTRL_OR_CMD]}),bq=N({name:"zoomToFitSelection",label:"helpDialog.zoomToSelection",icon:Fs,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>{let r=n.scene.getSelectedElements(o);return Ja({targetElements:r.length?r:e,appState:{...o,userToFollow:null},fitToViewport:!0,canvasOffsets:n.getEditorUIOffsets()})},keyTest:e=>e.code===Io.THREE&&e.shiftKey&&!e.altKey&&!e[Zo.CTRL_OR_CMD]}),pk=N({name:"zoomToFit",label:"helpDialog.zoomToFit",icon:Fs,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>Ja({targetElements:e,appState:{...o,userToFollow:null},fitToViewport:!1,canvasOffsets:n.getEditorUIOffsets()}),keyTest:e=>e.code===Io.ONE&&e.shiftKey&&!e.altKey&&!e[Zo.CTRL_OR_CMD]}),Ec=N({name:"toggleTheme",label:(e,o)=>o.theme===qa.DARK?"buttons.lightMode":"buttons.darkMode",keywords:["toggle","dark","light","mode","theme"],icon:(e,o)=>e.theme===qa.LIGHT?La:Da,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,o,t)=>({appState:{...o,theme:t||(o.theme===qa.LIGHT?qa.DARK:qa.LIGHT)},captureUpdate:Co.EVENTUALLY}),keyTest:e=>e.altKey&&e.shiftKey&&e.code===Io.D,predicate:(e,o,t,n)=>!!n.props.UIOptions.canvasActions.toggleTheme}),yq=N({name:"toggleEraserTool",label:"toolBar.eraser",trackEvent:{category:"toolbar"},perform:(e,o,t,n)=>{let r;return wt(o)?r=di(o,{...o.activeTool.lastActiveTool||{type:n.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):r=di(o,{type:"eraser",lastActiveToolBeforeEraser:o.activeTool}),{appState:{...o,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:r},captureUpdate:Co.IMMEDIATELY}},keyTest:e=>e.key===Zo.E}),wq=N({name:"toggleLassoTool",label:"toolBar.lasso",icon:fn,trackEvent:{category:"toolbar"},predicate:(e,o,t,n)=>n.state.preferredSelectionTool.type!=="lasso",perform:(e,o,t,n)=>{let r;return o.activeTool.type!=="lasso"?(r=di(o,{type:"lasso",fromSelection:!1}),pe(n.interactiveCanvas,Ox.CROSSHAIR)):r=di(o,{type:"selection"}),{appState:{...o,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:r},captureUpdate:Co.NEVER}}}),Ux=N({name:"toggleHandTool",label:"toolBar.hand",trackEvent:{category:"toolbar"},icon:Bs,viewMode:!1,perform:(e,o,t,n)=>{let r;return ro(o)?r=di(o,{...o.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):(r=di(o,{type:"hand",lastActiveToolBeforeEraser:o.activeTool}),pe(n.interactiveCanvas,Ox.GRAB)),{appState:{...o,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:r},captureUpdate:Co.IMMEDIATELY}},keyTest:e=>!e.altKey&&!e[Zo.CTRL_OR_CMD]&&e.key===Zo.H});import{updateActiveTool as Wx}from"@excalidraw/common";import{CaptureUpdateAction as hk}from"@excalidraw/element";var gk=N({name:"setEmbeddableAsActiveTool",trackEvent:{category:"toolbar"},target:"Tool",label:"toolBar.embeddable",perform:(e,o,t,n)=>{let r=Wx(o,{type:"embeddable"});return Ct(n.canvas,{...o,activeTool:r}),{elements:e,appState:{...o,activeTool:Wx(o,{type:"embeddable"})},captureUpdate:hk.EVENTUALLY}}});import{pointFrom as Yx}from"@excalidraw/math";import{bindOrUnbindBindingElement as fk}from"@excalidraw/element/binding";import{isValidPolygon as Vx,newElementWith as Qp}from"@excalidraw/element";import{LinearElementEditor as bc}from"@excalidraw/element/linearElementEditor";import{isBindingElement as Xx,isFreeDrawElement as Kx,isLinearElement as Zx,isLineElement as yc}from"@excalidraw/element";import{KEYS as eu,arrayToMap as Ek,invariant as $x,shouldRotateWithDiscreteAngle as xk,updateActiveTool as jx}from"@excalidraw/common";import{isPathALoop as bk}from"@excalidraw/element";import{isInvisiblySmallElement as tu}from"@excalidraw/element";import{CaptureUpdateAction as qx}from"@excalidraw/element";import{jsx as yk}from"react/jsx-runtime";var ht=N({name:"finalize",label:"",trackEvent:!1,perform:(e,o,t,n)=>{let r=e,{interactiveCanvas:i,focusContainer:l,scene:a}=n,s=a.getNonDeletedElementsMap();if(t&&o.selectedLinearElement){let{event:d,sceneCoords:h}=t,f=bc.getElement(o.selectedLinearElement.elementId,s);$x(f,"Arrow element should exist if selectedLinearElement is set"),$x(h,"sceneCoords should be defined if actionFinalize is called with event");let g=bc.handlePointerUp(d,o.selectedLinearElement,o,n.scene);if(Xx(f)&&!o.selectedLinearElement.segmentMidPointHoveredCoords){let b=!!o.newElement,v=(b||!o.selectedLinearElement.selectedPointsIndices?[f.points.length-1]:o.selectedLinearElement.selectedPointsIndices).reduce((x,w)=>(x.set(w,{point:bc.pointFromAbsoluteCoords(f,Yx(h.x-g.pointerOffset.x,h.y-g.pointerOffset.y),s)}),x),new Map)??new Map;fk(f,v,h.x-g.pointerOffset.x,h.y-g.pointerOffset.y,a,o,{newArrow:b,altKey:d.altKey,angleLocked:xk(d)})}else yc(f)&&o.selectedLinearElement?.isEditing&&!o.newElement&&!Vx(f.points)&&a.mutateElement(f,{polygon:!1});if(g!==o.selectedLinearElement){f&&tu(f)&&(r=r.map(y=>y.id===f.id?Qp(y,{isDeleted:!0}):y));let b=o.activeTool?.locked;return{elements:f.points.length<2||tu(f)?e.map(y=>y.id===f.id?Qp(y,{isDeleted:!0}):y):r,appState:{...o,cursorButton:"up",selectedLinearElement:b?null:{...g,selectedPointsIndices:null,isEditing:!1,initialState:{...g.initialState,lastClickedPoint:-1},pointerOffset:{x:0,y:0}},selectionElement:null,suggestedBinding:null,newElement:null,multiElement:null},captureUpdate:qx.IMMEDIATELY}}}window.document.activeElement instanceof HTMLElement&&l();let c=null;if(o.multiElement)c=o.multiElement;else if(o.newElement?.type==="freedraw"||Xx(o.newElement))c=o.newElement;else if(Object.keys(o.selectedElementIds).length===1){let d=s.get(Object.keys(o.selectedElementIds)[0]);d&&(c=d)}if(c){if(o.selectedLinearElement&&o.multiElement&&c.type!=="freedraw"&&o.lastPointerDownWith!=="touch"){let{points:d}=c,{lastCommittedPoint:h}=o.selectedLinearElement;(!h||d[d.length-1]!==h)&&a.mutateElement(c,{points:c.points.slice(0,-1)})}if(c&&tu(c)&&(r=r.map(d=>d.id===c?.id?Qp(d,{isDeleted:!0}):d)),Zx(c)||Kx(c)){if(bk(c.points,o.zoom.value)&&(yc(c)||Kx(c))){let h=c.points,f=h[0],g=h.map((b,y)=>y===h.length-1?Yx(f[0],f[1]):b);yc(c)?a.mutateElement(c,{points:g,polygon:!0}):a.mutateElement(c,{points:g})}yc(c)&&!Vx(c.points)&&a.mutateElement(c,{polygon:!1})}}(!o.activeTool.locked&&o.activeTool.type!=="freedraw"||!c)&&It(i);let m;o.activeTool.type==="eraser"?m=jx(o,{...o.activeTool.lastActiveTool||{type:n.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):m=jx(o,{type:n.state.preferredSelectionTool.type});let p=c&&Zx(c)?new bc(c,Ek(r)):o.selectedLinearElement;return p=p&&{...p,isEditing:o.newElement?!1:p.isEditing,initialState:{...p.initialState,lastClickedPoint:-1,origin:null}},{elements:r,appState:{...o,cursorButton:"up",activeTool:(o.activeTool.locked||o.activeTool.type==="freedraw")&&c?o.activeTool:m,activeEmbeddable:null,newElement:null,selectionElement:null,multiElement:null,editingTextElement:null,suggestedBinding:null,frameToHighlight:null,selectedElementIds:c&&!o.activeTool.locked&&o.activeTool.type!=="freedraw"?{...o.selectedElementIds,[c.id]:!0}:o.selectedElementIds,selectedLinearElement:p},captureUpdate:qx.IMMEDIATELY}},keyTest:(e,o)=>e.key===eu.ESCAPE&&o.selectedLinearElement?.isEditing||(e.key===eu.ESCAPE||e.key===eu.ENTER)&&o.multiElement!==null,PanelComponent:({appState:e,updateData:o,data:t})=>yk(V,{type:"button",icon:sE,title:E("buttons.done"),"aria-label":E("buttons.done"),onClick:o,visible:e.multiElement!=null,size:t?.size||"medium",style:{pointerEvents:"all"}})});import{getElementsInGroup as eb,isSomeElementSelected as wk,makeNextSelectedElementIds as vk,selectGroupsForSelectedElements as Tk}from"@excalidraw/element";import{CaptureUpdateAction as Jx}from"@excalidraw/element";import{KEYS as Ik,isWritableElement as Ck,updateActiveTool as Qx}from"@excalidraw/common";var Sk=(e,o)=>e.activeTool.type==="eraser"?Qx(e,{...e.activeTool.lastActiveTool||{type:o.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):Qx(e,{type:o.state.preferredSelectionTool.type}),kk=(e,o,t)=>{if(!e.editingGroupId)return null;let n=o.scene.getNonDeletedElements(),r=o.scene.getSelectedElements({selectedElementIds:t,elements:n}),i=r.length?r:eb(n,e.editingGroupId);for(let l of i){let a=l.groupIds.indexOf(e.editingGroupId);if(a!==-1&&l.groupIds[a+1])return l.groupIds[a+1]}return null},Mk=N({name:"deselect",label:"",trackEvent:!1,perform:(e,o,t,n)=>{let r=Sk(o,n);if(o.editingGroupId){let i=n.scene.getNonDeletedElements(),l=Object.keys(o.selectedElementIds).length>0?o.selectedElementIds:eb(i,o.editingGroupId).reduce((a,s)=>(a[s.id]=!0,a),{});return{appState:{...o,...Tk({editingGroupId:kk(o,n,l),selectedElementIds:l},i,o,n),activeEmbeddable:null,activeTool:r,selectedLinearElement:null,selectionElement:null,showHyperlinkPopup:!1,suggestedBinding:null,frameToHighlight:null},captureUpdate:Jx.IMMEDIATELY}}return{appState:{...o,activeEmbeddable:null,activeTool:r,editingGroupId:null,selectedElementIds:vk({},o),selectedGroupIds:{},selectedLinearElement:null,selectionElement:null,showHyperlinkPopup:!1,suggestedBinding:null,frameToHighlight:null},captureUpdate:Jx.IMMEDIATELY}},keyTest:(e,o,t,n)=>e.key!==Ik.ESCAPE||Ck(e.target)?!1:!o.newElement&&o.multiElement===null&&!o.selectedLinearElement?.isEditing&&(o.activeEmbeddable!==null||o.activeTool.type!==n.state.preferredSelectionTool.type||!!o.editingGroupId||!!o.selectedLinearElement||wk(n.scene.getNonDeletedElements(),o))});import{KEYS as kc,DEFAULT_EXPORT_PADDING as hM,EXPORT_SCALES as gM,THEME as ol}from"@excalidraw/common";import{getNonDeletedElements as fM}from"@excalidraw/element";import{CaptureUpdateAction as lo}from"@excalidraw/element";import Pk from"clsx";import{jsx as tb,jsxs as Ak}from"react/jsx-runtime";var ou=({children:e,checked:o,onChange:t,className:n})=>Ak("div",{className:Pk("Checkbox",n,{"is-checked":o}),onClick:r=>{t(!o,r),r.currentTarget.querySelector(".Checkbox-box").focus()},children:[tb("button",{type:"button",className:"Checkbox-box",role:"checkbox","aria-checked":o,children:Ls}),tb("div",{className:"Checkbox-label",children:e})]});import{THEME as Qa}from"@excalidraw/common";import{jsx as el}from"react/jsx-runtime";var nb=e=>{let o=e.title||(e.value===Qa.DARK?E("buttons.lightMode"):E("buttons.darkMode"));return el(V,{type:"icon",icon:e.value===Qa.LIGHT?ob.MOON:ob.SUN,title:o,"aria-label":o,onClick:()=>e.onChange(e.value===Qa.DARK?Qa.LIGHT:Qa.DARK),"data-testid":"toggle-dark-mode"})},ob={SUN:el("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:el("path",{fill:"currentColor",d:"M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z"})}),MOON:el("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:el("path",{fill:"currentColor",d:"M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"})})};import{useState as Lk}from"react";import{focusNearestParent as Dk,KEYS as _k}from"@excalidraw/common";import{jsx as rb,jsxs as Rk}from"react/jsx-runtime";var ib=e=>{let{id:o}=_e(),[t,n]=Lk(e.value),r=l=>{e.ignoreFocus||Dk(l.target);let a=l.target.value;a!==e.value&&e.onChange(a)},i=l=>{if(l.key===_k.ENTER){if(l.preventDefault(),l.nativeEvent.isComposing||l.keyCode===229)return;l.currentTarget.blur()}};return Rk("div",{className:"ProjectName",children:[rb("label",{className:"ProjectName-label",htmlFor:"filename",children:`${e.label}:`}),rb("input",{type:"text",className:"TextInput",onBlur:r,onKeyDown:i,id:`${o}-filename`,value:t,onChange:l=>n(l.target.value)})]})};import{useCallback as Nk,useEffect as Bk,useRef as Fk}from"react";import{jsx as wc,jsxs as Gk}from"react/jsx-runtime";var Ok=5e3,zk=({progress:e})=>wc("div",{className:"Toast__progress-bar",children:wc("div",{className:"Toast__progress-bar-fill",style:{width:`${Math.min(5,Math.round(e*100))}%`}})}),Hk=({message:e,onClose:o,closable:t=!1,duration:n=Ok,style:r})=>{let i=Fk(0),l=n!==1/0,a=Nk(()=>{l&&(i.current=window.setTimeout(()=>o(),n))},[o,n,l]);return Bk(()=>{if(l)return a(),()=>clearTimeout(i.current)},[a,e,n,l]),Gk("div",{className:"Toast",role:"status",onMouseEnter:l?()=>clearTimeout(i?.current):void 0,onMouseLeave:l?a:void 0,style:r,children:[wc("div",{className:"Toast__message",children:e}),t&&wc(V,{icon:xo,"aria-label":"close",type:"icon",onClick:o,className:"close"})]})},mi=Object.assign(Hk,{ProgressBar:zk});import{DEFAULT_EXPORT_PADDING as rM,DEFAULT_FILENAME as iM,IMAGE_MIME_TYPES as pb,isFirefox as aM,MIME_TYPES as lM,cloneJSON as sM,SVG_DOCUMENT_PREAMBLE as cM,arrayToMap as dM}from"@excalidraw/common";import{getNonDeletedElements as mM}from"@excalidraw/element";import{isFrameLikeElement as pM}from"@excalidraw/element";import{getElementsOverlappingFrame as uM}from"@excalidraw/element";import{ALLOWED_PASTE_MIME_TYPES as Uk,EXPORT_DATA_TYPES as tl,MIME_TYPES as _t,arrayToMap as Wk,isMemberOf as Yk,isPromiseLike as Vk,EVENT as vc}from"@excalidraw/common";import{mutateElement as Xk}from"@excalidraw/element";import{deepCopyElement as Kk}from"@excalidraw/element";import{isFrameLikeElement as Zk,isInitializedImageElement as $k}from"@excalidraw/element";import{getContainingFrame as ab}from"@excalidraw/element";var YJ="clipboard"in navigator&&"readText"in navigator.clipboard,Tc="clipboard"in navigator&&"writeText"in navigator.clipboard,Pn="clipboard"in navigator&&"write"in navigator.clipboard&&"ClipboardItem"in window&&"toBlob"in HTMLCanvasElement.prototype,jk=e=>!!([tl.excalidraw,tl.excalidrawClipboard,tl.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),lb=({types:e,files:o})=>{!e&&!o&&console.warn("createPasteEvent: no types or files provided");let t=new ClipboardEvent(vc.PASTE,{clipboardData:new DataTransfer});if(e)for(let[n,r]of Object.entries(e)){if(typeof r!="string"){o=o||[],o.push(r);continue}try{if(t.clipboardData?.items.add(r,n),t.clipboardData?.getData(n)!==r)throw new Error(`Failed to set "${n}" as clipboardData item`)}catch(i){throw new Error(i.message)}}if(o){let n=-1;for(let r of o){n++;try{if(t.clipboardData?.items.add(r),t.clipboardData?.files[n]!==r)throw new Error(`Failed to set file "${r.name}" as clipboardData item`)}catch(i){throw new Error(i.message)}}}return t},qk=({elements:e,files:o})=>{let t=Wk(e),n=new Set(e.filter(a=>Zk(a))),r=!1,i=e.reduce((a,s)=>($k(s)&&(r=!0,o&&o[s.fileId]&&(a[s.fileId]=o[s.fileId])),a),{});r&&!o&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let l={type:tl.excalidrawClipboard,elements:e.map(a=>{if(ab(a,t)&&!n.has(ab(a,t))){let s=Kk(a);return Xk(s,t,{frameId:null}),s}return a}),files:o?i:void 0};return JSON.stringify(l)},Ic=async(e,o,t)=>{let n=qk({elements:e,files:o});await ao({[_t.excalidrawClipboard]:n,[_t.text]:n},t)};function sb(e){let o=[];for(let t of e.childNodes)if(t.nodeType===3){let n=t.textContent?.trim();n&&o.push({type:"text",value:n})}else if(t instanceof HTMLImageElement){let n=t.getAttribute("src");n&&n.startsWith("http")&&o.push({type:"imageUrl",value:n})}else o=o.concat(sb(t));return o}var Jk=e=>{let o=e.value;try{let t=new DOMParser().parseFromString(o,_t.html),n=sb(t.body);if(n.length)return{type:"mixedContent",value:n}}catch(t){console.error(`error in parseHTMLFromPaste: ${t.message}`)}return null},cb=async()=>{let e={},o;try{o=await navigator.clipboard?.read()}catch(t){try{if(navigator.clipboard?.readText){console.warn(`navigator.clipboard.readText() failed (${t.message}). Failling back to navigator.clipboard.read()`);let n=await navigator.clipboard?.readText();if(n)return{[_t.text]:n}}}catch(n){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${n.message}). Failling back to navigator.clipboard.read()`);else{if(n.name==="DataError")return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${n.message}`),e;throw n}}throw t}for(let t of o)for(let n of t.types)if(Yk(Uk,n))try{if(n===_t.text||n===_t.html)e[n]=await(await t.getType(n)).text();else if(k1(n)){let r=await t.getType(n),i=_1(r,n,void 0);e[n]=i}else throw new Mm(`Unsupported clipboard type: ${n}`)}catch(r){console.warn(r instanceof Mm?r.message:`Cannot retrieve ${n} from clipboardItem: ${r.message}`)}return Object.keys(e).length===0&&console.warn("No clipboard data found from clipboard.read()."),e},Qk=async(e,o=!1)=>{try{let t=e.findByType(_t.html),n=!o&&t&&Jk(t);return n?n.value.every(r=>r.type==="text")?{type:"text",value:e.getData(_t.text)??n.value.map(r=>r.value).join(`
|
|
2
|
-
`).trim()}:n:{type:"text",value:(e.getData(_t.text)||"").trim()}}catch{return{type:"text",value:""}}},eM=function(e){return this.find(o=>o.type===e)||null},tM=function(e){return this.find(t=>t.type===e)?.value??null},oM=function(){return this.filter(e=>e.kind==="file")},db=e=>{let o;mb(e)?o=e.clipboardData?.items:o=e.dataTransfer?.items;let t=new Set;for(let n of Array.from(o||[]))t.has(n.type)||t.add(n.type);return t},pi=async e=>{let o;mb(e)?o=e.clipboardData?.items:o=e.dataTransfer?.items;let t=(await Promise.all(Array.from(o||[]).map(async n=>{if(n.kind==="file"){let r=n.getAsFile();if(r){let i=await D1(n);return r=await Pa(r),{type:r.type,kind:"file",file:r,fileHandle:i}}}else if(n.kind==="string"){let{type:r}=n,i;return"clipboardData"in e&&e.clipboardData?i=e.clipboardData?.getData(r):i=await new Promise(l=>{n.getAsString(a=>l(a))}),{type:r,kind:"string",value:i}}return null}))).filter(n=>n!=null);return Object.assign(t,{findByType:eM,getData:tM,getFiles:oM})},Cc=async(e,o=!1)=>{let t=await Qk(e,o);if(t.type==="mixedContent")return{mixedContent:t.value};try{let n=JSON.parse(t.value),r=n.type===tl.excalidrawClipboardWithAPI;if(jk(n))return{elements:n.elements,files:n.files,text:o?JSON.stringify(n.elements,null,2):void 0,programmaticAPI:r}}catch{}return{text:t.value}},Sc=async e=>{try{await navigator.clipboard.write([new ClipboardItem({[_t.png]:e})])}catch(o){if(Vk(e))await navigator.clipboard.write([new ClipboardItem({[_t.png]:await e})]);else throw o}},ao=async(e,o)=>{e=e||"";let t=Object.entries(typeof e=="string"?{[_t.text]:e}:e);try{if(o){for(let[r,i]of t)if(o.clipboardData?.setData(r,i),o.clipboardData?.getData(r)!==i)throw new Error("Failed to setData on clipboardEvent");return}}catch(r){console.error(r)}let n=t.find(([r])=>r===_t.text);if(Tc&&n)try{await navigator.clipboard.writeText(n[1]);return}catch(r){console.error(r)}if(n&&!nM(n[1]))throw new Error("Error copying to clipboard.")},nM=e=>{e||(e=" ");let o=document.documentElement.getAttribute("dir")==="rtl",t=document.createElement("textarea");t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px";let n=window.pageYOffset||document.documentElement.scrollTop;t.style.top=`${n}px`,t.style.fontSize="12pt",t.setAttribute("readonly",""),t.value=e,document.body.appendChild(t);let r=!1;try{t.select(),t.setSelectionRange(0,t.value.length),r=document.execCommand("copy")}catch(i){console.error(i)}return t.remove(),r},mb=e=>e.type===vc.PASTE||e.type===vc.COPY||e.type===vc.CUT;var cr=(e,{selectedElementIds:o},t)=>{e=mM(e);let n=dM(e),r=t&&we(e,{selectedElementIds:o}),i=null,l=r?te(e,{selectedElementIds:o},{includeBoundTextElement:!0}):e;return r&&(l.length===1&&pM(l[0])?(i=l[0],l=uM(e,i,n)):l.length>1&&(l=te(e,{selectedElementIds:o},{includeBoundTextElement:!0,includeElementsInFrames:!0}))),{exportingFrame:i,exportedElements:sM(l)}},dr=async(e,o,t,n,{exportBackground:r,exportPadding:i=rM,viewBackgroundColor:l,name:a=t.name||iM,fileHandle:s=null,exportingFrame:c=null})=>{if(o.length===0)throw new Error(E("alerts.cannotExportEmptyCanvas"));if(e==="svg"||e==="clipboard-svg"){let p=or(o,{exportBackground:r,exportWithDarkMode:t.exportWithDarkMode,viewBackgroundColor:l,exportPadding:i,exportScale:t.exportScale,exportEmbedScene:t.exportEmbedScene&&e==="svg"},n,{exportingFrame:c});if(e==="svg")return Pm(p.then(d=>new Blob([cM+d.outerHTML],{type:lM.svg})),{description:"Export to SVG",name:a,extension:t.exportEmbedScene?"excalidraw.svg":"svg",mimeTypes:[pb.svg],fileHandle:s});if(e==="clipboard-svg"){let d=await p.then(h=>h.outerHTML);try{await ao(d)}catch{throw new Error(E("errors.copyToSystemClipboardFailed"))}return}}let m=xs(o,t,n,{exportBackground:r,viewBackgroundColor:l,exportPadding:i,exportingFrame:c});if(e==="png"){let p=Ma(m);return t.exportEmbedScene&&(p=p.then(d=>import("./data/image-
|
|
1
|
+
import{$ as P1,A as b1,B as gs,C as Ca,D as fs,E as Es,F as Sa,G as y1,H as w1,I as v1,J as xs,K as or,L as T1,M as kS,N as nr,O as Fr,Q as I1,S as C1,T as S1,U as bs,V as k1,W as Lm,X as ka,Y as Ma,Z as M1,_ as Dm,a as h1,aa as A1,b as tr,ba as _m,c as Gt,ca as L1,d as g1,da as D1,e as we,ea as _1,f as f1,fa as Pa,g as te,h as Rr,i as fo,j as wa,k as va,l as Nr,m as Ta,n as us,o as E1,p as Mm,q as Uo,r as gn,s as wt,t as ro,u as Br,v as x1,w as Pm,x as Ia,y as hs,z as Am}from"./chunk-B2SJBHTC.js";import{a as C}from"./chunk-5ADLKOJQ.js";import{F as km}from"./chunk-VHQT4IVX.js";import{c as u1}from"./chunk-3PELD44J.js";import{b as p1,c as SS,d as I}from"./chunk-SRAX5OIU.js";import aU,{useCallback as lU,useContext as sU,useEffect as cU,useRef as dU,useState as mU}from"react";import{DEFAULT_IMAGE_OPTIONS as xa,DEFAULT_UI_OPTIONS as TS,isShallowEqual as pU}from"@excalidraw/common";import ZI from"clsx";import Pz from"lodash.throttle";import to,{useContext as mn}from"react";import{flushSync as Ot}from"react-dom";import Az from"roughjs/bin/rough";import{nanoid as Lz}from"nanoid";import{clamp as bf,pointFrom as Q,pointDistance as sn,vector as $I,pointRotateRads as yf,vectorFromPoint as wf,vectorSubtract as jI,vectorDot as qI,vectorNormalize as JI}from"@excalidraw/math";import{COLOR_PALETTE as Dz,CODES as QI,shouldResizeFromCenter as eC,shouldMaintainAspectRatio as jl,shouldRotateWithDiscreteAngle as tC,isArrowKey as dm,KEYS as Y,APP_NAME as _z,CURSOR_TYPE as Ce,DEFAULT_TRANSFORM_HANDLE_SPACING as Rz,DEFAULT_VERTICAL_ALIGN as oC,DRAGGING_THRESHOLD as nC,ELEMENT_SHIFT_TRANSLATE_AMOUNT as Nz,ELEMENT_TRANSLATE_AMOUNT as rC,EVENT as q,FRAME_STYLE as No,IMAGE_MIME_TYPES as Bz,IMAGE_RENDER_TIMEOUT as Fz,LINE_CONFIRM_THRESHOLD as vf,MIME_TYPES as sa,MQ_RIGHT_SIDEBAR_MIN_WIDTH as Oz,POINTER_BUTTON as Bo,ROUNDNESS as mm,SCROLL_TIMEOUT as zz,TAP_TWICE_TIMEOUT as iC,TEXT_TO_CENTER_SNAP_THRESHOLD as Hz,THEME as ca,TOUCH_CTX_MENU_TIMEOUT as Gz,VERTICAL_ALIGN as Uz,YOUTUBE_STATES as pm,ZOOM_STEP as Wz,POINTER_EVENTS as da,TOOL_TYPE as Fo,supportsResizeObserver as Yz,DEFAULT_COLLISION_THRESHOLD as aC,DEFAULT_TEXT_ALIGN as Vz,ARROW_TYPE as $n,DEFAULT_REDUCED_GLOBAL_ALPHA as Xz,isLocalLink as Kz,normalizeLink as Tf,toValidURL as Zz,getGridPoint as dt,getLineHeight as lC,debounce as sC,distance as ma,getFontString as If,getNearestScrollableContainer as $z,isInputLike as cC,isToolIcon as jz,isWritableElement as ql,sceneCoordsToViewportCoords as um,tupleToCoors as Cf,viewportCoordsToSceneCoords as De,wrapEvent as qz,updateObject as Sf,updateActiveTool as Oo,isTransparent as Jz,easeToValuesRAF as Qz,muteFSAbortError as eH,isTestEnv as QC,isDevEnv as eS,easeOut as tH,updateStable as Jl,addEventListener as Ge,normalizeEOL as oH,getDateTime as dC,isShallowEqual as mC,arrayToMap as hm,applyDarkModeFilter as nH,AppEventBus as rH,randomInteger as iH,CLASSES as kf,Emitter as Ar,MINIMUM_ARROW_SIZE as aH,DOUBLE_TAP_POSITION_THRESHOLD as pC,BIND_MODE_TIMEOUT as lH,invariant as zo,getFeatureFlag as cn,createUserAgentDescriptor as tS,getFormFactor as sH,deriveStylesPanelMode as ym,isIOS as cH,isBrave as dH,isSafari as mH,loadDesktopUIModePreference as pH,setDesktopUIMode as uH,isSelectionLikeTool as Ql,oneOf as hH,matchKey as uC}from"@excalidraw/common";import{getObservedAppState as gH,getCommonBounds as pa,getElementAbsoluteCoords as hC,bindOrUnbindBindingElements as gC,fixBindingsAfterDeletion as fH,getHoveredElementForBinding as Ho,isBindingEnabled as es,updateBoundElements as gm,newElementWith as jn,newFrameElement as EH,newFreeDrawElement as xH,newEmbeddableElement as fC,newMagicFrameElement as EC,newIframeElement as bH,newArrowElement as yH,newElement as wH,newImageElement as vH,newLinearElement as TH,newTextElement as xC,refreshTextDimensions as IH,deepCopyElement as bC,duplicateElements as yC,hasBoundTextElement as wC,isArrowElement as ua,isBindingElement as Go,isBindingElementType as CH,isBoundToContainer as Mf,isFrameLikeElement as at,isImageElement as qn,isEmbeddableElement as dn,isInitializedImageElement as ts,isLinearElement as bt,isLinearElementType as SH,isUsingAdaptiveRadius as kH,isIframeElement as ha,isIframeLikeElement as Pf,isMagicFrameElement as vC,isTextBindableContainer as TC,isElbowArrow as Lt,isFlowchartNodeElement as MH,isBindableElement as Af,isTextElement as zt,getNormalizedDimensions as PH,isElementCompletelyInViewport as Lf,isElementInViewport as IC,isInvisiblySmallElement as CC,getCornerRadius as AH,isPathALoop as SC,createSrcDoc as kC,embeddableURLValidator as Df,maybeParseEmbedSrc as LH,getEmbedLink as fm,getInitializedImageElements as DH,normalizeSVG as MC,updateImageCache as _H,getBoundTextElement as _f,getContainerCenter as Rf,getContainerElement as PC,isValidTextContainer as AC,redrawTextBoundingBox as RH,hasBoundingBox as NH,getCommonFrameId as LC,getFrameChildren as Nf,getFrameChildrenInsertionIndex as BH,isCursorInFrame as DC,addElementsToFrame as Bf,replaceAllElementsInFrame as FH,removeElementsFromFrame as OH,getElementsInResizingFrame as Ff,getElementsInNewFrame as zH,getContainingFrame as Of,elementOverlapsWithFrame as HH,updateFrameMembershipOfSelectedElements as _C,isElementInFrame as RC,getFrameLikeTitle as GH,getElementsOverlappingFrame as UH,filterElementsEligibleAsFrameChildren as WH,hitElementBoundText as YH,hitElementBoundingBoxOnly as VH,hitElementItself as os,getVisibleSceneBounds as XH,FlowChartCreator as KH,FlowChartNavigator as ZH,getLinkDirectionFromKey as NC,cropElement as $H,wrapText as jH,isElementLink as zf,parseElementLinkFromURL as qH,isMeasureTextSupported as JH,normalizeText as QH,measureText as BC,getLineHeightInPx as FC,getApproxMinLineWidth as eG,getApproxMinLineHeight as tG,getMinTextElementWidth as oG,ShapeCache as ns,getRenderOpacity as nG,editGroupForSelectedElement as rG,getElementsInGroup as Lr,getSelectedGroupIdForElement as iG,getSelectedGroupIds as aG,isElementInGroup as OC,isSelectedViaGroup as lG,selectGroupsForSelectedElements as eo,syncInvalidIndices as oS,syncMovedIndices as zC,excludeElementsInFramesFromSelection as sG,getSelectionStateForElements as cG,makeNextSelectedElementIds as ye,getResizeOffsetXY as dG,getResizeArrowDirection as mG,transformElements as pG,getCursorForResizingElement as HC,getElementWithTransformHandleType as GC,getTransformHandleTypeFromCoords as UC,dragNewElement as WC,dragSelectedElements as uG,getDragOffsetXY as hG,isNonDeletedElement as YC,Scene as VC,Store as gG,CaptureUpdateAction as yt,hitElementBoundingBox as fG,isLineElement as Hf,isSimpleArrow as Gf,StoreDelta as XC,positionElementsOnGrid as KC,calculateFixedPointForNonElbowArrowBinding as ZC,bindOrUnbindBindingElement as EG,mutateElement as Em,getElementBounds as $C,doBoundsIntersect as xG,isPointInElement as bG,maxBindingDistance_simple as Uf,convertToExcalidrawElements as yG,getSnapOutlineMidPoint as Wf,handleFocusPointDrag as wG,handleFocusPointHover as vG,handleFocusPointPointerDown as TG,handleFocusPointPointerUp as IG,maybeHandleArrowPointlikeDrag as xm,getUncroppedWidthAndHeight as CG,getActiveTextElement as jC,isEligibleFrameChildType as SG}from"@excalidraw/element";import{LinearElementEditor as se}from"@excalidraw/element/linearElementEditor";import{findShapeByKey as kG}from"@excalidraw/element/shapes";import{KEYS as ap,MOBILE_ACTION_BUTTON_BG as US,updateActiveTool as WS}from"@excalidraw/common";import{getNonDeletedElements as lp}from"@excalidraw/element";import{fixBindingsAfterDeletion as YS}from"@excalidraw/element";import{LinearElementEditor as P0}from"@excalidraw/element/linearElementEditor";import{newElementWith as Ys}from"@excalidraw/element";import{getContainerElement as A0}from"@excalidraw/element";import{isBoundToContainer as Us,isElbowArrow as VS,isFrameLikeElement as XS}from"@excalidraw/element";import{getFrameChildren as KS}from"@excalidraw/element";import{getElementsInGroup as sp,selectGroupsForSelectedElements as ZS}from"@excalidraw/element";import{CaptureUpdateAction as Ws}from"@excalidraw/element";import{isDevEnv as LS}from"@excalidraw/common";import{atom as je,createStore as MS}from"jotai";import{createIsolation as PS}from"jotai-scope";var R1=PS();var{useAtom:He,useSetAtom:N1,useAtomValue:ys,useStore:xU}=R1,B1=R1.Provider,Ut=MS();var AS=p1({"./locales/ar-SA.json":()=>import("./locales/ar-SA-3G7FTBZJ.js"),"./locales/az-AZ.json":()=>import("./locales/az-AZ-HMFZUPFL.js"),"./locales/bg-BG.json":()=>import("./locales/bg-BG-Y7OZ2DXF.js"),"./locales/bn-BD.json":()=>import("./locales/bn-BD-36TGMEAF.js"),"./locales/bn-IN.json":()=>import("./locales/bn-IN-FALW4RB5.js"),"./locales/ca-ES.json":()=>import("./locales/ca-ES-MJRJ6GTN.js"),"./locales/cs-CZ.json":()=>import("./locales/cs-CZ-52YM52ZO.js"),"./locales/da-DK.json":()=>import("./locales/da-DK-QEP42HP6.js"),"./locales/de-CH.json":()=>import("./locales/de-CH-LGHSGO4X.js"),"./locales/de-DE.json":()=>import("./locales/de-DE-GHNPPGTN.js"),"./locales/el-GR.json":()=>import("./locales/el-GR-2UZLGABX.js"),"./locales/en.json":()=>import("./locales/en-6UCVDQQ7.js"),"./locales/es-ES.json":()=>import("./locales/es-ES-2NUH2FTW.js"),"./locales/eu-ES.json":()=>import("./locales/eu-ES-LW4CGHUU.js"),"./locales/fa-IR.json":()=>import("./locales/fa-IR-U32PFECK.js"),"./locales/fi-FI.json":()=>import("./locales/fi-FI-G7756HAK.js"),"./locales/fr-FR.json":()=>import("./locales/fr-FR-VIEH4DTC.js"),"./locales/gl-ES.json":()=>import("./locales/gl-ES-JWQDRMPC.js"),"./locales/he-IL.json":()=>import("./locales/he-IL-YYBNMYP4.js"),"./locales/hi-IN.json":()=>import("./locales/hi-IN-4J4RW5AN.js"),"./locales/hu-HU.json":()=>import("./locales/hu-HU-MBXXMHSF.js"),"./locales/id-ID.json":()=>import("./locales/id-ID-5U764SVL.js"),"./locales/it-IT.json":()=>import("./locales/it-IT-7BNDK63V.js"),"./locales/ja-JP.json":()=>import("./locales/ja-JP-4SLEHWLA.js"),"./locales/kaa.json":()=>import("./locales/kaa-YHCGFUY5.js"),"./locales/kab-KAB.json":()=>import("./locales/kab-KAB-LSGAIMUB.js"),"./locales/kk-KZ.json":()=>import("./locales/kk-KZ-3YNSB7GZ.js"),"./locales/km-KH.json":()=>import("./locales/km-KH-7GXC5R4I.js"),"./locales/ko-KR.json":()=>import("./locales/ko-KR-B6Q6YTFE.js"),"./locales/ku-TR.json":()=>import("./locales/ku-TR-FBC7A657.js"),"./locales/lt-LT.json":()=>import("./locales/lt-LT-NTZ3RRBU.js"),"./locales/lv-LV.json":()=>import("./locales/lv-LV-G24LH3KG.js"),"./locales/mr-IN.json":()=>import("./locales/mr-IN-FMZEIYNW.js"),"./locales/my-MM.json":()=>import("./locales/my-MM-B6EJQIQF.js"),"./locales/nb-NO.json":()=>import("./locales/nb-NO-GEP6ZOEM.js"),"./locales/nl-NL.json":()=>import("./locales/nl-NL-4QUIWSVP.js"),"./locales/nn-NO.json":()=>import("./locales/nn-NO-P32L2VHA.js"),"./locales/oc-FR.json":()=>import("./locales/oc-FR-QRACY6JR.js"),"./locales/pa-IN.json":()=>import("./locales/pa-IN-GBDTCDVG.js"),"./locales/percentages.json":()=>import("./locales/percentages-5DKR754L.js"),"./locales/pl-PL.json":()=>import("./locales/pl-PL-2Y6CXCHK.js"),"./locales/pt-BR.json":()=>import("./locales/pt-BR-FKWT7UFL.js"),"./locales/pt-PT.json":()=>import("./locales/pt-PT-6EMD7SCZ.js"),"./locales/ro-RO.json":()=>import("./locales/ro-RO-XERO3Y25.js"),"./locales/ru-RU.json":()=>import("./locales/ru-RU-XKTTT4QL.js"),"./locales/si-LK.json":()=>import("./locales/si-LK-MGLC5APF.js"),"./locales/sk-SK.json":()=>import("./locales/sk-SK-BMCDJLZC.js"),"./locales/sl-SI.json":()=>import("./locales/sl-SI-LAWKY4LU.js"),"./locales/sv-SE.json":()=>import("./locales/sv-SE-X2ORO3SG.js"),"./locales/ta-IN.json":()=>import("./locales/ta-IN-RZDP4ZDC.js"),"./locales/th-TH.json":()=>import("./locales/th-TH-GY4Y5ENV.js"),"./locales/tr-TR.json":()=>import("./locales/tr-TR-CT4QTEX3.js"),"./locales/uk-UA.json":()=>import("./locales/uk-UA-XEPSQF3S.js"),"./locales/uz-UZ.json":()=>import("./locales/uz-UZ-WM3HHDOU.js"),"./locales/vi-VN.json":()=>import("./locales/vi-VN-RFG3SAMP.js"),"./locales/zh-CN.json":()=>import("./locales/zh-CN-2WGTQQH5.js"),"./locales/zh-HK.json":()=>import("./locales/zh-HK-J64WV2A2.js"),"./locales/zh-TW.json":()=>import("./locales/zh-TW-4JITCNYX.js")});var DS=85,Eo={code:"en",label:"English"},zr=[Eo,...[{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",rtl:!0},{code:"bg-BG",label:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"},{code:"ca-ES",label:"Catal\xE0"},{code:"cs-CZ",label:"\u010Cesky"},{code:"de-DE",label:"Deutsch"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"},{code:"es-ES",label:"Espa\xF1ol"},{code:"eu-ES",label:"Euskara"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",rtl:!0},{code:"fi-FI",label:"Suomi"},{code:"fr-FR",label:"Fran\xE7ais"},{code:"gl-ES",label:"Galego"},{code:"he-IL",label:"\u05E2\u05D1\u05E8\u05D9\u05EA",rtl:!0},{code:"hi-IN",label:"\u0939\u093F\u0928\u094D\u0926\u0940"},{code:"hu-HU",label:"Magyar"},{code:"id-ID",label:"Bahasa Indonesia"},{code:"it-IT",label:"Italiano"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E"},{code:"kab-KAB",label:"Taqbaylit"},{code:"kk-KZ",label:"\u049A\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4"},{code:"ku-TR",label:"Kurd\xEE"},{code:"lt-LT",label:"Lietuvi\u0173"},{code:"lv-LV",label:"Latvie\u0161u"},{code:"my-MM",label:"Burmese"},{code:"nb-NO",label:"Norsk bokm\xE5l"},{code:"nl-NL",label:"Nederlands"},{code:"nn-NO",label:"Norsk nynorsk"},{code:"oc-FR",label:"Occitan"},{code:"pa-IN",label:"\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40"},{code:"pl-PL",label:"Polski"},{code:"pt-BR",label:"Portugu\xEAs Brasileiro"},{code:"pt-PT",label:"Portugu\xEAs"},{code:"ro-RO",label:"Rom\xE2n\u0103"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},{code:"sk-SK",label:"Sloven\u010Dina"},{code:"sv-SE",label:"Svenska"},{code:"sl-SI",label:"Sloven\u0161\u010Dina"},{code:"tr-TR",label:"T\xFCrk\xE7e"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"},{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t"},{code:"mr-IN",label:"\u092E\u0930\u093E\u0920\u0940"}].filter(e=>u1[e.code]>=DS).sort((e,o)=>e.label>o.label?1:-1)],vs="__test__";LS()&&zr.unshift({code:vs,label:"test language"},{code:`${vs}.rtl`,label:"\u202Atest language (rtl)\u202C",rtl:!0});var Or=Eo,ws={},Ts=async e=>{if(Or=e,document.documentElement.dir=Or.rtl?"rtl":"ltr",document.documentElement.lang=Or.code,e.code.startsWith(vs))ws={};else try{ws=await AS(`./locales/${Or.code}.json`)}catch(o){console.error(`Failed to load language ${e.code}:`,o.message),ws=km}Ut.set(O1,e.code)},Wo=()=>Or,F1=(e,o)=>{for(let t=0;t<o.length;++t){let n=o[t];if(e[n]===void 0)return;e=e[n]}if(typeof e=="string")return e},E=(e,o,t)=>{if(Or.code.startsWith(vs))return`\u202A[[${o?`${e}(${JSON.stringify(o).slice(1,-1)})`:e}]]\u202C`;let n=e.split("."),r=F1(ws,n)||F1(km,n)||t;if(r===void 0){let i=`Can't find translation for ${e}`;if(C.PROD)return console.warn(i),"";throw new Error(i)}if(o)for(let i in o)r=r.replace(`{{${i}}}`,String(o[i]));return r},O1=je(Eo.code),Te=()=>{let e=ys(O1);return{t:E,langCode:e}};import _S from"clsx";import Xe from"react";import{THEME as RS}from"@excalidraw/common";import{Fragment as ve,jsx as u,jsxs as D}from"react/jsx-runtime";var io=e=>"var(--icon-fill-color)",z1=e=>e===RS.LIGHT?"#fff":"#1e1e1e",k=(e,o=512)=>{let{width:t=512,height:n=t,mirror:r,style:i,...l}=typeof o=="number"?{width:o}:o;return u("svg",{"aria-hidden":"true",focusable:"false",role:"img",viewBox:`0 0 ${t} ${n}`,className:_S({"rtl-mirror":r}),style:i,...l,children:typeof e=="string"?u("path",{fill:"currentColor",d:e}):e})},O={width:24,height:24,fill:"none",strokeWidth:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},ne={width:20,height:20,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},mt={width:40,height:20},_U=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("rect",{x:3,y:8,width:18,height:4,rx:1}),u("line",{x1:12,y1:8,x2:12,y2:21}),u("path",{d:"M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7"}),u("path",{d:"M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5"})]}),O),RU=k(D("svg",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),u("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),O),NU=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("circle",{cx:"12",cy:"12",r:"1"}),u("circle",{cx:"12",cy:"19",r:"1"}),u("circle",{cx:"12",cy:"5",r:"1"})]}),O),H1=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),u("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),u("path",{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]}),O),G1=k(D("svg",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6"}),u("line",{x1:"12",y1:"16",x2:"12",y2:"21"}),u("line",{x1:"8",y1:"4",x2:"16",y2:"4"})]}),O),Rm=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M6.5 9.5l3.5 -3"}),u("path",{d:"M14 5.5l3 1.5"}),u("path",{d:"M18.5 10l-2.5 7"}),u("path",{d:"M13.5 17.5l-7 -5"})]}),O),rr=k(D("g",{children:[u("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z",stroke:"currentColor",strokeWidth:"1.25"}),u("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z",stroke:"currentColor",strokeWidth:"1.25"}),u("mask",{id:"UnlockedIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:6,y:1,width:9,height:9,children:u("path",{stroke:"none",d:"M6.399 9.561V5.175c0-.93.401-1.823 1.116-2.48a3.981 3.981 0 0 1 2.693-1.028c1.01 0 1.98.37 2.694 1.027.715.658 1.116 1.55 1.116 2.481",fill:"#fff"})}),u("g",{mask:"url(#UnlockedIcon)",children:u("path",{stroke:"none",d:"M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z",fill:"currentColor"})})]}),ne),Hr=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z"}),u("path",{d:"M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z"}),u("path",{d:"M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916"})]}),ne),U1=k(u("g",{fill:"currentColor",children:u("path",{d:"M12 2a5 5 0 0 1 5 5v3a3 3 0 0 1 3 3v6a3 3 0 0 1 -3 3h-10a3 3 0 0 1 -3 -3v-6a3 3 0 0 1 3 -3v-3a5 5 0 0 1 5 -5m0 12a2 2 0 0 0 -1.995 1.85l-.005 .15a2 2 0 1 0 2 -2m0 -10a3 3 0 0 0 -3 3v3h6v-3a3 3 0 0 0 -3 -3"})}),{width:24,height:24}),W1=k(D(ve,{children:[u("path",{d:"M38.5 83.5c-14-2-17.833-10.473-21-22.5C14.333 48.984 12 22 12 12.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),u("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z",fill:"currentColor"}),u("path",{d:"M12.005 10.478c1.92 3.495 3.838 7 7.905 14.423m-7.905-14.423c3.11 5.683 6.23 11.368 7.905 14.423m0 0c-3.68.226-7.35.455-13.91.85m13.91-.85c-5.279.33-10.566.647-13.91.85m0 0c1.936-4.931 3.882-9.86 6.005-15.273M6 25.75c2.069-5.257 4.135-10.505 6.005-15.272",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:41,height:94,fill:"none"}),Y1=k(D(ve,{children:[u("path",{d:"M18.026 1.232c-5.268 13.125-5.548 33.555 3.285 42.311 8.823 8.75 33.31 12.304 42.422 13.523",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),u("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m72.181 59.247-13.058-10-2.948 13.62 16.006-3.62Z",fill:"currentColor"}),u("path",{d:"M72.181 59.247c-3.163-2.429-6.337-4.856-13.058-10m13.058 10c-5.145-3.936-10.292-7.882-13.058-10m0 0c-.78 3.603-1.563 7.196-2.948 13.62m2.948-13.62c-1.126 5.168-2.24 10.346-2.948 13.62m0 0c5.168-1.166 10.334-2.343 16.006-3.62m-16.006 3.62c5.51-1.248 11.01-2.495 16.006-3.62",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:85,height:71,fill:"none"}),V1=k(D(ve,{children:[u("path",{d:"M1 77c14-2 31.833-11.973 35-24 3.167-12.016-6-35-9.5-43.5",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"}),u("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m24.165 1.093-2.132 16.309 13.27-4.258-11.138-12.05Z",fill:"currentColor"}),u("path",{d:"M24.165 1.093c-.522 3.953-1.037 7.916-2.132 16.309m2.131-16.309c-.835 6.424-1.68 12.854-2.13 16.308m0 0c3.51-1.125 7.013-2.243 13.27-4.257m-13.27 4.257c5.038-1.608 10.08-3.232 13.27-4.257m0 0c-3.595-3.892-7.197-7.777-11.14-12.05m11.14 12.05c-3.837-4.148-7.667-8.287-11.14-12.05",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})]}),{width:38,height:78,fill:"none"}),BU=k(u("g",{fill:"currentColor",children:u("path",{d:"M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z",fill:"currentColor"})}),{width:40,height:40,fill:"none"}),Is=k(D("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 6l4.153 11.793a0.365 .365 0 0 0 .331 .207a0.366 .366 0 0 0 .332 -.207l2.184 -4.793l4.787 -1.994a0.355 .355 0 0 0 .213 -.323a0.355 .355 0 0 0 -.213 -.323l-11.787 -4.36z"}),u("path",{d:"M13.5 13.5l4.5 4.5"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),fn=k(D("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,children:[u("path",{d:"M4.028 13.252c-.657 -.972 -1.028 -2.078 -1.028 -3.252c0 -3.866 4.03 -7 9 -7s9 3.134 9 7s-4.03 7 -9 7c-1.913 0 -3.686 -.464 -5.144 -1.255"}),u("path",{d:"M5 15m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M5 17c0 1.42 .316 2.805 1 4"})]}),{fill:"none",width:22,height:22,strokeWidth:1.25}),Cs=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})]}),O),Ss=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10.5 20.4l-6.9 -6.9c-.781 -.781 -.781 -2.219 0 -3l6.9 -6.9c.781 -.781 2.219 -.781 3 0l6.9 6.9c.781 .781 .781 2.219 0 3l-6.9 6.9c-.781 .781 -2.219 .781 -3 0z"})]}),O),ks=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("circle",{cx:"12",cy:"12",r:"9"})]}),O),X1=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),u("line",{x1:"15",y1:"16",x2:"19",y2:"12"}),u("line",{x1:"15",y1:"8",x2:"19",y2:"12"})]}),O),Ms=k(u("path",{d:"M4.167 10h11.666",strokeWidth:"1.5"}),ne),K1=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z"}),u("path",{d:"M16 7h4"}),u("path",{d:"M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3"})]}),O),En=k(D("g",{strokeWidth:"1.25",children:[u("path",{clipRule:"evenodd",d:"m7.643 15.69 7.774-7.773a2.357 2.357 0 1 0-3.334-3.334L4.31 12.357a3.333 3.333 0 0 0-.977 2.357v1.953h1.953c.884 0 1.732-.352 2.357-.977Z"}),u("path",{d:"m11.25 5.417 3.333 3.333"})]}),ne),xn=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"20",x2:"7",y2:"20"}),u("line",{x1:"14",y1:"20",x2:"21",y2:"20"}),u("line",{x1:"6.9",y1:"15",x2:"13.8",y2:"15"}),u("line",{x1:"10.2",y1:"6.3",x2:"16",y2:"20"}),u("polyline",{points:"5 20 11 4 13 4 20 20"})]}),O),Z1=k(D("g",{stroke:"currentColor",strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 7v-2h13v2"}),u("path",{d:"M10 5v14"}),u("path",{d:"M12 19h-4"}),u("path",{d:"M15 13v-1h6v1"}),u("path",{d:"M18 12v7"}),u("path",{d:"M17 19h2"})]}),O),Ps=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M12.5 6.667h.01"}),u("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z"}),u("path",{d:"m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166"}),u("path",{d:"m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667"})]}),ne),$1=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3"}),u("path",{d:"M18 13.3l-6.3 -6.3"})]}),O),Nm=k(u("path",{strokeWidth:"1.25",d:"M10 4.167v11.666M4.167 10h11.666"}),ne),Bm=k(u("path",{d:"M5 10h10",strokeWidth:"1.25"}),ne),j1=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M21 21l-6 -6"}),u("path",{d:"M3.268 12.043a7.017 7.017 0 0 0 6.634 4.957a7.012 7.012 0 0 0 7.043 -6.131a7 7 0 0 0 -5.314 -7.672a7.021 7.021 0 0 0 -8.241 4.403"}),u("path",{d:"M3 4v4h4"})]}),O),ir=k(u("path",{strokeWidth:"1.25",d:"M3.333 5.833h13.334M8.333 9.167v5M11.667 9.167v5M4.167 5.833l.833 10c0 .92.746 1.667 1.667 1.667h6.666c.92 0 1.667-.746 1.667-1.667l.833-10M7.5 5.833v-2.5c0-.46.373-.833.833-.833h3.334c.46 0 .833.373.833.833v2.5"}),ne),As=k(D("g",{strokeWidth:"1.5",children:[u("polyline",{points:"12 16 18 10 12 4"}),u("polyline",{points:"8 4 2 10 8 16"})]}),ne),Aa=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M14.375 6.458H8.958a2.5 2.5 0 0 0-2.5 2.5v5.417a2.5 2.5 0 0 0 2.5 2.5h5.417a2.5 2.5 0 0 0 2.5-2.5V8.958a2.5 2.5 0 0 0-2.5-2.5Z"}),u("path",{clipRule:"evenodd",d:"M11.667 3.125c.517 0 .986.21 1.325.55.34.338.55.807.55 1.325v1.458H8.333c-.485 0-.927.185-1.26.487-.343.312-.57.75-.609 1.24l-.005 5.357H5a1.87 1.87 0 0 1-1.326-.55 1.87 1.87 0 0 1-.549-1.325V5c0-.518.21-.987.55-1.326.338-.34.807-.549 1.325-.549h6.667Z"})]}),ne),La=k(u("path",{clipRule:"evenodd",d:"M10 2.5h.328a6.25 6.25 0 0 0 6.6 10.372A7.5 7.5 0 1 1 10 2.493V2.5Z",stroke:"currentColor"}),ne),Da=k(u("g",{stroke:"currentColor",strokeLinejoin:"round",children:u("path",{d:"M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM10 4.167V2.5M14.167 5.833l1.166-1.166M15.833 10H17.5M14.167 14.167l1.166 1.166M10 15.833V17.5M5.833 14.167l-1.166 1.166M5 10H3.333M5.833 5.833 4.667 4.667"})}),{...ne,strokeWidth:1.5}),q1=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),u("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),u("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),O),_a=k(u("path",{strokeWidth:"1.25",d:"M3.333 14.167v1.666c0 .92.747 1.667 1.667 1.667h10c.92 0 1.667-.746 1.667-1.667v-1.666M5.833 9.167 10 13.333l4.167-4.166M10 3.333v10"}),ne),Gr=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("circle",{cx:"12",cy:"12",r:"9"}),u("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),u("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),O),J1=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("circle",{cx:"12",cy:"12",r:"9"}),u("line",{x1:"12",y1:"17",x2:"12",y2:"17.01"}),u("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),O),FU=k(u("path",{strokeWidth:"1.25",d:"M9.167 5.833H5.833c-1.254 0-2.5 1.282-2.5 2.5v5.834c0 1.283 1.252 2.5 2.5 2.5h5.834c1.251 0 2.5-1.25 2.5-2.5v-3.334M8.333 11.667l8.334-8.334M12.5 3.333h4.167V7.5"}),ne),Q1=k(u("path",{d:"M7.5 15.833c-3.583 1.167-3.583-2.083-5-2.5m10 4.167v-2.917c0-.833.083-1.166-.417-1.666 2.334-.25 4.584-1.167 4.584-5a3.833 3.833 0 0 0-1.084-2.667 3.5 3.5 0 0 0-.083-2.667s-.917-.25-2.917 1.084a10.25 10.25 0 0 0-5.166 0C5.417 2.333 4.5 2.583 4.5 2.583a3.5 3.5 0 0 0-.083 2.667 3.833 3.833 0 0 0-1.084 2.667c0 3.833 2.25 4.75 4.584 5-.5.5-.5 1-.417 1.666V17.5",strokeWidth:"1.25"}),ne),eE=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M7.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM12.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM6.25 6.25c2.917-.833 4.583-.833 7.5 0M5.833 13.75c2.917.833 5.417.833 8.334 0"}),u("path",{d:"M12.917 14.167c0 .833 1.25 2.5 1.666 2.5 1.25 0 2.361-1.39 2.917-2.5.556-1.39.417-4.861-1.25-9.584-1.214-.846-2.5-1.116-3.75-1.25l-.833 2.084M7.083 14.167c0 .833-1.13 2.5-1.526 2.5-1.191 0-2.249-1.39-2.778-2.5-.529-1.39-.397-4.861 1.19-9.584 1.157-.846 2.318-1.116 3.531-1.25l.833 2.084"})]}),ne),tE=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 4l11.733 16h4.267l-11.733 -16z"}),u("path",{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"})]}),O),Ls=k(u("polyline",{fill:"none",stroke:"currentColor",points:"20 6 9 17 4 12"}),{width:24,height:24}),Ra=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M8.333 11.667a2.917 2.917 0 0 0 4.167 0l3.333-3.334a2.946 2.946 0 1 0-4.166-4.166l-.417.416"}),u("path",{d:"M11.667 8.333a2.917 2.917 0 0 0-4.167 0l-3.333 3.334a2.946 2.946 0 0 0 4.166 4.166l.417-.416"})]}),ne),oE=k("M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z",{width:448,height:512}),nE=k("M252 54L203 8a28 27 0 00-20-8H28C12 0 0 12 0 27v195c0 15 12 26 28 26h204c15 0 28-11 28-26V73a28 27 0 00-8-19zM130 213c-21 0-37-16-37-36 0-19 16-35 37-35 20 0 37 16 37 35 0 20-17 36-37 36zm56-169v56c0 4-4 6-7 6H44c-4 0-7-2-7-6V42c0-4 3-7 7-7h133l4 2 3 2a7 7 0 012 5z M296 201l87 95-188 205-78 9c-10 1-19-8-18-20l9-84zm141-14l-41-44a31 31 0 00-46 0l-38 41 87 95 38-42c13-14 13-36 0-50z",{width:448,height:512}),Ds=k(u("path",{d:"m9.257 6.351.183.183H15.819c.34 0 .727.182 1.051.506.323.323.505.708.505 1.05v5.819c0 .316-.183.7-.52 1.035-.337.338-.723.522-1.037.522H4.182c-.352 0-.74-.181-1.058-.5-.318-.318-.499-.705-.499-1.057V5.182c0-.351.181-.736.5-1.054.32-.321.71-.503 1.057-.503H6.53l2.726 2.726Z",strokeWidth:"1.25"}),ne),OU=k("M384 112v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h80c0-35.29 28.71-64 64-64s64 28.71 64 64h80c26.51 0 48 21.49 48 48zM192 40c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24m96 114v-20a6 6 0 0 0-6-6H102a6 6 0 0 0-6 6v20a6 6 0 0 0 6 6h180a6 6 0 0 0 6-6z",{width:384,height:512}),zU=k("M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"),rE=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z"}),u("path",{d:"M13.737 9.737c2.299 -2.3 3.23 -5.095 2.081 -6.245c-1.15 -1.15 -3.945 -.217 -6.244 2.082c-2.3 2.299 -3.231 5.095 -2.082 6.244c1.15 1.15 3.946 .218 6.245 -2.081z"}),u("path",{d:"M7.492 11.818c.362 .362 .768 .676 1.208 .934l6.895 4.047c1.078 .557 2.255 -.075 3.692 -1.512c1.437 -1.437 2.07 -2.614 1.512 -3.692c-.372 -.718 -1.72 -3.017 -4.047 -6.895a6.015 6.015 0 0 0 -.934 -1.208"})]}),O),iE=k(u("g",{strokeWidth:1.5,children:u("path",{d:"M6 18l12 -12"})}),O),aE=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15 8h.01"}),u("path",{d:"M12 20h-5a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v5"}),u("path",{d:"M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4"}),u("path",{d:"M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598"}),u("path",{d:"M19 16v6"}),u("path",{d:"M22 19l-3 3l-3 -3"})]}),O),lE=k("M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z",{width:512,height:512}),HU=k("M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),GU=k("M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z",{width:448,height:512}),sE=k("M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"),UU=k("M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"),Fm=k(u("path",{d:"M7.5 10.833 4.167 7.5 7.5 4.167M4.167 7.5h9.166a3.333 3.333 0 0 1 0 6.667H12.5",strokeWidth:"1.25"}),ne),Om=k(u("path",{d:"M12.5 10.833 15.833 7.5 12.5 4.167M15.833 7.5H6.667a3.333 3.333 0 1 0 0 6.667H7.5",strokeWidth:"1.25"}),ne),cE=k("M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z",{mirror:!0}),dE=k(u("path",{d:"M5 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 17.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM7.25 8.917l5.5-2.834M7.25 11.083l5.5 2.834",strokeWidth:"1.5"}),ne),WU=k("M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"),YU=k("M16 5l-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z",{width:24,height:24}),VU=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1"}),u("path",{d:"M12 14v-11"}),u("path",{d:"M9 6l3 -3l3 3"})]}),O),XU=k(D(ve,{children:[u("path",{fill:"currentColor",d:"M40 5.6v6.1l-4.1.7c-8.9 1.4-16.5 6.9-20.6 15C13 32 10.9 43 12.4 43c.4 0 2.4-1.3 4.4-3 5-3.9 12.1-7 18.2-7.7l5-.6v12.8l11.2-11.3L62.5 22 51.2 10.8 40-.5v6.1zm10.2 22.6L44 34.5v-6.8l-6.9.6c-3.9.3-9.8 1.7-13.2 3.1-3.5 1.4-6.5 2.4-6.7 2.2-.9-1 3-7.5 6.4-10.8C28 18.6 34.4 16 40.1 16c3.7 0 3.9-.1 3.9-3.2V9.5l6.2 6.3 6.3 6.2-6.3 6.2z"}),u("path",{stroke:"currentColor",fill:"currentColor",d:"M0 36v20h48v-6.2c0-6 0-6.1-2-4.3-1.1 1-2 2.9-2 4.2V52H4V34c0-17.3-.1-18-2-18s-2 .7-2 20z"})]}),{width:64,height:64}),KU=k(u("path",{stroke:"currentColor",strokeWidth:"40",fill:"currentColor",d:"M148 560a318 318 0 0 0 522 110 316 316 0 0 0 0-450 316 316 0 0 0-450 0c-11 11-21 22-30 34v4h47c25 0 46 21 46 46s-21 45-46 45H90c-13 0-25-6-33-14-9-9-14-20-14-33V156c0-25 20-45 45-45s45 20 45 45v32l1 1a401 401 0 0 1 623 509l212 212a42 42 0 0 1-59 59L698 757A401 401 0 0 1 65 570a42 42 0 0 1 83-10z"}),{width:1024}),mE=D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 10l0 10"}),u("path",{d:"M12 10l4 4"}),u("path",{d:"M12 10l-4 4"}),u("path",{d:"M4 4l16 0"})]}),pE=D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 5l0 14"}),u("path",{d:"M16 9l-4 -4"}),u("path",{d:"M8 9l4 -4"})]}),zm=k(pE,O),Hm=k(pE,{...O,style:{transform:"rotate(180deg)"}}),Gm=k(mE,O),Um=k(mE,{...O,style:{transform:"rotate(180deg)"}}),Wm=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M3.333 3.333h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v7.083c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V8.125c0-.92-.746-1.667-1.666-1.667ZM6.875 6.458h-.417c-.92 0-1.666.747-1.666 1.667v3.75c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667v-3.75c0-.92-.747-1.667-1.667-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),Ym=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M6.875 3.125h-.417c-.92 0-1.666.746-1.666 1.667v7.083c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667V4.792c0-.92-.747-1.667-1.667-1.667ZM13.542 5.817h-.417c-.92 0-1.667.747-1.667 1.667v4.391c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V7.484c0-.92-.746-1.667-1.666-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),Vm=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M15.208 4.792H8.125c-.92 0-1.667.746-1.667 1.666v.417c0 .92.747 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM12.516 11.458H8.125c-.92 0-1.667.746-1.667 1.667v.417c0 .92.747 1.666 1.667 1.666h4.391c.92 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.667-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),Xm=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M16.667 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M11.875 4.792H4.792c-.92 0-1.667.746-1.667 1.666v.417c0 .92.746 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM11.683 11.458H7.292c-.92 0-1.667.746-1.667 1.667v.417c0 .92.746 1.666 1.667 1.666h4.39c.921 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.666-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),uE=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M16.667 3.333v13.334M3.333 3.333v13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M14.375 10.208v-.416c0-.92-.746-1.667-1.667-1.667H7.292c-.92 0-1.667.746-1.667 1.667v.416c0 .92.746 1.667 1.667 1.667h5.416c.92 0 1.667-.746 1.667-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),hE=k(D(ve,{children:[D("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M3.333 3.333h13.334M3.333 16.667h13.334",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M10.208 5.625h-.416c-.92 0-1.667.746-1.667 1.667v5.416c0 .92.746 1.667 1.667 1.667h.416c.92 0 1.667-.746 1.667-1.667V7.292c0-.92-.746-1.667-1.667-1.667Z"})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),Km=k(D("g",{stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M1.667 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M8.333 10h3.334",strokeLinejoin:"round"}),u("path",{d:"M15.417 10h2.916",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M6.875 4.792h-.417c-.92 0-1.666.746-1.666 1.666v7.084c0 .92.746 1.666 1.666 1.666h.417c.92 0 1.667-.746 1.667-1.666V6.458c0-.92-.747-1.666-1.667-1.666ZM13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v3.75c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667v-3.75c0-.92-.746-1.667-1.666-1.667Z"})]}),ne),Zm=k(D("g",{stroke:"currentColor",strokeWidth:"1.25",children:[u("path",{d:"M10 18.333v-2.916",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M10 11.667V8.333",strokeLinejoin:"round"}),u("path",{d:"M10 4.583V1.667",strokeLinecap:"round",strokeLinejoin:"round"}),u("path",{d:"M4.792 13.125v.417c0 .92.746 1.666 1.666 1.666h7.084c.92 0 1.666-.746 1.666-1.666v-.417c0-.92-.746-1.667-1.666-1.667H6.458c-.92 0-1.666.746-1.666 1.667ZM6.458 6.458v.417c0 .92.747 1.667 1.667 1.667h3.75c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666h-3.75c-.92 0-1.667.746-1.667 1.666Z"})]}),ne),_s=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("circle",{cx:"9",cy:"7",r:"4"}),u("path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"}),u("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"}),u("path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85"})]}),O),ZU=k("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z"),$U=k("M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z"),xo=k(D(ve,{children:[u("g",{clipPath:"url(#a)",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:u("path",{d:"M15 5 5 15M5 5l10 10"})}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),jU=k("M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z",{mirror:!0}),qU=k("M11.553 22.894a.998.998 0 00.894 0s3.037-1.516 5.465-4.097C19.616 16.987 21 14.663 21 12V5a1 1 0 00-.649-.936l-8-3a.998.998 0 00-.702 0l-8 3A1 1 0 003 5v7c0 2.663 1.384 4.987 3.088 6.797 2.428 2.581 5.465 4.097 5.465 4.097zm-1.303-8.481l6.644-6.644a.856.856 0 111.212 1.212l-7.25 7.25a.856.856 0 01-1.212 0l-3.75-3.75a.856.856 0 111.212-1.212l3.144 3.144z",{width:24}),JU=k("M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z",{width:384,height:512}),$m=Xe.memo(({theme:e})=>k(D(ve,{children:[u("path",{d:"M25 26H111V111H25",fill:io(e)}),u("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:io(e),strokeWidth:"2"}),u("path",{d:"M100 100H160V160H100",fill:io(e)}),u("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:io(e),strokeWidth:"2"}),D("g",{fill:z1(e),stroke:io(e),strokeWidth:"6",children:[u("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),u("rect",{x:"2.5",y:"149.5",width:"30",height:"30"}),u("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),u("rect",{x:"147.5",y:"2.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),jm=Xe.memo(({theme:e})=>k(D(ve,{children:[u("path",{d:"M25 26H111V111H25",fill:io(e)}),u("path",{d:"M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z",stroke:io(e),strokeWidth:"2"}),u("path",{d:"M100 100H160V160H100",fill:io(e)}),u("path",{d:"M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z",stroke:io(e),strokeWidth:"2"}),D("g",{fill:z1(e),stroke:io(e),strokeWidth:"6",children:[u("rect",{x:"2.5",y:"2.5",width:"30",height:"30"}),u("rect",{x:"78.5",y:"149.5",width:"30",height:"30"}),u("rect",{x:"147.5",y:"149.5",width:"30",height:"30"}),u("rect",{x:"147.5",y:"78.5",width:"30",height:"30"}),u("rect",{x:"105.5",y:"2.5",width:"30",height:"30"}),u("rect",{x:"2.5",y:"102.5",width:"30",height:"30"})]})]}),{width:182,height:182,mirror:!0})),gE=k(u("g",{strokeWidth:1.25,children:u("path",{d:"M5.879 2.625h8.242a3.27 3.27 0 0 1 3.254 3.254v8.242a3.27 3.27 0 0 1-3.254 3.254H5.88a3.27 3.27 0 0 1-3.254-3.254V5.88A3.27 3.27 0 0 1 5.88 2.626l-.001-.001ZM4.518 16.118l7.608-12.83m.198 13.934 5.051-9.897M2.778 9.675l9.348-6.387m-7.608 12.83 12.857-8.793"})}),ne),fE=k(D(ve,{children:[u("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),u("mask",{id:"FillHachureIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:2,y:2,width:16,height:16,children:u("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.25"})}),u("g",{mask:"url(#FillHachureIcon)",children:u("path",{d:"M2.258 15.156 15.156 2.258M7.324 20.222 20.222 7.325m-20.444 5.35L12.675-.222m-8.157 18.34L17.416 5.22",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})]}),ne),EE=k(D(ve,{children:[D("g",{clipPath:"url(#a)",children:[u("path",{d:"M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z",stroke:"currentColor",strokeWidth:"1.25"}),u("mask",{id:"FillCrossHatchIcon",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:-1,y:-1,width:22,height:22,children:u("path",{d:"M2.426 15.044 15.044 2.426M7.383 20 20 7.383M0 12.617 12.617 0m-7.98 17.941L17.256 5.324m-2.211 12.25L2.426 4.956M20 12.617 7.383 0m5.234 20L0 7.383m17.941 7.98L5.324 2.745",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),u("g",{mask:"url(#FillCrossHatchIcon)",children:u("path",{d:"M14.121 2H5.88A3.879 3.879 0 0 0 2 5.879v8.242A3.879 3.879 0 0 0 5.879 18h8.242A3.879 3.879 0 0 0 18 14.121V5.88A3.879 3.879 0 0 0 14.121 2Z",fill:"currentColor"})})]}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),xE=k(D(ve,{children:[u("g",{clipPath:"url(#a)",children:u("path",{d:"M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z",stroke:"currentColor",strokeWidth:"1.25"})}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),{...ne,fill:"currentColor"}),qm=k(u(ve,{children:u("path",{d:"M4.167 10h11.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),ne),bE=k(u("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),ne),yE=k(u("path",{d:"M5 10h10",stroke:"currentColor",strokeWidth:"3.75",strokeLinecap:"round",strokeLinejoin:"round"}),ne),QU=Xe.memo(({theme:e})=>k(u("path",{d:"M6 10H34",stroke:io(e),strokeWidth:2,fill:"none",strokeLinecap:"round"}),{width:40,height:20})),wE=k(D("g",{strokeWidth:"2",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 12h2"}),u("path",{d:"M17 12h2"}),u("path",{d:"M11 12h2"})]}),O),vE=k(D("g",{strokeWidth:"2",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 12v.01"}),u("path",{d:"M8 12v.01"}),u("path",{d:"M12 12v.01"}),u("path",{d:"M16 12v.01"}),u("path",{d:"M20 12v.01"})]}),O),TE=k(u("path",{d:"M2.5 12.038c1.655-.885 5.9-3.292 8.568-4.354 2.668-1.063.101 2.821 1.32 3.104 1.218.283 5.112-1.814 5.112-1.814",strokeWidth:"1.25"}),ne),IE=k(u("path",{d:"M2.5 12.563c1.655-.886 5.9-3.293 8.568-4.355 2.668-1.062.101 2.822 1.32 3.105 1.218.283 5.112-1.814 5.112-1.814m-13.469 2.23c2.963-1.586 6.13-5.62 7.468-4.998 1.338.623-1.153 4.11-.132 5.595 1.02 1.487 6.133-1.43 6.133-1.43",strokeWidth:"1.25"}),ne),CE=k(u("path",{d:"M2.5 11.936c1.737-.879 8.627-5.346 10.42-5.268 1.795.078-.418 5.138.345 5.736.763.598 3.53-1.789 4.235-2.147M2.929 9.788c1.164-.519 5.47-3.28 6.987-3.114 1.519.165 1 3.827 2.121 4.109 1.122.281 3.839-2.016 4.606-2.42",strokeWidth:"1.25"}),ne),SE=k(D("svg",{strokeWidth:"1.5",children:[u("path",{d:"M3.33334 9.99998V6.66665C3.33334 6.04326 3.33403 4.9332 3.33539 3.33646C4.95233 3.33436 6.06276 3.33331 6.66668 3.33331H10"}),u("path",{d:"M13.3333 3.33331V3.34331"}),u("path",{d:"M16.6667 3.33331V3.34331"}),u("path",{d:"M16.6667 6.66669V6.67669"}),u("path",{d:"M16.6667 10V10.01"}),u("path",{d:"M3.33334 13.3333V13.3433"}),u("path",{d:"M16.6667 13.3333V13.3433"}),u("path",{d:"M3.33334 16.6667V16.6767"}),u("path",{d:"M6.66666 16.6667V16.6767"}),u("path",{d:"M10 16.6667V16.6767"}),u("path",{d:"M13.3333 16.6667V16.6767"}),u("path",{d:"M16.6667 16.6667V16.6767"})]}),ne),kE=k(D("g",{strokeWidth:"1.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 12v-4a4 4 0 0 1 4 -4h4"}),u("line",{x1:"16",y1:"4",x2:"16",y2:"4.01"}),u("line",{x1:"20",y1:"4",x2:"20",y2:"4.01"}),u("line",{x1:"20",y1:"8",x2:"20",y2:"8.01"}),u("line",{x1:"20",y1:"12",x2:"20",y2:"12.01"}),u("line",{x1:"4",y1:"16",x2:"4",y2:"16.01"}),u("line",{x1:"20",y1:"16",x2:"20",y2:"16.01"}),u("line",{x1:"4",y1:"20",x2:"4",y2:"20.01"}),u("line",{x1:"8",y1:"20",x2:"8",y2:"20.01"}),u("line",{x1:"12",y1:"20",x2:"12",y2:"20.01"}),u("line",{x1:"16",y1:"20",x2:"16",y2:"20.01"}),u("line",{x1:"20",y1:"20",x2:"20",y2:"20.01"})]}),O),ME=Xe.memo(({flip:e=!1})=>k(D("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",opacity:.3,strokeWidth:2,fill:"none",strokeLinecap:"round",children:[u("path",{d:"M7,11 H19"}),u("path",{d:"M25,6 L33,16 M33,6 L25,16"})]}),mt)),PE=Xe.memo(({flip:e=!1})=>k(u("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:u("path",{d:"M7,11 H33 M23,5 L33,11 L23,17"})}),mt)),AE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",children:[u("path",{d:"M7,11 H23",strokeWidth:2,strokeLinecap:"round"}),u("path",{d:"M23,5 L35,11 L23,17 Z"})]}),mt)),LE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",children:[u("path",{d:"M7,11 H23"}),u("path",{d:"M23,5 L35,11 L23,17 Z"})]}),mt)),DE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",children:[u("path",{d:"M7,11 H25",strokeWidth:2,strokeLinecap:"round"}),u("circle",{cx:"29",cy:"11",r:"4"})]}),mt)),_E=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeWidth:2,children:[u("path",{d:"M7,11 H25",strokeLinecap:"round"}),u("circle",{cx:"29",cy:"11",r:"4"})]}),mt)),RE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"currentColor",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",children:[u("path",{d:"M7,11 H21",strokeWidth:2,strokeLinecap:"round"}),u("path",{d:"M21,11 L28,5 L35,11 L28,17 Z"})]}),mt)),NE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"none",transform:e?"translate(40, 0) scale(-1, 1)":"",strokeLinejoin:"round",strokeWidth:2,strokeLinecap:"round",children:[u("path",{d:"M7,11 H21"}),u("path",{d:"M21,11 L28,5 L35,11 L28,17 Z"})]}),mt)),BE=Xe.memo(({flip:e=!1})=>k(u("g",{transform:e?"translate(40, 0) scale(-1, 1)":"",stroke:"currentColor",strokeWidth:2,fill:"none",strokeLinecap:"round",children:u("path",{d:"M11,11 H31 M31,5 V17"})}),mt)),FE=Xe.memo(({flip:e=!1})=>k(u("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:u("path",{d:"M35,11 H7 M15,5 V17"})}),mt)),OE=Xe.memo(({flip:e=!1})=>k(u("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:u("path",{d:"M35,11 H7 M15,11 L7,5 M15,11 L7,17"})}),mt)),zE=Xe.memo(({flip:e=!1})=>k(u("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:u("path",{d:"M35,11 H7 M23,5 V17 M15,11 L7,5 M15,11 L7,17"})}),mt)),HE=Xe.memo(({flip:e=!1})=>k(u("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:u("path",{d:"M35,11 H7 M15,5 V17 M7,5 V17"})}),mt)),GE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:[u("path",{d:"M35,11 H19 M11,11 H7 M7,5 V17"}),u("circle",{cx:"15",cy:"11",r:"4"})]}),mt)),UE=Xe.memo(({flip:e=!1})=>k(D("g",{stroke:"currentColor",fill:"none",transform:e?"":"translate(40, 0) scale(-1, 1)",strokeLinejoin:"round",strokeWidth:2,children:[u("path",{d:"M35,11 H27 M19,11 H7 M15,11 L7,5 M15,11 L7,17"}),u("circle",{cx:"23",cy:"11",r:"4"})]}),mt)),WE=k(D(ve,{children:[u("g",{clipPath:"url(#a)",children:u("path",{d:"M14.167 6.667a3.333 3.333 0 0 0-3.334-3.334H9.167a3.333 3.333 0 0 0 0 6.667h1.666a3.333 3.333 0 0 1 0 6.667H9.167a3.333 3.333 0 0 1-3.334-3.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),YE=k(D(ve,{children:[u("g",{clipPath:"url(#a)",children:u("path",{d:"M5 16.667V3.333L10 15l5-11.667v13.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),VE=k(D(ve,{children:[u("g",{clipPath:"url(#a)",children:u("path",{d:"M5.833 3.333v13.334h8.334",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),u("defs",{children:u("clipPath",{id:"a",children:u("path",{fill:"#fff",d:"M0 0h20v20H0z"})})})]}),ne),XE=k(u(ve,{children:u("path",{d:"m1.667 3.333 6.666 13.334M8.333 3.333 1.667 16.667M11.667 3.333v13.334h6.666",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),ne),ar=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 7v-2h13v2"}),u("path",{d:"M10 5v14"}),u("path",{d:"M12 19h-4"}),u("path",{d:"M15 13v-1h6v1"}),u("path",{d:"M18 12v7"}),u("path",{d:"M17 19h2"})]}),O),KE=k(u(ve,{children:D("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M7 12h10"}),u("path",{d:"M7 5v14"}),u("path",{d:"M17 5v14"}),u("path",{d:"M15 19h4"}),u("path",{d:"M15 5h4"}),u("path",{d:"M5 19h4"}),u("path",{d:"M5 5h4"})]})}),O),Na=k(u(ve,{children:u("g",{stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",children:u("path",{d:"M5.833 16.667v-10a3.333 3.333 0 0 1 3.334-3.334h1.666a3.333 3.333 0 0 1 3.334 3.334v10M5.833 10.833h8.334"})})}),ne),NS=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M7 8l-4 4l4 4"}),u("path",{d:"M17 8l4 4l-4 4"}),u("path",{d:"M14 4l-4 16"})]}),O),Rs=NS,ZE=k(D("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),u("line",{x1:"4",y1:"12",x2:"12",y2:"12"}),u("line",{x1:"4",y1:"16",x2:"16",y2:"16"})]}),O),$E=k(D("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),u("line",{x1:"8",y1:"12",x2:"16",y2:"12"}),u("line",{x1:"6",y1:"16",x2:"18",y2:"16"})]}),O),jE=k(D("g",{stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"8",x2:"20",y2:"8"}),u("line",{x1:"10",y1:"12",x2:"20",y2:"12"}),u("line",{x1:"8",y1:"16",x2:"20",y2:"16"})]}),O),qE=Xe.memo(({theme:e})=>k(D("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"4",x2:"20",y2:"4"}),u("rect",{x:"9",y:"8",width:"6",height:"12",rx:"2"})]}),O)),JE=Xe.memo(({theme:e})=>k(D("g",{strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"20",x2:"20",y2:"20"}),u("rect",{x:"9",y:"4",width:"6",height:"12",rx:"2"})]}),O)),QE=Xe.memo(({theme:e})=>k(D("g",{strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("line",{x1:"4",y1:"12",x2:"9",y2:"12"}),u("line",{x1:"15",y1:"12",x2:"20",y2:"12"}),u("rect",{x:"9",y:"6",width:"6",height:"12",rx:"2"})]}),O)),Ns=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M21 19h-18l9 -15"}),u("path",{d:"M20.615 15.171h.015"}),u("path",{d:"M19.515 11.771h.015"}),u("path",{d:"M17.715 8.671h.015"}),u("path",{d:"M15.415 5.971h.015"})]}),O),eW=k(u("path",{d:"M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z",fill:"currentColor"}),{width:640,height:512}),tW=k(u("path",{d:"M480 416C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H150.6C133.7 480 117.4 473.3 105.4 461.3L25.37 381.3C.3786 356.3 .3786 315.7 25.37 290.7L258.7 57.37C283.7 32.38 324.3 32.38 349.3 57.37L486.6 194.7C511.6 219.7 511.6 260.3 486.6 285.3L355.9 416H480zM265.4 416L332.7 348.7L195.3 211.3L70.63 336L150.6 416L265.4 416z"})),Bs=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),u("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),u("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),u("path",{d:"M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47"})]}),O),Jm=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),u("path",{d:"M7 11l5 5l5 -5"}),u("path",{d:"M12 4l0 12"})]}),O),Ur=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"}),u("path",{d:"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2"})]}),O),e0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),u("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),u("path",{d:"M9.15 14.85l8.85 -10.85"}),u("path",{d:"M6 4l8.85 10.85"})]}),O),t0=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),u("path",{d:"M12 17l0 .01"}),u("path",{d:"M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"})]}),O),oW=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M7 4v16l13 -8z"})]}),O),nW=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",strokeWidth:"0",fill:"currentColor"})]}),O),o0=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 12l5 5l10 -10"})]}),O),n0=k(D(ve,{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z"}),u("path",{d:"M12 9v4"}),u("path",{d:"M12 17h.01"})]}),O),r0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M11 7l6 6"}),u("path",{d:"M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z"})]}),O),Wr=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 3l-4 7h8z"}),u("path",{d:"M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}),u("path",{d:"M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"})]}),O),bn=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 7l16 0"}),u("path",{d:"M4 17l16 0"}),u("path",{d:"M7 4l0 16"}),u("path",{d:"M17 4l0 16"})]}),O),rW=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"}),u("path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"})]}),O),iW=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 10l-2 1l8 4l8 -4l-2 -1"}),u("path",{d:"M4 15l8 4l8 -4"}),u("path",{d:"M12 4v7"}),u("path",{d:"M15 8l-3 3l-3 -3"})]}),O),aW=k(D("g",{strokeWidth:"1.25",children:[u("path",{d:"M4.16602 10H15.8327"}),u("path",{d:"M12.5 13.3333L15.8333 10"}),u("path",{d:"M12.5 6.66666L15.8333 9.99999"})]}),ne),Yr=k(D("g",{fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(90 10 10)",children:[u("path",{clipRule:"evenodd",d:"m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z"}),u("path",{d:"m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13"})]}),20),i0=k(D("g",{stroke:"currentColor",fill:"none",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z"}),u("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),u("path",{d:"M15 6l3 3"}),u("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),u("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),O),lW=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z"}),u("path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3"}),u("path",{d:"M15 6l3 3"}),u("path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"}),u("path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2"})]}),O),sW=k(D("g",{stroke:"currentColor",fill:"none",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35"}),u("path",{d:"M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946"}),u("path",{d:"M6 7.63c-1.391 -.236 -2.787 .395 -3.534 1.689a3.474 3.474 0 0 0 1.271 4.745l4.263 2.514l6 -3.348"}),u("path",{d:"M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45"}),u("path",{d:"M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946"}),u("path",{d:"M18 16.302c1.391 .236 2.787 -.395 3.534 -1.689a3.474 3.474 0 0 0 -1.271 -4.745l-4.308 -2.514l-5.955 3.42"})]}),O),a0=k(D("g",{stroke:"currentColor",fill:"none",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),u("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),u("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),u("path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2"})]}),O),lr=k(D("g",{stroke:"currentColor",fill:"none",strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"}),u("path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"})]}),O),l0=k(D("g",{stroke:"currentColor",fill:"none",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"}),u("path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"}),u("path",{d:"M3 3l18 18"})]}),O),cW=k(D("g",{stroke:"currentColor",fill:"none",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),u("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),u("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),u("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),u("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),u("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),O),dW=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8"}),u("path",{d:"M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8"}),u("path",{d:"M17.5 16a3.5 3.5 0 0 0 0 -7h-.5"}),u("path",{d:"M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0"}),u("path",{d:"M6.5 16a3.5 3.5 0 0 1 0 -7h.5"}),u("path",{d:"M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10"})]}),O),bo=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),u("path",{d:"M21 21l-6 -6"})]}),O),mW=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M20.984 12.53a9 9 0 1 0 -7.552 8.355"}),u("path",{d:"M12 7v5l3 3"}),u("path",{d:"M19 16l-2 3h4l-2 3"})]}),O),pW=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 8l0 4l2 2"}),u("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]}),O),s0=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M9 2m0 3a3 3 0 0 1 3 -3h0a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3h0a3 3 0 0 1 -3 -3z"}),u("path",{d:"M5 10a7 7 0 0 0 14 0"}),u("path",{d:"M8 21l8 0"}),u("path",{d:"M12 17l0 4"})]}),O),c0=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 3l18 18"}),u("path",{d:"M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1 -.13 .874m-2 2a3 3 0 0 1 -3.87 -2.872v-1"}),u("path",{d:"M5 10a7 7 0 0 0 10.846 5.85m2 -2a6.967 6.967 0 0 0 1.152 -3.85"}),u("path",{d:"M8 21l8 0"}),u("path",{d:"M12 17l0 4"})]}),O),uW=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11"})]}),O),d0=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M8 8m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z"}),u("path",{d:"M12 20v.01"}),u("path",{d:"M16 20v.01"}),u("path",{d:"M8 20v.01"}),u("path",{d:"M4 20v.01"}),u("path",{d:"M4 16v.01"}),u("path",{d:"M4 12v.01"}),u("path",{d:"M4 8v.01"}),u("path",{d:"M4 4v.01"}),u("path",{d:"M8 4v.01"}),u("path",{d:"M12 4v.01"}),u("path",{d:"M16 4v.01"}),u("path",{d:"M20 4v.01"}),u("path",{d:"M20 8v.01"}),u("path",{d:"M20 12v.01"}),u("path",{d:"M20 16v.01"}),u("path",{d:"M20 20v.01"})]}),O),m0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 3v18"}),u("path",{d:"M19 21v-18"}),u("path",{d:"M5 7h14"}),u("path",{d:"M5 15h14"}),u("path",{d:"M8 13v4"}),u("path",{d:"M11 13v4"}),u("path",{d:"M16 13v4"}),u("path",{d:"M14 5v4"}),u("path",{d:"M11 5v4"}),u("path",{d:"M8 5v4"}),u("path",{d:"M3 21h18"})]}),O),p0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 12l18 0"}),u("path",{d:"M7 16l10 0l-10 5l0 -5"}),u("path",{d:"M7 8l10 0l-10 -5l0 5"})]}),O),u0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M12 3l0 18"}),u("path",{d:"M16 7l0 10l5 0l-5 -10"}),u("path",{d:"M8 7l0 10l-5 0l5 -10"})]}),O),Qm=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z"}),u("path",{d:"M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2"}),u("path",{d:"M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"})]}),O),Fs=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),u("path",{d:"M22 22l-3 -3"}),u("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),u("path",{d:"M3 11v-1"}),u("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),u("path",{d:"M10 3h1"}),u("path",{d:"M15 3h1a2 2 0 0 1 2 2v1"})]}),O),h0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),u("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),u("path",{d:"M4 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75"}),u("path",{d:"M10 15l2 6l2 -6"}),u("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"})]}),O),g0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),u("path",{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"}),u("path",{d:"M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3"}),u("path",{d:"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6"}),u("path",{d:"M11 21v-6l3 6v-6"})]}),O),Vr=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 13v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a2 2 0 0 0 6 0v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a8 8 0 0 1 -16 0"}),u("path",{d:"M4 8l5 0"}),u("path",{d:"M15 8l4 0"})]}),O),f0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 14c.83 .642 2.077 1.017 3.5 1c1.423 .017 2.67 -.358 3.5 -1c.83 -.642 2.077 -1.017 3.5 -1c1.423 -.017 2.67 .358 3.5 1"}),u("path",{d:"M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),u("path",{d:"M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2"}),u("path",{d:"M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z"}),u("path",{d:"M16.746 16.726a3 3 0 1 0 .252 -5.555"})]}),O),E0=k(D("g",{stroke:"currentColor",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-16a1 1 0 0 1-1-1v-10zM7 20h10M9 16v4M15 16v4"})]}),{...O,strokeWidth:1.5}),hW=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"}),u("path",{d:"M21 12h-13l3 -3"}),u("path",{d:"M11 15l-3 -3"})]}),O),gW=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z"}),u("path",{d:"M10 9l5 3l-5 3z"})]}),O),x0=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 6h18"}),u("path",{d:"M3 12h18"}),u("path",{d:"M3 18h18"}),u("path",{d:"M6 3v18"}),u("path",{d:"M12 3v18"}),u("path",{d:"M18 3v18"})]}),O),b0=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M17 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}),u("path",{d:"M3 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"}),u("path",{d:"M17 5c-6.627 0 -12 5.373 -12 12"})]}),O),Xr=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 18l12 -12"}),u("path",{d:"M18 10v-4h-4"})]}),O),Kr=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4,19L10,19C11.097,19 12,18.097 12,17L12,9C12,7.903 12.903,7 14,7L21,7"}),u("path",{d:"M18 4l3 3l-3 3"})]}),O),Zr=k(D("g",{children:[u("path",{d:"M16,12L20,9L16,6"}),u("path",{d:"M6 20c0 -6.075 4.925 -11 11 -11h3"})]}),O),Os=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 9l6 6l6 -6"})]}),O),y0=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 15l6 -6l6 6"})]}),O),w0=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 15l6 -6l6 6"})]}),O),ep=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M8 5v10a1 1 0 0 0 1 1h10"}),u("path",{d:"M5 8h10a1 1 0 0 1 1 1v10"})]}),O),zs=k(D("g",{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M5 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M19 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M5 7l0 10"}),u("path",{d:"M7 5l10 0"}),u("path",{d:"M7 19l10 0"}),u("path",{d:"M19 7l0 10"})]}),O),tp=k(D("g",{strokeWidth:"1.25",children:[u("rect",{x:"4",y:"4",width:"4",height:"4",rx:"1"}),u("rect",{x:"10",y:"4",width:"4",height:"4",rx:"1"}),u("rect",{x:"16",y:"4",width:"4",height:"4",rx:"1"}),u("rect",{x:"4",y:"10",width:"4",height:"4",rx:"1"}),u("rect",{x:"10",y:"10",width:"4",height:"4",rx:"1"}),u("rect",{x:"16",y:"10",width:"4",height:"4",rx:"1"}),u("rect",{x:"4",y:"16",width:"4",height:"4",rx:"1"}),u("rect",{x:"10",y:"16",width:"4",height:"4",rx:"1"}),u("rect",{x:"16",y:"16",width:"4",height:"4",rx:"1"})]}),O),op=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("rect",{x:"7",y:"6",width:"10",height:"8",rx:"1",strokeDasharray:"2 2"}),u("line",{x1:"3",y1:"6",x2:"3",y2:"14"}),u("polyline",{points:"2 8 3 6 4 8"}),u("polyline",{points:"2 12 3 14 4 12"}),u("line",{x1:"7",y1:"18",x2:"17",y2:"18"}),u("polyline",{points:"9 17 7 18 9 19"}),u("polyline",{points:"15 17 17 18 15 19"})]}),O),fW=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 11v8a1 1 0 0 0 1 1h8m-9 -14v-1a1 1 0 0 1 1 -1h1m5 0h2m5 0h1a1 1 0 0 1 1 1v1m0 5v2m0 5v1a1 1 0 0 1 -1 1h-1"}),u("path",{d:"M4 12h7a1 1 0 0 1 1 1v7"})]}),O),np=k(u("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:.5,viewBox:"0 0 640 512",children:u("path",{d:"M15 15C24.4 5.7 39.6 5.7 49 15l63 63L112 40c0-13.3 10.7-24 24-24s24 10.7 24 24l0 96c0 13.3-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l38.1 0L15 49C5.7 39.6 5.7 24.4 15 15zM133.5 243.9C158.6 193.6 222.7 112 320 112s161.4 81.6 186.5 131.9c3.8 7.6 3.8 16.5 0 24.2C481.4 318.4 417.3 400 320 400s-161.4-81.6-186.5-131.9c-3.8-7.6-3.8-16.5 0-24.2zM320 320a64 64 0 1 0 0-128 64 64 0 1 0 0 128zM591 15c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-63 63 38.1 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-96 0c-13.3 0-24-10.7-24-24l0-96c0-13.3 10.7-24 24-24s24 10.7 24 24l0 38.1 63-63zM15 497c-9.4-9.4-9.4-24.6 0-33.9l63-63L40 400c-13.3 0-24-10.7-24-24s10.7-24 24-24l96 0c13.3 0 24 10.7 24 24l0 96c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-38.1L49 497c-9.4 9.4-24.6 9.4-33.9 0zm576 0l-63-63 0 38.1c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-96c0-13.3 10.7-24 24-24l96 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-38.1 0 63 63c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0z"})})),v0=k(D("g",{strokeWidth:1.5,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 6l8 0"}),u("path",{d:"M16 6l4 0"}),u("path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 12l2 0"}),u("path",{d:"M10 12l10 0"}),u("path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 18l11 0"}),u("path",{d:"M19 18l1 0"})]}),O),T0=k(D("g",{strokeWidth:1,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M6 10l4 -4 L6 14l8 -8 L6 18l12 -12 L10 18l8 -8 L14 18l4 -4"})]}),O),BS=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),u("path",{d:"M13.5 6.5l4 4"})]}),O),EW=k(D("g",{strokeWidth:1,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M11 7l-5 5l5 5"}),u("path",{d:"M17 7l-5 5l5 5"})]}),O),I0=k(D("g",{strokeWidth:"1.75",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"}),u("path",{d:"M15 4l0 16"})]}),O),xW=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1"})]}),O),bW=k(D("g",{strokeWidth:"1.25",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M3 4l18 0"}),u("path",{d:"M4 4v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-10"}),u("path",{d:"M12 16l0 4"}),u("path",{d:"M9 20l6 0"}),u("path",{d:"M8 12l3 -3l2 2l3 -3"})]}),O),Hs=u("div",{style:{width:"1rem",height:"1rem"}}),C0=k(D("g",{strokeWidth:"1.5",children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("polyline",{points:"9 6 15 12 9 18"})]}),O),S0=k(D("g",{strokeWidth:1.25,children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 6l8 0"}),u("path",{d:"M16 6l4 0"}),u("path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 12l2 0"}),u("path",{d:"M10 12l10 0"}),u("path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),u("path",{d:"M4 18l11 0"}),u("path",{d:"M19 18l1 0"})]}),O);import k0 from"clsx";import ip,{useEffect as zS,useRef as M0,useState as HS}from"react";import{isPromiseLike as GS}from"@excalidraw/common";import FS from"react";import{jsx as rp}from"react/jsx-runtime";var OS=({size:e="1em",circleWidth:o=8,synchronized:t=!1,className:n=""})=>{let i=-(FS.useRef(Date.now()).current%1600);return rp("div",{className:`Spinner ${n}`,children:rp("svg",{viewBox:"0 0 100 100",style:{width:e,height:e,"--spinner-delay":t?`${i}ms`:0},children:rp("circle",{cx:"50",cy:"50",r:50-o/2,strokeWidth:o,fill:"none",strokeMiterlimit:"10"})})})},Yo=OS;import{jsx as Ba,jsxs as Fa}from"react/jsx-runtime";var V=ip.forwardRef(({size:e="medium",visible:o=!0,className:t="",...n},r)=>{let{id:i}=_e(),l=ip.useRef(null);ip.useImperativeHandle(r,()=>l.current);let a=`ToolIcon_size_${e}`,[s,c]=HS(!1),m=M0(!0),p=async h=>{let f="onClick"in n&&n.onClick?.(h);if(GS(f))try{c(!0),await f}catch(g){if(g instanceof us)console.warn(g);else throw g}finally{m.current&&c(!1)}};zS(()=>(m.current=!0,()=>{m.current=!1}),[]);let d=M0(null);if(n.type==="button"||n.type==="icon"||n.type==="submit"){let h=n.type==="icon"?"button":n.type;return Fa("button",{className:k0("ToolIcon_type_button",a,t,o&&!n.hidden?"ToolIcon_type_button--show":"ToolIcon_type_button--hide",{ToolIcon:!n.hidden,"ToolIcon--selected":n.selected,"ToolIcon--plain":n.type==="icon"}),style:n.style,"data-testid":n["data-testid"],hidden:n.hidden,title:n.title,"aria-label":n["aria-label"],type:h,onClick:p,ref:l,disabled:s||n.isLoading||!!n.disabled,children:[(n.icon||n.label)&&Fa("div",{className:"ToolIcon__icon","aria-hidden":"true","aria-disabled":!!n.disabled,children:[n.icon||n.label,n.keyBindingLabel&&Ba("span",{className:"ToolIcon__keybinding",children:n.keyBindingLabel}),n.isLoading&&Ba(Yo,{})]}),n.showAriaLabel&&Fa("div",{className:"ToolIcon__label",children:[n["aria-label"]," ",s&&Ba(Yo,{})]}),n.children]})}return Fa("label",{className:k0("ToolIcon",t),title:n.title,onPointerDown:h=>{d.current=h.pointerType||null,n.onPointerDown?.({pointerType:h.pointerType||null})},onPointerUp:()=>{requestAnimationFrame(()=>{d.current=null})},children:[Ba("input",{className:`ToolIcon_type_radio ${a}`,type:"radio",name:n.name,"aria-label":n["aria-label"],"aria-keyshortcuts":n["aria-keyshortcuts"],"data-testid":n["data-testid"],id:`${i}-${n.id}`,onChange:()=>{n.onChange?.({pointerType:d.current})},checked:n.checked,ref:l}),Fa("div",{className:"ToolIcon__icon",children:[n.icon,n.keyBindingLabel&&Ba("span",{className:"ToolIcon__keybinding",children:n.keyBindingLabel})]})]})});V.displayName="ToolButton";var Gs=[],N=e=>(Gs=Gs.concat(e),e);import{jsx as jS}from"react/jsx-runtime";var $S=(e,o,t)=>{let n=new Set(te(e.filter(m=>XS(m)),o).map(m=>m.id)),r={},i=t.scene.getNonDeletedElementsMap(),l=new Set;for(let m of n){let p=KS(e,m);for(let d of p)if(!l.has(d.id)){if(Us(d)){let h=A0(d,i);h&&(r[h.id]=!0)}else r[d.id]=!0;l.add(d.id)}}let a=!0,s=e.map(m=>{if(o.selectedElementIds[m.id]){let p=Us(m)?A0(m,i):null;return m.frameId&&n.has(m.frameId)?(a=!1,r[m.id]=!0,m):p?.frameId&&n.has(p?.frameId)?m:(m.boundElements&&m.boundElements.forEach(d=>{let h=t.scene.getNonDeletedElementsMap().get(d.id);h&&VS(h)&&t.scene.mutateElement(h,{startBinding:m.id===h.startBinding?.elementId?null:h.startBinding,endBinding:m.id===h.endBinding?.elementId?null:h.endBinding})}),Ys(m,{isDeleted:!0}))}return m.frameId&&n.has(m.frameId)?(a=!1,Us(m)||(r[m.id]=!0),Ys(m,{frameId:null})):Us(m)&&o.selectedElementIds[m.containerId]?Ys(m,{isDeleted:!0}):m}),c=o.editingGroupId;if(a&&o.editingGroupId){let m=sp(s,o.editingGroupId).filter(p=>!p.isDeleted);if(m.length>1)m[0]&&(r[m[0].id]=!0);else{c=null,m[0]&&(r[m[0].id]=!0);let p=m[0];if(p){let d=p.groupIds.findIndex(f=>f===o.editingGroupId),h=p.groupIds[d+1];if(h){let f=sp(s,h).filter(g=>!g.isDeleted);f.length>1&&(c=h,f.forEach(g=>{r[g.id]=!0}))}}}}return{elements:s,appState:{...o,...ZS({selectedElementIds:r,editingGroupId:c},s,o,null)}}},L0=(e,o)=>{if(e.editingGroupId){let t=sp(lp(o),e.editingGroupId);if(t.length)return{...e,selectedElementIds:{[t[0].id]:!0}}}return e},Oa=N({name:"deleteSelectedElements",label:"labels.delete",icon:ir,trackEvent:{category:"element",action:"delete"},perform:(e,o,t,n)=>{if(o.selectedLinearElement?.isEditing){let{elementId:l,selectedPointsIndices:a}=o.selectedLinearElement,s=n.scene.getNonDeletedElementsMap(),c=P0.getElement(l,s);if(!c||a==null)return!1;if(a.length>=c.points.length){let m=e.map(d=>d.id===c.id?Ys(d,{isDeleted:!0}):d),p=L0(o,m);return{elements:m,appState:{...p,selectedLinearElement:null},captureUpdate:Ws.IMMEDIATELY}}return P0.deletePoints(c,n,a),{elements:e,appState:{...o,selectedLinearElement:{...o.selectedLinearElement,selectedPointsIndices:a?.[0]>0?[a[0]-1]:[0]}},captureUpdate:Ws.IMMEDIATELY}}let{elements:r,appState:i}=$S(e,o,n);return YS(r,r.filter(l=>l.isDeleted)),i=L0(i,r),{elements:r,appState:{...i,activeTool:WS(o,{type:n.state.preferredSelectionTool.type}),multiElement:null,newElement:null,activeEmbeddable:null,selectedLinearElement:null},captureUpdate:we(lp(e),o)?Ws.IMMEDIATELY:Ws.EVENTUALLY}},keyTest:(e,o,t)=>(e.key===ap.BACKSPACE||e.key===ap.DELETE)&&!e[ap.CTRL_OR_CMD],PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>{let r=et()==="mobile";return jS(V,{type:"button",icon:ir,title:E("labels.delete"),"aria-label":E("labels.delete"),onClick:()=>t(null),disabled:!we(lp(e),o),style:{...r&&o.openPopup!=="compactOtherProperties"?US:{}}})}});import{KEYS as $r,CODES as jr,isDarwin as Vs}from"@excalidraw/common";import{moveOneLeft as qS,moveOneRight as JS,moveAllLeft as QS,moveAllRight as e5}from"@excalidraw/element";import{CaptureUpdateAction as Xs}from"@excalidraw/element";import{isDarwin as D0}from"@excalidraw/common";var L=e=>e.replace(/\b(Opt(?:ion)?|Alt)\b/i,D0?E("keys.option"):E("keys.alt")).replace(/\bShift\b/i,E("keys.shift")).replace(/\b(Enter|Return)\b/i,E("keys.enter")).replace(/\b(Ctrl|Cmd|Command|CtrlOrCmd)\b/gi,D0?E("keys.cmd"):E("keys.ctrl")).replace(/\b(Esc(?:ape)?)\b/i,E("keys.escape")).replace(/\b(Space(?:bar)?)\b/i,E("keys.spacebar")).replace(/\b(Del(?:ete)?)\b/i,E("keys.delete"));import{jsx as Ks}from"react/jsx-runtime";var cp=N({name:"sendBackward",label:"labels.sendBackward",keywords:["move down","zindex","layer"],icon:Hm,trackEvent:{category:"element"},perform:(e,o,t,n)=>({elements:qS(e,o,n.scene),appState:o,captureUpdate:Xs.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[$r.CTRL_OR_CMD]&&!e.shiftKey&&e.code===jr.BRACKET_LEFT,PanelComponent:({updateData:e,appState:o})=>Ks("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${E("labels.sendBackward")} \u2014 ${L("CtrlOrCmd+[")}`,children:Hm})}),dp=N({name:"bringForward",label:"labels.bringForward",keywords:["move up","zindex","layer"],icon:zm,trackEvent:{category:"element"},perform:(e,o,t,n)=>({elements:JS(e,o,n.scene),appState:o,captureUpdate:Xs.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[$r.CTRL_OR_CMD]&&!e.shiftKey&&e.code===jr.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:o})=>Ks("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${E("labels.bringForward")} \u2014 ${L("CtrlOrCmd+]")}`,children:zm})}),mp=N({name:"sendToBack",label:"labels.sendToBack",keywords:["move down","zindex","layer"],icon:Um,trackEvent:{category:"element"},perform:(e,o)=>({elements:QS(e,o),appState:o,captureUpdate:Xs.IMMEDIATELY}),keyTest:e=>Vs?e[$r.CTRL_OR_CMD]&&e.altKey&&e.code===jr.BRACKET_LEFT:e[$r.CTRL_OR_CMD]&&e.shiftKey&&e.code===jr.BRACKET_LEFT,PanelComponent:({updateData:e,appState:o})=>Ks("button",{type:"button",className:"zIndexButton",onClick:()=>e(null),title:`${E("labels.sendToBack")} \u2014 ${Vs?L("CtrlOrCmd+Alt+["):L("CtrlOrCmd+Shift+[")}`,children:Um})}),pp=N({name:"bringToFront",label:"labels.bringToFront",keywords:["move up","zindex","layer"],icon:Gm,trackEvent:{category:"element"},perform:(e,o)=>({elements:e5(e,o),appState:o,captureUpdate:Xs.IMMEDIATELY}),keyTest:e=>Vs?e[$r.CTRL_OR_CMD]&&e.altKey&&e.code===jr.BRACKET_RIGHT:e[$r.CTRL_OR_CMD]&&e.shiftKey&&e.code===jr.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:o})=>Ks("button",{type:"button",className:"zIndexButton",onClick:t=>e(null),title:`${E("labels.bringToFront")} \u2014 ${Vs?L("CtrlOrCmd+Alt+]"):L("CtrlOrCmd+Shift+]")}`,children:Gm})});import{getNonDeletedElements as t5}from"@excalidraw/element";import{LinearElementEditor as o5}from"@excalidraw/element/linearElementEditor";import{isLinearElement as n5,isTextElement as r5}from"@excalidraw/element";import{arrayToMap as i5,KEYS as _0}from"@excalidraw/common";import{selectGroupsForSelectedElements as a5}from"@excalidraw/element";import{CaptureUpdateAction as l5}from"@excalidraw/element";var up=N({name:"selectAll",label:"labels.selectAll",icon:d0,trackEvent:{category:"canvas"},viewMode:!1,perform:(e,o,t,n)=>{if(o.selectedLinearElement?.isEditing)return!1;let r=e.filter(i=>!i.isDeleted&&!(r5(i)&&i.containerId)&&!i.locked).reduce((i,l)=>(i[l.id]=!0,i),{});return{appState:{...o,...a5({editingGroupId:null,selectedElementIds:r},t5(e),o,n),selectedLinearElement:Object.keys(r).length===1&&n5(e[0])?new o5(e[0],i5(e)):null},captureUpdate:l5.IMMEDIATELY}},keyTest:e=>e[_0.CTRL_OR_CMD]&&e.key===_0.A});import{DEFAULT_GRID_SIZE as R0,KEYS as N0,MOBILE_ACTION_BUTTON_BG as s5,arrayToMap as B0}from"@excalidraw/common";import{getNonDeletedElements as F0}from"@excalidraw/element";import{LinearElementEditor as c5}from"@excalidraw/element/linearElementEditor";import{getSelectedElements as d5,getSelectionStateForElements as m5}from"@excalidraw/element";import{syncMovedIndices as p5}from"@excalidraw/element";import{duplicateElements as u5}from"@excalidraw/element";import{CaptureUpdateAction as O0}from"@excalidraw/element";import{jsx as h5}from"react/jsx-runtime";var hp=N({name:"duplicateSelection",label:"labels.duplicateSelection",icon:Aa,trackEvent:{category:"element"},perform:(e,o,t,n)=>{if(o.selectedElementsAreBeingDragged)return!1;if(o.selectedLinearElement?.isEditing)try{let l=c5.duplicateSelectedPoints(o,n.scene);return{elements:e,appState:l,captureUpdate:O0.IMMEDIATELY}}catch{return!1}let{duplicatedElements:r,elementsWithDuplicates:i}=u5({type:"in-place",elements:e,idsOfElementsToDuplicate:B0(d5(e,o,{includeBoundTextElement:!0,includeElementsInFrames:!0})),appState:o,randomizeSeed:!0,overrides:({origElement:l,origIdToDuplicateId:a})=>{let s=l.frameId&&a.get(l.frameId);return{x:l.x+R0/2,y:l.y+R0/2,frameId:s??l.frameId}}});if(n.props.onDuplicate&&i){let l=n.props.onDuplicate(i,e);l&&(i=l)}return{elements:p5(i,B0(r)),appState:{...o,...m5(r,F0(i),o)},captureUpdate:O0.IMMEDIATELY}},keyTest:e=>e[N0.CTRL_OR_CMD]&&e.key===N0.D,PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>{let r=et()==="mobile";return h5(V,{type:"button",icon:Aa,title:`${E("labels.duplicateSelection")} \u2014 ${L("CtrlOrCmd+D")}`,"aria-label":E("labels.duplicateSelection"),onClick:()=>t(null),disabled:!we(F0(e),o),style:{...r&&o.openPopup!=="compactOtherProperties"?s5:{}}})}});import{pointFrom as y6}from"@excalidraw/math";import{useEffect as Bp,useMemo as Hp,useRef as Fp,useState as w6}from"react";import{DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE as v6,DEFAULT_ELEMENT_BACKGROUND_PICKS as T6,DEFAULT_ELEMENT_STROKE_COLOR_PALETTE as I6,DEFAULT_ELEMENT_STROKE_PICKS as C6,ARROW_TYPE as Xt,DEFAULT_FONT_FAMILY as S6,DEFAULT_FONT_SIZE as k6,FONT_FAMILY as M6,ROUNDNESS as pc,STROKE_WIDTH as Op,VERTICAL_ALIGN as dc,KEYS as li,randomInteger as P6,arrayToMap as Gp,getFontFamilyString as A6,getLineHeight as L6,isTransparent as D6,reduceToCommonValue as _6,invariant as Up,FONT_SIZES as mc}from"@excalidraw/common";import{canBecomePolygon as R6,getNonDeletedElements as Lx}from"@excalidraw/element";import{bindBindingElement as Sx,calculateFixedPointForElbowArrowBinding as kx,updateBoundElements as N6}from"@excalidraw/element";import{LinearElementEditor as sr}from"@excalidraw/element/linearElementEditor";import{newElementWith as qe}from"@excalidraw/element";import{getArrowheadForPicker as Mx}from"@excalidraw/element";import{getBoundTextElement as Mn,redrawTextBoundingBox as ja}from"@excalidraw/element";import{isArrowElement as uc,isBoundToContainer as B6,isElbowArrow as Dx,isLinearElement as zp,isLineElement as Px,isTextElement as Tt,isUsingAdaptiveRadius as F6}from"@excalidraw/element";import{hasStrokeColor as O6}from"@excalidraw/element";import{updateElbowArrowPoints as z6,CaptureUpdateAction as Je,toggleLinePolygonState as H6}from"@excalidraw/element";import{deriveStylesPanelMode as G6}from"@excalidraw/common";import{isDevEnv as g5}from"@excalidraw/common";var f5=new Set(["command_palette","export"]),de=(e,o,t,n)=>{try{if(typeof window>"u"||C.VITE_WORKER_ID||C.VITE_APP_ENABLE_TRACKING!=="true"||!f5.has(e)||g5())return;C.PROD||console.info("trackEvent",{category:e,action:o,label:t,value:n}),window.sa_event&&window.sa_event(o,{category:e,label:t,value:n})}catch(r){console.error("error during analytics",r)}};import y5 from"clsx";import E5 from"clsx";import{forwardRef as x5}from"react";import{jsx as b5}from"react/jsx-runtime";var qr=x5((e,o)=>{let{title:t,className:n,testId:r,active:i,standalone:l,icon:a,onClick:s}=e;return b5("button",{type:"button",ref:o,title:t,"data-testid":r,className:E5(n,{standalone:l,active:i}),onClick:s,style:e.style,children:a},t)});import{Fragment as v5,jsx as gp,jsxs as w5}from"react/jsx-runtime";var Wt=e=>gp(v5,{children:e.options.map(o=>e.type==="button"?gp(qr,{icon:o.icon,title:o.text,testId:o.testId,active:o.active??e.value===o.value,onClick:t=>e.onClick(o.value,t)},o.text):w5("label",{className:y5({active:e.value===o.value}),title:o.text,children:[gp("input",{type:"radio",name:e.group,onChange:()=>e.onChange(o.value),checked:e.value===o.value,"data-testid":o.testId}),o.icon]},o.text))});import{Popover as rx}from"radix-ui";import ix from"clsx";import{useRef as ax,useEffect as I4}from"react";import{COLOR_OUTLINE_CONTRAST_THRESHOLD as ox,COLOR_PALETTE as lx,isColorDark as nx,isWritableElement as C4}from"@excalidraw/common";import{jsx as T5}from"react/jsx-runtime";var Zs=()=>T5("div",{style:{width:1,height:"1rem",backgroundColor:"var(--default-border-color)",margin:"0 auto"}});import{useEffect as M5,useRef as P5}from"react";import{createPortal as A5}from"react-dom";import{EVENT as yn,KEYS as L5,rgbToHex as D5}from"@excalidraw/common";import z0 from"react";var fp=z0.createContext(null),he=()=>z0.useContext(fp);import{useState as I5,useLayoutEffect as H0}from"react";import{THEME as C5}from"@excalidraw/common";var $s=e=>{let[o,t]=I5(null),n=me(),{theme:r}=he(),{container:i}=_e();return H0(()=>{o&&(o.className="",o.classList.add("excalidraw",...e?.className?.split(/\s+/)||[]),o.classList.toggle("excalidraw--mobile",n.formFactor==="phone"),o.classList.toggle("theme--dark",r===C5.DARK))},[o,r,n.formFactor,e?.className]),H0(()=>{let l=e?.parentSelector?i?.querySelector(e.parentSelector):document.body;if(!l)return;let a=document.createElement("div");return l.appendChild(a),t(a),()=>{l.removeChild(a)}},[i,e?.parentSelector]),o};import{useEffect as S5}from"react";import{EVENT as js}from"@excalidraw/common";function Jr(e,o,t){S5(()=>{function n(r){let i=r;if(!e.current)return;let l=t?.(i,e.current);if(l===!0)return;if(l===!1)return o(i);e.current.contains(i.target)||!document.documentElement.contains(i.target)||i.target.closest("[data-radix-portal]")||i.target===document.documentElement&&document.body.style.pointerEvents==="none"||i.target.closest("[data-prevent-outside-click]")||o(i)}return document.addEventListener(js.POINTER_DOWN,n),document.addEventListener(js.TOUCH_START,n),()=>{document.removeEventListener(js.POINTER_DOWN,n),document.removeEventListener(js.TOUCH_START,n)}},[e,o,t])}import{useRef as k5}from"react";var Qr=e=>{let o=k5(e);return Object.assign(o.current,e),o.current};import{jsx as _5}from"react/jsx-runtime";var wn=je(null),G0=({onCancel:e,onChange:o,onSelect:t,colorPickerType:n})=>{let r=$s({className:"excalidraw-eye-dropper-backdrop",parentSelector:".excalidraw-eye-dropper-container"}),i=he(),l=ei(),a=vt(),s=te(l,i),c=Qr({app:a,onCancel:e,onChange:o,onSelect:t,selectedElements:s}),{container:m}=_e();M5(()=>{let d=p.current;if(!d||!a.canvas||!r)return;let h=!1,f=a.canvas.getContext("2d"),g=({clientX:S,clientY:P})=>{let M=f.getImageData((S-i.offsetLeft)*window.devicePixelRatio,(P-i.offsetTop)*window.devicePixelRatio,1,1).data;return D5(M[0],M[1],M[2])},b=({clientX:S,clientY:P,altKey:M})=>{d.style.top=`${P+20}px`,d.style.left=`${S+20}px`;let _=g({clientX:S,clientY:P});h&&c.onChange(n,_,c.selectedElements,{altKey:M}),d.style.background=_},y=()=>{c.onCancel()},v=(S,P)=>{c.onSelect(S,P)},x=S=>{h=!0,S.stopImmediatePropagation()},w=S=>{h=!1,m?.focus(),S.stopImmediatePropagation(),S.preventDefault(),v(g(S),S)},T=S=>{S.key===L5.ESCAPE&&(S.preventDefault(),S.stopImmediatePropagation(),y())};return r.tabIndex=-1,r.focus(),b({clientX:c.app.lastViewportPosition.x,clientY:c.app.lastViewportPosition.y,altKey:!1}),r.addEventListener(yn.KEYDOWN,T),r.addEventListener(yn.POINTER_DOWN,x),r.addEventListener(yn.POINTER_UP,w),window.addEventListener("pointermove",b,{passive:!0}),window.addEventListener(yn.BLUR,y),()=>{h=!1,r.removeEventListener(yn.KEYDOWN,T),r.removeEventListener(yn.POINTER_DOWN,x),r.removeEventListener(yn.POINTER_UP,w),window.removeEventListener("pointermove",b),window.removeEventListener(yn.BLUR,y)}},[c,a.canvas,r,n,m,i.offsetLeft,i.offsetTop]);let p=P5(null);return Jr(p,()=>{e()},d=>!!d.target.closest(".excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop")),r?A5(_5("div",{ref:p,className:"excalidraw-eye-dropper-preview"}),r):null};import{Popover as Ep}from"radix-ui";import F5 from"clsx";import O5 from"react";import{isInteractive as z5}from"@excalidraw/common";import R5 from"react";import N5 from"clsx";import{jsx as B5}from"react/jsx-runtime";var Oe=R5.forwardRef(({children:e,padding:o,className:t,style:n},r)=>B5("div",{className:N5("Island",t),style:{"--padding":o,...n},ref:r,children:e}));import{jsx as xp,jsxs as H5}from"react/jsx-runtime";var Vo=O5.forwardRef(({className:e,container:o,children:t,style:n,onClose:r,onKeyDown:i,onFocusOutside:l,onPointerLeave:a,onPointerDownOutside:s,preventAutoFocusOnTouch:c=!1},m)=>{let p=me(),d=p.formFactor==="phone"&&!p.isLandscape;return xp(Ep.Portal,{container:o,children:H5(Ep.Content,{ref:m,className:F5("focus-visible-none",e),"data-prevent-outside-click":!0,side:d?"bottom":"right",align:d?"center":"start",alignOffset:-16,sideOffset:20,collisionBoundary:o??void 0,style:{zIndex:"var(--zIndex-ui-styles-popup)",marginLeft:p.formFactor==="phone"?"0.5rem":void 0},onPointerLeave:a,onKeyDown:i,onFocusOutside:l,onPointerDownOutside:s,onOpenAutoFocus:h=>{c&&p.isTouchScreen&&h.preventDefault()},onCloseAutoFocus:h=>{h.stopPropagation(),h.preventDefault(),o&&!z5(document.activeElement)&&o.focus(),r()},children:[xp(Oe,{padding:3,style:n,children:t}),xp(Ep.Arrow,{width:20,height:10,style:{fill:"var(--popup-bg-color)",filter:"drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)"}})]})})});import{useState as G5,useCallback as bp}from"react";var qs=()=>document.querySelector(".excalidraw-wysiwyg"),Js=()=>{let e=qs();return e?{start:e.selectionStart,end:e.selectionEnd}:null},za=e=>{setTimeout(()=>{let o=qs();o&&(o.focus(),e&&(o.selectionStart=e.start,o.selectionEnd=e.end))},0)},Ha=(e,o,t,n)=>{o&&n&&n();let r=o&&t?Js():null;e(),o&&t&&za(r)},U0=()=>{let[e,o]=G5(null),t=bp(()=>{let i=Js();o(i)},[]),n=bp(()=>{setTimeout(()=>{let i=qs();i&&(i.focus(),e&&(i.selectionStart=e.start,i.selectionEnd=e.end,o(null)))},0)},[e]),r=bp(()=>{o(null)},[]);return{saveCaretPosition:t,restoreCaretPosition:n,clearSavedPosition:r,hasSavedPosition:!!e}},W0=(e=100)=>{let o=qs();if(o){let t=o.onblur;o.onblur=null,setTimeout(()=>{o.onblur=t},e)}};import W5 from"clsx";import{useCallback as Y5,useEffect as wp,useRef as V0,useState as V5}from"react";import{KEYS as vp,normalizeInputColor as X5}from"@excalidraw/common";import{MAX_CUSTOM_COLORS_USED_IN_CANVAS as U5}from"@excalidraw/common";var vn=({palette:e,color:o})=>{if(!o)return null;for(let[t,n]of Object.entries(e))if(Array.isArray(n)){let r=n.indexOf(o);if(r>-1)return{colorName:t,shade:r}}else if(n===o)return{colorName:t,shade:null};return null},Ga=[["q","w","e","r","t"],["a","s","d","f","g"],["z","x","c","v","b"]].flat(),yp=({color:e,palette:o})=>!Object.values(o).flat().includes(e),Y0=(e,o,t)=>{let n={elementBackground:"backgroundColor",elementStroke:"strokeColor"},r=e.filter(l=>{if(l.isDeleted)return!1;let a=l[n[o]];return yp({color:a,palette:t})}),i=new Map;return r.forEach(l=>{let a=l[n[o]];i.has(a)?i.set(a,i.get(a)+1):i.set(a,1)}),[...i.entries()].sort((l,a)=>a[1]-l[1]).map(l=>l[0]).slice(0,U5)},Yt=je(null);import{Fragment as K5,jsx as Qs,jsxs as X0}from"react/jsx-runtime";var K0=({color:e,onChange:o,label:t,colorPickerType:n,placeholder:r})=>{let i=me(),[l,a]=V5(e),[s,c]=He(Yt);wp(()=>{a(e)},[e]);let m=Y5(g=>{let b=g.toLowerCase(),y=X5(b);y&&o(y),a(b)},[o]),p=V0(null),d=V0(null);wp(()=>{p.current&&p.current.focus()},[s]);let[h,f]=He(wn);return wp(()=>()=>{f(null)},[f]),X0("div",{className:"color-picker__input-label",children:[Qs("div",{className:"color-picker__input-hash",children:"#"}),Qs("input",{ref:s==="hex"?p:void 0,style:{border:0,padding:0},spellCheck:!1,className:"color-picker-input","aria-label":t,onChange:g=>{m(g.target.value)},value:(l||"").replace(/^#/,""),onBlur:()=>{a(e)},tabIndex:-1,onFocus:()=>c("hex"),onKeyDown:g=>{g.key!==vp.TAB&&(g.key===vp.ESCAPE&&d.current?.focus(),g.stopPropagation())},placeholder:r}),i.formFactor!=="phone"&&X0(K5,{children:[Qs("div",{style:{width:"1px",height:"1.25rem",backgroundColor:"var(--default-border-color)"}}),Qs("div",{ref:d,className:W5("excalidraw-eye-dropper-trigger",{selected:h}),onClick:()=>f(g=>g?null:{keepOpenOnAlt:!1,onSelect:b=>o(b),colorPickerType:n}),title:`${E("labels.eyeDropper")} \u2014 ${vp.I.toLocaleUpperCase()} or ${L("Alt")} `,children:r0})]})]})};import Sp,{useEffect as kp,useImperativeHandle as u4,useState as h4}from"react";import{EVENT as Q0}from"@excalidraw/common";import{DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX as g4,DEFAULT_ELEMENT_STROKE_COLOR_INDEX as f4,KEYS as E4}from"@excalidraw/common";import q5 from"clsx";import{useEffect as J5,useRef as Q5}from"react";import{isColorDark as Z5}from"@excalidraw/common";import{jsxs as j5}from"react/jsx-runtime";var $5=({color:e,keyLabel:o,isShade:t=!1})=>j5("div",{className:"color-picker__button__hotkey-label",style:{color:Z5(e)?"#fff":"#000"},children:[t&&"\u21E7",o]}),ti=$5;import{jsx as Tp,jsxs as e4}from"react/jsx-runtime";var Z0=({colors:e,color:o,onChange:t,label:n})=>{let[r,i]=He(Yt),l=Q5(null);return J5(()=>{l.current&&l.current.focus()},[o,r]),Tp("div",{className:"color-picker-content--default",children:e.map((a,s)=>e4("button",{ref:o===a?l:void 0,tabIndex:-1,type:"button",className:q5("color-picker__button color-picker__button--large has-outline",{active:o===a,"is-transparent":a==="transparent"||!a}),onClick:()=>{t(a),i("custom")},title:a,"aria-label":n,style:{"--swatch-color":a},children:[Tp("div",{className:"color-picker__button-outline"}),Tp(ti,{color:a,keyLabel:s+1})]},s))})};import t4 from"clsx";import{useEffect as o4,useRef as n4}from"react";import{jsx as Ip,jsxs as i4}from"react/jsx-runtime";var r4=({palette:e,color:o,onChange:t,activeShade:n,showHotKey:r=!0})=>{let i=vn({color:o,palette:e}),[l,a]=He(Yt),s=n4(null);return o4(()=>{s.current&&l==="baseColors"&&s.current.focus()},[i?.colorName,l]),Ip("div",{className:"color-picker-content--default",children:Object.entries(e).map(([c,m],p)=>{let d=(Array.isArray(m)?m[n]:m)||"transparent",h=Ga[p],f=E(`colors.${c.replace(/\d+/,"")}`,null,"");return i4("button",{ref:i?.colorName===c?s:void 0,tabIndex:-1,type:"button",className:t4("color-picker__button color-picker__button--large has-outline",{active:i?.colorName===c,"is-transparent":d==="transparent"||!d}),onClick:()=>{t(d),a("baseColors")},title:`${f}${d.startsWith("#")?` ${d}`:""} \u2014 ${h}`,"aria-label":`${f} \u2014 ${h}`,style:d?{"--swatch-color":d}:void 0,"data-testid":`color-${c}`,children:[Ip("div",{className:"color-picker__button-outline"}),r&&Ip(ti,{color:d,keyLabel:h})]},c)})})},$0=r4;import{jsx as l4}from"react/jsx-runtime";var a4=({children:e})=>l4("div",{className:"color-picker__heading",children:e}),oi=a4;import s4 from"clsx";import{useEffect as c4,useRef as d4}from"react";import{jsx as Ua,jsxs as j0}from"react/jsx-runtime";var q0=({color:e,onChange:o,palette:t,showHotKey:n})=>{let r=vn({color:e||"transparent",palette:t}),[i,l]=He(Yt),a=d4(null);if(c4(()=>{a.current&&i==="shades"&&a.current.focus()},[r,i]),r){let{colorName:s,shade:c}=r,m=t[s];if(Array.isArray(m))return Ua("div",{className:"color-picker-content--default shades",children:m.map((p,d)=>j0("button",{ref:d===c&&i==="shades"?a:void 0,tabIndex:-1,type:"button",className:s4("color-picker__button color-picker__button--large has-outline",{active:d===c}),"aria-label":"Shade",title:`${s} - ${d+1}`,style:p?{"--swatch-color":p}:void 0,onClick:()=>{o(p),l("shades")},children:[Ua("div",{className:"color-picker__button-outline"}),n&&Ua(ti,{color:p,keyLabel:d+1,isShade:!0})]},d))})}return j0("div",{className:"color-picker-content--default",style:{position:"relative"},tabIndex:-1,children:[Ua("button",{type:"button",tabIndex:-1,className:"color-picker__button color-picker__button--large color-picker__button--no-focus-visible"}),Ua("div",{tabIndex:-1,style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",fontSize:"0.75rem"},children:E("colorPicker.noShades")})]})};import{COLORS_PER_ROW as ni,COLOR_PALETTE as m4,KEYS as Wa}from"@excalidraw/common";var Cp=(e,o,t)=>{let n=Math.ceil(t/ni);switch(o=o??-1,e){case"ArrowLeft":{let r=o-1;return r<0?t-1:r}case"ArrowRight":return(o+1)%t;case"ArrowDown":{let r=o+ni;return r>=t?o%ni:r}case"ArrowUp":{let r=o-ni,i=r<0?ni*n+r:r;return i>=t?void 0:i}}},p4=({e,colorObj:o,onChange:t,palette:n,customColors:r,setActiveColorPickerSection:i,activeShade:l})=>{if(o?.shade!=null&&["Digit1","Digit2","Digit3","Digit4","Digit5"].includes(e.code)&&e.shiftKey){let a=Number(e.code.slice(-1))-1;return t(n[o.colorName][a]),i("shades"),!0}if(["1","2","3","4","5"].includes(e.key)&&r[Number(e.key)-1])return t(r[Number(e.key)-1]),i("custom"),!0;if(Ga.includes(e.key)){let a=Ga.indexOf(e.key),s=Object.keys(n)[a],c=n[s],m=Array.isArray(c)?c[l]:c;return t(m),i("baseColors"),!0}return!1},J0=({event:e,activeColorPickerSection:o,palette:t,color:n,onChange:r,customColors:i,setActiveColorPickerSection:l,updateData:a,activeShade:s,onEyeDropperToggle:c,onEscape:m})=>{if(e[Wa.CTRL_OR_CMD])return!1;if(e.key===Wa.ESCAPE)return m(e),!0;if(e.key===Wa.ALT)return c(!0),!0;if(e.key===Wa.I)return c(),!0;let p=vn({color:n,palette:t});if(e.key===Wa.TAB){let d={custom:!!i.length,baseColors:!0,shades:p?.shade!=null,hex:!0},h=Object.entries(d).reduce((v,[x,w])=>(w&&v.push(x),v),[]),f=h.indexOf(o),g=e.shiftKey?-1:1,b=f+g>h.length-1?0:f+g<0?h.length-1:f+g,y=h[b];return y&&l(y),y==="custom"?r(i[0]):y==="baseColors"&&(Object.entries(t).find(([x,w])=>Array.isArray(w)?w.includes(n):w===n?x:null)||r(m4.black)),e.preventDefault(),e.stopPropagation(),!0}if(p4({e,colorObj:p,onChange:r,palette:t,customColors:i,setActiveColorPickerSection:l,activeShade:s}))return!0;if(o==="shades"&&p){let{shade:d}=p,h=Cp(e.key,d,ni);if(h!==void 0)return r(t[p.colorName][h]),!0}if(o==="baseColors"&&p){let{colorName:d}=p,h=Object.keys(t),f=h.indexOf(d),g=Cp(e.key,f,h.length);if(g!==void 0){let b=h[g],y=t[b];return r(Array.isArray(y)?y[s]:y),!0}}if(o==="custom"){let d=n!=null?i.indexOf(n):0,h=Cp(e.key,d,i.length);if(h!==void 0){let f=i[h];return r(f),!0}}return!1};import{jsx as Tn,jsxs as ec}from"react/jsx-runtime";var ex=Sp.forwardRef(({color:e,onChange:o,type:t,elements:n,palette:r,updateData:i,children:l,showTitle:a,onEyeDropperToggle:s,onEscape:c,showHotKey:m=!0},p)=>{let d=a?t==="elementStroke"?E("labels.stroke"):t==="elementBackground"?E("labels.background"):null:null,[h]=Sp.useState(()=>t==="canvasBackground"?[]:Y0(n,t,r)),[f,g]=He(Yt),b=vn({color:e,palette:r});kp(()=>{if(!f){let w=!!e&&yp({color:e,palette:r}),T=w&&!h.includes(e);g(T?null:w?"custom":b?.shade!=null?"shades":"baseColors")}},[f,e,r,g,b,h]);let[y,v]=h4(b?.shade??(t==="elementBackground"?g4:f4));kp(()=>{b?.shade!=null&&v(b.shade);let w=T=>{T.key===E4.ALT&&s(!1)};return document.addEventListener(Q0.KEYUP,w,{capture:!0}),()=>{document.removeEventListener(Q0.KEYUP,w,{capture:!0})}},[b,s]);let x=Sp.useRef(null);return u4(p,()=>x.current),kp(()=>{x?.current?.focus()},[]),Tn("div",{role:"dialog","aria-modal":"true","aria-label":E("labels.colorPicker"),children:ec("div",{ref:x,onKeyDown:w=>{J0({event:w,activeColorPickerSection:f,palette:r,color:e,onChange:o,onEyeDropperToggle:s,customColors:h,setActiveColorPickerSection:g,updateData:i,activeShade:y,onEscape:c})&&(w.preventDefault(),w.stopPropagation())},className:"color-picker-content properties-content",tabIndex:-1,children:[d&&Tn("div",{className:"color-picker__title",children:d}),!!h.length&&ec("div",{children:[Tn(oi,{children:E("colorPicker.mostUsedCustomColors")}),Tn(Z0,{colors:h,color:e,label:E("colorPicker.mostUsedCustomColors"),onChange:o})]}),ec("div",{children:[Tn(oi,{children:E("colorPicker.colors")}),Tn($0,{color:e,palette:r,onChange:o,activeShade:y,showHotKey:m})]}),ec("div",{children:[Tn(oi,{children:E("colorPicker.shades")}),Tn(q0,{color:e,onChange:o,palette:r,showHotKey:m})]}),l]})})});import x4 from"clsx";import{COLOR_OUTLINE_CONTRAST_THRESHOLD as b4,DEFAULT_CANVAS_BACKGROUND_PICKS as y4,DEFAULT_ELEMENT_BACKGROUND_PICKS as w4,DEFAULT_ELEMENT_STROKE_PICKS as v4,isColorDark as T4}from"@excalidraw/common";import{jsx as Mp}from"react/jsx-runtime";var tx=({onChange:e,type:o,activeColor:t,topPicks:n})=>{let r;return o==="elementStroke"&&(r=v4),o==="elementBackground"&&(r=w4),o==="canvasBackground"&&(r=y4),n&&(r=n),r?Mp("div",{className:"color-picker__top-picks",children:r.map(i=>Mp("button",{className:x4("color-picker__button",{active:i===t,"is-transparent":i==="transparent"||!i,"has-outline":!T4(i,b4)}),style:{"--swatch-color":i},type:"button",title:i,onClick:()=>e(i),"data-testid":`color-top-pick-${i}`,children:Mp("div",{className:"color-picker__button-outline"})},i))}):(console.error("Invalid type for TopPicks"),null)};import{jsx as Vt,jsxs as tc}from"react/jsx-runtime";var S4=({type:e,color:o,onChange:t,label:n,elements:r,palette:i=lx,updateData:l,getOpenPopup:a,appState:s})=>{let{container:c}=_e(),m=et(),p=m!=="full",d=m==="mobile",[,h]=He(Yt),[f,g]=He(wn),b=tc("div",{children:[Vt(oi,{children:E("colorPicker.hexCode")}),Vt(K0,{color:o||"",label:n,onChange:x=>{t(x)},colorPickerType:e,placeholder:E("colorPicker.color")})]}),y=ax(null),v=()=>{y.current?.focus()};return Vt(Vo,{container:c,style:{maxWidth:"13rem"},preventAutoFocusOnTouch:!!s.editingTextElement,onFocusOutside:x=>{C4(x.target)||v(),x.preventDefault()},onPointerDownOutside:x=>{f&&x.preventDefault()},onClose:()=>{a()===e&&l({openPopup:null}),h(null),s.editingTextElement&&setTimeout(()=>{let x=document.querySelector(".excalidraw-wysiwyg");x&&x.focus()},0)},children:i?Vt(ex,{ref:y,palette:i,color:o,onChange:x=>{let w=s.editingTextElement?Js():null;t(x),s.editingTextElement&&w&&za(w)},onEyeDropperToggle:x=>{g(w=>x?(w=w||{keepOpenOnAlt:!0,onSelect:t,colorPickerType:e},w.keepOpenOnAlt=!0,w):x===!1||w?null:{keepOpenOnAlt:!1,onSelect:t,colorPickerType:e})},onEscape:x=>{f?g(null):l({openPopup:null})},type:e,elements:r,updateData:l,showTitle:p,showHotKey:!d,children:b}):b})},k4=({label:e,color:o,type:t,mode:n="background",onToggle:r,editingTextElement:i})=>{let l=et(),a=l!=="full",s=l==="mobile",c=m=>{m.preventDefault(),m.stopPropagation(),i&&W0(),r()};return tc(rx.Trigger,{type:"button",className:ix("color-picker__button active-color properties-trigger",{"is-transparent":!o||o==="transparent","has-outline":!o||!nx(o,ox),"compact-sizing":a,"mobile-border":s}),"aria-label":e,style:o?{"--swatch-color":o}:void 0,title:t==="elementStroke"?E("labels.showStroke"):E("labels.showBackground"),"data-openpopup":t,onClick:c,children:[Vt("div",{className:"color-picker__button-outline",children:!o&&iE}),a&&o&&n==="stroke"&&Vt("div",{className:"color-picker__button-background",children:Vt("span",{style:{color:o&&nx(o,ox)?"#fff":"#111"},children:T0})})]})},Ya=({type:e,color:o,onChange:t,label:n,elements:r,palette:i=lx,topPicks:l,updateData:a,appState:s})=>{let c=ax(s.openPopup);I4(()=>{c.current=s.openPopup},[s.openPopup]);let p=et()!=="full";return Vt("div",{children:tc("div",{role:"dialog","aria-modal":"true",className:ix("color-picker-container",{"color-picker-container--no-top-picks":p}),children:[!p&&Vt(tx,{activeColor:o,onChange:t,type:e,topPicks:l}),!p&&Vt(Zs,{}),tc(rx.Root,{open:s.openPopup===e,onOpenChange:d=>{d&&a({openPopup:e})},children:[Vt(k4,{color:o,label:n,type:e,mode:e==="elementStroke"?"stroke":"background",editingTextElement:!!s.editingTextElement,onToggle:()=>{s.openPopup===e?a({openPopup:null}):s.openPopup?a({openPopup:e}):a({openPopup:e})}}),s.openPopup===e&&Vt(S4,{type:e,color:o,onChange:t,label:n,elements:r,palette:i,updateData:a,getOpenPopup:()=>c.current,appState:s})]})]})})};import{Popover as t6}from"radix-ui";import o6 from"clsx";import n6,{useCallback as r6,useMemo as i6}from"react";import{FONT_FAMILY as Dp}from"@excalidraw/common";import V4,{useMemo as Sn,useState as X4,useRef as mx,useEffect as px,useCallback as ux}from"react";import{arrayToList as K4,debounce as Z4,FONT_FAMILY as kn,getFontFamilyString as $4}from"@excalidraw/common";import M4 from"clsx";import P4 from"react";import{jsx as A4,jsxs as L4}from"react/jsx-runtime";var oc=P4.forwardRef(({className:e,placeholder:o,onChange:t},n)=>L4("div",{className:M4("QuickSearch__wrapper",e),children:[bo,A4("input",{ref:n,className:"QuickSearch__input",type:"text",placeholder:o,onChange:r=>t(r.target.value.trim().toLowerCase())})]}));import D4 from"clsx";import{Children as _4}from"react";import{jsx as sx}from"react/jsx-runtime";var nc=({className:e,placeholder:o,children:t})=>{let n=!_4.count(t);return sx("div",{className:D4("ScrollableList__wrapper",e),role:"menu",children:n?sx("div",{className:"empty",children:o}):t})};import{jsx as R4,jsxs as N4}from"react/jsx-runtime";var cx=({children:e,className:o="",style:t,title:n})=>N4("div",{className:`dropdown-menu-group ${o}`,style:t,children:[n&&R4("p",{className:"dropdown-menu-group-title",children:n}),e]}),Va=cx;cx.displayName="DropdownMenuGroup";import{THEME as W4}from"@excalidraw/common";import{DropdownMenu as Y4}from"radix-ui";import B4,{useContext as F4}from"react";import{composeEventHandlers as O4}from"@excalidraw/common";var Pp=B4.createContext({}),In=(e="",o=!1,t=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e} ${o?"dropdown-menu-item--selected":""} ${t?"dropdown-menu-item--hovered":""}`.trim(),rc=e=>{let o=F4(Pp);return O4(e,t=>{o.onSelect?.(t)})};import{jsx as z4}from"react/jsx-runtime";var Xa=({children:e,...o})=>z4("span",{...o,style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",...o.style},children:e});import{Fragment as G4,jsx as Ka,jsxs as U4}from"react/jsx-runtime";var H4=({textStyle:e,icon:o,shortcut:t,children:n,badge:r})=>{let i=me();return U4(G4,{children:[o&&Ka("div",{className:"dropdown-menu-item__icon",children:o}),Ka("div",{style:e,className:"dropdown-menu-item__text",children:Ka(Xa,{children:n})}),r&&Ka("div",{className:"dropdown-menu-item__badge",children:r}),t&&i.formFactor!=="phone"&&Ka("div",{className:"dropdown-menu-item__shortcut",children:t})]})},Cn=H4;import{jsx as ic}from"react/jsx-runtime";var Ap=({icon:e,badge:o,value:t,children:n,shortcut:r,className:i,selected:l,onSelect:a,...s})=>{let c=rc(a);return ic(Y4.Item,{className:"radix-menu-item",onSelect:c,asChild:!0,children:ic("button",{...s,value:t,className:In(i,l),title:s.title??s["aria-label"],children:ic(Cn,{icon:e,shortcut:r,badge:o,children:n})})})};Ap.displayName="DropdownMenuItem";var ri={GREEN:"green",RED:"red",BLUE:"blue"},ac=({type:e=ri.BLUE,children:o})=>{let{theme:t}=yo(),n={display:"inline-flex",marginLeft:"auto",padding:"2px 4px",borderRadius:6,fontSize:9,fontFamily:"Cascadia, monospace",border:t===W4.LIGHT?"1.5px solid white":"none"};switch(e){case ri.GREEN:Object.assign(n,{backgroundColor:"var(--background-color-badge)",color:"var(--color-badge)"});break;case ri.RED:Object.assign(n,{backgroundColor:"pink",color:"darkred"});break;case ri.BLUE:default:Object.assign(n,{background:"var(--color-promo)",color:"var(--color-surface-lowest)"})}return ic("div",{className:"DropDownMenuItemBadge",style:n,children:o})};ac.displayName="DropdownMenuItemBadge";Ap.Badge=ac;var Dt=Ap;import{KEYS as ii}from"@excalidraw/common";var dx=({event:e,inputRef:o,hoveredFont:t,filteredFonts:n,onClose:r,onSelect:i,onHover:l})=>{if(!e[ii.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===ii.F)return o.current?.focus(),!0;if(e.key===ii.ESCAPE)return r(),!0;if(e.key===ii.ENTER)return t?.value&&i(t.value),!0;if(e.key===ii.ARROW_DOWN)return t?.next?l(t.next.value):n[0]?.value&&l(n[0].value),!0;if(e.key===ii.ARROW_UP)return t?.prev?l(t.prev.value):n[n.length-1]?.value&&l(n[n.length-1].value),!0};import{jsx as Xo,jsxs as J4}from"react/jsx-runtime";var j4=e=>{switch(e){case kn.Excalifont:case kn.Virgil:return En;case kn.Nunito:case kn.Helvetica:return Na;case kn["Lilita One"]:return KE;case kn["Comic Shanns"]:case kn.Cascadia:return Rs;default:return Na}},q4=(e,o)=>Object.entries(kn).find(([,t])=>t===e)?.[0]??o[0]?.fontFace?.family??"Unknown",hx=V4.memo(({selectedFontFamily:e,hoveredFontFamily:o,onSelect:t,onHover:n,onLeave:r,onOpen:i,onClose:l})=>{let{container:a}=_e(),s=vt(),{fonts:c}=s,{showDeprecatedFonts:m}=ai(),p=et(),[d,h]=X4(""),f=mx(null),g=Sn(()=>Array.from(Uo.registered.entries()).filter(([A,{metadata:F}])=>!F.private&&!F.fallback).map(([A,{metadata:F,fontFaces:U}])=>{let j={value:A,icon:j4(A),text:q4(A,U)};return F.deprecated&&Object.assign(j,{deprecated:F.deprecated,badge:{type:ri.RED,placeholder:E("fontList.badge.old")}}),j}).sort((A,F)=>A.text.toLowerCase()>F.text.toLowerCase()?1:-1),[]),b=Sn(()=>new Set(c.getSceneFamilies()),[e]),y=Sn(()=>g.filter(A=>b.has(A.value)),[g,b]),v=Sn(()=>g.filter(A=>!b.has(A.value)&&(m||!A.deprecated)),[g,b,m]),x=Sn(()=>K4([...y,...v].filter(A=>A.text?.toLowerCase().includes(d))),[y,v,d]),w=Sn(()=>{let A;return o?A=x.find(F=>F.value===o):e&&(A=x.find(F=>F.value===e)),!A&&d&&(x[0]?.value?n(x[0].value):r()),A},[o,e,d,x,n,r]),T=ux(A=>{let F=null;if(s.state.editingTextElement){let U=document.querySelector(".excalidraw-wysiwyg");U&&(F={start:U.selectionStart,end:U.selectionEnd})}t(A),s.state.editingTextElement&&F&&setTimeout(()=>{let U=document.querySelector(".excalidraw-wysiwyg");U&&F&&(U.focus(),U.selectionStart=F.start,U.selectionEnd=F.end)},0)},[t,s.state.editingTextElement]),S=ux(A=>{dx({event:A,inputRef:f,hoveredFont:w,filteredFonts:x,onSelect:T,onHover:n,onClose:l})&&(A.preventDefault(),A.stopPropagation())},[w,x,T,n,l]);px(()=>(i(),()=>{l()}),[]);let P=Sn(()=>x.filter(A=>b.has(A.value)),[x,b]),M=Sn(()=>x.filter(A=>!b.has(A.value)),[x,b]),_=({font:A,order:F})=>{let U=mx(null),j=A.value===w?.value,z=A.value===e;return px(()=>{j&&(F===0?U.current?.scrollIntoView?.({block:"end"}):U.current?.scrollIntoView?.({block:"nearest"}))},[j,F]),Xo("button",{ref:U,type:"button",value:A.value,className:In("",z,j),title:A.text,tabIndex:z?0:-1,onClick:Z=>{T(Number(Z.currentTarget.value))},onMouseMove:()=>{w?.value!==A.value&&n(A.value)},children:Xo(Cn,{icon:A.icon,badge:A.badge&&Xo(ac,{type:A.badge.type,children:A.badge.placeholder}),textStyle:{fontFamily:$4({fontFamily:A.value})},children:A.text})})},R=[];return P.length&&R.push(Xo(Va,{title:E("fontList.sceneFonts"),children:P.map((A,F)=>Xo(_,{font:A,order:F},A.value))},"group_1")),M.length&&R.push(Xo(Va,{title:E("fontList.availableFonts"),children:M.map((A,F)=>Xo(_,{font:A,order:F+P.length},A.value))},"group_2")),J4(Vo,{className:"properties-content",container:a,style:{width:"15rem"},onClose:()=>{l(),s.state.editingTextElement&&setTimeout(()=>{let A=document.querySelector(".excalidraw-wysiwyg");A&&A.focus()},0)},onPointerLeave:r,onKeyDown:S,preventAutoFocusOnTouch:!!s.state.editingTextElement,children:[p==="full"&&Xo(oc,{ref:f,placeholder:E("quickSearch.placeholder"),onChange:Z4(h,20)}),Xo(nc,{className:"dropdown-menu fonts manual-hover",placeholder:E("fontList.empty"),children:R.length?R:null})]})},(e,o)=>e.selectedFontFamily===o.selectedFontFamily&&e.hoveredFontFamily===o.hoveredFontFamily);import{Popover as Q4}from"radix-ui";import{MOBILE_ACTION_BUTTON_BG as e6}from"@excalidraw/common";import{jsx as Lp}from"react/jsx-runtime";var gx=({selectedFontFamily:e,isOpened:o=!1,compactMode:t=!1})=>{let n=Me(),r=t?{...e6,width:"2rem",height:"2rem"}:{};return Lp(Q4.Trigger,{asChild:!0,children:Lp("div",{"data-openpopup":"fontFamily",className:"properties-trigger",children:Lp(qr,{standalone:!0,icon:xn,title:E("labels.showFonts"),className:"properties-trigger",testId:"font-family-show-fonts",active:o,onClick:()=>{n(i=>({openPopup:i.openPopup==="fontFamily"?null:i.openPopup}))},style:{border:"none",...r}})})})};import{jsx as Za,jsxs as fx}from"react/jsx-runtime";var Ex=[{value:Dp.Excalifont,icon:En,text:E("labels.handDrawn"),testId:"font-family-hand-drawn"},{value:Dp.Nunito,icon:Na,text:E("labels.normal"),testId:"font-family-normal"},{value:Dp["Comic Shanns"],icon:Rs,text:E("labels.code"),testId:"font-family-code"}],P$=new Set(Ex.map(e=>e.value));var xx=n6.memo(({isOpened:e,selectedFontFamily:o,hoveredFontFamily:t,onSelect:n,onHover:r,onLeave:i,onPopupChange:l,compactMode:a=!1})=>{let s=i6(()=>Ex,[]),c=r6(m=>{m&&n(m)},[n]);return fx("div",{role:"dialog","aria-modal":"true",className:o6("FontPicker__container",{"FontPicker__container--compact":a}),children:[!a&&Za("div",{className:"buttonList",children:Za(Wt,{type:"button",options:s,value:o,onClick:c})}),!a&&Za(Zs,{}),fx(t6.Root,{open:e,onOpenChange:l,children:[Za(gx,{selectedFontFamily:o,isOpened:e,compactMode:a}),e&&Za(hx,{selectedFontFamily:o,hoveredFontFamily:t,onSelect:c,onHover:r,onLeave:i,onOpen:()=>l(!0),onClose:()=>l(!1)})]})]})},(e,o)=>e.isOpened===o.isOpened&&e.selectedFontFamily===o.selectedFontFamily&&e.hoveredFontFamily===o.hoveredFontFamily);import{Popover as _p}from"radix-ui";import c6 from"clsx";import vx,{useEffect as d6,useMemo as m6}from"react";import{isArrowKey as p6,KEYS as Ko}from"@excalidraw/common";import{jsx as a6}from"react/jsx-runtime";var lc=({className:e,icon:o,size:t="1em"})=>a6("span",{className:e,style:{width:t,height:"100%",margin:"0 0.5ex 0 0.5ex",display:"inline-flex",lineHeight:0,verticalAlign:"middle",flex:"0 0 auto"},children:o});import{Fragment as s6,jsx as bx,jsxs as yx}from"react/jsx-runtime";var l6=({label:e,open:o,openTrigger:t,children:n,className:r,showCollapsedIcon:i=!0})=>yx(s6,{children:[yx("div",{style:{cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center"},className:r,onClick:t,children:[e,i&&bx(lc,{icon:o?y0:Os})]}),o&&bx("div",{style:{display:"flex",flexDirection:"column"},children:n})]}),$a=l6;import{jsx as wo,jsxs as cc}from"react/jsx-runtime";var u6=je(!1),sc=4,h6="default",g6=e=>e.flatMap(o=>o.options),wx=(e,o)=>{for(let t of e){let n=t.options.find(o);if(n)return n}return null},f6=(e,o)=>e.some(t=>t.options.some(o)),E6=e=>e.flatMap(o=>Array.from({length:Math.ceil(o.options.length/sc)},(t,n)=>o.options.slice(n*sc,n*sc+sc)));function x6({visibleSections:e,hiddenSections:o=[],value:t,label:n,onChange:r,onClose:i}){let{container:l}=_e(),[a,s]=He(u6),c=[...e,...o],m=g6(c),p=E6([...e,...a?o:[]]),d=g=>{let b=m.find(y=>y.keyBinding===g.key.toLowerCase());if(!(g.metaKey||g.altKey||g.ctrlKey)&&b)r(b.value),g.preventDefault();else if(g.key===Ko.TAB){let y=m.findIndex(x=>x.value===t),v=g.shiftKey?(m.length+y-1)%m.length:(y+1)%m.length;r(m[v].value)}else if(p6(g.key)){let y=Wo().rtl,v=m.findIndex(x=>x.value===t);if(v!==-1){let x=m.length,w=v;switch(g.key){case(y?Ko.ARROW_LEFT:Ko.ARROW_RIGHT):w=(v+1)%x;break;case(y?Ko.ARROW_RIGHT:Ko.ARROW_LEFT):w=(x+v-1)%x;break;case Ko.ARROW_DOWN:{let T=p.findIndex(P=>P.some(M=>M.value===t)),S=p[T];if(T!==-1&&S){let P=S.findIndex(R=>R.value===t),M=p[(T+1)%p.length],_=M[Math.min(P,M.length-1)]??m[v];r(_.value),g.preventDefault(),g.nativeEvent.stopImmediatePropagation(),g.stopPropagation();return}break}case Ko.ARROW_UP:{let T=p.findIndex(P=>P.some(M=>M.value===t)),S=p[T];if(T!==-1&&S){let P=S.findIndex(R=>R.value===t),M=p[(p.length+T-1)%p.length],_=M[Math.min(P,M.length-1)]??m[v];r(_.value),g.preventDefault(),g.nativeEvent.stopImmediatePropagation(),g.stopPropagation();return}break}}r(m[w].value)}g.preventDefault()}else(g.key===Ko.ESCAPE||g.key===Ko.ENTER)&&(g.preventDefault(),i());g.nativeEvent.stopImmediatePropagation(),g.stopPropagation()};d6(()=>{f6(o,g=>g.value===t)&&s(!0)},[t,o,s]);let h=g=>wo("div",{className:"picker-content",children:g.map(b=>cc("button",{type:"button",className:c6("picker-option",{active:t===b.value}),onClick:()=>{r(b.value)},title:b.keyBinding?`${b.text} \u2014 ${b.keyBinding.toUpperCase()}`:b.text,"aria-label":b.text||"none","aria-keyshortcuts":b.keyBinding||void 0,ref:y=>{t===b.value&&setTimeout(()=>{y?.focus()},0)},children:[b.icon,b.keyBinding&&wo("span",{className:"picker-keybinding",children:b.keyBinding})]},b.text))}),f=g=>g.map((b,y)=>b.name===h6?wo(vx.Fragment,{children:h(b.options)},`${b.name}-${y}`):cc("div",{className:"picker-section",children:[wo("div",{className:"picker-section-label",children:b.name}),h(b.options)]},`${b.name}-${y}`));return wo(_p.Content,{className:"picker",role:"dialog","aria-modal":"true","aria-label":n,side:"bottom",align:"start",sideOffset:12,alignOffset:12,style:{zIndex:"var(--zIndex-ui-styles-popup)"},onKeyDown:d,collisionBoundary:l??void 0,children:cc("div",{className:"picker-sections",children:[f(e),o.length>0&&wo($a,{label:E("labels.more_options"),open:a,openTrigger:()=>{s(g=>!g)},className:"picker-collapsible",children:wo("div",{className:"picker-sections",children:f(o)})})]})})}function Rp({value:e,label:o,visibleSections:t,hiddenSections:n,onChange:r}){let[i,l]=vx.useState(!1),a=m6(()=>wx(t,s=>s.value===e)??wx(n??[],s=>s.value===e),[t,n,e]);return wo("div",{children:cc(_p.Root,{open:i,onOpenChange:s=>l(s),children:[wo(_p.Trigger,{type:"button","aria-label":o,onClick:()=>l(!i),className:i?"active":"",children:a?.icon}),i&&wo(x6,{visibleSections:t,hiddenSections:n,value:e,label:o,onChange:r,onClose:()=>{l(!1)}})]})})}import Tx,{useEffect as b6}from"react";import{jsx as Np,jsxs as Ix}from"react/jsx-runtime";var Cx=({label:e,value:o,onChange:t,min:n=0,max:r=100,step:i=10,minLabel:l=n,hasCommonValue:a=!0,testId:s})=>{let c=Tx.useRef(null),m=Tx.useRef(null);return b6(()=>{if(c.current&&m.current){let p=c.current,d=m.current,h=p.offsetWidth,f=parseFloat(getComputedStyle(p).getPropertyValue("--slider-thumb-size"))||16,g=(o-n)/(r-n||1)*100,b=g/100*(h-f)+f/2;d.style.left=`${b}px`,p.style.background=`linear-gradient(to right, var(--color-slider-track) 0%, var(--color-slider-track) ${g}%, var(--button-bg) ${g}%, var(--button-bg) 100%)`}},[r,n,o]),Ix("label",{className:"control-label",children:[e,Ix("div",{className:"range-wrapper",children:[Np("input",{style:{"--color-slider-track":a?void 0:"var(--button-bg)"},ref:c,type:"range",min:n,max:r,step:i,onChange:p=>{t(+p.target.value)},value:o,className:"range-input","data-testid":s}),Np("div",{className:"value-bubble",ref:m,children:o!==n?o:null}),Np("div",{className:"zero-label",children:l})]})]})};import{Fragment as Xp,jsx as J,jsxs as ut}from"react/jsx-runtime";var _x=.1,si=e=>{let o=G6(e.editorInterface);return{stylesPanelMode:o,isCompact:o!=="full",isMobile:o==="mobile"}},pt=(e,o,t,n=!1)=>{let r=Gp(te(e,o,{includeBoundTextElement:n}));return e.map(i=>r.get(i.id)||i.id===o.editingTextElement?.id?t(i):i)},nt=function(e,o,t,n,r){let i=o.state.editingTextElement,l=Lx(e),a=null;if(i&&(a=t(i)),!a)if(we(l,o.state)){let c=o.scene.getSelectedElements(o.state),m=n===!0?c:c.filter(p=>n(p));a=_6(m,t)??(typeof r=="function"?r(!0):r)}else a=typeof r=="function"?r(!1):r;return a},U6=(e,o,t)=>B6(o)||!o.autoResize?o:t.mutateElement(o,{x:e.textAlign==="left"?e.x:e.x+(e.width-o.width)/(e.textAlign==="center"?2:1),y:e.y+(e.height-o.height)/2}),Wp=(e,o,t,n,r)=>{let i=new Set,l=pt(e,o,a=>{if(Tt(a)){let s=n(a);i.add(s);let c=qe(a,{fontSize:s});return ja(c,t.scene.getContainerElement(a),t.scene),c=U6(a,c,t.scene),c}return a},!0);return te(e,o,{includeBoundTextElement:!0}).forEach(a=>{Tt(a)&&N6(a,t.scene)}),{elements:l,appState:{...o,currentItemFontSize:i.size===1?[...i][0]:r??o.currentItemFontSize},captureUpdate:Je.IMMEDIATELY}},W6=N({name:"changeStrokeColor",label:"labels.stroke",trackEvent:!1,perform:(e,o,t)=>({...t?.currentItemStrokeColor&&{elements:pt(e,o,n=>O6(n.type)?qe(n,{strokeColor:t.currentItemStrokeColor}):n,!0)},appState:{...o,...t},captureUpdate:t?.currentItemStrokeColor?Je.IMMEDIATELY:Je.EVENTUALLY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>{let{stylesPanelMode:i}=si(n);return ut(Xp,{children:[i==="full"&&J("h3",{"aria-hidden":"true",children:E("labels.stroke")}),J(Ya,{topPicks:C6,palette:I6,type:"elementStroke",label:E("labels.stroke"),color:nt(e,n,l=>l.strokeColor,!0,l=>l?null:o.currentItemStrokeColor),onChange:l=>t({currentItemStrokeColor:l}),elements:e,appState:o,updateData:t})]})}}),Y6=N({name:"changeBackgroundColor",label:"labels.changeBackground",trackEvent:!1,perform:(e,o,t,n)=>{if(!t?.currentItemBackgroundColor)return{appState:{...o,...t},captureUpdate:Je.EVENTUALLY};let r,i=n.scene.getSelectedElements(o);if(!D6(t.currentItemBackgroundColor)&&i.every(a=>Px(a)&&R6(a.points))){let a=Gp(i);r=e.map(s=>a.has(s.id)&&Px(s)?qe(s,{backgroundColor:t.currentItemBackgroundColor,...H6(s,!0)}):s)}else r=pt(e,o,a=>qe(a,{backgroundColor:t.currentItemBackgroundColor}));return{elements:r,appState:{...o,...t},captureUpdate:Je.IMMEDIATELY}},PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>{let{stylesPanelMode:i}=si(n);return ut(Xp,{children:[i==="full"&&J("h3",{"aria-hidden":"true",children:E("labels.background")}),J(Ya,{topPicks:T6,palette:v6,type:"elementBackground",label:E("labels.background"),color:nt(e,n,l=>l.backgroundColor,!0,l=>l?null:o.currentItemBackgroundColor),onChange:l=>t({currentItemBackgroundColor:l}),elements:e,appState:o,updateData:t})]})}}),V6=N({name:"changeFillStyle",label:"labels.fill",trackEvent:!1,perform:(e,o,t,n)=>(de("element","changeFillStyle",`${t} (${n.editorInterface.formFactor==="phone"?"mobile":"desktop"})`),{elements:pt(e,o,r=>qe(r,{fillStyle:t})),appState:{...o,currentItemFillStyle:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>{let r=te(e,o),i=r.length>0&&r.every(l=>l.fillStyle==="zigzag");return ut("fieldset",{children:[J("legend",{children:E("labels.fill")}),J("div",{className:"buttonList",children:J(Wt,{type:"button",options:[{value:"hachure",text:`${i?E("labels.zigzag"):E("labels.hachure")} (${L("Alt-Click")})`,icon:i?gE:fE,active:i?!0:void 0,testId:"fill-hachure"},{value:"cross-hatch",text:E("labels.crossHatch"),icon:EE,testId:"fill-cross-hatch"},{value:"solid",text:E("labels.solid"),icon:xE,testId:"fill-solid"}],value:nt(e,n,l=>l.fillStyle,l=>l.hasOwnProperty("fillStyle"),l=>l?null:o.currentItemFillStyle),onClick:(l,a)=>{let s=a.altKey&&l==="hachure"&&r.every(c=>c.fillStyle==="hachure")?"zigzag":l;t(s)}})})]})}}),X6=N({name:"changeStrokeWidth",label:"labels.strokeWidth",trackEvent:!1,perform:(e,o,t)=>({elements:pt(e,o,n=>qe(n,{strokeWidth:t})),appState:{...o,currentItemStrokeWidth:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>ut("fieldset",{children:[J("legend",{children:E("labels.strokeWidth")}),J("div",{className:"buttonList",children:J(Wt,{group:"stroke-width",options:[{value:Op.thin,text:E("labels.thin"),icon:qm,testId:"strokeWidth-thin"},{value:Op.bold,text:E("labels.bold"),icon:bE,testId:"strokeWidth-bold"},{value:Op.extraBold,text:E("labels.extraBold"),icon:yE,testId:"strokeWidth-extraBold"}],value:nt(e,n,i=>i.strokeWidth,i=>i.hasOwnProperty("strokeWidth"),i=>i?null:o.currentItemStrokeWidth),onChange:i=>t(i)})})]})}),K6=N({name:"changeSloppiness",label:"labels.sloppiness",trackEvent:!1,perform:(e,o,t)=>({elements:pt(e,o,n=>qe(n,{seed:P6(),roughness:t})),appState:{...o,currentItemRoughness:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>ut("fieldset",{children:[J("legend",{children:E("labels.sloppiness")}),J("div",{className:"buttonList",children:J(Wt,{group:"sloppiness",options:[{value:0,text:E("labels.architect"),icon:TE},{value:1,text:E("labels.artist"),icon:IE},{value:2,text:E("labels.cartoonist"),icon:CE}],value:nt(e,n,i=>i.roughness,i=>i.hasOwnProperty("roughness"),i=>i?null:o.currentItemRoughness),onChange:i=>t(i)})})]})}),Rj=N({name:"changeStrokeStyle",label:"labels.strokeStyle",trackEvent:!1,perform:(e,o,t)=>({elements:pt(e,o,n=>qe(n,{strokeStyle:t})),appState:{...o,currentItemStrokeStyle:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>ut("fieldset",{children:[J("legend",{children:E("labels.strokeStyle")}),J("div",{className:"buttonList",children:J(Wt,{group:"strokeStyle",options:[{value:"solid",text:E("labels.strokeStyle_solid"),icon:qm},{value:"dashed",text:E("labels.strokeStyle_dashed"),icon:wE},{value:"dotted",text:E("labels.strokeStyle_dotted"),icon:vE}],value:nt(e,n,i=>i.strokeStyle,i=>i.hasOwnProperty("strokeStyle"),i=>i?null:o.currentItemStrokeStyle),onChange:i=>t(i)})})]})}),Z6=N({name:"changeOpacity",label:"labels.opacity",trackEvent:!1,perform:(e,o,t)=>({elements:pt(e,o,n=>qe(n,{opacity:t}),!0),appState:{...o,currentItemOpacity:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,app:t,updateData:n})=>{let r=nt(e,t,i=>i.opacity,!0,i=>i?null:o.currentItemOpacity);return J(Cx,{label:E("labels.opacity"),value:r??o.currentItemOpacity,hasCommonValue:r!==null,onChange:n,min:0,max:100,step:10,testId:"opacity"})}}),$6=N({name:"changeFontSize",label:"labels.fontSize",trackEvent:!1,perform:(e,o,t,n)=>Wp(e,o,n,()=>(Up(t,"actionChangeFontSize: Expected a font size value"),t),t),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>{let{isCompact:i}=si(n);return ut("fieldset",{children:[J("legend",{children:E("labels.fontSize")}),J("div",{className:"buttonList",children:J(Wt,{group:"font-size",options:[{value:mc.sm,text:E("labels.small"),icon:WE,testId:"fontSize-small"},{value:mc.md,text:E("labels.medium"),icon:YE,testId:"fontSize-medium"},{value:mc.lg,text:E("labels.large"),icon:VE,testId:"fontSize-large"},{value:mc.xl,text:E("labels.veryLarge"),icon:XE,testId:"fontSize-veryLarge"}],value:nt(e,n,l=>{if(Tt(l))return l.fontSize;let a=Mn(l,n.scene.getNonDeletedElementsMap());return a?a.fontSize:null},l=>Tt(l)||Mn(l,n.scene.getNonDeletedElementsMap())!==null,l=>l?null:o.currentItemFontSize||k6),onChange:l=>{Ha(()=>t(l),i,!!o.editingTextElement,r?.onPreventClose)}})})]})}}),Yp=N({name:"decreaseFontSize",label:"labels.decreaseFontSize",icon:ar,trackEvent:!1,perform:(e,o,t,n)=>Wp(e,o,n,r=>Math.round(1/(1+_x)*r.fontSize)),keyTest:e=>e[li.CTRL_OR_CMD]&&e.shiftKey&&(e.key===li.CHEVRON_LEFT||e.key===li.COMMA)}),Vp=N({name:"increaseFontSize",label:"labels.increaseFontSize",icon:ar,trackEvent:!1,perform:(e,o,t,n)=>Wp(e,o,n,r=>Math.round(r.fontSize*(1+_x))),keyTest:e=>e[li.CTRL_OR_CMD]&&e.shiftKey&&(e.key===li.CHEVRON_RIGHT||e.key===li.PERIOD)}),j6=N({name:"changeFontFamily",label:"labels.fontFamily",trackEvent:!1,perform:(e,o,t,n)=>{let{cachedElements:r,resetAll:i,resetContainers:l,...a}=t;if(i)return{elements:pt(e,o,g=>{let b=r?.get(g.id);return b?qe(g,{...b}):g},!0),appState:{...o,...a},captureUpdate:Je.NEVER};Up(t,"actionChangeFontFamily: value must be defined");let{currentItemFontFamily:s,currentHoveredFontFamily:c}=t,m=Je.EVENTUALLY,p,d=!1;if(s)p=s,m=Je.IMMEDIATELY;else if(c){p=c,m=Je.EVENTUALLY;let f=te(e,o,{includeBoundTextElement:!0}).filter(g=>Tt(g));if(f.length>200)d=!0;else{let g=0,b=0;for(;g<f.length&&b<5e3;){let y=f[g];b+=y?.originalText.length||0,g++}b>5e3&&(d=!0)}}let h={appState:{...o,...a},captureUpdate:m};if(p&&!d){let f=new Map,g=new Set,b=!1,y=Array.from(Uo.loadedFontsCache.values()),v=Object.entries(M6).find(([T,S])=>S===p)?.[0];c&&v&&y.some(T=>T.startsWith(v))&&(b=!0),Object.assign(h,{elements:pt(e,o,T=>{if(Tt(T)&&(T.fontFamily!==p||s)){let S=qe(T,{fontFamily:p,lineHeight:L6(p)}),P=r?.get(T.containerId||"")||{},M=n.scene.getContainerElement(T);return l&&M&&P&&n.scene.mutateElement(M,{...P}),b||(g=new Set([...g,...Array.from(S.originalText)])),f.set(S,M),S}return T},!0)});let x=`10px ${A6({fontFamily:p})}`,w=Array.from(g.values()).join();if(b||window.document.fonts.check(x,w))for(let[T,S]of f)ja(T,S,n.scene);else window.document.fonts.load(x,w).then(T=>{for(let[S,P]of f){let M=n.scene.getElement(S.id),_=P?n.scene.getElement(P.id):null;M&&ja(M,_,n.scene)}n.fonts.onLoaded(T)})}return h},PanelComponent:({elements:e,appState:o,app:t,updateData:n})=>{let r=Fp(new Map),i=Fp(null),[l,a]=w6({}),s=Fp(!0),{stylesPanelMode:c,isCompact:m}=si(t),p=Hp(()=>{let d=(h,f)=>nt(h,t,g=>{if(Tt(g))return g.fontFamily;let b=Mn(g,f);return b?b.fontFamily:null},g=>Tt(g)||Mn(g,f)!==null,g=>g?null:o.currentItemFontFamily||S6);return l.openPopup==="fontFamily"&&o.openPopup==="fontFamily"?d(Array.from(r.current?.values()??[]),r.current):!l.openPopup&&o.openPopup!=="fontFamily"?d(e,t.scene.getNonDeletedElementsMap()):i.current},[l.openPopup,o,e,t]);return Bp(()=>{i.current=p},[p]),Bp(()=>{Object.keys(l).length&&(n(l),a({}))},[l]),Bp(()=>(s.current=!1,()=>{s.current=!0}),[]),ut(Xp,{children:[c==="full"&&J("legend",{children:E("labels.fontFamily")}),J(xx,{isOpened:o.openPopup==="fontFamily",selectedFontFamily:p,hoveredFontFamily:o.currentHoveredFontFamily,compactMode:c!=="full",onSelect:d=>{Ha(()=>{a({openPopup:null,currentHoveredFontFamily:null,currentItemFontFamily:d}),r.current.clear()},m,!!o.editingTextElement)},onHover:d=>{a({currentHoveredFontFamily:d,cachedElements:new Map(r.current),resetContainers:!0})},onLeave:()=>{a({currentHoveredFontFamily:null,cachedElements:new Map(r.current),resetAll:!0})},onPopupChange:d=>{if(d){r.current.clear();let{editingTextElement:h}=o;if(h?.type==="text"){let f=t.scene.getElement(h.id);r.current.set(h.id,qe(f||h,{},!0))}else{let f=te(e,o,{includeBoundTextElement:!0});for(let g of f)r.current.set(g.id,qe(g,{},!0))}a({...l,openPopup:"fontFamily"})}else{let h={currentHoveredFontFamily:null,cachedElements:new Map(r.current),resetAll:!0};a({...h}),r.current.clear(),m&&o.editingTextElement&&za(null)}}})]})}}),q6=N({name:"changeTextAlign",label:"Change text alignment",trackEvent:!1,perform:(e,o,t,n)=>({elements:pt(e,o,r=>{if(Tt(r)){let i=qe(r,{textAlign:t});return ja(i,n.scene.getContainerElement(r),n.scene),i}return r},!0),appState:{...o,currentItemTextAlign:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>{let i=n.scene.getNonDeletedElementsMap(),{isCompact:l}=si(n);return ut("fieldset",{children:[J("legend",{children:E("labels.textAlign")}),J("div",{className:"buttonList",children:J(Wt,{group:"text-align",options:[{value:"left",text:E("labels.left"),icon:ZE,testId:"align-left"},{value:"center",text:E("labels.center"),icon:$E,testId:"align-horizontal-center"},{value:"right",text:E("labels.right"),icon:jE,testId:"align-right"}],value:nt(e,n,a=>{if(Tt(a))return a.textAlign;let s=Mn(a,i);return s?s.textAlign:null},a=>Tt(a)||Mn(a,i)!==null,a=>a?null:o.currentItemTextAlign),onChange:a=>{Ha(()=>t(a),l,!!o.editingTextElement,r?.onPreventClose)}})})]})}}),J6=N({name:"changeVerticalAlign",label:"Change vertical alignment",trackEvent:{category:"element"},perform:(e,o,t,n)=>({elements:pt(e,o,r=>{if(Tt(r)){let i=qe(r,{verticalAlign:t});return ja(i,n.scene.getContainerElement(r),n.scene),i}return r},!0),appState:{...o},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,data:r})=>{let{isCompact:i}=si(n);return J("fieldset",{children:J("div",{className:"buttonList",children:J(Wt,{group:"text-align",options:[{value:dc.TOP,text:E("labels.alignTop"),icon:J(qE,{theme:o.theme}),testId:"align-top"},{value:dc.MIDDLE,text:E("labels.centerVertically"),icon:J(QE,{theme:o.theme}),testId:"align-middle"},{value:dc.BOTTOM,text:E("labels.alignBottom"),icon:J(JE,{theme:o.theme}),testId:"align-bottom"}],value:nt(e,n,l=>{if(Tt(l)&&l.containerId)return l.verticalAlign;let a=Mn(l,n.scene.getNonDeletedElementsMap());return a?a.verticalAlign:null},l=>Tt(l)||Mn(l,n.scene.getNonDeletedElementsMap())!==null,l=>l?null:dc.MIDDLE),onChange:l=>{Ha(()=>t(l),i,!!o.editingTextElement,r?.onPreventClose)}})})})}}),Nj=N({name:"changeRoundness",label:"Change edge roundness",trackEvent:!1,perform:(e,o,t)=>({elements:pt(e,o,n=>Dx(n)?n:qe(n,{roundness:t==="round"?{type:F6(n.type)?pc.ADAPTIVE_RADIUS:pc.PROPORTIONAL_RADIUS}:null})),appState:{...o,currentItemRoundness:t},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n,renderAction:r})=>{let l=Rr(Lx(e),o).some(a=>a.roundness?.type===pc.LEGACY);return ut("fieldset",{children:[J("legend",{children:E("labels.edges")}),ut("div",{className:"buttonList",children:[J(Wt,{group:"edges",options:[{value:"sharp",text:E("labels.sharp"),icon:SE},{value:"round",text:E("labels.round"),icon:kE}],value:nt(e,n,a=>l?null:a.roundness?"round":"sharp",a=>!uc(a)&&a.hasOwnProperty("roundness"),a=>a?null:o.currentItemRoundness),onChange:a=>t(a)}),r("togglePolygon")]})]})}}),Ax=e=>({visibleSections:[{name:"default",options:[{value:null,text:E("labels.arrowhead_none"),keyBinding:"q",icon:J(ME,{flip:e})},{value:"arrow",text:E("labels.arrowhead_arrow"),keyBinding:"w",icon:J(PE,{flip:e})},{value:"triangle",text:E("labels.arrowhead_triangle"),icon:J(AE,{flip:e}),keyBinding:"e"},{value:"triangle_outline",text:E("labels.arrowhead_triangle_outline"),icon:J(LE,{flip:e}),keyBinding:"r"}]}],hiddenSections:[{name:"default",options:[{value:"circle",text:E("labels.arrowhead_circle"),keyBinding:"a",icon:J(DE,{flip:e})},{value:"circle_outline",text:E("labels.arrowhead_circle_outline"),keyBinding:"s",icon:J(_E,{flip:e})},{value:"diamond",text:E("labels.arrowhead_diamond"),icon:J(RE,{flip:e}),keyBinding:"d"},{value:"diamond_outline",text:E("labels.arrowhead_diamond_outline"),icon:J(NE,{flip:e}),keyBinding:"f"},{value:"bar",text:E("labels.arrowhead_bar"),keyBinding:"z",icon:J(BE,{flip:e})}]},{name:E("labels.cardinality"),options:[{value:"cardinality_one",text:E("labels.arrowhead_cardinality_one"),icon:J(FE,{flip:e}),keyBinding:"x"},{value:"cardinality_many",text:E("labels.arrowhead_cardinality_many"),icon:J(OE,{flip:e}),keyBinding:"c"},{value:"cardinality_one_or_many",text:E("labels.arrowhead_cardinality_one_or_many"),icon:J(zE,{flip:e}),keyBinding:"v"},{value:"cardinality_exactly_one",text:E("labels.arrowhead_cardinality_exactly_one"),icon:J(HE,{flip:e}),keyBinding:null},{value:"cardinality_zero_or_one",text:E("labels.arrowhead_cardinality_zero_or_one"),icon:J(GE,{flip:e}),keyBinding:null},{value:"cardinality_zero_or_many",text:E("labels.arrowhead_cardinality_zero_or_many"),icon:J(UE,{flip:e}),keyBinding:null}]}]}),Bj=N({name:"changeArrowhead",label:"Change arrowheads",trackEvent:!1,perform:(e,o,t)=>(Up(t,"actionChangeArrowhead: value must be defined"),{elements:pt(e,o,n=>{if(zp(n)){let{position:r,type:i}=t;if(r==="start")return qe(n,{startArrowhead:i});if(r==="end")return qe(n,{endArrowhead:i})}return n}),appState:{...o,[t.position==="start"?"currentItemStartArrowhead":"currentItemEndArrowhead"]:t.type},captureUpdate:Je.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>{let r=Wo().rtl,i=Hp(()=>Ax(!r),[r]),l=Hp(()=>Ax(!!r),[r]);return ut("fieldset",{children:[J("legend",{children:E("labels.arrowheads")}),ut("div",{className:"iconSelectList buttonList",children:[J(Rp,{visibleSections:i.visibleSections,hiddenSections:i.hiddenSections,label:"arrowhead_start",value:nt(e,n,a=>zp(a)&&Nr(a.type)?Mx(a.startArrowhead):o.currentItemStartArrowhead,!0,a=>a?null:o.currentItemStartArrowhead),onChange:a=>t({position:"start",type:a})}),J(Rp,{visibleSections:l.visibleSections,hiddenSections:l.hiddenSections,label:"arrowhead_end",value:nt(e,n,a=>zp(a)&&Nr(a.type)?Mx(a.endArrowhead):o.currentItemEndArrowhead,!0,a=>a?null:o.currentItemEndArrowhead),onChange:a=>t({position:"end",type:a})})]})]})}}),Q6=N({name:"changeArrowProperties",label:"Change arrow properties",trackEvent:!1,perform:(e,o,t,n)=>!1,PanelComponent:({elements:e,appState:o,updateData:t,app:n,renderAction:r})=>ut("div",{className:"selected-shape-actions",children:[r("changeArrowhead"),r("changeArrowType")]})}),Fj=N({name:"changeArrowType",label:"Change arrow types",trackEvent:!1,perform:(e,o,t,n)=>{let r=pt(e,o,a=>{if(!uc(a))return a;let s=n.scene.getNonDeletedElementsMap(),c=sr.getPointAtIndexGlobalCoordinates(a,0,s),m=sr.getPointAtIndexGlobalCoordinates(a,-1,s),p=qe(a,{x:t===Xt.elbow?c[0]:a.x,y:t===Xt.elbow?c[1]:a.y,roundness:t===Xt.round?{type:pc.PROPORTIONAL_RADIUS}:null,elbowed:t===Xt.elbow,angle:t===Xt.elbow?0:a.angle,points:t===Xt.elbow||a.elbowed?[sr.pointFromAbsoluteCoords({...a,x:c[0],y:c[1],angle:0},c,s),sr.pointFromAbsoluteCoords({...a,x:c[0],y:c[1],angle:0},m,s)]:a.points});if(Dx(p)){p.fixedSegments=null;let d=n.scene.getNonDeletedElementsMap();n.dismissLinearEditor();let h=sr.getPointAtIndexGlobalCoordinates(p,0,d),f=sr.getPointAtIndexGlobalCoordinates(p,-1,d),g=p.startBinding&&d.get(p.startBinding.elementId),b=p.endBinding&&d.get(p.endBinding.elementId),y=g&&p.startBinding?{...p.startBinding,...kx(p,g,"start",d,o.isBindingEnabled)}:null,v=b&&p.endBinding?{...p.endBinding,...kx(p,b,"end",d,o.isBindingEnabled)}:null;p={...p,startBinding:y,endBinding:v,...z6(p,d,{points:[h,f].map(x=>y6(x[0]-p.x,x[1]-p.y)),startBinding:y,endBinding:v,fixedSegments:null})}}else{let d=n.scene.getNonDeletedElementsMap();if(p.startBinding){let h=d.get(p.startBinding.elementId);h&&Sx(p,h,o.bindMode==="inside"?"inside":"orbit","start",n.scene)}if(p.endBinding){let h=d.get(p.endBinding.elementId);h&&Sx(p,h,o.bindMode==="inside"?"inside":"orbit","end",n.scene)}}return p}),i={...o,currentItemArrowType:t},l=o.selectedLinearElement?.elementId;if(l){let a=r.find(s=>s.id===l);a&&(i.selectedLinearElement=new sr(a,Gp(e)))}return{elements:r,appState:i,captureUpdate:Je.IMMEDIATELY}},PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>ut("fieldset",{children:[J("legend",{children:E("labels.arrowtypes")}),J("div",{className:"buttonList",children:J(Wt,{group:"arrowtypes",options:[{value:Xt.sharp,text:E("labels.arrowtype_sharp"),icon:Xr,testId:"sharp-arrow"},{value:Xt.round,text:E("labels.arrowtype_round"),icon:Zr,testId:"round-arrow"},{value:Xt.elbow,text:E("labels.arrowtype_elbowed"),icon:Kr,testId:"elbow-arrow"}],value:nt(e,n,r=>uc(r)?r.elbowed?Xt.elbow:r.roundness?Xt.round:Xt.sharp:null,r=>uc(r),r=>r?null:o.currentItemArrowType),onChange:r=>t(r)})})]})});import{clamp as qp,roundToStep as ak}from"@excalidraw/math";import{DEFAULT_CANVAS_BACKGROUND_PICKS as lk,CURSOR_TYPE as Ox,MAX_ZOOM as zx,MIN_ZOOM as Hx,THEME as qa,ZOOM_STEP as Jp,updateActiveTool as di,CODES as Io,KEYS as Zo}from"@excalidraw/common";import{getNonDeletedElements as sk}from"@excalidraw/element";import{getCommonBounds as ck}from"@excalidraw/element";import{CaptureUpdateAction as Co}from"@excalidraw/element";import{useEffect as ek}from"react";import{jsx as ok}from"react/jsx-runtime";var ci=()=>{let e=document.querySelector(".excalidraw-tooltip");if(e)return e;let o=document.createElement("div");return document.body.appendChild(o),o.classList.add("excalidraw-tooltip"),o},Kp=(e,o,t="bottom")=>{let n=e.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,l=5,a=o.left+o.width/2-n.width/2;a<0?a=l:a+n.width>=r&&(a=r-n.width-l);let s;t==="bottom"?(s=o.top+o.height+l,s+n.height>=i&&(s=o.top-n.height-l)):(s=o.top-n.height-l,s<0&&(s=o.top+o.height+l)),Object.assign(e.style,{top:`${s}px`,left:`${a}px`})},tk=(e,o,t,n)=>{o.classList.add("excalidraw-tooltip--visible"),o.style.minWidth=n?"50ch":"10ch",o.style.maxWidth=n?"50ch":"15ch",o.textContent=t;let r=e.getBoundingClientRect();Kp(o,r)},st=({children:e,label:o,long:t=!1,style:n,disabled:r})=>(ek(()=>()=>ci().classList.remove("excalidraw-tooltip--visible"),[]),r?null:ok("div",{className:"excalidraw-tooltip-wrapper",onPointerEnter:i=>tk(i.currentTarget,ci(),o,t),onPointerLeave:()=>ci().classList.remove("excalidraw-tooltip--visible"),style:n,children:e}));import{CURSOR_TYPE as Zp,MIME_TYPES as $p,THEME as Nx}from"@excalidraw/common";var Bx='<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">',nk='<path d="M6.164 11.755a5.314 5.314 0 0 1-4.932-5.298 5.314 5.314 0 0 1 5.311-5.311 5.314 5.314 0 0 1 5.307 5.113l8.773 8.773a3.322 3.322 0 0 1 0 4.696l-.895.895a3.322 3.322 0 0 1-4.696 0l-8.868-8.868Z" style="fill:#fff"/>',Fx='<path stroke="#1b1b1f" fill="#fff" d="m7.868 11.113 7.773 7.774a2.359 2.359 0 0 0 1.667.691 2.368 2.368 0 0 0 2.357-2.358c0-.625-.248-1.225-.69-1.667L11.201 7.78 9.558 9.469l-1.69 1.643v.001Zm10.273 3.606-3.333 3.333m-3.25-6.583 2 2m-7-7 3 3M3.664 3.625l1 1M2.529 6.922l1.407-.144m5.735-2.932-1.118.866M4.285 9.823l.758-1.194m1.863-6.207-.13 1.408"/>',rk=`data:${$p.svg},${encodeURIComponent(`${Bx}${Fx}</svg>`)}`,ik=`data:${$p.svg},${encodeURIComponent(`${Bx}${nk}${Fx}</svg>`)}`,It=e=>{e&&(e.style.cursor="")},pe=(e,o)=>{e&&(e.style.cursor=o)},vo,Rx,jp=(e,o)=>{let n=()=>{let r=o===Nx.DARK;vo=document.createElement("canvas"),vo.theme=o,vo.height=20,vo.width=20;let i=vo.getContext("2d");i.lineWidth=1,i.beginPath(),i.arc(vo.width/2,vo.height/2,5,0,2*Math.PI),i.fillStyle=r?"#000":"#fff",i.fill(),i.strokeStyle=r?"#fff":"#000",i.stroke(),Rx=vo.toDataURL($p.svg)};(!vo||vo.theme!==o)&&n(),pe(e,`url(${Rx}) ${20/2} ${20/2}, auto`)},Ct=(e,o)=>{if(e)if(o.activeTool.type==="selection")It(e);else if(ro(o))e.style.cursor=Zp.GRAB;else if(wt(o))jp(e,o.theme);else if(o.activeTool.type==="laser"){let t=o.theme===Nx.LIGHT?rk:ik;e.style.cursor=`url(${t}), auto`}else["image","custom"].includes(o.activeTool.type)?o.activeTool.type!=="image"&&(e.style.cursor=Zp.AUTO):e.style.cursor=Zp.CROSSHAIR};var To=({viewportX:e,viewportY:o,nextZoom:t},n)=>{let r=e-n.offsetLeft,i=o-n.offsetTop,l=n.zoom.value,a=n.scrollX+(r-r/l),s=n.scrollY+(i-i/l),c=-(r-r/t),m=-(i-i/t);return{scrollX:a+c,scrollY:s+m,zoom:{value:t}}};import{jsx as xc,jsxs as uk}from"react/jsx-runtime";var dk=N({name:"changeViewBackgroundColor",label:"labels.canvasBackground",trackEvent:!1,predicate:(e,o,t,n)=>!!n.props.UIOptions.canvasActions.changeViewBackgroundColor&&!o.viewModeEnabled,perform:(e,o,t)=>({appState:{...o,...t},captureUpdate:t?.viewBackgroundColor?Co.IMMEDIATELY:Co.EVENTUALLY}),PanelComponent:({elements:e,appState:o,updateData:t,appProps:n,data:r})=>xc(Ya,{palette:null,topPicks:lk,label:E("labels.canvasBackground"),type:"canvasBackground",color:o.viewBackgroundColor,onChange:i=>t({viewBackgroundColor:i}),"data-testid":"canvas-background-picker",elements:e,appState:o,updateData:t})}),hc=N({name:"zoomIn",label:"buttons.zoomIn",viewMode:!0,icon:Nm,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>({appState:{...o,...To({viewportX:o.width/2+o.offsetLeft,viewportY:o.height/2+o.offsetTop,nextZoom:Gt(o.zoom.value+Jp)},o),userToFollow:null},captureUpdate:Co.EVENTUALLY}),PanelComponent:({updateData:e,appState:o})=>xc(V,{type:"button",className:"zoom-in-button zoom-button",icon:Nm,title:`${E("buttons.zoomIn")} \u2014 ${L("CtrlOrCmd++")}`,"aria-label":E("buttons.zoomIn"),disabled:o.zoom.value>=zx,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Io.EQUAL||e.code===Io.NUM_ADD)&&(e[Zo.CTRL_OR_CMD]||e.shiftKey)}),gc=N({name:"zoomOut",label:"buttons.zoomOut",icon:Bm,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>({appState:{...o,...To({viewportX:o.width/2+o.offsetLeft,viewportY:o.height/2+o.offsetTop,nextZoom:Gt(o.zoom.value-Jp)},o),userToFollow:null},captureUpdate:Co.EVENTUALLY}),PanelComponent:({updateData:e,appState:o})=>xc(V,{type:"button",className:"zoom-out-button zoom-button",icon:Bm,title:`${E("buttons.zoomOut")} \u2014 ${L("CtrlOrCmd+-")}`,"aria-label":E("buttons.zoomOut"),disabled:o.zoom.value<=Hx,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Io.MINUS||e.code===Io.NUM_SUBTRACT)&&(e[Zo.CTRL_OR_CMD]||e.shiftKey)}),fc=N({name:"resetZoom",label:"buttons.resetZoom",icon:j1,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>({appState:{...o,...To({viewportX:o.width/2+o.offsetLeft,viewportY:o.height/2+o.offsetTop,nextZoom:Gt(1)},o),userToFollow:null},captureUpdate:Co.EVENTUALLY}),PanelComponent:({updateData:e,appState:o})=>xc(st,{label:E("buttons.resetZoom"),style:{height:"100%"},children:uk(V,{type:"button",className:"reset-zoom-button zoom-button",title:E("buttons.resetZoom"),"aria-label":E("buttons.resetZoom"),onClick:()=>{e(null)},children:[(o.zoom.value*100).toFixed(0),"%"]})}),keyTest:e=>(e.code===Io.ZERO||e.code===Io.NUM_ZERO)&&(e[Zo.CTRL_OR_CMD]||e.shiftKey)}),mk=(e,o,t=1)=>{let[n,r,i,l]=e,a=i-n,s=o.width/a,c=l-r,m=o.height/c,d=Math.min(s,m)*qp(t,.1,1);return Math.min(d,1)},Gx=({bounds:e,appState:o,canvasOffsets:t,fitToViewport:n=!1,viewportZoomFactor:r=1,minZoom:i=-1/0,maxZoom:l=1/0})=>{r=qp(r,Hx,zx);let[a,s,c,m]=e,p=(a+c)/2,d=(s+m)/2,h=t?.left??0,f=t?.top??0,g=t?.right??0,b=t?.bottom??0,y=o.width-h-g,v=o.height-f-b,x;if(n){let S=c-a,P=m-s;x=Math.min(y/S,v/P)*r}else x=mk(e,{width:y,height:v},r);let w=Gt(qp(ak(x,Jp,"floor"),i,l)),T=h1({scenePoint:{x:p,y:d},viewportDimensions:{width:o.width,height:o.height},offsets:t,zoom:{value:w}});return{appState:{...o,scrollX:T.scrollX,scrollY:T.scrollY,zoom:{value:w}},captureUpdate:Co.EVENTUALLY}},Ja=({canvasOffsets:e,targetElements:o,appState:t,fitToViewport:n,viewportZoomFactor:r,minZoom:i,maxZoom:l})=>{let a=ck(sk(o));return Gx({canvasOffsets:e,bounds:a,appState:t,fitToViewport:n,viewportZoomFactor:r,minZoom:i,maxZoom:l})},xq=N({name:"zoomToFitSelectionInViewport",label:"labels.zoomToFitViewport",icon:Fs,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>{let r=n.scene.getSelectedElements(o);return Ja({targetElements:r.length?r:e,appState:{...o,userToFollow:null},fitToViewport:!1,canvasOffsets:n.getEditorUIOffsets()})},keyTest:e=>e.code===Io.TWO&&e.shiftKey&&!e.altKey&&!e[Zo.CTRL_OR_CMD]}),bq=N({name:"zoomToFitSelection",label:"helpDialog.zoomToSelection",icon:Fs,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>{let r=n.scene.getSelectedElements(o);return Ja({targetElements:r.length?r:e,appState:{...o,userToFollow:null},fitToViewport:!0,canvasOffsets:n.getEditorUIOffsets()})},keyTest:e=>e.code===Io.THREE&&e.shiftKey&&!e.altKey&&!e[Zo.CTRL_OR_CMD]}),pk=N({name:"zoomToFit",label:"helpDialog.zoomToFit",icon:Fs,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,o,t,n)=>Ja({targetElements:e,appState:{...o,userToFollow:null},fitToViewport:!1,canvasOffsets:n.getEditorUIOffsets()}),keyTest:e=>e.code===Io.ONE&&e.shiftKey&&!e.altKey&&!e[Zo.CTRL_OR_CMD]}),Ec=N({name:"toggleTheme",label:(e,o)=>o.theme===qa.DARK?"buttons.lightMode":"buttons.darkMode",keywords:["toggle","dark","light","mode","theme"],icon:(e,o)=>e.theme===qa.LIGHT?La:Da,viewMode:!0,trackEvent:{category:"canvas"},perform:(e,o,t)=>({appState:{...o,theme:t||(o.theme===qa.LIGHT?qa.DARK:qa.LIGHT)},captureUpdate:Co.EVENTUALLY}),keyTest:e=>e.altKey&&e.shiftKey&&e.code===Io.D,predicate:(e,o,t,n)=>!!n.props.UIOptions.canvasActions.toggleTheme}),yq=N({name:"toggleEraserTool",label:"toolBar.eraser",trackEvent:{category:"toolbar"},perform:(e,o,t,n)=>{let r;return wt(o)?r=di(o,{...o.activeTool.lastActiveTool||{type:n.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):r=di(o,{type:"eraser",lastActiveToolBeforeEraser:o.activeTool}),{appState:{...o,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:r},captureUpdate:Co.IMMEDIATELY}},keyTest:e=>e.key===Zo.E}),wq=N({name:"toggleLassoTool",label:"toolBar.lasso",icon:fn,trackEvent:{category:"toolbar"},predicate:(e,o,t,n)=>n.state.preferredSelectionTool.type!=="lasso",perform:(e,o,t,n)=>{let r;return o.activeTool.type!=="lasso"?(r=di(o,{type:"lasso",fromSelection:!1}),pe(n.interactiveCanvas,Ox.CROSSHAIR)):r=di(o,{type:"selection"}),{appState:{...o,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:r},captureUpdate:Co.NEVER}}}),Ux=N({name:"toggleHandTool",label:"toolBar.hand",trackEvent:{category:"toolbar"},icon:Bs,viewMode:!1,perform:(e,o,t,n)=>{let r;return ro(o)?r=di(o,{...o.activeTool.lastActiveTool||{type:"selection"},lastActiveToolBeforeEraser:null}):(r=di(o,{type:"hand",lastActiveToolBeforeEraser:o.activeTool}),pe(n.interactiveCanvas,Ox.GRAB)),{appState:{...o,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:r},captureUpdate:Co.IMMEDIATELY}},keyTest:e=>!e.altKey&&!e[Zo.CTRL_OR_CMD]&&e.key===Zo.H});import{updateActiveTool as Wx}from"@excalidraw/common";import{CaptureUpdateAction as hk}from"@excalidraw/element";var gk=N({name:"setEmbeddableAsActiveTool",trackEvent:{category:"toolbar"},target:"Tool",label:"toolBar.embeddable",perform:(e,o,t,n)=>{let r=Wx(o,{type:"embeddable"});return Ct(n.canvas,{...o,activeTool:r}),{elements:e,appState:{...o,activeTool:Wx(o,{type:"embeddable"})},captureUpdate:hk.EVENTUALLY}}});import{pointFrom as Yx}from"@excalidraw/math";import{bindOrUnbindBindingElement as fk}from"@excalidraw/element/binding";import{isValidPolygon as Vx,newElementWith as Qp}from"@excalidraw/element";import{LinearElementEditor as bc}from"@excalidraw/element/linearElementEditor";import{isBindingElement as Xx,isFreeDrawElement as Kx,isLinearElement as Zx,isLineElement as yc}from"@excalidraw/element";import{KEYS as eu,arrayToMap as Ek,invariant as $x,shouldRotateWithDiscreteAngle as xk,updateActiveTool as jx}from"@excalidraw/common";import{isPathALoop as bk}from"@excalidraw/element";import{isInvisiblySmallElement as tu}from"@excalidraw/element";import{CaptureUpdateAction as qx}from"@excalidraw/element";import{jsx as yk}from"react/jsx-runtime";var ht=N({name:"finalize",label:"",trackEvent:!1,perform:(e,o,t,n)=>{let r=e,{interactiveCanvas:i,focusContainer:l,scene:a}=n,s=a.getNonDeletedElementsMap();if(t&&o.selectedLinearElement){let{event:d,sceneCoords:h}=t,f=bc.getElement(o.selectedLinearElement.elementId,s);$x(f,"Arrow element should exist if selectedLinearElement is set"),$x(h,"sceneCoords should be defined if actionFinalize is called with event");let g=bc.handlePointerUp(d,o.selectedLinearElement,o,n.scene);if(Xx(f)&&!o.selectedLinearElement.segmentMidPointHoveredCoords){let b=!!o.newElement,v=(b||!o.selectedLinearElement.selectedPointsIndices?[f.points.length-1]:o.selectedLinearElement.selectedPointsIndices).reduce((x,w)=>(x.set(w,{point:bc.pointFromAbsoluteCoords(f,Yx(h.x-g.pointerOffset.x,h.y-g.pointerOffset.y),s)}),x),new Map)??new Map;fk(f,v,h.x-g.pointerOffset.x,h.y-g.pointerOffset.y,a,o,{newArrow:b,altKey:d.altKey,angleLocked:xk(d)})}else yc(f)&&o.selectedLinearElement?.isEditing&&!o.newElement&&!Vx(f.points)&&a.mutateElement(f,{polygon:!1});if(g!==o.selectedLinearElement){f&&tu(f)&&(r=r.map(y=>y.id===f.id?Qp(y,{isDeleted:!0}):y));let b=o.activeTool?.locked;return{elements:f.points.length<2||tu(f)?e.map(y=>y.id===f.id?Qp(y,{isDeleted:!0}):y):r,appState:{...o,cursorButton:"up",selectedLinearElement:b?null:{...g,selectedPointsIndices:null,isEditing:!1,initialState:{...g.initialState,lastClickedPoint:-1},pointerOffset:{x:0,y:0}},selectionElement:null,suggestedBinding:null,newElement:null,multiElement:null},captureUpdate:qx.IMMEDIATELY}}}window.document.activeElement instanceof HTMLElement&&l();let c=null;if(o.multiElement)c=o.multiElement;else if(o.newElement?.type==="freedraw"||Xx(o.newElement))c=o.newElement;else if(Object.keys(o.selectedElementIds).length===1){let d=s.get(Object.keys(o.selectedElementIds)[0]);d&&(c=d)}if(c){if(o.selectedLinearElement&&o.multiElement&&c.type!=="freedraw"&&o.lastPointerDownWith!=="touch"){let{points:d}=c,{lastCommittedPoint:h}=o.selectedLinearElement;(!h||d[d.length-1]!==h)&&a.mutateElement(c,{points:c.points.slice(0,-1)})}if(c&&tu(c)&&(r=r.map(d=>d.id===c?.id?Qp(d,{isDeleted:!0}):d)),Zx(c)||Kx(c)){if(bk(c.points,o.zoom.value)&&(yc(c)||Kx(c))){let h=c.points,f=h[0],g=h.map((b,y)=>y===h.length-1?Yx(f[0],f[1]):b);yc(c)?a.mutateElement(c,{points:g,polygon:!0}):a.mutateElement(c,{points:g})}yc(c)&&!Vx(c.points)&&a.mutateElement(c,{polygon:!1})}}(!o.activeTool.locked&&o.activeTool.type!=="freedraw"||!c)&&It(i);let m;o.activeTool.type==="eraser"?m=jx(o,{...o.activeTool.lastActiveTool||{type:n.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):m=jx(o,{type:n.state.preferredSelectionTool.type});let p=c&&Zx(c)?new bc(c,Ek(r)):o.selectedLinearElement;return p=p&&{...p,isEditing:o.newElement?!1:p.isEditing,initialState:{...p.initialState,lastClickedPoint:-1,origin:null}},{elements:r,appState:{...o,cursorButton:"up",activeTool:(o.activeTool.locked||o.activeTool.type==="freedraw")&&c?o.activeTool:m,activeEmbeddable:null,newElement:null,selectionElement:null,multiElement:null,editingTextElement:null,suggestedBinding:null,frameToHighlight:null,selectedElementIds:c&&!o.activeTool.locked&&o.activeTool.type!=="freedraw"?{...o.selectedElementIds,[c.id]:!0}:o.selectedElementIds,selectedLinearElement:p},captureUpdate:qx.IMMEDIATELY}},keyTest:(e,o)=>e.key===eu.ESCAPE&&o.selectedLinearElement?.isEditing||(e.key===eu.ESCAPE||e.key===eu.ENTER)&&o.multiElement!==null,PanelComponent:({appState:e,updateData:o,data:t})=>yk(V,{type:"button",icon:sE,title:E("buttons.done"),"aria-label":E("buttons.done"),onClick:o,visible:e.multiElement!=null,size:t?.size||"medium",style:{pointerEvents:"all"}})});import{getElementsInGroup as eb,isSomeElementSelected as wk,makeNextSelectedElementIds as vk,selectGroupsForSelectedElements as Tk}from"@excalidraw/element";import{CaptureUpdateAction as Jx}from"@excalidraw/element";import{KEYS as Ik,isWritableElement as Ck,updateActiveTool as Qx}from"@excalidraw/common";var Sk=(e,o)=>e.activeTool.type==="eraser"?Qx(e,{...e.activeTool.lastActiveTool||{type:o.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):Qx(e,{type:o.state.preferredSelectionTool.type}),kk=(e,o,t)=>{if(!e.editingGroupId)return null;let n=o.scene.getNonDeletedElements(),r=o.scene.getSelectedElements({selectedElementIds:t,elements:n}),i=r.length?r:eb(n,e.editingGroupId);for(let l of i){let a=l.groupIds.indexOf(e.editingGroupId);if(a!==-1&&l.groupIds[a+1])return l.groupIds[a+1]}return null},Mk=N({name:"deselect",label:"",trackEvent:!1,perform:(e,o,t,n)=>{let r=Sk(o,n);if(o.editingGroupId){let i=n.scene.getNonDeletedElements(),l=Object.keys(o.selectedElementIds).length>0?o.selectedElementIds:eb(i,o.editingGroupId).reduce((a,s)=>(a[s.id]=!0,a),{});return{appState:{...o,...Tk({editingGroupId:kk(o,n,l),selectedElementIds:l},i,o,n),activeEmbeddable:null,activeTool:r,selectedLinearElement:null,selectionElement:null,showHyperlinkPopup:!1,suggestedBinding:null,frameToHighlight:null},captureUpdate:Jx.IMMEDIATELY}}return{appState:{...o,activeEmbeddable:null,activeTool:r,editingGroupId:null,selectedElementIds:vk({},o),selectedGroupIds:{},selectedLinearElement:null,selectionElement:null,showHyperlinkPopup:!1,suggestedBinding:null,frameToHighlight:null},captureUpdate:Jx.IMMEDIATELY}},keyTest:(e,o,t,n)=>e.key!==Ik.ESCAPE||Ck(e.target)?!1:!o.newElement&&o.multiElement===null&&!o.selectedLinearElement?.isEditing&&(o.activeEmbeddable!==null||o.activeTool.type!==n.state.preferredSelectionTool.type||!!o.editingGroupId||!!o.selectedLinearElement||wk(n.scene.getNonDeletedElements(),o))});import{KEYS as kc,DEFAULT_EXPORT_PADDING as hM,EXPORT_SCALES as gM,THEME as ol}from"@excalidraw/common";import{getNonDeletedElements as fM}from"@excalidraw/element";import{CaptureUpdateAction as lo}from"@excalidraw/element";import Pk from"clsx";import{jsx as tb,jsxs as Ak}from"react/jsx-runtime";var ou=({children:e,checked:o,onChange:t,className:n})=>Ak("div",{className:Pk("Checkbox",n,{"is-checked":o}),onClick:r=>{t(!o,r),r.currentTarget.querySelector(".Checkbox-box").focus()},children:[tb("button",{type:"button",className:"Checkbox-box",role:"checkbox","aria-checked":o,children:Ls}),tb("div",{className:"Checkbox-label",children:e})]});import{THEME as Qa}from"@excalidraw/common";import{jsx as el}from"react/jsx-runtime";var nb=e=>{let o=e.title||(e.value===Qa.DARK?E("buttons.lightMode"):E("buttons.darkMode"));return el(V,{type:"icon",icon:e.value===Qa.LIGHT?ob.MOON:ob.SUN,title:o,"aria-label":o,onClick:()=>e.onChange(e.value===Qa.DARK?Qa.LIGHT:Qa.DARK),"data-testid":"toggle-dark-mode"})},ob={SUN:el("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:el("path",{fill:"currentColor",d:"M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z"})}),MOON:el("svg",{width:"512",height:"512",className:"rtl-mirror",viewBox:"0 0 512 512",children:el("path",{fill:"currentColor",d:"M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"})})};import{useState as Lk}from"react";import{focusNearestParent as Dk,KEYS as _k}from"@excalidraw/common";import{jsx as rb,jsxs as Rk}from"react/jsx-runtime";var ib=e=>{let{id:o}=_e(),[t,n]=Lk(e.value),r=l=>{e.ignoreFocus||Dk(l.target);let a=l.target.value;a!==e.value&&e.onChange(a)},i=l=>{if(l.key===_k.ENTER){if(l.preventDefault(),l.nativeEvent.isComposing||l.keyCode===229)return;l.currentTarget.blur()}};return Rk("div",{className:"ProjectName",children:[rb("label",{className:"ProjectName-label",htmlFor:"filename",children:`${e.label}:`}),rb("input",{type:"text",className:"TextInput",onBlur:r,onKeyDown:i,id:`${o}-filename`,value:t,onChange:l=>n(l.target.value)})]})};import{useCallback as Nk,useEffect as Bk,useRef as Fk}from"react";import{jsx as wc,jsxs as Gk}from"react/jsx-runtime";var Ok=5e3,zk=({progress:e})=>wc("div",{className:"Toast__progress-bar",children:wc("div",{className:"Toast__progress-bar-fill",style:{width:`${Math.min(5,Math.round(e*100))}%`}})}),Hk=({message:e,onClose:o,closable:t=!1,duration:n=Ok,style:r})=>{let i=Fk(0),l=n!==1/0,a=Nk(()=>{l&&(i.current=window.setTimeout(()=>o(),n))},[o,n,l]);return Bk(()=>{if(l)return a(),()=>clearTimeout(i.current)},[a,e,n,l]),Gk("div",{className:"Toast",role:"status",onMouseEnter:l?()=>clearTimeout(i?.current):void 0,onMouseLeave:l?a:void 0,style:r,children:[wc("div",{className:"Toast__message",children:e}),t&&wc(V,{icon:xo,"aria-label":"close",type:"icon",onClick:o,className:"close"})]})},mi=Object.assign(Hk,{ProgressBar:zk});import{DEFAULT_EXPORT_PADDING as rM,DEFAULT_FILENAME as iM,IMAGE_MIME_TYPES as pb,isFirefox as aM,MIME_TYPES as lM,cloneJSON as sM,SVG_DOCUMENT_PREAMBLE as cM,arrayToMap as dM}from"@excalidraw/common";import{getNonDeletedElements as mM}from"@excalidraw/element";import{isFrameLikeElement as pM}from"@excalidraw/element";import{getElementsOverlappingFrame as uM}from"@excalidraw/element";import{ALLOWED_PASTE_MIME_TYPES as Uk,EXPORT_DATA_TYPES as tl,MIME_TYPES as _t,arrayToMap as Wk,isMemberOf as Yk,isPromiseLike as Vk,EVENT as vc}from"@excalidraw/common";import{mutateElement as Xk}from"@excalidraw/element";import{deepCopyElement as Kk}from"@excalidraw/element";import{isFrameLikeElement as Zk,isInitializedImageElement as $k}from"@excalidraw/element";import{getContainingFrame as ab}from"@excalidraw/element";var YJ="clipboard"in navigator&&"readText"in navigator.clipboard,Tc="clipboard"in navigator&&"writeText"in navigator.clipboard,Pn="clipboard"in navigator&&"write"in navigator.clipboard&&"ClipboardItem"in window&&"toBlob"in HTMLCanvasElement.prototype,jk=e=>!!([tl.excalidraw,tl.excalidrawClipboard,tl.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),lb=({types:e,files:o})=>{!e&&!o&&console.warn("createPasteEvent: no types or files provided");let t=new ClipboardEvent(vc.PASTE,{clipboardData:new DataTransfer});if(e)for(let[n,r]of Object.entries(e)){if(typeof r!="string"){o=o||[],o.push(r);continue}try{if(t.clipboardData?.items.add(r,n),t.clipboardData?.getData(n)!==r)throw new Error(`Failed to set "${n}" as clipboardData item`)}catch(i){throw new Error(i.message)}}if(o){let n=-1;for(let r of o){n++;try{if(t.clipboardData?.items.add(r),t.clipboardData?.files[n]!==r)throw new Error(`Failed to set file "${r.name}" as clipboardData item`)}catch(i){throw new Error(i.message)}}}return t},qk=({elements:e,files:o})=>{let t=Wk(e),n=new Set(e.filter(a=>Zk(a))),r=!1,i=e.reduce((a,s)=>($k(s)&&(r=!0,o&&o[s.fileId]&&(a[s.fileId]=o[s.fileId])),a),{});r&&!o&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let l={type:tl.excalidrawClipboard,elements:e.map(a=>{if(ab(a,t)&&!n.has(ab(a,t))){let s=Kk(a);return Xk(s,t,{frameId:null}),s}return a}),files:o?i:void 0};return JSON.stringify(l)},Ic=async(e,o,t)=>{let n=qk({elements:e,files:o});await ao({[_t.excalidrawClipboard]:n,[_t.text]:n},t)};function sb(e){let o=[];for(let t of e.childNodes)if(t.nodeType===3){let n=t.textContent?.trim();n&&o.push({type:"text",value:n})}else if(t instanceof HTMLImageElement){let n=t.getAttribute("src");n&&n.startsWith("http")&&o.push({type:"imageUrl",value:n})}else o=o.concat(sb(t));return o}var Jk=e=>{let o=e.value;try{let t=new DOMParser().parseFromString(o,_t.html),n=sb(t.body);if(n.length)return{type:"mixedContent",value:n}}catch(t){console.error(`error in parseHTMLFromPaste: ${t.message}`)}return null},cb=async()=>{let e={},o;try{o=await navigator.clipboard?.read()}catch(t){try{if(navigator.clipboard?.readText){console.warn(`navigator.clipboard.readText() failed (${t.message}). Failling back to navigator.clipboard.read()`);let n=await navigator.clipboard?.readText();if(n)return{[_t.text]:n}}}catch(n){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${n.message}). Failling back to navigator.clipboard.read()`);else{if(n.name==="DataError")return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${n.message}`),e;throw n}}throw t}for(let t of o)for(let n of t.types)if(Yk(Uk,n))try{if(n===_t.text||n===_t.html)e[n]=await(await t.getType(n)).text();else if(k1(n)){let r=await t.getType(n),i=_1(r,n,void 0);e[n]=i}else throw new Mm(`Unsupported clipboard type: ${n}`)}catch(r){console.warn(r instanceof Mm?r.message:`Cannot retrieve ${n} from clipboardItem: ${r.message}`)}return Object.keys(e).length===0&&console.warn("No clipboard data found from clipboard.read()."),e},Qk=async(e,o=!1)=>{try{let t=e.findByType(_t.html),n=!o&&t&&Jk(t);return n?n.value.every(r=>r.type==="text")?{type:"text",value:e.getData(_t.text)??n.value.map(r=>r.value).join(`
|
|
2
|
+
`).trim()}:n:{type:"text",value:(e.getData(_t.text)||"").trim()}}catch{return{type:"text",value:""}}},eM=function(e){return this.find(o=>o.type===e)||null},tM=function(e){return this.find(t=>t.type===e)?.value??null},oM=function(){return this.filter(e=>e.kind==="file")},db=e=>{let o;mb(e)?o=e.clipboardData?.items:o=e.dataTransfer?.items;let t=new Set;for(let n of Array.from(o||[]))t.has(n.type)||t.add(n.type);return t},pi=async e=>{let o;mb(e)?o=e.clipboardData?.items:o=e.dataTransfer?.items;let t=(await Promise.all(Array.from(o||[]).map(async n=>{if(n.kind==="file"){let r=n.getAsFile();if(r){let i=await D1(n);return r=await Pa(r),{type:r.type,kind:"file",file:r,fileHandle:i}}}else if(n.kind==="string"){let{type:r}=n,i;return"clipboardData"in e&&e.clipboardData?i=e.clipboardData?.getData(r):i=await new Promise(l=>{n.getAsString(a=>l(a))}),{type:r,kind:"string",value:i}}return null}))).filter(n=>n!=null);return Object.assign(t,{findByType:eM,getData:tM,getFiles:oM})},Cc=async(e,o=!1)=>{let t=await Qk(e,o);if(t.type==="mixedContent")return{mixedContent:t.value};try{let n=JSON.parse(t.value),r=n.type===tl.excalidrawClipboardWithAPI;if(jk(n))return{elements:n.elements,files:n.files,text:o?JSON.stringify(n.elements,null,2):void 0,programmaticAPI:r}}catch{}return{text:t.value}},Sc=async e=>{try{await navigator.clipboard.write([new ClipboardItem({[_t.png]:e})])}catch(o){if(Vk(e))await navigator.clipboard.write([new ClipboardItem({[_t.png]:await e})]);else throw o}},ao=async(e,o)=>{e=e||"";let t=Object.entries(typeof e=="string"?{[_t.text]:e}:e);try{if(o){for(let[r,i]of t)if(o.clipboardData?.setData(r,i),o.clipboardData?.getData(r)!==i)throw new Error("Failed to setData on clipboardEvent");return}}catch(r){console.error(r)}let n=t.find(([r])=>r===_t.text);if(Tc&&n)try{await navigator.clipboard.writeText(n[1]);return}catch(r){console.error(r)}if(n&&!nM(n[1]))throw new Error("Error copying to clipboard.")},nM=e=>{e||(e=" ");let o=document.documentElement.getAttribute("dir")==="rtl",t=document.createElement("textarea");t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px";let n=window.pageYOffset||document.documentElement.scrollTop;t.style.top=`${n}px`,t.style.fontSize="12pt",t.setAttribute("readonly",""),t.value=e,document.body.appendChild(t);let r=!1;try{t.select(),t.setSelectionRange(0,t.value.length),r=document.execCommand("copy")}catch(i){console.error(i)}return t.remove(),r},mb=e=>e.type===vc.PASTE||e.type===vc.COPY||e.type===vc.CUT;var cr=(e,{selectedElementIds:o},t)=>{e=mM(e);let n=dM(e),r=t&&we(e,{selectedElementIds:o}),i=null,l=r?te(e,{selectedElementIds:o},{includeBoundTextElement:!0}):e;return r&&(l.length===1&&pM(l[0])?(i=l[0],l=uM(e,i,n)):l.length>1&&(l=te(e,{selectedElementIds:o},{includeBoundTextElement:!0,includeElementsInFrames:!0}))),{exportingFrame:i,exportedElements:sM(l)}},dr=async(e,o,t,n,{exportBackground:r,exportPadding:i=rM,viewBackgroundColor:l,name:a=t.name||iM,fileHandle:s=null,exportingFrame:c=null})=>{if(o.length===0)throw new Error(E("alerts.cannotExportEmptyCanvas"));if(e==="svg"||e==="clipboard-svg"){let p=or(o,{exportBackground:r,exportWithDarkMode:t.exportWithDarkMode,viewBackgroundColor:l,exportPadding:i,exportScale:t.exportScale,exportEmbedScene:t.exportEmbedScene&&e==="svg"},n,{exportingFrame:c});if(e==="svg")return Pm(p.then(d=>new Blob([cM+d.outerHTML],{type:lM.svg})),{description:"Export to SVG",name:a,extension:t.exportEmbedScene?"excalidraw.svg":"svg",mimeTypes:[pb.svg],fileHandle:s});if(e==="clipboard-svg"){let d=await p.then(h=>h.outerHTML);try{await ao(d)}catch{throw new Error(E("errors.copyToSystemClipboardFailed"))}return}}let m=xs(o,t,n,{exportBackground:r,viewBackgroundColor:l,exportPadding:i,exportingFrame:c});if(e==="png"){let p=Ma(m);return t.exportEmbedScene&&(p=p.then(d=>import("./data/image-GWMHT2EN.js").then(({encodePngMetadata:h})=>h({blob:d,metadata:Ia(o,t,n,"local")})))),Pm(p,{description:"Export to PNG",name:a,extension:t.exportEmbedScene?"excalidraw.png":"png",mimeTypes:[pb.png],fileHandle:s})}else if(e==="clipboard")try{let p=Ma(m);await Sc(p)}catch(p){throw console.warn(p),p.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(E("canvasError.canvasTooBig")):aM&&p.name==="TypeError"?new Error(`${E("alerts.couldNotCopyToClipboard")}
|
|
3
3
|
|
|
4
4
|
${E("hints.firefox_clipboard_write")}`):new Error(E("alerts.couldNotCopyToClipboard"))}else throw new Error("Unsupported export type")};var ub=async(e,o,t)=>{let n=C1(o);if(!S1(n))throw new Error("fileHandle should exist and should be of type svg or png when resaving");let{elements:r,appState:i,files:l}=await e,{exportBackground:a,viewBackgroundColor:s}=i;i={...i,exportEmbedScene:!0};let{exportedElements:c,exportingFrame:m}=cr(r,i,!1);return await dr(n,c,i,l,{exportBackground:a,viewBackgroundColor:s,name:t,fileHandle:o,exportingFrame:m}),{fileHandle:o}};import{Fragment as Eb,jsx as So,jsxs as xb}from"react/jsx-runtime";var ru=N({name:"changeProjectName",label:"labels.fileTitle",trackEvent:!1,perform:(e,o,t)=>({appState:{...o,name:t},captureUpdate:lo.EVENTUALLY}),PanelComponent:({appState:e,updateData:o,appProps:t,data:n,app:r})=>So(ib,{label:E("labels.fileTitle"),value:r.getName(),onChange:i=>o(i),ignoreFocus:n?.ignoreFocus??!1})}),hb=N({name:"changeExportScale",label:"imageExportDialog.scale",trackEvent:{category:"export",action:"scale"},perform:(e,o,t)=>({appState:{...o,exportScale:t},captureUpdate:lo.EVENTUALLY}),PanelComponent:({elements:e,appState:o,updateData:t})=>{let n=fM(e),i=we(n,o)?te(n,o):n;return So(Eb,{children:gM.map(l=>{let[a,s]=T1(i,hM,l),c=`${E("imageExportDialog.label.scale")} ${l}x (${a}x${s})`;return So(V,{size:"small",type:"radio",icon:`${l}x`,name:"export-canvas-scale",title:c,"aria-label":c,id:"export-canvas-scale",checked:l===o.exportScale,onChange:()=>t(l)},l)})})}}),iu=N({name:"changeExportBackground",label:"imageExportDialog.label.withBackground",trackEvent:{category:"export",action:"toggleBackground"},perform:(e,o,t)=>({appState:{...o,exportBackground:t},captureUpdate:lo.EVENTUALLY}),PanelComponent:({appState:e,updateData:o})=>So(ou,{checked:e.exportBackground,onChange:t=>o(t),children:E("imageExportDialog.label.withBackground")})}),Mc=N({name:"changeExportEmbedScene",label:"imageExportDialog.tooltip.embedScene",trackEvent:{category:"export",action:"embedScene"},perform:(e,o,t)=>({appState:{...o,exportEmbedScene:t},captureUpdate:lo.EVENTUALLY}),PanelComponent:({appState:e,updateData:o})=>xb(ou,{checked:e.exportEmbedScene,onChange:t=>o(t),children:[E("imageExportDialog.label.embedScene"),So(st,{label:E("imageExportDialog.tooltip.embedScene"),long:!0,children:So("div",{className:"excalidraw-tooltip-icon",children:cE})})]})}),ui=!1,nu=(e,o)=>{let t=o.message??E("progressDialog.defaultMessage");e.setAppState({toast:{message:o.progress!=null?xb(Eb,{children:[t,So(mi.ProgressBar,{progress:o.progress})]}):t,duration:1/0}})};async function EM(e,o){if(o.app.state.isLoading&&(nu(o.app,{progress:null}),await o.app.onStateChange({predicate:t=>!t.isLoading})),e!=null&&typeof e=="object"&&Symbol.asyncIterator in e){for await(let t of e){if(o.signal.aborted){e.return();return}if(t.type==="progress")nu(o.app,{message:t.message,progress:t.progress??null});else if(t.type==="done")return}return}e instanceof Promise&&(nu(o.app,{progress:null}),await e)}function gb(e,o,t,n){let r=new AbortController,i=r.signal,l=new Promise(async a=>{try{n.props.onExport&&await EM(n.props.onExport("json",{elements:e,appState:o,files:t},{signal:i}),{app:n,signal:i})}catch(s){s?.name==="AbortError"?console.warn(`onExport() aborted by host app (signal aborted: ${i.aborted})`):console.error("Error during props.onExport() handling",s)}a({elements:e,appState:o,files:n.files})});return{abortController:r,data:l}}var mr=N({name:"saveToActiveFile",label:"buttons.save",icon:_a,trackEvent:{category:"export"},predicate:(e,o,t,n)=>!!n.props.UIOptions.canvasActions.saveToActiveFile&&!!o.fileHandle&&!o.viewModeEnabled,perform:async(e,o,t,n)=>{if(ui)return!1;ui=!0;let r=o.fileHandle,i=n.getName(),{abortController:l,data:a}=gb(e,o,n.files,n);try{let{fileHandle:s}=bs(r)?await ub(a,r,i):await hs({data:a,filename:i,fileHandle:r});return{captureUpdate:lo.NEVER,appState:{fileHandle:s,toast:{message:r&&s?.name?E("toast.fileSavedToFilename").replace("{filename}",`"${s.name}"`):E("toast.fileSaved"),duration:1500}}}}catch(s){return l.abort(),s?.name!=="AbortError"?console.error(s):console.warn(s),{captureUpdate:lo.NEVER,appState:{toast:null}}}finally{ui=!1}},keyTest:e=>!1}),nl=N({name:"saveFileToDisk",label:"exportDialog.disk_title",icon:_a,viewMode:!0,trackEvent:{category:"export"},perform:async(e,o,t,n)=>{if(ui)return!1;ui=!0;let{abortController:r,data:i}=gb(e,o,n.files,n);try{let{fileHandle:l}=await hs({data:i,filename:n.getName(),fileHandle:null});return{captureUpdate:lo.NEVER,appState:{openDialog:null,fileHandle:l,toast:{message:E("toast.fileSaved"),duration:3e3}}}}catch(l){return r.abort(),l?.name!=="AbortError"?console.error(l):console.warn(l),{captureUpdate:lo.NEVER,appState:{toast:null}}}finally{ui=!1}},keyTest:e=>e.key.toLowerCase()===kc.S&&e.shiftKey&&e[kc.CTRL_OR_CMD],PanelComponent:({updateData:e})=>So(V,{type:"button",icon:nE,title:E("buttons.saveAs"),"aria-label":E("buttons.saveAs"),showAriaLabel:me().formFactor==="phone",hidden:!Br,onClick:()=>e(null),"data-testid":"save-as-button"})}),hi=N({name:"loadScene",label:"buttons.load",trackEvent:{category:"export"},predicate:(e,o,t,n)=>!!n.props.UIOptions.canvasActions.loadScene&&!o.viewModeEnabled,perform:async(e,o,t,n)=>{try{let{elements:r,appState:i,files:l}=await Am(o,e);return{elements:r,appState:i,files:l,captureUpdate:lo.IMMEDIATELY}}catch(r){return r?.name==="AbortError"?(console.warn(r),!1):{elements:e,appState:{...o,errorMessage:r.message},files:n.files,captureUpdate:lo.EVENTUALLY}}},keyTest:e=>e[kc.CTRL_OR_CMD]&&e.key===kc.O}),fb=N({name:"exportWithDarkMode",label:"imageExportDialog.label.darkMode",trackEvent:{category:"export",action:"toggleTheme"},perform:(e,o,t,n)=>(n.sessionExportThemeOverride=t?ol.DARK:ol.LIGHT,{appState:{...o,exportWithDarkMode:t},captureUpdate:lo.EVENTUALLY}),PanelComponent:({appState:e,updateData:o})=>So("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"-45px",marginBottom:"10px"},children:So(nb,{value:e.exportWithDarkMode?ol.DARK:ol.LIGHT,onChange:t=>{o(t===ol.DARK)},title:E("imageExportDialog.label.darkMode")})})});import{DEFAULT_FONT_SIZE as xM,DEFAULT_FONT_FAMILY as bM,DEFAULT_TEXT_ALIGN as yM,getLineHeight as wM}from"@excalidraw/common";import{newElementWith as Pc}from"@excalidraw/element";import{hasBoundTextElement as vM,canApplyRoundnessTypeToElement as TM,getDefaultRoundnessTypeForElement as IM,isFrameLikeElement as CM,isArrowElement as SM,isExcalidrawElement as kM,isTextElement as au}from"@excalidraw/element";import{getBoundTextElement as MM,redrawTextBoundingBox as PM}from"@excalidraw/element";import{CaptureUpdateAction as lu}from"@excalidraw/element";var bb="{}",AM=N({name:"copyStyles",label:"labels.copyStyles",icon:Qm,trackEvent:{category:"element"},perform:(e,o,t,n)=>{let r=[],i=e.find(l=>o.selectedElementIds[l.id]);if(r.push(i),i&&vM(i)){let l=MM(i,n.scene.getNonDeletedElementsMap());r.push(l)}return i&&(bb=JSON.stringify(r)),{appState:{...o,toast:{message:E("toast.copyStyles")}},captureUpdate:lu.EVENTUALLY}}}),LM=N({name:"pasteStyles",label:"labels.pasteStyles",icon:Qm,trackEvent:{category:"element"},perform:(e,o,t,n)=>{let r=JSON.parse(bb),i=r[0],l=r[1];if(!kM(i))return{elements:e,captureUpdate:lu.EVENTUALLY};let a=te(e,o,{includeBoundTextElement:!0}),s=a.map(c=>c.id);return{elements:e.map(c=>{if(s.includes(c.id)){let m=i;if(au(c)&&c.containerId&&(m=l),!m)return c;let p=Pc(c,{backgroundColor:m?.backgroundColor,strokeWidth:m?.strokeWidth,strokeColor:m?.strokeColor,strokeStyle:m?.strokeStyle,fillStyle:m?.fillStyle,opacity:m?.opacity,roughness:m?.roughness,roundness:m.roundness?TM(m.roundness.type,c)?m.roundness:IM(c):null});if(au(p)){let d=m.fontSize||xM,h=m.fontFamily||bM;p=Pc(p,{fontSize:d,fontFamily:h,textAlign:m.textAlign||yM,lineHeight:m.lineHeight||wM(h)});let f=null;p.containerId&&(f=a.find(g=>au(p)&&g.id===p.containerId)||null),PM(p,f,n.scene)}return p.type==="arrow"&&SM(m)&&(p=Pc(p,{startArrowhead:m.startArrowhead,endArrowhead:m.endArrowhead})),CM(c)&&(p=Pc(p,{roundness:null,backgroundColor:"transparent"})),p}return c}),captureUpdate:lu.IMMEDIATELY}}});import{KEYS as DM}from"@excalidraw/common";import{CaptureUpdateAction as _M}from"@excalidraw/element";var pr=N({name:"toggleShortcuts",label:"welcomeScreen.defaults.helpHint",icon:J1,viewMode:!0,trackEvent:{category:"menu",action:"toggleHelpDialog"},perform:(e,o,t,{focusContainer:n})=>(o.openDialog?.name==="help"&&n(),{appState:{...o,openDialog:o.openDialog?.name==="help"?null:{name:"help"},openMenu:null,openPopup:null},captureUpdate:_M.EVENTUALLY}),keyTest:e=>e.key===DM.QUESTION_MARK});import{getNonDeletedElements as Lc}from"@excalidraw/element";import{newElementWith as vb}from"@excalidraw/element";import{isBoundToContainer as RM}from"@excalidraw/element";import{frameAndChildrenSelectedTogether as NM,getElementsInResizingFrame as BM,getFrameLikeElements as FM,getRootElements as OM,groupByFrameLikes as zM,removeElementsFromFrame as HM,replaceAllElementsInFrame as GM}from"@excalidraw/element";import{KEYS as Dc,randomId as UM,arrayToMap as su}from"@excalidraw/common";import{getSelectedGroupIds as Ac,selectGroup as WM,selectGroupsForSelectedElements as YM,getElementsInGroup as yb,addToGroup as VM,removeFromSelectedGroups as XM,isElementInGroup as Tb}from"@excalidraw/element";import{syncMovedIndices as KM}from"@excalidraw/element";import{CaptureUpdateAction as rl}from"@excalidraw/element";import{jsx as gi}from"react/jsx-runtime";var ZM=e=>{if(e.length>=2){let o=e[0].groupIds;for(let t of o)if(e.reduce((n,r)=>n&&Tb(r,t),!0))return!0}return!1},wb=(e,o,t)=>{let n=t.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!0});return n.length>=2&&!ZM(n)&&!NM(n)},cu=N({name:"group",label:"labels.group",icon:e=>gi($m,{theme:e.theme}),trackEvent:{category:"element"},perform:(e,o,t,n)=>{let r=OM(n.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!0}));if(r.length<2)return{appState:o,elements:e,captureUpdate:rl.EVENTUALLY};let i=Ac(o);if(i.length===1){let b=i[0],y=new Set(yb(e,b).map(w=>w.id)),v=new Set(r.map(w=>w.id));if(new Set([...Array.from(y),...Array.from(v)]).size===y.size)return{appState:o,elements:e,captureUpdate:rl.EVENTUALLY}}let l=[...e];new Set(r.map(b=>b.frameId)).size>1&&zM(r).forEach((y,v)=>{HM(y,n.scene.getNonDeletedElementsMap())});let s=UM(),c=su(r);l=l.map(b=>c.get(b.id)?vb(b,{groupIds:VM(b.groupIds,s,o.editingGroupId)}):b);let m=yb(l,s),p=m[m.length-1],d=l.lastIndexOf(p),h=l.slice(d+1),f=l.slice(0,d).filter(b=>!Tb(b,s)),g=KM([...f,...m,...h],su(m));return{appState:{...o,...WM(s,{...o,selectedGroupIds:{}},Lc(l))},elements:g,captureUpdate:rl.IMMEDIATELY}},predicate:(e,o,t,n)=>wb(e,o,n),keyTest:e=>!e.shiftKey&&e[Dc.CTRL_OR_CMD]&&e.key===Dc.G,PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>gi(V,{hidden:!wb(e,o,n),type:"button",icon:gi($m,{theme:o.theme}),onClick:()=>t(null),title:`${E("labels.group")} \u2014 ${L("CtrlOrCmd+G")}`,"aria-label":E("labels.group"),visible:we(Lc(e),o)})}),du=N({name:"ungroup",label:"labels.ungroup",icon:e=>gi(jm,{theme:e.theme}),trackEvent:{category:"element"},perform:(e,o,t,n)=>{let r=Ac(o),i=su(e);if(r.length===0)return{appState:o,elements:e,captureUpdate:rl.EVENTUALLY};let l=[...e],a=[];l=l.map(d=>{RM(d)&&a.push(d.id);let h=XM(d.groupIds,o.selectedGroupIds);return h.length===d.groupIds.length?d:vb(d,{groupIds:h})});let s=YM(o,Lc(l),o,null),c=n.scene.getSelectedElements(o),m=new Set(c.filter(d=>d.frameId).map(d=>d.frameId));return FM(e).filter(d=>m.has(d.id)).forEach(d=>{d&&(l=GM(l,BM(l,d,o,i),d))}),s.selectedElementIds=Object.entries(s.selectedElementIds).reduce((d,[h,f])=>(f&&!a.includes(h)&&(d[h]=!0),d),{}),{appState:{...o,...s},elements:l,captureUpdate:rl.IMMEDIATELY}},keyTest:e=>e.shiftKey&&e[Dc.CTRL_OR_CMD]&&e.key===Dc.G.toUpperCase(),predicate:(e,o)=>Ac(o).length>0,PanelComponent:({elements:e,appState:o,updateData:t})=>gi(V,{type:"button",hidden:Ac(o).length===0,icon:gi(jm,{theme:o.theme}),onClick:()=>t(null),title:`${E("labels.ungroup")} \u2014 ${L("CtrlOrCmd+Shift+G")}`,"aria-label":E("labels.ungroup"),visible:we(Lc(e),o)})});import tP from"clsx";import{CaptureUpdateAction as Mb}from"@excalidraw/element";import{invariant as oP}from"@excalidraw/common";import{COLOR_CHARCOAL_BLACK as $M,COLOR_VOICE_CALL as jM,COLOR_WHITE as Rc,THEME as qM,UserIdleState as Ib}from"@excalidraw/common";var _c=(e,o,t,n,r,i,l)=>{e.beginPath(),e.moveTo(o+i,t),e.lineTo(o+n-i,t),e.quadraticCurveTo(o+n,t,o+n,t+i),e.lineTo(o+n,t+r-i),e.quadraticCurveTo(o+n,t+r,o+n-i,t+r),e.lineTo(o+i,t+r),e.quadraticCurveTo(o,t+r,o,t+r-i),e.lineTo(o,t+i),e.quadraticCurveTo(o,t,o+i,t),e.closePath(),e.fill(),l&&(e.strokeStyle=l),e.stroke()};function JM(e){let o=0;if(e.length===0)return o;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);o=(o<<5)-o+n}return o}var ur=(e,o)=>`hsl(${Math.abs(JM(o?.id||e))%37*10}, 100%, 83%)`,Cb=e=>{let o=e?.trim()?.codePointAt(0);return(o?String.fromCodePoint(o):"?").toUpperCase()},Sb=({context:e,renderConfig:o,appState:t,normalizedWidth:n,normalizedHeight:r})=>{for(let[i,l]of o.remotePointerViewportCoords){let{x:a,y:s}=l,c=t.collaborators.get(i);a-=t.offsetLeft,s-=t.offsetTop;let m=11,p=14,d=a<0||a>n-m||s<0||s>r-p;a=Math.max(a,0),a=Math.min(a,n-m),s=Math.max(s,0),s=Math.min(s,r-p);let h=ur(i,c);e.save(),e.strokeStyle=h,e.fillStyle=h;let f=o.remotePointerUserStates.get(i),g=d||f===Ib.IDLE||f===Ib.AWAY;g&&(e.globalAlpha=.3),o.remotePointerButton.get(i)==="down"&&(e.beginPath(),e.arc(a,s,15,0,2*Math.PI,!1),e.lineWidth=3,e.strokeStyle="#ffffff88",e.stroke(),e.closePath(),e.beginPath(),e.arc(a,s,15,0,2*Math.PI,!1),e.lineWidth=1,e.strokeStyle=h,e.stroke(),e.closePath());let b=t.theme===qM.DARK?"#2f6330":jM,y=c?.isSpeaking;y&&(e.fillStyle=b,e.strokeStyle=b,e.lineWidth=10,e.lineJoin="round",e.beginPath(),e.moveTo(a,s),e.lineTo(a+0,s+14),e.lineTo(a+4,s+9),e.lineTo(a+11,s+8),e.closePath(),e.stroke(),e.fill()),e.fillStyle=Rc,e.strokeStyle=Rc,e.lineWidth=6,e.lineJoin="round",e.beginPath(),e.moveTo(a,s),e.lineTo(a+0,s+14),e.lineTo(a+4,s+9),e.lineTo(a+11,s+8),e.closePath(),e.stroke(),e.fill(),e.fillStyle=h,e.strokeStyle=h,e.lineWidth=2,e.lineJoin="round",e.beginPath(),g?(e.moveTo(a-1,s-1),e.lineTo(a-1,s+15),e.lineTo(a+5,s+10),e.lineTo(a+12,s+9),e.closePath(),e.fill()):(e.moveTo(a,s),e.lineTo(a+0,s+14),e.lineTo(a+4,s+9),e.lineTo(a+11,s+8),e.closePath(),e.fill(),e.stroke());let v=o.remotePointerUsernames.get(i)||"";if(!d&&v){e.font="600 12px sans-serif";let x=(y?a+0:a)+m/2,w=(y?s+0:s)+p+2,T=5,S=3,P=e.measureText(v),M=P.actualBoundingBoxDescent+P.actualBoundingBoxAscent,_=Math.max(M,12),R=x-1,A=w-1,F=P.width+2+T*2+2,U=_+2+S*2+2;if(e.roundRect?(e.beginPath(),e.roundRect(R,A,F,U,8),e.fillStyle=h,e.fill(),e.strokeStyle=Rc,e.stroke(),y&&(e.beginPath(),e.roundRect(R-2,A-2,F+4,U+4,8),e.strokeStyle=b,e.stroke())):_c(e,R,A,F,U,8,Rc),e.fillStyle=$M,e.fillText(v,x+T+1,w+S+P.actualBoundingBoxAscent+Math.floor((_-M)/2)+2),y){e.fillStyle=b;let j=8,z=8,Z=5;e.fillRect(R+F+z,A+(U/2-j/2),2,j),e.fillRect(R+F+z+Z,A+(U/2-j*2/2),2,j*2),e.fillRect(R+F+z+Z*2,A+(U/2-j/2),2,j)}}e.restore(),e.closePath()}};import QM from"clsx";import{useState as eP}from"react";import{jsx as kb}from"react/jsx-runtime";var mu=({color:e,onClick:o,name:t,src:n,className:r})=>{let i=Cb(t),[l,a]=eP(!1),s=!l&&n,c=s?void 0:{background:e};return kb("div",{className:QM("Avatar",r),style:c,onClick:o,children:s?kb("img",{className:"Avatar-img",src:n,alt:i,referrerPolicy:"no-referrer",onError:()=>a(!0)}):i})};import{jsx as ko,jsxs as Nc}from"react/jsx-runtime";var nP=N({name:"goToCollaborator",label:"Go to a collaborator",viewMode:!0,trackEvent:{category:"collab"},perform:(e,o,t)=>(oP(t,"actionGoToCollaborator: collaborator should be defined when actionGoToCollaborator is called"),!t.socketId||o.userToFollow?.socketId===t.socketId||t.isCurrentUser?{appState:{...o,userToFollow:null},captureUpdate:Mb.EVENTUALLY}:{appState:{...o,userToFollow:{socketId:t.socketId,username:t.username||""},openMenu:o.openMenu==="canvas"?null:o.openMenu},captureUpdate:Mb.EVENTUALLY}),PanelComponent:({updateData:e,data:o,appState:t})=>{let{socketId:n,collaborator:r,withName:i,isBeingFollowed:l}=o,a=ur(n,r),s=tP({"is-followed":l,"is-current-user":r.isCurrentUser===!0,"is-speaking":r.isSpeaking,"is-in-call":r.isInCall,"is-muted":r.isMuted}),c=r.isInCall?r.isSpeaking?Nc("div",{className:"UserList__collaborator-status-icon-speaking-indicator",title:E("userList.hint.isSpeaking"),children:[ko("div",{}),ko("div",{}),ko("div",{})]}):r.isMuted?ko("div",{className:"UserList__collaborator-status-icon-microphone-muted",title:E("userList.hint.micMuted"),children:c0}):ko("div",{title:E("userList.hint.inCall"),children:s0}):null;return i?Nc("div",{className:`dropdown-menu-item dropdown-menu-item-base UserList__collaborator ${s}`,style:{"--avatar-size":"1.5rem"},onClick:()=>e(r),children:[ko(mu,{color:a,onClick:()=>{},name:r.username||"",src:r.avatarUrl,className:s}),ko("div",{className:"UserList__collaborator-name",children:r.username}),Nc("div",{className:"UserList__collaborator-status-icons","aria-hidden":!0,children:[l&&ko("div",{className:"UserList__collaborator-status-icon-is-followed",title:E("userList.hint.followStatus"),children:lr}),c]})]}):Nc("div",{className:`UserList__collaborator UserList__collaborator--avatar-only ${s}`,children:[ko(mu,{color:a,onClick:()=>{e(r)},name:r.username||"",src:r.avatarUrl,className:s}),c&&ko("div",{className:"UserList__collaborator-status-icon",children:c})]})}});import{getNonDeletedElements as fi}from"@excalidraw/element";import{isFrameLikeElement as rP}from"@excalidraw/element";import{updateFrameMembershipOfSelectedElements as iP}from"@excalidraw/element";import{KEYS as An,arrayToMap as aP}from"@excalidraw/common";import{alignElements as lP}from"@excalidraw/element";import{CaptureUpdateAction as Ei}from"@excalidraw/element";import{getSelectedElementsByGroup as sP}from"@excalidraw/element";import{jsx as bi}from"react/jsx-runtime";var Qe=(e,o)=>{let t=o.scene.getSelectedElements(e);return sP(t,o.scene.getNonDeletedElementsMap(),e).length>1&&!t.some(n=>rP(n))},xi=(e,o,t,n)=>{let r=t.scene.getSelectedElements(o),i=lP(r,n,t.scene,o),l=aP(i);return iP(e.map(a=>l.get(a.id)||a),o,t)},cP=N({name:"alignTop",label:"labels.alignTop",icon:Wm,trackEvent:{category:"element"},predicate:(e,o,t,n)=>Qe(o,n),perform:(e,o,t,n)=>({appState:o,elements:xi(e,o,n,{position:"start",axis:"y"}),captureUpdate:Ei.IMMEDIATELY}),keyTest:e=>e[An.CTRL_OR_CMD]&&e.shiftKey&&e.key===An.ARROW_UP,PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>bi(V,{hidden:!Qe(o,n),type:"button",icon:Wm,onClick:()=>t(null),title:`${E("labels.alignTop")} \u2014 ${L("CtrlOrCmd+Shift+Up")}`,"aria-label":E("labels.alignTop"),visible:we(fi(e),o)})}),dP=N({name:"alignBottom",label:"labels.alignBottom",icon:Ym,trackEvent:{category:"element"},predicate:(e,o,t,n)=>Qe(o,n),perform:(e,o,t,n)=>({appState:o,elements:xi(e,o,n,{position:"end",axis:"y"}),captureUpdate:Ei.IMMEDIATELY}),keyTest:e=>e[An.CTRL_OR_CMD]&&e.shiftKey&&e.key===An.ARROW_DOWN,PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>bi(V,{hidden:!Qe(o,n),type:"button",icon:Ym,onClick:()=>t(null),title:`${E("labels.alignBottom")} \u2014 ${L("CtrlOrCmd+Shift+Down")}`,"aria-label":E("labels.alignBottom"),visible:we(fi(e),o)})}),mP=N({name:"alignLeft",label:"labels.alignLeft",icon:Vm,trackEvent:{category:"element"},predicate:(e,o,t,n)=>Qe(o,n),perform:(e,o,t,n)=>({appState:o,elements:xi(e,o,n,{position:"start",axis:"x"}),captureUpdate:Ei.IMMEDIATELY}),keyTest:e=>e[An.CTRL_OR_CMD]&&e.shiftKey&&e.key===An.ARROW_LEFT,PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>bi(V,{hidden:!Qe(o,n),type:"button",icon:Vm,onClick:()=>t(null),title:`${E("labels.alignLeft")} \u2014 ${L("CtrlOrCmd+Shift+Left")}`,"aria-label":E("labels.alignLeft"),visible:we(fi(e),o)})}),pP=N({name:"alignRight",label:"labels.alignRight",icon:Xm,trackEvent:{category:"element"},predicate:(e,o,t,n)=>Qe(o,n),perform:(e,o,t,n)=>({appState:o,elements:xi(e,o,n,{position:"end",axis:"x"}),captureUpdate:Ei.IMMEDIATELY}),keyTest:e=>e[An.CTRL_OR_CMD]&&e.shiftKey&&e.key===An.ARROW_RIGHT,PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>bi(V,{hidden:!Qe(o,n),type:"button",icon:Xm,onClick:()=>t(null),title:`${E("labels.alignRight")} \u2014 ${L("CtrlOrCmd+Shift+Right")}`,"aria-label":E("labels.alignRight"),visible:we(fi(e),o)})}),uP=N({name:"alignVerticallyCentered",label:"labels.centerVertically",icon:Km,trackEvent:{category:"element"},predicate:(e,o,t,n)=>Qe(o,n),perform:(e,o,t,n)=>({appState:o,elements:xi(e,o,n,{position:"center",axis:"y"}),captureUpdate:Ei.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>bi(V,{hidden:!Qe(o,n),type:"button",icon:Km,onClick:()=>t(null),title:E("labels.centerVertically"),"aria-label":E("labels.centerVertically"),visible:we(fi(e),o)})}),hP=N({name:"alignHorizontallyCentered",label:"labels.centerHorizontally",icon:Zm,trackEvent:{category:"element"},predicate:(e,o,t,n)=>Qe(o,n),perform:(e,o,t,n)=>({appState:o,elements:xi(e,o,n,{position:"center",axis:"x"}),captureUpdate:Ei.IMMEDIATELY}),PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>bi(V,{hidden:!Qe(o,n),type:"button",icon:Zm,onClick:()=>t(null),title:E("labels.centerHorizontally"),"aria-label":E("labels.centerHorizontally"),visible:we(fi(e),o)})});import{getNonDeletedElements as Pb}from"@excalidraw/element";import{isFrameLikeElement as gP}from"@excalidraw/element";import{CODES as Ab,KEYS as Lb,arrayToMap as fP}from"@excalidraw/common";import{updateFrameMembershipOfSelectedElements as EP}from"@excalidraw/element";import{distributeElements as xP}from"@excalidraw/element";import{CaptureUpdateAction as Db}from"@excalidraw/element";import{getSelectedElementsByGroup as bP}from"@excalidraw/element";import{jsx as Nb}from"react/jsx-runtime";var _b=(e,o)=>{let t=o.scene.getSelectedElements(e);return bP(t,o.scene.getNonDeletedElementsMap(),e).length>2&&!t.some(n=>gP(n))},Rb=(e,o,t,n)=>{let r=t.scene.getSelectedElements(o),i=xP(r,t.scene.getNonDeletedElementsMap(),n,o,t.scene),l=fP(i);return EP(e.map(a=>l.get(a.id)||a),o,t)},yP=N({name:"distributeHorizontally",label:"labels.distributeHorizontally",trackEvent:{category:"element"},perform:(e,o,t,n)=>({appState:o,elements:Rb(e,o,n,{space:"between",axis:"x"}),captureUpdate:Db.IMMEDIATELY}),keyTest:e=>!e[Lb.CTRL_OR_CMD]&&e.altKey&&e.code===Ab.H,PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>Nb(V,{hidden:!_b(o,n),type:"button",icon:uE,onClick:()=>t(null),title:`${E("labels.distributeHorizontally")} \u2014 ${L("Alt+H")}`,"aria-label":E("labels.distributeHorizontally"),visible:we(Pb(e),o)})}),wP=N({name:"distributeVertically",label:"labels.distributeVertically",trackEvent:{category:"element"},perform:(e,o,t,n)=>({appState:o,elements:Rb(e,o,n,{space:"between",axis:"y"}),captureUpdate:Db.IMMEDIATELY}),keyTest:e=>!e[Lb.CTRL_OR_CMD]&&e.altKey&&e.code===Ab.V,PanelComponent:({elements:e,appState:o,updateData:t,app:n})=>Nb(V,{hidden:!_b(o,n),type:"button",icon:hE,onClick:()=>t(null),title:`${E("labels.distributeVertically")} \u2014 ${L("Alt+V")}`,"aria-label":E("labels.distributeVertically"),visible:we(Pb(e),o)})});import{arrayToMap as Bb,KEYS as TP,matchKey as IP}from"@excalidraw/common";import{CaptureUpdateAction as CP}from"@excalidraw/element";import{updateFrameMembershipOfSelectedElements as SP}from"@excalidraw/element/frame";import{arrangeElements as kP}from"@excalidraw/element/arrange";var vP={fitToViewport:!0,animate:!0,duration:200,viewportZoomFactor:.8},yi=(e,o)=>({smartZoom:{...vP,...o?.smartZoom},arrange:{...e.arrangeConfiguration,...o?.arrange},normalise:{...e.normaliseConfiguration,...o?.normalise}});import{jsx as AP}from"react/jsx-runtime";var MP=(e,o,t)=>{let n=t.scene.getSelectedElements(o),r=Bb(e),{arrange:i}=yi(o,t.props.editorPreferences),l=kP(t.scene,n,r,i.algorithm,i.gap),a=Bb(l);return SP(e.map(s=>a.get(s.id)||s),o,t)},PP=Qe,pu=N({name:"arrangeElements",label:"labels.arrangeElements",keywords:["arrange","rearrange","spread"],icon:tp,trackEvent:{category:"element"},viewMode:!1,predicate:(e,o,t,n)=>PP(o,n),perform:(e,o,t,n)=>({appState:o,elements:MP(e,o,n),captureUpdate:CP.IMMEDIATELY}),keyTest:e=>e.shiftKey&&IP(e,TP.R),PanelComponent:({updateData:e})=>AP("button",{type:"button",className:"arrangeButton",onClick:()=>e(null),title:`${E("labels.arrangeElements")} \u2014 ${L("Shift+R")}`,children:tp})});import{arrayToMap as Fb}from"@excalidraw/common";import{CaptureUpdateAction as LP}from"@excalidraw/element";import{updateFrameMembershipOfSelectedElements as DP}from"@excalidraw/element/frame";import{normaliseElements as _P}from"@excalidraw/element/normalise";import{jsx as BP}from"react/jsx-runtime";var RP=(e,o,t)=>{let n=t.scene.getSelectedElements(o),r=Fb(e),{normalise:i}=yi(o,t.props.editorPreferences),l=_P(t.scene,n,r,i.mode,i.metric),a=Fb(l);return DP(e.map(s=>a.get(s.id)||s),o,t)},NP=Qe,uu=N({name:"normaliseElements",label:"labels.normaliseElements",keywords:["normalize","normalise","scale","size","image"],icon:op,trackEvent:{category:"element"},viewMode:!1,predicate:(e,o,t,n)=>NP(o,n),perform:(e,o,t,n)=>({appState:o,elements:RP(e,o,n),captureUpdate:LP.IMMEDIATELY}),PanelComponent:({updateData:e})=>BP("button",{type:"button",className:"arrangeButton",onClick:()=>e(null),title:E("labels.normaliseElements"),children:op})});import{getNonDeletedElements as FP}from"@excalidraw/element";import{bindOrUnbindBindingElements as OP}from"@excalidraw/element";import{getCommonBoundingBox as Ob}from"@excalidraw/element";import{newElementWith as zP}from"@excalidraw/element";import{deepCopyElement as HP}from"@excalidraw/element";import{resizeMultipleElements as GP}from"@excalidraw/element";import{isArrowElement as zb,isElbowArrow as UP}from"@excalidraw/element";import{updateFrameMembershipOfSelectedElements as Hb}from"@excalidraw/element";import{CODES as Gb,KEYS as WP,arrayToMap as YP}from"@excalidraw/common";import{CaptureUpdateAction as Ub}from"@excalidraw/element";var hu=N({name:"flipHorizontal",label:"labels.flipHorizontal",icon:u0,trackEvent:{category:"element"},perform:(e,o,t,n)=>({elements:Hb(Wb(e,n.scene.getNonDeletedElementsMap(),o,"horizontal",n),o,n),appState:o,captureUpdate:Ub.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===Gb.H}),gu=N({name:"flipVertical",label:"labels.flipVertical",icon:p0,trackEvent:{category:"element"},perform:(e,o,t,n)=>({elements:Hb(Wb(e,n.scene.getNonDeletedElementsMap(),o,"vertical",n),o,n),appState:o,captureUpdate:Ub.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===Gb.V&&!e[WP.CTRL_OR_CMD]}),Wb=(e,o,t,n,r)=>{let i=te(FP(e),t,{includeBoundTextElement:!0,includeElementsInFrames:!0}),l=VP(i,o,n,r),a=YP(l);return e.map(s=>a.get(s.id)||s)},VP=(e,o,t,n)=>{if(e.every(d=>zb(d)&&(d.startBinding||d.endBinding)))return e.map(d=>{let h=d;return zP(h,{startArrowhead:h.endArrowhead,endArrowhead:h.startArrowhead})});let{midX:r,midY:i}=Ob(e);GP(e,o,"nw",n.scene,new Map(Array.from(o.values()).map(d=>[d.id,HP(d)])),{flipByX:t==="horizontal",flipByY:t==="vertical",shouldResizeFromCenter:!0,shouldMaintainAspectRatio:!0}),OP(e.filter(zb),n.scene,n.state);let{elbowArrows:l,otherElements:a}=e.reduce((d,h)=>UP(h)?{...d,elbowArrows:d.elbowArrows.concat(h)}:{...d,otherElements:d.otherElements.concat(h)},{elbowArrows:[],otherElements:[]}),{midX:s,midY:c}=Ob(e),[m,p]=[r-s,i-c];return a.forEach(d=>n.scene.mutateElement(d,{x:d.x+m,y:d.y+p})),l.forEach(d=>n.scene.mutateElement(d,{x:d.x+m,y:d.y+p})),e};import{isTextElement as XP}from"@excalidraw/element";import{getTextFromElements as KP}from"@excalidraw/element";import{CODES as ZP,KEYS as Yb,isFirefox as $P}from"@excalidraw/common";import{CaptureUpdateAction as Rt}from"@excalidraw/element";var wi=N({name:"copy",label:"labels.copy",icon:Aa,trackEvent:{category:"element"},perform:async(e,o,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});try{await Ic(r,n.files,t)}catch(i){return{captureUpdate:Rt.EVENTUALLY,appState:{...o,errorMessage:i.message}}}return{captureUpdate:Rt.EVENTUALLY}},keyTest:void 0}),fu=N({name:"paste",label:"labels.paste",trackEvent:{category:"element"},perform:async(e,o,t,n)=>{let r;try{r=await cb()}catch(i){return i.name==="AbortError"||i.name==="NotAllowedError"?!1:(console.error(`actionPaste ${i.name}: ${i.message}`),$P?{captureUpdate:Rt.EVENTUALLY,appState:{...o,errorMessage:E("hints.firefox_clipboard_write")}}:{captureUpdate:Rt.EVENTUALLY,appState:{...o,errorMessage:E("errors.asyncPasteFailedOnRead")}})}try{n.pasteFromClipboard(lb({types:r}))}catch(i){return console.error(i),{captureUpdate:Rt.EVENTUALLY,appState:{...o,errorMessage:E("errors.asyncPasteFailedOnParse")}}}return{captureUpdate:Rt.EVENTUALLY}},keyTest:void 0}),Bc=N({name:"cut",label:"labels.cut",icon:e0,trackEvent:{category:"element"},perform:(e,o,t,n)=>(wi.perform(e,o,t,n),Oa.perform(e,o,null,n)),keyTest:e=>e[Yb.CTRL_OR_CMD]&&e.key===Yb.X}),jP=N({name:"copyAsSvg",label:"labels.copyAsSvg",icon:h0,trackEvent:{category:"element"},perform:async(e,o,t,n)=>{if(!n.canvas)return{captureUpdate:Rt.EVENTUALLY};let{exportedElements:r,exportingFrame:i}=cr(e,o,!0);try{await dr("clipboard-svg",r,o,n.files,{...o,exportingFrame:i,name:n.getName()});let l=n.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});return{appState:{toast:{message:E("toast.copyToClipboardAsSvg",{exportSelection:l.length?E("toast.selection"):E("toast.canvas"),exportColorScheme:o.exportWithDarkMode?E("buttons.darkMode"):E("buttons.lightMode")})}},captureUpdate:Rt.EVENTUALLY}}catch(l){return console.error(l),{appState:{errorMessage:l.message},captureUpdate:Rt.EVENTUALLY}}},predicate:e=>Tc&&e.length>0,keywords:["svg","clipboard","copy"]}),qP=N({name:"copyAsPng",label:"labels.copyAsPng",icon:g0,trackEvent:{category:"element"},perform:async(e,o,t,n)=>{if(!n.canvas)return{captureUpdate:Rt.EVENTUALLY};let r=n.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),{exportedElements:i,exportingFrame:l}=cr(e,o,!0);try{return await dr("clipboard",i,o,n.files,{...o,exportingFrame:l,name:n.getName()}),{appState:{...o,toast:{message:E("toast.copyToClipboardAsPng",{exportSelection:r.length?E("toast.selection"):E("toast.canvas"),exportColorScheme:o.exportWithDarkMode?E("buttons.darkMode"):E("buttons.lightMode")})}},captureUpdate:Rt.EVENTUALLY}}catch(a){return console.error(a),{appState:{...o,errorMessage:a.message},captureUpdate:Rt.EVENTUALLY}}},predicate:e=>Pn&&e.length>0,keyTest:e=>e.code===ZP.C&&e.altKey&&e.shiftKey,keywords:["png","clipboard","copy"]}),Fc=N({name:"copyText",label:"labels.copyText",trackEvent:{category:"element"},perform:(e,o,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!0});try{ao(KP(r))}catch{throw new Error(E("errors.copyToSystemClipboardFailed"))}return{captureUpdate:Rt.EVENTUALLY}},predicate:(e,o,t,n)=>Tc&&n.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!0}).some(XP),keywords:["text","clipboard","copy"]});import{CODES as JP,KEYS as QP}from"@excalidraw/common";import{CaptureUpdateAction as eA}from"@excalidraw/element";var vi=N({name:"gridMode",icon:x0,keywords:["snap"],label:"labels.toggleGrid",viewMode:!0,trackEvent:{category:"canvas",predicate:e=>e.gridModeEnabled},perform(e,o){return{appState:{...o,gridModeEnabled:!this.checked(o),objectsSnapModeEnabled:!1},captureUpdate:eA.EVENTUALLY}},checked:e=>e.gridModeEnabled,predicate:(e,o,t)=>t.gridModeEnabled===void 0,keyTest:e=>e[QP.CTRL_OR_CMD]&&e.code===JP.QUOTE});import{CaptureUpdateAction as tA}from"@excalidraw/element";var il=N({name:"zenMode",label:"buttons.zenMode",icon:f0,viewMode:!0,trackEvent:{category:"canvas",predicate:e=>!e.zenModeEnabled},perform(e,o){return{appState:{...o,zenModeEnabled:!this.checked(o)},captureUpdate:tA.EVENTUALLY}},checked:e=>e.zenModeEnabled,predicate:(e,o,t,n)=>n.editorInterface.formFactor!=="phone"&&typeof t.zenModeEnabled>"u"});import{CODES as oA,KEYS as nA}from"@excalidraw/common";import{CaptureUpdateAction as rA}from"@excalidraw/element";var so=N({name:"objectsSnapMode",label:"buttons.objectsSnapMode",icon:Vr,viewMode:!1,trackEvent:{category:"canvas",predicate:e=>!e.objectsSnapModeEnabled},perform(e,o){return{appState:{...o,objectsSnapModeEnabled:!this.checked(o),gridModeEnabled:!1},captureUpdate:rA.EVENTUALLY}},checked:e=>e.objectsSnapModeEnabled,predicate:(e,o,t)=>typeof t.objectsSnapModeEnabled>"u",keyTest:e=>!e[nA.CTRL_OR_CMD]&&e.altKey&&e.code===oA.S});import{CaptureUpdateAction as iA}from"@excalidraw/element";var al=N({name:"arrowBinding",label:"labels.arrowBinding",viewMode:!1,trackEvent:{category:"canvas",predicate:e=>e.bindingPreference==="disabled"},perform(e,o){let t=o.bindingPreference==="enabled"?"disabled":"enabled";return{appState:{...o,bindingPreference:t,isBindingEnabled:t==="enabled"},captureUpdate:iA.NEVER}},checked:e=>e.bindingPreference==="enabled"});import{CaptureUpdateAction as aA}from"@excalidraw/element";var ll=N({name:"midpointSnapping",label:"labels.midpointSnapping",viewMode:!1,trackEvent:{category:"canvas",predicate:e=>!e.isMidpointSnappingEnabled},perform(e,o){return{appState:{...o,isMidpointSnappingEnabled:!this.checked(o)},captureUpdate:aA.NEVER}},checked:e=>e.isMidpointSnappingEnabled});import{CODES as lA,KEYS as sA}from"@excalidraw/common";import{CaptureUpdateAction as cA}from"@excalidraw/element";var Ln=N({name:"stats",label:"stats.fullTitle",icon:m0,viewMode:!0,trackEvent:{category:"menu"},keywords:["edit","attributes","customize"],perform(e,o){return{appState:{...o,stats:{...o.stats,open:!this.checked(o)}},captureUpdate:cA.EVENTUALLY}},checked:e=>e.stats.open,keyTest:e=>!e[sA.CTRL_OR_CMD]&&e.altKey&&e.code===lA.SLASH});import{BOUND_TEXT_PADDING as Vb,ROUNDNESS as Xb,TEXT_ALIGN as $b,VERTICAL_ALIGN as jb,arrayToMap as qb,getFontString as dA}from"@excalidraw/common";import{getOriginalContainerHeightFromCache as mA,isBoundToContainer as Kb,resetOriginalContainerCache as pA,updateOriginalContainerCache as uA}from"@excalidraw/element";import{computeBoundTextPosition as hA,computeContainerDimensionForBoundText as Zb,getBoundTextElement as Jb,redrawTextBoundingBox as Qb}from"@excalidraw/element";import{hasBoundTextElement as gA,isArrowElement as fA,isTextBindableContainer as Eu,isTextElement as sl,isUsingAdaptiveRadius as EA}from"@excalidraw/element";import{measureText as xA}from"@excalidraw/element";import{syncMovedIndices as e2}from"@excalidraw/element";import{newElement as bA}from"@excalidraw/element";import{CaptureUpdateAction as xu}from"@excalidraw/element";var bu=N({name:"unbindText",label:"labels.unbindText",trackEvent:{category:"element"},predicate:(e,o,t,n)=>n.scene.getSelectedElements(o).some(i=>gA(i)),perform:(e,o,t,n)=>{let r=n.scene.getSelectedElements(o),i=n.scene.getNonDeletedElementsMap();return r.forEach(l=>{let a=Jb(l,i);if(a){let{width:s,height:c}=xA(a.originalText,dA(a),a.lineHeight),m=mA(l.id);pA(l.id);let{x:p,y:d}=hA(l,a,i);n.scene.mutateElement(a,{containerId:null,width:s,height:c,text:a.originalText,x:p,y:d}),n.scene.mutateElement(l,{boundElements:l.boundElements?.filter(h=>h.id!==a.id),height:m||l.height})}}),{elements:e,appState:o,captureUpdate:xu.IMMEDIATELY}}}),yu=N({name:"bindText",label:"labels.bindText",trackEvent:{category:"element"},predicate:(e,o,t,n)=>{let r=n.scene.getSelectedElements(o);if(r.length===2){let i=sl(r[0])||sl(r[1]),l;if(Eu(r[0])?l=r[0]:Eu(r[1])&&(l=r[1]),i&&l&&Jb(l,n.scene.getNonDeletedElementsMap())===null)return!0}return!1},perform:(e,o,t,n)=>{let r=n.scene.getSelectedElements(o),i,l;sl(r[0])&&Eu(r[1])?(i=r[0],l=r[1]):(i=r[1],l=r[0]),n.scene.mutateElement(i,{containerId:l.id,verticalAlign:jb.MIDDLE,textAlign:$b.CENTER,autoResize:!0,angle:fA(l)?0:l?.angle??0}),n.scene.mutateElement(l,{boundElements:(l.boundElements||[]).concat({type:"text",id:i.id})});let a=l.height;return Qb(i,l,n.scene),uA(l.id,a),{elements:yA(e,l,i),appState:{...o,selectedElementIds:{[l.id]:!0}},captureUpdate:xu.IMMEDIATELY}}}),yA=(e,o,t)=>{let n=e.slice(),r=n.findIndex(l=>l.id===t.id);n.splice(r,1);let i=n.findIndex(l=>l.id===o.id);return n.splice(i+1,0,t),e2(n,qb([o,t])),n},wA=(e,o,t)=>{let n=e.slice(),r=n.findIndex(l=>l.id===o.id);n.splice(r,1);let i=n.findIndex(l=>l.id===t.id);return n.splice(i,0,o),e2(n,qb([o,t])),n},t2=N({name:"wrapTextInContainer",label:"labels.createContainerFromText",trackEvent:{category:"element"},predicate:(e,o,t,n)=>{let r=n.scene.getSelectedElements(o),i=r.some(l=>sl(l)&&!Kb(l));return r.length>0&&i},perform:(e,o,t,n)=>{let r=n.scene.getSelectedElements(o),i=e.slice(),l={};for(let a of r)if(sl(a)&&!Kb(a)){let s=bA({type:"rectangle",backgroundColor:o.currentItemBackgroundColor,boundElements:[...a.boundElements||[],{id:a.id,type:"text"}],angle:a.angle,fillStyle:o.currentItemFillStyle,strokeColor:o.currentItemStrokeColor,roughness:o.currentItemRoughness,strokeWidth:o.currentItemStrokeWidth,strokeStyle:o.currentItemStrokeStyle,roundness:o.currentItemRoundness==="round"?{type:EA("rectangle")?Xb.ADAPTIVE_RADIUS:Xb.PROPORTIONAL_RADIUS}:null,opacity:100,locked:!1,x:a.x-Vb,y:a.y-Vb,width:Zb(a.width,"rectangle"),height:Zb(a.height,"rectangle"),groupIds:a.groupIds,frameId:a.frameId});if(a.boundElements?.length){let c=a.boundElements.filter(p=>p.type==="arrow").map(p=>p.id);i.filter(p=>c.includes(p.id)).forEach(p=>{let d=p.startBinding,h=p.endBinding;d?.elementId===a.id&&(d={...d,elementId:s.id}),h?.elementId===a.id&&(h={...h,elementId:s.id}),(d||h)&&n.scene.mutateElement(p,{startBinding:d,endBinding:h})})}n.scene.mutateElement(a,{containerId:s.id,verticalAlign:jb.MIDDLE,boundElements:null,textAlign:$b.CENTER,autoResize:!0}),Qb(a,s,n.scene),i=wA([...i,s],s,a),l[s.id]=!0}return{elements:i,appState:{...o,selectedElementIds:l},captureUpdate:xu.IMMEDIATELY}}});import{isEmbeddableElement as OA}from"@excalidraw/element";import{KEYS as m2}from"@excalidraw/common";import{CaptureUpdateAction as zA}from"@excalidraw/element";import{pointFrom as i2}from"@excalidraw/math";import vA from"clsx";import{useCallback as o2,useEffect as n2,useLayoutEffect as TA,useRef as IA,useState as CA}from"react";import{EVENT as wu,HYPERLINK_TOOLTIP_DELAY as SA,KEYS as Oc}from"@excalidraw/common";import{getElementAbsoluteCoords as Su}from"@excalidraw/element";import{hitElementBoundingBox as kA}from"@excalidraw/element";import{isElementLink as MA}from"@excalidraw/element";import{getEmbedLink as PA,embeddableURLValidator as AA}from"@excalidraw/element";import{sceneCoordsToViewportCoords as a2,viewportCoordsToSceneCoords as LA,wrapEvent as DA,isLocalLink as _A,normalizeLink as vu}from"@excalidraw/common";import{isEmbeddableElement as Tu}from"@excalidraw/element";import{jsx as Ti,jsxs as r2}from"react/jsx-runtime";var ku=380,RA=42,Iu=5,l2=85,NA=500,Cu=!1,zc=new Map,s2=({element:e,scene:o,setAppState:t,onLinkOpen:n,setToast:r,updateEmbedValidationStatus:i})=>{let l=o.getNonDeletedElementsMap(),a=yo(),s=ai(),c=me(),m=e.link||"",[p,d]=CA(m),h=IA(null),f=a.showHyperlinkPopup==="editor",g=o2(()=>{if(!h.current)return;let w=vu(h.current.value)||null;if(!e.link&&w&&de("hyperlink","create"),Tu(e)){if(a.activeEmbeddable?.element===e&&t({activeEmbeddable:null}),!w){o.mutateElement(e,{link:null}),i(e,!1);return}if(!AA(w,s.validateEmbeddable))w&&r({message:E("toast.unableToEmbed"),closable:!0}),e.link&&zc.set(e.id,e.link),o.mutateElement(e,{link:w}),i(e,!1);else{let{width:T,height:S}=e,P=PA(w);P?.error instanceof URIError&&r({message:E("toast.unrecognizedLinkFormat"),closable:!0});let M=P?P.intrinsicSize.w/P.intrinsicSize.h:1,_=zc.get(e.id)!==e.link;o.mutateElement(e,{..._?{width:P?.type==="video"?T>S?T:S*M:T,height:P?.type==="video"&&T>S?T/M:S}:{},link:w}),i(e,!0),zc.has(e.id)&&zc.delete(e.id)}}else o.mutateElement(e,{link:w})},[e,o,r,s.validateEmbeddable,a.activeEmbeddable,t,i]);TA(()=>()=>{g()},[g]),n2(()=>{f&&h?.current&&!(c.formFactor==="phone"||c.isTouchScreen)&&h.current.select()},[f,c.formFactor,c.isTouchScreen]),n2(()=>{let w=null,T=S=>{if(f)return;w&&clearTimeout(w),FA(e,l,a,i2(S.clientX,S.clientY))&&(w=window.setTimeout(()=>{t({showHyperlinkPopup:!1})},NA))};return window.addEventListener(wu.POINTER_MOVE,T,!1),()=>{window.removeEventListener(wu.POINTER_MOVE,T,!1),w&&clearTimeout(w)}},[a,e,f,t,l]);let b=o2(()=>{de("hyperlink","delete"),o.mutateElement(e,{link:null}),t({showHyperlinkPopup:!1})},[t,e,o]),y=()=>{de("hyperlink","edit","popup-ui"),t({showHyperlinkPopup:"editor"})},{x:v,y:x}=c2(e,a,l);return a.contextMenu||a.selectedElementsAreBeingDragged||a.resizingElement||a.isRotating||a.openMenu||a.viewModeEnabled?null:r2("div",{className:"excalidraw-hyperlinkContainer",style:{top:`${x}px`,left:`${v}px`,width:ku,padding:Iu},children:[f?Ti("input",{className:vA("excalidraw-hyperlinkContainer-input"),placeholder:E("labels.link.hint"),ref:h,value:p,onChange:w=>d(w.target.value),autoFocus:!0,onKeyDown:w=>{w.stopPropagation(),w[Oc.CTRL_OR_CMD]&&w.key===Oc.K&&w.preventDefault(),(w.key===Oc.ENTER||w.key===Oc.ESCAPE)&&(g(),t({showHyperlinkPopup:"info"}))}}):e.link?Ti("a",{href:vu(e.link||""),className:"excalidraw-hyperlinkContainer-link",target:_A(e.link)?"_self":"_blank",onClick:w=>{if(e.link&&n){let T=DA(wu.EXCALIDRAW_LINK,w.nativeEvent);n({...e,link:vu(e.link)},T),T.defaultPrevented&&w.preventDefault()}},rel:"noopener noreferrer",children:e.link}):Ti("div",{className:"excalidraw-hyperlinkContainer-link",children:E("labels.link.empty")}),r2("div",{className:"excalidraw-hyperlinkContainer__buttons",children:[!f&&Ti(V,{type:"button",title:E("buttons.edit"),"aria-label":E("buttons.edit"),label:E("buttons.edit"),onClick:y,className:"excalidraw-hyperlinkContainer--edit",icon:En}),Ti(V,{type:"button",title:E("labels.linkToElement"),"aria-label":E("labels.linkToElement"),label:E("labels.linkToElement"),onClick:()=>{t({openDialog:{name:"elementLinkSelector",sourceElementId:e.id}})},icon:zs}),m&&!Tu(e)&&Ti(V,{type:"button",title:E("buttons.remove"),"aria-label":E("buttons.remove"),label:E("buttons.remove"),onClick:b,className:"excalidraw-hyperlinkContainer--remove",icon:ir})]})]})},c2=(e,o,t)=>{let[n,r]=Su(e,t),{x:i,y:l}=a2({sceneX:n+e.width/2,sceneY:r},o),a=i-o.offsetLeft-ku/2,s=l-o.offsetTop-l2;return{x:a,y:s}},Mu=(e,o)=>{let t=te(e,o);return Tu(t[0])?"labels.link.editEmbed":t[0]?.link?"labels.link.edit":"labels.link.create"},cl=null,d2=(e,o,t)=>{cl&&clearTimeout(cl),cl=window.setTimeout(()=>BA(e,o,t),SA)},BA=(e,o,t)=>{if(!e.link)return;let n=ci();n.classList.add("excalidraw-tooltip--visible"),n.style.maxWidth="20rem",n.textContent=MA(e.link)?E("labels.link.goToElement"):e.link;let[r,i,l,a]=Su(e,t),[s,c,m,p]=b1([r,i,l,a],e.angle,o),d=a2({sceneX:s,sceneY:c},o);Kp(n,{left:d.x,top:d.y,width:m,height:p},"top"),de("hyperlink","tooltip","link-icon"),Cu=!0},Pu=()=>{cl&&clearTimeout(cl),Cu&&(Cu=!1,ci().classList.remove("excalidraw-tooltip--visible"))},FA=(e,o,t,[n,r])=>{let{x:i,y:l}=LA({clientX:n,clientY:r},t),a=15/t.zoom.value;if(kA(i2(i,l),e,o))return!1;let[s,c,m]=Su(e,o);if(i>=s&&i<=m&&l>=c-l2&&l<=c)return!1;let{x:p,y:d}=c2(e,t,o);return!(n>=p-a&&n<=p+ku+Iu*2+a&&r>=d-a&&r<=d+a+Iu*2+RA)};import{jsx as HA}from"react/jsx-runtime";var Au=N({name:"hyperlink",label:(e,o)=>Mu(e,o),icon:Ra,perform:(e,o)=>o.showHyperlinkPopup==="editor"?!1:{elements:e,appState:{...o,showHyperlinkPopup:"editor",openMenu:null},captureUpdate:zA.IMMEDIATELY},trackEvent:{category:"hyperlink",action:"click"},keyTest:e=>e[m2.CTRL_OR_CMD]&&e.key===m2.K,predicate:(e,o)=>te(e,o).length===1,PanelComponent:({elements:e,appState:o,updateData:t})=>{let n=te(e,o);return HA(V,{type:"button",icon:Ra,"aria-label":E(Mu(e,o)),title:`${OA(e[0])?E("labels.link.labelEmbed"):E("labels.link.label")} - ${L("CtrlOrCmd+K")}`,onClick:()=>t(null),selected:n.length===1&&!!n[0].link})}});import{KEYS as p2,arrayToMap as Du,randomId as GA}from"@excalidraw/common";import{elementsAreInSameGroup as UA,newElementWith as u2,selectGroupsFromGivenElements as h2}from"@excalidraw/element";import{CaptureUpdateAction as g2}from"@excalidraw/element";var Lu=e=>e.every(o=>!o.locked),dl=N({name:"toggleElementLock",label:(e,o,t)=>{let n=t.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!1});return Lu(n)?"labels.elementLock.lock":"labels.elementLock.unlock"},icon:(e,o)=>{let t=te(o,e);return Lu(t)?Hr:rr},trackEvent:{category:"element"},predicate:(e,o,t,n)=>{let r=n.scene.getSelectedElements(o);return r.length>0&&!r.some(i=>i.locked&&i.frameId)},perform:(e,o,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});if(!r.length)return!1;let i=Lu(r),l=Du(r),a=r.length>1&&UA(r),c=r.length===1||a?null:GA(),m={...o.lockedMultiSelections};if(i)m={...o.lockedMultiSelections,...c?{[c]:!0}:{}};else if(a){let y=r[0].groupIds.at(-1);delete m[y]}let p=e.map(y=>{if(!l.has(y.id))return y;let v=y.groupIds;return i?c&&(v=[...v,c]):v=v.filter(x=>!o.lockedMultiSelections[x]),u2(y,{locked:i,groupIds:v.length!==y.groupIds.length?v:y.groupIds})}),d=Du(p),h=i?{}:Object.fromEntries(r.map(y=>[y.id,!0])),f=r.map(y=>d.get(y.id)||y),g=i?{}:h2(f,o),b=i?c||(a?r[0].groupIds.at(-1):r[0].id):null;return{elements:p,appState:{...o,selectedElementIds:h,selectedGroupIds:g,selectedLinearElement:i?null:o.selectedLinearElement,lockedMultiSelections:m,activeLockedId:b},captureUpdate:g2.IMMEDIATELY}},keyTest:(e,o,t,n)=>e.key.toLocaleLowerCase()===p2.L&&e[p2.CTRL_OR_CMD]&&e.shiftKey&&n.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!1}).length>0}),f2=N({name:"unlockAllElements",trackEvent:{category:"canvas"},viewMode:!1,icon:rr,predicate:(e,o)=>te(e,o).length===0&&e.some(n=>n.locked),perform:(e,o)=>{let t=e.filter(l=>l.locked),n=e.map(l=>{if(l.locked){let a=l.groupIds.filter(s=>!o.lockedMultiSelections[s]);return u2(l,{locked:!1,groupIds:l.groupIds.length!==a.length?a:l.groupIds})}return l}),r=Du(n),i=t.map(l=>r.get(l.id)||l);return{elements:n,appState:{...o,selectedElementIds:Object.fromEntries(t.map(l=>[l.id,!0])),selectedGroupIds:h2(i,o),lockedMultiSelections:{},activeLockedId:null},captureUpdate:g2.IMMEDIATELY}},label:"labels.elementLock.unlockAll"});import{isElbowArrow as OL,isLinearElement as zL,isLineElement as Pi}from"@excalidraw/element";import{arrayToMap as HL,invariant as ju}from"@excalidraw/common";import{toggleLinePolygonState as GL,CaptureUpdateAction as z2}from"@excalidraw/element";import{getSizeFromPoints as Dpe,randomInteger as BL,getUpdatedTimestamp as FL}from"@excalidraw/common";import{simplify as wL}from"points-on-curve";import{getStroke as vL}from"perfect-freehand";import{pointsOnBezierCurves as ere}from"points-on-curve";import{invariant as ore}from"@excalidraw/common";import{curve as rre,lineSegment as ire,pointFrom as are,pointDistance as lre,pointFromArray as sre,pointFromVector as cre,pointRotateRads as dre,polygon as mre,polygonFromPoints as pre,PRECISION as ure,segmentsIntersectAt as hre,vector as gre,vectorAdd as fre,vectorFromPoint as Ere,vectorScale as xre}from"@excalidraw/math";import{getElementAbsoluteCoords as yre}from"@excalidraw/element";var _u=e=>{if(!e)return[];for(let o of e.sets)if(o.type==="path")return o.ops;return e.sets[0].ops};import{pointFrom as TL,pointDistance as R2,pointRotateRads as Epe}from"@excalidraw/math";import{ROUGHNESS as IL,THEME as $u,isTransparent as El,assertNever as CL,COLOR_PALETTE as SL,LINE_POLYGON_POINT_MERGE_DISTANCE as bpe,applyDarkModeFilter as xl}from"@excalidraw/common";import{RoughGenerator as kL}from"roughjs/bin/generator";import Pme from"roughjs/bin/rough";import{isRightAngleRads as Lme,lineSegment as Dme,pointFrom as _me,pointRotateRads as Rme}from"@excalidraw/math";import{BOUND_TEXT_PADDING as Bme,DEFAULT_REDUCED_GLOBAL_ALPHA as Fme,ELEMENT_READY_TO_ERASE_OPACITY as Ome,FRAME_STYLE as zme,DARK_THEME_FILTER as Hme,MIME_TYPES as _2,THEME as Gme,distance as Ume,getFontString as Wme,isRTL as Yme,getVerticalOffset as Vme,invariant as Xme,applyDarkModeFilter as Kme,isSafari as Zme}from"@excalidraw/common";import Fde from"roughjs/bin/rough";import{arrayToMap as zde,invariant as D2,rescalePoints as Hde,sizeOf as Gde}from"@excalidraw/common";import{degreesToRadians as Xu,lineSegment as Wde,pointDistance as Yde,pointFrom as rt,pointFromArray as hL,pointRotateRads as Mi}from"@excalidraw/math";import{pointsOnBezierCurves as Kde}from"points-on-curve";import{pointCenter as ode,pointFrom as nde,pointRotateRads as rde,pointsEqual as ide,pointDistance as ade,vectorFromPoint as lde,curveLength as sde,curvePointAtLength as cde}from"@excalidraw/math";import{DRAGGING_THRESHOLD as pde,KEYS as ude,shouldRotateWithDiscreteAngle as hde,getGridPoint as gde,invariant as fde,isShallowEqual as Ede,getFeatureFlag as xde}from"@excalidraw/common";import{arrayToMap as Fle,getFeatureFlag as Ole,invariant as zle,isTransparent as Hle}from"@excalidraw/common";import{PRECISION as Ule,clamp as Wle,lineSegment as Yle,pointDistance as Vle,pointDistanceSq as Xle,pointFrom as Kle,pointFromVector as Zle,pointRotateRads as $le,pointsEqual as jle,vectorFromPoint as qle,vectorNormalize as Jle,vectorScale as Qle}from"@excalidraw/math";import{invariant as mae,isTransparent as pae}from"@excalidraw/common";import{curveIntersectLineSegment as hae,isPointWithinBounds as gae,lineSegment as fae,lineSegmentIntersectionPoints as Eae,pointFrom as xae,pointFromVector as bae,pointRotateRads as yae,pointsEqual as wae,vectorFromPoint as vae,vectorNormalize as Tae,vectorScale as Iae}from"@excalidraw/math";import{ellipse as Sae,ellipseSegmentInterceptPoints as kae}from"@excalidraw/math/ellipse";import{DEFAULT_ADAPTIVE_RADIUS as VA,DEFAULT_PROPORTIONAL_RADIUS as Nu,invariant as Lre,LINE_CONFIRM_THRESHOLD as XA,ROUNDNESS as Bu}from"@excalidraw/common";import{bezierEquation as _re,curve as Rre,curveCatmullRomCubicApproxPoints as Nre,curveOffsetPoints as Bre,lineSegment as Fre,lineSegmentIntersectionPoints as Ore,pointDistance as KA,pointFrom as zre,pointFromArray as Hre,pointFromVector as Gre,pointRotateRads as Ure,pointTranslate as Wre,rectangle as Yre,vectorFromPoint as Vre,vectorNormalize as Xre,vectorScale as Kre}from"@excalidraw/math";import{ROUNDNESS as Ire,assertNever as Cre}from"@excalidraw/common";import{pointsEqual as kre}from"@excalidraw/math";var E2=e=>!!e&&e.type==="embeddable",x2=e=>!!e&&e.type==="iframe",Ru=e=>!!e&&(e.type==="iframe"||e.type==="embeddable"),$o=e=>e!=null&&e.type==="text";var ml=e=>e!=null&&(e.type==="frame"||e.type==="magicframe");var hr=e=>e!=null&&WA(e.type);var Dn=e=>e!=null&&e.type==="arrow",pl=e=>Dn(e)&&e.elbowed;var WA=e=>e==="arrow"||e==="line";var Ii=e=>e!==null&&"containerId"in e&&e.containerId!==null&&$o(e);var ul=(e,o=1)=>{if(e.length>=3){let[t,n]=[e[0],e[e.length-1]];return KA(t,n)<=XA/o}return!1},hl=(e,o)=>{if(o.roundness?.type===Bu.PROPORTIONAL_RADIUS||o.roundness?.type===Bu.LEGACY)return e*Nu;if(o.roundness?.type===Bu.ADAPTIVE_RADIUS){let t=o.roundness?.value??VA,n=t/Nu;return e<=n?e*Nu:t}return 0};import{ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO as Lie,ARROW_LABEL_WIDTH_FRACTION as Die,BOUND_TEXT_PADDING as _ie,DEFAULT_FONT_SIZE as Rie,TEXT_ALIGN as Nie,VERTICAL_ALIGN as Bie,getFontString as Fie,isProdEnv as Oie,invariant as zie}from"@excalidraw/common";import{pointFrom as Gie,pointRotateRads as Uie}from"@excalidraw/math";import{BOUND_TEXT_PADDING as sie,DEFAULT_FONT_SIZE as cie,DEFAULT_FONT_FAMILY as die,getFontString as mie,isTestEnv as pie,normalizeEOL as uie}from"@excalidraw/common";var hie="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase();import{isDevEnv as wie,isTestEnv as vie}from"@excalidraw/common";import{curvePointDistance as qie,distanceToLineSegment as Jie,pointRotateRads as Qie}from"@excalidraw/math";import{ellipse as tae,ellipseDistanceFromPoint as oae}from"@excalidraw/math/ellipse";var y2=e=>e==="rectangle"||e==="iframe"||e==="embeddable"||e==="line"||e==="diamond"||e==="image";import{invariant as Gae,isDevEnv as Uae,isTestEnv as Wae}from"@excalidraw/common";import{pointFrom as Vae,pointFromVector as Xae,pointRotateRads as Kae,pointScaleFromOrigin as Zae,pointsEqual as $ae,triangleIncludesPoint as jae,vectorCross as qae,vectorFromPoint as eL,vectorScale as Jae}from"@excalidraw/math";var Hu=[1,0],k2=[0,1],Gu=[-1,0],M2=[0,-1],Wc=e=>{let[o,t]=e,n=Math.abs(o),r=Math.abs(t);return o>r?Hu:o<=-r?Gu:t>n?k2:M2},P2=(e,o)=>Wc(eL(e,o)),Yc=(e,o)=>Vc(P2(e,o)),zu=(e,o)=>e[0]===o[0]&&e[1]===o[1],Vc=e=>zu(e,Hu)||zu(e,Gu);import{clamp as rle,pointDistance as ile,pointFrom as ale,pointScaleFromOrigin as lle,pointsEqual as sle,pointTranslate as cle,vector as dle,vectorCross as mle,vectorFromPoint as ple,vectorScale as ule}from"@excalidraw/math";import{BinaryHeap as gle,invariant as fle,isAnyTrue as Ele,getSizeFromPoints as xle,isDevEnv as ble,arrayToMap as yle}from"@excalidraw/common";var mse=10/1.5;import{SHIFT_LOCKING_ANGLE as fse,viewportCoordsToSceneCoords as Ese}from"@excalidraw/common";import{normalizeRadians as bse,radiansBetweenAngles as yse,radiansDifference as wse}from"@excalidraw/math";import{pointsEqual as Tse}from"@excalidraw/math";import{arrayToMap as Nce,findIndex as Bce,findLastIndex as Fce}from"@excalidraw/common";import{arrayToMap as uce,isShallowEqual as mL}from"@excalidraw/common";import{lineSegment as gce,pointFrom as fce,pointRotateRads as Ece}from"@excalidraw/math";import{arrayToMap as Kse}from"@excalidraw/common";import{isPointWithinBounds as $se,pointFrom as jse}from"@excalidraw/math";import{vectorCross as Pse,vectorFromPoint as Ase}from"@excalidraw/math";import{arrayToMap as Rse}from"@excalidraw/common";import{validateOrderKey as Bse,generateNKeysBetween as Fse}from"@excalidraw/fractional-indexing";var L2=(e,o)=>{let t=[];for(let n of e.values())n.frameId===o&&t.push(n);return t};var Sce=function(){let e=null,o=null,t=null,n=(r,i)=>(t!=null&&r===e&&i.selectedElementIds===o||(t=r.some(l=>i.selectedElementIds[l.id]),e=r,o=i.selectedElementIds),t);return n.clearCache=()=>{e=null,o=null,t=null},n}(),Xc=(e,o,t)=>{let n=new Set,r=[];for(let i of e.values()){if(o.selectedElementIds[i.id]){r.push(i),n.add(i.id);continue}if(t?.includeBoundTextElement&&Ii(i)&&o.selectedElementIds[i?.containerId]){r.push(i),n.add(i.id);continue}}if(t?.includeElementsInFrames){let i=[];return r.forEach(l=>{ml(l)&&L2(e,l.id).forEach(a=>!n.has(a.id)&&i.push(a)),i.push(l)}),i}return r};var Vu=(e,o)=>mL(o.selectedElementIds,e)?o.selectedElementIds:e;var pL=function(){let e=null,o=null,t=null,n=(i,l,a,s)=>{if(t!==void 0&&l===o&&i===e&&a.editingGroupId===t?.editingGroupId)return t;let c={};for(let d of i){let h=d.groupIds;if(a.editingGroupId){let f=h.indexOf(a.editingGroupId);f>-1&&(h=h.slice(0,f))}if(h.length>0){let f=h[h.length-1];c[f]=!0}}let m={},p=l.reduce((d,h)=>{if(h.isDeleted)return d;let f=h.groupIds.find(g=>c[g]);return f&&(d[h.id]=!0,Array.isArray(m[f])?m[f].push(h.id):m[f]=[h.id]),d},{});for(let d of Object.keys(m))m[d].length<2&&c[d]&&(c[d]=!1);return o=l,e=i,t={editingGroupId:a.editingGroupId,selectedGroupIds:c,selectedElementIds:Vu({...a.selectedElementIds,...p},s)},t},r=(i,l,a,s)=>{let c=s?s.scene.getSelectedElements({selectedElementIds:i.selectedElementIds,elements:l}):Xc(l,i);return c.length?n(c,l,i,a):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:Vu(i.selectedElementIds,a)}};return r.clearCache=()=>{o=null,e=null,t=null},r}();var Hc=e=>{let o=Math.floor(e.width/2)+1,t=0,n=e.width,r=Math.floor(e.height/2)+1,i=o,l=e.height;return[o,t,n,r,i,l,0,r]};var gL=20,fL=15,EL=e=>{switch(e){case"arrow":return 25;case"diamond":case"diamond_outline":return 12;case"cardinality_many":case"cardinality_one_or_many":case"cardinality_zero_or_many":return fL;case"cardinality_one":case"cardinality_exactly_one":case"cardinality_zero_or_one":return gL;default:return 15}},xL=e=>{switch(e){case"bar":return 90;case"arrow":return 20;default:return 25}},gt=(e,o,t,n,r=0)=>{if(n===null||o.length<1)return null;let i=_u(o[0]);if(i.length<1)return null;let l=t==="start"?1:i.length-1,a=i[l].data;D2(a.length===6,"Op data length is not 6");let s=rt(a[4],a[5]),c=rt(a[2],a[3]),m=rt(a[0],a[1]),p=i[l-1],d=rt(0,0);if(p.op==="move"){let oe=hL(p.data);D2(oe!=null,"Op data is not a point"),d=oe}else p.op==="bcurveTo"&&(d=rt(p.data[4],p.data[5]));let h=(oe,ce)=>Math.pow(1-oe,3)*s[ce]+3*oe*Math.pow(1-oe,2)*c[ce]+3*Math.pow(oe,2)*(1-oe)*m[ce]+d[ce]*Math.pow(oe,3),[f,g]=t==="start"?d:s,[b,y]=[h(.3,0),h(.3,1)],v=Math.hypot(f-b,g-y),x=(f-b)/v,w=(g-y)/v,T=EL(n),S=0;{let[oe,ce]=t==="end"?e.points[e.points.length-1]:e.points[0],[re,B]=e.points.length>1?t==="end"?e.points[e.points.length-2]:e.points[1]:[0,0];S=Math.hypot(oe-re,ce-B)}let M=Math.min(T,S*(n==="diamond"||n==="diamond_outline"?.25:.5)),_=f-x*M*r,R=g-w*M*r,A=_-x*M,F=R-w*M;if(n==="circle"||n==="circle_outline"){let oe=Math.hypot(F-R,A-_)+e.strokeWidth-2;return[_,R,oe]}let U=xL(n);if(n==="cardinality_many"||n==="cardinality_one_or_many"){let[oe,ce]=Mi(rt(_,R),rt(A,F),Xu(-U)),[re,B]=Mi(rt(_,R),rt(A,F),Xu(U));return[A,F,oe,ce,re,B]}let[j,z]=Mi(rt(A,F),rt(_,R),-U*Math.PI/180),[Z,ae]=Mi(rt(A,F),rt(_,R),Xu(U));if(n==="diamond"||n==="diamond_outline"){let oe,ce;if(t==="start"){let[re,B]=e.points.length>1?e.points[1]:[0,0];[oe,ce]=Mi(rt(_+M*2,R),rt(_,R),Math.atan2(B-R,re-_))}else{let[re,B]=e.points.length>1?e.points[e.points.length-2]:[0,0];[oe,ce]=Mi(rt(_-M*2,R),rt(_,R),Math.atan2(R-B,_-re))}return[_,R,j,z,oe,ce,Z,ae]}return[_,R,j,z,Z,ae]};import{pointFrom as lme,pointCenter as sme,pointRotateRads as cme,vectorFromPoint as dme,vectorNormalize as mme,vectorSubtract as pme,vectorAdd as ume,vectorScale as hme,pointFromVector as gme,clamp as fme,isCloseTo as Eme}from"@excalidraw/math";var bL=typeof document<"u"?document.createElement("img"):{src:""};bL.src=`data:${_2.svg},${encodeURIComponent('<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="image" class="svg-inline--fa fa-image fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#888" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>')}`;var yL=typeof document<"u"?document.createElement("img"):{src:""};yL.src=`data:${_2.svg},${encodeURIComponent('<svg viewBox="0 0 668 668" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48ZM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56ZM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.81709 0 0 .81709 124.825 145.825)"/><path d="M256 8C119.034 8 8 119.033 8 256c0 136.967 111.034 248 248 248s248-111.034 248-248S392.967 8 256 8Zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676ZM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676Z" style="fill:#888;fill-rule:nonzero" transform="matrix(.30366 0 0 .30366 506.822 60.065)"/></svg>')}`;var Ku=new WeakMap;var St=class St{};I(St,"rg",new kL),I(St,"cache",new WeakMap),I(St,"get",(o,t)=>{let n=St.cache.get(o);if(n&&(t===null||n.theme===t))return n.shape}),I(St,"delete",o=>{St.cache.delete(o),Ku.delete(o)}),I(St,"destroy",()=>{St.cache=new WeakMap}),I(St,"generateElementShape",(o,t)=>{let n=t?.isExporting?void 0:St.get(o,t?t.theme:null);if(n!==void 0)return n;Ku.delete(o);let r=AL(o,St.rg,t||{isExporting:!1,canvasBackgroundColor:SL.white,embedsValidationStatus:null,theme:$u.LIGHT});return t?.isExporting||St.cache.set(o,{shape:r,theme:t?.theme||$u.LIGHT}),r});var ki=St,ML=e=>[8,8+e],O2=e=>[1.5,6+e];function PL(e){let o=e.roughness,t=Math.max(e.width,e.height),n=Math.min(e.width,e.height);return n>=20&&t>=50||n>=15&&e.roundness&&y2(e.type)||hr(e)&&t>=50?o:Math.min(o/(t<10?3:2),2.5)}var qo=(e,o=!1,t=!1)=>{let n={seed:e.seed,strokeLineDash:e.strokeStyle==="dashed"?ML(e.strokeWidth):e.strokeStyle==="dotted"?O2(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!=="solid",strokeWidth:e.strokeStyle!=="solid"?e.strokeWidth+.5:e.strokeWidth,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:PL(e),stroke:t?xl(e.strokeColor):e.strokeColor,preserveVertices:o||e.roughness<IL.cartoonist};switch(e.type){case"rectangle":case"iframe":case"embeddable":case"diamond":case"ellipse":return n.fillStyle=e.fillStyle,n.fill=El(e.backgroundColor)?void 0:t?xl(e.backgroundColor):e.backgroundColor,e.type==="ellipse"&&(n.curveFitting=1),n;case"line":case"freedraw":return ul(e.points)&&(n.fillStyle=e.fillStyle,n.fill=e.backgroundColor==="transparent"?void 0:t?xl(e.backgroundColor):e.backgroundColor),n;case"arrow":return n;default:throw new Error(`Unimplemented type ${e.type}`)}},N2=(e,o,t)=>Ru(e)&&(o||E2(e)&&t?.get(e.id)!==!0)&&El(e.backgroundColor)&&El(e.strokeColor)?{...e,roughness:0,backgroundColor:"#d3d3d3",fillStyle:"solid"}:x2(e)?{...e,strokeColor:El(e.strokeColor)?"#000000":e.strokeColor,backgroundColor:El(e.backgroundColor)?"#f4f4f6":e.backgroundColor}:e,fl=(e,o,t)=>{if(o===null)return[];let[,,n,r,i,l]=o;return[e.line(n,r,i,l,t)]},Kc=(e,o,t)=>{if(o===null)return[];let[n,r,i,l,a,s]=o;return[e.line(i,l,n,r,t),e.line(a,s,n,r,t)]},gr=(e,o)=>{let t={...o};if(e.strokeStyle==="dotted"){let n=O2(e.strokeWidth-1);t.strokeLineDash=[n[0],n[1]-1]}else delete t.strokeLineDash;return t.roughness=Math.min(1,t.roughness||0),t},Zu=(e,o,t,n,r,i=1)=>{if(n===null)return[];let[l,a,s]=n,c={...o,fill:r,fillStyle:"solid",stroke:t,roughness:Math.min(.5,o.roughness||0)};return delete c.strokeLineDash,[e.circle(l,a,s*i,c)]},B2=(e,o,t,n,r,i,l,a)=>{if(n===null)return[];let s=a?xl(e.strokeColor):e.strokeColor,c=a?xl(l):l,m=-.25,p=.8;switch(n){case"circle":case"circle_outline":return Zu(r,i,s,gt(e,o,t,n),n==="circle_outline"?c:s);case"triangle":case"triangle_outline":{let d=gt(e,o,t,n);if(d===null)return[];let[h,f,g,b,y,v]=d,x={...i,fill:n==="triangle_outline"?c:s,fillStyle:"solid",roughness:Math.min(1,i.roughness||0)};return delete x.strokeLineDash,[r.polygon([[h,f],[g,b],[y,v],[h,f]],x)]}case"diamond":case"diamond_outline":{let d=gt(e,o,t,n);if(d===null)return[];let[h,f,g,b,y,v,x,w]=d,T={...i,fill:n==="diamond_outline"?c:s,fillStyle:"solid",roughness:Math.min(1,i.roughness||0)};return delete T.strokeLineDash,[r.polygon([[h,f],[g,b],[y,v],[x,w],[h,f]],T)]}case"cardinality_one":return fl(r,gt(e,o,t,n),gr(e,i));case"cardinality_many":return Kc(r,gt(e,o,t,n),gr(e,i));case"cardinality_one_or_many":{let d=gr(e,i);return[...Kc(r,gt(e,o,t,"cardinality_many"),d),...fl(r,gt(e,o,t,"cardinality_one",m),d)]}case"cardinality_exactly_one":{let d=gr(e,i);return[...fl(r,gt(e,o,t,"cardinality_one",-.5),d),...fl(r,gt(e,o,t,"cardinality_one"),d)]}case"cardinality_zero_or_one":{let d=gr(e,i);return[...Zu(r,i,s,gt(e,o,t,"circle_outline",1.5),c,p),...fl(r,gt(e,o,t,"cardinality_one",-.5),d)]}case"cardinality_zero_or_many":{let d=gr(e,i);return[...Kc(r,gt(e,o,t,"cardinality_many"),d),...Zu(r,i,s,gt(e,o,t,"circle_outline",1.5),c,p)]}case"bar":case"arrow":default:return Kc(r,gt(e,o,t,n),gr(e,i))}};var AL=(e,o,{isExporting:t,canvasBackgroundColor:n,embedsValidationStatus:r,theme:i})=>{let l=i===$u.DARK;switch(e.type){case"rectangle":case"iframe":case"embeddable":{let a;if(e.roundness){let s=e.width,c=e.height,m=hl(Math.min(s,c),e);a=o.path(`M ${m} 0 L ${s-m} 0 Q ${s} 0, ${s} ${m} L ${s} ${c-m} Q ${s} ${c}, ${s-m} ${c} L ${m} ${c} Q 0 ${c}, 0 ${c-m} L 0 ${m} Q 0 0, ${m} 0`,qo(N2(e,t,r),!0,l))}else a=o.rectangle(0,0,e.width,e.height,qo(N2(e,t,r),!1,l));return a}case"diamond":{let a,[s,c,m,p,d,h,f,g]=Hc(e);if(e.roundness){let b=hl(Math.abs(s-f),e),y=hl(Math.abs(p-c),e);a=o.path(`M ${s+b} ${c+y} L ${m-b} ${p-y}
|
|
5
5
|
C ${m} ${p}, ${m} ${p}, ${m-b} ${p+y}
|
|
@@ -18,7 +18,7 @@ ${E("hints.firefox_clipboard_write")}`):new Error(E("alerts.couldNotCopyToClipbo
|
|
|
18
18
|
${e.state.scrollX}${e.state.scrollY}${e.state.offsetTop}${e.state.offsetLeft}${e.state.zoom.value}${p.map(b=>b.id).join(",")}`;if(d===s.current)return;s.current=d;let h;if(p.length===1){let[b,,,y,v,x]=UD(p[0],e.scene.getNonDeletedElementsMap());h=ND(hd(b,y),hd(v,x),p[0].angle)}else{let{minX:b,maxY:y}=GD(p);h=hd(b,y)}let{x:f,y:g}=JD({sceneX:h[0],sceneY:h[1]},e.state);a({x:f,y:g})},[n,r,e.scene,e.state]),Dl(()=>{for(let p of r){let d=Gh(p.id,h_(p));Rl.has(d)||Rl.set(d,p)}},[r]),Dl(()=>{for(let p of n)if(!_l.has(p.id)){let d=Lw(p,e.scene.getNonDeletedElementsMap());d&&_l.set(p.id,{fontSize:d.fontSize})}},[n,e.scene]);let m=t==="linear"?[["line",Ms],["sharpArrow",Xr],["curvedArrow",Zr],["elbowArrow",Kr]]:t==="generic"?[["rectangle",Cs],["diamond",Ss],["ellipse",ks]]:[];return Wh("div",{ref:c,tabIndex:-1,style:{position:"absolute",top:`${l.y+(i_+8)*e.state.zoom.value-e.state.offsetTop}px`,left:`${l.x-e.state.offsetLeft-r_}px`,zIndex:2},className:ZD.CONVERT_ELEMENT_TYPE_POPUP,children:m.map(([p,d])=>{let h=i&&(t==="generic"&&n[0].type===p||t==="linear"&&Zi(r[0])===p);return Wh(V,{className:"Shape",type:"radio",icon:d,checked:h,name:"convertElementType-option",title:p,keyBindingLabel:"","aria-label":p,"data-testid":`toolbar-${p}`,onChange:()=>{e.state.activeTool.type!==p&&de("convertElementType",p,"ui"),Vh(e,{conversionType:t,nextType:p}),c.current?.focus()}},`${o[0].id}${o[0].version}_${p}`)})})},d_=(e,o,t)=>{let n=YD(e,o),r=WD(e,o),i=XD(o.text,Nh(o),n),l=Mw(i,Nh(o),o.lineHeight),a=o.fontSize;for(;(l.width>n||l.height>r)&&a>0;){a-=1;let s={...o,fontSize:a};l=Mw(o.text,Nh(s),o.lineHeight)}Hh(o,t.getNonDeletedElementsMap(),{fontSize:a,width:l.width,height:l.height}),VD(o,e,t)},Vh=(e,{conversionType:o,nextType:t,direction:n="right"})=>{if(!o)return!1;let r=e.scene.getSelectedElements(e.state),i=r.reduce((a,s)=>({...a,[s.id]:!0}),{}),l=n==="right"?1:-1;if(o==="generic"){let a=_w(r),c=a.every(m=>m.type===a[0].type)?Al.indexOf(a[0].type):-1;if(t=t??Al[(c+Al.length+l)%Al.length],t&&$i(t)){let m={};for(let d of a){let h=Aw(d,t,e);m[h.id]=h}let p=[];for(let d of e.scene.getElementsIncludingDeleted())m[d.id]?p.push(m[d.id]):p.push(d);e.scene.replaceAllElements(p);for(let d of Object.values(m)){let h=Lw(d,e.scene.getNonDeletedElementsMap());h&&(_l.get(d.id)&&Hh(h,e.scene.getNonDeletedElementsMap(),{fontSize:_l.get(d.id)?.fontSize??h.fontSize}),d_(d,h,e.scene))}e.setState(d=>({selectedElementIds:i,activeTool:kw(d,{type:"selection"})}))}}if(o==="linear"){let a=Uh(r);if(!t){let c=qD(a,Zi),m=c?Ll.indexOf(c):-1;t=Ll[(m+Ll.length+l)%Ll.length]}if(gd(t)){let c=[],m=e.scene.getElementsMapIncludingDeleted();for(let p of a){let d=Rl.get(Gh(p.id,t));if(d&&Zi(d)===t)m.set(d.id,d),c.push(d);else{let h=Aw(p,t,e);m.set(h.id,h),c.push(h)}}e.scene.replaceAllElements(m);for(let p of c)if(Yh(p))if(zD(p)){let d=m_(p);if(d.length<2)continue;let h=[];for(let g=1;g<d.length-2;g++)h.push({start:d[g],end:d[g+1],index:g+1});let f=RD(p,e.scene.getNonDeletedElementsMap(),{points:d,fixedSegments:h});Hh(p,e.scene.getNonDeletedElementsMap(),{...f,endArrowhead:"arrow"})}else{let d=jD(["line","sharpArrow","curvedArrow"],h=>Rl.get(Gh(p.id,h)));if(d){let h=d.points;e.scene.mutateElement(p,{points:h})}}}let s=Uh(e.scene.getSelectedElements(e.state));e.setState(c=>({selectedElementIds:i,selectedLinearElement:s.length===1?new QD(s[0],e.scene.getNonDeletedElementsMap()):null,activeTool:kw(c,{type:"selection"})}))}return!0},fd=e=>{if(e.length===0)return null;let o=!1;for(let t of e){if($i(t.type))return"generic";Dw(t)&&(o=!0)}return o?"linear":null},Dw=e=>Yh(e)&&(!OD(e)||!FD(e)&&!BD(e)),Gh=(e,o)=>`${e}:${o}`,_w=e=>e.filter(o=>$i(o.type)),Uh=e=>e.filter(o=>Dw(o)),ud=20,Ki=(e,o)=>e[0]===o[0],Oh=(e,o)=>e[1]===o[1],Pw=(e,o)=>Ki(e,o)?Math.abs(e[1]-o[1]):Math.abs(e[0]-o[0]),m_=e=>{let o=[e.points[0]],t=p_(e.points);for(let i=1;i<t.length;++i){let l=o[o.length-1],a=[...t[i]];Math.abs(a[0]-l[0])<ud?a[0]=l[0]:Math.abs(a[1]-l[1])<ud&&(a[1]=l[1]),Ki(l,a)||Oh(l,a)||o.push(hd(l[0],a[1])),o.push(a)}let n=[o[0]];for(let i=1;i<o.length-1;++i)Ki(o[i-1],o[i])&&Ki(o[i],o[i+1])||Oh(o[i-1],o[i])&&Oh(o[i],o[i+1])||n.push(o[i]);n.push(o[o.length-1]);let r=[n[0]];for(let i=1;i<n.length-1;++i){let l=r[r.length-1],a=n[i],s=n[i+1],c=Ki(l,a),m=Ki(a,s);if(c!==m){let p=Pw(l,a),d=Pw(a,s);if(p<ud||d<ud){if(d<p)c?s[0]=l[0]:s[1]=l[1];else if(m)for(let h=r.length-1;h>=0&&r[h][0]===l[0];--h)r[h][0]=a[0];else for(let h=r.length-1;h>=0&&r[h][1]===l[1];--h)r[h][1]=a[1];continue}}r.push(a)}return r.push(n[n.length-1]),r},p_=e=>{if(e.length===0)return[];let o=[e[0]];for(let t=1;t<e.length;t++){let[n,r]=o[o.length-1],[i,l]=e[t];(n!==i||r!==l)&&o.push(e[t])}return o},Aw=(e,o,t)=>{if(!u_(e.type,o)){if(!$D())throw Error(`Invalid conversion from ${e.type} to ${o}.`);return e}if(e.type===o)return e;if(o_.delete(e),$i(o)){let n=Pl(e_({...e,type:o,roundness:o==="diamond"&&e.roundness?{type:HD(o)?Bh.ADAPTIVE_RADIUS:Bh.PROPORTIONAL_RADIUS}:e.roundness}));return n_(n,t.scene,t.state),n}if(gd(o))switch(o){case"line":return Pl(t_({...e,type:"line"}));case"sharpArrow":return Pl(Fh({...e,type:"arrow",elbowed:!1,roundness:null,startArrowhead:t.state.currentItemStartArrowhead,endArrowhead:t.state.currentItemEndArrowhead}));case"curvedArrow":return Pl(Fh({...e,type:"arrow",elbowed:!1,roundness:{type:Bh.PROPORTIONAL_RADIUS},startArrowhead:t.state.currentItemStartArrowhead,endArrowhead:t.state.currentItemEndArrowhead}));case"elbowArrow":return Pl(Fh({...e,type:"arrow",elbowed:!0,fixedSegments:null,roundness:null}))}return KD(o,`unhandled conversion type: ${o}`),e},u_=(e,o)=>!!($i(e)&&$i(o)||gd(e)&&gd(o)),h_=e=>Yh(e)?Zi(e):e.type,Rw=s_;import Ed from"react";var g_=/({{[\w-]+}})|(<[\w-]+>)|(<\/[\w-]+>)/g,f_=/{{([\w-]+)}}/,E_=/<([\w-]+)>/,x_=/<\/([\w-]+)>/,b_=(e,o)=>{let t=[{name:"",children:[]}];return e.split(g_).filter(Boolean).forEach(n=>{let r=n.match(E_),i=n.match(x_),l=n.match(f_);if(r!==null){let a=r[1];o.hasOwnProperty(a)?t.push({name:a,children:[]}):console.warn(`Trans: missed to pass in prop ${a} for interpolating ${e}`)}else if(i!==null)if(i[1]===t[t.length-1].name){let s=t.pop(),c=Ed.createElement(Ed.Fragment,{},...s.children),m=o[s.name];typeof m=="function"&&t[t.length-1].children.push(m(c))}else console.warn(`Trans: unexpected end tag ${n} for interpolating ${e}`);else if(l!==null){let a=l[1];o.hasOwnProperty(a)?t[t.length-1].children.push(o[a]):console.warn(`Trans: key ${a} not in props for interpolating ${e}`)}else t[t.length-1].children.push(n)}),t.length!==1&&console.warn(`Trans: stack not empty for interpolating ${e}`),t[0].children},y_=({i18nKey:e,children:o,...t})=>{let{t:n}=Te();return Ed.createElement(Ed.Fragment,{},...b_(n(e),t))},wr=y_;import{jsx as jt,jsxs as Nw}from"react/jsx-runtime";var w_=()=>Nw("div",{"data-testid":"brave-measure-text-error",children:[jt("p",{children:jt(wr,{i18nKey:"errors.brave_measure_text_error.line1",bold:e=>jt("span",{style:{fontWeight:600},children:e})})}),jt("p",{children:jt(wr,{i18nKey:"errors.brave_measure_text_error.line2",bold:e=>jt("span",{style:{fontWeight:600},children:e})})}),jt("p",{children:jt(wr,{i18nKey:"errors.brave_measure_text_error.line3",link:e=>jt("a",{href:"http://docs.excalidraw.com/docs/@excalidraw/excalidraw/faq#turning-off-aggresive-block-fingerprinting-in-brave-browser",children:e})})}),jt("p",{children:jt(wr,{i18nKey:"errors.brave_measure_text_error.line4",issueLink:e=>jt("a",{href:"https://github.com/excalidraw/excalidraw/issues/new",children:e}),discordLink:e=>Nw("a",{href:"https://discord.gg/UexuTaE",children:[e,"."]})})})]}),Bw=w_;import P_ from"clsx";import A_ from"react";import{isDarwin as Fw}from"@excalidraw/common";var v_={toggleTheme:[L("Shift+Alt+D")],saveScene:[L("CtrlOrCmd+S")],loadScene:[L("CtrlOrCmd+O")],imageExport:[L("CtrlOrCmd+Shift+E")],cut:[L("CtrlOrCmd+X")],copy:[L("CtrlOrCmd+C")],paste:[L("CtrlOrCmd+V")],copyStyles:[L("CtrlOrCmd+Alt+C")],pasteStyles:[L("CtrlOrCmd+Alt+V")],selectAll:[L("CtrlOrCmd+A")],deleteSelectedElements:[L("Delete")],duplicateSelection:[L("CtrlOrCmd+D"),L(`Alt+${E("helpDialog.drag")}`)],sendBackward:[L("CtrlOrCmd+[")],bringForward:[L("CtrlOrCmd+]")],sendToBack:[Fw?L("CtrlOrCmd+Alt+["):L("CtrlOrCmd+Shift+[")],bringToFront:[Fw?L("CtrlOrCmd+Alt+]"):L("CtrlOrCmd+Shift+]")],copyAsPng:[L("Shift+Alt+C")],group:[L("CtrlOrCmd+G")],ungroup:[L("CtrlOrCmd+Shift+G")],gridMode:[L("CtrlOrCmd+'")],zenMode:[L("Alt+Z")],objectsSnapMode:[L("Alt+S")],stats:[L("Alt+/")],flipHorizontal:[L("Shift+H")],flipVertical:[L("Shift+V")],viewMode:[L("Alt+R")],hyperlink:[L("CtrlOrCmd+K")],toggleElementLock:[L("CtrlOrCmd+Shift+L")],resetZoom:[L("CtrlOrCmd+0")],zoomOut:[L("CtrlOrCmd+-")],zoomIn:[L("CtrlOrCmd++")],zoomToFitSelection:[L("Shift+3")],zoomToFit:[L("Shift+1")],zoomToFitSelectionInViewport:[L("Shift+2")],toggleEraserTool:[L("E")],toggleHandTool:[L("H")],setFrameAsActiveTool:[L("F")],saveFileToDisk:[L("CtrlOrCmd+S")],saveToActiveFile:[L("CtrlOrCmd+S")],toggleShortcuts:[L("?")],searchMenu:[L("CtrlOrCmd+F")],wrapSelectionInFrame:[],arrangeElements:[L("Shift+R")],toolLock:[L("Q")]},Ue=(e,o=0)=>{let t=v_[e];return t&&t.length>0?t[o]||t[0]:""};import{useLayoutEffect as T_,useRef as Ow,useEffect as zw}from"react";import{unstable_batchedUpdates as I_}from"react-dom";import{KEYS as C_,queryFocusableElements as S_}from"@excalidraw/common";import k_ from"clsx";import{jsx as M_}from"react/jsx-runtime";var Hw=({children:e,left:o,top:t,onCloseRequest:n,fitInViewport:r=!1,offsetLeft:i=0,offsetTop:l=0,viewportWidth:a=window.innerWidth,viewportHeight:s=window.innerHeight,className:c})=>{let m=Ow(null);zw(()=>{let d=m.current;if(!d)return;d.contains(document.activeElement)||d.focus();let h=f=>{if(f.key===C_.TAB){let g=S_(d),{activeElement:b}=document,y=g.findIndex(v=>v===b);b===d?(f.shiftKey?g[g.length-1]?.focus():g[0].focus(),f.preventDefault(),f.stopImmediatePropagation()):y===0&&f.shiftKey?(g[g.length-1]?.focus(),f.preventDefault(),f.stopImmediatePropagation()):y===g.length-1&&!f.shiftKey&&(g[0]?.focus(),f.preventDefault(),f.stopImmediatePropagation())}};return d.addEventListener("keydown",h),()=>d.removeEventListener("keydown",h)},[]);let p=Ow(null);return T_(()=>{if(r&&m.current&&t!=null&&o!=null){let d=m.current,{width:h,height:f}=d.getBoundingClientRect();if(p.current?.top===t&&p.current?.left===o)return;p.current={top:t,left:o},h>=a?(d.style.width=`${a}px`,d.style.left="0px",d.style.overflowX="scroll"):o+h-i>a?d.style.left=`${a-h-10}px`:d.style.left=`${o}px`,f>=s?(d.style.height=`${s-20}px`,d.style.top="10px",d.style.overflowY="scroll"):t+f-l>s?d.style.top=`${s-f}px`:d.style.top=`${t}px`}},[t,o,r,a,s,i,l]),zw(()=>{if(n){let d=h=>{m.current?.contains(h.target)||I_(()=>n(h))};return document.addEventListener("pointerdown",d,!1),()=>document.removeEventListener("pointerdown",d,!1)}},[n]),M_("div",{className:k_("popover",c),ref:m,tabIndex:-1,children:e})};import{jsx as nn,jsxs as Uw}from"react/jsx-runtime";var Ze="separator",Gw=e=>"onSelect"in e,Ww=A_.memo(({actionManager:e,items:o,top:t,left:n,onClose:r})=>{let i=yo(),l=ei(),a=o.reduce((s,c)=>c?c===Ze||Gw(c)?(s.push(c),s):((!c.predicate||c.predicate(l,i,e.app.props,e.app))&&s.push(c),s):s,[]);return nn(Hw,{onCloseRequest:()=>{r()},top:t,left:n,fitInViewport:!0,offsetLeft:i.offsetLeft,offsetTop:i.offsetTop,viewportWidth:i.width,viewportHeight:i.height,className:"context-menu-popover",children:nn("ul",{className:"context-menu",onContextMenu:s=>s.preventDefault(),children:a.map((s,c)=>{if(s===Ze)return!a[c-1]||a[c-1]===Ze?null:nn("hr",{className:"context-menu-item-separator"},c);if(Gw(s))return nn("li",{"data-testid":s.key,onClick:()=>{r(()=>{s.onSelect()})},children:Uw("button",{type:"button",className:"context-menu-item",children:[nn("div",{className:"context-menu-item__label",children:s.label}),nn("kbd",{className:"context-menu-item__shortcut"})]})},s.key);let m=s.name,p="";return s.label&&(typeof s.label=="function"?p=E(s.label(l,i,e.app)):p=E(s.label)),nn("li",{"data-testid":m,onClick:()=>{r(()=>{e.executeAction(s,"contextMenu")})},children:Uw("button",{type:"button",className:P_("context-menu-item",{dangerous:m==="deleteSelectedElements",checkmark:s.checked?.(i)}),children:[nn("div",{className:"context-menu-item__label",children:p}),nn("kbd",{className:"context-menu-item__shortcut",children:m?Ue(m):""})]})},c)})})})});import{jsx as Xh,jsxs as Yw}from"react/jsx-runtime";var L_=({height:e,width:o,userToFollow:t,onDisconnect:n})=>Xh("div",{className:"follow-mode",style:{width:o,height:e},children:Yw("div",{className:"follow-mode__badge",children:[Yw("div",{className:"follow-mode__badge__label",children:["Following"," ",Xh("span",{className:"follow-mode__badge__username",title:t.username,children:t.username})]}),Xh("button",{type:"button",onClick:n,className:"follow-mode__disconnect-btn",children:xo})]})}),Vw=L_;import Kn from"clsx";import QF from"react";import{CLASSES as eO,DEFAULT_SIDEBAR as af,TOOL_TYPE as hI,arrayToMap as tO,capitalizeString as oO,isShallowEqual as am}from"@excalidraw/common";import{mutateElement as nO}from"@excalidraw/element";import{showSelectedShapeActions as rO}from"@excalidraw/element";import{ShapeCache as iO}from"@excalidraw/element";import{createIsolation as D_}from"jotai-scope";import Kh from"react";import Po from"tunnel-rat";var Zh=Kh.createContext(null),We=()=>Kh.useContext(Zh),__=D_(),Xw=()=>Kh.useMemo(()=>({MainMenuTunnel:Po(),WelcomeScreenMenuHintTunnel:Po(),WelcomeScreenToolbarHintTunnel:Po(),WelcomeScreenHelpHintTunnel:Po(),WelcomeScreenCenterTunnel:Po(),FooterCenterTunnel:Po(),DefaultSidebarTriggerTunnel:Po(),DefaultSidebarTabTriggersTunnel:Po(),OverwriteConfirmDialogTunnel:Po(),TTDDialogTriggerTunnel:Po(),tunnelsJotai:__}),[]);import Ao from"clsx";import{useMemo as uR,useRef as hR,useState as gR}from"react";import{Popover as On}from"radix-ui";import{CLASSES as wv,KEYS as fR,capitalizeString as rn,isTransparent as Td}from"@excalidraw/common";import{shouldAllowVerticalAlign as vv,suppportsHorizontalAlign as Tv,hasBoundTextElement as Id,isElbowArrow as Qh,isImageElement as Iv,isLinearElement as eg,isTextElement as Sd,isArrowElement as bv,hasStrokeColor as yv,toolIsArrow as Cd}from"@excalidraw/element";import{getToolbarTools as ER,SHAPES as xR}from"@excalidraw/element/shapes";import{forwardRef as Kw}from"react";import Zw from"clsx";import{jsx as $w}from"react/jsx-runtime";var R_=Kw(({children:e,gap:o,align:t,justifyContent:n,className:r,style:i},l)=>$w("div",{className:Zw("Stack Stack_horizontal",r),style:{"--gap":o,alignItems:t,justifyContent:n,...i},ref:l,children:e})),N_=Kw(({children:e,gap:o,align:t,justifyContent:n,className:r,style:i},l)=>$w("div",{className:Zw("Stack Stack_vertical",r),style:{"--gap":o,justifyItems:t,justifyContent:n,...i},ref:l,children:e})),kt={Row:R_,Col:N_};import{useEffect as B_,useState as F_}from"react";import jw from"clsx";import{capitalizeString as qw}from"@excalidraw/common";import{Popover as $h}from"radix-ui";import{jsx as xd,jsxs as O_}from"react/jsx-runtime";var bd=({app:e,options:o,activeTool:t,defaultOption:n,className:r="Shape",namePrefix:i,title:l,"data-testid":a,onToolChange:s,displayedOption:c,fillable:m=!1})=>{let[p,d]=F_(!1),h=t.type,f=c.type===h,g=32/2+10,{container:b}=_e();return!o.some(y=>y.type===h)&&p&&d(!1),B_(()=>{let y=e.onPointerDownEmitter.on(()=>{d(!1)});return()=>y?.()},[e]),O_($h.Root,{open:p,children:[xd($h.Trigger,{asChild:!0,children:xd(V,{className:jw(r,{fillable:m,active:o.some(y=>y.type===t.type)}),type:"radio",icon:c.icon,checked:f,name:"editor-current-shape",title:l,"aria-label":l,"data-testid":a,onPointerDown:()=>{d(y=>!y),s(n)}})}),xd($h.Content,{className:"tool-popover-content",sideOffset:g,collisionBoundary:b??void 0,children:o.map(({type:y,icon:v,title:x})=>xd(V,{className:jw(r,{active:h===y}),type:"radio",icon:v,checked:h===y,name:`${i}-option`,title:x||qw(y),keyBindingLabel:"","aria-label":x||qw(y),"data-testid":`toolbar-${y}`,onChange:()=>{e.state.activeTool.type!==y&&de("toolbar",y,"ui"),e.setActiveTool({type:y}),s?.(y)}},y))})]})};import xv from"react";import{DropdownMenu as cR}from"radix-ui";import{CLASSES as dR}from"@excalidraw/common";import z_ from"clsx";import{useCallback as H_,useEffect as G_,useRef as U_}from"react";import{CLASSES as W_,EVENT as Jw,KEYS as Y_}from"@excalidraw/common";import{DropdownMenu as V_}from"radix-ui";import{jsx as yd}from"react/jsx-runtime";var Qw=({children:e,onClickOutside:o,className:t="",onSelect:n,open:r=!0,align:i="end",style:l})=>{let a=me(),s=U_(null),c=Qr({onClickOutside:o});Jr(s,H_(p=>{s.current?.closest(`.${W_.DROPDOWN_MENU_EVENT_WRAPPER}`)?.contains(p.target)||c.onClickOutside?.()},[c])),G_(()=>{if(!r)return;let p=h=>{h.key===Y_.ESCAPE&&(h.stopImmediatePropagation(),c.onClickOutside?.())},d={capture:!0};return document.addEventListener(Jw.KEYDOWN,p,d),()=>{document.removeEventListener(Jw.KEYDOWN,p,d)}},[c,r]);let m=z_(`dropdown-menu ${t}`,{"dropdown-menu--mobile":a.formFactor==="phone"}).trim();return yd(Pp.Provider,{value:{onSelect:n},children:yd(V_.Content,{ref:s,className:m,style:l,"data-testid":"dropdown-menu",align:i,sideOffset:8,onCloseAutoFocus:p=>p.preventDefault(),children:a.formFactor==="phone"?yd(kt.Col,{className:"dropdown-menu-container",children:e}):yd(Oe,{className:"dropdown-menu-container",padding:2,children:e})})})};Qw.displayName="DropdownMenuContent";var ev=Qw;import{jsx as K_}from"react/jsx-runtime";var X_=({children:e,className:o="",selected:t,...n})=>K_("div",{...n,className:`dropdown-menu-item-base dropdown-menu-item-custom ${o} ${t?"dropdown-menu-item--selected":""}`.trim(),children:e}),tv=X_;import{DropdownMenu as Z_}from"radix-ui";import{jsx as jh}from"react/jsx-runtime";var ov=({icon:e,shortcut:o,href:t,children:n,onSelect:r,className:i="",selected:l,rel:a="noopener",...s})=>{let c=rc(r);return jh(Z_.Item,{className:"radix-menu-item",onSelect:c,asChild:!0,children:jh("a",{...s,href:t,target:"_blank",rel:`noopener ${a}`,className:In(i,l),title:s.title??s["aria-label"],children:jh(Cn,{icon:e,shortcut:o,children:n})})})},ji=ov;ov.displayName="DropdownMenuItemLink";import{jsx as $_}from"react/jsx-runtime";var nv=()=>$_("div",{style:{height:"1px",backgroundColor:"var(--default-border-color)",margin:"6px 0",flex:"0 0 auto"}}),rv=nv;nv.displayName="DropdownMenuSeparator";import{DropdownMenu as oR}from"radix-ui";import j_ from"clsx";import{DropdownMenu as q_}from"radix-ui";import{useCallback as J_,useState as iv}from"react";import{jsx as Jh}from"react/jsx-runtime";var qh=-4,Q_=4,av=({children:e,className:o})=>{let t=me(),n=j_(`dropdown-menu dropdown-submenu ${o}`,{"dropdown-menu--mobile":t.formFactor==="phone"}).trim(),r=J_(c=>{if(c){let p=c.closest(".dropdown-menu-container")?.getBoundingClientRect();if(p){let d=c.getBoundingClientRect().width,f=window.innerWidth-p.right;f<d+20&&(l(f-d+qh),s(qh+8))}}},[]),[i,l]=iv(Q_),[a,s]=iv(qh);return Jh(q_.SubContent,{className:n,sideOffset:i,alignOffset:a,collisionPadding:8,ref:r,children:t.formFactor==="phone"?Jh(kt.Col,{className:"dropdown-menu-container",children:e}):Jh(Oe,{className:"dropdown-menu-container",padding:2,style:{zIndex:1},children:e})})},lv=av;av.displayName="DropdownMenuSubContent";import{DropdownMenu as eR}from"radix-ui";import{jsx as sv,jsxs as tR}from"react/jsx-runtime";var cv=({children:e,icon:o,shortcut:t,className:n})=>tR(eR.SubTrigger,{className:`${In(n)} dropdown-menu__submenu-trigger`,children:[sv(Cn,{icon:o,shortcut:t,children:e}),sv("div",{className:"dropdown-menu__submenu-trigger-icon",children:C0})]}),dv=cv;cv.displayName="DropdownMenuSubTrigger";import mv from"react";var wd=e=>o=>{let t=mv.Children.toArray(o).find(n=>mv.isValidElement(n)&&typeof n.type!="string"&&n?.type.displayName&&n.type.displayName===e);return t||null},pv=wd("DropdownMenuTrigger"),uv=wd("DropdownMenuContent"),hv=wd("DropdownMenuSubTrigger"),gv=wd("DropdownMenuSubContent");import{jsxs as nR}from"react/jsx-runtime";var vd=({children:e})=>{let o=hv(e),t=gv(e);return nR(oR.Sub,{children:[o,t]})};vd.Trigger=dv;vd.Content=lv;vd.displayName="DropdownMenuSub";var Fn=vd;import rR from"clsx";import{DropdownMenu as iR}from"radix-ui";import{jsx as aR}from"react/jsx-runtime";var fv=({className:e="",children:o,onToggle:t,title:n,...r})=>{let i=me(),l=rR(`dropdown-menu-button ${e}`,"zen-mode-transition",{"dropdown-menu-button--mobile":i.formFactor==="phone"}).trim();return aR(iR.Trigger,{className:l,onClick:t,type:"button","data-testid":"dropdown-menu-button",title:n,...r,children:o})},Ev=fv;fv.displayName="DropdownMenuTrigger";import{jsx as sR}from"react/jsx-runtime";var lR=e=>sR(Dt,{...e,icon:e.checked?Ls:Hs}),mo=lR;import{jsx as pR,jsxs as mR}from"react/jsx-runtime";var po=({children:e,open:o})=>{let t=pv(e),n=uv(e),r=n&&xv.isValidElement(n)?xv.cloneElement(n,{open:o}):n;return pR(cR.Root,{open:o,modal:!1,children:mR("div",{className:dR.DROPDOWN_MENU_EVENT_WRAPPER,style:{display:"contents"},children:[t,r]})})};po.Trigger=Ev;po.Content=ev;po.Item=Dt;po.ItemCheckbox=mo;po.ItemLink=ji;po.ItemCustom=tv;po.Group=Va;po.Separator=rv;po.Sub=Fn;var Pe=po;po.displayName="DropdownMenu";import{Fragment as Nt,jsx as X,jsxs as ie}from"react/jsx-runtime";var tg=Ao([wv.SHAPE_ACTIONS_THEME_SCOPE,"properties-content"]),og=(e,o)=>{let t=o[0]?.type||null;for(let n of o)if(n.type!==t){t=null;break}return yv(e.activeTool.type)&&e.activeTool.type!=="image"&&t!=="image"&&t!=="frame"&&t!=="magicframe"||o.some(n=>yv(n.type))},ng=(e,o)=>fo(e.activeTool.type)||o.some(t=>fo(t.type)),Cv=({appState:e,elementsMap:o,renderAction:t,app:n})=>{let r=Rr(o,e),i=!1;r.length===2&&(Id(r[0])||Id(r[1]))&&(i=!0);let l=!!(e.editingTextElement||e.newElement),a=me(),s=document.documentElement.getAttribute("dir")==="rtl",c=fo(e.activeTool.type)&&!Td(e.currentItemBackgroundColor)||r.some(f=>fo(f.type)&&!Td(f.backgroundColor)),m=r.length===1||i,p=!e.selectedLinearElement?.isEditing&&r.length===1&&eg(r[0])&&!Qh(r[0]),d=!e.croppingElementId&&r.length===1&&Iv(r[0]),h=!i&&Qe(e,n);return ie("div",{className:"selected-shape-actions",children:[X("div",{children:og(e,r)&&t("changeStrokeColor")}),ng(e,r)&&X("div",{children:t("changeBackgroundColor")}),c&&t("changeFillStyle"),(wa(e.activeTool.type)||r.some(f=>wa(f.type)))&&t("changeStrokeWidth"),(e.activeTool.type==="freedraw"||r.some(f=>f.type==="freedraw"))&&t("changeStrokeShape"),(va(e.activeTool.type)||r.some(f=>va(f.type)))&&ie(Nt,{children:[t("changeStrokeStyle"),t("changeSloppiness")]}),(Ta(e.activeTool.type)||r.some(f=>Ta(f.type)))&&X(Nt,{children:t("changeRoundness")}),(Cd(e.activeTool.type)||r.some(f=>Cd(f.type)))&&X(Nt,{children:t("changeArrowType")}),(e.activeTool.type==="text"||r.some(Sd))&&ie(Nt,{children:[X("fieldset",{children:t("changeFontFamily")}),t("changeFontSize"),(e.activeTool.type==="text"||Tv(r,o))&&t("changeTextAlign")]}),vv(r,o)&&t("changeVerticalAlign"),(Nr(e.activeTool.type)||r.some(f=>Nr(f.type)))&&X(Nt,{children:t("changeArrowhead")}),t("changeOpacity"),ie("fieldset",{children:[X("legend",{children:E("labels.layers")}),ie("div",{className:"buttonList",children:[t("sendToBack"),t("sendBackward"),t("bringForward"),t("bringToFront")]})]}),h&&!i&&ie("fieldset",{children:[X("legend",{children:E("labels.align")}),ie("div",{className:"buttonList",children:[s?ie(Nt,{children:[t("alignRight"),t("alignHorizontallyCentered"),t("alignLeft")]}):ie(Nt,{children:[t("alignLeft"),t("alignHorizontallyCentered"),t("alignRight")]}),r.length>2&&t("distributeHorizontally"),X("div",{style:{flexBasis:"100%",height:0}}),ie("div",{style:{display:"flex",flexWrap:"wrap",gap:".5rem",marginTop:"-0.5rem"},children:[t("alignTop"),t("alignVerticallyCentered"),t("alignBottom"),r.length>2&&t("distributeVertically"),X("div",{style:{flexBasis:"100%",height:0}}),t("arrangeElements"),t("normaliseElements")]})]})]}),!l&&r.length>0&&ie("fieldset",{children:[X("legend",{children:E("labels.actions")}),ie("div",{className:"buttonList",children:[a.formFactor!=="phone"&&t("duplicateSelection"),a.formFactor!=="phone"&&t("deleteSelectedElements"),t("group"),t("ungroup"),m&&t("hyperlink"),d&&t("cropEditor"),p&&t("toggleLinearEditor"),t("smartZoom")]})]})]})},Sv=({appState:e,renderAction:o,setAppState:t,targetElements:n,container:r})=>{let i=fo(e.activeTool.type)&&!Td(e.currentItemBackgroundColor)||n.some(s=>fo(s.type)&&!Td(s.backgroundColor)),l=n.length>0||e.activeTool.type!=="selection"&&e.activeTool.type!=="eraser"&&e.activeTool.type!=="hand"&&e.activeTool.type!=="laser"&&e.activeTool.type!=="lasso",a=e.openPopup==="compactStrokeStyles";return l?X("div",{className:"compact-action-item",children:ie(On.Root,{open:a,onOpenChange:s=>{t(s?{openPopup:"compactStrokeStyles"}:{openPopup:null})},children:[X(On.Trigger,{asChild:!0,children:X("button",{type:"button",className:Ao("compact-action-button properties-trigger",{active:a}),title:E("labels.stroke"),onClick:s=>{s.preventDefault(),s.stopPropagation(),t({openPopup:a?null:"compactStrokeStyles"})},children:v0})}),a&&X(Vo,{className:tg,container:r,style:{maxWidth:"13rem"},onClose:()=>{},children:ie("div",{className:"selected-shape-actions",children:[i&&o("changeFillStyle"),(wa(e.activeTool.type)||n.some(s=>wa(s.type)))&&o("changeStrokeWidth"),(va(e.activeTool.type)||n.some(s=>va(s.type)))&&ie(Nt,{children:[o("changeStrokeStyle"),o("changeSloppiness")]}),(Ta(e.activeTool.type)||n.some(s=>Ta(s.type)))&&o("changeRoundness"),o("changeOpacity")]})})]})}):null},kv=({appState:e,renderAction:o,setAppState:t,targetElements:n,container:r,app:i})=>{let l=Cd(e.activeTool.type)||n.some(s=>Cd(s.type)),a=e.openPopup==="compactArrowProperties";return l?X("div",{className:"compact-action-item",children:ie(On.Root,{open:a,onOpenChange:s=>{t(s?{openPopup:"compactArrowProperties"}:{openPopup:null})},children:[X(On.Trigger,{asChild:!0,children:X("button",{type:"button",className:Ao("compact-action-button properties-trigger",{active:a}),title:E("labels.arrowtypes"),onClick:s=>{s.preventDefault(),s.stopPropagation(),t({openPopup:a?null:"compactArrowProperties"})},children:(()=>{let s=nt(n,i,c=>bv(c)?c.elbowed?"elbow":c.roundness?"round":"sharp":null,c=>bv(c),c=>c?null:e.currentItemArrowType);return s==="elbow"?Kr:s==="round"?Zr:Xr})()})}),a&&X(Vo,{container:r,className:"properties-content",style:{maxWidth:"13rem"},onClose:()=>{},children:o("changeArrowProperties")})]})}):null},Mv=({appState:e,renderAction:o,setAppState:t,targetElements:n,container:r,elementsMap:i})=>{let{saveCaretPosition:l,restoreCaretPosition:a}=U0(),s=e.openPopup==="compactTextProperties";return X("div",{className:"compact-action-item",children:ie(On.Root,{open:s,onOpenChange:c=>{c?(e.editingTextElement&&l(),t({openPopup:"compactTextProperties"})):(t({openPopup:null}),e.editingTextElement&&a())},children:[X(On.Trigger,{asChild:!0,children:X("button",{type:"button",className:Ao("compact-action-button properties-trigger",{active:s}),title:E("labels.textAlign"),onClick:c=>{c.preventDefault(),c.stopPropagation(),s?t({openPopup:null}):(e.editingTextElement&&l(),t({openPopup:"compactTextProperties"}))},children:Z1})}),e.openPopup==="compactTextProperties"&&X(Vo,{className:tg,container:r,style:{maxWidth:"13rem"},preventAutoFocusOnTouch:!!e.editingTextElement,onClose:()=>{e.editingTextElement&&a()},children:ie("div",{className:"selected-shape-actions",children:[(e.activeTool.type==="text"||n.some(Sd))&&o("changeFontSize"),(e.activeTool.type==="text"||Tv(n,i))&&o("changeTextAlign"),vv(n,i)&&o("changeVerticalAlign")]})})]})})},Pv=({appState:e,renderAction:o,targetElements:t,setAppState:n,container:r,app:i,showDuplicate:l,showDelete:a})=>{let s=!!(e.editingTextElement||e.newElement),c=!e.croppingElementId&&t.length===1&&Iv(t[0]),m=t.length===1,p=Qe(e,i),d=!1;t.length===2&&(Id(t[0])||Id(t[1]))&&(d=!0);let h=document.documentElement.getAttribute("dir")==="rtl",f=e.openPopup==="compactOtherProperties";return s||t.length===0?null:X("div",{className:"compact-action-item",children:ie(On.Root,{open:f,onOpenChange:g=>{n(g?{openPopup:"compactOtherProperties"}:{openPopup:null})},children:[X(On.Trigger,{asChild:!0,children:X("button",{type:"button",className:Ao("compact-action-button properties-trigger",{active:f}),title:E("labels.actions"),onClick:g=>{g.preventDefault(),g.stopPropagation(),n({openPopup:f?null:"compactOtherProperties"})},children:H1})}),f&&X(Vo,{className:tg,container:r,style:{maxWidth:"12rem",justifyContent:"center",alignItems:"center"},onClose:()=>{},children:ie("div",{className:"selected-shape-actions",children:[ie("fieldset",{children:[X("legend",{children:E("labels.layers")}),ie("div",{className:"buttonList",children:[o("sendToBack"),o("sendBackward"),o("bringForward"),o("bringToFront")]})]}),p&&!d&&ie("fieldset",{children:[X("legend",{children:E("labels.align")}),ie("div",{className:"buttonList",children:[h?ie(Nt,{children:[o("alignRight"),o("alignHorizontallyCentered"),o("alignLeft")]}):ie(Nt,{children:[o("alignLeft"),o("alignHorizontallyCentered"),o("alignRight")]}),t.length>2&&o("distributeHorizontally"),X("div",{style:{flexBasis:"100%",height:0}}),ie("div",{style:{display:"flex",flexWrap:"wrap",gap:".5rem",marginTop:"-0.5rem"},children:[o("alignTop"),o("alignVerticallyCentered"),o("alignBottom"),t.length>2&&o("distributeVertically"),X("div",{style:{flexBasis:"100%",height:0}}),o("arrangeElements"),o("normaliseElements")]})]})]}),ie("fieldset",{children:[X("legend",{children:E("labels.actions")}),ie("div",{className:"buttonList",children:[o("group"),o("ungroup"),m&&o("hyperlink"),c&&o("cropEditor"),l&&o("duplicateSelection"),a&&o("deleteSelectedElements")]})]})]})})]})})},bR=({appState:e,renderAction:o,targetElements:t})=>!e.selectedLinearElement?.isEditing&&t.length===1&&eg(t[0])&&!Qh(t[0])?X("div",{className:"compact-action-item",children:o("toggleLinearEditor")}):null,Av=({appState:e,elementsMap:o,renderAction:t,app:n,setAppState:r})=>{let i=Rr(o,e),{container:l}=_e(),a=!!(e.editingTextElement||e.newElement),s=!e.selectedLinearElement?.isEditing&&i.length===1&&eg(i[0])&&!Qh(i[0]);return ie("div",{className:"compact-shape-actions",children:[og(e,i)&&X("div",{className:Ao("compact-action-item"),children:t("changeStrokeColor")}),ng(e,i)&&X("div",{className:"compact-action-item",children:t("changeBackgroundColor")}),X(Sv,{appState:e,renderAction:t,setAppState:r,targetElements:i,container:l}),X(kv,{appState:e,renderAction:t,setAppState:r,targetElements:i,container:l,app:n}),s&&X("div",{className:"compact-action-item",children:t("toggleLinearEditor")}),(e.activeTool.type==="text"||i.some(Sd))&&ie(Nt,{children:[X("div",{className:"compact-action-item",children:t("changeFontFamily")}),X(Mv,{appState:e,renderAction:t,setAppState:r,targetElements:i,container:l,elementsMap:o})]}),!a&&i.length>0&&X("div",{className:"compact-action-item",children:t("duplicateSelection")}),!a&&i.length>0&&X("div",{className:"compact-action-item",children:t("deleteSelectedElements")}),X(Pv,{appState:e,renderAction:t,targetElements:i,setAppState:r,container:l,app:n})]})},Lv=({appState:e,elementsMap:o,renderAction:t,app:n,setAppState:r})=>{let i=Rr(o,e),{container:l}=_e(),a=hR(null),s=a.current?.getBoundingClientRect()?.width??0,c=9,m=6,p=32,d=c*p+(c-1)*m,h=p+m,f=s>=d+h,g=s>=d+2*h;return ie(Oe,{className:"compact-shape-actions mobile-shape-actions",style:{flexDirection:"row",boxShadow:"none",padding:0,zIndex:2,backgroundColor:"transparent",height:p*1.35,marginBottom:4,alignItems:"center",gap:m,pointerEvents:"none"},ref:a,children:[ie("div",{style:{display:"flex",flexDirection:"row",gap:m,flex:1},children:[og(e,i)&&X("div",{className:Ao("compact-action-item"),children:t("changeStrokeColor")}),ng(e,i)&&X("div",{className:"compact-action-item",children:t("changeBackgroundColor")}),X(Sv,{appState:e,renderAction:t,setAppState:r,targetElements:i,container:l}),X(kv,{appState:e,renderAction:t,setAppState:r,targetElements:i,container:l,app:n}),X(bR,{appState:e,renderAction:t,targetElements:i}),(e.activeTool.type==="text"||i.some(Sd))&&ie(Nt,{children:[X("div",{className:"compact-action-item",children:t("changeFontFamily")}),X(Mv,{appState:e,renderAction:t,setAppState:r,targetElements:i,container:l,elementsMap:o})]}),X(Pv,{appState:e,renderAction:t,targetElements:i,setAppState:r,container:l,app:n,showDuplicate:!g,showDelete:!f})]}),ie("div",{style:{display:"flex",flexDirection:"row",gap:m},children:[X("div",{className:"compact-action-item",children:t("undo")}),X("div",{className:"compact-action-item",children:t("redo")}),g&&X("div",{className:"compact-action-item",children:t("duplicateSelection")}),f&&X("div",{className:"compact-action-item",children:t("deleteSelectedElements")})]})]})},Dv=({activeTool:e,setAppState:o,app:t,UIOptions:n})=>{let[r,i]=gR(!1),l=et(),a=l==="full",s=l==="compact",c=[{type:"selection",icon:Is,title:rn(E("toolBar.selection"))},{type:"lasso",icon:fn,title:rn(E("toolBar.lasso"))}],m=a&&e.type==="lasso"&&t.state.preferredSelectionTool.type!=="lasso",p=xR.filter(h=>h.myocSimplifiedMode===!1),d=uR(()=>{switch(e.type){case"frame":return{icon:bn,highlight:!1};case"lasso":return{icon:fn,highlight:!0};case"embeddable":return{icon:As,highlight:!0};case"laser":return t.props.isCollaborating?{icon:Wr,highlight:!0}:{icon:Yr,highlight:!0};case"diamond":return{icon:Ss,highlight:!0};case"rectangle":return{icon:Cs,highlight:!0};case"ellipse":return{icon:ks,highlight:!0};case"arrow":return{icon:X1,highlight:!0};case"line":return{icon:Ms,highlight:!0};default:return{icon:Wr,highlight:!1}}},[e.type,t.props.isCollaborating]);return ie(Nt,{children:[ER(t).filter(h=>!t.state.myocSimplifiedMode||h.myocSimplifiedMode).map(({value:h,icon:f,key:g,fillable:b})=>{if(n.tools?.[h]===!1)return null;let y=E(`toolBar.${h}`),v=g&&rn(typeof g=="string"?g:g[0]),x=v;return(h==="selection"||h==="lasso")&&s?X(bd,{app:t,options:c,activeTool:e,defaultOption:t.state.preferredSelectionTool.type,namePrefix:"selectionType",title:rn(E("toolBar.selection")),"data-testid":"toolbar-selection",onToolChange:w=>{(w==="selection"||w==="lasso")&&(t.setActiveTool({type:w}),o({preferredSelectionTool:{type:w,initialized:!0}}))},displayedOption:c.find(w=>w.type===t.state.preferredSelectionTool.type)||c[0],fillable:e.type==="selection"},"selection-popover"):X(V,{className:Ao("Shape",{fillable:b}),type:"radio",icon:f,checked:e.type===h,name:"editor-current-shape",title:`${rn(y)} \u2014 ${x}`,keyBindingLabel:v,"aria-label":rn(y),"aria-keyshortcuts":x,"data-testid":`toolbar-${h}`,onPointerDown:({pointerType:w})=>{!t.state.penDetected&&w==="pen"&&t.togglePenMode(!0),h==="selection"&&(t.state.activeTool.type==="selection"?t.setActiveTool({type:"lasso"}):t.setActiveTool({type:"selection"}))},onChange:({pointerType:w})=>{t.state.activeTool.type!==h&&de("toolbar",h,"ui"),h==="image"?t.setActiveTool({type:h}):t.setActiveTool({type:h})}},h)}),X("div",{className:"App-toolbar__divider"}),ie(Pe,{open:r,children:[X(Pe.Trigger,{className:Ao("App-toolbar__extra-tools-trigger",{"App-toolbar__extra-tools-trigger--selected":d.highlight}),onToggle:()=>{i(!r),o({openMenu:null,openPopup:null})},title:E("toolBar.extraTools"),children:d.icon}),ie(Pe.Content,{onClickOutside:()=>i(!1),onSelect:()=>i(!1),className:"App-toolbar__extra-tools-dropdown",children:[X(Pe.Item,{onSelect:()=>t.setActiveTool({type:"lasso"}),icon:fn,"data-testid":"toolbar-lasso",selected:m,children:E("toolBar.lasso")}),p.map(({value:h,icon:f,key:g,fillable:b})=>{let y=E(`toolBar.${h}`),v=g&&rn(typeof g=="string"?g:g[0]);return X(Pe.Item,{onSelect:()=>t.setActiveTool({type:h}),icon:f,"data-testid":`toolbar-${h}`,selected:e.type===h,shortcut:v??void 0,children:rn(y)},h)}),X("div",{className:"App-toolbar__dropdown-divider"}),X(Pe.Item,{onSelect:()=>t.toggleLock(),icon:t.state.activeTool.locked?Hr:rr,"data-testid":"toolbar-lock",selected:t.state.activeTool.locked,shortcut:fR.Q,children:rn(E("toolBar.lock-short"))})]})]})]})},_v=({renderAction:e,zoom:o})=>X(kt.Col,{gap:1,className:wv.ZOOM_ACTIONS,children:ie(kt.Row,{align:"center",children:[e("zoomOut"),e("resetZoom"),e("zoomIn")]})}),Rv=({renderAction:e,className:o})=>ie("div",{className:`undo-redo-buttons ${o}`,children:[X("div",{className:"undo-button-container",children:X(st,{label:E("buttons.undo"),children:e("undo")})}),X("div",{className:"redo-button-container",children:ie(st,{label:E("buttons.redo"),children:[" ",e("redo")]})})]}),Nv=({actionManager:e,showExitZenModeBtn:o})=>X("button",{type:"button",className:Ao("disable-zen-mode",{"disable-zen-mode--visible":o}),onClick:()=>e.executeAction(il),children:E("buttons.exitZenMode")});import yR from"clsx";import{useState as wR,useEffect as vR}from"react";import{THEME as TR}from"@excalidraw/common";import{jsx as rg,jsxs as IR}from"react/jsx-runtime";var kd=({delay:e,theme:o})=>{let[t,n]=wR(!!e);return vR(()=>{if(!e)return;let r=setTimeout(()=>{n(!1)},e);return()=>clearTimeout(r)},[e]),t?null:IR("div",{className:yR("LoadingMessage",{"LoadingMessage--dark":o===TR.DARK}),children:[rg("div",{children:rg(Yo,{})}),rg("div",{className:"LoadingMessage-text",children:E("labels.loadingScene")})]})};import{useState as Fv}from"react";import Nl from"clsx";import{KEYS as Ov,capitalizeString as Mt}from"@excalidraw/common";import{SHAPES as kR}from"@excalidraw/element/shapes";import CR from"clsx";import{KEYS as Bv}from"@excalidraw/common";import{jsx as SR}from"react/jsx-runtime";var Md=e=>SR(V,{className:CR("Shape",{fillable:!1,active:e.checked}),type:"radio",icon:Bs,name:"editor-current-shape",checked:e.checked,title:`${e.title} \u2014 H`,keyBindingLabel:e.isMobile?void 0:Bv.H.toLocaleUpperCase(),"aria-label":`${e.title} \u2014 H`,"aria-keyshortcuts":Bv.H,"data-testid":"toolbar-hand",onChange:()=>e.onChange?.()});import{jsx as Bt,jsxs as ag}from"react/jsx-runtime";var ig=[{type:"selection",icon:Is,title:Mt(E("toolBar.selection"))},{type:"lasso",icon:fn,title:Mt(E("toolBar.lasso"))}],zv=({app:e,actionManager:o,onHandToolToggle:t,setAppState:n})=>{let r=e.state.activeTool,[i,l]=Fv(!1),a=(M,_)=>{e.state.activeTool.type!==M&&de("toolbar",M,"ui"),M==="selection"?e.state.activeTool.type==="selection"||e.setActiveTool({type:"selection"}):e.setActiveTool({type:M})},[s,c]=Fv(0),m=36,p=4,d=7,h=d*m+(d-1)*p,f=m+p,g=s>=h+1*f,b=s>=h+2*f,y=s>=h+3*f,v=kR.filter(M=>M.myocSimplifiedMode===!1),x=o.isActionEnabled(so),w=Ue("objectsSnapMode"),S=["text","frame","embeddable","laser","magicframe"].filter(M=>!(g&&M==="text"||b&&M==="image"||y&&M==="frame")).includes(r.type),P=S?r.type==="text"?xn:r.type==="image"?Ps:r.type==="frame"?bn:r.type==="embeddable"?As:r.type==="laser"?Yr:r.type==="magicframe"?i0:Wr:Wr;return ag("div",{className:"mobile-toolbar",ref:M=>{M&&c(M.getBoundingClientRect().width)},children:[Bt(Md,{checked:ro(e.state),onChange:t,title:E("toolBar.hand"),isMobile:!0}),Bt(bd,{app:e,options:ig,activeTool:r,defaultOption:e.state.preferredSelectionTool.type,namePrefix:"selectionType",title:Mt(E("toolBar.selection")),"data-testid":"toolbar-selection",onToolChange:M=>{(M==="selection"||M==="lasso")&&(e.setActiveTool({type:M}),n({preferredSelectionTool:{type:M,initialized:!0}}))},displayedOption:ig.find(M=>M.type===e.state.preferredSelectionTool.type)||ig[0]}),Bt(V,{className:Nl({active:r.type==="freedraw"}),type:"radio",icon:En,checked:r.type==="freedraw",name:"editor-current-shape",title:`${Mt(E("toolBar.freedraw"))}`,"aria-label":Mt(E("toolBar.freedraw")),"data-testid":"toolbar-freedraw",onChange:()=>a("freedraw")}),g&&Bt(V,{className:Nl({active:r.type==="text"}),type:"radio",icon:xn,checked:r.type==="text",name:"editor-current-shape",title:`${Mt(E("toolBar.text"))}`,"aria-label":Mt(E("toolBar.text")),"data-testid":"toolbar-text",onChange:()=>a("text")}),b&&Bt(V,{className:Nl({active:r.type==="image"}),type:"radio",icon:Ps,checked:r.type==="image",name:"editor-current-shape",title:`${Mt(E("toolBar.image"))}`,"aria-label":Mt(E("toolBar.image")),"data-testid":"toolbar-image",onChange:()=>a("image")}),Bt(V,{className:Nl({active:r.type==="eraser"}),type:"radio",icon:$1,checked:r.type==="eraser",name:"editor-current-shape",title:`${Mt(E("toolBar.eraser"))}`,"aria-label":Mt(E("toolBar.eraser")),"data-testid":"toolbar-eraser",onChange:()=>a("eraser")}),ag(Pe,{open:i,children:[Bt(Pe.Trigger,{className:Nl("App-toolbar__extra-tools-trigger App-toolbar__extra-tools-trigger--mobile",{"App-toolbar__extra-tools-trigger--selected":S||i}),onToggle:()=>{l(!i),n({openMenu:null,openPopup:null})},title:E("toolBar.extraTools"),style:{width:m,height:m,display:"flex",alignItems:"center",justifyContent:"center"},children:P}),ag(Pe.Content,{onClickOutside:()=>l(!1),onSelect:()=>l(!1),className:"App-toolbar__extra-tools-dropdown",align:"start",children:[v.map(({value:M,icon:_,key:R,fillable:A})=>{let F=E(`toolBar.${M}`),U=R&&Mt(typeof R=="string"?R:R[0]);return Bt(Pe.Item,{onSelect:()=>e.setActiveTool({type:M}),icon:_,"data-testid":`toolbar-${M}`,selected:r.type===M,shortcut:U??void 0,children:Mt(F)},M)}),Bt("div",{className:"App-toolbar__dropdown-divider"}),Bt(Pe.Item,{onSelect:()=>e.toggleLock(),icon:e.state.activeTool.locked?Hr:rr,"data-testid":"toolbar-lock",selected:e.state.activeTool.locked,shortcut:Ov.Q,children:Mt(E("toolBar.lock-short"))}),x&&Bt(Pe.Item,{onSelect:()=>{o.executeAction(so,"ui")},icon:Vr,"data-testid":"toolbar-objects-snap-mode",selected:e.state.objectsSnapModeEnabled,shortcut:w,children:E("buttons.objectsSnapMode")}),!g&&Bt(Pe.Item,{onSelect:()=>e.setActiveTool({type:"text"}),icon:xn,shortcut:Ov.T.toLocaleUpperCase(),"data-testid":"toolbar-text",selected:r.type==="text",children:E("toolBar.text")}),!b&&Bt(Pe.Item,{onSelect:()=>e.setActiveTool({type:"image"}),icon:Ps,"data-testid":"toolbar-image",selected:r.type==="image",children:E("toolBar.image")})]})]})]})};import{Fragment as MR,jsx as vr,jsxs as Bl}from"react/jsx-runtime";var Hv=({appState:e,elements:o,actionManager:t,setAppState:n,onHandToolToggle:r,renderTopLeftUI:i,renderTopRightUI:l,renderSidebars:a,renderWelcomeScreen:s,UIOptions:c,app:m,onPenModeToggle:p})=>{let{WelcomeScreenCenterTunnel:d}=We(),h=()=>vr(zv,{app:m,actionManager:t,onHandToolToggle:r,setAppState:n});return Bl(MR,{children:[a(),vr("div",{className:"App-welcome-screen",children:s&&vr(d.Out,{})}),Bl("div",{className:"App-bottom-bar-container",style:{marginBottom:$t+tn},children:[vr("div",{className:"App-bottom-bar-item",children:vr(Oe,{children:Bl("div",{className:"mobile-toolbar",children:[t.renderAction("viewMode"),t.renderAction("smartZoom")]})})}),!e.viewModeEnabled&&Bl("div",{className:"App-bottom-bar-item",children:[vr(Lv,{appState:e,elementsMap:m.scene.getNonDeletedElementsMap(),renderAction:t.renderAction,app:m,setAppState:n}),Bl(Oe,{className:"App-toolbar",children:[!e.viewModeEnabled&&e.openDialog?.name!=="elementLinkSelector"&&h(),e.scrolledOutside&&!e.openMenu&&!e.openSidebar&&vr("button",{type:"button",className:"scroll-back-to-content",onClick:()=>{n(f=>({...tr(o,f)}))},children:E("buttons.scrollBackToContent")})]})]})]})]})};import Kv,{useLayoutEffect as Zv,useRef as $v,useState as jv}from"react";import{newTextElement as qv}from"@excalidraw/element";import NR from"clsx";import{useEffect as BR,useState as FR}from"react";import{KEYS as OR,queryFocusableElements as Vv}from"@excalidraw/common";import{useCallback as PR,useState as AR}from"react";var Gv=()=>{let[e,o]=AR(null),t=PR(n=>o(n),[]);return[e,t]};import Uv from"clsx";import{useRef as LR}from"react";import{createPortal as DR}from"react-dom";import{KEYS as _R}from"@excalidraw/common";import{jsx as Wv,jsxs as RR}from"react/jsx-runtime";var Yv=e=>{let{closeOnClickOutside:o=!0}=e,t=$s({className:Uv("excalidraw-modal-container",e.portalContainerClassName)}),n=LR(document.body.classList.contains("excalidraw-animations-disabled"));if(!t)return null;let r=i=>{i.key===_R.ESCAPE&&(i.nativeEvent.stopImmediatePropagation(),i.stopPropagation(),e.onCloseRequest())};return DR(RR("div",{className:Uv("Modal",e.className,{"animations-disabled":n.current}),role:"dialog","aria-modal":"true",onKeyDown:r,"aria-labelledby":e.labelledBy,children:[Wv("div",{className:"Modal__background",onClick:o?e.onCloseRequest:void 0}),Wv("div",{className:"Modal__content",style:{"--max-width":`${e.maxWidth}px`},tabIndex:0,children:e.children})]}),t)};import{jsx as Pd,jsxs as Xv}from"react/jsx-runtime";function zR(e){if(e&&typeof e=="number")return e;switch(e){case"small":return 550;case"wide":return 1024;case"regular":default:return 800}}var qt=e=>{let[o,t]=Gv(),[n]=FR(document.activeElement),{id:r}=_e(),i=me().formFactor==="phone";BR(()=>{if(!o)return;let s=Vv(o);setTimeout(()=>{s.length>0&&e.autofocus!==!1&&(s[1]||s[0]).focus()});let c=m=>{if(m.key===OR.TAB){let p=Vv(o),{activeElement:d}=document,h=p.findIndex(f=>f===d);h===0&&m.shiftKey?(p[p.length-1].focus(),m.preventDefault()):h===p.length-1&&!m.shiftKey&&(p[0].focus(),m.preventDefault())}};return o.addEventListener("keydown",c),()=>o.removeEventListener("keydown",c)},[o,e.autofocus]);let l=Me(),a=()=>{l({openMenu:null}),n.focus(),e.onCloseRequest()};return Pd(Yv,{className:NR("Dialog",e.className,{"Dialog--fullscreen":i}),labelledBy:"dialog-title",maxWidth:zR(e.size),onCloseRequest:a,closeOnClickOutside:e.closeOnClickOutside,portalContainerClassName:e.portalContainerClassName,children:Xv(Oe,{ref:t,children:[e.title&&Xv("h2",{id:`${r}-dialog-title`,className:"Dialog__title",children:[Pd("span",{className:"Dialog__titleContent",children:e.title}),e.titleButton]}),i&&Pd("button",{className:"Dialog__close",onClick:a,title:E("buttons.close"),"aria-label":E("buttons.close"),type:"button",children:xo}),Pd("div",{className:"Dialog__content",children:e.children})]})})};import{jsx as an,jsxs as Ad}from"react/jsx-runtime";var HR=e=>{switch(e){case"bar":return E("labels.chartType_bar");case"line":return E("labels.chartType_line");case"radar":return E("labels.chartType_radar");default:return e}},GR=e=>{let o=$v(null),[t,n]=jv(null),{theme:r}=he();Zv(()=>{if(!e.spreadsheet){n(null);return}let l=Rh(e.chartType,e.spreadsheet,0,0,e.colorSeed);if(!l){n(null),o.current?.replaceChildren();return}n(l);let a,s=o.current;return(async()=>(a=await or(l,{exportBackground:!1,viewBackgroundColor:"#fff",exportWithDarkMode:r==="dark"},null,{skipInliningFonts:!0}),a.querySelector(".style-fonts")?.remove(),s.replaceChildren(),s.appendChild(a)))(),()=>{s.replaceChildren()}},[e.spreadsheet,e.chartType,e.colorSeed,r]);let i=HR(e.chartType);return Ad("button",{type:"button",className:"ChartPreview","aria-label":i,onClick:()=>{t&&e.onClick(e.chartType,t)},children:[an("div",{className:"ChartPreview__canvas",ref:o}),an("div",{className:"ChartPreview__label",children:i})]})},UR=e=>{let o=$v(null),{theme:t}=he();return Zv(()=>{if(!e.rawText)return;let n=qv({text:e.rawText,x:0,y:0}),r=o.current;return(async()=>{let i=await or([n],{exportBackground:!1,viewBackgroundColor:"#fff",exportWithDarkMode:t==="dark"},null,{skipInliningFonts:!0});i.querySelector(".style-fonts")?.remove(),r.replaceChildren(),r.appendChild(i)})(),()=>{r.replaceChildren()}},[e.rawText,t]),Ad("button",{type:"button",className:"ChartPreview","aria-label":E("labels.chartType_plaintext"),onClick:()=>{e.onClick(e.rawText)},children:[an("div",{className:"ChartPreview__canvas",ref:o}),an("div",{className:"ChartPreview__label",children:E("labels.chartType_plaintext")})]})},Jv=({data:e,rawText:o,onClose:t})=>{let{onInsertElements:n,focusContainer:r}=vt(),[i,l]=jv(Math.random()),a=Kv.useCallback(()=>{l(Math.random())},[]),s=Kv.useCallback(()=>{t&&t()},[t]),c=(p,d)=>{n(d),de("paste","chart",p),t(),r()},m=p=>{let d=qv({text:p,x:0,y:0});n([d]),de("paste","chart","plaintext"),t(),r()};return an(qt,{size:"regular",onCloseRequest:s,title:Ad("div",{className:"PasteChartDialog__title",children:[an("div",{className:"PasteChartDialog__titleText",children:E("labels.pasteCharts")}),an("div",{className:"PasteChartDialog__reshuffleBtn",onClick:a,role:"button",tabIndex:0,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a())},children:rE})]}),className:"PasteChartDialog",autofocus:!1,children:Ad("div",{className:"container",children:[["bar","line","radar"].map(p=>Hi(e,p)?an(GR,{chartType:p,spreadsheet:e,colorSeed:i,onClick:c},p):null),o&&an(UR,{rawText:o,onClick:m})]})})};import{Fragment as WR,jsx as Qv,jsxs as YR}from"react/jsx-runtime";var Fl=({heading:e,children:o,...t})=>{let{id:n}=_e(),r=Qv("h2",{className:"visually-hidden",id:`${n}-${e}-title`,children:E(`headings.${e}`)});return Qv("section",{...t,"aria-labelledby":`${n}-${e}-title`,children:typeof o=="function"?o(r):YR(WR,{children:[r,o]})})};import{Popover as Ld}from"radix-ui";import e3 from"clsx";import Dd,{useLayoutEffect as VR}from"react";import{supportsResizeObserver as XR,isShallowEqual as KR}from"@excalidraw/common";import{Fragment as JR,jsx as Lo,jsxs as _d}from"react/jsx-runtime";var ZR=4,$R=8,jR=({shouldWrap:e,children:o,username:t})=>e?Lo(st,{label:t||"Unknown user",children:o}):Lo(JR,{children:o}),lg=({actionManager:e,collaborator:o,socketId:t,withName:n=!1,shouldWrapWithTooltip:r=!1,isBeingFollowed:i})=>{let l={socketId:t,collaborator:o,withName:n,isBeingFollowed:i},a=e.renderAction("goToCollaborator",l);return Lo(jR,{username:o.username,shouldWrap:r,children:a},t)},qR=["avatarUrl","id","socketId","username","isInCall","isSpeaking","isMuted"],Rd=Dd.memo(({className:e,mobile:o,collaborators:t,userToFollow:n})=>{let r=Ye(),i=new Map;t.forEach((g,b)=>{let y=g.id||b;i.set(y,{...g,socketId:b})});let l=Array.from(i.values()).filter(g=>g.username?.trim()),[a,s]=Dd.useState(""),c=l.filter(g=>g.username?.toLowerCase().includes(a)),m=Dd.useRef(null);VR(()=>{if(m.current){let g=y=>{let v=Math.max(1,Math.min(8,Math.floor(y/38)));d(v)};if(g(m.current.clientWidth),!XR)return;let b=new ResizeObserver(y=>{for(let v of y){let{width:x}=v.contentRect;g(x)}});return b.observe(m.current),()=>{b.disconnect()}}},[]);let[p,d]=Dd.useState(ZR),f=l.slice(0,p-1).map(g=>lg({actionManager:r,collaborator:g,socketId:g.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:g.socketId===n}));return o?Lo("div",{className:e3("UserList UserList_mobile",e),children:l.map(g=>lg({actionManager:r,collaborator:g,socketId:g.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:g.socketId===n}))}):Lo("div",{className:"UserList__wrapper",ref:m,children:_d("div",{className:e3("UserList",e),style:{"--max-avatars":p},children:[f,l.length>p-1&&_d(Ld.Root,{children:[_d(Ld.Trigger,{className:"UserList__more",children:["+",l.length-p+1]}),Lo(Ld.Content,{style:{zIndex:2,width:"15rem",textAlign:"left"},align:"end",sideOffset:10,children:_d(Oe,{padding:2,children:[l.length>=$R&&Lo(oc,{placeholder:E("quickSearch.placeholder"),onChange:s}),Lo(nc,{className:"dropdown-menu UserList__collaborators",placeholder:E("userList.empty"),children:c.length>0?[Lo("div",{className:"hint",children:E("userList.hint.text")}),c.map(g=>lg({actionManager:r,collaborator:g,socketId:g.socketId,withName:!0,isBeingFollowed:g.socketId===n}))]:[]}),Lo(Ld.Arrow,{width:20,height:10,style:{fill:"var(--popup-bg-color)",filter:"drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)"}})]})})]})]})})},(e,o)=>{if(e.collaborators.size!==o.collaborators.size||e.mobile!==o.mobile||e.className!==o.className||e.userToFollow!==o.userToFollow)return!1;let t=o.collaborators.keys();for(let[n,r]of e.collaborators){let i=o.collaborators.get(n);if(!i||n!==t.next().value||!KR(r,i,qR))return!1}return!0});import QR from"clsx";import{jsx as t3,jsxs as tN}from"react/jsx-runtime";var eN="medium",o3=e=>e.penDetected?tN("label",{className:QR("ToolIcon ToolIcon__penMode",`ToolIcon_size_${eN}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[t3("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),t3("div",{className:"ToolIcon__icon",children:K1})]}):null;import Ol from"clsx";import{jsx as oN}from"react/jsx-runtime";var n3=e=>oN("button",{className:"help-icon",onClick:e.onClick,type:"button",title:`${E("helpDialog.title")} \u2014 ?`,"aria-label":E("helpDialog.title"),children:Gr});import{jsx as Ft,jsxs as sg}from"react/jsx-runtime";var r3=({appState:e,actionManager:o,showExitZenModeBtn:t,renderWelcomeScreen:n})=>{let{FooterCenterTunnel:r,WelcomeScreenHelpHintTunnel:i}=We();return sg("footer",{role:"contentinfo",className:"layer-ui__wrapper__footer App-menu App-menu_bottom",children:[Ft("div",{className:Ol("layer-ui__wrapper__footer-left zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled}),children:Ft(kt.Col,{gap:2,children:sg(Fl,{heading:"canvasActions",children:[Ft(st,{label:E("labels.viewMode"),children:Ft("div",{className:Ol("view-mode-button"),children:o.renderAction("viewMode")})}),Ft(st,{label:E("buttons.smartZoom"),children:Ft("div",{className:Ol("smart-zoom-button"),children:o.renderAction("smartZoom")})}),Ft(_v,{renderAction:o.renderAction,zoom:e.zoom}),!e.viewModeEnabled&&Ft(Rv,{renderAction:o.renderAction,className:Ol("zen-mode-transition",{"layer-ui__wrapper__footer-left--transition-bottom":e.zenModeEnabled})})]})})}),Ft(r.Out,{}),Ft("div",{className:Ol("layer-ui__wrapper__footer-right zen-mode-transition",{"transition-right":e.zenModeEnabled}),children:sg("div",{style:{position:"relative"},children:[n&&Ft(i.Out,{}),Ft(n3,{onClick:()=>o.executeAction(pr)})]})}),Ft(Nv,{actionManager:o,showExitZenModeBtn:t})]})},i3=r3;r3.displayName="Footer";import EN from"clsx";import{useEffect as p3,useLayoutEffect as u3,useRef as Eg,useState as xN,forwardRef as h3,useImperativeHandle as bN,useCallback as c3}from"react";import{CLASSES as yN,EVENT as d3,isDevEnv as wN,KEYS as vN,updateObject as TN}from"@excalidraw/common";import lN from"clsx";import{useContext as sN}from"react";import nN from"clsx";import{composeEventHandlers as rN}from"@excalidraw/common";import{jsx as iN}from"react/jsx-runtime";var uo=({type:e="button",onSelect:o,selected:t,children:n,className:r="",...i})=>iN("button",{onClick:rN(i.onClick,l=>{o()}),type:e,className:nN("excalidraw-button",r,{selected:t}),...i,children:n});import aN from"react";var Nd=aN.createContext({});import{jsx as cg,jsxs as a3}from"react/jsx-runtime";var dg=({children:e,className:o})=>{let t=me(),n=sN(Nd),r=!!(t.canFitSidebar&&n.shouldRenderDockButton);return a3("div",{className:lN("sidebar__header",o),"data-testid":"sidebar-header",children:[e,a3("div",{className:"sidebar__header__buttons",children:[r&&cg(st,{label:E("labels.sidebarLock"),children:cg(uo,{onSelect:()=>n.onDock?.(!n.docked),selected:!!n.docked,className:"sidebar__dock","data-testid":"sidebar-dock","aria-label":E("labels.sidebarLock"),children:G1})}),cg(uo,{"data-testid":"sidebar-close",className:"sidebar__close",onSelect:n.onCloseRequest,"aria-label":E("buttons.close"),children:xo})]})]})};dg.displayName="SidebarHeader";import{Tabs as cN}from"radix-ui";import{jsx as l3}from"react/jsx-runtime";var mg=({children:e,tab:o,onSelect:t,...n})=>l3(cN.Trigger,{value:o,asChild:!0,onSelect:t,children:l3("button",{type:"button",className:"excalidraw-button sidebar-tab-trigger",...n,children:e})});mg.displayName="SidebarTabTrigger";import{Tabs as dN}from"radix-ui";import{jsx as mN}from"react/jsx-runtime";var pg=({children:e,...o})=>mN(dN.List,{className:"sidebar-triggers",...o,children:e});pg.displayName="SidebarTabTriggers";import pN from"clsx";import{jsx as ug,jsxs as s3}from"react/jsx-runtime";var hg=({name:e,tab:o,icon:t,title:n,children:r,onToggle:i,className:l,style:a})=>{let s=Me(),c=he();return s3("label",{title:n,className:"sidebar-trigger__label-element",children:[ug("input",{className:"ToolIcon_type_checkbox",type:"checkbox",onChange:m=>{document.querySelector(".layer-ui__wrapper")?.classList.remove("animate");let p=m.target.checked;s({openSidebar:p?{name:e,tab:o}:null,openMenu:null,openPopup:null}),i?.(p)},checked:c.openSidebar?.name===e,"aria-label":n,"aria-keyshortcuts":"0"}),s3("div",{className:pN("sidebar-trigger",l),style:a,children:[t&&ug("div",{children:t}),r&&ug("div",{className:"sidebar-trigger__label",children:r})]})]})};hg.displayName="SidebarTrigger";import{Tabs as uN}from"radix-ui";import{jsx as hN}from"react/jsx-runtime";var gg=({children:e,...o})=>{let t=he(),n=Me();if(!t.openSidebar)return null;let{name:r}=t.openSidebar;return hN(uN.Root,{className:"sidebar-tabs-root",value:t.openSidebar.tab,onValueChange:i=>n(l=>({...l,openSidebar:{...l.openSidebar,name:r,tab:i}})),...o,children:e})};gg.displayName="SidebarTabs";import{Tabs as gN}from"radix-ui";import{jsx as fN}from"react/jsx-runtime";var fg=({tab:e,children:o,...t})=>fN(gN.Content,{...t,value:e,"data-testid":e,children:o});fg.displayName="SidebarTab";import{jsx as m3}from"react/jsx-runtime";import{createElement as IN}from"react";var zl=je(!1),g3=h3(({name:e,children:o,onDock:t,docked:n,className:r,...i},l)=>{wN()&&t&&n==null&&console.warn("Sidebar: `docked` must be set when `onDock` is supplied for the sidebar to be user-dockable. To hide this message, either pass `docked` or remove `onDock`");let a=Me(),s=N1(zl);u3(()=>(s(!!n),()=>{s(!1)}),[s,n]);let c=Eg({});c.current.onCloseRequest=()=>{a({openSidebar:null})},c.current.onDock=h=>t?.(h),c.current=TN(c.current,{docked:n,shouldRenderDockButton:!!t&&n!=null});let m=Eg(null);bN(l,()=>m.current);let p=me(),d=c3(()=>{document.querySelector(".Dialog")||a({openSidebar:null})},[a]);return Jr(m,c3(h=>{h.target.closest(".sidebar-trigger")||(!n||!p.canFitSidebar)&&d()},[d,n,p.canFitSidebar])),p3(()=>{let h=f=>{f.key===vN.ESCAPE&&(!n||!p.canFitSidebar)&&d()};return document.addEventListener(d3.KEYDOWN,h),()=>{document.removeEventListener(d3.KEYDOWN,h)}},[d,n,p.canFitSidebar]),m3(Oe,{...i,className:EN(yN.SIDEBAR,{"sidebar--docked":n},r),ref:m,children:m3(Nd.Provider,{value:c.current,children:o})})});g3.displayName="SidebarInner";var Do=Object.assign(h3((e,o)=>{let t=he(),{onStateChange:n}=e,r=Eg(t.openSidebar);p3(()=>{(!t.openSidebar&&r?.current?.name===e.name||t.openSidebar?.name===e.name&&r?.current?.name!==e.name||r.current?.name===e.name)&&t.openSidebar!==r.current&&n?.(t.openSidebar?.name!==e.name?null:t.openSidebar),r.current=t.openSidebar},[t.openSidebar,n,e.name]);let[i,l]=xN(!1);return u3(()=>(l(!0),()=>l(!1)),[]),i&&t.openSidebar?.name===e.name?IN(g3,{...e,ref:o,key:e.name}):null}),{Header:dg,TabTriggers:pg,TabTrigger:mg,Tabs:gg,Tab:fg,Trigger:hg});Do.displayName="Sidebar";import{composeEventHandlers as DN}from"@excalidraw/common";import{useLayoutEffect as CN,useRef as SN}from"react";import{jsx as kN}from"react/jsx-runtime";var Tr=(e,o)=>{let t=je(0),n=r=>{let{tunnelsJotai:{useAtom:i}}=We(),[,l]=i(t),a=SN({preferHost:!1,counter:0});return CN(()=>{let s=a.current;return l(c=>{let m=c+1;return s.counter=m,m}),()=>{l(c=>{let m=c-1;return s.counter=m,m||(s.preferHost=!1),m})}},[l]),r.__fallback||(a.current.preferHost=!0),!a.current.counter&&r.__fallback&&a.current.preferHost||a.current.counter>1&&r.__fallback?null:kN(o,{...r})};return n.displayName=e,n};var wg={};SS(wg,{ChangeCanvasBackground:()=>S3,Export:()=>k3,Help:()=>I3,LiveCollaborationTrigger:()=>P3,LoadScene:()=>y3,Preferences:()=>ho,PreferencesToggleGridModeItem:()=>yg,PreferencesToggleZenModeItem:()=>N3,SaveAsImage:()=>v3,SaveToActiveFile:()=>w3,SearchMenu:()=>T3,Socials:()=>M3,ToggleTheme:()=>C3});import LN from"clsx";import{THEME as zn}from"@excalidraw/common";var xg=je({active:!1});async function f3({title:e,description:o,actionLabel:t,color:n}){return new Promise(r=>{Ut.set(xg,{active:!0,onConfirm:()=>r(!0),onClose:()=>r(!1),onReject:()=>r(!1),title:e,description:o,actionLabel:t,color:n})})}import MN from"clsx";import{jsx as E3,jsxs as PN}from"react/jsx-runtime";var Bd=function({onChange:e,value:o,choices:t,name:n}){return E3("div",{className:"RadioGroup",children:t.map(r=>PN("div",{className:MN("RadioGroup__choice",{active:r.value===o}),title:r.ariaLabel,children:[E3("input",{name:n,type:"radio",checked:r.value===o,onChange:()=>e(r.value),"aria-label":r.ariaLabel}),r.label]},String(r.value)))})};import{Fragment as AN,jsx as Hl,jsxs as x3}from"react/jsx-runtime";var b3=({value:e,shortcut:o,onChange:t,choices:n,children:r,name:i,icon:l})=>{let a=me();return x3(AN,{children:[x3("div",{className:"dropdown-menu-item-base dropdown-menu-item-bare",children:[l&&Hl("div",{className:"dropdown-menu-item__icon",children:l}),Hl("label",{className:"dropdown-menu-item__text",children:Hl(Xa,{children:r})}),Hl(Bd,{name:i,value:e,onChange:t,choices:n})]}),o&&a.formFactor!=="phone"&&Hl("div",{className:"dropdown-menu-item__shortcut dropdown-menu-item__shortcut--orphaned",children:o})]})};b3.displayName="DropdownMenuItemContentRadio";var bg=b3;import{Fragment as O3,jsx as ge,jsxs as Gl}from"react/jsx-runtime";var y3=()=>{let{t:e}=Te(),o=Ye(),t=ei();return o.isActionEnabled(hi)?ge(Dt,{icon:Ds,onSelect:async()=>{(!t.length||await f3({title:e("overwriteConfirm.modal.loadFromFile.title"),actionLabel:e("overwriteConfirm.modal.loadFromFile.button"),color:"warning",description:ge(wr,{i18nKey:"overwriteConfirm.modal.loadFromFile.description",bold:r=>ge("strong",{children:r}),br:()=>ge("br",{})})}))&&o.executeAction(hi)},"data-testid":"load-button",shortcut:Ue("loadScene"),"aria-label":e("buttons.load"),children:e("buttons.load")}):null};y3.displayName="LoadScene";var w3=()=>{let{t:e}=Te(),o=Ye();return o.isActionEnabled(mr)?ge(Dt,{shortcut:Ue("saveScene"),"data-testid":"save-button",onSelect:()=>o.executeAction(mr),icon:oE,"aria-label":`${e("buttons.save")}`,children:`${e("buttons.save")}`}):null};w3.displayName="SaveToActiveFile";var v3=()=>{let e=Me(),{t:o}=Te();return ge(Dt,{icon:aE,"data-testid":"image-export-button",onSelect:()=>e({openDialog:{name:"imageExport"}}),shortcut:Ue("imageExport"),"aria-label":o("buttons.exportImage"),children:o("buttons.exportImage")})};v3.displayName="SaveAsImage";var T3=e=>{let{t:o}=Te(),t=Ye();return ge(Dt,{icon:bo,"data-testid":"search-menu-button",onSelect:()=>{t.executeAction(qu)},shortcut:Ue("searchMenu"),"aria-label":o("search.title"),className:e?.className,children:o("search.title")})};T3.displayName="SearchMenu";var I3=()=>{let{t:e}=Te(),o=Ye();return ge(Dt,{"data-testid":"help-menu-item",icon:Gr,onSelect:()=>o.executeAction(pr),shortcut:"?","aria-label":e("helpDialog.title"),children:e("helpDialog.title")})};I3.displayName="Help";var C3=e=>{let{t:o}=Te(),t=he(),n=Ye(),r=Ue("toggleTheme");return n.isActionEnabled(Ec)?e?.allowSystemTheme?ge(bg,{name:"theme",value:e.theme,onChange:i=>e.onSelect(i),choices:[{value:zn.LIGHT,label:Da,ariaLabel:`${o("buttons.lightMode")} - ${r}`},{value:zn.DARK,label:La,ariaLabel:`${o("buttons.darkMode")} - ${r}`},{value:"system",label:E0,ariaLabel:o("buttons.systemMode")}],children:o("labels.theme")}):ge(Dt,{onSelect:i=>{if(i.preventDefault(),e?.onSelect)e.onSelect(t.theme===zn.DARK?zn.LIGHT:zn.DARK);else return n.executeAction(Ec)},icon:t.theme===zn.DARK?Da:La,"data-testid":"toggle-dark-mode",shortcut:r,"aria-label":t.theme===zn.DARK?o("buttons.lightMode"):o("buttons.darkMode"),children:t.theme===zn.DARK?o("buttons.lightMode"):o("buttons.darkMode")}):null};C3.displayName="ToggleTheme";var S3=()=>{let{t:e}=Te(),o=he(),t=Ye(),n=ai();return o.viewModeEnabled||!n.UIOptions.canvasActions.changeViewBackgroundColor?null:Gl("div",{style:{marginTop:"0.75rem"},children:[ge("div",{"data-testid":"canvas-background-label",style:{fontSize:"0.875rem",marginBottom:"0.25rem",marginLeft:"0.5rem"},children:e("labels.canvasBackground")}),ge("div",{style:{padding:"0 0.625rem"},children:t.renderAction("changeViewBackgroundColor")})]})};S3.displayName="ChangeCanvasBackground";var k3=()=>{let{t:e}=Te(),o=Me();return ge(Dt,{icon:_a,onSelect:()=>{o({openDialog:{name:"jsonExport"}})},"data-testid":"json-export-button","aria-label":e("buttons.export"),children:e("buttons.export")})};k3.displayName="Export";var M3=()=>{let{t:e}=Te();return Gl(O3,{children:[ge(ji,{icon:Q1,href:"https://github.com/excalidraw/excalidraw","aria-label":"GitHub",children:"GitHub"}),ge(ji,{icon:tE,href:"https://x.com/excalidraw","aria-label":"X",children:e("labels.followUs")}),ge(ji,{icon:eE,href:"https://discord.gg/UexuTaE","aria-label":"Discord",children:e("labels.discordChat")})]})};M3.displayName="Socials";var P3=({onSelect:e,isCollaborating:o})=>{let{t}=Te();return ge(Dt,{"data-testid":"collab-button",icon:_s,className:LN({"active-collab":o}),onSelect:e,children:t("labels.liveCollaboration")})};P3.displayName="LiveCollaborationTrigger";var A3=()=>{let{t:e}=Te(),o=vt(),t=he();return ge(mo,{checked:t.activeTool.locked,shortcut:Ue("toolLock"),onSelect:n=>{o.toggleLock(),n.preventDefault()},children:e("labels.preferences_toolLock")})},L3=()=>{let{t:e}=Te(),o=he(),t=Me();return ge(bg,{name:"boxSelectionMode",icon:Hs,value:o.boxSelectionMode,onChange:n=>{t({boxSelectionMode:n})},choices:[{value:"contain",label:e("labels.boxSelectionContain"),ariaLabel:e("labels.boxSelectionContain")},{value:"overlap",label:e("labels.boxSelectionOverlap"),ariaLabel:e("labels.boxSelectionOverlap")}],children:e("labels.boxSelectionMode")})},D3=()=>{let{t:e}=Te(),o=Ye(),t=he();return ge(mo,{checked:t.objectsSnapModeEnabled,shortcut:Ue("objectsSnapMode"),onSelect:n=>{o.executeAction(so),n.preventDefault()},children:e("buttons.objectsSnapMode")})},_3=()=>{let{t:e}=Te(),o=Ye(),t=he();return ge(mo,{checked:t.bindingPreference==="enabled",onSelect:n=>{o.executeAction(al),n.preventDefault()},children:e("labels.arrowBinding")})},R3=()=>{let{t:e}=Te(),o=Ye(),t=he();return ge(mo,{checked:t.isMidpointSnappingEnabled,onSelect:n=>{o.executeAction(ll),n.preventDefault()},children:e("labels.midpointSnapping")})},yg=()=>{let{t:e}=Te(),o=Ye(),t=he();return ge(mo,{checked:t.gridModeEnabled,shortcut:Ue("gridMode"),onSelect:n=>{o.executeAction(vi),n.preventDefault()},children:e("labels.toggleGrid")})},N3=()=>{let{t:e}=Te(),o=Ye(),t=he();return ge(mo,{checked:t.zenModeEnabled,shortcut:Ue("zenMode"),onSelect:n=>{o.executeAction(il),n.preventDefault()},children:e("buttons.zenMode")})},B3=()=>{let{t:e}=Te(),o=Ye(),t=he();return ge(mo,{checked:t.viewModeEnabled,shortcut:Ue("viewMode"),onSelect:n=>{o.executeAction(_i),n.preventDefault()},children:e("labels.viewMode")})},F3=()=>{let{t:e}=Te(),o=Ye(),t=he();return ge(mo,{checked:t.stats.open,shortcut:Ue("stats"),onSelect:n=>{o.executeAction(Ln),n.preventDefault()},children:e("stats.fullTitle")})},ho=({children:e,additionalItems:o})=>{let{t}=Te();return Gl(Fn,{children:[ge(Fn.Trigger,{icon:S0,children:t("labels.preferences")}),Gl(Fn.Content,{className:"excalidraw-main-menu-preferences-submenu",children:[e||Gl(O3,{children:[ge(L3,{}),ge(A3,{}),ge(D3,{}),ge(yg,{}),ge(B3,{}),ge(F3,{}),ge(_3,{}),ge(R3,{})]}),o]})]})};ho.ToggleToolLock=A3;ho.BoxSelectionMode=L3;ho.ToggleSnapMode=D3;ho.ToggleArrowBinding=_3;ho.ToggleMidpointSnapping=R3;ho.ToggleGridMode=yg;ho.ToggleZenMode=N3;ho.ToggleViewMode=B3;ho.ToggleElementProperties=F3;ho.displayName="Preferences";import{jsx as Fd,jsxs as vg}from"react/jsx-runtime";var _N=Object.assign(Tr("MainMenu",({children:e,onSelect:o})=>{let{MainMenuTunnel:t}=We(),n=me(),r=he(),i=Me();return Fd(t.In,{children:vg(Pe,{open:r.openMenu==="canvas",children:[Fd(Pe.Trigger,{onToggle:()=>{i({openMenu:r.openMenu==="canvas"?null:"canvas",openPopup:null,openDialog:null})},"data-testid":"main-menu-trigger",className:"main-menu-trigger",children:q1}),vg(Pe.Content,{onClickOutside:()=>i({openMenu:null}),onSelect:DN(o,()=>{i({openMenu:null})}),className:"main-menu",align:"start",children:[e,n.formFactor==="phone"&&r.collaborators.size>0&&vg("fieldset",{className:"UserList-Wrapper",children:[Fd("legend",{children:E("labels.collaborators")}),Fd(Rd,{mobile:!0,collaborators:r.collaborators,userToFollow:r.userToFollow?.socketId||null})]})]})]})})}),{Trigger:Pe.Trigger,Item:Pe.Item,ItemLink:Pe.ItemLink,ItemCustom:Pe.ItemCustom,Group:Pe.Group,Separator:Pe.Separator,Sub:Fn,DefaultItems:wg}),Et=_N;import RN from"clsx";import{forwardRef as NN,useState as BN}from"react";import{isPromiseLike as FN}from"@excalidraw/common";import{jsx as Od,jsxs as ON}from"react/jsx-runtime";var Hn=NN(({children:e,icon:o,onClick:t,label:n,variant:r="filled",color:i="primary",size:l="medium",fullWidth:a,className:s,status:c,disabled:m},p)=>{let[d,h]=BN(!1),f=async b=>{let y=t?.(b);if(FN(y)){let v=window.setTimeout(()=>{h(!0)},50);try{await y}catch(x){if(x instanceof us)console.warn(x);else throw x}finally{clearTimeout(v),h(!1)}}},g=d?"loading":c;return i=g==="success"?"success":i,Od("button",{className:RN("ExcButton",`ExcButton--color-${i}`,`ExcButton--variant-${r}`,`ExcButton--size-${l}`,`ExcButton--status-${g}`,{"ExcButton--fullWidth":a},s),onClick:f,type:"button","aria-label":n,ref:p,disabled:m||g==="loading"||g==="success",children:ON("div",{className:"ExcButton__contents",children:[g==="loading"?Od(Yo,{className:"ExcButton__statusIcon"}):g==="success"&&Od("div",{className:"ExcButton__statusIcon",children:o0}),o&&Od("div",{className:"ExcButton__icon","aria-hidden":!0,children:o}),r!=="icon"&&(e??n)]})})});import{jsx as qi,jsxs as GN}from"react/jsx-runtime";var zd=({title:e,children:o,actionLabel:t,onClick:n})=>GN("div",{className:"OverwriteConfirm__Actions__Action",children:[qi("h4",{children:e}),qi("div",{className:"OverwriteConfirm__Actions__Action__content",children:o}),qi(Hn,{variant:"outlined",color:"muted",label:t,size:"large",fullWidth:!0,onClick:n})]}),zN=()=>{let{t:e}=Te(),o=Ye(),t=Me();return qi(zd,{title:e("overwriteConfirm.action.exportToImage.title"),actionLabel:e("overwriteConfirm.action.exportToImage.button"),onClick:()=>{o.executeAction(Mc,"ui",!0),t({openDialog:{name:"imageExport"}})},children:e("overwriteConfirm.action.exportToImage.description")})},HN=()=>{let{t:e}=Te(),o=Ye();return qi(zd,{title:e("overwriteConfirm.action.saveToDisk.title"),actionLabel:e("overwriteConfirm.action.saveToDisk.button"),onClick:()=>{o.executeAction(nl,"ui")},children:e("overwriteConfirm.action.saveToDisk.description")})},Tg=Object.assign(({children:e})=>qi("div",{className:"OverwriteConfirm__Actions",children:e}),{ExportToImage:zN,SaveToDisk:HN});import{jsx as Gn,jsxs as z3}from"react/jsx-runtime";var Hd=Object.assign(Tr("OverwriteConfirmDialog",({children:e})=>{let{OverwriteConfirmDialogTunnel:o}=We(),[t,n]=He(xg);if(!t.active)return null;let r=()=>{t.onClose(),n(l=>({...l,active:!1}))},i=()=>{t.onConfirm(),n(l=>({...l,active:!1}))};return Gn(o.In,{children:Gn(qt,{onCloseRequest:r,title:!1,size:916,children:z3("div",{className:"OverwriteConfirm",children:[Gn("h3",{children:t.title}),z3("div",{className:`OverwriteConfirm__Description OverwriteConfirm__Description--color-${t.color}`,children:[Gn("div",{className:"OverwriteConfirm__Description__icon",children:n0}),Gn("div",{children:t.description}),Gn("div",{className:"OverwriteConfirm__Description__spacer"}),Gn(Hn,{color:t.color,size:"large",label:t.actionLabel,onClick:i})]}),Gn(Tg,{children:e})]})})})}),{Actions:Tg,Action:zd});import h9 from"clsx";import{CANVAS_SEARCH_TAB as Ag,DEFAULT_SIDEBAR as g9,composeEventHandlers as f9}from"@excalidraw/common";import{round as KN}from"@excalidraw/math";import ZN from"clsx";import $N from"lodash.debounce";import{Fragment as jN,memo as qN,useEffect as Ul,useMemo as G3,useRef as Sg,useState as U3}from"react";import{CLASSES as JN,EVENT as QN,FONT_FAMILY as kg,FRAME_STYLE as Mg,getLineHeight as e9}from"@excalidraw/common";import{isElementCompletelyInViewport as t9}from"@excalidraw/element";import{measureText as Wl}from"@excalidraw/element";import{KEYS as Ji,randomInteger as W3,addEventListener as o9,getFontString as Ud}from"@excalidraw/common";import{newTextElement as n9}from"@excalidraw/element";import{isTextElement as K3,isFrameLikeElement as Wd}from"@excalidraw/element";import{getDefaultFrameName as Z3}from"@excalidraw/element/frame";import Ig from"clsx";import{forwardRef as UN,useRef as WN,useImperativeHandle as YN,useLayoutEffect as VN,useState as XN}from"react";import{jsx as Cg,jsxs as H3}from"react/jsx-runtime";var Gd=UN(({onChange:e,label:o,fullWidth:t,placeholder:n,readonly:r,selectOnRender:i,onKeyDown:l,isRedacted:a=!1,icon:s,className:c,type:m,...p},d)=>{let h=WN(null);YN(d,()=>h.current),VN(()=>{i&&(h.current?.focus(),h.current?.select())},[i]);let[f,g]=XN(!1);return H3("div",{className:Ig("ExcTextField",c,{"ExcTextField--fullWidth":t,"ExcTextField--hasIcon":!!s}),onClick:()=>{h.current?.focus()},children:[s,o&&Cg("div",{className:"ExcTextField__label",children:o}),H3("div",{className:Ig("ExcTextField__input",{"ExcTextField__input--readonly":r}),children:[Cg("input",{className:Ig({"is-redacted":"value"in p&&p.value&&a&&!f}),readOnly:r,value:"value"in p?p.value:void 0,defaultValue:"defaultValue"in p?p.defaultValue:void 0,placeholder:n,ref:h,onChange:b=>e?.(b.target.value),onKeyDown:l,type:m}),a&&Cg(uo,{onSelect:()=>g(!f),style:{border:0,userSelect:"none"},children:f?l0:lr})]})]})});import{Fragment as u9,jsx as tt,jsxs as _o}from"react/jsx-runtime";var r9=je(""),Pg=je(null),i9=350,$3=()=>{let e=vt(),o=Me(),t=Sg(null),[n,r]=He(r9),i=n.trim(),[l,a]=U3(!1),[s,c]=U3({nonce:null,items:[]}),m=Sg(null),p=Sg(void 0),[d,h]=He(Pg),f=e.scene.getNonDeletedElementsMap();Ul(()=>{l||(i!==m.current||e.scene.getSceneNonce()!==p.current)&&(m.current=null,X3(i,e,(x,w)=>{c({nonce:W3(),items:x}),m.current=i,p.current=e.scene.getSceneNonce(),o({searchMatches:x.length?{focusedId:null,matches:x.map(T=>({id:T.element.id,focus:!1,matchedLines:T.matchedLines}))}:null})}))},[l,i,f,e,o,h,p]);let g=()=>{s.items.length>0&&h(x=>x===null?0:(x+1)%s.items.length)},b=()=>{s.items.length>0&&h(x=>x===null?0:x-1<0?s.items.length-1:x-1)};Ul(()=>{o(x=>x.searchMatches?{searchMatches:{focusedId:d!==null&&x.searchMatches?.matches[d]?.id||null,matches:x.searchMatches.matches.map((T,S)=>S===d?{...T,focus:!0}:{...T,focus:!1})}}:null)},[d,o]),Ul(()=>{if(s.items.length>0&&d!==null){let x=s.items[d];if(x){let w=e.state.zoom.value,T=n9({text:x.searchQuery,x:x.element.x+(x.matchedLines[0]?.offsetX??0),y:x.element.y+(x.matchedLines[0]?.offsetY??0),width:x.matchedLines[0]?.width,height:x.matchedLines[0]?.height,fontSize:Wd(x.element)?Mg.nameFontSize:x.element.fontSize,fontFamily:Wd(x.element)?kg.Assistant:x.element.fontFamily}),S=14,P=T.fontSize,M=P*w<S;if(!t9([T],e.canvas.width/window.devicePixelRatio,e.canvas.height/window.devicePixelRatio,{offsetLeft:e.state.offsetLeft,offsetTop:e.state.offsetTop,scrollX:e.state.scrollX,scrollY:e.state.scrollY,zoom:e.state.zoom},e.scene.getNonDeletedElementsMap(),e.getEditorUIOffsets())||M){let _;M?P>=S?_={fitToContent:!0}:_={fitToViewport:!0,maxZoom:KN(S/P,1)}:_={fitToContent:!0},e.scrollToContent(T,{animate:!0,duration:300,..._,canvasOffsets:e.getEditorUIOffsets()})}}}},[d,s,e]),Ul(()=>()=>{h(null),m.current=null,p.current=void 0,o({searchMatches:null}),a(!1)},[o,h]);let y=Qr({goToNextItem:g,goToPreviousItem:b,searchMatches:s});Ul(()=>{let x=w=>{if(w.key===Ji.ESCAPE&&!e.state.openDialog&&!e.state.openPopup){w.preventDefault(),w.stopPropagation(),o({openSidebar:null});return}if(w[Ji.CTRL_OR_CMD]&&w.key===Ji.F){if(w.preventDefault(),w.stopPropagation(),e.state.openDialog)return;t.current?.matches(":focus")||(e.state.openDialog&&o({openDialog:null}),t.current?.focus(),t.current?.select())}w.target instanceof HTMLElement&&w.target.closest(".layer-ui__search")&&y.searchMatches.items.length&&(w.key===Ji.ENTER&&(w.stopPropagation(),y.goToNextItem()),w.key===Ji.ARROW_UP?(w.stopPropagation(),y.goToPreviousItem()):w.key===Ji.ARROW_DOWN&&(w.stopPropagation(),y.goToNextItem()))};return o9(window,QN.KEYDOWN,x,{capture:!0,passive:!1})},[o,y,e]);let v=`${s.items.length} ${s.items.length===1?E("search.singleResult"):E("search.multipleResults")}`;return _o("div",{className:"layer-ui__search",children:[tt("div",{className:"layer-ui__search-header",children:tt(Gd,{className:JN.SEARCH_MENU_INPUT_WRAPPER,value:n,ref:t,placeholder:E("search.placeholder"),icon:bo,onChange:x=>{r(x),a(!0);let w=x.trim();X3(w,e,(T,S)=>{c({nonce:W3(),items:T}),h(S),m.current=w,p.current=e.scene.getSceneNonce(),o({searchMatches:T.length?{focusedId:null,matches:T.map(P=>({id:P.element.id,focus:!1,matchedLines:P.matchedLines}))}:null}),a(!1)})},selectOnRender:!0})}),_o("div",{className:"layer-ui__search-count",children:[s.items.length>0&&_o(u9,{children:[d!==null&&d>-1?_o("div",{children:[d+1," / ",v]}):tt("div",{children:v}),_o("div",{className:"result-nav",children:[tt(uo,{onSelect:()=>{g()},className:"result-nav-btn",children:Os}),tt(uo,{onSelect:()=>{b()},className:"result-nav-btn",children:w0})]})]}),s.items.length===0&&i&&m.current&&tt("div",{style:{margin:"1rem auto"},children:E("search.noMatch")})]}),tt(s9,{matches:s,onItemClick:h,focusIndex:d,searchQuery:i})]})},Y3=e=>{let o=[e.preview.moreBefore?"...":"",e.preview.previewText.slice(0,e.preview.indexInSearchQuery),e.preview.previewText.slice(e.preview.indexInSearchQuery,e.preview.indexInSearchQuery+e.searchQuery.length),e.preview.previewText.slice(e.preview.indexInSearchQuery+e.searchQuery.length),e.preview.moreAfter?"...":""];return tt("div",{tabIndex:-1,className:ZN("layer-ui__result-item",{active:e.highlighted}),onClick:e.onClick,ref:t=>{e.highlighted&&t?.scrollIntoView({behavior:"auto",block:"nearest"})},children:tt("div",{className:"preview-text",children:o.flatMap((t,n)=>tt(jN,{children:n===2?tt("b",{children:t}):t},n))})})},a9=e=>{let o=G3(()=>e.matches.items.filter(n=>Wd(n.element)),[e.matches]),t=G3(()=>e.matches.items.filter(n=>K3(n.element)),[e.matches]);return _o("div",{children:[o.length>0&&_o("div",{className:"layer-ui__search-result-container",children:[_o("div",{className:"layer-ui__search-result-title",children:[tt("div",{className:"title-icon",children:bn}),tt("div",{children:E("search.frames")})]}),o.map((n,r)=>tt(Y3,{searchQuery:e.searchQuery,preview:n.preview,highlighted:r===e.focusIndex,onClick:()=>e.onItemClick(r)},n.element.id+n.index)),t.length>0&&tt("div",{className:"layer-ui__divider"})]}),t.length>0&&_o("div",{className:"layer-ui__search-result-container",children:[_o("div",{className:"layer-ui__search-result-title",children:[tt("div",{className:"title-icon",children:xn}),tt("div",{children:E("search.texts")})]}),t.map((n,r)=>tt(Y3,{searchQuery:e.searchQuery,preview:n.preview,highlighted:r+o.length===e.focusIndex,onClick:()=>e.onItemClick(r+o.length)},n.element.id+n.index))]})]})},l9=(e,o)=>e.matches.nonce===o.matches.nonce&&e.focusIndex===o.focusIndex,s9=qN(a9,l9),V3=(e,o,t)=>{let i=e.slice(0,o),l=i.split(/\s+/),a=i.endsWith(" "),s=l.length-2-1-(a?0:1),c=l.slice(s<=0?0:s).join(" ")+(a?" ":""),m=20;c=c.length>m?c.slice(-m):c;let p=e.slice(o+t.length),d=p.split(/\s+/),h=!p.startsWith(" "),f=h?6:5,g=(h?"":" ")+d.slice(0,f).join(" ");return{indexInSearchQuery:c.length,previewText:c+t+g,moreBefore:s>0,moreAfter:d.length>f}},c9=(e,o)=>{let t=e.split(`
|
|
19
19
|
`),n=[],r=0;for(let i=0;i<t.length;i++){let l=t[i],a=t[i+1];if(a){let s=o.indexOf(a,r);if(s>l.length+r){let c=s-(l.length+r);for(;c>0;)l+=" ",c--}}n.push(l),r=r+l.length}return n.join(`
|
|
20
20
|
`)},d9=(e,o,t)=>{let r=c9(e.text,e.originalText).split(`
|
|
21
|
-
`),i=[],l=0,a=0;for(let p of r){let d=l,h=d+p.length-1;i.push({line:p,startIndex:d,endIndex:h,lineNumber:a}),l=h+1,a++}let s=t,c=e.originalText.slice(t,t+o.length),m=[];for(let p of i){if(c==="")break;if(s>=p.startIndex&&s<=p.endIndex){let d=p.endIndex+1-s,h=p.line.slice(0,s-p.startIndex),f=c.slice(0,d);c=c.slice(d);let g=Wl(h,Ud(e),e.lineHeight);if(h===""&&(g.width=0),e.textAlign!=="left"&&p.line.length>0){let w=Wl(p.line,Ud(e),e.lineHeight),T=e.textAlign==="center"?(e.width-w.width)/2:e.width-w.width;g.width+=T}let{width:b,height:y}=Wl(f,Ud(e),e.lineHeight),v=g.width,x=p.lineNumber*g.height;m.push({offsetX:v,offsetY:x,width:b,height:y,showOnCanvas:!0}),s+=d}}return m},m9=(e,o,t,n)=>{let r=e.name??Z3(e),i=r.slice(t,t+o.length),l=r.slice(0,t),a=Ud({fontSize:Mg.nameFontSize,fontFamily:kg.Assistant}),s=e9(kg.Assistant),c=Wl(l,a,s);l===""&&(c.width=0);let m=Wl(i,a,s),p=c.width,d=-c.height-Mg.strokeWidth,h=m.width;return[{offsetX:p,offsetY:d,width:h,height:m.height,showOnCanvas:p+h<=e.width*n}]},p9=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&"),X3=$N((e,o,t)=>{if(!e||e===""){t([],null);return}let n=o.scene.getNonDeletedElements(),r=n.filter(d=>K3(d)),i=n.filter(d=>Wd(d));r.sort((d,h)=>d.y-h.y),i.sort((d,h)=>d.y-h.y);let l=[],a=new RegExp(p9(e),"gi");for(let d of r){let h=null,f=d.originalText;for(;(h=a.exec(f))!==null;){let g=V3(f,h.index,e),b=d9(d,e,h.index);b.length>0&&l.push({element:d,searchQuery:e,preview:g,index:h.index,matchedLines:b})}}let s=[];for(let d of i){let h=null,f=d.name??Z3(d);for(;(h=a.exec(f))!==null;){let g=V3(f,h.index,e),b=m9(d,e,h.index,o.state.zoom.value);b.length>0&&s.push({element:d,searchQuery:e,preview:g,index:h.index,matchedLines:b})}}let c=new Set(o.visibleElements.map(d=>d.id)),m=[...s,...l],p=m.findIndex(d=>c.has(d.element.id))??null;t(m,p)},i9);import{jsx as Un,jsxs as j3}from"react/jsx-runtime";import{createElement as E9}from"react";var q3=Tr("DefaultSidebarTrigger",e=>{let{DefaultSidebarTriggerTunnel:o}=We();return Un(o.In,{children:Un(Do.Trigger,{...e,className:"default-sidebar-trigger",name:g9.name})})});q3.displayName="DefaultSidebarTrigger";var J3=({children:e})=>{let{DefaultSidebarTabTriggersTunnel:o}=We();return Un(o.In,{children:e})};J3.displayName="DefaultTabTriggers";var Yd=Object.assign(Tr("DefaultSidebar",({children:e,className:o,onDock:t,docked:n,...r})=>{let i=he(),l=Me(),{DefaultSidebarTabTriggersTunnel:a}=We(),s=i.openSidebar?.tab===Ag;return E9(Do,{...r,name:"default",key:"default",className:h9("default-sidebar",o),docked:s||(n??i.defaultSidebarDockedPreference),onDock:s||t===!1||!t&&n!=null?void 0:f9(t,c=>{l({defaultSidebarDockedPreference:c})})},j3(Do.Tabs,{children:[Un(Do.Header,{children:j3(Do.TabTriggers,{children:[Un(Do.TabTrigger,{tab:Ag,children:bo}),Un(a.Out,{})]})}),Un(Do.Tab,{tab:Ag,children:Un($3,{})}),e]}))}),{Trigger:q3,TabTriggers:J3});import{round as YT}from"@excalidraw/math";import WB from"clsx";import YB from"lodash.throttle";import{useEffect as VT,useMemo as Vg,useState as VB,memo as XB}from"react";import{STATS_PANELS as tm}from"@excalidraw/common";import{getCommonBounds as KB}from"@excalidraw/element";import{getUncroppedWidthAndHeight as ZB}from"@excalidraw/element";import{isImageElement as Xg}from"@excalidraw/element";import{frameAndChildrenSelectedTogether as $B}from"@excalidraw/element";import{elementsAreInSameGroup as jB}from"@excalidraw/element";import{degreesToRadians as aT,radiansToDegrees as dT}from"@excalidraw/math";import{getBoundTextElement as lT}from"@excalidraw/element";import{isArrowElement as sT,isElbowArrow as A9}from"@excalidraw/element";import{updateBindings as cT}from"@excalidraw/element";import I9 from"clsx";import{useEffect as rT,useRef as Xd,useState as C9}from"react";import{EVENT as ta,KEYS as S9,cloneJSON as Lg}from"@excalidraw/common";import{deepCopyElement as k9}from"@excalidraw/element";import{CaptureUpdateAction as iT}from"@excalidraw/element";import{pointFrom as Wn,pointRotateRads as Vd}from"@excalidraw/math";import{getBoundTextElement as x9,isBindingElement as b9,unbindBindingElement as Q3}from"@excalidraw/element";import{isFrameLikeElement as oT}from"@excalidraw/element";import{getSelectedGroupIds as y9,getElementsInGroup as w9,isInGroup as v9}from"@excalidraw/element";import{getFrameChildren as T9}from"@excalidraw/element";import{updateBindings as eT}from"@excalidraw/element";import{DRAGGING_THRESHOLD as tT}from"@excalidraw/common";var nT=.01,Yl=10,Pt=(e,o)=>!(o==="angle"&&oT(e)),Ne=(e,o)=>{let t=e+o/2;return t-t%o},Qi=(e,o,t)=>Object.keys(e).map(n=>({original:(t??o).get(n),latest:o.get(n)})).filter(n=>n.original!==void 0&&n.latest!==void 0);var Ir=(e,o,t,n,r,i,l=!0)=>{if(b9(t)&&(t.startBinding||t.endBinding)){if(Math.abs(e-t.x)<tT&&Math.abs(o-t.y)<tT)return;Q3(t,"start",n),Q3(t,"end",n)}let a=n.getNonDeletedElementsMap(),s=a.get(t.id);if(!s)return;let[c,m]=[t.x+t.width/2,t.y+t.height/2],[p,d]=Vd(Wn(t.x,t.y),Wn(c,m),t.angle),h=e-p,f=o-d,[g,b]=Vd(Wn(e,o),Wn(c+h,m+f),-t.angle);n.mutateElement(s,{x:g,y:b},{informMutation:l,isDragging:!1}),eT(s,n,r);let y=x9(t,i);if(y){let v=a.get(y.id);v&&n.mutateElement(v,{x:y.x+h,y:y.y+f},{informMutation:l,isDragging:!1})}if(oT(t)){let v=T9(i,t.id);v.forEach(x=>{let w=a.get(x.id);if(!w)return;let[T,S]=[x.x+x.width/2,x.y+x.height/2],[P,M]=Vd(Wn(x.x,x.y),Wn(T,S),x.angle),_=Math.round(P+h),R=Math.round(M+f),[A,F]=Vd(Wn(_,R),Wn(T+h,S+f),-x.angle);n.mutateElement(w,{x:A,y:F},{informMutation:l,isDragging:!1}),eT(w,n,r,{simultaneouslyUpdated:v})})}},ea=(e,o)=>{let n=y9(o).map(r=>w9(e,r).reduce((i,l)=>(i[l.id]=!0,i),{}));return e.filter(r=>!v9(r)).forEach(r=>{n.push({[r.id]:!0})}),n};import{jsx as Dg,jsxs as P9}from"react/jsx-runtime";var M9=({label:e,icon:o,dragInputCallback:t,value:n,elements:r,editable:i=!0,shouldKeepAspectRatio:l,property:a,scene:s,appState:c,sensitivity:m=1,dragFinishedCallback:p})=>{let d=vt(),h=Me(),f=Xd(null),g=Xd(null),[b,y]=C9(n.toString()),v=Xd(null);v.current||(v.current={originalAppState:Lg(c),originalElements:r,lastUpdatedValue:b,updatePending:!1}),rT(()=>{let T=n.toString();y(T),v.current.lastUpdatedValue=T},[n]);let x=(T,S,P)=>{if(!v.current.updatePending)return!1;v.current.updatePending=!1;let M=Number(T);if(isNaN(M)){y(n.toString());return}let _=Number(M.toFixed(2)),R=Number(n);(isNaN(R)||Math.abs(_-R)>=nT)&&(v.current.lastUpdatedValue=T,t({accumulatedChange:0,instantChange:0,originalElements:S,originalElementsMap:d.scene.getNonDeletedElementsMap(),shouldKeepAspectRatio:l,shouldChangeByStepSize:!1,scene:s,nextValue:_,property:a,originalAppState:P,setInputValue:A=>y(String(A)),app:d,setAppState:h}),d.syncActionResult({captureUpdate:iT.IMMEDIATELY}))},w=Xd({});return w.current.handleInputValue=x,rT(()=>{let T=f.current,S=w.current;return()=>{let P=T?.value;P&&S.handleInputValue?.(P,v.current.originalElements,v.current.originalAppState),window.removeEventListener(ta.POINTER_MOVE,S.onPointerMove,!1),window.removeEventListener(ta.POINTER_UP,S.onPointerUp,!1)}},[i]),i?P9("div",{className:I9("drag-input-container",!i&&"disabled"),"data-testid":e,children:[Dg("div",{className:"drag-input-label",ref:g,onPointerDown:T=>{if(f.current&&i){document.body.classList.add("excalidraw-cursor-resize");let S=Number(f.current.value);isNaN(S)&&(S=0);let P=null,M=d.scene.getNonDeletedElements().reduce((z,Z)=>(z.set(Z.id,k9(Z)),z),new Map),_=r.map(z=>M.get(z.id)),R=Lg(c),A=0,F=0,U=z=>{if(P&&M!==null&&_!==null){let Z=z.clientX-P.x;Z!==0&&(F+=Z,Math.abs(F)>=m&&(F=Math.sign(F)*Math.floor(Math.abs(F)/m),A+=F,t({accumulatedChange:A,instantChange:F,originalElements:_,originalElementsMap:M,shouldKeepAspectRatio:l,shouldChangeByStepSize:z.shiftKey,property:a,scene:s,originalAppState:R,setInputValue:ae=>y(String(ae)),app:d,setAppState:h}),F=0))}P={x:z.clientX,y:z.clientY}},j=()=>{window.removeEventListener(ta.POINTER_MOVE,U,!1),d.syncActionResult({captureUpdate:iT.IMMEDIATELY}),p?.({app:d,setAppState:h,originalElements:_,originalAppState:R}),P=null,A=0,F=0,_=null,M=null,document.body.classList.remove("excalidraw-cursor-resize"),window.removeEventListener(ta.POINTER_UP,j,!1)};w.current.onPointerMove=U,w.current.onPointerUp=j,window.addEventListener(ta.POINTER_MOVE,U,!1),window.addEventListener(ta.POINTER_UP,j,!1)}},onPointerEnter:()=>{g.current&&(g.current.style.cursor="ew-resize")},children:o?Dg(lc,{icon:o}):e}),Dg("input",{className:"drag-input",autoComplete:"off",spellCheck:"false",onKeyDown:T=>{if(i){let S=T.target;S instanceof HTMLInputElement&&T.key===S9.ENTER&&(x(S.value,r,c),d.focusContainer())}},ref:f,value:b,onChange:T=>{v.current.updatePending=!0,y(T.target.value)},onFocus:T=>{T.target.select(),v.current.originalElements=r,v.current.originalAppState=Lg(c)},onBlur:T=>{b?i&&x(T.target.value,v.current.originalElements,v.current.originalAppState):y(n.toString())},disabled:!i})]}):null},ot=M9;import{jsx as R9}from"react/jsx-runtime";var L9=15,D9=({accumulatedChange:e,originalElements:o,shouldChangeByStepSize:t,nextValue:n,scene:r,app:i})=>{let l=r.getNonDeletedElementsMap(),a=o[0];if(a&&!A9(a)){let s=l.get(a.id);if(!s)return;if(n!==void 0){let f=aT(n);r.mutateElement(s,{angle:f}),cT(s,r,i.state);let g=lT(s,l);g&&!sT(s)&&r.mutateElement(g,{angle:f});return}let c=Math.round(dT(a.angle)*100)/100,m=Math.round(e),p=(c+m)%360;t&&(p=Ne(p,L9)),p=p<0?p+360:p;let d=aT(p);r.mutateElement(s,{angle:d}),cT(s,r,i.state);let h=lT(s,l);h&&!sT(s)&&r.mutateElement(h,{angle:d})}},_9=({element:e,scene:o,appState:t,property:n})=>R9(ot,{label:"A",icon:Ns,value:Math.round(dT(e.angle)%360*100)/100,elements:[e],dragInputCallback:D9,editable:Pt(e,"angle"),scene:o,appState:t,property:n}),mT=_9;import{jsx as B9}from"react/jsx-runtime";var pT=5,N9=({property:e,scene:o,appState:t,setAppState:n})=>B9(ot,{label:"Grid step",sensitivity:8,elements:[],dragInputCallback:({nextValue:r,instantChange:i,shouldChangeByStepSize:l,setInputValue:a})=>{n(s=>{let c;return r?c=r:i&&(c=l?Ne(s.gridStep+pT*Math.sign(i),pT):s.gridStep+i),c?(c=g1(c),a(c),{gridStep:c}):(a(s.gridStep),null)})},scene:o,value:t.gridStep,property:e,appState:t}),uT=N9;import{clamp as Kd,round as _g}from"@excalidraw/math";import{MIN_WIDTH_OR_HEIGHT as Zd}from"@excalidraw/common";import{MINIMAL_CROP_SIZE as hT,getUncroppedWidthAndHeight as ET}from"@excalidraw/element";import{resizeSingleElement as gT}from"@excalidraw/element";import{isImageElement as xT}from"@excalidraw/element";import{isFrameLikeElement as Rg}from"@excalidraw/element";import{getElementsInResizingFrame as Ng}from"@excalidraw/element";import{replaceAllElementsInFrame as bT}from"@excalidraw/element";import{jsx as G9}from"react/jsx-runtime";var fT=10,F9=e=>e.type==="image",O9=({accumulatedChange:e,originalElements:o,originalElementsMap:t,shouldKeepAspectRatio:n,shouldChangeByStepSize:r,nextValue:i,property:l,originalAppState:a,instantChange:s,scene:c,app:m,setAppState:p})=>{let d=c.getNonDeletedElementsMap(),h=o[0],f=d.get(h.id);if(h&&f){let g=n||F9(h),b=h.width/h.height;if(a.croppingElementId===h.id){let y=d.get(h.id);if(!y||!xT(y)||!y.crop)return;let v=y.crop,x={...v},w=y.scale[0]===-1,T=y.scale[1]===-1,{width:S,height:P}=ET(y),M=v.naturalWidth/S,_=v.naturalHeight/P,R=w?v.width+v.x:v.naturalWidth-v.x,A=T?v.height+v.y:v.naturalHeight-v.y,F=hT*M,U=hT*_;if(i!==void 0){if(l==="width"){let oe=i*M,ce=Kd(oe,F,R);x={...x,width:ce,x:w?v.x+v.width-ce:v.x}}else if(l==="height"){let oe=i*_,ce=Kd(oe,U,A);x={...x,height:ce,y:T?v.y+v.height-ce:v.y}}c.mutateElement(y,{crop:x,width:x.width/(v.naturalWidth/S),height:x.height/(v.naturalHeight/P)});return}let j=l==="width"?s:0,z=l==="height"?s:0,Z=Kd(v.width+j,F,R),ae=Kd(v.height+z,F,A);x={...v,x:w?v.x+v.width-Z:v.x,y:T?v.y+v.height-ae:v.y,width:Z,height:ae},c.mutateElement(y,{crop:x,width:x.width/(v.naturalWidth/S),height:x.height/(v.naturalHeight/P)});return}if(i!==void 0){let y=Math.max(l==="width"?i:g?i*b:h.width,Zd),v=Math.max(l==="height"?i:g?i/b:h.height,Zd);if(gT(y,v,f,h,t,c,l==="width"?"e":"s",{shouldMaintainAspectRatio:g}),Rg(f)){let x=Ng(c.getElementsIncludingDeleted(),f,a,c.getNonDeletedElementsMap()),w=bT(c.getElementsIncludingDeleted(),x,f);c.replaceAllElements(w)}return}{let y=l==="width"?e:0,v=l==="height"?e:0,x=Math.max(0,h.width+y);l==="width"&&(r?x=Ne(x,fT):x=Math.round(x));let w=Math.max(0,h.height+v);if(l==="height"&&(r?w=Ne(w,fT):w=Math.round(w)),g&&(l==="width"?w=Math.round(x/b*100)/100:x=Math.round(w*b*100)/100),w=Math.max(Zd,w),x=Math.max(Zd,x),gT(x,w,f,h,t,c,l==="width"?"e":"s",{shouldMaintainAspectRatio:g}),Rg(f)){let T=Ng(c.getElementsIncludingDeleted(),f,a,c.getNonDeletedElementsMap());p({elementsToHighlight:T})}}}},z9=({setAppState:e,app:o,originalElements:t,originalAppState:n})=>{let r=o.scene.getNonDeletedElementsMap(),i=t?.[0],l=i&&r.get(i.id);if(l&&Rg(l)){let a=Ng(o.scene.getElementsIncludingDeleted(),l,n,o.scene.getNonDeletedElementsMap()),s=bT(o.scene.getElementsIncludingDeleted(),a,l);o.scene.replaceAllElements(s),e({elementsToHighlight:null})}},H9=({property:e,element:o,scene:t,appState:n})=>{let r=_g(e==="width"?o.width:o.height,2);if(n.croppingElementId&&n.croppingElementId===o.id&&xT(o)&&o.crop){let{width:i,height:l}=ET(o);if(e==="width"){let a=i/o.crop.naturalWidth;r=_g(o.crop.width*a,2)}if(e==="height"){let a=l/o.crop.naturalHeight;r=_g(o.crop.height*a,2)}}return G9(ot,{label:e==="width"?"W":"H",elements:[o],dragInputCallback:O9,value:r,editable:Pt(o,e),scene:t,appState:n,property:e,dragFinishedCallback:z9})},Bg=H9;import{getBoundTextElement as U9,redrawTextBoundingBox as W9}from"@excalidraw/element";import{hasBoundTextElement as Y9,isTextElement as wT}from"@excalidraw/element";import{jsx as Z9}from"react/jsx-runtime";var yT=4,V9=4,X9=({accumulatedChange:e,originalElements:o,shouldChangeByStepSize:t,nextValue:n,scene:r})=>{let i=r.getNonDeletedElementsMap(),l=o[0];if(l){let a=i.get(l.id);if(!a||!wT(a))return;let s;if(n!==void 0)s=Math.max(Math.round(n),yT);else if(l.type==="text"){let c=Math.round(l.fontSize),m=Math.round(e);s=Math.max(c+m,yT),t&&(s=Ne(s,V9))}s&&(r.mutateElement(a,{fontSize:s}),W9(a,r.getContainerElement(a),r))}},K9=({element:e,scene:o,appState:t,property:n})=>{let r=wT(e)?e:Y9(e)?U9(e,o.getNonDeletedElementsMap()):null;return r?Z9(ot,{label:"F",value:Math.round(r.fontSize*10)/10,elements:[r],dragInputCallback:X9,icon:ar,appState:t,scene:o,property:n}):null},vT=K9;import{degreesToRadians as TT,radiansToDegrees as ST}from"@excalidraw/math";import{getBoundTextElement as IT}from"@excalidraw/element";import{isArrowElement as CT}from"@excalidraw/element";import{isInGroup as Fg}from"@excalidraw/element";import{jsx as J9}from"react/jsx-runtime";var $9=15,j9=({accumulatedChange:e,originalElements:o,shouldChangeByStepSize:t,nextValue:n,property:r,scene:i})=>{let l=i.getNonDeletedElementsMap(),a=o.map(c=>l.get(c.id)).filter(c=>c&&!Fg(c)&&Pt(c,r)),s=o.filter(c=>!Fg(c)&&Pt(c,r));if(n!==void 0){let c=TT(n);for(let m of a){if(!m)continue;i.mutateElement(m,{angle:c});let p=IT(m,l);p&&!CT(m)&&i.mutateElement(p,{angle:c})}i.triggerUpdate();return}for(let c=0;c<a.length;c++){let m=a[c];if(!m)continue;let p=s[c],d=Math.round(ST(p.angle)*100)/100,h=Math.round(e),f=(d+h)%360;t&&(f=Ne(f,$9)),f=f<0?f+360:f;let g=TT(f);i.mutateElement(m,{angle:g});let b=IT(m,l);b&&!CT(m)&&i.mutateElement(b,{angle:g})}i.triggerUpdate()},q9=({elements:e,scene:o,appState:t,property:n})=>{let r=e.filter(s=>!Fg(s)&&Pt(s,"angle")),i=r.map(s=>Math.round(ST(s.angle)%360*100)/100),l=new Set(i).size===1?i[0]:"Mixed",a=r.some(s=>Pt(s,"angle"));return J9(ot,{label:"A",icon:Ns,value:l,elements:e,dragInputCallback:j9,editable:a,appState:t,scene:o,property:n})},kT=q9;import{pointFrom as _T}from"@excalidraw/math";import{useMemo as mB}from"react";import{MIN_WIDTH_OR_HEIGHT as Yn}from"@excalidraw/common";import{getElementsInResizingFrame as zg,isFrameLikeElement as Hg,replaceAllElementsInFrame as BT,updateBoundElements as pB}from"@excalidraw/element";import{rescalePointsInElement as uB,resizeSingleElement as RT}from"@excalidraw/element";import{getBoundTextElement as hB,handleBindTextResize as gB}from"@excalidraw/element";import{isTextElement as FT}from"@excalidraw/element";import{MIME_TYPES as Cr}from"@excalidraw/common";var $d=({elements:e,appState:o,files:t,maxWidthOrHeight:n,getDimensions:r,exportPadding:i,exportingFrame:l})=>{let a=nr(e,null,{deleteInvisibleElements:!0}),s=Fr(o,null),{exportBackground:c,viewBackgroundColor:m}=s;return xs(a,{...s,offsetTop:0,offsetLeft:0,width:0,height:0},t||{},{exportBackground:c,exportPadding:i,viewBackgroundColor:m,exportingFrame:l},(p,d)=>{let h=document.createElement("canvas");if(n){typeof r=="function"&&console.warn("`getDimensions()` is ignored when `maxWidthOrHeight` is supplied.");let g=Math.max(p,d),b=n<g?n/g:o?.exportScale??1;return h.width=p*b,h.height=d*b,{canvas:h,scale:b}}let f=r?.(p,d)||{width:p,height:d};return h.width=f.width,h.height=f.height,{canvas:h,scale:f.scale??1}})},MT=async e=>{let{mimeType:o=Cr.png,quality:t}=e;o===Cr.png&&typeof t=="number"&&console.warn(`"quality" will be ignored for "${Cr.png}" mimeType`),o==="image/jpg"&&(o=Cr.jpg),o===Cr.jpg&&!e.appState?.exportBackground&&(console.warn(`Defaulting "exportBackground" to "true" for "${Cr.jpg}" mimeType`),e={...e,appState:{...e.appState,exportBackground:!0}});let n=await $d(e);return t=t||(/image\/jpe?g/.test(o)?.92:.8),new Promise((r,i)=>{n.toBlob(async l=>{if(!l)return i(new Error("couldn't export to blob"));l&&o===Cr.png&&e.appState?.exportEmbedScene&&(l=await I1({blob:l,metadata:Ia(e.elements,e.appState,e.files||{},"local")})),r(l)},o,t)})},PT=async({elements:e,appState:o=gn(),files:t={},exportPadding:n,renderEmbeddables:r,exportingFrame:i,skipInliningFonts:l,reuseImages:a})=>{let s=nr(e,null,{deleteInvisibleElements:!0}),m={...Fr(o,null),exportPadding:n};return or(s,m,t,{exportingFrame:i,renderEmbeddables:r,skipInliningFonts:l,reuseImages:a})},Q9=async e=>{if(e.type==="svg"){let o=await PT(e);await ao(o.outerHTML)}else if(e.type==="png")await Sc(MT(e));else if(e.type==="json")await Ic(e.elements,e.files);else throw new Error("Invalid export type")};import{arrayToMap as eB}from"@excalidraw/common";import{getElementBounds as tB}from"@excalidraw/element";import{isArrowElement as oB,isExcalidrawElement as nB,isFreeDrawElement as rB,isLinearElement as iB,isTextElement as aB}from"@excalidraw/element";import{rangeIncludesValue as jd,pointFrom as ln,pointRotateRads as lB,rangeInclusive as qd}from"@excalidraw/math";var sB=e=>e.type==="diamond"?[ln(e.width/2,0),ln(e.width,e.height/2),ln(e.width/2,e.height),ln(0,e.height/2)]:[ln(0,0),ln(0+e.width,0),ln(0+e.width,e.height),ln(0,e.height)],cB=e=>iB(e)||rB(e)?e.points:sB(e),AT=e=>{let o=e.reduce((t,[n,r])=>(t.minY=Math.min(t.minY,r),t.minX=Math.min(t.minX,n),t.maxX=Math.max(t.maxX,n),t.maxY=Math.max(t.maxY,r),t),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,cx:0,cy:0});return o.cx=(o.maxX+o.minX)/2,o.cy=(o.maxY+o.minY)/2,o},LT=e=>{let o=cB(e),{cx:t,cy:n}=AT(o),r=ln(t,n),i=o.map(m=>lB(m,r,e.angle)),{minX:l,minY:a,maxX:s,maxY:c}=AT(i);return[l+e.x,a+e.y,s+e.x,c+e.y]},Og=(e,o,t=!1)=>{let n=LT(e),r=o[0]<=n[0]&&o[2]>=n[2]&&o[1]<=n[1]&&o[3]>=n[3];return t?r?!0:n[0]<=o[0]&&n[2]>=o[2]&&n[1]<=o[1]&&n[3]>=o[3]:r},DT=(e,o)=>{let t=LT(e);return(jd(t[0],qd(o[0],o[2]))||jd(o[0],qd(t[0],t[2])))&&(jd(t[1],qd(o[1],o[3]))||jd(o[1],qd(t[1],t[3])))},dB=({elements:e,bounds:o,type:t,errorMargin:n=0})=>{nB(o)&&(o=tB(o,eB(e)));let r=[o[0]-n,o[1]-n,o[2]+n,o[3]+n],i=new Set;for(let l of e){if(i.has(l.id))continue;if(t==="overlap"?DT(l,r):t==="inside"?Og(l,r):Og(l,r,!0)){if(i.add(l.id),l.boundElements)for(let s of l.boundElements)i.add(s.id);aB(l)&&l.containerId&&i.add(l.containerId),oB(l)&&(l.startBinding&&i.add(l.startBinding.elementId),l.endBinding&&i.add(l.endBinding?.elementId))}}return e.filter(l=>i.has(l.id))};import{getCommonBounds as Jd}from"@excalidraw/element";import{jsx as wB}from"react/jsx-runtime";var oa=10,fB=(e,o,t,n)=>{let r=n.x-e,i=n.y-o,l=n.width*t,a=n.height*t,s=e+r*t,c=o+i*t;return{width:l,height:a,x:s,y:c,...uB(n,l,a,!1),...FT(n)?{fontSize:n.fontSize*t}:{}}},EB=(e,o,t,n,r,i,l,a)=>{let s=a.getNonDeletedElementsMap(),c=fB(e,o,n,i);a.mutateElement(r,c);let m=hB(i,l);if(m){let p=m.fontSize*n;pB(r,a);let d=s.get(m.id);d&&FT(d)&&(a.mutateElement(d,{fontSize:p}),gB(r,a,t==="width"?"e":"s",!0))}},NT=(e,o,t,n,r,i,l,a,s,c)=>{i==="width"?o=Math.round(e/n*100)/100:e=Math.round(o*n*100)/100;let m=o/t;for(let p=0;p<a.length;p++){let d=a[p],h=l[p];EB(r[0],r[1],i,m,h,d,s,c)}},xB=({accumulatedChange:e,originalElements:o,originalElementsMap:t,originalAppState:n,shouldChangeByStepSize:r,nextValue:i,scene:l,property:a,setAppState:s,app:c})=>{let m=l.getNonDeletedElementsMap(),p=ea(o,n);if(i!==void 0){for(let g of p){let b=Qi(g,m,t);if(b.length>1){let y=b.map(F=>F.latest),v=b.map(F=>F.original),[x,w,T,S]=Jd(v),P=T-x,M=S-w,_=P/M,R=Math.max(Yn,a==="width"?Math.max(0,i):P),A=Math.max(Yn,a==="height"?Math.max(0,i):M);NT(R,A,M,_,_T(x,w),a,y,v,t,l)}else{let[y]=b,v=y?.latest,x=y?.original;if(v&&x&&Pt(v,a)){let w=a==="width"?Math.max(0,i):v.width;a==="width"&&(r?w=Ne(w,oa):w=Math.round(w));let T=a==="height"?Math.max(0,i):v.height;if(a==="height"&&(r?T=Ne(T,oa):T=Math.round(T)),w=Math.max(Yn,w),T=Math.max(Yn,T),RT(w,T,v,x,t,l,a==="width"?"e":"s",{shouldInformMutation:!1}),Hg(v)){let S=zg(l.getElementsIncludingDeleted(),v,n,l.getNonDeletedElementsMap()),P=BT(l.getElementsIncludingDeleted(),S,v);l.replaceAllElements(P)}}}}l.triggerUpdate();return}let d=a==="width"?e:0,h=a==="height"?e:0,f=[];for(let g of p){let b=Qi(g,m,t);if(b.length>1){let y=b.map(F=>F.latest),v=b.map(F=>F.original),[x,w,T,S]=Jd(v),P=T-x,M=S-w,_=P/M,R=Math.max(0,P+d);a==="width"&&(r?R=Ne(R,oa):R=Math.round(R));let A=Math.max(0,M+h);a==="height"&&(r?A=Ne(A,oa):A=Math.round(A)),R=Math.max(Yn,R),A=Math.max(Yn,A),NT(R,A,M,_,_T(x,w),a,y,v,t,l)}else{let[y]=b,v=y?.latest,x=y?.original;if(v&&x&&Pt(v,a)){let w=Math.max(0,x.width+d);a==="width"&&(r?w=Ne(w,oa):w=Math.round(w));let T=Math.max(0,x.height+h);if(a==="height"&&(r?T=Ne(T,oa):T=Math.round(T)),w=Math.max(Yn,w),T=Math.max(Yn,T),RT(w,T,v,x,t,l,a==="width"?"e":"s",{shouldInformMutation:!1}),Hg(v)){let S=zg(l.getElementsIncludingDeleted(),v,n,l.getNonDeletedElementsMap());f.push(...S)}}}}s({elementsToHighlight:f}),l.triggerUpdate()},bB=({setAppState:e,app:o,originalElements:t,originalAppState:n})=>{let r=o.scene.getNonDeletedElementsMap(),i=t?.[0],l=i&&r.get(i.id);if(l&&Hg(l)){let a=zg(o.scene.getElementsIncludingDeleted(),l,n,o.scene.getNonDeletedElementsMap()),s=BT(o.scene.getElementsIncludingDeleted(),a,l);o.scene.replaceAllElements(s),e({elementsToHighlight:null})}},yB=({property:e,elements:o,elementsMap:t,atomicUnits:n,scene:r,appState:i})=>{let l=mB(()=>n.map(c=>{let m=Qi(c,t);if(m.length>1){let[d,h,f,g]=Jd(m.map(b=>b.latest));return Math.round((e==="width"?f-d:g-h)*100)/100}let[p]=m;return Math.round((e==="width"?p.latest.width:p.latest.height)*100)/100}),[t,n,e]),a=new Set(l).size===1?Math.round(l[0]*100)/100:"Mixed",s=l.length>0;return wB(ot,{label:e==="width"?"W":"H",elements:o,dragInputCallback:xB,value:a,editable:s,appState:i,property:e,scene:r,dragFinishedCallback:bB})},Gg=yB;import{getBoundTextElement as vB,redrawTextBoundingBox as OT}from"@excalidraw/element";import{hasBoundTextElement as TB,isTextElement as IB}from"@excalidraw/element";import{isInGroup as CB}from"@excalidraw/element";import{jsx as AB}from"react/jsx-runtime";var zT=4,SB=4,kB=(e,o)=>e.reduce((t,n)=>{if(!n||CB(n))return t;if(IB(n))return t.push(n),t;if(TB(n)){let r=vB(n,o);if(r)return t.push(r),t}return t},[]),MB=({accumulatedChange:e,originalElements:o,shouldChangeByStepSize:t,nextValue:n,scene:r})=>{let i=r.getNonDeletedElementsMap(),l=o.map(s=>i.get(s.id)),a;if(n){a=Math.max(Math.round(n),zT);for(let s of l)r.mutateElement(s,{fontSize:a}),OT(s,r.getContainerElement(s),r);r.triggerUpdate()}else{let s=o;for(let c=0;c<l.length;c++){let m=l[c],p=s[c],d=Math.round(p.fontSize),h=Math.round(e),f=Math.max(d+h,zT);t&&(f=Ne(f,SB)),r.mutateElement(m,{fontSize:f}),OT(m,r.getContainerElement(m),r)}r.triggerUpdate()}},PB=({elements:e,scene:o,appState:t,property:n,elementsMap:r})=>{let i=kB(e,r);if(!i.length)return null;let l=i.map(c=>Math.round(c.fontSize*10)/10),a=new Set(l).size===1?l[0]:"Mixed",s=l.length>0;return AB(ot,{label:"F",icon:ar,elements:i,dragInputCallback:MB,value:a,editable:s,scene:o,property:n,appState:t})},HT=PB;import{pointFrom as Vn,pointRotateRads as Qd}from"@excalidraw/math";import{useMemo as LB}from"react";import{isTextElement as DB}from"@excalidraw/element";import{getCommonBounds as Ug}from"@excalidraw/element";import{jsx as FB}from"react/jsx-runtime";var _B=(e,o,t,n,r,i,l)=>{for(let a=0;a<n.length;a++){let s=n[a],[c,m]=[s.x+s.width/2,s.y+s.height/2],[p,d]=Qd(Vn(s.x,s.y),Vn(c,m),s.angle),h=e==="x"?Math.round(p+o):p,f=e==="y"?Math.round(d+t):d;Ir(h,f,s,i,l,r,!1)}},RB=(e,o,t,n,r,i)=>{let l=r.getNonDeletedElementsMap(),[a,s,,]=Ug(t),c=e-a,m=o-s;for(let p=0;p<t.length;p++){let d=t[p],h=l.get(d.id);if(h&&(!DB(h)||!h.containerId)){let[f,g]=[h.x+h.width/2,h.y+h.height/2],[b,y]=Qd(Vn(h.x,h.y),Vn(f,g),h.angle);Ir(b+c,y+m,d,r,i,n,!1)}}},NB=({accumulatedChange:e,originalElements:o,originalElementsMap:t,shouldChangeByStepSize:n,nextValue:r,property:i,scene:l,originalAppState:a,app:s})=>{let c=l.getNonDeletedElementsMap();if(r!==void 0){for(let h of ea(o,a)){let f=Qi(h,c,t);if(f.length>1){let[g,b,,]=Ug(f.map(x=>x.latest));RB(i==="x"?r:g,i==="y"?r:b,f.map(x=>x.original),t,l,s.state)}else{let g=f[0]?.original,b=f[0]?.latest;if(g&&b&&Pt(b,i)){let[y,v]=[g.x+g.width/2,g.y+g.height/2],[x,w]=Qd(Vn(g.x,g.y),Vn(y,v),g.angle);Ir(i==="x"?r:x,i==="y"?r:w,g,l,s.state,t,!1)}}}l.triggerUpdate();return}let m=n?Ne(e,Yl):e;_B(i,i==="x"?m:0,i==="y"?m:0,o,t,l,s.state),l.triggerUpdate()},BB=({property:e,elements:o,elementsMap:t,atomicUnits:n,scene:r,appState:i})=>{let l=LB(()=>n.map(s=>{let c=Object.keys(s).map(g=>t.get(g)).filter(g=>g!==void 0);if(c.length>1){let[g,b]=Ug(c);return Math.round((e==="x"?g:b)*100)/100}let[m]=c,[p,d]=[m.x+m.width/2,m.y+m.height/2],[h,f]=Qd(Vn(m.x,m.y),Vn(p,d),m.angle);return Math.round((e==="x"?h:f)*100)/100}),[n,t,e]),a=new Set(l).size===1?l[0]:"Mixed";return FB(ot,{label:e==="x"?"X":"Y",elements:o,dragInputCallback:NB,value:a,property:e,scene:r,appState:i})},Wg=BB;import{clamp as Vl,pointFrom as em,pointRotateRads as UT,round as GT}from"@excalidraw/math";import{getFlipAdjustedCropPosition as OB,getUncroppedWidthAndHeight as zB}from"@excalidraw/element";import{isImageElement as WT}from"@excalidraw/element";import{jsx as UB}from"react/jsx-runtime";var HB=({accumulatedChange:e,instantChange:o,originalElements:t,originalElementsMap:n,shouldChangeByStepSize:r,nextValue:i,property:l,scene:a,originalAppState:s,app:c})=>{let m=a.getNonDeletedElementsMap(),p=t[0],[d,h]=[p.x+p.width/2,p.y+p.height/2],[f,g]=UT(em(p.x,p.y),em(d,h),p.angle);if(s.croppingElementId===p.id){let w=m.get(p.id);if(!w||!WT(w)||!w.crop)return;let T=w.crop,S=T,P=w.scale[0]===-1,M=w.scale[1]===-1,{width:_,height:R}=zB(w);if(i!==void 0){if(l==="x"){let U=i*(T.naturalWidth/_);P?S={...T,x:Vl(T.naturalWidth-U-T.width,0,T.naturalWidth-T.width)}:S={...T,x:Vl(i*(T.naturalWidth/_),0,T.naturalWidth-T.width)}}l==="y"&&(S={...T,y:Vl(i*(T.naturalHeight/R),0,T.naturalHeight-T.height)}),a.mutateElement(w,{crop:S});return}let A=(l==="x"?o:0)*(P?-1:1),F=(l==="y"?o:0)*(M?-1:1);S={...T,x:Vl(T.x+A,0,T.naturalWidth-T.width),y:Vl(T.y+F,0,T.naturalHeight-T.height)},a.mutateElement(w,{crop:S});return}if(i!==void 0){Ir(l==="x"?i:f,l==="y"?i:g,p,a,c.state,n);return}let b=l==="x"?e:0,y=l==="y"?e:0,v=l==="x"?Math.round(r?Ne(p.x+b,Yl):f+b):f,x=l==="y"?Math.round(r?Ne(p.y+y,Yl):g+y):g;Ir(v,x,p,a,c.state,n)},GB=({property:e,element:o,elementsMap:t,scene:n,appState:r})=>{let[i,l]=UT(em(o.x,o.y),em(o.x+o.width/2,o.y+o.height/2),o.angle),a=GT(e==="x"?i:l,2);if(r.croppingElementId===o.id&&WT(o)&&o.crop){let s=OB(o);s&&(a=GT(e==="x"?s.x:s.y,2))}return UB(ot,{label:e==="x"?"X":"Y",elements:[o],dragInputCallback:HB,scene:n,value:a,property:e,appState:r})},Yg=GB;import{Fragment as Kg,jsx as ee,jsxs as At}from"react/jsx-runtime";var qB=50,Xl=e=>{let o=yo(),t=e.app.scene.getSceneNonce()||1,n=e.app.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!1}),r=Rn(e.app);return ee(JB,{...e,appState:o,sceneNonce:t,selectedElements:n,gridModeEnabled:r})},Ae=({children:e,columns:o=1,heading:t,style:n,...r})=>ee("div",{className:WB("exc-stats__row",{"exc-stats__row--heading":t}),style:{gridTemplateColumns:`repeat(${o}, 1fr)`,...n},...r,children:e});Ae.displayName="StatsRow";var om=({children:e,order:o,style:t,...n})=>ee("div",{className:"exc-stats__rows",style:{order:o,...t},...n,children:e});om.displayName="StatsRows";Xl.StatsRow=Ae;Xl.StatsRows=om;var JB=XB(({app:e,onClose:o,renderCustomStats:t,selectedElements:n,appState:r,sceneNonce:i,gridModeEnabled:l})=>{let a=e.scene,s=a.getNonDeletedElements(),c=a.getNonDeletedElementsMap(),m=Me(),p=n.length===1?n[0]:null,d=n.length>1?n:null,h=r.croppingElementId&&Xg(p),f=h?ZB(p):null,[g,b]=VB({width:0,height:0}),y=Vg(()=>YB(w=>{let T=KB(w);b({width:Math.round(T[2])-Math.round(T[0]),height:Math.round(T[3])-Math.round(T[1])})},qB),[]);VT(()=>{y(s)},[i,s,y]),VT(()=>()=>y.cancel(),[y]);let v=Vg(()=>ea(n,r),[n,r]),x=Vg(()=>$B(n),[n]);return ee("div",{className:"exc-stats",children:At(Oe,{padding:3,children:[At("div",{className:"title",children:[ee("h2",{children:E("stats.title")}),ee("div",{className:"close",onClick:o,children:xo})]}),At($a,{label:ee("h3",{children:E("stats.generalStats")}),open:!!(r.stats.panels&tm.generalStats),openTrigger:()=>m(w=>({stats:{open:!0,panels:w.stats.panels^tm.generalStats}})),children:[At(om,{children:[ee(Ae,{heading:!0,children:E("stats.scene")}),At(Ae,{columns:2,children:[ee("div",{children:E("stats.shapes")}),ee("div",{children:s.length})]}),At(Ae,{columns:2,children:[ee("div",{children:E("stats.width")}),ee("div",{children:g.width})]}),At(Ae,{columns:2,children:[ee("div",{children:E("stats.height")}),ee("div",{children:g.height})]}),l&&At(Kg,{children:[ee(Ae,{heading:!0,children:"Canvas"}),ee(Ae,{children:ee(uT,{property:"gridStep",scene:a,appState:r,setAppState:m})})]})]}),t?.(s,r)]}),!x&&n.length>0&&ee("div",{id:"elementStats",style:{marginTop:12},children:ee($a,{label:ee("h3",{children:E("stats.elementProperties")}),open:!!(r.stats.panels&tm.elementProperties),openTrigger:()=>m(w=>({stats:{open:!0,panels:w.stats.panels^tm.elementProperties}})),children:At(om,{children:[p&&At(Kg,{children:[h&&ee(Ae,{heading:!0,children:E("labels.unCroppedDimension")}),r.croppingElementId&&Xg(p)&&f&&At(Ae,{columns:2,children:[ee("div",{children:E("stats.width")}),ee("div",{children:YT(f.width,2)})]}),r.croppingElementId&&Xg(p)&&f&&At(Ae,{columns:2,children:[ee("div",{children:E("stats.height")}),ee("div",{children:YT(f.height,2)})]}),ee(Ae,{heading:!0,"data-testid":"stats-element-type",style:{margin:"0.3125rem 0"},children:r.croppingElementId?E("labels.imageCropping"):E(`element.${p.type}`)}),ee(Ae,{children:ee(Yg,{element:p,property:"x",elementsMap:c,scene:a,appState:r})}),ee(Ae,{children:ee(Yg,{element:p,property:"y",elementsMap:c,scene:a,appState:r})}),ee(Ae,{children:ee(Bg,{property:"width",element:p,scene:a,appState:r})}),ee(Ae,{children:ee(Bg,{property:"height",element:p,scene:a,appState:r})}),ee(Ae,{children:ee(mT,{property:"angle",element:p,scene:a,appState:r})}),ee(Ae,{children:ee(vT,{property:"fontSize",element:p,scene:a,appState:r})})]}),d&&At(Kg,{children:[jB(d)&&ee(Ae,{heading:!0,children:E("element.group")}),At(Ae,{columns:2,style:{margin:"0.3125rem 0"},children:[ee("div",{children:E("stats.shapes")}),ee("div",{children:n.length})]}),ee(Ae,{children:ee(Wg,{property:"x",elements:d,elementsMap:c,atomicUnits:v,scene:a,appState:r})}),ee(Ae,{children:ee(Wg,{property:"y",elements:d,elementsMap:c,atomicUnits:v,scene:a,appState:r})}),ee(Ae,{children:ee(Gg,{property:"width",elements:d,elementsMap:c,atomicUnits:v,scene:a,appState:r})}),ee(Ae,{children:ee(Gg,{property:"height",elements:d,elementsMap:c,atomicUnits:v,scene:a,appState:r})}),ee(Ae,{children:ee(kT,{property:"angle",elements:d,scene:a,appState:r})}),ee(Ae,{children:ee(HT,{property:"fontSize",elements:d,scene:a,appState:r,elementsMap:c})})]})]})})})]})})},(e,o)=>e.sceneNonce===o.sceneNonce&&e.selectedElements===o.selectedElements&&e.appState.stats.panels===o.appState.stats.panels&&e.gridModeEnabled===o.gridModeEnabled&&e.appState.gridStep===o.appState.gridStep&&e.appState.croppingElementId===o.appState.croppingElementId);import{useCallback as oF,useEffect as XT,useState as KT}from"react";import{normalizeLink as nF,KEYS as $g}from"@excalidraw/common";import{defaultGetElementLinkFromSelection as rF,getLinkIdAndTypeFromSelection as iF}from"@excalidraw/element";import QB from"clsx";import{jsx as nm,jsxs as tF}from"react/jsx-runtime";var eF=({label:e,onClick:o,className:t,children:n,actionType:r,type:i="button",isLoading:l,...a})=>{let s=r?`Dialog__action-button--${r}`:"";return tF("button",{className:QB("Dialog__action-button",s,t),type:i,"aria-label":e,onClick:o,...a,children:[n&&nm("div",{style:l?{visibility:"hidden"}:{},children:n}),nm("div",{style:l?{visibility:"hidden"}:{},children:e}),l&&nm("div",{style:{position:"absolute",inset:0},children:nm(Yo,{})})]})},Zg=eF;import{jsx as na,jsxs as rm}from"react/jsx-runtime";var aF=({sourceElementId:e,onClose:o,appState:t,scene:n,generateLinkForSelection:r=rF})=>{let i=n.getNonDeletedElementsMap(),l=i.get(e)?.link??null,[a,s]=KT(l),[c,m]=KT(!1);XT(()=>{let d=te(i,t),h=l;if(d.length>0&&r){let f=iF(d,t);f&&(h=nF(r(f.id,f.type)))}s(h)},[i,t,t.selectedElementIds,l,r]);let p=oF(()=>{if(a&&a!==i.get(e)?.link){let d=i.get(e);d&&n.mutateElement(d,{link:a})}if(!a&&c&&e){let d=i.get(e);d&&n.mutateElement(d,{link:null})}o?.()},[e,a,i,c,n,o]);return XT(()=>{let d=h=>{t.openDialog?.name==="elementLinkSelector"&&h.key===$g.ENTER&&p(),t.openDialog?.name==="elementLinkSelector"&&h.key===$g.ESCAPE&&o?.()};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}},[t,o,p]),rm("div",{className:"ElementLinkDialog",children:[rm("div",{className:"ElementLinkDialog__header",children:[na("h2",{children:E("elementLink.title")}),na("p",{children:E("elementLink.desc")})]}),rm("div",{className:"ElementLinkDialog__input",children:[na(Gd,{value:a??"",onChange:d=>{c||m(!0),s(d)},onKeyDown:d=>{d.key===$g.ENTER&&p()},className:"ElementLinkDialog__input-field",selectOnRender:!0}),l&&a&&na(V,{type:"button",title:E("buttons.remove"),"aria-label":E("buttons.remove"),label:E("buttons.remove"),onClick:()=>{s(null),m(!0)},className:"ElementLinkDialog__remove",icon:ir})]}),rm("div",{className:"ElementLinkDialog__actions",children:[na(Zg,{label:E("buttons.cancel"),onClick:()=>{o?.()},style:{marginRight:10}}),na(Zg,{label:E("buttons.confirm"),onClick:p,actionType:"primary"})]})]})},ZT=aF;import lF,{useState as sF}from"react";import{Fragment as cF,jsx as jg}from"react/jsx-runtime";var $T=({children:e,onClose:o})=>{let[t,n]=sF(!!e),{container:r}=_e(),i=lF.useCallback(()=>{n(!1),o&&o(),r?.focus()},[o,r]);return jg(cF,{children:t&&jg(qt,{size:"small",onCloseRequest:i,title:E("errorDialog.title"),children:jg("div",{style:{whiteSpace:"pre-wrap"},children:e})})})};import dF from"clsx";import{jsx as mF}from"react/jsx-runtime";var jT=({children:e,side:o,className:t})=>mF("div",{className:dF("FixedSideContainer",`FixedSideContainer_side_${o}`,t),children:e});import qT,{useMemo as bF}from"react";import JT from"clsx";import{isDarwin as QT,isFirefox as yF,isWindows as wF}from"@excalidraw/common";import{KEYS as kr}from"@excalidraw/common";import{SHAPES as vF}from"@excalidraw/element/shapes";import{isFirefox as pF,KEYS as qg}from"@excalidraw/common";import{SHAPES as uF}from"@excalidraw/element/shapes";import{Fragment as xF,jsx as Be,jsxs as Sr}from"react/jsx-runtime";var hF=e=>Sr(xF,{children:[Be("h3",{children:e.title}),Be("div",{className:"HelpDialog__islands-container",children:e.children})]}),Jg=e=>Sr("div",{className:`HelpDialog__island ${e.className}`,children:[Be("h4",{className:"HelpDialog__island-title",children:e.caption}),Be("div",{className:"HelpDialog__island-content",children:e.children})]});function*gF(e,o){let t=!0;for(let n of e)t||(yield o),t=!1,yield n}var fF=e=>e.replace(/\b[a-z]\b/,o=>o.toUpperCase()),it=({label:e,shortcuts:o,isOr:t=!0})=>{let n=o.map(r=>(r.endsWith("++")?[...r.slice(0,-2).split("+"),"+"]:r.split("+")).map(l=>Be(EF,{children:fF(l)},l)));return Sr("div",{className:"HelpDialog__shortcut",children:[Be("div",{children:e}),Be("div",{className:"HelpDialog__key-container",children:[...gF(n,t?E("helpDialog.or"):null)]})]})},EF=e=>Be("kbd",{className:"HelpDialog__key",...e});function Qg(){return Sr(hF,{title:E("helpDialog.shortcuts"),children:[Sr(Jg,{className:"HelpDialog__island--tools",caption:E("helpDialog.tools"),children:[Be(it,{label:E("toolBar.hand"),shortcuts:[qg.H]}),uF.filter(({myocSimplifiedMode:e})=>e).map(({value:e,key:o})=>Be(it,{label:E(`toolBar.${e}`),shortcuts:[...o]},e)),Be(it,{label:E("helpDialog.cropStart"),shortcuts:[E("helpDialog.doubleClick"),L("Enter")],isOr:!0}),Be(it,{label:E("helpDialog.cropFinish"),shortcuts:[L("Enter"),L("Escape")],isOr:!0})]}),Sr(Jg,{className:"HelpDialog__island--view",caption:E("helpDialog.view"),children:[Be(it,{label:E("helpDialog.smartZoom"),shortcuts:[qg.F]}),Be(it,{label:E("helpDialog.dragToZoom"),shortcuts:[`${qg.Z}+${E("helpDialog.drag")}`]}),Be(it,{label:E("buttons.objectsSnapMode"),shortcuts:[L("Alt+S")]})]}),Sr(Jg,{className:"HelpDialog__island--editor",caption:E("helpDialog.editor"),children:[Be(it,{label:E("labels.pasteAsPlaintext"),shortcuts:[L("CtrlOrCmd+Shift+V")]}),Be(it,{label:E("labels.multiSelect"),shortcuts:[L(`Shift+${E("helpDialog.click")}`)]}),Be(it,{label:E("helpDialog.deepSelect"),shortcuts:[L(`CtrlOrCmd+${E("helpDialog.click")}`)]}),Be(it,{label:E("helpDialog.deepBoxSelect"),shortcuts:[L(`CtrlOrCmd+${E("helpDialog.drag")}`)]}),(Pn||pF)&&Be(it,{label:E("labels.copyAsPng"),shortcuts:[L("Shift+Alt+C")]}),Be(it,{label:E("helpDialog.toggleElementLock"),shortcuts:[L("CtrlOrCmd+Shift+L")]}),Be(it,{label:E("labels.group"),shortcuts:[L("CtrlOrCmd+G")]}),Be(it,{label:E("labels.ungroup"),shortcuts:[L("CtrlOrCmd+Shift+G")]}),Be(it,{label:E("labels.flipHorizontal"),shortcuts:[L("Shift+H")]}),Be(it,{label:E("labels.flipVertical"),shortcuts:[L("Shift+V")]})]})]})}import{Fragment as tI,jsx as W,jsxs as Mr}from"react/jsx-runtime";var TF=e=>Mr(tI,{children:[W("h3",{children:e.title}),W("div",{className:"HelpDialog__islands-container",children:e.children})]}),ef=e=>Mr("div",{className:`HelpDialog__island ${e.className}`,children:[W("h4",{className:"HelpDialog__island-title",children:e.caption}),W("div",{className:"HelpDialog__island-content",children:e.children})]});function*IF(e,o){let t=!0;for(let n of e)t||(yield o),t=!1,yield n}var CF=e=>e.replace(/\b[a-z]\b/,o=>o.toUpperCase()),K=({label:e,shortcuts:o,isOr:t=!0})=>{let n=o.map(r=>(r.endsWith("++")?[...r.slice(0,-2).split("+"),"+"]:r.split("+")).map(l=>W(SF,{children:CF(l)},l)));return Mr("div",{className:"HelpDialog__shortcut",children:[W("div",{children:e}),W("div",{className:"HelpDialog__key-container",children:[...IF(n,t?E("helpDialog.or"):null)]})]})},SF=e=>W("kbd",{className:"HelpDialog__key",...e}),eI=({onClose:e})=>{let[o,t]=qT.useState(!1),n=qT.useCallback(()=>{e&&e()},[e]),r=bF(()=>o?W("button",{className:JT("toggle-button",{}),onClick:()=>t(!1),children:E("helpDialog.myoc.showingAll")}):W("button",{className:JT("toggle-button",{}),onClick:()=>t(!0),children:E("helpDialog.myoc.showingBasic")}),[o]);return W(tI,{children:W(qt,{onCloseRequest:n,title:E("helpDialog.title"),className:"HelpDialog",titleButton:r,portalContainerClassName:"HelpDialog__modalContainer",children:o?Mr(TF,{title:E("helpDialog.shortcuts"),children:[Mr(ef,{className:"HelpDialog__island--tools",caption:E("helpDialog.tools"),children:[W(K,{label:E("toolBar.hand"),shortcuts:[kr.H]}),vF.map(({value:i,key:l})=>W(K,{label:E(`toolBar.${i}`),shortcuts:[...l]},i)),W(K,{label:E("toolBar.frame"),shortcuts:[kr.F]}),W(K,{label:E("toolBar.laser"),shortcuts:[kr.K]}),W(K,{label:E("labels.eyeDropper"),shortcuts:[kr.I,"Shift+S","Shift+G"]}),W(K,{label:E("helpDialog.editLineArrowPoints"),shortcuts:[L("CtrlOrCmd+Enter")]}),W(K,{label:E("helpDialog.editText"),shortcuts:[L("Enter")]}),W(K,{label:E("helpDialog.textNewLine"),shortcuts:[L("Enter"),L("Shift+Enter")]}),W(K,{label:E("helpDialog.textFinish"),shortcuts:[L("Esc"),L("CtrlOrCmd+Enter")]}),W(K,{label:E("helpDialog.curvedArrow"),shortcuts:["A",E("helpDialog.click"),E("helpDialog.click"),E("helpDialog.click")],isOr:!1}),W(K,{label:E("helpDialog.curvedLine"),shortcuts:["L",E("helpDialog.click"),E("helpDialog.click"),E("helpDialog.click")],isOr:!1}),W(K,{label:E("helpDialog.cropStart"),shortcuts:[E("helpDialog.doubleClick"),L("Enter")],isOr:!0}),W(K,{label:E("helpDialog.cropFinish"),shortcuts:[L("Enter"),L("Escape")],isOr:!0}),W(K,{label:E("toolBar.lock"),shortcuts:[kr.Q]}),W(K,{label:E("helpDialog.preventBinding"),shortcuts:[L("CtrlOrCmd")]}),W(K,{label:E("toolBar.link"),shortcuts:[L("CtrlOrCmd+K")]}),W(K,{label:E("toolBar.convertElementType"),shortcuts:["Tab","Shift+Tab"],isOr:!0})]}),Mr(ef,{className:"HelpDialog__island--view",caption:E("helpDialog.view"),children:[W(K,{label:E("helpDialog.smartZoom"),shortcuts:[kr.F]}),W(K,{label:E("helpDialog.dragToZoom"),shortcuts:[`${kr.Z}+${E("helpDialog.drag")}`]}),W(K,{label:E("buttons.zoomIn"),shortcuts:[L("CtrlOrCmd++")]}),W(K,{label:E("buttons.zoomOut"),shortcuts:[L("CtrlOrCmd+-")]}),W(K,{label:E("buttons.resetZoom"),shortcuts:[L("CtrlOrCmd+0")]}),W(K,{label:E("helpDialog.zoomToSelection"),shortcuts:["Shift+2"]}),W(K,{label:E("helpDialog.movePageUpDown"),shortcuts:["PgUp/PgDn"]}),W(K,{label:E("helpDialog.movePageLeftRight"),shortcuts:["Shift+PgUp/PgDn"]}),W(K,{label:E("buttons.objectsSnapMode"),shortcuts:[L("Alt+S")]}),W(K,{label:E("labels.toggleGrid"),shortcuts:[L("CtrlOrCmd+'")]}),W(K,{label:E("labels.viewMode"),shortcuts:[L("Alt+R")]}),W(K,{label:E("stats.fullTitle"),shortcuts:[L("Alt+/")]}),W(K,{label:E("search.title"),shortcuts:[Ue("searchMenu")]})]}),Mr(ef,{className:"HelpDialog__island--editor",caption:E("helpDialog.editor"),children:[W(K,{label:E("labels.moveCanvas"),shortcuts:[L(`Space+${E("helpDialog.drag")}`),L(`Wheel+${E("helpDialog.drag")}`)],isOr:!0}),W(K,{label:E("labels.delete"),shortcuts:[L("Delete")]}),W(K,{label:E("labels.cut"),shortcuts:[L("CtrlOrCmd+X")]}),W(K,{label:E("labels.copy"),shortcuts:[L("CtrlOrCmd+C")]}),W(K,{label:E("labels.paste"),shortcuts:[L("CtrlOrCmd+V")]}),W(K,{label:E("labels.pasteAsPlaintext"),shortcuts:[L("CtrlOrCmd+Shift+V")]}),W(K,{label:E("labels.selectAll"),shortcuts:[L("CtrlOrCmd+A")]}),W(K,{label:E("labels.multiSelect"),shortcuts:[L(`Shift+${E("helpDialog.click")}`)]}),W(K,{label:E("helpDialog.deepSelect"),shortcuts:[L(`CtrlOrCmd+${E("helpDialog.click")}`)]}),W(K,{label:E("helpDialog.deepBoxSelect"),shortcuts:[L(`CtrlOrCmd+${E("helpDialog.drag")}`)]}),(Pn||yF)&&W(K,{label:E("labels.copyAsPng"),shortcuts:[L("Shift+Alt+C")]}),W(K,{label:E("labels.sendToBack"),shortcuts:[QT?L("CtrlOrCmd+Alt+["):L("CtrlOrCmd+Shift+[")]}),W(K,{label:E("labels.bringToFront"),shortcuts:[QT?L("CtrlOrCmd+Alt+]"):L("CtrlOrCmd+Shift+]")]}),W(K,{label:E("labels.sendBackward"),shortcuts:[L("CtrlOrCmd+[")]}),W(K,{label:E("labels.bringForward"),shortcuts:[L("CtrlOrCmd+]")]}),W(K,{label:E("labels.alignTop"),shortcuts:[L("CtrlOrCmd+Shift+Up")]}),W(K,{label:E("labels.alignBottom"),shortcuts:[L("CtrlOrCmd+Shift+Down")]}),W(K,{label:E("labels.alignLeft"),shortcuts:[L("CtrlOrCmd+Shift+Left")]}),W(K,{label:E("labels.alignRight"),shortcuts:[L("CtrlOrCmd+Shift+Right")]}),W(K,{label:E("labels.arrangeElements"),shortcuts:[L("Shift+R")]}),W(K,{label:E("labels.duplicateSelection"),shortcuts:[L("CtrlOrCmd+D"),L(`Alt+${E("helpDialog.drag")}`)]}),W(K,{label:E("helpDialog.toggleElementLock"),shortcuts:[L("CtrlOrCmd+Shift+L")]}),W(K,{label:E("buttons.undo"),shortcuts:[L("CtrlOrCmd+Z")]}),W(K,{label:E("buttons.redo"),shortcuts:wF?[L("CtrlOrCmd+Y"),L("CtrlOrCmd+Shift+Z")]:[L("CtrlOrCmd+Shift+Z")]}),W(K,{label:E("labels.group"),shortcuts:[L("CtrlOrCmd+G")]}),W(K,{label:E("labels.ungroup"),shortcuts:[L("CtrlOrCmd+Shift+G")]}),W(K,{label:E("labels.flipHorizontal"),shortcuts:[L("Shift+H")]}),W(K,{label:E("labels.flipVertical"),shortcuts:[L("Shift+V")]}),W(K,{label:E("labels.showStroke"),shortcuts:[L("S")]}),W(K,{label:E("labels.showBackground"),shortcuts:[L("G")]}),W(K,{label:E("labels.showFonts"),shortcuts:[L("Shift+F")]}),W(K,{label:E("labels.decreaseFontSize"),shortcuts:[L("CtrlOrCmd+Shift+<")]}),W(K,{label:E("labels.increaseFontSize"),shortcuts:[L("CtrlOrCmd+Shift+>")]})]})]}):W(Qg,{})})})};import{CANVAS_SEARCH_TAB as kF,DEFAULT_SIDEBAR as MF}from"@excalidraw/common";import{isFlowchartNodeElement as PF,isImageElement as oI,isLinearElement as nI,isLineElement as AF,isTextBindableContainer as LF,isTextElement as DF}from"@excalidraw/element";import{isNodeInFlowchart as _F}from"@excalidraw/element";import{jsx as tf}from"react/jsx-runtime";var be=e=>Array.isArray(e)?`<kbd>${e.map(L).join(" + ")}</kbd>`:`<kbd>${L(e)}</kbd>`,RF=({appState:e,isMobile:o,editorInterface:t,app:n})=>{let{activeTool:r,isResizing:i,isRotating:l,lastPointerDownWith:a}=e,s=e.multiElement!==null;if(e.openSidebar?.name===MF.name&&e.openSidebar.tab===kF&&e.searchMatches?.matches.length)return E("hints.dismissSearch",{shortcut:be("Escape")});if(e.openSidebar&&!t.canFitSidebar)return null;if(wt(e))return E("hints.eraserRevert",{shortcut:be("Alt")});let c=n.scene.getSelectedElements(e);if(e.selectedLinearElement?.isDragging&&c[0]?.type==="arrow")return E("hints.arrowBindModifiers",{shortcut_1:be("Ctrl"),shortcut_2:be("Alt")});if(r.type==="arrow"||r.type==="line")return s?E("hints.linearElementMulti",{shortcut_1:be("Escape"),shortcut_2:be("Enter")}):r.type==="arrow"?E("hints.arrowTool",{shortcut:be("A")}):E("hints.linearElement");if(r.type==="freedraw")return E("hints.freeDraw");if(r.type==="text")return E("hints.text");if(r.type==="embeddable")return E("hints.embeddable");if(i&&a==="mouse"&&c.length===1){let m=c[0];return nI(m)&&m.points.length===2?E("hints.lockAngle",{shortcut:be("Shift")}):oI(m)?E("hints.resizeImage",{shortcut_1:be("Shift"),shortcut_2:be("Alt")}):E("hints.resize",{shortcut_1:be("Shift"),shortcut_2:be("Alt")})}if(l&&a==="mouse")return E("hints.rotate",{shortcut:be("Shift")});if(c.length===1&&DF(c[0]))return E("hints.text_selected",{shortcut:be("Enter")});if(e.editingTextElement)return E("hints.text_editing",{shortcut_1:be("Escape"),shortcut_2:be(["CtrlOrCmd","Enter"])});if(e.croppingElementId)return E("hints.leaveCropEditor",{shortcut_1:be("Enter"),shortcut_2:be("Escape")});if(c.length===1&&oI(c[0]))return E("hints.enterCropEditor",{shortcut:be("Enter")});if(r.type==="selection"){if(e.selectionElement&&!c.length&&!e.editingTextElement&&!e.selectedLinearElement?.isEditing)return E("hints.deepBoxSelect",{shortcut:be("CtrlOrCmd")});if(Rn(n)&&e.selectedElementsAreBeingDragged)return E("hints.disableSnapping",{shortcut:be("CtrlOrCmd")});if(!c.length&&!o)return E("hints.canvasPanning",{shortcut_1:be(E("keys.mmb")),shortcut_2:be("Space")});if(c.length===1){if(nI(c[0]))return e.selectedLinearElement?.isEditing?e.selectedLinearElement.selectedPointsIndices?E("hints.lineEditor_pointSelected",{shortcut_1:be("Delete"),shortcut_2:be(["CtrlOrCmd","D"])}):E("hints.lineEditor_nothingSelected",{shortcut_1:be("Shift"),shortcut_2:be("Alt")}):AF(c[0])?E("hints.lineEditor_line_info",{shortcut:be("Enter")}):E("hints.lineEditor_info",{shortcut_1:be("CtrlOrCmd"),shortcut_2:be(["CtrlOrCmd","Enter"])});if(!e.newElement&&!e.selectedElementsAreBeingDragged&&LF(c[0])){let m=E("hints.bindTextToElement",{shortcut:be("Enter")}),p=E("hints.createFlowchart",{shortcut:be(["CtrlOrCmd","\u2191\u2193"])});return PF(c[0])?_F(c[0],n.scene.getNonDeletedElementsMap())?[m,p]:[m,p]:m}}}return null},rI=({appState:e,isMobile:o,editorInterface:t,app:n})=>{let r=RF({appState:e,isMobile:o,editorInterface:t,app:n});if(!r)return null;let l=(Array.isArray(r)?r.map(a=>a.replace(/\. ?$/,"")).join(", "):r).split(/(<kbd>[^<]+<\/kbd>)/g).map((a,s)=>{if(s%2===1){let c=a[0]==="<"&&a.match(/^<kbd>([^<]+)<\/kbd>$/);return tf("kbd",{children:c?c[1]:a},s)}return a});return tf("div",{className:"HintViewer",children:tf("span",{children:l})})};import{useEffect as lI,useRef as sI,useState as Pr}from"react";import{DEFAULT_EXPORT_PADDING as HF,EXPORT_IMAGE_TYPES as of,isFirefox as GF,EXPORT_SCALES as UF,cloneJSON as cI}from"@excalidraw/common";import{useCallback as NF,useRef as BF,useState as FF}from"react";var OF=2e3,iI=()=>{let[e,o]=FF(null),t=BF(0),n=()=>{clearTimeout(t.current),o("success"),t.current=window.setTimeout(()=>{o(null)},OF)},r=NF(()=>{o(null)},[]);return{copyStatus:e,resetCopyStatus:r,onCopy:n}};import zF from"clsx";import{jsx as aI}from"react/jsx-runtime";var Kl=({title:e,name:o,checked:t,onChange:n,disabled:r=!1})=>aI("div",{className:zF("Switch",{toggled:t,disabled:r}),children:aI("input",{name:o,id:o,title:e,type:"checkbox",checked:t,disabled:r,onChange:()=>n(!t),onKeyDown:i=>{i.key===" "&&n(!t)}})});import{jsx as Le,jsxs as Xn}from"react/jsx-runtime";var WF=()=>Xn("div",{children:[Le("h3",{children:E("canvasError.cannotShowPreview")}),Le("p",{children:Le("span",{children:E("canvasError.canvasTooBig")})}),Xn("em",{children:["(",E("canvasError.canvasTooBigTip"),")"]})]}),YF=({appStateSnapshot:e,elementsSnapshot:o,files:t,actionManager:n,onExportImage:r,name:i,exportWithDarkMode:l})=>{let a=we(o,e),[s,c]=Pr(i),[m,p]=Pr(a),[d,h]=Pr(e.exportBackground),[f,g]=Pr(e.exportEmbedScene),[b,y]=Pr(e.exportScale),v=sI(null),x=sI(0),[w,T]=Pr(null),{onCopy:S,copyStatus:P,resetCopyStatus:M}=iI();lI(()=>{M()},[s,d,l,b,f,M]);let{exportedElements:_,exportingFrame:R}=cr(o,e,m);return lI(()=>{let A=v.current;if(!A)return;let F=A.offsetWidth,U=A.offsetHeight;if(!F)return;let j=++x.current,z=()=>j!==x.current;return $d({elements:_,appState:{...e,name:s,exportBackground:d,exportWithDarkMode:l,exportScale:b,exportEmbedScene:f},files:t,exportPadding:HF,maxWidthOrHeight:Math.max(F,U),exportingFrame:R}).then(async Z=>{if(!z()){try{await Ma(Z)}catch(ae){throw ae.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(E("canvasError.canvasTooBig")):ae}z()||(T(null),A.replaceChildren(Z))}}).catch(Z=>{z()||(console.error(Z),T(Z))}),()=>{x.current+=1}},[e,t,_,R,s,d,l,b,f]),Xn("div",{className:"ImageExportModal",children:[Le("h3",{children:E("imageExportDialog.header")}),Xn("div",{className:"ImageExportModal__preview",children:[Le("div",{className:"ImageExportModal__preview__canvas",ref:v,children:w&&Le(WF,{})}),Le("div",{className:"ImageExportModal__preview__filename",children:!Br&&Le("input",{type:"text",className:"TextInput",value:s,style:{width:"30ch"},onChange:A=>{c(A.target.value),n.executeAction(ru,"ui",A.target.value)}})})]}),Xn("div",{className:"ImageExportModal__settings",children:[Le("h3",{children:E("imageExportDialog.header")}),a&&Le(Zl,{label:E("imageExportDialog.label.onlySelected"),name:"exportOnlySelected",children:Le(Kl,{name:"exportOnlySelected",checked:m,onChange:A=>{p(A)}})}),Le(Zl,{label:E("imageExportDialog.label.withBackground"),name:"exportBackgroundSwitch",children:Le(Kl,{name:"exportBackgroundSwitch",checked:d,onChange:A=>{h(A),n.executeAction(iu,"ui",A)}})}),Le(Zl,{label:E("imageExportDialog.label.darkMode"),name:"exportDarkModeSwitch",children:Le(Kl,{name:"exportDarkModeSwitch",checked:l,onChange:A=>{n.executeAction(fb,"ui",A)}})}),Le(Zl,{label:E("imageExportDialog.label.embedScene"),tooltip:E("imageExportDialog.tooltip.embedScene"),name:"exportEmbedSwitch",children:Le(Kl,{name:"exportEmbedSwitch",checked:f,onChange:A=>{g(A),n.executeAction(Mc,"ui",A)}})}),Le(Zl,{label:E("imageExportDialog.label.scale"),name:"exportScale",children:Le(Bd,{name:"exportScale",value:b,onChange:A=>{y(A),n.executeAction(hb,"ui",A)},choices:UF.map(A=>({value:A,label:`${A}\xD7`}))})}),Xn("div",{className:"ImageExportModal__settings__buttons",children:[Le(Hn,{className:"ImageExportModal__settings__buttons__button",label:E("imageExportDialog.title.exportToPng"),onClick:()=>r(of.png,_,{exportingFrame:R}),icon:Jm,children:E("imageExportDialog.button.exportToPng")}),Le(Hn,{className:"ImageExportModal__settings__buttons__button",label:E("imageExportDialog.title.exportToSvg"),onClick:()=>r(of.svg,_,{exportingFrame:R}),icon:Jm,children:E("imageExportDialog.button.exportToSvg")}),(Pn||GF)&&Le(Hn,{className:"ImageExportModal__settings__buttons__button",label:E("imageExportDialog.title.copyPngToClipboard"),status:P,onClick:async()=>{await r(of.clipboard,_,{exportingFrame:R}),S()},icon:Ur,children:E("imageExportDialog.button.copyPngToClipboard")})]})]})]})},Zl=({label:e,children:o,tooltip:t,name:n})=>Xn("div",{className:"ImageExportModal__settings__setting",title:e,children:[Xn("label",{htmlFor:n,className:"ImageExportModal__settings__setting__label",children:[e,t&&Le(st,{label:t,long:!0,children:t0})]}),Le("div",{className:"ImageExportModal__settings__setting__content",children:o})]}),dI=({elements:e,appState:o,files:t,actionManager:n,onExportImage:r,onCloseRequest:i,name:l})=>{let[{appStateSnapshot:a,elementsSnapshot:s}]=Pr(()=>({appStateSnapshot:cI(o),elementsSnapshot:cI(e)}));return Le(qt,{onCloseRequest:i,size:"wide",title:!1,children:Le(YF,{elementsSnapshot:s,appStateSnapshot:a,files:t,actionManager:n,onExportImage:r,name:l,exportWithDarkMode:o.exportWithDarkMode})})};import XF from"react";import{getFrame as KF}from"@excalidraw/common";import{jsx as VF}from"react/jsx-runtime";var nf={primary:{base:"var(--color-primary)",darker:"var(--color-primary-darker)",darkest:"var(--color-primary-darkest)"},lime:{base:"#74b816",darker:"#66a80f",darkest:"#5c940d"},pink:{base:"#d6336c",darker:"#c2255c",darkest:"#a61e4d"}},rf=({children:e,color:o})=>VF("div",{className:"Card",style:{"--card-color":nf[o].base,"--card-color-darker":nf[o].darker,"--card-color-darkest":nf[o].darkest},children:e});import{Fragment as $F,jsx as go,jsxs as im}from"react/jsx-runtime";var ZF=({elements:e,appState:o,setAppState:t,files:n,actionManager:r,exportOpts:i,canvas:l,onCloseRequest:a})=>{let{onExportToBackend:s}=i;return go("div",{className:"ExportDialog ExportDialog--json",children:im("div",{className:"ExportDialog-cards",children:[i.saveFileToDisk&&im(rf,{color:"lime",children:[go("div",{className:"Card-icon",children:lE}),go("h2",{children:E("exportDialog.disk_title")}),im("div",{className:"Card-details",children:[E("exportDialog.disk_details"),!Br&&r.renderAction("changeProjectName")]}),go(V,{className:"Card-button",type:"button",title:E("exportDialog.disk_button"),"aria-label":E("exportDialog.disk_button"),showAriaLabel:!0,onClick:()=>{r.executeAction(nl,"ui")}})]}),s&&im(rf,{color:"pink",children:[go("div",{className:"Card-icon",children:Ra}),go("h2",{children:E("exportDialog.link_title")}),go("div",{className:"Card-details",children:E("exportDialog.link_details")}),go(V,{className:"Card-button",type:"button",title:E("exportDialog.link_button"),"aria-label":E("exportDialog.link_button"),showAriaLabel:!0,onClick:async()=>{try{de("export","link",`ui (${KF()})`),await s(e,o,n),a()}catch(c){t({errorMessage:c.message})}}})]}),i.renderCustomUI&&i.renderCustomUI(e,o,n,l)]})})},mI=({elements:e,appState:o,files:t,actionManager:n,exportOpts:r,canvas:i,setAppState:l})=>{let a=XF.useCallback(()=>{l({openDialog:null})},[l]);return go($F,{children:o.openDialog?.name==="jsonExport"&&go(qt,{onCloseRequest:a,title:E("buttons.export"),children:go(ZF,{elements:e,appState:o,setAppState:l,files:t,actionManager:n,onCloseRequest:a,exportOpts:r,canvas:i})})})};import jF from"clsx";import{jsx as pI,jsxs as JF}from"react/jsx-runtime";var qF="small",uI=e=>JF("label",{className:jF("ToolIcon ToolIcon__LaserPointer",`ToolIcon_size_${qF}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[pI("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":"toolbar-LaserPointer"}),pI("div",{className:"ToolIcon__icon",children:Yr})]});import{Fragment as lf,jsx as $,jsxs as xt}from"react/jsx-runtime";var aO=({UIOptions:e})=>xt(Et,{__fallback:!0,children:[$(Et.DefaultItems.LoadScene,{}),$(Et.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&$(Et.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&$(Et.DefaultItems.SaveAsImage,{}),$(Et.DefaultItems.SearchMenu,{}),$(Et.DefaultItems.Help,{}),$(Et.Separator,{}),$(Et.Group,{title:"Excalidraw links",children:$(Et.DefaultItems.Socials,{})}),$(Et.Separator,{}),$(Et.DefaultItems.ToggleTheme,{}),$(Et.DefaultItems.ChangeCanvasBackground,{})]}),lO=()=>xt(Hd,{__fallback:!0,children:[$(Hd.Actions.SaveToDisk,{}),$(Hd.Actions.ExportToImage,{})]}),sO=({actionManager:e,appState:o,files:t,setAppState:n,elements:r,canvas:i,onLockToggle:l,onHandToolToggle:a,onPenModeToggle:s,showExitZenModeBtn:c,renderTopLeftUI:m,renderTopRightUI:p,renderCustomStats:d,UIOptions:h,onExportImage:f,renderWelcomeScreen:g,children:b,app:y,isCollaborating:v,generateLinkForSelection:x})=>{let w=me(),S=et()==="compact",P=Xw(),M=S?{menuTopGap:4,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:.5,islandPadding:1,collabMarginLeft:8}:{menuTopGap:6,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:1,islandPadding:1,collabMarginLeft:8},_=P.tunnelsJotai.Provider,[R,A]=He(wn),F=()=>h.canvasActions.export?$(mI,{elements:r,appState:o,files:t,actionManager:e,exportOpts:h.canvasActions.export,canvas:i,setAppState:n}):null,U=()=>!h.canvasActions.saveAsImage||o.openDialog?.name!=="imageExport"?null:$(dI,{elements:r,appState:o,files:t,actionManager:e,onExportImage:f,onCloseRequest:()=>n({openDialog:null}),name:y.getName()}),j=()=>xt("div",{style:{position:"relative"},children:[$(P.MainMenuTunnel.Out,{}),g&&$(P.WelcomeScreenMenuHintTunnel.Out,{})]}),z=()=>{let re=S;return $(Fl,{heading:"selectedShapeActions",className:Kn("selected-shape-actions zen-mode-transition",{"transition-left":o.zenModeEnabled}),children:re?$(Oe,{className:Kn("compact-shape-actions-island"),padding:0,style:{maxHeight:`${o.height-166}px`},children:$(Av,{appState:o,elementsMap:y.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:y,setAppState:n})}):$(Oe,{className:eO.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${o.height-166}px`},children:$(Cv,{appState:o,elementsMap:y.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:y})})})},Z=()=>{let re=rO(o,r),B=e.isActionEnabled(so),H=Ue("objectsSnapMode"),ue=o.stats.open&&!o.zenModeEnabled&&!o.viewModeEnabled&&o.openDialog?.name!=="elementLinkSelector";return $(jT,{side:"top",children:xt("div",{className:"App-menu App-menu_top",children:[xt(kt.Col,{gap:M.menuTopGap,className:Kn("App-menu_top__left"),children:[j(),$("div",{className:Kn("selected-shape-actions-container",{"selected-shape-actions-container--compact":S}),children:re&&z()})]}),!o.viewModeEnabled&&o.openDialog?.name!=="elementLinkSelector"&&$(Fl,{heading:"shapes",className:"shapes-section",children:xe=>xt("div",{style:{position:"relative"},children:[g&&$(P.WelcomeScreenToolbarHintTunnel.Out,{}),$(kt.Col,{gap:M.toolbarColGap,align:"start",children:xt(kt.Row,{gap:M.toolbarRowGap,className:Kn("App-toolbar-container",{"zen-mode":o.zenModeEnabled}),children:[xt(Oe,{padding:M.islandPadding,className:Kn("App-toolbar",{"zen-mode":o.zenModeEnabled,"App-toolbar--compact":S}),children:[$(rI,{appState:o,isMobile:w.formFactor==="phone",editorInterface:w,app:y}),xe,xt(kt.Row,{gap:M.toolbarInnerRowGap,children:[$(o3,{zenModeEnabled:o.zenModeEnabled,checked:o.penMode,onChange:()=>s(null),title:E("toolBar.penMode"),penDetected:o.penDetected}),$(Md,{checked:ro(o),onChange:a,title:E("toolBar.hand")}),$(Dv,{setAppState:n,activeTool:o.activeTool,UIOptions:h,app:y}),B&&xt(lf,{children:[$("div",{className:"App-toolbar__divider"}),$(V,{className:Kn("Shape","App-toolbar__snap-mode-button",{active:o.objectsSnapModeEnabled}),type:"button",icon:Vr,title:`${E("buttons.objectsSnapMode")} (${H})`,"aria-label":E("buttons.objectsSnapMode"),"aria-keyshortcuts":H,"data-testid":"toolbar-objects-snap-mode",onClick:()=>{e.executeAction(so,"ui")}})]})]})]}),v&&$(Oe,{style:{marginLeft:M.collabMarginLeft,alignSelf:"center",height:"fit-content"},children:$(uI,{title:E("toolBar.laser"),checked:o.activeTool.type===hI.laser,onChange:()=>y.setActiveTool({type:hI.laser}),isMobile:!0})})]})})]})}),xt("div",{className:Kn("layer-ui__wrapper__top-right zen-mode-transition",{"transition-right":o.zenModeEnabled,"layer-ui__wrapper__top-right--compact":S}),children:[o.collaborators.size>0&&$(Rd,{collaborators:o.collaborators,userToFollow:o.userToFollow?.socketId||null}),p?.(w.formFactor==="phone",o),!o.viewModeEnabled&&o.openDialog?.name!=="elementLinkSelector"&&(!oe||o.openSidebar?.name!==af.name)&&$(P.DefaultSidebarTriggerTunnel.Out,{}),ue&&$(Xl,{app:y,onClose:()=>{e.executeAction(Ln)},renderCustomStats:d})]})]})})},ae=()=>$(Yd,{__fallback:!0,onDock:re=>{de("sidebar",`toggleDock (${re?"dock":"undock"})`,`(${w.formFactor==="phone"?"mobile":"desktop"})`)}}),oe=ys(zl),ce=xt(lf,{children:[b,$(aO,{UIOptions:h}),$(Yd.Trigger,{__fallback:!0,icon:I0,title:oO(E("search.title")),onToggle:re=>{re&&de("sidebar",`${af.name} (open)`,`button (${w.formFactor==="phone"?"mobile":"desktop"})`)},tab:af.defaultTab}),$(lO,{}),o.isLoading&&$(kd,{delay:250}),o.errorMessage&&$($T,{onClose:()=>n({errorMessage:null}),children:o.errorMessage}),R&&w.formFactor!=="phone"&&$(G0,{colorPickerType:R.colorPickerType,onCancel:()=>{A(null)},onChange:(re,B,H,{altKey:ue})=>{if(!(re!=="elementBackground"&&re!=="elementStroke"))if(H.length){for(let xe of H)nO(xe,tO(r),{[ue&&R.swapPreviewOnAlt?re==="elementBackground"?"strokeColor":"backgroundColor":re==="elementBackground"?"backgroundColor":"strokeColor"]:B}),iO.delete(xe);y.scene.triggerUpdate()}else n(re==="elementBackground"?{currentItemBackgroundColor:B}:{currentItemStrokeColor:B})},onSelect:(re,B)=>{A(H=>H?.keepOpenOnAlt&&B.altKey?H:null),R?.onSelect?.(re,B)}}),o.openDialog?.name==="help"&&$(eI,{onClose:()=>{n({openDialog:null})}}),o.openDialog?.name==="elementLinkSelector"&&$(ZT,{sourceElementId:o.openDialog.sourceElementId,onClose:()=>{n({openDialog:null})},scene:y.scene,appState:o,generateLinkForSelection:x}),$(P.OverwriteConfirmDialogTunnel.Out,{}),U(),F(),o.openDialog?.name==="charts"&&$(Jv,{data:o.openDialog.data,rawText:o.openDialog.rawText,onClose:()=>n({openDialog:null})}),w.formFactor==="phone"&&$(Hv,{app:y,appState:o,elements:r,actionManager:e,renderJSONExportDialog:F,renderImageExportDialog:U,setAppState:n,onHandToolToggle:a,onPenModeToggle:s,renderTopLeftUI:m,renderTopRightUI:p,renderSidebars:ae,renderWelcomeScreen:g,UIOptions:h}),w.formFactor!=="phone"&&xt(lf,{children:[xt("div",{className:"layer-ui__wrapper",style:o.openSidebar&&oe&&w.canFitSidebar?{width:"calc(100% - var(--right-sidebar-width))"}:{},children:[g&&$(P.WelcomeScreenCenterTunnel.Out,{}),Z(),$(i3,{appState:o,actionManager:e,showExitZenModeBtn:c,renderWelcomeScreen:g}),(o.toast||o.scrolledOutside)&&xt("div",{className:"floating-status-stack",children:[o.toast&&$(mi,{message:o.toast.message,onClose:()=>n({toast:null}),duration:o.toast.duration,closable:o.toast.closable}),!o.toast&&o.scrolledOutside&&$("button",{type:"button",className:"scroll-back-to-content",onClick:()=>{n(re=>({...tr(r,re)}))},children:E("buttons.scrollBackToContent")})]})]}),ae()]})]});return $(fp.Provider,{value:o,children:$(_,{children:$(Zh.Provider,{value:P,children:ce})})})},gI=e=>{let{cursorButton:o,scrollX:t,scrollY:n,...r}=e;return r},cO=(e,o)=>{if(e.children!==o.children)return!1;let{canvas:t,appState:n,...r}=e,{canvas:i,appState:l,...a}=o;return am(gI(n),gI(l),{selectedElementIds:am,selectedGroupIds:am})&&am(r,a)},fI=QF.memo(sO,cO);import dO from"clsx";import{jsx as EI,jsxs as pO}from"react/jsx-runtime";var mO="small",sf=e=>pO("label",{className:dO("ToolIcon ToolIcon__MagicButton",`ToolIcon_size_${mO}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[EI("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),EI("div",{className:"ToolIcon__icon",children:e.icon})]});import{useEffect as uO,useRef as hO}from"react";import{jsx as xI}from"react/jsx-runtime";var bI=({trails:e})=>{let o=hO(null);return uO(()=>{if(o.current)for(let t of e)t.start(o.current);return()=>{for(let t of e)t.stop()}},e),xI("div",{className:"SVGLayer",children:xI("svg",{ref:o})})};import tz,{useEffect as oz,useRef as BI}from"react";import{CURSOR_TYPE as FI,isShallowEqual as nz,sceneCoordsToViewportCoords as rz}from"@excalidraw/common";import{clamp as pf,pointFrom as ra,pointsEqual as wO,bezierEquation as AI,pointRotateRads as lm,pointDistance as vO}from"@excalidraw/math";import{arrayToMap as TO,BIND_MODE_TIMEOUT as $l,DEFAULT_TRANSFORM_HANDLE_SPACING as LI,FRAME_STYLE as Qt,getFeatureFlag as IO,invariant as II,THEME as Zn}from"@excalidraw/common";import{deconstructDiamondElement as uf,deconstructRectanguloidElement as DI,elementCenterPoint as ia,getDiamondBaseCorners as CO,FOCUS_POINT_SIZE as SO,getOmitSidesForEditorInterface as cf,getTransformHandles as kO,getTransformHandlesFromCoords as MO,hasBoundingBox as PO,hitElementItself as AO,isArrowElement as LO,isBindableElement as _I,isElbowArrow as aa,isFrameLikeElement as la,isImageElement as CI,isLinearElement as DO,isLineElement as _O,maxBindingDistance_simple as RO,isTextElement as NO,getActiveTextElement as BO}from"@excalidraw/element";import{LinearElementEditor as Ro}from"@excalidraw/element/linearElementEditor";import{renderSelectionElement as FO}from"@excalidraw/element";import{getElementsInGroup as hf,getSelectedGroupIds as OO,isSelectedViaGroup as zO,selectGroupsFromGivenElements as HO}from"@excalidraw/element";import{getCommonBounds as gf,getElementAbsoluteCoords as sm}from"@excalidraw/element";import{getGlobalFixedPointForBindableElement as SI,isFocusPointVisible as GO}from"@excalidraw/element";import{pointFrom as ct}from"@excalidraw/math";import{THEME as gO}from"@excalidraw/common";var fO="#ff6b6b",EO="#ff0000",yI=1,wI=2,vI=(e,o)=>{if(!o.snapLines.length)return;let t=o.theme===gO.LIGHT||o.zenModeEnabled?fO:EO,n=(o.zenModeEnabled?yI*1.5:yI)/o.zoom.value;e.save(),e.translate(o.scrollX,o.scrollY);for(let r of o.snapLines)r.type==="pointer"?(e.lineWidth=n,e.strokeStyle=t,bO(r,e,o)):r.type==="gap"?(e.lineWidth=n,e.strokeStyle=t,yO(r.points[0],r.points[1],r.direction,o,e)):r.type==="points"&&(e.lineWidth=n,e.strokeStyle=t,xO(r,e,o));e.restore()},xO=(e,o,t)=>{if(!t.zenModeEnabled){let n=e.points[0],r=e.points[e.points.length-1];Jt(n,r,o)}for(let n of e.points)TI(n,t,o)},bO=(e,o,t)=>{TI(e.points[0],t,o),t.zenModeEnabled||Jt(e.points[0],e.points[1],o)},TI=([e,o],t,n)=>{n.save();let r=(t.zenModeEnabled?wI*1.5:wI)/t.zoom.value;n.beginPath(),n.moveTo(e-r,o-r),n.lineTo(e+r,o+r),n.moveTo(e+r,o-r),n.lineTo(e-r,o+r),n.stroke(),n.restore()},Jt=(e,o,t)=>{t.beginPath(),t.lineTo(e[0],e[1]),t.lineTo(o[0],o[1]),t.stroke()},yO=(e,o,t,n,r)=>{let i=8/n.zoom.value,l=i/2,a=i/4;if(t==="horizontal"){let s=[(e[0]+o[0])/2,e[1]];n.zenModeEnabled||Jt(ct(e[0],e[1]-i),ct(e[0],e[1]+i),r),Jt(ct(s[0]-a,s[1]-l),ct(s[0]-a,s[1]+l),r),Jt(ct(s[0]+a,s[1]-l),ct(s[0]+a,s[1]+l),r),n.zenModeEnabled||(Jt(ct(o[0],o[1]-i),ct(o[0],o[1]+i),r),Jt(e,o,r))}else{let s=[e[0],(e[1]+o[1])/2];n.zenModeEnabled||Jt(ct(e[0]-i,e[1]),ct(e[0]+i,e[1]),r),Jt(ct(s[0]-l,s[1]-a),ct(s[0]+l,s[1]-a),r),Jt(ct(s[0]-l,s[1]+a),ct(s[0]+l,s[1]+a),r),n.zenModeEnabled||(Jt(ct(o[0]-i,o[1]),ct(o[0]+i,o[1]),r),Jt(e,o,r))}};var UO=(e,o)=>{II(o.selectedLinearElement,"selectedLinearElement is null");let{segmentMidPointHoveredCoords:t}=o.selectedLinearElement;II(t,"midPointCoords is null"),e.save(),e.translate(o.scrollX,o.scrollY),ff(t,e,o),e.restore()},WO=(e,o,t)=>{let{elementId:n,hoverPointIndex:r}=o.selectedLinearElement;if(o.selectedLinearElement?.isEditing&&o.selectedLinearElement?.selectedPointsIndices?.includes(r)||o.selectedLinearElement?.isDragging)return;let i=Ro.getElement(n,t);if(!i)return;let l=Ro.getPointAtIndexGlobalCoordinates(i,r,t);e.save(),e.translate(o.scrollX,o.scrollY),ff(l,e,o),e.restore()},ff=(e,o,t)=>{o.fillStyle="rgba(105, 101, 219, 0.4)",Ca(o,e[0],e[1],Ro.POINT_HANDLE_SIZE/t.zoom.value,!1)},YO=(e,o,t)=>{e.save(),e.translate(o.scrollX,o.scrollY),ff(t,e,o),e.restore()},df=(e,o,t,n,r,i,l)=>{e.strokeStyle="#5e5ad8",e.setLineDash([]),e.fillStyle="rgba(255, 255, 255, 0.9)",r?e.fillStyle="rgba(134, 131, 226, 0.9)":i&&(e.fillStyle="rgba(177, 151, 252, 0.7)"),Ca(e,t[0],t[1],(l?n*(o.selectedLinearElement?.isEditing?1.5:2):n)/o.zoom.value,!i,!l||r)},VO=(e,o,t,n,r)=>{let i=o.element.frameId&&t.get(o.element.frameId);switch(i&&la(i)&&(e.translate(i.x,i.y),e.beginPath(),Qt.radius&&e.roundRect?e.roundRect(-1,-1,i.width+1,i.height+1,Qt.radius/n.zoom.value):e.rect(-1,-1,i.width+1,i.height+1),e.clip(),e.translate(-i.x,-i.y)),o.element.type){case"magicframe":case"frame":e.save(),e.translate(o.element.x,o.element.y),e.lineWidth=Qt.strokeWidth/n.zoom.value,e.strokeStyle=n.theme===Zn.DARK?"rgba(3, 93, 161, 1)":"rgba(106, 189, 252, 1)",Qt.radius&&e.roundRect?(e.beginPath(),e.roundRect(0,0,o.element.width,o.element.height,Qt.radius/n.zoom.value),e.stroke(),e.closePath()):e.strokeRect(0,0,o.element.width,o.element.height),e.restore();break;default:e.save();let l=ia(o.element,t);switch(e.translate(l[0],l[1]),e.rotate(o.element.angle),e.translate(-l[0],-l[1]),e.translate(o.element.x,o.element.y),e.lineWidth=pf(1.75,o.element.strokeWidth,4)/Math.max(.25,n.zoom.value),e.strokeStyle=n.theme===Zn.DARK?"rgba(3, 93, 161, 1)":"rgba(106, 189, 252, 1)",o.element.type){case"ellipse":e.beginPath(),e.ellipse(o.element.width/2,o.element.height/2,o.element.width/2,o.element.height/2,0,0,2*Math.PI),e.closePath(),e.stroke();break;case"diamond":{let[a,s]=uf(o.element);a.forEach(c=>{e.beginPath(),e.moveTo(c[0][0]-o.element.x,c[0][1]-o.element.y),e.lineTo(c[1][0]-o.element.x,c[1][1]-o.element.y),e.stroke()}),s.forEach(c=>{let[m,p,d,h]=c;e.beginPath(),e.moveTo(m[0]-o.element.x,m[1]-o.element.y),e.bezierCurveTo(p[0]-o.element.x,p[1]-o.element.y,d[0]-o.element.x,d[1]-o.element.y,h[0]-o.element.x,h[1]-o.element.y),e.stroke()})}break;default:{let[a,s]=DI(o.element);a.forEach(c=>{e.beginPath(),e.moveTo(c[0][0]-o.element.x,c[0][1]-o.element.y),e.lineTo(c[1][0]-o.element.x,c[1][1]-o.element.y),e.stroke()}),s.forEach(c=>{let[m,p,d,h]=c;e.beginPath(),e.moveTo(m[0]-o.element.x,m[1]-o.element.y),e.bezierCurveTo(p[0]-o.element.x,p[1]-o.element.y,d[0]-o.element.x,d[1]-o.element.y,h[0]-o.element.x,h[1]-o.element.y),e.stroke()})}break}e.restore();break}if(n.isMidpointSnappingEnabled&&(la(o.element)||_I(o.element))){let l=n.selectedLinearElement,a=l?.elementId&&Ro.getElement(l?.elementId,t),s=r&&AO({point:r,element:o.element,elementsMap:t,threshold:0,overrideShouldTestInside:!0}),c=a&&aa(a)||n.activeTool.type==="arrow"&&n.currentItemArrowType==="elbow";if(!s||c){e.save();let m=ia(o.element,t),p;if(o.element.type==="diamond"){let g=ia(o.element,t);p=CO(o.element).map(b=>{let y=AI(b,.5),v=lm(y,g,o.element.angle);return ra(v[0],v[1])})}else p=[{x:o.element.width,y:o.element.height/2},{x:o.element.width/2,y:o.element.height},{x:0,y:o.element.height/2},{x:o.element.width/2,y:0}].map(b=>{let y=ra(b.x+o.element.x,b.y+o.element.y),v=lm(y,m,o.element.angle);return ra(v[0],v[1])});let d=r&&p.reduce((g,b,y)=>{let v=vO(b,r);return y===-1||v<g.distance?{idx:y,distance:v}:g},{idx:-1,distance:1/0}),h=4/n.zoom.value,f=RO(n.zoom)+o.element.strokeWidth/2;p.forEach((g,b)=>{let y=(!s||c)&&d?.idx===b&&d.distance<=f,v=!y&&(c||b===d?.idx&&d.distance<=f*2);y?(e.fillStyle=n.theme===Zn.DARK?"rgba(3, 93, 161, 1)":"rgba(106, 189, 252, 1)",e.beginPath(),e.arc(g[0],g[1],h,0,2*Math.PI),e.fill()):v&&(e.fillStyle=n.theme===Zn.DARK?"rgba(0, 0, 0, 0.8)":"rgba(65, 65, 65, 0.5)",e.beginPath(),e.arc(g[0],g[1],h,0,2*Math.PI),e.fill())}),e.restore()}}},XO=(e,o,t,n,r,i,l)=>{let a=e.state.bindMode==="orbit"&&e.bindModeHandler!==null,s=$l-(l?.runtime??(a?0:$l)),c=pf(1/$l*s,1e-4,1),m=t.strokeWidth/2,p=t.frameId&&n.get(t.frameId);switch(p&&la(p)&&(o.translate(p.x,p.y),o.beginPath(),Qt.radius&&o.roundRect?o.roundRect(-1,-1,p.width+1,p.height+1,Qt.radius/r.zoom.value):o.rect(-1,-1,p.width+1,p.height+1),o.clip(),o.translate(-p.x,-p.y)),t.type){case"magicframe":case"frame":o.save(),o.translate(t.x,t.y),o.lineWidth=Qt.strokeWidth/r.zoom.value,o.strokeStyle=r.theme===Zn.DARK?`rgba(3, 93, 161, ${c})`:`rgba(106, 189, 252, ${c})`,Qt.radius&&o.roundRect?(o.beginPath(),o.roundRect(0,0,t.width,t.height,Qt.radius/r.zoom.value),o.stroke(),o.closePath()):o.strokeRect(0,0,t.width,t.height),o.restore();break;default:o.save();let h=ia(t,n),f=h[0]+r.scrollX,g=h[1]+r.scrollY;switch(o.translate(f,g),o.rotate(t.angle),o.translate(-f,-g),o.translate(t.x+r.scrollX-m,t.y+r.scrollY-m),o.lineWidth=pf(2.5,t.strokeWidth*1.75,4)/Math.max(.25,r.zoom.value),o.strokeStyle=r.theme===Zn.DARK?`rgba(3, 93, 161, ${c/2})`:`rgba(106, 189, 252, ${c/2})`,t.type){case"ellipse":o.beginPath(),o.ellipse((t.width+m*2)/2,(t.height+m*2)/2,(t.width+m*2)/2,(t.height+m*2)/2,0,0,2*Math.PI),o.closePath(),o.stroke();break;case"diamond":{let[b,y]=uf(t,m);b.forEach(v=>{o.beginPath(),o.moveTo(v[0][0]-t.x+m,v[0][1]-t.y+m),o.lineTo(v[1][0]-t.x+m,v[1][1]-t.y+m),o.stroke()}),y.forEach(v=>{let[x,w,T,S]=v;o.beginPath(),o.moveTo(x[0]-t.x+m,x[1]-t.y+m),o.bezierCurveTo(w[0]-t.x+m,w[1]-t.y+m,T[0]-t.x+m,T[1]-t.y+m,S[0]-t.x+m,S[1]-t.y+m),o.stroke()})}break;default:{let[b,y]=DI(t,m);b.forEach(v=>{o.beginPath(),o.moveTo(v[0][0]-t.x+m,v[0][1]-t.y+m),o.lineTo(v[1][0]-t.x+m,v[1][1]-t.y+m),o.stroke()}),y.forEach(v=>{let[x,w,T,S]=v;o.beginPath(),o.moveTo(x[0]-t.x+m,x[1]-t.y+m),o.bezierCurveTo(w[0]-t.x+m,w[1]-t.y+m,T[0]-t.x+m,T[1]-t.y+m,S[0]-t.x+m,S[1]-t.y+m),o.stroke()})}break}o.restore();break}if(!a||(l?.runtime??0)>$l)return;let d=.5*(Math.min(t.width,t.height)/2);if(!la(t)){o.save(),o.translate(t.x+r.scrollX,t.y+r.scrollY);let h=1/$l*s;if(o.strokeStyle="rgba(0, 0, 0, 0.2)",o.lineWidth=1/r.zoom.value,o.setLineDash([4/r.zoom.value,4/r.zoom.value]),o.lineDashOffset=-h*10/r.zoom.value,o.beginPath(),o.ellipse(t.width/2,t.height/2,d,d,0,0,2*Math.PI),o.stroke(),o.fillStyle="rgba(0, 0, 0, 0.04)",o.beginPath(),o.ellipse(t.width/2,t.height/2,d*(1-c),d*(1-c),0,0,2*Math.PI),o.fill(),o.restore(),r.isMidpointSnappingEnabled){o.save(),o.translate(t.x+r.scrollX,t.y+r.scrollY);let f=5/r.zoom.value,g=5/r.zoom.value,b=f+g,y;if(t.type==="diamond"){let[,v]=uf(t),x=ia(t,n);y=v.map(w=>{let T=AI(w,.5),S=lm(T,x,t.angle);return{x:S[0]-t.x,y:S[1]-t.y}})}else{let v=ia(t,n);y=[{x:t.width/2,y:0},{x:t.width,y:t.height/2},{x:t.width/2,y:t.height},{x:0,y:t.height/2}].map(w=>{let T=ra(w.x+t.x,w.y+t.y),S=lm(T,v,t.angle);return{x:S[0]-t.x,y:S[1]-t.y}})}y.forEach(v=>{o.clearRect(v.x-b,v.y-b,b*2,b*2)}),o.fillStyle=r.theme===Zn.DARK?`rgba(3, 93, 161, ${c})`:`rgba(106, 189, 252, ${c})`,y.forEach(v=>{o.beginPath(),o.arc(v.x,v.y,f,0,2*Math.PI),o.fill()}),o.restore()}}return{runtime:(l?.runtime??0)+i}},KO=(e,o,t,n,r,i,l)=>{if(t===null)return;if(IO("COMPLEX_BINDINGS"))return XO(e,o,t.element,n,r,i,l);o.save(),o.translate(r.scrollX,r.scrollY);let a=e.lastPointerMoveCoords?ra(e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y):null;VO(o,t,n,r,a),o.restore()},RI=(e,o,t)=>{let{angle:n,x1:r,y1:i,x2:l,y2:a,selectionColors:s,cx:c,cy:m,dashed:p,activeEmbeddable:d}=t,h=l-r,f=a-i,b=(t.padding??LI*2)/o.zoom.value,y=8/o.zoom.value,v=4/o.zoom.value;e.save(),e.translate(o.scrollX,o.scrollY),e.lineWidth=(d?4:1)/o.zoom.value;let x=s.length;for(let w=0;w<x;++w)e.strokeStyle=s[w],p&&e.setLineDash([y,v+(y+v)*(x-1)]),e.lineDashOffset=(y+v)*w,Sa(e,r-b,i-b,h+b*2,f+b*2,c,m,n);e.restore()},ZO=(e,o,t,n)=>{let[r,i,l,a]=sm(t,n),s=l-r,c=a-i;e.strokeStyle="rgb(0,118,255)",e.lineWidth=Qt.strokeWidth/o.zoom.value,e.save(),e.translate(o.scrollX,o.scrollY),Sa(e,r,i,s,c,r+s/2,i+c/2,t.angle,!1,Qt.radius/o.zoom.value),e.restore()},kI=(e,o,t,n)=>{let{colors:r=["rgb(0,118,255)"],dashed:i=!1}=n||{},l=t.filter(m=>m.groupIds.length===0),a=t.filter(m=>m.groupIds.length>0),s=m=>{let[p,d,h,f]=gf(m);return{angle:0,x1:p,x2:h,y1:d,y2:f,selectionColors:r,dashed:i,cx:p+(h-p)/2,cy:d+(f-d)/2,activeEmbeddable:!1}},c=m=>{let p=hf(t,m);return s(p)};Object.entries(HO(a,o)).filter(([m,p])=>p).map(([m,p])=>m).map(m=>c(m)).concat(l.map(m=>s([m]))).forEach(m=>RI(e,o,m))},mf=(e,o,t,n)=>{if(!o.selectedLinearElement)return;e.save(),e.translate(o.scrollX,o.scrollY),e.lineWidth=1/o.zoom.value;let r=Ro.getPointsGlobalCoordinates(t,n),{POINT_HANDLE_SIZE:i}=Ro,l=o.selectedLinearElement?.isEditing?i:i/2,a=aa(t),s=_O(t);if(r.forEach((c,m)=>{if(a&&m!==0&&m!==r.length-1)return;let p=m>0&&(m!==r.length-1||!s||!t.polygon)&&wO(c,m===r.length-1?r[0]:r[m-1],2/o.zoom.value),d=!!o.selectedLinearElement?.isEditing&&!!o.selectedLinearElement?.selectedPointsIndices?.includes(m);s&&t.polygon&&!d&&m===t.points.length-1&&o.selectedLinearElement?.isEditing&&o.selectedLinearElement?.selectedPointsIndices?.includes(0)&&(d=!0),df(e,o,c,l,d,!1,p)}),aa(t)){let c=t.fixedSegments?.map(m=>m.index)||[];r.slice(0,-1).forEach((m,p)=>{Ro.isSegmentTooShort(t,r[p+1],r[p],p,o.zoom,n)||df(e,o,ra((m[0]+r[p+1][0])/2,(m[1]+r[p+1][1])/2),i/2,!1,!c.includes(p+1),!1)})}else Ro.getEditorMidPoints(t,n,o).filter((m,p,d)=>m!==null&&!(aa(t)&&(p===0||p===d.length-1))).forEach(m=>{(o.selectedLinearElement?.isEditing||r.length===2)&&df(e,o,m,i/2,!1,!0,!1)});e.restore()},$O=(e,o,t,n)=>{e.save(),e.translate(o.scrollX,o.scrollY),e.strokeStyle="rgba(134, 131, 226, 0.6)",e.lineWidth=1/o.zoom.value,e.setLineDash([4/o.zoom.value,4/o.zoom.value]),e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(n[0],n[1]),e.stroke(),e.restore()},jO=(e,o,t,n,r)=>{e.save(),e.translate(o.scrollX,o.scrollY),e.strokeStyle="rgba(134, 131, 226, 0.6)",e.lineWidth=1/o.zoom.value,e.setLineDash([]),e.fillStyle=r?"rgba(134, 131, 226, 0.9)":"rgba(255, 255, 255, 0.9)",Ca(e,t[0],t[1],n/o.zoom.value,!0,!0),e.restore()},MI=({arrow:e,appState:o,type:t,context:n,elementsMap:r})=>{let i=t==="start"?e.startBinding:e.endBinding,l=i?.elementId&&r.get(i.elementId);if(!l||!_I(l)||l.isDeleted)return;let a=SI(i.fixedPoint,l,r);if(!GO(a,e,l,r,o,t))return;let s=o.selectedLinearElement,c=!!s?.isDragging,m=t==="start"?0:e.points.length-1,p=!!s?.selectedPointsIndices?.includes(m);if(s?.hoveredFocusPointBinding===t&&!s.draggedFocusPointBinding&&YO(n,o,a),!(p&&c)){let d=SI(i.fixedPoint,l,r),h=s?.hoveredFocusPointBinding===t,f=Ro.getPointAtIndexGlobalCoordinates(e,m,r);$O(n,o,f,d),jO(n,o,d,SO/1.5,h)}},PI=(e,o,t,n,r)=>{Object.keys(n).forEach(i=>{let l=n[i];if(l!==void 0){let[a,s,c,m]=l;e.save(),e.lineWidth=1/t.zoom.value,o.selectionColor&&(e.strokeStyle=o.selectionColor),i==="rotation"?Ca(e,a+c/2,s+m/2,c/2,!0):e.roundRect?(e.beginPath(),e.roundRect(a,s,c,m,2/t.zoom.value),e.fill(),e.stroke()):Sa(e,a,s,c,m,a+c/2,s+m/2,r,!0),e.restore()}})},qO=(e,o,t,n,r)=>{let[i,l,,,a,s]=sm(n,r),c=3,m=20,p=c/t.zoom.value,d=p/2,h=a-i+p,f=s-l+p,g=Math.min(m/t.zoom.value,h),b=Math.min(m/t.zoom.value,f);e.save(),e.fillStyle=o.selectionColor,e.strokeStyle=o.selectionColor,e.lineWidth=p,[[[-h,-f],[0,d],[g,d],[d,0],[d,b]],[[h-d,-f],[d,d],[-g+d,d],[0,0],[0,b]],[[-h,f],[0,-d],[g,-d],[d,0],[d,-b]],[[h-d,f],[d,-d],[-g+d,-d],[0,0],[0,-b]]].forEach(v=>{let[[x,w],[T,S],[P,M],[_,R],[A,F]]=v;e.save(),e.translate(a,s),e.rotate(n.angle),e.beginPath(),e.moveTo(x+T,w+S),e.lineTo(x+P,w+M),e.stroke(),e.beginPath(),e.moveTo(x+_,w+R),e.lineTo(x+A,w+F),e.stroke(),e.restore()}),e.restore()},JO=(e,o,t,n)=>{o.save();let r=uh(t.zoom.value),i=e.width+r*2,l=e.height+r*2,a=e.x+e.width/2,s=e.y+e.height/2,c=-(e.width/2+r),m=-(e.height/2+r);o.translate(a+t.scrollX,s+t.scrollY),o.rotate(e.angle),o.lineWidth=1/t.zoom.value,o.strokeStyle=n,o.globalAlpha=.5,o.setLineDash([6/t.zoom.value,4/t.zoom.value]),o.strokeRect(c,m,i,l),o.restore()},QO=(e,o,t,n,r)=>{let i=hh(e,t.zoom.value,r);i&&(o.save(),o.globalAlpha=.5,o.lineWidth=1.5/t.zoom.value,o.lineCap="round",o.strokeStyle=n,o.beginPath(),o.moveTo(i.start[0]+t.scrollX,i.start[1]+t.scrollY),o.lineTo(i.end[0]+t.scrollX,i.end[1]+t.scrollY),o.stroke(),o.restore())},ez=({app:e,canvas:o,elementsMap:t,visibleElements:n,selectedElements:r,allElementsMap:i,scale:l,appState:a,renderConfig:s,editorInterface:c,animationState:m,deltaTime:p})=>{if(o===null)return{atLeastOneVisibleElement:!1,elementsMap:t};let[d,h]=fs(o,l),f=m,g=Es({canvas:o,scale:l,normalizedWidth:d,normalizedHeight:h});g.save(),g.scale(a.zoom.value,a.zoom.value);let b;if(n.forEach(S=>{a.selectedLinearElement?.isEditing&&a.selectedLinearElement.elementId===S.id&&S&&(b=S)}),b&&mf(g,a,b,t),a.selectionElement&&!a.isCropping)try{FO(a.selectionElement,g,a,s.selectionColor)}catch(S){console.error(S)}let y=BO(r,a);if(y&&!y.autoResize&&QO(y,g,a,s.selectionColor,c.formFactor),a.editingTextElement){let S=i.get(a.editingTextElement.id);S&&!S.autoResize&&JO(S,g,a,s.selectionColor)}if(a.isBindingEnabled&&a.suggestedBinding?f={...m,bindingHighlight:KO(e,g,a.suggestedBinding,i,a,p,m?.bindingHighlight)}:f={...m,bindingHighlight:void 0},a.frameToHighlight&&ZO(g,a,a.frameToHighlight,t),a.elementsToHighlight&&kI(g,a,a.elementsToHighlight),a.activeLockedId){let S=i.get(a.activeLockedId),P=S?[S]:hf(i,a.activeLockedId);kI(g,a,P,{colors:["#ced4da"],dashed:!0})}let v=r.some(S=>la(S));r.length===1&&a.selectedLinearElement?.isEditing&&a.selectedLinearElement.elementId===r[0].id&&mf(g,a,r[0],t);let x=a.selectedLinearElement,w=x&&Ro.getElement(x.elementId,i);if(w&&(a.selectedLinearElement.isDragging||(x.segmentMidPointHoveredCoords?UO(g,a):(aa(w)?x.hoverPointIndex===0||x.hoverPointIndex===w.points.length-1:x.hoverPointIndex>=0)&&WO(g,a,t)),LO(w)&&(MI({arrow:w,elementsMap:i,appState:a,context:g,type:"start"}),MI({arrow:w,elementsMap:i,appState:a,context:g,type:"end"}))),!a.multiElement&&!a.newElement&&!a.selectedLinearElement?.isEditing){let S=PO(r,a,c),P=r.length===1&&DO(r[0]);P&&a.selectedLinearElement?.elementId===r[0].id&&!r[0].locked&&mf(g,a,r[0],t);let M=s.selectionColor||"#000";if(S){let _=TO(r),R=[];for(let F of t.values()){let U=[],j=s.remoteSelectedElementIds.get(F.id);if(P&&aa(F)&&(F.startBinding||F.endBinding)||(_.has(F.id)&&!zO(a,F)&&U.push(M),j&&U.push(...j.map(z=>ur(z,a.collaborators.get(z))))),U.length){let[z,Z,ae,oe,ce,re]=sm(F,t,!0);R.push({angle:F.angle,x1:z,y1:Z,x2:ae,y2:oe,selectionColors:F.locked?["#ced4da"]:U,dashed:!!j||F.locked,cx:ce,cy:re,activeEmbeddable:a.activeEmbeddable?.element===F&&a.activeEmbeddable.state==="active",padding:F.id===a.croppingElementId||CI(F)?0:void 0})}}let A=F=>{let U=hf(t,F),[j,z,Z,ae]=gf(U);R.push({angle:0,x1:j,x2:Z,y1:z,y2:ae,selectionColors:U.some(oe=>oe.locked)?["#ced4da"]:["#000"],dashed:!0,cx:j+(Z-j)/2,cy:z+(ae-z)/2,activeEmbeddable:!1})};for(let F of OO(a))A(F);a.editingGroupId&&A(a.editingGroupId),R.forEach(F=>RI(g,a,F))}if(g.save(),g.translate(a.scrollX,a.scrollY),r.length===1){g.fillStyle="#fff";let _=kO(r[0],a.zoom,t,"mouse",cf(c));if(!a.viewModeEnabled&&S&&!NO(a.editingTextElement)&&!a.croppingElementId&&PI(g,s,a,_,r[0].angle),a.croppingElementId&&!a.isCropping){let R=t.get(a.croppingElementId);R&&CI(R)&&qO(g,s,a,R,t)}}else if(r.length>1&&!a.isRotating&&!r.some(_=>_.locked)){let _=LI*2/a.zoom.value;g.fillStyle="#fff";let[R,A,F,U]=gf(r,t),j=g.getLineDash();g.setLineDash([2/a.zoom.value]);let z=g.lineWidth;g.lineWidth=1/a.zoom.value,g.strokeStyle=M,Sa(g,R-_,A-_,F-R+_*2,U-A+_*2,(R+F)/2,(A+U)/2,0),g.lineWidth=z,g.setLineDash(j);let Z=MO([R,A,F,U,(R+F)/2,(A+U)/2],0,a.zoom,"mouse",v?{...cf(c),rotation:!0}:cf(c));r.some(ae=>!ae.locked)&&PI(g,s,a,Z,0)}g.restore()}a.searchMatches?.matches.forEach(({id:S,focus:P,matchedLines:M})=>{let _=t.get(S);if(_){let[R,A,,,F,U]=sm(_,t,!0);g.save(),a.theme===Zn.LIGHT?P?g.fillStyle="rgba(255, 124, 0, 0.4)":g.fillStyle="rgba(255, 226, 0, 0.4)":P?g.fillStyle="rgba(229, 82, 0, 0.4)":g.fillStyle="rgba(99, 52, 0, 0.4)";let j=la(_)?a.zoom.value:1;g.translate(a.scrollX,a.scrollY),g.translate(F,U),g.rotate(_.angle),M.forEach(z=>{(z.showOnCanvas||P)&&g.fillRect(R+z.offsetX/j-F,A+z.offsetY/j-U,z.width/j,z.height/j)}),g.restore()}}),vI(g,a),g.restore(),Sb({context:g,renderConfig:s,appState:a,normalizedWidth:d,normalizedHeight:h});let T;return s.renderScrollbars&&(T=Ry(t,d,h,a),g.save(),g.fillStyle=_y,g.strokeStyle="rgba(255,255,255,0.8)",[T.horizontal,T.vertical].forEach(S=>{S&&_c(g,S.x,S.y,S.width,S.height,$t/2)}),g.restore()),{scrollBars:T,atLeastOneVisibleElement:n.length>0,elementsMap:t,animationState:f}},NI=e=>{let o=ez(e);return e.callback(o),o};import{jsx as lz}from"react/jsx-runtime";var OI="animateInteractiveScene",iz=e=>{let o=BI(!1),t=BI(null);return oz(()=>{if(!o.current){o.current=!0;return}let n=new Map,r=new Map,i=new Map,l=new Map,a=new Map;e.appState.collaborators.forEach((c,m)=>{if(c.selectedElementIds)for(let p of Object.keys(c.selectedElementIds))i.has(p)||i.set(p,[]),i.get(p).push(m);!c.pointer||c.pointer.renderCursor===!1||(c.username&&l.set(m,c.username),c.userState&&a.set(m,c.userState),r.set(m,rz({sceneX:c.pointer.x,sceneY:c.pointer.y},e.appState)),n.set(m,c.button))});let s=e.containerRef?.current&&getComputedStyle(e.containerRef.current).getPropertyValue("--color-selection")||"#6965db";t.current={app:e.app,canvas:e.canvas,elementsMap:e.elementsMap,visibleElements:e.visibleElements,selectedElements:e.selectedElements,allElementsMap:e.allElementsMap,scale:window.devicePixelRatio,appState:e.appState,renderConfig:{remotePointerViewportCoords:r,remotePointerButton:n,remoteSelectedElementIds:i,remotePointerUsernames:l,remotePointerUserStates:a,selectionColor:s,renderScrollbars:e.renderScrollbars,lastViewportPosition:e.app.lastViewportPosition},editorInterface:e.editorInterface,callback:e.renderInteractiveSceneCallback,animationState:{bindingHighlight:void 0},deltaTime:0},Qo.running(OI)||Qo.start(OI,({deltaTime:c,state:m})=>{let p=NI({...t.current,deltaTime:c,animationState:m}).animationState;if(p){for(let d in p)if(p[d]!==void 0)return p}})}),lz("canvas",{className:"excalidraw__canvas interactive",style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled&&e.appState.activeTool.type!=="laser"?FI.GRAB:FI.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onClick:e.onClick,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:E("labels.drawingCanvas")})},zI=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,activeTool:e.activeTool,openDialog:e.openDialog,editingGroupId:e.editingGroupId,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,selectionElement:e.selectionElement,selectedGroupIds:e.selectedGroupIds,selectedLinearElement:e.selectedLinearElement,multiElement:e.multiElement,newElement:e.newElement,isBindingEnabled:e.isBindingEnabled,isMidpointSnappingEnabled:e.isMidpointSnappingEnabled,suggestedBinding:e.suggestedBinding,isRotating:e.isRotating,elementsToHighlight:e.elementsToHighlight,collaborators:e.collaborators,activeEmbeddable:e.activeEmbeddable,snapLines:e.snapLines,zenModeEnabled:e.zenModeEnabled,editingTextElement:e.editingTextElement,isCropping:e.isCropping,croppingElementId:e.croppingElementId,searchMatches:e.searchMatches,activeLockedId:e.activeLockedId,hoveredElementIds:e.hoveredElementIds,frameRendering:e.frameRendering,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,exportScale:e.exportScale,currentItemArrowType:e.currentItemArrowType}),az=(e,o)=>e.selectionNonce!==o.selectionNonce||e.canvasNonce!==o.canvasNonce||e.scale!==o.scale||e.elementsMap!==o.elementsMap||e.visibleElements!==o.visibleElements||e.selectedElements!==o.selectedElements||e.renderScrollbars!==o.renderScrollbars?!1:nz(zI(e.appState),zI(o.appState)),Ef=tz.memo(iz,az);import sz,{useEffect as HI,useRef as GI}from"react";import{isShallowEqual as UI}from"@excalidraw/common";import{jsx as mz}from"react/jsx-runtime";var cz=e=>{let o=GI(null),t=GI(!1);return HI(()=>{e.canvas.style.width=`${e.appState.width}px`,e.canvas.style.height=`${e.appState.height}px`,e.canvas.width=e.appState.width*e.scale,e.canvas.height=e.appState.height*e.scale},[e.appState.height,e.appState.width,e.canvas,e.scale]),HI(()=>{let n=o.current;if(!n)return;let r=e.canvas;t.current||(t.current=!0,n.replaceChildren(r),r.classList.add("excalidraw__canvas","static"));let i=getComputedStyle(n).getPropertyValue("--color-grid-bold").trim(),l=getComputedStyle(n).getPropertyValue("--color-grid-regular").trim();v1({canvas:r,rc:e.rc,scale:e.scale,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,visibleElements:e.visibleElements,appState:e.appState,renderConfig:{...e.renderConfig,gridColorBold:i,gridColorRegular:l}},Ni())}),mz("div",{className:"excalidraw__canvas-wrapper",ref:o})},WI=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,openDialog:e.openDialog,hoveredElementIds:e.hoveredElementIds,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,viewBackgroundColor:e.viewBackgroundColor,exportScale:e.exportScale,selectedElementsAreBeingDragged:e.selectedElementsAreBeingDragged,gridSize:e.gridSize,gridStep:e.gridStep,frameRendering:e.frameRendering,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,editingGroupId:e.editingGroupId,currentHoveredFontFamily:e.currentHoveredFontFamily,croppingElementId:e.croppingElementId,suggestedBinding:e.suggestedBinding}),dz=(e,o)=>e.canvasNonce!==o.canvasNonce||e.scale!==o.scale||e.elementsMap!==o.elementsMap||e.visibleElements!==o.visibleElements?!1:UI(WI(e.appState),WI(o.appState))&&UI(e.renderConfig,o.renderConfig),xf=sz.memo(cz,dz);import{useEffect as xz,useRef as bz}from"react";import{throttleRAF as pz}from"@excalidraw/common";import{getTargetFrame as uz,isInvisiblySmallElement as hz,renderElement as gz,shouldApplyFrameClip as fz}from"@excalidraw/element";var YI=({canvas:e,rc:o,newElement:t,elementsMap:n,allElementsMap:r,scale:i,appState:l,renderConfig:a})=>{if(e){let[s,c]=fs(e,i),m=Es({canvas:e,scale:i,normalizedWidth:s,normalizedHeight:c});if(m.save(),m.scale(l.zoom.value,l.zoom.value),t&&t.type!=="selection"){if(hz(t))return;if((t.frameId||l.frameToHighlight?.id)&&l.frameRendering.enabled&&l.frameRendering.clip){let d=uz(t,n,l);d&&fz(t,d,l,n)&&y1(d,m,a,l)}gz(t,n,r,o,m,a,l)}else m.clearRect(0,0,s,c);m.restore()}},Ez=pz(e=>{YI(e)}),VI=(e,o)=>{if(o){Ez(e);return}YI(e)};import{jsx as wz}from"react/jsx-runtime";var yz=e=>{let o=bz(null);return xz(()=>{o.current&&VI({canvas:o.current,scale:e.scale,newElement:e.newElement,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,rc:e.rc,renderConfig:e.renderConfig,appState:e.appState},Ni())}),wz("canvas",{className:"excalidraw__canvas",style:{width:e.appState.width,height:e.appState.height},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:o})},XI=yz;var cm=class{constructor(o){this.getState=o;I(this,"listeners",[]);I(this,"onStateChange",(o,t,n)=>{let{predicate:r,getValue:i,callback:l,once:a,matchesImmediately:s}=this.normalize(o,t,n);return l?s&&(queueMicrotask(()=>{let c=this.getState();l(i(c),c)}),a)?()=>{}:this.subscribe({predicate:r,getValue:i,callback:l,once:a}):s?Promise.resolve(i(this.getState())):new Promise(c=>{this.subscribe({predicate:r,getValue:i,callback:m=>c(m),once:!0})})})}isStateChangePredicateOptions(o){return typeof o=="object"&&!Array.isArray(o)&&"predicate"in o}subscribe(o){return this.listeners.push(o),()=>{this.listeners=this.listeners.filter(t=>t!==o)}}normalize(o,t,n){let r,i,l=t,a=n?.once??!1,s=!1;if(this.isStateChangePredicateOptions(o)){let{predicate:c,callback:m,once:p}=o;r=c,i=d=>d,l=m?(d,h)=>m(h):void 0,a=p??!1,s=c(this.getState())}else if(typeof o=="function"){let c=o;r=(m,p)=>c(m)!==c(p),i=m=>c(m)}else if(Array.isArray(o)){let c=o;r=(m,p)=>c.some(d=>m[d]!==p[d]),i=m=>m}else{let c=o;r=(m,p)=>m[c]!==p[c],i=m=>m[c]}return{predicate:r,getValue:i,callback:l,once:a,matchesImmediately:s}}flush(o){if(!this.listeners.length)return;let t=this.getState(),n=[];for(let r of this.listeners)r.predicate(t,o)?(r.callback(r.getValue(t),t),r.once||n.push(r)):n.push(r);this.listeners=n}clear(){this.listeners=[]}};import{getCommonBounds as vz,getElementsInGroup as Tz,selectGroupsFromGivenElements as Iz}from"@excalidraw/element";import{sceneCoordsToViewportCoords as Cz}from"@excalidraw/common";import{flushSync as Sz}from"react-dom";import{jsx as Mz}from"react/jsx-runtime";var kz=({app:e,activeLockedId:o})=>{let t=e.scene.getElement(o),n=t?[t]:Tz(e.scene.getNonDeletedElementsMap(),o);if(n.length===0)return null;let[r,i]=vz(n),{x:l,y:a}=Cz({sceneX:r,sceneY:i},e.state);return Mz("div",{className:"UnlockPopup",style:{bottom:`${e.state.height+12-a+e.state.offsetTop}px`,left:`${l-e.state.offsetLeft}px`},onClick:()=>{Sz(()=>{let s=Iz(n,e.state);e.setState({selectedElementIds:n.reduce((c,m)=>({...c,[m.id]:!0}),{}),selectedGroupIds:s,activeLockedId:null})}),e.actionManager.executeAction(dl)},title:E("labels.elementLock.unlock"),children:U1})},KI=kz;import{Fragment as DG,jsx as Ee,jsxs as bm}from"react/jsx-runtime";var nS=to.createContext(null),rS=to.createContext(null),Zf={formFactor:"desktop",desktopUIMode:"full",userAgent:tS(typeof navigator<"u"?navigator.userAgent:""),isTouchScreen:!1,canFitSidebar:!1,isLandscape:!0},jf=to.createContext(Zf);jf.displayName="EditorInterfaceContext";var MG={"editor:mount":{cardinality:"once",replay:"last"},"editor:initialize":{cardinality:"once",replay:"last"},"editor:unmount":{cardinality:"once",replay:"last"}},qf=to.createContext({container:null,id:null});qf.displayName="ExcalidrawContainerContext";var Jf=to.createContext([]);Jf.displayName="ExcalidrawElementsContext";var Qf=to.createContext({...gn(),width:0,height:0,offsetLeft:0,offsetTop:0});Qf.displayName="ExcalidrawAppStateContext";var e1=to.createContext(()=>{console.warn("Uninitialized ExcalidrawSetAppStateContext context!")});e1.displayName="ExcalidrawSetAppStateContext";var t1=to.createContext(null);t1.displayName="ExcalidrawActionManagerContext";var fa=to.createContext(null);fa.displayName="ExcalidrawAPIContext";var wm=to.createContext(null);wm.displayName="ExcalidrawAPISetContext";var vt=()=>mn(nS),ai=()=>mn(rS),me=()=>mn(jf),et=()=>ym(me()),_e=()=>mn(qf),ei=()=>mn(Jf),yo=()=>mn(Qf),Me=()=>mn(e1),Ye=()=>mn(t1),vm=()=>mn(fa),rs=!1,Yf=0,is=null,Jn=!1,ga=!1,as=!1,ls=!1,Vf=!1,ss={horizontal:null,vertical:null},Qn=0,cs=!1,Xf=new Map,PG=4,Kf=!1,qC=0,JC=!1,Dr=null,AG="zoom-in",fe={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},$f=class e extends to.Component{constructor(t){super(t);I(this,"canvas");I(this,"interactiveCanvas",null);I(this,"sessionExportThemeOverride");I(this,"rc");I(this,"unmounted",!1);I(this,"actionManager");I(this,"editorInterface",Zf);I(this,"stylesPanelMode",ym(Zf));I(this,"excalidrawContainerRef",to.createRef());I(this,"scene");I(this,"fonts");I(this,"renderer");I(this,"visibleElements");I(this,"resizeObserver");I(this,"id");I(this,"store");I(this,"history");I(this,"excalidrawContainerValue");I(this,"files",{});I(this,"imageCache",new Map);I(this,"iFrameRefs",new Map);I(this,"embedsValidationStatus",new Map);I(this,"initializedEmbeds",new Set);I(this,"elementsPendingErasure",new Set);I(this,"_initialized",!1);I(this,"editorLifecycleEvents",new rH(MG));I(this,"onEvent",this.editorLifecycleEvents.on.bind(this.editorLifecycleEvents));I(this,"appStateObserver",new cm(()=>this.state));I(this,"onStateChange",this.appStateObserver.onStateChange);I(this,"flowChartCreator",new KH);I(this,"flowChartNavigator",new ZH);I(this,"bindModeHandler",null);I(this,"hitLinkElement");I(this,"lastPointerDownEvent",null);I(this,"lastPointerUpEvent",null);I(this,"lastPointerUpIsDoubleClick",!1);I(this,"lastPointerMoveEvent",null);I(this,"lastPointerMoveCoords",null);I(this,"lastCompletedCanvasClicks",[]);I(this,"previousPointerMoveCoords",null);I(this,"lastViewportPosition",{x:0,y:0});I(this,"laserTrails",new ed(this));I(this,"eraserTrail",new id(this));I(this,"lassoTrail",new rd(this));I(this,"onChangeEmitter",new Ar);I(this,"onPointerDownEmitter",new Ar);I(this,"onPointerUpEmitter",new Ar);I(this,"onUserFollowEmitter",new Ar);I(this,"onScrollChangeEmitter",new Ar);I(this,"missingPointerEventCleanupEmitter",new Ar);I(this,"onRemoveEventListenersEmitter",new Ar);I(this,"api");I(this,"addImageElementsToScene",async(t,n,r)=>{await this.insertImages(t,n,r)});I(this,"updateEditorAtom",(t,...n)=>{let r=Ut.set(t,...n);return this.triggerRender(),r});I(this,"previousHoveredBindableElement",null);I(this,"getEffectiveGridSize",()=>Rn(this)?this.state.gridSize:null);I(this,"getTextCreationGridPoint",(t,n)=>{let r=this.getEffectiveGridSize();if(r===null)return null;let i=l=>Math.floor(l/r)*r;return{x:i(t),y:i(n)}});I(this,"handleIframeLikeElementHover",({hitElement:t,scenePointer:n,moveEvent:r})=>t&&Pf(t)&&(this.state.viewModeEnabled||this.state.activeTool.type==="laser"||this.isIframeLikeElementCenter(t,r,n.x,n.y))?(pe(this.interactiveCanvas,Ce.POINTER),this.setState({activeEmbeddable:{element:t,state:"hover"}}),!0):(this.state.activeEmbeddable?.state==="hover"&&this.setState({activeEmbeddable:null}),!1));I(this,"isDoubleClick",(t,n)=>t!=null&&n.timeStamp-t.timeStamp<=iC);I(this,"updateEmbedValidationStatus",(t,n)=>{this.embedsValidationStatus.set(t.id,n),ns.delete(t)});I(this,"updateEmbeddables",()=>{let t=new Set,n=!1;this.scene.getNonDeletedElements().filter(r=>{if(dn(r)){if(t.add(r.id),!this.embedsValidationStatus.has(r.id)){n=!0;let i=Df(r.link,this.props.validateEmbeddable);this.updateEmbedValidationStatus(r,i)}}else ha(r)&&t.add(r.id);return!1}),n&&this.scene.triggerUpdate(),this.iFrameRefs.forEach((r,i)=>{t.has(i)||this.iFrameRefs.delete(i)})});I(this,"getFrameNameDOMId",t=>`${this.id}-frame-name-${t.id}`);I(this,"frameNameBoundsCache",{get:t=>{let n=this.frameNameBoundsCache._cache.get(t.id);if(!n||n.zoom!==this.state.zoom.value||n.versionNonce!==t.versionNonce){let r=document.getElementById(this.getFrameNameDOMId(t));if(r){let i=r.getBoundingClientRect(),l=De({clientX:i.x,clientY:i.y},this.state),a=De({clientX:i.right,clientY:i.bottom},this.state);return n={x:l.x,y:l.y,width:a.x-l.x,height:a.y-l.y,angle:0,zoom:this.state.zoom.value,versionNonce:t.versionNonce},this.frameNameBoundsCache._cache.set(t.id,n),n}return null}return n},_cache:new Map});I(this,"resetEditingFrame",t=>{t&&this.scene.mutateElement(t,{name:t.name?.trim()||null}),this.setState({editingFrame:null})});I(this,"renderFrameNames",()=>{if(!this.state.frameRendering.enabled||!this.state.frameRendering.name)return this.state.editingFrame&&this.resetEditingFrame(null),null;let t=this.state.theme===ca.DARK,n=this.scene.getNonDeletedFramesLikes(),r=n.length>0&&this.state.searchMatches?.focusedId&&at(this.scene.getElement(this.state.searchMatches.focusedId))?this.state.searchMatches.matches.find(i=>i.focus):null;return n.map(i=>{if(!IC(i,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap()))return this.state.editingFrame===i.id&&this.resetEditingFrame(i),null;let{x:l,y:a}=um({sceneX:i.x,sceneY:i.y},this.state),s=6,c,m=GH(i);if(i.id===this.state.editingFrame){let p=m;c=Ee("input",{autoFocus:!0,value:p,onChange:d=>{this.scene.mutateElement(i,{name:d.target.value})},onFocus:d=>d.target.select(),onBlur:()=>this.resetEditingFrame(i),onKeyDown:d=>{(d.key===Y.ESCAPE||d.key===Y.ENTER)&&this.resetEditingFrame(i)},style:{background:t?nH(this.state.viewBackgroundColor):this.state.viewBackgroundColor,zIndex:2,border:"none",display:"block",padding:`${s}px`,borderRadius:4,boxShadow:"inset 0 0 0 1px var(--color-primary)",fontFamily:"Assistant",fontSize:`${No.nameFontSize}px`,transform:`translate(-${s}px, ${s}px)`,color:t?No.nameColorDarkTheme:No.nameColorLightTheme,overflow:"hidden",maxWidth:`${document.body.clientWidth-l-s}px`},size:p.length+1||1,dir:"auto",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off"})}else c=m;return Ee("div",{id:this.getFrameNameDOMId(i),className:kf.FRAME_NAME,style:{position:"absolute",bottom:`${this.state.height+No.nameOffsetY-a+this.state.offsetTop}px`,left:`${l-this.state.offsetLeft}px`,zIndex:2,fontSize:No.nameFontSize,color:t?No.nameColorDarkTheme:No.nameColorLightTheme,lineHeight:No.nameLineHeight,width:"max-content",maxWidth:r?.id===i.id&&r?.focus?"none":`${i.width*this.state.zoom.value}px`,overflow:i.id===this.state.editingFrame?"visible":"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",cursor:Ce.MOVE,pointerEvents:this.state.viewModeEnabled?da.disabled:da.enabled},onPointerDown:p=>this.handleCanvasPointerDown(p),onWheel:p=>this.handleWheel(p),onContextMenu:this.handleCanvasContextMenu,onDoubleClick:()=>{this.setState({editingFrame:i.id})},children:c},i.id)})});I(this,"focusContainer",()=>{this.excalidrawContainerRef.current?.focus()});I(this,"getSceneElementsIncludingDeleted",()=>this.scene.getElementsIncludingDeleted());I(this,"getSceneElementsMapIncludingDeleted",()=>this.scene.getElementsMapIncludingDeleted());I(this,"getSceneElements",()=>this.scene.getNonDeletedElements());I(this,"onInsertElements",t=>{this.addElementsFromPaste({elements:t,position:"center",files:null})});I(this,"onExportImage",async(t,n,r)=>{de("export",t,"ui");let i=await dr(t,n,this.state,this.files,{exportBackground:this.state.exportBackground,name:this.getName(),viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:r.exportingFrame}).catch(eH).catch(l=>{console.error(l),this.setState({errorMessage:l.message})});this.state.exportEmbedScene&&i&&bs(i)&&this.setState({fileHandle:i})});I(this,"magicGenerations",new Map);I(this,"updateMagicGeneration",({frameElement:t,data:n})=>{n.status==="pending"?this.scene.mutateElement(t,{customData:{generationData:void 0}},{informMutation:!1,isDragging:!1}):this.scene.mutateElement(t,{customData:{generationData:n}},{informMutation:!1,isDragging:!1}),this.magicGenerations.set(t.id,n),this.triggerRender()});I(this,"plugins",{});I(this,"onMagicframeToolSelect",()=>{let t=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});if(t.length===0)this.setActiveTool({type:Fo.magicframe}),de("ai","tool-select (empty-selection)","d2c");else{let n=t.length===1&&vC(t[0])&&t[0];if(!n&&t.some(i=>at(i)||i.frameId)){this.setActiveTool({type:Fo.magicframe});return}de("ai","tool-select (existing selection)","d2c");let r;if(n)r=n;else{let[i,l,a,s]=pa(t),c=50;r=EC({...No,x:i-c,y:l-c,width:a-i+c*2,height:s-l+c*2,opacity:100,locked:!1}),this.insertNewElement(r);for(let m of t)this.scene.mutateElement(m,{frameId:r.id});this.setState({selectedElementIds:{[r.id]:!0}})}this.onMagicFrameGenerate(r,"upstream")}});I(this,"openEyeDropper",({type:t})=>{this.updateEditorAtom(wn,{swapPreviewOnAlt:!0,colorPickerType:t==="stroke"?"elementStroke":"elementBackground",onSelect:(n,r)=>{let i=t==="background"&&r.altKey||t==="stroke"&&!r.altKey;!this.scene.getSelectedElements(this.state).length||this.state.activeTool.type!=="selection"?i?this.syncActionResult({appState:{...this.state,currentItemStrokeColor:n},captureUpdate:yt.IMMEDIATELY}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:n},captureUpdate:yt.IMMEDIATELY}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(a=>this.state.selectedElementIds[a.id]?jn(a,{[i?"strokeColor":"backgroundColor"]:n}):a),captureUpdate:yt.IMMEDIATELY})},keepOpenOnAlt:!1})});I(this,"dismissLinearEditor",()=>{setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isEditing:!1}})})});I(this,"syncActionResult",Re(t=>{if(this.unmounted||t===!1)return;this.store.scheduleAction(t.captureUpdate);let n=!1,r=null;if(t.elements&&(this.scene.replaceAllElements(t.elements),n=!0),t.files&&(this.addMissingFiles(t.files,t.replaceFiles),this.addNewImagesToImageCache()),t.appState||r||this.state.contextMenu){let i=t?.appState?.viewModeEnabled||!1,l=t?.appState?.zenModeEnabled||!1,a=t?.appState?.theme||this.props.theme||ca.LIGHT,s=t?.appState?.name??this.state.name,c=t?.appState?.errorMessage??this.state.errorMessage;typeof this.props.viewModeEnabled<"u"&&(i=this.props.viewModeEnabled),typeof this.props.zenModeEnabled<"u"&&(l=this.props.zenModeEnabled),r=t.appState?.editingTextElement||null,t.elements&&r&&t.elements.forEach(m=>{r?.id===m.id&&r!==m&&YC(m)&&zt(m)&&(r=m)}),r?.isDeleted&&(r=null),this.setState(m=>{let p=t.appState||{};return{...m,...p,contextMenu:null,editingTextElement:r,viewModeEnabled:i,zenModeEnabled:l,theme:a,name:s,errorMessage:c}}),n=!0}n||this.scene.triggerUpdate()}));I(this,"onBlur",Re(()=>{Jn=!1,ga=!1,ls=!1,this.restoreCursorAfterZoomKey(),this.setState({isBindingEnabled:this.state.bindingPreference==="enabled"})}));I(this,"onUnload",()=>{this.onBlur()});I(this,"disableEvent",t=>{t.preventDefault()});I(this,"resetHistory",()=>{this.history.clear()});I(this,"resetStore",()=>{this.store.clear()});I(this,"resetScene",Re(t=>{this.scene.replaceAllElements([]),this.setState(n=>({...gn(),isLoading:t?.resetLoadingState?!1:n.isLoading,theme:this.state.theme})),this.resetStore(),this.resetHistory()}));I(this,"initializeScene",async()=>{"launchQueue"in window&&"LaunchParams"in window&&window.launchQueue.setConsumer(async l=>{if(!l.files.length)return;let a=l.files[0],s=await a.getFile();this.loadFileToCanvas(new File([s],s.name||"",{type:s.type}),a)}),this.props.theme&&this.setState({theme:this.props.theme}),this.state.isLoading||this.setState({isLoading:!0});let t=null;try{typeof this.props.initialData=="function"?t=await this.props.initialData()||null:t=await this.props.initialData||null}catch(l){console.error(l),t={appState:{errorMessage:l.message||"Encountered an error during importing or restoring scene data"}}}let n=nr(t?.elements,null,{repairBindings:!0,deleteInvisibleElements:!0}),r=Fr(t?.appState,null),i=r.activeTool;r.preferredSelectionTool.initialized||(r.preferredSelectionTool={type:this.editorInterface.formFactor==="phone"?"lasso":"selection",initialized:!0}),r={...r,theme:this.props.theme||r.theme,openSidebar:r?.openSidebar||this.state.openSidebar,activeTool:i.type==="image"||i.type==="lasso"||i.type==="selection"?{...i,type:r.preferredSelectionTool.type}:r.activeTool,isLoading:!1,toast:this.state.toast},t?.scrollToContent&&(r={...r,...tr(n,{...r,width:this.state.width,height:this.state.height,offsetTop:this.state.offsetTop,offsetLeft:this.state.offsetLeft})}),this.resetStore(),this.resetHistory(),this.syncActionResult({elements:n,appState:r,files:t?.files,captureUpdate:yt.NEVER}),this.clearImageShapeCache(),this.fonts.loadSceneFonts().then(l=>{this.fonts.onLoaded(l)}),zf(window.location.href)&&this.scrollToContent(window.location.href,{animate:!1})});I(this,"getFormFactor",(t,n)=>this.props.UIOptions.getFormFactor?.(t,n)??sH(t,n));I(this,"refreshEditorInterface",()=>{let t=this.excalidrawContainerRef.current;if(!t)return;let{width:n,height:r}=t.getBoundingClientRect(),i=pH(),l=tS(typeof navigator<"u"?navigator.userAgent:""),a=this.props.UIOptions.dockedSidebarBreakpoint!=null?this.props.UIOptions.dockedSidebarBreakpoint:Oz,s=Sf(this.editorInterface,{desktopUIMode:i??this.editorInterface.desktopUIMode,formFactor:this.getFormFactor(n,r),userAgent:l,canFitSidebar:n>a,isLandscape:n>r});this.editorInterface=s,this.reconcileStylesPanelMode(s)});I(this,"reconcileStylesPanelMode",t=>{let n=ym(t);if(n===this.stylesPanelMode)return;let r=this.stylesPanelMode;this.stylesPanelMode=n,r!=="full"&&n==="full"&&this.setState(i=>({preferredSelectionTool:{type:"selection",initialized:!0}}))});I(this,"setDesktopUIMode",t=>{let n=uH(t);this.editorInterface=Sf(this.editorInterface,{desktopUIMode:n}),this.reconcileStylesPanelMode(this.editorInterface)});I(this,"onResize",Re(()=>{this.scene.getElementsIncludingDeleted().forEach(t=>ns.delete(t)),this.refreshEditorInterface(),this.updateDOMRect(),this.setState({})}));I(this,"onFullscreenChange",()=>{!document.fullscreenElement&&this.state.activeEmbeddable?.state==="active"&&this.setState({activeEmbeddable:null})});I(this,"renderInteractiveSceneCallback",({atLeastOneVisibleElement:t,scrollBars:n,elementsMap:r})=>{n&&(ss=n);let i=this.state.editingTextElement?!1:!t&&r.size>0;this.state.scrolledOutside!==i&&this.setState({scrolledOutside:i}),this.scheduleImageRefresh()});I(this,"onScroll",sC(()=>{let{offsetTop:t,offsetLeft:n}=this.getCanvasOffsets();this.setState(r=>r.offsetLeft===n&&r.offsetTop===t?null:{offsetTop:t,offsetLeft:n})},zz));I(this,"onCut",Re(t=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||ql(t.target)||(this.actionManager.executeAction(Bc,"keyboard",t),t.preventDefault(),t.stopPropagation())}));I(this,"onCopy",Re(t=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||ql(t.target)||(this.actionManager.executeAction(wi,"keyboard",t),t.preventDefault(),t.stopPropagation())}));I(this,"onTouchStart",t=>{if(cH&&t.preventDefault(),!rs){rs=!0,t.touches.length===1&&(is={x:t.touches[0].clientX,y:t.touches[0].clientY}),clearTimeout(Yf),Yf=window.setTimeout(e.resetTapTwice,iC);return}if(rs&&t.touches.length===1&&is){let n=t.touches[0];sn(Q(n.clientX,n.clientY),Q(is.x,is.y))<=pC&&(this.lassoTrail.endPath(),this.deselectElements(),this.handleCanvasDoubleClick({clientX:n.clientX,clientY:n.clientY,type:"touch",altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1})),rs=!1,clearTimeout(Yf)}t.touches.length===2&&this.setState({selectedElementIds:ye({},this.state),activeEmbeddable:null})});I(this,"onTouchEnd",t=>{this.resetContextMenuTimer(),t.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:ye(this.state.previousSelectedElementIds,this.state)}):fe.pointers.clear()});I(this,"pasteFromClipboard",Re(async t=>{let n=!!Kf,r=document.activeElement,i=this.excalidrawContainerRef.current?.contains(r);if(t&&!i)return;let l=document.elementFromPoint(this.lastViewportPosition.x,this.lastViewportPosition.y);if(t&&(!(l instanceof HTMLCanvasElement)||ql(r)))return;let a=await pi(t),s=a.getFiles(),c=await Cc(a,n);if(this.props.onPaste)try{if(await this.props.onPaste(c,t)===!1)return}catch(m){console.error(m)}await this.insertClipboardContent(c,s,n),this.setActiveTool({type:this.state.preferredSelectionTool.type},!0),t?.preventDefault()}));I(this,"addElementsFromPaste",t=>{let n=nr(t.elements,null,{deleteInvisibleElements:!0}),[r,i,l,a]=pa(n),s=ma(r,l)/2,c=ma(i,a)/2,m=typeof t.position=="object"?t.position.clientX:t.position==="cursor"?this.lastViewportPosition.x:this.state.width/2+this.state.offsetLeft,p=typeof t.position=="object"?t.position.clientY:t.position==="cursor"?this.lastViewportPosition.y:this.state.height/2+this.state.offsetTop,{x:d,y:h}=De({clientX:m,clientY:p},this.state),f=d-s,g=h-c,[b,y]=dt(f,g,this.getEffectiveGridSize()),{duplicatedElements:v}=yC({type:"everything",elements:n.map(M=>jn(M,{x:M.x+b-r,y:M.y+y-i})),randomizeSeed:!t.retainSeed,preserveFrameChildrenOrder:t.preserveFrameChildrenOrder}),x=this.scene.getElementsIncludingDeleted(),w=[...x,...v];w=this.props.onDuplicate?.(w,x)||w,zC(w,hm(v));let S=this.getTopLayerFrameAtSceneCoords({x:d,y:h});if(S){let M=WH(v,S);w=Bf(w,M,S)}this.scene.replaceAllElements(w),v.forEach(M=>{if(zt(M)&&Mf(M)){let _=PC(M,this.scene.getElementsMapIncludingDeleted());RH(M,_,this.scene)}}),mH&&Uo.loadElementsFonts(v).then(M=>{this.fonts.onLoaded(M)}),t.files&&this.addMissingFiles(t.files);let P=sG(v);this.store.scheduleCapture(),this.setState({...this.state,openSidebar:this.state.openSidebar&&this.editorInterface.canFitSidebar&&Ut.get(zl)?this.state.openSidebar:null,...eo({editingGroupId:null,selectedElementIds:P.reduce((M,_)=>(Mf(_)||(M[_.id]=!0),M),{})},this.scene.getNonDeletedElements(),this.state,this)},()=>{t.files&&this.addNewImagesToImageCache()}),this.setActiveTool({type:this.state.preferredSelectionTool.type},!0),t.fitToContent&&this.scrollToContent(v,{fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()})});I(this,"setAppState",(t,n)=>{this.setState(t,n)});I(this,"removePointer",t=>{Qn&&this.resetContextMenuTimer(),fe.pointers.delete(t.pointerId)});I(this,"toggleLock",(t="ui")=>{this.state.activeTool.locked||de("toolbar","toggleLock",`${t} (${this.editorInterface.formFactor==="phone"?"mobile":"desktop"})`),this.setState(n=>({activeTool:{...n.activeTool,...Oo(this.state,n.activeTool.locked?{type:this.state.preferredSelectionTool.type}:n.activeTool),locked:!n.activeTool.locked}}))});I(this,"updateFrameRendering",t=>{this.setState(n=>{let r=typeof t=="function"?t(n.frameRendering):t;return{frameRendering:{enabled:r?.enabled??n.frameRendering.enabled,clip:r?.clip??n.frameRendering.clip,name:r?.name??n.frameRendering.name,outline:r?.outline??n.frameRendering.outline}}})});I(this,"togglePenMode",t=>{this.setState(n=>({penMode:t??!n.penMode,penDetected:!0}))});I(this,"onHandToolToggle",()=>{this.actionManager.executeAction(Ux)});I(this,"zoomCanvas",t=>{this.setState({...To({viewportX:this.state.width/2+this.state.offsetLeft,viewportY:this.state.height/2+this.state.offsetTop,nextZoom:Gt(t)},this.state)})});I(this,"cancelInProgressAnimation",null);I(this,"scrollToViewport",(t,n)=>{this.cancelInProgressAnimation?.();let r={value:Gt(t.zoom)},i=n?.duration??500;if(n?.animate&&i>0){let l=this.state.scrollX,a=this.state.scrollY,s=this.state.zoom.value,c=Qz({fromValues:{scrollX:l,scrollY:a,zoom:s},toValues:{scrollX:t.scrollX,scrollY:t.scrollY,zoom:r.value},interpolateValue:(m,p,d,h)=>{if(h==="zoom")return m*Math.pow(p/m,tH(d))},onStep:({scrollX:m,scrollY:p,zoom:d})=>{this.setState({scrollX:m,scrollY:p,zoom:{value:d}})},onStart:()=>{this.setState({shouldCacheIgnoreZoom:!0})},onEnd:()=>{this.cancelInProgressAnimation=null,this.setState({shouldCacheIgnoreZoom:!1})},onCancel:()=>{this.cancelInProgressAnimation=null,this.setState({shouldCacheIgnoreZoom:!1})},duration:i});this.cancelInProgressAnimation=()=>{c(),this.cancelInProgressAnimation=null}}else this.setState({scrollX:t.scrollX,scrollY:t.scrollY,zoom:r})});I(this,"scrollToContent",(t=this.scene.getNonDeletedElements(),n)=>{if(typeof t=="string"){let s;if(zf(t)?s=qH(t):s=t,s){let c=this.scene.getElementsFromId(s);c?.length?this.scrollToContent(c,{fitToContent:n?.fitToContent??!0,animate:n?.animate??!0}):zf(t)&&this.setState({toast:{message:E("elementLink.notFound"),duration:3e3,closable:!0}})}return}let r=Array.isArray(t)?t:[t],i=this.state.zoom,l=this.state.scrollX,a=this.state.scrollY;if(n?.fitToContent||n?.fitToViewport){let{appState:s}=Ja({canvasOffsets:n.canvasOffsets,targetElements:r,appState:this.state,fitToViewport:!!n?.fitToViewport,viewportZoomFactor:n?.viewportZoomFactor,minZoom:n?.minZoom,maxZoom:n?.maxZoom});i=s.zoom,l=s.scrollX,a=s.scrollY}else{let s=tr(r,this.state);l=s.scrollX,a=s.scrollY}this.scrollToViewport({scrollX:l,scrollY:a,zoom:i.value},{animate:n?.animate,duration:n?.duration})});I(this,"maybeUnfollowRemoteUser",()=>{this.state.userToFollow&&this.setState({userToFollow:null})});I(this,"translateCanvas",t=>{this.cancelInProgressAnimation?.(),this.maybeUnfollowRemoteUser(),this.setState(t)});I(this,"setToast",t=>{this.setState({toast:t})});I(this,"handleToastClose",()=>{this.setToast(null)});I(this,"restoreFileFromShare",async()=>{try{let t=await caches.open("web-share-target"),n=await t.match("shared-file");if(n){let r=await n.blob(),i=new File([r],r.name||"",{type:r.type});this.loadFileToCanvas(i,null),await t.delete("shared-file"),window.history.replaceState(null,_z,window.location.pathname)}}catch(t){this.setState({errorMessage:t.message})}});I(this,"addFiles",Re(t=>{let{addedFiles:n}=this.addMissingFiles(t);this.clearImageShapeCache(n),this.scene.triggerUpdate(),this.addNewImagesToImageCache()}));I(this,"addMissingFiles",(t,n=!1)=>{let r=n?{}:{...this.files},i={},l=Array.isArray(t)?t:Object.values(t);for(let a of l)if(!r[a.id]&&(i[a.id]=a,r[a.id]=a,a.mimeType===sa.svg))try{let s=P1(MC(A1(a.dataURL)),sa.svg);a.dataURL!==s&&(a.version=(a.version??1)+1,a.dataURL=s)}catch(s){console.error(s)}return this.files=r,{addedFiles:i}});I(this,"updateScene",Re(t=>{let{elements:n,appState:r,collaborators:i,captureUpdate:l}=t;if(l){let a=n||void 0,s=r?gH({...this.store.snapshot.appState,...r}):void 0;this.store.scheduleMicroAction({action:l,elements:a,appState:s})}r&&this.setState(r),n&&this.scene.replaceAllElements(n),i&&(this.laserTrails.updateCollabTrails(i),this.setState({collaborators:i}))}));I(this,"applyDeltas",(t,n)=>{let r=XC.squash(...t),i={...this.state},l=new Map(this.scene.getElementsMapIncludingDeleted());return XC.applyTo(r,l,i,n)});I(this,"mutateElement",(t,n,r=!0)=>this.scene.mutateElement(t,n,{informMutation:r,isDragging:!1}));I(this,"triggerRender",t=>{t===!0?this.scene.triggerUpdate():this.setState({})});I(this,"toggleSidebar",({name:t,tab:n,force:r})=>{let i;r===void 0?i=this.state.openSidebar?.name===t&&this.state.openSidebar?.tab===n?null:t:i=r?t:null;let l=i?{name:i}:null;return l&&n&&(l.tab=n),this.setState({openSidebar:l}),!!i});I(this,"updateCurrentCursorPosition",Re(t=>{this.lastViewportPosition.x=t.clientX,this.lastViewportPosition.y=t.clientY}));I(this,"getEditorUIOffsets",()=>{let t=this.excalidrawContainerRef?.current?.querySelector(".App-toolbar")?.getBoundingClientRect()?.bottom??0,n=this.excalidrawContainerRef?.current?.querySelector(".sidebar")?.getBoundingClientRect(),r=this.excalidrawContainerRef?.current?.querySelector(".App-menu__left")?.getBoundingClientRect(),i=16;return Wo().rtl?{top:t+i,right:Math.max(this.state.width-(r?.left??this.state.width),0)+i,bottom:i,left:Math.max(n?.right??0,0)+i}:{top:t+i,right:Math.max(this.state.width-(n?.left??this.state.width)+i,0),bottom:i,left:Math.max(r?.right??0,0)+i}});I(this,"onKeyDown",Re(t=>{if("Proxy"in window&&(!t.shiftKey&&/^[A-Z]$/.test(t.key)||t.shiftKey&&/^[a-z]$/.test(t.key))&&(t=new Proxy(t,{get(a,s){let c=a[s];return typeof c=="function"?c.bind(a):s==="key"?t.shiftKey?a.key.toUpperCase():a.key.toLowerCase():c}})),!cC(t.target)){if((t.key===Y.ESCAPE||t.key===Y.ENTER)&&this.state.croppingElementId){this.finishImageCropping();return}let a=te(this.scene.getNonDeletedElementsMap(),this.state);if(a.length===1&&qn(a[0])&&t.key===Y.ENTER){this.startImageCropping(a[0]);return}if(t.key===Y.ESCAPE)this.updateEditorAtom(on,null);else if(t.key===Y.TAB&&(document.activeElement===this.excalidrawContainerRef?.current||document.activeElement?.classList.contains(kf.CONVERT_ELEMENT_TYPE_POPUP))){t.preventDefault();let c=fd(a);Ut.get(on)?.type==="panel"&&Vh(this,{conversionType:c,direction:t.shiftKey?"left":"right"})&&this.store.scheduleCapture(),c&&this.updateEditorAtom(on,{type:"panel"})}if(t.key===Y.ESCAPE&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.clear(),this.triggerRender(!0);return}let s=dm(t.key);if(t[Y.CTRL_OR_CMD]&&s&&!t.shiftKey){t.preventDefault();let c=te(this.scene.getNonDeletedElementsMap(),this.state);c.length===1&&MH(c[0])&&this.flowChartCreator.createNodes(c[0],this.state,NC(t.key),this.scene),this.flowChartCreator.pendingNodes?.length&&!Lf(this.flowChartCreator.pendingNodes,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(this.flowChartCreator.pendingNodes,{animate:!0,duration:300,fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()});return}if(t.altKey){let c=te(this.scene.getNonDeletedElementsMap(),this.state);if(c.length===1&&s){t.preventDefault();let m=this.flowChartNavigator.exploreByDirection(c[0],this.scene.getNonDeletedElementsMap(),NC(t.key));if(m){this.setState(d=>({selectedElementIds:ye({[m]:!0},d)}));let p=this.scene.getNonDeletedElementsMap().get(m);p&&!Lf([p],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(p,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})}return}}}if(t[Y.CTRL_OR_CMD]&&t.key.toLowerCase()===Y.V&&(Kf=t.shiftKey,clearTimeout(qC),qC=window.setTimeout(()=>{Kf=!1},100)),t[Y.CTRL_OR_CMD]&&ql(t.target)&&(t.code===QI.MINUS||t.code===QI.EQUAL)){t.preventDefault();return}if(ql(t.target)&&t.key!==Y.ESCAPE||dm(t.key)&&cC(t.target))return;if(t.key===Y.QUESTION_MARK){this.setState({openDialog:{name:"help"}});return}else if(t.key.toLowerCase()===Y.E&&t.shiftKey&&t[Y.CTRL_OR_CMD]){t.preventDefault(),this.setState({openDialog:{name:"imageExport"}});return}if(t.key===Y.PAGE_UP||t.key===Y.PAGE_DOWN){let a=(t.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;t.key===Y.PAGE_DOWN&&(a=-a),t.shiftKey?this.translateCanvas(s=>({scrollX:s.scrollX+a})):this.translateCanvas(s=>({scrollY:s.scrollY+a}))}if(this.state.openDialog?.name==="elementLinkSelector"||(t.key===Y.ALT&&(cn("COMPLEX_BINDINGS")?this.handleSkipBindMode():xm({app:this,event:t})),this.actionManager.handleKeyDown(t)))return;if(!t.altKey&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&uC(t,Y.Z)){ga=!0,pe(this.interactiveCanvas,AG),t.preventDefault();return}let n=this.props.viewModeEnabled===!0;if(!n&&this.state.viewModeEnabled&&t.key===Y.ESCAPE){this.setActiveTool({type:"selection"});return}if(!n&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged){let a=kG(t.key,this);if(this.state.viewModeEnabled&&a)return;if(a){this.state.activeTool.type!==a&&de("toolbar",a,`keyboard (${this.editorInterface.formFactor==="phone"?"mobile":"desktop"})`),a==="arrow"&&this.state.activeTool.type==="arrow"&&this.setState(s=>({currentItemArrowType:s.currentItemArrowType===$n.sharp?$n.round:s.currentItemArrowType===$n.round?$n.elbow:$n.sharp})),a==="lasso"&&this.state.activeTool.type==="laser"?this.setActiveTool({type:this.state.preferredSelectionTool.type}):this.setActiveTool({type:a}),t.stopPropagation();return}else if(t.key===Y.Q){this.toggleLock("keyboard"),t.stopPropagation();return}}if(this.state.viewModeEnabled)return;if(t[Y.CTRL_OR_CMD]&&!t.repeat&&(cn("COMPLEX_BINDINGS")&&this.resetDelayedBindMode(),Ot(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!=="enabled"})}),xm({app:this,event:t})),dm(t.key)){let a=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),s=new Set;a.filter(d=>Go(d)).filter(d=>{let h=d.startBinding&&!a.some(g=>g.id===d.startBinding?.elementId),f=d.endBinding&&!a.some(g=>g.id===d.endBinding?.elementId);return h||f}).forEach(d=>s.add(d.id)),a=a.filter(d=>!s.has(d.id));let c=this.getEffectiveGridSize()&&(t.shiftKey?rC:this.getEffectiveGridSize())||(t.shiftKey?Nz:rC),m=0,p=0;t.key===Y.ARROW_LEFT?m=-c:t.key===Y.ARROW_RIGHT?m=c:t.key===Y.ARROW_UP?p=-c:t.key===Y.ARROW_DOWN&&(p=c),a.forEach(d=>{this.scene.mutateElement(d,{x:d.x+m,y:d.y+p},{informMutation:!1,isDragging:!1}),gm(d,this.scene,{simultaneouslyUpdated:a})}),this.scene.triggerUpdate(),t.preventDefault()}else if(t.key===Y.ENTER){let a=this.scene.getSelectedElements(this.state);if(a.length===1){let s=a[0];if(t[Y.CTRL_OR_CMD]||Hf(s))bt(s)&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==s.id)&&(this.store.scheduleCapture(),Lt(s)||this.actionManager.executeAction(Ai));else if(zt(s)||AC(s)){let c;zt(s)||(c=s);let m=Rf(s,this.state,this.scene.getNonDeletedElementsMap()),p=m.x,d=m.y;this.startTextEditing({sceneX:p,sceneY:d,container:c}),t.preventDefault();return}else at(s)&&this.setState({editingFrame:s.id})}}if(t.key===Y.SPACE&&fe.pointers.size===0&&(Jn=!0,pe(this.interactiveCanvas,Ce.GRAB),t.preventDefault()),(t.key===Y.G||t.key===Y.S)&&!t.altKey&&!t[Y.CTRL_OR_CMD]){let a=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type==="selection"&&!a.length)return;t.key===Y.G&&(fo(this.state.activeTool.type)||a.some(s=>fo(s.type)))&&(this.setState({openPopup:"elementBackground"}),t.stopPropagation()),t.key===Y.S&&(this.setState({openPopup:"elementStroke"}),t.stopPropagation())}if(!t[Y.CTRL_OR_CMD]&&t.shiftKey&&t.key.toLowerCase()===Y.F){let a=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type==="selection"&&!a.length)return;(this.state.activeTool.type==="text"||a.find(s=>zt(s)||_f(s,this.scene.getNonDeletedElementsMap())))&&(t.preventDefault(),this.setState({openPopup:"fontFamily"}))}let r=t.key.toLocaleLowerCase(),i=r===Y.S&&t.shiftKey&&!t[Y.CTRL_OR_CMD],l=t.key===Y.I||r===Y.G&&t.shiftKey;(i||l)&&this.openEyeDropper({type:i?"stroke":"background"})}));I(this,"onKeyUp",Re(t=>{if(t.key===Y.SPACE&&(this.state.viewModeEnabled&&this.state.activeTool.type!=="laser"||this.state.openDialog?.name==="elementLinkSelector"?pe(this.interactiveCanvas,Ce.GRAB):Ql(this.state.activeTool.type)?It(this.interactiveCanvas):(Ct(this.interactiveCanvas,this.state),this.setState({selectedElementIds:ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),Jn=!1),uC(t,Y.Z)&&(ga=!1,this.restoreCursorAfterZoomKey()),t.key===Y.ALT&&xm({app:this,event:t}),(t.key===Y.ALT&&this.state.bindMode==="skip"||!t[Y.CTRL_OR_CMD]&&!es(this.state))&&(this.setState({bindMode:"orbit"}),this.lastPointerMoveEvent&&cn("COMPLEX_BINDINGS"))){let n=De({clientX:this.lastPointerMoveEvent.clientX,clientY:this.lastPointerMoveEvent.clientY},this.state),r=Ho(Q(n.x,n.y),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(this.state.selectedLinearElement){let i=se.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());Go(i)&&this.handleDelayedBindModeChange(i,r)}}if(!t[Y.CTRL_OR_CMD]){let n=this.state.bindingPreference==="enabled";this.state.isBindingEnabled!==n&&Ot(()=>{this.setState({isBindingEnabled:n})}),xm({app:this,event:t})}if(dm(t.key)){gC(this.scene.getSelectedElements(this.state).filter(ua),this.scene,this.state);let n=this.scene.getNonDeletedElementsMap();this.scene.getSelectedElements(this.state).filter(Gf).forEach(r=>{r.startBinding&&this.scene.mutateElement(r,{startBinding:{...r.startBinding,...ZC(r,n.get(r.startBinding.elementId),"start",n)}}),r.endBinding&&this.scene.mutateElement(r,{endBinding:{...r.endBinding,...ZC(r,n.get(r.endBinding.elementId),"end",n)}})}),this.setState({suggestedBinding:null})}if(t.altKey||this.flowChartNavigator.isExploring&&(this.flowChartNavigator.clear(),this.syncActionResult({captureUpdate:yt.IMMEDIATELY})),!t[Y.CTRL_OR_CMD]&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.pendingNodes?.length&&this.insertNewElements(this.flowChartCreator.pendingNodes);let n=this.flowChartCreator.pendingNodes?.[0];n&&(this.setState(r=>({selectedElementIds:ye({[n.id]:!0},r)})),Lf([n],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())||this.scrollToContent(n,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})),this.flowChartCreator.clear(),this.syncActionResult({captureUpdate:yt.IMMEDIATELY})}}));I(this,"isToolSupported",t=>this.props.UIOptions.tools?.[t]!==!1);I(this,"setActiveTool",(t,n=!1)=>{if(!this.isToolSupported(t.type)){console.warn(`"${t.type}" tool is disabled via "UIOptions.canvasActions.tools.${t.type}"`);return}let r=Oo(this.state,t);r.type==="hand"?pe(this.interactiveCanvas,Ce.GRAB):Jn||Ct(this.interactiveCanvas,{...this.state,activeTool:r}),jz(document.activeElement)&&this.focusContainer(),SH(r.type)||this.setState({suggestedBinding:null}),r.type==="image"&&this.onImageToolbarButtonClick(),this.setState(i=>{let l={snapLines:i.snapLines.length?[]:i.snapLines,originSnapOffset:null,activeEmbeddable:null,selectedLinearElement:Ql(r.type)?i.selectedLinearElement:null,frameToHighlight:null};return r.type==="freedraw"&&this.store.scheduleCapture(),r.type==="lasso"?{...i,...l,activeTool:r,...n?{}:{selectedElementIds:ye({},i),selectedGroupIds:ye({},i),editingGroupId:null,multiElement:null}}:r.type!=="selection"?{...i,...l,activeTool:r,selectedElementIds:ye({},i),selectedGroupIds:ye({},i),editingGroupId:null,multiElement:null}:{...i,...l,activeTool:r}})});I(this,"setOpenDialog",t=>{this.setState({openDialog:t})});I(this,"setCursor",t=>{pe(this.interactiveCanvas,t)});I(this,"resetCursor",()=>{It(this.interactiveCanvas)});I(this,"isTouchScreenMultiTouchGesture",()=>fe.pointers.size>=2);I(this,"getName",()=>this.state.name||this.props.name||`${E("labels.untitled")}-${dC()}`);I(this,"onGestureStart",Re(t=>{t.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:ye({},this.state),activeEmbeddable:null}),fe.initialScale=this.state.zoom.value}));I(this,"onGestureChange",Re(t=>{if(t.preventDefault(),this.isTouchScreenMultiTouchGesture())return;let n=fe.initialScale;n&&this.setState(r=>({...To({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:Gt(n*t.scale)},r)}))}));I(this,"onGestureEnd",Re(t=>{t.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:ye(this.state.previousSelectedElementIds,this.state)}),fe.initialScale=null}));I(this,"isHittingTextAutoResizeHandle",(t,n)=>{let r=jC(t,this.state);return!!(r&&!r.isDeleted&&!r.autoResize&&wy(n,r,this.state.zoom.value,this.editorInterface.formFactor))});I(this,"handleTextAutoResizeHandlePointerDown",(t,n)=>{let r=jC(t,this.state);return!r||!this.isHittingTextAutoResizeHandle(t,n)?!1:(this.actionManager.executeAction(rh,"ui",r),this.resetCursor(),!0)});I(this,"startTextEditing",({sceneX:t,sceneY:n,insertAtParentCenter:r=!0,container:i,autoEdit:l=!0,initialCaretSceneCoords:a})=>{let s=!1,c=r&&this.getTextWysiwygSnappedToCenterPosition(t,n,this.state,i);i&&c&&(_f(i,this.scene.getNonDeletedElementsMap())||(s=!0));let m=this.getSelectedTextElement(i)||this.getTextElementAtPosition(t,n),p=m?.fontFamily||this.state.currentItemFontFamily,d=m?.lineHeight||lC(p),h=this.state.currentItemFontSize;if(!m&&s&&i&&!ua(i)){let w=eG(If({fontSize:h,fontFamily:p}),d),T=tG(h,d),S=Math.max(i.height,T),P=Math.max(i.width,w);this.scene.mutateElement(i,{height:S,width:P}),t=i.x+P/2,n=i.y+S/2,c&&(c=this.getTextWysiwygSnappedToCenterPosition(t,n,this.state,i))}let f=this.getTextCreationGridPoint(t,n),g=c?{x:c.elementCenterX,y:c.elementCenterY}:m?{x:t,y:n}:{x:f?.x??t,y:f===null?n-FC(h,d)/2:f.y},b=this.getTopLayerFrameAtSceneCoords({x:g.x,y:g.y}),y=b&&(!s||!i||i.frameId===b.id)?b.id:null,v=m||xC({x:g.x,y:g.y,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:"",fontSize:h,fontFamily:p,textAlign:c?"center":this.state.currentItemTextAlign,verticalAlign:c?Uz.MIDDLE:oC,containerId:s?i?.id:void 0,groupIds:i?.groupIds??[],lineHeight:d,angle:i?ua(i)?0:i.angle:0,frameId:y});if(!m&&s&&i&&this.scene.mutateElement(i,{boundElements:(i.boundElements||[]).concat({type:"text",id:v.id})}),this.setState({editingTextElement:v}),!m)if(i&&s){let x=this.scene.getElementIndex(i.id);this.scene.insertElementsAtIndex([v],x+1)}else this.insertNewElement(v);l||m||i?this.handleTextWysiwyg(v,{isExistingElement:!!m,initialCaretSceneCoords:m?a:null}):this.setState({newElement:v,multiElement:null})});I(this,"startImageCropping",t=>{this.store.scheduleCapture(),this.setState({croppingElementId:t.id})});I(this,"finishImageCropping",()=>{this.state.croppingElementId&&(this.store.scheduleCapture(),this.setState({croppingElementId:null}))});I(this,"shouldHandleBrowserCanvasDoubleClick",t=>{if(t==="touch"||this.lastCompletedCanvasClicks.length===0)return!0;if(this.lastCompletedCanvasClicks.length<2)return!1;let[n,r]=this.lastCompletedCanvasClicks;return sn(Q(n.x,n.y),Q(r.x,r.y))<=pC});I(this,"handleCanvasDoubleClick",t=>{if(this.state.editingTextElement||!this.shouldHandleBrowserCanvasDoubleClick(t.type)||this.state.multiElement||this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let n=this.scene.getSelectedElements(this.state),{x:r,y:i}=De(t,this.state);if(n.length===1&&bt(n[0])){let a=n[0];if((t[Y.CTRL_OR_CMD]&&Gf(a)||Hf(a))&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==a.id)){this.actionManager.executeAction(Ai);return}else if(this.state.selectedLinearElement&&Lt(n[0])){let s=se.getSegmentMidpointHitCoords(this.state.selectedLinearElement,{x:r,y:i},this.state,this.scene.getNonDeletedElementsMap()),c=s?se.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,s,this.scene.getNonDeletedElementsMap()):-1;if(c&&c>-1){this.store.scheduleCapture(),se.deleteFixedSegment(n[0],this.scene,c);let m=se.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:r,y:i},this.state,this.scene.getNonDeletedElementsMap()),p=m?se.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,m,this.scene.getNonDeletedElementsMap()):null;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,segmentMidpoint:{index:p,value:s,added:!1}},segmentMidPointHoveredCoords:m}});return}}else if(this.state.selectedLinearElement?.isEditing&&this.state.selectedLinearElement.elementId===a.id&&Hf(a))return}if(n.length===1&&qn(n[0])){this.startImageCropping(n[0]);return}if(It(this.interactiveCanvas),aG(this.state).length>0){let a=this.getElementAtPosition(r,i),s=a&&iG(a,this.state.selectedGroupIds);if(s){this.store.scheduleCapture(),this.setState(c=>({...c,...eo({editingGroupId:s,selectedElementIds:{[a.id]:!0}},this.scene.getNonDeletedElements(),c,this)}));return}}if(It(this.interactiveCanvas),!t[Y.CTRL_OR_CMD]&&!this.state.viewModeEnabled){let a=this.getElementAtPosition(r,i);if(Pf(a)){this.setState({activeEmbeddable:{element:a,state:"active"}});return}if(!this.state.selectedLinearElement?.isEditing){let s=this.getTextBindableContainerAtPosition(r,i);if(s&&(wC(s)||!Jz(s.backgroundColor)||os({point:Q(r,i),element:s,elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(s)}))){let c=Rf(s,this.state,this.scene.getNonDeletedElementsMap());r=c.x,i=c.y}this.startTextEditing({sceneX:r,sceneY:i,insertAtParentCenter:!t.altKey,container:s})}}});I(this,"handleCanvasClick",t=>{if(t.button!==Bo.MAIN){this.lastCompletedCanvasClicks=[];return}this.lastCompletedCanvasClicks=[...this.lastCompletedCanvasClicks.slice(-1),{x:t.clientX,y:t.clientY}]});I(this,"getElementLinkAtPosition",(t,n)=>{if(n&&n.locked)return;let r=this.scene.getNonDeletedElements(),i=-1;for(let l=r.length-1;l>=0;l--){let a=r[l];if(n&&a.id===n.id&&(i=l),a.link&&l>=i&&gs(a,this.scene.getNonDeletedElementsMap(),this.state,Q(t.x,t.y),this.editorInterface.formFactor==="phone"))return a}});I(this,"handleElementLinkClick",t=>{let n=sn(Q(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY),Q(this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY));if(!this.hitLinkElement||n>nC)return;let r=De(this.lastPointerDownEvent,this.state),i=this.scene.getNonDeletedElementsMap(),l=gs(this.hitLinkElement,i,this.state,Q(r.x,r.y),this.editorInterface.formFactor==="phone"),a=De(this.lastPointerUpEvent,this.state),s=gs(this.hitLinkElement,i,this.state,Q(a.x,a.y),this.editorInterface.formFactor==="phone");if(l&&s){Pu();let c=this.hitLinkElement.link;if(c){c=Tf(c);let m;if(this.props.onLinkOpen&&(m=qz(q.EXCALIDRAW_LINK,t.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:c},m)),!m?.defaultPrevented){let p=Kz(c)?"_self":"_blank",d=window.open(void 0,p);d&&(d.opener=null,d.location=c)}}}});I(this,"getTopLayerFrameAtSceneCoords",(t,n)=>{let r=this.scene.getNonDeletedElementsMap(),i=this.scene.getNonDeletedFramesLikes().filter(s=>!s.locked&&DC(t,s,r));if(!i.length)return null;let l=i.at(-1),a=this.getElementsAtPosition(t.x,t.y,{includeLockedElements:!0}).findLast(s=>!n?.excludeElementIds?.[s.id]);if(a){if(at(a)&&!a.locked)return l;let s=this.scene.getElementIndex(a.id),c=this.scene.getElementIndex(l.id);if(s!==-1&&c!==-1&&s<=c)return l;let m=n?.currentFrameId?i.find(p=>p.id===n.currentFrameId)??null:null;return m||(a.frameId?i.find(p=>p.id===a.frameId)??null:null)}return l});I(this,"updateFrameToHighlight",t=>{this.state.frameToHighlight!==t&&this.setState({frameToHighlight:t})});I(this,"maybeUpdateFrameToHighlightOnPointerMove",(t,n)=>{this.state.newElement||this.state.multiElement||this.state.selectionElement||this.state.selectedElementsAreBeingDragged||this.updateFrameToHighlight(!n&&SG(this.state.activeTool.type)?this.getTopLayerFrameAtSceneCoords(t):null)});I(this,"insertNewElements",t=>{if(!t.length)return;let n=[];for(let r of t){let i=n[n.length-1];i?.[0].frameId===r.frameId?i.push(r):n.push([r])}for(let r of n){let i=r[0].frameId,l=i?BH(this.scene.getElementsIncludingDeleted(),i):null;this.scene.insertElementsAtIndex(r,l)}});I(this,"insertNewElement",t=>{this.insertNewElements([t]);let n=t.frameId?this.scene.getNonDeletedElement(t.frameId):null;this.updateFrameToHighlight(n&&at(n)?n:null)});I(this,"handleCanvasPointerMove",t=>{this.savePointer(t.clientX,t.clientY,this.state.cursorButton),this.lastPointerMoveEvent=t.nativeEvent;let n=De(t,this.state),{x:r,y:i}=n;this.lastPointerMoveCoords={x:r,y:i},fe.pointers.has(t.pointerId)&&fe.pointers.set(t.pointerId,{x:t.clientX,y:t.clientY});let l=fe.initialScale;if(fe.pointers.size===2&&fe.lastCenter&&l&&fe.initialDistance){let g=ah(fe.pointers),b=g.x-fe.lastCenter.x,y=g.y-fe.lastCenter.y;fe.lastCenter=g;let v=lh(Array.from(fe.pointers.values())),x=this.state.activeTool.type==="freedraw"&&this.state.penMode?1:v/fe.initialDistance,w=x?Gt(l*x):this.state.zoom.value;this.setState(T=>{let S=To({viewportX:g.x,viewportY:g.y,nextZoom:w},T);return this.translateCanvas({zoom:S.zoom,scrollX:S.scrollX+2*(b/w),scrollY:S.scrollY+2*(y/w),shouldCacheIgnoreZoom:!0}),null}),this.resetShouldCacheIgnoreZoomDebounced()}else fe.lastCenter=fe.initialDistance=fe.initialScale=null;if(Jn||ga||as||ls||Vf||ro(this.state))return;let s=bh(ss,t.clientX-this.state.offsetLeft,t.clientY-this.state.offsetTop).isOverEither;if(!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.multiElement&&(s?It(this.interactiveCanvas):Ct(this.interactiveCanvas,this.state)),this.maybeUpdateFrameToHighlightOnPointerMove({x:r,y:i},s),!this.state.newElement&&fy(this.state.activeTool.type)){let{originOffset:g,snapLines:b}=gy(this.scene.getNonDeletedElements(),this,{x:r,y:i},t,this.scene.getNonDeletedElementsMap());this.setState(y=>{let v=Jl(y.snapLines,b),x=y.originSnapOffset?Jl(y.originSnapOffset,g):g;return y.snapLines===v&&y.originSnapOffset===x?null:{snapLines:v,originSnapOffset:x}})}else!this.state.newElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.selectionElement&&this.setState(g=>g.snapLines.length?{snapLines:[]}:null);if(this.state.selectedLinearElement?.isEditing&&!this.state.selectedLinearElement.isDragging){let g=this.state.newElement?null:se.handlePointerMoveInEditMode(t,r,i,this);g&&g!==this.state.selectedLinearElement&&Ot(()=>{this.setState({selectedLinearElement:g})})}if(CH(this.state.activeTool.type)){let{newElement:g}=this.state;if(!g&&es(this.state)){let b=Q(r,i),y=this.scene.getNonDeletedElementsMap(),v=Ho(b,this.scene.getNonDeletedElements(),y,Uf(this.state.zoom));v?this.setState({suggestedBinding:{element:v,midPoint:Wf(b,v,y,this.state.zoom)}}):this.state.suggestedBinding&&this.setState({suggestedBinding:null})}}if(this.state.multiElement&&this.state.selectedLinearElement){let{multiElement:g,selectedLinearElement:b}=this.state,{x:y,y:v,points:x}=g,w=x[x.length-1],{lastCommittedPoint:T}=b;if(Ct(this.interactiveCanvas,this.state),w===T)ua(this.state.newElement)&&es(this.state)&&Ho(Q(r,i),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),Uf(this.state.zoom))?(this.actionManager.executeAction(ht,"ui",{event:t.nativeEvent,sceneCoords:{x:r,y:i}}),this.setState({suggestedBinding:null}),this.state.activeTool.locked||(It(this.interactiveCanvas),this.setState(P=>({newElement:null,activeTool:Oo(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:ye({...P.selectedElementIds,[g.id]:!0},P),selectedLinearElement:new se(g,this.scene.getNonDeletedElementsMap())})))):sn(Q(r-y,i-v),w)>=vf?(this.scene.mutateElement(g,{points:[...x,Q(r-y,i-v)]},{informMutation:!1,isDragging:!1}),zo(this.state.selectedLinearElement?.initialState,"initialState must be set"),this.setState({selectedLinearElement:{...this.state.selectedLinearElement,lastCommittedPoint:x[x.length-1],selectedPointsIndices:[g.points.length-1],initialState:{...this.state.selectedLinearElement.initialState,lastClickedPoint:g.points.length-1}}})):pe(this.interactiveCanvas,Ce.POINTER);else if(x.length>2&&T&&sn(Q(r-y,i-v),T)<vf){pe(this.interactiveCanvas,Ce.POINTER),this.scene.mutateElement(g,{points:x.slice(0,-1)},{informMutation:!1,isDragging:!1});let S=g.points.length-1;this.setState({selectedLinearElement:{...b,selectedPointsIndices:b.selectedPointsIndices?[...new Set(b.selectedPointsIndices.map(P=>Math.min(P,S)))]:b.selectedPointsIndices,lastCommittedPoint:g.points[S],initialState:{...b.initialState,lastClickedPoint:S}}})}else{SC(x,this.state.zoom.value)&&pe(this.interactiveCanvas,Ce.POINTER);let S=this.scene.getNonDeletedElementsMap();if(Gf(g)){let M=Ho(Q(r,i),this.scene.getNonDeletedElements(),S);cn("COMPLEX_BINDINGS")&&this.handleDelayedBindModeChange(g,M)}zo(this.state.selectedLinearElement,"Expected selectedLinearElement to be set to operate on a linear element");let P=se.handlePointerMove(t.nativeEvent,this,r,i,this.state.selectedLinearElement);P&&this.setState(P)}return}if(this.state.activeTool.type==="arrow"){let g=Ho(Q(r,i),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),Uf(this.state.zoom)),b=Q(r,i),y=this.scene.getNonDeletedElementsMap();g&&!bG(b,g,y)&&this.setState({suggestedBinding:{element:g,midPoint:Wf(b,g,y,this.state.zoom)}})}let c=!!t.buttons,m=this.state.activeTool.type==="laser";if(c||!m&&this.state.activeTool.type!=="selection"&&this.state.activeTool.type!=="lasso"&&this.state.activeTool.type!=="text"&&this.state.activeTool.type!=="eraser")return;let p=this.scene.getNonDeletedElements(),d=this.scene.getSelectedElements(this.state);if(this.isHittingTextAutoResizeHandle(d,n)){pe(this.interactiveCanvas,Ce.POINTER);return}if(d.length===1&&!s&&!this.state.selectedLinearElement?.isEditing){if(this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,r,i),(!this.state.selectedLinearElement||this.state.selectedLinearElement.hoverPointIndex===-1)&&this.state.openDialog?.name!=="elementLinkSelector"&&!(d.length===1&&Lt(d[0]))&&!(bt(d[0])&&(this.editorInterface.userAgent.isMobileDevice||d[0].points.length===2))){let g=GC(p,this.state,r,i,this.state.zoom,t.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);if(g&&g.transformHandleType){pe(this.interactiveCanvas,HC(g));return}}}else if(d.length>1&&!s&&this.state.openDialog?.name!=="elementLinkSelector"){let g=UC(pa(d),r,i,this.state.zoom,t.pointerType,this.editorInterface);if(g){pe(this.interactiveCanvas,HC({transformHandleType:g}));return}}if(wt(this.state))return;let h=this.getElementAtPosition(r,i,{preferSelected:!0,includeLockedElements:!0}),f=null;if(h&&h.locked?f=null:f=h,this.handleIframeLikeElementHover({hitElement:f,scenePointer:n,moveEvent:t})||(this.hitLinkElement=this.getElementLinkAtPosition(n,h)),this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id])pe(this.interactiveCanvas,Ce.POINTER),d2(this.hitLinkElement,this.state,this.scene.getNonDeletedElementsMap());else{if(Pu(),m)return;f&&(f.link||dn(f))&&this.state.selectedElementIds[f.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:"info"}):this.state.activeTool.type==="text"?pe(this.interactiveCanvas,zt(f)?Ce.TEXT:Ce.CROSSHAIR):!t[Y.CTRL_OR_CMD]&&this.isHittingCommonBoundingBoxOfSelectedElements(n,d)?pe(this.interactiveCanvas,Ce.MOVE):this.state.viewModeEnabled?pe(this.interactiveCanvas,Ce.GRAB):this.state.openDialog?.name==="elementLinkSelector"?pe(this.interactiveCanvas,Ce.AUTO):s?pe(this.interactiveCanvas,Ce.AUTO):!t[Y.CTRL_OR_CMD]&&f?.id!==this.state.editingTextElement?.id?(f||this.isHittingCommonBoundingBoxOfSelectedElements(n,d))&&!f?.locked&&(!f||!Lt(f)||!(f.startBinding||f.endBinding))&&(this.state.activeTool.type!=="lasso"||d.length>0)&&pe(this.interactiveCanvas,Ce.MOVE):pe(this.interactiveCanvas,Ce.AUTO),this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,r,i)}this.state.openDialog?.name==="elementLinkSelector"&&f?this.setState(g=>({hoveredElementIds:Jl(g.hoveredElementIds,eo({editingGroupId:g.editingGroupId,selectedElementIds:{[f.id]:!0}},this.scene.getNonDeletedElements(),g,this).selectedElementIds)})):this.state.openDialog?.name==="elementLinkSelector"&&!f&&this.setState(g=>({hoveredElementIds:Jl(g.hoveredElementIds,{})}))});I(this,"handleEraser",(t,n)=>{let r=this.eraserTrail.addPointToPath(n.x,n.y,t.altKey);this.elementsPendingErasure=new Set(r),this.triggerRender()});I(this,"handleTouchMove",t=>{cs=!0});I(this,"handleCanvasPointerDown",t=>{let n=this.scene.getSelectedElements(this.state);if(!t.ctrlKey){let g=this.state.bindingPreference==="enabled";this.state.isBindingEnabled!==g&&this.setState({isBindingEnabled:g})}let r=De(t,this.state),{x:i,y:l}=r;this.lastPointerMoveCoords={x:i,y:l};let a=t.target;if(a.setPointerCapture&&a.setPointerCapture(t.pointerId),this.maybeCleanupAfterMissingPointerUp(t.nativeEvent),this.maybeUnfollowRemoteUser(),this.state.searchMatches&&(this.setState(g=>({searchMatches:g.searchMatches&&{focusedId:null,matches:g.searchMatches.matches.map(b=>({...b,focus:!1}))}})),this.updateEditorAtom(Pg,null)),Ut.get(on)&&this.updateEditorAtom(on,null),this.state.contextMenu&&this.setState({contextMenu:null}),this.state.snapLines&&this.setAppState({snapLines:[]}),this.state.openPopup&&this.setState({openPopup:null}),this.updateGestureOnPointerDown(t),t.pointerType==="touch"&&this.state.newElement&&this.state.newElement.type==="freedraw"){let g=this.state.newElement;this.updateScene({...g.points.length<10?{elements:this.scene.getElementsIncludingDeleted().filter(b=>b.id!==g.id)}:{},appState:{newElement:null,editingTextElement:null,suggestedBinding:null,selectedElementIds:ye(Object.keys(this.state.selectedElementIds).filter(b=>b!==g.id).reduce((b,y)=>(b[y]=this.state.selectedElementIds[y],b),{}),this.state)},captureUpdate:this.state.openDialog?.name==="elementLinkSelector"?yt.EVENTUALLY:yt.NEVER});return}let s=document.getSelection();if(s?.anchorNode&&s.removeAllRanges(),this.maybeOpenContextMenuAfterPointerDownOnTouchDevices(t),!this.state.penDetected&&t.pointerType==="pen"&&this.setState(g=>({penMode:!0,penDetected:!0})),!this.editorInterface.isTouchScreen&&["pen","touch"].includes(t.pointerType)&&(this.editorInterface=Sf(this.editorInterface,{isTouchScreen:!0})),as||ls||(this.lastPointerDownEvent=t,this.handleCanvasZoomUsingZDrag(t)||this.handleCanvasPanUsingWheelOrSpaceDrag(t)))return;if(this.setState({lastPointerDownWith:t.pointerType,cursorButton:"down"}),this.savePointer(t.clientX,t.clientY,"down"),t.button===Bo.ERASER&&this.state.activeTool.type!==Fo.eraser){this.setState({activeTool:Oo(this.state,{type:Fo.eraser,lastActiveToolBeforeEraser:this.state.activeTool})},()=>{this.handleCanvasPointerDown(t);let g=()=>{b(),y?.(),wt(this.state)&&this.setState({activeTool:Oo(this.state,{...this.state.activeTool.lastActiveTool||{type:Fo.selection},lastActiveToolBeforeEraser:null})})},b=Ge(window,q.POINTER_UP,g,{once:!0}),y;requestAnimationFrame(()=>{y=this.missingPointerEventCleanupEmitter.once(g)})});return}if(t.button!==Bo.MAIN&&t.button!==Bo.TOUCH&&t.button!==Bo.ERASER||fe.pointers.size>1)return;let c=this.initialPointerDownState(t);if(this.setState({selectedElementsAreBeingDragged:!1}),this.handleTextAutoResizeHandlePointerDown(n,c.origin)||this.handleDraggingScrollBar(t,c)||(this.clearSelectionIfNotUsingSelection(),this.handleSelectionOnPointerDown(t,c))||!(!this.state.penMode||t.pointerType!=="touch"||this.state.activeTool.type==="selection"||this.state.activeTool.type==="lasso"||this.state.activeTool.type==="text"||this.state.activeTool.type==="image"))return;if(this.state.activeTool.type==="lasso"){let g=c.hit.element&&this.isASelectedElement(c.hit.element);(t.altKey&&t[Y.CTRL_OR_CMD]&&!c.resize.handleType||!c.hit.hasHitCommonBoundingBoxOfSelectedElements&&!c.resize.handleType&&!g)&&(this.lassoTrail.hasCurrentTrail||this.lassoTrail.startPath(c.origin.x,c.origin.y,t.shiftKey),c.drag.blockDragging=this.editorInterface.formFactor==="desktop"),this.editorInterface.formFactor!=="desktop"&&c.hit.element&&!g&&(this.setState(v=>{let x={...v.selectedElementIds,[c.hit.element.id]:!0},w=[];Object.keys(v.selectedElementIds).forEach(S=>{let P=this.scene.getElement(S);P&&w.push(P)});let T=c.hit.element;if(at(T))Nf(w,T.id).forEach(S=>{delete x[S.id]});else if(T.frameId)x[T.frameId]&&delete x[T.id];else{let S=T.groupIds,P=new Set(S.flatMap(M=>Lr(this.scene.getNonDeletedElements(),M)).filter(M=>at(M)).map(M=>M.id));P.size>0&&w.forEach(M=>{M.frameId&&P.has(M.frameId)&&(delete x[M.id],M.groupIds.flatMap(_=>Lr(this.scene.getNonDeletedElements(),_)).forEach(_=>{delete x[_.id]}))})}return{...eo({editingGroupId:v.editingGroupId,selectedElementIds:x},this.scene.getNonDeletedElements(),v,this),showHyperlinkPopup:T.link||dn(T)?"info":!1}}),c.hit.wasAddedToSelection=!0)}else this.state.activeTool.type==="text"?this.handleTextOnPointerDown(t,c):this.state.activeTool.type==="arrow"||this.state.activeTool.type==="line"?this.handleLinearElementOnPointerDown(t,this.state.activeTool.type,c):this.state.activeTool.type==="freedraw"?this.handleFreeDrawElementOnPointerDown(t,this.state.activeTool.type,c):this.state.activeTool.type==="custom"?Ct(this.interactiveCanvas,this.state):this.state.activeTool.type===Fo.frame||this.state.activeTool.type===Fo.magicframe?this.createFrameElementOnPointerDown(c,this.state.activeTool.type):this.state.activeTool.type==="laser"?this.laserTrails.startPath(c.lastCoords.x,c.lastCoords.y):this.state.activeTool.type!=="eraser"&&this.state.activeTool.type!=="hand"&&this.state.activeTool.type!=="image"&&this.createGenericElementOnPointerDown(this.state.activeTool.type,c);this.props?.onPointerDown?.(this.state.activeTool,c),this.onPointerDownEmitter.trigger(this.state.activeTool,c,t),this.state.activeTool.type==="eraser"&&this.eraserTrail.startPath(c.lastCoords.x,c.lastCoords.y);let p=this.onPointerMoveFromPointerDownHandler(c),d=this.onPointerUpFromPointerDownHandler(c),h=this.onKeyDownFromPointerDownHandler(c),f=this.onKeyUpFromPointerDownHandler(c);this.missingPointerEventCleanupEmitter.once(g=>d(g||t.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type==="laser")&&(window.addEventListener(q.POINTER_MOVE,p),window.addEventListener(q.POINTER_UP,d),window.addEventListener(q.KEYDOWN,h),window.addEventListener(q.KEYUP,f),c.eventListeners.onMove=p,c.eventListeners.onUp=d,c.eventListeners.onKeyUp=f,c.eventListeners.onKeyDown=h)});I(this,"handleCanvasPointerUp",t=>{if(cn("COMPLEX_BINDINGS")&&this.resetDelayedBindMode(),this.removePointer(t),this.lastPointerUpIsDoubleClick=this.isDoubleClick(this.lastPointerUpEvent,t),this.lastPointerUpEvent=t,!t.ctrlKey){let l=this.state.bindingPreference==="enabled";this.state.isBindingEnabled!==l&&this.setState({isBindingEnabled:l})}let n=De({clientX:t.clientX,clientY:t.clientY},this.state),{x:r,y:i}=n;if(this.lastPointerMoveCoords={x:r,y:i},!this.handleIframeLikeCenterClick()){if(this.editorInterface.isTouchScreen){let l=this.getElementAtPosition(n.x,n.y,{includeLockedElements:!0});this.hitLinkElement=this.getElementLinkAtPosition(n,l)}this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?this.handleElementLinkClick(t):this.state.viewModeEnabled&&this.setState({activeEmbeddable:null,selectedElementIds:{}})}});I(this,"maybeOpenContextMenuAfterPointerDownOnTouchDevices",t=>{t.pointerType==="touch"&&(cs=!1,Qn?cs=!0:Qn=window.setTimeout(()=>{Qn=0,cs||this.handleCanvasContextMenu(t)},Gz))});I(this,"resetContextMenuTimer",()=>{clearTimeout(Qn),Qn=0,cs=!1});I(this,"maybeCleanupAfterMissingPointerUp",t=>{Dr?.(),this.missingPointerEventCleanupEmitter.trigger(t).clear()});I(this,"handleCanvasZoomUsingZDrag",t=>{if(!(ga&&fe.pointers.size<=1&&t.button===Bo.MAIN))return!1;ls=!0,this.focusContainer(),t.preventDefault();let n=t.clientX,r=t.clientY,i=t.clientX,l=this.state.zoom.value,a=200,s=Tl(m=>{let p=Gt(l*2**((m.clientX-i)/a));this.translateCanvas(d=>({...To({viewportX:n,viewportY:r,nextZoom:p},d),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced()}),c=Re(Dr=()=>{Dr=null,ls=!1,ga||this.restoreCursorAfterZoomKey(),window.removeEventListener(q.POINTER_MOVE,s),window.removeEventListener(q.POINTER_UP,c),window.removeEventListener(q.BLUR,c),s.flush()});return window.addEventListener(q.BLUR,c),window.addEventListener(q.POINTER_MOVE,s,{passive:!0}),window.addEventListener(q.POINTER_UP,c),!0});I(this,"restoreCursorAfterZoomKey",()=>{this.state.viewModeEnabled&&this.state.activeTool.type!=="laser"?pe(this.interactiveCanvas,Ce.GRAB):Ql(this.state.activeTool.type)?It(this.interactiveCanvas):Ct(this.interactiveCanvas,this.state)});I(this,"handleCanvasPanUsingWheelOrSpaceDrag",t=>{if(!(fe.pointers.size<=1&&(t.button===Bo.WHEEL||t.button===Bo.MAIN&&Jn||ro(this.state)||this.state.viewModeEnabled&&this.state.activeTool.type!=="laser")))return!1;as=!0,this.focusContainer(),this.state.editingTextElement||t.preventDefault();let n=!1,r=typeof window===void 0?!1:/Linux/.test(window.navigator.platform);pe(this.interactiveCanvas,Ce.GRABBING);let{clientX:i,clientY:l}=t,a=Tl(c=>{let m=i-c.clientX,p=l-c.clientY;if(i=c.clientX,l=c.clientY,r&&!n&&(Math.abs(m)>1||Math.abs(p)>1)){n=!0;let d=f=>{document.body.removeEventListener(q.PASTE,d),f.stopPropagation()},h=()=>{setTimeout(()=>{document.body.removeEventListener(q.PASTE,d),window.removeEventListener(q.POINTER_UP,h)},100)};document.body.addEventListener(q.PASTE,d),window.addEventListener(q.POINTER_UP,h)}this.translateCanvas({scrollX:this.state.scrollX-m/this.state.zoom.value,scrollY:this.state.scrollY-p/this.state.zoom.value})}),s=Re(Dr=()=>{Dr=null,as=!1,Jn||(this.state.viewModeEnabled&&this.state.activeTool.type!=="laser"?pe(this.interactiveCanvas,Ce.GRAB):Ct(this.interactiveCanvas,this.state)),this.setState({cursorButton:"up"}),this.savePointer(t.clientX,t.clientY,"up"),window.removeEventListener(q.POINTER_MOVE,a),window.removeEventListener(q.POINTER_UP,s),window.removeEventListener(q.BLUR,s),a.flush()});return window.addEventListener(q.BLUR,s),window.addEventListener(q.POINTER_MOVE,a,{passive:!0}),window.addEventListener(q.POINTER_UP,s),!0});I(this,"clearSelectionIfNotUsingSelection",()=>{Ql(this.state.activeTool.type)||this.setState({selectedElementIds:ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})});I(this,"handleSelectionOnPointerDown",(t,n)=>{if(Ql(this.state.activeTool.type)){let r=this.scene.getNonDeletedElements(),i=this.scene.getNonDeletedElementsMap(),l=this.scene.getSelectedElements(this.state);if(l.length===1&&!this.state.selectedLinearElement?.isEditing&&!Lt(l[0])&&!(bt(l[0])&&(this.editorInterface.userAgent.isMobileDevice||l[0].points.length===2))&&!(this.state.selectedLinearElement&&this.state.selectedLinearElement.hoverPointIndex!==-1)){let a=GC(r,this.state,n.origin.x,n.origin.y,this.state.zoom,t.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);a!=null&&(a.transformHandleType==="rotation"?(this.setState({resizingElement:a.element}),n.resize.handleType=a.transformHandleType):(this.state.croppingElementId||this.setState({resizingElement:a.element}),n.resize.handleType=a.transformHandleType))}else l.length>1&&(n.resize.handleType=UC(pa(l),n.origin.x,n.origin.y,this.state.zoom,t.pointerType,this.editorInterface));if(n.resize.handleType)n.resize.isResizing=!0,n.resize.offset=Cf(dG(n.resize.handleType,l,i,n.origin.x,n.origin.y)),l.length===1&&bt(l[0])&&l[0].points.length===2&&(n.resize.arrowDirection=mG(n.resize.handleType,l[0]));else{if(this.state.selectedLinearElement){let d=this.state.selectedLinearElement,h=se.handlePointerDown(t,this,this.store,n.origin,d,this.scene);if(h.hitElement&&(n.hit.element=h.hitElement),h.linearElementEditor&&this.setState({selectedLinearElement:h.linearElementEditor}),h.didAddPoint)return!0;let f=this.scene.getNonDeletedElementsMap(),g=se.getElement(d.elementId,f);if(g&&Go(g)){let{hitFocusPoint:b,pointerOffset:y}=TG(g,n,f,this.state);if(b)return this.setState({selectedLinearElement:{...d,hoveredFocusPointBinding:b,draggedFocusPointBinding:b,pointerOffset:y}}),!1}}let a=this.getElementsAtPosition(n.origin.x,n.origin.y,{includeLockedElements:!0}),s=a.filter(d=>!d.locked),c=this.getElementAtPosition(n.origin.x,n.origin.y,{allHitElements:a});if((!c||c.id!==this.state.activeLockedId)&&this.setState({activeLockedId:null}),c&&c.locked&&!s.some(d=>this.state.selectedElementIds[d.id])?n.hit.element=null:n.hit.element=n.hit.element??this.getElementAtPosition(n.origin.x,n.origin.y),this.hitLinkElement=this.getElementLinkAtPosition(n.origin,c),this.hitLinkElement)return!0;if(this.state.croppingElementId&&n.hit.element?.id!==this.state.croppingElementId&&this.finishImageCropping(),n.hit.element&&this.getElementLinkAtPosition({x:n.origin.x,y:n.origin.y},n.hit.element))return!1;n.hit.allHitElements=s;let m=n.hit.element,p=n.hit.allHitElements.some(d=>this.isASelectedElement(d));if((m===null||!p)&&!t.shiftKey&&!n.hit.hasHitCommonBoundingBoxOfSelectedElements&&(!this.state.selectedLinearElement?.isEditing||m&&m?.id!==this.state.selectedLinearElement?.elementId)&&this.clearSelection(m),this.state.selectedLinearElement?.isEditing)this.setState(d=>({selectedLinearElement:d.selectedLinearElement?{...d.selectedLinearElement,isEditing:!!m&&m.id===this.state.selectedLinearElement?.elementId}:null,selectedElementIds:d.selectedLinearElement?ye({[d.selectedLinearElement.elementId]:!0},this.state):ye({},d)}));else if(m!=null){if(t[Y.CTRL_OR_CMD])return t.altKey?(this.state.openDialog?.name==="elementLinkSelector"&&this.setOpenDialog(null),this.lassoTrail.startPath(n.origin.x,n.origin.y,t.shiftKey),this.setActiveTool({type:"lasso",fromSelection:!0}),!1):(this.state.selectedElementIds[m.id]||(n.hit.wasAddedToSelection=!0),this.setState(d=>({...rG(d,m),previousSelectedElementIds:this.state.selectedElementIds})),!1);this.state.selectedElementIds[m.id]||(this.state.editingGroupId&&!OC(m,this.state.editingGroupId)&&this.setState({selectedElementIds:ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),!p&&!n.hit.hasHitCommonBoundingBoxOfSelectedElements&&(this.setState(d=>{let h={...d.selectedElementIds,[m.id]:!0},f=[];if(Object.keys(d.selectedElementIds).forEach(g=>{let b=this.scene.getElement(g);b&&f.push(b)}),at(m))Nf(f,m.id).forEach(g=>{delete h[g.id]});else if(m.frameId)h[m.frameId]&&delete h[m.id];else{let g=m.groupIds,b=new Set(g.flatMap(y=>Lr(this.scene.getNonDeletedElements(),y)).filter(y=>at(y)).map(y=>y.id));b.size>0&&f.forEach(y=>{y.frameId&&b.has(y.frameId)&&(delete h[y.id],y.groupIds.flatMap(v=>Lr(this.scene.getNonDeletedElements(),v)).forEach(v=>{delete h[v.id]}))})}return d.openDialog?.name==="elementLinkSelector"&&(m.groupIds.some(g=>d.selectedGroupIds[g])||(h={[m.id]:!0})),{...eo({editingGroupId:d.editingGroupId,selectedElementIds:h},this.scene.getNonDeletedElements(),d,this),showHyperlinkPopup:m.link||dn(m)?"info":!1}}),n.hit.wasAddedToSelection=!0))}this.setState({previousSelectedElementIds:this.state.selectedElementIds})}}return!1});I(this,"handleTextOnPointerDown",(t,n)=>{if(this.state.editingTextElement)return;let r=n.origin.x,i=n.origin.y,l=this.getElementAtPosition(r,i,{includeBoundTextElement:!0}),a=this.getTextBindableContainerAtPosition(r,i);wC(l)&&(a=l,r=l.x+l.width/2,i=l.y+l.height/2),this.startTextEditing({sceneX:r,sceneY:i,insertAtParentCenter:!t.altKey,container:a,autoEdit:!1,initialCaretSceneCoords:{x:r,y:i}}),It(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:Oo(this.state,{type:this.state.preferredSelectionTool.type})})});I(this,"handleFreeDrawElementOnPointerDown",(t,n,r)=>{let[i,l]=dt(r.origin.x,r.origin.y,null),a=this.getTopLayerFrameAtSceneCoords({x:i,y:l}),s=t.pressure===.5,c=xH({type:n,x:i,y:l,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:null,simulatePressure:s,locked:!1,frameId:a?a.id:null,points:[Q(0,0)],pressures:s?[]:[t.pressure]});this.insertNewElement(c),this.setState(m=>{let p={...m.selectedElementIds};return delete p[c.id],{selectedElementIds:ye(p,m)}}),this.setState({newElement:c,suggestedBinding:null})});I(this,"insertIframeElement",({sceneX:t,sceneY:n,width:r,height:i})=>{let[l,a]=dt(t,n,this.lastPointerDownEvent?.[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),s=bH({type:"iframe",x:l,y:a,strokeColor:"transparent",backgroundColor:"transparent",fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness("iframe"),opacity:this.state.currentItemOpacity,locked:!1,width:r,height:i});return this.insertNewElement(s),s});I(this,"insertEmbeddableElement",({sceneX:t,sceneY:n,link:r})=>{let[i,l]=dt(t,n,this.lastPointerDownEvent?.[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=fm(r);if(!a)return;a.error instanceof URIError&&this.setToast({message:E("toast.unrecognizedLinkFormat"),closable:!0});let s=fC({type:"embeddable",x:i,y:l,strokeColor:"transparent",backgroundColor:"transparent",fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness("embeddable"),opacity:this.state.currentItemOpacity,locked:!1,width:a.intrinsicSize.w,height:a.intrinsicSize.h,link:r});return this.insertNewElement(s),s});I(this,"newImagePlaceholder",({sceneX:t,sceneY:n,addToFrameUnderCursor:r=!0,customData:i})=>{let[l,a]=dt(t,n,this.lastPointerDownEvent?.[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),s=r?this.getTopLayerFrameAtSceneCoords({x:l,y:a}):null,c=100/this.state.zoom.value;return vH({type:"image",strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:null,opacity:this.state.currentItemOpacity,locked:!1,frameId:s?s.id:null,x:l-c/2,y:a-c/2,width:c,height:c,customData:i})});I(this,"handleLinearElementOnPointerDown",(t,n,r)=>{if(t.ctrlKey&&Ot(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!=="enabled"})}),this.state.multiElement){let{multiElement:i,selectedLinearElement:l}=this.state;if(zo(l,"selectedLinearElement is expected to be set"),i.type==="line"&&SC(i.points,this.state.zoom.value)){Ot(()=>{this.setState({selectedLinearElement:{...l,lastCommittedPoint:i.points[i.points.length-1],initialState:{...l.initialState,lastClickedPoint:-1}}})}),this.actionManager.executeAction(ht);return}if(Lt(i)&&i.points.length>1){this.actionManager.executeAction(ht,"ui",{event:t.nativeEvent,sceneCoords:{x:r.origin.x,y:r.origin.y}});return}let{x:a,y:s}=i,{lastCommittedPoint:c}=l,m=es(this.state)&&Ho(Q(this.lastPointerMoveCoords?.x??a+i.points[i.points.length-1][0],this.lastPointerMoveCoords?.y??s+i.points[i.points.length-1][1]),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(Go(i)&&m||i.points.length>1&&c&&sn(Q(r.origin.x-a,r.origin.y-s),c)<vf){this.actionManager.executeAction(ht,"ui",{event:t.nativeEvent,sceneCoords:{x:r.origin.x,y:r.origin.y}});return}this.setState(p=>({selectedElementIds:ye({...p.selectedElementIds,[i.id]:!0},p)})),pe(this.interactiveCanvas,Ce.POINTER)}else{let[i,l]=dt(r.origin.x,r.origin.y,t[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=this.getTopLayerFrameAtSceneCoords({x:i,y:l}),{currentItemStartArrowhead:s,currentItemEndArrowhead:c}=this.state,[m,p]=n==="arrow"?[s,c]:[null,null],d=n==="arrow"?yH({type:n,x:i,y:l,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemArrowType===$n.round?{type:mm.PROPORTIONAL_RADIUS}:null,startArrowhead:m,endArrowhead:p,locked:!1,frameId:a?a.id:null,elbowed:this.state.currentItemArrowType===$n.elbow,fixedSegments:this.state.currentItemArrowType===$n.elbow?[]:null}):TH({type:n,x:i,y:l,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemRoundness==="round"?{type:mm.PROPORTIONAL_RADIUS}:null,locked:!1,frameId:a?a.id:null}),h=Q(r.origin.x,r.origin.y),f=this.scene.getNonDeletedElementsMap(),g=es(this.state)?Ho(h,this.scene.getNonDeletedElements(),f):null;this.scene.mutateElement(d,{points:[Q(0,0),Q(0,0)]}),this.insertNewElement(d),Go(d)&&EG(d,new Map([[0,{point:Q(0,0),isDragging:!1}]]),h[0],h[1],this.scene,this.state,{newArrow:!0,altKey:t.altKey,initialBinding:!0,angleLocked:tC(t.nativeEvent)}),Ot(()=>{this.setState(b=>{let y=null,v=b.selectedElementIds;if(bt(d)){y=new se(d,this.scene.getNonDeletedElementsMap());let x=d.points.length-1;y={...y,selectedPointsIndices:[x],initialState:{...y.initialState,arrowStartIsInside:t.altKey,lastClickedPoint:x,origin:Q(r.origin.x,r.origin.y)}}}return v=this.state.activeTool.locked?b.selectedElementIds:ye({[d.id]:!0},b),{...b,bindMode:"orbit",newElement:d,startBoundElement:g,suggestedBinding:g&&Go(d)?{element:g,midPoint:Wf(h,g,f,this.state.zoom)}:null,selectedElementIds:v,selectedLinearElement:y}})}),Go(d)&&cn("COMPLEX_BINDINGS")&&this.handleDelayedBindModeChange(d,g)}});I(this,"createGenericElementOnPointerDown",(t,n)=>{let[r,i]=dt(n.origin.x,n.origin.y,this.lastPointerDownEvent?.[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),l=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),a={x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.getCurrentItemRoundness(t),locked:!1,frameId:l?l.id:null},s;t==="embeddable"?s=fC({type:"embeddable",...a}):s=wH({type:t,...a}),s.type==="selection"?this.setState({selectionElement:s}):(this.insertNewElement(s),this.setState({multiElement:null,newElement:s}))});I(this,"createFrameElementOnPointerDown",(t,n)=>{let[r,i]=dt(t.origin.x,t.origin.y,this.lastPointerDownEvent?.[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),l={x:r,y:i,opacity:this.state.currentItemOpacity,locked:!1,...No},a=n===Fo.magicframe?EC(l):EH(l);this.insertNewElement(a),this.setState({multiElement:null,newElement:a})});I(this,"restoreReadyToEraseElements",()=>{this.elementsPendingErasure=new Set,this.triggerRender()});I(this,"eraseElements",()=>{let t=!1;this.elementsPendingErasure.forEach(r=>{let i=this.scene.getElement(r);if(Go(i)){if(i.startBinding){let l=this.scene.getElement(i.startBinding.elementId);Em(l,this.scene.getElementsMapIncludingDeleted(),{boundElements:l.boundElements.filter(a=>a.id!==i.id)})}if(i.endBinding){let l=this.scene.getElement(i.endBinding.elementId);Em(l,this.scene.getElementsMapIncludingDeleted(),{boundElements:l.boundElements.filter(a=>a.id!==i.id)})}}else Af(i)&&i.boundElements?.forEach(l=>{if(l.type==="arrow"){let a=this.scene.getElement(l.id);a?.startBinding?.elementId===i.id&&Em(a,this.scene.getElementsMapIncludingDeleted(),{startBinding:null}),a?.endBinding?.elementId===i.id&&Em(a,this.scene.getElementsMapIncludingDeleted(),{endBinding:null})}})});let n=this.scene.getElementsIncludingDeleted().map(r=>this.elementsPendingErasure.has(r.id)||r.frameId&&this.elementsPendingErasure.has(r.frameId)||Mf(r)&&this.elementsPendingErasure.has(r.containerId)?(t=!0,jn(r,{isDeleted:!0})):r);this.elementsPendingErasure=new Set,t&&(this.store.scheduleCapture(),this.scene.replaceAllElements(n))});I(this,"initializeImage",async(t,n)=>{if(!Lm(n))throw new Error(E("errors.unsupportedFileType"));let r=n.type,i=n.size>=this.state.dontResizeLimitMBs*1024*1024;if(pe(this.interactiveCanvas,"wait"),r===sa.svg)try{n=_m(MC(await n.text()),n.name)}catch(c){throw console.warn(c),new Error(E("errors.svgImageInsertError"))}else if(i){let{maxWidthOrHeight:c}=this.props.imageOptions;try{n=await this.props.compressImageFile(n,{maxWidthOrHeight:c}),console.info("Excalidraw: image resized")}catch(m){console.error("Error trying to resizing image file on insertion",m)}}let{maxFileSizeBytes:l}=this.props.imageOptions;if(n.size>l)throw new Error(E("errors.fileTooBig",{maxSize:`${Math.trunc(l/1024/1024)}MB`}));let a=await(this.props.generateIdForFile?.(n)||M1(n));if(!a)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),new Error(E("errors.imageInsertError"));let s=this.files[a]?.dataURL||await Dm(n);return new Promise(async(c,m)=>{try{let p=this.getLatestInitializedImageElement(t,a);if(this.addMissingFiles([{mimeType:r,id:a,dataURL:s,created:Date.now(),lastRetrieved:Date.now()}]),!this.imageCache.get(a)){this.addNewImagesToImageCache();let{erroredFiles:h}=await this.updateImageCache([p]);if(h.size)throw new Error("Image cache update resulted with an error.")}let d=await this.imageCache.get(a)?.image;if(d&&this.state.newElement?.id!==p.id){p=this.getLatestInitializedImageElement(t,a);let h=this.getImageNaturalDimensions(p,d);Object.assign(p,h)}c(p)}catch(p){console.error(p),m(new Error(E("errors.imageInsertError")))}})});I(this,"getLatestInitializedImageElement",(t,n)=>{let r=this.scene.getElement(t.id)??t;return jn(r,{fileId:n})});I(this,"onImageToolbarButtonClick",async()=>{try{let t=this.state.width/2+this.state.offsetLeft,n=this.state.height/2+this.state.offsetTop,{x:r,y:i}=De({clientX:t,clientY:n},this.state),l=await x1({description:"Image",extensions:Object.keys(Bz),multiple:!0});this.insertImages(l.map(a=>({file:a})),r,i)}catch(t){t.name!=="AbortError"?console.error(t):console.warn(t),this.setState({newElement:null,activeTool:Oo(this.state,{type:this.state.preferredSelectionTool.type})},()=>{this.actionManager.executeAction(ht)})}});I(this,"getImageNaturalDimensions",(t,n)=>{let r=Math.max(this.state.height-120,160),i=Math.min(r,Math.floor(this.state.height*.5)/this.state.zoom.value),l=Math.min(n.naturalHeight,i),a=l*(n.naturalWidth/n.naturalHeight),s=t.x+t.width/2-a/2,c=t.y+t.height/2-l/2;return{x:s,y:c,width:a,height:l,crop:null}});I(this,"updateImageCache",async(t,n=this.files)=>{let{updatedFiles:r,erroredFiles:i}=await _H({imageCache:this.imageCache,fileIds:t.map(l=>l.fileId),files:n});return i.size&&(this.store.scheduleAction(yt.NEVER),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(l=>ts(l)&&i.has(l.fileId)?jn(l,{status:"error"}):l))),{updatedFiles:r,erroredFiles:i}});I(this,"addNewImagesToImageCache",async(t=DH(this.scene.getNonDeletedElements()),n=this.files)=>{let r=t.filter(i=>!i.isDeleted&&!this.imageCache.has(i.fileId));if(r.length){let{updatedFiles:i}=await this.updateImageCache(r,n);if(i.size)for(let l of r)i.has(l.fileId)&&ns.delete(l);i.size&&this.scene.triggerUpdate()}});I(this,"scheduleImageRefresh",Pz(()=>{this.addNewImagesToImageCache()},Fz));I(this,"handleInteractiveCanvasRef",t=>{t!==null?(this.interactiveCanvas=t,this.interactiveCanvas.addEventListener(q.TOUCH_START,this.onTouchStart,{passive:!1}),this.interactiveCanvas.addEventListener(q.TOUCH_END,this.onTouchEnd)):(this.interactiveCanvas?.removeEventListener(q.TOUCH_START,this.onTouchStart),this.interactiveCanvas?.removeEventListener(q.TOUCH_END,this.onTouchEnd))});I(this,"insertImages",async(t,n,r)=>{let i=50/this.state.zoom.value,l=KC(t.map(({customData:d})=>this.newImagePlaceholder({sceneX:n,sceneY:r,customData:d})),n,r,i);this.insertNewElements(l);let a=await Promise.all(l.map(async(d,h)=>{try{return await this.initializeImage(d,await Pa(t[h].file))}catch(f){return this.setState({errorMessage:f.message||E("errors.imageInsertError")}),jn(d,{isDeleted:!0})}})),s=hm(a),c=KC(a.filter(d=>!d.isDeleted),n,r,i),m=hm(c),p=this.scene.getElementsIncludingDeleted().map(d=>m.get(d.id)??s.get(d.id)??d);this.updateScene({appState:{selectedElementIds:ye(Object.fromEntries(c.map(d=>[d.id,!0])),this.state)},elements:p,captureUpdate:yt.IMMEDIATELY}),this.setState({},()=>{this.actionManager.executeAction(ht)})});I(this,"handleAppOnDrop",async t=>{let{x:n,y:r}=De(t,this.state),i=await pi(t),l=i.getFiles();if(l.length===1){let{file:c,fileHandle:m}=l[0];if(c&&(c.type===sa.png||c.type===sa.svg))try{let p=await ka(c,this.state,this.scene.getElementsIncludingDeleted(),m);this.syncActionResult({...p,appState:{...p.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:yt.IMMEDIATELY});return}catch(p){if(p.name!=="EncodingError")throw new Error(E("alerts.couldNotLoadInvalidFile"))}}let a=l.map(c=>c.file).filter(c=>Lm(c));if(a.length>0&&this.isToolSupported("image"))return this.insertImages(a.map(c=>({file:c})),n,r);if(l.length>0){let{file:c,fileHandle:m}=l[0];c&&await this.loadFileToCanvas(c,m)}let s=i.findByType(sa.text);if(s){let c=s.value;if(c&&Df(c,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(c)||fm(c)?.type==="video")){let m=this.insertEmbeddableElement({sceneX:n,sceneY:r,link:Tf(c)});m&&(this.store.scheduleCapture(),this.setState({selectedElementIds:{[m.id]:!0}}))}}});I(this,"loadFileToCanvas",async(t,n)=>{t=await Pa(t);try{let r=this.scene.getElementsIncludingDeleted(),i;try{i=await ka(t,this.state,r,n)}catch(l){let a=l instanceof E1;if(a&&l.code==="IMAGE_NOT_CONTAINS_SCENE_DATA"&&!this.isToolSupported("image")){this.setState({isLoading:!1,errorMessage:E("errors.imageToolNotSupported")});return}let s=a?E("alerts.cannotRestoreFromImage"):E("alerts.couldNotLoadInvalidFile");this.setState({isLoading:!1,errorMessage:s})}if(!i)return;oS(r.concat(i.elements)),this.store.scheduleMicroAction({action:yt.NEVER,elements:r,appState:void 0}),this.setState({isLoading:!0}),this.syncActionResult({...i,appState:{...i.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:yt.IMMEDIATELY})}catch(r){this.setState({isLoading:!1,errorMessage:r.message})}});I(this,"handleCanvasContextMenu",t=>{if(t.preventDefault(),("pointerType"in t.nativeEvent&&t.nativeEvent.pointerType==="touch"||"pointerType"in t.nativeEvent&&t.nativeEvent.pointerType==="pen"&&t.button!==Bo.SECONDARY)&&this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let{x:n,y:r}=De(t,this.state),i=this.getElementAtPosition(n,r,{preferSelected:!0,includeLockedElements:!0}),l=this.scene.getSelectedElements(this.state),a=this.isHittingCommonBoundingBoxOfSelectedElements({x:n,y:r},l),s=i||a?"element":"canvas",c=this.excalidrawContainerRef.current,{top:m,left:p}=c.getBoundingClientRect(),d=t.clientX-p,h=t.clientY-m;de("contextMenu","openContextMenu",s),this.setState({...i&&!this.state.selectedElementIds[i.id]?{...this.state,...eo({editingGroupId:this.state.editingGroupId,selectedElementIds:{[i.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:bt(i)?new se(i,this.scene.getNonDeletedElementsMap()):null}:this.state,showHyperlinkPopup:!1},()=>{this.setState({contextMenu:{top:h,left:d,items:this.getContextMenuItems(s)}})})});I(this,"maybeDragNewGenericElement",(t,n,r=!0)=>{let i=this.state.selectionElement,l=t.lastCoords;if(i&&t.boxSelection.hasOccurred&&this.state.activeTool.type!=="eraser"){WC({newElement:i,elementType:this.state.activeTool.type,originX:t.origin.x,originY:t.origin.y,x:l.x,y:l.y,width:ma(t.origin.x,l.x),height:ma(t.origin.y,l.y),shouldMaintainAspectRatio:jl(n),shouldResizeFromCenter:!1,scene:this.scene,zoom:this.state.zoom.value,informMutation:!1});return}let a=this.state.newElement;if(!a)return;let[s,c]=dt(l.x,l.y,n[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),m=ts(a)&&this.imageCache.get(a.fileId)?.image,p=m&&!(m instanceof Promise)?m.width/m.height:null;this.maybeCacheReferenceSnapPoints(n,[a]);let{snapOffset:d,snapLines:h}=hy(a,this,n,{x:t.originInGrid.x+(this.state.originSnapOffset?.x??0),y:t.originInGrid.y+(this.state.originSnapOffset?.y??0)},{x:s-t.originInGrid.x,y:c-t.originInGrid.y},this.scene.getNonDeletedElementsMap());s+=d.x,c+=d.y,this.setState({snapLines:h}),Go(a)||WC({newElement:a,elementType:this.state.activeTool.type,originX:t.originInGrid.x,originY:t.originInGrid.y,x:s,y:c,width:ma(t.originInGrid.x,s),height:ma(t.originInGrid.y,c),shouldMaintainAspectRatio:qn(a)?!jl(n):jl(n),shouldResizeFromCenter:eC(n),zoom:this.state.zoom.value,scene:this.scene,widthAspectRatio:p,originOffset:this.state.originSnapOffset,informMutation:r}),this.setState({newElement:a}),(this.state.activeTool.type===Fo.frame||this.state.activeTool.type===Fo.magicframe)&&this.setState({elementsToHighlight:Ff(this.scene.getNonDeletedElements(),a,this.state,this.scene.getNonDeletedElementsMap())})});I(this,"maybeHandleCrop",(t,n)=>{if(!this.state.croppingElementId)return!1;let r=t.resize.handleType,i=t.lastCoords,[l,a]=dt(i.x-t.resize.offset.x,i.y-t.resize.offset.y,n[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),s=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(r&&s&&qn(s)){let c=t.originalElements.get(s.id),m=ts(s)&&this.imageCache.get(s.fileId)?.image;if(c&&qn(c)&&m&&!(m instanceof Promise)){let[p,d]=dt(i.x,i.y,n[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),h={x:p-t.originInGrid.x,y:d-t.originInGrid.y};this.maybeCacheReferenceSnapPoints(n,[s]);let{snapOffset:f,snapLines:g}=mh([s],[c],this,n,h,r);this.scene.mutateElement(s,$H(s,this.scene.getNonDeletedElementsMap(),r,m.naturalWidth,m.naturalHeight,l+f.x,a+f.y,n.shiftKey?c.width/c.height:void 0)),gm(s,this.scene),this.setState({isCropping:r&&r!=="rotation",snapLines:g})}return!0}return!1});I(this,"maybeHandleResize",(t,n)=>{let r=this.scene.getSelectedElements(this.state),i=r.filter(p=>at(p)),l=t.resize.handleType;if(i.length>0&&l==="rotation"||r.length===1&&Lt(r[0])||this.state.croppingElementId)return!1;this.setState({isResizing:l&&l!=="rotation",isRotating:l==="rotation",activeEmbeddable:null});let a=t.lastCoords,[s,c]=dt(a.x-t.resize.offset.x,a.y-t.resize.offset.y,n[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),m=new Map;if(i.forEach(p=>{Nf(this.scene.getNonDeletedElements(),p.id).forEach(h=>{m.set(p.id+h.id,{x:h.x-p.x,y:h.y-p.y})})}),!this.state.selectedElementsAreBeingDragged){let[p,d]=dt(a.x,a.y,n[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),h={x:p-t.originInGrid.x,y:d-t.originInGrid.y},f=[...t.originalElements.values()];this.maybeCacheReferenceSnapPoints(n,r);let{snapOffset:g,snapLines:b}=mh(r,te(f,this.state),this,n,h,l);s+=g.x,c+=g.y,this.setState({snapLines:b})}if(pG(t.originalElements,l,r,this.scene,tC(n),eC(n),r.some(p=>qn(p))?!jl(n):jl(n),s,c,t.resize.center.x,t.resize.center.y)){let p=new Set;return i.forEach(d=>{Ff(this.scene.getNonDeletedElements(),d,this.state,this.scene.getNonDeletedElementsMap()).forEach(h=>p.add(h))}),this.setState({elementsToHighlight:[...p]}),!0}return!1});I(this,"getContextMenuItems",t=>{let n=[],r=this.getImageContextMenuItems(),i=r.length>0?[Ze,...r]:[];if(t==="canvas")return this.state.viewModeEnabled?[vi,_i,Ln]:[fu,Ze,Fc,Ze,up,f2,Ze,vi,so,al,ll,_i,Ln];if(n.push(Fc),this.state.viewModeEnabled){let s=[wi];return s.push(...i,...n),s}let l=this.editorInterface.formFactor==="desktop"?[Ze,cp,dp,mp,pp]:[],a=[Ze,Bc,wi,fu];return a.push(...i),r.length>0&&a.push(Ze),a.push(Ze,K2,Z2,$2,Ze,Ju,pu,uu,Ze,...n,Ze,cu,rh,bu,yu,t2,du,...l,Ze,hu,gu,Ze,Ai,Ze,Au,Y2,Ze,zy,hp,dl,Ze,Oa),a});I(this,"getImageContextMenuItems",()=>{if(!this.props.imageContextMenuItems)return[];let t=this.scene.getSelectedElements(this.state);return t.length===0||!t.every(n=>qn(n))?[]:[...this.props.imageContextMenuItems(t.map(n=>n.id))]});I(this,"handleWheel",Re(t=>{if(!(t.target instanceof HTMLCanvasElement||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLIFrameElement||t.target instanceof HTMLElement&&t.target.classList.contains(kf.FRAME_NAME))){t[Y.CTRL_OR_CMD]&&t.preventDefault();return}if(t.preventDefault(),as)return;let{deltaX:n,deltaY:r}=t;if(t.metaKey||t.ctrlKey||this.state.wheelZoomsOnDefault){let i=Math.sign(r),l=Wz*100,a=Math.abs(r),s=r;a>l&&(s=l*i);let c=this.state.zoom.value-s/100;c+=Math.log10(Math.max(1,this.state.zoom.value))*-i*Math.min(1,a/20),this.translateCanvas(m=>({...To({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:Gt(c)},m),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced();return}if(t.shiftKey){this.translateCanvas(({zoom:i,scrollX:l})=>({scrollX:l-(r||n)/i.value}));return}this.translateCanvas(({zoom:i,scrollX:l,scrollY:a})=>({scrollX:l-n/i.value,scrollY:a-r/i.value}))}));I(this,"savePointer",(t,n,r)=>{if(!t||!n)return;let{x:i,y:l}=De({clientX:t,clientY:n},this.state);isNaN(i)||isNaN(l);let a={x:i,y:l,tool:this.state.activeTool.type==="laser"?"laser":"pointer"};this.props.onPointerUpdate?.({pointer:a,button:r,pointersMap:fe.pointers})});I(this,"resetShouldCacheIgnoreZoomDebounced",sC(()=>{this.unmounted||this.setState({shouldCacheIgnoreZoom:!1})},300));I(this,"updateDOMRect",t=>{if(this.excalidrawContainerRef?.current){let n=this.excalidrawContainerRef.current,{width:r,height:i,left:l,top:a}=n.getBoundingClientRect(),{width:s,height:c,offsetTop:m,offsetLeft:p}=this.state;if(r===s&&i===c&&l===p&&a===m){t&&t();return}this.setState({width:r,height:i,offsetLeft:l,offsetTop:a},()=>{t&&t()})}});I(this,"refresh",()=>{this.setState({...this.getCanvasOffsets()})});I(this,"watchState",()=>{});let n=gn(),{viewModeEnabled:r=!1,zenModeEnabled:i=!1,gridModeEnabled:l=!1,objectsSnapModeEnabled:a=!1,theme:s=n.theme,name:c=`${E("labels.untitled")}-${dC()}`,wheelZoomsOnDefault:m=!1}=t;this.state={...n,theme:s,exportWithDarkMode:s===ca.DARK,isLoading:!0,...this.getCanvasOffsets(),viewModeEnabled:r,zenModeEnabled:i,objectsSnapModeEnabled:a,gridModeEnabled:l??n.gridModeEnabled,name:c,width:window.innerWidth,height:window.innerHeight,wheelZoomsOnDefault:m},this.refreshEditorInterface(),this.stylesPanelMode=ym(this.editorInterface),this.id=Lz(),this.actionManager=new $c(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new VC,this.canvas=document.createElement("canvas"),this.rc=Az.canvas(this.canvas),this.renderer=new vl(this.scene),this.visibleElements=[],this.store=new gG(this),this.history=new yl(this.store),this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new Uo(this.scene),this.history=new yl(this.store),this.actionManager.registerAll(Gs),this.actionManager.registerAction(Q2(this.history)),this.actionManager.registerAction(ey(this.history)),this.api=this.createExcalidrawAPI()}createExcalidrawAPI(){return{isDestroyed:!1,updateScene:this.updateScene,applyDeltas:this.applyDeltas,mutateElement:this.mutateElement,addFiles:this.addFiles,addImageElementsToScene:this.addImageElementsToScene,resetScene:this.resetScene,getSceneElementsIncludingDeleted:this.getSceneElementsIncludingDeleted,getSceneElementsMapIncludingDeleted:this.getSceneElementsMapIncludingDeleted,history:{clear:this.resetHistory},scrollToViewport:this.scrollToViewport,scrollToContent:this.scrollToContent,getSceneElements:this.getSceneElements,getAppState:()=>this.state,getFiles:()=>this.files,getName:this.getName,registerAction:n=>{this.actionManager.registerAction(n)},refresh:this.refresh,setToast:this.setToast,id:this.id,setActiveTool:this.setActiveTool,setCursor:this.setCursor,resetCursor:this.resetCursor,getEditorInterface:()=>this.editorInterface,updateFrameRendering:this.updateFrameRendering,toggleSidebar:this.toggleSidebar,onChange:n=>this.onChangeEmitter.on(n),onIncrement:n=>this.store.onStoreIncrementEmitter.on(n),onPointerDown:n=>this.onPointerDownEmitter.on(n),onPointerUp:n=>this.onPointerUpEmitter.on(n),onScrollChange:n=>this.onScrollChangeEmitter.on(n),onUserFollow:n=>this.onUserFollowEmitter.on(n),onStateChange:this.onStateChange,onEvent:this.onEvent}}onWindowMessage(t){if(t.origin!=="https://player.vimeo.com"&&t.origin!=="https://www.youtube.com")return;let n=null;try{n=JSON.parse(t.data)}catch{}if(n)switch(t.origin){case"https://player.vimeo.com":if(n.method==="paused"){let r=null,i=document.body.querySelectorAll("iframe.excalidraw__embeddable");if(!i)break;for(let l of i)l.contentWindow===t.source&&(r=l.contentWindow);r?.postMessage(JSON.stringify({method:n.value?"play":"pause",value:!0}),"*")}break;case"https://www.youtube.com":if(n.event==="infoDelivery"&&n.info&&n.id&&typeof n.info.playerState=="number"){let r=n.id,i=n.info.playerState;Object.values(pm).includes(i)&&Xf.set(r,i)}break}}handleSkipBindMode(){if(this.state.selectedLinearElement?.initialState&&!this.state.selectedLinearElement.initialState.arrowStartIsInside){zo(this.lastPointerMoveCoords,"Missing last pointer move coords when changing bind skip mode for arrow start");let t=this.scene.getNonDeletedElementsMap(),n=Ho(Q(this.lastPointerMoveCoords.x,this.lastPointerMoveCoords.y),this.scene.getNonDeletedElements(),t),r=se.getElement(this.state.selectedLinearElement.elementId,t);r?.startBinding&&n?.id===r.startBinding.elementId&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:!0}}})}if(this.state.bindMode==="orbit"&&(this.bindModeHandler&&(clearTimeout(this.bindModeHandler),this.bindModeHandler=null),Ot(()=>{this.setState({bindMode:"skip"})}),this.lastPointerMoveCoords&&this.state.selectedLinearElement?.selectedPointsIndices&&this.state.selectedLinearElement?.selectedPointsIndices.length)){let{x:t,y:n}=this.lastPointerMoveCoords,r=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;zo(r,"Last event must exist");let i=t-this.state.selectedLinearElement.pointerOffset.x,l=n-this.state.selectedLinearElement.pointerOffset.y,a=this.state.multiElement?se.handlePointerMove(r,this,i,l,this.state.selectedLinearElement):se.handlePointDragging(r,this,i,l,this.state.selectedLinearElement);a&&this.setState(a)}}resetDelayedBindMode(){this.bindModeHandler&&(clearTimeout(this.bindModeHandler),this.bindModeHandler=null),this.state.bindMode!=="orbit"&&setTimeout(()=>this.setState({bindMode:"orbit"}))}handleDelayedBindModeChange(t,n){if(t.isDeleted||Lt(t))return;let r=()=>{if(this.bindModeHandler=null,zo(this.lastPointerMoveCoords,"Expected lastPointerMoveCoords to be set"),!this.state.multiElement){if(!this.state.selectedLinearElement||!this.state.selectedLinearElement.selectedPointsIndices||!this.state.selectedLinearElement.selectedPointsIndices.length)return;let f=this.state.selectedLinearElement.selectedPointsIndices.includes(0),g=this.state.selectedLinearElement.selectedPointsIndices.includes(t.points.length-1);if(!f&&!g||f&&g)return}let{x:p,y:d}=this.lastPointerMoveCoords,h=Ho(Q(p,d),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(h&&this.state.bindMode!=="skip"){zo(this.state.selectedLinearElement?.elementId===t.id,"The selectedLinearElement is expected to not change while a bind mode timeout is ticking");let f=this.state.selectedLinearElement.initialState.arrowStartIsInside||t.startBinding?.elementId===h.id;Ot(()=>{zo(this.state.selectedLinearElement,"this.state.selectedLinearElement must exist"),this.setState({bindMode:"inside",selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:f}}})});let g=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;zo(g,"Last event must exist");let b=p-this.state.selectedLinearElement.pointerOffset.x,y=d-this.state.selectedLinearElement.pointerOffset.y,v=this.state.multiElement?se.handlePointerMove(g,this,b,y,this.state.selectedLinearElement):se.handlePointDragging(g,this,b,y,this.state.selectedLinearElement);v&&this.setState(v)}},i=!1;if(this.state.selectedLinearElement?.selectedPointsIndices){let p=this.scene.getNonDeletedElementsMap(),d=this.state.selectedLinearElement.selectedPointsIndices.includes(0),h=this.state.selectedLinearElement.selectedPointsIndices.includes(t.points.length-1),f=d?n:t.startBinding&&p.get(t.startBinding.elementId),g=h?n:t.endBinding&&p.get(t.endBinding.elementId),b=f&&$C(f,p),y=g&&$C(g,p);i=!!(b&&y&&f.id!==g.id&&xG(b,y))}let l=this.state.selectedLinearElement?.selectedPointsIndices?.includes(0),a=this.state.selectedLinearElement?.selectedPointsIndices?.includes(t.points.length-1),s=l?"startBinding":a?"endBinding":null,c=l?"endBinding":a?"startBinding":null,m=c&&t[c]?.mode==="inside"&&t[c]?.elementId===n?.id||s&&t[s]?.mode==="inside"&&n?.id===t[s]?.elementId;s&&c&&t[s]?.mode==="inside"&&n?.id!==t[s]?.elementId&&t[c]?.elementId!==t[s]?.elementId&&this.scene.mutateElement(t,{[s]:{...t[s],mode:"orbit"}},{informMutation:!1,isDragging:!0}),!n||this.previousHoveredBindableElement&&n.id!==this.previousHoveredBindableElement.id?(this.bindModeHandler&&(clearTimeout(this.bindModeHandler),this.bindModeHandler=null),this.state.bindMode==="inside"&&Ot(()=>{this.setState({bindMode:"orbit"})}),this.previousHoveredBindableElement=null):!this.bindModeHandler&&(!this.state.newElement||!t.startBinding||i)&&!m&&(this.bindModeHandler=setTimeout(r,lH)),this.previousHoveredBindableElement=n}cacheEmbeddableRef(t,n){n&&this.iFrameRefs.set(t.id,n)}getHTMLIFrameElement(t){return this.iFrameRefs.get(t.id)}handleIframeLikeCenterClick(){if(!this.lastPointerDownEvent||!this.lastPointerUpEvent||this.lastPointerDownEvent.button!==Bo.MAIN||Jn||!hH(this.state.activeTool.type,["laser","selection","lasso"]))return!1;let t=Q(De({clientX:this.lastPointerDownEvent.clientX,clientY:this.lastPointerDownEvent.clientY},this.state)),n=Q(De({clientX:this.lastPointerUpEvent.clientX,clientY:this.lastPointerUpEvent.clientY},this.state));if(sn(t,n)>nC)return!1;let i=this.getElementAtPosition(t[0],t[1]);if(!(i&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<=300&&fe.pointers.size<2&&Pf(i)&&(this.state.viewModeEnabled||this.state.activeTool.type==="laser"||this.isIframeLikeElementCenter(i,this.lastPointerUpEvent,n[0],n[1]))))return!1;let a=i;if(this.state.activeEmbeddable?.element===a&&this.state.activeEmbeddable?.state==="active"||(setTimeout(()=>{this.setState({activeEmbeddable:{element:a,state:"active"},selectedElementIds:{[a.id]:!0},newElement:null,selectionElement:null})},100),ha(a)))return!0;let s=this.getHTMLIFrameElement(a);if(!s?.contentWindow)return!0;if(s.src.includes("youtube")){let c=Xf.get(a.id);switch(c||(Xf.set(a.id,pm.UNSTARTED),s.contentWindow.postMessage(JSON.stringify({event:"listening",id:a.id}),"*")),c){case pm.PLAYING:case pm.BUFFERING:s.contentWindow?.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),"*");break;default:s.contentWindow?.postMessage(JSON.stringify({event:"command",func:"playVideo",args:""}),"*")}}return s.src.includes("player.vimeo.com")&&s.contentWindow.postMessage(JSON.stringify({method:"paused"}),"*"),!0}isIframeLikeElementCenter(t,n,r,i){return t&&!n.altKey&&!n.shiftKey&&!n.metaKey&&!n.ctrlKey&&(this.state.activeEmbeddable?.element!==t||this.state.activeEmbeddable?.state==="hover"||!this.state.activeEmbeddable)&&r>=t.x+t.width/3&&r<=t.x+2*t.width/3&&i>=t.y+t.height/3&&i<=t.y+2*t.height/3}renderEmbeddables(){let t=this.state.zoom.value,n=this.state.width,r=this.state.height,i=this.scene.getNonDeletedElements().filter(l=>dn(l)&&this.embedsValidationStatus.get(l.id)===!0||ha(l));return Ee(DG,{children:i.map(l=>{let{x:a,y:s}=um({sceneX:l.x,sceneY:l.y},this.state),c=IC(l,n,r,this.state,this.scene.getNonDeletedElementsMap()),m=this.initializedEmbeds.has(l.id);if(c&&!m&&this.initializedEmbeds.add(l.id),!(c||m))return null;let d;if(ha(l)){d=null;let y=(l.customData?.generationData??this.magicGenerations.get(l.id))||{status:"error",message:"No generation data",code:"ERR_NO_GENERATION_DATA"};if(y.status==="done"){let v=y.html;d={intrinsicSize:{w:l.width,h:l.height},type:"document",srcdoc:()=>v}}else if(y.status==="pending")d={intrinsicSize:{w:l.width,h:l.height},type:"document",srcdoc:()=>kC(`
|
|
21
|
+
`),i=[],l=0,a=0;for(let p of r){let d=l,h=d+p.length-1;i.push({line:p,startIndex:d,endIndex:h,lineNumber:a}),l=h+1,a++}let s=t,c=e.originalText.slice(t,t+o.length),m=[];for(let p of i){if(c==="")break;if(s>=p.startIndex&&s<=p.endIndex){let d=p.endIndex+1-s,h=p.line.slice(0,s-p.startIndex),f=c.slice(0,d);c=c.slice(d);let g=Wl(h,Ud(e),e.lineHeight);if(h===""&&(g.width=0),e.textAlign!=="left"&&p.line.length>0){let w=Wl(p.line,Ud(e),e.lineHeight),T=e.textAlign==="center"?(e.width-w.width)/2:e.width-w.width;g.width+=T}let{width:b,height:y}=Wl(f,Ud(e),e.lineHeight),v=g.width,x=p.lineNumber*g.height;m.push({offsetX:v,offsetY:x,width:b,height:y,showOnCanvas:!0}),s+=d}}return m},m9=(e,o,t,n)=>{let r=e.name??Z3(e),i=r.slice(t,t+o.length),l=r.slice(0,t),a=Ud({fontSize:Mg.nameFontSize,fontFamily:kg.Assistant}),s=e9(kg.Assistant),c=Wl(l,a,s);l===""&&(c.width=0);let m=Wl(i,a,s),p=c.width,d=-c.height-Mg.strokeWidth,h=m.width;return[{offsetX:p,offsetY:d,width:h,height:m.height,showOnCanvas:p+h<=e.width*n}]},p9=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&"),X3=$N((e,o,t)=>{if(!e||e===""){t([],null);return}let n=o.scene.getNonDeletedElements(),r=n.filter(d=>K3(d)),i=n.filter(d=>Wd(d));r.sort((d,h)=>d.y-h.y),i.sort((d,h)=>d.y-h.y);let l=[],a=new RegExp(p9(e),"gi");for(let d of r){let h=null,f=d.originalText;for(;(h=a.exec(f))!==null;){let g=V3(f,h.index,e),b=d9(d,e,h.index);b.length>0&&l.push({element:d,searchQuery:e,preview:g,index:h.index,matchedLines:b})}}let s=[];for(let d of i){let h=null,f=d.name??Z3(d);for(;(h=a.exec(f))!==null;){let g=V3(f,h.index,e),b=m9(d,e,h.index,o.state.zoom.value);b.length>0&&s.push({element:d,searchQuery:e,preview:g,index:h.index,matchedLines:b})}}let c=new Set(o.visibleElements.map(d=>d.id)),m=[...s,...l],p=m.findIndex(d=>c.has(d.element.id))??null;t(m,p)},i9);import{jsx as Un,jsxs as j3}from"react/jsx-runtime";import{createElement as E9}from"react";var q3=Tr("DefaultSidebarTrigger",e=>{let{DefaultSidebarTriggerTunnel:o}=We();return Un(o.In,{children:Un(Do.Trigger,{...e,className:"default-sidebar-trigger",name:g9.name})})});q3.displayName="DefaultSidebarTrigger";var J3=({children:e})=>{let{DefaultSidebarTabTriggersTunnel:o}=We();return Un(o.In,{children:e})};J3.displayName="DefaultTabTriggers";var Yd=Object.assign(Tr("DefaultSidebar",({children:e,className:o,onDock:t,docked:n,...r})=>{let i=he(),l=Me(),{DefaultSidebarTabTriggersTunnel:a}=We(),s=i.openSidebar?.tab===Ag;return E9(Do,{...r,name:"default",key:"default",className:h9("default-sidebar",o),docked:s||(n??i.defaultSidebarDockedPreference),onDock:s||t===!1||!t&&n!=null?void 0:f9(t,c=>{l({defaultSidebarDockedPreference:c})})},j3(Do.Tabs,{children:[Un(Do.Header,{children:j3(Do.TabTriggers,{children:[Un(Do.TabTrigger,{tab:Ag,children:bo}),Un(a.Out,{})]})}),Un(Do.Tab,{tab:Ag,children:Un($3,{})}),e]}))}),{Trigger:q3,TabTriggers:J3});import{round as YT}from"@excalidraw/math";import WB from"clsx";import YB from"lodash.throttle";import{useEffect as VT,useMemo as Vg,useState as VB,memo as XB}from"react";import{STATS_PANELS as tm}from"@excalidraw/common";import{getCommonBounds as KB}from"@excalidraw/element";import{getUncroppedWidthAndHeight as ZB}from"@excalidraw/element";import{isImageElement as Xg}from"@excalidraw/element";import{frameAndChildrenSelectedTogether as $B}from"@excalidraw/element";import{elementsAreInSameGroup as jB}from"@excalidraw/element";import{degreesToRadians as aT,radiansToDegrees as dT}from"@excalidraw/math";import{getBoundTextElement as lT}from"@excalidraw/element";import{isArrowElement as sT,isElbowArrow as A9}from"@excalidraw/element";import{updateBindings as cT}from"@excalidraw/element";import I9 from"clsx";import{useEffect as rT,useRef as Xd,useState as C9}from"react";import{EVENT as ta,KEYS as S9,cloneJSON as Lg}from"@excalidraw/common";import{deepCopyElement as k9}from"@excalidraw/element";import{CaptureUpdateAction as iT}from"@excalidraw/element";import{pointFrom as Wn,pointRotateRads as Vd}from"@excalidraw/math";import{getBoundTextElement as x9,isBindingElement as b9,unbindBindingElement as Q3}from"@excalidraw/element";import{isFrameLikeElement as oT}from"@excalidraw/element";import{getSelectedGroupIds as y9,getElementsInGroup as w9,isInGroup as v9}from"@excalidraw/element";import{getFrameChildren as T9}from"@excalidraw/element";import{updateBindings as eT}from"@excalidraw/element";import{DRAGGING_THRESHOLD as tT}from"@excalidraw/common";var nT=.01,Yl=10,Pt=(e,o)=>!(o==="angle"&&oT(e)),Ne=(e,o)=>{let t=e+o/2;return t-t%o},Qi=(e,o,t)=>Object.keys(e).map(n=>({original:(t??o).get(n),latest:o.get(n)})).filter(n=>n.original!==void 0&&n.latest!==void 0);var Ir=(e,o,t,n,r,i,l=!0)=>{if(b9(t)&&(t.startBinding||t.endBinding)){if(Math.abs(e-t.x)<tT&&Math.abs(o-t.y)<tT)return;Q3(t,"start",n),Q3(t,"end",n)}let a=n.getNonDeletedElementsMap(),s=a.get(t.id);if(!s)return;let[c,m]=[t.x+t.width/2,t.y+t.height/2],[p,d]=Vd(Wn(t.x,t.y),Wn(c,m),t.angle),h=e-p,f=o-d,[g,b]=Vd(Wn(e,o),Wn(c+h,m+f),-t.angle);n.mutateElement(s,{x:g,y:b},{informMutation:l,isDragging:!1}),eT(s,n,r);let y=x9(t,i);if(y){let v=a.get(y.id);v&&n.mutateElement(v,{x:y.x+h,y:y.y+f},{informMutation:l,isDragging:!1})}if(oT(t)){let v=T9(i,t.id);v.forEach(x=>{let w=a.get(x.id);if(!w)return;let[T,S]=[x.x+x.width/2,x.y+x.height/2],[P,M]=Vd(Wn(x.x,x.y),Wn(T,S),x.angle),_=Math.round(P+h),R=Math.round(M+f),[A,F]=Vd(Wn(_,R),Wn(T+h,S+f),-x.angle);n.mutateElement(w,{x:A,y:F},{informMutation:l,isDragging:!1}),eT(w,n,r,{simultaneouslyUpdated:v})})}},ea=(e,o)=>{let n=y9(o).map(r=>w9(e,r).reduce((i,l)=>(i[l.id]=!0,i),{}));return e.filter(r=>!v9(r)).forEach(r=>{n.push({[r.id]:!0})}),n};import{jsx as Dg,jsxs as P9}from"react/jsx-runtime";var M9=({label:e,icon:o,dragInputCallback:t,value:n,elements:r,editable:i=!0,shouldKeepAspectRatio:l,property:a,scene:s,appState:c,sensitivity:m=1,dragFinishedCallback:p})=>{let d=vt(),h=Me(),f=Xd(null),g=Xd(null),[b,y]=C9(n.toString()),v=Xd(null);v.current||(v.current={originalAppState:Lg(c),originalElements:r,lastUpdatedValue:b,updatePending:!1}),rT(()=>{let T=n.toString();y(T),v.current.lastUpdatedValue=T},[n]);let x=(T,S,P)=>{if(!v.current.updatePending)return!1;v.current.updatePending=!1;let M=Number(T);if(isNaN(M)){y(n.toString());return}let _=Number(M.toFixed(2)),R=Number(n);(isNaN(R)||Math.abs(_-R)>=nT)&&(v.current.lastUpdatedValue=T,t({accumulatedChange:0,instantChange:0,originalElements:S,originalElementsMap:d.scene.getNonDeletedElementsMap(),shouldKeepAspectRatio:l,shouldChangeByStepSize:!1,scene:s,nextValue:_,property:a,originalAppState:P,setInputValue:A=>y(String(A)),app:d,setAppState:h}),d.syncActionResult({captureUpdate:iT.IMMEDIATELY}))},w=Xd({});return w.current.handleInputValue=x,rT(()=>{let T=f.current,S=w.current;return()=>{let P=T?.value;P&&S.handleInputValue?.(P,v.current.originalElements,v.current.originalAppState),window.removeEventListener(ta.POINTER_MOVE,S.onPointerMove,!1),window.removeEventListener(ta.POINTER_UP,S.onPointerUp,!1)}},[i]),i?P9("div",{className:I9("drag-input-container",!i&&"disabled"),"data-testid":e,children:[Dg("div",{className:"drag-input-label",ref:g,onPointerDown:T=>{if(f.current&&i){document.body.classList.add("excalidraw-cursor-resize");let S=Number(f.current.value);isNaN(S)&&(S=0);let P=null,M=d.scene.getNonDeletedElements().reduce((z,Z)=>(z.set(Z.id,k9(Z)),z),new Map),_=r.map(z=>M.get(z.id)),R=Lg(c),A=0,F=0,U=z=>{if(P&&M!==null&&_!==null){let Z=z.clientX-P.x;Z!==0&&(F+=Z,Math.abs(F)>=m&&(F=Math.sign(F)*Math.floor(Math.abs(F)/m),A+=F,t({accumulatedChange:A,instantChange:F,originalElements:_,originalElementsMap:M,shouldKeepAspectRatio:l,shouldChangeByStepSize:z.shiftKey,property:a,scene:s,originalAppState:R,setInputValue:ae=>y(String(ae)),app:d,setAppState:h}),F=0))}P={x:z.clientX,y:z.clientY}},j=()=>{window.removeEventListener(ta.POINTER_MOVE,U,!1),d.syncActionResult({captureUpdate:iT.IMMEDIATELY}),p?.({app:d,setAppState:h,originalElements:_,originalAppState:R}),P=null,A=0,F=0,_=null,M=null,document.body.classList.remove("excalidraw-cursor-resize"),window.removeEventListener(ta.POINTER_UP,j,!1)};w.current.onPointerMove=U,w.current.onPointerUp=j,window.addEventListener(ta.POINTER_MOVE,U,!1),window.addEventListener(ta.POINTER_UP,j,!1)}},onPointerEnter:()=>{g.current&&(g.current.style.cursor="ew-resize")},children:o?Dg(lc,{icon:o}):e}),Dg("input",{className:"drag-input",autoComplete:"off",spellCheck:"false",onKeyDown:T=>{if(i){let S=T.target;S instanceof HTMLInputElement&&T.key===S9.ENTER&&(x(S.value,r,c),d.focusContainer())}},ref:f,value:b,onChange:T=>{v.current.updatePending=!0,y(T.target.value)},onFocus:T=>{T.target.select(),v.current.originalElements=r,v.current.originalAppState=Lg(c)},onBlur:T=>{b?i&&x(T.target.value,v.current.originalElements,v.current.originalAppState):y(n.toString())},disabled:!i})]}):null},ot=M9;import{jsx as R9}from"react/jsx-runtime";var L9=15,D9=({accumulatedChange:e,originalElements:o,shouldChangeByStepSize:t,nextValue:n,scene:r,app:i})=>{let l=r.getNonDeletedElementsMap(),a=o[0];if(a&&!A9(a)){let s=l.get(a.id);if(!s)return;if(n!==void 0){let f=aT(n);r.mutateElement(s,{angle:f}),cT(s,r,i.state);let g=lT(s,l);g&&!sT(s)&&r.mutateElement(g,{angle:f});return}let c=Math.round(dT(a.angle)*100)/100,m=Math.round(e),p=(c+m)%360;t&&(p=Ne(p,L9)),p=p<0?p+360:p;let d=aT(p);r.mutateElement(s,{angle:d}),cT(s,r,i.state);let h=lT(s,l);h&&!sT(s)&&r.mutateElement(h,{angle:d})}},_9=({element:e,scene:o,appState:t,property:n})=>R9(ot,{label:"A",icon:Ns,value:Math.round(dT(e.angle)%360*100)/100,elements:[e],dragInputCallback:D9,editable:Pt(e,"angle"),scene:o,appState:t,property:n}),mT=_9;import{jsx as B9}from"react/jsx-runtime";var pT=5,N9=({property:e,scene:o,appState:t,setAppState:n})=>B9(ot,{label:"Grid step",sensitivity:8,elements:[],dragInputCallback:({nextValue:r,instantChange:i,shouldChangeByStepSize:l,setInputValue:a})=>{n(s=>{let c;return r?c=r:i&&(c=l?Ne(s.gridStep+pT*Math.sign(i),pT):s.gridStep+i),c?(c=g1(c),a(c),{gridStep:c}):(a(s.gridStep),null)})},scene:o,value:t.gridStep,property:e,appState:t}),uT=N9;import{clamp as Kd,round as _g}from"@excalidraw/math";import{MIN_WIDTH_OR_HEIGHT as Zd}from"@excalidraw/common";import{MINIMAL_CROP_SIZE as hT,getUncroppedWidthAndHeight as ET}from"@excalidraw/element";import{resizeSingleElement as gT}from"@excalidraw/element";import{isImageElement as xT}from"@excalidraw/element";import{isFrameLikeElement as Rg}from"@excalidraw/element";import{getElementsInResizingFrame as Ng}from"@excalidraw/element";import{replaceAllElementsInFrame as bT}from"@excalidraw/element";import{jsx as G9}from"react/jsx-runtime";var fT=10,F9=e=>e.type==="image",O9=({accumulatedChange:e,originalElements:o,originalElementsMap:t,shouldKeepAspectRatio:n,shouldChangeByStepSize:r,nextValue:i,property:l,originalAppState:a,instantChange:s,scene:c,app:m,setAppState:p})=>{let d=c.getNonDeletedElementsMap(),h=o[0],f=d.get(h.id);if(h&&f){let g=n||F9(h),b=h.width/h.height;if(a.croppingElementId===h.id){let y=d.get(h.id);if(!y||!xT(y)||!y.crop)return;let v=y.crop,x={...v},w=y.scale[0]===-1,T=y.scale[1]===-1,{width:S,height:P}=ET(y),M=v.naturalWidth/S,_=v.naturalHeight/P,R=w?v.width+v.x:v.naturalWidth-v.x,A=T?v.height+v.y:v.naturalHeight-v.y,F=hT*M,U=hT*_;if(i!==void 0){if(l==="width"){let oe=i*M,ce=Kd(oe,F,R);x={...x,width:ce,x:w?v.x+v.width-ce:v.x}}else if(l==="height"){let oe=i*_,ce=Kd(oe,U,A);x={...x,height:ce,y:T?v.y+v.height-ce:v.y}}c.mutateElement(y,{crop:x,width:x.width/(v.naturalWidth/S),height:x.height/(v.naturalHeight/P)});return}let j=l==="width"?s:0,z=l==="height"?s:0,Z=Kd(v.width+j,F,R),ae=Kd(v.height+z,F,A);x={...v,x:w?v.x+v.width-Z:v.x,y:T?v.y+v.height-ae:v.y,width:Z,height:ae},c.mutateElement(y,{crop:x,width:x.width/(v.naturalWidth/S),height:x.height/(v.naturalHeight/P)});return}if(i!==void 0){let y=Math.max(l==="width"?i:g?i*b:h.width,Zd),v=Math.max(l==="height"?i:g?i/b:h.height,Zd);if(gT(y,v,f,h,t,c,l==="width"?"e":"s",{shouldMaintainAspectRatio:g}),Rg(f)){let x=Ng(c.getElementsIncludingDeleted(),f,a,c.getNonDeletedElementsMap()),w=bT(c.getElementsIncludingDeleted(),x,f);c.replaceAllElements(w)}return}{let y=l==="width"?e:0,v=l==="height"?e:0,x=Math.max(0,h.width+y);l==="width"&&(r?x=Ne(x,fT):x=Math.round(x));let w=Math.max(0,h.height+v);if(l==="height"&&(r?w=Ne(w,fT):w=Math.round(w)),g&&(l==="width"?w=Math.round(x/b*100)/100:x=Math.round(w*b*100)/100),w=Math.max(Zd,w),x=Math.max(Zd,x),gT(x,w,f,h,t,c,l==="width"?"e":"s",{shouldMaintainAspectRatio:g}),Rg(f)){let T=Ng(c.getElementsIncludingDeleted(),f,a,c.getNonDeletedElementsMap());p({elementsToHighlight:T})}}}},z9=({setAppState:e,app:o,originalElements:t,originalAppState:n})=>{let r=o.scene.getNonDeletedElementsMap(),i=t?.[0],l=i&&r.get(i.id);if(l&&Rg(l)){let a=Ng(o.scene.getElementsIncludingDeleted(),l,n,o.scene.getNonDeletedElementsMap()),s=bT(o.scene.getElementsIncludingDeleted(),a,l);o.scene.replaceAllElements(s),e({elementsToHighlight:null})}},H9=({property:e,element:o,scene:t,appState:n})=>{let r=_g(e==="width"?o.width:o.height,2);if(n.croppingElementId&&n.croppingElementId===o.id&&xT(o)&&o.crop){let{width:i,height:l}=ET(o);if(e==="width"){let a=i/o.crop.naturalWidth;r=_g(o.crop.width*a,2)}if(e==="height"){let a=l/o.crop.naturalHeight;r=_g(o.crop.height*a,2)}}return G9(ot,{label:e==="width"?"W":"H",elements:[o],dragInputCallback:O9,value:r,editable:Pt(o,e),scene:t,appState:n,property:e,dragFinishedCallback:z9})},Bg=H9;import{getBoundTextElement as U9,redrawTextBoundingBox as W9}from"@excalidraw/element";import{hasBoundTextElement as Y9,isTextElement as wT}from"@excalidraw/element";import{jsx as Z9}from"react/jsx-runtime";var yT=4,V9=4,X9=({accumulatedChange:e,originalElements:o,shouldChangeByStepSize:t,nextValue:n,scene:r})=>{let i=r.getNonDeletedElementsMap(),l=o[0];if(l){let a=i.get(l.id);if(!a||!wT(a))return;let s;if(n!==void 0)s=Math.max(Math.round(n),yT);else if(l.type==="text"){let c=Math.round(l.fontSize),m=Math.round(e);s=Math.max(c+m,yT),t&&(s=Ne(s,V9))}s&&(r.mutateElement(a,{fontSize:s}),W9(a,r.getContainerElement(a),r))}},K9=({element:e,scene:o,appState:t,property:n})=>{let r=wT(e)?e:Y9(e)?U9(e,o.getNonDeletedElementsMap()):null;return r?Z9(ot,{label:"F",value:Math.round(r.fontSize*10)/10,elements:[r],dragInputCallback:X9,icon:ar,appState:t,scene:o,property:n}):null},vT=K9;import{degreesToRadians as TT,radiansToDegrees as ST}from"@excalidraw/math";import{getBoundTextElement as IT}from"@excalidraw/element";import{isArrowElement as CT}from"@excalidraw/element";import{isInGroup as Fg}from"@excalidraw/element";import{jsx as J9}from"react/jsx-runtime";var $9=15,j9=({accumulatedChange:e,originalElements:o,shouldChangeByStepSize:t,nextValue:n,property:r,scene:i})=>{let l=i.getNonDeletedElementsMap(),a=o.map(c=>l.get(c.id)).filter(c=>c&&!Fg(c)&&Pt(c,r)),s=o.filter(c=>!Fg(c)&&Pt(c,r));if(n!==void 0){let c=TT(n);for(let m of a){if(!m)continue;i.mutateElement(m,{angle:c});let p=IT(m,l);p&&!CT(m)&&i.mutateElement(p,{angle:c})}i.triggerUpdate();return}for(let c=0;c<a.length;c++){let m=a[c];if(!m)continue;let p=s[c],d=Math.round(ST(p.angle)*100)/100,h=Math.round(e),f=(d+h)%360;t&&(f=Ne(f,$9)),f=f<0?f+360:f;let g=TT(f);i.mutateElement(m,{angle:g});let b=IT(m,l);b&&!CT(m)&&i.mutateElement(b,{angle:g})}i.triggerUpdate()},q9=({elements:e,scene:o,appState:t,property:n})=>{let r=e.filter(s=>!Fg(s)&&Pt(s,"angle")),i=r.map(s=>Math.round(ST(s.angle)%360*100)/100),l=new Set(i).size===1?i[0]:"Mixed",a=r.some(s=>Pt(s,"angle"));return J9(ot,{label:"A",icon:Ns,value:l,elements:e,dragInputCallback:j9,editable:a,appState:t,scene:o,property:n})},kT=q9;import{pointFrom as _T}from"@excalidraw/math";import{useMemo as mB}from"react";import{MIN_WIDTH_OR_HEIGHT as Yn}from"@excalidraw/common";import{getElementsInResizingFrame as zg,isFrameLikeElement as Hg,replaceAllElementsInFrame as BT,updateBoundElements as pB}from"@excalidraw/element";import{rescalePointsInElement as uB,resizeSingleElement as RT}from"@excalidraw/element";import{getBoundTextElement as hB,handleBindTextResize as gB}from"@excalidraw/element";import{isTextElement as FT}from"@excalidraw/element";import{MIME_TYPES as Cr}from"@excalidraw/common";var $d=({elements:e,appState:o,files:t,maxWidthOrHeight:n,getDimensions:r,exportPadding:i,exportingFrame:l})=>{let a=nr(e,null,{deleteInvisibleElements:!0}),s=Fr(o,null),{exportBackground:c,viewBackgroundColor:m}=s;return xs(a,{...s,offsetTop:0,offsetLeft:0,width:0,height:0},t||{},{exportBackground:c,exportPadding:i,viewBackgroundColor:m,exportingFrame:l},(p,d)=>{let h=document.createElement("canvas");if(n){typeof r=="function"&&console.warn("`getDimensions()` is ignored when `maxWidthOrHeight` is supplied.");let g=Math.max(p,d),b=n<g?n/g:o?.exportScale??1;return h.width=p*b,h.height=d*b,{canvas:h,scale:b}}let f=r?.(p,d)||{width:p,height:d};return h.width=f.width,h.height=f.height,{canvas:h,scale:f.scale??1}})},MT=async e=>{let{mimeType:o=Cr.png,quality:t}=e;o===Cr.png&&typeof t=="number"&&console.warn(`"quality" will be ignored for "${Cr.png}" mimeType`),o==="image/jpg"&&(o=Cr.jpg),o===Cr.jpg&&!e.appState?.exportBackground&&(console.warn(`Defaulting "exportBackground" to "true" for "${Cr.jpg}" mimeType`),e={...e,appState:{...e.appState,exportBackground:!0}});let n=await $d(e);return t=t||(/image\/jpe?g/.test(o)?.92:.8),new Promise((r,i)=>{n.toBlob(async l=>{if(!l)return i(new Error("couldn't export to blob"));l&&o===Cr.png&&e.appState?.exportEmbedScene&&(l=await I1({blob:l,metadata:Ia(e.elements,e.appState,e.files||{},"local")})),r(l)},o,t)})},PT=async({elements:e,appState:o=gn(),files:t={},exportPadding:n,renderEmbeddables:r,exportingFrame:i,skipInliningFonts:l,reuseImages:a})=>{let s=nr(e,null,{deleteInvisibleElements:!0}),m={...Fr(o,null),exportPadding:n};return or(s,m,t,{exportingFrame:i,renderEmbeddables:r,skipInliningFonts:l,reuseImages:a})},Q9=async e=>{if(e.type==="svg"){let o=await PT(e);await ao(o.outerHTML)}else if(e.type==="png")await Sc(MT(e));else if(e.type==="json")await Ic(e.elements,e.files);else throw new Error("Invalid export type")};import{arrayToMap as eB}from"@excalidraw/common";import{getElementBounds as tB}from"@excalidraw/element";import{isArrowElement as oB,isExcalidrawElement as nB,isFreeDrawElement as rB,isLinearElement as iB,isTextElement as aB}from"@excalidraw/element";import{rangeIncludesValue as jd,pointFrom as ln,pointRotateRads as lB,rangeInclusive as qd}from"@excalidraw/math";var sB=e=>e.type==="diamond"?[ln(e.width/2,0),ln(e.width,e.height/2),ln(e.width/2,e.height),ln(0,e.height/2)]:[ln(0,0),ln(0+e.width,0),ln(0+e.width,e.height),ln(0,e.height)],cB=e=>iB(e)||rB(e)?e.points:sB(e),AT=e=>{let o=e.reduce((t,[n,r])=>(t.minY=Math.min(t.minY,r),t.minX=Math.min(t.minX,n),t.maxX=Math.max(t.maxX,n),t.maxY=Math.max(t.maxY,r),t),{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,cx:0,cy:0});return o.cx=(o.maxX+o.minX)/2,o.cy=(o.maxY+o.minY)/2,o},LT=e=>{let o=cB(e),{cx:t,cy:n}=AT(o),r=ln(t,n),i=o.map(m=>lB(m,r,e.angle)),{minX:l,minY:a,maxX:s,maxY:c}=AT(i);return[l+e.x,a+e.y,s+e.x,c+e.y]},Og=(e,o,t=!1)=>{let n=LT(e),r=o[0]<=n[0]&&o[2]>=n[2]&&o[1]<=n[1]&&o[3]>=n[3];return t?r?!0:n[0]<=o[0]&&n[2]>=o[2]&&n[1]<=o[1]&&n[3]>=o[3]:r},DT=(e,o)=>{let t=LT(e);return(jd(t[0],qd(o[0],o[2]))||jd(o[0],qd(t[0],t[2])))&&(jd(t[1],qd(o[1],o[3]))||jd(o[1],qd(t[1],t[3])))},dB=({elements:e,bounds:o,type:t,errorMargin:n=0})=>{nB(o)&&(o=tB(o,eB(e)));let r=[o[0]-n,o[1]-n,o[2]+n,o[3]+n],i=new Set;for(let l of e){if(i.has(l.id))continue;if(t==="overlap"?DT(l,r):t==="inside"?Og(l,r):Og(l,r,!0)){if(i.add(l.id),l.boundElements)for(let s of l.boundElements)i.add(s.id);aB(l)&&l.containerId&&i.add(l.containerId),oB(l)&&(l.startBinding&&i.add(l.startBinding.elementId),l.endBinding&&i.add(l.endBinding?.elementId))}}return e.filter(l=>i.has(l.id))};import{getCommonBounds as Jd}from"@excalidraw/element";import{jsx as wB}from"react/jsx-runtime";var oa=10,fB=(e,o,t,n)=>{let r=n.x-e,i=n.y-o,l=n.width*t,a=n.height*t,s=e+r*t,c=o+i*t;return{width:l,height:a,x:s,y:c,...uB(n,l,a,!1),...FT(n)?{fontSize:n.fontSize*t}:{}}},EB=(e,o,t,n,r,i,l,a)=>{let s=a.getNonDeletedElementsMap(),c=fB(e,o,n,i);a.mutateElement(r,c);let m=hB(i,l);if(m){let p=m.fontSize*n;pB(r,a);let d=s.get(m.id);d&&FT(d)&&(a.mutateElement(d,{fontSize:p}),gB(r,a,t==="width"?"e":"s",!0))}},NT=(e,o,t,n,r,i,l,a,s,c)=>{i==="width"?o=Math.round(e/n*100)/100:e=Math.round(o*n*100)/100;let m=o/t;for(let p=0;p<a.length;p++){let d=a[p],h=l[p];EB(r[0],r[1],i,m,h,d,s,c)}},xB=({accumulatedChange:e,originalElements:o,originalElementsMap:t,originalAppState:n,shouldChangeByStepSize:r,nextValue:i,scene:l,property:a,setAppState:s,app:c})=>{let m=l.getNonDeletedElementsMap(),p=ea(o,n);if(i!==void 0){for(let g of p){let b=Qi(g,m,t);if(b.length>1){let y=b.map(F=>F.latest),v=b.map(F=>F.original),[x,w,T,S]=Jd(v),P=T-x,M=S-w,_=P/M,R=Math.max(Yn,a==="width"?Math.max(0,i):P),A=Math.max(Yn,a==="height"?Math.max(0,i):M);NT(R,A,M,_,_T(x,w),a,y,v,t,l)}else{let[y]=b,v=y?.latest,x=y?.original;if(v&&x&&Pt(v,a)){let w=a==="width"?Math.max(0,i):v.width;a==="width"&&(r?w=Ne(w,oa):w=Math.round(w));let T=a==="height"?Math.max(0,i):v.height;if(a==="height"&&(r?T=Ne(T,oa):T=Math.round(T)),w=Math.max(Yn,w),T=Math.max(Yn,T),RT(w,T,v,x,t,l,a==="width"?"e":"s",{shouldInformMutation:!1}),Hg(v)){let S=zg(l.getElementsIncludingDeleted(),v,n,l.getNonDeletedElementsMap()),P=BT(l.getElementsIncludingDeleted(),S,v);l.replaceAllElements(P)}}}}l.triggerUpdate();return}let d=a==="width"?e:0,h=a==="height"?e:0,f=[];for(let g of p){let b=Qi(g,m,t);if(b.length>1){let y=b.map(F=>F.latest),v=b.map(F=>F.original),[x,w,T,S]=Jd(v),P=T-x,M=S-w,_=P/M,R=Math.max(0,P+d);a==="width"&&(r?R=Ne(R,oa):R=Math.round(R));let A=Math.max(0,M+h);a==="height"&&(r?A=Ne(A,oa):A=Math.round(A)),R=Math.max(Yn,R),A=Math.max(Yn,A),NT(R,A,M,_,_T(x,w),a,y,v,t,l)}else{let[y]=b,v=y?.latest,x=y?.original;if(v&&x&&Pt(v,a)){let w=Math.max(0,x.width+d);a==="width"&&(r?w=Ne(w,oa):w=Math.round(w));let T=Math.max(0,x.height+h);if(a==="height"&&(r?T=Ne(T,oa):T=Math.round(T)),w=Math.max(Yn,w),T=Math.max(Yn,T),RT(w,T,v,x,t,l,a==="width"?"e":"s",{shouldInformMutation:!1}),Hg(v)){let S=zg(l.getElementsIncludingDeleted(),v,n,l.getNonDeletedElementsMap());f.push(...S)}}}}s({elementsToHighlight:f}),l.triggerUpdate()},bB=({setAppState:e,app:o,originalElements:t,originalAppState:n})=>{let r=o.scene.getNonDeletedElementsMap(),i=t?.[0],l=i&&r.get(i.id);if(l&&Hg(l)){let a=zg(o.scene.getElementsIncludingDeleted(),l,n,o.scene.getNonDeletedElementsMap()),s=BT(o.scene.getElementsIncludingDeleted(),a,l);o.scene.replaceAllElements(s),e({elementsToHighlight:null})}},yB=({property:e,elements:o,elementsMap:t,atomicUnits:n,scene:r,appState:i})=>{let l=mB(()=>n.map(c=>{let m=Qi(c,t);if(m.length>1){let[d,h,f,g]=Jd(m.map(b=>b.latest));return Math.round((e==="width"?f-d:g-h)*100)/100}let[p]=m;return Math.round((e==="width"?p.latest.width:p.latest.height)*100)/100}),[t,n,e]),a=new Set(l).size===1?Math.round(l[0]*100)/100:"Mixed",s=l.length>0;return wB(ot,{label:e==="width"?"W":"H",elements:o,dragInputCallback:xB,value:a,editable:s,appState:i,property:e,scene:r,dragFinishedCallback:bB})},Gg=yB;import{getBoundTextElement as vB,redrawTextBoundingBox as OT}from"@excalidraw/element";import{hasBoundTextElement as TB,isTextElement as IB}from"@excalidraw/element";import{isInGroup as CB}from"@excalidraw/element";import{jsx as AB}from"react/jsx-runtime";var zT=4,SB=4,kB=(e,o)=>e.reduce((t,n)=>{if(!n||CB(n))return t;if(IB(n))return t.push(n),t;if(TB(n)){let r=vB(n,o);if(r)return t.push(r),t}return t},[]),MB=({accumulatedChange:e,originalElements:o,shouldChangeByStepSize:t,nextValue:n,scene:r})=>{let i=r.getNonDeletedElementsMap(),l=o.map(s=>i.get(s.id)),a;if(n){a=Math.max(Math.round(n),zT);for(let s of l)r.mutateElement(s,{fontSize:a}),OT(s,r.getContainerElement(s),r);r.triggerUpdate()}else{let s=o;for(let c=0;c<l.length;c++){let m=l[c],p=s[c],d=Math.round(p.fontSize),h=Math.round(e),f=Math.max(d+h,zT);t&&(f=Ne(f,SB)),r.mutateElement(m,{fontSize:f}),OT(m,r.getContainerElement(m),r)}r.triggerUpdate()}},PB=({elements:e,scene:o,appState:t,property:n,elementsMap:r})=>{let i=kB(e,r);if(!i.length)return null;let l=i.map(c=>Math.round(c.fontSize*10)/10),a=new Set(l).size===1?l[0]:"Mixed",s=l.length>0;return AB(ot,{label:"F",icon:ar,elements:i,dragInputCallback:MB,value:a,editable:s,scene:o,property:n,appState:t})},HT=PB;import{pointFrom as Vn,pointRotateRads as Qd}from"@excalidraw/math";import{useMemo as LB}from"react";import{isTextElement as DB}from"@excalidraw/element";import{getCommonBounds as Ug}from"@excalidraw/element";import{jsx as FB}from"react/jsx-runtime";var _B=(e,o,t,n,r,i,l)=>{for(let a=0;a<n.length;a++){let s=n[a],[c,m]=[s.x+s.width/2,s.y+s.height/2],[p,d]=Qd(Vn(s.x,s.y),Vn(c,m),s.angle),h=e==="x"?Math.round(p+o):p,f=e==="y"?Math.round(d+t):d;Ir(h,f,s,i,l,r,!1)}},RB=(e,o,t,n,r,i)=>{let l=r.getNonDeletedElementsMap(),[a,s,,]=Ug(t),c=e-a,m=o-s;for(let p=0;p<t.length;p++){let d=t[p],h=l.get(d.id);if(h&&(!DB(h)||!h.containerId)){let[f,g]=[h.x+h.width/2,h.y+h.height/2],[b,y]=Qd(Vn(h.x,h.y),Vn(f,g),h.angle);Ir(b+c,y+m,d,r,i,n,!1)}}},NB=({accumulatedChange:e,originalElements:o,originalElementsMap:t,shouldChangeByStepSize:n,nextValue:r,property:i,scene:l,originalAppState:a,app:s})=>{let c=l.getNonDeletedElementsMap();if(r!==void 0){for(let h of ea(o,a)){let f=Qi(h,c,t);if(f.length>1){let[g,b,,]=Ug(f.map(x=>x.latest));RB(i==="x"?r:g,i==="y"?r:b,f.map(x=>x.original),t,l,s.state)}else{let g=f[0]?.original,b=f[0]?.latest;if(g&&b&&Pt(b,i)){let[y,v]=[g.x+g.width/2,g.y+g.height/2],[x,w]=Qd(Vn(g.x,g.y),Vn(y,v),g.angle);Ir(i==="x"?r:x,i==="y"?r:w,g,l,s.state,t,!1)}}}l.triggerUpdate();return}let m=n?Ne(e,Yl):e;_B(i,i==="x"?m:0,i==="y"?m:0,o,t,l,s.state),l.triggerUpdate()},BB=({property:e,elements:o,elementsMap:t,atomicUnits:n,scene:r,appState:i})=>{let l=LB(()=>n.map(s=>{let c=Object.keys(s).map(g=>t.get(g)).filter(g=>g!==void 0);if(c.length>1){let[g,b]=Ug(c);return Math.round((e==="x"?g:b)*100)/100}let[m]=c,[p,d]=[m.x+m.width/2,m.y+m.height/2],[h,f]=Qd(Vn(m.x,m.y),Vn(p,d),m.angle);return Math.round((e==="x"?h:f)*100)/100}),[n,t,e]),a=new Set(l).size===1?l[0]:"Mixed";return FB(ot,{label:e==="x"?"X":"Y",elements:o,dragInputCallback:NB,value:a,property:e,scene:r,appState:i})},Wg=BB;import{clamp as Vl,pointFrom as em,pointRotateRads as UT,round as GT}from"@excalidraw/math";import{getFlipAdjustedCropPosition as OB,getUncroppedWidthAndHeight as zB}from"@excalidraw/element";import{isImageElement as WT}from"@excalidraw/element";import{jsx as UB}from"react/jsx-runtime";var HB=({accumulatedChange:e,instantChange:o,originalElements:t,originalElementsMap:n,shouldChangeByStepSize:r,nextValue:i,property:l,scene:a,originalAppState:s,app:c})=>{let m=a.getNonDeletedElementsMap(),p=t[0],[d,h]=[p.x+p.width/2,p.y+p.height/2],[f,g]=UT(em(p.x,p.y),em(d,h),p.angle);if(s.croppingElementId===p.id){let w=m.get(p.id);if(!w||!WT(w)||!w.crop)return;let T=w.crop,S=T,P=w.scale[0]===-1,M=w.scale[1]===-1,{width:_,height:R}=zB(w);if(i!==void 0){if(l==="x"){let U=i*(T.naturalWidth/_);P?S={...T,x:Vl(T.naturalWidth-U-T.width,0,T.naturalWidth-T.width)}:S={...T,x:Vl(i*(T.naturalWidth/_),0,T.naturalWidth-T.width)}}l==="y"&&(S={...T,y:Vl(i*(T.naturalHeight/R),0,T.naturalHeight-T.height)}),a.mutateElement(w,{crop:S});return}let A=(l==="x"?o:0)*(P?-1:1),F=(l==="y"?o:0)*(M?-1:1);S={...T,x:Vl(T.x+A,0,T.naturalWidth-T.width),y:Vl(T.y+F,0,T.naturalHeight-T.height)},a.mutateElement(w,{crop:S});return}if(i!==void 0){Ir(l==="x"?i:f,l==="y"?i:g,p,a,c.state,n);return}let b=l==="x"?e:0,y=l==="y"?e:0,v=l==="x"?Math.round(r?Ne(p.x+b,Yl):f+b):f,x=l==="y"?Math.round(r?Ne(p.y+y,Yl):g+y):g;Ir(v,x,p,a,c.state,n)},GB=({property:e,element:o,elementsMap:t,scene:n,appState:r})=>{let[i,l]=UT(em(o.x,o.y),em(o.x+o.width/2,o.y+o.height/2),o.angle),a=GT(e==="x"?i:l,2);if(r.croppingElementId===o.id&&WT(o)&&o.crop){let s=OB(o);s&&(a=GT(e==="x"?s.x:s.y,2))}return UB(ot,{label:e==="x"?"X":"Y",elements:[o],dragInputCallback:HB,scene:n,value:a,property:e,appState:r})},Yg=GB;import{Fragment as Kg,jsx as ee,jsxs as At}from"react/jsx-runtime";var qB=50,Xl=e=>{let o=yo(),t=e.app.scene.getSceneNonce()||1,n=e.app.scene.getSelectedElements({selectedElementIds:o.selectedElementIds,includeBoundTextElement:!1}),r=Rn(e.app);return ee(JB,{...e,appState:o,sceneNonce:t,selectedElements:n,gridModeEnabled:r})},Ae=({children:e,columns:o=1,heading:t,style:n,...r})=>ee("div",{className:WB("exc-stats__row",{"exc-stats__row--heading":t}),style:{gridTemplateColumns:`repeat(${o}, 1fr)`,...n},...r,children:e});Ae.displayName="StatsRow";var om=({children:e,order:o,style:t,...n})=>ee("div",{className:"exc-stats__rows",style:{order:o,...t},...n,children:e});om.displayName="StatsRows";Xl.StatsRow=Ae;Xl.StatsRows=om;var JB=XB(({app:e,onClose:o,renderCustomStats:t,selectedElements:n,appState:r,sceneNonce:i,gridModeEnabled:l})=>{let a=e.scene,s=a.getNonDeletedElements(),c=a.getNonDeletedElementsMap(),m=Me(),p=n.length===1?n[0]:null,d=n.length>1?n:null,h=r.croppingElementId&&Xg(p),f=h?ZB(p):null,[g,b]=VB({width:0,height:0}),y=Vg(()=>YB(w=>{let T=KB(w);b({width:Math.round(T[2])-Math.round(T[0]),height:Math.round(T[3])-Math.round(T[1])})},qB),[]);VT(()=>{y(s)},[i,s,y]),VT(()=>()=>y.cancel(),[y]);let v=Vg(()=>ea(n,r),[n,r]),x=Vg(()=>$B(n),[n]);return ee("div",{className:"exc-stats",children:At(Oe,{padding:3,children:[At("div",{className:"title",children:[ee("h2",{children:E("stats.title")}),ee("div",{className:"close",onClick:o,children:xo})]}),At($a,{label:ee("h3",{children:E("stats.generalStats")}),open:!!(r.stats.panels&tm.generalStats),openTrigger:()=>m(w=>({stats:{open:!0,panels:w.stats.panels^tm.generalStats}})),children:[At(om,{children:[ee(Ae,{heading:!0,children:E("stats.scene")}),At(Ae,{columns:2,children:[ee("div",{children:E("stats.shapes")}),ee("div",{children:s.length})]}),At(Ae,{columns:2,children:[ee("div",{children:E("stats.width")}),ee("div",{children:g.width})]}),At(Ae,{columns:2,children:[ee("div",{children:E("stats.height")}),ee("div",{children:g.height})]}),l&&At(Kg,{children:[ee(Ae,{heading:!0,children:"Canvas"}),ee(Ae,{children:ee(uT,{property:"gridStep",scene:a,appState:r,setAppState:m})})]})]}),t?.(s,r)]}),!x&&n.length>0&&ee("div",{id:"elementStats",style:{marginTop:12},children:ee($a,{label:ee("h3",{children:E("stats.elementProperties")}),open:!!(r.stats.panels&tm.elementProperties),openTrigger:()=>m(w=>({stats:{open:!0,panels:w.stats.panels^tm.elementProperties}})),children:At(om,{children:[p&&At(Kg,{children:[h&&ee(Ae,{heading:!0,children:E("labels.unCroppedDimension")}),r.croppingElementId&&Xg(p)&&f&&At(Ae,{columns:2,children:[ee("div",{children:E("stats.width")}),ee("div",{children:YT(f.width,2)})]}),r.croppingElementId&&Xg(p)&&f&&At(Ae,{columns:2,children:[ee("div",{children:E("stats.height")}),ee("div",{children:YT(f.height,2)})]}),ee(Ae,{heading:!0,"data-testid":"stats-element-type",style:{margin:"0.3125rem 0"},children:r.croppingElementId?E("labels.imageCropping"):E(`element.${p.type}`)}),ee(Ae,{children:ee(Yg,{element:p,property:"x",elementsMap:c,scene:a,appState:r})}),ee(Ae,{children:ee(Yg,{element:p,property:"y",elementsMap:c,scene:a,appState:r})}),ee(Ae,{children:ee(Bg,{property:"width",element:p,scene:a,appState:r})}),ee(Ae,{children:ee(Bg,{property:"height",element:p,scene:a,appState:r})}),ee(Ae,{children:ee(mT,{property:"angle",element:p,scene:a,appState:r})}),ee(Ae,{children:ee(vT,{property:"fontSize",element:p,scene:a,appState:r})})]}),d&&At(Kg,{children:[jB(d)&&ee(Ae,{heading:!0,children:E("element.group")}),At(Ae,{columns:2,style:{margin:"0.3125rem 0"},children:[ee("div",{children:E("stats.shapes")}),ee("div",{children:n.length})]}),ee(Ae,{children:ee(Wg,{property:"x",elements:d,elementsMap:c,atomicUnits:v,scene:a,appState:r})}),ee(Ae,{children:ee(Wg,{property:"y",elements:d,elementsMap:c,atomicUnits:v,scene:a,appState:r})}),ee(Ae,{children:ee(Gg,{property:"width",elements:d,elementsMap:c,atomicUnits:v,scene:a,appState:r})}),ee(Ae,{children:ee(Gg,{property:"height",elements:d,elementsMap:c,atomicUnits:v,scene:a,appState:r})}),ee(Ae,{children:ee(kT,{property:"angle",elements:d,scene:a,appState:r})}),ee(Ae,{children:ee(HT,{property:"fontSize",elements:d,scene:a,appState:r,elementsMap:c})})]})]})})})]})})},(e,o)=>e.sceneNonce===o.sceneNonce&&e.selectedElements===o.selectedElements&&e.appState.stats.panels===o.appState.stats.panels&&e.gridModeEnabled===o.gridModeEnabled&&e.appState.gridStep===o.appState.gridStep&&e.appState.croppingElementId===o.appState.croppingElementId);import{useCallback as oF,useEffect as XT,useState as KT}from"react";import{normalizeLink as nF,KEYS as $g}from"@excalidraw/common";import{defaultGetElementLinkFromSelection as rF,getLinkIdAndTypeFromSelection as iF}from"@excalidraw/element";import QB from"clsx";import{jsx as nm,jsxs as tF}from"react/jsx-runtime";var eF=({label:e,onClick:o,className:t,children:n,actionType:r,type:i="button",isLoading:l,...a})=>{let s=r?`Dialog__action-button--${r}`:"";return tF("button",{className:QB("Dialog__action-button",s,t),type:i,"aria-label":e,onClick:o,...a,children:[n&&nm("div",{style:l?{visibility:"hidden"}:{},children:n}),nm("div",{style:l?{visibility:"hidden"}:{},children:e}),l&&nm("div",{style:{position:"absolute",inset:0},children:nm(Yo,{})})]})},Zg=eF;import{jsx as na,jsxs as rm}from"react/jsx-runtime";var aF=({sourceElementId:e,onClose:o,appState:t,scene:n,generateLinkForSelection:r=rF})=>{let i=n.getNonDeletedElementsMap(),l=i.get(e)?.link??null,[a,s]=KT(l),[c,m]=KT(!1);XT(()=>{let d=te(i,t),h=l;if(d.length>0&&r){let f=iF(d,t);f&&(h=nF(r(f.id,f.type)))}s(h)},[i,t,t.selectedElementIds,l,r]);let p=oF(()=>{if(a&&a!==i.get(e)?.link){let d=i.get(e);d&&n.mutateElement(d,{link:a})}if(!a&&c&&e){let d=i.get(e);d&&n.mutateElement(d,{link:null})}o?.()},[e,a,i,c,n,o]);return XT(()=>{let d=h=>{t.openDialog?.name==="elementLinkSelector"&&h.key===$g.ENTER&&p(),t.openDialog?.name==="elementLinkSelector"&&h.key===$g.ESCAPE&&o?.()};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}},[t,o,p]),rm("div",{className:"ElementLinkDialog",children:[rm("div",{className:"ElementLinkDialog__header",children:[na("h2",{children:E("elementLink.title")}),na("p",{children:E("elementLink.desc")})]}),rm("div",{className:"ElementLinkDialog__input",children:[na(Gd,{value:a??"",onChange:d=>{c||m(!0),s(d)},onKeyDown:d=>{d.key===$g.ENTER&&p()},className:"ElementLinkDialog__input-field",selectOnRender:!0}),l&&a&&na(V,{type:"button",title:E("buttons.remove"),"aria-label":E("buttons.remove"),label:E("buttons.remove"),onClick:()=>{s(null),m(!0)},className:"ElementLinkDialog__remove",icon:ir})]}),rm("div",{className:"ElementLinkDialog__actions",children:[na(Zg,{label:E("buttons.cancel"),onClick:()=>{o?.()},style:{marginRight:10}}),na(Zg,{label:E("buttons.confirm"),onClick:p,actionType:"primary"})]})]})},ZT=aF;import lF,{useState as sF}from"react";import{Fragment as cF,jsx as jg}from"react/jsx-runtime";var $T=({children:e,onClose:o})=>{let[t,n]=sF(!!e),{container:r}=_e(),i=lF.useCallback(()=>{n(!1),o&&o(),r?.focus()},[o,r]);return jg(cF,{children:t&&jg(qt,{size:"small",onCloseRequest:i,title:E("errorDialog.title"),children:jg("div",{style:{whiteSpace:"pre-wrap"},children:e})})})};import dF from"clsx";import{jsx as mF}from"react/jsx-runtime";var jT=({children:e,side:o,className:t})=>mF("div",{className:dF("FixedSideContainer",`FixedSideContainer_side_${o}`,t),children:e});import qT,{useMemo as bF}from"react";import JT from"clsx";import{isDarwin as QT,isFirefox as yF,isWindows as wF}from"@excalidraw/common";import{KEYS as kr}from"@excalidraw/common";import{SHAPES as vF}from"@excalidraw/element/shapes";import{isFirefox as pF,KEYS as qg}from"@excalidraw/common";import{SHAPES as uF}from"@excalidraw/element/shapes";import{Fragment as xF,jsx as Be,jsxs as Sr}from"react/jsx-runtime";var hF=e=>Sr(xF,{children:[Be("h3",{children:e.title}),Be("div",{className:"HelpDialog__islands-container",children:e.children})]}),Jg=e=>Sr("div",{className:`HelpDialog__island ${e.className}`,children:[Be("h4",{className:"HelpDialog__island-title",children:e.caption}),Be("div",{className:"HelpDialog__island-content",children:e.children})]});function*gF(e,o){let t=!0;for(let n of e)t||(yield o),t=!1,yield n}var fF=e=>e.replace(/\b[a-z]\b/,o=>o.toUpperCase()),it=({label:e,shortcuts:o,isOr:t=!0})=>{let n=o.map(r=>(r.endsWith("++")?[...r.slice(0,-2).split("+"),"+"]:r.split("+")).map(l=>Be(EF,{children:fF(l)},l)));return Sr("div",{className:"HelpDialog__shortcut",children:[Be("div",{children:e}),Be("div",{className:"HelpDialog__key-container",children:[...gF(n,t?E("helpDialog.or"):null)]})]})},EF=e=>Be("kbd",{className:"HelpDialog__key",...e});function Qg(){return Sr(hF,{title:E("helpDialog.shortcuts"),children:[Sr(Jg,{className:"HelpDialog__island--tools",caption:E("helpDialog.tools"),children:[Be(it,{label:E("toolBar.hand"),shortcuts:[qg.H]}),uF.filter(({myocSimplifiedMode:e})=>e).map(({value:e,key:o})=>Be(it,{label:E(`toolBar.${e}`),shortcuts:[...o]},e)),Be(it,{label:E("helpDialog.cropStart"),shortcuts:[E("helpDialog.doubleClick"),L("Enter")],isOr:!0}),Be(it,{label:E("helpDialog.cropFinish"),shortcuts:[L("Enter"),L("Escape")],isOr:!0})]}),Sr(Jg,{className:"HelpDialog__island--view",caption:E("helpDialog.view"),children:[Be(it,{label:E("helpDialog.smartZoom"),shortcuts:[qg.F]}),Be(it,{label:E("helpDialog.dragToZoom"),shortcuts:[`${qg.Z}+${E("helpDialog.drag")}`]}),Be(it,{label:E("buttons.objectsSnapMode"),shortcuts:[L("Alt+S")]})]}),Sr(Jg,{className:"HelpDialog__island--editor",caption:E("helpDialog.editor"),children:[Be(it,{label:E("labels.pasteAsPlaintext"),shortcuts:[L("CtrlOrCmd+Shift+V")]}),Be(it,{label:E("labels.multiSelect"),shortcuts:[L(`Shift+${E("helpDialog.click")}`)]}),Be(it,{label:E("helpDialog.deepSelect"),shortcuts:[L(`CtrlOrCmd+${E("helpDialog.click")}`)]}),Be(it,{label:E("helpDialog.deepBoxSelect"),shortcuts:[L(`CtrlOrCmd+${E("helpDialog.drag")}`)]}),(Pn||pF)&&Be(it,{label:E("labels.copyAsPng"),shortcuts:[L("Shift+Alt+C")]}),Be(it,{label:E("helpDialog.toggleElementLock"),shortcuts:[L("CtrlOrCmd+Shift+L")]}),Be(it,{label:E("labels.group"),shortcuts:[L("CtrlOrCmd+G")]}),Be(it,{label:E("labels.ungroup"),shortcuts:[L("CtrlOrCmd+Shift+G")]}),Be(it,{label:E("labels.flipHorizontal"),shortcuts:[L("Shift+H")]}),Be(it,{label:E("labels.flipVertical"),shortcuts:[L("Shift+V")]})]})]})}import{Fragment as tI,jsx as W,jsxs as Mr}from"react/jsx-runtime";var TF=e=>Mr(tI,{children:[W("h3",{children:e.title}),W("div",{className:"HelpDialog__islands-container",children:e.children})]}),ef=e=>Mr("div",{className:`HelpDialog__island ${e.className}`,children:[W("h4",{className:"HelpDialog__island-title",children:e.caption}),W("div",{className:"HelpDialog__island-content",children:e.children})]});function*IF(e,o){let t=!0;for(let n of e)t||(yield o),t=!1,yield n}var CF=e=>e.replace(/\b[a-z]\b/,o=>o.toUpperCase()),K=({label:e,shortcuts:o,isOr:t=!0})=>{let n=o.map(r=>(r.endsWith("++")?[...r.slice(0,-2).split("+"),"+"]:r.split("+")).map(l=>W(SF,{children:CF(l)},l)));return Mr("div",{className:"HelpDialog__shortcut",children:[W("div",{children:e}),W("div",{className:"HelpDialog__key-container",children:[...IF(n,t?E("helpDialog.or"):null)]})]})},SF=e=>W("kbd",{className:"HelpDialog__key",...e}),eI=({onClose:e})=>{let[o,t]=qT.useState(!1),n=qT.useCallback(()=>{e&&e()},[e]),r=bF(()=>o?W("button",{className:JT("toggle-button",{}),onClick:()=>t(!1),children:E("helpDialog.myoc.showingAll")}):W("button",{className:JT("toggle-button",{}),onClick:()=>t(!0),children:E("helpDialog.myoc.showingBasic")}),[o]);return W(tI,{children:W(qt,{onCloseRequest:n,title:E("helpDialog.title"),className:"HelpDialog",titleButton:r,portalContainerClassName:"HelpDialog__modalContainer",children:o?Mr(TF,{title:E("helpDialog.shortcuts"),children:[Mr(ef,{className:"HelpDialog__island--tools",caption:E("helpDialog.tools"),children:[W(K,{label:E("toolBar.hand"),shortcuts:[kr.H]}),vF.map(({value:i,key:l})=>W(K,{label:E(`toolBar.${i}`),shortcuts:[...l]},i)),W(K,{label:E("toolBar.frame"),shortcuts:[kr.F]}),W(K,{label:E("toolBar.laser"),shortcuts:[kr.K]}),W(K,{label:E("labels.eyeDropper"),shortcuts:[kr.I,"Shift+S","Shift+G"]}),W(K,{label:E("helpDialog.editLineArrowPoints"),shortcuts:[L("CtrlOrCmd+Enter")]}),W(K,{label:E("helpDialog.editText"),shortcuts:[L("Enter")]}),W(K,{label:E("helpDialog.textNewLine"),shortcuts:[L("Enter"),L("Shift+Enter")]}),W(K,{label:E("helpDialog.textFinish"),shortcuts:[L("Esc"),L("CtrlOrCmd+Enter")]}),W(K,{label:E("helpDialog.curvedArrow"),shortcuts:["A",E("helpDialog.click"),E("helpDialog.click"),E("helpDialog.click")],isOr:!1}),W(K,{label:E("helpDialog.curvedLine"),shortcuts:["L",E("helpDialog.click"),E("helpDialog.click"),E("helpDialog.click")],isOr:!1}),W(K,{label:E("helpDialog.cropStart"),shortcuts:[E("helpDialog.doubleClick"),L("Enter")],isOr:!0}),W(K,{label:E("helpDialog.cropFinish"),shortcuts:[L("Enter"),L("Escape")],isOr:!0}),W(K,{label:E("toolBar.lock"),shortcuts:[kr.Q]}),W(K,{label:E("helpDialog.preventBinding"),shortcuts:[L("CtrlOrCmd")]}),W(K,{label:E("toolBar.link"),shortcuts:[L("CtrlOrCmd+K")]}),W(K,{label:E("toolBar.convertElementType"),shortcuts:["Tab","Shift+Tab"],isOr:!0})]}),Mr(ef,{className:"HelpDialog__island--view",caption:E("helpDialog.view"),children:[W(K,{label:E("helpDialog.smartZoom"),shortcuts:[kr.F]}),W(K,{label:E("helpDialog.dragToZoom"),shortcuts:[`${kr.Z}+${E("helpDialog.drag")}`]}),W(K,{label:E("buttons.zoomIn"),shortcuts:[L("CtrlOrCmd++")]}),W(K,{label:E("buttons.zoomOut"),shortcuts:[L("CtrlOrCmd+-")]}),W(K,{label:E("buttons.resetZoom"),shortcuts:[L("CtrlOrCmd+0")]}),W(K,{label:E("helpDialog.zoomToSelection"),shortcuts:["Shift+2"]}),W(K,{label:E("helpDialog.movePageUpDown"),shortcuts:["PgUp/PgDn"]}),W(K,{label:E("helpDialog.movePageLeftRight"),shortcuts:["Shift+PgUp/PgDn"]}),W(K,{label:E("buttons.objectsSnapMode"),shortcuts:[L("Alt+S")]}),W(K,{label:E("labels.toggleGrid"),shortcuts:[L("CtrlOrCmd+'")]}),W(K,{label:E("labels.viewMode"),shortcuts:[L("Alt+R")]}),W(K,{label:E("stats.fullTitle"),shortcuts:[L("Alt+/")]}),W(K,{label:E("search.title"),shortcuts:[Ue("searchMenu")]})]}),Mr(ef,{className:"HelpDialog__island--editor",caption:E("helpDialog.editor"),children:[W(K,{label:E("labels.moveCanvas"),shortcuts:[L(`Space+${E("helpDialog.drag")}`),L(`Wheel+${E("helpDialog.drag")}`)],isOr:!0}),W(K,{label:E("labels.delete"),shortcuts:[L("Delete")]}),W(K,{label:E("labels.cut"),shortcuts:[L("CtrlOrCmd+X")]}),W(K,{label:E("labels.copy"),shortcuts:[L("CtrlOrCmd+C")]}),W(K,{label:E("labels.paste"),shortcuts:[L("CtrlOrCmd+V")]}),W(K,{label:E("labels.pasteAsPlaintext"),shortcuts:[L("CtrlOrCmd+Shift+V")]}),W(K,{label:E("labels.selectAll"),shortcuts:[L("CtrlOrCmd+A")]}),W(K,{label:E("labels.multiSelect"),shortcuts:[L(`Shift+${E("helpDialog.click")}`)]}),W(K,{label:E("helpDialog.deepSelect"),shortcuts:[L(`CtrlOrCmd+${E("helpDialog.click")}`)]}),W(K,{label:E("helpDialog.deepBoxSelect"),shortcuts:[L(`CtrlOrCmd+${E("helpDialog.drag")}`)]}),(Pn||yF)&&W(K,{label:E("labels.copyAsPng"),shortcuts:[L("Shift+Alt+C")]}),W(K,{label:E("labels.sendToBack"),shortcuts:[QT?L("CtrlOrCmd+Alt+["):L("CtrlOrCmd+Shift+[")]}),W(K,{label:E("labels.bringToFront"),shortcuts:[QT?L("CtrlOrCmd+Alt+]"):L("CtrlOrCmd+Shift+]")]}),W(K,{label:E("labels.sendBackward"),shortcuts:[L("CtrlOrCmd+[")]}),W(K,{label:E("labels.bringForward"),shortcuts:[L("CtrlOrCmd+]")]}),W(K,{label:E("labels.alignTop"),shortcuts:[L("CtrlOrCmd+Shift+Up")]}),W(K,{label:E("labels.alignBottom"),shortcuts:[L("CtrlOrCmd+Shift+Down")]}),W(K,{label:E("labels.alignLeft"),shortcuts:[L("CtrlOrCmd+Shift+Left")]}),W(K,{label:E("labels.alignRight"),shortcuts:[L("CtrlOrCmd+Shift+Right")]}),W(K,{label:E("labels.arrangeElements"),shortcuts:[L("Shift+R")]}),W(K,{label:E("labels.duplicateSelection"),shortcuts:[L("CtrlOrCmd+D"),L(`Alt+${E("helpDialog.drag")}`)]}),W(K,{label:E("helpDialog.toggleElementLock"),shortcuts:[L("CtrlOrCmd+Shift+L")]}),W(K,{label:E("buttons.undo"),shortcuts:[L("CtrlOrCmd+Z")]}),W(K,{label:E("buttons.redo"),shortcuts:wF?[L("CtrlOrCmd+Y"),L("CtrlOrCmd+Shift+Z")]:[L("CtrlOrCmd+Shift+Z")]}),W(K,{label:E("labels.group"),shortcuts:[L("CtrlOrCmd+G")]}),W(K,{label:E("labels.ungroup"),shortcuts:[L("CtrlOrCmd+Shift+G")]}),W(K,{label:E("labels.flipHorizontal"),shortcuts:[L("Shift+H")]}),W(K,{label:E("labels.flipVertical"),shortcuts:[L("Shift+V")]}),W(K,{label:E("labels.showStroke"),shortcuts:[L("S")]}),W(K,{label:E("labels.showBackground"),shortcuts:[L("G")]}),W(K,{label:E("labels.showFonts"),shortcuts:[L("Shift+F")]}),W(K,{label:E("labels.decreaseFontSize"),shortcuts:[L("CtrlOrCmd+Shift+<")]}),W(K,{label:E("labels.increaseFontSize"),shortcuts:[L("CtrlOrCmd+Shift+>")]})]})]}):W(Qg,{})})})};import{CANVAS_SEARCH_TAB as kF,DEFAULT_SIDEBAR as MF}from"@excalidraw/common";import{isFlowchartNodeElement as PF,isImageElement as oI,isLinearElement as nI,isLineElement as AF,isTextBindableContainer as LF,isTextElement as DF}from"@excalidraw/element";import{isNodeInFlowchart as _F}from"@excalidraw/element";import{jsx as tf}from"react/jsx-runtime";var be=e=>Array.isArray(e)?`<kbd>${e.map(L).join(" + ")}</kbd>`:`<kbd>${L(e)}</kbd>`,RF=({appState:e,isMobile:o,editorInterface:t,app:n})=>{let{activeTool:r,isResizing:i,isRotating:l,lastPointerDownWith:a}=e,s=e.multiElement!==null;if(e.openSidebar?.name===MF.name&&e.openSidebar.tab===kF&&e.searchMatches?.matches.length)return E("hints.dismissSearch",{shortcut:be("Escape")});if(e.openSidebar&&!t.canFitSidebar)return null;if(wt(e))return E("hints.eraserRevert",{shortcut:be("Alt")});let c=n.scene.getSelectedElements(e);if(e.selectedLinearElement?.isDragging&&c[0]?.type==="arrow")return E("hints.arrowBindModifiers",{shortcut_1:be("Ctrl"),shortcut_2:be("Alt")});if(r.type==="arrow"||r.type==="line")return s?E("hints.linearElementMulti",{shortcut_1:be("Escape"),shortcut_2:be("Enter")}):r.type==="arrow"?E("hints.arrowTool",{shortcut:be("A")}):E("hints.linearElement");if(r.type==="freedraw")return E("hints.freeDraw");if(r.type==="text")return E("hints.text");if(r.type==="embeddable")return E("hints.embeddable");if(i&&a==="mouse"&&c.length===1){let m=c[0];return nI(m)&&m.points.length===2?E("hints.lockAngle",{shortcut:be("Shift")}):oI(m)?E("hints.resizeImage",{shortcut_1:be("Shift"),shortcut_2:be("Alt")}):E("hints.resize",{shortcut_1:be("Shift"),shortcut_2:be("Alt")})}if(l&&a==="mouse")return E("hints.rotate",{shortcut:be("Shift")});if(c.length===1&&DF(c[0]))return E("hints.text_selected",{shortcut:be("Enter")});if(e.editingTextElement)return E("hints.text_editing",{shortcut_1:be("Escape"),shortcut_2:be(["CtrlOrCmd","Enter"])});if(e.croppingElementId)return E("hints.leaveCropEditor",{shortcut_1:be("Enter"),shortcut_2:be("Escape")});if(c.length===1&&oI(c[0]))return E("hints.enterCropEditor",{shortcut:be("Enter")});if(r.type==="selection"){if(e.selectionElement&&!c.length&&!e.editingTextElement&&!e.selectedLinearElement?.isEditing)return E("hints.deepBoxSelect",{shortcut:be("CtrlOrCmd")});if(Rn(n)&&e.selectedElementsAreBeingDragged)return E("hints.disableSnapping",{shortcut:be("CtrlOrCmd")});if(!c.length&&!o)return E("hints.canvasPanning",{shortcut_1:be(E("keys.mmb")),shortcut_2:be("Space")});if(c.length===1){if(nI(c[0]))return e.selectedLinearElement?.isEditing?e.selectedLinearElement.selectedPointsIndices?E("hints.lineEditor_pointSelected",{shortcut_1:be("Delete"),shortcut_2:be(["CtrlOrCmd","D"])}):E("hints.lineEditor_nothingSelected",{shortcut_1:be("Shift"),shortcut_2:be("Alt")}):AF(c[0])?E("hints.lineEditor_line_info",{shortcut:be("Enter")}):E("hints.lineEditor_info",{shortcut_1:be("CtrlOrCmd"),shortcut_2:be(["CtrlOrCmd","Enter"])});if(!e.newElement&&!e.selectedElementsAreBeingDragged&&LF(c[0])){let m=E("hints.bindTextToElement",{shortcut:be("Enter")}),p=E("hints.createFlowchart",{shortcut:be(["CtrlOrCmd","\u2191\u2193"])});return PF(c[0])?_F(c[0],n.scene.getNonDeletedElementsMap())?[m,p]:[m,p]:m}}}return null},rI=({appState:e,isMobile:o,editorInterface:t,app:n})=>{let r=RF({appState:e,isMobile:o,editorInterface:t,app:n});if(!r)return null;let l=(Array.isArray(r)?r.map(a=>a.replace(/\. ?$/,"")).join(", "):r).split(/(<kbd>[^<]+<\/kbd>)/g).map((a,s)=>{if(s%2===1){let c=a[0]==="<"&&a.match(/^<kbd>([^<]+)<\/kbd>$/);return tf("kbd",{children:c?c[1]:a},s)}return a});return tf("div",{className:"HintViewer",children:tf("span",{children:l})})};import{useEffect as lI,useRef as sI,useState as Pr}from"react";import{DEFAULT_EXPORT_PADDING as HF,EXPORT_IMAGE_TYPES as of,isFirefox as GF,EXPORT_SCALES as UF,cloneJSON as cI}from"@excalidraw/common";import{useCallback as NF,useRef as BF,useState as FF}from"react";var OF=2e3,iI=()=>{let[e,o]=FF(null),t=BF(0),n=()=>{clearTimeout(t.current),o("success"),t.current=window.setTimeout(()=>{o(null)},OF)},r=NF(()=>{o(null)},[]);return{copyStatus:e,resetCopyStatus:r,onCopy:n}};import zF from"clsx";import{jsx as aI}from"react/jsx-runtime";var Kl=({title:e,name:o,checked:t,onChange:n,disabled:r=!1})=>aI("div",{className:zF("Switch",{toggled:t,disabled:r}),children:aI("input",{name:o,id:o,title:e,type:"checkbox",checked:t,disabled:r,onChange:()=>n(!t),onKeyDown:i=>{i.key===" "&&n(!t)}})});import{jsx as Le,jsxs as Xn}from"react/jsx-runtime";var WF=()=>Xn("div",{children:[Le("h3",{children:E("canvasError.cannotShowPreview")}),Le("p",{children:Le("span",{children:E("canvasError.canvasTooBig")})}),Xn("em",{children:["(",E("canvasError.canvasTooBigTip"),")"]})]}),YF=({appStateSnapshot:e,elementsSnapshot:o,files:t,actionManager:n,onExportImage:r,name:i,exportWithDarkMode:l})=>{let a=we(o,e),[s,c]=Pr(i),[m,p]=Pr(a),[d,h]=Pr(e.exportBackground),[f,g]=Pr(e.exportEmbedScene),[b,y]=Pr(e.exportScale),v=sI(null),x=sI(0),[w,T]=Pr(null),{onCopy:S,copyStatus:P,resetCopyStatus:M}=iI();lI(()=>{M()},[s,d,l,b,f,M]);let{exportedElements:_,exportingFrame:R}=cr(o,e,m);return lI(()=>{let A=v.current;if(!A)return;let F=A.offsetWidth,U=A.offsetHeight;if(!F)return;let j=++x.current,z=()=>j!==x.current;return $d({elements:_,appState:{...e,name:s,exportBackground:d,exportWithDarkMode:l,exportScale:b,exportEmbedScene:f},files:t,exportPadding:HF,maxWidthOrHeight:Math.max(F,U),exportingFrame:R}).then(async Z=>{if(!z()){try{await Ma(Z)}catch(ae){throw ae.name==="CANVAS_POSSIBLY_TOO_BIG"?new Error(E("canvasError.canvasTooBig")):ae}z()||(T(null),A.replaceChildren(Z))}}).catch(Z=>{z()||(console.error(Z),T(Z))}),()=>{x.current+=1}},[e,t,_,R,s,d,l,b,f]),Xn("div",{className:"ImageExportModal",children:[Le("h3",{children:E("imageExportDialog.header")}),Xn("div",{className:"ImageExportModal__preview",children:[Le("div",{className:"ImageExportModal__preview__canvas",ref:v,children:w&&Le(WF,{})}),Le("div",{className:"ImageExportModal__preview__filename",children:!Br&&Le("input",{type:"text",className:"TextInput",value:s,style:{width:"30ch"},onChange:A=>{c(A.target.value),n.executeAction(ru,"ui",A.target.value)}})})]}),Xn("div",{className:"ImageExportModal__settings",children:[Le("h3",{children:E("imageExportDialog.header")}),a&&Le(Zl,{label:E("imageExportDialog.label.onlySelected"),name:"exportOnlySelected",children:Le(Kl,{name:"exportOnlySelected",checked:m,onChange:A=>{p(A)}})}),Le(Zl,{label:E("imageExportDialog.label.withBackground"),name:"exportBackgroundSwitch",children:Le(Kl,{name:"exportBackgroundSwitch",checked:d,onChange:A=>{h(A),n.executeAction(iu,"ui",A)}})}),Le(Zl,{label:E("imageExportDialog.label.darkMode"),name:"exportDarkModeSwitch",children:Le(Kl,{name:"exportDarkModeSwitch",checked:l,onChange:A=>{n.executeAction(fb,"ui",A)}})}),Le(Zl,{label:E("imageExportDialog.label.embedScene"),tooltip:E("imageExportDialog.tooltip.embedScene"),name:"exportEmbedSwitch",children:Le(Kl,{name:"exportEmbedSwitch",checked:f,onChange:A=>{g(A),n.executeAction(Mc,"ui",A)}})}),Le(Zl,{label:E("imageExportDialog.label.scale"),name:"exportScale",children:Le(Bd,{name:"exportScale",value:b,onChange:A=>{y(A),n.executeAction(hb,"ui",A)},choices:UF.map(A=>({value:A,label:`${A}\xD7`}))})}),Xn("div",{className:"ImageExportModal__settings__buttons",children:[Le(Hn,{className:"ImageExportModal__settings__buttons__button",label:E("imageExportDialog.title.exportToPng"),onClick:()=>r(of.png,_,{exportingFrame:R}),icon:Jm,children:E("imageExportDialog.button.exportToPng")}),Le(Hn,{className:"ImageExportModal__settings__buttons__button",label:E("imageExportDialog.title.exportToSvg"),onClick:()=>r(of.svg,_,{exportingFrame:R}),icon:Jm,children:E("imageExportDialog.button.exportToSvg")}),(Pn||GF)&&Le(Hn,{className:"ImageExportModal__settings__buttons__button",label:E("imageExportDialog.title.copyPngToClipboard"),status:P,onClick:async()=>{await r(of.clipboard,_,{exportingFrame:R}),S()},icon:Ur,children:E("imageExportDialog.button.copyPngToClipboard")})]})]})]})},Zl=({label:e,children:o,tooltip:t,name:n})=>Xn("div",{className:"ImageExportModal__settings__setting",title:e,children:[Xn("label",{htmlFor:n,className:"ImageExportModal__settings__setting__label",children:[e,t&&Le(st,{label:t,long:!0,children:t0})]}),Le("div",{className:"ImageExportModal__settings__setting__content",children:o})]}),dI=({elements:e,appState:o,files:t,actionManager:n,onExportImage:r,onCloseRequest:i,name:l})=>{let[{appStateSnapshot:a,elementsSnapshot:s}]=Pr(()=>({appStateSnapshot:cI(o),elementsSnapshot:cI(e)}));return Le(qt,{onCloseRequest:i,size:"wide",title:!1,children:Le(YF,{elementsSnapshot:s,appStateSnapshot:a,files:t,actionManager:n,onExportImage:r,name:l,exportWithDarkMode:o.exportWithDarkMode})})};import XF from"react";import{getFrame as KF}from"@excalidraw/common";import{jsx as VF}from"react/jsx-runtime";var nf={primary:{base:"var(--color-primary)",darker:"var(--color-primary-darker)",darkest:"var(--color-primary-darkest)"},lime:{base:"#74b816",darker:"#66a80f",darkest:"#5c940d"},pink:{base:"#d6336c",darker:"#c2255c",darkest:"#a61e4d"}},rf=({children:e,color:o})=>VF("div",{className:"Card",style:{"--card-color":nf[o].base,"--card-color-darker":nf[o].darker,"--card-color-darkest":nf[o].darkest},children:e});import{Fragment as $F,jsx as go,jsxs as im}from"react/jsx-runtime";var ZF=({elements:e,appState:o,setAppState:t,files:n,actionManager:r,exportOpts:i,canvas:l,onCloseRequest:a})=>{let{onExportToBackend:s}=i;return go("div",{className:"ExportDialog ExportDialog--json",children:im("div",{className:"ExportDialog-cards",children:[i.saveFileToDisk&&im(rf,{color:"lime",children:[go("div",{className:"Card-icon",children:lE}),go("h2",{children:E("exportDialog.disk_title")}),im("div",{className:"Card-details",children:[E("exportDialog.disk_details"),!Br&&r.renderAction("changeProjectName")]}),go(V,{className:"Card-button",type:"button",title:E("exportDialog.disk_button"),"aria-label":E("exportDialog.disk_button"),showAriaLabel:!0,onClick:()=>{r.executeAction(nl,"ui")}})]}),s&&im(rf,{color:"pink",children:[go("div",{className:"Card-icon",children:Ra}),go("h2",{children:E("exportDialog.link_title")}),go("div",{className:"Card-details",children:E("exportDialog.link_details")}),go(V,{className:"Card-button",type:"button",title:E("exportDialog.link_button"),"aria-label":E("exportDialog.link_button"),showAriaLabel:!0,onClick:async()=>{try{de("export","link",`ui (${KF()})`),await s(e,o,n),a()}catch(c){t({errorMessage:c.message})}}})]}),i.renderCustomUI&&i.renderCustomUI(e,o,n,l)]})})},mI=({elements:e,appState:o,files:t,actionManager:n,exportOpts:r,canvas:i,setAppState:l})=>{let a=XF.useCallback(()=>{l({openDialog:null})},[l]);return go($F,{children:o.openDialog?.name==="jsonExport"&&go(qt,{onCloseRequest:a,title:E("buttons.export"),children:go(ZF,{elements:e,appState:o,setAppState:l,files:t,actionManager:n,onCloseRequest:a,exportOpts:r,canvas:i})})})};import jF from"clsx";import{jsx as pI,jsxs as JF}from"react/jsx-runtime";var qF="small",uI=e=>JF("label",{className:jF("ToolIcon ToolIcon__LaserPointer",`ToolIcon_size_${qF}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[pI("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":"toolbar-LaserPointer"}),pI("div",{className:"ToolIcon__icon",children:Yr})]});import{Fragment as lf,jsx as $,jsxs as xt}from"react/jsx-runtime";var aO=({UIOptions:e})=>xt(Et,{__fallback:!0,children:[$(Et.DefaultItems.LoadScene,{}),$(Et.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&$(Et.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&$(Et.DefaultItems.SaveAsImage,{}),$(Et.DefaultItems.SearchMenu,{}),$(Et.DefaultItems.Help,{}),$(Et.Separator,{}),$(Et.Group,{title:"Excalidraw links",children:$(Et.DefaultItems.Socials,{})}),$(Et.Separator,{}),$(Et.DefaultItems.ToggleTheme,{}),$(Et.DefaultItems.ChangeCanvasBackground,{})]}),lO=()=>xt(Hd,{__fallback:!0,children:[$(Hd.Actions.SaveToDisk,{}),$(Hd.Actions.ExportToImage,{})]}),sO=({actionManager:e,appState:o,files:t,setAppState:n,elements:r,canvas:i,onLockToggle:l,onHandToolToggle:a,onPenModeToggle:s,showExitZenModeBtn:c,renderTopLeftUI:m,renderTopRightUI:p,renderCustomStats:d,UIOptions:h,onExportImage:f,renderWelcomeScreen:g,children:b,app:y,isCollaborating:v,generateLinkForSelection:x})=>{let w=me(),S=et()==="compact",P=Xw(),M=S?{menuTopGap:4,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:.5,islandPadding:1,collabMarginLeft:8}:{menuTopGap:6,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:1,islandPadding:1,collabMarginLeft:8},_=P.tunnelsJotai.Provider,[R,A]=He(wn),F=()=>h.canvasActions.export?$(mI,{elements:r,appState:o,files:t,actionManager:e,exportOpts:h.canvasActions.export,canvas:i,setAppState:n}):null,U=()=>!h.canvasActions.saveAsImage||o.openDialog?.name!=="imageExport"?null:$(dI,{elements:r,appState:o,files:t,actionManager:e,onExportImage:f,onCloseRequest:()=>n({openDialog:null}),name:y.getName()}),j=()=>xt("div",{style:{position:"relative"},children:[$(P.MainMenuTunnel.Out,{}),g&&$(P.WelcomeScreenMenuHintTunnel.Out,{})]}),z=()=>{let re=S;return $(Fl,{heading:"selectedShapeActions",className:Kn("selected-shape-actions zen-mode-transition",{"transition-left":o.zenModeEnabled}),children:re?$(Oe,{className:Kn("compact-shape-actions-island"),padding:0,style:{maxHeight:`${o.height-166}px`},children:$(Av,{appState:o,elementsMap:y.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:y,setAppState:n})}):$(Oe,{className:eO.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${o.height-166}px`},children:$(Cv,{appState:o,elementsMap:y.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:y})})})},Z=()=>{let re=rO(o,r),B=e.isActionEnabled(so),H=Ue("objectsSnapMode"),ue=o.stats.open&&!o.zenModeEnabled&&!o.viewModeEnabled&&o.openDialog?.name!=="elementLinkSelector";return $(jT,{side:"top",children:xt("div",{className:"App-menu App-menu_top",children:[xt(kt.Col,{gap:M.menuTopGap,className:Kn("App-menu_top__left"),children:[j(),$("div",{className:Kn("selected-shape-actions-container",{"selected-shape-actions-container--compact":S}),children:re&&z()})]}),!o.viewModeEnabled&&o.openDialog?.name!=="elementLinkSelector"&&$(Fl,{heading:"shapes",className:"shapes-section",children:xe=>xt("div",{style:{position:"relative"},children:[g&&$(P.WelcomeScreenToolbarHintTunnel.Out,{}),$(kt.Col,{gap:M.toolbarColGap,align:"start",children:xt(kt.Row,{gap:M.toolbarRowGap,className:Kn("App-toolbar-container",{"zen-mode":o.zenModeEnabled}),children:[xt(Oe,{padding:M.islandPadding,className:Kn("App-toolbar",{"zen-mode":o.zenModeEnabled,"App-toolbar--compact":S}),children:[$(rI,{appState:o,isMobile:w.formFactor==="phone",editorInterface:w,app:y}),xe,xt(kt.Row,{gap:M.toolbarInnerRowGap,children:[$(o3,{zenModeEnabled:o.zenModeEnabled,checked:o.penMode,onChange:()=>s(null),title:E("toolBar.penMode"),penDetected:o.penDetected}),$(Md,{checked:ro(o),onChange:a,title:E("toolBar.hand")}),$(Dv,{setAppState:n,activeTool:o.activeTool,UIOptions:h,app:y}),B&&xt(lf,{children:[$("div",{className:"App-toolbar__divider"}),$(V,{className:Kn("Shape","App-toolbar__snap-mode-button",{active:o.objectsSnapModeEnabled}),type:"button",icon:Vr,title:`${E("buttons.objectsSnapMode")} (${H})`,"aria-label":E("buttons.objectsSnapMode"),"aria-keyshortcuts":H,"data-testid":"toolbar-objects-snap-mode",onClick:()=>{e.executeAction(so,"ui")}})]})]})]}),v&&$(Oe,{style:{marginLeft:M.collabMarginLeft,alignSelf:"center",height:"fit-content"},children:$(uI,{title:E("toolBar.laser"),checked:o.activeTool.type===hI.laser,onChange:()=>y.setActiveTool({type:hI.laser}),isMobile:!0})})]})})]})}),xt("div",{className:Kn("layer-ui__wrapper__top-right zen-mode-transition",{"transition-right":o.zenModeEnabled,"layer-ui__wrapper__top-right--compact":S}),children:[o.collaborators.size>0&&$(Rd,{collaborators:o.collaborators,userToFollow:o.userToFollow?.socketId||null}),p?.(w.formFactor==="phone",o),!o.viewModeEnabled&&o.openDialog?.name!=="elementLinkSelector"&&(!oe||o.openSidebar?.name!==af.name)&&$(P.DefaultSidebarTriggerTunnel.Out,{}),ue&&$(Xl,{app:y,onClose:()=>{e.executeAction(Ln)},renderCustomStats:d})]})]})})},ae=()=>$(Yd,{__fallback:!0,onDock:re=>{de("sidebar",`toggleDock (${re?"dock":"undock"})`,`(${w.formFactor==="phone"?"mobile":"desktop"})`)}}),oe=ys(zl),ce=xt(lf,{children:[b,$(aO,{UIOptions:h}),$(Yd.Trigger,{__fallback:!0,icon:I0,title:oO(E("search.title")),onToggle:re=>{re&&de("sidebar",`${af.name} (open)`,`button (${w.formFactor==="phone"?"mobile":"desktop"})`)},tab:af.defaultTab}),$(lO,{}),o.isLoading&&$(kd,{delay:250}),o.errorMessage&&$($T,{onClose:()=>n({errorMessage:null}),children:o.errorMessage}),R&&w.formFactor!=="phone"&&$(G0,{colorPickerType:R.colorPickerType,onCancel:()=>{A(null)},onChange:(re,B,H,{altKey:ue})=>{if(!(re!=="elementBackground"&&re!=="elementStroke"))if(H.length){for(let xe of H)nO(xe,tO(r),{[ue&&R.swapPreviewOnAlt?re==="elementBackground"?"strokeColor":"backgroundColor":re==="elementBackground"?"backgroundColor":"strokeColor"]:B}),iO.delete(xe);y.scene.triggerUpdate()}else n(re==="elementBackground"?{currentItemBackgroundColor:B}:{currentItemStrokeColor:B})},onSelect:(re,B)=>{A(H=>H?.keepOpenOnAlt&&B.altKey?H:null),R?.onSelect?.(re,B)}}),o.openDialog?.name==="help"&&$(eI,{onClose:()=>{n({openDialog:null})}}),o.openDialog?.name==="elementLinkSelector"&&$(ZT,{sourceElementId:o.openDialog.sourceElementId,onClose:()=>{n({openDialog:null})},scene:y.scene,appState:o,generateLinkForSelection:x}),$(P.OverwriteConfirmDialogTunnel.Out,{}),U(),F(),o.openDialog?.name==="charts"&&$(Jv,{data:o.openDialog.data,rawText:o.openDialog.rawText,onClose:()=>n({openDialog:null})}),w.formFactor==="phone"&&$(Hv,{app:y,appState:o,elements:r,actionManager:e,renderJSONExportDialog:F,renderImageExportDialog:U,setAppState:n,onHandToolToggle:a,onPenModeToggle:s,renderTopLeftUI:m,renderTopRightUI:p,renderSidebars:ae,renderWelcomeScreen:g,UIOptions:h}),w.formFactor!=="phone"&&xt(lf,{children:[xt("div",{className:"layer-ui__wrapper",style:o.openSidebar&&oe&&w.canFitSidebar?{width:"calc(100% - var(--right-sidebar-width))"}:{},children:[g&&$(P.WelcomeScreenCenterTunnel.Out,{}),Z(),$(i3,{appState:o,actionManager:e,showExitZenModeBtn:c,renderWelcomeScreen:g}),(o.toast||o.scrolledOutside)&&xt("div",{className:"floating-status-stack",children:[o.toast&&$(mi,{message:o.toast.message,onClose:()=>n({toast:null}),duration:o.toast.duration,closable:o.toast.closable}),!o.toast&&o.scrolledOutside&&$("button",{type:"button",className:"scroll-back-to-content",onClick:()=>{n(re=>({...tr(r,re)}))},children:E("buttons.scrollBackToContent")})]})]}),ae()]})]});return $(fp.Provider,{value:o,children:$(_,{children:$(Zh.Provider,{value:P,children:ce})})})},gI=e=>{let{cursorButton:o,scrollX:t,scrollY:n,...r}=e;return r},cO=(e,o)=>{if(e.children!==o.children)return!1;let{canvas:t,appState:n,...r}=e,{canvas:i,appState:l,...a}=o;return am(gI(n),gI(l),{selectedElementIds:am,selectedGroupIds:am})&&am(r,a)},fI=QF.memo(sO,cO);import dO from"clsx";import{jsx as EI,jsxs as pO}from"react/jsx-runtime";var mO="small",sf=e=>pO("label",{className:dO("ToolIcon ToolIcon__MagicButton",`ToolIcon_size_${mO}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[EI("input",{className:"ToolIcon_type_checkbox",type:"checkbox",name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),EI("div",{className:"ToolIcon__icon",children:e.icon})]});import{useEffect as uO,useRef as hO}from"react";import{jsx as xI}from"react/jsx-runtime";var bI=({trails:e})=>{let o=hO(null);return uO(()=>{if(o.current)for(let t of e)t.start(o.current);return()=>{for(let t of e)t.stop()}},e),xI("div",{className:"SVGLayer",children:xI("svg",{ref:o})})};import tz,{useEffect as oz,useRef as BI}from"react";import{CURSOR_TYPE as FI,isShallowEqual as nz,sceneCoordsToViewportCoords as rz}from"@excalidraw/common";import{clamp as pf,pointFrom as ra,pointsEqual as wO,bezierEquation as AI,pointRotateRads as lm,pointDistance as vO}from"@excalidraw/math";import{arrayToMap as TO,BIND_MODE_TIMEOUT as $l,DEFAULT_TRANSFORM_HANDLE_SPACING as LI,FRAME_STYLE as Qt,getFeatureFlag as IO,invariant as II,THEME as Zn}from"@excalidraw/common";import{deconstructDiamondElement as uf,deconstructRectanguloidElement as DI,elementCenterPoint as ia,getDiamondBaseCorners as CO,FOCUS_POINT_SIZE as SO,getOmitSidesForEditorInterface as cf,getTransformHandles as kO,getTransformHandlesFromCoords as MO,hasBoundingBox as PO,hitElementItself as AO,isArrowElement as LO,isBindableElement as _I,isElbowArrow as aa,isFrameLikeElement as la,isImageElement as CI,isLinearElement as DO,isLineElement as _O,maxBindingDistance_simple as RO,isTextElement as NO,getActiveTextElement as BO}from"@excalidraw/element";import{LinearElementEditor as Ro}from"@excalidraw/element/linearElementEditor";import{renderSelectionElement as FO}from"@excalidraw/element";import{getElementsInGroup as hf,getSelectedGroupIds as OO,isSelectedViaGroup as zO,selectGroupsFromGivenElements as HO}from"@excalidraw/element";import{getCommonBounds as gf,getElementAbsoluteCoords as sm}from"@excalidraw/element";import{getGlobalFixedPointForBindableElement as SI,isFocusPointVisible as GO}from"@excalidraw/element";import{pointFrom as ct}from"@excalidraw/math";import{THEME as gO}from"@excalidraw/common";var fO="#ff6b6b",EO="#ff0000",yI=1,wI=2,vI=(e,o)=>{if(!o.snapLines.length)return;let t=o.theme===gO.LIGHT||o.zenModeEnabled?fO:EO,n=(o.zenModeEnabled?yI*1.5:yI)/o.zoom.value;e.save(),e.translate(o.scrollX,o.scrollY);for(let r of o.snapLines)r.type==="pointer"?(e.lineWidth=n,e.strokeStyle=t,bO(r,e,o)):r.type==="gap"?(e.lineWidth=n,e.strokeStyle=t,yO(r.points[0],r.points[1],r.direction,o,e)):r.type==="points"&&(e.lineWidth=n,e.strokeStyle=t,xO(r,e,o));e.restore()},xO=(e,o,t)=>{if(!t.zenModeEnabled){let n=e.points[0],r=e.points[e.points.length-1];Jt(n,r,o)}for(let n of e.points)TI(n,t,o)},bO=(e,o,t)=>{TI(e.points[0],t,o),t.zenModeEnabled||Jt(e.points[0],e.points[1],o)},TI=([e,o],t,n)=>{n.save();let r=(t.zenModeEnabled?wI*1.5:wI)/t.zoom.value;n.beginPath(),n.moveTo(e-r,o-r),n.lineTo(e+r,o+r),n.moveTo(e+r,o-r),n.lineTo(e-r,o+r),n.stroke(),n.restore()},Jt=(e,o,t)=>{t.beginPath(),t.lineTo(e[0],e[1]),t.lineTo(o[0],o[1]),t.stroke()},yO=(e,o,t,n,r)=>{let i=8/n.zoom.value,l=i/2,a=i/4;if(t==="horizontal"){let s=[(e[0]+o[0])/2,e[1]];n.zenModeEnabled||Jt(ct(e[0],e[1]-i),ct(e[0],e[1]+i),r),Jt(ct(s[0]-a,s[1]-l),ct(s[0]-a,s[1]+l),r),Jt(ct(s[0]+a,s[1]-l),ct(s[0]+a,s[1]+l),r),n.zenModeEnabled||(Jt(ct(o[0],o[1]-i),ct(o[0],o[1]+i),r),Jt(e,o,r))}else{let s=[e[0],(e[1]+o[1])/2];n.zenModeEnabled||Jt(ct(e[0]-i,e[1]),ct(e[0]+i,e[1]),r),Jt(ct(s[0]-l,s[1]-a),ct(s[0]+l,s[1]-a),r),Jt(ct(s[0]-l,s[1]+a),ct(s[0]+l,s[1]+a),r),n.zenModeEnabled||(Jt(ct(o[0]-i,o[1]),ct(o[0]+i,o[1]),r),Jt(e,o,r))}};var UO=(e,o)=>{II(o.selectedLinearElement,"selectedLinearElement is null");let{segmentMidPointHoveredCoords:t}=o.selectedLinearElement;II(t,"midPointCoords is null"),e.save(),e.translate(o.scrollX,o.scrollY),ff(t,e,o),e.restore()},WO=(e,o,t)=>{let{elementId:n,hoverPointIndex:r}=o.selectedLinearElement;if(o.selectedLinearElement?.isEditing&&o.selectedLinearElement?.selectedPointsIndices?.includes(r)||o.selectedLinearElement?.isDragging)return;let i=Ro.getElement(n,t);if(!i)return;let l=Ro.getPointAtIndexGlobalCoordinates(i,r,t);e.save(),e.translate(o.scrollX,o.scrollY),ff(l,e,o),e.restore()},ff=(e,o,t)=>{o.fillStyle="rgba(105, 101, 219, 0.4)",Ca(o,e[0],e[1],Ro.POINT_HANDLE_SIZE/t.zoom.value,!1)},YO=(e,o,t)=>{e.save(),e.translate(o.scrollX,o.scrollY),ff(t,e,o),e.restore()},df=(e,o,t,n,r,i,l)=>{e.strokeStyle="#5e5ad8",e.setLineDash([]),e.fillStyle="rgba(255, 255, 255, 0.9)",r?e.fillStyle="rgba(134, 131, 226, 0.9)":i&&(e.fillStyle="rgba(177, 151, 252, 0.7)"),Ca(e,t[0],t[1],(l?n*(o.selectedLinearElement?.isEditing?1.5:2):n)/o.zoom.value,!i,!l||r)},VO=(e,o,t,n,r)=>{let i=o.element.frameId&&t.get(o.element.frameId);switch(i&&la(i)&&(e.translate(i.x,i.y),e.beginPath(),Qt.radius&&e.roundRect?e.roundRect(-1,-1,i.width+1,i.height+1,Qt.radius/n.zoom.value):e.rect(-1,-1,i.width+1,i.height+1),e.clip(),e.translate(-i.x,-i.y)),o.element.type){case"magicframe":case"frame":e.save(),e.translate(o.element.x,o.element.y),e.lineWidth=Qt.strokeWidth/n.zoom.value,e.strokeStyle=n.theme===Zn.DARK?"rgba(3, 93, 161, 1)":"rgba(106, 189, 252, 1)",Qt.radius&&e.roundRect?(e.beginPath(),e.roundRect(0,0,o.element.width,o.element.height,Qt.radius/n.zoom.value),e.stroke(),e.closePath()):e.strokeRect(0,0,o.element.width,o.element.height),e.restore();break;default:e.save();let l=ia(o.element,t);switch(e.translate(l[0],l[1]),e.rotate(o.element.angle),e.translate(-l[0],-l[1]),e.translate(o.element.x,o.element.y),e.lineWidth=pf(1.75,o.element.strokeWidth,4)/Math.max(.25,n.zoom.value),e.strokeStyle=n.theme===Zn.DARK?"rgba(3, 93, 161, 1)":"rgba(106, 189, 252, 1)",o.element.type){case"ellipse":e.beginPath(),e.ellipse(o.element.width/2,o.element.height/2,o.element.width/2,o.element.height/2,0,0,2*Math.PI),e.closePath(),e.stroke();break;case"diamond":{let[a,s]=uf(o.element);a.forEach(c=>{e.beginPath(),e.moveTo(c[0][0]-o.element.x,c[0][1]-o.element.y),e.lineTo(c[1][0]-o.element.x,c[1][1]-o.element.y),e.stroke()}),s.forEach(c=>{let[m,p,d,h]=c;e.beginPath(),e.moveTo(m[0]-o.element.x,m[1]-o.element.y),e.bezierCurveTo(p[0]-o.element.x,p[1]-o.element.y,d[0]-o.element.x,d[1]-o.element.y,h[0]-o.element.x,h[1]-o.element.y),e.stroke()})}break;default:{let[a,s]=DI(o.element);a.forEach(c=>{e.beginPath(),e.moveTo(c[0][0]-o.element.x,c[0][1]-o.element.y),e.lineTo(c[1][0]-o.element.x,c[1][1]-o.element.y),e.stroke()}),s.forEach(c=>{let[m,p,d,h]=c;e.beginPath(),e.moveTo(m[0]-o.element.x,m[1]-o.element.y),e.bezierCurveTo(p[0]-o.element.x,p[1]-o.element.y,d[0]-o.element.x,d[1]-o.element.y,h[0]-o.element.x,h[1]-o.element.y),e.stroke()})}break}e.restore();break}if(n.isMidpointSnappingEnabled&&(la(o.element)||_I(o.element))){let l=n.selectedLinearElement,a=l?.elementId&&Ro.getElement(l?.elementId,t),s=r&&AO({point:r,element:o.element,elementsMap:t,threshold:0,overrideShouldTestInside:!0}),c=a&&aa(a)||n.activeTool.type==="arrow"&&n.currentItemArrowType==="elbow";if(!s||c){e.save();let m=ia(o.element,t),p;if(o.element.type==="diamond"){let g=ia(o.element,t);p=CO(o.element).map(b=>{let y=AI(b,.5),v=lm(y,g,o.element.angle);return ra(v[0],v[1])})}else p=[{x:o.element.width,y:o.element.height/2},{x:o.element.width/2,y:o.element.height},{x:0,y:o.element.height/2},{x:o.element.width/2,y:0}].map(b=>{let y=ra(b.x+o.element.x,b.y+o.element.y),v=lm(y,m,o.element.angle);return ra(v[0],v[1])});let d=r&&p.reduce((g,b,y)=>{let v=vO(b,r);return y===-1||v<g.distance?{idx:y,distance:v}:g},{idx:-1,distance:1/0}),h=4/n.zoom.value,f=RO(n.zoom)+o.element.strokeWidth/2;p.forEach((g,b)=>{let y=(!s||c)&&d?.idx===b&&d.distance<=f,v=!y&&(c||b===d?.idx&&d.distance<=f*2);y?(e.fillStyle=n.theme===Zn.DARK?"rgba(3, 93, 161, 1)":"rgba(106, 189, 252, 1)",e.beginPath(),e.arc(g[0],g[1],h,0,2*Math.PI),e.fill()):v&&(e.fillStyle=n.theme===Zn.DARK?"rgba(0, 0, 0, 0.8)":"rgba(65, 65, 65, 0.5)",e.beginPath(),e.arc(g[0],g[1],h,0,2*Math.PI),e.fill())}),e.restore()}}},XO=(e,o,t,n,r,i,l)=>{let a=e.state.bindMode==="orbit"&&e.bindModeHandler!==null,s=$l-(l?.runtime??(a?0:$l)),c=pf(1/$l*s,1e-4,1),m=t.strokeWidth/2,p=t.frameId&&n.get(t.frameId);switch(p&&la(p)&&(o.translate(p.x,p.y),o.beginPath(),Qt.radius&&o.roundRect?o.roundRect(-1,-1,p.width+1,p.height+1,Qt.radius/r.zoom.value):o.rect(-1,-1,p.width+1,p.height+1),o.clip(),o.translate(-p.x,-p.y)),t.type){case"magicframe":case"frame":o.save(),o.translate(t.x,t.y),o.lineWidth=Qt.strokeWidth/r.zoom.value,o.strokeStyle=r.theme===Zn.DARK?`rgba(3, 93, 161, ${c})`:`rgba(106, 189, 252, ${c})`,Qt.radius&&o.roundRect?(o.beginPath(),o.roundRect(0,0,t.width,t.height,Qt.radius/r.zoom.value),o.stroke(),o.closePath()):o.strokeRect(0,0,t.width,t.height),o.restore();break;default:o.save();let h=ia(t,n),f=h[0]+r.scrollX,g=h[1]+r.scrollY;switch(o.translate(f,g),o.rotate(t.angle),o.translate(-f,-g),o.translate(t.x+r.scrollX-m,t.y+r.scrollY-m),o.lineWidth=pf(2.5,t.strokeWidth*1.75,4)/Math.max(.25,r.zoom.value),o.strokeStyle=r.theme===Zn.DARK?`rgba(3, 93, 161, ${c/2})`:`rgba(106, 189, 252, ${c/2})`,t.type){case"ellipse":o.beginPath(),o.ellipse((t.width+m*2)/2,(t.height+m*2)/2,(t.width+m*2)/2,(t.height+m*2)/2,0,0,2*Math.PI),o.closePath(),o.stroke();break;case"diamond":{let[b,y]=uf(t,m);b.forEach(v=>{o.beginPath(),o.moveTo(v[0][0]-t.x+m,v[0][1]-t.y+m),o.lineTo(v[1][0]-t.x+m,v[1][1]-t.y+m),o.stroke()}),y.forEach(v=>{let[x,w,T,S]=v;o.beginPath(),o.moveTo(x[0]-t.x+m,x[1]-t.y+m),o.bezierCurveTo(w[0]-t.x+m,w[1]-t.y+m,T[0]-t.x+m,T[1]-t.y+m,S[0]-t.x+m,S[1]-t.y+m),o.stroke()})}break;default:{let[b,y]=DI(t,m);b.forEach(v=>{o.beginPath(),o.moveTo(v[0][0]-t.x+m,v[0][1]-t.y+m),o.lineTo(v[1][0]-t.x+m,v[1][1]-t.y+m),o.stroke()}),y.forEach(v=>{let[x,w,T,S]=v;o.beginPath(),o.moveTo(x[0]-t.x+m,x[1]-t.y+m),o.bezierCurveTo(w[0]-t.x+m,w[1]-t.y+m,T[0]-t.x+m,T[1]-t.y+m,S[0]-t.x+m,S[1]-t.y+m),o.stroke()})}break}o.restore();break}if(!a||(l?.runtime??0)>$l)return;let d=.5*(Math.min(t.width,t.height)/2);if(!la(t)){o.save(),o.translate(t.x+r.scrollX,t.y+r.scrollY);let h=1/$l*s;if(o.strokeStyle="rgba(0, 0, 0, 0.2)",o.lineWidth=1/r.zoom.value,o.setLineDash([4/r.zoom.value,4/r.zoom.value]),o.lineDashOffset=-h*10/r.zoom.value,o.beginPath(),o.ellipse(t.width/2,t.height/2,d,d,0,0,2*Math.PI),o.stroke(),o.fillStyle="rgba(0, 0, 0, 0.04)",o.beginPath(),o.ellipse(t.width/2,t.height/2,d*(1-c),d*(1-c),0,0,2*Math.PI),o.fill(),o.restore(),r.isMidpointSnappingEnabled){o.save(),o.translate(t.x+r.scrollX,t.y+r.scrollY);let f=5/r.zoom.value,g=5/r.zoom.value,b=f+g,y;if(t.type==="diamond"){let[,v]=uf(t),x=ia(t,n);y=v.map(w=>{let T=AI(w,.5),S=lm(T,x,t.angle);return{x:S[0]-t.x,y:S[1]-t.y}})}else{let v=ia(t,n);y=[{x:t.width/2,y:0},{x:t.width,y:t.height/2},{x:t.width/2,y:t.height},{x:0,y:t.height/2}].map(w=>{let T=ra(w.x+t.x,w.y+t.y),S=lm(T,v,t.angle);return{x:S[0]-t.x,y:S[1]-t.y}})}y.forEach(v=>{o.clearRect(v.x-b,v.y-b,b*2,b*2)}),o.fillStyle=r.theme===Zn.DARK?`rgba(3, 93, 161, ${c})`:`rgba(106, 189, 252, ${c})`,y.forEach(v=>{o.beginPath(),o.arc(v.x,v.y,f,0,2*Math.PI),o.fill()}),o.restore()}}return{runtime:(l?.runtime??0)+i}},KO=(e,o,t,n,r,i,l)=>{if(t===null)return;if(IO("COMPLEX_BINDINGS"))return XO(e,o,t.element,n,r,i,l);o.save(),o.translate(r.scrollX,r.scrollY);let a=e.lastPointerMoveCoords?ra(e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y):null;VO(o,t,n,r,a),o.restore()},RI=(e,o,t)=>{let{angle:n,x1:r,y1:i,x2:l,y2:a,selectionColors:s,cx:c,cy:m,dashed:p,activeEmbeddable:d}=t,h=l-r,f=a-i,b=(t.padding??LI*2)/o.zoom.value,y=8/o.zoom.value,v=4/o.zoom.value;e.save(),e.translate(o.scrollX,o.scrollY),e.lineWidth=(d?4:1)/o.zoom.value;let x=s.length;for(let w=0;w<x;++w)e.strokeStyle=s[w],p&&e.setLineDash([y,v+(y+v)*(x-1)]),e.lineDashOffset=(y+v)*w,Sa(e,r-b,i-b,h+b*2,f+b*2,c,m,n);e.restore()},ZO=(e,o,t,n)=>{let[r,i,l,a]=sm(t,n),s=l-r,c=a-i;e.strokeStyle="rgb(0,118,255)",e.lineWidth=Qt.strokeWidth/o.zoom.value,e.save(),e.translate(o.scrollX,o.scrollY),Sa(e,r,i,s,c,r+s/2,i+c/2,t.angle,!1,Qt.radius/o.zoom.value),e.restore()},kI=(e,o,t,n)=>{let{colors:r=["rgb(0,118,255)"],dashed:i=!1}=n||{},l=t.filter(m=>m.groupIds.length===0),a=t.filter(m=>m.groupIds.length>0),s=m=>{let[p,d,h,f]=gf(m);return{angle:0,x1:p,x2:h,y1:d,y2:f,selectionColors:r,dashed:i,cx:p+(h-p)/2,cy:d+(f-d)/2,activeEmbeddable:!1}},c=m=>{let p=hf(t,m);return s(p)};Object.entries(HO(a,o)).filter(([m,p])=>p).map(([m,p])=>m).map(m=>c(m)).concat(l.map(m=>s([m]))).forEach(m=>RI(e,o,m))},mf=(e,o,t,n)=>{if(!o.selectedLinearElement)return;e.save(),e.translate(o.scrollX,o.scrollY),e.lineWidth=1/o.zoom.value;let r=Ro.getPointsGlobalCoordinates(t,n),{POINT_HANDLE_SIZE:i}=Ro,l=o.selectedLinearElement?.isEditing?i:i/2,a=aa(t),s=_O(t);if(r.forEach((c,m)=>{if(a&&m!==0&&m!==r.length-1)return;let p=m>0&&(m!==r.length-1||!s||!t.polygon)&&wO(c,m===r.length-1?r[0]:r[m-1],2/o.zoom.value),d=!!o.selectedLinearElement?.isEditing&&!!o.selectedLinearElement?.selectedPointsIndices?.includes(m);s&&t.polygon&&!d&&m===t.points.length-1&&o.selectedLinearElement?.isEditing&&o.selectedLinearElement?.selectedPointsIndices?.includes(0)&&(d=!0),df(e,o,c,l,d,!1,p)}),aa(t)){let c=t.fixedSegments?.map(m=>m.index)||[];r.slice(0,-1).forEach((m,p)=>{Ro.isSegmentTooShort(t,r[p+1],r[p],p,o.zoom,n)||df(e,o,ra((m[0]+r[p+1][0])/2,(m[1]+r[p+1][1])/2),i/2,!1,!c.includes(p+1),!1)})}else Ro.getEditorMidPoints(t,n,o).filter((m,p,d)=>m!==null&&!(aa(t)&&(p===0||p===d.length-1))).forEach(m=>{(o.selectedLinearElement?.isEditing||r.length===2)&&df(e,o,m,i/2,!1,!0,!1)});e.restore()},$O=(e,o,t,n)=>{e.save(),e.translate(o.scrollX,o.scrollY),e.strokeStyle="rgba(134, 131, 226, 0.6)",e.lineWidth=1/o.zoom.value,e.setLineDash([4/o.zoom.value,4/o.zoom.value]),e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(n[0],n[1]),e.stroke(),e.restore()},jO=(e,o,t,n,r)=>{e.save(),e.translate(o.scrollX,o.scrollY),e.strokeStyle="rgba(134, 131, 226, 0.6)",e.lineWidth=1/o.zoom.value,e.setLineDash([]),e.fillStyle=r?"rgba(134, 131, 226, 0.9)":"rgba(255, 255, 255, 0.9)",Ca(e,t[0],t[1],n/o.zoom.value,!0,!0),e.restore()},MI=({arrow:e,appState:o,type:t,context:n,elementsMap:r})=>{let i=t==="start"?e.startBinding:e.endBinding,l=i?.elementId&&r.get(i.elementId);if(!l||!_I(l)||l.isDeleted)return;let a=SI(i.fixedPoint,l,r);if(!GO(a,e,l,r,o,t))return;let s=o.selectedLinearElement,c=!!s?.isDragging,m=t==="start"?0:e.points.length-1,p=!!s?.selectedPointsIndices?.includes(m);if(s?.hoveredFocusPointBinding===t&&!s.draggedFocusPointBinding&&YO(n,o,a),!(p&&c)){let d=SI(i.fixedPoint,l,r),h=s?.hoveredFocusPointBinding===t,f=Ro.getPointAtIndexGlobalCoordinates(e,m,r);$O(n,o,f,d),jO(n,o,d,SO/1.5,h)}},PI=(e,o,t,n,r)=>{Object.keys(n).forEach(i=>{let l=n[i];if(l!==void 0){let[a,s,c,m]=l;e.save(),e.lineWidth=1/t.zoom.value,o.selectionColor&&(e.strokeStyle=o.selectionColor),i==="rotation"?Ca(e,a+c/2,s+m/2,c/2,!0):e.roundRect?(e.beginPath(),e.roundRect(a,s,c,m,2/t.zoom.value),e.fill(),e.stroke()):Sa(e,a,s,c,m,a+c/2,s+m/2,r,!0),e.restore()}})},qO=(e,o,t,n,r)=>{let[i,l,,,a,s]=sm(n,r),c=3,m=20,p=c/t.zoom.value,d=p/2,h=a-i+p,f=s-l+p,g=Math.min(m/t.zoom.value,h),b=Math.min(m/t.zoom.value,f);e.save(),e.fillStyle=o.selectionColor,e.strokeStyle=o.selectionColor,e.lineWidth=p,[[[-h,-f],[0,d],[g,d],[d,0],[d,b]],[[h-d,-f],[d,d],[-g+d,d],[0,0],[0,b]],[[-h,f],[0,-d],[g,-d],[d,0],[d,-b]],[[h-d,f],[d,-d],[-g+d,-d],[0,0],[0,-b]]].forEach(v=>{let[[x,w],[T,S],[P,M],[_,R],[A,F]]=v;e.save(),e.translate(a,s),e.rotate(n.angle),e.beginPath(),e.moveTo(x+T,w+S),e.lineTo(x+P,w+M),e.stroke(),e.beginPath(),e.moveTo(x+_,w+R),e.lineTo(x+A,w+F),e.stroke(),e.restore()}),e.restore()},JO=(e,o,t,n)=>{o.save();let r=uh(t.zoom.value),i=e.width+r*2,l=e.height+r*2,a=e.x+e.width/2,s=e.y+e.height/2,c=-(e.width/2+r),m=-(e.height/2+r);o.translate(a+t.scrollX,s+t.scrollY),o.rotate(e.angle),o.lineWidth=1/t.zoom.value,o.strokeStyle=n,o.globalAlpha=.5,o.setLineDash([6/t.zoom.value,4/t.zoom.value]),o.strokeRect(c,m,i,l),o.restore()},QO=(e,o,t,n,r)=>{let i=hh(e,t.zoom.value,r);i&&(o.save(),o.globalAlpha=.5,o.lineWidth=1.5/t.zoom.value,o.lineCap="round",o.strokeStyle=n,o.beginPath(),o.moveTo(i.start[0]+t.scrollX,i.start[1]+t.scrollY),o.lineTo(i.end[0]+t.scrollX,i.end[1]+t.scrollY),o.stroke(),o.restore())},ez=({app:e,canvas:o,elementsMap:t,visibleElements:n,selectedElements:r,allElementsMap:i,scale:l,appState:a,renderConfig:s,editorInterface:c,animationState:m,deltaTime:p})=>{if(o===null)return{atLeastOneVisibleElement:!1,elementsMap:t};let[d,h]=fs(o,l),f=m,g=Es({canvas:o,scale:l,normalizedWidth:d,normalizedHeight:h});g.save(),g.scale(a.zoom.value,a.zoom.value);let b;if(n.forEach(S=>{a.selectedLinearElement?.isEditing&&a.selectedLinearElement.elementId===S.id&&S&&(b=S)}),b&&mf(g,a,b,t),a.selectionElement&&!a.isCropping)try{FO(a.selectionElement,g,a,s.selectionColor)}catch(S){console.error(S)}let y=BO(r,a);if(y&&!y.autoResize&&QO(y,g,a,s.selectionColor,c.formFactor),a.editingTextElement){let S=i.get(a.editingTextElement.id);S&&!S.autoResize&&JO(S,g,a,s.selectionColor)}if(a.isBindingEnabled&&a.suggestedBinding?f={...m,bindingHighlight:KO(e,g,a.suggestedBinding,i,a,p,m?.bindingHighlight)}:f={...m,bindingHighlight:void 0},a.frameToHighlight&&ZO(g,a,a.frameToHighlight,t),a.elementsToHighlight&&kI(g,a,a.elementsToHighlight),a.activeLockedId){let S=i.get(a.activeLockedId),P=S?[S]:hf(i,a.activeLockedId);kI(g,a,P,{colors:["#ced4da"],dashed:!0})}let v=r.some(S=>la(S));r.length===1&&a.selectedLinearElement?.isEditing&&a.selectedLinearElement.elementId===r[0].id&&mf(g,a,r[0],t);let x=a.selectedLinearElement,w=x&&Ro.getElement(x.elementId,i);if(w&&(a.selectedLinearElement.isDragging||(x.segmentMidPointHoveredCoords?UO(g,a):(aa(w)?x.hoverPointIndex===0||x.hoverPointIndex===w.points.length-1:x.hoverPointIndex>=0)&&WO(g,a,t)),LO(w)&&(MI({arrow:w,elementsMap:i,appState:a,context:g,type:"start"}),MI({arrow:w,elementsMap:i,appState:a,context:g,type:"end"}))),!a.multiElement&&!a.newElement&&!a.selectedLinearElement?.isEditing){let S=PO(r,a,c),P=r.length===1&&DO(r[0]);P&&a.selectedLinearElement?.elementId===r[0].id&&!r[0].locked&&mf(g,a,r[0],t);let M=s.selectionColor||"#000";if(S){let _=TO(r),R=[];for(let F of t.values()){let U=[],j=s.remoteSelectedElementIds.get(F.id);if(P&&aa(F)&&(F.startBinding||F.endBinding)||(_.has(F.id)&&!zO(a,F)&&U.push(M),j&&U.push(...j.map(z=>ur(z,a.collaborators.get(z))))),U.length){let[z,Z,ae,oe,ce,re]=sm(F,t,!0);R.push({angle:F.angle,x1:z,y1:Z,x2:ae,y2:oe,selectionColors:F.locked?["#ced4da"]:U,dashed:!!j||F.locked,cx:ce,cy:re,activeEmbeddable:a.activeEmbeddable?.element===F&&a.activeEmbeddable.state==="active",padding:F.id===a.croppingElementId||CI(F)?0:void 0})}}let A=F=>{let U=hf(t,F),[j,z,Z,ae]=gf(U);R.push({angle:0,x1:j,x2:Z,y1:z,y2:ae,selectionColors:U.some(oe=>oe.locked)?["#ced4da"]:["#000"],dashed:!0,cx:j+(Z-j)/2,cy:z+(ae-z)/2,activeEmbeddable:!1})};for(let F of OO(a))A(F);a.editingGroupId&&A(a.editingGroupId),R.forEach(F=>RI(g,a,F))}if(g.save(),g.translate(a.scrollX,a.scrollY),r.length===1){g.fillStyle="#fff";let _=kO(r[0],a.zoom,t,"mouse",cf(c));if(!a.viewModeEnabled&&S&&!NO(a.editingTextElement)&&!a.croppingElementId&&PI(g,s,a,_,r[0].angle),a.croppingElementId&&!a.isCropping){let R=t.get(a.croppingElementId);R&&CI(R)&&qO(g,s,a,R,t)}}else if(r.length>1&&!a.isRotating&&!r.some(_=>_.locked)){let _=LI*2/a.zoom.value;g.fillStyle="#fff";let[R,A,F,U]=gf(r,t),j=g.getLineDash();g.setLineDash([2/a.zoom.value]);let z=g.lineWidth;g.lineWidth=1/a.zoom.value,g.strokeStyle=M,Sa(g,R-_,A-_,F-R+_*2,U-A+_*2,(R+F)/2,(A+U)/2,0),g.lineWidth=z,g.setLineDash(j);let Z=MO([R,A,F,U,(R+F)/2,(A+U)/2],0,a.zoom,"mouse",v?{...cf(c),rotation:!0}:cf(c));r.some(ae=>!ae.locked)&&PI(g,s,a,Z,0)}g.restore()}a.searchMatches?.matches.forEach(({id:S,focus:P,matchedLines:M})=>{let _=t.get(S);if(_){let[R,A,,,F,U]=sm(_,t,!0);g.save(),a.theme===Zn.LIGHT?P?g.fillStyle="rgba(255, 124, 0, 0.4)":g.fillStyle="rgba(255, 226, 0, 0.4)":P?g.fillStyle="rgba(229, 82, 0, 0.4)":g.fillStyle="rgba(99, 52, 0, 0.4)";let j=la(_)?a.zoom.value:1;g.translate(a.scrollX,a.scrollY),g.translate(F,U),g.rotate(_.angle),M.forEach(z=>{(z.showOnCanvas||P)&&g.fillRect(R+z.offsetX/j-F,A+z.offsetY/j-U,z.width/j,z.height/j)}),g.restore()}}),vI(g,a),g.restore(),Sb({context:g,renderConfig:s,appState:a,normalizedWidth:d,normalizedHeight:h});let T;return s.renderScrollbars&&(T=Ry(t,d,h,a),g.save(),g.fillStyle=_y,g.strokeStyle="rgba(255,255,255,0.8)",[T.horizontal,T.vertical].forEach(S=>{S&&_c(g,S.x,S.y,S.width,S.height,$t/2)}),g.restore()),{scrollBars:T,atLeastOneVisibleElement:n.length>0,elementsMap:t,animationState:f}},NI=e=>{let o=ez(e);return e.callback(o),o};import{jsx as lz}from"react/jsx-runtime";var OI="animateInteractiveScene",iz=e=>{let o=BI(!1),t=BI(null);return oz(()=>{if(!o.current){o.current=!0;return}let n=new Map,r=new Map,i=new Map,l=new Map,a=new Map;e.appState.collaborators.forEach((c,m)=>{if(c.selectedElementIds)for(let p of Object.keys(c.selectedElementIds))i.has(p)||i.set(p,[]),i.get(p).push(m);!c.pointer||c.pointer.renderCursor===!1||(c.username&&l.set(m,c.username),c.userState&&a.set(m,c.userState),r.set(m,rz({sceneX:c.pointer.x,sceneY:c.pointer.y},e.appState)),n.set(m,c.button))});let s=e.containerRef?.current&&getComputedStyle(e.containerRef.current).getPropertyValue("--color-selection")||"#6965db";t.current={app:e.app,canvas:e.canvas,elementsMap:e.elementsMap,visibleElements:e.visibleElements,selectedElements:e.selectedElements,allElementsMap:e.allElementsMap,scale:window.devicePixelRatio,appState:e.appState,renderConfig:{remotePointerViewportCoords:r,remotePointerButton:n,remoteSelectedElementIds:i,remotePointerUsernames:l,remotePointerUserStates:a,selectionColor:s,renderScrollbars:e.renderScrollbars,lastViewportPosition:e.app.lastViewportPosition},editorInterface:e.editorInterface,callback:e.renderInteractiveSceneCallback,animationState:{bindingHighlight:void 0},deltaTime:0},Qo.running(OI)||Qo.start(OI,({deltaTime:c,state:m})=>{let p=NI({...t.current,deltaTime:c,animationState:m}).animationState;if(p){for(let d in p)if(p[d]!==void 0)return p}})}),lz("canvas",{className:"excalidraw__canvas interactive",style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled&&e.appState.activeTool.type!=="laser"?FI.GRAB:FI.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onClick:e.onClick,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:E("labels.drawingCanvas")})},zI=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,activeTool:e.activeTool,openDialog:e.openDialog,editingGroupId:e.editingGroupId,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,selectionElement:e.selectionElement,selectedGroupIds:e.selectedGroupIds,selectedLinearElement:e.selectedLinearElement,multiElement:e.multiElement,newElement:e.newElement,isBindingEnabled:e.isBindingEnabled,isMidpointSnappingEnabled:e.isMidpointSnappingEnabled,suggestedBinding:e.suggestedBinding,isRotating:e.isRotating,elementsToHighlight:e.elementsToHighlight,collaborators:e.collaborators,activeEmbeddable:e.activeEmbeddable,snapLines:e.snapLines,zenModeEnabled:e.zenModeEnabled,editingTextElement:e.editingTextElement,isCropping:e.isCropping,croppingElementId:e.croppingElementId,searchMatches:e.searchMatches,activeLockedId:e.activeLockedId,hoveredElementIds:e.hoveredElementIds,frameRendering:e.frameRendering,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,exportScale:e.exportScale,currentItemArrowType:e.currentItemArrowType}),az=(e,o)=>e.selectionNonce!==o.selectionNonce||e.canvasNonce!==o.canvasNonce||e.scale!==o.scale||e.elementsMap!==o.elementsMap||e.visibleElements!==o.visibleElements||e.selectedElements!==o.selectedElements||e.renderScrollbars!==o.renderScrollbars?!1:nz(zI(e.appState),zI(o.appState)),Ef=tz.memo(iz,az);import sz,{useEffect as HI,useRef as GI}from"react";import{isShallowEqual as UI}from"@excalidraw/common";import{jsx as mz}from"react/jsx-runtime";var cz=e=>{let o=GI(null),t=GI(!1);return HI(()=>{e.canvas.style.width=`${e.appState.width}px`,e.canvas.style.height=`${e.appState.height}px`,e.canvas.width=e.appState.width*e.scale,e.canvas.height=e.appState.height*e.scale},[e.appState.height,e.appState.width,e.canvas,e.scale]),HI(()=>{let n=o.current;if(!n)return;let r=e.canvas;t.current||(t.current=!0,n.replaceChildren(r),r.classList.add("excalidraw__canvas","static"));let i=getComputedStyle(n).getPropertyValue("--color-grid-bold").trim(),l=getComputedStyle(n).getPropertyValue("--color-grid-regular").trim();v1({canvas:r,rc:e.rc,scale:e.scale,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,visibleElements:e.visibleElements,appState:e.appState,renderConfig:{...e.renderConfig,gridColorBold:i,gridColorRegular:l}},Ni())}),mz("div",{className:"excalidraw__canvas-wrapper",ref:o})},WI=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,openDialog:e.openDialog,hoveredElementIds:e.hoveredElementIds,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,viewBackgroundColor:e.viewBackgroundColor,exportScale:e.exportScale,selectedElementsAreBeingDragged:e.selectedElementsAreBeingDragged,gridSize:e.gridSize,gridStep:e.gridStep,frameRendering:e.frameRendering,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,editingGroupId:e.editingGroupId,currentHoveredFontFamily:e.currentHoveredFontFamily,croppingElementId:e.croppingElementId,suggestedBinding:e.suggestedBinding}),dz=(e,o)=>e.canvasNonce!==o.canvasNonce||e.scale!==o.scale||e.elementsMap!==o.elementsMap||e.visibleElements!==o.visibleElements?!1:UI(WI(e.appState),WI(o.appState))&&UI(e.renderConfig,o.renderConfig),xf=sz.memo(cz,dz);import{useEffect as xz,useRef as bz}from"react";import{throttleRAF as pz}from"@excalidraw/common";import{getTargetFrame as uz,isInvisiblySmallElement as hz,renderElement as gz,shouldApplyFrameClip as fz}from"@excalidraw/element";var YI=({canvas:e,rc:o,newElement:t,elementsMap:n,allElementsMap:r,scale:i,appState:l,renderConfig:a})=>{if(e){let[s,c]=fs(e,i),m=Es({canvas:e,scale:i,normalizedWidth:s,normalizedHeight:c});if(m.save(),m.scale(l.zoom.value,l.zoom.value),t&&t.type!=="selection"){if(hz(t))return;if((t.frameId||l.frameToHighlight?.id)&&l.frameRendering.enabled&&l.frameRendering.clip){let d=uz(t,n,l);d&&fz(t,d,l,n)&&y1(d,m,a,l)}gz(t,n,r,o,m,a,l)}else m.clearRect(0,0,s,c);m.restore()}},Ez=pz(e=>{YI(e)}),VI=(e,o)=>{if(o){Ez(e);return}YI(e)};import{jsx as wz}from"react/jsx-runtime";var yz=e=>{let o=bz(null);return xz(()=>{o.current&&VI({canvas:o.current,scale:e.scale,newElement:e.newElement,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,rc:e.rc,renderConfig:e.renderConfig,appState:e.appState},Ni())}),wz("canvas",{className:"excalidraw__canvas",style:{width:e.appState.width,height:e.appState.height},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:o})},XI=yz;var cm=class{constructor(o){this.getState=o;I(this,"listeners",[]);I(this,"onStateChange",(o,t,n)=>{let{predicate:r,getValue:i,callback:l,once:a,matchesImmediately:s}=this.normalize(o,t,n);return l?s&&(queueMicrotask(()=>{let c=this.getState();l(i(c),c)}),a)?()=>{}:this.subscribe({predicate:r,getValue:i,callback:l,once:a}):s?Promise.resolve(i(this.getState())):new Promise(c=>{this.subscribe({predicate:r,getValue:i,callback:m=>c(m),once:!0})})})}isStateChangePredicateOptions(o){return typeof o=="object"&&!Array.isArray(o)&&"predicate"in o}subscribe(o){return this.listeners.push(o),()=>{this.listeners=this.listeners.filter(t=>t!==o)}}normalize(o,t,n){let r,i,l=t,a=n?.once??!1,s=!1;if(this.isStateChangePredicateOptions(o)){let{predicate:c,callback:m,once:p}=o;r=c,i=d=>d,l=m?(d,h)=>m(h):void 0,a=p??!1,s=c(this.getState())}else if(typeof o=="function"){let c=o;r=(m,p)=>c(m)!==c(p),i=m=>c(m)}else if(Array.isArray(o)){let c=o;r=(m,p)=>c.some(d=>m[d]!==p[d]),i=m=>m}else{let c=o;r=(m,p)=>m[c]!==p[c],i=m=>m[c]}return{predicate:r,getValue:i,callback:l,once:a,matchesImmediately:s}}flush(o){if(!this.listeners.length)return;let t=this.getState(),n=[];for(let r of this.listeners)r.predicate(t,o)?(r.callback(r.getValue(t),t),r.once||n.push(r)):n.push(r);this.listeners=n}clear(){this.listeners=[]}};import{getCommonBounds as vz,getElementsInGroup as Tz,selectGroupsFromGivenElements as Iz}from"@excalidraw/element";import{sceneCoordsToViewportCoords as Cz}from"@excalidraw/common";import{flushSync as Sz}from"react-dom";import{jsx as Mz}from"react/jsx-runtime";var kz=({app:e,activeLockedId:o})=>{let t=e.scene.getElement(o),n=t?[t]:Tz(e.scene.getNonDeletedElementsMap(),o);if(n.length===0)return null;let[r,i]=vz(n),{x:l,y:a}=Cz({sceneX:r,sceneY:i},e.state);return Mz("div",{className:"UnlockPopup",style:{bottom:`${e.state.height+12-a+e.state.offsetTop}px`,left:`${l-e.state.offsetLeft}px`},onClick:()=>{Sz(()=>{let s=Iz(n,e.state);e.setState({selectedElementIds:n.reduce((c,m)=>({...c,[m.id]:!0}),{}),selectedGroupIds:s,activeLockedId:null})}),e.actionManager.executeAction(dl)},title:E("labels.elementLock.unlock"),children:U1})},KI=kz;import{Fragment as DG,jsx as Ee,jsxs as bm}from"react/jsx-runtime";var nS=to.createContext(null),rS=to.createContext(null),Zf={formFactor:"desktop",desktopUIMode:"full",userAgent:tS(typeof navigator<"u"?navigator.userAgent:""),isTouchScreen:!1,canFitSidebar:!1,isLandscape:!0},jf=to.createContext(Zf);jf.displayName="EditorInterfaceContext";var MG={"editor:mount":{cardinality:"once",replay:"last"},"editor:initialize":{cardinality:"once",replay:"last"},"editor:unmount":{cardinality:"once",replay:"last"}},qf=to.createContext({container:null,id:null});qf.displayName="ExcalidrawContainerContext";var Jf=to.createContext([]);Jf.displayName="ExcalidrawElementsContext";var Qf=to.createContext({...gn(),width:0,height:0,offsetLeft:0,offsetTop:0});Qf.displayName="ExcalidrawAppStateContext";var e1=to.createContext(()=>{console.warn("Uninitialized ExcalidrawSetAppStateContext context!")});e1.displayName="ExcalidrawSetAppStateContext";var t1=to.createContext(null);t1.displayName="ExcalidrawActionManagerContext";var fa=to.createContext(null);fa.displayName="ExcalidrawAPIContext";var wm=to.createContext(null);wm.displayName="ExcalidrawAPISetContext";var vt=()=>mn(nS),ai=()=>mn(rS),me=()=>mn(jf),et=()=>ym(me()),_e=()=>mn(qf),ei=()=>mn(Jf),yo=()=>mn(Qf),Me=()=>mn(e1),Ye=()=>mn(t1),vm=()=>mn(fa),rs=!1,Yf=0,is=null,Jn=!1,ga=!1,as=!1,ls=!1,Vf=!1,ss={horizontal:null,vertical:null},Qn=0,cs=!1,Xf=new Map,PG=4,Kf=!1,qC=0,JC=!1,Dr=null,AG="zoom-in",fe={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},$f=class e extends to.Component{constructor(t){super(t);I(this,"canvas");I(this,"interactiveCanvas",null);I(this,"sessionExportThemeOverride");I(this,"rc");I(this,"unmounted",!1);I(this,"actionManager");I(this,"editorInterface",Zf);I(this,"stylesPanelMode",ym(Zf));I(this,"excalidrawContainerRef",to.createRef());I(this,"scene");I(this,"fonts");I(this,"renderer");I(this,"visibleElements");I(this,"resizeObserver");I(this,"id");I(this,"store");I(this,"history");I(this,"excalidrawContainerValue");I(this,"files",{});I(this,"imageCache",new Map);I(this,"iFrameRefs",new Map);I(this,"embedsValidationStatus",new Map);I(this,"initializedEmbeds",new Set);I(this,"elementsPendingErasure",new Set);I(this,"_initialized",!1);I(this,"editorLifecycleEvents",new rH(MG));I(this,"onEvent",this.editorLifecycleEvents.on.bind(this.editorLifecycleEvents));I(this,"appStateObserver",new cm(()=>this.state));I(this,"onStateChange",this.appStateObserver.onStateChange);I(this,"flowChartCreator",new KH);I(this,"flowChartNavigator",new ZH);I(this,"bindModeHandler",null);I(this,"hitLinkElement");I(this,"lastPointerDownEvent",null);I(this,"lastPointerUpEvent",null);I(this,"lastPointerUpIsDoubleClick",!1);I(this,"lastPointerMoveEvent",null);I(this,"lastPointerMoveCoords",null);I(this,"lastCompletedCanvasClicks",[]);I(this,"previousPointerMoveCoords",null);I(this,"lastViewportPosition",{x:0,y:0});I(this,"laserTrails",new ed(this));I(this,"eraserTrail",new id(this));I(this,"lassoTrail",new rd(this));I(this,"onChangeEmitter",new Ar);I(this,"onPointerDownEmitter",new Ar);I(this,"onPointerUpEmitter",new Ar);I(this,"onUserFollowEmitter",new Ar);I(this,"onScrollChangeEmitter",new Ar);I(this,"missingPointerEventCleanupEmitter",new Ar);I(this,"onRemoveEventListenersEmitter",new Ar);I(this,"api");I(this,"addImageElementsToScene",async(t,n,r)=>{await this.insertImages(t,n,r)});I(this,"updateEditorAtom",(t,...n)=>{let r=Ut.set(t,...n);return this.triggerRender(),r});I(this,"previousHoveredBindableElement",null);I(this,"getEffectiveGridSize",()=>Rn(this)?this.state.gridSize:null);I(this,"getTextCreationGridPoint",(t,n)=>{let r=this.getEffectiveGridSize();if(r===null)return null;let i=l=>Math.floor(l/r)*r;return{x:i(t),y:i(n)}});I(this,"handleIframeLikeElementHover",({hitElement:t,scenePointer:n,moveEvent:r})=>t&&Pf(t)&&(this.state.viewModeEnabled||this.state.activeTool.type==="laser"||this.isIframeLikeElementCenter(t,r,n.x,n.y))?(pe(this.interactiveCanvas,Ce.POINTER),this.setState({activeEmbeddable:{element:t,state:"hover"}}),!0):(this.state.activeEmbeddable?.state==="hover"&&this.setState({activeEmbeddable:null}),!1));I(this,"isDoubleClick",(t,n)=>t!=null&&n.timeStamp-t.timeStamp<=iC);I(this,"updateEmbedValidationStatus",(t,n)=>{this.embedsValidationStatus.set(t.id,n),ns.delete(t)});I(this,"updateEmbeddables",()=>{let t=new Set,n=!1;this.scene.getNonDeletedElements().filter(r=>{if(dn(r)){if(t.add(r.id),!this.embedsValidationStatus.has(r.id)){n=!0;let i=Df(r.link,this.props.validateEmbeddable);this.updateEmbedValidationStatus(r,i)}}else ha(r)&&t.add(r.id);return!1}),n&&this.scene.triggerUpdate(),this.iFrameRefs.forEach((r,i)=>{t.has(i)||this.iFrameRefs.delete(i)})});I(this,"getFrameNameDOMId",t=>`${this.id}-frame-name-${t.id}`);I(this,"frameNameBoundsCache",{get:t=>{let n=this.frameNameBoundsCache._cache.get(t.id);if(!n||n.zoom!==this.state.zoom.value||n.versionNonce!==t.versionNonce){let r=document.getElementById(this.getFrameNameDOMId(t));if(r){let i=r.getBoundingClientRect(),l=De({clientX:i.x,clientY:i.y},this.state),a=De({clientX:i.right,clientY:i.bottom},this.state);return n={x:l.x,y:l.y,width:a.x-l.x,height:a.y-l.y,angle:0,zoom:this.state.zoom.value,versionNonce:t.versionNonce},this.frameNameBoundsCache._cache.set(t.id,n),n}return null}return n},_cache:new Map});I(this,"resetEditingFrame",t=>{t&&this.scene.mutateElement(t,{name:t.name?.trim()||null}),this.setState({editingFrame:null})});I(this,"renderFrameNames",()=>{if(!this.state.frameRendering.enabled||!this.state.frameRendering.name)return this.state.editingFrame&&this.resetEditingFrame(null),null;let t=this.state.theme===ca.DARK,n=this.scene.getNonDeletedFramesLikes(),r=n.length>0&&this.state.searchMatches?.focusedId&&at(this.scene.getElement(this.state.searchMatches.focusedId))?this.state.searchMatches.matches.find(i=>i.focus):null;return n.map(i=>{if(!IC(i,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap()))return this.state.editingFrame===i.id&&this.resetEditingFrame(i),null;let{x:l,y:a}=um({sceneX:i.x,sceneY:i.y},this.state),s=6,c,m=GH(i);if(i.id===this.state.editingFrame){let p=m;c=Ee("input",{autoFocus:!0,value:p,onChange:d=>{this.scene.mutateElement(i,{name:d.target.value})},onFocus:d=>d.target.select(),onBlur:()=>this.resetEditingFrame(i),onKeyDown:d=>{(d.key===Y.ESCAPE||d.key===Y.ENTER)&&this.resetEditingFrame(i)},style:{background:t?nH(this.state.viewBackgroundColor):this.state.viewBackgroundColor,zIndex:2,border:"none",display:"block",padding:`${s}px`,borderRadius:4,boxShadow:"inset 0 0 0 1px var(--color-primary)",fontFamily:"Assistant",fontSize:`${No.nameFontSize}px`,transform:`translate(-${s}px, ${s}px)`,color:t?No.nameColorDarkTheme:No.nameColorLightTheme,overflow:"hidden",maxWidth:`${document.body.clientWidth-l-s}px`},size:p.length+1||1,dir:"auto",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off"})}else c=m;return Ee("div",{id:this.getFrameNameDOMId(i),className:kf.FRAME_NAME,style:{position:"absolute",bottom:`${this.state.height+No.nameOffsetY-a+this.state.offsetTop}px`,left:`${l-this.state.offsetLeft}px`,zIndex:2,fontSize:No.nameFontSize,color:t?No.nameColorDarkTheme:No.nameColorLightTheme,lineHeight:No.nameLineHeight,width:"max-content",maxWidth:r?.id===i.id&&r?.focus?"none":`${i.width*this.state.zoom.value}px`,overflow:i.id===this.state.editingFrame?"visible":"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",cursor:Ce.MOVE,pointerEvents:this.state.viewModeEnabled?da.disabled:da.enabled},onPointerDown:p=>this.handleCanvasPointerDown(p),onWheel:p=>this.handleWheel(p),onContextMenu:this.handleCanvasContextMenu,onDoubleClick:()=>{this.setState({editingFrame:i.id})},children:c},i.id)})});I(this,"focusContainer",()=>{this.excalidrawContainerRef.current?.focus()});I(this,"getSceneElementsIncludingDeleted",()=>this.scene.getElementsIncludingDeleted());I(this,"getSceneElementsMapIncludingDeleted",()=>this.scene.getElementsMapIncludingDeleted());I(this,"getSceneElements",()=>this.scene.getNonDeletedElements());I(this,"onInsertElements",t=>{this.addElementsFromPaste({elements:t,position:"center",files:null})});I(this,"onExportImage",async(t,n,r)=>{de("export",t,"ui");let i=await dr(t,n,this.state,this.files,{exportBackground:this.state.exportBackground,name:this.getName(),viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:r.exportingFrame}).catch(eH).catch(l=>{console.error(l),this.setState({errorMessage:l.message})});this.state.exportEmbedScene&&i&&bs(i)&&this.setState({fileHandle:i})});I(this,"magicGenerations",new Map);I(this,"updateMagicGeneration",({frameElement:t,data:n})=>{n.status==="pending"?this.scene.mutateElement(t,{customData:{generationData:void 0}},{informMutation:!1,isDragging:!1}):this.scene.mutateElement(t,{customData:{generationData:n}},{informMutation:!1,isDragging:!1}),this.magicGenerations.set(t.id,n),this.triggerRender()});I(this,"plugins",{});I(this,"onMagicframeToolSelect",()=>{let t=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});if(t.length===0)this.setActiveTool({type:Fo.magicframe}),de("ai","tool-select (empty-selection)","d2c");else{let n=t.length===1&&vC(t[0])&&t[0];if(!n&&t.some(i=>at(i)||i.frameId)){this.setActiveTool({type:Fo.magicframe});return}de("ai","tool-select (existing selection)","d2c");let r;if(n)r=n;else{let[i,l,a,s]=pa(t),c=50;r=EC({...No,x:i-c,y:l-c,width:a-i+c*2,height:s-l+c*2,opacity:100,locked:!1}),this.insertNewElement(r);for(let m of t)this.scene.mutateElement(m,{frameId:r.id});this.setState({selectedElementIds:{[r.id]:!0}})}this.onMagicFrameGenerate(r,"upstream")}});I(this,"openEyeDropper",({type:t})=>{this.updateEditorAtom(wn,{swapPreviewOnAlt:!0,colorPickerType:t==="stroke"?"elementStroke":"elementBackground",onSelect:(n,r)=>{let i=t==="background"&&r.altKey||t==="stroke"&&!r.altKey;!this.scene.getSelectedElements(this.state).length||this.state.activeTool.type!=="selection"?i?this.syncActionResult({appState:{...this.state,currentItemStrokeColor:n},captureUpdate:yt.IMMEDIATELY}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:n},captureUpdate:yt.IMMEDIATELY}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(a=>this.state.selectedElementIds[a.id]?jn(a,{[i?"strokeColor":"backgroundColor"]:n}):a),captureUpdate:yt.IMMEDIATELY})},keepOpenOnAlt:!1})});I(this,"dismissLinearEditor",()=>{setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isEditing:!1}})})});I(this,"syncActionResult",Re(t=>{if(this.unmounted||t===!1)return;this.store.scheduleAction(t.captureUpdate);let n=!1,r=null;if(t.elements&&(this.scene.replaceAllElements(t.elements),n=!0),t.files&&(this.addMissingFiles(t.files,t.replaceFiles),this.addNewImagesToImageCache()),t.appState||r||this.state.contextMenu){let i=t?.appState?.viewModeEnabled||!1,l=t?.appState?.zenModeEnabled||!1,a=t?.appState?.theme||this.props.theme||ca.LIGHT,s=t?.appState?.name??this.state.name,c=t?.appState?.errorMessage??this.state.errorMessage;typeof this.props.viewModeEnabled<"u"&&(i=this.props.viewModeEnabled),typeof this.props.zenModeEnabled<"u"&&(l=this.props.zenModeEnabled),r=t.appState?.editingTextElement||null,t.elements&&r&&t.elements.forEach(m=>{r?.id===m.id&&r!==m&&YC(m)&&zt(m)&&(r=m)}),r?.isDeleted&&(r=null),this.setState(m=>{let p=t.appState||{};return{...m,...p,contextMenu:null,editingTextElement:r,viewModeEnabled:i,zenModeEnabled:l,theme:a,name:s,errorMessage:c}}),n=!0}n||this.scene.triggerUpdate()}));I(this,"onBlur",Re(()=>{Jn=!1,ga=!1,ls=!1,this.restoreCursorAfterZoomKey(),this.setState({isBindingEnabled:this.state.bindingPreference==="enabled"})}));I(this,"onUnload",()=>{this.onBlur()});I(this,"disableEvent",t=>{t.preventDefault()});I(this,"resetHistory",()=>{this.history.clear()});I(this,"resetStore",()=>{this.store.clear()});I(this,"resetScene",Re(t=>{this.scene.replaceAllElements([]),this.setState(n=>({...gn(),isLoading:t?.resetLoadingState?!1:n.isLoading,theme:this.state.theme})),this.resetStore(),this.resetHistory()}));I(this,"initializeScene",async()=>{"launchQueue"in window&&"LaunchParams"in window&&window.launchQueue.setConsumer(async l=>{if(!l.files.length)return;let a=l.files[0],s=await a.getFile();this.loadFileToCanvas(new File([s],s.name||"",{type:s.type}),a)}),this.props.theme&&this.setState({theme:this.props.theme}),this.state.isLoading||this.setState({isLoading:!0});let t=null;try{typeof this.props.initialData=="function"?t=await this.props.initialData()||null:t=await this.props.initialData||null}catch(l){console.error(l),t={appState:{errorMessage:l.message||"Encountered an error during importing or restoring scene data"}}}let n=nr(t?.elements,null,{repairBindings:!0,deleteInvisibleElements:!0}),r=Fr(t?.appState,null),i=r.activeTool;r.preferredSelectionTool.initialized||(r.preferredSelectionTool={type:this.editorInterface.formFactor==="phone"?"lasso":"selection",initialized:!0}),r={...r,theme:this.props.theme||r.theme,openSidebar:r?.openSidebar||this.state.openSidebar,activeTool:i.type==="image"||i.type==="lasso"||i.type==="selection"?{...i,type:r.preferredSelectionTool.type}:r.activeTool,isLoading:!1,toast:this.state.toast},t?.scrollToContent&&(r={...r,...tr(n,{...r,width:this.state.width,height:this.state.height,offsetTop:this.state.offsetTop,offsetLeft:this.state.offsetLeft})}),this.resetStore(),this.resetHistory(),this.syncActionResult({elements:n,appState:r,files:t?.files,captureUpdate:yt.NEVER}),this.clearImageShapeCache(),this.fonts.loadSceneFonts().then(l=>{this.fonts.onLoaded(l)}),zf(window.location.href)&&this.scrollToContent(window.location.href,{animate:!1})});I(this,"getFormFactor",(t,n)=>this.props.UIOptions.getFormFactor?.(t,n)??sH(t,n));I(this,"refreshEditorInterface",()=>{let t=this.excalidrawContainerRef.current;if(!t)return;let{width:n,height:r}=t.getBoundingClientRect(),i=pH(),l=tS(typeof navigator<"u"?navigator.userAgent:""),a=this.props.UIOptions.dockedSidebarBreakpoint!=null?this.props.UIOptions.dockedSidebarBreakpoint:Oz,s=Sf(this.editorInterface,{desktopUIMode:i??this.editorInterface.desktopUIMode,formFactor:this.getFormFactor(n,r),userAgent:l,canFitSidebar:n>a,isLandscape:n>r});this.editorInterface=s,this.reconcileStylesPanelMode(s)});I(this,"reconcileStylesPanelMode",t=>{let n=ym(t);if(n===this.stylesPanelMode)return;let r=this.stylesPanelMode;this.stylesPanelMode=n,r!=="full"&&n==="full"&&this.setState(i=>({preferredSelectionTool:{type:"selection",initialized:!0}}))});I(this,"setDesktopUIMode",t=>{let n=uH(t);this.editorInterface=Sf(this.editorInterface,{desktopUIMode:n}),this.reconcileStylesPanelMode(this.editorInterface)});I(this,"onResize",Re(()=>{this.scene.getElementsIncludingDeleted().forEach(t=>ns.delete(t)),this.refreshEditorInterface(),this.updateDOMRect(),this.setState({})}));I(this,"onFullscreenChange",()=>{!document.fullscreenElement&&this.state.activeEmbeddable?.state==="active"&&this.setState({activeEmbeddable:null})});I(this,"renderInteractiveSceneCallback",({atLeastOneVisibleElement:t,scrollBars:n,elementsMap:r})=>{n&&(ss=n);let i=this.state.editingTextElement?!1:!t&&r.size>0;this.state.scrolledOutside!==i&&this.setState({scrolledOutside:i}),this.scheduleImageRefresh()});I(this,"onScroll",sC(()=>{let{offsetTop:t,offsetLeft:n}=this.getCanvasOffsets();this.setState(r=>r.offsetLeft===n&&r.offsetTop===t?null:{offsetTop:t,offsetLeft:n})},zz));I(this,"onCut",Re(t=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||ql(t.target)||(this.actionManager.executeAction(Bc,"keyboard",t),t.preventDefault(),t.stopPropagation())}));I(this,"onCopy",Re(t=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||ql(t.target)||(this.actionManager.executeAction(wi,"keyboard",t),t.preventDefault(),t.stopPropagation())}));I(this,"onTouchStart",t=>{if(cH&&t.preventDefault(),!rs){rs=!0,t.touches.length===1&&(is={x:t.touches[0].clientX,y:t.touches[0].clientY}),clearTimeout(Yf),Yf=window.setTimeout(e.resetTapTwice,iC);return}if(rs&&t.touches.length===1&&is){let n=t.touches[0];sn(Q(n.clientX,n.clientY),Q(is.x,is.y))<=pC&&(this.lassoTrail.endPath(),this.deselectElements(),this.handleCanvasDoubleClick({clientX:n.clientX,clientY:n.clientY,type:"touch",altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1})),rs=!1,clearTimeout(Yf)}t.touches.length===2&&this.setState({selectedElementIds:ye({},this.state),activeEmbeddable:null})});I(this,"onTouchEnd",t=>{this.resetContextMenuTimer(),t.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:ye(this.state.previousSelectedElementIds,this.state)}):fe.pointers.clear()});I(this,"pasteFromClipboard",Re(async t=>{let n=!!Kf,r=document.activeElement,i=this.excalidrawContainerRef.current?.contains(r);if(t&&!i)return;let l=document.elementFromPoint(this.lastViewportPosition.x,this.lastViewportPosition.y);if(t&&(!(l instanceof HTMLCanvasElement)||ql(r)))return;let a=await pi(t),s=a.getFiles(),c=await Cc(a,n);if(this.props.onPaste)try{if(await this.props.onPaste(c,t)===!1)return}catch(m){console.error(m)}await this.insertClipboardContent(c,s,n),this.setActiveTool({type:this.state.preferredSelectionTool.type},!0),t?.preventDefault()}));I(this,"addElementsFromPaste",t=>{let n=nr(t.elements,null,{deleteInvisibleElements:!0}),[r,i,l,a]=pa(n),s=ma(r,l)/2,c=ma(i,a)/2,m=typeof t.position=="object"?t.position.clientX:t.position==="cursor"?this.lastViewportPosition.x:this.state.width/2+this.state.offsetLeft,p=typeof t.position=="object"?t.position.clientY:t.position==="cursor"?this.lastViewportPosition.y:this.state.height/2+this.state.offsetTop,{x:d,y:h}=De({clientX:m,clientY:p},this.state),f=d-s,g=h-c,[b,y]=dt(f,g,this.getEffectiveGridSize()),{duplicatedElements:v}=yC({type:"everything",elements:n.map(M=>jn(M,{x:M.x+b-r,y:M.y+y-i})),randomizeSeed:!t.retainSeed,preserveFrameChildrenOrder:t.preserveFrameChildrenOrder}),x=this.scene.getElementsIncludingDeleted(),w=[...x,...v];w=this.props.onDuplicate?.(w,x)||w,zC(w,hm(v));let S=this.getTopLayerFrameAtSceneCoords({x:d,y:h});if(S){let M=WH(v,S);w=Bf(w,M,S)}this.scene.replaceAllElements(w),v.forEach(M=>{if(zt(M)&&Mf(M)){let _=PC(M,this.scene.getElementsMapIncludingDeleted());RH(M,_,this.scene)}}),mH&&Uo.loadElementsFonts(v).then(M=>{this.fonts.onLoaded(M)}),t.files&&this.addMissingFiles(t.files);let P=sG(v);this.store.scheduleCapture(),this.setState({...this.state,openSidebar:this.state.openSidebar&&this.editorInterface.canFitSidebar&&Ut.get(zl)?this.state.openSidebar:null,...eo({editingGroupId:null,selectedElementIds:P.reduce((M,_)=>(Mf(_)||(M[_.id]=!0),M),{})},this.scene.getNonDeletedElements(),this.state,this)},()=>{t.files&&this.addNewImagesToImageCache()}),this.setActiveTool({type:this.state.preferredSelectionTool.type},!0),t.fitToContent&&this.scrollToContent(v,{fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()})});I(this,"setAppState",(t,n)=>{this.setState(t,n)});I(this,"removePointer",t=>{Qn&&this.resetContextMenuTimer(),fe.pointers.delete(t.pointerId)});I(this,"toggleLock",(t="ui")=>{this.state.activeTool.locked||de("toolbar","toggleLock",`${t} (${this.editorInterface.formFactor==="phone"?"mobile":"desktop"})`),this.setState(n=>({activeTool:{...n.activeTool,...Oo(this.state,n.activeTool.locked?{type:this.state.preferredSelectionTool.type}:n.activeTool),locked:!n.activeTool.locked}}))});I(this,"updateFrameRendering",t=>{this.setState(n=>{let r=typeof t=="function"?t(n.frameRendering):t;return{frameRendering:{enabled:r?.enabled??n.frameRendering.enabled,clip:r?.clip??n.frameRendering.clip,name:r?.name??n.frameRendering.name,outline:r?.outline??n.frameRendering.outline}}})});I(this,"togglePenMode",t=>{this.setState(n=>({penMode:t??!n.penMode,penDetected:!0}))});I(this,"onHandToolToggle",()=>{this.actionManager.executeAction(Ux)});I(this,"zoomCanvas",t=>{this.setState({...To({viewportX:this.state.width/2+this.state.offsetLeft,viewportY:this.state.height/2+this.state.offsetTop,nextZoom:Gt(t)},this.state)})});I(this,"cancelInProgressAnimation",null);I(this,"scrollToViewport",(t,n)=>{this.cancelInProgressAnimation?.();let r={value:Gt(t.zoom)},i=n?.duration??500;if(n?.animate&&i>0){let l=this.state.scrollX,a=this.state.scrollY,s=this.state.zoom.value,c=Qz({fromValues:{scrollX:l,scrollY:a,zoom:s},toValues:{scrollX:t.scrollX,scrollY:t.scrollY,zoom:r.value},interpolateValue:(m,p,d,h)=>{if(h==="zoom")return m*Math.pow(p/m,tH(d))},onStep:({scrollX:m,scrollY:p,zoom:d})=>{this.setState({scrollX:m,scrollY:p,zoom:{value:d}})},onStart:()=>{this.setState({shouldCacheIgnoreZoom:!0})},onEnd:()=>{this.cancelInProgressAnimation=null,this.setState({shouldCacheIgnoreZoom:!1})},onCancel:()=>{this.cancelInProgressAnimation=null,this.setState({shouldCacheIgnoreZoom:!1})},duration:i});this.cancelInProgressAnimation=()=>{c(),this.cancelInProgressAnimation=null}}else this.setState({scrollX:t.scrollX,scrollY:t.scrollY,zoom:r})});I(this,"scrollToContent",(t=this.scene.getNonDeletedElements(),n)=>{if(typeof t=="string"){let s;if(zf(t)?s=qH(t):s=t,s){let c=this.scene.getElementsFromId(s);c?.length?this.scrollToContent(c,{fitToContent:n?.fitToContent??!0,animate:n?.animate??!0}):zf(t)&&this.setState({toast:{message:E("elementLink.notFound"),duration:3e3,closable:!0}})}return}let r=Array.isArray(t)?t:[t],i=this.state.zoom,l=this.state.scrollX,a=this.state.scrollY;if(n?.fitToContent||n?.fitToViewport){let{appState:s}=Ja({canvasOffsets:n.canvasOffsets,targetElements:r,appState:this.state,fitToViewport:!!n?.fitToViewport,viewportZoomFactor:n?.viewportZoomFactor,minZoom:n?.minZoom,maxZoom:n?.maxZoom});i=s.zoom,l=s.scrollX,a=s.scrollY}else{let s=tr(r,this.state);l=s.scrollX,a=s.scrollY}this.scrollToViewport({scrollX:l,scrollY:a,zoom:i.value},{animate:n?.animate,duration:n?.duration})});I(this,"maybeUnfollowRemoteUser",()=>{this.state.userToFollow&&this.setState({userToFollow:null})});I(this,"translateCanvas",t=>{this.cancelInProgressAnimation?.(),this.maybeUnfollowRemoteUser(),this.setState(t)});I(this,"setToast",t=>{this.setState({toast:t})});I(this,"handleToastClose",()=>{this.setToast(null)});I(this,"restoreFileFromShare",async()=>{try{let t=await caches.open("web-share-target"),n=await t.match("shared-file");if(n){let r=await n.blob(),i=new File([r],r.name||"",{type:r.type});this.loadFileToCanvas(i,null),await t.delete("shared-file"),window.history.replaceState(null,_z,window.location.pathname)}}catch(t){this.setState({errorMessage:t.message})}});I(this,"addFiles",Re(t=>{let{addedFiles:n}=this.addMissingFiles(t);this.clearImageShapeCache(n),this.scene.triggerUpdate(),this.addNewImagesToImageCache()}));I(this,"addMissingFiles",(t,n=!1)=>{let r=n?{}:{...this.files},i={},l=Array.isArray(t)?t:Object.values(t);for(let a of l)if(!r[a.id]&&(i[a.id]=a,r[a.id]=a,a.mimeType===sa.svg))try{let s=P1(MC(A1(a.dataURL)),sa.svg);a.dataURL!==s&&(a.version=(a.version??1)+1,a.dataURL=s)}catch(s){console.error(s)}return this.files=r,{addedFiles:i}});I(this,"updateScene",Re(t=>{let{elements:n,appState:r,collaborators:i,captureUpdate:l}=t;if(l){let a=n||void 0,s=r?gH({...this.store.snapshot.appState,...r}):void 0;this.store.scheduleMicroAction({action:l,elements:a,appState:s})}r&&this.setState(r),n&&this.scene.replaceAllElements(n),i&&(this.laserTrails.updateCollabTrails(i),this.setState({collaborators:i}))}));I(this,"applyDeltas",(t,n)=>{let r=XC.squash(...t),i={...this.state},l=new Map(this.scene.getElementsMapIncludingDeleted());return XC.applyTo(r,l,i,n)});I(this,"mutateElement",(t,n,r=!0)=>this.scene.mutateElement(t,n,{informMutation:r,isDragging:!1}));I(this,"triggerRender",t=>{t===!0?this.scene.triggerUpdate():this.setState({})});I(this,"toggleSidebar",({name:t,tab:n,force:r})=>{let i;r===void 0?i=this.state.openSidebar?.name===t&&this.state.openSidebar?.tab===n?null:t:i=r?t:null;let l=i?{name:i}:null;return l&&n&&(l.tab=n),this.setState({openSidebar:l}),!!i});I(this,"updateCurrentCursorPosition",Re(t=>{this.lastViewportPosition.x=t.clientX,this.lastViewportPosition.y=t.clientY}));I(this,"getEditorUIOffsets",()=>{let t=this.excalidrawContainerRef?.current?.querySelector(".App-toolbar")?.getBoundingClientRect()?.bottom??0,n=this.excalidrawContainerRef?.current?.querySelector(".sidebar")?.getBoundingClientRect(),r=this.excalidrawContainerRef?.current?.querySelector(".App-menu__left")?.getBoundingClientRect(),i=16;return Wo().rtl?{top:t+i,right:Math.max(this.state.width-(r?.left??this.state.width),0)+i,bottom:i,left:Math.max(n?.right??0,0)+i}:{top:t+i,right:Math.max(this.state.width-(n?.left??this.state.width)+i,0),bottom:i,left:Math.max(r?.right??0,0)+i}});I(this,"onKeyDown",Re(t=>{if("Proxy"in window&&(!t.shiftKey&&/^[A-Z]$/.test(t.key)||t.shiftKey&&/^[a-z]$/.test(t.key))&&(t=new Proxy(t,{get(a,s){let c=a[s];return typeof c=="function"?c.bind(a):s==="key"?t.shiftKey?a.key.toUpperCase():a.key.toLowerCase():c}})),!cC(t.target)){if((t.key===Y.ESCAPE||t.key===Y.ENTER)&&this.state.croppingElementId){this.finishImageCropping();return}let a=te(this.scene.getNonDeletedElementsMap(),this.state);if(a.length===1&&qn(a[0])&&t.key===Y.ENTER){this.startImageCropping(a[0]);return}if(t.key===Y.ESCAPE)this.updateEditorAtom(on,null);else if(t.key===Y.TAB&&(document.activeElement===this.excalidrawContainerRef?.current||document.activeElement?.classList.contains(kf.CONVERT_ELEMENT_TYPE_POPUP))){t.preventDefault();let c=fd(a);Ut.get(on)?.type==="panel"&&Vh(this,{conversionType:c,direction:t.shiftKey?"left":"right"})&&this.store.scheduleCapture(),c&&this.updateEditorAtom(on,{type:"panel"})}if(t.key===Y.ESCAPE&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.clear(),this.triggerRender(!0);return}let s=dm(t.key);if(t[Y.CTRL_OR_CMD]&&s&&!t.shiftKey){t.preventDefault();let c=te(this.scene.getNonDeletedElementsMap(),this.state);c.length===1&&MH(c[0])&&this.flowChartCreator.createNodes(c[0],this.state,NC(t.key),this.scene),this.flowChartCreator.pendingNodes?.length&&!Lf(this.flowChartCreator.pendingNodes,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(this.flowChartCreator.pendingNodes,{animate:!0,duration:300,fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()});return}if(t.altKey){let c=te(this.scene.getNonDeletedElementsMap(),this.state);if(c.length===1&&s){t.preventDefault();let m=this.flowChartNavigator.exploreByDirection(c[0],this.scene.getNonDeletedElementsMap(),NC(t.key));if(m){this.setState(d=>({selectedElementIds:ye({[m]:!0},d)}));let p=this.scene.getNonDeletedElementsMap().get(m);p&&!Lf([p],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(p,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})}return}}}if(t[Y.CTRL_OR_CMD]&&t.key.toLowerCase()===Y.V&&(Kf=t.shiftKey,clearTimeout(qC),qC=window.setTimeout(()=>{Kf=!1},100)),t[Y.CTRL_OR_CMD]&&ql(t.target)&&(t.code===QI.MINUS||t.code===QI.EQUAL)){t.preventDefault();return}if(ql(t.target)&&t.key!==Y.ESCAPE||dm(t.key)&&cC(t.target))return;if(t.key===Y.QUESTION_MARK){this.setState({openDialog:{name:"help"}});return}else if(t.key.toLowerCase()===Y.E&&t.shiftKey&&t[Y.CTRL_OR_CMD]){t.preventDefault(),this.setState({openDialog:{name:"imageExport"}});return}if(t.key===Y.PAGE_UP||t.key===Y.PAGE_DOWN){let a=(t.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;t.key===Y.PAGE_DOWN&&(a=-a),t.shiftKey?this.translateCanvas(s=>({scrollX:s.scrollX+a})):this.translateCanvas(s=>({scrollY:s.scrollY+a}))}if(this.state.openDialog?.name==="elementLinkSelector"||(t.key===Y.ALT&&(cn("COMPLEX_BINDINGS")?this.handleSkipBindMode():xm({app:this,event:t})),this.actionManager.handleKeyDown(t)))return;if(!t.altKey&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&uC(t,Y.Z)){ga=!0,pe(this.interactiveCanvas,AG),t.preventDefault();return}let n=this.props.viewModeEnabled===!0;if(!n&&this.state.viewModeEnabled&&t.key===Y.ESCAPE){this.setActiveTool({type:"selection"});return}if(!n&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged){let a=kG(t.key,this);if(this.state.viewModeEnabled&&a)return;if(a){this.state.activeTool.type!==a&&de("toolbar",a,`keyboard (${this.editorInterface.formFactor==="phone"?"mobile":"desktop"})`),a==="arrow"&&this.state.activeTool.type==="arrow"&&this.setState(s=>({currentItemArrowType:s.currentItemArrowType===$n.sharp?$n.round:s.currentItemArrowType===$n.round?$n.elbow:$n.sharp})),a==="lasso"&&this.state.activeTool.type==="laser"?this.setActiveTool({type:this.state.preferredSelectionTool.type}):this.setActiveTool({type:a}),t.stopPropagation();return}else if(t.key===Y.Q){this.toggleLock("keyboard"),t.stopPropagation();return}}if(this.state.viewModeEnabled)return;if(t[Y.CTRL_OR_CMD]&&!t.repeat&&(cn("COMPLEX_BINDINGS")&&this.resetDelayedBindMode(),Ot(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!=="enabled"})}),xm({app:this,event:t})),dm(t.key)){let a=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),s=new Set;a.filter(d=>Go(d)).filter(d=>{let h=d.startBinding&&!a.some(g=>g.id===d.startBinding?.elementId),f=d.endBinding&&!a.some(g=>g.id===d.endBinding?.elementId);return h||f}).forEach(d=>s.add(d.id)),a=a.filter(d=>!s.has(d.id));let c=this.getEffectiveGridSize()&&(t.shiftKey?rC:this.getEffectiveGridSize())||(t.shiftKey?Nz:rC),m=0,p=0;t.key===Y.ARROW_LEFT?m=-c:t.key===Y.ARROW_RIGHT?m=c:t.key===Y.ARROW_UP?p=-c:t.key===Y.ARROW_DOWN&&(p=c),a.forEach(d=>{this.scene.mutateElement(d,{x:d.x+m,y:d.y+p},{informMutation:!1,isDragging:!1}),gm(d,this.scene,{simultaneouslyUpdated:a})}),this.scene.triggerUpdate(),t.preventDefault()}else if(t.key===Y.ENTER){let a=this.scene.getSelectedElements(this.state);if(a.length===1){let s=a[0];if(t[Y.CTRL_OR_CMD]||Hf(s))bt(s)&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==s.id)&&(this.store.scheduleCapture(),Lt(s)||this.actionManager.executeAction(Ai));else if(zt(s)||AC(s)){let c;zt(s)||(c=s);let m=Rf(s,this.state,this.scene.getNonDeletedElementsMap()),p=m.x,d=m.y;this.startTextEditing({sceneX:p,sceneY:d,container:c}),t.preventDefault();return}else at(s)&&this.setState({editingFrame:s.id})}}if(t.key===Y.SPACE&&fe.pointers.size===0&&(Jn=!0,pe(this.interactiveCanvas,Ce.GRAB),t.preventDefault()),(t.key===Y.G||t.key===Y.S)&&!t.altKey&&!t[Y.CTRL_OR_CMD]){let a=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type==="selection"&&!a.length)return;t.key===Y.G&&(fo(this.state.activeTool.type)||a.some(s=>fo(s.type)))&&(this.setState({openPopup:"elementBackground"}),t.stopPropagation()),t.key===Y.S&&(this.setState({openPopup:"elementStroke"}),t.stopPropagation())}if(!t[Y.CTRL_OR_CMD]&&t.shiftKey&&t.key.toLowerCase()===Y.F){let a=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type==="selection"&&!a.length)return;(this.state.activeTool.type==="text"||a.find(s=>zt(s)||_f(s,this.scene.getNonDeletedElementsMap())))&&(t.preventDefault(),this.setState({openPopup:"fontFamily"}))}let r=t.key.toLocaleLowerCase(),i=r===Y.S&&t.shiftKey&&!t[Y.CTRL_OR_CMD],l=t.key===Y.I||r===Y.G&&t.shiftKey;(i||l)&&this.openEyeDropper({type:i?"stroke":"background"})}));I(this,"onKeyUp",Re(t=>{if(t.key===Y.SPACE&&(this.state.viewModeEnabled&&this.state.activeTool.type!=="laser"||this.state.openDialog?.name==="elementLinkSelector"?pe(this.interactiveCanvas,Ce.GRAB):Ql(this.state.activeTool.type)?It(this.interactiveCanvas):(Ct(this.interactiveCanvas,this.state),this.setState({selectedElementIds:ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),Jn=!1),uC(t,Y.Z)&&(ga=!1,this.restoreCursorAfterZoomKey()),t.key===Y.ALT&&xm({app:this,event:t}),(t.key===Y.ALT&&this.state.bindMode==="skip"||!t[Y.CTRL_OR_CMD]&&!es(this.state))&&(this.setState({bindMode:"orbit"}),this.lastPointerMoveEvent&&cn("COMPLEX_BINDINGS"))){let n=De({clientX:this.lastPointerMoveEvent.clientX,clientY:this.lastPointerMoveEvent.clientY},this.state),r=Ho(Q(n.x,n.y),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(this.state.selectedLinearElement){let i=se.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());Go(i)&&this.handleDelayedBindModeChange(i,r)}}if(!t[Y.CTRL_OR_CMD]){let n=this.state.bindingPreference==="enabled";this.state.isBindingEnabled!==n&&Ot(()=>{this.setState({isBindingEnabled:n})}),xm({app:this,event:t})}if(dm(t.key)){gC(this.scene.getSelectedElements(this.state).filter(ua),this.scene,this.state);let n=this.scene.getNonDeletedElementsMap();this.scene.getSelectedElements(this.state).filter(Gf).forEach(r=>{r.startBinding&&this.scene.mutateElement(r,{startBinding:{...r.startBinding,...ZC(r,n.get(r.startBinding.elementId),"start",n)}}),r.endBinding&&this.scene.mutateElement(r,{endBinding:{...r.endBinding,...ZC(r,n.get(r.endBinding.elementId),"end",n)}})}),this.setState({suggestedBinding:null})}if(t.altKey||this.flowChartNavigator.isExploring&&(this.flowChartNavigator.clear(),this.syncActionResult({captureUpdate:yt.IMMEDIATELY})),!t[Y.CTRL_OR_CMD]&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.pendingNodes?.length&&this.insertNewElements(this.flowChartCreator.pendingNodes);let n=this.flowChartCreator.pendingNodes?.[0];n&&(this.setState(r=>({selectedElementIds:ye({[n.id]:!0},r)})),Lf([n],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())||this.scrollToContent(n,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})),this.flowChartCreator.clear(),this.syncActionResult({captureUpdate:yt.IMMEDIATELY})}}));I(this,"isToolSupported",t=>this.props.UIOptions.tools?.[t]!==!1);I(this,"setActiveTool",(t,n=!1)=>{if(!this.isToolSupported(t.type)){console.warn(`"${t.type}" tool is disabled via "UIOptions.canvasActions.tools.${t.type}"`);return}let r=Oo(this.state,t);r.type==="hand"?pe(this.interactiveCanvas,Ce.GRAB):Jn||Ct(this.interactiveCanvas,{...this.state,activeTool:r}),jz(document.activeElement)&&this.focusContainer(),SH(r.type)||this.setState({suggestedBinding:null}),r.type==="image"&&this.onImageToolbarButtonClick(),this.setState(i=>{let l={snapLines:i.snapLines.length?[]:i.snapLines,originSnapOffset:null,activeEmbeddable:null,selectedLinearElement:Ql(r.type)?i.selectedLinearElement:null,frameToHighlight:null};return r.type==="freedraw"&&this.store.scheduleCapture(),r.type==="lasso"?{...i,...l,activeTool:r,...n?{}:{selectedElementIds:ye({},i),selectedGroupIds:ye({},i),editingGroupId:null,multiElement:null}}:r.type!=="selection"?{...i,...l,activeTool:r,selectedElementIds:ye({},i),selectedGroupIds:ye({},i),editingGroupId:null,multiElement:null}:{...i,...l,activeTool:r}})});I(this,"setOpenDialog",t=>{this.setState({openDialog:t})});I(this,"setCursor",t=>{pe(this.interactiveCanvas,t)});I(this,"resetCursor",()=>{It(this.interactiveCanvas)});I(this,"isTouchScreenMultiTouchGesture",()=>fe.pointers.size>=2);I(this,"getName",()=>this.state.name||this.props.name||`${E("labels.untitled")}-${dC()}`);I(this,"onGestureStart",Re(t=>{t.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:ye({},this.state),activeEmbeddable:null}),fe.initialScale=this.state.zoom.value}));I(this,"onGestureChange",Re(t=>{if(t.preventDefault(),this.isTouchScreenMultiTouchGesture())return;let n=fe.initialScale;n&&this.setState(r=>({...To({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:Gt(n*t.scale)},r)}))}));I(this,"onGestureEnd",Re(t=>{t.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:ye(this.state.previousSelectedElementIds,this.state)}),fe.initialScale=null}));I(this,"isHittingTextAutoResizeHandle",(t,n)=>{let r=jC(t,this.state);return!!(r&&!r.isDeleted&&!r.autoResize&&wy(n,r,this.state.zoom.value,this.editorInterface.formFactor))});I(this,"handleTextAutoResizeHandlePointerDown",(t,n)=>{let r=jC(t,this.state);return!r||!this.isHittingTextAutoResizeHandle(t,n)?!1:(this.actionManager.executeAction(rh,"ui",r),this.resetCursor(),!0)});I(this,"startTextEditing",({sceneX:t,sceneY:n,insertAtParentCenter:r=!0,container:i,autoEdit:l=!0,initialCaretSceneCoords:a})=>{let s=!1,c=r&&this.getTextWysiwygSnappedToCenterPosition(t,n,this.state,i);i&&c&&(_f(i,this.scene.getNonDeletedElementsMap())||(s=!0));let m=this.getSelectedTextElement(i)||this.getTextElementAtPosition(t,n),p=m?.fontFamily||this.state.currentItemFontFamily,d=m?.lineHeight||lC(p),h=this.state.currentItemFontSize;if(!m&&s&&i&&!ua(i)){let w=eG(If({fontSize:h,fontFamily:p}),d),T=tG(h,d),S=Math.max(i.height,T),P=Math.max(i.width,w);this.scene.mutateElement(i,{height:S,width:P}),t=i.x+P/2,n=i.y+S/2,c&&(c=this.getTextWysiwygSnappedToCenterPosition(t,n,this.state,i))}let f=this.getTextCreationGridPoint(t,n),g=c?{x:c.elementCenterX,y:c.elementCenterY}:m?{x:t,y:n}:{x:f?.x??t,y:f===null?n-FC(h,d)/2:f.y},b=this.getTopLayerFrameAtSceneCoords({x:g.x,y:g.y}),y=b&&(!s||!i||i.frameId===b.id)?b.id:null,v=m||xC({x:g.x,y:g.y,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:"",fontSize:h,fontFamily:p,textAlign:c?"center":this.state.currentItemTextAlign,verticalAlign:c?Uz.MIDDLE:oC,containerId:s?i?.id:void 0,groupIds:i?.groupIds??[],lineHeight:d,angle:i?ua(i)?0:i.angle:0,frameId:y});if(!m&&s&&i&&this.scene.mutateElement(i,{boundElements:(i.boundElements||[]).concat({type:"text",id:v.id})}),this.setState({editingTextElement:v}),!m)if(i&&s){let x=this.scene.getElementIndex(i.id);this.scene.insertElementsAtIndex([v],x+1)}else this.insertNewElement(v);l||m||i?this.handleTextWysiwyg(v,{isExistingElement:!!m,initialCaretSceneCoords:m?a:null}):this.setState({newElement:v,multiElement:null})});I(this,"startImageCropping",t=>{this.store.scheduleCapture(),this.setState({croppingElementId:t.id})});I(this,"finishImageCropping",()=>{this.state.croppingElementId&&(this.store.scheduleCapture(),this.setState({croppingElementId:null}))});I(this,"shouldHandleBrowserCanvasDoubleClick",t=>{if(t==="touch"||this.lastCompletedCanvasClicks.length===0)return!0;if(this.lastCompletedCanvasClicks.length<2)return!1;let[n,r]=this.lastCompletedCanvasClicks;return sn(Q(n.x,n.y),Q(r.x,r.y))<=pC});I(this,"handleCanvasDoubleClick",t=>{if(this.state.editingTextElement||!this.shouldHandleBrowserCanvasDoubleClick(t.type)||this.state.multiElement||this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let n=this.scene.getSelectedElements(this.state),{x:r,y:i}=De(t,this.state);if(n.length===1&&bt(n[0])){let a=n[0];if((t[Y.CTRL_OR_CMD]&&Gf(a)||Hf(a))&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==a.id)){this.actionManager.executeAction(Ai);return}else if(this.state.selectedLinearElement&&Lt(n[0])){let s=se.getSegmentMidpointHitCoords(this.state.selectedLinearElement,{x:r,y:i},this.state,this.scene.getNonDeletedElementsMap()),c=s?se.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,s,this.scene.getNonDeletedElementsMap()):-1;if(c&&c>-1){this.store.scheduleCapture(),se.deleteFixedSegment(n[0],this.scene,c);let m=se.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:r,y:i},this.state,this.scene.getNonDeletedElementsMap()),p=m?se.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,m,this.scene.getNonDeletedElementsMap()):null;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,segmentMidpoint:{index:p,value:s,added:!1}},segmentMidPointHoveredCoords:m}});return}}else if(this.state.selectedLinearElement?.isEditing&&this.state.selectedLinearElement.elementId===a.id&&Hf(a))return}if(n.length===1&&qn(n[0])){this.startImageCropping(n[0]);return}if(It(this.interactiveCanvas),aG(this.state).length>0){let a=this.getElementAtPosition(r,i),s=a&&iG(a,this.state.selectedGroupIds);if(s){this.store.scheduleCapture(),this.setState(c=>({...c,...eo({editingGroupId:s,selectedElementIds:{[a.id]:!0}},this.scene.getNonDeletedElements(),c,this)}));return}}if(It(this.interactiveCanvas),!t[Y.CTRL_OR_CMD]&&!this.state.viewModeEnabled){let a=this.getElementAtPosition(r,i);if(Pf(a)){this.setState({activeEmbeddable:{element:a,state:"active"}});return}if(!this.state.selectedLinearElement?.isEditing){let s=this.getTextBindableContainerAtPosition(r,i);if(s&&(wC(s)||!Jz(s.backgroundColor)||os({point:Q(r,i),element:s,elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(s)}))){let c=Rf(s,this.state,this.scene.getNonDeletedElementsMap());r=c.x,i=c.y}this.startTextEditing({sceneX:r,sceneY:i,insertAtParentCenter:!t.altKey,container:s})}}});I(this,"handleCanvasClick",t=>{if(t.button!==Bo.MAIN){this.lastCompletedCanvasClicks=[];return}this.lastCompletedCanvasClicks=[...this.lastCompletedCanvasClicks.slice(-1),{x:t.clientX,y:t.clientY}]});I(this,"getElementLinkAtPosition",(t,n)=>{if(n&&n.locked)return;let r=this.scene.getNonDeletedElements(),i=-1;for(let l=r.length-1;l>=0;l--){let a=r[l];if(n&&a.id===n.id&&(i=l),a.link&&l>=i&&gs(a,this.scene.getNonDeletedElementsMap(),this.state,Q(t.x,t.y),this.editorInterface.formFactor==="phone"))return a}});I(this,"handleElementLinkClick",t=>{let n=sn(Q(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY),Q(this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY));if(!this.hitLinkElement||n>nC)return;let r=De(this.lastPointerDownEvent,this.state),i=this.scene.getNonDeletedElementsMap(),l=gs(this.hitLinkElement,i,this.state,Q(r.x,r.y),this.editorInterface.formFactor==="phone"),a=De(this.lastPointerUpEvent,this.state),s=gs(this.hitLinkElement,i,this.state,Q(a.x,a.y),this.editorInterface.formFactor==="phone");if(l&&s){Pu();let c=this.hitLinkElement.link;if(c){c=Tf(c);let m;if(this.props.onLinkOpen&&(m=qz(q.EXCALIDRAW_LINK,t.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:c},m)),!m?.defaultPrevented){let p=Kz(c)?"_self":"_blank",d=window.open(void 0,p);d&&(d.opener=null,d.location=c)}}}});I(this,"getTopLayerFrameAtSceneCoords",(t,n)=>{let r=this.scene.getNonDeletedElementsMap(),i=this.scene.getNonDeletedFramesLikes().filter(s=>!s.locked&&DC(t,s,r));if(!i.length)return null;let l=i.at(-1),a=this.getElementsAtPosition(t.x,t.y,{includeLockedElements:!0}).findLast(s=>!n?.excludeElementIds?.[s.id]);if(a){if(at(a)&&!a.locked)return l;let s=this.scene.getElementIndex(a.id),c=this.scene.getElementIndex(l.id);if(s!==-1&&c!==-1&&s<=c)return l;let m=n?.currentFrameId?i.find(p=>p.id===n.currentFrameId)??null:null;return m||(a.frameId?i.find(p=>p.id===a.frameId)??null:null)}return l});I(this,"updateFrameToHighlight",t=>{this.state.frameToHighlight!==t&&this.setState({frameToHighlight:t})});I(this,"maybeUpdateFrameToHighlightOnPointerMove",(t,n)=>{this.state.newElement||this.state.multiElement||this.state.selectionElement||this.state.selectedElementsAreBeingDragged||this.updateFrameToHighlight(!n&&SG(this.state.activeTool.type)?this.getTopLayerFrameAtSceneCoords(t):null)});I(this,"insertNewElements",t=>{if(!t.length)return;let n=[];for(let r of t){let i=n[n.length-1];i?.[0].frameId===r.frameId?i.push(r):n.push([r])}for(let r of n){let i=r[0].frameId,l=i?BH(this.scene.getElementsIncludingDeleted(),i):null;this.scene.insertElementsAtIndex(r,l)}});I(this,"insertNewElement",t=>{this.insertNewElements([t]);let n=t.frameId?this.scene.getNonDeletedElement(t.frameId):null;this.updateFrameToHighlight(n&&at(n)?n:null)});I(this,"handleCanvasPointerMove",t=>{this.savePointer(t.clientX,t.clientY,this.state.cursorButton),this.lastPointerMoveEvent=t.nativeEvent;let n=De(t,this.state),{x:r,y:i}=n;this.lastPointerMoveCoords={x:r,y:i},fe.pointers.has(t.pointerId)&&fe.pointers.set(t.pointerId,{x:t.clientX,y:t.clientY});let l=fe.initialScale;if(fe.pointers.size===2&&fe.lastCenter&&l&&fe.initialDistance){let g=ah(fe.pointers),b=g.x-fe.lastCenter.x,y=g.y-fe.lastCenter.y;fe.lastCenter=g;let v=lh(Array.from(fe.pointers.values())),x=this.state.activeTool.type==="freedraw"&&this.state.penMode?1:v/fe.initialDistance,w=x?Gt(l*x):this.state.zoom.value;this.setState(T=>{let S=To({viewportX:g.x,viewportY:g.y,nextZoom:w},T);return this.translateCanvas({zoom:S.zoom,scrollX:S.scrollX+2*(b/w),scrollY:S.scrollY+2*(y/w),shouldCacheIgnoreZoom:!0}),null}),this.resetShouldCacheIgnoreZoomDebounced()}else fe.lastCenter=fe.initialDistance=fe.initialScale=null;if(Jn||ga||as||ls||Vf||ro(this.state))return;let s=bh(ss,t.clientX-this.state.offsetLeft,t.clientY-this.state.offsetTop).isOverEither;if(!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.multiElement&&(s?It(this.interactiveCanvas):Ct(this.interactiveCanvas,this.state)),this.maybeUpdateFrameToHighlightOnPointerMove({x:r,y:i},s),!this.state.newElement&&fy(this.state.activeTool.type)){let{originOffset:g,snapLines:b}=gy(this.scene.getNonDeletedElements(),this,{x:r,y:i},t,this.scene.getNonDeletedElementsMap());this.setState(y=>{let v=Jl(y.snapLines,b),x=y.originSnapOffset?Jl(y.originSnapOffset,g):g;return y.snapLines===v&&y.originSnapOffset===x?null:{snapLines:v,originSnapOffset:x}})}else!this.state.newElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.selectionElement&&this.setState(g=>g.snapLines.length?{snapLines:[]}:null);if(this.state.selectedLinearElement?.isEditing&&!this.state.selectedLinearElement.isDragging){let g=this.state.newElement?null:se.handlePointerMoveInEditMode(t,r,i,this);g&&g!==this.state.selectedLinearElement&&Ot(()=>{this.setState({selectedLinearElement:g})})}if(CH(this.state.activeTool.type)){let{newElement:g}=this.state;if(!g&&es(this.state)){let b=Q(r,i),y=this.scene.getNonDeletedElementsMap(),v=Ho(b,this.scene.getNonDeletedElements(),y,Uf(this.state.zoom));v?this.setState({suggestedBinding:{element:v,midPoint:Wf(b,v,y,this.state.zoom)}}):this.state.suggestedBinding&&this.setState({suggestedBinding:null})}}if(this.state.multiElement&&this.state.selectedLinearElement){let{multiElement:g,selectedLinearElement:b}=this.state,{x:y,y:v,points:x}=g,w=x[x.length-1],{lastCommittedPoint:T}=b;if(Ct(this.interactiveCanvas,this.state),w===T)ua(this.state.newElement)&&es(this.state)&&Ho(Q(r,i),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),Uf(this.state.zoom))?(this.actionManager.executeAction(ht,"ui",{event:t.nativeEvent,sceneCoords:{x:r,y:i}}),this.setState({suggestedBinding:null}),this.state.activeTool.locked||(It(this.interactiveCanvas),this.setState(P=>({newElement:null,activeTool:Oo(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:ye({...P.selectedElementIds,[g.id]:!0},P),selectedLinearElement:new se(g,this.scene.getNonDeletedElementsMap())})))):sn(Q(r-y,i-v),w)>=vf?(this.scene.mutateElement(g,{points:[...x,Q(r-y,i-v)]},{informMutation:!1,isDragging:!1}),zo(this.state.selectedLinearElement?.initialState,"initialState must be set"),this.setState({selectedLinearElement:{...this.state.selectedLinearElement,lastCommittedPoint:x[x.length-1],selectedPointsIndices:[g.points.length-1],initialState:{...this.state.selectedLinearElement.initialState,lastClickedPoint:g.points.length-1}}})):pe(this.interactiveCanvas,Ce.POINTER);else if(x.length>2&&T&&sn(Q(r-y,i-v),T)<vf){pe(this.interactiveCanvas,Ce.POINTER),this.scene.mutateElement(g,{points:x.slice(0,-1)},{informMutation:!1,isDragging:!1});let S=g.points.length-1;this.setState({selectedLinearElement:{...b,selectedPointsIndices:b.selectedPointsIndices?[...new Set(b.selectedPointsIndices.map(P=>Math.min(P,S)))]:b.selectedPointsIndices,lastCommittedPoint:g.points[S],initialState:{...b.initialState,lastClickedPoint:S}}})}else{SC(x,this.state.zoom.value)&&pe(this.interactiveCanvas,Ce.POINTER);let S=this.scene.getNonDeletedElementsMap();if(Gf(g)){let M=Ho(Q(r,i),this.scene.getNonDeletedElements(),S);cn("COMPLEX_BINDINGS")&&this.handleDelayedBindModeChange(g,M)}zo(this.state.selectedLinearElement,"Expected selectedLinearElement to be set to operate on a linear element");let P=se.handlePointerMove(t.nativeEvent,this,r,i,this.state.selectedLinearElement);P&&this.setState(P)}return}if(this.state.activeTool.type==="arrow"){let g=Ho(Q(r,i),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),Uf(this.state.zoom)),b=Q(r,i),y=this.scene.getNonDeletedElementsMap();g&&!bG(b,g,y)&&this.setState({suggestedBinding:{element:g,midPoint:Wf(b,g,y,this.state.zoom)}})}let c=!!t.buttons,m=this.state.activeTool.type==="laser";if(c||!m&&this.state.activeTool.type!=="selection"&&this.state.activeTool.type!=="lasso"&&this.state.activeTool.type!=="text"&&this.state.activeTool.type!=="eraser")return;let p=this.scene.getNonDeletedElements(),d=this.scene.getSelectedElements(this.state);if(this.isHittingTextAutoResizeHandle(d,n)){pe(this.interactiveCanvas,Ce.POINTER);return}if(d.length===1&&!s&&!this.state.selectedLinearElement?.isEditing){if(this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,r,i),(!this.state.selectedLinearElement||this.state.selectedLinearElement.hoverPointIndex===-1)&&this.state.openDialog?.name!=="elementLinkSelector"&&!(d.length===1&&Lt(d[0]))&&!(bt(d[0])&&(this.editorInterface.userAgent.isMobileDevice||d[0].points.length===2))){let g=GC(p,this.state,r,i,this.state.zoom,t.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);if(g&&g.transformHandleType){pe(this.interactiveCanvas,HC(g));return}}}else if(d.length>1&&!s&&this.state.openDialog?.name!=="elementLinkSelector"){let g=UC(pa(d),r,i,this.state.zoom,t.pointerType,this.editorInterface);if(g){pe(this.interactiveCanvas,HC({transformHandleType:g}));return}}if(wt(this.state))return;let h=this.getElementAtPosition(r,i,{preferSelected:!0,includeLockedElements:!0}),f=null;if(h&&h.locked?f=null:f=h,this.handleIframeLikeElementHover({hitElement:f,scenePointer:n,moveEvent:t})||(this.hitLinkElement=this.getElementLinkAtPosition(n,h)),this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id])pe(this.interactiveCanvas,Ce.POINTER),d2(this.hitLinkElement,this.state,this.scene.getNonDeletedElementsMap());else{if(Pu(),m)return;f&&(f.link||dn(f))&&this.state.selectedElementIds[f.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:"info"}):this.state.activeTool.type==="text"?pe(this.interactiveCanvas,zt(f)?Ce.TEXT:Ce.CROSSHAIR):!t[Y.CTRL_OR_CMD]&&this.isHittingCommonBoundingBoxOfSelectedElements(n,d)?pe(this.interactiveCanvas,Ce.MOVE):this.state.viewModeEnabled?pe(this.interactiveCanvas,Ce.GRAB):this.state.openDialog?.name==="elementLinkSelector"?pe(this.interactiveCanvas,Ce.AUTO):s?pe(this.interactiveCanvas,Ce.AUTO):!t[Y.CTRL_OR_CMD]&&f?.id!==this.state.editingTextElement?.id?(f||this.isHittingCommonBoundingBoxOfSelectedElements(n,d))&&!f?.locked&&(!f||!Lt(f)||!(f.startBinding||f.endBinding))&&(this.state.activeTool.type!=="lasso"||d.length>0)&&pe(this.interactiveCanvas,Ce.MOVE):pe(this.interactiveCanvas,Ce.AUTO),this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,r,i)}this.state.openDialog?.name==="elementLinkSelector"&&f?this.setState(g=>({hoveredElementIds:Jl(g.hoveredElementIds,eo({editingGroupId:g.editingGroupId,selectedElementIds:{[f.id]:!0}},this.scene.getNonDeletedElements(),g,this).selectedElementIds)})):this.state.openDialog?.name==="elementLinkSelector"&&!f&&this.setState(g=>({hoveredElementIds:Jl(g.hoveredElementIds,{})}))});I(this,"handleEraser",(t,n)=>{let r=this.eraserTrail.addPointToPath(n.x,n.y,t.altKey);this.elementsPendingErasure=new Set(r),this.triggerRender()});I(this,"handleTouchMove",t=>{cs=!0});I(this,"handleCanvasPointerDown",t=>{let n=this.scene.getSelectedElements(this.state);if(!t.ctrlKey){let g=this.state.bindingPreference==="enabled";this.state.isBindingEnabled!==g&&this.setState({isBindingEnabled:g})}let r=De(t,this.state),{x:i,y:l}=r;this.lastPointerMoveCoords={x:i,y:l};let a=t.target;if(a.setPointerCapture&&a.setPointerCapture(t.pointerId),this.maybeCleanupAfterMissingPointerUp(t.nativeEvent),this.maybeUnfollowRemoteUser(),this.state.searchMatches&&(this.setState(g=>({searchMatches:g.searchMatches&&{focusedId:null,matches:g.searchMatches.matches.map(b=>({...b,focus:!1}))}})),this.updateEditorAtom(Pg,null)),Ut.get(on)&&this.updateEditorAtom(on,null),this.state.contextMenu&&this.setState({contextMenu:null}),this.state.snapLines&&this.setAppState({snapLines:[]}),this.state.openPopup&&this.setState({openPopup:null}),this.updateGestureOnPointerDown(t),t.pointerType==="touch"&&this.state.newElement&&this.state.newElement.type==="freedraw"){let g=this.state.newElement;this.updateScene({...g.points.length<10?{elements:this.scene.getElementsIncludingDeleted().filter(b=>b.id!==g.id)}:{},appState:{newElement:null,editingTextElement:null,suggestedBinding:null,selectedElementIds:ye(Object.keys(this.state.selectedElementIds).filter(b=>b!==g.id).reduce((b,y)=>(b[y]=this.state.selectedElementIds[y],b),{}),this.state)},captureUpdate:this.state.openDialog?.name==="elementLinkSelector"?yt.EVENTUALLY:yt.NEVER});return}let s=document.getSelection();if(s?.anchorNode&&s.removeAllRanges(),this.maybeOpenContextMenuAfterPointerDownOnTouchDevices(t),!this.state.penDetected&&t.pointerType==="pen"&&this.setState(g=>({penMode:!0,penDetected:!0})),!this.editorInterface.isTouchScreen&&["pen","touch"].includes(t.pointerType)&&(this.editorInterface=Sf(this.editorInterface,{isTouchScreen:!0})),as||ls||(this.lastPointerDownEvent=t,this.handleCanvasZoomUsingZDrag(t)||this.handleCanvasPanUsingWheelOrSpaceDrag(t)))return;if(this.setState({lastPointerDownWith:t.pointerType,cursorButton:"down"}),this.savePointer(t.clientX,t.clientY,"down"),t.button===Bo.ERASER&&this.state.activeTool.type!==Fo.eraser){this.setState({activeTool:Oo(this.state,{type:Fo.eraser,lastActiveToolBeforeEraser:this.state.activeTool})},()=>{this.handleCanvasPointerDown(t);let g=()=>{b(),y?.(),wt(this.state)&&this.setState({activeTool:Oo(this.state,{...this.state.activeTool.lastActiveTool||{type:Fo.selection},lastActiveToolBeforeEraser:null})})},b=Ge(window,q.POINTER_UP,g,{once:!0}),y;requestAnimationFrame(()=>{y=this.missingPointerEventCleanupEmitter.once(g)})});return}if(t.button!==Bo.MAIN&&t.button!==Bo.TOUCH&&t.button!==Bo.ERASER||fe.pointers.size>1)return;let c=this.initialPointerDownState(t);if(this.setState({selectedElementsAreBeingDragged:!1}),this.handleTextAutoResizeHandlePointerDown(n,c.origin)||this.handleDraggingScrollBar(t,c)||(this.clearSelectionIfNotUsingSelection(),this.handleSelectionOnPointerDown(t,c))||!(!this.state.penMode||t.pointerType!=="touch"||this.state.activeTool.type==="selection"||this.state.activeTool.type==="lasso"||this.state.activeTool.type==="text"||this.state.activeTool.type==="image"))return;if(this.state.activeTool.type==="lasso"){let g=c.hit.element&&this.isASelectedElement(c.hit.element);(t.altKey&&t[Y.CTRL_OR_CMD]&&!c.resize.handleType||!c.hit.hasHitCommonBoundingBoxOfSelectedElements&&!c.resize.handleType&&!g)&&(this.lassoTrail.hasCurrentTrail||this.lassoTrail.startPath(c.origin.x,c.origin.y,t.shiftKey),c.drag.blockDragging=this.editorInterface.formFactor==="desktop"),this.editorInterface.formFactor!=="desktop"&&c.hit.element&&!g&&(this.setState(v=>{let x={...v.selectedElementIds,[c.hit.element.id]:!0},w=[];Object.keys(v.selectedElementIds).forEach(S=>{let P=this.scene.getElement(S);P&&w.push(P)});let T=c.hit.element;if(at(T))Nf(w,T.id).forEach(S=>{delete x[S.id]});else if(T.frameId)x[T.frameId]&&delete x[T.id];else{let S=T.groupIds,P=new Set(S.flatMap(M=>Lr(this.scene.getNonDeletedElements(),M)).filter(M=>at(M)).map(M=>M.id));P.size>0&&w.forEach(M=>{M.frameId&&P.has(M.frameId)&&(delete x[M.id],M.groupIds.flatMap(_=>Lr(this.scene.getNonDeletedElements(),_)).forEach(_=>{delete x[_.id]}))})}return{...eo({editingGroupId:v.editingGroupId,selectedElementIds:x},this.scene.getNonDeletedElements(),v,this),showHyperlinkPopup:T.link||dn(T)?"info":!1}}),c.hit.wasAddedToSelection=!0)}else this.state.activeTool.type==="text"?this.handleTextOnPointerDown(t,c):this.state.activeTool.type==="arrow"||this.state.activeTool.type==="line"?this.handleLinearElementOnPointerDown(t,this.state.activeTool.type,c):this.state.activeTool.type==="freedraw"?this.handleFreeDrawElementOnPointerDown(t,this.state.activeTool.type,c):this.state.activeTool.type==="custom"?Ct(this.interactiveCanvas,this.state):this.state.activeTool.type===Fo.frame||this.state.activeTool.type===Fo.magicframe?this.createFrameElementOnPointerDown(c,this.state.activeTool.type):this.state.activeTool.type==="laser"?this.laserTrails.startPath(c.lastCoords.x,c.lastCoords.y):this.state.activeTool.type!=="eraser"&&this.state.activeTool.type!=="hand"&&this.state.activeTool.type!=="image"&&this.createGenericElementOnPointerDown(this.state.activeTool.type,c);this.props?.onPointerDown?.(this.state.activeTool,c),this.onPointerDownEmitter.trigger(this.state.activeTool,c,t),this.state.activeTool.type==="eraser"&&this.eraserTrail.startPath(c.lastCoords.x,c.lastCoords.y);let p=this.onPointerMoveFromPointerDownHandler(c),d=this.onPointerUpFromPointerDownHandler(c),h=this.onKeyDownFromPointerDownHandler(c),f=this.onKeyUpFromPointerDownHandler(c);this.missingPointerEventCleanupEmitter.once(g=>d(g||t.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type==="laser")&&(window.addEventListener(q.POINTER_MOVE,p),window.addEventListener(q.POINTER_UP,d),window.addEventListener(q.KEYDOWN,h),window.addEventListener(q.KEYUP,f),c.eventListeners.onMove=p,c.eventListeners.onUp=d,c.eventListeners.onKeyUp=f,c.eventListeners.onKeyDown=h)});I(this,"handleCanvasPointerUp",t=>{if(cn("COMPLEX_BINDINGS")&&this.resetDelayedBindMode(),this.removePointer(t),this.lastPointerUpIsDoubleClick=this.isDoubleClick(this.lastPointerUpEvent,t),this.lastPointerUpEvent=t,!t.ctrlKey){let l=this.state.bindingPreference==="enabled";this.state.isBindingEnabled!==l&&this.setState({isBindingEnabled:l})}let n=De({clientX:t.clientX,clientY:t.clientY},this.state),{x:r,y:i}=n;if(this.lastPointerMoveCoords={x:r,y:i},!this.handleIframeLikeCenterClick()){if(this.editorInterface.isTouchScreen){let l=this.getElementAtPosition(n.x,n.y,{includeLockedElements:!0});this.hitLinkElement=this.getElementLinkAtPosition(n,l)}this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?this.handleElementLinkClick(t):this.state.viewModeEnabled&&this.setState({activeEmbeddable:null,selectedElementIds:{}})}});I(this,"maybeOpenContextMenuAfterPointerDownOnTouchDevices",t=>{t.pointerType==="touch"&&(cs=!1,Qn?cs=!0:Qn=window.setTimeout(()=>{Qn=0,cs||this.handleCanvasContextMenu(t)},Gz))});I(this,"resetContextMenuTimer",()=>{clearTimeout(Qn),Qn=0,cs=!1});I(this,"maybeCleanupAfterMissingPointerUp",t=>{Dr?.(),this.missingPointerEventCleanupEmitter.trigger(t).clear()});I(this,"handleCanvasZoomUsingZDrag",t=>{if(!(ga&&fe.pointers.size<=1&&t.button===Bo.MAIN))return!1;ls=!0,this.focusContainer(),t.preventDefault();let n=t.clientX,r=t.clientY,i=t.clientX,l=this.state.zoom.value,a=200,s=Tl(m=>{let p=Gt(l*2**((m.clientX-i)/a));this.translateCanvas(d=>({...To({viewportX:n,viewportY:r,nextZoom:p},d),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced()}),c=Re(Dr=()=>{Dr=null,ls=!1,ga||this.restoreCursorAfterZoomKey(),window.removeEventListener(q.POINTER_MOVE,s),window.removeEventListener(q.POINTER_UP,c),window.removeEventListener(q.BLUR,c),s.flush()});return window.addEventListener(q.BLUR,c),window.addEventListener(q.POINTER_MOVE,s,{passive:!0}),window.addEventListener(q.POINTER_UP,c),!0});I(this,"restoreCursorAfterZoomKey",()=>{this.state.viewModeEnabled&&this.state.activeTool.type!=="laser"?pe(this.interactiveCanvas,Ce.GRAB):Ql(this.state.activeTool.type)?It(this.interactiveCanvas):Ct(this.interactiveCanvas,this.state)});I(this,"handleCanvasPanUsingWheelOrSpaceDrag",t=>{if(!(fe.pointers.size<=1&&(t.button===Bo.WHEEL||t.button===Bo.MAIN&&Jn||ro(this.state)||this.state.viewModeEnabled&&this.state.activeTool.type!=="laser")))return!1;as=!0,this.focusContainer(),this.state.editingTextElement||t.preventDefault();let n=!1,r=typeof window===void 0?!1:/Linux/.test(window.navigator.platform);pe(this.interactiveCanvas,Ce.GRABBING);let{clientX:i,clientY:l}=t,a=Tl(c=>{let m=i-c.clientX,p=l-c.clientY;if(i=c.clientX,l=c.clientY,r&&!n&&(Math.abs(m)>1||Math.abs(p)>1)){n=!0;let d=f=>{document.body.removeEventListener(q.PASTE,d),f.stopPropagation()},h=()=>{setTimeout(()=>{document.body.removeEventListener(q.PASTE,d),window.removeEventListener(q.POINTER_UP,h)},100)};document.body.addEventListener(q.PASTE,d),window.addEventListener(q.POINTER_UP,h)}this.translateCanvas({scrollX:this.state.scrollX-m/this.state.zoom.value,scrollY:this.state.scrollY-p/this.state.zoom.value})}),s=Re(Dr=()=>{Dr=null,as=!1,Jn||(this.state.viewModeEnabled&&this.state.activeTool.type!=="laser"?pe(this.interactiveCanvas,Ce.GRAB):Ct(this.interactiveCanvas,this.state)),this.setState({cursorButton:"up"}),this.savePointer(t.clientX,t.clientY,"up"),window.removeEventListener(q.POINTER_MOVE,a),window.removeEventListener(q.POINTER_UP,s),window.removeEventListener(q.BLUR,s),a.flush()});return window.addEventListener(q.BLUR,s),window.addEventListener(q.POINTER_MOVE,a,{passive:!0}),window.addEventListener(q.POINTER_UP,s),!0});I(this,"clearSelectionIfNotUsingSelection",()=>{Ql(this.state.activeTool.type)||this.setState({selectedElementIds:ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})});I(this,"handleSelectionOnPointerDown",(t,n)=>{if(Ql(this.state.activeTool.type)){let r=this.scene.getNonDeletedElements(),i=this.scene.getNonDeletedElementsMap(),l=this.scene.getSelectedElements(this.state);if(l.length===1&&!this.state.selectedLinearElement?.isEditing&&!Lt(l[0])&&!(bt(l[0])&&(this.editorInterface.userAgent.isMobileDevice||l[0].points.length===2))&&!(this.state.selectedLinearElement&&this.state.selectedLinearElement.hoverPointIndex!==-1)){let a=GC(r,this.state,n.origin.x,n.origin.y,this.state.zoom,t.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);a!=null&&(a.transformHandleType==="rotation"?(this.setState({resizingElement:a.element}),n.resize.handleType=a.transformHandleType):(this.state.croppingElementId||this.setState({resizingElement:a.element}),n.resize.handleType=a.transformHandleType))}else l.length>1&&(n.resize.handleType=UC(pa(l),n.origin.x,n.origin.y,this.state.zoom,t.pointerType,this.editorInterface));if(n.resize.handleType)n.resize.isResizing=!0,n.resize.offset=Cf(dG(n.resize.handleType,l,i,n.origin.x,n.origin.y)),l.length===1&&bt(l[0])&&l[0].points.length===2&&(n.resize.arrowDirection=mG(n.resize.handleType,l[0]));else{if(this.state.selectedLinearElement){let d=this.state.selectedLinearElement,h=se.handlePointerDown(t,this,this.store,n.origin,d,this.scene);if(h.hitElement&&(n.hit.element=h.hitElement),h.linearElementEditor&&this.setState({selectedLinearElement:h.linearElementEditor}),h.didAddPoint)return!0;let f=this.scene.getNonDeletedElementsMap(),g=se.getElement(d.elementId,f);if(g&&Go(g)){let{hitFocusPoint:b,pointerOffset:y}=TG(g,n,f,this.state);if(b)return this.setState({selectedLinearElement:{...d,hoveredFocusPointBinding:b,draggedFocusPointBinding:b,pointerOffset:y}}),!1}}let a=this.getElementsAtPosition(n.origin.x,n.origin.y,{includeLockedElements:!0}),s=a.filter(d=>!d.locked),c=this.getElementAtPosition(n.origin.x,n.origin.y,{allHitElements:a});if((!c||c.id!==this.state.activeLockedId)&&this.setState({activeLockedId:null}),c&&c.locked&&!s.some(d=>this.state.selectedElementIds[d.id])?n.hit.element=null:n.hit.element=n.hit.element??this.getElementAtPosition(n.origin.x,n.origin.y),this.hitLinkElement=this.getElementLinkAtPosition(n.origin,c),this.hitLinkElement)return!0;if(this.state.croppingElementId&&n.hit.element?.id!==this.state.croppingElementId&&this.finishImageCropping(),n.hit.element&&this.getElementLinkAtPosition({x:n.origin.x,y:n.origin.y},n.hit.element))return!1;n.hit.allHitElements=s;let m=n.hit.element,p=n.hit.allHitElements.some(d=>this.isASelectedElement(d));if((m===null||!p)&&!t.shiftKey&&!n.hit.hasHitCommonBoundingBoxOfSelectedElements&&(!this.state.selectedLinearElement?.isEditing||m&&m?.id!==this.state.selectedLinearElement?.elementId)&&this.clearSelection(m),this.state.selectedLinearElement?.isEditing)this.setState(d=>({selectedLinearElement:d.selectedLinearElement?{...d.selectedLinearElement,isEditing:!!m&&m.id===this.state.selectedLinearElement?.elementId}:null,selectedElementIds:d.selectedLinearElement?ye({[d.selectedLinearElement.elementId]:!0},this.state):ye({},d)}));else if(m!=null){if(t[Y.CTRL_OR_CMD])return t.altKey?(this.state.openDialog?.name==="elementLinkSelector"&&this.setOpenDialog(null),this.lassoTrail.startPath(n.origin.x,n.origin.y,t.shiftKey),this.setActiveTool({type:"lasso",fromSelection:!0}),!1):(this.state.selectedElementIds[m.id]||(n.hit.wasAddedToSelection=!0),this.setState(d=>({...rG(d,m),previousSelectedElementIds:this.state.selectedElementIds})),!1);this.state.selectedElementIds[m.id]||(this.state.editingGroupId&&!OC(m,this.state.editingGroupId)&&this.setState({selectedElementIds:ye({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),!p&&!n.hit.hasHitCommonBoundingBoxOfSelectedElements&&(this.setState(d=>{let h={...d.selectedElementIds,[m.id]:!0},f=[];if(Object.keys(d.selectedElementIds).forEach(g=>{let b=this.scene.getElement(g);b&&f.push(b)}),at(m))Nf(f,m.id).forEach(g=>{delete h[g.id]});else if(m.frameId)h[m.frameId]&&delete h[m.id];else{let g=m.groupIds,b=new Set(g.flatMap(y=>Lr(this.scene.getNonDeletedElements(),y)).filter(y=>at(y)).map(y=>y.id));b.size>0&&f.forEach(y=>{y.frameId&&b.has(y.frameId)&&(delete h[y.id],y.groupIds.flatMap(v=>Lr(this.scene.getNonDeletedElements(),v)).forEach(v=>{delete h[v.id]}))})}return d.openDialog?.name==="elementLinkSelector"&&(m.groupIds.some(g=>d.selectedGroupIds[g])||(h={[m.id]:!0})),{...eo({editingGroupId:d.editingGroupId,selectedElementIds:h},this.scene.getNonDeletedElements(),d,this),showHyperlinkPopup:m.link||dn(m)?"info":!1}}),n.hit.wasAddedToSelection=!0))}this.setState({previousSelectedElementIds:this.state.selectedElementIds})}}return!1});I(this,"handleTextOnPointerDown",(t,n)=>{if(this.state.editingTextElement)return;let r=n.origin.x,i=n.origin.y,l=this.getElementAtPosition(r,i,{includeBoundTextElement:!0}),a=this.getTextBindableContainerAtPosition(r,i);wC(l)&&(a=l,r=l.x+l.width/2,i=l.y+l.height/2),this.startTextEditing({sceneX:r,sceneY:i,insertAtParentCenter:!t.altKey,container:a,autoEdit:!1,initialCaretSceneCoords:{x:r,y:i}}),It(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:Oo(this.state,{type:this.state.preferredSelectionTool.type})})});I(this,"handleFreeDrawElementOnPointerDown",(t,n,r)=>{let[i,l]=dt(r.origin.x,r.origin.y,null),a=this.getTopLayerFrameAtSceneCoords({x:i,y:l}),s=t.pressure===.5,c=xH({type:n,x:i,y:l,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:null,simulatePressure:s,locked:!1,frameId:a?a.id:null,points:[Q(0,0)],pressures:s?[]:[t.pressure]});this.insertNewElement(c),this.setState(m=>{let p={...m.selectedElementIds};return delete p[c.id],{selectedElementIds:ye(p,m)}}),this.setState({newElement:c,suggestedBinding:null})});I(this,"insertIframeElement",({sceneX:t,sceneY:n,width:r,height:i})=>{let[l,a]=dt(t,n,this.lastPointerDownEvent?.[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),s=bH({type:"iframe",x:l,y:a,strokeColor:"transparent",backgroundColor:"transparent",fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness("iframe"),opacity:this.state.currentItemOpacity,locked:!1,width:r,height:i});return this.insertNewElement(s),s});I(this,"insertEmbeddableElement",({sceneX:t,sceneY:n,link:r})=>{let[i,l]=dt(t,n,this.lastPointerDownEvent?.[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=fm(r);if(!a)return;a.error instanceof URIError&&this.setToast({message:E("toast.unrecognizedLinkFormat"),closable:!0});let s=fC({type:"embeddable",x:i,y:l,strokeColor:"transparent",backgroundColor:"transparent",fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness("embeddable"),opacity:this.state.currentItemOpacity,locked:!1,width:a.intrinsicSize.w,height:a.intrinsicSize.h,link:r});return this.insertNewElement(s),s});I(this,"newImagePlaceholder",({sceneX:t,sceneY:n,addToFrameUnderCursor:r=!0,customData:i})=>{let[l,a]=dt(t,n,this.lastPointerDownEvent?.[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),s=r?this.getTopLayerFrameAtSceneCoords({x:l,y:a}):null,c=100/this.state.zoom.value;return vH({type:"image",strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:null,opacity:this.state.currentItemOpacity,locked:!1,frameId:s?s.id:null,x:l-c/2,y:a-c/2,width:c,height:c,customData:i})});I(this,"handleLinearElementOnPointerDown",(t,n,r)=>{if(t.ctrlKey&&Ot(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!=="enabled"})}),this.state.multiElement){let{multiElement:i,selectedLinearElement:l}=this.state;if(zo(l,"selectedLinearElement is expected to be set"),i.type==="line"&&SC(i.points,this.state.zoom.value)){Ot(()=>{this.setState({selectedLinearElement:{...l,lastCommittedPoint:i.points[i.points.length-1],initialState:{...l.initialState,lastClickedPoint:-1}}})}),this.actionManager.executeAction(ht);return}if(Lt(i)&&i.points.length>1){this.actionManager.executeAction(ht,"ui",{event:t.nativeEvent,sceneCoords:{x:r.origin.x,y:r.origin.y}});return}let{x:a,y:s}=i,{lastCommittedPoint:c}=l,m=es(this.state)&&Ho(Q(this.lastPointerMoveCoords?.x??a+i.points[i.points.length-1][0],this.lastPointerMoveCoords?.y??s+i.points[i.points.length-1][1]),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(Go(i)&&m||i.points.length>1&&c&&sn(Q(r.origin.x-a,r.origin.y-s),c)<vf){this.actionManager.executeAction(ht,"ui",{event:t.nativeEvent,sceneCoords:{x:r.origin.x,y:r.origin.y}});return}this.setState(p=>({selectedElementIds:ye({...p.selectedElementIds,[i.id]:!0},p)})),pe(this.interactiveCanvas,Ce.POINTER)}else{let[i,l]=dt(r.origin.x,r.origin.y,t[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=this.getTopLayerFrameAtSceneCoords({x:i,y:l}),{currentItemStartArrowhead:s,currentItemEndArrowhead:c}=this.state,[m,p]=n==="arrow"?[s,c]:[null,null],d=n==="arrow"?yH({type:n,x:i,y:l,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemArrowType===$n.round?{type:mm.PROPORTIONAL_RADIUS}:null,startArrowhead:m,endArrowhead:p,locked:!1,frameId:a?a.id:null,elbowed:this.state.currentItemArrowType===$n.elbow,fixedSegments:this.state.currentItemArrowType===$n.elbow?[]:null}):TH({type:n,x:i,y:l,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemRoundness==="round"?{type:mm.PROPORTIONAL_RADIUS}:null,locked:!1,frameId:a?a.id:null}),h=Q(r.origin.x,r.origin.y),f=this.scene.getNonDeletedElementsMap(),g=es(this.state)?Ho(h,this.scene.getNonDeletedElements(),f):null;this.scene.mutateElement(d,{points:[Q(0,0),Q(0,0)]}),this.insertNewElement(d),Go(d)&&EG(d,new Map([[0,{point:Q(0,0),isDragging:!1}]]),h[0],h[1],this.scene,this.state,{newArrow:!0,altKey:t.altKey,initialBinding:!0,angleLocked:tC(t.nativeEvent)}),Ot(()=>{this.setState(b=>{let y=null,v=b.selectedElementIds;if(bt(d)){y=new se(d,this.scene.getNonDeletedElementsMap());let x=d.points.length-1;y={...y,selectedPointsIndices:[x],initialState:{...y.initialState,arrowStartIsInside:t.altKey,lastClickedPoint:x,origin:Q(r.origin.x,r.origin.y)}}}return v=this.state.activeTool.locked?b.selectedElementIds:ye({[d.id]:!0},b),{...b,bindMode:"orbit",newElement:d,startBoundElement:g,suggestedBinding:g&&Go(d)?{element:g,midPoint:Wf(h,g,f,this.state.zoom)}:null,selectedElementIds:v,selectedLinearElement:y}})}),Go(d)&&cn("COMPLEX_BINDINGS")&&this.handleDelayedBindModeChange(d,g)}});I(this,"createGenericElementOnPointerDown",(t,n)=>{let[r,i]=dt(n.origin.x,n.origin.y,this.lastPointerDownEvent?.[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),l=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),a={x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.getCurrentItemRoundness(t),locked:!1,frameId:l?l.id:null},s;t==="embeddable"?s=fC({type:"embeddable",...a}):s=wH({type:t,...a}),s.type==="selection"?this.setState({selectionElement:s}):(this.insertNewElement(s),this.setState({multiElement:null,newElement:s}))});I(this,"createFrameElementOnPointerDown",(t,n)=>{let[r,i]=dt(t.origin.x,t.origin.y,this.lastPointerDownEvent?.[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),l={x:r,y:i,opacity:this.state.currentItemOpacity,locked:!1,...No},a=n===Fo.magicframe?EC(l):EH(l);this.insertNewElement(a),this.setState({multiElement:null,newElement:a})});I(this,"restoreReadyToEraseElements",()=>{this.elementsPendingErasure=new Set,this.triggerRender()});I(this,"eraseElements",()=>{let t=!1;this.elementsPendingErasure.forEach(r=>{let i=this.scene.getElement(r);if(Go(i)){if(i.startBinding){let l=this.scene.getElement(i.startBinding.elementId);Em(l,this.scene.getElementsMapIncludingDeleted(),{boundElements:l.boundElements.filter(a=>a.id!==i.id)})}if(i.endBinding){let l=this.scene.getElement(i.endBinding.elementId);Em(l,this.scene.getElementsMapIncludingDeleted(),{boundElements:l.boundElements.filter(a=>a.id!==i.id)})}}else Af(i)&&i.boundElements?.forEach(l=>{if(l.type==="arrow"){let a=this.scene.getElement(l.id);a?.startBinding?.elementId===i.id&&Em(a,this.scene.getElementsMapIncludingDeleted(),{startBinding:null}),a?.endBinding?.elementId===i.id&&Em(a,this.scene.getElementsMapIncludingDeleted(),{endBinding:null})}})});let n=this.scene.getElementsIncludingDeleted().map(r=>this.elementsPendingErasure.has(r.id)||r.frameId&&this.elementsPendingErasure.has(r.frameId)||Mf(r)&&this.elementsPendingErasure.has(r.containerId)?(t=!0,jn(r,{isDeleted:!0})):r);this.elementsPendingErasure=new Set,t&&(this.store.scheduleCapture(),this.scene.replaceAllElements(n))});I(this,"initializeImage",async(t,n)=>{if(!Lm(n))throw new Error(E("errors.unsupportedFileType"));let r=n.type,i=n.size>=this.state.dontResizeLimitMBs*1024*1024;if(pe(this.interactiveCanvas,"wait"),r===sa.svg)try{n=_m(MC(await n.text()),n.name)}catch(c){throw console.warn(c),new Error(E("errors.svgImageInsertError"))}else if(i){let{maxWidthOrHeight:c}=this.props.imageOptions;try{n=await this.props.compressImageFile(n,{maxWidthOrHeight:c}),console.info("Excalidraw: image resized")}catch(m){console.error("Error trying to resizing image file on insertion",m)}}let{maxFileSizeBytes:l}=this.props.imageOptions;if(n.size>l)throw new Error(E("errors.fileTooBig",{maxSize:`${Math.trunc(l/1024/1024)}MB`}));let a=await(this.props.generateIdForFile?.(n)||M1(n));if(!a)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),new Error(E("errors.imageInsertError"));let s=this.files[a]?.dataURL||await Dm(n);return new Promise(async(c,m)=>{try{let p=this.getLatestInitializedImageElement(t,a,n.name);if(this.addMissingFiles([{mimeType:r,id:a,dataURL:s,created:Date.now(),lastRetrieved:Date.now()}]),!this.imageCache.get(a)){this.addNewImagesToImageCache();let{erroredFiles:h}=await this.updateImageCache([p]);if(h.size)throw new Error("Image cache update resulted with an error.")}let d=await this.imageCache.get(a)?.image;if(d&&this.state.newElement?.id!==p.id){p=this.getLatestInitializedImageElement(t,a,n.name);let h=this.getImageNaturalDimensions(p,d);Object.assign(p,h)}c(p)}catch(p){console.error(p),m(new Error(E("errors.imageInsertError")))}})});I(this,"getLatestInitializedImageElement",(t,n,r)=>{let i=this.scene.getElement(t.id)??t;return jn(i,{fileId:n,fileName:r})});I(this,"onImageToolbarButtonClick",async()=>{try{let t=this.state.width/2+this.state.offsetLeft,n=this.state.height/2+this.state.offsetTop,{x:r,y:i}=De({clientX:t,clientY:n},this.state),l=await x1({description:"Image",extensions:Object.keys(Bz),multiple:!0});this.insertImages(l.map(a=>({file:a})),r,i)}catch(t){t.name!=="AbortError"?console.error(t):console.warn(t),this.setState({newElement:null,activeTool:Oo(this.state,{type:this.state.preferredSelectionTool.type})},()=>{this.actionManager.executeAction(ht)})}});I(this,"getImageNaturalDimensions",(t,n)=>{let r=Math.max(this.state.height-120,160),i=Math.min(r,Math.floor(this.state.height*.5)/this.state.zoom.value),l=Math.min(n.naturalHeight,i),a=l*(n.naturalWidth/n.naturalHeight),s=t.x+t.width/2-a/2,c=t.y+t.height/2-l/2;return{x:s,y:c,width:a,height:l,crop:null}});I(this,"updateImageCache",async(t,n=this.files)=>{let{updatedFiles:r,erroredFiles:i}=await _H({imageCache:this.imageCache,fileIds:t.map(l=>l.fileId),files:n});return i.size&&(this.store.scheduleAction(yt.NEVER),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(l=>ts(l)&&i.has(l.fileId)?jn(l,{status:"error"}):l))),{updatedFiles:r,erroredFiles:i}});I(this,"addNewImagesToImageCache",async(t=DH(this.scene.getNonDeletedElements()),n=this.files)=>{let r=t.filter(i=>!i.isDeleted&&!this.imageCache.has(i.fileId));if(r.length){let{updatedFiles:i}=await this.updateImageCache(r,n);if(i.size)for(let l of r)i.has(l.fileId)&&ns.delete(l);i.size&&this.scene.triggerUpdate()}});I(this,"scheduleImageRefresh",Pz(()=>{this.addNewImagesToImageCache()},Fz));I(this,"handleInteractiveCanvasRef",t=>{t!==null?(this.interactiveCanvas=t,this.interactiveCanvas.addEventListener(q.TOUCH_START,this.onTouchStart,{passive:!1}),this.interactiveCanvas.addEventListener(q.TOUCH_END,this.onTouchEnd)):(this.interactiveCanvas?.removeEventListener(q.TOUCH_START,this.onTouchStart),this.interactiveCanvas?.removeEventListener(q.TOUCH_END,this.onTouchEnd))});I(this,"insertImages",async(t,n,r)=>{let i=50/this.state.zoom.value,l=KC(t.map(({customData:d})=>this.newImagePlaceholder({sceneX:n,sceneY:r,customData:d})),n,r,i);this.insertNewElements(l);let a=await Promise.all(l.map(async(d,h)=>{try{return await this.initializeImage(d,await Pa(t[h].file))}catch(f){return this.setState({errorMessage:f.message||E("errors.imageInsertError")}),jn(d,{isDeleted:!0})}})),s=hm(a),c=KC(a.filter(d=>!d.isDeleted),n,r,i),m=hm(c),p=this.scene.getElementsIncludingDeleted().map(d=>m.get(d.id)??s.get(d.id)??d);this.updateScene({appState:{selectedElementIds:ye(Object.fromEntries(c.map(d=>[d.id,!0])),this.state)},elements:p,captureUpdate:yt.IMMEDIATELY}),this.setState({},()=>{this.actionManager.executeAction(ht)})});I(this,"handleAppOnDrop",async t=>{let{x:n,y:r}=De(t,this.state),i=await pi(t),l=i.getFiles();if(l.length===1){let{file:c,fileHandle:m}=l[0];if(c&&(c.type===sa.png||c.type===sa.svg))try{let p=await ka(c,this.state,this.scene.getElementsIncludingDeleted(),m);this.syncActionResult({...p,appState:{...p.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:yt.IMMEDIATELY});return}catch(p){if(p.name!=="EncodingError")throw new Error(E("alerts.couldNotLoadInvalidFile"))}}let a=l.map(c=>c.file).filter(c=>Lm(c));if(a.length>0&&this.isToolSupported("image"))return this.insertImages(a.map(c=>({file:c})),n,r);if(l.length>0){let{file:c,fileHandle:m}=l[0];c&&await this.loadFileToCanvas(c,m)}let s=i.findByType(sa.text);if(s){let c=s.value;if(c&&Df(c,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(c)||fm(c)?.type==="video")){let m=this.insertEmbeddableElement({sceneX:n,sceneY:r,link:Tf(c)});m&&(this.store.scheduleCapture(),this.setState({selectedElementIds:{[m.id]:!0}}))}}});I(this,"loadFileToCanvas",async(t,n)=>{t=await Pa(t);try{let r=this.scene.getElementsIncludingDeleted(),i;try{i=await ka(t,this.state,r,n)}catch(l){let a=l instanceof E1;if(a&&l.code==="IMAGE_NOT_CONTAINS_SCENE_DATA"&&!this.isToolSupported("image")){this.setState({isLoading:!1,errorMessage:E("errors.imageToolNotSupported")});return}let s=a?E("alerts.cannotRestoreFromImage"):E("alerts.couldNotLoadInvalidFile");this.setState({isLoading:!1,errorMessage:s})}if(!i)return;oS(r.concat(i.elements)),this.store.scheduleMicroAction({action:yt.NEVER,elements:r,appState:void 0}),this.setState({isLoading:!0}),this.syncActionResult({...i,appState:{...i.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:yt.IMMEDIATELY})}catch(r){this.setState({isLoading:!1,errorMessage:r.message})}});I(this,"handleCanvasContextMenu",t=>{if(t.preventDefault(),("pointerType"in t.nativeEvent&&t.nativeEvent.pointerType==="touch"||"pointerType"in t.nativeEvent&&t.nativeEvent.pointerType==="pen"&&t.button!==Bo.SECONDARY)&&this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let{x:n,y:r}=De(t,this.state),i=this.getElementAtPosition(n,r,{preferSelected:!0,includeLockedElements:!0}),l=this.scene.getSelectedElements(this.state),a=this.isHittingCommonBoundingBoxOfSelectedElements({x:n,y:r},l),s=i||a?"element":"canvas",c=this.excalidrawContainerRef.current,{top:m,left:p}=c.getBoundingClientRect(),d=t.clientX-p,h=t.clientY-m;de("contextMenu","openContextMenu",s),this.setState({...i&&!this.state.selectedElementIds[i.id]?{...this.state,...eo({editingGroupId:this.state.editingGroupId,selectedElementIds:{[i.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:bt(i)?new se(i,this.scene.getNonDeletedElementsMap()):null}:this.state,showHyperlinkPopup:!1},()=>{this.setState({contextMenu:{top:h,left:d,items:this.getContextMenuItems(s)}})})});I(this,"maybeDragNewGenericElement",(t,n,r=!0)=>{let i=this.state.selectionElement,l=t.lastCoords;if(i&&t.boxSelection.hasOccurred&&this.state.activeTool.type!=="eraser"){WC({newElement:i,elementType:this.state.activeTool.type,originX:t.origin.x,originY:t.origin.y,x:l.x,y:l.y,width:ma(t.origin.x,l.x),height:ma(t.origin.y,l.y),shouldMaintainAspectRatio:jl(n),shouldResizeFromCenter:!1,scene:this.scene,zoom:this.state.zoom.value,informMutation:!1});return}let a=this.state.newElement;if(!a)return;let[s,c]=dt(l.x,l.y,n[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),m=ts(a)&&this.imageCache.get(a.fileId)?.image,p=m&&!(m instanceof Promise)?m.width/m.height:null;this.maybeCacheReferenceSnapPoints(n,[a]);let{snapOffset:d,snapLines:h}=hy(a,this,n,{x:t.originInGrid.x+(this.state.originSnapOffset?.x??0),y:t.originInGrid.y+(this.state.originSnapOffset?.y??0)},{x:s-t.originInGrid.x,y:c-t.originInGrid.y},this.scene.getNonDeletedElementsMap());s+=d.x,c+=d.y,this.setState({snapLines:h}),Go(a)||WC({newElement:a,elementType:this.state.activeTool.type,originX:t.originInGrid.x,originY:t.originInGrid.y,x:s,y:c,width:ma(t.originInGrid.x,s),height:ma(t.originInGrid.y,c),shouldMaintainAspectRatio:qn(a)?!jl(n):jl(n),shouldResizeFromCenter:eC(n),zoom:this.state.zoom.value,scene:this.scene,widthAspectRatio:p,originOffset:this.state.originSnapOffset,informMutation:r}),this.setState({newElement:a}),(this.state.activeTool.type===Fo.frame||this.state.activeTool.type===Fo.magicframe)&&this.setState({elementsToHighlight:Ff(this.scene.getNonDeletedElements(),a,this.state,this.scene.getNonDeletedElementsMap())})});I(this,"maybeHandleCrop",(t,n)=>{if(!this.state.croppingElementId)return!1;let r=t.resize.handleType,i=t.lastCoords,[l,a]=dt(i.x-t.resize.offset.x,i.y-t.resize.offset.y,n[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),s=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(r&&s&&qn(s)){let c=t.originalElements.get(s.id),m=ts(s)&&this.imageCache.get(s.fileId)?.image;if(c&&qn(c)&&m&&!(m instanceof Promise)){let[p,d]=dt(i.x,i.y,n[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),h={x:p-t.originInGrid.x,y:d-t.originInGrid.y};this.maybeCacheReferenceSnapPoints(n,[s]);let{snapOffset:f,snapLines:g}=mh([s],[c],this,n,h,r);this.scene.mutateElement(s,$H(s,this.scene.getNonDeletedElementsMap(),r,m.naturalWidth,m.naturalHeight,l+f.x,a+f.y,n.shiftKey?c.width/c.height:void 0)),gm(s,this.scene),this.setState({isCropping:r&&r!=="rotation",snapLines:g})}return!0}return!1});I(this,"maybeHandleResize",(t,n)=>{let r=this.scene.getSelectedElements(this.state),i=r.filter(p=>at(p)),l=t.resize.handleType;if(i.length>0&&l==="rotation"||r.length===1&&Lt(r[0])||this.state.croppingElementId)return!1;this.setState({isResizing:l&&l!=="rotation",isRotating:l==="rotation",activeEmbeddable:null});let a=t.lastCoords,[s,c]=dt(a.x-t.resize.offset.x,a.y-t.resize.offset.y,n[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),m=new Map;if(i.forEach(p=>{Nf(this.scene.getNonDeletedElements(),p.id).forEach(h=>{m.set(p.id+h.id,{x:h.x-p.x,y:h.y-p.y})})}),!this.state.selectedElementsAreBeingDragged){let[p,d]=dt(a.x,a.y,n[Y.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),h={x:p-t.originInGrid.x,y:d-t.originInGrid.y},f=[...t.originalElements.values()];this.maybeCacheReferenceSnapPoints(n,r);let{snapOffset:g,snapLines:b}=mh(r,te(f,this.state),this,n,h,l);s+=g.x,c+=g.y,this.setState({snapLines:b})}if(pG(t.originalElements,l,r,this.scene,tC(n),eC(n),r.some(p=>qn(p))?!jl(n):jl(n),s,c,t.resize.center.x,t.resize.center.y)){let p=new Set;return i.forEach(d=>{Ff(this.scene.getNonDeletedElements(),d,this.state,this.scene.getNonDeletedElementsMap()).forEach(h=>p.add(h))}),this.setState({elementsToHighlight:[...p]}),!0}return!1});I(this,"getContextMenuItems",t=>{let n=[],r=this.getImageContextMenuItems(),i=r.length>0?[Ze,...r]:[];if(t==="canvas")return this.state.viewModeEnabled?[vi,_i,Ln]:[fu,Ze,Fc,Ze,up,f2,Ze,vi,so,al,ll,_i,Ln];if(n.push(Fc),this.state.viewModeEnabled){let s=[wi];return s.push(...i,...n),s}let l=this.editorInterface.formFactor==="desktop"?[Ze,cp,dp,mp,pp]:[],a=[Ze,Bc,wi,fu];return a.push(...i),r.length>0&&a.push(Ze),a.push(Ze,K2,Z2,$2,Ze,Ju,pu,uu,Ze,...n,Ze,cu,rh,bu,yu,t2,du,...l,Ze,hu,gu,Ze,Ai,Ze,Au,Y2,Ze,zy,hp,dl,Ze,Oa),a});I(this,"getImageContextMenuItems",()=>{if(!this.props.imageContextMenuItems)return[];let t=this.scene.getSelectedElements(this.state);return t.length===0||!t.every(n=>qn(n))?[]:[...this.props.imageContextMenuItems(t.map(n=>n.id))]});I(this,"handleWheel",Re(t=>{if(!(t.target instanceof HTMLCanvasElement||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLIFrameElement||t.target instanceof HTMLElement&&t.target.classList.contains(kf.FRAME_NAME))){t[Y.CTRL_OR_CMD]&&t.preventDefault();return}if(t.preventDefault(),as)return;let{deltaX:n,deltaY:r}=t;if(t.metaKey||t.ctrlKey||this.state.wheelZoomsOnDefault){let i=Math.sign(r),l=Wz*100,a=Math.abs(r),s=r;a>l&&(s=l*i);let c=this.state.zoom.value-s/100;c+=Math.log10(Math.max(1,this.state.zoom.value))*-i*Math.min(1,a/20),this.translateCanvas(m=>({...To({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:Gt(c)},m),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced();return}if(t.shiftKey){this.translateCanvas(({zoom:i,scrollX:l})=>({scrollX:l-(r||n)/i.value}));return}this.translateCanvas(({zoom:i,scrollX:l,scrollY:a})=>({scrollX:l-n/i.value,scrollY:a-r/i.value}))}));I(this,"savePointer",(t,n,r)=>{if(!t||!n)return;let{x:i,y:l}=De({clientX:t,clientY:n},this.state);isNaN(i)||isNaN(l);let a={x:i,y:l,tool:this.state.activeTool.type==="laser"?"laser":"pointer"};this.props.onPointerUpdate?.({pointer:a,button:r,pointersMap:fe.pointers})});I(this,"resetShouldCacheIgnoreZoomDebounced",sC(()=>{this.unmounted||this.setState({shouldCacheIgnoreZoom:!1})},300));I(this,"updateDOMRect",t=>{if(this.excalidrawContainerRef?.current){let n=this.excalidrawContainerRef.current,{width:r,height:i,left:l,top:a}=n.getBoundingClientRect(),{width:s,height:c,offsetTop:m,offsetLeft:p}=this.state;if(r===s&&i===c&&l===p&&a===m){t&&t();return}this.setState({width:r,height:i,offsetLeft:l,offsetTop:a},()=>{t&&t()})}});I(this,"refresh",()=>{this.setState({...this.getCanvasOffsets()})});I(this,"watchState",()=>{});let n=gn(),{viewModeEnabled:r=!1,zenModeEnabled:i=!1,gridModeEnabled:l=!1,objectsSnapModeEnabled:a=!1,theme:s=n.theme,name:c=`${E("labels.untitled")}-${dC()}`,wheelZoomsOnDefault:m=!1}=t;this.state={...n,theme:s,exportWithDarkMode:s===ca.DARK,isLoading:!0,...this.getCanvasOffsets(),viewModeEnabled:r,zenModeEnabled:i,objectsSnapModeEnabled:a,gridModeEnabled:l??n.gridModeEnabled,name:c,width:window.innerWidth,height:window.innerHeight,wheelZoomsOnDefault:m},this.refreshEditorInterface(),this.stylesPanelMode=ym(this.editorInterface),this.id=Lz(),this.actionManager=new $c(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new VC,this.canvas=document.createElement("canvas"),this.rc=Az.canvas(this.canvas),this.renderer=new vl(this.scene),this.visibleElements=[],this.store=new gG(this),this.history=new yl(this.store),this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new Uo(this.scene),this.history=new yl(this.store),this.actionManager.registerAll(Gs),this.actionManager.registerAction(Q2(this.history)),this.actionManager.registerAction(ey(this.history)),this.api=this.createExcalidrawAPI()}createExcalidrawAPI(){return{isDestroyed:!1,updateScene:this.updateScene,applyDeltas:this.applyDeltas,mutateElement:this.mutateElement,addFiles:this.addFiles,addImageElementsToScene:this.addImageElementsToScene,resetScene:this.resetScene,getSceneElementsIncludingDeleted:this.getSceneElementsIncludingDeleted,getSceneElementsMapIncludingDeleted:this.getSceneElementsMapIncludingDeleted,history:{clear:this.resetHistory},scrollToViewport:this.scrollToViewport,scrollToContent:this.scrollToContent,getSceneElements:this.getSceneElements,getAppState:()=>this.state,getFiles:()=>this.files,getName:this.getName,registerAction:n=>{this.actionManager.registerAction(n)},refresh:this.refresh,setToast:this.setToast,id:this.id,setActiveTool:this.setActiveTool,setCursor:this.setCursor,resetCursor:this.resetCursor,getEditorInterface:()=>this.editorInterface,updateFrameRendering:this.updateFrameRendering,toggleSidebar:this.toggleSidebar,onChange:n=>this.onChangeEmitter.on(n),onIncrement:n=>this.store.onStoreIncrementEmitter.on(n),onPointerDown:n=>this.onPointerDownEmitter.on(n),onPointerUp:n=>this.onPointerUpEmitter.on(n),onScrollChange:n=>this.onScrollChangeEmitter.on(n),onUserFollow:n=>this.onUserFollowEmitter.on(n),onStateChange:this.onStateChange,onEvent:this.onEvent}}onWindowMessage(t){if(t.origin!=="https://player.vimeo.com"&&t.origin!=="https://www.youtube.com")return;let n=null;try{n=JSON.parse(t.data)}catch{}if(n)switch(t.origin){case"https://player.vimeo.com":if(n.method==="paused"){let r=null,i=document.body.querySelectorAll("iframe.excalidraw__embeddable");if(!i)break;for(let l of i)l.contentWindow===t.source&&(r=l.contentWindow);r?.postMessage(JSON.stringify({method:n.value?"play":"pause",value:!0}),"*")}break;case"https://www.youtube.com":if(n.event==="infoDelivery"&&n.info&&n.id&&typeof n.info.playerState=="number"){let r=n.id,i=n.info.playerState;Object.values(pm).includes(i)&&Xf.set(r,i)}break}}handleSkipBindMode(){if(this.state.selectedLinearElement?.initialState&&!this.state.selectedLinearElement.initialState.arrowStartIsInside){zo(this.lastPointerMoveCoords,"Missing last pointer move coords when changing bind skip mode for arrow start");let t=this.scene.getNonDeletedElementsMap(),n=Ho(Q(this.lastPointerMoveCoords.x,this.lastPointerMoveCoords.y),this.scene.getNonDeletedElements(),t),r=se.getElement(this.state.selectedLinearElement.elementId,t);r?.startBinding&&n?.id===r.startBinding.elementId&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:!0}}})}if(this.state.bindMode==="orbit"&&(this.bindModeHandler&&(clearTimeout(this.bindModeHandler),this.bindModeHandler=null),Ot(()=>{this.setState({bindMode:"skip"})}),this.lastPointerMoveCoords&&this.state.selectedLinearElement?.selectedPointsIndices&&this.state.selectedLinearElement?.selectedPointsIndices.length)){let{x:t,y:n}=this.lastPointerMoveCoords,r=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;zo(r,"Last event must exist");let i=t-this.state.selectedLinearElement.pointerOffset.x,l=n-this.state.selectedLinearElement.pointerOffset.y,a=this.state.multiElement?se.handlePointerMove(r,this,i,l,this.state.selectedLinearElement):se.handlePointDragging(r,this,i,l,this.state.selectedLinearElement);a&&this.setState(a)}}resetDelayedBindMode(){this.bindModeHandler&&(clearTimeout(this.bindModeHandler),this.bindModeHandler=null),this.state.bindMode!=="orbit"&&setTimeout(()=>this.setState({bindMode:"orbit"}))}handleDelayedBindModeChange(t,n){if(t.isDeleted||Lt(t))return;let r=()=>{if(this.bindModeHandler=null,zo(this.lastPointerMoveCoords,"Expected lastPointerMoveCoords to be set"),!this.state.multiElement){if(!this.state.selectedLinearElement||!this.state.selectedLinearElement.selectedPointsIndices||!this.state.selectedLinearElement.selectedPointsIndices.length)return;let f=this.state.selectedLinearElement.selectedPointsIndices.includes(0),g=this.state.selectedLinearElement.selectedPointsIndices.includes(t.points.length-1);if(!f&&!g||f&&g)return}let{x:p,y:d}=this.lastPointerMoveCoords,h=Ho(Q(p,d),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(h&&this.state.bindMode!=="skip"){zo(this.state.selectedLinearElement?.elementId===t.id,"The selectedLinearElement is expected to not change while a bind mode timeout is ticking");let f=this.state.selectedLinearElement.initialState.arrowStartIsInside||t.startBinding?.elementId===h.id;Ot(()=>{zo(this.state.selectedLinearElement,"this.state.selectedLinearElement must exist"),this.setState({bindMode:"inside",selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:f}}})});let g=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;zo(g,"Last event must exist");let b=p-this.state.selectedLinearElement.pointerOffset.x,y=d-this.state.selectedLinearElement.pointerOffset.y,v=this.state.multiElement?se.handlePointerMove(g,this,b,y,this.state.selectedLinearElement):se.handlePointDragging(g,this,b,y,this.state.selectedLinearElement);v&&this.setState(v)}},i=!1;if(this.state.selectedLinearElement?.selectedPointsIndices){let p=this.scene.getNonDeletedElementsMap(),d=this.state.selectedLinearElement.selectedPointsIndices.includes(0),h=this.state.selectedLinearElement.selectedPointsIndices.includes(t.points.length-1),f=d?n:t.startBinding&&p.get(t.startBinding.elementId),g=h?n:t.endBinding&&p.get(t.endBinding.elementId),b=f&&$C(f,p),y=g&&$C(g,p);i=!!(b&&y&&f.id!==g.id&&xG(b,y))}let l=this.state.selectedLinearElement?.selectedPointsIndices?.includes(0),a=this.state.selectedLinearElement?.selectedPointsIndices?.includes(t.points.length-1),s=l?"startBinding":a?"endBinding":null,c=l?"endBinding":a?"startBinding":null,m=c&&t[c]?.mode==="inside"&&t[c]?.elementId===n?.id||s&&t[s]?.mode==="inside"&&n?.id===t[s]?.elementId;s&&c&&t[s]?.mode==="inside"&&n?.id!==t[s]?.elementId&&t[c]?.elementId!==t[s]?.elementId&&this.scene.mutateElement(t,{[s]:{...t[s],mode:"orbit"}},{informMutation:!1,isDragging:!0}),!n||this.previousHoveredBindableElement&&n.id!==this.previousHoveredBindableElement.id?(this.bindModeHandler&&(clearTimeout(this.bindModeHandler),this.bindModeHandler=null),this.state.bindMode==="inside"&&Ot(()=>{this.setState({bindMode:"orbit"})}),this.previousHoveredBindableElement=null):!this.bindModeHandler&&(!this.state.newElement||!t.startBinding||i)&&!m&&(this.bindModeHandler=setTimeout(r,lH)),this.previousHoveredBindableElement=n}cacheEmbeddableRef(t,n){n&&this.iFrameRefs.set(t.id,n)}getHTMLIFrameElement(t){return this.iFrameRefs.get(t.id)}handleIframeLikeCenterClick(){if(!this.lastPointerDownEvent||!this.lastPointerUpEvent||this.lastPointerDownEvent.button!==Bo.MAIN||Jn||!hH(this.state.activeTool.type,["laser","selection","lasso"]))return!1;let t=Q(De({clientX:this.lastPointerDownEvent.clientX,clientY:this.lastPointerDownEvent.clientY},this.state)),n=Q(De({clientX:this.lastPointerUpEvent.clientX,clientY:this.lastPointerUpEvent.clientY},this.state));if(sn(t,n)>nC)return!1;let i=this.getElementAtPosition(t[0],t[1]);if(!(i&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<=300&&fe.pointers.size<2&&Pf(i)&&(this.state.viewModeEnabled||this.state.activeTool.type==="laser"||this.isIframeLikeElementCenter(i,this.lastPointerUpEvent,n[0],n[1]))))return!1;let a=i;if(this.state.activeEmbeddable?.element===a&&this.state.activeEmbeddable?.state==="active"||(setTimeout(()=>{this.setState({activeEmbeddable:{element:a,state:"active"},selectedElementIds:{[a.id]:!0},newElement:null,selectionElement:null})},100),ha(a)))return!0;let s=this.getHTMLIFrameElement(a);if(!s?.contentWindow)return!0;if(s.src.includes("youtube")){let c=Xf.get(a.id);switch(c||(Xf.set(a.id,pm.UNSTARTED),s.contentWindow.postMessage(JSON.stringify({event:"listening",id:a.id}),"*")),c){case pm.PLAYING:case pm.BUFFERING:s.contentWindow?.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),"*");break;default:s.contentWindow?.postMessage(JSON.stringify({event:"command",func:"playVideo",args:""}),"*")}}return s.src.includes("player.vimeo.com")&&s.contentWindow.postMessage(JSON.stringify({method:"paused"}),"*"),!0}isIframeLikeElementCenter(t,n,r,i){return t&&!n.altKey&&!n.shiftKey&&!n.metaKey&&!n.ctrlKey&&(this.state.activeEmbeddable?.element!==t||this.state.activeEmbeddable?.state==="hover"||!this.state.activeEmbeddable)&&r>=t.x+t.width/3&&r<=t.x+2*t.width/3&&i>=t.y+t.height/3&&i<=t.y+2*t.height/3}renderEmbeddables(){let t=this.state.zoom.value,n=this.state.width,r=this.state.height,i=this.scene.getNonDeletedElements().filter(l=>dn(l)&&this.embedsValidationStatus.get(l.id)===!0||ha(l));return Ee(DG,{children:i.map(l=>{let{x:a,y:s}=um({sceneX:l.x,sceneY:l.y},this.state),c=IC(l,n,r,this.state,this.scene.getNonDeletedElementsMap()),m=this.initializedEmbeds.has(l.id);if(c&&!m&&this.initializedEmbeds.add(l.id),!(c||m))return null;let d;if(ha(l)){d=null;let y=(l.customData?.generationData??this.magicGenerations.get(l.id))||{status:"error",message:"No generation data",code:"ERR_NO_GENERATION_DATA"};if(y.status==="done"){let v=y.html;d={intrinsicSize:{w:l.width,h:l.height},type:"document",srcdoc:()=>v}}else if(y.status==="pending")d={intrinsicSize:{w:l.width,h:l.height},type:"document",srcdoc:()=>kC(`
|
|
22
22
|
<style>
|
|
23
23
|
html, body {
|
|
24
24
|
width: 100%;
|