"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[70],{3312:(e,t,r)=>{r.d(t,{$:()=>d});var a=r(5155),i=r(2115),o=r(2317),n=r(1027),s=r(7549);let l=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=i.forwardRef((e,t)=>{let{className:r,variant:i,size:n,asChild:d=!1,...c}=e,f=d?o.DX:"button";return(0,a.jsx)(f,{className:(0,s.cn)(l({variant:i,size:n,className:r})),ref:t,...c})});d.displayName="Button"},9749:(e,t,r)=>{r.d(t,{BT:()=>d,Wu:()=>c,ZB:()=>l,Zp:()=>n,aR:()=>s});var a=r(5155),i=r(2115),o=r(7549);let n=i.forwardRef((e,t)=>{let{className:r,...i}=e;return(0,a.jsx)("div",{ref:t,className:(0,o.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...i})});n.displayName="Card";let s=i.forwardRef((e,t)=>{let{className:r,...i}=e;return(0,a.jsx)("div",{ref:t,className:(0,o.cn)("flex flex-col space-y-1.5 p-6",r),...i})});s.displayName="CardHeader";let l=i.forwardRef((e,t)=>{let{className:r,...i}=e;return(0,a.jsx)("h3",{ref:t,className:(0,o.cn)("text-2xl font-semibold leading-none tracking-tight",r),...i})});l.displayName="CardTitle";let d=i.forwardRef((e,t)=>{let{className:r,...i}=e;return(0,a.jsx)("p",{ref:t,className:(0,o.cn)("text-sm text-muted-foreground",r),...i})});d.displayName="CardDescription";let c=i.forwardRef((e,t)=>{let{className:r,...i}=e;return(0,a.jsx)("div",{ref:t,className:(0,o.cn)("p-6 pt-0",r),...i})});c.displayName="CardContent",i.forwardRef((e,t)=>{let{className:r,...i}=e;return(0,a.jsx)("div",{ref:t,className:(0,o.cn)("flex items-center p-6 pt-0",r),...i})}).displayName="CardFooter"},4870:(e,t,r)=>{r.d(t,{C5:()=>y,MJ:()=>h,eI:()=>g,lR:()=>m,lV:()=>d,zB:()=>f});var a=r(5155),i=r(2115),o=r(2317),n=r(9606),s=r(7549),l=r(8986);let d=n.Op,c=i.createContext({}),f=e=>{let{...t}=e;return(0,a.jsx)(c.Provider,{value:{name:t.name},children:(0,a.jsx)(n.xI,{...t})})},u=()=>{let e=i.useContext(c),t=i.useContext(p),{getFieldState:r,formState:a}=(0,n.xW)(),o=r(e.name,a);if(!e)throw Error("useFormField should be used within ");let{id:s}=t;return{id:s,name:e.name,formItemId:"".concat(s,"-form-item"),formDescriptionId:"".concat(s,"-form-item-description"),formMessageId:"".concat(s,"-form-item-message"),...o}},p=i.createContext({}),g=i.forwardRef((e,t)=>{let{className:r,...o}=e,n=i.useId();return(0,a.jsx)(p.Provider,{value:{id:n},children:(0,a.jsx)("div",{ref:t,className:(0,s.cn)("space-y-2",r),...o})})});g.displayName="FormItem";let m=i.forwardRef((e,t)=>{let{className:r,...i}=e,{error:o,formItemId:n}=u();return(0,a.jsx)(l.J,{ref:t,className:(0,s.cn)(o&&"text-destructive",r),htmlFor:n,...i})});m.displayName="FormLabel";let h=i.forwardRef((e,t)=>{let{...r}=e,{error:i,formItemId:n,formDescriptionId:s,formMessageId:l}=u();return(0,a.jsx)(o.DX,{ref:t,id:n,"aria-describedby":i?"".concat(s," ").concat(l):"".concat(s),"aria-invalid":!!i,...r})});h.displayName="FormControl",i.forwardRef((e,t)=>{let{className:r,...i}=e,{formDescriptionId:o}=u();return(0,a.jsx)("p",{ref:t,id:o,className:(0,s.cn)("text-sm text-muted-foreground",r),...i})}).displayName="FormDescription";let y=i.forwardRef((e,t)=>{let{className:r,children:i,...o}=e,{error:n,formMessageId:l}=u(),d=n?String(null==n?void 0:n.message):i;return d?(0,a.jsx)("p",{ref:t,id:l,className:(0,s.cn)("text-sm font-medium text-destructive",r),...o,children:d}):null});y.displayName="FormMessage"},3900:(e,t,r)=>{r.d(t,{p:()=>n});var a=r(5155),i=r(2115),o=r(7549);let n=i.forwardRef((e,t)=>{let{className:r,type:i,...n}=e;return(0,a.jsx)("input",{type:i,className:(0,o.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:t,...n})});n.displayName="Input"},8986:(e,t,r)=>{r.d(t,{J:()=>d});var a=r(5155),i=r(2115),o=r(4352),n=r(1027),s=r(7549);let l=(0,n.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=i.forwardRef((e,t)=>{let{className:r,...i}=e;return(0,a.jsx)(o.b,{ref:t,className:(0,s.cn)(l(),r),...i})});d.displayName=o.b.displayName},2928:(e,t,r)=>{r.d(t,{B:()=>n});var a=r(9827),i=r(3030),o=r(3705);let n=(0,a.v)((e,t)=>({user:null,isAuth:!1,isLoading:!1,isInitialized:!1,checkAuth:async()=>{if(!(0,i.getCookie)("accessToken")){e({isInitialized:!0,isAuth:!1});return}e({isLoading:!0});try{await t().getProfile(),e({isAuth:!0,isInitialized:!0})}catch(t){console.error("Auth check failed",t),(0,i.deleteCookie)("accessToken"),(0,i.deleteCookie)("refreshToken"),e({user:null,isAuth:!1,isInitialized:!0})}finally{e({isLoading:!1})}},login:async(r,a)=>{e({isLoading:!0});try{let{accessToken:n,refreshToken:s}=(await o.F.post("/auth/login",{phone:r,password:a})).data;(0,i.setCookie)("accessToken",n),(0,i.setCookie)("refreshToken",s),e({isAuth:!0}),await t().getProfile()}finally{e({isLoading:!1})}},register:async t=>{e({isLoading:!0});try{let{confirmPassword:e,...r}=t;await o.F.post("/auth/register",r)}finally{e({isLoading:!1})}},logout:()=>{(0,i.deleteCookie)("accessToken"),(0,i.deleteCookie)("refreshToken"),e({user:null,isAuth:!1}),window.location.href="/auth/login"},getProfile:async()=>{try{let t=await o.F.get("/profile",{params:{_t:Date.now()}});e({user:t.data,isAuth:!0})}catch(e){console.error("Profile load failed",e)}},updateProfile:async r=>{e({isLoading:!0});try{await o.F.put("/profile",r),await t().getProfile()}finally{e({isLoading:!1})}},changePhone:async r=>{e({isLoading:!0});try{await o.F.post("/profile/change-phone",{newPhone:r}),await t().getProfile()}finally{e({isLoading:!1})}},becomePerformer:async()=>{e({isLoading:!0});try{await o.F.post("/profile/become-performer"),await t().getProfile()}finally{e({isLoading:!1})}},becomePerformerFull:async r=>{e({isLoading:!0});try{await o.F.post("/profile/become-performer",{description:r.description,competencies:r.competencies,location:r.location,currentLocation:null,isAlwaysReady:r.workSchedule.isAlwaysReady,workingDays:r.workSchedule.isAlwaysReady?null:JSON.stringify(r.workSchedule.schedulePerDay)}),await t().getProfile()}finally{e({isLoading:!1})}},updateCompetencies:async r=>{e({isLoading:!0});try{await o.F.put("/profile/competencies",{Competencies:r}),await t().getProfile()}finally{e({isLoading:!1})}},uploadAvatar:async r=>{e({isLoading:!0});try{let e=new FormData;e.append("file",r),await o.F.post("/profile/avatar",e,{headers:{"Content-Type":"multipart/form-data"}}),await t().getProfile()}finally{e({isLoading:!1})}},changePassword:async(r,a)=>{e({isLoading:!0});try{var i;let e=null===(i=t().user)||void 0===i?void 0:i.id;if(!e)throw Error("Пользователь не авторизован");await o.F.post("/profile/change-password",{accountId:e,oldPassword:r,newPassword:a})}finally{e({isLoading:!1})}},updateLocation:async(r,a)=>{e({isLoading:!0});try{var i;let e=null===(i=t().user)||void 0===i?void 0:i.id;if(!e)throw Error("Пользователь не авторизован");await o.F.put("/profile/location",{accountId:e,location:r,currentLocation:a}),await t().getProfile()}finally{e({isLoading:!1})}},updateSchedule:async(r,a)=>{e({isLoading:!0});try{var i;let e=null===(i=t().user)||void 0===i?void 0:i.id;if(!e)throw Error("Пользователь не авторизован");let n=r?"[]":JSON.stringify(a||{});await o.F.put("/profile/schedule",{accountId:e,isAlwaysReady:r,workingDaysJson:n}),await t().getProfile()}finally{e({isLoading:!1})}}}))},3705:(e,t,r)=>{r.d(t,{F:()=>o});var a=r(2651),i=r(3030);let o=a.A.create({baseURL:"http://127.0.0.1:5000/api",headers:{"Content-Type":"application/json"}});o.interceptors.request.use(e=>{let t=(0,i.getCookie)("accessToken");return t&&e.headers&&(e.headers.Authorization="Bearer ".concat(t)),console.log("\uD83D\uDE80 Sending request to: ".concat(e.baseURL).concat(e.url)),e});let n=!1,s=[],l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;s.forEach(r=>{e?r.reject(e):r.resolve(t)}),s=[]};o.interceptors.response.use(e=>e,async e=>{var t;let r=e.config;if((null===(t=e.response)||void 0===t?void 0:t.status)===401&&!r._retry){if(n)return new Promise((e,t)=>{s.push({resolve:e,reject:t})}).then(e=>(r.headers.Authorization="Bearer ".concat(e),o(r))).catch(e=>Promise.reject(e));r._retry=!0,n=!0;let e=(0,i.getCookie)("refreshToken");try{let{accessToken:t,refreshToken:n}=(await a.A.post("".concat("http://127.0.0.1:5000/api","/auth/refresh"),{refreshToken:e})).data;return(0,i.setCookie)("accessToken",t),(0,i.setCookie)("refreshToken",n),o.defaults.headers.common.Authorization="Bearer ".concat(t),l(null,t),o(r)}catch(e){return l(e,null),(0,i.deleteCookie)("accessToken"),(0,i.deleteCookie)("refreshToken"),window.location.href="/auth/login",Promise.reject(e)}finally{n=!1}}return Promise.reject(e)})},7549:(e,t,r)=>{r.d(t,{cn:()=>o,n:()=>n});var a=r(3463),i=r(9795);function o(){for(var e=arguments.length,t=Array(e),r=0;r