Files
appco_dist/.output/public/_nuxt/D8LZkxKc.js
T
2025-08-24 13:00:31 +03:30

2 lines
3.6 KiB
JavaScript

import{d as B,u as D,H as A,r as k,a4 as I,o as M,y as r,z as i,A as o,I as s,an as x,B as p,U as w,bp as V,a5 as b,a6 as $,C as m,D as _,ce as O,E as y,aB as T,S as q}from"./BYv1load.js";import{_ as z}from"./CscEAC8U.js";import{C as H,a as G}from"./7leyeuG9.js";import{m as a,e as u,r as J,c as K}from"./OQQ34J4k.js";const Q={class:"w-full h-screen bg-black text-white"},W={class:"flex w-full p-4 gap-8 justify-between items-center"},X={class:"flex gap-8 items-center"},Y=["alt"],Z={class:"font-semibold text-lg"},ee={class:"w-full flex items-center justify-center"},te=["src","alt"],se={key:1,class:"empty-state"},ae={class:"media-picker"},oe={class:"media-grid"},ne=["onClick"],le=["src"],re=["src"],ie=["onClick"],ce={class:"absolute bottom-5 right-5 addStyle"},f=10,_e=B({__name:"index",setup(ue){const d=D(),c=A(),h=k(null),v=k("");function C(){d.push({name:"home"}),J()}I(a,e=>{a.value.length===0?u.value="":a.value.length===1?u.value=a.value[0]:u.value=e[e.length-1]});function S(){a.value.length!==0?d.push({name:"add-story-infStory"}):q.warn(c.useString("addAtLeastOneMedia"))}function E(e){u.value=a.value[e]}const P=e=>e.includes(".mp4")||e.includes(".mov")||e.includes("video"),U=async()=>{try{H.isNativePlatform()?(await G.pickImages({limit:f-a.value.length})).photos.forEach(t=>a.value.push(t.webPath)):h.value.click()}catch(e){console.error("Error selecting media:",e)}},L=e=>{const t=e.target.files;t.length&&(Array.from(t).forEach(n=>{a.value.length<f&&(a.value.push(URL.createObjectURL(n)),K.value.push(n),u.value=URL.createObjectURL(n))}),h.value.value="")},R=e=>{e.preventDefault();const t=e.dataTransfer.files;Array.from(t).forEach(n=>{a.value.length<f&&a.value.push(URL.createObjectURL(n))})},F=e=>{a.value.splice(e,1)};return M(()=>{switch(d.currentRoute.value.name){case"add-product-inputProduct":v.value="product";break;case"add-story-inputStory":v.value="story";break;case"add-product-excel-inputProductExcel":v.value="productExcel";break}}),(e,t)=>{const n=O,N=T;return i(),r(b,null,[o("div",Q,[o("div",W,[o("div",X,[o("img",{src:z,alt:s(x),class:"w-4",onClick:C},null,8,Y),o("div",Z,p(s(c).useString("newStory")),1)]),o("div",{class:"text-primary text-sm",onClick:S},p(s(c).useString("next")),1)]),o("div",ee,[s(u)?(i(),r("img",{key:0,src:s(u),alt:s(x),class:"w-full aspect-square"},null,8,te)):s(a).length===0?(i(),r("p",se,p(s(c).useString("tapPlusToAdd")),1)):w("",!0)]),o("div",ae,[o("div",{class:"drop-area",onDragover:t[0]||(t[0]=V(()=>{},["prevent"])),onDrop:R},[o("div",oe,[(i(!0),r(b,null,$(s(a),(l,g)=>(i(),r("div",{key:g,class:"media-container",onClick:j=>E(g)},[P(l)?(i(),r("video",{key:0,src:l,class:"media-preview",controls:""},null,8,le)):(i(),r("img",{key:1,src:l,class:"media-preview"},null,8,re)),o("button",{onClick:j=>F(g),class:"remove-btn"},"✖",8,ie)],8,ne))),128)),s(a).length<f?(i(),r("div",{key:0,class:"add-media text-black",onClick:U},t[5]||(t[5]=[o("span",null,"+",-1)]))):w("",!0)])],32),o("input",{ref_key:"fileInput",ref:h,type:"file",accept:"image/*,video/*",multiple:"",hidden:"",onChange:L},null,544)])]),o("div",ce,[m(N,{value:v.value,"onUpdate:value":t[4]||(t[4]=l=>v.value=l),"button-style":"solid"},{default:_(()=>[m(n,{onClick:t[1]||(t[1]=l=>s(d).push({name:"add-product-excel-inputProductExcel"})),value:"productExcel"},{default:_(()=>[y(p(s(c).useString("productExcel")),1)]),_:1}),m(n,{onClick:t[2]||(t[2]=l=>s(d).push({name:"add-product-inputProduct"})),value:"product"},{default:_(()=>[y(p(s(c).useString("product2")),1)]),_:1}),m(n,{onClick:t[3]||(t[3]=l=>s(d).push({name:"add-story-inputStory"})),value:"story"},{default:_(()=>[y(p(s(c).useString("story2")),1)]),_:1})]),_:1},8,["value"])])],64)}}});export{_e as _};