1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BNfiALQ0.js","./C4iS2aBk.js"])))=>i.map(i=>d[i]); 2import{_ as $t,g as St,t as It,a as Ct,b as Et}from"./DYc-tTms.js";import{s as Pt}from"./DB5uJRWV.js";import{a3 as Tt,g as ut,a4 as zt,o as u,c as q,a as e,t as p,k as l,q as L,b as c,E as vt,F as D,N as te,s as Pe,Y as At,a5 as Lt,a6 as Mt,$ as jt,a0 as S,a7 as Rt,a8 as Gt,n as ht,A as ne,r as f,p as _t,a9 as Ft,d as dt,D as de,w as P,e as Ot,f as Ht,G as Vt,H as ct,S as Dt,M as Ut,x as Nt}from"./CSYtTi5R.js";import{_ as Bt}from"./Cmbf7rAD.js";import{s as yt}from"./rRFHb9cQ.js";import{s as Kt}from"./pNVYeO4p.js";import{s as Wt}from"./DHXagm6D.js";import{s as Yt}from"./Cr5ORny2.js";import{s as wt}from"./BhIzAn6-.js";import{u as Qt}from"./CYJ813Qi.js";import{u as kt}from"./8sDRR8L0.js";import{s as k}from"./DXn5qrhZ.js";import{T as Jt}from"./Co3eY0Dg.js";import{a as Zt}from"./C6zKP_74.js";import{s as Xt}from"./DGY8kgRQ.js";import{s as el}from"./CU7iduCd.js";import{s as tl}from"./x_rD_Ya3.js";import{g as ll}from"./DIT3M6Uk.js";import{_ as ol}from"./DlAUqK2U.js";import"./5Bn8sfOl.js";import"./B8ygnw1g.js";import"./BjGQz9TT.js";import"./Td_NrXJC.js";import"./C3cSfmaP.js";import"./2i_eZDti.js";import"./CdM5tZTY.js";import"./VGjZecW7.js";import"./CwY89Pc-.js";import"./BfrOBogT.js";import"./Co65sj30.js";import"./Vfa1HrGJ.js";import"./eZNxoPjA.js";import"./DoyLntpQ.js";import"./zHAcT-hm.js";import"./C3nCNyvD.js";import"./C2hV4Y-z.js";import"./o-hZm7IA.js";import"./BJYYGVVZ.js";import"./Cl6EKB7t.js";import"./BCzwK444.js";const nl={class:"bg-white rounded-xl border border-gray-200 p-6"},il={class:"flex items-center justify-between mb-6 pb-4 border-b border-gray-100"},rl={class:"flex items-center gap-3"},sl={class:"text-lg font-semibold text-gray-900"},al={key:0,class:"text-sm text-gray-500"},dl={key:0,class:"flex flex-col items-center justify-center py-12"},cl={class:"text-gray-600 mt-4"},ul={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},pl={class:"text-lg font-semibold text-gray-900 mb-2"},ml={class:"text-gray-500 text-sm max-w-sm"},ql={key:2,class:"grid grid-cols-2 gap-4 max-h-[700px] overflow-y-auto"},fl=["onClick"],gl={key:0,class:"absolute inset-0 bg-blue-500 bg-opacity-30 rounded-lg border-4 border-blue-500 z-10 flex items-center justify-center"},bl={class:"relative aspect-square rounded-lg overflow-hidden border-2 border-gray-200 hover:border-blue-400 transition-all"},vl=["src","alt"],hl={__name:"ImagePreview",props:Tt({title:{type:String,default:"Preview"},items:{type:Array,default:()=>[]},isLoading:{type:Boolean,default:!1},loadingText:{type:String,default:"Generating..."},emptyIcon:{type:String,default:"pi pi-image"},emptyTitle:{type:String,default:"No preview yet"},emptySubtitle:{type:String,default:"Submit the form to see preview"}},{selectedImages:{type:Array,default:()=>[]},selectedImagesModifiers:{}}),emits:["update:selectedImages"],setup(s){const{t}=ut(),r=zt(s,"selectedImages"),h=I=>r.value.includes(I.url),n=I=>{const O=r.value.indexOf(I.url);O>-1?r.value.splice(O,1):r.value.push(I.url)};return(I,O)=>{const Me=Pt;return u(),q("div",nl,[e("div",il,[e("div",rl,[O[0]||(O[0]=e("div",{class:"w-12 h-12 rounded-lg bg-purple-50 flex items-center justify-center"},[e("i",{class:"pi pi-image text-2xl text-purple-600"})],-1)),e("div",null,[e("h3",sl,p(s.title),1),r.value.length>0?(u(),q("p",al,p(r.value.length)+" "+p(r.value.length===1?l(t)("image_selected"):l(t)("images_selected")),1)):L("",!0)])])]),s.isLoading?(u(),q("div",dl,[c(Me,{style:{width:"50px",height:"50px"},strokeWidth:"4"}),e("p",cl,p(s.loadingText),1)])):s.items.length===0?(u(),q("div",ul,[e("i",{class:vt([s.emptyIcon,"text-6xl text-gray-300 mb-4"])},null,2),e("h4",pl,p(s.emptyTitle),1),e("p",ml,p(s.emptySubtitle),1)])):(u(),q("div",ql,[(u(!0),q(D,null,te(s.items,(M,z)=>(u(),q("div",{key:z,class:"relative group cursor-pointer",onClick:ce=>n(M)},[h(M)?(u(),q("div",gl,O[1]||(O[1]=[e("div",{class:"bg-blue-500 rounded-full pt-2 px-2 pb-0.5"},[e("i",{class:"pi pi-check text-white text-2xl"})],-1)]))):L("",!0),e("div",bl,[e("img",{src:M.url,alt:M.caption||`Image ${z+1}`,class:"w-full h-full object-cover"},null,8,vl)])],8,fl))),128))]))])}}},_l={class:"p-6"},yl={class:"mb-4"},wl={class:"grid grid-cols-1 lg:grid-cols-3 gap-6"},kl={class:"lg:col-span-2 space-y-6"},xl={class:"bg-white rounded-lg border border-gray-200 p-6"},$l={class:"flex items-center justify-between mb-4"},Sl={class:"flex gap-2"},Il={class:"mb-4"},Cl={class:"bg-white rounded-lg border border-gray-200 p-6"},El={class:"flex items-center justify-between mb-4"},Pl={class:"flex gap-4"},Tl={class:"grid grid-cols-2 md:grid-cols-4 gap-4"},zl={class:"bg-white rounded-lg border border-gray-200 p-6"},Al={class:"space-y-3"},Ll={class:"flex-1 space-y-2"},Ml={class:"space-y-6"},jl={class:"bg-white rounded-lg border border-gray-200 p-6"},Rl={class:"bg-white rounded-lg border border-gray-200 p-6"},Gl={class:"space-y-4"},Fl={class:"flex gap-2 flex-wrap"},Ol={__name:"ProductDetailSkeleton",setup(s){return(t,r)=>(u(),q("div",_l,[e("div",yl,[c(l(k),{height:"2.5rem",width:"12rem",class:"rounded"}
2)]),e("div",wl,[e("div",kl,[e("div",xl,[e("div",$l,[c(l(k),{height:"2rem",width:"10rem"}),e("div",Sl,[c(l(k),{height:"2.5rem",width:"5rem",class:"rounded"}),c(l(k),{height:"2.5rem",width:"9rem",class:"rounded"})])]),e("div",Il,[c(l(k),{height:"1.5rem",width:"8rem",class:"mb-2"}),c(l(k),{height:"1.25rem",width:"100%",class:"mb-1"}),c(l(k),{height:"1.25rem",width:"80%"})]),e("div",null,[c(l(k),{height:"1.5rem",width:"10rem",class:"mb-2"}),c(l(k),{height:"1rem",width:"100%",class:"mb-2"}),c(l(k),{height:"1rem",width:"100%",class:"mb-2"}),c(l(k),{height:"1rem",width:"100%",class:"mb-2"}),c(l(k),{height:"1rem",width:"90%",class:"mb-2"}),c(l(k),{height:"1rem",width:"85%"})])]),e("div",Cl,[e("div",El,[c(l(k),{height:"2rem",width:"10rem"}),e("div",Pl,[c(l(k),{height:"2.5rem",width:"10rem",class:"rounded"}),c(l(k),{height:"2.5rem",width:"10rem",class:"rounded"})])]),e("div",Tl,[(u(),q(D,null,te(4,h=>c(l(k),{key:h,height:"150px",class:"rounded-lg"})),64))])]),e("div",zl,[c(l(k),{height:"1.5rem",width:"6rem",class:"mb-4"}),e("div",Al,[(u(),q(D,null,te(3,h=>e("div",{key:h,class:"flex items-center gap-4 p-3 border border-gray-200 rounded"},[c(l(k),{height:"3rem",width:"3rem",class:"rounded"}),e("div",Ll,[c(l(k),{height:"1rem",width:"60%"}),c(l(k),{height:"1rem",width:"40%"})]),c(l(k),{height:"2rem",width:"5rem",class:"rounded"})])),64))])])]),e("div",Ml,[e("div",jl,[c(l(k),{height:"1rem",width:"7rem",class:"mb-3"}),c(l(k),{height:"250px",class:"rounded-lg"})]),e("div",Rl,[e("div",Gl,[e("div",null,[c(l(k),{height:"0.875rem",width:"4rem",class:"mb-1"}),c(l(k),{height:"1rem",width:"8rem"})]),e("div",null,[c(l(k),{height:"0.875rem",width:"4rem",class:"mb-1"}),c(l(k),{height:"1.5rem",width:"5rem",class:"rounded-full"})]),e("div",null,[c(l(k),{height:"0.875rem",width:"4rem",class:"mb-1"}),c(l(k),{height:"1rem",width:"7rem"})]),e("div",null,[c(l(k),{height:"0.875rem",width:"5rem",class:"mb-1"}),e("div",Fl,[c(l(k),{height:"1.5rem",width:"5rem",class:"rounded-full"}),c(l(k),{height:"1.5rem",width:"6rem",class:"rounded-full"})])]),e("div",null,[c(l(k),{height:"0.875rem",width:"6rem",class:"mb-1"}),c(l(k),{height:"1rem",width:"10rem"})]),e("div",null,[c(l(k),{height:"0.875rem",width:"7rem",class:"mb-1"}),c(l(k),{height:"1rem",width:"9rem"})])])])])])]))}},Hl={class:"grid grid-cols-2 md:grid-cols-4 gap-4"},Vl={__name:"ProductMediaSkeleton",props:{count:{type:Number,default:4}},setup(s){return(t,r)=>(u(),q("div",Hl,[(u(!0),q(D,null,te(s.count,h=>(u(),Pe(l(k),{key:h,height:"150px",class:"rounded-lg"}))),128))]))}};var Dl=function(t){var r=t.dt;return` 3/*! 4* Quill Editor v1.3.3 5* https://quilljs.com/ 6* Copyright (c) 2014, Jason Chen 7* Copyright (c) 2013, salesforce.com 8*/ 9.ql-container { 10 box-sizing: border-box; 11 font-family: Helvetica, Arial, sans-serif; 12 font-size: 13px; 13 height: 100%; 14 margin: 0; 15 position: relative; 16} 17.ql-container.ql-disabled .ql-tooltip { 18 visibility: hidden; 19} 20.ql-container.ql-disabled .ql-editor ul[data-checked] > li::before { 21 pointer-events: none; 22} 23.ql-clipboard { 24 inset-inline-start: -100000px; 25 height: 1px; 26 overflow-y: hidden; 27 position: absolute; 28 top: 50%; 29} 30.ql-clipboard p { 31 margin: 0; 32 padding: 0; 33} 34.ql-editor { 35 box-sizing: border-box; 36 line-height: 1.42; 37 height: 100%; 38 outline: none; 39 overflow-y: auto; 40 padding: 12px 15px; 41 tab-size: 4; 42 -moz-tab-size: 4; 43 text-align: left; 44 white-space: pre-wrap; 45 word-wrap: break-word; 46} 47.ql-editor > * { 48 cursor: text; 49} 50.ql-editor p, 51.ql-editor ol, 52.ql-editor ul, 53.ql-editor pre, 54.ql-editor blockquote, 55.ql-editor h1, 56.ql-editor h2, 57.ql-editor h3, 58.ql-editor h4, 59.ql-editor h5, 60.ql-editor h6 { 61 margin: 0; 62 padding: 0; 63 counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9; 64} 65.ql-editor ol, 66.ql-editor ul { 67 padding-inline-start: 1.5rem; 68} 69.ql-editor ol > li, 70.ql-editor ul > li { 71 list-style-type: none; 72} 73.ql-editor ul > li::before { 74 content: '\\2022'; 75} 76.ql-editor ul[data-checked='true'], 77.ql-editor ul[data-checked='false'] { 78 pointer-events: none; 79} 80.ql-editor ul[data-checked='true'] > li *, 81.ql-editor ul[data-checked='false'] > li * { 82 pointer-events: all; 83} 84.ql-editor ul[data-checked='true'] > li::before, 85.ql-editor ul[data-checked='false'] > li::before { 86 color: #777; 87 cursor: pointer; 88 pointer-events: all; 89} 90.ql-editor ul[data-checked='true'] > li::before { 91 content: '\\2611'; 92} 93.ql-editor ul[data-checked='false'] > li::before { 94 content: '\\2610'; 95} 96.ql-editor li::before { 97 display: inline-block; 98 white-space: nowrap; 99 width: 1.2rem; 100} 101.ql-editor li:not(.ql-direction-rtl)::before {
102 margin-inline-start: -1.5rem; 103 margin-inline-end: 0.3rem; 104 text-align: right; 105} 106.ql-editor li.ql-direction-rtl::before { 107 margin-inline-start: 0.3rem; 108 margin-inline-end: -1.5rem; 109} 110.ql-editor ol li:not(.ql-direction-rtl), 111.ql-editor ul li:not(.ql-direction-rtl) { 112 padding-inline-start: 1.5rem; 113} 114.ql-editor ol li.ql-direction-rtl, 115.ql-editor ul li.ql-direction-rtl { 116 padding-inline-end: 1.5rem; 117} 118.ql-editor ol li { 119 counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9; 120 counter-increment: list-0; 121} 122.ql-editor ol li:before { 123 content: counter(list-0, decimal) '. '; 124} 125.ql-editor ol li.ql-indent-1 { 126 counter-increment: list-1; 127} 128.ql-editor ol li.ql-indent-1:before { 129 content: counter(list-1, lower-alpha) '. '; 130} 131.ql-editor ol li.ql-indent-1 { 132 counter-reset: list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9; 133} 134.ql-editor ol li.ql-indent-2 { 135 counter-increment: list-2; 136} 137.ql-editor ol li.ql-indent-2:before { 138 content: counter(list-2, lower-roman) '. '; 139} 140.ql-editor ol li.ql-indent-2 { 141 counter-reset: list-3 list-4 list-5 list-6 list-7 list-8 list-9; 142} 143.ql-editor ol li.ql-indent-3 { 144 counter-increment: list-3; 145} 146.ql-editor ol li.ql-indent-3:before { 147 content: counter(list-3, decimal) '. '; 148} 149.ql-editor ol li.ql-indent-3 { 150 counter-reset: list-4 list-5 list-6 list-7 list-8 list-9; 151} 152.ql-editor ol li.ql-indent-4 { 153 counter-increment: list-4; 154} 155.ql-editor ol li.ql-indent-4:before { 156 content: counter(list-4, lower-alpha) '. '; 157} 158.ql-editor ol li.ql-indent-4 { 159 counter-reset: list-5 list-6 list-7 list-8 list-9; 160} 161.ql-editor ol li.ql-indent-5 { 162 counter-increment: list-5; 163} 164.ql-editor ol li.ql-indent-5:before { 165 content: counter(list-5, lower-roman) '. '; 166} 167.ql-editor ol li.ql-indent-5 { 168 counter-reset: list-6 list-7 list-8 list-9; 169} 170.ql-editor ol li.ql-indent-6 { 171 counter-increment: list-6; 172} 173.ql-editor ol li.ql-indent-6:before { 174 content: counter(list-6, decimal) '. '; 175} 176.ql-editor ol li.ql-indent-6 { 177 counter-reset: list-7 list-8 list-9; 178} 179.ql-editor ol li.ql-indent-7 { 180 counter-increment: list-7; 181} 182.ql-editor ol li.ql-indent-7:before { 183 content: counter(list-7, lower-alpha) '. '; 184} 185.ql-editor ol li.ql-indent-7 { 186 counter-reset: list-8 list-9; 187} 188.ql-editor ol li.ql-indent-8 { 189 counter-increment: list-8; 190} 191.ql-editor ol li.ql-indent-8:before { 192 content: counter(list-8, lower-roman) '. '; 193} 194.ql-editor ol li.ql-indent-8 { 195 counter-reset: list-9; 196} 197.ql-editor ol li.ql-indent-9 { 198 counter-increment: list-9; 199} 200.ql-editor ol li.ql-indent-9:before { 201 content: counter(list-9, decimal) '. '; 202} 203.ql-editor .ql-video { 204 display: block; 205 max-width: 100%; 206} 207.ql-editor .ql-video.ql-align-center { 208 margin: 0 auto; 209} 210.ql-editor .ql-video.ql-align-right { 211 margin: 0 0 0 auto; 212} 213.ql-editor .ql-bg-black { 214 background: #000; 215} 216.ql-editor .ql-bg-red { 217 background: #e60000; 218} 219.ql-editor .ql-bg-orange { 220 background: #f90; 221} 222.ql-editor .ql-bg-yellow { 223 background: #ff0; 224} 225.ql-editor .ql-bg-green { 226 background: #008a00; 227} 228.ql-editor .ql-bg-blue { 229 background: #06c; 230} 231.ql-editor .ql-bg-purple { 232 background: #93f; 233} 234.ql-editor .ql-color-white { 235 color: #fff; 236} 237.ql-editor .ql-color-red { 238 color: #e60000; 239} 240.ql-editor .ql-color-orange { 241 color: #f90; 242} 243.ql-editor .ql-color-yellow { 244 color: #ff0; 245} 246.ql-editor .ql-color-green { 247 color: #008a00; 248} 249.ql-editor .ql-color-blue { 250 color: #06c; 251} 252.ql-editor .ql-color-purple { 253 color: #93f; 254} 255.ql-editor .ql-font-serif { 256 font-family: Georgia, Times New Roman, serif; 257} 258.ql-editor .ql-font-monospace { 259 font-family: Monaco, Courier New, monospace; 260} 261.ql-editor .ql-size-small { 262 font-size: 0.75rem; 263} 264.ql-editor .ql-size-large { 265 font-size: 1.5rem; 266} 267.ql-editor .ql-size-huge { 268 font-size: 2.5rem; 269} 270.ql-editor .ql-direction-rtl { 271 direction: rtl; 272 text-align: inherit; 273} 274.ql-editor .ql-align-center { 275 text-align: center; 276} 277.ql-editor .ql-align-justify { 278 text-align: justify; 279} 280.ql-editor .ql-align-right { 281 text-align: right; 282} 283.ql-editor.ql-blank::before { 284 color: rgba(0, 0, 0, 0.6); 285 content: attr(data-placeholder); 286 font-style: italic; 287 inset-inline-start: 15px; 288 pointer-events: none; 289 position: absolute; 290 inset-inline-end: 15px; 291} 292.ql-snow.ql-toolbar:after, 293.ql-snow .ql-toolbar:after { 294 clear: both; 295 content: ''; 296 display: table; 297} 298.ql-snow.ql-toolbar button, 299.ql-snow .ql-toolbar button { 300 background: none; 301 border: none; 302 cursor: pointer; 303 display: inline-block; 304 float: left; 305 height: 24px; 306 padding-block: 3px; 307 padding-inline: 5px; 308 width: 28px; 309} 310.ql-snow.ql-toolbar button svg, 311.ql-snow .ql-toolbar button svg { 312 float: left; 313 height: 100%; 314} 315.ql-snow.ql-toolbar button:active:hover, 316.ql-snow .ql-toolbar button:active:hover { 317 outline: none; 318} 319.ql-snow.ql-toolbar input.ql-image[type='file'], 320.ql-snow .ql-toolbar input.ql-image[type='file'] { 321 display: none; 322} 323.ql-snow.ql-toolbar button:hover, 324.ql-snow .ql-toolbar button:hover, 325.ql-snow.ql-toolbar button:focus, 326.ql-snow .ql-toolbar button:focus, 327.ql-snow.ql-toolbar button.ql-active, 328.ql-snow .ql-toolbar button.ql-active, 329.ql-snow.ql-toolbar .ql-picker-label:hover, 330.ql-snow .ql-toolbar .ql-picker-label:hover, 331.ql-snow.ql-toolbar .ql-picker-label.ql-active, 332.ql-snow .ql-toolbar .ql-picker-label.ql-active, 333.ql-snow.ql-toolbar .ql-picker-item:hover, 334.ql-snow .ql-toolbar .ql-picker-item:hover, 335.ql-snow.ql-toolbar .ql-picker-item.ql-selected, 336.ql-snow .ql-toolbar .ql-picker-item.ql-selected { 337 color: #06c; 338} 339.ql-snow.ql-toolbar button:hover .ql-fill, 340.ql-snow .ql-toolbar button:hover .ql-fill, 341.ql-snow.ql-toolbar button:focus .ql-fill, 342.ql-snow .ql-toolbar button:focus .ql-fill, 343.ql-snow.ql-toolbar button.ql-active .ql-fill, 344.ql-snow .ql-toolbar button.ql-active .ql-fill, 345.ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill, 346.ql-snow .ql-toolbar .ql-picker-label:hover .ql-fill, 347.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill, 348.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-fill, 349.ql-snow.ql-toolbar .ql-picker-item:hover .ql-fill, 350.ql-snow .ql-toolbar .ql-picker-item:hover .ql-fill, 351.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill, 352.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-fill, 353.ql-snow.ql-toolbar button:hover .ql-stroke.ql-fill, 354.ql-snow .ql-toolbar button:hover .ql-stroke.ql-fill, 355.ql-snow.ql-toolbar button:focus .ql-stroke.ql-fill, 356.ql-snow .ql-toolbar button:focus .ql-stroke.ql-fill, 357.ql-snow.ql-toolbar button.ql-active .ql-stroke.ql-fill, 358.ql-snow .ql-toolbar button.ql-active .ql-stroke.ql-fill, 359.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill, 360.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill, 361.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill, 362.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill, 363.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill, 364.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill, 365.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill, 366.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill { 367 fill: #06c; 368} 369.ql-snow.ql-toolbar button:hover .ql-stroke, 370.ql-snow .ql-toolbar button:hover .ql-stroke, 371.ql-snow.ql-toolbar button:focus .ql-stroke, 372.ql-snow .ql-toolbar button:focus .ql-stroke, 373.ql-snow.ql-toolbar button.ql-active .ql-stroke, 374.ql-snow .ql-toolbar button.ql-active .ql-stroke, 375.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke, 376.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke, 377.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke, 378.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke, 379.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke, 380.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke, 381.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke, 382.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke, 383.ql-snow.ql-toolbar button:hover .ql-stroke-miter, 384.ql-snow .ql-toolbar button:hover .ql-stroke-miter, 385.ql-snow.ql-toolbar button:focus .ql-stroke-miter, 386.ql-snow .ql-toolbar button:focus .ql-stroke-miter, 387.ql-snow.ql-toolbar button.ql-active .ql-stroke-miter, 388.ql-snow.ql-toolbar button.ql-active .ql-stroke-miter, 389.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke-miter, 390.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke-miter, 391.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter, 392.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter, 393.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke-miter, 394.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke-miter, 395.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter, 396.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter { 397 stroke: #06c; 398} 399@media (pointer: coarse) { 400 .ql-snow.ql-toolbar button:hover:not(.ql-active), 401 .ql-snow .ql-toolbar button:hover:not(.ql-active) { 402 color: #444; 403 } 404 .ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-fill, 405 .ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-fill, 406 .ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke.ql-fill, 407 .ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke.ql-fill { 408 fill: #444; 409 } 410 .ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke, 411 .ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke, 412 .ql-snow.ql-toolbar button:hover:not(.ql-active) .ql-stroke-miter, 413 .ql-snow .ql-toolbar button:hover:not(.ql-active) .ql-stroke-miter { 414 stroke: #444; 415 } 416} 417.ql-snow { 418 box-sizing: border-box; 419} 420.ql-snow * { 421 box-sizing: border-box; 422} 423.ql-snow .ql-hidden { 424 display: none; 425} 426.ql-snow .ql-out-bottom, 427.ql-snow .ql-out-top { 428 visibility: hidden; 429} 430.ql-snow .ql-tooltip { 431 position: absolute; 432 transform: translateY(10px); 433} 434.ql-snow .ql-tooltip a { 435 cursor: pointer; 436 text-decoration: none; 437} 438.ql-snow .ql-tooltip.ql-flip { 439 transform: translateY(-10px); 440} 441.ql-snow .ql-formats { 442 display: inline-block; 443 vertical-align: middle; 444} 445.ql-snow .ql-formats:after { 446 clear: both; 447 content: ''; 448 display: table; 449} 450.ql-snow .ql-stroke { 451 fill: none; 452 stroke: #444; 453 stroke-linecap: round; 454 stroke-linejoin: round; 455 stroke-width: 2; 456} 457.ql-snow .ql-stroke-miter { 458 fill: none; 459 stroke: #444; 460 stroke-miterlimit: 10; 461 stroke-width: 2; 462} 463.ql-snow .ql-fill, 464.ql-snow .ql-stroke.ql-fill { 465 fill: #444; 466} 467.ql-snow .ql-empty { 468 fill: none; 469} 470.ql-snow .ql-even { 471 fill-rule: evenodd; 472} 473.ql-snow .ql-thin, 474.ql-snow .ql-stroke.ql-thin { 475 stroke-width: 1; 476} 477.ql-snow .ql-transparent { 478 opacity: 0.4; 479} 480.ql-snow .ql-direction svg:last-child { 481 display: none; 482} 483.ql-snow .ql-direction.ql-active svg:last-child { 484 display: inline; 485} 486.ql-snow .ql-direction.ql-active svg:first-child { 487 display: none; 488} 489.ql-snow .ql-editor h1 { 490 font-size: 2rem; 491} 492.ql-snow .ql-editor h2 { 493 font-size: 1.5rem; 494} 495.ql-snow .ql-editor h3 { 496 font-size: 1.17rem; 497} 498.ql-snow .ql-editor h4 { 499 font-size: 1rem; 500} 501.ql-snow .ql-editor h5 { 502 font-size: 0.83rem; 503} 504.ql-snow .ql-editor h6 { 505 font-size: 0.67rem; 506} 507.ql-snow .ql-editor a { 508 text-decoration: underline; 509} 510.ql-snow .ql-editor blockquote { 511 border-inline-start: 4px solid #ccc; 512 margin-block-end: 5px; 513 margin-block-start: 5px; 514 padding-inline-start: 16px; 515} 516.ql-snow .ql-editor code, 517.ql-snow .ql-editor pre { 518 background: #f0f0f0; 519 border-radius: 3px; 520} 521.ql-snow .ql-editor pre { 522 white-space: pre-wrap; 523 margin-block-end: 5px; 524 margin-block-start: 5px; 525 padding: 5px 10px; 526} 527.ql-snow .ql-editor code { 528 font-size: 85%; 529 padding: 2px 4px; 530} 531.ql-snow .ql-editor pre.ql-syntax { 532 background: #23241f; 533 color: #f8f8f2; 534 overflow: visible; 535} 536.ql-snow .ql-editor img { 537 max-width: 100%; 538} 539.ql-snow .ql-picker { 540 color: #444; 541 display: inline-block; 542 float: left; 543 inset-inline-start: 0; 544 font-size: 14px; 545 font-weight: 500; 546 height: 24px; 547 position: relative; 548 vertical-align: middle; 549} 550.ql-snow .ql-picker-label { 551 cursor: pointer; 552 display: inline-block; 553 height: 100%; 554 padding-inline-start: 8px; 555 padding-inline-end: 2px; 556 position: relative; 557 width: 100%; 558} 559.ql-snow .ql-picker-label::before { 560 display: inline-block; 561 line-height: 22px; 562} 563.ql-snow .ql-picker-options { 564 background: #fff; 565 display: none; 566 min-width: 100%; 567 padding: 4px 8px; 568 position: absolute; 569 white-space: nowrap; 570} 571.ql-snow .ql-picker-options .ql-picker-item { 572 cursor: pointer; 573 display: block; 574 padding-block-end: 5px; 575 padding-block-start: 5px; 576} 577.ql-snow .ql-picker.ql-expanded .ql-picker-label { 578 color: #ccc; 579 z-index: 2; 580} 581.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill { 582 fill: #ccc; 583} 584.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke { 585 stroke: #ccc; 586} 587.ql-snow .ql-picker.ql-expanded .ql-picker-options { 588 display: block; 589 margin-block-start: -1px; 590 top: 100%; 591 z-index: 1; 592} 593.ql-snow .ql-color-picker, 594.ql-snow .ql-icon-picker { 595 width: 28px; 596} 597.ql-snow .ql-color-picker .ql-picker-label, 598.ql-snow .ql-icon-picker .ql-picker-label { 599 padding: 2px 4px; 600} 601.ql-snow .ql-color-picker .ql-picker-label svg, 602.ql-snow .ql-icon-picker .ql-picker-label svg { 603 inset-inline-end: 4px; 604} 605.ql-snow .ql-icon-picker .ql-picker-options { 606 padding: 4px 0; 607} 608.ql-snow .ql-icon-picker .ql-picker-item { 609 height: 24px; 610 width: 24px; 611 padding: 2px 4px; 612} 613.ql-snow .ql-color-picker .ql-picker-options { 614 padding: 3px 5px; 615 width: 152px; 616} 617.ql-snow .ql-color-picker .ql-picker-item { 618 border: 1px solid transparent; 619 float: left; 620 height: 16px; 621 margin: 2px; 622 padding: 0; 623 width: 16px; 624} 625.ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg { 626 position: absolute; 627 margin-block-start: -9px; 628 inset-inline-end: 0; 629 top: 50%; 630 width: 18px; 631} 632.ql-snow .ql-picker.ql-header .ql-picker-label[data-label]:not([data-label=''])::before, 633.ql-snow .ql-picker.ql-font .ql-picker-label[data-label]:not([data-label=''])::before, 634.ql-snow .ql-picker.ql-size .ql-picker-label[data-label]:not([data-label=''])::before, 635.ql-snow .ql-picker.ql-header .ql-picker-item[data-label]:not([data-label=''])::before, 636.ql-snow .ql-picker.ql-font .ql-picker-item[data-label]:not([data-label=''])::before, 637.ql-snow .ql-picker.ql-size .ql-picker-item[data-label]:not([data-label=''])::before { 638 content: attr(data-label); 639} 640.ql-snow .ql-picker.ql-header { 641 width: 98px; 642} 643.ql-snow .ql-picker.ql-header .ql-picker-label::before, 644.ql-snow .ql-picker.ql-header .ql-picker-item::before {
645 content: 'Normal'; 646} 647.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='1']::before, 648.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='1']::before { 649 content: 'Heading 1'; 650} 651.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='2']::before, 652.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='2']::before { 653 content: 'Heading 2'; 654} 655.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='3']::before, 656.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='3']::before { 657 content: 'Heading 3'; 658} 659.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='4']::before, 660.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='4']::before { 661 content: 'Heading 4'; 662} 663.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='5']::before, 664.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='5']::before { 665 content: 'Heading 5'; 666} 667.ql-snow .ql-picker.ql-header .ql-picker-label[data-value='6']::before, 668.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='6']::before { 669 content: 'Heading 6'; 670} 671.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='1']::before { 672 font-size: 2rem; 673} 674.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='2']::before { 675 font-size: 1.5rem; 676} 677.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='3']::before { 678 font-size: 1.17rem; 679} 680.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='4']::before { 681 font-size: 1rem; 682} 683.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='5']::before { 684 font-size: 0.83rem; 685} 686.ql-snow .ql-picker.ql-header .ql-picker-item[data-value='6']::before { 687 font-size: 0.67rem; 688} 689.ql-snow .ql-picker.ql-font { 690 width: 108px; 691} 692.ql-snow .ql-picker.ql-font .ql-picker-label::before, 693.ql-snow .ql-picker.ql-font .ql-picker-item::before { 694 content: 'Sans Serif'; 695} 696.ql-snow .ql-picker.ql-font .ql-picker-label[data-value='serif']::before, 697.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='serif']::before { 698 content: 'Serif'; 699} 700.ql-snow .ql-picker.ql-font .ql-picker-label[data-value='monospace']::before, 701.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='monospace']::before { 702 content: 'Monospace'; 703} 704.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='serif']::before { 705 font-family: Georgia, Times New Roman, serif; 706} 707.ql-snow .ql-picker.ql-font .ql-picker-item[data-value='monospace']::before { 708 font-family: Monaco, Courier New, monospace; 709} 710.ql-snow .ql-picker.ql-size { 711 width: 98px; 712} 713.ql-snow .ql-picker.ql-size .ql-picker-label::before, 714.ql-snow .ql-picker.ql-size .ql-picker-item::before { 715 content: 'Normal'; 716} 717.ql-snow .ql-picker.ql-size .ql-picker-label[data-value='small']::before, 718.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='small']::before { 719 content: 'Small'; 720} 721.ql-snow .ql-picker.ql-size .ql-picker-label[data-value='large']::before, 722.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='large']::before { 723 content: 'Large'; 724} 725.ql-snow .ql-picker.ql-size .ql-picker-label[data-value='huge']::before, 726.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='huge']::before { 727 content: 'Huge'; 728} 729.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='small']::before { 730 font-size: 10px; 731} 732.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='large']::before { 733 font-size: 18px; 734} 735.ql-snow .ql-picker.ql-size .ql-picker-item[data-value='huge']::before { 736 font-size: 32px; 737} 738.ql-snow .ql-color-picker.ql-background .ql-picker-item { 739 background: #fff; 740} 741.ql-snow .ql-color-picker.ql-color .ql-picker-item { 742 background: #000; 743} 744.ql-toolbar.ql-snow { 745 border: 1px solid #ccc; 746 box-sizing: border-box; 747 font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; 748 padding: 8px; 749} 750.ql-toolbar.ql-snow .ql-formats { 751 margin-inline-end: 15px; 752} 753.ql-toolbar.ql-snow .ql-picker-label { 754 border: 1px solid transparent; 755} 756.ql-toolbar.ql-snow .ql-picker-options { 757 border: 1px solid transparent; 758 box-shadow: rgba(0, 0, 0, 0.2) 0 2px 8px; 759} 760.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label { 761 border-color: #ccc; 762} 763.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options { 764 border-color: #ccc; 765} 766.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item.ql-selected, 767.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item:hover { 768 border-color: #000; 769} 770.ql-toolbar.ql-snow + .ql-container.ql-snow { 771 border-block-start: 0; 772} 773.ql-snow .ql-tooltip { 774 background: #fff; 775 border: 1px solid #ccc; 776 box-shadow: 0 0 5px #ddd; 777 color: #444; 778 padding: 5px 12px; 779 white-space: nowrap; 780} 781.ql-snow .ql-tooltip::before { 782 content: 'Visit URL:';
783 line-height: 26px; 784 margin-inline-end: 8px; 785} 786.ql-snow .ql-tooltip input[type='text'] { 787 display: none; 788 border: 1px solid #ccc; 789 font-size: 13px; 790 height: 26px; 791 margin: 0; 792 padding: 3px 5px; 793 width: 170px; 794} 795.ql-snow .ql-tooltip a.ql-preview { 796 display: inline-block; 797 max-width: 200px; 798 overflow-x: hidden; 799 text-overflow: ellipsis; 800 vertical-align: top; 801} 802.ql-snow .ql-tooltip a.ql-action::after { 803 border-inline-end: 1px solid #ccc; 804 content: 'Edit'; 805 margin-inline-start: 16px; 806 padding-inline-end: 8px; 807} 808.ql-snow .ql-tooltip a.ql-remove::before { 809 content: 'Remove'; 810 margin-inline-start: 8px; 811} 812.ql-snow .ql-tooltip a { 813 line-height: 26px; 814} 815.ql-snow .ql-tooltip.ql-editing a.ql-preview, 816.ql-snow .ql-tooltip.ql-editing a.ql-remove { 817 display: none; 818} 819.ql-snow .ql-tooltip.ql-editing input[type='text'] { 820 display: inline-block; 821} 822.ql-snow .ql-tooltip.ql-editing a.ql-action::after { 823 border-inline-end: 0; 824 content: 'Save'; 825 padding-inline-end: 0; 826} 827.ql-snow .ql-tooltip[data-mode='link']::before { 828 content: 'Enter link:'; 829} 830.ql-snow .ql-tooltip[data-mode='formula']::before { 831 content: 'Enter formula:'; 832} 833.ql-snow .ql-tooltip[data-mode='video']::before { 834 content: 'Enter video:'; 835} 836.ql-snow a { 837 color: #06c; 838} 839.ql-container.ql-snow { 840 border: 1px solid #ccc; 841} 842 843.p-editor .p-editor-toolbar { 844 background: `.concat(r("editor.toolbar.background"),`; 845 border-start-end-radius: `).concat(r("editor.toolbar.border.radius"),`; 846 border-start-start-radius: `).concat(r("editor.toolbar.border.radius"),`; 847} 848 849.p-editor .p-editor-toolbar.ql-snow { 850 border: 1px solid `).concat(r("editor.toolbar.border.color"),`; 851} 852 853.p-editor .p-editor-toolbar.ql-snow .ql-stroke { 854 stroke: `).concat(r("editor.toolbar.item.color"),`; 855} 856 857.p-editor .p-editor-toolbar.ql-snow .ql-fill { 858 fill: `).concat(r("editor.toolbar.item.color"),`; 859} 860 861.p-editor .p-editor-toolbar.ql-snow .ql-picker .ql-picker-label { 862 border: 0 none; 863 color: `).concat(r("editor.toolbar.item.color"),`; 864} 865 866.p-editor .p-editor-toolbar.ql-snow .ql-picker .ql-picker-label:hover { 867 color: `).concat(r("editor.toolbar.item.hover.color"),`; 868} 869 870.p-editor .p-editor-toolbar.ql-snow .ql-picker .ql-picker-label:hover .ql-stroke { 871 stroke: `).concat(r("editor.toolbar.item.hover.color"),`; 872} 873 874.p-editor .p-editor-toolbar.ql-snow .ql-picker .ql-picker-label:hover .ql-fill { 875 fill: `).concat(r("editor.toolbar.item.hover.color"),`; 876} 877 878.p-editor .p-editor-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label { 879 color: `).concat(r("editor.toolbar.item.active.color"),`; 880} 881 882.p-editor .p-editor-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke { 883 stroke: `).concat(r("editor.toolbar.item.active.color"),`; 884} 885 886.p-editor .p-editor-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill { 887 fill: `).concat(r("editor.toolbar.item.active.color"),`; 888} 889 890.p-editor .p-editor-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options { 891 background: `).concat(r("editor.overlay.background"),`; 892 border: 1px solid `).concat(r("editor.overlay.border.color"),`; 893 box-shadow: `).concat(r("editor.overlay.shadow"),`; 894 border-radius: `).concat(r("editor.overlay.border.radius"),`; 895 padding: `).concat(r("editor.overlay.padding"),`; 896} 897 898.p-editor .p-editor-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options .ql-picker-item { 899 color: `).concat(r("editor.overlay.option.color"),`; 900 border-radius: `).concat(r("editor.overlay.option.border.radius"),`; 901} 902 903.p-editor .p-editor-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options .ql-picker-item:hover { 904 background: `).concat(r("editor.overlay.option.focus.background"),`; 905 color: `).concat(r("editor.overlay.option.focus.color"),`; 906} 907 908.p-editor .p-editor-toolbar.ql-snow .ql-picker.ql-expanded:not(.ql-icon-picker) .ql-picker-item { 909 padding: `).concat(r("editor.overlay.option.padding"),`; 910} 911 912.p-editor .p-editor-content { 913 border-end-end-radius: `).concat(r("editor.content.border.radius"),`; 914 border-end-start-radius: `).concat(r("editor.content.border.radiu
914s"),`; 915} 916 917.p-editor .p-editor-content.ql-snow { 918 border: 1px solid `).concat(r("editor.content.border.color"),`; 919} 920 921.p-editor .p-editor-content .ql-editor { 922 background: `).concat(r("editor.content.background"),`; 923 color: `).concat(r("editor.content.color"),`; 924 border-end-end-radius: `).concat(r("editor.content.border.radius"),`; 925 border-end-start-radius: `).concat(r("editor.content.border.radius"),`; 926} 927 928.p-editor .ql-snow.ql-toolbar button:hover, 929.p-editor .ql-snow.ql-toolbar button:focus { 930 color: `).concat(r("editor.toolbar.item.hover.color"),`; 931} 932 933.p-editor .ql-snow.ql-toolbar button:hover .ql-stroke, 934.p-editor .ql-snow.ql-toolbar button:focus .ql-stroke { 935 stroke: `).concat(r("editor.toolbar.item.hover.color"),`; 936} 937 938.p-editor .ql-snow.ql-toolbar button:hover .ql-fill, 939.p-editor .ql-snow.ql-toolbar button:focus .ql-fill { 940 fill: `).concat(r("editor.toolbar.item.hover.color"),`; 941} 942 943.p-editor .ql-snow.ql-toolbar button.ql-active, 944.p-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active, 945.p-editor .ql-snow.ql-toolbar .ql-picker-item.ql-selected { 946 color: `).concat(r("editor.toolbar.item.active.color"),`; 947} 948 949.p-editor .ql-snow.ql-toolbar button.ql-active .ql-stroke, 950.p-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke, 951.p-editor .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke { 952 stroke: `).concat(r("editor.toolbar.item.active.color"),`; 953} 954 955.p-editor .ql-snow.ql-toolbar button.ql-active .ql-fill, 956.p-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill, 957.p-editor .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill { 958 fill: `).concat(r("editor.toolbar.item.active.color"),`; 959} 960 961.p-editor .ql-snow.ql-toolbar button.ql-active .ql-picker-label, 962.p-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-picker-label, 963.p-editor .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-picker-label { 964 color: `).concat(r("editor.toolbar.item.active.color"),`; 965} 966`)},Ul={root:function(t){var r=t.instance;return["p-editor",{"p-invalid":r.$invalid}]},toolbar:"p-editor-toolbar",content:"p-editor-content"},Nl=At.extend({name:"editor",theme:Dl,classes:Ul}),Bl={name:"BaseEditor",extends:Zt,props:{placeholder:String,readonly:Boolean,formats:Array,editorStyle:null,modules:null},style:Nl,provide:function(){return{$pcEditor:this,$parentInstance:this}}};function Ue(s){"@babel/helpers - typeof";return Ue=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ue(s)}function ft(s,t){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(s);t&&(h=h.filter(function(n){return Object.getOwnPropertyDescriptor(s,n).enumerable})),r.push.apply(r,h)}return r}function Kl(s){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ft(Object(r),!0).forEach(function(h){Wl(s,h,r[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):ft(Object(r)).forEach(function(h){Object.defineProperty(s,h,Object.getOwnPropertyDescriptor(r,h))})}return s}function Wl(s,t,r){return(t=Yl(t))in s?Object.defineProperty(s,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[t]=r,s}function Yl(s){var t=Ql(s,"string");return Ue(t)=="symbol"?t:t+""}function Ql(s,t){if(Ue(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var h=r.call(s,t||"default");if(Ue(h)!="object")return h;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(s)}var gt=function(){try{return window.Quill}catch{return null}}(),xt={name:"Editor",extends:Bl,inheritAttrs:!1,emits:["text-change","selection-change","load"],data:function(){return{reRenderColorKey:0}},quill:null,watch:{modelValue:function(t,r){t!==r&&this.quill&&!this.quill.hasFocus()&&(this.reRenderColorKey++,this.renderValue(t))},readonly:function(){this.handleReadOnlyChange()}},mounted:function(){var t=this,r={modules:Kl({toolbar:this.$refs.toolbarElement},this.modules),readOnly:this.readonly,theme:"snow",formats:this.formats,placeholder:this.placeholder};gt?(this.quill=new gt(this.$refs.editorElement,r),this.initQuill(),this.handleLoad()):Lt(()=>import("./BNfiALQ0.js"),__vite__mapDeps([0,1]),import.meta.url).then(function(h){h&&Mt(t.$refs.editorElement)&&(h.default?t.quill=new h.default(t.$refs.editorElement,r):t.quill=new h(t.$refs.editorElement,r),t.initQuill())}).then(function(){t.handleLoad()})},beforeUnmount:function(){this.quill=null},methods:{renderValue:function(t){this.quill&&(t?this.quill.clipboard.dangerouslyPasteHTML(t):this.quill.setText(""))},initQuill:function(){var t=this;this.renderValue(this.d_value),this.quill.on("text-change",function(r,h,n){if
966(n==="user"){var I=t.$refs.editorElement.children[0].innerHTML,O=t.quill.getText().trim();I==="<p><br></p>"&&(I=""),t.writeValue(I),t.$emit("text-change",{htmlValue:I,textValue:O,delta:r,source:n,instance:t.quill})}}),this.quill.on("selection-change",function(r,h,n){var I=t.$refs.editorElement.children[0].innerHTML,O=t.quill.getText().trim();t.$emit("selection-change",{htmlValue:I,textValue:O,range:r,oldRange:h,source:n,instance:t.quill})})},handleLoad:function(){this.quill&&this.quill.getModule("toolbar")&&this.$emit("load",{instance:this.quill})},handleReadOnlyChange:function(){this.quill&&this.quill.enable(!this.readonly)}}};function Jl(s,t,r,h,n,I){return u(),q("div",S({class:s.cx("root")},s.ptmi("root")),[e("div",S({ref:"toolbarElement",class:s.cx("toolbar")},s.ptm("toolbar")),[jt(s.$slots,"toolbar",{},function(){return[e("span",S({class:"ql-formats"},s.ptm("formats")),[e("select",S({class:"ql-header",defaultValue:"0"},s.ptm("header")),[e("option",S({value:"1"},s.ptm("option")),"Heading",16),e("option",S({value:"2"},s.ptm("option")),"Subheading",16),e("option",S({value:"0"},s.ptm("option")),"Normal",16)],16),e("select",S({class:"ql-font"},s.ptm("font")),[e("option",Rt(Gt(s.ptm("option"))),null,16),e("option",S({value:"serif"},s.ptm("option")),null,16),e("option",S({value:"monospace"},s.ptm("option")),null,16)],16)],16),e("span",S({class:"ql-formats"},s.ptm("formats")),[e("button",S({class:"ql-bold",type:"button"},s.ptm("bold")),null,16),e("button",S({class:"ql-italic",type:"button"},s.ptm("italic")),null,16),e("button",S({class:"ql-underline",type:"button"},s.ptm("underline")),null,16)],16),(u(),q("span",S({key:n.reRenderColorKey,class:"ql-formats"},s.ptm("formats")),[e("select",S({class:"ql-color"},s.ptm("color")),null,16),e("select",S({class:"ql-background"},s.ptm("background")),null,16)],16)),e("span",S({class:"ql-formats"},s.ptm("formats")),[e("button",S({class:"ql-list",value:"ordered",type:"button"},s.ptm("list")),null,16),e("button",S({class:"ql-list",value:"bullet",type:"button"},s.ptm("list")),null,16),e("select",S({class:"ql-align"},s.ptm("select")),[e("option",S({defaultValue:""},s.ptm("option")),null,16),e("option",S({value:"center"},s.ptm("option")),null,16),e("option",S({value:"right"},s.ptm("option")),null,16),e("option",S({value:"justify"},s.ptm("option")),null,16)],16)],16),e("span",S({class:"ql-formats"},s.ptm("formats")),[e("button",S({class:"ql-link",type:"button"},s.ptm("link")),null,16),e("button",S({class:"ql-image",type:"button"},s.ptm("image")),null,16),e("button",S({class:"ql-code-block",type:"button"},s.ptm("codeBlock")),null,16)],16),e("span",S({class:"ql-formats"},s.ptm("formats")),[e("button",S({class:"ql-clean",type:"button"},s.ptm("clean")),null,16)],16)]})],16),e("div",S({ref:"editorElement",class:s.cx("content"),style:s.editorStyle},s.ptm("content")),null,16)],16)}xt.render=Jl;const Zl={key:0,class:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-4"},Xl={class:"flex items-center gap-3 mb-3"},eo={class:"flex-1"},to={class:"text-blue-900 font-medium"},lo={class:"ml-2 text-sm"},oo={class:"text-blue-700 text-sm mt-1"},no={key:0,class:"ml-9 space-y-2"},io={class:"flex items-center gap-3"},ro={key:0,class:"flex items-center gap-1"},so={class:"font-semibold"},ao={key:1,class:"bg-amber-50 border border-amber-200 rounded-lg p-4 mb-4"},co={class:"flex items-center gap-3 mb-3"},uo={class:"flex-1"},po={class:"text-amber-900 font-medium"},mo={class:"ml-2 text-sm"},qo={class:"text-amber-700 text-sm mt-1"},fo={key:0,class:"ml-9 space-y-2"},go={class:"text-sm text-amber-900"},bo={class:"flex items-center gap-3"},vo={key:0,class:"flex items-center gap-1"},ho={class:"font-semibold"},_o={class:"bg-white rounded-lg border border-gray-200 p-6"},yo={class:"flex items-center justify-between mb-4"},wo={class:"text-2xl font-bold text-gray-900"},ko={class:"flex gap-2"},xo={class:"mb-4"},$o={class:"text-lg font-semibold text-black block mb-2"},So=["innerHTML"],Io={class:"text-lg font-semibold text-black block mb-2"},Co=["innerHTML"],Eo={class:"py-4"},Po={key:0,class:"flex items-center justify-center py-6"},To={class:"ml-3 text-gray-600"},zo={key:1,class:"text-center py-6"},Ao={class:"text-gray-600"},Lo={class:"text-gray-600 mb-4"},Mo={class:"space-y-3"},jo=["for"],Ro={key:0,class:"text-xs text-orange-500 ml-2"},Go={key:1,class:"text-xs text-green-600 ml-2"},Fo={class:"flex justify-end gap-2"},Oo={class:"py-4"},Ho={class:"space-y-6"},Vo={class:"text-sm font-bold text-gray-700 block mb-2"},Do={class:"text-sm font-bold text-gray-700 block mb-2"},Uo={class:"ql-formats"},No={class:"ql-bold"},Bo={class:"ql-italic"},Ko={class:"ql-underline"},Wo={class:"ql-strike"},Yo={class:"ql-formats"},Qo={class:"ql-list",value:"ordered"},Jo={class:"ql-list",value:"bullet"},Zo={class:"ql-formats"},Xo={class:"ql-direction",value:"rtl"},en={class:"ql-formats"},tn={class:"ql-clean"},ln={class:"flex justify-end items-center w-full"},on={class:"flex gap-3"},nn={key:0,class:"flex items-center justify-center py-12"},rn={class:"ml-3 text-gray-600"},sn={key:1,class:"text-center py-12"},an={class:"text-gray-600"},dn={key:2,class:"space-y-4 py-4"},cn=["innerHTML"],un={class:"flex items-center justify-between mt-4"},pn={class:"text-sm text-gray-600"},mn={key:0,class:"flex items-center gap-2"},qn={key:1,class:"flex items-center gap-2"},fn={class:"flex gap-2"},gn={key:0,class:"py-4"},bn={class:"space-y-6"},vn={class:"text-sm font-bold text-gray-700 block mb-2"},hn=["innerHTML"],_n={class:"text-sm font-bold text-gray-700 block mb-2"},yn=["innerHTML"],wn={class:"grid grid-cols-2 gap-4 pt-4 border-t border-gray-200"},kn={class:"text-xs font-semibold text-gray-500 uppercase"},xn={class:"text-sm text-gray-900 mt-1"},$n={class:"text-xs font-semibold text-gray-500 uppercase"},Sn={class:"text-sm text-gray-900 mt-1"},In={class:"flex justify-end gap-2"},Cn=5e3,En={__name:"ProductContent",props:{product:{type:Object,required:!0},domain:{type:String,required:!0},shopDomain:{type:String,required:!1,default:null}
966,shopSettings:{type:Object,required:!1,default:null},isConfigured:{type:Boolean,required:!1,default:!1}},emits:["refresh"],setup(s,{emit:t}){const r=s,h=t,{t:n}=ut(),I=ht(),O=/[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]/,Me=/[A-Za-z\u00C0-\u024F]/,M=d=>{for(const o of d||""){if(O.test(o))return"rtl";if(Me.test(o))return"ltr"}return"ltr"};let z=null;const ce=()=>{var V;if(!z)return;const d=M(z.getText()),o=z.getLength();(((V=z.getFormat(0,o))==null?void 0:V.direction)==="rtl"?"rtl":"ltr")!==d&&z.formatLine(0,o,{direction:d==="rtl"?"rtl":!1,align:d==="rtl"?"right":!1})},T=d=>{z=(d==null?void 0:d.instance)||null,z&&(ce(),z.on("text-change",ce))},{fetchShopSettings:Ne}=kt(),v={en:n("english"),ar:n("arabic")},R=ne(()=>{var d;return(d=r.shopSettings)!=null&&d.projects?r.shopSettings.projects.map(o=>({language:o.target_language,status:o.config_status,isReady:o.config_status==="READY",isPending:o.config_status==="PENDING",active:o.active})):[]});ne(()=>R.value.map(d=>d.language));const ge=d=>v[d]||d,be=f(!1),U=f([]),ke=f(!1),xe=f(!1),le=f([]),Y=f([]),je=f(!1),K=f(!1),Q=f(!1),J=f(null),j=f(!1),W=f(""),H=f(""),E=f(null),ie=f(!1),re=f(!1),oe=f(!1),N=f(!1),se=f([]),ve=f(!1),A=f(null),he=f(!1),ue=ne(()=>Y.value.filter(d=>(d==null?void 0:d.status)==="pending")),pe=ne(()=>Y.value.filter(d=>(d==null?void 0:d.status)==="in_review")),$e=d=>d?new Date(d).toLocaleString():"",Se=async()=>{var d;if(!r.shopDomain){I.add({severity:"warn",summary:n("warning"),detail:n("no_target_languages_configured"),life:5e3});return}xe.value=!0,be.value=!0,U.value=[];try{const o=await Ne(r.shopDomain);o.success&&((d=o.data)!=null&&d.projects)?le.value=o.data.projects.map(C=>({language:C.target_language,status:C.config_status,isReady:C.config_status==="READY",isPending:C.config_status==="PENDING",active:C.active})):le.value=[]}catch(o){console.error("Error fetching shop settings:",o),le.value=[]}finally{xe.value=!1}},Ie=()=>{be.value=!1,U.value=[],le.value=[]},B=d=>{if(!d)return d;if(typeof d=="string"&&(d.startsWith("gid://shopify/Product/")||d.startsWith("gid://shopify/ProductVariant/"))){const o=d.split("/");return o[o.length-1]}return d},Ce=async()=>{var d;if(!((d=r.product)!=null&&d.product_id)||U.value.length===0){I.add({severity:"warn",summary:n("warning"),detail:n("please_select_at_least_one_language"),life:3e3});return}ke.value=!0;try{const o=await $fetch("/api/generation-management/product-content-generate",{method:"POST",body:{product_id:B(r.product.product_id),shop_id:r.shopDomain,target_languages:U.value}});if(o!=null&&o.success)I.add({severity:"success",summary:n("success"),detail:n("content_generation_started"),life:3e3}),Ie(),await _e();else throw new Error((o==null?void 0:o.message)||"Failed to generate content")}catch(o){console.error("Error generating content:",o),I.add({severity:"error",summary:n("error"),detail:n("failed_to_generate_content"),life:5e3})}finally{ke.value=!1}},_e=async()=>{var d;if((d=r.product)!=null&&d.product_id){if(!r.shopDomain){console.error("Shop domain is required to fetch product content");return}je.value=!0;try{const o=await $fetch("/api/generation-management/product-content-generated",{params:{product_id:B(r.product.product_id),shop_id:r.shopDomain,status:["pending","in_review"]}});o!=null&&o.success&&Array.isArray(o==null?void 0:o.data)?(Y.value=o.data||[],K.value=ue.value.length>0,Q.value=pe.value.length>0,K.value?ye():me()):(Y.value=[],K.value=!1,Q.value=!1,me())}catch(o){console.error("Error fetching product content:",o),Y.value=[],K.value=!1,Q.value=!1,me()}finally{je.value=!1}}},ye=()=>{J.value&&clearInterval(J.value),J.value=tl(()=>{_e()},Cn)},me=()=>{J.value&&(clearInterval(J.value),J.value=null)},Xe=async()=>{N.value=!0,await Be()},et=()=>{N.value=!1,se.value=[]},Be=async()=>{var d;if((d=r.product)!=null&&d.product_id){if(!r.shopDomain){console.error("Shop domain is required to fetch ready content");return}ve.value=!0;try{const o=await $fetch("/api/generation-management/product-content-generated",{params:{product_id:B(r.product.product_id),shop_id:r.shopDomain,status:["ready","published"]}});o!=null&&o.success&&Array.isArray(o==null?void 0:o.data)?se.value=o.data||[]:se.value=[]}catch(o){console.error("Error fetching ready content:",o),se.value=[]}finally{ve.value=!1}}},tt=d=>{A.value=d,he.value=!0},lt=()=>{he.value=!1,A.value=null},we=f(!1),ot=async d=>{var o,C;if(d!=null&&d.product_content_id){we.value=!0;try{const V=await $fetch("/api/generation-management/product-content-publish",{method:"POST",body:{product_id:B(r.product.product_id),product_content_id:d.product_content_id,title:(o=d.reviewed_content)==null?void 0:o.title,de
966scription:(C=d.reviewed_content)==null?void 0:C.description,language:d.language,shop_id:r.shopDomain}});if(!(V!=null&&V.success))throw new Error((V==null?void 0:V.message)||"Failed to publish content");I.add({severity:"success",summary:n("success"),detail:n("content_published_to_shopify_successfully"),life:3e3}),et(),h("refresh")}catch(V){console.error("Error publishing history content:",V),I.add({severity:"error",summary:n("error"),detail:n("failed_to_publish_content"),life:5e3})}finally{we.value=!1}}},nt=d=>{const o=Y.value.find(C=>(C==null?void 0:C.product_content_id)===d);console.log("Opening review modal for content ID:",d,"Found item:",o),o?(E.value=o,W.value=o.optimized_content.title||"",H.value=o.optimized_content.description||"",j.value=!0):I.add({severity:"error",summary:n("error"),detail:n("content_not_found"),life:3e3})},Re=()=>{j.value=!1,W.value="",H.value="",E.value=null,ie.value=!1,re.value=!1,oe.value=!1},Ge=async()=>{var d;if((d=E.value)!=null&&d.product_content_id){ie.value=!0;try{const o=await $fetch("/api/generation-management/product-content-reject",{method:"POST",body:{product_content_id:E.value.product_content_id}});if(o!=null&&o.success)I.add({severity:"success",summary:n("success"),detail:n("content_rejected_successfully"),life:3e3}),Re(),await _e();else throw new Error((o==null?void 0:o.message)||"Failed to reject content")}catch(o){console.error("Error rejecting content:",o),I.add({severity:"error",summary:n("error"),detail:n("failed_to_reject_content"),life:5e3})}finally{ie.value=!1}}},it=async()=>{if(E.value){re.value=!0;try{const d=await $fetch("/api/generation-management/product-content-reviewed",{method:"PUT",body:{product_content_id:E.value.product_content_id,reviewed_title:W.value,reviewed_description:H.value}});if(!(d!=null&&d.success))throw new Error((d==null?void 0:d.message)||"Failed to save content");I.add({severity:"success",summary:n("success"),detail:n("content_added_to_history"),life:3e3}),Re(),await _e()}catch(d){console.error("Error saving content:",d),I.add({severity:"error",summary:n("error"),detail:n("failed_to_save_content"),life:5e3})}finally{re.value=!1}}},rt=async()=>{var d;if((d=E.value)!=null&&d.product_content_id){oe.value=!0;try{const o=await $fetch("/api/generation-management/product-content-publish",{method:"POST",body:{product_id:B(r.product.product_id),product_content_id:E.value.product_content_id,title:W.value,description:H.value,language:E.value.language,shop_id:r.shopDomain}});if(!(o!=null&&o.success))throw new Error((o==null?void 0:o.message)||"Failed to publish content");I.add({severity:"success",summary:n("success"),detail:n("content_published_to_shopify_successfully"),life:3e3}),Re(),await _e(),h("refresh")}catch(o){console.error("Error publishing content:",o),I.add({severity:"error",summary:n("error"),detail:n("failed_to_publish_content"),life:5e3})}finally{oe.value=!1}}};return _t(()=>{_e()}),Ft(()=>{var d;me(),(d=z==null?void 0:z.off)==null||d.call(z,"text-change",ce)}),(d,o)=>{var We,Fe;const C=wt,V=el,Te=yt,Ke=Xt,st=xt,Z=Jt;return u(),q(D,null,[K.value?(u(),q("div",Zl,[e("div",Xl,[o[7]||(o[7]=e("i",{class:"pi pi-spin pi-spinner text-blue-600 text-xl"},null,-1)),e("div",eo,[e("p",to,[dt(p(l(n)("content_generation_in_progress"))+" ",1),e("span",lo,"("+p(ue.value.length)+" "+p(ue.value.length===1?l(n)("item"):l(n)("items"))+")",1)]),e("p",oo,p(l(n)("content_generation_in_progress_description")),1)])]),ue.value.length>0?(u(),q("div",no,[(u(!0),q(D,null,te(ue.value,b=>(u(),q("div",{key:b.product_content_id,class:"text-sm text-blue-800 bg-blue-100 rounded px-3 py-2"},[e("div",io,[b.language?(u(),q("div",ro,[o[8]||(o[8]=e("i",{class:"pi pi-globe text-xs"},null,-1)),e("span",so,p(ge(b.language)),1)])):L("",!0),e("div",null,p($e(b.created_at)),1)])]))),128))])):L("",!0)])):L("",!0),Q.value?(u(),q("div",ao,[e("div",co,[o[9]||(o[9]=e("i",{class:"pi pi-info-circle text-amber-600 text-xl"},null,-1)),e("div",uo,[e("p",po,[dt(p(l(n)("content_ready_for_review"))+" ",1),e("span",mo,"("+p(pe.value.length)+" "+p(pe.value.length===1?l(n)("item"):l(n)("items"))+")",1)]),e("p",qo,p(l(n)("content_ready_for_review_description")),1)])]),pe.value.length>0?(u(),q("div",fo,[(u(!0),q(D,null,te(pe.value,b=>(u(),q("div",{key:b.product_content_id,class:"flex items-center justify-between bg-amber-100 rounded px-3 py-2"},[e("div",go,[e("div",bo,[b.language?(u(),q("div",vo,[o[10]||(o[10]=e("i",{class:"pi pi-globe text-xs"},null,-1)),e("span",ho,p(ge(b.language)),1)])):L("",!0),e("div",null,p($e(b.created_at)),1)])]),c(C,{label:l(n)("review"),size:"small",onClick:ae=>nt(b.product_content_id)},null,8,["label","onClick"])]))),128))])):L("",!0)])):L("",!0),e("div",_o,[e("div",yo,[e("h1",wo,p(l(n)("product_content")),1),e("div",ko,[de((u(),Pe(C,{outlined:"",severity:"secondary",label:l(n)("saved_content"),onClick:Xe,disabled:!s.isConfigured},{icon:P(()=>o[11]||(o[11]=[e("i",{class:"pi pi-history mr-2"},null,-1)])),_:1},8,["label","disabled"])),[[Z,s.isConfigured?"":l(n)("you_need_to_configure_first"),void 0,{top:!0}]]),de((u(),Pe(C,{label:l(n)("generate_content"),onClick:Se,disabled:K.value||Q.value||!s.isConfigured},{icon:P(()=>o[12]||(o[12]=[e("i",{class:"pi pi-sparkles mr-2"},null,-1)])),_:1},8,["label","disabled"])),[[Z,s.isConfigured?K.value||Q.value?l(n)("finish_pending_content_first"):"":l(n)("you_need_to_configure_first"),void 0,{top:!0}]])])]),e("div",xo,[e("h4",$o,p(l(n)("product_title")),1),e("p",{innerHTML:((We=s.product)==null?void 0:We.title)||"",class:"text-gray-700 leading-relaxed whitespace-pre-line"},null,8,So)]),e("div",null,[e("h4",Io,p(l(n)("product_description")),1),e("p",{innerHTML:((Fe=s.product)==null?void 0:Fe.description)||"",class:"text-gray-700 leading-relaxed whitespace-pre-line"},null,8,Co)])]),c(Te,{visible:be.value,"onUpdate:visible":o[1]||(o[1]=b=>be.value=b),modal:"",header:l(n)("select_target_languages"),style:{width:"90vw",maxWidth:"500px"}},{footer:P(()=>[e("div",Fo,[c(C,{label:l(n)("close"),severity:"secondary",onClick:Ie,disabled:ke.value},null,8,["label","disabled"]),c(C,{label:l(n)("generate_content"),icon:"pi pi-sparkles",disabled:U.value.length===0||ke.value||xe.value,loading:ke.value,onClick:Ce},null,8,["label","disabled","loading"])])]),default:P(()=>[e("div",Eo,[xe.value?(u(),q("div",Po,[o[13]||(o[13]=e("i",{class:"pi pi-spin pi-spinner text-2xl text-blue-600"},null,-1)),e("span",To,p(l(n)("loading"))+"...",1)])):le.value.length===0?(u(),q("div",zo,[o[14]||(o[14]=e("i",{class:"pi pi-info-circle text-3xl text-gray-400 mb-2"},null,-1)),e("p",Ao,p(l(n)("no_target_languages_configured")),1)])):(u(),q(D,{key:2},[e("p",Lo,p(l(n)("select_languages_for_content_generation")),1),e("div",Mo,[(u(!0),q(D,null,te(le.value,b=>(u(),q("div",{key:b.language,class:"flex items-center gap-3"},[c(V,{modelValue:U.value,"onUpdate:modelValue":o[0]||(o[0]=ae=>U.value=ae),inputId:b.language,value:b.language,disabled:b.isPending},null,8,["modelValue","inputId","value","disabled"]),e("label",{for:b.language,class:vt(["ml-2",b.isPending?"text-gray-400 cursor-not-allowed":"text-gray-700 cursor-pointer"])},[dt(p(ge(b.language))+" ",1),b.isPending?(u(),q("span",Ro,"("+p(l(n)("pending"))+")",1)):b.isReady?(u(),q("span",Go,"("+p(l(n)("ready"))+")",1)):L("",!0)],10,jo)]))),128))])],64))])]),_:1},8,["visible","header"]),c(Te,{visible:j.value,"onUpdate:visible":o[4]||(o[4]=b=>j.value=b),modal:"",header:l(n)("review_content"),style:{width:"90vw",maxWidth:"800px"}},{footer:P(()=>[e("div",ln,[e("div",on,[c(C,{label:l(n)("reject"),icon:"pi pi-times",severity:"danger",outlined:"",loading:ie.value,onClick:Ge},null,8,["label","loading"]),c(C,{label:l(n)("save"),icon:"pi pi-save",severity:"secondary",outlined:"",loading:re.value,onClick:it},null,8,["label","loading"]),c(C,{label:l(n)("publish_to_shopify"),icon:"pi pi-upload",loading:oe.value,onClick:rt},null,8,["label","loading"])])])]),default:P(()=>[e("div",Oo,[e("div",Ho,[e("div",null,[e("label",Vo,p(l(n)("product_title")),1),c(Ke,{modelValue:W.value,"onUpdate:modelValue":o[2]||(o[2]=b=>W.value=b),class:"w-full"},null,8,["modelValue"])]),e("div",null,[e("label",Do,p(l(n)("product_description")),1),c(st,{modelValue:H.value,"onUpdate:modelValue":o[3]||(o[3]=b=>H.value=b),editorStyle:"height: 320px",onLoad:T},{toolbar:P(()=>[e("span",Uo,[de(e("button",No,null,512),[[Z,"Bold",void 0,{bottom:!0}]]),de(e("button",Bo,null,512),[[Z,"Italic",void 0,{bottom:!0}]]),de(e("button",Ko,null,512),[[Z,"Underline",void 0,{bottom:!0}]]),de(e("button",Wo,null,512),[[Z,"Strike",void 0,{bottom:!0}]])]),o[16]||(o[16]=e("span",{class:"ql-formats"},[e("select",{class:"ql-color"}),e("select",{class:"ql-background"})],-1)),e("span",Yo,[de(e("button",Qo,null,512),[[Z,"Ordered List",void 0,{bottom:!0}]]),de(e("button",Jo,null,512),[[Z,"Bullet List",void 0,{bottom:!0}]])]),e("span",Zo,[o[15]||(o[15]=e("select",{class:"ql-align"},[e("option",{selected:""}),e("option",{value:"center"}),e("option",{value:"right"}),e("option",{value:"justify"})],-1)),de(e("button",Xo,null,512),[[Z,"Text Direction",void 0,{bottom:!0}]])]),e("span",en,[de(e("button",tn,null,512),[[Z,"Clear Formatting",void 0,{bottom:!0}]])])]),_:1},8,["modelValue"])])])])]),_:1},8,["visible","header"]),c(Te,{visible:N.value,"onUpdate:visible":o[5]||(o[5]=b=>N.value=b),modal:"",header:l(n)("saved_content"),style:{width:"90vw",maxWidth:"900px"}},{default:P(()=>[ve.value?(u(),q("div",nn,[o[17]||(o[17]=e("i",{class:"pi pi-spin pi-spinner text-3xl text-blue-600"},null,-1)),e("span",rn,p(l(n)("loading"))+"...",1)])):se.value.length===0?(u(),q("div",sn,[o[18]||(o[18]=e("i",{class:"pi pi-inbox text-5xl text-gray-400 mb-4"},null,-1)),e("p",an,p(l(n)("no_content_history")),1)])):(u(),q("div",dn,[(u(!0),q(D,null,te(se.value,b=>{var ae;return u(),q("div",{key:b.product_content_id,class:"border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow"},[e("h3",{innerHTML:((ae=b==null?void 0:b.reviewed_content)==null?void 0:ae.title)||"",class:"text-lg font-semibold text-gray-900 mb-3"},null,8,cn),e("div",un,[e("div",pn,[b.published_at?(u(),q("span",mn,[o[19]||(o[19]=e("i",{class:"pi pi-check-circle text-green-600"},null,-1)),e("span",null,p(l(n)("published_at"))+": "+p($e(b.published_at)),1)])):(u(),q("span",qn,[o[20]||(o[20]=e("i",{class:"pi pi-clock text-gray-400"},null,-1)),e("span",null,p(l(n)("not_published_yet")),1)]))]),e("div",fn,[c(C,{label:l(n)("view"),icon:"pi pi-eye",size:"small",outlined:"",onClick:ze=>tt(b)},null,8,["label","onClick"]),c(C,{label:l(n)("publish"),icon:"pi pi-upload",size:"small",loading:we.value,onClick:ze=>ot(b)},null,8,["label","loading","onClick"])])])])}),128))]))]),_:1},8,["visible","header"]),c(Te,{visible:he.value,"onUpdate:visible":o[6]||(o[6]=b=>he.value=b),modal:"",header:l(n)("content_details"),style:{width:"90vw",maxWidth:"800px"}},{footer:P(()=>[e("div",In,[c(C,{label:l(n)("close"),severity:"secondary",onClick:lt},null,8,["label"])])]),default:P(()=>{var b,ae,ze,Ye,Oe,qe;return[A.value?(u(),q("div",gn,[e("div",bn,[e("div",null,[e("label",vn,p(l(n)("product_title")),1),e("p",{innerHTML:((ae=(b=A.value)==null?void 0:b.reviewed_content)==null?void 0:ae.title)||"",class:"text-gray-900 p-3 bg-gray-50 rounded border border-gray-200"},null,8,hn)]),e("div",null,[e("label",_n,p(l(n)("product_description")),1),e("p",{innerHTML:((Ye=(ze=A.value)==null?void 0:ze.reviewed_content)==null?void 0:Ye.de
966scription)||"",class:"text-gray-900 p-3 bg-gray-50 rounded border border-gray-200 whitespace-pre-line"},null,8,yn)]),e("div",wn,[e("div",null,[e("label",kn,p(l(n)("created_at")),1),e("p",xn,p($e((Oe=A.value)==null?void 0:Oe.created_at)),1)]),e("div",null,[e("label",$n,p(l(n)("published_at")),1),e("p",Sn,p((qe=A.value)!=null&&qe.published_at?$e(A.value.published_at):l(n)("not_published_yet")),1)])])])])):L("",!0)]}),_:1},8,["visible","header"])],64)}}},Pn={key:1,class:"p-6"},Tn={key:0,class:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6 flex items-center justify-between"},zn={class:"flex items-center gap-3"},An={class:"text-blue-900 font-medium"},Ln={class:"text-blue-700 text-sm mt-1"},Mn={class:""},jn={class:"flex items-start justify-between"},Rn={class:"grid grid-cols-1 lg:grid-cols-3 gap-6"},Gn={class:"lg:col-span-2 space-y-6"},Fn={class:"bg-white rounded-lg border border-gray-200 p-6"},On={class:"flex items-center justify-between mb-4"},Hn={class:"text-2xl font-semibold text-black block mb-2"},Vn={class:"flex gap-4"},Dn={key:1},Un={class:"grid grid-cols-2 md:grid-cols-4 gap-4"},Nn=["src","alt"],Bn={key:0,class:"mt-4 flex justify-center"},Kn={key:2,class:"text-center py-8 text-gray-500"},Wn={class:"bg-white rounded-lg border border-gray-200 p-6"},Yn={class:"text-lg font-semibold text-gray-900 mb-4"},Qn=["src","alt"],Jn={class:"flex gap-2 flex-wrap"},Zn={class:"flex flex-col gap-1"},Xn={class:"text-gray-700 font-mono text-sm"},ei={class:"space-y-6"},ti={class:"bg-white rounded-lg border border-gray-200 p-6"},li={class:"text-sm font-bold text-gray-700 block mb-3"},oi={class:"rounded-lg overflow-hidden border border-gray-200 bg-gray-50"},ni=["src","alt"],ii={class:"bg-white rounded-lg border border-gray-200 p-6"},ri={class:"space-y-4"},si={class:"text-sm font-bold text-gray-700 block mb-1"},ai={class:"flex items-center gap-2"},di={class:"text-gray-600"},ci={key:0},ui={class:"text-sm font-bold text-gray-700 block mb-1"},pi={key:1},mi={class:"text-sm font-bold text-gray-700 block mb-1"},qi={class:"flex items-center gap-2"},fi={class:"text-gray-600"},gi={key:2},bi={class:"text-sm font-bold text-gray-700 block mb-1"},vi={class:"flex gap-2 flex-wrap"},hi={key:3},_i={class:"text-sm font-bold text-gray-700 block mb-1"},yi={class:"flex items-center gap-2"},wi={class:"text-gray-600 text-sm"},ki={key:4},xi={class:"text-sm font-bold text-gray-700 block mb-1"},$i=["href"],Si={key:2,class:"flex flex-col items-center justify-center py-20"},Ii={class:"text-2xl font-semibold text-gray-900 mb-2"},Ci={class:"text-gray-600 mb-6"},Ei={key:0,class:"py-4"},Pi={class:"text-gray-600 mb-6"},Ti={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},zi={key:1,class:"py-4"},Ai={class:"grid grid-cols-1 lg:grid-cols-2 gap-6"},Li={class:"bg-white rounded-xl border border-gray-200 p-6"},Mi={class:"flex items-center gap-3 mb-6 pb-4 border-b border-gray-100"},ji={class:"text-lg font-semibold text-gray-900"},Ri={class:"text-sm text-gray-500"},Gi={class:"lg:sticky lg:top-4 h-fit"},Fi={key:0,class:"flex justify-between items-center w-full"},Oi={class:"flex items-center gap-3"},Hi={class:"flex items-center gap-4"},Vi={class:"text-sm text-gray-600"},Di={class:"py-4"},bt=8,Ui={__name:"[id]",setup(s){const{t}=ut(),r=Ot(),h=Ht(),n=ht(),I=Vt(),{fetchShopSettings:O,isShopConfigured:Me}=kt(),M=ne(()=>{var a;return(a=I.selectedWebsite)==null?void 0:a.website}),{setTitle:z}=Qt();z(t("product_details"));const ce=f([]),T=f(null),Ne=f(!1),v=f(null),R=f([]),ge=f(!0),be=f(!1),U=f(!1),ke=ne(()=>U.value?R.value:R.value.slice(0,bt)),xe=ne(()=>Math.max(0,R.value.length-bt)),le=f(null),Y=f(!0),je=f(!1),K=f(!1),Q=f(null),J=f(!1),j=f(null),W=f(!1),H=f([]),E=f([]),ie=f(!1),re=f(!1),oe=f(!1),N=f(null),se=f(!1),ve=f(!1),A=f([]),he=f(!1),ue=f(!1),pe=f(1),$e=f(10),Se=f(!1),Ie=f(!1),B=f([]),Ce=f(1),_e=f(10),ye=f(!1),me=f(!1),Xe=ne(()=>{const a=[];let i=0;return Array.isArray(A.value)&&A.value.forEach((_,g)=>{_&&_.generated_images&&Array.isArray(_.generated_images)&&_.generated_images.forEach((m,$)=>{m&&(a.push({id:`${g}-${$}-${i}`,url:m}),i++)})}),a}),et=ne(()=>!R.value||!Array.isArray(R.value)?[]:R.value.filter(a=>a&&a.media_id&&a.url).map(a=>({id:a.media_id,url:a.url,media_id:a.media_id}))),Be=ne(()=>{var _;if(!N.value||!R.value||!Array.isArray(R.value))return[];const a=(_=N.value)==null?void 0:_.image_url;if(!a)return[];const i=R.value.find(g=>g&&g.url===a);return i&&i.media_id?[{id:i.media_id,url:i.url,media_id:i.media_id}]:[]}),tt=ne(()=>!j.value||!v.value?[]:St(j.value.id,t).map(i=>{if(i.name==="product_images"){const g=[...(R.value||[]).filter(m=>m&&m.media_id&&m.url).map(m=>({id:m.media_id,url:m.url,source:"product"})),...B.value||[]];return{...i,galleryImages:g,hasMoreGalleryImages:ye.value,isLoadingMoreGalleryImages:me.value}}return i})),lt=[{id:"flatlay-studio",titleKey:"flatlay_studio",descriptionKey:"flatlay_studio_desc",image:"/images/creative/flatlay.png",type:"image"},{id:"model-photo-shoot",titleKey:"model_photo_shoot",descriptionKey:"model_photo_shoot_desc",image:"/images/creative/model.png",type:"image"},{id:"industrial-studio",titleKey:"industrial_studio",descriptionKey:"industrial_studio_desc",image:"/images/creative/photoshoot.png",type:"image"}],we=a=>{if(!a)return a;
966if(typeof a=="string"&&(a.startsWith("gid://shopify/Product/")||a.startsWith("gid://shopify/ProductVariant/"))){const i=a.split("/");return i[i.length-1]}return a},ot=a=>{N.value=a,oe.value=!0},nt=async a=>{var i,_,g,m,$;if(!(!Array.isArray(a)||a.length===0||!N.value||!v.value)){se.value=!0;try{const y=a[0];if(!y)throw new Error("No image selected");const x=typeof y=="object"?y.url:y,G=typeof y=="object"?y.media_id:null;if(!G)throw new Error("Media ID not found for selected image");const X=(i=N.value)==null?void 0:i.image_url,F=(_=N.value)==null?void 0:_.variant_id;if(!F||!((g=v.value)!=null&&g.product_id))throw new Error("Missing required IDs for variant update");const fe=we(v.value.product_id),at=we(F),He=await $fetch(`/api/generation-management/products/${fe}/variants/${at}/media`,{method:"POST",body:{shop_domain:(m=v.value)==null?void 0:m.shop_domain,media_id:G}});if(He.success){n.add({severity:"info",summary:t("processing"),detail:t("uploading_images_to_shopify"),life:3e3});const Qe=30,Je=2e3;let Ve=0,Ae=!1;for(;Ve<Qe&&!Ae;){await new Promise(Ee=>setTimeout(Ee,Je)),await qe(h.params.id,!0);const De=($=v.value)==null?void 0:$.variants;if(Array.isArray(De)){const Ee=De.find(Le=>(Le==null?void 0:Le.variant_id)===F);if(Ee&&Ee.image_url!==X){Ae=!0;break}}Ve++}Ae?(n.add({severity:"success",summary:t("success"),detail:t("variant_image_updated"),life:3e3}),oe.value=!1,N.value=null):(n.add({severity:"error",summary:t("error"),detail:t("variant_image_update_error"),life:3e3}),oe.value=!1,N.value=null)}else throw new Error(He.message||"Failed to update variant image")}catch(y){console.error("Error updating variant image:",y),n.add({severity:"error",summary:t("error"),detail:t("failed_to_update_variant_image"),life:5e3}),oe.value=!1,N.value=null}finally{se.value=!1}}},Re=async a=>{j.value=a,await C(!0)},Ge=()=>{j.value=null,H.value=[],E.value=[],B.value=[],Ce.value=1,ye.value=!1},it=async()=>{var i,_,g;if(!Array.isArray(E.value)||E.value.length===0||!M.value||!v.value)return;const a=E.value.filter(m=>m&&(typeof m=="string"||typeof m=="object"&&m.url)).map(m=>typeof m=="object"?m.url:m);if(a.length!==0){re.value=!0;try{const m=a.filter(X=>X).map(X=>{var F;return{originalSource:X,alt:((F=v.value)==null?void 0:F.title)||"Product image",mediaContentType:"IMAGE"}}),$=we((i=v.value)==null?void 0:i.product_id),y=await $fetch(`/api/generation-management/products/${$}/media`,{method:"POST",body:{shop_domain:(_=v.value)==null?void 0:_.shop_domain,business_id:M.value,media:m}});if(!y.success||!((g=y.data)!=null&&g.upload_id))throw new Error(y.message||"Failed to initiate media upload");const x=y.data.upload_id;n.add({severity:"info",summary:t("processing"),detail:t("uploading_images_to_shopify"),life:3e3}),E.value=[];const G=await Ke(x);if(G.success)n.add({severity:"success",summary:t("success"),detail:t("images_published_successfully",{count:a.length}),life:3e3}),await qe(h.params.id),J.value=!1,Ge();else throw new Error(G.message||"Failed to upload images")}catch(m){console.error("Error publishing images:",m),n.add({severity:"error",summary:t("error"),detail:t("failed_to_publish_to_shopify"),life:5e3})}finally{re.value=!1}}},rt=async()=>{var i,_,g;if(!v.value||E.value.length===0)return;const a=h.params.id;ie.value=!0;try{const m=E.value.map(x=>typeof x=="object"?x.url:x),$={shop_id:T.value,source_product_images:H.value.filter(x=>x.type==="product_image").map(x=>x.url),reference_model_image_url:H.value.filter(x=>x.type==="model_image").map(x=>x.url),background_color:((i=H.value.find(x=>x.type==="background_color"))==null?void 0:i.value)||"",ratio:((_=H.value.find(x=>x.type==="ratio"))==null?void 0:_.value)||"",style:((g=j.value)==null?void 0:g.id)||"",generated_images:m,accessories_image_urls:H.value.filter(x=>x.type==="accessory_image").map(x=>x.url)},y=await $fetch(`/api/generation-management/products/${a}/image-generations`,{method:"POST",body:$});if(y.success)n.add({severity:"success",summary:t("success"),detail:t("images_saved_to_gallery_successfully",{count:E.value.length}),life:3e3}),E.value=[];else throw new Error(y.message||"Failed to save images")}catch(m){console.error("Error saving images to gallery:",m),n.add({severity:"error",summary:t("error"),detail:t("failed_to_save_images_to_gallery"),life:5e3})}finally{ie.value=!1}},d=async(a=!0)=>{var _;if(!v.value)return;if(!T.value){console.error("Shopify account is required to fetch generated images");return}const i=h.params.id;a?(he.value=!0,pe.value=1,A.value=[]):Ie.value=!0;try{const g=await $fetch(`/api/generation-management/products/${i}/image-generations`,{method:"GET",params:{shop_id:T.value,page:pe.value,page_size:$e.value}});if(g.success&&g.data){const m=Array.isArray(g.data.image_generations)?g.data.image_generations:[];a?A.value=m:Array.isArray(A.value)?A.value.push(...m):A.value=m,Se.value=((_=g.data.metadata)==null?void 0:_.has_next_page)||!1}else a&&(A.value=[]),Se.value=!1}catch(g){console.error("Error fetching generated images:",g),n.add({severity:"error",summary:t("error"),detail:t("failed_to_fetch_generated_images"),life:5e3}),a&&(A.value=[]),Se.value=!1}finally{he.value=!1,Ie.value=!1}},o=async()=>{Ie.value||!Se.value||(pe.value++,await d(!1))},C=async(a=!0)=>{var _,g;if(!v.value)return;if(!T.value){console.error("Shopify account is required to fetch form gallery images");return}const i=h.params.id;me.value=!0,a&&(Ce.value=1,B.value=[]);try{const m=await $fetch(`/api/generation-management/products/${i}/image-generations`,{method:"GET",params:{shop_id:T.value,page:Ce.value,page_size:_e.value}});if(m.success&&m.data){const $=m.data.image_generations||[],y=[];let x=((_=B.value)==null?void 0:_.length)||0;Array.isArray($)&&$.forEach((G,X)=>{G&&G.generated_images&&Array.isArray(G.generated_images)&&G.generated_images.forEac
966h((F,fe)=>{F&&(y.push({id:`gen-${Ce.value}-${X}-${fe}-${x}`,url:F,source:"generated"}),x++)})}),a?B.value=y:B.value.push(...y),ye.value=((g=m.data.metadata)==null?void 0:g.has_next_page)||!1}else a&&(B.value=[]),ye.value=!1}catch(m){console.error("[Form Gallery] Error fetching images:",m),a&&(B.value=[]),ye.value=!1}finally{me.value=!1}},V=async()=>{me.value||!ye.value||(Ce.value++,await C(!1))},Te=async()=>{ve.value=!0,await d(!0)},Ke=async(a,i=30,_=2e3)=>{let g=0;for(;g<i;)try{const m=await $fetch(`/api/generation-management/products/media/${a}`);if(m.success&&m.data){const $=m.data;if($.media_items_count===$.completed_media_count)return{success:!0,data:$};await new Promise(y=>setTimeout(y,_)),g++}else throw new Error(m.message||"Failed to check upload status")}catch(m){throw console.error("Error polling upload status:",m),m}return{success:!1,message:"Upload status check timeout. Please check later."}},st=async a=>{var _,g,m;if(!Array.isArray(a)||a.length===0||!M.value||!v.value)return;const i=a.filter($=>$&&(typeof $=="string"||typeof $=="object"&&$.url)).map($=>typeof $=="object"?$.url:$);if(i.length!==0){ue.value=!0;try{const $=i.filter(F=>F).map(F=>{var fe;return{originalSource:F,alt:((fe=v.value)==null?void 0:fe.title)||"Product image",mediaContentType:"IMAGE"}}),y=we((_=v.value)==null?void 0:_.product_id),x=await $fetch(`/api/generation-management/products/${y}/media`,{method:"POST",body:{shop_domain:(g=v.value)==null?void 0:g.shop_domain,business_id:M.value,media:$}});if(!x.success||!((m=x.data)!=null&&m.upload_id))throw new Error(x.message||"Failed to initiate media upload");const G=x.data.upload_id;n.add({severity:"info",summary:t("processing"),detail:t("uploading_images_to_shopify"),life:3e3});const X=await Ke(G);if(X.success)n.add({severity:"success",summary:t("success"),detail:t("images_published_to_shopify_successfully",{count:i.length}),life:3e3}),await qe(h.params.id),ve.value=!1;else throw new Error(X.message||"Failed to upload images")}catch($){console.error("Error publishing to Shopify:",$),n.add({severity:"error",summary:t("error"),detail:t("failed_to_publish_to_shopify"),life:5e3})}finally{ue.value=!1}}},Z=async a=>{var i,_;if(!((i=j.value)!=null&&i.id)||!a){console.error("No tool selected or form data missing");return}try{W.value=!0;const g=j.value.id,m=(_=It)==null?void 0:_[g];if(!m)throw new Error(`No API configuration found for tool: ${g}`);["flatlay-studio","model-photo-shoot","industrial-studio","editorial-studio"].includes(g)&&(a.domain=M.value||"");const y=typeof m.transformPayload=="function"?m.transformPayload(a):a,x=await $fetch(m.endpoint,{method:"POST",body:y}
966);H.value=typeof m.transformResponse=="function"?m.transformResponse(x,t):[],n.add({severity:"success",summary:t("success"),detail:t("content_generated_successfully"),life:3e3})}catch(g){console.error("Error generating content:",g),n.add({severity:"error",summary:t("error"),detail:t("failed_to_generate_content"),life:5e3})}finally{W.value=!1}};ct(()=>J.value,a=>{a||Ge()});const We=a=>({ACTIVE:"success",DRAFT:"warning",ARCHIVED:"danger"})[a]||"secondary",Fe=async a=>{if(!a){Y.value=!1;return}je.value=!0;try{const i=await Me(a);Y.value=i}catch(i){console.error("Error checking configuration status:",i),Y.value=!1}finally{je.value=!1}},b=async()=>{K.value=!1,Q.value&&Q.value.resetForm(),T.value&&await Fe(T.value)},ae=()=>{K.value=!1,Q.value&&Q.value.resetForm()},ze=async a=>{if(a){try{const i=await O(a);i.success&&i.data?le.value=i.data:le.value=null}catch(i){console.error("Error fetching shop settings:",i),le.value=null}await Fe(a)}},Ye=async a=>{if(a){be.value=!0,U.value=!1;try{const i=await $fetch(`/api/generation-management/products/${a}/images`,{method:"GET",params:{shop_id:T.value}});i.success&&i.data?R.value=Array.isArray(i.data)?i.data:[]:R.value=[]}catch(i){console.error("Error fetching product images:",i),n.add({severity:"error",summary:t("error"),detail:t("failed_to_fetch_product_images"),life:5e3}),R.value=[]}finally{be.value=!1}}},Oe=async()=>{if(!M.value){console.error("Website not found in store");return}Ne.value=!0,ce.value=[];try{const i=(await ll(M.value)).references||[],_=["not_completed","failed","error","disconnected","revoked"],g=["in_progress","syncing","pending","queued"],m=y=>{if(!y)return"done";const x=String(y).toLowerCase();return _.includes(x)?"not_completed":g.some(G=>x.includes(G))?"in_progress":"done"},$=y=>y?String(y).trim().replace(/^https?:\/\//i,"").replace(/\.myshopify\.com$/i,""):"";ce.value=i.map(y=>({reference:y.reference,status:m(y.status),displayName:$(y.reference)})).filter(y=>y.status==="done"),ce.value.length>0&&!T.value&&(T.value=ce.value[0].reference)}catch(a){console.error("Failed to fetch Shopify accounts:",a),n.add({severity:"error",summary:t("error"),detail:t("failed_to_fetch_shopify_accounts"),life:4e3})}finally{Ne.value=!1}},qe=async(a,i=!1)=>{if(i||(ge.value=!0),!T.value){console.warn("No Shopify account selected, skipping product fetch"),i||(ge.value=!1);return}try{const _=await $fetch(`/api/generation-management/products/${a}`,{method:"GET",params:{shop_id:T.value}});_.success&&_.data?(v.value=_.data,v.value&&!i&&(await Ye(a),T.value&&await ze(T.value))):v.value=null}catch(_){console.error("Error fetching product:",_),v.value=null}finally{i||(ge.value=!1)}};return _t(async()=>{await Oe(),await qe(h.params.id)}),ct(()=>h.params.id,async a=>{a&&T.value&&await qe(a)}),ct(()=>M.value,async(a,i)=>{a&&i&&a!==i&&(T.value=null,await Oe(),r.push("/content/products"))}),(a,i)=>{var He,Qe,Je,Ve,Ae,De,Ee,Le,pt,mt,qt;const _=Nt,g=wt,m=Yt,$=Wt,y=Kt,x=Ct,G=Et,X=hl,F=yt,fe=$t,at=Bt;return u(),q(D,null,[c(_),ge.value?(u(),Pe(Ol,{key:0})):v.value?(u(),q("div",Pn,[Y.value?L("",!0):(u(),q("div",Tn,[e("div",zn,[i[11]||(i[11]=e("i",{class:"pi pi-info-circle text-blue-600 text-xl"},null,-1)),e("div",null,[e("p",An,p(l(t)("configure_generation_settings")),1),e("p",Ln,p(l(t)("configure_generation_settings_description")),1)])]),c(g,{label:l(t)("configure"),icon:"pi pi-cog",onClick:i[0]||(i[0]=w=>K.value=!0),severity:"info"},null,8,["label"])])),e("div",Mn,[e("div",jn,[c(g,{icon:"pi pi-arrow-left",label:l(t)("back_to_products"),text:"",onClick:i[1]||(i[1]=w=>l(r).push("/content/products")),class:"mb-4"},null,8,["label"])])]),e("div",Rn,[e("div",Gn,[c(En,{product:v.value,domain:M.value,"shop-domain":T.value,"shop-settings":le.value,"is-configured":Y.value,onRefresh:i[2]||(i[2]=()=>qe(l(h).params.id))},null,8,["product","domain","shop-domain","shop-settings","is-configured"]),e("div",Fn,[e("div",On,[e("h4",Hn,p(l(t)("product_media")),1),e("div",Vn,[c(g,{outlined:"",label:l(t)("generated_images"),severity:"secondary",onClick:Te},{icon:P(()=>i[12]||(i[12]=[e("i",{class:"pi pi-image mr-2"},null,-1)])),_:1},8,["label"]),c(g,{label:l(t)("generate_images"),onClick:i[3]||(i[3]=w=>J.value=!0)},{icon:P(()=>i[13]||(i[13]=[e("i",{class:"pi pi-sparkles mr-2"},null,-1)])),_:1},8,["label"])])]),be.value?(u(),Pe(Vl,{key:0,count:4})):R.value.length>0?(u(),q("div",Dn,[e("div",Un,[(u(!0),q(D,null,te(ke.value,(w,ee)=>{var Ze;return u(),q("div",{key:ee,class:"relative aspect-[3/4] rounded-lg overflow-hidden border border-gray-200 bg-gray-50"},[e("img",{src:w.url,alt:`${((Ze=v.value)==null?void 0:Ze.title)||""} - ${ee+1}`,class:"w-full h-full object-cover object-top"},null,8,Nn)])}),128))]),xe.value>0?(u(),q("div",Bn,[c(g,{text:"",severity:"secondary",iconPos:"right",icon:U.value?"pi pi-chevron-up":"pi pi-chevron-down",label:U.value?l(t)("show_less"):`${l(t)("show_more")} (${xe.value})`,onClick:i[4]||(i[4]=w=>U.value=!U.value)}
966,null,8,["icon","label"])])):L("",!0)])):(u(),q("div",Kn,[i[14]||(i[14]=e("i",{class:"pi pi-image text-3xl mb-2"},null,-1)),e("p",null,p(l(t)("no_images_available")),1)]))]),e("div",Wn,[e("h2",Yn,p(l(t)("variants")),1),c(y,{value:((He=v.value)==null?void 0:He.variants)||[],dataKey:"variant_id",stripedRows:""},{default:P(()=>[c(m,{header:l(t)("image"),style:{width:"80px"}},{body:P(({data:w})=>{var ee;return[e("img",{src:w.image_url,alt:((ee=w.options)==null?void 0:ee.join(" / "))||"",class:"w-12 h-12 object-cover rounded"},null,8,Qn)]}),_:1},8,["header"]),c(m,{field:"options",header:l(t)("options")},{body:P(({data:w})=>[e("div",Jn,[(u(!0),q(D,null,te(w.options||[],(ee,Ze)=>(u(),Pe($,{key:Ze,value:ee,severity:"info",class:"text-sm"},null,8,["value"]))),128))])]),_:1},8,["header"]),c(m,{field:"price",header:l(t)("price")},{body:P(({data:w})=>{var ee;return[e("div",Zn,[e("span",null,p(w==null?void 0:w.price)+" "+p(((ee=v.value)==null?void 0:ee.currency)||""),1)])]}),_:1},8,["header"]),c(m,{field:"sku",header:l(t)("sku")},{body:P(({data:w})=>[e("span",Xn,p((w==null?void 0:w.sku)||""),1)]),_:1},8,["header"]),c(m,{header:l(t)("actions")},{body:P(({data:w})=>[c(g,{label:l(t)("edit_image"),icon:"pi pi-pencil",size:"small",outlined:"",onClick:Ut(ee=>ot(w),["stop"])},null,8,["label","onClick"])]),_:1},8,["header"])]),_:1},8,["value"])])]),e("div",ei,[e("div",ti,[e("label",li,p(l(t)("primary_image")),1),e("div",oi,[e("img",{src:(Qe=v.value)==null?void 0:Qe.featured_image_url,alt:((Je=v.value)==null?void 0:Je.title)||"",class:"block w-full h-auto"},null,8,ni)])]),e("div",ii,[e("div",ri,[e("div",null,[e("label",si,p(l(t)("vendor")),1),e("div",ai,[e("span",di,p(((Ve=v.value)==null?void 0:Ve.vendor)||""),1)])]),(Ae=v.value)!=null&&Ae.status?(u(),q("div",ci,[e("label",ui,p(l(t)("status")),1),c($,{value:l(t)(v.value.status.toLowerCase()),severity:We(v.value.status)},null,8,["value","severity"])])):L("",!0),(De=v.value)!=null&&De.price&&v.value.price>0?(u(),q("div",pi,[e("label",mi,p(l(t)("price")),1),e("div",qi,[e("span",fi,p((Ee=v.value)==null?void 0:Ee.price)+" "+p(((Le=v.value)==null?void 0:Le.currency)||""),1)])])):L("",!0),(pt=v.value)!=null&&pt.categories&&v.value.categories.length>0?(u(),q("div",gi,[e("label",bi,p(l(t)("categories")),1),e("div",vi,[(u(!0),q(D,null,te(v.value.categories,w=>(u(),Pe($,{key:w,value:w,severity:"secondary"},null,8,["value"]))),128))])])):L("",!0),(mt=v.value)!=null&&mt.shop_domain?(u(),q("div",hi,[e("label",_i,p(l(t)("shop_domain")),1),e("div",yi,[e("span",wi,p(v.value.shop_domain),1)])])):L("",!0),(qt=v.value)!=null&&qt.product_page_url?(u(),q("div",ki,[e("label",xi,p(l(t)("product_page")),1),e("a",{href:v.value.product_page_url,target:"_blank",rel:"noopener noreferrer",class:"flex items-center gap-2 text-blue-600 hover:text-blue-800 hover:underline text-sm break-all"},[i[15]||(i[15]=e("i",{class:"pi pi-external-link"},null,-1)),e("span",null,p(l(t)("view_on_store")),1)],8,$i)])):L("",!0)])])])])])):(u(),q("div",Si,[i[16]||(i[16]=e("i",{class:"pi pi-exclamation-circle text-6xl text-gray-400 mb-4"},null,-1)),e("h2",Ii,p(l(t)("product_not_found")),1),e("p",Ci,p(l(t)("product_not_found_description")),1),c(g,{label:l(t)("back_to_products"),icon:"pi pi-arrow-left",onClick:i[5]||(i[5]=w=>l(r).push("/content/products"))},null,8,["label"])])),c(F,{visible:J.value,"onUpdate:visible":i[7]||(i[7]=w=>J.value=w),modal:"",header:j.value?l(t)(j.value.titleKey):l(t)("generate_images"),style:Dt({width:"90vw",maxWidth:j.value?"1400px":"900px"})},{footer:P(()=>[j.value?(u(),q("div",Fi,[e("div",Oi,[c(g,{icon:"pi pi-arrow-left",label:l(t)("back_to_tools"),text:"",onClick:Ge},null,8,["label"])]),e("div",Hi,[e("span",Vi,p(E.value.length)+" "+p(E.value.length===1?l(t)("image_selected"):l(t)("images_selected")),1),c(g,{label:l(t)("add_to_gallery"),icon:"pi pi-plus",severity:"secondary",disabled:E.value.length===0||W.value||ie.value||re.value,loading:ie.value,onClick:rt},null,8,["label","disabled","loading"]),c(g,{label:l(t)("publish_images"),icon:"pi pi-upload",disabled:E.value.length===0||W.value||ie.value||re.value,loading:re.value,onClick:it},null,8,["label","disabled","loading"])])])):L("",!0)]),default:P(()=>[j.value?(u(),q("div",zi,[e("div",Ai,[e("div",Li,[e("div",Mi,[i[17]||(i[17]=e("div",{class:"w-12 h-12 rounded-lg bg-blue-50 flex items-center justify-center"},[e("i",{class:"pi pi-sliders-h text-2xl text-blue-600"})],-1)),e("div",null,[e("h3",ji,p(l(t)("configure_settings")),1),e("p",Ri,p(l(t)("fill_form_to_generate")),1)])]),c(G,{fields:tt.value,"submit-label":l(t)("generate"),"is-submitting":W.value,onSubmit:Z,onLoadMoreGallery:V},null,8,["fields","submit-label","is-submitting"])]),e("div",Gi,[c(X,{title:l(t)("preview"),items:H.value,"is-loading":W.value,"loading-text":l(t)("generating_content"),"empty-icon":"pi pi-image","empty-title":l(t)("no_preview_yet"),"empty-subtitle":l(t)("submit_form_to_see_preview"),"selected-images":E.value,"onUpdate:selectedImages":i[6]||(i[6]=w=>E.value=w)},null,8,["title","items","is-loading","loading-text","empty-title","empty-subtitle","selected-images"])])])])):(u(),q("div",Ei,[e("p",Pi,p(l(t)("select_image_generation_tool")),1),e("div",Ti,[(u(),q(D,null,te(lt,w=>c(x,{key:w.id,title:l(t)(w.titleKey),description:l(t)(w.descriptionKey),image:w.image,onClick:ee=>Re(w)},null,8,["title","description","image","onClick"])),64))])]))]),_:1},8,["visible","header","style"]),c(fe,{visible:oe.value,"onUpdate:visible":i[8]||(i[8]=w=>oe.value=w),images:et.value,"pre-selected-images":Be.value,"disabled-images":Be.value,title:l(t)("edit_variant_image"),subtitle:l(t)("select_image_for_variant"),"max-selection":1,"confirm-loading":se.value,onConfirm:nt},null,8,["visible","images","pre-selected-images","disabled-images","title","subtitle","confirm-loading"]),c(fe,{visible:ve.value,"onUpdate:visible":i[9]||(i[9]=w=>ve.value=w),images:Xe.value,title:l(t)("gallery"),subtitle:l(t)("select_images_to_publish_to_shopify"),"is-loading":he.value,"confirm-label":l(t)("publish_to_shopify"),"confirm-loading":ue.value,"is-loading-more":Ie.value,"has-more":Se.value,onConfirm:st,onLoadMore:o},null,8,["visible","images","title","subtitle","is-loading","confirm-label","confirm-loading","is-loading-more","has-more"]),c(F,{visible:K.value,"onUpdate:visible":i[10]||(i[10]=w=>
966K.value=w),modal:"",header:l(t)("configure_language_and_content"),style:{width:"90vw",maxWidth:"600px"}},{default:P(()=>[e("div",Di,[c(at,{ref_key:"configSettingsRef",ref:Q,"shop-id":T.value,"show-actions":!0,"business-id":M.value,"show-cancel":!0,onSaved:b,onCancel:ae},null,8,["shop-id","business-id"])])]),_:1},8,["visible","header"])],64)}}},Tr=ol(Ui,[["__scopeId","data-v-2e56a6d1"]]);export{Tr 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.