import{r as C,a as O,d as A,u as B,cE as E,b as y,k as P,j as e,ar as D,e as M,T as F,f as d,as as u,aM as p,eB as h,n as S,eC as U,B as x,eD as R,en as _}from"./index-BW07AEtf.js";const G=({applyChangeOwner:g,closeOwnedModal:r,event:s})=>{var l;const[t,o]=C.useState({Id:0}),c=O(),{t:a,i18n:i}=A(),{isMobile:j}=B(),w=E(s.resource),n=y(P),{start:I,end:T}=s,f=b=>{o({Id:b.userId})},k=()=>{g(),c(R({eventId:Number(s.id),userId:Number(t.Id)})),c(_())},m=()=>{o({Id:0})};return e.jsxs(D,{centered:!j,opened:!0,onClose:r,title:a("eventOptions.changeOwner"),children:[e.jsxs(M,{mb:20,children:[e.jsx(F,{label:s.title,position:"top",multiline:!0,disabled:((l=s.title)==null?void 0:l.length)<59,maw:500,withArrow:!0,transitionProps:{duration:200},styles:{tooltip:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:e.jsx(d,{truncate:!0,fz:16,children:s.title})}),e.jsx(u,{gap:"xs",children:e.jsxs(d,{fz:15,c:"gray.5",children:[p(I,h,!1,i.language)," -"," ",p(T,h,!1,i.language)]})})]}),e.jsx(S,{accessType:w,handlePickContact:f,resetContact:m,placeholder:a("placeholders.newOwner"),isFillInputOnPick:!0}),e.jsx(U,{opened:!!t.Id,children:e.jsxs(u,{justify:"flex-end",mt:"lg",gap:10,children:[e.jsx(x,{variant:"outline",onClick:r,children:a("buttons.cancel")}),e.jsx(x,{"data-autofocus":!0,onClick:k,disabled:!t.Id||t.Id===(n==null?void 0:n.Id),children:a("eventOptions.changeOwner")})]})})]})};export{G as default};
