1import{ar as e,u as t,bm as r,r as a,fx as s,fy as n,cu as l,j as i,bU as o,fz as c,bI as d,Q as m,fA as h,fB as u,fC as x,fD as p,fE as g,D as f,i as v,k as j,fF as b,B as w,X as N,aM as y,C as S,ah as L,ai as E,f as C,aC as _,bH as I,a_ as k,o as z,a5 as R,a6 as U,a7 as O,a8 as T,a9 as F,aa as M,ab as P,ac as G,eL as H,eM as A,fG as W,fH as D,fI as B,a as $,eN as q,eO as Y}from"./index-DMmkt1ET.js";import{L as V}from"./label-C-FAycOj.js";import{L as J}from"./language-selector-MDokYJZJ.js";import{h as Q}from"./heic2any-WrMeTEXt.js";import{B as K}from"./BrandWriterMetaFooter-Dqm0MY8w.js";import{S as X,a as Z,b as ee,c as te,d as re}from"./select-F5q4ZfZ1.js";import{C as ae}from"./clock-B2NtgCtf.js";import{M as se}from"./map-pin-CyDSTchS.js";import{A as ne}from"./index-D0veQdn4.js";import{M as le}from"./mic-CeEPKBvX.js";import{C as ie}from"./camera-DiyMGsgK.js";import{I as oe}from"./image-plus-Bd7nGZEX.js";import"./useOptionsQueries-38HAIZp1.js";import"./user-shop-helpers-DSINuLYe.js";import"./currencies-CW_gu8JS.js";import"./search-Ceake_zw.js";import"./react-icons.esm-CeBdftn8.js";import"./index-jVOyRz7F.js";import"./index-DPmaI-h8.js";import"./index-r8ssOwms.js";const ce=({file:e,onRemove:t,index:r,previewUnavailableLabel:s})=>{const[n,l]=a.useState(""),[o,c]=a.useState(!1),d=a.useRef(null);return a.useEffect((()=>{let t=!1;const r=()=>{d.current&&(URL.revokeObjectURL(d.current),d.current=null)},a=e=>{r(),d.current=e,t||l(e)};return(async()=>{if(t||(l(""),c(!1)),!function(e){const t=e.name.toLowerCase(),r=e.type.toLowerCase();return t.endsWith(".heic")||t.endsWith(".heif")||"image/heic"===r||"image/heif"===r||"image/heic-sequence"===r||"image/heif-sequence"===r}(e))return void a(URL.createObjectURL(e));t||c(!0);const s=URL.createObjectURL(e);try{const e=await(n=s,new Promise((e=>{const t=new Image,r=r=>{t.onload=null,t.onerror=null,e(r)};t.onload=()=>r(t.naturalWidth>0),t.onerror=()=>r(!1),t.src=n})));if(t)return void URL.revokeObjectURL(s);if(e)return a(s),void(t||c(!1));URL.revokeObjectURL(s)}catch{URL.revokeObjectURL(s)}var n;const i=async t=>{const r=await Q({blob:e,toType:t,..."image/jpeg"===t?{quality:.92}:{}}),s=Array.isArray(r)?r[0]:r;if(!s||0===s.size)throw new Error("Empty HEIC conversion result");a(URL.createObjectURL(s))};try{await i("image/jpeg")}catch(o){console.warn("HEICâJPEG preview failed, trying PNG:",o);try{await i("image/png")}catch(d){console.error("HEIC conversion failed:",d),t||(r(),l(""))}}finally{t||c(!1)}})(),()=>{t=!0,r()}}),[e]),i.jsxs("div",{className:"relative group aspect-square",children:[o?i.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gray-100 rounded-lg border border-gray-200",children:i.jsx("div",{className:"w-6 h-6 border-2 border-purple-500 border-t-transparent rounded-full animate-spin"})}):n?i.jsx("img",{src:n,alt:`Preview ${r+1}`,className:"w-full h-full object-cover rounded-lg border border-gray-200"},n):i.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-1 px-2 bg-gray-100 rounded-lg border border-gray-200 text-center",children:[i.jsx(oe,{className:"w-8 h-8 text-gray-400 shrink-0"}),i.jsx("span",{className:"text-[11px] leading-tight text-gray-500",children:s})]}),i.jsx("button",{onClick:t,className:"absolute -top-1 -right-1 bg-red-500 text-white rounded-full p-1 shadow-md opacity-90 hover:opacity-100 hover:scale-110 transition-all",type:"button",children:i.jsx(N,{className:"w-3 h-3"})})]})},de=()=>i.jsx("div",{className:"flex items-center gap-0.5 h-3 mx-1",children:[.1,.2,.3,.4].map(((e,t)=>i.jsx(k.div,{className:"w-0.5 bg-red-500 rounded-full",initial:{height:"20%"},animate:{height:["20%","100%","20%"]},transition:{duration:.6,repeat:1/0,ease:"easeInOut",delay:e}},t)))});function me(e){const t=e.type.toLowerCase().trim(),r=e.name.toLowerCase(),a=new Set(["image/jpeg","image/jpg","image/pjpeg","image/png","image/heic","image/heif","image/heic-sequence","image/heif-sequence"]),s=r.endsWith(".jpg")||r.endsWith(".jpeg")||r.endsWith(".png")||r.endsWith(".heic")||r.endsWith(".heif");return t&&"application/octet-stream"!==t?a.has(t):s}const he=()=>{const[Q,he]=e();t();const{toast:ue}=$(),{slug:xe}
1=r(),[pe,ge]=a.useState(null),[fe,ve]=a.useState(!0),[je,be]=a.useState(null),[we,Ne]=a.useState(null),[ye,Se]=a.useState(null),[Le,Ee]=a.useState(!1),[Ce,_e]=a.useState(null),[Ie,ke]=a.useState(!1),[ze,Re]=a.useState("zh-Hans-MY"),[Ue,Oe]=a.useState(""),[Te,Fe]=a.useState([]),[Me,Pe]=a.useState(!1),[Ge,He]=a.useState(0),[Ae,We]=a.useState(!1),[De,Be]=a.useState(""),[$e,qe]=a.useState(!1),[Ye,Ve]=a.useState(""),[Je,Qe]=a.useState([]),[Ke,Xe]=a.useState(!1),Ze=a.useRef(null),et=a.useRef(!1),[tt,rt]=a.useState(""),[at,st]=a.useState(!0),nt=e=>{const t=e=>{const t=(e||"").toLowerCase().trim();return"zh"===t||"zh-cn"===t||"zh_cn"===t||"zh-hans"===t?0:"zh-tw"===t||"zh_tw"===t||"zh-hant"===t?1:"en"===t||"en-us"===t||"en_us"===t?2:"ms"===t||"ms-my"===t||"ms_my"===t||"malay"===t?3:99};return e.map(((e,r)=>({lang:e,idx:r,r:t(e)}))).sort(((e,t)=>e.r-t.r||e.idx-t.idx)).map((e=>e.lang))},lt=(()=>{const e=nt(s(pe)),t=ye||e[0]||null;return n(t)})(),it=(e,t)=>l.getFixedT(lt)(e,t),ot=a.useMemo((()=>[it("preLaunchEvent.modal.generating.hints.0","æ£å¨ä¸ä¼ ä¸ï¼è¯·ç¨å..."),it("preLaunchEvent.modal.generating.hints.1","ç½éå¯è½ä¼å½±åä¸ä¼ é度"),it("preLaunchEvent.modal.generating.hints.2","æ£å¨å¤çæ¨çæ°æ®..."),it("preLaunchEvent.modal.generating.hints.3","å³å°å®æï¼è¯·èå¿çå¾
"),it("preLaunchEvent.modal.generating.hints.4","快好äºï¼é©¬ä¸å°±å¥½...")]),[lt]);a.useEffect((()=>{if(!Me)return void He(0);const e=setInterval((()=>{He((e=>e<ot.length-1?e+1:e))}),3500);return()=>clearInterval(e)}),[Me,ot.length]),a.useEffect((()=>()=>{et.current=!0,Ze.current&&Ze.current.stop()}),[]);const ct=a.useRef(!0);a.useEffect((()=>(ct.current=!0,()=>{ct.current=!1})),[]);const dt=e=>{const t=e.target.files;if(t){const r=Array.from(t),a=r.filter((e=>me(e)));if(a.length!==r.length)return ue({title:it("reviewShop.error.title"),description:it("reviewShop.form.images.errorInvalid","Only JPG, PNG, HEIC, or HEIF images are allowed."),variant:"destructive"}),void(e.target.value="");Qe((e=>{const t=[...e,...a].slice(0,4);e.length+a.length>4&&ue({title:it("reviewShop.error.title"),description:it("reviewShop.form.images.errorMaxCount","Maximum 4 images allowed"),variant:"destructive"});return t.reduce(((e,t)=>e+t.size),0)>20971520?(ue({title:it("reviewShop.error.title"),description:it("reviewShop.form.images.errorMaxSize","Total size cannot exceed 20MB"),variant:"destructive"}),e):t}))}e.target.value=""};a.useEffect((()=>{if(!xe)return;ve(!0),be(null),ge(null),Oe(""),Fe([]),Ve(""),qe(!1),Se(null),Ee(!1),Qe([]);(async()=>{try{const e=await W(xe);if(!e.status||!e.data)return be(e.message||"Event not found"),void ve(!1);{const t=e.data;if("active"!==t.event_status)return be(it("preLaunchEvent.error.eventUnavailable","This event is currently unavailable")),void ve(!1);ge(t);const r=nt(s(t)),a=r[0]||"en",n=e=>{const t=(e||"").toLowerCase();return"zh"===t?"zh-Hans-MY":"zh-tw"===t||"tw"===t?"zh-Hant-TW":"en"===t?"en-US":"ms"===t||"ms-my"===t?"ms-MY":"en-US"};r.length>1?(Se(null),Ee(!0)):(Se(a),Re(n(a)),Ee(!1))}}catch(e){be(e.message||"Failed to load event")}finally{ve(!1)}})()}),[xe]);const mt=e=>{const t=(e||"").toLowerCase();return"zh"===t?"zh-Hans-MY":"zh-tw"===t||"tw"===t?"zh-Hant-TW":"en"===t?"en-US":"ms"===t||"ms-my"===t?"ms-MY":"en-US"},ht=()=>{var e;return(null==(e=null==pe?void 0:pe.event_input_data)?void 0:e.event_usp)?B(pe,ye):[]};if(Le&&pe&&!fe&&!je){const e=nt(s(pe)),t=l.getFixedT(l.language||"en-US");return i.jsx("div",{className:"min-h-screen h-full bg-gradient-to-br from-purple-100 via-purple-50 to-purple-100",children:i.jsx("div",{className:"flex items-center justify-center min-h-[80vh] p-4",children:i.jsx("div",{className:"bg-white rounded-3xl w-full max-w-md flex flex-col shadow-2xl",children:i.jsxs("div",{className:"p-8",children:[i.jsx("div",{className:"flex justify-center mb-8",children:pe.logo_url?i.jsx("img",{src:pe.logo_url,alt:"Event Logo",className:"h-16 object-contain"}):i.jsx("img",{src:o,alt:"Logo",className:"h-10 object-contain"})}),i.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2 text-center",children:t("reviewShop.languageStep.title","Choose Your Language")}),i.jsx("p",{className:"text-gray-600 text-center mb-8",children:t("reviewShop.languageStep.subtitle","Select your preferred language to continue")}),i.jsx("div",{className:"space-y-3",children:e.map((e=>i.jsxs("button",{className:"w-full py-4 px-6 rounded-2xl border-2 border-gray-200 hover:border-purple-400 hover:bg-purple-50 transition-all text-left font-medium text-gray-700 flex items-center justify-between",onClick:()=>{Se(e),Re(mt(e)),Ee(!1)},children:[i.jsx("span",{children:c(e)}),i.jsx(d,{className:"w-5 h-5 text-gray-400 rotate-[-90deg]"})]},e)))})]})})})})}return i.jsxs("div",{className:"min-h-screen h-full bg-gradient-to-br from-purple-100 via-purple-50 to-purple-100",children:[i.jsx("div",{className:"hidden sticky top-0 bg-white/80 backdrop-blur-sm border-b border-gray-100 px-4 py-3 z-40",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("div",{className:"flex-1"}),(null==pe?void 0:pe.logo_url)?i.jsx("img",{src:pe.logo_url,alt:"Event Logo",className:"h-6"}):i.jsx("img",{src:o,alt:"BrandWriter.AI",className:"h-6"}),i.jsx("div",{className:"flex-1 flex justify-end"})]})}),i.jsx("div",{className:"px-4 py-3",children:fe?i.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[i.jsx("div",{className:"w-12 h-12 border-4 border-purple-300 border-t-transparent roun
1ded-full animate-spin mb-6"}),i.jsx("div",{className:"text-gray-500 text-lg",children:it("reviewShop.loading","Loading...")})]}):je?i.jsx("div",{className:"text-center py-20",children:i.jsxs("div",{className:"bg-red-50/80 backdrop-blur-sm border border-red-200 rounded-3xl p-8 max-w-md mx-auto shadow-xl",children:[i.jsx("div",{className:"w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4",children:i.jsx(m,{className:"w-6 h-6 text-red-600"})}),i.jsx("div",{className:"text-red-600 text-xl font-semibold mb-3",children:we||it("preLaunchEvent.error.title","Error")}),i.jsx("div",{className:"text-red-500/90 text-sm bg-red-100/50 py-2 px-4 rounded-lg inline-block whitespace-pre-line",children:je})]})}):pe?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"text-center mb-2 max-w-lg mx-auto relative",children:i.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[i.jsx("div",{className:"flex-shrink-0",children:pe.logo_url&&i.jsx("div",{className:"w-10 h-10 rounded-full border-2 border-white shadow-lg overflow-hidden bg-white",children:i.jsx("img",{src:pe.logo_url,alt:h(pe,ye)||"Event",className:"w-full h-full object-cover"})})}),i.jsx("div",{className:"flex-0 flex-grow text-start",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("h1",{className:"text-base font-bold text-gray-900",children:h(pe,ye)})})}),nt(s(pe)).length>1&&i.jsx("div",{className:"flex-shrink-0",children:i.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 px-3 py-2 rounded-full border border-gray-200 bg-white/80 text-gray-700 text-xs font-semibold hover:bg-white transition-colors",onClick:()=>{_e(null),ke(!0)},title:it("reviewShop.languageSwitch.title","Switch language"),children:[c(ye||nt(s(pe))[0]),i.jsx(d,{className:"w-4 h-4 text-gray-400"})]})})]})}),(pe.poster_url||u(pe,ye)||x(pe,ye)||p(pe,ye)||g(pe,ye))&&i.jsx("div",{className:"mx-auto max-w-lg mb-4",children:i.jsxs("div",{className:"bg-white/90 backdrop-blur-sm rounded-2xl shadow-lg overflow-hidden border border-gray-100",children:[pe.poster_url&&i.jsxs(f,{children:[i.jsx(v,{asChild:!0,children:i.jsx("button",{type:"button",className:"relative w-full flex justify-center bg-gray-50 p-3 cursor-zoom-in","aria-label":it("preLaunchEvent.eventPoster.viewLarge","View poster"),children:i.jsx("img",{src:pe.poster_url,alt:h(pe,ye)||"Event Poster",className:"max-h-80 w-auto object-contain rounded-lg shadow-sm"})})}),i.jsx(j,{className:"max-w-[95vw] sm:max-w-5xl p-3 bg-white rounded-2xl sm:rounded-3xl shadow-2xl border border-gray-100 [&>button.absolute]:hidden",children:i.jsxs("div",{className:"w-full",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{className:"min-w-0",children:i.jsx("div",{className:"text-sm font-semibold text-gray-900 truncate",children:h(pe,ye)||it("preLaunchEvent.eventPoster.title","Event Poster")})}),i.jsx(b,{asChild:!0,children:i.jsx(w,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full text-gray-600 hover:text-gray-900 hover:bg-gray-100","aria-label":it("common.close","Close"),children:i.jsx(N,{className:"h-5 w-5"})})})]}),i.jsx("div",{className:"mt-2",children:i.jsx("img",{src:pe.poster_url,alt:h(pe,ye)||"Event Poster",className:"w-full h-auto max-h-[80vh] object-contain rounded-xl sm:rounded-2xl"})})]})})]}),i.jsxs("div",{className:"p-4 space-y-3",children:[i.jsx("h2",{className:"text-lg font-bold text-gray-900",children:h(pe,ye)}),u(pe,ye)&&i.jsx("div",{className:"text-gray-700 text-sm leading-relaxed whitespace-pre-line",children:u(pe,ye)}),(x(pe,ye)||g(pe,ye)||p(pe,ye))&&i.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-2 pt-2 border-t border-gray-100",children:[x(pe,ye)&&i.jsxs("div",{className:"flex items-center gap-1.5 text-gray-600",children:[i.jsx(y,{className:"w-4 h-4 text-purple-500 flex-shrink-0"}),i.jsx("span",{className:"text-xs font-medium",children:x(pe,ye)})]}),g(pe,ye)&&i.jsxs("div",{className:"flex items-center gap-1.5 text-gray-600",children:[i.jsx(ae,{className:"w-4 h-4 text-purple-500 flex-shrink-0"}),i.jsx("span",{className:"text-xs font-medium",children:g(pe,ye)})]}),p(pe,ye)&&i.jsxs("div",{className:"flex items-center gap-1.5 text-gray-600",children:[i.jsx(se,{className:"w-4 h-4 text-purple-500 flex-shrink-0"}),i.jsx("span",{className:"text-xs font-medium",children:p(pe,ye)})]})]})]})]})}),i.jsxs(S,{className:"mx-auto max-w-lg shadow-xl border-0 bg-white/70 backdrop-blur-sm min-h-[80vh]",children:[i.jsx(L,{className:"text-center pb-0",children:i.jsx(E,{className:"text-xl font-bold text-gray-900"})}),i.jsxs(C,{className:"space-y-6 pt-3",children:[ht().length>0&&i.jsxs("div",{children:[i.jsxs(V,{className:"text-sm font-medium text-gray-700 mb-1 block",children:[it("preLaunchEvent.form.usp.label","è¿åºæ´»å¨éï¼ä½ æ¯è¾æ³å
è®²çæ¯åªä¸é¨åï¼"),i.jsx("span",{className:"text-red-500",children:" *"})]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:ht().map(((e,t)=>i.jsx(_,{variant:Te.includes(e)?"default":"outline",className:"cursor-pointer select-none px-2 py-1 text-xs font-medium transition-all touch-manipulation "+(Te.includes(e)?"hover:bg-purple-100 bg-purple-100 text-purple-700 border-purple-300 shadow-md":"border-2 border-gray-200 text-gray-600 hover:border-purple-200 hover:bg-purple-50 active:bg-purple-100 focus:outline-none focus:bg-purple-50"),onClick:t=>{(e=>{Fe((t=>t.includes(e)?t.filter((t=>t!==e)):[...t,e]))})(e),t.currentTarget.blur()},onTouchEnd:e=>{e.currentTarget.blur()},children:e},t)))}),$e&&0===Te.length&&i.jsx("p",{className:"text-red-500 text-sm mt-1",children:it("preLaunchEvent.form.usp.error","Please select a highlight")})]}),i.jsxs("div",{children:[i.jsxs(V,{className:"text-sm font-medium text-gray-700 mb-3 block",children:[it("preLaunchEvent.form.customerInput.label","çå°è¿ä¸ªæ´»å¨ï¼ä½ ç¬¬ä¸æ¶é´å¨æçæ¯åªä¸ä»¶äºï¼"),i.jsx("span",{className:"text-red-500",children:" *"})]}),i.jsxs("div",{className:"relative",children:[i.jsx(I,{placeholder:it("preLaunchEvent.form.customerInput.placeholder","Tell us about your experience or what you're looking forward to..."),value:Ue,onChange:e=>{Oe(e.target.value),at&&e.target.value.length>0&&st(!1)},className:"min-h-[100px] text-sm border-2 border-gray-200 focus:border-purple-400 focus:ring-purple-400 resize-none pr-16 sm:pr-14"}),Ke?i.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-1 bg-white shadow-md rounded-full border border-gray-200 p-1.5 sm:p-1",children:[i.jsx("div",{className:"flex items-center px-2 sm:px-1.5 border-r border-gray-200",children:i.jsx(de,{})}),i.jsx(w,{variant:"ghost",size:"icon",className:"h-8 w-8 sm:h-6 sm:w-6 rounded-full hover:bg-green-100 active:bg-green-200 text-green-600 touch-manipulation",onClick:()=>{et.current=!0,Ze.current&&Ze.current.stop(),Xe(!1)},title:"Finish",children:i.jsx(z,{className:"h-4 w-4 sm:h-3 sm:w-3"})}),i.jsx(w,{variant:"ghost",size:"icon",className:"h-8 w-8 sm:h-6 sm:w-6 rounded-full hover:bg-red-100 active:bg-red-200 text-red-600 touch-manipulation",onClick:()=>{et.current=!0,Ze.current&&Ze.current.stop(),Xe(!1),Oe(tt)},title:"Cancel",children:i.jsx(N,{className:"h-4 w-4 sm:h-3 sm:w-3"})})]}):i.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-2",children:[i.jsx(ne,{children:at&&i.jsxs(k.div,{initial:{opacity:0,x:-10}
1,animate:{opacity:1,x:[0,4,8,12,8,4,0]},exit:{opacity:0,x:-10},transition:{opacity:{duration:.3,ease:"easeOut"},x:{duration:.7,repeat:1/0,repeatDelay:1,ease:"easeInOut"}},className:"relative text-xs text-white font-medium whitespace-nowrap bg-purple-500 px-2 py-1 rounded shadow-md border border-purple-300",children:[i.jsx("span",{children:it("reviewShop.form.tryVoiceInput","Try voice input!")}),i.jsx("span",{className:"absolute top-1/2 right-0 -translate-y-1/2 translate-x-full ml-1",children:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",className:"inline",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("polygon",{points:"0,3 0,10 7,6.5",fill:"#a78bfa"})})})]})}),i.jsx(w,{variant:"ghost",size:"icon",className:"h-12 w-12 sm:h-10 sm:w-10 rounded-full shadow-lg transition-all touch-manipulation bg-purple-500 text-white hover:bg-purple-600 active:bg-purple-700 shadow-purple-500/50 hover:shadow-purple-600/60 hover:text-white",onClick:()=>{at&&st(!1);const e=window.SpeechRecognition||window.webkitSpeechRecognition;if(!e)return void ue({title:it("reviewShop.error.title"),description:"Voice input is not supported in this browser.",variant:"destructive"});const t=Ue;rt(t);const r=new e;r.continuous=!1,r.interimResults=!0,r.lang=H(lt);const a=q(lt);a&&A();let s="";r.onstart=()=>{Xe(!0)},r.onresult=e=>{let r="",n="";for(let t=e.resultIndex;t<e.results.length;++t){const a=e.results[t][0].transcript;e.results[t].isFinal?r+=a:n+=a}if(r.trim()){const e=s.length>0&&!s.endsWith(" ")?" ":"";s+=e+r.trim()}(e=>{let r=(s+(e?" "+e:"")).trim();a&&(r=Y(r));const n=t.length>0&&!t.endsWith(" ")&&r?" ":"";Oe(t+n+r)})(n.trim())},r.onend=()=>{if(et.current)Xe(!1);else try{r.start()}catch(e){}},r.onerror=e=>{console.error("Speech recognition error",e.error),"no-speech"!==e.error&&"aborted"!==e.error&&(et.current=!0,Xe(!1),ue({title:"Error",description:"Voice input error: "+e.error,variant:"destructive"}))},et.current=!1,Ze.current=r,r.start()},children:i.jsx(le,{className:"h-5 w-5 sm:h-4 sm:w-4"})})]})]}),$e&&""===Ue.trim()&&i.jsx("p",{className:"text-red-500 text-sm mt-1",children:it("preLaunchEvent.form.customerInput.error","Please share your thoughts")})]}),i.jsxs("div",{children:[i.jsxs(V,{className:"text-sm font-medium text-gray-700 mb-3 block",children:[it("preLaunchEvent.form.images.label","Upload Image"),i.jsx("span",{className:"text-red-500",children:" *"}),i.jsxs("span",{className:"text-gray-400 font-normal ml-2 text-xs",children:["(",it("preLaunchEvent.form.images.optional","Optional"),","," ",it("preLaunchEvent.form.images.uploadLimitsHint","Max 4, < 20MB total"),")"]})]}),i.jsxs("div",{className:"flex flex-col gap-4",children:[Je.length>0&&i.jsx("div",{className:"grid grid-cols-3 gap-2",children:Je.map(((e,t)=>i.jsx(ce,{file:e,index:t,onRemove:()=>(e=>{Qe((t=>t.filter(((t,r)=>r!==e))))})(t),previewUnavailableLabel:it("preLaunchEvent.form.images.previewUnavailable","Preview unavailable (file will still upload)")},t)))}),Je.length<4&&i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("input",{type:"file",accept:"image/jpeg,image/jpg,image/png,image/heic,image/heif,.heic,.heif",capture:"environment",onChange:dt,className:"hidden",id:"form-image-camera"}),i.jsxs("label",{htmlFor:"form-image-camera",className:"cursor-pointer flex items-center justify-center gap-2 w-full p-3 border-2 border-dashed border-gray-300 rounded-lg hover:border-purple-400 hover:bg-purple-50 transition-all group",children:[i.jsx(ie,{className:"w-5 h-5 text-gray-400 group-hover:text-purple-500 transition-colors"}),i.jsx("span",{className:"text-sm text-gray-500 group-hover:text-purple-600 font-medium transition-colors",children:it("reviewShop.form.images.camera","Take Photo")})]})]}),i.jsxs("div",{className:"flex-1",children:[i.jsx("input",{type:"file",accept:"image/jpeg,image/jpg,image/png,image/heic,image/heif,.heic,.heif",onChange:dt,className:"hidden",id:"form-image-upload",multiple:!0}),i.jsxs("label",{htmlFor:"form-image-upload",className:"cursor-pointer flex items-center justify-center gap-2 w-full p-3 border-2 border-dashed border-gray-300 rounded-lg hover:border-purple-400 hover:bg-purple-50 transition-all group",children:[i.jsx(oe,{className:"w-5 h-5 text-gray-400 group-hover:text-purple-500 transition-colors"}),i.jsx("span",{className:"text-sm text-gray-500 group-hover:text-purple-600 font-medium transition-colors",children:it("reviewShop.form.images.upload","Upload Image")})]})]})]})]}),$e&&0===Je.length&&i.jsx("p",{className:"text-red-500 text-sm mt-1",children:it("preLaunchEvent.form.images.error","Please upload an image")}),$e&&Je.length>0&&Je.some((e=>!me(e)))&&i.jsx("p",{className:"text-red-500 text-sm mt-1",children:it("reviewShop.form.images.errorInvalid","Only JPG, PNG, HEIC, or HEIF images are allowed.")}
1)]}),i.jsxs("div",{className:"flex items-center w-full gap-1",children:[i.jsx("div",{className:"w-1/3 flex items-center",children:i.jsx(V,{className:"text-sm font-medium text-gray-700 block",children:it("reviewShop.form.language.label","Output Language")})}),i.jsx("div",{className:"w-full",children:i.jsx(J,{value:ze,onChange:e=>Re(e),openTo:"top",isReview:!0})})]}),i.jsx(w,{className:"w-full h-14 text-lg font-semibold shadow-xl transition-all duration-200 transform "+(Me?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700 text-white hover:scale-[1.02]"),onClick:async()=>{var e;if(!pe)return;if(!pe||ht().length>0&&0===Te.length||""===Ue.trim()||0===Je.length||Je.some((e=>!me(e))))return void qe(!0);const t=`${pe.id}${Date.now().toString()}${Math.random().toString(36).substring(2,8).toUpperCase()}`;Ve(t),Pe(!0);try{const r=(()=>{const e=ze.toLowerCase();return e.includes("zh-hans")||"zh-cn"===e?"zh":e.includes("zh-hant")||"zh-tw"===e?"zh-tw":e.includes("ms")?"ms":"en"})(),a={pre_launch_event_id:pe.id,language_code:ze,customer_input:Ue||void 0,event_usp:Te.length>0?Te:void 0,content_unique_id:t,images:Je.length>0?Je:void 0},s={pre_launch_event_id:pe.id,language:r,customer_input:Ue||void 0,event_usp:Te.length>0?Te:void 0,language_code:ze};sessionStorage.setItem(`event_params_${t}`,JSON.stringify(s));const n=await D(a);if(n.status){const r=(null==(e=n.data)?void 0:e.content_unique_id)||t;return he(`/event-content/${xe}/result?content_id=${r}&lang=${encodeURIComponent(lt)}`),void Pe(!1)}{if(Pe(!1),"INSUFFICIENT_CREDITS"===n.error_code)return Ne(it("preLaunchEvent.generationLimit.title","Generation Limit Reached")),be(it("preLaunchEvent.generationLimit.message","Content generation is not available right now")),void Ve("");let e;e="IMAGE_PROCESSING_FAILED"===n.error_code||"IMAGE_TOO_LARGE"===n.error_code?it("preLaunchEvent.error.imageTooLarge","Image is too large, please upload a smaller size image"):it("preLaunchEvent.error.genericError","Failed to generate content, please try again"),Be(e),We(!0),Ve("")}}catch(r){if(Pe(!1),"INSUFFICIENT_CREDITS"===r.errorCode||"INSUFFICIENT_CREDITS"===r.error_code)Ne(it("preLaunchEvent.generationLimit.title","Generation Limit Reached")),be(it("preLaunchEvent.generationLimit.message","Content generation is not available right now"));else{let e;e="IMAGE_PROCESSING_FAILED"===r.error_code||"IMAGE_TOO_LARGE"===r.error_code?it("preLaunchEvent.error.imageTooLarge","Image is too large, please upload a smaller size image"):it("preLaunchEvent.error.genericError","Failed to generate content, please try again"),Be(e),We(!0)}Ve("")}},disabled:Me,children:Me?i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin"}),it("preLaunchEvent.form.generating","Generating...")]}):it("preLaunchEvent.form.generateButton","Generate Content")})]})]})]}):null}),i.jsx(ne,{children:Me&&i.jsx(k.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-6",children:i.jsx(k.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2},className:"bg-white rounded-3xl w-full max-w-sm p-8 shadow-2xl",children:i.jsxs("div",{className:"flex flex-col items-center text-center",children:[i.jsxs("div",{className:"relative mb-5",children:[i.jsx(k.div,{className:"absolute rounded-full border border-purple-300/30",animate:{scale:[1,1.5,1.5],opacity:[.5,0,0]},transition:{duration:2,repeat:1/0,ease:"easeOut"},style:{width:60,height:60,top:-4,left:-4}}),i.jsx("div",{className:"w-[52px] h-[52px] rounded-full bg-purple-100 border border-purple-200 flex items-center justify-center",children:i.jsx("div",{className:"w-6 h-6 border-[2.5px] border-purple-600 border-t-transparent rounded-full animate-spin"})})]}),i.jsx("div",{className:"h-12 flex items-center overflow-hidden",children:i.jsx(ne,{mode:"wait",children:i.jsx(k.p,{initial:{opacity:0,y:16,filter:"blur(4px)"},animate:{opacity:1,y:0,filter:"blur(0px)"},exit:{opacity:0,y:-16,filter:"blur(4px)"},transition:{duration:.4,ease:[.23,1,.32,1]},className:"text-sm text-gray-500 leading-relaxed",children:ot[Ge]},Ge)})}),i.jsx("div",{className:"flex items-center gap-1.5 mt-3",children:ot.map(((e,t)=>i.jsx(k.div,{className:"rounded-full",animate:{width:t===Ge?16:5,height:5,backgroundColor:t===Ge?"rgba(147,51,234,0.7)":t<Ge?"rgba(192,132,252,0.45)":"rgba(216,180,254,0.3)"},transition:{duration:.35,ease:"easeOut"}},t)))})]})})})}),Ae&&i.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-6",children:i.jsx("div",{className:"bg-white rounded-3xl w-full max-w-sm p-6 shadow-2xl animate-in fade-in zoom-in-95 duration-200",children:i.jsxs("div",{className:"flex flex-col items-center text-center",children:[i.jsx("div",{className:"w-14 h-14 bg-red-50 rounded-full flex items-center justify-center mb-4",children:i.jsx(m,{className:"w-7 h-7 text-red-500"})}),i.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-2",children:it("preLaunchEvent.error.title","Oops! Something went wrong")}),i.jsx("p",{className:"text-sm text-gray-500 leading-relaxed mb-6",children:De}),i.jsx(w,{onClick:()=>{We(!1),Be("")},className:"w-full rounded-xl h-11 font-semibold",children:it("common.ok","OK")})]})})}),i.jsxs("div",{className:"mt-0 flex flex-col items-center gap-4",children:[i.jsx(K,{logoHeight:"h-[70px]"}),i.jsx("div",{className:"text-center text-xs text-gray-400",children:i.jsx("p",{children:it("reviewShop.footer.copyright",{year:(new Date).getFullYear()})})})]}),i.jsx(R,{open:Ie,onOpenChange:ke,children:i.jsxs(U,{children:[i.jsxs(O,{children:[i.jsx(T,{children:it("reviewShop.languageSwitch.confirmTitle","Switch language?")}),i.jsxs(F,{children:[i.jsx("span",{className:"text-gray-700",children:it("reviewShop.languageSwitch.confirmPrefix","Switching language")})," ",i.jsx("span",{className:"font-bold text-red-600",children:it("reviewShop.languageSwitch.confirmEmphasis","will reset your current selections and inputs")}),i.jsx("span",{className:"text-gray-700",children:"."})," ",i.jsx("span",{className:"text-gray-700",children:it("reviewShop.languageSwitch.confirmSuffix","You will need to fill the form again.")})]})]}),i.jsxs("div",{className:"mt-2 space-y-2",children:[i.jsx(V,{className:"text-sm font-medium text-gray-700",children:it("reviewShop.languageSwitch.pickLanguage","Choose language")}),i.jsxs(X,{value:Ce||ye||void 0,onValueChange:e=>_e(e),children:[i.jsx(Z,{className:"w-full",children:i.jsx(ee,{placeholder:it("reviewShop.languageSwitch.placeholder","Select a language")})}),i.jsx(te,{children:pe?nt(s(pe)).map((e=>i.jsx(re,{value:e,children:c(e)},e))):null})]})]}),i.jsxs(M,{children:[i.jsx(P,{children:it("common.cancel","Cancel")}),i.jsx(G,{onClick:()=>{const e=Ce||ye;pe&&e&&e!==ye&&(Se(e),Re(mt(e)),Oe(""),Fe([]),Qe([]),qe(!1))},children:it("common.confirm","Confirm")})]})]})})]})};export{he 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.