1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FbEdaL-q.js","./entry.BKSlcA4h.css"])))=>i.map(i=>d[i]); 2import{d as te,e as T,c as u,r as se,f as g,a as o,m as re,i as D,o as d,_ as $,H as M,E as X,G as fe,v as O,I as Se,L as ee,Q as Le,R as x,S as oe,U as Ce,J as Te,K as pe,h as W,M as y,N as f,T as he,x as I,y as C,z as E,n as w,V as Q,F as U,A as Z,D as m,C as Ae,W as H,P as _e,t as ce,X as Ee,g as De,k as le,l as ne,Y as Pe,b as Oe,Z as Ue}from"./FbEdaL-q.js";import{_ as ge,G as Me,a as Ve,F as Be,b as xe,m as Fe,c as be}from"./ORbJkjbY.js";import{l as me,u as Re}from"./WWRZdGKx.js";import{C as ve}from"./QJp31d1-.js";import{G as Ne,H as He}from"./C1qzbn9R.js";import{u as je}from"./C3bIjaF4.js";const Ke=["width","height","fill","transform"],Ge={key:0},Ze=o("path",{d:"M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z"},null,-1),ze=[Ze],We={key:1},Je=o("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"},null,-1),qe=o("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"},null,-1),Ye=[Je,qe],Qe={key:2},Xe=o("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z"},null,-1),$e=[Xe],et={key:3},tt=o("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"},null,-1),st=[tt],rt={key:4},ot=o("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"},null,-1),nt=[ot],at={key:5},lt=o("path",{d:"M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z"},null,-1),it=[lt],dt={name:"PhCircleNotch"},ut=te({...dt,props:{weight:{type:String},size:{type:[String,Number]},color:{type:String},mirrored:{type:Boolean}},setup(t){const e=t,a=D("weight","regular"),n=D("size","1em"),s=D("color","currentColor"),r=D("mirrored",!1),i=T(()=>e.weight??a),l=T(()=>e.size??n),p=T(()=>e.color??s),b=T(()=>e.mirrored!==void 0?e.mirrored?"scale(-1, 1)":void 0:r?"scale(-1, 1)":void 0);return(h,v)=>(d(),u("svg",re({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",width:l.value,height:l.value,fill:p.value,transform:b.value},h.$attrs),[se(h.$slots,"default"),i.value==="bold"?(d(),u("g",Ge,ze)):i.value==="duotone"?(d(),u("g",We,Ye)):i.value==="fill"?(d(),u("g",Qe,$e)):i.value==="light"?(d(),u("g",et,st)):i.value==="regular"?(d(),u("g",rt,nt)):i.value==="thin"?(d(),u("g",at,it)):g("",!0)],16,Ke))}}),ct=["width","height","fill","transform"],pt={key:0},gt=o("path",{d:"M220,112v96a20,20,0,0,1-20,20H56a20,20,0,0,1-20-20V112A20,20,0,0,1,56,92H76a12,12,0,0,1,0,24H60v88H196V116H180a12,12,0,0,1,0-24h20A20,20,0,0,1,220,112ZM96.49,72.49,116,53v83a12,12,0,0,0,24,0V53l19.51,19.52a12,12,0,1,0,17-17l-40-40a12,12,0,0,0-17,0l-40,40a12,12,0,1,0,17,17Z"},null,-1),mt=[gt],ht={key:1},ft=o("path",{d:"M208,104V216H48V104Z",opacity:"0.2"},null,-1),xt=o("path",{d:"M216,112v96a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V112A16,16,0,0,1,56,96H80a8,8,0,0,1,0,16H56v96H200V112H176a8,8,0,0,1,0-16h24A16,16,0,0,1,216,112ZM93.66,69.66,120,43.31V136a8,8,0,0,0,16,0V43.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,69.66Z"},null,-1),bt=[ft,xt],vt={key:2},yt=o("path",{d:"M216,112v96a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V112A16,16,0,0,1,56,96h64v48a8,8,0,0,0,16,0V96h64A16,16,0,0,1,216,112ZM136,43.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,69.66L120,43.31V96h16Z"},null,-1),wt=[yt],It={key:3},kt=o("path",{d:"M214,112v96a14,14,0,0,1-14,14H56a14,14,0,0,1-14-14V112A14,14,0,0,1,56,98H80a6,
26,0,0,1,0,12H56a2,2,0,0,0-2,2v96a2,2,0,0,0,2,2H200a2,2,0,0,0,2-2V112a2,2,0,0,0-2-2H176a6,6,0,0,1,0-12h24A14,14,0,0,1,214,112ZM92.24,68.24,122,38.49V136a6,6,0,0,0,12,0V38.49l29.76,29.75a6,6,0,1,0,8.48-8.48l-40-40a6,6,0,0,0-8.48,0l-40,40a6,6,0,1,0,8.48,8.48Z"},null,-1),St=[kt],Lt={key:4},Ct=o("path",{d:"M216,112v96a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V112A16,16,0,0,1,56,96H80a8,8,0,0,1,0,16H56v96H200V112H176a8,8,0,0,1,0-16h24A16,16,0,0,1,216,112ZM93.66,69.66,120,43.31V136a8,8,0,0,0,16,0V43.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,69.66Z"},null,-1),Tt=[Ct],At={key:5},_t=o("path",{d:"M212,112v96a12,12,0,0,1-12,12H56a12,12,0,0,1-12-12V112a12,12,0,0,1,12-12H80a4,4,0,0,1,0,8H56a4,4,0,0,0-4,4v96a4,4,0,0,0,4,4H200a4,4,0,0,0,4-4V112a4,4,0,0,0-4-4H176a4,4,0,0,1,0-8h24A12,12,0,0,1,212,112ZM90.83,66.83,124,33.66V136a4,4,0,0,0,8,0V33.66l33.17,33.17a4,4,0,1,0,5.66-5.66l-40-40a4,4,0,0,0-5.66,0l-40,40a4,4,0,0,0,5.66,5.66Z"},null,-1),Et=[_t],Dt={name:"PhExport"},Pt=te({...Dt,props:{weight:{type:String},size:{type:[String,Number]},color:{type:String},mirrored:{type:Boolean}},setup(t){const e=t,a=D("weight","regular"),n=D("size","1em"),s=D("color","currentColor"),r=D("mirrored",!1),i=T(()=>e.weight??a),l=T(()=>e.size??n),p=T(()=>e.color??s),b=T(()=>e.mirrored!==void 0?e.mirrored?"scale(-1, 1)":void 0:r?"scale(-1, 1)":void 0);return(h,v)=>(d(),u("svg",re({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",width:l.value,height:l.value,fill:p.value,transform:b.value},h.$attrs),[se(h.$slots,"default"),i.value==="bold"?(d(),u("g",pt,mt)):i.value==="duotone"?(d(),u("g",ht,bt)):i.value==="fill"?(d(),u("g",vt,wt)):i.value==="light"?(d(),u("g",It,St)):i.value==="regular"?(d(),u("g",Lt,Tt)):i.value==="thin"?(d(),u("g",At,Et)):g("",!0)],16,ct))}}),Ot=["width","height","fill","transform"],Ut={key:0},Mt=o("path",{d:"M160,88a16,16,0,1,1,16,16A16,16,0,0,1,160,88Zm76-32V160a20,20,0,0,1-20,20H204v20a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V88A20,20,0,0,1,40,68H60V56A20,20,0,0,1,80,36H216A20,20,0,0,1,236,56ZM180,180H80a20,20,0,0,1-20-20V92H44V196H180Zm-21.66-24L124,121.66,89.66,156ZM212,60H84v67.72l25.86-25.86a20,20,0,0,1,28.28,0L192.28,156H212Z"},null,-1),Vt=[Mt],Bt={key:1},Ft=o("path",{d:"M224,56v82.06l-23.72-23.72a8,8,0,0,0-11.31,0L163.31,140,113.66,90.34a8,8,0,0,0-11.32,0L64,128.69V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z",opacity:"0.2"},null,-1),Rt=o("path",{d:"M216,40H72A16,16,0,0,0,56,56V72H40A16,16,0,0,0,24,88V200a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V184h16a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM72,56H216v62.75l-10.07-10.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L72,109.37ZM184,200H40V88H56v80a16,16,0,0,0,16,16H184Zm32-32H72V132l36-36,49.66,49.66a8,8,0,0,0,11.31,0L194.63,120,216,141.38V168ZM160,84a12,12,0,1,1,12,12A12,12,0,0,1,160,84Z"},null,-1),Nt=[Ft,Rt],Ht={key:2},jt=o("path",{d:"M216,40H72A16,16,0,0,0,56,56V72H40A16,16,0,0,0,24,88V200a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V184h16a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM172,72a12,12,0,1,1-12,12A12,12,0,0,1,172,72Zm12,128H40V88H56v80a16,16,0,0,0,16,16H184Zm32-32H72V120.69l30.34-30.35a8,8,0,0,1,11.32,0L163.31,140,189,114.34a8,8,0,0,1,11.31,0L216,130.07V168Z"},null,-1),Kt=[jt],Gt={key:3},Zt=o("path",{d:"M216,42H72A14,14,0,0,0,58,56V74H40A14,14,0,0,0,26,88V200a14,14,0,0,0,14,14H184a14,14,0,0,0,14-14V182h18a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM70,56a2,2,0,0,1,2-2H216a2,2,0,0,1,2,2v67.57L204.53,110.1a14,14,0,0,0-19.8,0l-21.42,21.41L117.9,86.1a14,14,0,0,0-19.8,0L70,114.2ZM186,200a2,2,0,0,1-2,2H40a2,2,0,0,1-2-2V88a2,2,0,0,1,2-2H58v82a14,14,0,0,0,14,14H186Zm30-30H72a2,2,0,0,1-2-2V131.17l36.58-36.58a2,2,0,0,1,2.83,0l49.66,49.66a6,6,0,0,0,8.49,0l25.65-25.66a2,2,0,0,1,2.83,0l22,22V168A2,2,0,0,1,216,170ZM162,84a10,10,0,1,1,10,10A10,10,0,0,1,162,84Z"},null,-1),zt=[Zt],Wt={key:4},Jt=o("path",{d:"M216,40H72A16,16,0,0,0,56,56V72H40A16,16,0,0,0,24,88V200a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V184h16a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM72,56H216v62.75l-10.07-10.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L72,109.37ZM184,200H40V88H56v80a16,16,0,0,0,16,16H184Zm32-32H72V132l36-36,49.66,49.66a8,8,0,0,0,11.31,0L194.63,120,216,141.38V168ZM160,84a12,12,0,1,1,12,12A12,12,0,0,1,160,84Z"},null,-1),qt=[Jt],Yt={key:5},Qt=o("path",{d:"M216,44H72A12,12,0,0,0,60,56V76H40A12,12,0,0,0,28,88V200a12,12,0,0,0,12,12H184a12,12,0,0,0,12-12V180h20a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM68,56a4,4,0,0,1,4-4H216a4,4,0,0,1,4,4v72.4l-16.89-16.89a12,12,0,0,0-17,0l-22.83,22.83L116.49,87.51a12,12,0,0,0-17,0L68,119ZM188,200a4,4,0,0,1-4,4H40a4,4,0,0,1-4-4V88a4,4,0,0,1,4-4H60v84a12,12,0,0,0,12,12H188Zm28-28H72a4,4,0,0,1-4-4V130.34l37.17-37.17a4,4,0,0,1,5.66,0l49.66,49.66a4,4,0,0,0,5.65,0l25.66-25.66a4,4,0,0,1,5.66,0L220,139.71V168A4,4,0,0,1,216,172ZM164,84a8,8,0,1,1,8,8A8,8,0,0,1,164,84Z"}
2,null,-1),Xt=[Qt],$t={name:"PhImages"},es=te({...$t,props:{weight:{type:String},size:{type:[String,Number]},color:{type:String},mirrored:{type:Boolean}},setup(t){const e=t,a=D("weight","regular"),n=D("size","1em"),s=D("color","currentColor"),r=D("mirrored",!1),i=T(()=>e.weight??a),l=T(()=>e.size??n),p=T(()=>e.color??s),b=T(()=>e.mirrored!==void 0?e.mirrored?"scale(-1, 1)":void 0:r?"scale(-1, 1)":void 0);return(h,v)=>(d(),u("svg",re({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",width:l.value,height:l.value,fill:p.value,transform:b.value},h.$attrs),[se(h.$slots,"default"),i.value==="bold"?(d(),u("g",Ut,Vt)):i.value==="duotone"?(d(),u("g",Bt,Nt)):i.value==="fill"?(d(),u("g",Ht,Kt)):i.value==="light"?(d(),u("g",Gt,zt)):i.value==="regular"?(d(),u("g",Wt,qt)):i.value==="thin"?(d(),u("g",Yt,Xt)):g("",!0)],16,Ot))}}),ts=["width","height","fill","transform"],ss={key:0},rs=o("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"},null,-1),os=[rs],ns={key:1},as=o("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"},null,-1),ls=o("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"},null,-1),is=[as,ls],ds={key:2},us=o("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"},null,-1),cs=[us],ps={key:3},gs=o("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"},null,-1),ms=[gs],hs={key:4},fs=o("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"},null,-1),xs=[fs],bs={key:5},vs=o("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"},null,-1),ys=[vs],ws={name:"PhPlus"},Is=te({...ws,props:{weight:{type:String},size:{type:[String,Number]},color:{type:String},mirrored:{type:Boolean}},setup(t){const e=t,a=D("weight","regular"),n=D("size","1em"),s=D("color","currentColor"),r=D("mirrored",!1),i=T(()=>e.weight??a),l=T(()=>e.size??n),p=T(()=>e.color??s),b=T(()=>e.mirrored!==void 0?e.mirrored?"scale(-1, 1)":void 0:r?"scale(-1, 1)":void 0);return(h,v)=>(d(),u("svg",re({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",width:l.value,height:l.value,fill:p.value,transform:b.value},h.$attrs),[se(h.$slots,"default"),i.value==="bold"?(d(),u("g",ss,os)):i.value==="duotone"?(d(),u("g",ns,is)):i.value==="fill"?(d(),u("g",ds,cs)):i.value==="light"?(d(),u("g",ps,ms)):i.value==="regular"?(d(),u("g",hs,xs)):i.value==="thin"?(d(),u("g",bs,ys)):g("",!0)],16,ts))}}),ks=["width","height","fill","transform"],Ss={key:0},Ls=o("path",{d:"M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z"},null,-1),Cs=[Ls],Ts={key:1},As=o("path",{d:"M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z",opacity:"0.2"},null,-1),_s=o("path",{d:"M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z"},null,-1),Es=[As,_s],Ds={key:2},Ps=o("path",{d:"M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z"},null,-1),Os=[Ps],Us={key:3}
2,Ms=o("path",{d:"M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z"},null,-1),Vs=[Ms],Bs={key:4},Fs=o("path",{d:"M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z"},null,-1),Rs=[Fs],Ns={key:5},Hs=o("path",{d:"M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z"},null,-1),js=[Hs],Ks={name:"PhSparkle"},Gs=te({...Ks,props:{weight:{type:String},size:{type:[String,Number]},color:{type:String},mirrored:{type:Boolean}},setup(t){const e=t,a=D("weight","regular"),n=D("size","1em"),s=D("color","currentColor"),r=D("mirrored",!1),i=T(()=>e.weight??a),l=T(()=>e.size??n),p=T(()=>e.color??s),b=T(()=>e.mirrored!==void 0?e.mirrored?"scale(-1, 1)":void 0:r?"scale(-1, 1)":void 0);return(h,v)=>(d(),u("svg",re({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",width:l.value,height:l.value,fill:p.value,transform:b.value},h.$attrs),[se(h.$slots,"default"),i.value==="bold"?(d(),u("g",Ss,Cs)):i.value==="duotone"?(d(),u("g",Ts,Es)):i.value==="fill"?(d(),u("g",Ds,Os)):i.value==="light"?(d(),u("g",Us,Vs)):i.value==="regular"?(d(),u("g",Bs,Rs)):i.value==="thin"?(d(),u("g",Ns,js)):g("",!0)],16,ks))}}),Zs={name:"LibraryBold"},zs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -960 960 960",fill:"currentColor"};function Ws(t,e,a,n,s,r){return d(),u("svg",zs,e[0]||(e[0]=[o("path",{d:"m523-430-49-63q-7-9-18.5-9t-18.5 9l-46 61q-9 12-2.583 25 6.416 13 21.583 13h296q15.042 0 21.521-13Q734-420 725-432l-80-108q-6.615-10-18.808-10Q614-550 607-540l-84 110ZM286-192q-39.05 0-66.525-27.475Q192-246.95 192-286v-542q0-39.463 27.475-67.231Q246.95-923 286-923h542q39.463 0 67.231 27.769Q923-867.463 923-828v542q0 39.05-27.769 66.525Q867.463-192 828-192H286Zm0-94h542v-542H286v542ZM132-37q-39.463 0-67.231-27.769Q37-92.537 37-132v-589q0-19.75 14.238-33.375T85.175-768q19.275 0 33.05 13.625Q132-740.75 132-721v589h589q19.75 0 33.375 14.061Q768-103.877 768-84.439 768-65 754.375-51T721-37H132Zm154-791v542-542Z"},null,-1)]))}const Js=$(Zs,[["render",Ws]]),qs={name:"MyLibrary"};function Ys(t,e,a,n,s,r){const i=Js,l=fe;return d(),M(l,{to:"/my-library",class:"border-border bg-surface text-foreground hover:bg-surface-2 focus:ring-brand-blue/30 inline-flex items-center gap-x-2 rounded-lg border px-4 py-2 text-sm font-semibold focus:ring-4 focus:outline-none"},{default:X(()=>[O(i,{class:"h-5 w-5"}),e[0]||(e[0]=o("span",null,"My Library",-1))]),_:1,__:[0]})}const ye=$(qs,[["render",Ys]]),ie="pending_create_batch",Qs=7200*1e3;function Xs(){const t=pe(),e=Te.create({baseURL:t.public.apiBaseUrl});return e.interceptors.request.use(a=>{const n=localStorage.getItem("auth_token");return n&&(a.headers.Authorization=`Bearer ${n}`),a},async a=>await Promise.reject(a)),e}let de=null;function ue(){return de||(de=Xs()),de}function we(){return{imageName:"",ecommerce:{brand:"",product:"",primary_color:"",secondary_color:""},seoKeywords:[],negativeKeywords:[],autoContext:!0,customPrompt:"",textLength:"normal",aiModel:"gpt-5-nano",languages:["en"],prefix:"",suffix:"",outputType:"plain"}}function J(t){return{...t,ecommerce:{...t.ecommerce},seoKeywords:[...t.seoKeywords],negativeKeywords:[...t.negativeKeywords],languages:[...t.languages]}}function q(){return{url:"",file:null,sourceType:"url",name:"",nameIsUserSet:!1,options:we(),pageContext:null,alt:"",results:{},htmlOutput:null,status:"pending",errorMessage:null,humanReview:"none"}}const ae=Se("create",{state:()=>({imageData:[q()],globalDefaults:we(),currentImageIndex:0,applyOptionsToAll:!1,loading:!1,processingIndex:null,lastResponse:null}),getters:{currentImage(){return x.filter(this.imageData,e=>e.url!==""||e.file)[this.currentImageIndex]||null},options(){return this.applyOptionsToAll?this.globalDefaults:this.currentImage?.options||this.globalDefaults},totalCredits(){const t=this.options,e=t.textLength==="detailed"?2:1,a=t.aiModel==="gpt-5"?10:1,n=Math.max(1,t.languages.length);return e*a*n},creditsForImage(){return t=>{const e=this.imageData[t];if(!e)return 0;const a=this.applyOptionsToAll?this.globalDefaults:e.options,n=a.textLength==="detailed"?2:1,s=a.aiModel==="gpt-5"?10:1,r=Math.max(1,a.languages.length);return n*s*r}},validImages(){return x.filter(this.imageData,t=>t.url!==""||t.file)},isProcessing(){return x.some(this.imageData,t=>t.status==="processing")}},actions:{appendImage(t){const e={...q(),...t};e.options=J(this.globalDefaults),this.imageData.push(e)},appendImageFromUrl(t){if(!x.some(this.imageData,e=>e.url===t)){const e={...q(),url:t,sourceType:"url"};e.options=J(this.globalDefaults),this.imageData.push(e)}},appendImageFromFile(t,e){const a={...q(),url:e,file:Ce(t),sourceType:"upload"};a.options=J(this.globalDefaults),this.imageData.push(a)},removeImageAtIndex(t){if(t>=0&&t<this.imageData.length){this.imageData.splice(t,1);const e=x.filter(this.imageData,a=>a.url!==""||a.file).length;this.currentImageIndex>=e&&(this.currentImageIndex=Math.max(0,e-1))}},clearAllImages(){this.imageData=[q()],this.currentImageIndex=0,this.lastResponse=null},clearState(){this.$reset()},clearEmptyUrlData(){this.imageData=x.filter(this.imageData,t=>t.url!==""||t.file)},removeDuplicateUrls(){const t=new Set;this.imageData=x.filter(this.imageData,e=>e.url===""?!0:t.has(e.url)?!1:(t.add(e.url),!0))},setImageDataArray(t){x.forEach(t,e=>{this.appendImageFromUrl(e)}
2)},appendImageFromScrape(t,e,a){if(!x.some(this.imageData,n=>n.url===t)){const n={...q(),url:t,sourceType:"url",pageContext:{...e||{},...a||{}}};n.options=J(this.globalDefaults),this.imageData.push(n)}},setImageDataArrayFromScrape(t,e,a){x.forEach(t,n=>{const s=a?.[n]||null;this.appendImageFromScrape(n,e,s)})},setApplyOptionsToAll(t){this.applyOptionsToAll=t},setCurrentImageIndex(t){this.currentImageIndex=t},applyDefaultsToAllImages(){x.forEach(this.imageData,t=>{(t.url!==""||t.file)&&(t.options=J(this.globalDefaults))})},copyCurrentOptionsToDefaults(){const t=this.currentImage;t&&(this.globalDefaults={...t.options})},getTargetOptions(){return this.applyOptionsToAll?this.globalDefaults:this.currentImage?.options||this.globalDefaults},ensureImageOptions(t){t.options||(t.options=J(this.globalDefaults)),t.options.ecommerce||(t.options.ecommerce={brand:"",product:"",primary_color:"",secondary_color:""})},setImageName(t){const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.imageName=t,e.nameIsUserSet=t!=="")},setBrand(t){if(this.globalDefaults.ecommerce.brand=t,this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.ecommerce.brand=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.ecommerce.brand=t)}},setProduct(t){if(this.globalDefaults.ecommerce.product=t,this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.ecommerce.product=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.ecommerce.product=t)}},setPrimaryColor(t){if(this.globalDefaults.ecommerce.primary_color=t,this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.ecommerce.primary_color=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.ecommerce.primary_color=t)}},setSecondaryColor(t){if(this.globalDefaults.ecommerce.secondary_color=t,this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.ecommerce.secondary_color=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.ecommerce.secondary_color=t)}},setSeoKeywords(t){if(this.globalDefaults.seoKeywords=[...t],this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.seoKeywords=[...t])});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.seoKeywords=t)}},setNegativeKeywords(t){if(this.globalDefaults.negativeKeywords=[...t],this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.negativeKeywords=[...t])});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.negativeKeywords=t)}},setAutoContext(t){if(this.globalDefaults.autoContext=t,this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.autoContext=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.autoContext=t)}},setCustomPrompt(t){if(this.globalDefaults.customPrompt=t,this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.customPrompt=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.customPrompt=t)}},setPrefix(t){if(this.globalDefaults.prefix=t,this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.prefix=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.prefix=t)}},setSuffix(t){if(this.globalDefaults.suffix=t,this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.suffix=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.suffix=t)}},setTextLength(t){if(this.globalDefaults.textLength=t,this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.textLength=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.textLength=t)}},setAiModel(t){if(this.globalDefaults.aiModel=t,this.applyOptionsToAll)x.forEac
2h(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.aiModel=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.aiModel=t)}},setLanguages(t){const e=(t||[]).filter(n=>n&&n!=="en"),a=["en",...Array.from(new Set(e))];if(this.globalDefaults.languages=a,this.applyOptionsToAll)x.forEach(this.imageData,n=>{(n.url!==""||n.file)&&(this.ensureImageOptions(n),n.options.languages=[...a])});else{const n=this.currentImage;n&&(this.ensureImageOptions(n),n.options.languages=a)}},setOutputType(t){if(this.globalDefaults.outputType=t,this.applyOptionsToAll)x.forEach(this.imageData,e=>{(e.url!==""||e.file)&&(this.ensureImageOptions(e),e.options.outputType=t)});else{const e=this.currentImage;e&&(this.ensureImageOptions(e),e.options.outputType=t)}},setSelectedAIModel(t){const e={gpt5nano:"gpt-5-nano","gpt-5-nano":"gpt-5-nano",gpt5:"gpt-5","gpt-5":"gpt-5"};this.setAiModel(e[t]||"gpt-5-nano")},setSelectedLength(t){this.setTextLength(t)},setSelectedLanguages(t){this.setLanguages(t)},flagForHumanReview(t){this.imageData[t]&&(this.imageData[t].humanReview="flagged")},buildRequestPayload(t){const e=t.file?oe(t.file):null,a=e&&t.sourceType==="upload",n={...this.globalDefaults,...t.options||{},autoContext:this.globalDefaults.autoContext,aiModel:this.globalDefaults.aiModel,languages:this.globalDefaults.languages,textLength:this.globalDefaults.textLength,outputType:this.globalDefaults.outputType,prefix:this.globalDefaults.prefix,suffix:this.globalDefaults.suffix};if(a){const i=new FormData;if(i.append("image_file",e),n.imageName&&t.nameIsUserSet&&i.append("image_name",n.imageName),n.ecommerce?.brand&&i.append("ecommerce[brand]",n.ecommerce.brand),n.ecommerce?.product&&i.append("ecommerce[product]",n.ecommerce.product),n.ecommerce?.primary_color&&i.append("ecommerce[primary_color]",n.ecommerce.primary_color),n.ecommerce?.secondary_color&&i.append("ecommerce[secondary_color]",n.ecommerce.secondary_color),x.forEach(n.seoKeywords||[],(l,p)=>{i.append(`seo_keywords[${p}]`,l)}),x.forEach(n.negativeKeywords||[],(l,p)=>{i.append(`negative_keywords[${p}]`,l)}),i.append("auto_context",n.autoContext?"1":"0"),n.autoContext&&t.pageContext){const l=t.pageContext;l.page_title&&i.append("page_context[page_title]",l.page_title),l.meta_description&&i.append("page_context[meta_description]",l.meta_description),l.nearby_heading&&i.append("page_context[nearby_heading]",l.nearby_heading),l.figcaption&&i.append("page_context[figcaption]",l.figcaption),l.existing_alt&&i.append("page_context[existing_alt]",l.existing_alt)}return n.customPrompt&&i.append("custom_prompt",n.customPrompt),i.append("text_length",n.textLength||"normal"),i.append("ai_model",n.aiModel||"gpt-5-nano"),x.forEach(n.languages||["en"],(l,p)=>{i.append(`languages[${p}]`,l)}),i.append("prefix",n.prefix||""),i.append("suffix",n.suffix||""),i.append("output_type",n.outputType||"plain"),i}const s={image_url:t.url,text_length:n.textLength||"normal",ai_model:n.aiModel||"gpt-5-nano",languages:n.languages||["en"]};n.imageName&&t.nameIsUserSet&&(s.image_name=n.imageName);const r=n.ecommerce;return(r?.brand||r?.product||r?.primary_color||r?.secondary_color)&&(s.ecommerce={},r.brand&&(s.ecommerce.brand=r.brand),r.product&&(s.ecommerce.product=r.product),r.primary_color&&(s.ecommerce.primary_color=r.primary_color),r.secondary_color&&(s.ecommerce.secondary_color=r.secondary_color)),n.seoKeywords?.length>0&&(s.seo_keywords=n.seoKeywords),n.negativeKeywords?.length>0&&(s.negative_keywords=n.negativeKeywords),s.auto_context=!!n.autoContext,n.autoContext&&t.pageContext&&(s.page_context=t.pageContext),n.customPrompt&&(s.custom_prompt=n.customPrompt),s.prefix=n.prefix||"",s.suffix=n.suffix||"",n.outputType!=="plain"&&(s.output_type=n.outputType),s},buildRegeneratePayload(t){const e={...this.globalDefaults,...t.options||{},autoContext:this.globalDefaults.autoContext,aiModel:this.globalDefaults.aiModel,languages:this.globalDefaults.languages,textLength:this.globalDefaults.textLength,outputType:this.globalDefaults.outputType,prefix:this.globalDefaults.prefix,suffix:this.globalDefaults.suffix},a={text_length:e.textLength||"normal",ai_model:e.aiModel||"gpt-5-nano",languages:e.languages||["en"],output_type:e.outputType||"plain",image_name:t.nameIsUserSet&&e.imageName||""};a.auto_context=!!e.autoContext,e.autoContext&&t.pageContext&&(a.page_context=t.pageContext),a.custom_prompt=e.customPrompt||"",a.prefix=e.prefix||"",a.suffix=e.suffix||"",a.seo_keywords=e.seoKeywords||[],a.negative_keywords=e.negativeKeywords||[];const n=e.ecommerce;return a.ecommerce={brand:n?.brand||"",product:n?.product||"",primary_color:n?.primary_color||"",secondary_color:n?.secondary_color||""},a},stashPendingBatch(){if(!(typeof window>"u"))try{const t=x.filter(this.imageData,a=>!!a.url).map(a=>({url:a.url,sourceType:"url",name:a.name,nameIsUserSet:a.nameIsUserSet,options:oe(a.options),pageContext:a.pageContext?oe(a.pageContext):null})),e=x.filter(this.imageData,a=>!!a.file&&!a.url).length;if(t.length===0&&e===0)return;window.localStorage.setItem(ie,JSON.stringify({savedAt:Date.now(),images:t,droppedUploads:e,globalDefaults:oe(this.globalDefaults),applyOptionsToAll:this.applyOptionsToAll}))}catch{}},restorePendingBatch(){if(typeof window>"u")return null;let t=null;try{t=window.localStorage.getItem(ie)}catch{return null}if(!t)return null;try{window.localStorage.removeItem(ie)}catch{}try{const e=JSON.parse(t);if(!e||typeof e.savedAt!="number"||Date.now()-e.savedAt>Qs)return null;const a=Array.isArray(e.images)?e.images:[];return a.length===0?e.droppedUploads||null:(e.globalDefaults&&(this.globalDefaults=e.globalDefaults),typeof e.applyOptionsToAll=="boolean"&&(this.applyOptionsToAll=e.applyOptionsToAll),this.imageData=a.map(n=>({...q(),url:String(n.url||""),sourceType:"url",name:String(n.name||""),nameIsUserSet:!!n.nameIsUserSet,options:n.options||J(this.globalDefaults),pageContext:n.pageContext||null})),this.currentImageIndex=0,e.droppedUploads||0)}catch{return null}},requireAccountForGeneration(){return ee().authenticated?!1:(this.stashPendingBatch(),typeof window<"u"&&(window.location.href="/sign-up?redirect=/create"),!0)},async generateAltText(t){if(this.requireAccountForGeneration())return;const e=this.imageData[t];if(!e||!e.url&&!e.file){console.error("No image data at index",t);return}try{this.loading=!0,e.status="processing",e.errorMessage=null;let a;if(e.id)a=await ue().post(`/images/${e.id}/regenerate`,this.buildRegeneratePayload(e));else{const r=this.buildRequestPayload(e),i=r instanceof FormData;a=await ue().post("/images",r,{headers:i?{"Content-Type":"multipart/form-data"}:{"Content-Type":"application/json"}})}const n=a.data.image;if(this.lastResponse=n,a.data.credits_remaining!==void 0){const r=ee();r.user.current_credits_available=a.data.credits_remaining,r.user.credits_total=a.data.credits_remaining,localStorage.setItem("userData",JSON.stringify(r.user))}e.id=n.id,e.status=n.status,e.results=n.results||{},e.htmlOutput=n.html_output,n.image_name&&!e.nameIsUserSet&&(e.name=n.image_name,this.ensureImageOptions(e),e.options.imageName=n.image_name);const s=n.primary_language||this.options.languages[0]||"en";e.alt=n.results?.[s]||"",e.alt&&Le().trackFirstGeneration(),n.error_message&&(e.errorMessage=n.error_message)}catch(a){console.error("Failed to generate alt text:",a),e.status="failed";let n=a.response?.data?.error||a.response?.data?.message||a.message||"Generation failed";(n.includes("downloading")||n.includes("download"))&&(n="The image host blocked the request. Try downloading the image and uploading it as a file instead."),e.errorMessage=n}finally{this.imageData.some(a=>a.status==="processing")||(this.loading=!1)}},async generateAllAltText(){if(this.requireAccountForGeneration())return;this.clearEmptyUrlData(),this.removeDuplicateUrls();const t=[];for(let a=0;a<this.imageData.length;a++)(this.imageData[a].url||this.imageData[a].file)&&t.push(a);const e=10;for(let a=0;a<t.length;a+=e){const n=t.slice(a,a+e);await Promise.all(n.map(s=>this.generateAltText(s)))}},async pollImageStatus(t,e=30,a=2e3){const n=this.imageData[t];if(!n?.id)return;let s=0;for(;s<e&&n.status==="processing";){await new Promise(r=>setTimeout(r,a));try{const i=(await ue().get(`/images/${n.id}/status`)).data;n.status=i.status,n.results=i.results||{},n.htmlOutput=i.html_output;const l=i.primary_language||"en";if(n.alt=i.results?.[l]||"",i.error_message&&(n.errorMessage=i.error_message),i.status==="completed"||i.status==="failed")break}catch(r){console.error("Failed to poll status:",r)}s++}}}}),$s={name:"ImageOptions",data(){return{createStore:ae(),userStore:ee(),selectedLength:"normal",selectedOutputType:"plain",selectedLanguages:["en"],languageInput:"",selectedName:"",selectedBrand:"",selectedProduct:"",selectedAIModel:"gpt5nano",selectedPrimary:"",selectedSecondary:"",customPromptText:"",selectedPrefix:"",selectedSuffix:"",isNameFocused:!1,autoContextEnabled:!0,showEcommerce:!1,showSEO:!1,showNegativeKeywords:!1,showCustomPrompt:!1,showPrefixSuffix:!1,languages:me,seoTags:[],seoInput:"",negativeTags:[],negativeInput:"",showLanguageModal:!1,showLanguageDropdown:!1,showAIModelDropdown:!1,showTextLengthDropdown:!1,languageSearch:"",languageError:"",isLoadingOptions:!1,toastMessage:"",toastTimeout:null,isSavingDefaults:!1,saveDefaultsLabel:"Save as Default Settings",savedDefaultsSnapsh
2ot:null}},computed:{currentImageIndex(){return this.createStore.currentImageIndex},processingIndex(){return this.createStore.processingIndex},validImageCount(){return this.createStore.validImages.length},currentImageDiffersFromDefaults(){const t=this.createStore.globalDefaults,e={"gpt-5-nano":"gpt5nano","gpt-5":"gpt5"};return this.selectedLength!==(t.textLength||"normal")||this.customPromptText!==(t.customPrompt||"")||this.selectedPrefix!==(t.prefix||"")||this.selectedSuffix!==(t.suffix||"")||this.selectedBrand!==(t.ecommerce?.brand||"")||this.selectedProduct!==(t.ecommerce?.product||"")||this.selectedPrimary!==(t.ecommerce?.primary_color||"")||this.selectedSecondary!==(t.ecommerce?.secondary_color||"")||this.selectedAIModel!==(e[t.aiModel]||"gpt5nano")||JSON.stringify([...this.seoTags].sort())!==JSON.stringify([...t.seoKeywords||[]].sort())||JSON.stringify([...this.negativeTags].sort())!==JSON.stringify([...t.negativeKeywords||[]].sort())||JSON.stringify([...this.selectedLanguages].sort())!==JSON.stringify([...t.languages||["en"]].sort())},hasAnyInput(){return this.seoTags.length>0||this.negativeTags.length>0||this.selectedBrand!==""||this.selectedProduct!==""||this.selectedPrimary!==""||this.selectedSecondary!==""||this.customPromptText!==""||this.selectedPrefix!==""||this.selectedSuffix!==""||this.selectedLength!=="normal"||this.selectedOutputType!=="plain"||this.selectedAIModel!=="gpt5nano"},allImagesHaveAlt(){return this.createStore.validImages.length>0&&this.createStore.validImages.every(t=>t.alt)},differsFromSavedDefaults(){const t=this.savedDefaultsSnapshot;if(!t)return this.selectedName!==""||this.seoTags.length>0||this.negativeTags.length>0||this.selectedBrand!==""||this.selectedProduct!==""||this.selectedPrimary!==""||this.selectedSecondary!==""||this.customPromptText!==""||this.selectedPrefix!==""||this.selectedSuffix!==""||this.selectedLanguages.length>1||this.selectedLength!=="normal"||this.selectedOutputType!=="plain"||this.selectedAIModel!=="gpt5nano";const e=!!(t.brand||t.product||t.primaryColor||t.secondaryColor),a=t.seoKeywords.length>0,n=t.negativeKeywords.length>0,s=!!t.customPrompt,r=!!(t.prefix||t.suffix);return this.selectedName!==""||this.selectedAIModel!=="gpt5nano"||this.selectedLength!==t.textLength||this.selectedOutputType!==t.outputType||this.autoContextEnabled!==t.autoContext||this.customPromptText!==t.customPrompt||this.selectedPrefix!==t.prefix||this.selectedSuffix!==t.suffix||this.selectedBrand!==t.brand||this.selectedProduct!==t.product||this.selectedPrimary!==t.primaryColor||this.selectedSecondary!==t.secondaryColor||JSON.stringify([...this.seoTags].sort())!==JSON.stringify([...t.seoKeywords].sort())||JSON.stringify([...this.negativeTags].sort())!==JSON.stringify([...t.negativeKeywords].sort())||JSON.stringify([...this.selectedLanguages].sort())!==JSON.stringify([...t.languages].sort())||this.showEcommerce!==e||this.showSEO!==a||this.showNegativeKeywords!==n||this.showCustomPrompt!==s||this.showPrefixSuffix!==r},showSaveDefaultsBtn(){if(!this.savedDefaultsSnapshot)return!1;const t=this.savedDefaultsSnapshot;return this.selectedLength!==t.textLength||this.customPromptText!==t.customPrompt||this.selectedPrefix!==t.prefix||this.selectedSuffix!==t.suffix||this.selectedBrand!==t.brand||this.selectedProduct!==t.product||this.selectedPrimary!==t.primaryColor||this.selectedSecondary!==t.secondaryColor||JSON.stringify([...this.seoTags].sort())!==JSON.stringify([...t.seoKeywords].sort())||JSON.stringify([...this.negativeTags].sort())!==JSON.stringify([...t.negativeKeywords].sort())||JSON.stringify([...this.selectedLanguages].sort())!==JSON.stringify([...t.languages].sort())},filteredLanguages(){return this.languageSearch?this.languages.filter(t=>t.name.toLowerCase().includes(this.languageSearch.toLowerCase())):this.languages},totalCredits(){return this.createStore.totalCredits}},async mounted(){document.addEventListener("click",this.handleClickOutside);try{const t=await this.userStore.fetchGenerationDefaults();if(t){this.isLoadingOptions=!0;const e=this.createStore.globalDefaults;t.text_length&&(e.textLength=t.text_length),t.languages?.length&&(e.languages=[...t.languages]),t.custom_prompt&&(e.customPrompt=t.custom_prompt),t.seo_keywords?.length&&(e.seoKeywords=[...t.seo_keywords]),t.negative_keywords?.length&&(e.negativeKeywords=[...t.negative_keywords]),t.ecommerce_brand&&(e.ecommerce.brand=t.ecommerce_brand),t.ecommerce_product&&(e.ecommerce.product=t.ecommerce_product),t.ecommerce_primary_color&&(e.ecommerce.primary_color=t.ecommerce_primary_color),t.ecommerce_secondary_color&&(e.ecommerce.secondary_color=t.ecommerce_secondary_color),"auto_context"in t&&(e.autoContext=!!t.auto_context),t.output_type&&(this.selectedOutputType=t.output_type),"prefix"in t&&(e.prefix=t.prefix||""),"suffix"in t&&(e.suffix=t.suffix||""),this.selectedPrefix=e.prefix||"",this.selectedSuffix=e.suffix||"",this.showPrefixSuffix=!!(this.selectedPrefix||this.selectedSuffix),this.createStore.imageData.forEach(a=>{a.options&&(a.options={...e,ecommerce:{...e.ecommerce},seoKeywords:[...e.seoKeywords],negativeKeywords:[...e.negativeKeywords],languages:[...e.languages]})}),this.autoContextEnabled=e.autoContext,this.selectedLength=e.textLength,this.selectedLanguages=[...e.languages],this.customPromptText=e.customPrompt,this.seoTags=[...e.seoKeywords],this.negativeTags=[...e.negativeKeywords],this.selectedBrand=e.ecommerce.brand,this.selectedProduct=e.ecommerce.product,this.selectedPrimary=e.ecommerce.primary_color,this.selectedSecondary=e.ecommerce.secondary_color,this.showSEO=this.seoTags.length>0,this.showNegativeKeywords=this.negativeTags.length>0,this.showEcommerce=!!(e.ecommerce.brand||e.ecommerce.product||e.ecommerce.primary_color||e.ecommerce.secondary_color),this.showCustomPrompt=!!e.customPrompt,this.$nextTick(()=>{this.isLoadingOptions=!1})}}catch{}
2this.savedDefaultsSnapshot={textLength:this.selectedLength,outputType:this.selectedOutputType,autoContext:this.autoContextEnabled,languages:[...this.selectedLanguages],customPrompt:this.customPromptText,seoKeywords:[...this.seoTags],negativeKeywords:[...this.negativeTags],brand:this.selectedBrand,product:this.selectedProduct,primaryColor:this.selectedPrimary,secondaryColor:this.selectedSecondary,prefix:this.selectedPrefix,suffix:this.selectedSuffix},this.syncAllOptionsToStore()},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)},watch:{currentImageIndex:{handler(){this.loadOptionsFromCurrentImage()},immediate:!0},processingIndex(t,e){e!==null&&t===null&&this.loadOptionsFromCurrentImage()},validImageCount(t){t===0&&this.loadOptionsFromCurrentImage()},selectedName(t){this.isLoadingOptions||this.createStore.setImageName(t)},selectedBrand(t){this.isLoadingOptions||this.createStore.setBrand(t)},selectedProduct(t){this.isLoadingOptions||this.createStore.setProduct(t)},selectedPrimary(t){this.isLoadingOptions||this.createStore.setPrimaryColor(t)},selectedSecondary(t){this.isLoadingOptions||this.createStore.setSecondaryColor(t)},seoTags:{handler(t){this.isLoadingOptions||this.createStore.setSeoKeywords([...t])},deep:!0},negativeTags:{handler(t){this.isLoadingOptions||this.createStore.setNegativeKeywords([...t])},deep:!0},autoContextEnabled(t){this.isLoadingOptions||this.createStore.setAutoContext(t)}
2,customPromptText(t){if(t&&t.length>500){this.customPromptText=t.slice(0,500);return}this.isLoadingOptions||this.createStore.setCustomPrompt(t)},selectedPrefix(t){this.isLoadingOptions||this.createStore.setPrefix(t)},selectedSuffix(t){this.isLoadingOptions||this.createStore.setSuffix(t)},selectedOutputType(t){this.isLoadingOptions||this.createStore.setOutputType(t)},showEcommerce(t){t||(this.selectedBrand="",this.selectedProduct="",this.selectedPrimary="",this.selectedSecondary="")},showSEO(t){t||(this.seoTags=[],this.seoInput="")},showNegativeKeywords(t){t||(this.negativeTags=[],this.negativeInput="")},showCustomPrompt(t){t||(this.customPromptText="")},showPrefixSuffix(t){t||(this.selectedPrefix="",this.selectedSuffix="")},selectedAIModel(t){this.isLoadingOptions||this.createStore.setSelectedAIModel(t)},selectedLength(t){this.isLoadingOptions||this.createStore.setTextLength(t)},selectedLanguages:{handler(t){this.isLoadingOptions||this.createStore.setLanguages([...t])},deep:!0}},methods:{loadOptionsFromCurrentImage(){this.toastMessage="",this.toastTimeout&&(clearTimeout(this.toastTimeout),this.toastTimeout=null);const t=this.createStore.currentImage;if(!t){this.isLoadingOptions=!0;const r=this.createStore.globalDefaults;this.selectedName="",this.selectedBrand=r.ecommerce?.brand||"",this.selectedProduct=r.ecommerce?.product||"",this.selectedPrimary=r.ecommerce?.primary_color||"",this.selectedSecondary=r.ecommerce?.secondary_color||"",this.seoTags=[...r.seoKeywords||[]],this.negativeTags=[...r.negativeKeywords||[]],this.autoContextEnabled=r.autoContext??!0,this.customPromptText=r.customPrompt||"",this.selectedPrefix=r.prefix||"",this.selectedSuffix=r.suffix||"",this.selectedLength=r.textLength||"normal",this.selectedLanguages=[...r.languages||["en"]],this.showEcommerce=!!(this.selectedBrand||this.selectedProduct||this.selectedPrimary||this.selectedSecondary),this.showSEO=this.seoTags.length>0,this.showNegativeKeywords=this.negativeTags.length>0,this.showCustomPrompt=!!this.customPromptText,this.showPrefixSuffix=!!(this.selectedPrefix||this.selectedSuffix),this.$nextTick(()=>{this.isLoadingOptions=!1});return}this.isLoadingOptions=!0;const e=t.options,a=this.createStore.globalDefaults,n={imageName:"",ecommerce:{brand:a.ecommerce?.brand||"",product:a.ecommerce?.product||"",primary_color:a.ecommerce?.primary_color||"",secondary_color:a.ecommerce?.secondary_color||""},seoKeywords:[...a.seoKeywords||[]],negativeKeywords:[...a.negativeKeywords||[]],autoContext:a.autoContext??!0,customPrompt:a.customPrompt||"",prefix:a.prefix||"",suffix:a.suffix||"",textLength:a.textLength||"normal",aiModel:a.aiModel||"gpt-5-nano",languages:[...a.languages||["en"]],outputType:a.outputType||"plain"},s={"gpt-5-nano":"gpt5nano","gpt-5":"gpt5"};this.selectedName=e?.imageName||n.imageName,this.selectedBrand=e?.ecommerce?.brand??n.ecommerce.brand,this.selectedProduct=e?.ecommerce?.product??n.ecommerce.product,this.selectedPrimary=e?.ecommerce?.primary_color??n.ecommerce.primary_color,this.selectedSecondary=e?.ecommerce?.secondary_color??n.ecommerce.secondary_color,this.seoTags=[...e?.seoKeywords??n.seoKeywords],this.negativeTags=[...e?.negativeKeywords??n.negativeKeywords],this.autoContextEnabled=e?.autoContext??n.autoContext??!0,this.customPromptText=e?.customPrompt??n.customPrompt,this.selectedPrefix=e?.prefix??n.prefix,this.selectedSuffix=e?.suffix??n.suffix,this.selectedLength=e?.textLength??n.textLength,this.selectedAIModel=s[e?.aiModel]||"gpt5nano",this.selectedLanguages=[...e?.languages??n.languages],this.selectedOutputType=e?.outputType??n.outputType,this.showEcommerce=!!(this.selectedBrand||this.selectedProduct||this.selectedPrimary||this.selectedSecondary),this.showSEO=this.seoTags.length>0,this.showNegativeKeywords=this.negativeTags.length>0,this.showCustomPrompt=!!this.customPromptText,this.showPrefixSuffix=!!(this.selectedPrefix||this.selectedSuffix),this.$nextTick(()=>{this.isLoadingOptions=!1})},showToast(t){this.toastTimeout&&clearTimeout(this.toastTimeout),this.toastMessage=t,this.toastTimeout=setTimeout(()=>{this.toastMessage=""},2500)},ensureImageOptions(t){t.options||(t.options={imageName:"",ecommerce:{brand:"",product:"",primary_color:"",secondary_color:""},seoKeywords:[],negativeKeywords:[],autoContext:!0,customPrompt:"",prefix:"",suffix:"",textLength:"normal",aiModel:"gpt-5-nano",languages:["en"],outputType:"plain"}),t.options.ecommerce||(t.options.ecommerce={brand:"",product:"",primary_color:"",secondary_color:""})},saveForCurrentImage(){this.syncAllOptionsToStore();const t={gpt5nano:"gpt-5-nano",gpt5:"gpt-5"};this.createStore.globalDefaults.textLength=this.selectedLength,this.createStore.globalDefaults.aiModel=t[this.selectedAIModel]||"gpt-5-nano",this.createStore.globalDefaults.languages=[...this.selectedLanguages],this.createStore.globalDefaults.outputType=this.selectedOutputType,this.showToast("Options saved for this image")},applyToAllImagesAction(){const t={gpt5nano:"gpt-5-nano",gpt5:"gpt-5"};x.filter(this.createStore.imageData,a=>a.url!==""||a.file).forEach(a=>{this.ensureImageOptions(a);const n=a;n.options.ecommerce.brand=this.selectedBrand,n.options.ecommerce.product=this.selectedProduct,n.options.ecommerce.primary_color=this.selectedPrimary,n.options.ecommerce.secondary_color=this.selectedSecondary,n.options.seoKeywords=[...this.seoTags],n.options.negativeKeywords=[...this.negativeTags],n.options.customPrompt=this.customPromptText,n.options.prefix=this.selectedPrefix,n.options.suffix=this.selectedSuffix,n.options.textLength=this.selectedLength,n.options.aiModel=t[this.selectedAIModel]||"gpt-5-nano",n.options.languages=[...this.selectedLanguages],n.options.outputType=this.selectedOutputType}),this.createStore.globalDefaults.ecommerce.brand=this.selectedBrand,this.createStore.globalDefaults.ecommerce.product=this.selectedProduct,this.createStore.globalDefaults.ecommerce.primary_color=this.selectedPrimary,this.createStore.globalDefaults.ecommerce.secondary_color=this.selectedSecondary,this.createStore.globalDefaults.seoKeywords=[...this.seoTags],this.createStore.globalDefaults.negativeKeywords=[...this.negativeTags],this.createStore.globalDefaults.customPrompt=this.customPromptText,this.createStore.globalDefaults.prefix=this.selectedPrefix,this.createStore.globalDefaults.suffix=this.selectedSuffix,this.createStore.globalDefaults.textLength=this.selectedLength,this.createStore.globalDefaults.aiModel=t[this.selectedAIModel]||"gpt-5-nano",this.createStore.globalDefaults.languages=[...this.selectedLanguages],this.createStore.globalDefaults.outputType=this.selectedOutputType,this.showToast("Options saved for all images")},async saveAsDefaults(){this.isSavingDefaults=!0;try{await this.userStore.saveGenerationDefaults({auto_context:this.autoContextEnabled,text_length:this.selectedLength,output_type:this.selectedOutputType,languages:[...this.selectedLanguages],custom_prompt:this.customPromptText,seo_keywords:[...this.seoTags],negative_keywords:[...this.negativeTags],ecommerce_brand:this.selectedBrand,ecommerce_product:this.selectedProduct,ecommerce_primary_color:this.selectedPrimary,ecommerce_secondary_color:this.selectedSecondary,prefix:this.selectedPrefix,suffix:this.selectedSuffix}
2),this.savedDefaultsSnapshot={textLength:this.selectedLength,outputType:this.selectedOutputType,autoContext:this.autoContextEnabled,languages:[...this.selectedLanguages],customPrompt:this.customPromptText,seoKeywords:[...this.seoTags],negativeKeywords:[...this.negativeTags],brand:this.selectedBrand,product:this.selectedProduct,primaryColor:this.selectedPrimary,secondaryColor:this.selectedSecondary,prefix:this.selectedPrefix,suffix:this.selectedSuffix},this.saveDefaultsLabel="Defaults Saved!",setTimeout(()=>{this.saveDefaultsLabel="Save as Default Settings"},2e3)}catch{this.showToast("Failed to save defaults")}this.isSavingDefaults=!1},syncAllOptionsToStore(){this.createStore.setImageName(this.selectedName),this.createStore.setBrand(this.selectedBrand),this.createStore.setProduct(this.selectedProduct),this.createStore.setPrimaryColor(this.selectedPrimary),this.createStore.setSecondaryColor(this.selectedSecondary),this.createStore.setSeoKeywords([...this.seoTags]),this.createStore.setNegativeKeywords([...this.negativeTags]),this.createStore.setAutoContext(this.autoContextEnabled),this.createStore.setCustomPrompt(this.customPromptText),this.createStore.setPrefix(this.selectedPrefix),this.createStore.setSuffix(this.selectedSuffix),this.createStore.setTextLength(this.selectedLength),this.createStore.setSelectedAIModel(this.selectedAIModel),this.createStore.setLanguages(this.selectedLanguages),this.createStore.setOutputType(this.selectedOutputType)},addSeoTag(){const t=x.trim(this.seoInput);if(!t){this.seoInput="";return}if(this.seoTags.includes(t)){this.seoInput="";return}if(this.negativeTags.includes(t)){W().showToast(`"${t}" is already in Negative Keywords. Remove it from there first.`,"info"),this.seoInput="";return}if(this.seoTags.length>=10){W().showToast("Maximum 10 SEO keywords reached.","info"),this.seoInput="";return}this.seoTags.push(t),this.seoInput=""},clearName(){this.selectedName="",this.$nextTick(()=>{const t=document.getElementById("name");t&&t.focus()})},removeSeoTag(t){this.seoTags.splice(t,1)},addNegativeTag(){const t=x.trim(this.negativeInput);if(!t){this.negativeInput="";return}if(this.negativeTags.includes(t)){this.negativeInput="";return}if(this.seoTags.includes(t)){W().showToast(`"${t}" is already in SEO Keywords. Remove it from there first.`,"info"),this.negativeInput="";return}if([this.selectedBrand,this.selectedProduct,this.selectedPrimary,this.selectedSecondary].filter(Boolean).includes(t)){W().showToast(`"${t}" is already used as a Brand/Product/Color value. Remove it from there first.`,"info"),this.negativeInput="";return}if(this.negativeTags.length>=10){W().showToast("Maximum 10 negative keywords reached.","info"),this.negativeInput="";return}this.negativeTags.push(t),this.negativeInput=""},removeNegativeTag(t){this.negativeTags.splice(t,1)},removeLanguage(t){this.selectedLanguages[t]!=="en"&&(this.selectedLanguages.splice(t,1),this.createStore.setSelectedLanguages(this.selectedLanguages))},getLanguageName(t){const e=this.languages.find(a=>a.code===t);return e?e.name:t},handleLanguageCheckboxChange(){},toggleLanguageSelection(t){if(t==="en"&&this.selectedLanguages.includes("en"))return;const e=this.selectedLanguages.indexOf(t);e>-1?this.selectedLanguages.splice(e,1):this.selectedLanguages.push(t),this.createStore.setSelectedLanguages(this.selectedLanguages)},toggleLanguageDropdown(){this.showAIModelDropdown=!1,this.showTextLengthDropdown=!1,this.showLanguageDropdown=!this.showLanguageDropdown},handleClickOutside(t){const e=t.target;e.closest("#language-section")||(this.showLanguageDropdown=!1),e.closest("#text-length-section")||(this.showTextLengthDropdown=!1),e.closest("#ai-model-section")||(this.showAIModelDropdown=!1)},toggleAIModelDropdown(){this.showLanguageDropdown=!1,this.showTextLengthDropdown=!1,this.showAIModelDropdown=!this.showAIModelDropdown},selectAIModel(t){this.selectedAIModel=t,this.showAIModelDropdown=!1,this.createStore.setSelectedAIModel(t)},toggleTextLengthDropdown(){this.showLanguageDropdown=!1,this.showAIModelDropdown=!1,this.showTextLengthDropdown=!this.showTextLengthDropdown},selectTextLength(t){this.selectedLength=t,this.showTextLengthDropdown=!1,this.createStore.setSelectedLength(t)},addLanguageFromInput(){const t=this.languageInput.trim();if(!t)return;this.languageError="";const e=this.languages.find(s=>s.name.toLowerCase()===t.toLowerCase()),a=this.languages.find(s=>s.code.toLowerCase()===t.toLowerCase()),n=e||a;if(n)this.selectedLanguages.includes(n.code)?this.languageError=`Language "${n.name}" is already selected`:(this.selectedLanguages.push(n.code),this.createStore.setSelectedLanguages(this.selectedLanguages),this.languageInput="",this.languageError="");else{const s=t.length>25?t.substring(0,25)+"...":t;this.languageError=`Language "${s}" isn't supported`}},filterLanguagesFromInput(){this.languageError=""},handleLanguageInputEnter(t){t.preventDefault(),t.stopPropagation(),this.languageInput.trim()?this.addLanguageFromInput():this.showLanguageDropdown=!0},async generateAltText(){this.syncAllOptionsToStore(),await this.createStore.generateAllAltText(),console.log("Generated images:",this.createStore.imageData)},async clearAll(){this.isLoadingOptions=!0;let t=null;try{t=await this.userStore.fetchGenerationDefaults()}catch{}this.selectedName="",this.seoTags=[...t?.seo_keywords||[]],this.seoInput="",this.negativeTags=[...t?.
2negative_keywords||[]],this.negativeInput="",this.selectedBrand=t?.ecommerce_brand||"",this.selectedProduct=t?.ecommerce_product||"",this.selectedPrimary=t?.ecommerce_primary_color||"",this.selectedSecondary=t?.ecommerce_secondary_color||"",this.autoContextEnabled=t?.auto_context??!0,this.customPromptText=t?.custom_prompt||"",this.selectedPrefix=t?.prefix||"",this.selectedSuffix=t?.suffix||"",this.selectedLanguages=[...t?.languages||["en"]],this.selectedLength=t?.text_length||"normal",this.selectedOutputType=t?.output_type||"plain",this.selectedAIModel="gpt5nano",this.showEcommerce=!!(this.selectedBrand||this.selectedProduct||this.selectedPrimary||this.selectedSecondary),this.showSEO=this.seoTags.length>0,this.showNegativeKeywords=this.negativeTags.length>0,this.showCustomPrompt=!!this.customPromptText,this.showPrefixSuffix=!!(this.selectedPrefix||this.selectedSuffix),this.$nextTick(()=>{this.isLoadingOptions=!1,this.savedDefaultsSnapshot={textLength:this.selectedLength,outputType:this.selectedOutputType,autoContext:this.autoContextEnabled,languages:[...this.selectedLanguages],customPrompt:this.customPromptText,seoKeywords:[...this.seoTags],negativeKeywords:[...this.negativeTags],brand:this.selectedBrand,product:this.selectedProduct,primaryColor:this.selectedPrimary,secondaryColor:this.selectedSecondary,prefix:this.selectedPrefix,suffix:this.selectedSuffix},this.syncAllOptionsToStore(),this.showToast(t?"Reset to your default settings":"Reset to factory defaults")})}}},er={class:"w-full text-sm"},tr={class:"flex justify-between"},sr={class:"flex items-center gap-2"},rr=["disabled"],or={key:0,class:"mb-3 rounded-lg bg-green-100 px-4 py-2 text-center text-sm font-medium text-green-800"},nr={class:"mb-4"},ar={class:"relative"},lr={class:"mb-4"},ir={class:"flex items-center justify-between"},dr=["aria-checked"],ur={class:"mb-4"},cr={class:"flex"},pr={class:"flex h-5 items-center"},gr={key:0,class:"mt-2 ml-6 flex flex-col gap-4 sm:flex-row"},mr={class:"flex flex-1 flex-col"},hr={class:"flex flex-1 flex-col"},fr={class:"mb-4"},xr={class:"flex"},br={class:"flex h-5 items-center"},vr={key:0,class:"mt-2 ml-6"},yr={class:"border-border bg-surface-2 flex flex-wrap gap-2 rounded-lg border p-2"},wr=["onClick","onKeydown"],Ir=["disabled","placeholder"],kr={class:"mb-4"},Sr={class:"flex"},Lr={class:"flex h-5 items-center"},Cr={key:0,class:"mt-2 ml-6"},Tr={class:"border-border bg-surface-2 flex flex-wrap gap-2 rounded-lg border p-2"},Ar=["onClick","onKeydown"],_r=["disabled","placeholder"],Er={class:"mb-4"},Dr={class:"flex"},Pr={class:"flex h-5 items-center"},Or={key:0,class:"mt-2 ml-6"},Ur={class:"flex"},Mr={class:"flex h-5 items-center"},Vr={key:0,class:"mt-2 ml-6 grid grid-cols-1 gap-3 sm:grid-cols-2"},Br={class:"mb-4 flex gap-4"},Fr={class:"w-1/2"},Rr={id:"text-length-section",class:"relative"},Nr={class:"flex items-center gap-2"},Hr={key:0},jr={key:1},Kr={key:0,class:"border-border bg-surface absolute z-50 mt-1 w-full rounded-lg border shadow-lg"},Gr={class:"p-1"},Zr=["aria-selected"],zr={key:0,class:"text-accent"},Wr=["aria-selected"],Jr={key:0,class:"text-blue-600"},qr={id:"language-section"},Yr={class:"border-border bg-surface-2 focus-within:border-accent focus-within:ring-accent relative rounded-lg border focus-within:ring-2"},Qr={class:"flex max-h-20 flex-wrap gap-2 overflow-y-auto p-2"},Xr=["title"],$r=["onClick","onKeydown"],eo=["placeholder"],to={key:0,class:"px-2 pb-2 text-xs text-red-600"},so={class:"border-border border-t"},ro={key:0,class:"border-border bg-surface absolute z-50 mt-1 w-full rounded-lg border shadow-lg",style:{"max-height":"300px"}},oo={class:"border-border border-b p-3"},no={class:"relative"},ao={class:"text-muted h-48 overflow-y-auto px-3 pb-3 text-sm","aria-labelledby":"languageDropdownButton"},lo=["title","onClick","onKeydown","tabindex","aria-selected","aria-disabled"],io=["id","checked","disabled","onClick"],uo={key:0,class:"border-border my-4"},co={key:1,class:"border-border bg-surface-2 rounded-lg border p-3"},po={class:"mb-2 flex items-center justify-between"},go={class:"text-muted text-xs"},mo={key:0},ho=["disabled"];function fo(t,e,a,n,s,r){const i=ge;return d(),u("div",er,[o("form",{id:"options-section",class:"bg-surface mt-2 min-h-1/2 w-full rounded-lg px-4 pt-2 pb-8 shadow-md",onSubmit:e[58]||(e[58]=f(()=>{},["prevent"])),onKeydown:e[59]||(e[59]=y(f(()=>{},["prevent"]),["enter"]))},[o("div",tr,[e[60]||(e[60]=o("label",{for:"options-section",class:"block pb-1 text-2xl font-bold"}," Options ",-1)),o("div",sr,[r.differsFromSavedDefaults?(d(),u("button",{key:0,t
2ype:"button",disabled:s.createStore.isProcessing,class:"cursor-pointer rounded-lg border border-red-500 px-4 py-1 text-red-600 transition hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-50",onClick:e[0]||(e[0]=(...l)=>r.clearAll&&r.clearAll(...l)),onKeydown:e[1]||(e[1]=y(f((...l)=>r.clearAll&&r.clearAll(...l),["prevent"]),["enter"]))}," Reset to Default ",40,rr)):g("",!0)])]),O(he,{name:"fade"},{default:X(()=>[s.toastMessage?(d(),u("div",or,m(s.toastMessage),1)):g("",!0)]),_:1}),o("div",nr,[e[61]||(e[61]=o("div",{class:"mb-1 flex items-center gap-1.5"},[o("label",{for:"name",class:"text-foreground font-semibold"}," Image Name "),o("div",{class:"group/nametip relative flex items-center"},[o("span",{tabindex:"0",role:"img","aria-label":"Image name info",class:"inline-flex cursor-help rounded-full focus:outline-2 focus:outline-offset-1 focus:outline-accent"},[o("svg",{xmlns:"http://www.w3.org/2000/svg",class:"text-muted h-3.5 w-3.5",fill:"currentColor",viewBox:"0 0 16 16"},[o("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),o("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})])]),o("div",{class:"bg-foreground text-canvas pointer-events-none absolute bottom-full left-1/2 z-20 mb-2 hidden w-64 -translate-x-1/2 rounded-md px-3 py-2 text-xs shadow-lg group-hover/nametip:block group-focus-within/nametip:block"},[I(" If left blank, the name defaults to the first 4 words of the generated alt text (e.g. "),o("span",{class:"font-mono font-semibold"},"A-dog-sits-tall"),I("). "),o("div",{class:"border-foreground absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-current"})])])],-1)),o("div",ar,[C(o("input",{id:"name","onUpdate:modelValue":e[2]||(e[2]=l=>s.selectedName=l),type:"text",maxlength:"256",placeholder:"example-1",onFocus:e[3]||(e[3]=l=>s.isNameFocused=!0),onBlur:e[4]||(e[4]=l=>s.isNameFocused=!1),class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2.5 pr-8 text-sm"},null,544),[[E,s.selectedName,void 0,{trim:!0}]]),s.selectedName&&s.isNameFocused?(d(),u("button",{key:0,type:"button",class:"absolute inset-y-0 right-0 flex cursor-pointer items-center px-3 hover:opacity-70",onMousedown:e[5]||(e[5]=f(()=>{},["prevent"])),onClick:e[6]||(e[6]=f((...l)=>r.clearName&&r.clearName(...l),["prevent"]))},[O(i,{class:"text-muted dark:text-foreground h-4 w-4"})],32)):g("",!0)])]),e[100]||(e[100]=o("hr",{class:"border-border mb-4"},null,-1)),o("fieldset",null,[o("div",lr,[o("div",ir,[e[62]||(e[62]=o("div",{class:"flex items-center gap-1.5"},[o("label",{for:"autoContext",class:"text-foreground text-sm font-semibold"}," Auto-detect Context "),o("div",{class:"group/autotip relative flex items-center"},[o("span",{tabindex:"0",role:"img","aria-label":"Auto-detect context info",class:"inline-flex cursor-help rounded-full focus:outline-2 focus:outline-offset-1 focus:outline-accent"},[o("svg",{xmlns:"http://www.w3.org/2000/svg",class:"text-muted h-3.5 w-3.5",fill:"currentColor",viewBox:"0 0 16 16"},[o("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),o("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})])]),o("div",{class:"bg-foreground text-canvas pointer-events-none absolute bottom-full left-1/2 z-20 mb-2 hidden w-72 -translate-x-1/2 rounded-md px-3 py-2 text-xs shadow-lg group-hover/autotip:block group-focus-within/autotip:block"},[o("p",{class:"mb-1.5 font-semibold"},"Gathers metadata from filenames, page content & URLs:"),o("ul",{class:"list-disc space-y-0.5 pl-3.5"},[o("li",null,"Image filename & URL path"),o("li",null,"Page title & nearby headings"),o("li",null,"Captions & existing alt text"),o("li",null,"Open Graph & meta tags"),o("li",null,"Schema.org product data")]),o("p",{class:"mt-1.5 text-[10px] opacity-75"},"Available metadata varies by input method."),o("div",{class:"border-foreground absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-current"})])])],-1)),o("button",{id:"autoContext",type:"button",role:"switch","aria-label":"Auto-detect Context","aria-checked":s.autoContextEnabled,class:w(["relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:ring-2 focus:ring-accent focus:ring-offset-2 focus:outline-none",s.autoContextEnabled?"bg-accent":"bg-border"]),onClick:e[7]||(e[7]=l=>s.autoContextEnabled=!s.autoContextEnabled),onKeydown:[e[8]||(e[8]=y(f(l=>s.autoContextEnabled=!s.autoContextEnabled,["prevent"]),["enter"])),e[9]||(e[9]=y(f(l=>s.autoContextEnabled=!s.autoContextEnabled,["prevent"]),["space"]))]},[o("span",{class:w(["pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out",s.autoContextEnabled?"translate-x-4":"translate-x-0"])},null,2)],42,dr)]),e[63]||(e[63]=o("p",{class:"text-muted-2 mt-0.5 text-xs"}," Improve accuracy using surrounding image context ",-1))]),o("div",ur,[o("div",cr,[o("div",pr,[C(o("input",{id:"ecommerce","onUpdate:modelValue":e[10]||(e[10]=l=>s.showEcommerce=l),type:"checkbox",class:"text-accent border-foreground
2/30 bg-surface-2 focus:ring-accent h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[11]||(e[11]=y(f(l=>s.showEcommerce=!s.showEcommerce,["prevent"]),["enter"]))},null,544),[[Q,s.showEcommerce]])]),e[64]||(e[64]=o("div",{class:"ml-2 text-sm"},[o("label",{for:"ecommerce",class:"text-foreground font-semibold"}," Ecommerce "),o("p",{class:"text-muted-2 text-xs"}," Add brand, product, & color details ")],-1))]),s.showEcommerce?(d(),u("div",gr,[o("div",mr,[e[65]||(e[65]=o("label",{for:"brand",class:"text-foreground mb-1 font-medium"}," Brand ",-1)),C(o("input",{id:"brand","onUpdate:modelValue":e[12]||(e[12]=l=>s.selectedBrand=l),placeholder:"Apple",maxlength:"45",class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2.5 text-sm"},null,512),[[E,s.selectedBrand,void 0,{trim:!0}]]),e[66]||(e[66]=o("label",{for:"primary",class:"text-foreground mt-2 mb-1 font-medium"}," Primary Color ",-1)),C(o("input",{id:"primary","onUpdate:modelValue":e[13]||(e[13]=l=>s.selectedPrimary=l),placeholder:"Space Gray",maxlength:"45",class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2.5 text-sm"},null,512),[[E,s.selectedPrimary,void 0,{trim:!0}]])]),o("div",hr,[e[67]||(e[67]=o("label",{for:"product",class:"text-foreground mb-1 font-medium"}," Product ",-1)),C(o("input",{id:"product","onUpdate:modelValue":e[14]||(e[14]=l=>s.selectedProduct=l),placeholder:"iPhone",maxlength:"45",class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2.5 text-sm"},null,512),[[E,s.selectedProduct,void 0,{trim:!0}]]),e[68]||(e[68]=o("label",{for:"secondary",class:"text-foreground mt-2 mb-1 font-medium"}," Secondary Color ",-1)),C(o("input",{id:"secondary","onUpdate:modelValue":e[15]||(e[15]=l=>s.selectedSecondary=l),placeholder:"Onyx",maxlength:"45",class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2.5 text-sm"},null,512),[[E,s.selectedSecondary,void 0,{trim:!0}]])])])):g("",!0)]),o("div",fr,[o("div",xr,[o("div",br,[C(o("input",{id:"seo","onUpdate:modelValue":e[16]||(e[16]=l=>s.showSEO=l),type:"checkbox",class:"text-accent border-foreground
2/30 bg-surface-2 focus:ring-accent h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[17]||(e[17]=y(f(l=>s.showSEO=!s.showSEO,["prevent"]),["enter"]))},null,544),[[Q,s.showSEO]])]),e[69]||(e[69]=o("div",{class:"ml-2 text-sm"},[o("label",{for:"seo",class:"text-foreground font-semibold"}," SEO Keywords "),o("p",{class:"text-muted-2 text-xs"}," Optimize searchability ")],-1))]),s.showSEO?(d(),u("div",vr,[e[70]||(e[70]=o("label",{for:"seoKeywords",class:"text-foreground mb-1 block font-medium"},[I(" Keywords "),o("span",{class:"text-muted-2 text-xs font-normal"}," (Max. 10) ")],-1)),o("div",yr,[(d(!0),u(U,null,Z(s.seoTags,(l,p)=>(d(),u("span",{key:p,class:"rounded-sm bg-green-100 py-0.5 pl-2.5 text-sm font-medium text-green-800"},[I(m(l)+" ",1),o("button",{type:"button",class:"cursor-pointer rounded-sm pr-2.5 pl-1 text-green-800 focus-visible:outline focus-visible:outline-2 focus-visible:outline-green-600",onClick:b=>r.removeSeoTag(p),onKeydown:y(f(b=>r.removeSeoTag(p),["prevent"]),["enter"])}," Ã ",40,wr)]))),128)),C(o("input",{id:"seoKeywords","onUpdate:modelValue":e[18]||(e[18]=l=>s.seoInput=l),maxlength:"45",disabled:s.seoTags.length>=10,placeholder:s.seoTags.length===0?"Type a keyword and hit enter or space":s.seoTags.length>=10?"Maximum 10 keywords reached":"",class:"min-w-[40px] flex-1 bg-transparent focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",onKeydown:[e[19]||(e[19]=y(f((...l)=>r.addSeoTag&&r.addSeoTag(...l),["prevent"]),["enter"])),e[20]||(e[20]=y(f((...l)=>r.addSeoTag&&r.addSeoTag(...l),["prevent"]),["space"]))]},null,40,Ir),[[E,s.seoInput,void 0,{trim:!0}]])])])):g("",!0)]),o("div",kr,[o("div",Sr,[o("div",Lr,[C(o("input",{id:"negativeKeywords","onUpdate:modelValue":e[21]||(e[21]=l=>s.showNegativeKeywords=l),type:"checkbox",class:"text-accent border-foreground
2/30 bg-surface-2 focus:ring-accent h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[22]||(e[22]=y(f(l=>s.showNegativeKeywords=!s.showNegativeKeywords,["prevent"]),["enter"]))},null,544),[[Q,s.showNegativeKeywords]])]),e[71]||(e[71]=o("div",{class:"ml-2 text-sm"},[o("label",{for:"negativeKeywords",class:"text-foreground font-semibold"}," Negative Keywords "),o("p",{class:"text-muted-2 text-xs"}," Avoid unwanted associations ")],-1))]),s.showNegativeKeywords?(d(),u("div",Cr,[e[72]||(e[72]=o("label",{for:"negativeInput",class:"text-foreground mb-1 block font-medium"},[I(" Keywords "),o("span",{class:"text-muted-2 text-xs font-normal"}," (Max. 10) ")],-1)),o("div",Tr,[(d(!0),u(U,null,Z(s.negativeTags,(l,p)=>(d(),u("span",{key:p,class:"rounded-sm bg-red-100 py-0.5 pl-2.5 text-sm font-medium text-red-800"},[I(m(l)+" ",1),o("button",{type:"button",class:"cursor-pointer rounded-sm pr-2.5 pl-1 text-red-800 focus-visible:outline focus-visible:outline-2 focus-visible:outline-red-600",onClick:b=>r.removeNegativeTag(p),onKeydown:y(f(b=>r.removeNegativeTag(p),["prevent"]),["enter"])}," Ã ",40,Ar)]))),128)),C(o("input",{id:"negativeInput","onUpdate:modelValue":e[23]||(e[23]=l=>s.negativeInput=l),maxlength:"45",disabled:s.negativeTags.length>=10,placeholder:s.negativeTags.length===0?"Type a keyword and hit enter or space":s.negativeTags.length>=10?"Maximum 10 keywords reached":"",class:"min-w-[40px] flex-1 bg-transparent focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",onKeydown:[e[24]||(e[24]=y(f((...l)=>r.addNegativeTag&&r.addNegativeTag(...l),["prevent"]),["enter"])),e[25]||(e[25]=y(f((...l)=>r.addNegativeTag&&r.addNegativeTag(...l),["prevent"]),["space"]))]},null,40,_r),[[E,s.negativeInput,void 0,{trim:!0}]])])])):g("",!0)]),o("div",Er,[o("div",Dr,[o("div",Pr,[C(o("input",{id:"customPrompt","onUpdate:modelValue":e[26]||(e[26]=l=>s.showCustomPrompt=l),type:"checkbox",class:"text-accent border-foreground
2/30 bg-surface-2 focus:ring-accent h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[27]||(e[27]=y(f(l=>s.showCustomPrompt=!s.showCustomPrompt,["prevent"]),["enter"]))},null,544),[[Q,s.showCustomPrompt]])]),e[73]||(e[73]=o("div",{class:"ml-2 text-sm"},[o("label",{for:"customPrompt",class:"text-foreground font-semibold"}," Custom Prompt "),o("p",{class:"text-muted-2 text-xs"}," Add context about your image or customize the tone ")],-1))]),s.showCustomPrompt?(d(),u("div",Or,[e[74]||(e[74]=o("label",{for:"customText",class:"text-foreground mb-1 block font-medium"},[I(" Custom "),o("span",{class:"text-muted-2 text-xs font-normal"}," (Max. 500 Characters) ")],-1)),C(o("textarea",{id:"customText","onUpdate:modelValue":e[28]||(e[28]=l=>s.customPromptText=l),maxlength:"500",class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block max-h-[20rem] w-full rounded-lg border p-2.5 text-sm",placeholder:"e.g. This is Jane Smith, our CEO, speaking at a product launch"},null,512),[[E,s.customPromptText,void 0,{trim:!0}]]),s.customPromptText.length>0?(d(),u("div",{key:0,class:w(["mt-1 text-right text-xs",s.customPromptText.length>=500?"text-red-600 dark:text-red-400 font-medium":"text-muted-2"])},m(s.customPromptText.length)+"/500 ",3)):g("",!0)])):g("",!0)]),o("div",null,[o("div",Ur,[o("div",Mr,[C(o("input",{id:"prefixSuffix","onUpdate:modelValue":e[29]||(e[29]=l=>s.showPrefixSuffix=l),type:"checkbox",class:"text-accent border-foreground
2/30 bg-surface-2 focus:ring-accent h-4 w-4 cursor-pointer rounded border focus:ring-2",onKeydown:e[30]||(e[30]=y(f(l=>s.showPrefixSuffix=!s.showPrefixSuffix,["prevent"]),["enter"]))},null,544),[[Q,s.showPrefixSuffix]])]),e[75]||(e[75]=o("div",{class:"ml-2 text-sm"},[o("label",{for:"prefixSuffix",class:"text-foreground font-semibold"}," Prefix & Suffix "),o("p",{class:"text-muted-2 text-xs"},' Wrap alt text (e.g. "Photo of " â MyBrand) ')],-1))]),s.showPrefixSuffix?(d(),u("div",Vr,[o("div",null,[e[76]||(e[76]=o("label",{for:"optPrefix",class:"text-muted mb-1 block text-xs font-medium"}," Prefix ",-1)),C(o("input",{id:"optPrefix","onUpdate:modelValue":e[31]||(e[31]=l=>s.selectedPrefix=l),maxlength:"45",placeholder:'e.g. "Photo of "',class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2.5 text-sm"},null,512),[[E,s.selectedPrefix]])]),o("div",null,[e[77]||(e[77]=o("label",{for:"optSuffix",class:"text-muted mb-1 block text-xs font-medium"}," Suffix ",-1)),C(o("input",{id:"optSuffix","onUpdate:modelValue":e[32]||(e[32]=l=>s.selectedSuffix=l),maxlength:"45",placeholder:'e.g. " â MyBrand"',class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2.5 text-sm"},null,512),[[E,s.selectedSuffix]])])])):g("",!0)])]),e[101]||(e[101]=o("hr",{class:"border-border my-4"},null,-1)),o("fieldset",null,[o("div",Br,[o("div",Fr,[e[83]||(e[83]=o("div",{class:"mb-1 flex items-center gap-2"},[o("label",{for:"length",class:"text-foreground block font-semibold"}," Text Length "),o("div",{class:"group relative"},[o("span",{tabindex:"0",role:"img","aria-label":"Text length info",class:"inline-flex cursor-help rounded-full focus:outline-2 focus:outline-offset-1 focus:outline-accent"},[o("svg",{class:"text-muted-2 h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})])]),o("div",{class:"bg-foreground text-canvas pointer-events-none absolute bottom-full left-1/2 z-50 mb-2 -translate-x-1/2 transform rounded-lg px-3 py-2 text-xs whitespace-nowrap opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-within:opacity-100"},[I(" Normal â 1 sentence (1 credit) "),o("br"),I(" Detailed â 1 paragraph (2 credits) ")])])],-1)),o("div",Rr,[o("button",{onClick:e[33]||(e[33]=(...l)=>r.toggleTextLengthDropdown&&r.toggleTextLengthDropdown(...l)),onKeydown:e[34]||(e[34]=y(f((...l)=>r.toggleTextLengthDropdown&&r.toggleTextLengthDropdown(...l),["prevent"]),["enter"])),class:"border-border bg-surface-2 text-foreground focus:border-accent focus:ring-accent flex w-full cursor-pointer items-center justify-between rounded-lg border p-2.5 text-sm transition-all duration-200 focus:ring-2 focus:outline-none"},[o("span",Nr,[s.selectedLength==="normal"?(d(),u("span",Hr," Normal ")):s.selectedLength==="detailed"?(d(),u("span",jr," Detailed ")):g("",!0)]),(d(),u("svg",{class:w(["h-4 w-4 transition-transform duration-200",{"rotate-180":s.showTextLengthDropdown}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e[78]||(e[78]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)]),2))],32),s.showTextLengthDropdown?(d(),u("div",Kr,[o("div",Gr,[o("div",{onClick:e[35]||(e[35]=l=>r.selectTextLength("normal")),onKeydown:[e[36]||(e[36]=y(l=>r.selectTextLength("normal"),["enter"])),e[37]||(e[37]=y(f(l=>r.selectTextLength("normal"),["prevent"]),["space"]))],class:"hover:bg-surface-2 focus:bg-surface-2 flex cursor-pointer items-center justify-between rounded-md p-2 focus:outline-none",tabindex:"0",role:"option","aria-selected":s.selectedLength==="normal"},[e[80]||(e[80]=o("span",{class:"text-sm"},"Normal",-1)),s.selectedLength==="normal"?(d(),u("span",zr,e[79]||(e[79]=[o("svg",{class:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20"},[o("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})],-1)]))):g("",!0)],40,Zr),o("div",{onClick:e[38]||(e[38]=l=>r.selectTextLength("detailed")),onKeydown:[e[39]||(e[39]=y(l=>r.selectTextLength("detailed"),["enter"])),e[40]||(e[40]=y(f(l=>r.selectTextLength("detailed"),["prevent"]),["space"]))],class:"hover:bg-surface-2 focus:bg-surface-2 flex cursor-pointer items-center justify-between rounded-md p-2 focus:outline-none",tabindex:"0",role:"option","aria-selected":s.selectedLength==="detailed"},[e[82]||(e[82]=o("span",{class:"flex items-baseline gap-1"},[o("span",{class:"text-sm"}," Detailed "),o("span",{class:"text-[10px] text-blue-600"}," (2 credits) ")],-1)),s.selectedLength==="detailed"?(d(),u("span",Jr,e[81]||(e[81]=[o("svg",{class:"h-4 w-4",fill:"
2currentColor",viewBox:"0 0 20 20"},[o("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})],-1)]))):g("",!0)],40,Wr)])])):g("",!0)])]),g("",!0)]),o("div",qr,[e[96]||(e[96]=o("div",{class:"mb-1 flex items-center gap-2"},[o("label",{for:"languages",class:"text-foreground block font-semibold"}," Languages "),o("div",{class:"group relative"},[o("span",{tabindex:"0",role:"img","aria-label":"Credit calculation info",class:"inline-flex cursor-help rounded-full focus:outline-2 focus:outline-offset-1 focus:outline-accent"},[o("svg",{class:"text-muted-2 h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})])]),o("div",{class:"bg-foreground text-canvas pointer-events-none absolute bottom-full left-1/2 z-50 mb-2 -translate-x-1/2 transform rounded-lg px-3 py-2 text-xs whitespace-nowrap opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-within:opacity-100"}," Total Credits = Text Length Credits à Number of Languages Selected ")])],-1)),o("div",Yr,[o("div",Qr,[(d(!0),u(U,null,Z(s.selectedLanguages,(l,p)=>(d(),u("span",{key:p,title:l==="en"?"English is required â alt text is generated in English first, then translated to other languages":null,class:w(["text-accent bg-accent/10 inline-flex items-center rounded-sm py-0.5 pl-2.5 text-sm font-medium",l==="en"?"pr-2.5":""])},[I(m(r.getLanguageName(l))+" ",1),l!=="en"?(d(),u("button",{key:0,type:"button",class:"text-accent cursor-pointer rounded-sm pr-2.5 pl-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",onClick:b=>r.removeLanguage(p),onKeydown:y(f(b=>r.removeLanguage(p),["prevent"]),["enter"])}," à ",40,$r)):g("",!0)],10,Xr))),128)),C(o("input",{id:"languageInput","onUpdate:modelValue":e[49]||(e[49]=l=>s.languageInput=l),maxlength:"45","aria-label":"Add a language",placeholder:s.selectedLanguages.length===0?"Enter or select a language":"",class:"min-w-[40px] flex-1 rounded bg-transparent focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",onKeydown:[e[50]||(e[50]=y((...l)=>r.handleLanguageInputEnter&&r.handleLanguageInputEnter(...l),["enter"])),e[51]||(e[51]=y(f((...l)=>r.addLanguageFromInput&&r.addLanguageFromInput(...l),["prevent"]),["space"]))],onInput:e[52]||(e[52]=(...l)=>r.filterLanguagesFromInput&&r.filterLanguagesFromInput(...l))},null,40,eo),[[E,s.languageInput,void 0,{trim:!0}]])]),s.languageError?(d(),u("div",to,m(s.languageError),1)):g("",!0),o("div",so,[o("button",{id:"languageDropdownButton",onClick:e[53]||(e[53]=(...l)=>r.toggleLanguageDropdown&&r.toggleLanguageDropdown(...l)),onKeydown:e[54]||(e[54]=y(f((...l)=>r.toggleLanguageDropdown&&r.toggleLanguageDropdown(...l),["prevent"]),["enter"])),class:"text-foreground hover:bg-surface-2 focus:ring-accent inline-flex w-full cursor-pointer items-center justify-between rounded-lg px-3 py-2 text-sm font-medium focus:ring-2 focus:outline-none",type:"button"},[e[93]||(e[93]=o("span",null,"Browse all languages...",-1)),(d(),u("svg",{class:w(["ms-2.5 h-2.5 w-2.5 transition-transform duration-200",{"rotate-180":s.showLanguageDropdown}]),"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 10 6"},e[92]||(e[92]=[o("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m1 1 4 4 4-4"},null,-1)]),2))],32),s.showLanguageDropdown?(d(),u("div",ro,[o("div",oo,[e[95]||(e[95]=o("label",{for:"language-search",class:"sr-only"}," Search languages ",-1)),o("div",no,[e[94]||(e[94]=o("div",{class:"pointer-events-none absolute inset-y-0 start-0 flex items-center ps-3"},[o("svg",{class:"text-muted-2 h-4 w-4","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20"},[o("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"})])],-1)),C(o("input",{type:"text",id:"language-search","onUpdate:modelValue":e[55]||(e[55]=l=>s.languageSearch=l),class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2.5 ps-10 text-sm",placeholder:"Search languages"},null,512),[[E,s.languageSearch]])])]),o("ul",ao,[(d(!0),u(U,null,Z(r.filteredLanguages,l=>(d(),u("li",{key:l.code},[o("div",{class:w(["flex items-center rounded-sm p-2 focus:outline-none",l.code==="en"?"cursor-default opacity-60":"hover:bg-surface-2 focus:bg-surface-2 cursor-pointer"]),title:l.code==="en"?"English is required â alt text is generated in English first, then translated to other languages":null,onClick:p=>l.code!=="en"&&r.toggleLanguageSelection(l.code),onKeydown:[y(p=>l.code!=="en"&&r.toggleLanguageSelection(l.code),["enter"]),y(f(p=>l.code!=="en"&&r.toggleLanguageSelection(l.code),["prevent"]),["space"])],tabindex:l.code==="en"?-1:0,role:"option","aria-selected":s.selectedLanguages.includes(l.code),"aria-disabled":l.code==="en"},[o("input",{id:`checkbox-${l.code}`,type:"checkbox",checked:s.selectedLanguages.includes(l.code),disabled:l.code==="en",class:w(["text-accent border-border bg-surface-2 focus:ring-accent h-4 w-4 roun
2ded-sm focus:ring-2",l.code==="en"?"cursor-default":"cursor-pointer"]),onClick:f(p=>l.code!=="en"&&r.toggleLanguageSelection(l.code),["stop"])},null,10,io),o("label",{class:w(["text-foreground ms-2 w-full rounded-sm text-sm font-medium",l.code==="en"?"cursor-default":"cursor-pointer"])},m(l.name),3)],42,lo)]))),128))])])):g("",!0)])])])]),s.createStore.validImages.length>1&&r.currentImageDiffersFromDefaults&&!s.createStore.isProcessing&&!r.allImagesHaveAlt?(d(),u("hr",uo)):g("",!0),s.createStore.validImages.length>1&&r.currentImageDiffersFromDefaults&&!s.createStore.isProcessing&&!r.allImagesHaveAlt?(d(),u("div",co,[o("div",po,[e[97]||(e[97]=o("span",{class:"text-foreground text-sm font-medium"}," Apply current settings to all images: ",-1)),o("span",go," Image "+m(s.createStore.currentImageIndex+1)+" of "+m(s.createStore.validImages.length),1)]),o("button",{type:"button",class:"bg-accent text-on-accent hover:bg-accent/90 w-full cursor-pointer rounded-lg px-3 py-2 text-sm font-medium transition",onClick:e[56]||(e[56]=(...l)=>r.applyToAllImagesAction&&r.applyToAllImagesAction(...l))}," Apply to All Images "),e[98]||(e[98]=o("p",{class:"text-muted mt-2 text-xs"}," Options are automatically saved per-image. Use this button to copy current settings to all images. ",-1))])):g("",!0),O(he,{"enter-active-class":"transition duration-200 ease-out","enter-from-class":"opacity-0 -translate-y-1","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 -translate-y-1"},{default:X(()=>[r.showSaveDefaultsBtn?(d(),u("div",mo,[e[99]||(e[99]=o("hr",{class:"border-border my-3"},null,-1)),o("button",{type:"button",disabled:s.isSavingDefaults,class:"border-border bg-surface text-foreground hover:bg-surface-2 w-full cursor-pointer rounded-lg border px-3 py-2 text-sm font-medium transition disabled:cursor-not-allowed disabled:opacity-60",onClick:e[57]||(e[57]=(...l)=>r.saveAsDefaults&&r.saveAsDefaults(...l))},m(s.isSavingDefaults?"Saving...":s.saveDefaultsLabel),9,ho)])):g("",!0)]),_:1})],32)])}const Ie=$($s,[["render",fo],["__scopeId","data-v-27890cc7"]]),xo={name:"UploadedImages",components:{ConfirmModal:ve,LanguageBadges:xe,IconsClose:ge,PhCaretLeft:He,PhCaretRight:Ne,PhX:Be,PhSparkle:Gs,PhImages:es,PhCircleNotch:ut,PhPlus:Is,PhDownloadSimple:Ve,PhEnvelopeSimple:Me,PhExport:Pt},setup(){const t=ae(),e=ee(),a=Re(),{showToast:n}=W(),s=T(()=>x.filter(t.imageData,i=>i.url!==""||i.file)),r=T(()=>s.value.length);return{createStore:t,userStore:e,libraryStore:a,showToast:n,imagesWithUrl:s,imageCount:r}},watch:{imagesWithUrl:{handler(){this.$nextTick(()=>{this.generateOutputs(),this.initZoom()})},deep:!0},currentImageIndex:{handler(){this.$nextTick(()=>{this.generateOutputs(),this.initializeTabs(),this.initZoom()})}}},data(){return{confirmClearAll:!1,zoomInstances:[],isZoomed:!1,zoomObserver:null,editableAlt:"",htmlOutput:"",jsonOutput:"",activeTab:"plain",htmlInput:"",showDownloadDropdown:!1,downloadFormat:"txt",selectedLanguage:"",selectedJsonLangs:[],isGenerating:!1,isGeneratingAll:!1,stopGeneration:!1,wasStopped:!1,showAddPanel:!1,addUrlValue:"",isAddingImage:!1,isDragOverAdd:!1,showBatchExport:!1,batchExportFormat:"csv",batchExportEmail:"",batchExportEmailError:"",batchExportSelectedLangs:[],batchExportColumns:{text_length:!1,ai_model:!1,brand:!1,product:!1,primary_color:!1,secondary_color:!1,seo_keywords:!1,negative_keywords:!1,custom_prompt:!1},batchExportColumnOptions:[{key:"text_length",label:"Text Length"},{key:"brand",label:"Brand"},{key:"product",label:"Product"},{key:"primary_color",label:"Primary Color"},{key:"secondary_color",label:"Secondary Color"},{key:"seo_keywords",label:"SEO Keywords"},{key:"negative_keywords",label:"Negative Keywords"},{key:"custom_prompt",label:"Custom Prompt"}]}},computed:{currentImageIndex(){return this.createStore.currentImageIndex},currentImage(){return this.imagesWithUrl[this.currentImageIndex]||{url:"",alt:"",name:"",results:{},status:"pending",sourceType:"url"}},isEdited(){const t=this.currentImage,e=this.selectedLanguage&&t?.results?.[this.selectedLanguage]?t.results[this.selectedLanguage]:t.alt;return typeof this.editableAlt=="string"&&this.editableAlt!==e},hasAltForCurrent(){return!!this.currentImage?.alt},availableLanguages(){const t=this.currentImage?.results;return!t||Object.keys(t).length<=1?[]:Object.keys(t)},numImagesNeedingAlt(){return x.filter(this.imagesWithUrl,t=>!t.alt&&t.status!=="failed").length},singleCredits(){return this.createStore.totalCredits},totalCreditsAll(){return this.singleCredits*this.numImagesNeedingAlt},availableCredits(){const t=this.userStore.user?.current_credits_available;return typeof t=="number"?t:0},insufficientForSingle(){return this.singleCredits>this.availableCredits},insufficientForAll(){return this.totalCreditsAll>this.availableCredits},pasteKeyHint(){if(typeof navigator<"u"){const t=navigator.userAgentData?.platform||navigator.platform||"";if(/mac/i.test(t))return"âV"}return"Ctrl+V"},numCompletedImages(){return x.filter(this.imagesWithUrl,t=>t.status==="completed").length},completedImages(){return x.filter(this.imagesWithUrl,t=>t.status==="completed")},batchExportWillEmail(){return this.numCompletedImages>500},batchExportEmailValid(){return this.batchExportWillEmail?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.batchExportEmail):!0}
2,availableBatchExportLangs(){const t=new Set;for(const e of this.completedImages)e.results&&typeof e.results=="object"&&Object.keys(e.results).forEach(a=>t.add(a));return Array.from(t)},isLikelyMobile(){return typeof navigator<"u"?navigator.maxTouchPoints>0&&!/windows/i.test(navigator.userAgent):!1}},mounted(){this.initializeTabs(),this.generateOutputs(),this.$nextTick(()=>{this.initZoom()}),document.addEventListener("click",this.handleClickOutside),document.addEventListener("paste",this.handleAddPaste),window.addEventListener("dragover",this.preventWindowDrag,!1),window.addEventListener("drop",this.preventWindowDrag,!1)},beforeUnmount(){this.cleanupZoom(),document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("paste",this.handleAddPaste),window.removeEventListener("dragover",this.preventWindowDrag),window.removeEventListener("drop",this.preventWindowDrag)},methods:{initializeTabs(){this.activeTab="plain"},switchLanguage(t){this.selectedLanguage=t;const a=(this.currentImage?.results||{})[t]||this.currentImage?.alt||"";this.editableAlt=a;
2const n=this.currentImage.sourceType==="upload"?"YOUR_IMAGE_URL_HERE":this.currentImage.url;this.htmlOutput=`<img src="${n}" alt="${a}" />`,this.htmlInput=this.htmlOutput},updateJsonLangs(t){this.selectedJsonLangs=t,this.rebuildJsonOutput()},rebuildJsonOutput(){const t=this.currentImage;if(!t)return;const e=t.results||{},a={};if(t.name&&(a.image_name=t.name),a.image_url=t.sourceType==="upload"?"YOUR_IMAGE_URL_HERE":t.url||"",this.selectedJsonLangs.length===0||this.selectedJsonLangs.length===Object.keys(e).length)a.alt_text=Object.keys(e).length>0?e:{[this.selectedLanguage]:this.editableAlt};else{const n={};for(const s of this.selectedJsonLangs)e[s]&&(n[s]=e[s]);a.alt_text=Object.keys(n).length>0?n:e}this.jsonOutput=JSON.stringify(a,null,2)},generateOutputs(){if(this.imagesWithUrl.length===0)return;const t=this.currentImage,e=t.results||{},a=Object.keys(e);(!this.selectedLanguage||!a.includes(this.selectedLanguage))&&(this.selectedLanguage=a[0]||this.createStore.options.languages[0]||"en"),this.selectedJsonLangs=[...a];const n=e[this.selectedLanguage]||t.alt||"",s=t.sourceType==="upload"?"YOUR_IMAGE_
2URL_HERE":t.url;this.htmlOutput=`<img src="${s}" alt="${n}" />`;const r={};t.name&&(r.image_name=t.name),r.image_url=t.sourceType==="upload"?"YOUR_IMAGE_URL_HERE":t.url||"",r.alt_text=Object.keys(e).length>0?e:{[this.selectedLanguage]:n},this.jsonOutput=JSON.stringify(r,null,2),this.editableAlt=n,this.htmlInput=this.htmlOutput},setActiveTab(t){this.activeTab=t,t==="html"&&(this.htmlInput=this.htmlOutput)},getTabLabel(t){switch(t){case"html":return"HTML";case"json":return"JSON";default:return"Alt text"}},getTabContent(){switch(this.activeTab){case"html":return this.htmlInput||"";case"json":return this.jsonOutput||"";default:return this.editableAlt||""}},getDownloadContent(t){switch(t){case"csv":{const e=r=>`"${String(r||"").replace(/"/g,'""')}"`,a=this.createStore.options.languages||["en"],n=["image_name","image_url",...a.map(r=>`alt_text_${r.replace(/-/g,"_")}`)],s=x.map(this.imagesWithUrl,r=>{const i=r.sourceType==="upload"?"YOUR_IMAGE_URL_HERE":r.url||"",l=a.map(p=>e(r.results?.[p]||(p==="en"?r.alt:"")||""));return[e(r.name||""),e(i),...l]});return[n.join(","),...x.map(s,r=>r.join(","))].join(` 3`)}case"html":return this.htmlOutput||"";case"json":return this.jsonOutput||"";default:return this.editableAlt||""}},initZoom(){this.$nextTick(()=>{const t=this.$refs["current-image"];t&&t.complete?this.setupZoomForImage(t):t&&(t.onload=()=>{this.setupZoomForImage(t)})})},setupZoomForImage(t){this.zoomInstances[0]&&(this.zoomInstances[0].detach(),this.zoomInstances[0]=null),this.setupOverlayObserver();const e=Fe(t,{margin:24,background:"rgba(0, 0, 0, 0.8)",scrollOffset:0});this.zoomInstances[0]=e,e.on("open",()=>{this.isZoomed=!0;const a=document.querySelector(".medium-zoom-overlay");a&&(a.style.zIndex="9999");const n=e.getZoomedImage();n&&(n.style.zIndex="10000")}),e.on("opened",()=>{const a=e.getZoomedImage();a&&(a.style.zIndex="10000")}),e.on("closed",()=>{this.isZoomed=!1;const a=document.querySelector(".medium-zoom-overlay");a&&(a.style.zIndex="");const n=e.getZoomedImage();n&&(n.style.zIndex=""),this.$nextTick(()=>{this.initZoom()})})},setupOverlayObserver(){this.zoomObserver&&this.zoomObserver.disconnect(),this.zoomObserver=new MutationObserver(t=>{t.forEach(e=>{e.addedNodes.length&&e.addedNodes.forEach(a=>{a instanceof HTMLElement&&a.classList.contains("medium-zoom-overlay")&&(a.style.zIndex="9999")})})}),this.zoomObserver.observe(document.body,{childList:!0,subtree:!0})},cleanupZoom(){this.zoomInstances.forEach(t=>{t&&t.detach&&t.detach()}),this.zoomObserver&&(this.zoomObserver.disconnect(),this.zoomObserver=null)},goToImage(t){this.createStore.setCurrentImageIndex(t)},previousImage(){const t=this.currentImageIndex===0?this.imageCount-1:this.currentImageIndex-1;this.createStore.setCurrentImageIndex(t)},nextImage(){const t=this.currentImageIndex===this.imageCount-1?0:this.currentImageIndex+1;this.createStore.setCurrentImageIndex(t)},removeCurrentImage(){this.removeImageByVisibleIndex(this.currentImageIndex)},removeImageByVisibleIndex(t){const e=this.imagesWithUrl[t];if(!e)return;const a=this.createStore.imageData.findIndex(n=>n===e);a>-1&&this.createStore.removeImageAtIndex(a)},handleClearAll(){this.createStore.clearAllImages(),this.confirmClearAll=!1},saveEdits(){const t=this.currentImage;t.alt=this.editableAlt||"",this.showToast("Saved changes","success")},async regenerate(){const t=this.createStore.imageData.findIndex(e=>e.url===this.imagesWithUrl[this.currentImageIndex].url&&e.language===this.imagesWithUrl[this.currentImageIndex].language);if(t!==-1)try{this.isGenerating=!0,await this.createStore.generateAltText(t);const e=this.createStore.imageData[t];e?.status==="failed"&&this.showToast(e.errorMessage||"Generation failed","error")}catch(e){this.showToast(e.message||"Generation failed","error")}finally{this.isGenerating=!1}},async generateCurrent(){const t=this.createStore.imageData.findIndex(e=>e.url===this.imagesWithUrl[this.currentImageIndex].url&&e.language===this.imagesWithUrl[this.currentImageIndex].language);if(t!==-1)try{this.isGenerating=!0,await this.createStore.generateAltText(t);const e=this.createStore.imageData[t];if(e?.status==="failed"){const a=e.errorMessage||"Generation failed",n=a.toLowerCase().includes("unsupported")||a.toLowerCase().includes("format");
3this.showToast(n?"Unsupported image format. Try converting to PNG, JPEG, WebP, or GIF and re-uploading.":a,"error")}}catch(e){this.showToast(e.message||"Generation failed","error")}finally{this.isGenerating=!1}},async generateAll(){const t=x.map(this.createStore.imageData,(s,r)=>({img:s,idx:r})),e=x.filter(t,({img:s})=>s.url&&!s.alt&&s.status!=="failed"),a=x.map(e,({idx:s})=>s);if(a.length===0)return;this.isGeneratingAll=!0,this.stopGeneration=!1,this.wasStopped=!1;let n=0;try{for(let r=0;r<a.length;r+=10){if(this.stopGeneration){this.wasStopped=!0;break}const i=a.slice(r,r+10);await Promise.all(i.map(async l=>{this.stopGeneration||(await this.createStore.generateAltText(l),this.createStore.imageData[l]?.status==="failed"&&n++)}))}if(n>0){const r=n===1?"image":"images";this.showToast(`${n} ${r} failed to generate alt text. This may be due to an unsupported file format. Try converting ${n===1?"it":"them"} to PNG, JPEG, WebP, or GIF and try again.`,"error",8e3)}}finally{this.isGeneratingAll=!1,this.stopGeneration=!1}},stopGeneratingAll(){this.stopGeneration=!0},copyToClipboard(t){t&&(navigator.clipboard?.writeText(t),this.showToast("Copied to clipboard","success"))},toggleDownloadDropdown(){this.showDownloadDropdown=!this.showDownloadDropdown},onDownloadKeydown(t){if(!this.showDownloadDropdown)return;if(t.key==="Escape"){t.preventDefault(),this.showDownloadDropdown=!1,this.$nextTick(()=>document.getElementById("downloadAsButton")?.focus());return}if(t.key!=="Tab")return;const e=document.getElementById("downloadAsButton"),a=document.getElementById("downloadAsDropdown");if(!e||!a)return;const n=Array.from(a.querySelectorAll("button:not([disabled])")),s=[e,...n],r=s[0],i=s[s.length-1];t.shiftKey?document.activeElement===r&&(t.preventDefault(),i.focus()):document.activeElement===i&&(t.preventDefault(),r.focus())},downloadAs(t){this.showDownloadDropdown=!1,this.downloadFormat=t,this.download()},download(){const t=this.getDownloadContent(this.downloadFormat),e=new Blob([t],{type:this.getMimeType(this.downloadFormat)}),a=URL.createObjectURL(e),n=document.createElement("a");n.href=a;let s="alt-text";this.currentImage.name&&(s=this.currentImage.name.replace(/[^a-zA-Z0-9]/g,"-")),this.imageCount>1&&(s+=`-${this.currentImageIndex+1}`),n.download=`Alt-Text-Studio-${s}.${this.downloadFormat}`,n.click(),URL.revokeObjectURL(a)},getMimeType(t){switch(t){case"txt":return"text/plain;charset=utf-8";case"html":return"text/html;charset=utf-8";case"csv":return"text/csv;charset=utf-8";case"json":return"application/json;charset=utf-8";default:return"text/plain;charset=utf-8"}},langCodeToName(t){return me.find(a=>a.code===t)?.name??t},openBatchExport(){this.batchExportEmail=this.userStore.user?.email||"",this.batchExportSelectedLangs=[...this.availableBatchExportLangs],this.batchExportEmailError="",this.showBatchExport=!0,this.$nextTick(()=>{const t=this.$refs.batchExportPanel;t&&t.querySelector("button, input, [tabindex]")?.focus()})},trapFocusInExportPanel(t){const e=this.$refs.batchExportPanel;if(!e)return;const a=e.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(a.length===0)return;const n=a[0],s=a[a.length-1];t.shiftKey&&document.activeElement===n?(t.preventDefault(),s.focus()):!t.shiftKey&&document.activeElement===s&&(t.preventDefault(),n.focus())},handleBatchExport(){if(this.batchExportWillEmail)return this.sendBatchExportEmail();switch(this.batchExportFormat){case"txt":return this.handleBatchExportTxt();case"html":return this.handleBatchExportHtml();case"json":return this.handleBatchExportJson();default:return this.handleBatchExportCSV()}},batchExportDownload(t,e,a){const n=new Blob([t],{type:e}),s=URL.createObjectURL(n),r=document.createElement("a");r.href=s,r.download=`Alt-Text-Studio-export-${new Date().toISOString().split("T")[0]}.${a}`,r.click(),URL.revokeObjectURL(s),this.showBatchExport=!1},handleBatchExportCSV(){const t=this.completedImages;if(t.length===0)return;const e=h=>String(h||"").replace(/"/g,'""'),a=this.batchExportSelectedLangs,n=new Set;t.forEach(h=>{const v=h.results||{};(a.length>0?a.filter(P=>Object.prototype.hasOwnProperty.call(v,P)):Object.keys(v)).forEac
3h(P=>n.add(P))});const s=Array.from(n);s.length===0&&s.push("en");const r=this.batchExportColumnOptions.filter(h=>this.batchExportColumns[h.key]).map(h=>h.key),i=["image_name","image_url","source_type"];for(const h of s)i.push(`alt_text_${h.replace(/-/g,"_")}`);for(const h of r)i.push(h);i.push("created_at");const l=[i],p=(h,v)=>{const _=h.options||{};switch(v){case"text_length":return _.textLength||"normal";case"ai_model":return _.aiModel||"gpt-5-nano";case"brand":return _.ecommerce?.brand||"";case"product":return _.ecommerce?.product||"";case"primary_color":return _.ecommerce?.primary_color||"";case"secondary_color":return _.ecommerce?.secondary_color||"";case"seo_keywords":{const P=_.seoKeywords||[];return Array.isArray(P)?P.join(" | "):String(P||"")}case"negative_keywords":{const P=_.negativeKeywords||[];return Array.isArray(P)?P.join(" | "):String(P||"")}case"custom_prompt":return _.customPrompt||"";default:return""}};t.forEach(h=>{const v=e(h.name||""),_=e(h.sourceType==="upload"?"YOUR_IMAGE_URL_HERE":h.url||""),P=h.sourceType==="upload"?"Upload":"URL",j="",R=r.map(c=>e(p(h,c))),V=h.results||{},F=s.map(c=>e(V[c]||""));l.push([v,_,P,...F,...R,j])});const b=l.map(h=>h.map(v=>`"${v}"`).join(",")).join(` 4`);this.batchExportDownload(b,"text/csv;charset=utf-8;","csv")},handleBatchExportTxt(){const t=this.completedImages;if(t.length===0)return;const e=[];t.forEach(a=>
4{const n=a.name||"",s=a.sourceType==="upload"?"YOUR_IMAGE_URL_HERE":a.url||"",r=a.results||{},i=this.batchExportSelectedLangs,l=i.length>0?i.filter(p=>Object.prototype.hasOwnProperty.call(r,p)):Object.keys(r);l.length>0?l.forEach(p=>{e.length>0&&e.push(""),n&&e.push(`${n} â ${this.langCodeToName(p)}`),s&&e.push(s),e.push(r[p]||"")}):(e.length>0&&e.push(""),n&&e.push(n),s&&e.push(s),e.push(a.alt||""))}),this.batchExportDownload(e.join(` 5`),"text/plain;charset=utf-8","txt")},handleBatchExportHtml(){const t=this.completedImages;if(t.length===0)return;const e=s=>String(s||"").replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"),a=[];t.forEach(s=>{const r=s.name||"",i=s.sourceType==="upload"?"YOUR_IMAGE_URL_HERE":s.url||"",l=s.results||{},p=this.batchExportSelectedLangs,b=p.length>0?p.filter(h=>Object.prototype.hasOwnProperty.call(l,h)):Object.keys(l);b.length>0?b.forEach(h=>{const v=h!=="en"?` lang="${h}"`:"";a.length>0&&a.push(""),r&&a.push(` <!-- ${e(r)} (${this.langCodeToName(h)}) -->`),a.push(` <img src="${e(i)}" alt="${e(l[h]||"")}"${v} />`)}):(a.length>0&&a.push(""),r&&a.push(` <!-- ${e(r)} -->`),a.push(` <img src="${e(i)}" alt="${e(s.alt||"")}" />`))});const n=["<!DOCTYPE html>",'<html lang="en">',"<head>",' <meta charset="UTF-8" />'," <title>Alt Text Studio Export</title>","</head>","<body>",...a,"</body>","</html>"].join(` 6`);this.batchExportDownload(n,"text/html;charset=utf-8","html")},handleBatchExportJson(){const t=this.completedImages;if(t.length===0)return;const e=[];t.forEach(a=>
6{const n=a.name||"",s=a.sourceType==="upload"?"YOUR_IMAGE_URL_HERE":a.url||"",r=a.results||{},i=this.batchExportSelectedLangs,l=i.length>0?i.filter(b=>Object.prototype.hasOwnProperty.call(r,b)):Object.keys(r),p={};n&&(p.image_name=n),p.image_url=s,l.length>0?p.alt_text=Object.fromEntries(l.map(b=>[b,r[b]||""])):p.alt_text={en:a.alt||""},e.push(p)}),this.batchExportDownload(JSON.stringify(e,null,2),"application/json;charset=utf-8","json")},async sendBatchExportEmail(){const t=this.batchExportEmail;if(!t||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)){this.batchExportEmailError="Please enter a valid email address.";return}const e=this.completedImages.map(n=>n.id).filter(Boolean);if(e.length===0){this.showToast("No completed images to export.","error");return}const a=this.batchExportColumnOptions.filter(n=>this.batchExportColumns[n.key]).map(n=>n.key);try{await this.libraryStore.exportEmail({image_ids:e,format:this.batchExportFormat,languages:this.batchExportSelectedLangs.length>0?this.batchExportSelectedLangs:void 0,columns:a.length>0?a:void 0,email:t}),this.showToast(`Export is being sent to ${t}`,"success"),this.showBatchExport=!1}catch(n){const s=n?.response?.data?.message||"Failed to send export email. Please try again.";this.showToast(s,"error")}},startNewImage(){this.createStore.clearState()},handleAddAnother(){this.showAddPanel=!this.showAddPanel,this.showAddPanel&&this.$nextTick(()=>{const t=this.$refs.addUrlInput;t&&t.focus()})},submitAddUrl(){const t=this.addUrlValue.trim();if(!/^(ftp|http|https):\/\/[^ "]+$/.test(t)){this.showToast("Please enter a valid image URL","error");return}this.isAddingImage=!0;const a=new Image;a.onload=()=>{this.createStore.appendImageFromUrl(t),this.createStore.clearEmptyUrlData(),this.createStore.removeDuplicateUrls(),this.addUrlValue="",this.showAddPanel=!1,this.isAddingImage=!1},a.onerror=()=>{this.showToast("Could not load image from this URL. Some hosts (e.g. Wikipedia) block direct image fetching â try downloading the file and uploading it instead.","error"),this.isAddingImage=!1},a.src=t},preventWindowDrag(t){t.preventDefault()},handleAddDragLeave(t){t.currentTarget.contains(t.relatedTarget)||(this.isDragOverAdd=!1)},handleAddFileInput(t){const e=t.target;if(!e.files||e.files.length===0){e.value="";return}const a=Array.from(e.files);e.value="",Promise.all(a.map(n=>this.processAddFile(n))).then(()=>{this.showAddPanel=!1})},async handleAddFileDrop(t){this.isDragOverAdd=!1;const e=t.dataTransfer;if(!e)return;const a=[];if(e.items&&e.items.length>0){const r=[];for(const i of Array.from(e.items)){const l=i.webkitGetAsEntry?.();if(l)l.isDirectory?r.push(this.readAddDirEntries(l,a)):l.isFile&&r.push(new Promise(p=>{l.file(b=>{a.push(b),p()},()=>p())}));else{const p=i.getAsFile?.();p&&a.push(p)}}await Promise.all(r)}else a.push(...Array.from(e.files));const n=a.filter(r=>r.type.startsWith("image/"));if(n.length>0){await Promise.all(n.map(r=>this.processAddFile(r))),this.showAddPanel=!1;return}const s=e.getData("text/uri-list")||e.getData("text/plain");if(s){const r=s.split(` 7`).map(i=>i.trim()).filter(i=>i&&!i.startsWith("#"));for(const i of r)if(/^https?:\/\//.test(i)){this.addUrlValue=i,this.submitAddUrl();return}}},async readAddDirEntries(t,e){const a=t.createReader(),n=async()=>{const s=await new Promise((i,l)=>{a.readEntries(i,l)});if(!s.length)return;const r=[];for(const i of s)i.isFile?r.push(new Promise(l=>{i.file(p=>{e.push(p),l()},()=>l())})):i.isDirectory&&r.push(this.readAddDirEntries(i,e));await Promise.all(r),await n()};await n()},processAddFile(t){return new Promise(e=>{if(!["image/png","image/jpeg","image/jpg","image/webp","image/gif"].includes(t.type)){this.showToast("Unsupported file type. Please use PNG, JPG, WebP, or GIF.","error"),e();return}if(t.size>20971520){this.showToast("File size must be less than 20MB.","error"),e();return}const s=URL.createObjectURL(t),r=new Image;r.onload=()=>{this.createStore.appendImageFromFile(t,s),e()},r.onerror=()=>{this.showToast("Could not load the image. Please try another file.","error"),URL.revokeObjectURL(s),e()},r.src=s})},handleAddPaste(t){if(!this.showAddPanel)return;const e=t.target;if(e.tagName==="INPUT"||e.tagName==="TEXTAREA")return;const a=t.clipboardData?.items;if(a){for(const n of Array.from(a))if(n.type.startsWith("image/")){const s=n.getAsFile();if(s){t.preventDefault(),this.processAddFile(s).then(()=>{this.showAddPanel=!1});return}}}},handleClickOutside(t){const e=t.target;e.closest(".download-dropdown")||(this.showDownloadDropdown=!1),this.showBatchExport&&!e.closest(".batch-export-wrapper")&&(this.showBatchExport=!1)}}},bo={class:"w-full text-sm"},vo={class:"border-border flex items-center justify-between border-b pb-3"},yo={class:"flex items-center gap-2"},wo={class:"text-foreground text-2xl font-bold"},Io={key:0,class:"text-accent rounded-full bg-accent/10 px-2 py-0.5 text-xs font-semibold"},ko={class:"flex items-center gap-2"},So=["disabled"],Lo={class:"relative flex h-[520px] w-full overflow-hidden py-4"},Co={key:0,class:"hidden h-full w-56 shrink-0 overflow-y-auto p-1 mr-2 lg:block"},To={class:"grid grid-cols-2 gap-2 p-1"},Ao=["onClick"],_o=["src","alt","onError"],Eo=["disabled","onClick"],Do={class:"relative flex h-full w-full items-center justify-center"},Po={class:"absolute top-2 right-2 z-10 flex items-center gap-2"},Oo=["disabled"],Uo=["src","alt"],Mo={key:0,class:"px-6 lg:hidden"},Vo={class:"no-scrollbar mt-2 flex gap-2 overflow-x-auto pb-1"},Bo=["onClick"],Fo=["src","alt","onError"],Ro=["disabled","onClick"],No={class:"flex flex-col items-center gap-3 px-6 pb-3"},Ho={key:0,class:"w-full rounded-lg border border-red-300 bg-red-50 px-3 py-2 text-center text-xs text-red-700 dark:border-red-700 dark:bg-red-900/20 dark:text-red-400"},jo={key:1,class:"border-border bg-surface-2 w-full rounded-lg border px-4 py-3"},Ko={class:"mb-2 flex items-center justify-between"},Go={class:"flex items-center gap-2"},Zo=["disabled"],zo={class:"text-muted text-sm"},Wo={key:0},Jo={class:"border-border bg-surface-2 rounded border px-1 py-0.5 font-mono text-xs"},qo={class:"flex flex-wrap items-center justify-center gap-3"},Yo=["disabled"],Qo={key:0,class:"group/generate relative"},Xo=["disabled"],$o={class:"bg-foreground text-canvas pointer-events-none absolute bottom-full left-1/2 z-20 mb-2 hidden -translate-x-1/2 whitespace-nowrap rounded-md px-3 py-2 text-xs shadow-lg group-hover/generate:block"},en={class:"text-center"},tn={key:1,class:"group/generateall relative"},sn={class:"flex items-center gap-2"},rn=["disabled"],on=["disabled"],nn={class:"bg-foreground text-canvas pointer-events-none absolute bottom-full left-1/2 z-20 mb-2 hidden -translate-x-1/2 whitespace-nowrap rounded-md px-3 py-2 text-xs shadow-lg group-hover/generateall:block"},an={class:"text-center"},ln={key:2,class:"w-full text-center text-xs text-red-600 dark:text-red-400"},dn={key:3,class:"batch-export-wrapper relative"},un={class:"p-4 space-y-4"},cn={class:"flex items-center justify-between"},pn={class:"flex gap-1.5"},gn=["onClick"],mn={key:0},hn={class:"text-muted mb-2 text-xs"},fn={key:0,id:"batch-export-email-error",class:"mt-1 text-xs text-red-600",role:"alert"},xn={key:1},bn={class:"max-h-36 overflow-y-auto flex flex-wrap gap-1.5 pr-0.5"},vn=["onClick"],yn={class:"grid grid-cols-2 gap-x-4 gap-y-1.5"},wn=["onUpdate:modelValue","onKeydown"],In={class:"text-foreground text-sm"},kn=["disabled"],Sn={key:1,class:"border-t border-gray-200 p-3"},Ln={key:0,class:"mb-3"},Cn={key:1,class:"mb-3"},Tn={key:2,class:"mb-3 rounded-lg border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:border-amber-600 dar
7k:bg-amber-900/20 dark:text-amber-300"},An={class:"mb-3 flex gap-3 text-sm"},_n={class:"border-border bg-surface-2 relative rounded-lg border px-3 py-2"},En={class:"text-foreground mb-2 block text-sm font-semibold"},Dn={class:"flex items-start gap-2"},Pn={class:"min-w-0 flex-1"},On={key:3,class:"mt-0.5 flex justify-end"},Un={class:"mt-4 flex items-center justify-between"},Mn={class:"flex items-center gap-2"},Vn={class:"group/regen relative"},Bn=["disabled"],Fn={key:2,class:"whitespace-nowrap"},Rn={class:"bg-foreground text-canvas pointer-events-none absolute bottom-full left-1/2 z-20 mb-2 hidden -translate-x-1/2 whitespace-nowrap rounded-md px-3 py-2 text-xs shadow-lg group-hover/regen:block"},Nn={class:"text-center"},Hn=["disabled"],jn={class:"flex items-center gap-4"},Kn={key:0,id:"downloadAsDropdown",class:"border-border bg-surface absolute right-0 bottom-0 z-50 w-32 translate-x-[calc(100%+0.5rem)] rounded-lg border shadow-lg"},Gn={class:"p-1"},Zn={key:1,class:"mt-2 text-center text-sm text-gray-600"};function zn(t,e,a,n,s,r){const i=H("PhX"),l=H("PhCaretLeft"),p=H("PhCaretRight"),b=H("PhPlus"),h=H("PhCircleNotch"),v=H("PhSparkle"),_=H("PhImages"),P=H("PhExport"),j=H("PhEnvelopeSimple"),R=H("PhDownloadSimple"),V=xe,F=ve;return d(),u("div",bo,[n.imageCount>0?(d(),u("div",{key:0,class:"bg-surface relative mt-2 rounded-lg px-4 pt-2 pb-4 shadow-md",style:Ae({zIndex:s.isZoomed?"1":"auto"})},[o("div",vo,[o("div",yo,[o("span",wo,m(n.imageCount===1?"Image":"Images"),1),n.imageCount>0?(d(),u("span",Io,m(n.imageCount),1)):g("",!0)]),o("div",ko,[n.imageCount>0?(d(),u("button",{key:0,type:"button",disabled:s.isGenerating||s.isGeneratingAll,class:"cursor-pointer rounded-lg border border-red-500 px-3 py-1 text-sm font-medium text-red-600 hover:bg-red-50 focus:ring-2 focus:ring-red-300 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",onClick:e[0]||(e[0]=c=>s.confirmClearAll=!0)},m(n.imageCount>1?"Clear All":"Clear"),9,So)):g("",!0)])]),o("div",Lo,[n.imageCount>1?(d(),u("div",Co,[o("div",To,[(d(!0),u(U,null,Z(n.imagesWithUrl,(c,L)=>(d(),u("div",{key:L,class:"group relative cursor-pointer"},[o("button",{type:"button",onClick:N=>r.goToImage(L),class:"block w-full cursor-pointer"},[o("img",{src:c.url,alt:c.name||`Uploaded image ${L+1}`,class:w(["h-24 w-full rounded-lg object-cover shadow-sm transition-transform duration-150 group-hover:scale-[1.02]",[r.currentImageIndex===L?"ring-2 ring-blue-600":"ring-1 ring-gray-200"]]),onError:N=>r.removeImageByVisibleIndex(L)},null,42,_o)],8,Ao),o("button",{type:"button",disabled:s.isGenerating||s.isGeneratingAll,class:"absolute top-1 right-1 z-10 hidden h-5 w-5 cursor-pointer items-center justify-center rounded-full bg-black/60 text-white hover:bg-black/80 group-hover:flex disabled:cursor-not-allowed disabled:opacity-50",onClick:f(N=>r.removeImageByVisibleIndex(L),["stop"])},[O(i,{class:"h-2.5 w-2.5"})],8,Eo)]))),128))])])):g("",!0),o("div",Do,[n.imageCount>1?(d(),u("button",{key:0,onClick:e[1]||(e[1]=(...c)=>r.previousImage&&r.previousImage(...c)),class:"bg-surface/90 absolute top-1/2 left-2 z-10 -translate-y-1/2 cursor-pointer rounded-full p-2 shadow-md hover:bg-surface focus:ring-2 focus:ring-brand-blue/30 focus:outline-none"},[O(l,{class:"text-muted h-5 w-5"})])):g("",!0),n.imageCount>1?(d(),u("button",{key:1,onClick:e[2]||(e[2]=(...c)=>r.nextImage&&r.nextImage(...c)),class:"bg-surface/90 absolute top-1/2 right-2 z-10 -translate-y-1/2 cursor-pointer rounded-full p-2 shadow-md hover:bg-surface focus:ring-2 focus:ring-brand-blue/30 focus:outline-none"},[O(p,{class:"text-muted h-5 w-5"})])):g("",!0),o("div",Po,[o("button",{type:"button",disabled:s.isGenerating||s.isGeneratingAll,class:"bg-surface/90 dark:bg-surface-2/90 cursor-pointer rounded-full p-2 shadow-md hover:bg-surface dark:hover:bg-surface-2 focus:ring-2 focus:ring-brand-blue/30 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",title:"Remove",onClick:e[3]||(e[3]=(...c)=>r.removeCurrentImage&&r.removeCurrentImage(...c))},[O(i,{class:"text-muted dark:text-foreground h-4 w-4"})],8,Oo)]),o("img",{src:r.currentImage.url,ref:"current-image",class:w(["mx-auto block max-h-full max-w-full object-contain",s.isZoomed?"":"cursor-zoom-in"]),alt:r.currentImage.name||`Uploaded image ${r.currentImageIndex+1}`},null,10,Uo)])]),n.imageCount>1?(d(),u("div",Mo,[o("div",Vo,[(d(!0),u(U,null,Z(n.imagesWithUrl,(c,L)=>(d(),u("div",{key:L,class:"group relative shrink-0 cursor-pointer"},[o("button",{type:"button",onClick:N=>r.goToImage(L)},[o("img",{src:c.url,alt:c.name||`Uploaded image ${L+1}`,class:w(["h-16 w-16 rounded-md object-cover shadow-sm transition-transform duration-150 group-hover:scale-[1.03]",[r.currentImageIndex===L?"ring-2 ring-blue-600":"ring-1 ring-gray-200"]]),onError:N=>r.removeImageByVisibleIndex(L)},null,42,Fo)],8,Bo),o("button",{type:"button",disabled:s.isGenerating||s.isGeneratingAll,class:"absolute top-0.5 right-0.5 z-10 hidden h-4 w-4 cursor-pointer items-center justify-center rounded-full bg-black/60 text-white hover:bg-black/80 group-hover:flex disabled:cursor-not-allowed disabled:opacity-50",onClick:f(N=>r.removeImageByVisibleIndex(L),["stop"])},[O(i,{class:"h-2.5 w-2.5"})],8,Ro)]))),128))])])):g("",!0),o("div",No,[r.currentImage.status==="failed"&&r.currentImage.errorMessage?(d(),u("div",Ho,[e[45]||(e[45]=o("span",{class:"font-medium"},"Failed:",-1)),I(" "+m(r.currentImage.errorMessage),1)])):g("",!0),s.showAddPanel?(d(),u("div",jo,[o("div",Ko,[e[46]||(e[46]=o("span",{class:"text-foreground text-sm font-semibold"},"Add Another Image",-1)),o("button",{type:"button",class:"text-muted hover:text-foreground cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-accent","aria-label":"Close add image panel",onClick:e[4]||(e[4]=c=>s.showAddPanel=!1)},[O(i,{class:"h-4 w-4"})])]),o("div",Go,[C(o("input",{ref:"addUrlInput","onUpdate:modelValue":e[5]||(e[5]=c=>
7s.addUrlValue=c),type:"url",maxlength:"2048",placeholder:"https://www.example.com/image.jpg",class:"border-border bg-surface text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2 text-sm",onKeydown:[e[6]||(e[6]=y(f((...c)=>r.submitAddUrl&&r.submitAddUrl(...c),["prevent"]),["enter"])),e[7]||(e[7]=y(c=>s.showAddPanel=!1,["escape"]))]},null,544),[[E,s.addUrlValue,void 0,{trim:!0}]]),o("button",{type:"button",class:"bg-accent text-on-accent cursor-pointer rounded-lg px-3 py-2 text-sm font-medium hover:opacity-90 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",disabled:!s.addUrlValue||s.isAddingImage,onClick:e[8]||(e[8]=(...c)=>r.submitAddUrl&&r.submitAddUrl(...c))},m(s.isAddingImage?"â¦":"Link"),9,Zo)]),e[52]||(e[52]=o("div",{class:"my-3 flex items-center gap-2"},[o("hr",{class:"border-border flex-1 border-t"}),o("span",{class:"text-muted text-xs font-medium"},"or"),o("hr",{class:"border-border flex-1 border-t"})],-1)),o("label",{for:"add-upload-zone",class:w(["flex cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed py-4 transition-colors",s.isDragOverAdd?"border-accent bg-accent/10":"border-border bg-surface hover:bg-surface-2"]),onDragenter:e[10]||(e[10]=f(c=>s.isDragOverAdd=!0,["prevent"])),onDragover:e[11]||(e[11]=f(c=>s.isDragOverAdd=!0,["prevent"])),onDragleave:e[12]||(e[12]=(...c)=>r.handleAddDragLeave&&r.handleAddDragLeave(...c)),onDrop:e[13]||(e[13]=f((...c)=>r.handleAddFileDrop&&r.handleAddFileDrop(...c),["prevent"]))},[e[50]||(e[50]=o("svg",{class:"text-muted mb-1.5 h-6 w-6","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 16"},[o("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"})],-1)),o("p",zo,[e[48]||(e[48]=o("span",{class:"font-semibold"},"Click to upload",-1)),e[49]||(e[49]=I(", drag and drop",-1)),r.isLikelyMobile?g("",!0):(d(),u("span",Wo,[e[47]||(e[47]=I(", or paste ",-1)),o("kbd",Jo,m(r.pasteKeyHint),1)]))]),e[51]||(e[51]=o("p",{class:"text-muted-2 mt-1 text-xs"},"PNG, JPG, WebP, GIF · folders supported (Max. 20MB)",-1)),o("input",{id:"add-upload-zone",ref:"addFileInput",type:"file",accept:"image/png,image/jpeg,image/jpg,image/webp,image/gif",multiple:"",class:"hidden",onChange:e[9]||(e[9]=(...c)=>r.handleAddFileInput&&r.handleAddFileInput(...c))},null,544)],34)])):g("",!0),o("div",qo,[o("button",{type:"button",disabled:s.isGenerating||s.isGeneratingAll,class:"border-border text-muted hover:bg-surface-2 inline-flex cursor-pointer items-center gap-1.5 rounded-lg border px-3 py-2 text-sm font-medium focus:ring-2 focus:ring-brand-blue/30 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",onClick:e[14]||(e[14]=(...c)=>r.handleAddAnother&&r.handleAddAnother(...c))},[O(b,{class:"h-4 w-4"}),e[53]||(e[53]=o("span",null,"Add Another Image",-1))],8,Yo),r.hasAltForCurrent?g("",!0):(d(),u("div",Qo,[o("button",{type:"button",class:w(["inline-flex cursor-pointer items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium focus:ring-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",r.insufficientForSingle?"bg-red-600 text-white hover:bg-red-700 focus:ring-red-300":"bg-purple-700 text-on-accent hover:bg-purple-800 focus:ring-purple-300 dark:bg-purple-600 dark:hover:bg-purple-700"]),disabled:s.isGenerating||s.isGeneratingAll||r.insufficientForSingle,onClick:e[15]||(e[15]=(...c)=>r.generateCurrent&&r.generateCurrent(...c))},[s.isGenerating?(d(),M(h,{key:0,class:"h-4 w-4 animate-spin"})):(d(),M(v,{key:1,class:"h-4 w-4"})),o("span",null,m(s.isGenerating?"Generating...":r.insufficientForSingle?"Not enough credits":"Generate alt text"),1),o("span",{class:w(["rounded-full px-2 py-0.5 text-[11px] font-semibold",r.insufficientForSingle?"bg-white/20":"bg-canvas/20"])},m(r.singleCredits)+" credit"+m(r.singleCredits!==1?"s":""),3)],10,Xo),o("div",$o,[o("div",en,[r.insufficientForSingle?(d(),u(U,{key:0},[I(" Need "+m(r.singleCredits)+" credits, you have "+m(r.availableCredits),1)],64)):(d(),u(U,{key:1},[I(m(n.createStore.options.textLength==="detailed"?"Detailed":"Normal")+" ("+m(n.createStore.options.textLength==="detailed"?"2":"1")+") à "+m(n.createStore.options.languages.length)+" language"+m(n.createStore.options.languages.length!==1?"s":""),1)],64))]),e[54]||(e[54]=o("div",{class:"border-foreground absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-current"},null,-1))])])),n.imageCount>1&&r.numImagesNeedingAlt>0?(d(),u("div",tn,[o("div",sn,[o("button",{type:"button",class:w(["inline-flex cursor-pointer items-center gap-2 rounded-lg border px-4 py-2 text-sm font-medium focus:ring-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",r.insufficientForAll?"border-red-300 bg-red-50 text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-400 focus:ring-red-300":"border-accent bg-surface text-accent hover:bg-surface-2 focus:ring-brand-blue/30"]),disabled:s.isGenerating||s.isGeneratingAll||r.insufficientForAll,onClick:e[16]||(e[16]=c=>{s.wasStopped=!1,r.generateAll()})},[s.isGeneratingAll?(d(),M(h,{key:0,class:"h-4 w-4 animate-spin"})):(d(),M(_,{key:1,class:"h-4 w-4"})),o("span",null,m(s.stopGeneration?"Stopping...":s.isGeneratingAll?"Generating all...":s.wasStopped?"Generate remaining":r.insufficientForAll?"Not enough credits":"Generate for all"),1),o("span",{class:w(["rounded-full px-2 py-0.5 text-[11px] font-semibold",r.insufficientForAll?"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-400":"text-accent bg-accent/10"])},m(r.totalCreditsAll)+" credit"+m(r.totalCreditsAll!==1?"s":""),3)],10,rn),s.isGeneratingAll?(d(),u("button",{key:0,t
7ype:"button","aria-label":"Stop generating",class:w(["flex h-10 w-10 shrink-0 cursor-pointer items-center justify-center rounded-full border focus:ring-2 focus:outline-none transition-colors",s.stopGeneration?"border-red-400 bg-red-200 text-red-700 dark:border-red-700 dark:bg-red-800 dark:text-red-300":"border-red-300 bg-red-50 text-red-600 hover:bg-red-100 focus:ring-red-300 dark:border-red-800 dark:bg-red-950 dark:text-red-400 dark:hover:bg-red-900"]),disabled:s.stopGeneration,onClick:e[17]||(e[17]=(...c)=>r.stopGeneratingAll&&r.stopGeneratingAll(...c))},e[55]||(e[55]=[o("svg",{class:"h-5 w-5",fill:"currentColor",viewBox:"0 0 24 24"},[o("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2"})],-1)]),10,on)):g("",!0)]),o("div",nn,[o("div",an,[r.insufficientForAll?(d(),u(U,{key:0},[I(" Need "+m(r.totalCreditsAll)+" credits, you have "+m(r.availableCredits),1)],64)):(d(),u(U,{key:1},[I(m(r.singleCredits)+" credit"+m(r.singleCredits!==1?"s":"")+"/image à "+m(r.numImagesNeedingAlt)+" image"+m(r.numImagesNeedingAlt!==1?"s":"")+" = "+m(r.totalCreditsAll)+" total ",1)],64))]),e[56]||
7(e[56]=o("div",{class:"border-foreground absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-current"},null,-1))])])):g("",!0),r.insufficientForSingle||r.insufficientForAll&&n.imageCount>1&&r.numImagesNeedingAlt>0?(d(),u("p",ln,[I(" You need "+m(r.insufficientForAll&&r.numImagesNeedingAlt>1?r.totalCreditsAll:r.singleCredits)+" credits but only have "+m(r.availableCredits)+". ",1),o("button",{class:"text-accent cursor-pointer underline",onClick:e[18]||(e[18]=c=>n.userStore.navigateToBillingPortal())},"Get more credits")])):g("",!0),r.numCompletedImages>1&&!s.isGeneratingAll?(d(),u("div",dn,[o("button",{type:"button",class:"inline-flex cursor-pointer items-center gap-2 rounded-lg border border-accent bg-surface text-accent hover:bg-surface-2 px-4 py-2 text-sm font-medium focus:ring-2 focus:ring-brand-blue/30 focus:outline-none",onClick:e[19]||(e[19]=(...c)=>r.openBatchExport&&r.openBatchExport(...c))},[O(P,{class:"h-4 w-4"}),e[57]||(e[57]=o("span",null,"Export Batch Results",-1))]),s.showBatchExport?(d(),u("div",{key:0,ref:"batchExportPanel",role:"dialog","aria-modal":"true","aria-label":"Export options",class:"border-border bg-surface absolute left-0 bottom-full z-50 mb-2 w-72 max-w-[calc(100vw-2rem)] rounded-lg border shadow-xl sm:max-w-none",onClick:e[25]||(e[25]=f(()=>{},["stop"])),onKeydown:[e[26]||(e[26]=y(f(c=>s.showBatchExport=!1,["prevent"]),["escape"])),e[27]||(e[27]=y((...c)=>r.trapFocusInExportPanel&&r.trapFocusInExportPanel(...c),["tab"]))]},[o("div",un,[o("div",cn,[e[58]||(e[58]=o("span",{class:"text-foreground text-sm font-semibold"},"Export Options",-1)),o("button",{type:"button",class:"text-muted hover:text-foreground cursor-pointer",onClick:e[20]||(e[20]=c=>s.showBatchExport=!1)},[O(i,{class:"h-4 w-4"})])]),o("div",null,[e[59]||(e[59]=o("p",{class:"text-muted mb-2 text-xs font-semibold uppercase tracking-wide"},"Format",-1)),o("div",pn,[(d(),u(U,null,Z([{value:"csv",label:".csv"},{value:"json",label:".json"},{value:"html",label:".html"},{value:"txt",label:".txt"}],c=>o("button",{key:c.value,type:"button",onClick:L=>s.batchExportFormat=c.value,class:w(["rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors cursor-pointer",s.batchExportFormat===c.value?"bg-accent text-on-accent border-accent":"border-border text-muted bg-surface-2 hover:border-accent hover:text-foreground"])},m(c.label),11,gn)),64))])]),r.batchExportWillEmail?(d(),u("div",mn,[e[60]||(e[60]=o("label",{for:"batch-export-email",class:"text-muted mb-1 block text-xs font-semibold uppercase tracking-wide"}," Send export to ",-1)),o("p",hn," Large export ("+m(r.numCompletedImages)+" items) â the file will be emailed. ",1),C(o("input",{id:"batch-export-email","onUpdate:modelValue":e[21]||(e[21]=c=>s.batchExportEmail=c),type:"email",autocomplete:"email",inputmode:"email",placeholder:"[email protected]","aria-describedby":"batch-export-email-error",class:w(["border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border px-3 py-2 text-sm shadow-xs",s.batchExportEmailError?"border-red-400 focus:border-red-400 focus:ring-red-400/30":""]),onInput:e[22]||(e[22]=c=>s.batchExportEmailError="")},null,34),[[E,s.batchExportEmail,void 0,{trim:!0}]]),s.batchExportEmailError?(d(),u("p",fn,m(s.batchExportEmailError),1)):g("",!0)])):g("",!0),r.availableBatchExportLangs.length>1?(d(),u("div",xn,[e[61]||(e[61]=o("p",{class:"text-muted mb-1 text-xs font-semibold uppercase tracking-wide"},"Languages to export",-1)),o("div",bn,[o("button",{type:"button",onClick:e[23]||(e[23]=c=>s.batchExportSelectedLangs=s.batchExportSelectedLangs.length===r.availableBatchExportLangs.length?[]:[...r.availableBatchExportLangs]),class:w(["rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors cursor-pointer",s.batchExportSelectedLangs.length===r.availableBatchExportLangs.length?"bg-accent text-on-accent border-accent":"border-border text-muted bg-surface-2 hover:border-accent hover:text-foreground"])}," All Languages ("+m(r.availableBatchExportLangs.length)+") ",3),(d(!0),u(U,null,Z(r.availableBatchExportL
7angs,c=>(d(),u("button",{key:c,type:"button",onClick:()=>{s.batchExportSelectedLangs.length===r.availableBatchExportLangs.length?s.batchExportSelectedLangs=[c]:s.batchExportSelectedLangs.includes(c)?s.batchExportSelectedLangs.splice(s.batchExportSelectedLangs.indexOf(c),1):s.batchExportSelectedLangs.push(c)},class:w(["rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors cursor-pointer",s.batchExportSelectedLangs.includes(c)?"bg-accent text-on-accent border-accent":"border-border text-muted bg-surface-2 hover:border-accent hover:text-foreground"])},m(r.langCodeToName(c)),11,vn))),128))])])):g("",!0),s.batchExportFormat==="csv"?(d(),u(U,{key:2},[e[63]||(e[63]=o("hr",{class:"border-border"},null,-1)),o("div",null,[e[62]||(e[62]=o("p",{class:"text-muted mb-2 text-xs font-semibold uppercase tracking-wide"},"Optional Columns",-1)),o("div",yn,[(d(!0),u(U,null,Z(s.batchExportColumnOptions,c=>(d(),u("label",{key:c.key,class:"flex cursor-pointer items-center gap-2"},[C(o("input",{type:"checkbox","onUpdate:modelValue":L=>s.batchExportColumns[c.key]=L,class:"text-accent border-foreground
7/30 bg-surface-2 focus:ring-accent h-4 w-4 cursor-pointer rounded border",onKeydown:y(f(L=>s.batchExportColumns[c.key]=!s.batchExportColumns[c.key],["prevent"]),["enter"])},null,40,wn),[[Q,s.batchExportColumns[c.key]]]),o("span",In,m(c.label),1)]))),128))])])],64)):g("",!0),o("button",{type:"button",disabled:s.batchExportSelectedLangs.length===0||r.batchExportWillEmail&&!r.batchExportEmailValid,class:w(["inline-flex w-full items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-medium focus:outline-none",s.batchExportSelectedLangs.length===0||r.batchExportWillEmail&&!r.batchExportEmailValid?"bg-surface-2 text-muted cursor-not-allowed opacity-60":"bg-accent text-on-accent cursor-pointer hover:opacity-95"]),onClick:e[24]||(e[24]=(...c)=>r.handleBatchExport&&r.handleBatchExport(...c))},[r.batchExportWillEmail?(d(),M(j,{key:0,class:"h-4 w-4"})):(d(),M(R,{key:1,class:"h-4 w-4"})),I(" "+m(s.batchExportSelectedLangs.length===0?"Select a language":r.batchExportWillEmail?"Email File":`Download .${s.batchExportFormat}`),1)],10,kn)])],544)):g("",!0)])):g("",!0)])]),r.hasAltForCurrent?(d(),u("div",Sn,[r.availableLanguages.length>1&&r.currentImage?.status==="completed"&&s.activeTab!=="json"?(d(),u("div",Ln,[e[64]||(e[64]=o("label",{class:"text-muted mb-1 block text-xs font-medium"},"Language:",-1)),O(V,{languages:r.availableLanguages,selected:s.selectedLanguage,onChange:r.switchLanguage},null,8,["languages","selected","onChange"])])):g("",!0),r.availableLanguages.length>1&&r.currentImage?.status==="completed"&&s.activeTab==="json"?(d(),u("div",Cn,[e[65]||(e[65]=o("label",{class:"text-muted mb-1 block text-xs font-medium"},"Languages in JSON:",-1)),O(V,{languages:r.availableLanguages,selected:s.selectedJsonLangs,"multi-select":!0,onChange:r.updateJsonLangs},null,8,["languages","selected","onChange"])])):g("",!0),r.currentImage.errorMessage?(d(),u("div",Tn,m(r.currentImage.errorMessage),1)):g("",!0),o("div",An,[o("button",{type:"button",class:w(["cursor-pointer rounded-t-lg px-3 py-1.5 transition-colors",s.activeTab==="plain"?"bg-surface-2 text-foreground font-medium":"text-muted hover:text-foreground"]),onClick:e[28]||(e[28]=c=>r.setActiveTab("plain"))}," Plain Text ",2),o("button",{type:"button",class:w(["cursor-pointer rounded-t-lg px-3 py-1.5 transition-colors",s.activeTab==="html"?"bg-surface-2 text-foreground font-medium":"text-muted hover:text-foreground"]),onClick:e[29]||(e[29]=c=>r.setActiveTab("html"))}," HTML ",2),o("button",{type:"button",class:w(["cursor-pointer rounded-t-lg px-3 py-1.5 transition-colors",s.activeTab==="json"?"bg-surface-2 text-foreground font-medium":"text-muted hover:text-foreground"]),onClick:e[30]||(e[30]=c=>r.setActiveTab("json"))}," JSON ",2)]),o("div",_n,[o("label",En,m(r.getTabLabel(s.activeTab))+": ",1),o("div",Dn,[o("div",Pn,[s.activeTab==="plain"?C((d(),u("textarea",{key:0,"onUpdate:modelValue":e[31]||(e[31]=c=>s.editableAlt=c),rows:"3",maxlength:"1000","aria-label":"Generated plain alt text",class:"border-border bg-surface text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-brand-blue/30 block w-full rounded-lg border p-2.5 text-sm focus:ring-2"},null,512)),[[E,s.editableAlt]]):s.activeTab==="html"?C((d(),u("textarea",{key:1,"onUpdate:modelValue":e[32]||(e[32]=c=>s.htmlInput=c),maxlength:"1000","aria-label":"Generated HTML alt text",class:"border-border bg-surface text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-brand-blue/30 block w-full rounded-lg border p-2.5 text-sm focus:ring-2",rows:"3"},null,512)),[[E,s.htmlInput]]):s.activeTab==="json"?C((d(),u("textarea",{key:2,"onUpdate:modelValue":e[33]||(e[33]=c=>s.jsonOutput=c),readonly:"","aria-label":"Generated alt text JSON",class:"border-border bg-surface text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-brand-blue/30 block w-full rounded-lg border p-2.5 text-sm focus:ring-2",rows:"8"},null,512)),[[E,s.jsonOutput]]):g("",!0),s.activeTab==="plain"||s.activeTab==="html"?(d(),u("div",On,[o("span",{class:w(["text-xs",(s.activeTab==="plain"?s.editableAlt:s.htmlInput).length>=1e3?"text-red-500":(s.activeTab==="plain"?s.editableAlt:s.htmlInput).length>=900?"text-amber-500":"text-muted"])},m((s.activeTab==="plain"?s.editableAlt:s.htmlInput).length)+"/1000 ",3)])):g("",!0)]),o("button",{type:"button",class:"border-border bg-surface text-foreground hover:bg-surface cursor-pointer rounded-lg border px-3 py-2 text-sm font-medium focus:ring-2 focus:ring-brand-blue/30 focus:outline-none",onClick:e[34]||(e[34]=c=>r.copyToClipboard(r.getTabContent()))}," Copy ")]),o("div",Un,[o("div",Mn,[o("div",Vn,[o("button",{type:"button",class:w(["inline-flex cursor-pointer items-center flex-wrap justify-center gap-x-2 gap-y-0.5 rounded-lg px-4 py-2 text-sm font-medium focus:ring-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",r.insufficientForSingle?"bg-red-600 text-white hover:bg-red-700 focus:ring-red-300":"bg-purple-700 text-on-accent hover:bg-purple-800 focus:ring-purple-300 dark:bg-purple-600 dar
7k:hover:bg-purple-700"]),disabled:s.isGenerating||s.isGeneratingAll||r.insufficientForSingle,onClick:e[35]||(e[35]=(...c)=>r.regenerate&&r.regenerate(...c))},[s.isGenerating?(d(),M(h,{key:0,class:"h-4 w-4 animate-spin"})):(d(),M(v,{key:1,class:"h-4 w-4"})),o("span",null,m(s.isGenerating?"Generating...":r.insufficientForSingle?"Not enough credits":"Regenerate"),1),!s.isGenerating&&!r.insufficientForSingle?(d(),u("span",Fn,"(Overwrites Result)")):g("",!0),o("span",{class:w(["rounded-full px-2 py-0.5 text-[11px] font-semibold",r.insufficientForSingle?"bg-white/20":"bg-canvas/20"])},m(r.singleCredits)+" credit"+m(r.singleCredits!==1?"s":""),3)],10,Bn),o("div",Rn,[o("div",Nn,[r.insufficientForSingle?(d(),u(U,{key:0},[I(" Need "+m(r.singleCredits)+" credits, you have "+m(r.availableCredits),1)],64)):(d(),u(U,{key:1},[I(m(n.createStore.options.textLength==="detailed"?"Detailed":"Normal")+" ("+m(n.createStore.options.textLength==="detailed"?"2":"1")+") Ã "+m(n.createStore.options.languages.length)+" language"+m(n.createStore.options.languages.length!==1?"s":""),1)],64))]),e[66]||(e[66]=o("div",{class:"border-foreground absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-current"},null,-1))])]),o("button",{type:"button",disabled:s.isGenerating||s.isGeneratingAll,class:"border-border bg-surface text-foreground hover:bg-surface-2 cursor-pointer rounded-lg border px-4 py-2 text-sm font-medium focus:ring-2 focus:ring-brand-blue/30 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",onClick:e[36]||(e[36]=(...c)=>r.startNewImage&&r.startNewImage(...c))}," New image ",8,Hn)]),o("div",jn,[r.isEdited?(d(),u("button",{key:0,type:"button",class:"text-accent cursor-pointer text-sm font-medium hover:underline focus:outline-none",onClick:e[37]||(e[37]=(...c)=>r.saveEdits&&r.saveEdits(...c))}," Save Changes ")):g("",!0),o("div",{class:"download-dropdown relative",onKeydown:e[43]||(e[43]=(...c)=>r.onDownloadKeydown&&r.onDownloadKeydown(...c))},[o("button",{id:"downloadAsButton",type:"button",onClick:e[38]||(e[38]=(...c)=>r.toggleDownloadDropdown&&r.toggleDownloadDropdown(...c)),class:"text-muted hover:bg-surface hover:text-foreground inline-flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1 text-sm font-medium focus:ring-2 focus:ring-brand-blue/30 focus:outline-none"},[e[68]||(e[68]=I(" Download as ",-1)),(d(),u("svg",{class:w(["h-4 w-4 transition-transform duration-200",{"rotate-180":s.showDownloadDropdown}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e[67]||(e[67]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)]),2))]),s.showDownloadDropdown?(d(),u("div",Kn,[o("div",Gn,[o("button",{onClick:e[39]||(e[39]=c=>r.downloadAs("txt")),class:"text-foreground hover:bg-surface-2 focus:bg-surface-2 flex w-full cursor-pointer items-center rounded-md px-3 py-2 text-sm focus:outline-none"},e[69]||(e[69]=[o("span",{class:"font-mono text-xs"}," .txt ",-1),o("span",{class:"text-muted ml-2 text-xs"}," Plain Text ",-1)])),o("button",{onClick:e[40]||(e[40]=c=>r.downloadAs("html")),class:"text-foreground hover:bg-surface-2 focus:bg-surface-2 flex w-full cursor-pointer items-center rounded-md px-3 py-2 text-sm focus:outline-none"},e[70]||(e[70]=[o("span",{class:"font-mono text-xs"}," .html ",-1),o("span",{class:"text-muted ml-2 text-xs"}," HTML ",-1)])),o("button",{onClick:e[41]||(e[41]=c=>r.downloadAs("csv")),class:"text-foreground hover:bg-surface-2 focus:bg-surface-2 flex w-full cursor-pointer items-center rounded-md px-3 py-2 text-sm focus:outline-none"},e[71]||(e[71]=[o("span",{class:"font-mono text-xs"}," .csv ",-1),o("span",{class:"text-muted ml-2 text-xs"}," CSV ",-1)])),o("button",{onClick:e[42]||(e[42]=c=>r.downloadAs("json")),class:"text-foreground hover:bg-surface-2 focus:bg-surface-2 flex w-full cursor-pointer items-center rounded-md px-3 py-2 text-sm focus:outline-none"},e[72]||(e[72]=[o("span",{class:"font-mono text-xs"}," .json ",-1),o("span",{class:"text-muted ml-2 text-xs"}," JSON ",-1)]))])])):g("",!0)],32)])])])])):g("",!0)],4)):g("",!0),n.imageCount>1?(d(),u("div",Zn,m(r.currentImageIndex+1)+" of "+m(n.imageCount),1)):g("",!0),O(F,{show:s.confirmClearAll,title:n.imageCount>1?"Clear all images?":"Clear image?",message:n.imageCount>1?"This will remove all uploaded images from the current session.":"This will remove the uploaded image from the current session.","confirm-text":n.imageCount>1?"Clear all":"Clear","cancel-text":"Cancel","show-input":!1,onConfirm:r.handleClearAll,onClose:e[44]||(e[44]=c=>s.confirmClearAll=!1)},null,8,["show","title","message","confirm-text","onConfirm"])])}const Wn=$(xo,[["render",zn]]),Jn={name:"InputImages",data(){const{showToast:t}=W();return{createStore:ae(),showToast:t,isFocused:!1,isURLFocused:!1,isScrapeURLFocused:!1,urlInput:!1,fileInput:!1,textInput:!1,scrapeInput:!1,csvInput:!1,mountGuard:!0,isDragOverCsv:!1,showTooltip:!1,urlInputValue:"",textVal:"",scrapeUrlVal:"",maxBatchImages:
7500,maxTotalImages:1e4,isScraping:!1,scrapingMode:null,isPasting:!1,isDragOver:!1}},computed:{isValidScrapeUrl(){const t=String(this.scrapeUrlVal||"").trim();if(!t)return!1;const e=t.includes("://")?t:`https://${t}`;return/^(ftp|https?):\/\/[^\s"]+\.[^\s"]+/.test(e)},uploadFileTypesText(){return"PNG, JPG, JPEG, WebP, or non-animated GIF"},pasteKeyHint(){if(typeof navigator<"u"){const t=navigator.userAgentData?.platform||navigator.platform||"";if(/mac/i.test(t))return"âV"}return"Ctrl+V"},isLikelyMobile(){return typeof navigator<"u"?navigator.maxTouchPoints>0&&!/windows/i.test(navigator.userAgent):!1},inputPresent(){return!!this.urlInput||!!this.fileInput||!!this.textInput||!!this.scrapeInput||!!this.csvInput},textAreaClasses(){const t=["rounded-lg","border","border-border","px-3","py-2","w-full","text-sm"];return this.textInput?t.push("h-[40.7rem]","max-h-[39.75rem]"):t.push("h-full","max-h-[20rem]"),t}},mounted(){setTimeout(()=>{this.mountGuard=!1},100),(this._.provides[_e]||this.$route)?.query?.csv==="true"&&(this.csvInput=!0,this.$router.replace({query:{}})),document.addEventListener("paste",this.handlePaste),window.addEventListener("dragover",this.preventWindowDrag,!1),window.addEventListener("drop",this.preventWindowDrag,!1)},beforeUnmount(){document.removeEventListener("paste",this.handlePaste),window.removeEventListener("dragover",this.preventWindowDrag,!1),window.removeEventListener("drop",this.preventWindowDrag,!1)},methods:{closeTextInput(){this.textInput=!1,this.textVal=""},clearTextInput(){this.textVal?(this.textVal="",this.handleMultiURLBlur(),this.closeTextInput()):(this.closeTextInput(),this.handleMultiURLBlur()),this.$nextTick(()=>{const t=this.$refs.multiURLInput;t&&(t.style.height="")})},handleBack(){if(this.csvInput){this.csvInput=!1;return}if(this.textInput){this.closeTextInput(),this.$nextTick(()=>{const t=this.$refs.multiURLInput;t&&(t.style.height="")});return}if(this.scrapeInput){this.closeScrapeInput();return}},handleURLFocus(){this.isURLFocused=!0,!this.urlInput&&this.urlInputValue&&(this.urlInput=!0)},handleURLBlur(){this.isURLFocused=!1;const t=this.$refs.URLInput;t&&t.blur(),x.trim(this.urlInputValue)===""&&(this.urlInput=!1,this.urlInputValue="")},handleScrapeURLFocus(){this.isScrapeURLFocused=!0,!this.scrapeInput&&this.scrapeUrlVal&&(this.scrapeInput=!0)},handleScrapeURLBlur(){this.isScrapeURLFocused=!1;const t=this.$refs.ScrapeURLInput;t&&t.blur(),x.trim(this.scrapeUrlVal)===""&&(this.scrapeInput=!1,this.scrapeUrlVal="")},handleScrapeURLInput(t){const e=t.target;e&&(this.scrapeUrlVal=e.value,this.scrapeInput=x.trim(this.scrapeUrlVal)!=="")},handleMultiURLFocus(){this.isFocused=!0,!this.textInput&&this.textVal&&(this.textInput=!0,this.isURLFocused=!1,this.urlInput=!1)},handleMultiURLBlur(){const t=this.$refs.multiURLInput;t&&t.blur(),this.isFocused=!1,x.trim(this.textVal)===""&&(this.textInput=!1,this.$nextTick(()=>{const e=this.$refs.multiURLInput;e&&(e.style.height="")}))},clearURL(){this.urlInputValue="",this.urlInput=!1,this.createStore.clearEmptyUrlData(),this.createStore.removeDuplicateUrls(),this.$nextTick(()=>{const t=this.$refs.URLInput;t&&t.focus()})},clearScrapeURL(){this.scrapeUrlVal="",this.scrapeInput=!1,this.$nextTick(()=>{const t=this.$refs.ScrapeURLInput;t&&t.focus()})},closeScrapeInput(){this.isScrapeURLFocused=!1,this.scrapeInput=!1,this.scrapeUrlVal=""},handleURLInput(t){const e=t.target;e&&(this.urlInputValue=e.value,x.trim(this.urlInputValue)===""?this.urlInput=!1:this.urlInput=!0)},handleFileInput(t){if(this.isPasting)return;const e=t.target;if(!e.files||e.files.length===0){this.fileInput=!1;return}for(const a of Array.from(e.files)){if(a.name.endsWith(".csv")||a.type==="text/csv"){this.processCsvFile(a),e.value="";return}this.processImageFile(a)}e.value=""},preventWindowDrag(t){t.preventDefault()},handleDragLeave(t){t.currentTarget.contains(t.relatedTarget)||(this.isDragOver=!1)},async handleDrop(t){this.isDragOver=!1;const e=t.dataTransfer;if(!e)return;const a=[];if(e.items&&e.items.length>0){const s=[];for(const r of Array.from(e.items)){const i=r.webkitGetAsEntry?.();if(i)i.isDirectory?s.push(this.readDirEntries(i,a)):i.isFile&&s.push(new Promise(l=>{i.file(p=>{a.push(p),l()},()=>l())}));else{const l=r.getAsFile?.();l&&a.push(l)}}await Promise.all(s)}else a.push(...Array.from(e.files));if(a.length>0){for(const s of a){if(s.name.endsWith(".csv")||s.type==="text/csv"){this.processCsvFile(s);return}s.type.startsWith("image/")&&this.processImageFile(s)}return}
7const n=e.getData("text/uri-list")||e.getData("text/plain");if(n){const s=n.split(` 8`).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#"));for(const r of s)/^https?:\/\//.test(r)&&this.validateImageURL(r)}},async readDirEntries(t,e){const a=t.createReader(),n=async()=>{const s=await new Promise((i,l)=>{a.readEntries(i,l)});if(!s.length)return;const r=[];for(const i of s)i.isFile?r.push(new Promise(l=>{i.file(p=>{e.push(p),l()},()=>l())})):i.isDirectory&&r.push(this.readDirEntries(i,e));await Promise.all(r),await n()};await n()},handlePaste(t){const e=t.target;if(e.tagName==="INPUT"||e.tagName==="TEXTAREA")return;if(this.csvInput){const n=t.clipboardData?.items;if(n){for(const r of Array.from(n))if(r.type==="text/plain"||r.kind==="file"){const i=r.getAsFile();if(i){t.preventDefault(),this.processCsvFile(i);return}}const s=t.clipboardData?.getData("text");if(s?.trim()){t.preventDefault(),this.processCsvContent(s);return}}return}const a=t.clipboardData?.items;if(a){for(const n of Array.from(a))if(n.type.startsWith("image/")){const s=n.getAsFile();if(s){t.preventDefault(),this.isPasting=!0,this.processImageFile(s),setTimeout(()=>{this.isPasting=!1},500);return}}}},processImageFile(t,e){if(!["image/png","image/jpeg","image/jpg","image/webp","image/gif"].includes(t.type)){this.showToast(`Unsupported file type. Please use ${this.uploadFileTypesText}.`,"error"),e?.();return}if(t.size>20971520){this.showToast("File size must be less than 20MB.","error"),e?.();return}const s=new Image,r=URL.createObjectURL(t);s.onload=()=>{if(this.capExceeded(1)){URL.revokeObjectURL(r),e?.();return}this.fileInput=!0,this.createStore.appendImageFromFile(t,r)},s.onerror=()=>{this.showToast("Could not load the image. Please try another file.","error"),e?.(),URL.revokeObjectURL(r)},s.src=r},handleTextInput(t){const e=t.target;if(!e)return;e.value===""?this.textInput=!1:this.textInput=!0},hasUnsupportedExtension(t){const e=["svg","bmp","tiff","tif","ico","avif","heic","heif","pdf"];try{const n=new URL(t).pathname.split(".").pop()?.toLowerCase()||"";return e.includes(n)}catch{return!1}},capExceeded(t=1){return this.createStore.validImages.length+t>this.maxTotalImages?(this.showToast(`Woah, that's a lot of images! The cap is ${this.maxTotalImages.toLocaleString()} images at one time. You can add the additional images in a separate session. If you need more than ${this.maxTotalImages.toLocaleString()} at a time, please contact [email protected]`,"error",1e4),!0):!1},submitURL(){const t=this.urlInputValue;if(!/^(ftp|http|https):\/\/[^ "]+$/.test(String(t))){alert("Please enter a valid URL (e.g., https://www.example.com/image.jpg)");return}this.validateImageURL(t)},async submitScrapeUrl(t="all"){let e=this.scrapeUrlVal;if(typeof e=="string"&&e&&!e.includes("://")&&(e=`https://${e}`,this.scrapeUrlVal=e),!/^(ftp|http|https):\/\/[^ "]+$/.test(String(e))){alert("Please enter a valid webpage URL (e.g., https://www.example.com)");return}if(/\.(jpg|jpeg|png|gif|webp|svg|bmp|ico|avif|tiff?)(\?.*)?$/i.test(String(e))){const s=String(e).replace(/ /g,"%20");this.createStore.appendImageFromUrl(s),this.createStore.clearEmptyUrlData(),this.createStore.removeDuplicateUrls(),this.showToast("Image URL added","success"),this.scrapeUrlVal="";return}this.isScraping=!0,this.scrapingMode=t;try{const s=localStorage.getItem("auth_token"),r=pe().public.apiBaseUrl||"https://api.alttextstudio.com/api",i=await fetch(`${r}/scrape`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({webpage_url:e})}),l=await i.json();if(!i.ok){this.showToast(l.message||"Failed to scrape webpage","error");return}let p=t==="missing"?l.images_missing_alt||[]:l.images||[];const b=t==="missing"?l.total_missing_alt||0:l.total_found||0;if(p.length===0){this.showToast(t==="missing"?"All images on that page already have alt text.":"No images found on that page.",t==="missing"?"info":"error");return}if(b>this.maxBatchImages&&(this.showToast(`Found ${b} images â only the first ${this.maxBatchImages} have been added. Any additional images can be linked individually via Image URL or pasted into the Multiple URLs field.`,"info",1e4),p=p.slice(0,this.maxBatchImages)),this.capExceeded(p.length))return;this.createStore.setImageDataArrayFromScrape(p,l.page_context||null,l.image_contexts||null),this.createStore.clearEmptyUrlData(),this.createStore.removeDuplicateUrls(),this.clearScrapeURL()}catch{this.showToast("Unable to scrape this page. Please try again.","error")}finally{this.isScraping=!1,this.scrapingMode=null}},validateImageURL(t){if(this.hasUnsupportedExtension(t)){this.showToast("Unsupported image format. Please use PNG, JPG, WebP, or GIF.","error");return}const e=new Image;e.onload=()=>
8{if(e.naturalWidth>0&&e.naturalHeight>0){if(this.capExceeded(1))return;this.createStore.setImageDataArray([t]),this.urlInputValue="",this.urlInput=!1,this.createStore.clearEmptyUrlData(),this.createStore.removeDuplicateUrls(),this.$nextTick(()=>{const a=this.$refs.URLInput;a&&a.focus()})}else alert("The URL does not point to a valid image. Please check the URL and try again.")},e.onerror=()=>{alert("Could not load image from this URL. Some hosts (e.g. Wikipedia) block direct image fetching â try downloading the file and uploading it instead.")},e.src=t},submitTextInput(){if(!this.textVal.trim()){alert("Please enter some content first.");return}const t=/<img[^>]*src="([^"]+)"[^>]*>/gi,e=/(https?:\/\/[^\s,]+)/g,a=[];let n;for(;(n=t.exec(this.textVal))!==null;)n[1]&&a.push(n[1]);const s=this.textVal.match(e)||[];a.push(...s);const i=[...new Set(a)].filter(p=>/^(ftp|http|https):\/\/[^ "]+$/.test(String(p)));if(i.length===0){alert("No valid image URLs found. Please check your input and try again.");return}let l=i;i.length>this.maxBatchImages&&(alert(`You can upload up to ${this.maxBatchImages} images per batch. Only the first ${this.maxBatchImages} will be processed.`),l=i.slice(0,this.maxBatchImages)),this.validateMultipleImageURLs(l)},async validateMultipleImageURLs(t){const e=t.filter(s=>!this.hasUnsupportedExtension(s)),a=t.length-e.length;if(a>0&&this.showToast(`${a} unsupported image${a>1?"s":""} skipped (SVG, BMP, etc.). Use PNG, JPG, WebP, or GIF.`,"info",5e3),t=e,t.length===0){this.finishTextInputSubmission();return}if(this.capExceeded(t.length))return;const n=20;for(let s=0;s<t.length;s+=n){const r=t.slice(s,s+n);await Promise.all(r.map(i=>new Promise(l=>{const p=new Image;p.onload=()=>{p.width>0&&p.height>0&&this.createStore.appendImageFromUrl(i),l()},p.onerror=()=>{l()},p.src=i})))}this.finishTextInputSubmission()},finishTextInputSubmission(){this.textVal="",this.textInput=!1,this.createStore.clearEmptyUrlData(),this.createStore.removeDuplicateUrls(),this.$nextTick(()=>{const t=this.$refs.multiURLInput;t&&t.focus()})},downloadCsvTemplate(){const t=["image_name","image_url","alt_text_en","brand","product","primary_color","secondary_color","seo_keywords","negative_keywords","custom_prompt","text_length","created_at"],e=[["iPhone 17 Pro Max - Cosmic Orange","https://example.com/iphone-17-pro-max.jpg","Apple iPhone 17 Pro Max in Cosmic Orange finish on a white surface","Apple","iPhone 17 Pro Max","Cosmic Orange","Black","sleek | smartphone | pro camera | titanium","cheap | refurbished","","Normal","2026-03-15T14:30:00Z"],["Mountain Lake Sunset","https://example.com/mountain-lake.jpg","","","","","","nature | landscape | scenic | travel","","","Detailed","2026-03-20T09:00:00Z"],["Office Team Photo","https://example.com/team-photo.jpg","","","","","","","","Focus on the people and their expressions","Normal","2026-03-25T16:45:00Z"]],a=l=>`"${String(l).replace(/"/g,'""')}"`,n=[t,...e].map(l=>l.map(a).join(",")).join(` 9`),s=new Blob([n],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(s),i=document.createElement("a");i.href=r,i.download="Alt-Text-Studio-csv-template.csv",i.click(),URL.revokeObjectURL(r)},async handleCsvImport(t){const e=t.target,a=e.files?.[0];e.value="",a&&await this.processCsvFile(a)},handleCsvDragLeave(t){const e=t.relatedTarget;(!e||!t.currentTarget.contains(e))&&(this.isDragOverCsv=!1)},async handleCsvDrop(t){this.isDragOverCsv=!1;const e=t.dataTransfer?.files[0];e&&await this.processCsvFile(e)},async processCsvFile(t){try{const e=await t.text();await this.processCsvContent(e)}catch{this.showToast("Failed to parse CSV","error")}},async processCsvContent(t){const a=t.replace(/^\uFEFF/,"").split(/\r\n|\r|\n/).filter(B=>B.trim());if(a.length<2){this.showToast("CSV must have at least one data row","error");return}const n=this.parseCsvLine(a[0]).map(B=>B.toLowerCase().replace(/ /g,"_").trim()),s=n.indexOf("url")!==-1?n.indexOf("url"):n.indexOf("image_url");
9if(s===-1){this.showToast("CSV must have a URL or Image URL column","error");return}const r=(B,...Y)=>{for(const k of[B,...Y]){const K=n.indexOf(k);if(K!==-1)return K}return-1},i=r("image_name","name","asset_id"),l=r("brand","ecomm_brand"),p=r("product","ecomm_product"),b=r("primary_color","color","ecomm_color"),h=r("seo_keywords","keywords"),v=r("negative_keywords"),_=r("custom_prompt","gpt_prompt"),P=r("text_length"),j=r("ai_model"),R=r("lang"),V=me,F=[];n.forEach((B,Y)=>{if(B.startsWith("alt_text_")&&B!=="alt_text"){const k=B.slice(9),K=k.replace(/_/g,"-"),A=V.find(S=>S.code.toLowerCase()===K)||V.find(S=>S.code.toLowerCase()===k);F.push({idx:Y,langCode:A?A.code:K})}});const c=F.length===0?r("alt_text"):-1,L=r("language");let N=0;for(let B=1;B<a.length;B++){const Y=this.parseCsvLine(a[B]),k=A=>A!==-1?(Y[A]||"").trim():"",K=(Y[s]||"").trim();if(K){this.createStore.appendImageFromUrl(K);const A=this.createStore.imageData.find(S=>S.url===K);if(A){if(i!==-1&&k(i)&&(A.name=k(i),A.nameIsUserSet=!0),l!==-1&&k(l)&&(A.options.ecommerce.brand=k(l)),p!==-1&&k(p)&&(A.options.ecommerce.product=k(p)),b!==-1&&k(b)&&(A.options.ecommerce.primary_color=k(b)),h!==-1&&k(h)){const S=k(h),z=S.includes("|")?"|":",";A.options.seoKeywords=S.split(z).map(G=>G.trim()).filter(Boolean)}if(v!==-1&&k(v)){const S=k(v),z=S.includes("|")?"|":",";A.options.negativeKeywords=S.split(z).map(G=>G.trim()).filter(Boolean)}if(_!==-1&&k(_)&&(A.options.customPrompt=k(_)),R!==-1&&k(R)){const S=k(R).split(/[\s,|]+/).filter(Boolean);S.length>0&&(A.options.languages=S)}if(P!==-1){const S=k(P).toLowerCase();(S==="normal"||S==="detailed")&&(A.options.textLength=S)}if(j!==-1){const S=k(j).toLowerCase();S.includes("nano")?A.options.aiModel="gpt-5-nano":S.includes("gpt")&&S.includes("5")&&(A.options.aiModel="gpt-5")}if(F.length>0)for(const{idx:S,langCode:z}of F){const G=k(S);G&&(A.results[z]=G)}else if(c!==-1&&k(c)){const S=L!==-1?k(L):"";let z="en";if(S){const G=V.find(ke=>ke.name.toLowerCase()===S.toLowerCase());G&&(z=G.code)}A.results[z]=k(c)}!A.alt&&Object.keys(A.results).length>0&&(A.alt=Object.values(A.results)[0])}N++}}N===0?this.showToast("No image URLs found in CSV","error"):(this.createStore.clearEmptyUrlData(),this.createStore.removeDuplicateUrls(),this.showToast(`${N} image URL${N!==1?"s":""} loaded from CSV`,"success"),this.csvInput=!1)},parseCsvLine(t){const e=[];let a="",n=!1;for(let s=0;s<t.length;s++){const r=t[s];r==='"'?n&&t[s+1]==='"'?(a+='"',s++):n=!n:r===","&&!n?(e.push(a),a=""):a+=r}return e.push(a),e}}},qn={class:"w-full text-sm"},Yn={id:"input-section",class:"bg-surface relative mt-2 flex w-full flex-col rounded-lg px-4 pt-2 pb-4 shadow-md"},Qn={class:"flex items-center justify-between gap-x-2"},Xn={class:"flex justify-between"},$n={key:0,for:"input-section",class:"mb-1 block text-2xl font-bold"},ea={key:0,class:"relative mb-4 w-full"},ta={class:"relative"},sa={key:0,class:"absolute inset-y-0 right-0 flex items-center pr-2"},ra={key:0,class:"mt-2 flex justify-end"},oa={key:1,class:"flex w-full items-center gap-2 py-3"},na={key:2,class:"relative mb-4 w-full"},aa={class:"relative"},la={key:0,class:"absolute inset-y-0 right-0 flex items-center pr-2"},ia={key:0,class:"mt-2 flex justify-end gap-2"},da=["disabled"],ua=["disabled"],ca={key:3,class:"flex w-full items-center gap-2 py-3"},pa={key:4,class:"relative mb-4 w-full pt-3"},ga={class:"flex w-full items-center justify-center"},ma={class:"flex flex-col items-center justify-center pt-5 pb-6"},ha={class:"text-muted mb-2 text-sm"},fa={key:0},xa={class:"border-border bg-surface rounded border px-1 py-0.5 text-xs font-mono"},ba={class:"text-muted text-center text-xs"},va={key:5,class:"flex w-full items-center gap-2 py-3"},ya={key:6,class:"flex w-full flex-col"},wa={class:"mb-1 flex items-center justify-between"},Ia={key:0,class:"absolute top-0 right-0 flex -translate-y-1/2 transform flex-row items-center gap-2"},ka={key:7,class:"flex w-full flex-col gap-4 py-2"},Sa={class:"text-muted mb-2 text-sm"},La={key:0},Ca={class:"border-border bg-surface rounded border px-1 py-0.5 text-xs font-mono"},Ta={class:"border-border rounded-lg border p-3"},Aa={class:"flex flex-col gap-1.5"};function _a(t,e,a,n,s,r){const i=ge;return d(),u("div",qn,[o("div",Yn,[o("div",Qn,[o("div",Xn,[!s.textInput&&!s.csvInput||s.urlInput||s.scrapeInput?(d(),u("label",$n," Input ")):(d(),u("button",{key:1,type:"button",class:"bg-accent text-on-accent inline-flex cursor-pointer items-center rounded-lg px-3 py-2 text-center text-sm font-medium hover:opacity-95 focus:ring-2 focus:ring-accent focus:ring-offset-2 focus:outline-none",onClick:e[0]||(e[0]=(...l)=>r.handleBack&&r.handleBack(...l))},e[40]||(e[40]=[o("svg",{class:"me-2 h-6 w-6 text-current","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[o("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14M5 12l4-4m-4 4 4 4"})],-1),I(" Back ",-1)])))])]),!s.textInput&&!s.csvInput?(d(),u("div",ea,[e[41]||(e[41]=o("label",{for:"url",class:"text-foreground mb-1 block font-semibold"}," Image URL ",-1)),o("div",ta,[C(o("input",{id:"url",ref:"URLInput","onUpdate:modelValue":e[1]||(e[1]=l=>s.urlInputValue=l),type:"url",maxlength:"2048",placeholder:"https://www.example.com/image.jpg",class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2.5 pr-8 text-sm",onBlur:e[2]||(e[2]=(...l)=>r.handleURLBlur&&r.handleURLBlur(...l)),onFocus:e[3]||(e[3]=(...l)=>r.handleURLFocus&&r.handleURLFocus(...l)),onInput:e[4]||(e[4]=(...l)=>r.handleURLInput&&r.handleURLInput(...l))},null,544),[[E,s.urlInputValue,void 0,{trim:!0}]]),s.urlInputValue?(d(),u("div",sa,[o("button",{type:"button","aria-label":"Clear URL",class:"border-border bg-surface dark:bg-surface-2 text-foreground hover:bg-surface-2 dark:hover:bg-surface cursor-pointer rounded-md border px-2 py-1.5 text-xs font-medium focus:ring-2 focus:ring-brand-blue/20 focu
9s:outline-none",onMousedown:e[5]||(e[5]=f(()=>{},["prevent"])),onClick:e[6]||(e[6]=f((...l)=>r.clearURL&&r.clearURL(...l),["prevent"]))},[O(i,{class:"text-muted dark:text-foreground h-4 w-4"})],32)])):g("",!0)]),s.urlInputValue?(d(),u("div",ra,[o("button",{type:"button",class:"bg-accent text-on-accent cursor-pointer rounded-md px-4 py-2 text-sm font-medium hover:opacity-95 focus:ring-2 focus:ring-accent focus:ring-offset-2 focus:outline-none",onClick:e[7]||(e[7]=(...l)=>r.submitURL&&r.submitURL(...l))}," Upload ")])):g("",!0)])):g("",!0),!s.textInput&&!s.csvInput?(d(),u("div",oa,e[42]||(e[42]=[o("hr",{class:"border-border flex-grow border-t"},null,-1),o("span",{class:"text-muted text-lg font-medium"},"or",-1),o("hr",{class:"border-border flex-grow border-t"},null,-1)]))):g("",!0),!s.textInput&&!s.csvInput?(d(),u("div",na,[e[43]||(e[43]=o("label",{for:"scrape-url",class:"text-foreground mb-1 block font-semibold"}," Scrape Webpage ",-1)),o("div",aa,[C(o("input",{id:"scrape-url",ref:"ScrapeURLInput","onUpdate:modelValue":e[8]||(e[8]=l=>s.scrapeUrlVal=l),type:"url",maxlength:"2048",placeholder:"https://www.example.com",class:"border-border bg-surface-2 text-foreground placeholder:text-muted-2 focus:border-accent focus:ring-accent block w-full rounded-lg border p-2.5 pr-8 text-sm",onFocus:e[9]||(e[9]=(...l)=>r.handleScrapeURLFocus&&r.handleScrapeURLFocus(...l)),onBlur:e[10]||(e[10]=(...l)=>r.handleScrapeURLBlur&&r.handleScrapeURLBlur(...l)),onInput:e[11]||(e[11]=(...l)=>r.handleScrapeURLInput&&r.handleScrapeURLInput(...l))},null,544),[[E,s.scrapeUrlVal,void 0,{trim:!0}]]),s.scrapeUrlVal?(d(),u("div",la,[o("button",{type:"button","aria-label":"Clear scrape URL",class:"border-border bg-surface dark:bg-surface-2 text-foreground hover:bg-surface-2 dark:hover:bg-surface cursor-pointer rounded-md border px-2 py-1.5 text-xs font-medium focus:ring-2 focus:ring-brand-blue/20 focus:outline-none",onMousedown:e[12]||(e[12]=f(()=>{},["prevent"])),onClick:e[13]||(e[13]=f((...l)=>r.clearScrapeURL&&r.clearScrapeURL(...l),["prevent"]))},[O(i,{class:"text-muted dark:text-foreground h-4 w-4"})],32)])):g("",!0)]),s.scrapeUrlVal?(d(),u("div",ia,[o("button",{type:"button",disabled:s.isScraping||!r.isValidScrapeUrl,class:"bg-accent text-on-accent cursor-pointer rounded-md px-4 py-2 text-sm font-medium hover:opacity-95 focus:ring-2 focus:ring-accent focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",onClick:e[14]||(e[14]=l=>r.submitScrapeUrl("all"))},m(s.scrapingMode==="all"?"Scraping...":"Scrape All Images"),9,da),o("button",{type:"button",disabled:s.isScraping||!r.isValidScrapeUrl,class:"border-accent text-accent cursor-pointer rounded-md border bg-transparent px-4 py-2 text-sm font-medium hover:bg-accent/10 focus:ring-2 focus:ring-accent focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",onClick:e[15]||(e[15]=l=>r.submitScrapeUrl("missing"))},m(s.scrapingMode==="missing"?"Scraping...":"Scrape Images Missing Alt Text"),9,ua)])):g("",!0)])):g("",!0),!s.textInput&&!s.csvInput?(d(),u("div",ca,e[44]||(e[44]=[o("hr",{class:"border-border flex-grow border-t"},null,-1),o("span",{class:"text-muted text-lg font-medium"},"or",-1),o("hr",{class:"border-border flex-grow border-t"},null,-1)]))):g("",!0),!s.textInput&&!s.csvInput?(d(),u("div",pa,[e[50]||(e[50]=o("label",{for:"dropzone-file",class:"text-foreground mb-1 block font-semibold"}," Image Upload ",-1)),o("div",ga,[o("label",{for:"dropzone-file",tabindex:"0",role:"button","aria-label":"Upload image files",class:w(["flex h-64 w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors focus:outline-none focus:ring-2 focus:ring-accent",s.isDragOver?"border-accent bg-accent/10":"border-border bg-surface-2 hover:bg-surface"]),onKeydown:[e[17]||(e[17]=y(f(l=>t.$refs.dropzoneFileInput?.click(),["prevent"]),["enter"])),e[18]||(e[18]=y(f(l=>t.$refs.dropzoneFileInput?.click(),["prevent"]),["space"]))],onDragenter:e[19]||(e[19]=f(l=>s.isDragOver=!0,["prevent"])),onDragover:e[20]||(e[20]=f(l=>s.isDragOver=!0,["prevent"])),onDragleave:e[21]||(e[21]=(...l)=>r.handleDragLeave&&r.handleDragLeave(...l)),onDrop:e[22]||(e[22]=f((...l)=>r.handleDrop&&r.handleDrop(...l),["prevent"]))},[o("div",ma,[e[48]||(e[48]=o("svg",{class:"text-muted mb-4 h-8 w-8","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 16"},[o("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"})],-1)),o("p",ha,[e[46]||(e[46]=o("span",{class:"font-semibold"}," Click to upload ",-1)),e[47]||(e[47]=I(" , drag and drop",-1)),r.isLikelyMobile?g("",!0):(d(),u("span",fa,[e[45]||(e[45]=I(", or paste ",-1)),o("kbd",xa,m(r.pasteKeyHint),1)]))]),o("p",ba,m(r.uploadFileTypesText)+" · folders supported (Max. 20MB per image) ",1),e[49]||(e[49]=o("p",{class:"text-muted-2 mt-2 max-w-[560px] text-center text-[11px] leading-snug"}," Uploading a file here does not store it in your library. To see a preview in your library, host the image elsewhere (e.g., Cloudinary, Imgur) and paste the image URL instead. ",-1))]),o("input",{id:"dropzone-file",ref:"dropzoneFileInput",type:"file",multiple:"",class:"hidden",onChange:e[16]||(e[16]=(...l)=>r.handleFileInput&&r.handleFileInput(...l))},null,544)],34)])])):g("",!0),!s.textInput&&!s.csvInput?(d(),u("div",va,e[51]||(e[51]=[o("hr",{class:"border-border flex-grow border-t"},null,-1),o("span",{class:"text-muted text-lg font-medium"},"or",-1),o("hr",{class:"border-border flex-grow border-t"},null,-1)]))):g("",!0),s.csvInput?g("",!0):(d(),u("div",ya,[o("div",{class:w(["relative",s.textInput?"mt-2":"mt-0"])},[o("div",wa,[e[53]||(e[53]=o("label",{for:"text",class:"text-foreground font-semibold"}," Multiple URLs or HTML ",-1)),s.textInput?g("",!0):(d(),u("button",{key:0,t
9ype:"button",onClick:e[23]||(e[23]=l=>!s.mountGuard&&(s.csvInput=!0)),class:"border-border bg-surface text-foreground hover:bg-surface-2 focus:ring-accent inline-flex cursor-pointer items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs focus:ring-2 focus:outline-none"},e[52]||(e[52]=[o("svg",{class:"h-3.5 w-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})],-1),I(" Import CSV ",-1)])))]),s.textInput&&s.textVal?(d(),u("div",Ia,[o("button",{type:"button",class:"cursor-pointer rounded-lg border border-red-700 px-3 py-2 text-center text-sm font-medium text-red-700 hover:bg-red-800 hover:text-canvas focus:ring-4 focus:ring-red-300 focus:outline-none",onMousedown:e[24]||(e[24]=f((...l)=>r.clearTextInput&&r.clearTextInput(...l),["prevent"]))}," Clear ",32),o("button",{type:"button",class:"bg-accent text-on-accent cursor-pointer rounded-md px-3 py-2 text-sm font-medium hover:opacity-95 focus:ring-2 focus:ring-accent focus:ring-offset-2 focus:outline-none",onClick:e[25]||(e[25]=(...l)=>r.submitTextInput&&r.submitTextInput(...l))}," Upload ")])):g("",!0)],2),o("div",{class:w([["border-border bg-surface-2 max-h-[872px] overflow-hidden rounded-lg border",s.isFocused?"border-accent ring-1 ring-accent":"border-border"],"block w-full"])},[C(o("textarea",{id:"text",ref:"multiURLInput","onUpdate:modelValue":e[26]||(e[26]=l=>s.textVal=l),rows:"7",maxlength:"10000",placeholder:`Enter one or more image URLs or HTML tags. 10 11Example: 12https://www.example.com/image1.jpg 13https://www.example.com/image2.jpg 14 15Or use HTML: 16<html> 17<body> 18 <img src='https://www.example.com/image1.jpg' alt='Example Image 1'/> 19 <img src='https://www.example.com/image2.jpg' alt='Example Image 2'/> 20</body> 21</html>`,class:w([[s.textInput?"min-h-[560px]":"min-h-[160px]"],"text-foreground placeholder:text-muted-2 block max-h-[832px] w-full resize-y border-0 bg-transparent p-2.5 text-sm focus:ring-0"]),onPointerdown:e[27]||(e[27]=l=>{s.textInput=!0,s.isURLFocused=!1,s.urlInput=!1}),onFocus:e[28]||(e[28]=(...l)=>r.handleMultiURLFocus&&r.handleMultiURLFocus(...l)),onBlur:e[29]||(e[29]=(...l)=>r.handleMultiURLBlur&&r.handleMultiURLBlur(...l)),onInput:e[30]||(e[30]=(...l)=>r.handleTextInput&&r.handleTextInput(...l))},null,34),[[E,s.textVal,void 0,{trim:!0}]])],2)])),s.csvInput?(d(),u("div",ka,[e[62]||(e[62]=o("div",null,[o("p",{class:"text-foreground font-semibold"},"Import CSV"),o("p",{class:"text-muted mt-0.5 text-sm"},"Load image URLs from a CSV â they'll appear here for generation.")],-1)),o("div",null,[o("input",{ref:"csvCreateInput",type:"file",accept:".csv",class:"hidden",onChange:e[31]||(e[31]=(...l)=>r.handleCsvImport&&r.handleCsvImport(...l))},null,544),o("div",{tabindex:"0",role:"button","aria-label":"Upload CSV file",class:w(["flex w-full cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed px-4 py-10 transition-colors focus:outline-none focus:ring-2 focus:ring-accent",s.isDragOverCsv?"border-accent bg-accent/10":"border-border bg-surface-2 hover:bg-surface"]),onClick:e[32]||(e[32]=l=>t.$refs.csvCreateInput.click()),onKeydown:[e[33]||(e[33]=y(f(l=>t.$refs.csvCreateInput.click(),["prevent"]),["enter"])),e[34]||(e[34]=y(f(l=>t.$refs.csvCreateInput.click(),["prevent"]),["space"]))],onDragenter:e[35]||(e[35]=f(l=>s.isDragOverCsv=!0,["prevent"])),onDragover:e[36]||(e[36]=f(l=>s.isDragOverCsv=!0,["prevent"])),onDragleave:e[37]||(e[37]=l=>r.handleCsvDragLeave(l)),onDrop:e[38]||(e[38]=f(l=>r.handleCsvDrop(l),["prevent"]))},[e[57]||(e[57]=o("svg",{class:"text-muted mb-2 h-8 w-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1)),o("p",Sa,[e[55]||(e[55]=o("span",{class:"font-semibold"}
21,"Click to upload",-1)),e[56]||(e[56]=I(", drag and drop",-1)),r.isLikelyMobile?g("",!0):(d(),u("span",La,[e[54]||(e[54]=I(", or paste ",-1)),o("kbd",Ca,m(r.pasteKeyHint),1)]))]),e[58]||(e[58]=o("p",{class:"text-muted text-xs"},".csv files only",-1))],34)]),e[63]||(e[63]=ce('<div class="border-border rounded-lg border p-4"><p class="text-foreground mb-3 font-semibold text-sm">CSV Format</p><p class="text-muted text-xs mb-3">One row per image. The <span class="text-accent font-mono">image_url</span> column is required. Pre-existing alt text can be included in <span class="text-accent font-mono">alt_text_<em>xx</em></span> columns using <a href="https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes" target="_blank" rel="noopener noreferrer" class="text-accent underline underline-offset-2">ISO 639</a> language codes â e.g. <span class="text-accent font-mono">alt_text_en</span> (English), <span class="text-accent font-mono">alt_text_fr</span> (French), <span class="text-accent font-mono">alt_text_pt_BR</span> (Portuguese Brazil).</p><div class="hidden sm:grid grid-cols-[auto_1fr_auto] gap-x-5 gap-y-2"><span class="text-muted text-[11px] font-semibold uppercase tracking-wider">Column</span><span class="text-muted text-[11px] font-semibold uppercase tracking-wider">Description</span><span class="text-muted text-[11px] font-semibold uppercase tracking-wider">Example</span><div class="col-span-3 border-t border-border mt-1 mb-0.5"></div><span class="col-span-3 text-[11px] font-semibold text-muted uppercase tracking-wider mb-0.5">Required</span><span class="text-accent font-mono text-sm">image_url</span><span class="text-muted text-sm">Image URL to process</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">https://example.com/aj1.jpg</code></span><div class="col-span-3 border-t border-border mt-1 mb-0.5"></div><span class="col-span-3 text-[11px] font-semibold text-muted uppercase tracking-wider mb-0.5">Optional</span><span class="text-accent font-mono text-sm">image_name</span><span class="text-muted text-sm">Identifier / SKU</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">iphone-17-pro-max-orange</code></span><span class="text-accent font-mono text-sm">lang</span><span class="text-muted text-sm">Target language code(s)</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">en es fr</code></span><span class="text-accent font-mono text-sm">alt_text_<em>xx</em></span><span class="text-muted text-sm">Pre-existing alt text per language</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">alt_text_en, alt_text_fr</code></span><div class="col-span-3 border-t border-border mt-1 mb-0.5"></div><span class="col-span-3 text-[11px] font-semibold text-muted uppercase tracking-wider mb-0.5">E-commerce</span><span class="text-accent font-mono text-sm">brand</span><span class="text-muted text-sm">Brand name</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">Apple</code></span><span class="text-accent font-mono text-sm">product</span><span class="text-muted text-sm">Product name</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">iPhone 17 Pro Max</code></span><span class="text-accent font-mono text-sm">primary_color</span><span class="text-muted text-sm">Product color</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">Cosmic Orange</code></span><div class="col-span-3 border-t border-border mt-1 mb-0.5"></div><span class="col-span-3 text-[11px] font-semibold text-muted uppercase tracking-wider mb-0.5">SEO Keywords</span><span class="text-accent font-mono text-sm">seo_keywords</span><span class="text-muted text-sm">Pipe or comma-separated (max 10)</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">sleek|smartphone|pro camera</code></span><span class="text-accent font-mono text-sm">negative_keywords</span><span class="text-muted text-sm">Pipe or comma-separated (max 10)</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">cheap|replica</code></span><div class="col-span-3 border-t border-border mt-1 mb-0.5"></div><span class="col-span-3 text-[11px] font-semibold text-muted uppercase tracking-wider mb-0.5">Advanced</span><span class="text-accent font-mono text-sm">custom_prompt</span><span class="text-muted text-sm">Custom instructions</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">Focus on the color and design</code></span><span class="text-accent font-mono text-sm">text_length</span><span class="text-muted text-sm">Normal or Detailed</span><span class="text-muted text-sm whitespace-nowrap"><code class="bg-surface-2 border-border rounded border px-1 py-0.5 font-mono text-[11px]">Detailed</code></span></div><div class="sm:hidden space-y-2 text-sm"><div class="border-border border-t pt-2 mt-1"><span class="text-[11px] font-semibold text-muted uppercase tracking-wider">Required</span></div><div><span class="text-accent font-mono">image_url</span> <span class="text-muted">â Image URL</span></div><div class="border-border border-t pt-2 mt-1"><span class="text-[11px] font-semibold text-muted uppercase tracking-wider">Optional</span></div><div><span class="text-accent font-mono">image_name</span> <span class="text-muted">â Identifier / SKU</span></div><div><span class="text-accent font-mono">lang</span> <span class="text-muted">â Target language codes</span></div><div><span class="text-accent font-mono">alt_text_<em>xx</em></span> <span class="text-muted">â Pre-existing alt text</span></div><div class="border-border border-t pt-2 mt-1"><span class="text-[11px] font-semibold text-muted uppercase tracking-wider">E-commerce</span></div><div><span class="text-accent font-mono">brand</span>, <span class="text-accent font-mono">product</span>, <span class="text-accent font-mono">primary_color</span></div><div class="border-border border-t pt-2 mt-1"><span class="text-[11px] font-semibold text-muted uppercase tracking-wider">SEO & Advanced</span></div><div><span class="text-accent font-mono">seo_keywords</span>, <span class="text-accent font-mono">negative_keywords</span></div><div><span class="text-accent font-mono">custom_prompt</span>, <span class="text-accent font-mono">text_length</span></div></div><div class="border-border rounded-lg border p-3 text-muted leading-relaxed text-xs mt-4"> Switching from another tool? We also accept <span class="text-accent font-mono">asset_id</span>, <span class="text-accent font-mono">ecomm_product</span>, <span class="text-accent font-mono">ecomm_brand</span>, <span class="text-accent font-mono">ecomm_color</span>, <span class="text-accent font-mono">keywords</span>, and <span class="text-accent font-mono">gpt_prompt</span> columns. </div></div>',1)),o("div",Ta,[e[61]||(e[61]=o("p",{class:"text-foreground mb-2 text-xs font-semibold"},"See Example Template",-1)),o("div",Aa,[o("button",{type:"button",onClick:e[39]||(e[39]=(...l)=>r.downloadCsvTemplate&&r.downloadCsvTemplate(...l)),class:"text-accent hover:text-accent/80 flex cursor-pointer items-center gap-1.5 text-xs underline-offset-2 hover:underline"},e[59]||(e[59]=[o("svg",{class:"h-3.5 w-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})],-1),I(" Download CSV template ",-1)])),e[60]||(e[60]=o("a",{href:"https://docs.google.com/spreadsheets/d/12jtTPGyDwApOGWdhfJsVm-WCdS-Nq_vXdvBDKyRyFUQ/edit?usp=sharing",target:"_blank",rel:"noopener noreferrer",class:"text-accent hover:text-accent/80 flex items-center gap-1.5 text-xs underline-offset-2 hover:underline"},[o("svg",{class:"h-3.5 w-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})]),I(" Open Google Sheets template ")],-1))])])])):g("",!0)])])}const Ea=$(Jn,[["render",_a]]),Da={name:"CreatePage",components:{UploadedImages:Wn,InputImages:Ea,ImageOptions:Ie,RemainingCreditsBanner:be,MyLibrary:ye},setup(){je({title:"Create New Alt Text"});const t=ae(),e=ee(),a=De(),n=T(()=>t.imageData.filter(v=>v.url!=="").length>0),s=le(!!a.query.audit),r=T(()=>e.authenticated),i=le(!1),l=le(!1);ne(()=>{l.value=!0});const p=T(()=>l.value&&(!e.authenticated||e.lastFetchedAt!==null||i.value)&&!s.value);
21e.authenticated&&e.lastFetchedAt===null&&e.fetchAccount().catch(()=>{i.value=!0});const b=T(()=>t.imageData.some(v=>(v.url!==""||v.file)&&v.status!=="completed")),h=v=>{b.value&&(v.preventDefault(),v.returnValue="")};return ne(()=>{typeof window<"u"&&window.addEventListener("beforeunload",h)}),Pe(()=>{typeof window<"u"&&window.removeEventListener("beforeunload",h)}),ne(()=>{if(a.query.audit)return;const v=t.restorePendingBatch();if(v===null)return;const{showToast:_}=W();v>0?_(`Restored your images. ${v} uploaded ${v===1?"file":"files"} couldn't be carried over â please re-add ${v===1?"it":"them"}.`,"info"):_("Welcome back â your images are still here.","success")}),ne(async()=>{const v=a.query.audit;if(!v){s.value=!1;return}try{const _=pe(),j=await(await Oe(async()=>{const{default:R}=await import("./FbEdaL-q.js").then(V=>V.an);return{default:R}},__vite__mapDeps([0,1]),import.meta.url)).default.get(`${_.public.apiBaseUrl}/audit/${v}`);if(j.data?.pages){const R=new Set(["missing","empty","vague","filename","placeholder"]),V=new Set,F=[];for(const c of j.data.pages)if(c.images)for(const L of c.images)R.has(L.quality)&&!V.has(L.src)&&(V.add(L.src),F.push(L.src));F.length>0&&(t.setImageDataArray(F),t.clearEmptyUrlData(),t.removeDuplicateUrls())}}catch{}finally{s.value=!1}}),{createStore:t,showUploadedView:n,isPageReady:p,isAuthenticated:r,hydrated:l}},beforeRouteLeave(){if(this.createStore.imageData.some(e=>(e.url!==""||e.file)&&e.status!=="completed")&&!(typeof window<"u"&&window.confirm("You have unsaved images on this page. Generation in progress will continue server-side and results will appear in your library. Leave anyway?")))return!1;this.createStore.isProcessing||this.createStore.clearState()}},Pa={class:"bg-canvas text-foreground flex min-h-screen w-full flex-col"},Oa={class:"flex w-full flex-grow justify-center px-4 sm:px-6"},Ua={class:"relative w-full max-w-[1480px] pt-20 pb-8"},Ma={class:"flex w-full flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"},Va={class:"shrink-0 flex gap-x-2"},Ba={key:1,class:"bg-surface-2 h-10 w-28 animate-pulse rounded-lg"},Fa={class:"relative flex w-full flex-col pt-2 lg:flex-row lg:items-start lg:justify-between lg:gap-x-4"},Ra={class:"w-full"},Na={key:1,class:"bg-surface mt-2 w-full rounded-lg px-4 pt-2 pb-4 shadow-md"},Ha={class:"z-0 w-full lg:w-[480px] lg:min-w-[480px]"},ja={key:1,class:"bg-surface mt-2 min-h-1/2 w-full rounded-lg px-4 pt-2 pb-8 shadow-md"};function Ka(t,e,a,n,s,r){const i=be,l=fe,p=Ue,b=ye,h=Ie;return d(),u("div",Pa,[o("div",Oa,[o("div",Ua,[o("div",Ma,[e[2]||(e[2]=o("h1",{class:"shrink-0 text-2xl font-bold tracking-tight sm:text-4xl"}," Create New Alt Text ",-1)),O(p,null,{fallback:X(()=>e[1]||(e[1]=[o("div",{class:"bg-surface-2 h-10 w-64 animate-pulse rounded-lg"},null,-1)])),default:X(()=>[n.hydrated&&n.isAuthenticated?(d(),M(i,{key:0})):n.hydrated?(d(),M(l,{key:1,to:"/sign-up",class:"border-border bg-brand-lavender/20 text-foreground hover:opacity-90 flex w-fit items-center justify-center rounded-lg border p-2 text-sm tracking-tight"},{default:X(()=>e[0]||(e[0]=[o("span",{class:"font-bold"},"Sign up free",-1),I(" Â to generate â 25 credits, no card needed. ",-1)])),_:1,__:[0]})):g("",!0)]),_:1}),o("span",Va,[n.isPageReady?(d(),u(U,{key:0},[n.hydrated&&n.isAuthenticated?(d(),M(b,{key:0,alt:"my library"})):g("",!0)],64)):(d(),u("div",Ba))])]),o("div",Fa,[o("div",Ra,[n.isPageReady?(d(),M(Ee(n.showUploadedView?"UploadedImages":"InputImages"),{key:0})):(d(),u("div",Na,e[3]||(e[3]=[ce('<div class="bg-surface-2 mb-3 h-8 w-16 animate-pulse rounded"></div><div class="mb-4"><div class="bg-surface-2 mb-1 h-4 w-20 animate-pulse rounded"></div><div class="bg-surface-2 h-10 w-full animate-pulse rounded-lg"></div></div><div class="flex items-center gap-2 py-3"><div class="bg-surface-2 h-px flex-grow"></div><div class="bg-surface-2 h-5 w-6 animate-pulse rounded"></div><div class="bg-surface-2 h-px flex-grow"></div></div><div class="mb-4"><div class="bg-surface-2 mb-1 h-4 w-32 animate-pulse rounded"></div><div class="bg-surface-2 h-10 w-full animate-pulse rounded-lg"></div></div><div class="flex items-center gap-2 py-3"><div class="bg-surface-2 h-px flex-grow"></div><div class="bg-surface-2 h-5 w-6 animate-pulse rounded"></div><div class="bg-surface-2 h-px flex-grow"></div></div><div class="mb-4"><div class="bg-surface-2 mb-1 h-4 w-28 animate-pulse rounded"></div><div class="bg-surface-2 h-64 w-full animate-pulse rounded-lg border-2 border-dashed border-transparent"></div></div><div class="flex items-center gap-2 py-3"><div class="bg-surface-2 h-px flex-grow"></div><div class="bg-surface-2 h-5 w-6 animate-pulse rounded"></div><div class="bg-surface-2 h-px flex-grow"></div></div><div><div class="flex items-center justify-between mb-1"><div class="bg-surface-2 h-4 w-44 animate-pulse rounded"></div><div class="bg-surface-2 h-7 w-20 animate-pulse rounded-lg"></div></div><div class="bg-surface-2 h-32 w-full animate-pulse rounded-lg"></div></div>',8)])))]),o("div",Ha,[n.isPageReady?(d(),M(h,{key:0})):(d(),u("div",ja,e[4]||(e[4]=[ce('<div class="bg-surface-2 mb-3 h-8 w-20 animate-pulse rounded"></div><div class="mb-4"><div class="bg-surface-2 mb-1 h-4 w-24 animate-pulse rounded"></div><div class="bg-surface-2 h-10 w-full animate-pulse rounded-lg"></div></div><div class="bg-surface-2 mb-4 h-px w-full"></div><div class="mb-4 flex items-center justify-between"><div><div class="bg-surface-2 mb-1 h-4 w-36 animate-pulse rounded"></div><div class="bg-surface-2 h-3 w-56 animate-pulse rounded"></div></div><div class="bg-surface-2 h-5 w-9 animate-pulse rounded-full"></div></div><div class="mb-4 flex items-start gap-2"><div class="bg-surface-2 mt-0.5 h-4 w-4 animate-pulse rounded"></div><div><div class="bg-surface-2 mb-1 h-4 w-24 animate-pulse rounded"></div><div class="bg-surface-2 h-3 w-48 animate-pulse rounded"></div></div></div><div class="mb-4 flex items-start gap-2"><div class="bg-surface-2 mt-0.5 h-4 w-4 animate-pulse rounded"></div><div><div class="bg-surface-2 mb-1 h-4 w-28 animate-pulse rounded"></div><div class="bg-surface-2 h-3 w-36 animate-pulse rounded"></div></div></div><div class="mb-4 flex items-start gap-2"><div class="bg-surface-2 mt-0.5 h-4 w-4 animate-pulse rounded"></div><div><div class="bg-surface-2 mb-1 h-4 w-36 animate-pulse rounded"></div><div class="bg-surface-2 h-3 w-44 animate-pulse rounded"></div></div></div><div class="mb-4 flex items-start gap-2"><div class="bg-surface-2 mt-0.5 h-4 w-4 animate-pulse rounded"></div><div><div class="bg-surface-2 mb-1 h-4 w-28 animate-pulse rounded"></div><div class="bg-surface-2 h-3 w-56 animate-pulse rounded"></div></div></div><div class="bg-surface-2 my-4 h-px w-full"></div><div class="mb-4 w-1/2"><div class="bg-surface-2 mb-1 h-4 w-20 animate-pulse rounded"></div><div class="bg-surface-2 h-10 w-full animate-pulse rounded-lg"></div></div><div><div class="bg-surface-2 mb-1 h-4 w-20 animate-pulse rounded"></div><div class="bg-surface-2 h-10 w-full animate-pulse rounded-lg"></div><div class="bg-surface-2 mt-px h-10 w-full animate-pulse rounded-b-lg"></div></div>',11)])))])])])])])}const Ya=$(Da,[["render",Ka]]);export{Ya 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.