'));var H=!1,W=function(e){var t=e.element,n=e.setAppState,r=e.onLinkOpen,l=(0,Z.gF)(),h=t.link||\"\",m=(0,d.useState)(h),v=(0,o.Z)(m,2),b=v[0],y=v[1],x=(0,d.useRef)(null),w=\"editor\"===l.showHyperlinkPopup||!h,k=(0,d.useCallback)((function(){if(x.current){var e=U(x.current.value);!t.link&&e&&(0,L.L)(\"hyperlink\",\"create\"),(0,a.DR)(t,{link:e}),n({showHyperlinkPopup:\"info\"})}}),[t,n]);(0,d.useLayoutEffect)((function(){return function(){k()}}),[k]),(0,d.useEffect)((function(){var e=null,r=function(r){w||(e&&clearTimeout(e),ee(t,l,[r.clientX,r.clientY])&&(e=window.setTimeout((function(){n({showHyperlinkPopup:!1})}),500)))};return window.addEventListener(g.Ks.POINTER_MOVE,r,!1),function(){window.removeEventListener(g.Ks.POINTER_MOVE,r,!1),e&&clearTimeout(e)}}),[l,t,w,n]);var E=(0,d.useCallback)((function(){(0,L.L)(\"hyperlink\",\"delete\"),(0,a.DR)(t,{link:null}),w&&(x.current.value=\"\"),n({showHyperlinkPopup:!1})}),[n,t,w]),S=F(t,l),j=S.x,_=S.y;return l.draggingElement||l.resizingElement||l.isRotating||l.openMenu?null:(0,z.jsxs)(\"div\",{className:\"excalidraw-hyperlinkContainer\",style:{top:\"\".concat(_,\"px\"),left:\"\".concat(j,\"px\"),width:320,padding:5},children:[w?(0,z.jsx)(\"input\",{className:(0,f.Z)(\"excalidraw-hyperlinkContainer-input\"),placeholder:\"Type or paste your link here\",ref:x,value:b,onChange:function(e){return y(e.target.value)},autoFocus:!0,onKeyDown:function(e){e.stopPropagation(),e[p.tW.CTRL_OR_CMD]&&e.key===p.tW.K&&e.preventDefault(),e.key!==p.tW.ENTER&&e.key!==p.tW.ESCAPE||k()}}):(0,z.jsx)(\"a\",{href:t.link||\"\",className:(0,f.Z)(\"excalidraw-hyperlinkContainer-link\",{\"d-none\":w}),target:K(t.link)?\"_self\":\"_blank\",onClick:function(e){if(t.link&&r){var n=(0,i.ag)(g.Ks.EXCALIDRAW_LINK,e.nativeEvent);r(t,n),n.defaultPrevented&&e.preventDefault()}},rel:\"noopener noreferrer\",children:t.link}),(0,z.jsxs)(\"div\",{className:\"excalidraw-hyperlinkContainer__buttons\",children:[!w&&(0,z.jsx)(s.V,{type:\"button\",title:(0,u.t)(\"buttons.edit\"),\"aria-label\":(0,u.t)(\"buttons.edit\"),label:(0,u.t)(\"buttons.edit\"),onClick:function(){(0,L.L)(\"hyperlink\",\"edit\",\"popup-ui\"),n({showHyperlinkPopup:\"editor\"})},className:\"excalidraw-hyperlinkContainer--edit\",icon:c.Pm}),h&&(0,z.jsx)(s.V,{type:\"button\",title:(0,u.t)(\"buttons.remove\"),\"aria-label\":(0,u.t)(\"buttons.remove\"),label:(0,u.t)(\"buttons.remove\"),onClick:E,className:\"excalidraw-hyperlinkContainer--remove\",icon:c.XH})]})]})},F=function(e,t){var n=(0,x.qf)(e),r=(0,o.Z)(n,2),a=r[0],l=r[1],s=(0,i._i)({sceneX:a+e.width/2,sceneY:l},t),c=s.x,u=s.y;return{x:c-t.offsetLeft-160,y:u-t.offsetTop-85}},U=function(e){return(e=e.trim())&&(e.includes(\"://\")||/^[[\\\\/]/.test(e)||(e=\"https://\".concat(e))),e},K=function(e){return!!(null!=e&&e.includes(location.origin)||null!=e&&e.startsWith(\"/\"))},Y=(0,l.z)({name:\"hyperlink\",perform:function(e,t){return\"editor\"!==t.showHyperlinkPopup&&{elements:e,appState:N(N({},t),{},{showHyperlinkPopup:\"editor\",openMenu:null}),commitToHistory:!0}},trackEvent:{category:\"hyperlink\",action:\"click\"},keyTest:function(e){return e[p.tW.CTRL_OR_CMD]&&e.key===p.tW.K},contextItemLabel:function(e,t){return G(e,t)},predicate:function(e,t){return 1===(0,b.eD)(e,t).length},PanelComponent:function(e){var t=e.elements,n=e.appState,r=e.updateData,o=(0,b.eD)(t,n);return(0,z.jsx)(s.V,{type:\"button\",icon:c.xP,\"aria-label\":(0,u.t)(G(t,n)),title:\"\".concat((0,u.t)(\"labels.link.label\"),\" - \").concat((0,i.uY)(\"CtrlOrCmd+K\")),onClick:function(){return r(null)},selected:1===o.length&&!!o[0].link})}}),G=function(e,t){return(0,b.eD)(e,t)[0].link?\"labels.link.edit\":\"labels.link.create\"},V=function(e,t,n){var r=(0,o.Z)(e,4),i=r[0],a=r[1],l=r[2],s=r[3],c=h.Dn,u=c/n.zoom.value,d=c/n.zoom.value,f=c/n.zoom.value,p=(i+l)/2,g=(a+s)/2,v=(c-8)/(2*n.zoom.value),b=4/n.zoom.value,y=l+b-v,x=a-b-f+v,w=(0,m.U1)(y+u/2,x+d/2,p,g,t),k=(0,o.Z)(w,2);return[k[0]-u/2,k[1]-d/2,u,d]},X=function(e,t,n,r){var i=(0,o.Z)(n,2),a=i[0],l=i[1];if(!e.link||t.selectedElementIds[e.id])return!1;var s=4/t.zoom.value;if(!r&&t.viewModeEnabled&&(0,y.pX)(e,[a,l],s))return!0;var c=(0,x.qf)(e),u=(0,o.Z)(c,4),d=u[0],f=u[1],p=u[2],h=u[3],m=V([d,f,p,h],e.angle,t),g=(0,o.Z)(m,4),v=g[0],b=g[1],w=g[2],k=g[3];return a>v-s&&a