Files
appco_dist/.output/public/_nuxt/BN8guUTz.js
T
2026-01-27 16:02:45 +03:30

2 lines
2.6 KiB
JavaScript

import{d as S,G as w,k as y,ai as x,y as v,z as h,a5 as g,A as c,J as n,a2 as _,d$ as C,r as f,C as b,D as z}from"./Cbt2tPBc.js";import{i as k}from"./Dn4CZ-Yo.js";import{_ as D}from"./Bbd_Ti14.js";import{f as P,m as $}from"./5ZDQaK5A.js";const j=["id","value"],B=["for"],R=S({__name:"StoriesComponent",props:{story:{},selectedStory:{}},emits:["update:selectedStory"],setup(s,{emit:i}){const u=w(),t=s,p=i,a=y(()=>t.selectedStory?.includes(t.story?.id)),o=y({get(){return t.selectedStory},set(r){p("update:selectedStory",r)}});function d(){const r=o.value?.findIndex(e=>e===t.story.id);r===-1?o.value?.push(t.story.id):o.value?.splice(r,1)}return(r,e)=>{const l=x("lazy");return h(),v("div",{class:"w-full h-full aspect-[2/3] relative",onClick:d},[g(c("img",{class:_(["w-full h-full object-cover aspect-[2/3]",a.value&&"bg-gray-500 opacity-50"])},null,2),[[l,{src:n(u).useDataStorage(s.story?.media_url),loading:n(k),error:n(k)}]]),g(c("input",{type:"checkbox",id:`story-${s.story.id}`,value:s.story,"onUpdate:modelValue":e[0]||(e[0]=m=>o.value=m),class:"absolute opacity-0 w-full h-full peer"},null,8,j),[[C,o.value]]),c("label",{for:`story-${s.story.id}`,class:"absolute bottom-2 right-2 w-5 h-5 rounded border-1 border-black cursor-pointer transition-all group-hover:ring-2 group-hover:ring-blue-400 peer-checked:bg-black peer-checked:border-black"},[(h(),v("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",class:_(["w-18px h-18px text-white bg-black transition-opacity",a.value?"peer-checked:opacity-100":"opacity-0"])},[...e[1]||(e[1]=[c("path",{d:"M5 12l5 5L20 7"},null,-1)])],2))],8,B)])}}}),M=Object.assign(R,{__name:"StoriesComponent"}),E={class:"cropper-wrapper"},O=S({__name:"ProfilePictureEditor",props:{src:{}},emits:["onCropped"],setup(s,{expose:i,emit:u}){const t=s,p=u,a=f(null),o=f(null);f(!1);const d=y(()=>t.src.startsWith("data:")?t.src:`${t.src}?cacheBust=${Date.now()}`);return i({crop:()=>{const e=o.value;if(!e)return;const l=e.getResult({size:{width:400,height:400},mime:"image/jpeg",quality:.9});l?.canvas?(a.value=l.canvas.toDataURL(),p("onCropped",a.value)):console.warn("❗ Failed to get canvas result")}}),(e,l)=>{const m=D;return h(),v("div",E,[b(m,null,{default:z(()=>[b(n(P),{ref_key:"cropperRef",ref:o,class:"cropper",src:d.value,"stencil-component":n($),"stencil-props":{aspectRatio:1,movable:!1,resizable:!1},"stencil-size":{width:340,height:340},"image-restriction":"stencil"},null,8,["src","stencil-component"])]),_:1})])}}}),N=Object.assign(O,{__name:"ProfilePictureEditor"});export{N as P,M as S};