PageSourceSearch

https://etabletka.ua/_nuxt/Bh1wTb05.js

js etabletka.ua collected 2026-10-08 12:24:54 UTC 10,261 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./D6ViA_XL.js","./DlAUqK2U.js","./gUPqrLvJ.js","./entry.q48ADllK.css","./BNWvAocl.js"])))=>i.map(i=>d[i]);
2import{d as ne,z as re,A as ie,a as de,M as ue,u as me,r as C,b as ce,w as pe,L as fe,h as z,n as ve,I as ye,o as y,m as d,i as q,g as t,e as V,k as h,f as n,j as S,t as F,G as A,p as ge,D as _e,C as g,q as Y}from"./gUPqrLvJ.js";import he from"./CEbHZBhr.js";import{_ as be}from"./Bj-lP1zR.js";import{_ as xe}from"./Dpr-4i1L.js";import Ie from"./CViCI5mo.js";import{c as G}from"./Bf3N_qTb.js";import{u as Ce,_ as Ne}from"./Zd_48fvI.js";import{_ as ke}from"./CpMN933C.js";import{s as K}from"./C1wepP6w.js";import{g as we}from"./BaZTbA_x.js";import"./CsPJ3QoO.js";import"./DovQ9WMe.js";import"./BXHWejGz.js";import"./CzQT_8pN.js";import"./CEdGW0Hz.js";import"./DlAUqK2U.js";import"./Bd4-5fUd.js";import"./DRoNgqWU.js";import"./2UhlY15H.js";import"./CN0SqL7X.js";import"./Co1HtBT5.js";const Ve=G("components/Icon/Camera.vue",()=>Y(()=>import("./D6ViA_XL.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).then(_=>_.default||_)),Se=G("components/Icon/TrashCan.vue",()=>Y(()=>import("./BNWvAocl.js"),__vite__mapDeps([4,1,2,3]),import.meta.url).then(_=>_.default||_)),Ae={class:"profile"},De=["title"],Le={for:"upload-avatar",class:"set",type:"button","aria-label":"Завантажити фото профілю",title:"Завантажити фото профілю"},Oe={class:"name"},Te={key:0,class:"fill-data"},Ee={class:"personal-info"},$e={class:"birth-date"},Pe={class:"delivery-address"},ze={key:0,class:"city-select"},Fe=["disabled"],Be={class:"exact-address"},Me={class:"password"},u="profileForm",it=ne({__name:"index",async setup(_){let N,B;re({link:[{rel:"canonical",href:ie().href}]}),de(we());const{selectedCity:H,populateCity:J}=ue(),{setValue:Q,getValues:W,getErrors:X}=Ce(),{user:l,patchUserProfile:Z,uploadAvatar:ee,deleteAvatar:te}=me(),m=C(null),b=C(H.value),k=C(!1),w=C(!1),r=C(!1),o=_e({year:-1,month:-1,day:-1}),D=g(()=>Array.from({length:87},(a,e)=>new Date().getFullYear()-e-14).reverse().map(a=>a.toString())),M=g(()=>Array.from({length:12},(a,e)=>new Date(0,e).toLocaleString("uk-UA",{month:"long"})).map(a=>`${a.charAt(0).toUpperCase()}${a.slice(1)}`)),f=g(()=>{const a=new Date(o.year,o.month+1,0).getDate();return Array.from({length:a},(e,s)=>s+1).map(e=>e.toString())}),x=g(()=>{const a=Object.values(o).reduce((e,s)=>s!==-1?e+1:e,0);return a===0||a===3}),L=g(()=>{if(!l.value)return 0;let a=0;const e=Object.entries(l.value.profile),s=["id","favoriteProducts"];for(const[c,I]of e)s.includes(c)||I&&a++;return Number.parseInt((a/(e.length-s.length)*100).toString())}),O=g(()=>X(u)),U=g(()=>{for(const a in O.value)if(O.value[a])return!1;return!0}),R=a=>/\d/.test(a)?"Цифри заборонені":/[^\p{L} '\-]/u.test(a)?"Спец символи заборонені, окрім апострофа і тире":/^[\'\-]/.test(a)||/[\'\-]$/.test(a)?"Слово не може починатись, або закінчуватись апострофом та тире":/['\-]{2,}/.test(a)?"Не може бути 2 апострофа або тире підряд":null,T=a=>{const e=/[‘’ʼ`´]/g,s=/[‐‑‒–—―]/g;return a.replace(e,"'").replace(s,"-")},E=[{type:"input",validate:R},{type:"focus",validate:R}],j=async()=>{if(!l.value||!U.value)return;let a=null;try{const c=new Date(Number.parseInt(D.value[o.year]||""),o.month,Number.parseInt(f.value[o.day]||""),0,0,0,0);a=new Date(c.getTime()-c.getTimezoneOffset()*6e4).toISOString()}catch{}const e=W(u),s=await Z(l.value.id,{firstName:e.firstName,lastName:e.lastName||null,middleName:e.middleName||null,email:e.email||null,street:e.street||null,house:e.house||null,apartment:e.apartment||null,floor:e.floor||null,katottgId:b.value?.id||null,dateOfBirth:a});l.value.profile=s};ce(()=>l.value?.profile,a=>{if(!a)return;const e=["phone","email","firstName","lastName","middleName","street","house","apartment","floor"];for(const s of e)Q({namespace:u,id:s,value:a[s]||null});if(a.dateOfBirth){const s=new Date(a.dateOfBirth),[c,I,$]=[s.getFullYear().toString(),s.toLocaleStr
2ing("uk-UA",{month:"long"}),s.getDate().toString()];o.year=D.value.findIndex(v=>v===c),o.month=M.value.findIndex(v=>v.toLowerCase()===I),o.day=f.value.findIndex(v=>v===$)}},{immediate:!0,deep:!0});const ae=async a=>{if(!l.value||!m.value)return;const e=a.target;if(!e||!e.files)return;const s=e.files[0];if(s)try{m.value.classList.add("loading"),l.value.profile.avatar=await ee(l.value.id,s)}finally{m.value.classList.remove("loading")}},le=async()=>{if(!(!l.value||!m.value))try{m.value.classList.add("loading"),await te(l.value.id),l.value.profile.avatar=null}finally{m.value.classList.remove("loading")}};return l.value?.profile.katottgId&&(b.value=([N,B]=pe(()=>J(l.value.profile.katottgId)),N=await N,B(),N)),fe(()=>{if(!m.value)return;const a=L.value;m.value.style.setProperty("--progress",a.toString())}),(a,e)=>{const s=he,c=be,I=xe,$=Ie,v=Ve,oe=Se,p=Ne,P=ke,se=ye;return y(),z(se,{name:"profile"},{default:ve(()=>[d(s,{modelValue:t(k),"onUpdate:modelValue":e[0]||(e[0]=i=>q(k)?k.value=i:null),onSelect:e[1]||(e[1]=i=>b.value=i)},null,8,["modelValue"]),d(c,{modelValue:t(w),"onUpdate:modelValue":e[2]||(e[2]=i=>q(w)?w.value=i:null)},null,8,["modelValue"]),t(l)?(y(),V("form",{key:0,class:"personal-info-container",onSubmit:h(j,["prevent"])},[n("div",Ae,[n("div",{ref_key:"avatarRef",ref:m,class:"avatar",title:`Ваш профіль заповнено на ${t(L)}%`},[e[9]||(e[9]=n("svg",{viewBox:"0 0 90 90",class:"circle"},[n("circle",{class:"progress"})],-1)),t(l).profile.avatar?(y(),z(I,{key:0,format:"webp",class:"image",fit:"fill",sizes:"xs:80 sm:80 md:80 lg:80",src:t(l).profile.avatar,alt:`Фото профілю ${t(l).profile.firstName}`},null,8,["src","alt"])):(y(),z($,{key:1,class:"icon"})),n("input",{id:"upload-avatar",type:"file",accept:"image/jpeg, image/png, image/webp, image/avif",onChange:h(ae,["prevent"])},null,32),n("label",Le,[d(v,{hydrateOnVisible:"",class:"icon"})]),t(l).profile.avatar?(y(),V("button",{key:2,class:"reset",type:"button","aria-label":"Видалити фото профілю",title:"Видалити фото профілю",onClick:h(le,["prevent"])},[d(oe,{hydrateOnVisible:"",class:"icon"})])):S("",!0)],8,De),n("div",Oe,F(`${t(l).profile.firstName}${t(l).profile.lastName?` ${t(l).profile.lastName}`:""}`),1)]),t(L)<100?(y(),V("div",Te," Заповніть ваші дані, що в подальшому вам допоможе в оформленні замовлень ")):S("",!0),n("div",Ee,[e[11]||(e[11]=n("h1",null,"Персональна інформація",-1)),d(p,{id:"firstName",type:"text",label:"Ім’я",placeholder:"Ім’я",autocomplete:"off",validators:E,transformer:T,namespace:u,disabled:!t(r),minlength:2,maxlength:30,required:!0},null,8,["disabled"]),d(p,{id:"lastName",type:"text",label:"Прізвище",placeholder:"Прізвище",autocomplete:"off",validators:E,transformer:T,namespace:u,disabled:!t(r),minlength:2,maxlength:30},null,8,["disabled"]),d(p,{id:"middleName",type:"text",label:"По батькові",placeholder:"По батькові",autocomplete:"off",validators:E,transformer:T,namespace:u,disabled:!t(r),minlength:4,maxlength:30},null,8,["disabled"]),n("div",$e,[e[10]||(e[10]=n("label",{for:"day"}," Дата народження ",-1)),d(P,{id:"day",class:A(["day",{disabled:!t(r),hightlighted:t(r)&&!t(x)&&t(o).day===-1}]),placeholder:"День",options:t(f),searchable:!0,selectedIndex:t(o).day,onSelect:e[3]||(e[3]=i=>{t(o).day=i})},null,8,["class","options","selectedIndex"]),d(P,{class:A(["month",{disabled:!t(r),hightlighted:t(r)&&!t(x)&&t(o).month===-1}]),placeholder:"Місяць",options:t(M),searchable:!0,selectedIndex:t(o).month,onSelect:e[4]||(e[4]=i=>{t(o).month=i,t(o).day>t(f).length-1&&(t(o).day=t(f).length-1)})},null,8,["class","options","selectedIndex"]),d(P,{id:"year",class:A(["year",{disabled:!t(r),hightlighted:t(r)&&!t(x)&&t(o).year===-1}]),placeholder:"Рік",options:t(D),searchable:!0,selectedIndex:t(o).year,onSelect:e[5]||(e[5]=i=>{t(o).year=i,t(o).day>t(f).length-1&&(t(o).day=t(f).length-1)})},null,8,["class","options","selectedIndex"])]),d(p,{id:"phone",type:"phone",label:"Номер телефону",placeholder:"Номер телефону",autocomplete:"off",namespace:u,disabled:!0}),d(p,{id:"email",type:"email",label:"Електронна пошта",placeholder:"Електронна пошта",autocomplete:"off",namespace:u,disabled:!t(r)},null,8,["disabled"])]),n("div",Pe,[e[14]||(e[14]=n("h1",null,"Адреса доставки",-1)),t(b)?(y(),V("div",ze,[e[13]||(e[13]=n("label",{for:"city"},"Ваше місто",-1)),n("button",{id:"city",class:"city-selector",disabled:!t(r),onClick:e[6]||(e[6]=h(i=>k.value=!0,["prevent"]))},[ge(F(t(b)?.name)+" ",1),e[12]||(e[12]=n("span",{class:"action"},"змінити",-1))],8,Fe)])):S("",!0),d(p,{id:"street",type:"text",label:"Назва вулиці",placeholder:"НаÐ
2·Ð²Ð° вулиці",autocomplete:"off",namespace:u,disabled:!t(r)},null,8,["disabled"]),n("div",Be,[d(p,{id:"house",type:"number",placeholder:"Будинок",autocomplete:"off",min:1,max:999,controls:!1,namespace:u,disabled:!t(r)},null,8,["disabled"]),d(p,{id:"apartment",type:"number",placeholder:"Квартира",autocomplete:"off",min:1,max:999,controls:!1,namespace:u,disabled:!t(r)},null,8,["disabled"]),d(p,{id:"floor",type:"number",placeholder:"Поверх",autocomplete:"off",min:1,max:99,controls:"alt",namespace:u,disabled:!t(r)},null,8,["disabled"])])]),n("div",Me,[e[15]||(e[15]=n("h1",null,"Пароль профілю",-1)),n("button",{class:"change-password",onClick:e[7]||(e[7]=h(i=>w.value=!0,["prevent"]))}," Змінити пароль ")]),n("button",{class:A(["mode-toggle",{disabled:t(r)&&(!t(x)||!t(U))}]),type:"submit",onClick:e[8]||(e[8]=h(()=>{if(t(r)){if(!t(x)){("scrollToElement"in a?a.scrollToElement:t(K))(".birth-date",{align:"center"});return}const i=Object.keys(t(O));if(i.length){("scrollToElement"in a?a.scrollToElement:t(K))(`#${i[0]}`,{align:"center"});return}j()}r.value=!t(r)},["prevent"]))},F(t(r)?"Зберегти зміни":"Редагувати"),3)],32)):S("",!0)]),_:1})}}});
2export{it as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.