import{r as O,a as C,M as A,u as y,bT as B,b as E,bI as P,j as e,U,V as M,a1 as D,T as d,Y as u,al as p,bU as h,bV as F,bW as S,B as x,bX as R,bY as _}from"./index-AbGWey75.js";const G=({applyChangeOwner:b,closeOwnedModal:r,event:s})=>{var l;const[t,o]=O.useState({Id:0}),c=C(),{t:a,i18n:i}=A(),{isMobile:g}=y(),j=B(s.resource),n=E(P),{start:w,end:I}=s,T=k=>{o({Id:k.userId})},m=()=>{b(),c(R({eventId:Number(s.id),userId:Number(t.Id)})),c(_())},f=()=>{o({Id:0})};return e.jsxs(U,{centered:!g,opened:!0,onClose:r,title:a("eventOptions.changeOwner"),children:[e.jsxs(M,{mb:20,children:[e.jsx(D,{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(w,h,!1,i.language)," -"," ",p(I,h,!1,i.language)]})})]}),e.jsx(F,{accessType:j,handlePickContact:T,resetContact:f,placeholder:a("placeholders.newOwner"),isFillInputOnPick:!0}),e.jsx(S,{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:m,disabled:!t.Id||t.Id===(n==null?void 0:n.Id),children:a("eventOptions.changeOwner")})]})})]})};export{G as default};
