1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7543],{85:(e,t,r)=>{"use strict";r.d(t,{C2:()=>n,N5:()=>l,Sp:()=>o,Xg:()=>s,eo:()=>i});let a="https://api-prod.convomind.ai/api/v1",s=async(e,t)=>{let{page:r=1,size:s=50}=e,l="".concat(a,"/agents/reports?page=").concat(r,"&size=").concat(s),n=await fetch(l,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json",...t&&{Authorization:"Bearer ".concat(t)}}});if(!n.ok){let e=await n.json().catch(()=>null);throw Error("API Error: ".concat(n.status," - ").concat(e?JSON.stringify(e):n.statusText))}return await n.json()},l=async(e,t)=>{let r="".concat(a,"/agents/reports/").concat(e),s=await fetch(r,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json",...t&&{Authorization:"Bearer ".concat(t)}}});if(!s.ok){let e=await s.json().catch(()=>null);throw Error("API Error: ".concat(s.status," - ").concat(e?JSON.stringify(e):s.statusText))}return await s.json()},n=async(e,t,r)=>{try{let s="".concat(a,"/prompts/reports?page=").concat(t,"&size=").concat(r),l=await fetch(s,{method:"GET",headers:{Accept:"application/json",Authorization:"Bearer ".concat(e)}});if(!l.ok){let e=await l.json().catch(()=>null);throw Error("API Error: ".concat(l.status," - ").concat(e?JSON.stringify(e):l.statusText))}return await l.json()}catch(e){throw console.error("Failed to fetch prompt reports:",e),e}},i=async(e,t,r)=>{try{let s="".concat(a,"/prompts/reports/").concat(t),l=await fetch(s,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify(r)});if(!l.ok){let e=await l.json().catch(()=>null);throw Error("API Error: ".concat(l.status," - ").concat(e?JSON.stringify(e):l.statusText))}let n=await l.text();return n?JSON.parse(n):null}catch(e){throw console.error("Failed to update prompt report:",e),e}},o=async(e,t)=>{try{let r="".concat(a,"/prompts/reports/").concat(t),s=await fetch(r,{method:"DELETE",headers:{Accept:"application/json",Authorization:"Bearer ".concat(e)}});if(!s.ok){let e=await s.json().catch(()=>null);throw Error("API Error: ".concat(s.status," - ").concat(e?JSON.stringify(e):s.statusText))}let l=await s.text();return l?JSON.parse(l):null}catch(e){throw console.error("Failed to delete prompt report:",e),e}}},30122:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/agentic-frameworks",function(){return r(99326)}])},32383:()=>{},39811:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var a=r(37876),s=r(14232),l=r(48963),n=r(97355);let i=e=>{let{value:t,onChange:r,options:i,placeholder:o="Select...",className:d="",triggerClassName:c="",onOpen:x,disabled:u=!1}=e,[m,h]=(0,s.useState)(!1),g=(0,s.useRef)(null),p=i.find(e=>e.value===t&&!e.disabled);return(0,s.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&h(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,a.jsxs)("div",{ref:g,className:"relative ".concat(d),children:[(0,a.jsxs)("button",{type:"button",disabled:u,onClick:()=>{m||null==x||x(),h(e=>!e)},className:(0,n.cn)("w-full py-2 px-3 border border-gray-300 dark:border-border rounded-lg bg-white dark:bg-surface text-left text-sm flex items-center justify-between focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude focus:border-blue-500 dark:focus:border-claude disabled:opacity-60 disabled:cursor-not-allowed",c),children:[(0,a.jsx)("span",{className:p?"text-gray-900 dark:text-ink-primary":"text-gray-400 dark:text-ink-muted",children:p?p.label:o}),(0,a.jsx)(l.A,{className:"w-4 h-4 text-gray-500 dark:text-ink-muted transition-transform duration-200 ".concat(m?"rotate-180":"")})]}),m&&!u&&(0,a.jsxs)("div",{className:"absolute z-50 mt-1 w-full bg-white dark:bg-surface-elevated border border-gray-200 dark:border-border rounded-xl shadow-lg dark:shadow-black/40 overflow-hidden max-h-72 overflow-y-auto",children:[i.map((e,s)=>e.disabled?(0,a.jsx)("div",{className:"px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400 dark:text-ink-muted bg-gray-50 dark:bg-surface border-b border-gray-100 dark:border-border select-none",children:e.label},"".concat(e.value,"-").concat(s)):(0,a.jsx)("button",{type:"button",onClick:()=>{r(e.value),h(!1)},className:"w-full text-left px-4 py-2.5 text-sm transition-colors hover:bg-blue-50 dark:hover:bg-claude/10 hover:text-blue-700 dark:hover:text-claude ".concat(e.value===t?"bg-blue-600 dar
1k:bg-claude text-white hover:bg-blue-600 dark:hover:bg-claude hover:text-white dark:hover:text-white":"text-gray-700 dark:text-ink-secondary"),children:e.label},"".concat(e.value,"-").concat(s))),0===i.length&&(0,a.jsxs)("div",{className:"px-4 py-3 flex items-center gap-2 text-gray-400 dark:text-ink-muted text-sm",children:[(0,a.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-300 dark:border-border border-t-blue-500 dark:border-t-claude animate-spin"}),"Loading..."]})]})]})}},60329:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var a=r(37876);r(14232);var s=r(99622),l=r(95751),n=r(24755);let i=e=>{let{percentage:t,className:r=""}=e,{t:i}=(0,n.Bd)("chat"),o=t>=95?"#EF4444":t>=85?"#EA580C":t>=65?"#F97316":"#10B981",d=t>=95?{label:i("lengthIndicator.criticalLabel"),message:i("lengthIndicator.criticalMessage"),bgColor:"bg-red-50 dark:bg-red-950/20",borderColor:"border-red-200 dark:border-red-800/40",textColor:"text-red-800 dark:text-red-300",descColor:"text-red-700 dark:text-red-300/80",icon:s.A,iconColor:"text-red-600 dark:text-red-400",separatorColor:"#EF4444"}:t>=85?{label:i("lengthIndicator.highLabel"),message:i("lengthIndicator.highMessage"),bgColor:"bg-orange-50 dark:bg-orange-950/20",borderColor:"border-orange-200 dark:border-orange-800/40",textColor:"text-orange-800 dark:text-orange-300",descColor:"text-orange-700 dark:text-orange-300/80",icon:s.A,iconColor:"text-orange-600 dark:text-orange-400",separatorColor:"#EA580C"}:t>=65?{label:i("lengthIndicator.moderateLabel"),message:i("lengthIndicator.moderateMessage"),bgColor:"bg-orange-50 dark:bg-orange-950/20",borderColor:"border-orange-300 dark:border-orange-800/40",textColor:"text-orange-800 dark:text-orange-300",descColor:"text-orange-700 dark:text-orange-300/80",icon:s.A,iconColor:"text-orange-500 dark:text-orange-400",separatorColor:"#F97316"}:{label:i("lengthIndicator.healthyLabel"),message:i("lengthIndicator.healthyMessage"),bgColor:"bg-green-50 dark:bg-green-950/20",borderColor:"border-green-200 dark:border-green-800/40",textColor:"text-green-800 dark:text-green-300",descColor:"text-green-700 dark:text-green-300/80",icon:l.A,iconColor:"text-green-600 dark:text-green-400",separatorColor:"#10B981"},c=d.icon,x=2*Math.PI*24;return(0,a.jsxs)("div",{className:"relative inline-block ".concat(r),children:[(0,a.jsxs)("div",{className:"relative",style:{width:"40px",height:"40px"},children:[(0,a.jsxs)("svg",{className:"transform -rotate-90",width:"40",height:"40",viewBox:"0 0 64 64",style:{background:"transparent"},children:[(0,a.jsx)("circle",{cx:"32",cy:"32",r:24,className:"stroke-gray-200 dark:stroke-[#3a3a37]",strokeWidth:"5",fill:"transparent"}),(0,a.jsx)("circle",{cx:"32",cy:"32",r:24,stroke:o,strokeWidth:"5",fill:"transparent",strokeDasharray:x,strokeDashoffset:x-t/100*x,strokeLinecap:"round",style:{transition:"stroke-dashoffset 0.3s ease, stroke 0.3s ease"}})]}),(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,a.jsxs)("span",{className:"text-sm font-bold drop-shadow-md",style:{color:o},children:[t,"%"]})})]}),(0,a.jsx)("div",{className:"absolute right-full mr-2 top-0 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50 pointer-events-none",children:(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg shadow-lg border border-gray-200 dark:border-border p-3",style:{width:"240px",maxWidth:"240px"},children:[(0,a.jsx)("div",{className:"w-full mb-2",children:(0,a.jsx)("div",{className:"w-full h-1.5 rounded-full",style:{backgroundColor:d.separatorColor}})}),(0,a.jsx)("div",{className:"w-full ".concat(d.bgColor," border ").concat(d.borderColor," rounded-lg p-2.5"),children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(c,{className:"w-4 h-4 ".concat(d.iconColor," flex-shrink-0 mt-0.5")}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-xs font-semibold ".concat(d.textColor," mb-1 break-words"),children:d.label}),(0,a.jsx)("div",{className:"text-xs ".concat(d.descColor," leading-snug break-words"),children:d.message})]})]})})]})})]})}},78084:(e,t,r)=>{"use strict";r.d(t,{$:()=>o});var a=r(37876);r(14232);var s=r(82987),l=r(47137),n=r(97355);let i=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:r,size:l,asChild:o=!1,...d}=e,c=o?s.DX:"button";return(0,a.jsx)(c,{"data-slot":"button",className:(0,n.cn)(i({variant:r,size:l,className:t})),...d})}},83686:()=>{},97355:(e,t,r)=>{"use strict";r.d(t,{cn:()=>l});var a=r(69241),s=r(29573);function l(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,a.$)(t))}},99326:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>sd});var a=r(37876),s=r(14232),l=r(14e3),n=r(43275),i=r(83285),o=r(48963),d=r
1(61122),c=r(16493),x=r(34729),u=r(8420),m=r(77746),h=function(e){return e.CONTENT_CREATION="CONTENT_CREATION",e.BRIEF="BRIEF",e.PRODUCT_RESEARCH="PRODUCT_RESEARCH",e.GENERATOR="GENERATOR",e.SEARCH_DESCRIPTION="SEARCH_DESCRIPTION",e.X_AGENT="X_AGENT",e.SEO_ANALYSE="SEO_ANALYSE",e.CONTENT_GENERATION="CONTENT_GENERATION",e.CONTEXT_HINT="CONTEXT_HINT",e}({});let g={CONTENT_CREATION:"Content Brief Generation",BRIEF:"Product Outline Brief Generator",PRODUCT_RESEARCH:"Product Research",GENERATOR:"Product Long Description Generator",SEARCH_DESCRIPTION:"Product Scrape & Description Generator",X_AGENT:"X Intelligence Agent",SEO_ANALYSE:"Category Finder",CONTENT_GENERATION:"Content Studio",CONTEXT_HINT:"Context Hints"},p={CONTENT_CREATION:"By conducting detailed SERP, keyword, and competitor analyses, we create a detailed content brief focused on Google EEAT and SEO.",BRIEF:"Get unique briefs of your products on your marketplace",PRODUCT_RESEARCH:"Comprehensive product analysis with intelligent price comparison and customer sentiment insights",GENERATOR:"It analyzes the products on your website in terms of HTML and image dimensions, extracts details from the images, and generates a product description tailored to your prompt.",SEARCH_DESCRIPTION:"Scrapes product pages, extracts key features and technical specs, and generates SEO-friendly product descriptions.",X_AGENT:"X Intelligence Agent",SEO_ANALYSE:"Upload and analyze CSV files.",CONTENT_GENERATION:"Content Studio",CONTEXT_HINT:"Generates ChatGPT Ads context hints for an ad group from its landing page, evidence and brand context."};function b(e,t){let r=Object.keys(h).find(t=>g[t]===e);return r?p[r]:"Template for ".concat(t.toLowerCase())}var f=r(67914),v=r(67768),y=r(31777),k=r(85);let j=new Set,N={emit:()=>{j.forEach(e=>e())},on:e=>(j.add(e),()=>j.delete(e))};var w=function(e){return e.CONTENT_CREATION="CONTENT_CREATION",e.BRIEF="BRIEF",e.X_AGENT="X_AGENT",e.GENERATOR="GENERATOR",e.SEARCH_DESCRIPTION="SEARCH_DESCRIPTION",e.CONTENT_GENERATION="CONTENT_GENERATION",e.CONTEXT_HINT="CONTEXT_HINT",e}({});let C={type:"OTHER",label:"Other",icon:"\uD83D\uDCC4",color:"bg-gray-100 text-gray-600",agentName:"",order:Number.MAX_SAFE_INTEGER},S=[{type:"X_AGENT",label:"X Intelligence Agent",icon:"\uD835\uDD4F",color:"bg-yellow-100 text-yellow-700",agentName:"X Intelligence Agent",order:0},{type:"BRIEF",label:"Product Outline Brief Generator",icon:"\uD83D\uDCCB",color:"bg-blue-100 text-blue-700",agentName:"Product Outline Brief Generator",order:1},{type:"GENERATOR",label:"Product Long Description Generator",icon:"â¡",color:"bg-yellow-100 text-yellow-700",agentName:"Product Long Description Generator",order:2},{type:"CONTENT_CREATION",label:"Content Brief Creation",icon:"âï¸",color:"bg-indigo-100 text-indigo-700",agentName:"Content Brief Generation",order:3},{type:"SEARCH_DESCRIPTION",label:"Product Scrape & Description Generator",icon:"\uD83D\uDD0E",color:"bg-purple-100 text-purple-700",agentName:"Product Scrape & Description Generator",order:5},{type:"CONTENT_GENERATION",label:"Content Studio",icon:"\uD83C\uDFAC",color:"bg-purple-100 text-purple-700",agentName:"Content Studio",order:6},{type:"CONTEXT_HINT",label:"Context Hints",icon:"\uD83C\uDFAF",color:"bg-rose-100 text-rose-700",agentName:"Context Hints",order:7}],T=S.reduce((e,t)=>(e[t.type]=t,e),{}),A=S.reduce((e,t)=>(e[t.agentName]=t,e),{}),E=["X_AGENT"],L=e=>e&&T[e]||C,M=e=>!!e&&!!T[e],R=e=>L(e).agentName,z=e=>{var t;return e?null===(t=A[e])||void 0===t?void 0:t.type:void 0},_=["agentReports"],O=["agentReport"],I=e=>e.filter(e=>M(e.type)).sort((e,t)=>{let r=e.createdAt?new Date(e.createdAt).getTime():0;return(t.createdAt?new Date(t.createdAt).getTime():0)-r});var D=r(45982),P=r(24755);let B=e=>{let{report:t,onDeleteForEveryone:r,onDeleteForMe:s,onCancel:l}=e,{t:n}=(0,P.Bd)("agents-shell"),i=t.name||t.title;return(0,a.jsx)("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{backgroundColor:"rgba(0,0,0,0.4)"},onClick:l,children:(0,a.jsxs)("div",{className:"bg-white rounded-2xl w-full max-w-sm mx-4 overflow-hidden shadow-xl",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 px-5 pt-5 pb-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg bg-gray-100",children:(0,a.jsx)(D.A,{className:"w-5 h-5 text-gray-600"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-base font-semibold text-gray-900",children:n("deleteModal.title")}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:n("deleteModal.subtitle")})]})]}),(0,a.jsx)("div",{className:"px-5 pb-3",children:(0,a.jsx)("p",{className:"text-sm text-gray-600",children:(0,a.jsxs)("strong",{className:"text-gray-900",children:['"',i,'"']})})}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 px-5 pb-5",children:[(0,a.jsx)("button",{onClick:r,className:"w-full text-white text-sm font-medium py-3 rounded-xl transition-colors",style:{backgroundColor:"#8B0000"},children:n("deleteModal.deleteForEveryone")}),(0,a.jsx)("button",{onClick:s,className:"w-full text-sm font-medium py-3 rounded-xl transition-colors",style:{color:"#DC2626",backgroundColor:"rgba(220,38,38,0.08)"},children:n("deleteModal.deleteForMe")}),(0,a.jsx)("button",{onClick:l,className:"w-full text-sm font-medium py-3 rounded-xl transition-colors",style:{color:"#007AFF",backgroundColor:"rgba(0,122,255,0.08)"},children:n("deleteModal.cancel")})]})]})})};var F=r(69220),H=r(97168),U=r(36929),G=r(32003),q=r(77241),V=r(27182),W=r(95751),J=r(15062),K=r(69025),Y=r(57708),$=r(21980),X=r(15521),Z=r(33670);function Q(e){var t;return(null==e?void 0:null===(t=e.name)||void 0===t?void 0:t.trim())||Z.Ay.t("reports.savedReportFallback",{ns:"agents-shell"})}let ee=e=>{var t;return null!==(t=null==e?void 0:e.id)&&void 0!==t?t:null==e?void 0:e._id},et=e=>
1e?new Date(e.endsWith("Z")?e:e+"Z").toLocaleString(Z.Ay.language,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"";var er=r(87113);let ea="PROMPT_REPORT",es=e=>{var t,r;let{onClose:l,itemId:o,report:d,reportName:c,currentPlan:u="Enterprise Plan"}=e,{t:m}=(0,P.Bd)("agents-shell"),h=e=>"Owner"===e?m("share.owner"):"Editor"===e?m("share.editor"):"Viewer"===e?m("share.viewer"):null!=e?e:"",[g,p]=(0,s.useState)("select"),[b,f]=(0,s.useState)([]),[v,k]=(0,s.useState)(!0),[j,N]=(0,s.useState)(""),[w,C]=(0,s.useState)(""),[S,T]=(0,s.useState)(!1),[A,E]=(0,s.useState)([]),[M,R]=(0,s.useState)([]),z=L(null!==(t=null==d?void 0:d.type)&&void 0!==t?t:"OTHER"),_=c||(null==d?void 0:d.name)||(null==d?void 0:d.title)||Q(d)||m("reports.savedReportFallback"),O={"Trial Plan":{maxUsers:1,icon:F.A,color:"text-gray-800",bgColor:"bg-gray-50",borderColor:"border-gray-200"},"Basic Plan":{maxUsers:1,icon:x.A,color:"text-blue-700",bgColor:"bg-blue-50",borderColor:"border-blue-100"},"Pro Plan":{maxUsers:5,icon:H.A,color:"text-purple-700",bgColor:"bg-purple-50",borderColor:"border-purple-100"},"Enterprise Plan":{maxUsers:50,icon:U.A,color:"text-green-700",bgColor:"bg-green-50",borderColor:"border-green-100"}},I=null!==(r=O[u])&&void 0!==r?r:O["Enterprise Plan"],D=I.icon,B=(0,y.d4)(e=>e.user),{isDark:Z}=(0,er.D)();(0,s.useEffect)(()=>{(async()=>{try{let[e,t]=await Promise.all([(0,Y.fP)(B.token),(0,X.bd)(B.token,o,"PROMPT_REPORT")]);if(!(null==e?void 0:e.length))return;let r=e.map(e=>{var t,r,a;return{id:e.id,name:e.name+" "+e.surname,email:e.email,role:e.userRole||"Member",avatar:(null===(a=e.name)||void 0===a?void 0:null===(r=a.trim())||void 0===r?void 0:null===(t=r.charAt(0))||void 0===t?void 0:t.toUpperCase())||"U"}});if(null==t?void 0:t.length){t.filter(e=>"OWNER"===e.sharedRole).forEach(e=>{if(!r.find(t=>t.id===e.user.id)){var t,a,s;r.push({id:e.user.id,name:e.user.name+" "+e.user.surname,email:e.user.email,role:e.user.userRole||"Owner",avatar:(null===(s=e.user.name)||void 0===s?void 0:null===(a=s.trim())||void 0===a?void 0:null===(t=a.charAt(0))||void 0===t?void 0:t.toUpperCase())||"U"})}});let e=t.filter(e=>"NOT_SHARED"!==e.sharedRole);R(e);let a=e.filter(e=>"OWNER"!==e.sharedRole).map(e=>{let t=r.find(t=>t.id===e.user.id);return t?{...t,role_permission:"EDITOR"===e.sharedRole?"Editor":"Viewer"}:null}).filter(Boolean);f(a)}E(r)}catch(e){console.error("AgentShareModal load error:",e),E([]),R([])}})()},[B.token,o]),(0,s.useEffect)(()=>{M.length>0&&A.length>0&&f(M.filter(e=>"NOT_SHARED"!==e.sharedRole&&"OWNER"!==e.sharedRole).map(e=>{let t=A.find(t=>t.id===e.user.id);return t?{...t,role_permission:"EDITOR"===e.sharedRole?"Editor":"Viewer"}:null}).filter(e=>null!==e))},[M,A]);let ee=(0,s.useMemo)(()=>{let e=A.map(e=>{let t=M.find(t=>t.user.id===e.id);return{...e,isShared:!!t,isOwner:(null==t?void 0:t.sharedRole)==="OWNER",currentRole:t?"OWNER"===t.sharedRole?"Owner":"EDITOR"===t.sharedRole?"Editor":"Viewer":null}});return(w.trim()?e.filter(e=>e.name.toLowerCase().includes(w.toLowerCase())||e.email.toLowerCase().includes(w.toLowerCase())||e.role.toLowerCase().includes(w.toLowerCase())):e).sort((e,t)=>{if(e.isOwner&&!t.isOwner)return -1;if(!e.isOwner&&t.isOwner)return 1;if(!e.isOwner&&!t.isOwner){if(e.isShared&&!t.isShared)return -1;if(!e.isShared&&t.isShared)return 1}return 0})},[A,w,M]),et=A.length>6,es=e=>{e.isOwner||(T(!0),setTimeout(()=>T(!1),300),f(t=>t.find(t=>t.id===e.id)?t.filter(t=>t.id!==e.id):[...t,{...e,role_permission:"Viewer"}]))},el=(e,t,r)=>{r.stopPropagation(),e.isOwner||(T(!0),setTimeout(()=>T(!1),300),f(r=>{let a=r.find(t=>t.id===e.id);return a?a.role_permission===t?r.filter(t=>t.id!==e.id):r.map(r=>r.id===e.id?{...r,role_permission:t}:r):[...r,{...e,role_permission:t}]}))},en=e=>{T(!0),setTimeout(()=>T(!1),300);let t=ee.filter(e=>!e.isOwner);t.length>0&&t.every(t=>{let r=b.find(e=>e.id===t.id);return r&&r.role_permission===e})?f(e=>e.filter(e=>!t.find(t=>t.id===e.id))):f(r=>[...r.filter(e=>!t.find(t=>t.id===e.id)),...t.map(t=>({...t,role_permission:e}))])},ei=async()=>{try{let e=B.id,t=M.filter(t=>"OWNER"!==t.sharedRole&&t.user.id!==e&&!b.find(e=>e.id===t.user.id));t.length>0&&await (0,$.VU)(B.token,{sharedType:ea,itemId:o,userIds:t.map(e=>({userId:e.user.id,isEditor:"EDITOR"===e.sharedRole})),notification:{enabled:!1,customMessage:""}}),b.length>0&&await (0,$.GO)(B.token,{sharedType:ea,itemId:o,userIds:b.map(e=>({userId:e.id,isEditor:"Editor"===e.role_permission})),notification:{enabled:v,customMessage:j||""}}),p("success"),setTimeout(()=>l(),3e3)}catch(e){console.error("AgentShareModal confirm error:",e),p("error")}},eo=()=>{p("select"),f([]),C(""),N(""),l()};return(0,a.jsx)("div",{className:"p-8 bg-gray-50 dark:bg-surface min-h-screen",children:(0,a.jsx)("div",{className:"fixed inset-0 bg-black/30 dark:bg-black/50 flex items-start justify-center z-50 p-4 sm:p-6 backdrop-blur-sm overflow-y-auto",children:(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-2xl sm:rounded-3xl shadow-2xl dark:shadow-black/60 w-full max-w-2xl sm:max-w-5xl lg:max-w-6xl min-h-[500px] max-h-none my-8 flex flex-col overflow-hidden",children:["select"===g&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-shrink-0 px-6 sm:px-8 lg:px-10 py-6 sm:py-8 bg-white dark:bg-surface-elevated",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between mb-6 sm:mb-8 flex-col sm:flex-row gap-4 sm:gap-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 sm:gap-5 w-full sm:w-auto",children:[(0,a.jsx)("div",{className:"w-12 h-12 sm:w-14 sm:h-14 bg-gray-800 dark:bg-surface rounded-2xl flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(G.A,{className:"w-6 h-6 sm:w-7 sm:h-7 text-white dark:text-ink-primary"})}),(0,a.jsxs)("div",{className:"flex-1 sm:flex-none",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("h2",{className:"text-2xl sm:text-3xl font-semibold text-gray-900 dark:text-ink-primary leading-tight",children:m("share.title")}),(0,a.jsx)("div",{className:"hidden sm:block text-gray-400 dark:text-ink-muted text-sm font-medium",children:"â ConvoMind.ai"})]}),(0,a.jsxs)("div",{className:"flex items-start sm:items-center gap-3 mt-2 sm:mt-3 flex-col sm:flex-row",children:[(0,a.jsxs)("div",{className:"inline-flex items-center gap-2.5 px-3 sm:px-4 py-1.5 sm:py-2 rounded-full ".concat(I.bgColor," border ").concat(I.borderColor),children:[(0,a.jsx)(D,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 ".concat(I.color)}),(0,a.jsx)("span",{className:"text-xs sm:text-sm font-medium ".concat(I.color),children:(e=>m("share.plans.".concat(e),{defaultValue:null!=e?e:""}))(u)})]}),(0,a.jsx)("span",{className:"text-xs sm:text-sm text-gray-700 dark:text-ink-secondary font-medium",children:m("share.membersOf",{used:Math.min(A.length,I.maxUsers),max:I.maxUsers})})]})]})]}),(0,a.jsx)("button",{onClick:eo,className:"w-8 h-8 sm:w-9 sm:h-9 bg-gray-100 dark:bg-surface hover:bg-gray-200 dark:hover:bg-surface-active active:bg-gray-300 rounded-full flex items-center justify-center transition-all duration-300 hover:scale-105 active:scale-95 self-end sm:self-auto",children:(0,a.jsx)(n.A,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-gray-800 dark:text-ink-primary"})})]}),(0,a.jsx)("div",{className:"bg-gray-50 dark:bg-surface rounded-2xl p-4 sm:p-6 border border-gray-100 dark:border-border",children:(0,a.jsxs)("div",{className:"flex items-start gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"w-10 h-10 sm:w-12 sm:h-12 bg-gray-800 dark:bg-surface-active rounded-xl flex items-center justify-center flex-shrink-0",children:(0,a.jsx)("span",{className:"text-white text-lg sm:text-xl",children:z.icon})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1 sm:mb-2",children:[(0,a.jsx)("h3",{className:"text-lg sm:text-xl font-semibold text-gray-900 dark:text-ink-primary leading-tight",children:_}),(0,a.jsx)("div",{className:"text-xs font-medium px-2 py-0.5 rounded ".concat(z.color),children:z.label})]})})]})})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 sm:px-8 lg:px-10 pb-6 sm:pb-8",children:[(0,a.jsx)("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-500/30 rounded-xl p-3 sm:p-4 mb-6 sm:mb-8",children:(0,a.jsxs)("div",{className:"flex items-start gap-2 sm:gap-3",children:[(0,a.jsx)("div",{className:"w-5 h-5 sm:w-6 sm:h-6 bg-orange-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 sm:mt-1",children:(0,a.jsx)(q.A,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-white"})}),(0,a.jsx)("div",{children:(0,a.jsx)("p",{className:"text-orange-800 dark:text-orange-300 text-xs sm:text-sm leading-relaxed font-medium",children:m("share.privacyNote")})})]})}),(0,a.jsxs)("div",{className:"mb-6 sm:mb-8",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6 sm:mb-8 flex-col sm:flex-row gap-3 sm:gap-0",children:[(0,a.jsx)("h4",{className:"text-xl sm:text-2xl font-semibold text-gray-900 dark:text-ink-primary leading-tight w-full sm:w-auto text-center sm:text-left",children:m("share.teamMembers")}),(0,a.jsx)("div",{className:"flex items-center gap-3 sm:gap-4",children:(0,a.jsx)("div",{className:"text-xs sm:text-sm font-semibold text-gray-800 dark:text-ink-primary bg-gray-100 dark:bg-surface px-3 sm:px-4 py-1.5 sm:py-2 rounded-full",children:m("share.selectedCount",{count:b.length})})})]}),(0,a.jsxs)("div",{className:"mb-6 sm:mb-8 bg-gray-50 dark:bg-surface rounded-xl p-4 sm:p-6 border border-gray-100 dark:border-border",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-3 sm:mb-4 flex-col sm:flex-row gap-3 sm:gap-0",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3 w-full sm:w-auto",children:[(0,a.jsx)(G.A,{className:"w-4 h-4 sm:w-5 sm:h-5 text-gray-700 dark:text-ink-secondary flex-shrink-0"}),(0,a.jsx)("span",{className:"font-semibold text-gray-900 dark:text-ink-primary text-sm sm:text-base",children:m("share.quickActions")}),(0,a.jsx)("span",{className:"text-xs sm:text-sm text-gray-600 dark:text-ink-muted font-medium",children:w?m("share.membersFound",{count:ee.length}):m("share.membersAvailable",{count:ee.length})})]})}),(0,a.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3 flex-wrap",children:[(0,a.jsxs)("button",{onClick:()=>en("Viewer"),className:"px-3 sm:px-4 py-2 sm:py-2.5 rounded-lg font-medium text-xs sm:text-sm transition-all duration-200 flex items-center gap-1.5 sm:gap-2 hover:scale-[1.02] active:scale-[0.98] hover:shadow-sm ".concat(ee.filter(e=>!e.isOwner).length>0&&ee.filter(e=>!e.isOwner).every(e=>{var t;return(null===(t=b.find(t=>
1t.id===e.id))||void 0===t?void 0:t.role_permission)==="Viewer"})?"bg-blue-200 text-blue-800 border-2 border-blue-300 shadow-md":"bg-blue-100 hover:bg-blue-200 active:bg-blue-300 text-blue-700"),children:[(0,a.jsx)(V.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,a.jsx)("span",{children:m("share.allAsViewers")})]}),(0,a.jsxs)("button",{onClick:()=>en("Editor"),className:"px-3 sm:px-4 py-2 sm:py-2.5 rounded-lg font-medium text-xs sm:text-sm transition-all duration-200 flex items-center gap-1.5 sm:gap-2 hover:scale-[1.02] active:scale-[0.98] hover:shadow-sm ".concat(ee.filter(e=>!e.isOwner).length>0&&ee.filter(e=>!e.isOwner).every(e=>{var t;return(null===(t=b.find(t=>t.id===e.id))||void 0===t?void 0:t.role_permission)==="Editor"})?"bg-green-200 text-green-800 border-2 border-green-300 shadow-md":"bg-green-100 hover:bg-green-200 active:bg-green-300 text-green-700"),children:[(0,a.jsx)("span",{className:"text-xs sm:text-sm",children:"âï¸"}),(0,a.jsx)("span",{children:m("share.allAsEditors")})]}),(0,a.jsxs)("button",{onClick:()=>{T(!0),setTimeout(()=>T(!1),300);let e=ee.filter(e=>!e.isOwner);f(t=>t.filter(t=>!e.find(e=>e.id===t.id)))},className:"px-3 sm:px-4 py-2 sm:py-2.5 bg-gray-100 dark:bg-surface-active hover:bg-gray-200 dark:hover:bg-border active:bg-gray-300 text-gray-700 dark:text-ink-secondary rounded-lg font-medium text-xs sm:text-sm transition-all duration-200 flex items-center gap-1.5 sm:gap-2 hover:scale-[1.02] active:scale-[0.98] hover:shadow-sm",children:[(0,a.jsx)(n.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,a.jsx)("span",{children:m("share.clearAll")})]})]})]}),et&&(0,a.jsx)("div",{className:"mb-6 sm:mb-8",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 pl-3 sm:pl-4 flex items-center pointer-events-none",children:(0,a.jsx)(i.A,{className:"h-3.5 h-3.5 sm:h-4 sm:h-4 text-gray-500"})}),(0,a.jsx)("input",{type:"text",placeholder:m("share.searchPlaceholder"),value:w,onChange:e=>C(e.target.value),className:"block w-full pl-10 sm:pl-12 pr-3 sm:pr-4 py-3 sm:py-4 border border-gray-300 dark:border-border rounded-xl focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude focus:border-blue-500 bg-white dark:bg-surface text-gray-900 dark:text-ink-primary placeholder-gray-500 dark:placeholder-ink-muted transition-all duration-300 text-sm sm:text-base font-medium hover:border-gray-400 dark:hover:border-ink-muted focus:placeholder-gray-400"})]})}),(0,a.jsx)("div",{className:"space-y-2 max-h-60 sm:max-h-80 overflow-y-auto",children:ee.length>0?ee.map(e=>{let t=b.find(t=>t.id===e.id),r=M.find(t=>t.user.id===e.id)&&!t&&!e.isOwner;return(0,a.jsxs)("div",{className:"group relative overflow-hidden rounded-xl sm:rounded-2xl border transition-all duration-200 ".concat(e.isOwner?"border-amber-400 dark:border-amber-500/40 bg-amber-50 dark:bg-amber-900/20 cursor-not-allowed":t?"border-blue-500 dark:border-claude bg-blue-50 dark:bg-claude/10 cursor-pointer":r?"border-red-400 dark:border-red-500/40 bg-red-50 dark:bg-red-900/20 hover:border-red-500 hover:bg-red-100 opacity-80":"border-gray-200 dark:border-border bg-white dark:bg-surface-elevated hover:border-gray-300 dark:hover:border-ink-muted hover:bg-gray-50 dark:hover:bg-surface-active cursor-pointer"," ").concat(S?"animate-pulse":""),onClick:()=>!e.isOwner&&es(e),children:[(0,a.jsx)("div",{className:"absolute inset-0 rounded-xl sm:rounded-2xl overflow-hidden",children:(0,a.jsx)("div",{className:"absolute inset-0 transition-opacity duration-300 ".concat(t?"bg-blue-500 opacity-5":"bg-gray-500 opacity-0 group-hover:opacity-5")})}),(0,a.jsxs)("div",{className:"relative flex items-center justify-between p-3 sm:p-5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4 flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"relative flex-shrink-0",children:(0,a.jsx)("div",{className:"w-9 h-9 sm:w-11 sm:h-11 rounded-full bg-gray-800 flex items-center justify-center text-white font-semibold text-xs sm:text-sm",children:e.avatar})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"font-semibold text-sm sm:text-base leading-tight transition-colors duration-200 ".concat(r?"text-red-600 line-through opacity-80":"text-gray-900 dark:text-ink-primary group-hover:text-blue-700 dark:group-hover:text-claude"),children:[e.name,r&&(0,a.jsx)("span",{className:"ml-2 text-xs text-red-500 font-normal",children:m("share.willBeRemoved")})]}),(0,a.jsx)("div",{className:"text-gray-700 dark:text-ink-secondary text-xs sm:text-sm font-medium mt
1-0.5 sm:mt-1 leading-tight transition-colors duration-200 group-hover:text-gray-800 dark:group-hover:text-ink-primary",children:h(e.role)})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 sm:gap-3 flex-shrink-0",children:e.isOwner?(0,a.jsxs)("div",{className:"px-3 py-1.5 bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 rounded-lg text-sm font-medium flex items-center gap-1.5",children:[(0,a.jsx)(H.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:m("share.owner")})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 sm:gap-1.5 bg-white dark:bg-surface border border-gray-200 dark:border-border rounded-lg p-0.5 shadow-sm",children:[(0,a.jsxs)("button",{onClick:t=>el(e,"Viewer",t),className:"px-2 sm:px-3 py-1 sm:py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 flex items-center gap-1 ".concat((null==t?void 0:t.role_permission)==="Viewer"?"bg-blue-100 dark:bg-claude/20 text-blue-700 dark:text-claude shadow-sm ring-2 ring-blue-200 dark:ring-claude/30":"text-gray-600 dark:text-ink-muted hover:bg-gray-100 dark:hover:bg-surface-active hover:text-blue-600 dark:hover:text-claude"),children:[(0,a.jsx)(V.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:m("share.viewer")})]}),(0,a.jsxs)("button",{onClick:t=>el(e,"Editor",t),className:"px-2 sm:px-3 py-1 sm:py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 flex items-center gap-1 ".concat((null==t?void 0:t.role_permission)==="Editor"?"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 shadow-sm ring-2 ring-green-200 dark:ring-green-500/30":"text-gray-600 dark:text-ink-muted hover:bg-gray-100 dark:hover:bg-surface-active hover:text-green-600 dark:hover:text-green-400"),children:[(0,a.jsx)("span",{className:"text-xs",children:"âï¸"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:m("share.editor")})]})]}),(0,a.jsx)("div",{className:"w-4 h-4 sm:w-5 sm:h-5 rounded-full border-2 flex items-center justify-center transition-all duration-200 flex-shrink-0 ".concat(t?"border-blue-500 dark:border-claude bg-blue-500 dark:bg-claude":"border-gray-300 dark:border-border group-hover:border-gray-400 dark:group-hover:border-ink-muted"),children:t&&(0,a.jsx)(W.A,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-white"})})]})})]})]},e.id)}):(0,a.jsxs)("div",{className:"text-center py-8 sm:py-12",children:[(0,a.jsx)(i.A,{className:"w-8 h-8 sm:w-10 sm:h-10 text-gray-400 dark:text-ink-muted mx-auto mb-2 sm:mb-3"}),(0,a.jsx)("p",{className:"text-gray-600 dark:text-ink-secondary font-medium text-sm sm:text-base",children:m("share.noMembers")})]})})]}),(0,a.jsxs)("div",{className:"bg-gray-50 dark:bg-surface rounded-xl p-4 sm:p-6 mt-6 sm:mt-8 border border-gray-100 dark:border-border hover:bg-gray-100 dark:hover:bg-surface-active transition-colors duration-300",children:[(0,a.jsxs)("label",{className:"flex items-center justify-between cursor-pointer group flex-col sm:flex-row gap-3 sm:gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4 w-full sm:w-auto",children:[(0,a.jsx)(J.A,{className:"w-4 h-4 sm:w-5 sm:h-5 text-gray-800 dark:text-ink-primary transition-transform duration-200 group-hover:scale-110 flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 sm:flex-none",children:[(0,a.jsx)("span",{className:"font-semibold text-gray-900 dark:text-ink-primary text-sm sm:text-base leading-tight transition-colors duration-200 group-hover:text-blue-700 dark:group-hover:text-claude block",children:m("share.sendNotification")}),(0,a.jsx)("p",{className:"text-gray-700 dark:text-ink-secondary text-xs sm:text-sm mt-0.5 sm:mt-1 leading-relaxed",children:m("share.sendNotificationHint")})]})]}),(0,a.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,a.jsx)("input",{type:"checkbox",checked:v,onChange:e=>k(e.target.checked),className:"sr-only"}),(0,a.jsx)("div",{className:"w-10 h-6 sm:w-12 sm:h-7 rounded-full transition-colors duration-200 ".concat(v?"bg-orange-500 dark:bg-claude":"bg-gray-300 dark:bg-surface-active"),children:(0,a.jsx)("div",{className:"w-4 h-4 sm:w-5 sm:h-5 bg-white rounded-full transition-all duration-200 ease-out transform ".concat(v?"translate-x-5 sm:translate-x-6 translate-y-0.5 sm:translate-y-1":"translate-x-0.5 sm:translate-x-1 translate-y-0.5 sm:translate-y-1")})})]})]}),v&&(0,a.jsx)("div",{className:"mt-4 sm:mt-6 space-y-3 sm:space-y-4",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm sm:text-base font-semibold text-gray-900 dark:text-ink-primary mb-2 sm:mb-3",children:m("share.customMessage")}),(0,a.jsx)("textarea",{value:j,onChange:e=>{e.target.value.length<=250&&N(e.target.value)},placeholder:m("share.customMessagePlaceholder"),rows:3,className:"w-full px-3 sm:px-4 py-2 sm:py-3 border border-gray-300 dark:border-border rounded-xl focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude focus:border-blue-500 bg-white dark:bg-surface text-gray-900 dark:text-ink-primary placeholder-gray-500 dark:placeholder-ink-muted transition-all duration-300 text-sm sm:text-base font-medium hover:border-gray-400 dark:hover:border-ink-muted resize-none"}),(0,a.jsxs)("div",{className:"flex justify-between items-center mt-2",children:[(0,a.jsx)("p",{className:"text-xs sm:text-sm text-gray-600 dark:text-ink-muted",children:m("share.customMessageHint")}),(0,a.jsxs)("span",{className:"text-xs sm:text-sm font-medium ".concat(j.length>200?"text-orange-600":"text-gray-500 dark:text-ink-muted"),children:[j.length,"/250"]})]})]})})]})]}),(0,a.jsx)("div",{className:"flex-shrink-0 px-6 sm:px-8 lg:px-10 py-6 sm:py-8 bg-white dark:bg-surface-elevated border-t border-gray-100 dark:border-border",children:(0,a.jsxs)("div",{className:"flex items-center justify-between flex-col sm:flex-row gap-3 sm:gap-0",children:[(0,a.jsx)("button",{onClick:eo,className:"w-full sm:w-auto px-4 sm:px-6 py-2.5 sm:py-3 text-gray-800 dark:text-ink-primary bg-white dark:bg-surface border border-gray-300 dark:border-border rounded-xl hover:bg-gray-50 dark:hover:bg-surface-active active:bg-gray-100 transition-all duration-300 font-medium hover:scale-[1.02] active:scale-[0.98] hover:shadow-sm focus:ring-2 focus:ring-gray-300 focus:outline-none text-sm sm:text-base order-2 sm:order-1",children:m("share.cancel")}),(0,a.jsxs)("button",{onClick:()=>p("confirm"),disabled:0===b.length&&0===M.length,className:"w-full sm:w-auto px-6 sm:px-8 py-2.5 sm:py-3 bg-blue-500 dark:bg-claude text-white rounded-xl hover:bg-blue-600 dar
1k:hover:bg-claude-hover active:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-300 font-semibold hover:scale-[1.02] active:scale-[0.98] hover:shadow-lg disabled:hover:scale-100 disabled:hover:shadow-none focus:ring-2 focus:ring-blue-300 dark:focus:ring-claude/50 focus:outline-none relative overflow-hidden text-sm sm:text-base order-1 sm:order-2",children:[(0,a.jsx)("span",{className:"relative z-10",children:0===b.length&&M.length>0?m("share.removeAllAccess"):m("share.shareWithCount",{count:b.length})}),b.length>0&&(0,a.jsx)("div",{className:"absolute inset-0 bg-white opacity-0 hover:opacity-10 transition-opacity duration-200"})]})]})})]}),"confirm"===g&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-shrink-0 px-6 sm:px-8 lg:px-10 py-6 sm:py-8 bg-white dark:bg-surface-elevated",children:[(0,a.jsxs)("div",{className:"flex items-start sm:items-center justify-between mb-6 sm:mb-8 flex-col sm:flex-row gap-4 sm:gap-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 sm:gap-5 w-full sm:w-auto",children:[(0,a.jsx)("div",{className:"w-12 h-12 sm:w-14 sm:h-14 bg-orange-500 dark:bg-claude rounded-2xl flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(K.A,{className:"w-6 h-6 sm:w-7 sm:h-7 text-white"})}),(0,a.jsxs)("div",{className:"flex-1 sm:flex-none",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("h2",{className:"text-2xl sm:text-3xl font-semibold text-gray-900 dark:text-ink-primary leading-tight",children:m("share.confirmTitle")}),(0,a.jsxs)("div",{className:"hidden sm:block text-gray-400 dark:text-ink-muted text-sm font-medium",children:["â ",z.agentName]})]}),(0,a.jsx)("p",{className:"text-gray-700 dark:text-ink-secondary mt-1 sm:mt-2 text-sm sm:text-base leading-relaxed",children:m("share.confirmSubtitle")})]})]}),(0,a.jsx)("button",{onClick:eo,className:"w-8 h-8 sm:w-9 sm:h-9 bg-gray-100 dark:bg-surface hover:bg-gray-200 dark:hover:bg-surface-active active:bg-gray-300 rounded-full flex items-center justify-center transition-all duration-300 hover:scale-105 active:scale-95 self-end sm:self-auto",children:(0,a.jsx)(n.A,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-gray-800 dark:text-ink-primary"})})]}),(0,a.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-500/30 rounded-2xl p-4 sm:p-6",children:(0,a.jsxs)("div",{className:"flex items-start gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"w-5 h-5 sm:w-6 sm:h-6 bg-blue-500 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(K.A,{className:"w-3 h-3 sm:w-4 sm:h-4 text-white"})}),(0,a.jsx)("div",{children:(0,a.jsx)("p",{className:"text-blue-800 dark:text-blue-300 text-sm sm:text-base leading-relaxed font-medium",children:(0,a.jsx)(P.x6,{t:m,i18nKey:"share.confirmIntro",count:b.length,values:{name:_,agent:z.agentName},components:{b:(0,a.jsx)("span",{className:"font-semibold"}),c:(0,a.jsx)("span",{className:"font-semibold"})}})})})]})})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 sm:px-8 lg:px-10 pb-6 sm:pb-8",children:[(0,a.jsx)("div",{className:"mb-6 sm:mb-8",children:(()=>{let e=b.filter(e=>!M.find(t=>t.user.id===e.id)),t=b.filter(e=>{let t=M.find(t=>t.user.id===e.id),r=t?"EDITOR"===t.sharedRole?"Editor":"Viewer":null;return t&&r!==e.role_permission}),r=M.filter(e=>"OWNER"!==e.sharedRole&&e.user.id!==B.id&&!b.find(t=>t.id===e.user.id));return(0,a.jsxs)(a.Fragment,{children:[e.length>0&&(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("h4",{className:"font-semibold text-green-700 mb-4 text-lg sm:text-xl flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),m("share.newAccess",{count:e.length})]}),(0,a.jsx)("div",{className:"space-y-3 sm:space-y-4",children:e.map(e=>(0,a.jsx)("div",{className:"p-4 sm:p-5 bg-green-50 dark:bg-green-900/20 rounded-xl border border-green-200 dark:border-green-500/30 hover:bg-green-100 dark:hover:bg-green-900/30 transition-all duration-300",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-gray-800 dark:bg-surface flex items-center justify-center text-white dark:text-ink-primary font-semibold text-xs sm:text-sm flex-shrink-0",children:e.avatar}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"font-semibold text-gray-900 dark:text-ink-primary text-sm sm:text-base",children:e.name}),(0,a.jsx)("div",{className:"text-xs sm:text-sm text-gray-700 dark:text-ink-secondary font-medium",children:h(e.role)})]}),(0,a.jsx)("div",{className:"px-3 py-1.5 text-xs sm:text-sm rounded-lg font-medium flex items-center gap-1.5 ".concat("Viewer"===e.role_permission?"bg-blue-100 dar
1k:bg-blue-900/30 text-blue-700 dark:text-blue-400":"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400"),children:"Viewer"===e.role_permission?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(V.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:m("share.viewer")})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-xs",children:"âï¸"}),(0,a.jsx)("span",{children:m("share.editor")})]})})]})},e.id))})]}),t.length>0&&(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("h4",{className:"font-semibold text-orange-700 mb-4 text-lg sm:text-xl flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-orange-500 rounded-full"}),m("share.roleChanges",{count:t.length})]}),(0,a.jsx)("div",{className:"space-y-3 sm:space-y-4",children:t.map(e=>{let t=M.find(t=>t.user.id===e.id),r=t?"EDITOR"===t.sharedRole?"Editor":"Viewer":null;return(0,a.jsx)("div",{className:"p-4 sm:p-5 bg-orange-50 dark:bg-orange-900/20 rounded-xl border border-orange-200 dark:border-orange-500/30 hover:bg-orange-100 dark:hover:bg-orange-900/30 transition-all duration-300",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-gray-800 dark:bg-surface flex items-center justify-center text-white dark:text-ink-primary font-semibold text-xs sm:text-sm flex-shrink-0",children:e.avatar}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"font-semibold text-gray-900 dark:text-ink-primary text-sm sm:text-base",children:e.name}),(0,a.jsx)("div",{className:"text-xs sm:text-sm text-gray-700 dark:text-ink-secondary font-medium",children:h(e.role)})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"text-xs bg-gray-100 dark:bg-surface text-gray-600 dark:text-ink-muted px-2 py-1 rounded-lg font-medium",children:h(r)}),(0,a.jsx)("span",{className:"text-gray-400 dark:text-ink-muted",children:"â"}),(0,a.jsx)("div",{className:"px-3 py-1.5 text-xs sm:text-sm rounded-lg font-medium flex items-center gap-1.5 ".concat("Viewer"===e.role_permission?"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400":"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400"),children:"Viewer"===e.role_permission?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(V.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:m("share.viewer")})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-xs",children:"âï¸"}),(0,a.jsx)("span",{children:m("share.editor")})]})})]})]})},e.id)})})]}),r.length>0&&(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("h4",{className:"font-semibold text-red-700 mb-4 text-lg sm:text-xl flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),m("share.removeAccess",{count:r.length})]}),(0,a.jsx)("div",{className:"space-y-3 sm:space-y-4",children:r.map(e=>{let t=A.find(t=>t.id===e.user.id);return t?(0,a.jsx)("div",{className:"p-4 sm:p-5 bg-red-50 dark:bg-red-900/20 rounded-xl border border-red-200 dark:border-red-500/30 hover:bg-red-100 dark:hover:bg-red-900/30 transition-all duration-300",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-gray-800 dark:bg-surface flex items-center justify-center text-white dark:text-ink-primary font-semibold text-xs sm:text-sm flex-shrink-0",children:t.avatar}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"font-semibold text-gray-900 dark:text-ink-primary text-sm sm:text-base",children:t.name}),(0,a.jsx)("div",{className:"text-xs sm:text-sm text-gray-700 dark:text-ink-secondary font-medium",children:h(t.role)})]}),(0,a.jsx)("div",{className:"text-xs bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 px-2 py-1 rounded-lg font-medium",children:m("share.accessRemoved")})]})},t.id):null})})]}),0===e.length&&0===t.length&&0===r.length&&(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("div",{className:"text-gray-500 dark:text-ink-muted text-lg mb-2",children:m("share.noChanges")}
1),(0,a.jsx)("p",{className:"text-gray-400 dark:text-ink-muted text-sm",children:m("share.noChangesHint")})]})]})})()}),v&&(0,a.jsxs)("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-500/30 rounded-xl p-4 sm:p-5 mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3 mb-3",children:[(0,a.jsx)("div",{className:"w-5 h-5 sm:w-6 sm:h-6 bg-green-500 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(J.A,{className:"w-3 h-3 sm:w-4 sm:h-4 text-white"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-semibold text-green-800 dark:text-green-400 text-sm sm:text-base",children:m("share.emailsWillBeSent")}),(0,a.jsx)("p",{className:"text-green-700 dark:text-green-500 text-xs sm:text-sm mt-0.5 sm:mt-1",children:m("share.emailsRecipients",{count:b.length})})]})]}),j&&(0,a.jsxs)("div",{className:"mt-3 p-3 bg-white dark:bg-surface rounded-lg border border-green-200 dark:border-green-500/30",children:[(0,a.jsx)("p",{className:"text-sm text-gray-800 dark:text-ink-primary font-medium mb-1",children:m("share.customMessageLabel")}),(0,a.jsxs)("p",{className:"text-sm text-gray-700 dark:text-ink-secondary italic",children:['"',j,'"']})]})]})]}),(0,a.jsx)("div",{className:"flex-shrink-0 px-6 sm:px-8 lg:px-10 py-6 sm:py-8 bg-white dark:bg-surface-elevated border-t border-gray-100 dark:border-border",children:(0,a.jsxs)("div",{className:"flex items-center justify-between flex-col sm:flex-row gap-3 sm:gap-0",children:[(0,a.jsx)("button",{onClick:()=>p("select"),className:"w-full sm:w-auto px-4 sm:px-6 py-2.5 sm:py-3 text-gray-800 dark:text-ink-primary bg-white dark:bg-surface border border-gray-300 dark:border-border rounded-xl hover:bg-gray-50 dark:hover:bg-surface-active active:bg-gray-100 transition-all duration-300 font-medium hover:scale-[1.02] active:scale-[0.98] focus:ring-2 focus:ring-gray-300 focus:outline-none hover:shadow-sm text-sm sm:text-base order-2 sm:order-1",children:m("share.back")}),(0,a.jsxs)("button",{onClick:ei,className:"w-full sm:w-auto px-6 sm:px-8 py-2.5 sm:py-3 bg-green-500 text-white rounded-xl hover:bg-green-600 active:bg-green-700 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-300 font-semibold hover:scale-[1.02] active:scale-[0.98] hover:shadow-lg focus:ring-2 focus:ring-green-300 focus:outline-none relative overflow-hidden text-sm sm:text-base order-1 sm:order-2",children:[(0,a.jsx)("span",{className:"relative z-10",children:m("share.confirmShare")}),(0,a.jsx)("div",{className:"absolute inset-0 bg-white opacity-0 hover:opacity-10 transition-opacity duration-200"})]})]})})]}),"success"===g&&(0,a.jsx)("div",{className:"flex-1 flex items-center justify-center px-6 sm:px-10 py-12 sm:py-16 text-center",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"w-16 h-16 sm:w-20 sm:h-20 bg-green-500 rounded-2xl flex items-center justify-center mx-auto mb-6 sm:mb-8 shadow-lg shadow-green-200",children:(0,a.jsx)(W.A,{className:"w-8 h-8 sm:w-10 sm:h-10 text-white"})}),(0,a.jsx)("h2",{className:"text-2xl sm:text-3xl font-semibold text-gray-900 dark:text-ink-primary mb-4 sm:mb-6 leading-tight",children:m("share.successTitle")}),(0,a.jsx)("p",{className:"text-gray-600 dark:text-ink-secondary text-base sm:text-lg leading-relaxed mb-6 sm:mb-8 max-w-sm sm:max-w-md mx-auto",children:(0,a.jsx)(P.x6,{t:m,i18nKey:"share.successText",count:b.length,values:{name:_,agent:z.agentName},components:{b:(0,a.jsx)("span",{className:"font-semibold"}),c:(0,a.jsx)("span",{className:"font-semibold text-blue-600 dark:text-claude"})}})}),v&&(0,a.jsxs)("div",{className:"inline-flex items-center gap-2 px-3 sm:px-4 py-2 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-500/30 rounded-xl",children:[(0,a.jsx)(J.A,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-green-600 dark:text-green-400 flex-shrink-0"}),(0,a.jsx)("p",{className:"text-green-700 dark:text-green-400 font-medium text-sm sm:text-base leading-relaxed",children:m("share.emailsSent")})]})]})}),"error"===g&&(0,a.jsx)("div",{className:"flex-1 flex items-center justify-center px-6 sm:px-10 py-12 sm:py-16 text-center",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"w-16 h-16 sm:w-20 sm:h-20 bg-red-500 rounded-2xl flex items-center justify-center mx-auto mb-6 sm:mb-8 shadow-lg shadow-red-200",children:(0,a.jsx)(n.A,{className:"w-8 h-8 sm:w-10 sm:h-10 text-white"})}),(0,a.jsx)("h2",{className:"text-2xl sm:text-3xl font-semibold text-gray-900 dark:text-ink-primary mb-4 sm:mb-6 leading-tight",children:m("share.errorTitle")}),(0,a.jsx)("p",{className:"text-gray-600 dark:text-ink-secondary text-base sm:text-lg leading-relaxed mb-6 sm:mb-8 max-w-sm sm:max-w-md mx-auto",children:m("share.errorText")}),(0,a.jsxs)("div",{className:"flex gap-4 justify-center flex-col sm:flex-row",children:[(0,a.jsx)("button",{onClick:()=>p("confirm"),className:"px-6 py-3 bg-blue-500 dark:bg-claude text-white rounded-xl hover:bg-blue-600 dar
1k:hover:bg-claude-hover transition-all duration-300 font-semibold hover:scale-[1.02] active:scale-[0.98] hover:shadow-lg",children:m("share.tryAgain")}),(0,a.jsx)("button",{onClick:eo,className:"px-6 py-3 bg-gray-200 dark:bg-surface hover:bg-gray-300 dark:hover:bg-surface-active text-gray-800 dark:text-ink-primary rounded-xl transition-all duration-300 font-semibold hover:scale-[1.02] active:scale-[0.98]",children:m("share.cancel")})]})]})})]})})})};var el=r(39898),en=r(6141),ei=r(37304);let eo=e=>{let{report:t,displayName:r,showFavoriteStar:s=!1,isEditing:l,editTitle:i,isSubmitting:o,menuOpen:d,onSelect:c,onToggleMenu:u,onStartRename:m,onEditTitleChange:h,onSubmitRename:g,onCancelRename:p,onToggleFavorite:b,onShare:f,onDelete:v}=e,{t:y}=(0,P.Bd)("agents-shell"),k=ee(t),j=et(t.createdAt);return(0,a.jsx)("div",{className:"relative flex flex-col gap-0.5 px-1 py-1.5 cursor-pointer hover:bg-gray-100 dark:hover:bg-surface-active rounded transition-colors group",onClick:()=>!l&&c(t),children:l?(0,a.jsxs)("div",{className:"flex items-center gap-2",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("input",{autoFocus:!0,className:"flex-1 text-sm border rounded px-2 py-1 outline-none focus:border-blue-500 dark:bg-surface dark:border-border dark:text-ink-primary dark:focus:border-claude",value:i,onChange:e=>h(e.target.value),onKeyDown:e=>{"Enter"===e.key&&g(e,t),"Escape"===e.key&&p(e)}}),(0,a.jsx)("button",{onClick:e=>g(e,t),disabled:o,className:"p-1 text-green-600 hover:bg-green-50 dark:hover:bg-green-950/20 rounded disabled:opacity-50",children:(0,a.jsx)(W.A,{className:"w-4 h-4"})}),(0,a.jsx)("button",{onClick:p,className:"p-1 text-red-600 hover:bg-red-50 dark:hover:bg-red-950/20 rounded",children:(0,a.jsx)(n.A,{className:"w-4 h-4"})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[s&&t.favorite&&(0,a.jsx)(x.A,{className:"w-3 h-3 text-yellow-500 fill-current flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"font-medium text-sm text-gray-800 dark:text-ink-primary truncate",children:r}),j&&(0,a.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-ink-muted",children:j})]})]}),(0,a.jsx)("button",{onClick:e=>u(e,k),className:"opacity-0 group-hover:opacity-100 p-1 text-gray-400 dark:text-ink-muted hover:bg-gray-200 dark:hover:bg-surface-active rounded transition-all flex-shrink-0",children:(0,a.jsx)(el.A,{className:"w-3.5 h-3.5"})})]}),d&&(0,a.jsxs)("div",{className:"absolute right-0 top-10 w-44 bg-white dark:bg-surface-elevated border border-gray-200 dark:border-border rounded-md shadow-lg py-1 z-50",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-gray-700 dark:text-ink-secondary hover:bg-gray-100 dark:hover:bg-surface-active",onClick:e=>b(e,t),children:t.favorite?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(en.A,{className:"w-3 h-3"}),y("reports.unstar")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.A,{className:"w-3 h-3"}),y("reports.star")]})}),(0,a.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-gray-700 dark:text-ink-secondary hover:bg-gray-100 dark:hover:bg-surface-active",onClick:e=>f(e,t),children:[(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"18",cy:"5",r:"3"}),(0,a.jsx)("circle",{cx:"6",cy:"12",r:"3"}),(0,a.jsx)("circle",{cx:"18",cy:"19",r:"3"}),(0,a.jsx)("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),(0,a.jsx)("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),y("reports.shareWithTeam")]}),t.isEditor&&(0,a.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-gray-700 dark:text-ink-secondary hover:bg-gray-100 dark:hover:bg-surface-active",onClick:e=>m(e,t),children:[(0,a.jsx)(ei.A,{className:"w-3 h-3"}),y("reports.rename")]}),(0,a.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/20",onClick:e=>v(e,t),children:[(0,a.jsx)(D.A,{className:"w-3 h-3"}),y(t.isEditor?"reports.delete":"reports.deleteForMe")]})]})]})})},ed=[{value:"ALL",label:"All Types"},...S.map(e=>({value:e.type,label:e.label}))],ec=e=>{var t;let{value:r,onChange:l}=e,{t:n}
1=(0,P.Bd)("agents-shell"),[i,d]=(0,s.useState)(!1),c=(e,t)=>"ALL"===e?n("reports.allTypes"):null!=t?t:"",x=c(r,null===(t=ed.find(e=>e.value===r))||void 0===t?void 0:t.label);return(0,a.jsxs)(u.AM,{open:i,onOpenChange:d,children:[(0,a.jsx)(u.Wv,{asChild:!0,children:(0,a.jsxs)("button",{className:"w-full flex items-center justify-between text-xs px-3 py-2 border border-gray-200 dark:border-border rounded-lg bg-white dark:bg-surface-elevated text-gray-700 dark:text-ink-primary hover:bg-gray-50 dark:hover:bg-surface-active focus:outline-none transition-colors",children:[(0,a.jsx)("span",{children:x}),(0,a.jsx)(o.A,{className:"w-3 h-3 text-gray-500 dark:text-ink-muted transition-transform ".concat(i?"rotate-180":"")})]})}),(0,a.jsx)(u.hl,{className:"w-[232px] p-0",align:"start",sideOffset:4,children:(0,a.jsx)("div",{className:"py-1 max-h-60 overflow-y-auto",children:ed.map(e=>(0,a.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-xs transition-colors ".concat(r===e.value?"bg-claude/10 dark:bg-claude/10 text-claude font-medium":"text-gray-700 dark:text-ink-secondary hover:bg-gray-100 dark:hover:bg-surface-active"),onClick:()=>{l(e.value),d(!1)},children:[(0,a.jsx)("span",{className:"w-3 h-3 flex-shrink-0",children:r===e.value&&(0,a.jsx)(W.A,{className:"w-3 h-3 text-claude"})}),c(e.value,e.label)]},e.value))})})]})};var ex=r(56194);function eu(){let e=(0,y.d4)(e=>e.user),t=(0,v.jE)(),r=(0,s.useCallback)((e,r)=>{t.setQueryData(_,t=>(null!=t?t:[]).map(t=>ee(t)===e?{...t,...r}:t))},[t]),a=(0,s.useCallback)(e=>{t.setQueryData(_,t=>(null!=t?t:[]).filter(t=>ee(t)!==e))},[t]),l=(0,s.useCallback)(async(t,a)=>{await (0,k.eo)(e.token,t,{name:a}),r(t,{name:a})},[e.token,r]),n=(0,s.useCallback)(async t=>{let a=ee(t),s=!t.favorite;await (0,k.eo)(e.token,a,{favorite:s}),r(a,{favorite:s})},[e.token,r]);return{renameReport:l,toggleFavorite:n,deleteForEveryone:(0,s.useCallback)(async t=>{await (0,k.Sp)(e.token,t),a(t)},[e.token,a]),deleteForMe:(0,s.useCallback)(async t=>{await (0,ex.x9)(t,e.token),a(t)},[e.token,a])}}let em=e=>{let{reports:t,onSelect:r,onOverflowPanel:l}=e,{t:n}=(0,P.Bd)("agents-shell"),{renameReport:i,toggleFavorite:o,deleteForEveryone:d,deleteForMe:c}=eu(),[x,u]=(0,s.useState)("ALL"),[m,h]=(0,s.useState)(null),[g,p]=(0,s.useState)(""),[b,f]=(0,s.useState)(null),[v,y]=(0,s.useState)(!1),[k,j]=(0,s.useState)(null),[N,w]=(0,s.useState)(null),C=()=>"ALL"===x?5:8,S=(0,s.useMemo)(()=>"ALL"===x?t:t.filter(e=>e.type===x),[t,x]),T=(0,s.useMemo)(()=>Object.entries(S.reduce((e,t)=>{var r;let a=null!==(r=t.type)&&void 0!==r?r:"OTHER";return e[a]||(e[a]=[]),e[a].push(t),e},{})).sort((e,t)=>{let[r]=e,[a]=t;return L(r).order-L(a).order}),[S]);(0,s.useEffect)(()=>{let e=()=>f(null);return null!==b&&document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[b]);let A=(e,t)=>{e.stopPropagation(),f(e=>e===t?null:t)},E=(e,t)=>{e.stopPropagation(),t.isEditor&&(h(ee(t)),p(Q(t)),f(null))},M=async(e,t)=>{if(e.stopPropagation(),g.trim()&&!v){y(!0);try{await i(ee(t),g.trim())}catch(e){console.error("Failed to rename report:",e)}finally{y(!1),h(null)}}},R=e=>{e.stopPropagation(),h(null)},z=async(e,t)=>{e.stopPropagation(),f(null);try{await o(t)}catch(e){console.error("Failed to update favorite:",e)}},_=(e,t)=>{e.stopPropagation(),f(null),w(ee(t))},O=async(e,t)=>{if(e.stopPropagation(),f(null),t.isEditor){j(ee(t));return}
1try{await c(ee(t))}catch(e){console.error("Failed to delete report:",e)}};return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(ec,{value:x,onChange:u}),0===T.length?(0,a.jsx)("div",{className:"text-center py-8 text-gray-500 dark:text-ink-muted",children:(0,a.jsx)("p",{className:"text-sm",children:n("reports.noReports")})}):T.map(e=>{let[t,s]=e,i=L(t),o=C(),d=s.slice(0,o),c=s.length-d.length;return(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2 px-1",children:[(0,a.jsx)("span",{className:"text-xs text-gray-400 dark:text-ink-muted font-medium",children:i.label}),(0,a.jsx)("div",{className:"flex-1 h-px bg-gray-200 dark:bg-border"})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[d.map(e=>{let t=ee(e);return(0,a.jsx)(eo,{report:e,displayName:Q(e),isEditing:m===t,editTitle:g,isSubmitting:v,menuOpen:b===t,onSelect:e=>null==r?void 0:r(e),onToggleMenu:A,onStartRename:E,onEditTitleChange:p,onSubmitRename:M,onCancelRename:R,onToggleFavorite:z,onShare:_,onDelete:O},t)}),c>0&&(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),null==l||l({reports:s,title:i.label,icon:i.icon})},className:"w-full text-xs text-blue-600 dark:text-claude hover:text-blue-800 dark:hover:text-claude-hover py-1.5 text-center hover:bg-blue-50 dark:hover:bg-claude/10 rounded-lg transition-colors",children:n("reports.more",{count:c})})]})]},t)}),k&&(()=>{let e=t.find(e=>ee(e)===k);if(!e)return null;let r=ee(e);return(0,a.jsx)(B,{report:e,onDeleteForEveryone:async()=>{j(null);try{await d(r)}catch(e){console.error("Failed to delete report:",e)}},onDeleteForMe:async()=>{j(null);try{await c(r)}catch(e){console.error("Failed to delete for me:",e)}},onCancel:()=>j(null)})})(),N&&(()=>{let e=t.find(e=>ee(e)===N);return e?(0,a.jsx)(es,{itemId:N,report:e,onClose:()=>w(null)}):null})()]})},eh=e=>{let{onAgentSelect:t,selectedAgent:r,selectedCategory:p,setSelectedCategory:j,onClose:w,availableAgents:C,loading:S=!1,onSavedReportSelect:T,onOverflowPanel:A,disabledPermissions:M=[],selectedQueueAgent:R=null,onQueueAgentSelect:z}=e,{t:O}=(0,P.Bd)("agents-shell"),D=e=>"All Categories"===e?O("sidebar.allCategories"):O("categories.".concat(e),{defaultValue:null!=e?e:""}
1),[B,F]=(0,s.useState)(""),[H,U]=(0,s.useState)(!1),G=(0,l.useRouter)(),q=(0,l.usePathname)(),V=(0,l.useSearchParams)(),W=V.get("sidebarTab")||(V.get("recordId")?"saved":"library"),{data:J=[],isLoading:K}=function(){let e=(0,y.d4)(e=>{var t;return null===(t=e.user)||void 0===t?void 0:t.token});return(0,f.I)({queryKey:_,enabled:!!e,queryFn:async()=>{var t;return null!==(t=(await (0,k.Xg)({page:1,size:50},e)).records)&&void 0!==t?t:[]},select:I})}();!function(){let e=(0,v.jE)();(0,s.useEffect)(()=>{let t=N.on(()=>{e.invalidateQueries({queryKey:_})});return()=>{t()}},[e])}();let Y=e=>{let r=new URLSearchParams(window.location.search);r.set("sidebarTab",e),r.delete("agent"),r.delete("recordId"),r.delete("isEditor"),r.delete("queueAgent"),null==t||t(null),G.replace("".concat(q,"?").concat(r.toString()),{scroll:!1})},$=m.L.filter(e=>e.templates&&e.templates.length>0).flatMap(e=>e.templates.map(t=>({name:t,description:b(t,e.name),category:e.name,categoryIcon:e.icon,categoryColor:e.color}))).filter(e=>{let t=Object.keys(h).find(t=>g[t]===e.name)||"";return!(!(null!=C?C:[]).includes(t)||M.includes(t))}),X=E.filter(e=>(null!=C?C:[]).includes(e)&&!M.includes(e)).map(L),Z=$.filter(e=>{let t="All Categories"===p.name||e.category===p.name,r=!B.trim()||B.length<2||e.name.toLowerCase().includes(B.toLowerCase().trim())||e.description.toLowerCase().includes(B.toLowerCase().trim());return t&&r});return(0,a.jsxs)("div",{className:"border-r dark:border-border flex flex-col overflow-hidden transition-all duration-300 bg-[#faf9f6] dark:bg-surface",style:{width:"280px",minWidth:"280px",maxWidth:"280px",height:"100%",flexShrink:0},children:[(0,a.jsxs)("div",{className:"p-5 border-b dark:border-border",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-xl font-semibold dark:text-ink-primary",children:O("sidebar.title")}),(0,a.jsx)("button",{onClick:()=>null==w?void 0:w(),className:"p-1 rounded-md text-gray-400 dark:text-ink-muted hover:text-gray-700 dark:hover:text-ink-primary hover:bg-gray-100 dark:hover:bg-surface-active transition-colors",children:(0,a.jsx)(n.A,{className:"w-4 h-4"})})]}),(0,a.jsxs)("div",{className:"flex justify-start gap-4 border-b dark:border-border mb-4 relative overflow-x-auto whitespace-nowrap [scrollbar-width:none]",children:[(0,a.jsx)("button",{className:"pb-2 text-sm shrink-0 ".concat("library"===W?"font-medium border-b-2 border-black dark:border-claude text-black dark:text-ink-primary":"text-gray-500 dark:text-ink-muted"),onClick:()=>{Y("library"),null==t||t(null)},children:O("sidebar.tabs.library")}),(0,a.jsx)("button",{className:"pb-2 text-sm shrink-0 ".concat("saved"===W?"font-medium border-b-2 border-black dark:border-claude text-black dark:text-ink-primary":"text-gray-500 dark:text-ink-muted"),onClick:()=>Y("saved"),children:O("sidebar.tabs.saved")}),(0,a.jsx)("button",{className:"pb-2 text-sm shrink-0 ".concat("starred"===W?"font-medium border-b-2 border-black dark:border-claude text-black dark:text-ink-primary":"text-gray-500 dark:text-ink-muted"),onClick:()=>Y("starred"),children:O("sidebar.tabs.starred")}),(0,a.jsx)("button",{className:"pb-2 text-sm shrink-0 ".concat("queues"===W?"font-medium border-b-2 border-black dark:border-claude text-black dark:text-ink-primary":"text-gray-500 dark:text-ink-muted"),onClick:()=>Y("queues"),children:O("sidebar.tabs.queues")})]}),"queues"!==W&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"relative mb-4",children:[(0,a.jsx)(i.A,{className:"absolute left-3 top-3 h-4 w-4 text-gray-400 dark:text-ink-muted"}),(0,a.jsx)(u.pd,{className:"pl-10",placeholder:O("sidebar.searchPlaceholder"),value:B,onChange:e=>F(e.target.value)})]}),(0,a.jsx)("div",{className:"relative",children:(0,a.jsxs)(u.AM,{open:H,onOpenChange:U,children:[(0,a.jsx)(u.Wv,{asChild:!0,children:(0,a.jsxs)("button",{className:"w-full flex items-center justify-between px-3 py-2 text-left text-sm border border-gray-200 dark:border-border rounded-lg hover:bg-gray-50 dark:hover:bg-surface-active dark:bg-surface",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:p.color,children:p.icon}),(0,a.jsx)("span",{className:"text-gray-700 dark:text-ink-secondary",children:D(p.name)})]}),(0,a.jsx)(o.A,{className:"w-4 h-4 text-gray-500 dark:text-ink-muted transition-transform ".concat(H?"rotate-180":"")})]})}),(0,a.jsx)(u.hl,{className:"w-64 p-0",align:"start",sideOffset:4,children:(0,a.jsxs)("div",{className:"py-1 max-h-60 overflow-y-auto",children:[(0,a.jsxs)("button",{className:"w-full flex items-center justify-between px-3 py-2 text-sm text-gray-700 dark:text-ink-secondary hover:bg-gray-100 dark:hover:bg-surface-active",onClick:()=>{j({name:"All Categories",icon:"\uD83D\uDCC1",color:"text-yellow-500"}),U(!1)},children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"text-yellow-500",children:"\uD83D\uDCC1"}),(0,a.jsx)("span",{children:O("sidebar.allCategories")})]}),"All Categories"===p.name&&(0,a.jsx)("svg",{className:"w-4 h-4 text-blue-600 dar
1k:text-claude",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]}),m.L.map((e,t)=>(0,a.jsxs)("button",{className:"w-full flex items-center justify-between px-3 py-2 text-sm text-gray-700 dark:text-ink-secondary hover:bg-gray-100 dark:hover:bg-surface-active",onClick:()=>{j(e),U(!1)},children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:e.color,children:e.icon}),(0,a.jsx)("span",{children:D(e.name)})]}),p.name===e.name&&(0,a.jsx)("svg",{className:"w-4 h-4 text-blue-600 dark:text-claude",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},t))]})})]})})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-3 bg-[#faf9f6] dark:bg-surface",children:(()=>{if("library"===W)return S?(0,a.jsx)("div",{className:"flex items-center justify-center h-48",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):0===Z.length?(0,a.jsxs)("div",{className:"text-center py-8 text-gray-500 dark:text-ink-muted",children:[(0,a.jsx)(d.A,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),(0,a.jsx)("p",{className:"text-sm",children:O("sidebar.noAgents")}),B&&(0,a.jsx)("p",{className:"text-xs mt-1",children:O("sidebar.noAgentsHint")})]}):(0,a.jsx)("div",{className:"space-y-2",children:Z.map((e,s)=>(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border cursor-pointer hover:bg-gray-50 dark:hover:bg-surface-active transition-colors ".concat((null==r?void 0:r.name)===e.name?"border-blue-300 dark:border-claude/50 bg-blue-50 dark:bg-claude/10":"border-gray-200 dark:border-border"),onClick:()=>null==t?void 0:t(e),children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsxs)("svg",{className:"w-4 h-4 text-blue-600 dark:text-blue-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,a.jsx)("polyline",{points:"14 2 14 8 20 8"})]})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"font-medium text-sm text-gray-900 dark:text-ink-primary",children:e.name}),(0,a.jsxs)("div",{className:"text-xs text-gray-500 dark:text-ink-muted flex items-center gap-1 mt-0.5",children:[(0,a.jsx)("span",{className:e.categoryColor,children:e.categoryIcon}),e.description]})]})]},s))});if("queues"===W)return 0===X.length?(0,a.jsxs)("div",{className:"text-center py-8 text-gray-500 dark:text-ink-muted",children:[(0,a.jsx)(c.A,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),(0,a.jsx)("p",{className:"text-sm",children:O("queues.noAgents")})]}):(0,a.jsx)("div",{className:"space-y-2",children:X.map(e=>(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border cursor-pointer hover:bg-gray-50 dark:hover:bg-surface-active transition-colors ".concat(R===e.type?"border-blue-300 dark:border-claude/50 bg-blue-50 dark:bg-claude/10":"border-gray-200 dark:border-border"),onClick:()=>null==z?void 0:z(e.type),children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 text-sm ".concat(e.color),children:e.icon}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"font-medium text-sm text-gray-900 dark:text-ink-primary",children:e.agentName}),(0,a.jsx)("div",{className:"text-xs text-gray-500 dark:text-ink-muted mt-0.5",children:O("queues.agentHint")})]})]},e.type))});if(K)return(0,a.jsx)("div",{className:"flex items-center justify-center h-48",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})});let e="starred"===W?J.filter(e=>e.favorite):J;return 0===e.length?(0,a.jsxs)("div",{className:"text-center py-8 text-gray-500 dark:text-ink-muted",children:["starred"===W?(0,a.jsx)(x.A,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}):(0,a.jsx)(d.A,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),(0,a.jsx)("p",{className:"text-sm",children:"starred"===W?O("sidebar.noStarredReports"):O("sidebar.noSavedReports")})]}):(0,a.jsx)(em,{reports:e,onSelect:T,onOverflowPanel:A})})()})]})};var eg=r(68951),ep=r.n(eg),eb=r(60772),ef=r(4207),ev=r(28451),ey=r(64062);
1let ek="https://api-prod.convomind.ai/api/v1",ej=async(e,t)=>{try{let r=await fetch("".concat(ek,"/agents/brief"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify(t)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}let a=await r.text();return a=(a=a.replace(/^data:\s*/gm,"")).trim(),JSON.parse(a)}catch(e){throw console.error("Failed to create brief:",e),e}},eN=async(e,t)=>{let r=await fetch("".concat(ek,"/agents/productResearch"),{method:"POST",headers:{"Content-Type":"application/json",Connection:"keep-alive",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);throw Error("API Error: ".concat(r.status," - ").concat(e?JSON.stringify(e):r.statusText))}let a=await r.text();return JSON.parse(a=(a=(a=a.replace(/^data:\s*$/gm,"")).replace(/^data:\s*/gm,"")).trim())},ew=async(e,t)=>{try{let r=await fetch("".concat(ek,"/agents/generator"),{method:"POST",headers:{"Content-Type":"application/json",Connection:"keep-alive",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}let a=(await r.text()).split("\n").filter(e=>e.trim().startsWith("data:")&&e.includes("{")).map(e=>JSON.parse(e.replace(/^data:\s*/,"").trim()));if(0===a.length)throw Error("No valid JSON found in response");return a}catch(e){throw console.error("Failed to generate content:",e),e}},eC=async(e,t)=>{try{let r=new FormData;r.append("request",new Blob([JSON.stringify(e)],{type:"application/json"}));let a=await fetch("".concat(ek,"/basic/chat/imageGenerator"),{method:"POST",headers:{Connection:"keep-alive",...t&&{Authorization:"Bearer ".concat(t)}},body:r});if(!a.ok){let e=await a.json().catch(()=>null);throw Error("API Error: ".concat(a.status," - ").concat(e?JSON.stringify(e):a.statusText))}let s=await a.text(),l=s.split("\n").find(e=>e.trim().startsWith("data:")&&e.includes("{"));if(!l)throw Error("No valid JSON found in response");return s=l.replace(/^data:\s*/,"").trim(),JSON.parse(s)}catch(e){throw console.error("Failed to generate images:",e),e}},eS=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en",a=arguments.length>3?arguments[3]:void 0,s=new URLSearchParams({keyword:e,language:t,country:r}),l=await fetch("".concat(ek,"/search/keywords?").concat(s),{method:"GET",headers:{"Content-Type":"application/json",...a&&{Authorization:"Bearer ".concat(a)}}});if(!l.ok){let e=await l.json().catch(()=>null);(0,ey.h)(e,l)}return await l.json()},eT=async(e,t)=>{try{let r=await fetch("".concat(ek,"/agents/scrape/research"),{method:"POST",headers:{"Content-Type":"application/json",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}let a=(await r.text()).split("\n").map(e=>e.replace(/^data:\s*/,"").trim()).filter(e=>e&&e.startsWith("{"));if(0===a.length)throw Error("No valid JSON in response");let s=JSON.parse(a[a.length-1]);if("BUDGET_EXCEEDED"===s.data||"NOT_ENOUGH_CREDIT"===s.data){let e=Error("Budget exceeded");throw e.name="BudgetExceedRequestError",e}return s}catch(e){throw console.error("Failed to scrape competitor research:",e),e}},eA=async(e,t)=>{try{let r=await fetch("".concat(ek,"/agents/scrape/competitor"),{method:"POST",headers:{"Content-Type":"application/json",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}let a=await r.text();a=(a=a.replace(/^data:\s*/gm,"")).trim();let s=JSON.parse(a);if(Array.isArray(s.data)&&(s.data.includes("BUDGET_EXCEEDED")||s.data.includes("NOT_ENOUGH_CREDIT"))){let e=Error("Budget exceeded");throw e.name="BudgetExceedRequestError",e}return s}catch(e){throw console.error("Failed to scrape competitor:",e),e}},eE=async(e,t)=>{try{var r;let a=await fetch("".concat(ek,"/agents/scrape/main"),{method:"POST",headers:{"Content-Type":"application/json",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!a.ok){let e=await a.json().catch(()=>null);(0,ey.h)(e,a)}let s=(await a.text()).split("\n").map(e=>
1e.replace(/^data:\s*/,"").trim()).filter(Boolean);return{data:null!==(r=s[s.length-1])&&void 0!==r?r:""}}catch(e){throw console.error("Failed to scrape main:",e),e}},eL=async(e,t)=>{try{var r;let a=await fetch("".concat(ek,"/agents/scrape/content"),{method:"POST",headers:{"Content-Type":"application/json",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!a.ok){let e=await a.json().catch(()=>null);(0,ey.h)(e,a)}let s=(await a.text()).split("\n").map(e=>e.replace(/^data:\s*/,"").trim()).filter(Boolean);return{data:null!==(r=s[s.length-1])&&void 0!==r?r:""}}catch(e){throw console.error("Failed to scrape content:",e),e}},eM=async(e,t,r)=>{try{let a=new FormData;a.append("file",e),a.append("request",new Blob([JSON.stringify(t)],{type:"application/json"}));let s=await fetch("".concat(ek,"/agents/productDescription"),{method:"POST",headers:{...r&&{Authorization:"Bearer ".concat(r)}},body:a});if(!s.ok){let e=await s.json().catch(()=>null);(0,ey.h)(e,s)}let l=await s.text();return(l=(l=l.replace(/^data:\s*/gm,"")).trim()).split("\n").filter(Boolean).map(e=>JSON.parse(e))}catch(e){throw console.error("Failed to create product description:",e),e}},eR=async(e,t)=>{try{let r=await fetch("".concat(ek,"/agents/studio-prompt"),{method:"POST",headers:{"Content-Type":"application/json",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}let a=await r.text(),s=(a=(a=a.replace(/^data:\s*/gm,"")).trim()).split("\n").filter(e=>{let t=e.trim();return t&&"undefined"!==t&&"null"!==t}),l=null;for(let e=s.length-1;e>=0;e--)try{l=JSON.parse(s[e]);break}catch(e){continue}if(!l)throw Error("No valid JSON found in response");return l}catch(e){throw console.error("Failed to execute xagent studio prompt:",e),e}},ez=async(e,t)=>{try{let r=await fetch("".concat(ek,"/agents/xagent"),{method:"POST",headers:{"Content-Type":"application/json",Connection:"keep-alive",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}let a=await r.text();a=(a=a.replace(/^data:\s*/gm,"")).trim();let s={};try{s=a?JSON.parse(a):{}}catch(e){s={}}if((null==s?void 0:s.data)==="BUDGET_EXCEEDED"||(null==s?void 0:s.data)==="NOT_ENOUGH_CREDIT"){let e=Error("Budget exceeded");throw e.name="BudgetExceedRequestError",e}return s}catch(e){throw console.error("Failed to execute xagent:",e),e}},e_=async(e,t)=>{try{let r=await fetch("".concat(ek,"/agents/xagent-goal"),{method:"POST",headers:{"Content-Type":"application/json",Connection:"keep-alive",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}let a=await r.text();a=(a=a.replace(/^data:\s*/gm,"")).trim();let s=JSON.parse(a);if("BUDGET_EXCEEDED"===s.data||"NOT_ENOUGH_CREDIT"===s.data){let e=Error("Budget exceeded");throw e.name="BudgetExceedRequestError",e}return s}catch(e){throw console.error("Failed to execute xagent-goal:",e),e}},eO=async(e,t,r)=>{try{let a=await fetch("".concat(ek,"/pro/rag/create-ai/agent/").concat(e),{method:"POST",headers:{"Content-Type":"application/json",...r&&{Authorization:"Bearer ".concat(r)}},body:JSON.stringify(t)});if(!a.ok){let e=await a.json().catch(()=>null);(0,ey.h)(e,a)}return await a.json()}catch(e){throw console.error("Failed to create RAG AI:",e),e}},eI=async(e,t)=>{try{let a=await fetch("".concat(ek,"/agents/xagent-cost-estimation"),{method:"POST",headers:{"Content-Type":"application/json",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)}),s=await a.text(),l=(s=(s=s.replace(/^data:\s*/gm,"")).trim()).split("\n").map(e=>e.trim()).filter(Boolean),n=[],i=null;for(let e of l){let t;try{t=JSON.parse(e)}catch(e){continue}if(t&&"object"==typeof t){if(t.error||"number"==typeof t.status&&t.status>=400){var r;let e=String(null!==(r=t.error)&&void 0!==r?r:"").match(/username:\s*\[([^\]]+)\]/i);e&&e[1].split(",").map(e=>e.trim()).filter(Boolean).forEach(e=>{n.includes(e)||n.push(e)});continue}(void 0!==t.estimatedCost||void 0!==t.userIds)&&(i=t)}}if(!i){if(n.length)i={estimatedCost:0,rivalUserIds:[],userIds:[],totalPosts:0,totalIncomingTweets:0};else if(a.ok)throw Error("Empty cost estimation response");else{let e=l.map(e=>{try{return JSON.parse(e)}catch(e){return null}}).find(e=>(null==e?void 0:e.error)||(null==e?void 0:e.message));(0,ey.h)(e,a)}}return i.invalidUsernames=n,i}catch(e){throw console.error("Failed to get xagent cost estimation:",e),e}},eD=async(e,t)=>{try{let r=await fetch("".concat(ek,"/agents/generate-copy"),{method:"POST",headers:{"Content-Type":"application/json",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}let a=await r.text(),s=(a=(a=a.replace(/^data:\s*/gm,"")).trim()).split("\n").filter(
1Boolean),l=s[s.length-1];return JSON.parse(l)}catch(e){throw console.error("Failed to generate xagent copy:",e),e}};async function eP(e,t,r,a){var s,l,n;let i=new FormData;i.append("file",t),i.append("request",new Blob([JSON.stringify(r)],{type:"application/json"}));try{let t=await fetch("".concat(ek,"/agents/category-finder"),{method:"POST",headers:{Accept:"text/event-stream",...e&&{Authorization:"Bearer ".concat(e)}},body:i});if(!t.ok){let e=await t.json().catch(()=>null);(0,ey.h)(e,t)}if(!t.body)throw Error("Streaming is not supported in this environment.");let r=t.body.getReader(),n=new TextDecoder("utf-8"),o="";for(;;){let e;let{value:t,done:s}=await r.read();if(s)break;for(o+=n.decode(t,{stream:!0});-1!==(e=o.search(/\r?\n\r?\n/));){let t=o.slice(0,e);o=o.slice(e+("\r"===o[e]?4:2));let r=[];for(let e of t.split(/\r?\n/))e.startsWith("data:")&&r.push(e.slice(5).trimStart());if(0===r.length)continue;let s=r.join("\n");try{let e=JSON.parse(s),t=null!==(l=null==e?void 0:e.data)&&void 0!==l?l:e;a.onEvent(t)}catch(e){console.warn("Failed to parse SSE chunk:",s,e)}}}null===(s=a.onComplete)||void 0===s||s.call(a)}catch(t){let e=t instanceof Error?t:Error(String(t));throw null===(n=a.onError)||void 0===n||n.call(a,e),e}}var eB=r(39203),eF=r(46232),eH=r(12718),eU=r(37042),eG=r(84007),eq=r(63090),eV=r(14337),eW=r(59255),eJ=r(49473);let eK=e=>{let{finalContentWithModels:t,keyword:r,showToast:s,onExportComplete:l}=e,n=e=>{let t=new DOMParser().parseFromString(e,"text/html"),r=[],a=(e,t)=>{let r=[];if(e.nodeType===Node.TEXT_NODE){var s;let r=null===(s=e.textContent)||void 0===s?void 0:s.trim();return r&&"ul"!==t&&"ol"!==t?[new eW.NTc({text:r})]:[]}if(e.nodeType===Node.ELEMENT_NODE){let t=e.tagName.toLowerCase();switch(t){case"h1":r.push(new eW.fzL({text:e.textContent||"",heading:eW.Fmo.HEADING_1,spacing:{before:360,after:240}}));break;case"h2":r.push(new eW.fzL({text:e.textContent||"",heading:eW.Fmo.HEADING_2,spacing:{before:320,after:200}}));break;case"h3":r.push(new eW.fzL({text:e.textContent||"",heading:eW.Fmo.HEADING_3,spacing:{before:280,after:160}}));break;case"h4":r.push(new eW.fzL({text:e.textContent||"",heading:eW.Fmo.HEADING_4,spacing:{before:240,after:120}}));break;case"p":let s=[];e.childNodes.forEach(e=>{if(e.nodeType===Node.TEXT_NODE){let t=e.textContent;t&&s.push(new eW.NTc({text:t}))}else if("STRONG"===e.nodeName||"B"===e.nodeName)s.push(new eW.NTc({text:e.textContent||"",bold:!0}));else if("EM"===e.nodeName||"I"===e.nodeName)s.push(new eW.NTc({text:e.textContent||"",italics:!0}));else if("A"===e.nodeName){let t=e.href,r=e.textContent||t;s.push(new eW.Mf2({children:[new eW.NTc({text:r,style:"Hyperlink",color:"0563C1",underline:{}})],link:t}))}else{let t=e.textContent;t&&s.push(new eW.NTc({text:t}))}}),s.length>0&&r.push(new eW.fzL({children:s,spacing:{before:120,after:120}}));break;case"ul":e.querySelectorAll(":scope > li").forEach(e=>{let t=[];e.childNodes.forEach(e=>{var r,a;if(e.nodeType===Node.TEXT_NODE){let a=null===(r=e.textContent)||void 0===r?void 0:r.trim();a&&t.push(new eW.NTc({text:a}))}else if("STRONG"===e.nodeName||"B"===e.nodeName)t.push(new eW.NTc({text:e.textContent||"",bold:!0}));else if("EM"===e.nodeName||"I"===e.nodeName)t.push(new eW.NTc({text:e.textContent||"",italics:!0}));else if("A"===e.nodeName){let r=e.href,a=e.textContent||r;t.push(new eW.Mf2({children:[new eW.NTc({text:a,style:"Hyperlink",color:"0563C1",underline:{}})],link:r}))}else{let r=null===(a=e.textContent)||void 0===a?void 0:a.trim();r&&t.push(new eW.NTc({text:r}))}}),r.push(new eW.fzL({children:t.length>0?t:[new eW.NTc({text:e.textContent||""})],bullet:{level:0},spacing:{before:80,after:80}}))});break;case"ol":e.querySelectorAll(":scope > li").forEach((e,t)=>{let a=[];e.childNodes.forEach(e=>{var t,r;if(e.nodeType===Node.TEXT_NODE){let r=null===(t=e.textContent)||void 0===t?void 0:t.trim();r&&a.push(new eW.NTc({text:r}))}else if("STRONG"===e.nodeName||"B"===e.nodeName)a.push(new eW.NTc({text:e.textContent||"",bold:!0}));else if("EM"===e.nodeName||"I"===e.nodeName)a.push(new eW.NTc({text:e.textContent||"",italics:!0}));else if("A"===e.nodeName){let t=e.href,r=e.textContent||t;a.push(new eW.Mf2({children:[new eW.NTc({text:r,style:"Hyperlink",color:"0563C1",underline:{}})],link:t}))}else{let t=null===(r=e.textContent)||void 0===r?void 0:r.trim();t&&a.push(new eW.NTc({text:t}))}}),r.push(new eW.fzL({children:a.length>0?a:[new eW.NTc({text:e.textContent||""})],numbering:{reference:"numbered-list",level:0},spacing:{before:80,after:80}}))});break;case"table":let l=[];e.querySelectorAll("tr").forEach((e,t)=>{var r;let a=[],s=e.querySelectorAll("th, td"),n=null!==e.querySelector("th")||(null===(r=e.parentElement)||void 0===r?void 0:r.tagName)==="THEAD";
1s.forEach(e=>{let r=[];e.childNodes.forEach(e=>{var t,a;if(e.nodeType===Node.TEXT_NODE){let a=null===(t=e.textContent)||void 0===t?void 0:t.trim();a&&r.push(new eW.NTc({text:a,bold:n}))}else if("STRONG"===e.nodeName||"B"===e.nodeName)r.push(new eW.NTc({text:e.textContent||"",bold:!0}));else if("A"===e.nodeName){let t=e.href,a=e.textContent||t;r.push(new eW.Mf2({children:[new eW.NTc({text:a,style:"Hyperlink",color:"0563C1",underline:{}})],link:t}))}else{let t=null===(a=e.textContent)||void 0===a?void 0:a.trim();t&&r.push(new eW.NTc({text:t}))}}),a.push(new eW.nA6({children:[new eW.fzL({children:r.length>0?r:[new eW.NTc({text:e.textContent||""})],spacing:{before:100,after:100}})],shading:n?{fill:"F9FAFB"}:t%2==0?{fill:"FFFFFF"}:{fill:"F9FAFB"},borders:{top:{style:eW.kDD.SINGLE,size:1,color:"D1D5DB"},bottom:{style:eW.kDD.SINGLE,size:1,color:"D1D5DB"},left:{style:eW.kDD.SINGLE,size:1,color:"D1D5DB"},right:{style:eW.kDD.SINGLE,size:1,color:"D1D5DB"}}}))}),l.push(new eW.Hjg({children:a}))}),l.length>0&&(r.push(new eW.XIK({rows:l,width:{size:100,type:eW.PsV.PERCENTAGE},margins:{top:100,bottom:100,left:100,right:100}})),r.push(new eW.fzL({text:"",spacing:{before:240,after:240}})));break;case"br":r.push(new eW.fzL({text:"",spacing:{before:80,after:80}}));break;case"strong":case"b":return[new eW.NTc({text:e.textContent||"",bold:!0})];case"em":case"i":return[new eW.NTc({text:e.textContent||"",italics:!0})];case"a":let n=e.href,i=e.textContent||n;return[new eW.Mf2({children:[new eW.NTc({text:i,style:"Hyperlink",color:"0563C1",underline:{}})],link:n})];default:e.childNodes.forEach(e=>{r.push(...a(e,t))})}}return r};return t.body.childNodes.forEach(e=>{r.push(...a(e))}),r.filter(e=>void 0!==e)},{t:i,i18n:o}=(0,P.Bd)("agent-content-brief"),d=async()=>{try{if(s(i("docx.generating"),"success"),0===t.length){s(i("docx.noContent"),"error");return}let e=[];e.push(new eW.fzL({children:[new eW.NTc({text:r,bold:!0,size:36})],heading:eW.Fmo.HEADING_1,spacing:{after:300},alignment:eW.Yus.CENTER})),e.push(new eW.fzL({children:[new eW.NTc({text:i("docx.generated",{datetime:"".concat(new Date().toLocaleDateString(o.language)," ").concat(new Date().toLocaleTimeString(o.language))}),size:20})],spacing:{after:120},alignment:eW.Yus.CENTER}));let a=t.map(e=>e.modelName).join(", ");e.push(new eW.fzL({children:[new eW.NTc({text:i("docx.models",{models:a}),size:20})],spacing:{after:400},alignment:eW.Yus.CENTER})),t.forEach((r,a)=>{e.push(new eW.fzL({children:[new eW.NTc({text:r.modelName,bold:!0,size:28,color:"2563EB"})],heading:eW.Fmo.HEADING_2,spacing:{before:400,after:240},shading:{fill:"EFF6FF"},border:{top:{color:"E0E7FF",space:1,style:"single",size:6},bottom:{color:"E0E7FF",space:1,style:"single",size:6},left:{color:"E0E7FF",space:1,style:"single",size:6},right:{color:"E0E7FF",space:1,style:"single",size:6}}}));let s=n(r.content);e.push(...s),a<t.length-1&&e.push(new eW.fzL({text:"",border:{bottom:{color:"CCCCCC",space:1,style:"single",size:12}},spacing:{before:480,after:480}}))});let d=new eW.yoT({numbering:{config:[{reference:"numbered-list",levels:[{level:0,format:"decimal",text:"%1.",alignment:eW.Yus.LEFT}]}]},sections:[{children:e}]}),c=await eW.ND6.toBlob(d),x="".concat(r.replace(/[^a-z0-9\s]/gi,"").replace(/\s+/g,"_").toLowerCase(),"_").concat(new Date().toISOString().split("T")[0],".docx");(0,eJ.saveAs)(c,x),s(i("docx.exported"),"success"),l&&l()}catch(e){console.error("DOCX export failed:",e),s(i("docx.failed",{message:e instanceof Error?e.message:i("docx.unknownError")}),"error")}};return(0,a.jsxs)("button",{onClick:d,disabled:!t.length,className:"px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)(eV.A,{className:"w-4 h-4"}),i("docx.button")]})};var eY=r(75938),e$=r(39811);let eX=()=>(0,a.jsx)(ep(),{id:"3258e1bd9199d0cb",children:":root{--safe-area-inset-top:env(safe-area-inset-top);--safe-area-inset-right:env(safe-area-inset-right);--safe-area-inset-bottom:env(safe-area-inset-bottom);--safe-area-inset-left:env(safe-area-inset-left)}@media(hover:none)and (pointer:coarse){button,input,select,textarea{min-height:44px}}html{-webkit-overflow-scrolling:touch}@media screen and (max-width:768px){input,select,textarea{font-size:16px}}"}),eZ=()=>(0,a.jsx)(ep(),{id:"1e3620d2efb019fc",children:'.html-content{line-height:1.6;color:#374151}.html-content h1{font-size:1.875rem;font-weight:700;color:#111827;margin-top:1.5rem;margin-bottom:1rem}.html-content h2{font-size:1.5rem;font-weight:600;color:#111827;margin-top:1.25rem;margin-bottom:.875rem}.html-content h3{font-size:1.25rem;font-weight:600;color:#111827;margin-top:1rem;margin-bottom:.75rem}.html-content h4{font-size:1.125rem;font-weight:600;color:#111827;margin-top:.875rem;margin-bottom:.625rem}.html-content p{margin-bottom:1rem;color:#374151}.html-content ul,.html-content ol{margin-bottom:1rem;padding-left:1.5rem}.html-content ul{list-style-type:disc}.html-content ol{list-style-type:decimal}.html-content li{margin-bottom:.5rem;color:#374151}.html-content a{color:#2563eb;text-decoration:none}.html-content a:hover{text-decoration:underline}.html-content strong,.html-content b{font-weight:600;color:#111827}.html-content table{width:100%;border-collapse:collapse;margin:1.5rem 0;border:1px solid#e5e7eb}.html-content thead{background-color:#f9fafb}.html-content th{border:1px solid#d1d5db;padding:.75rem 1rem;text-align:left;font-weight:600;color:#111827;font-size:.875rem}.html-content td{border:1px solid#e5e7eb;padding:.75rem 1rem;color:#374151;font-size:.875rem}.html-content tr:nth-child(even){background-color:#f9fafb}.html-content code{background-color:#f3f4f6;padding:.125rem .375rem;-webkit-border-radius:.25rem;-moz-border-radius:.25rem;border-radius:.25rem;font-family:monospace;font-size:.875em}.html-content pre{background-color:#f3f4f6;padding:1rem;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;overflow-x:auto;margin:1rem 0}.html-content blockquote{border-left:4px solid#e5e7eb;padding-left:1rem;margin:1rem 0;color:#6b7280;font-style:italic}.html-content br{display:block;margin:.5rem 0;content:""}.dark .html-content{color:#c9c5bc}.dark .html-content h1,.dark .html-content h2,.dark .html-content h3,.dark .html-content h4{color:#f0ede8}.dark .html-content p{color:#c9c5bc}.dark .html-content li{color:#c9c5bc}.dark .html-content a{color:#f97316}.dark .html-content a:hover{color:#fb923c}.dark .html-content strong,.dark .html-content b{color:#f0ede8}.dark .html-content table{border-color:#3a3733}.dark .html-content thead{background-color:#2a2825}.dark .html-content th{border-color:#3a3733;color:#f0ede8}.dark .html-content td{border-color:#3a3733;color:#c9c5bc}.dark .html-content tr:nth-child(even){background-color:#232220}.dark .html-content code{background-color:#2a2825;color:#f0ede8}.dark .html-content pre{background-color:#2a2825;color:#f0ede8}.dark .html-content blockquote{border-left-color:#3a3733;color:#9a9590}'}),eQ=e=>{let{title:t,description:r,icon:s}=e;return(0,a.jsx)("div",{className:"bg-blue-50 dark:bg-surface-elevated border-l-4 border-blue-500 dark:border-border rounded-lg p-4 mb-6 mt-6",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[s&&(0,a.jsx)("div",{className:"flex-shrink-0 mt-0.5 [&_svg]:dark:text-orange-400",children:s}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-blue-900 dark:text-ink-primary mb-1",children:t}),(0,a.jsx)("p",{className:"text-sm text-blue-800 dark:text-ink-secondary",children:r})]})]})})},e0=e=>{let{showToast:t,initialData:r,initialResponse:l,recordId:i}=e,{t:o}=(0,P.Bd)("agent-content-brief"),d=(0,y.d4)(e=>
1e.user),[c,x]=(0,s.useState)(!1),[m,h]=(0,s.useState)(!1),[g,p]=(0,s.useState)(!1),[b,f]=(0,s.useState)("keyword-search"),[v,k]=(0,s.useState)(!1),[j,w]=(0,s.useState)([]),[C,S]=(0,s.useState)(""),[T,A]=(0,s.useState)(""),[E,L]=(0,s.useState)("uk"),[M,R]=(0,s.useState)("en"),[z,_]=(0,s.useState)(null),[O,I]=(0,s.useState)(!1),[D,B]=(0,s.useState)([]),[F,H]=(0,s.useState)([]),[U,G]=(0,s.useState)([]),[q,V]=(0,s.useState)([]),[W,J]=(0,s.useState)(""),[K,Y]=(0,s.useState)(null),[$,X]=(0,s.useState)(!1),[Z,Q]=(0,s.useState)("daily"),[ee,et]=(0,s.useState)(!1),er=(0,s.useRef)(null),[ea,el]=(0,s.useState)(!1),[en,ei]=(0,s.useState)(!1),[eo,ed]=(0,s.useState)(""),[ec,ex]=(0,s.useState)(null),[eu,em]=(0,s.useState)(!1),[eh,eg]=(0,s.useState)([]),[ep,ev]=(0,s.useState)(null),[ey,ek]=(0,s.useState)(""),[ej,eN]=(0,s.useState)(!1),[ew,eC]=(0,s.useState)({}),[eM,eR]=(0,s.useState)([]),[ez,e_]=(0,s.useState)(null),[eO,eI]=(0,s.useState)(!1),[eD,eP]=(0,s.useState)([]);(0,s.useEffect)(()=>{var e;let t=navigator.language.split("-")[0],r=(null===(e=navigator.language.split("-")[1])||void 0===e?void 0:e.toLowerCase())||"us";R(t),L(r)},[]),(0,s.useEffect)(()=>{if(!l)return;let e={};Object.keys(l).forEach(t=>{e[t]=t}),eC(e),e_(l),f("final-content")},[l]),(0,s.useEffect)(()=>{var e,a,s,l,n,i;if(r){if((null===(e=r.aiModels)||void 0===e?void 0:e[0])&&eg(r.aiModels),r.extraData)try{let e=JSON.parse(r.extraData);if(e.keywordSearch&&(S(e.keywordSearch.keyword||""),R(e.keywordSearch.language||"en"),L(e.keywordSearch.country||"us"),A(e.keywordSearch.additionalConsideration||"")),(null===(a=e.keywordSearch)||void 0===a?void 0:a.keywordSearchResponse)&&_(e.keywordSearch.keywordSearchResponse),(null===(s=e.researchStep)||void 0===s?void 0:s.result)&&Y(e.researchStep.result),(null===(l=e.competitorStep)||void 0===l?void 0:l.results)&&ex(e.competitorStep.results),null===(n=e.briefStep)||void 0===n?void 0:n.rawData){let t="string"==typeof e.briefStep.rawData?e.briefStep.rawData:JSON.stringify(e.briefStep.rawData);ek(t);let r=e.briefStep.rawData;if("string"==typeof r)try{r=JSON.parse(r)}catch(e){}if(Array.isArray(r)){let t={};r.forEach((r,a)=>{var s,l,n;let i=r.modelName||(null===(l=e.settings)||void 0===l?void 0:null===(s=l.selectedAiModels)||void 0===s?void 0:s[a])||"Model ".concat(a+1),o=r.responseContent||(null===(n=r.outputData)||void 0===n?void 0:n.text);o&&(t[i]=o)}),ev(t)}}(null===(i=e.settings)||void 0===i?void 0:i.selectedAiModels)&&eg(e.settings.selectedAiModels)}catch(e){console.error("Failed to parse extraData from history:",e),t("Ge\xe7miÅ verileri ayrıÅtırılırken bir hata oluÅtu.","error")}else r.content&&S("")}},[r]),(0,s.useEffect)(()=>{ep&&"object"==typeof ep&&Object.keys(ep).length>0&&eR(Object.entries(ep).map(e=>{let[t,r]=e;return{modelName:ew[t]||t,content:r}}))},[ep,ew]),(0,s.useEffect)(()=>{ez&&"object"==typeof ez&&Object.keys(ez).length>0&&eP(Object.entries(ez).map(e=>{let[t,r]=e;return{modelName:ew[t]||t,content:(0,eY.xI)(r)}}))},[ez,ew]),(0,s.useEffect)(()=>{(async()=>{if(!ep||!(null==d?void 0:d.token))return;let e=Object.keys(ep).filter(e=>!ew[e]);if(0===e.length)return;let t=await Promise.all(e.map(async e=>{try{var t,r;let a=await (0,eU.eU)(d.token,e),s=null!==(r=null!==(t=null==a?void 0:a.name)&&void 0!==t?t:null==a?void 0:a.modelName)&&void 0!==r?r:e;return[e,s]}catch(t){return[e,e]}}));eC(e=>({...e,...Object.fromEntries(t)}))})()},[ep,null==d?void 0:d.token]),(0,s.useEffect)(()=>{let e=async()=>{try{var e;let t=await (0,eU.Hs)(null==d?void 0:d.token,{status:"ACTIVE",agentry:!0}),r=null!==(e=t.agenticAIs)&&void 0!==e?e:[];w(r)}catch(e){console.error("Failed to fetch AI models:",e),t(o("toast.loadModelsFailed"),"error")}};(null==d?void 0:d.token)&&e()},[null==d?void 0:d.token]);let eB=async()=>{if(!W){t(o("toast.selectModel"),"error");return}let e=[...D,...q.map(e=>{var t;return(null==z?void 0:null===(t=z.searchResult.relatedSearches[e])||void 0===t?void 0:t.query)||""}).filter(Boolean)],r=U.map(e=>{var t;return(null==z?void 0:null===(t=z.searchResult.peopleAlsoAsked[e])||void 0===t?void 0:t.question)||""}).filter(Boolean);if(0===e.length&&0===r.length){t(o("toast.selectKeyword"),"error");return}X(!0);try{let a=await eT({aiModule:W,keyword:C,semanticKeyword:e,paa:r},null==d?void 0:d.token);Y(a.data),t(o("toast.generated"),"success")}catch(e){e instanceof Error?"BudgetExceedRequestError"===e.name&&(Q("budgetExceed"),et(!0)):t(o("toast.errorResearch",{message:e instanceof Error?e.message:o("toast.unknownError")}))}finally{X(!1)}},eF=async()=>
1{if(!eo){t(o("toast.selectModel"),"error");return}let e=F.map(e=>{var t;return(null==z?void 0:null===(t=z.searchResult.organicResults[e])||void 0===t?void 0:t.link)||""}).filter(Boolean);if(0===e.length){t(o("toast.selectUrl"),"error");return}em(!0);try{let r=await eA({aiModule:eo,keyword:C,urls:e},null==d?void 0:d.token);ex(r.data),t(o("toast.competitorGenerated"),"success")}catch(e){e instanceof Error?"BudgetExceedRequestError"===e.name&&(Q("budgetExceed"),et(!0)):t(o("toast.errorAnalysis",{message:e instanceof Error?e.message:o("toast.unknownError")}))}finally{em(!1)}},eV=async()=>{if(0===eh.length){t(o("toast.selectAtLeastOneModel"),"error");return}if(!K){t(o("toast.researchNotFound"),"error");return}let e=ec?ec.map(e=>e.content):[];eN(!0),f("content"),k(!1);try{let r={aiModels:eh,keyword:C,researchResult:K,competitorResponse:e};T.trim()&&(r.additionalConsideration=T);let a=await eE(r,null==d?void 0:d.token);ek(a.data);let s=a.data;try{s=JSON.parse(s)}catch(e){}if(Array.isArray(s)){let e={};s.forEach((t,r)=>{var a;let s=t.modelName||eh[r]||"Model ".concat(r+1),l=t.responseContent||(null===(a=t.outputData)||void 0===a?void 0:a.text);l&&(e[s]=l)}),ev(e)}t(o("toast.generated"),"success")}catch(e){e instanceof Error?"BudgetExceedRequestError"===e.name&&(Q("budgetExceed"),et(!0)):t(o("toast.errorContent",{message:e instanceof Error?e.message:o("toast.unknownError")}))}finally{eN(!1)}},eW=async()=>{let e;if(!ey){t(o("toast.briefNotFound"),"error");return}try{e=JSON.parse(ey)}catch(e){t(o("toast.briefParseFailed"),"error");return}let r=Array.isArray(e)?e.map(e=>{var t;return e.responseContent||(null===(t=e.outputData)||void 0===t?void 0:t.text)||""}).filter(Boolean).join("\n\n"):ey;if(!r.trim()){t(o("toast.briefEmpty"),"error");return}if(0===eh.length){t(o("toast.noModelsSelected"),"error");return}console.log("briefContent: ",r),eI(!0),f("final-content");try{let a={keywordSearch:{keyword:C,language:M,country:E,additionalConsideration:T,keywordSearchResponse:z,selectedSuggestions:D,selectedOrganicResults:F,selectedPeopleAlsoAsked:U,selectedRelatedSearches:q},researchStep:{result:K},competitorStep:{results:ec},briefStep:{rawData:e},settings:{selectedAiModels:eh}},s={content:r,aiModels:eh,extraData:JSON.stringify(a)},l=(await eL(s,null==d?void 0:d.token)).data;
1try{"string"==typeof l&&(l=JSON.parse(l))}catch(e){}if(Array.isArray(l)){let e={};l.forEach((t,r)=>{var a;let s=t.modelName||t.selectedModelResponse||eh[r]||"model-".concat(r),l=t.responseContent||(null===(a=t.outputData)||void 0===a?void 0:a.text);l&&(e[s]=l)}),e_(e)}t(o("toast.generated"),"success")}catch(e){e instanceof Error?"BudgetExceedRequestError"===e.name&&(Q("budgetExceed"),et(!0)):t(o("toast.errorContent",{message:e instanceof Error?e.message:o("toast.unknownError")}))}finally{eI(!1)}},eJ=async()=>{if("keyword-search"===b){if(!C.trim()){t(o("toast.enterKeyword"),"error");return}I(!0);try{let e=await eS(C,M,E,null==d?void 0:d.token);_(e),t(o("toast.keywordSearchDone"),"success"),setTimeout(()=>{f("prompt-editor"),x(!1)},1e3)}catch(e){e instanceof Error?"BudgetExceedRequestError"===e.name&&(Q("budgetExceed"),et(!0)):t(o("toast.errorKeywordSearch",{message:e instanceof Error?e.message:o("toast.unknownError")}))}finally{I(!1)}return}if("prompt-editor"===b){if(!(D.length>0||q.length>0||U.length>0)){t(o("toast.selectAtLeastOneItem"),"error");return}f("competitor-research"),k(!0),x(!1);return}if("competitor-research"===b){K?(f("competitor-analysis"),k(!0)):await eB();return}if("competitor-analysis"===b){ec?(f("competitor-results"),k(!0)):await eF();return}if("competitor-results"===b){if(0===eh.length){t(o("toast.selectAtLeastOneModel"),"error");return}await eV(),N.emit();return}if("content"===b){await eW(),N.emit();return}},e0=()=>{let e=[...D,...q.map(e=>{var t;return(null==z?void 0:null===(t=z.searchResult.relatedSearches[e])||void 0===t?void 0:t.query)||""}).filter(Boolean)],t=U.map(e=>{var t;return(null==z?void 0:null===(t=z.searchResult.peopleAlsoAsked[e])||void 0===t?void 0:t.question)||""}).filter(Boolean);return(0,a.jsxs)("div",{className:"h-full overflow-y-auto p-6 space-y-6",children:[(0,a.jsx)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 rounded-xl border border-blue-200 dark:border-blue-500/30 shadow-sm p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("span",{className:"text-sm text-gray-600 dark:text-ink-muted",children:o("panels.keywordLabel")}),(0,a.jsx)("span",{className:"ml-2 text-base font-semibold text-gray-900 dark:text-ink-primary",children:C})]})]})}),(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg border border-gray-200 dark:border-border p-4",children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-700 dark:text-ink-primary mb-3",children:o("panels.semanticKeywords")}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((e,t)=>(0,a.jsx)("span",{className:"px-3 py-1 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 rounded-full text-sm",children:e},t))})]}),t.length>0&&(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg border border-gray-200 dark:border-border p-4",children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-700 dark:text-ink-primary mb-3",children:o("panels.peopleAlsoAsked")}),(0,a.jsx)("div",{className:"space-y-2",children:t.map((e,t)=>(0,a.jsx)("div",{className:"text-sm text-gray-600 dark:text-ink-secondary border-l-2 border-blue-500 dark:border-claude pl-3",children:e},t))})]}),(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg border border-gray-200 dark:border-border p-4",children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-700 dark:text-ink-primary mb-3",children:o("panels.aiModel")}),(0,a.jsx)(e$.A,{value:W,onChange:J,placeholder:o("panels.selectModel"),options:j.map(e=>({value:e.tag,label:e.name}))})]}),(0,a.jsx)(eQ,{title:o("panels.researchHintTitle"),description:o("panels.researchHintDescription"),icon:(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})})]})},e5=()=>{let e=F.map(e=>
1null==z?void 0:z.searchResult.organicResults[e]).filter(Boolean);return(0,a.jsxs)("div",{className:"h-full overflow-y-auto p-6 space-y-6",children:[(0,a.jsx)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 rounded-xl border border-blue-200 dark:border-blue-500/30 shadow-sm p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("span",{className:"text-sm text-gray-600 dark:text-ink-muted",children:o("panels.keywordLabel")}),(0,a.jsx)("span",{className:"ml-2 text-base font-semibold text-gray-900 dark:text-ink-primary",children:C})]})]})}),(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg border border-gray-200 dark:border-border p-4",children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-700 dark:text-ink-primary mb-3",children:o("panels.selectedCompetitors")}),(0,a.jsx)("div",{className:"space-y-3",children:e.map((e,t)=>(0,a.jsxs)("div",{className:"p-3 bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-500/30 rounded-lg",children:[(0,a.jsx)("h5",{className:"text-sm font-semibold text-gray-800 dark:text-ink-primary mb-1",children:e.title}),(0,a.jsx)("a",{href:e.link,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 dark:text-orange-400 hover:underline break-all",children:e.link})]},t))})]}),(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg border border-gray-200 dark:border-border p-4",children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-700 dark:text-ink-primary mb-3",children:o("panels.aiModel")}),(0,a.jsx)(e$.A,{value:eo,onChange:ed,placeholder:o("panels.selectModel"),options:j.map(e=>({value:e.tag,label:e.name}))})]}),(0,a.jsx)(eQ,{title:o("panels.competitorHintTitle"),description:o("panels.competitorHintDescription"),icon:(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})})]})},e4=()=>{let e=[...D,...q.map(e=>{var t;return(null==z?void 0:null===(t=z.searchResult.relatedSearches[e])||void 0===t?void 0:t.query)||""}).filter(Boolean)],t=U.map(e=>{var t;return(null==z?void 0:null===(t=z.searchResult.peopleAlsoAsked[e])||void 0===t?void 0:t.question)||""}).filter(Boolean),r=F.map(e=>null==z?void 0:z.searchResult.organicResults[e]).filter(Boolean);return(0,a.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,a.jsx)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 rounded-xl border border-blue-200 dark:border-blue-500/30 shadow-sm p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("span",{className:"text-sm text-gray-600 dark:text-ink-muted",children:o("panels.keywordLabel")}),(0,a.jsx)("span",{className:"ml-2 text-base font-semibold text-gray-900 dark:text-ink-primary",children:C})]})]})}),(0,a.jsx)(eQ,{title:o("panels.reviewHintTitle"),description:o("panels.reviewHintDescription"),icon:(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})})}),(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg border border-gray-200 dark:border-border p-4",children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-700 dark:text-ink-primary mb-3",children:o("panels.selectAiModel")}),(0,a.jsx)("div",{className:"grid grid-cols-4 gap-2 max-h-48 overflow-y-auto",children:j.map(e=>(0,a.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-surface-active p-2 rounded",children:[(0,a.jsx)("input",{type:"radio",name:"aiModel",checked:eh.includes(e.tag),onChange:()=>eg([e.tag]),className:"w-4 h-4 accent-orange-500"}),(0,a.jsx)("span",{className:"text-sm dark:text-ink-secondary",children:e.name})]},e.tag))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4 mb-4 mt-4",children:[(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg border border-gray-200 dark:border-border p-4",children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-700 dark:text-ink-primary mb-3",children:o("panels.semanticKeywords")}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map((e,t)=>(0,a.jsx)("span",{className:"px-2 py-1 bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400 rounded-full text-xs",children:e},t))})]}),(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg border border-gray-200 dark:border-border p-4",children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-700 dark:text-ink-primary mb-3",children:o("panels.peopleAlsoAsked")}),(0,a.jsx)("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:t.map((e,t)=>(0,a.jsx)("div",{className:"text-xs text-gray-600 dark:text-ink-secondary border-l-2 border-blue-500 dark:border-claude pl-2",children:e},t))})]}),(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg border border-gray-200 dark:border-border p-4",children:[(0,a.jsx)("h4",{className:"font-semibold text-gray-700 dark:text-ink-primary mb-3",children:o("panels.selectedCompetitors")}),(0,a.jsx)("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:r.map((e,t)=>(0,a.jsx)("div",{className:"flex items-start gap-3",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-blue-600 dar
1k:text-blue-400 mb-1",children:e.title}),(0,a.jsx)("a",{href:e.link,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"text-xs text-green-700 dark:text-orange-400 hover:underline inline-block max-w-full truncate",children:e.link})]})},t))})]})]})]})};return(0,a.jsxs)("div",{className:"flex flex-col h-screen bg-gray-25 dark:bg-surface",style:{fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif'},children:[(0,a.jsx)(eX,{}),(0,a.jsx)(e2,{currentStep:"keyword-search"===b?1:"prompt-editor"===b?2:"competitor-research"===b?3:"competitor-analysis"===b?4:"competitor-results"===b?5:"content"===b?6:"final-content"===b?7:1,isGenerating:m||O||$||eu||ej,hasFreshResults:c,onStepClick:e=>{f(e),"competitor-research"===e||"competitor-analysis"===e||"competitor-results"===e?k(!0):k(!1)}}),(0,a.jsx)("div",{className:"border-b border-gray-200 dark:border-border px-8 py-6 bg-white dark:bg-surface-elevated",children:(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold dark:text-ink-primary",children:o("header.".concat(b),{defaultValue:b})}),"final-content"===b&&i&&(0,a.jsxs)(u.$n,{onClick:()=>p(!0),variant:"outline",size:"sm",className:"flex items-center",children:[(0,a.jsx)(ef.A,{className:"w-4 h-4 mr-2"}),o("header.shareWithTeam")]})]})}),(0,a.jsx)("div",{className:"flex-1 overflow-hidden",children:v?"competitor-results"===b?(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsx)("div",{className:"h-1/3 border-b border-gray-200 overflow-hidden",children:e4()}),(0,a.jsx)("div",{className:"h-2/3",children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eZ,{}),(0,a.jsxs)(eH.YZ,{className:"mt-6",direction:"horizontal",children:[(0,a.jsx)(eH.Zk,{defaultSize:50,minSize:30,children:(0,a.jsxs)("div",{className:"h-full overflow-y-auto p-6 bg-white dark:bg-surface",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4 text-gray-700 dark:text-ink-primary",children:o("panels.researchResult")}),K?(0,a.jsx)("div",{className:"bg-gray-50 dark:bg-surface-elevated p-4 rounded-lg",children:(0,a.jsx)(eq.A,{content:K,messageIndex:0})}):(0,a.jsx)("div",{className:"text-gray-400 dark:text-ink-muted text-center py-8",children:o("panels.noResearchResult")})]})}),(0,a.jsx)(eH.TW,{className:"w-1 bg-gray-300 dark:bg-border hover:bg-blue-500 dark:hover:bg-claude cursor-col-resize transition-colors duration-200"}),(0,a.jsx)(eH.Zk,{defaultSize:50,minSize:30,children:(0,a.jsxs)("div",{className:"h-full overflow-y-auto p-6 bg-white dark:bg-surface",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4 text-gray-700 dark:text-ink-primary",children:o("panels.competitorAnalysis")}),ec?(0,a.jsx)("div",{className:"space-y-4",children:Array.isArray(ec)?ec.map((e,t)=>(0,a.jsxs)("div",{className:"border border-gray-200 dark:border-border rounded-lg overflow-hidden",children:[(0,a.jsx)("div",{className:"bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-900/20 dark:to-pink-900/20 px-4 py-3 border-b border-gray-200 dark:border-border",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-purple-600 dark:text-purple-400 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),(0,a.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-purple-600 dark:text-purple-400 hover:underline break-all",children:e.url})]})}),(0,a.jsx)("div",{className:"bg-white dark:bg-surface-elevated p-4",children:(0,a.jsx)("div",{className:"html-content dark:text-ink-secondary",dangerouslySetInnerHTML:{__html:e.content}})})]},t)):(0,a.jsx)("div",{className:"bg-gray-50 dark:bg-surface-elevated p-4 rounded-lg",children:(0,a.jsx)("div",{className:"html-content dark:text-ink-secondary",dangerouslySetInnerHTML:{__html:ec}})})}):(0,a.jsx)("div",{className:"text-gray-400 dark:text-ink-muted text-center py-8",children:o("panels.noCompetitorResult")})]})})]})]})})]}):(0,a.jsxs)(eH.YZ,{direction:"horizontal",children:[(0,a.jsx)(eH.Zk,{defaultSize:50,minSize:30,maxSize:80,className:"flex flex-col",children:"competitor-analysis"===b?e5():e0()}),(0,a.jsxs)(eH.TW,{className:"w-1 bg-gray-300 dark:bg-border hover:bg-blue-500 dark:hover:bg-claude cursor-col-resize transition-colors duration-200 relative group",children:[(0,a.jsx)("div",{className:"absolute inset-y-0 -inset-x-1"}),(0,a.jsx)("div",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-1 h-8 rounded-full bg-gray-400 dark:bg-border opacity-0 group-hover:opacity-100 group-hover:bg-blue-600 dar
1k:group-hover:bg-claude transition-all duration-200"})]}),(0,a.jsx)(eH.Zk,{defaultSize:50,minSize:20,className:"bg-white dark:bg-surface border-l border-gray-200 dark:border-border",children:(()=>{let e="competitor-analysis"===b?ec:K,t="competitor-analysis"===b?eu:$;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eZ,{}),(0,a.jsx)("div",{className:"h-full overflow-y-auto p-6",children:e?(0,a.jsx)("div",{className:"max-w-none",children:"competitor-analysis"===b?(0,a.jsx)("div",{className:"space-y-4",children:Array.isArray(e)&&e.map((e,t)=>(0,a.jsxs)("div",{className:"border border-gray-200 dark:border-border rounded-lg overflow-hidden",children:[(0,a.jsx)("div",{className:"bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-900/20 dark:to-pink-900/20 px-4 py-3 border-b border-gray-200 dark:border-border",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-purple-600 dark:text-purple-400 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),(0,a.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-purple-600 dark:text-purple-400 hover:underline break-all",children:e.url})]})}),(0,a.jsx)("div",{className:"bg-white dark:bg-surface-elevated p-4",children:(0,a.jsx)("div",{className:"html-content dark:text-ink-secondary",dangerouslySetInnerHTML:{__html:e.content}})})]},t))}):(0,a.jsx)("div",{className:"bg-gray-50 dark:bg-surface p-4 rounded-lg",children:(0,a.jsx)(eq.A,{content:e,messageIndex:0})})}):(0,a.jsx)("div",{className:"h-full flex items-center justify-center text-gray-400 dark:text-ink-muted",children:(0,a.jsxs)("div",{className:"text-center",children:[t&&(0,a.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-16 w-16 border-b-2 border-blue-600 dark:border-orange-500 border-t-transparent mb-4"}),(0,a.jsx)("h3",{className:"text-xl font-semibold text-gray-700 dark:text-ink-primary mb-2",children:o("panels.generating")}),(0,a.jsx)("p",{className:"text-gray-500 dark:text-ink-muted",children:o("panels.mayTakeMinutes")})]})}),(0,a.jsx)(eb.A,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),(0,a.jsx)("p",{children:t?o("panels.generatingShort"):o("panels.contentPlaceholder")})]})})})]})})()})]}):(0,a.jsx)("div",{className:"h-full",children:"keyword-search"===b?(0,a.jsx)("div",{className:"flex-1 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-border scrollbar-track-transparent p-8",children:(0,a.jsx)("div",{className:"max-w-5xl mx-auto",children:(0,a.jsx)("div",{className:"space-y-6",children:(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-xl border border-gray-200 dark:border-border shadow-sm p-6",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary mb-4",children:o("search.title")}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium text-gray-700 dark:text-ink-secondary mb-2",children:[o("search.keyword")," ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)("input",{type:"text",value:C,onChange:e=>S(e.target.value),placeholder:o("search.keywordPlaceholder"),className:"w-full py-2 px-3 border border-gray-300 dark:border-border rounded-lg bg-white dark:bg-surface text-gray-800 dark:text-ink-primary placeholder:text-gray-400 dark:placeholder:text-ink-muted focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude/30 focus:border-blue-500 dark:focus:border-claude transition-all duration-200"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-ink-secondary mb-2",children:o("search.language")}),ea?(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:M,onChange:e=>R(e.target.value),placeholder:o("search.customLanguagePlaceholder"),className:"flex-1 py-2 px-3 border border-gray-300 dark:border-border rounded-lg bg-white dark:bg-surface text-gray-800 dark:text-ink-primary focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude/30 focus:border-blue-500 dark:focus:border-claude"}),(0,a.jsx)("button",{onClick:()=>{el(!1),R("en")},className:"px-3 py-2 text-sm text-gray-600 dark:text-ink-muted border border-gray-300 dark:border-border rounded-lg hover:bg-gray-50 dark:hover:bg-surface-active",children:"â"})]}):(0,a.jsx)(e$.A,{value:M,onChange:e=>{"custom"===e?(el(!0),R("")):R(e)},options:[{value:"en",label:o("languageOptions.en")},{value:"tr",label:o("languageOptions.tr")},{value:"es",label:o("languageOptions.es")},{value:"fr",label:o("languageOptions.fr")},{value:"de",label:o("languageOptions.de")},{value:"custom",label:o("search.others")}]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-ink-secondary mb-2",children:o("search.country")}),en?(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:E,onChange:e=>L(e.target.value),placeholder:o("search.customCountryPlaceholder"),className:"flex-1 py-2 px-3 border border-gray-300 dark:border-border rounded-lg bg-white dark:bg-surface text-gray-800 dark:text-ink-primary focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude/30 focus:border-blue-500 dark:focus:border-claude"}),(0,a.jsx)("button",{onClick:()=>{ei(!1),L("us")},className:"px-3 py-2 text-sm text-gray-600 dark:text-ink-muted border border-gray-300 dark:border-border rounded-lg hover:bg-gray-50 dark:hover:bg-surface-active",children:"â"})]}):(0,a.jsx)(e$.A,{value:E,onChange:e=>{"custom"===e?(ei(!0),L("")):L(e)},options:[{value:"uk",label:o("countryOptions.uk")},{value:"us",label:o("countryOptions.us")},{value:"tr",label:o("countryOptions.tr")},{value:"es",label:o("countryOptions.es")},{value:"fr",label:o("countryOptions.fr")},{value:"de",label:o("countryOptions.de")},{value:"custom",label:o("search.others")}]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-ink-secondary mb-2",children:o("search.additional")}),(0,a.jsx)("textarea",{value:T,onChange:e=>A(e.target.value),className:"w-full py-2 resize-none px-3 border border-gray-300 dark:border-border rounded-lg bg-white dark:bg-surface text-gray-800 dark:text-ink-primary placeholder:text-gray-400 dark:placeholder:text-ink-muted focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude/30 focus:border-blue-500 dark:focus:border-claude transition-all duration-200",placeholder:o("search.additionalPlaceholder"),style:{lineHeight:"1.5",fontSize:"14px",minHeight:"150px",maxHeight:"150px"}})]})]}),(0,a.jsx)(eQ,{title:o("search.hintTitle"),description:o("search.hintDescription"),icon:(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})})]})})})}):"prompt-editor"===b?(()=>{var e,t,r,s,l,n,i;return(0,a.jsx)("div",{className:"h-full flex flex-col",children:(0,a.jsx)("div",{className:"flex-1 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-transparent p-8",children:(0,a.jsx)("div",{className:"max-w-5xl mx-auto",children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)(eQ,{title:o("sources.hintTitle"),description:o("sources.hintDescription"),icon:(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),z&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 rounded-xl border border-blue-200 dark:border-blue-500/30 shadow-sm p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600 dar
1k:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("span",{className:"text-sm text-gray-600 dark:text-ink-muted",children:o("sources.keywordLabel")}),(0,a.jsx)("span",{className:"ml-2 text-base font-semibold text-gray-900 dark:text-ink-primary",children:C})]})]})}),(null==z?void 0:null===(e=z.autoCompleteResult)||void 0===e?void 0:e.suggestions)&&z.autoCompleteResult.suggestions.length>0&&(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-xl border border-gray-200 dark:border-border shadow-sm p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary",children:o("sources.autocomplete",{count:z.autoCompleteResult.suggestions.length})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>{B(z.autoCompleteResult.suggestions.map(e=>new URLSearchParams(e.serpApiLink.split("?")[1]).get("q")||"").filter(Boolean))},className:"px-3 py-1.5 text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 rounded-lg hover:bg-blue-100 dark:hover:bg-blue-900/30",children:o("sources.selectAll")}),(0,a.jsx)("button",{onClick:()=>B([]),className:"px-3 py-1.5 text-xs bg-gray-100 dark:bg-surface-active text-gray-600 dark:text-ink-muted rounded-lg hover:bg-gray-200 dark:hover:bg-surface-active/80",children:o("sources.clearAll")})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:z.autoCompleteResult.suggestions.map((e,t)=>{let r=new URLSearchParams(e.serpApiLink.split("?")[1]).get("q")||"";return(0,a.jsx)("button",{onClick:()=>{D.includes(r)?B(D.filter(e=>e!==r)):B([...D,r])},className:"px-3 py-1.5 rounded-full text-sm transition-all ".concat(D.includes(r)?"bg-blue-600 dark:bg-claude text-white":"bg-gray-100 dark:bg-surface-active text-gray-700 dark:text-ink-secondary hover:bg-gray-200 dark:hover:bg-surface-active/80"),children:r},t)})})]}),(null===(r=z.searchResult)||void 0===r?void 0:null===(t=r.peopleAlsoAsked)||void 0===t?void 0:t.length)>0&&(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-xl border border-gray-200 dark:border-border shadow-sm p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary",children:o("sources.peopleAlsoAsked",{count:z.searchResult.peopleAlsoAsked.length})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>G(z.searchResult.peopleAlsoAsked.map((e,t)=>t)),className:"px-3 py-1.5 text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 rounded-lg hover:bg-blue-100 dark:hover:bg-blue-900/30",children:o("sources.selectAll")}),(0,a.jsx)("button",{onClick:()=>G([]),className:"px-3 py-1.5 text-xs bg-gray-100 dark:bg-surface-active text-gray-600 dark:text-ink-muted rounded-lg hover:bg-gray-200 dark:hover:bg-surface-active/80",children:o("sources.clearAll")})]})]}),(0,a.jsx)("div",{className:"space-y-3",children:z.searchResult.peopleAlsoAsked.map((e,t)=>(0,a.jsxs)("div",{onClick:()=>{U.includes(t)?G(U.filter(e=>e!==t)):G([...U,t])},className:"p-3 rounded-lg cursor-pointer transition-all ".concat(U.includes(t)?"bg-blue-50 dark:bg-blue-900/20 border-2 border-blue-600 dark:border-blue-500":"bg-gray-50 dark:bg-surface border border-gray-200 dark:border-border hover:border-gray-300 dark:hover:border-border"),children:[(0,a.jsx)("p",{className:"text-sm font-medium text-gray-900 dark:text-ink-primary",children:e.question}),e.snippet&&(0,a.jsx)("p",{className:"text-xs text-gray-600 dark:text-ink-muted mt-1",children:e.snippet})]},t))})]}),(null===(l=z.searchResult)||void 0===l?void 0:null===(s=l.relatedSearches)||void 0===s?void 0:s.length)>0&&(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-xl border border-gray-200 dark:border-border shadow-sm p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary",children:o("sources.relatedSearches",{count:z.searchResult.relatedSearches.length})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>V(z.searchResult.relatedSearches.map((e,t)=>t)),className:"px-3 py-1.5 text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-600 dar
1k:text-blue-400 rounded-lg hover:bg-blue-100 dark:hover:bg-blue-900/30",children:o("sources.selectAll")}),(0,a.jsx)("button",{onClick:()=>V([]),className:"px-3 py-1.5 text-xs bg-gray-100 dark:bg-surface-active text-gray-600 dark:text-ink-muted rounded-lg hover:bg-gray-200 dark:hover:bg-surface-active/80",children:o("sources.clearAll")})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:z.searchResult.relatedSearches.map((e,t)=>(0,a.jsx)("button",{onClick:()=>{q.includes(t)?V(q.filter(e=>e!==t)):V([...q,t])},className:"px-3 py-1.5 rounded-full text-sm transition-all ".concat(q.includes(t)?"bg-green-600 text-white":"bg-gray-100 dark:bg-surface-active text-gray-700 dark:text-ink-secondary hover:bg-gray-200 dark:hover:bg-surface-active/80"),children:e.query},t))})]}),(null===(i=z.searchResult)||void 0===i?void 0:null===(n=i.organicResults)||void 0===n?void 0:n.length)>0&&(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-xl border border-gray-200 dark:border-border shadow-sm p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary",children:o("sources.topResults",{count:z.searchResult.organicResults.length})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>H(z.searchResult.organicResults.map((e,t)=>t)),className:"px-3 py-1.5 text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 rounded-lg hover:bg-blue-100 dark:hover:bg-blue-900/30",children:o("sources.selectAll")}),(0,a.jsx)("button",{onClick:()=>H([]),className:"px-3 py-1.5 text-xs bg-gray-100 dark:bg-surface-active text-gray-600 dark:text-ink-muted rounded-lg hover:bg-gray-200 dark:hover:bg-surface-active/80",children:o("sources.clearAll")})]})]}),(0,a.jsx)("div",{className:"space-y-3",children:z.searchResult.organicResults.map((e,t)=>(0,a.jsx)("div",{onClick:()=>{F.includes(t)?H(F.filter(e=>e!==t)):H([...F,t])},className:"p-4 rounded-lg cursor-pointer transition-all ".concat(F.includes(t)?"bg-purple-50 dark:bg-purple-900/20 border-2 border-purple-600 dark:border-purple-500":"bg-gray-50 dark:bg-surface border border-gray-200 dark:border-border hover:border-gray-300 dark:hover:border-border"),children:(0,a.jsx)("div",{className:"flex items-start gap-3",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-blue-600 dark:text-blue-400 mb-1",children:e.title}),(0,a.jsx)("a",{href:e.link,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"text-xs text-green-700 dark:text-green-400 hover:underline inline-block max-w-full truncate",children:e.link})]})})},t))})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,a.jsx)("button",{onClick:()=>{B(z.autoCompleteResult.suggestions.map(e=>new URLSearchParams(e.serpApiLink.split("?")[1]).get("q")||"").filter(Boolean)),H(z.searchResult.organicResults.map((e,t)=>t)),G(z.searchResult.peopleAlsoAsked.map((e,t)=>t)),V(z.searchResult.relatedSearches.map((e,t)=>t))},className:"px-3 py-1.5 text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 rounded hover:bg-blue-100 dark:hover:bg-blue-900/30",children:o("sources.selectAll")}),(0,a.jsx)("button",{onClick:()=>{B([]),H([]),G([]),V([])},className:"px-3 py-1.5 text-xs bg-gray-50 dark:bg-surface-active text-gray-600 dark:text-ink-muted rounded hover:bg-gray-100 dark:hover:bg-surface-active/80",children:o("sources.clearAll")})]})]})]})})})})})():"competitor-research"===b?e0():"competitor-analysis"===b?e5():"competitor-results"===b?e4():"content"===b?(()=>{let e=e=>{let t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll("a").forEach(e=>{e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer")}),t.innerHTML};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eZ,{}),(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[ep&&(0,a.jsx)("div",{className:"px-6 pt-6 pb-4 flex justify-end border-b border-gray-200 dark:border-border",children:(0,a.jsx)(eK,{finalContentWithModels:eM,keyword:C,showToast:t,onExportComplete:()=>{t(o("panels.exportDone"),"success")}})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-6",children:ej?(0,a.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-16 w-16 border-b-2 border-blue-600 dar
1k:border-orange-500 border-t-transparent mb-4"}),(0,a.jsx)("h3",{className:"text-xl font-semibold text-gray-700 dark:text-ink-primary mb-2",children:o("panels.generatingFinalBrief")}),(0,a.jsx)("p",{className:"text-gray-500 dark:text-ink-muted",children:o("panels.mayTakeMinutes")}),(0,a.jsx)("p",{className:"text-sm text-gray-400 dark:text-ink-muted mt-2",children:o("panels.doNotClose")})]})}):ep?(0,a.jsx)("div",{className:"space-y-6",children:Object.entries(ep).map(t=>{let[r,s]=t;return(0,a.jsxs)("div",{className:"border border-gray-200 dark:border-border rounded-lg overflow-hidden",children:[(0,a.jsx)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 px-4 py-3 border-b border-gray-200 dark:border-border",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-ink-primary",children:ew[r]||r})]})}),(0,a.jsx)("div",{className:"bg-white dark:bg-surface-elevated p-6",children:(0,a.jsx)("div",{className:"html-content",dangerouslySetInnerHTML:{__html:e(s)}})})]},r)})}):(0,a.jsx)("div",{className:"h-full flex items-center justify-center text-gray-400 dark:text-ink-muted",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(eb.A,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),(0,a.jsx)("p",{children:o("panels.finalBriefPlaceholder")})]})})})]})]})})():"final-content"===b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eZ,{}),(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[ez&&(0,a.jsx)("div",{className:"px-6 pt-6 pb-4 flex justify-end border-b border-gray-200 dark:border-border",children:(0,a.jsx)(eK,{finalContentWithModels:eD,keyword:C,showToast:t,onExportComplete:()=>{t("Export completed!","success")}})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-6",children:eO?(0,a.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-16 w-16 border-b-2 border-blue-600 dark:border-orange-500 border-t-transparent mb-4"}),(0,a.jsx)("h3",{className:"text-xl font-semibold text-gray-700 dark:text-ink-primary mb-2",children:o("finalContent.generating")}),(0,a.jsx)("p",{className:"text-gray-500 dark:text-ink-muted",children:o("finalContent.mayTakeMinutes")}),(0,a.jsx)("p",{className:"text-sm text-gray-400 dark:text-ink-muted mt-2",children:o("finalContent.doNotClose")})]})}):ez?(0,a.jsx)("div",{className:"space-y-6",children:Object.entries(ez).map(e=>{let[t,r]=e;return(0,a.jsxs)("div",{className:"border border-gray-200 dark:border-border rounded-lg overflow-hidden",children:[(0,a.jsx)("div",{className:"bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 px-4 py-3 border-b border-gray-200 dark:border-border",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-green-600 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-ink-primary",children:ew[t]||t})]})}),(0,a.jsx)("div",{className:"bg-white dark:bg-surface-elevated p-6",children:(0,a.jsx)(eq.A,{content:r,messageIndex:0})})]},t)})}):(0,a.jsx)("div",{className:"h-full flex items-center justify-center text-gray-400 dark:text-ink-muted",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(eb.A,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),(0,a.jsx)("p",{children:o("finalContent.placeholder")})]})})})]})]}):null})}),"final-content"!==b&&(0,a.jsx)(e1,{handleRun:eJ,view:b,isGenerating:m||O||$||eu||ej,onStop:()=>{h(!1),X(!1),em(!1),eN(!1),k(!1)},buttonText:"keyword-search"===b?O?o("actions.searching"):o("actions.search"):"prompt-editor"===b?o("actions.continue"):"competitor-research"===b?$?o("actions.generating"):K?o("actions.continueToCompetitor"):o("actions.generate"):"competitor-analysis"===b?eu?o("actions.analyzing"):ec?o("actions.continueToOverview"):o("actions.analyze"):"competitor-results"===b?ej?o("actions.generating"):o("actions.generateBrief"):"content"===b?o("actions.generateContent"):o("actions.continue")}),ee&&(0,a.jsx)("div",{ref:er,className:"relative ",children:(0,a.jsx)("div",{className:"absolute bottom-36 mb-4 left-0 right-0 mx-auto w-full max-w-3xl shadow-lg",children:(0,a.jsxs)("div",{className:"relative bg-white rounded shadow-lg",children:[(0,a.jsx)("button",{className:"absolute -top-2 -right-2 text-gray-600 hover:text-gray-900 bg-white rounded-full p-2 shadow-lg z-10 transition-colors",onClick:()=>et(!1),children:(0,a.jsx)(n.A,{className:"h-5 w-5"})}),(0,a.jsx)(eG.A,{limitType:Z,onClose:()=>et(!1)})]})})}),g&&i&&(0,a.jsx)(es,{itemId:i,report:{type:"BRIEF_CONTENT",name:C?o("share.reportNameWithKeyword",{keyword:C}):o("share.reportName")},onClose:()=>p(!1)})]})},e1=e=>{let{handleRun:t,isGenerating:r,onStop:s,buttonText:l}=e,{t:i}=(0,P.Bd)("agent-content-brief");return(0,a.jsx)("div",{className:"border-t border-gray-200 dark:border-border px-6 py-2 bg-white dark:bg-surface-elevated mb-8",children:(0,a.jsxs)("div",{className:"flex justify-end gap-3",children:[r&&(0,a.jsxs)("button",{onClick:s,className:"px-6 py-2.5 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors flex items-center gap-2",children:[(0,a.jsx)(n.A,{className:"w-4 h-4"}),i("actions.stop")]}),(0,a.jsxs)("button",{onClick:t,disabled:r,className:"px-6 py-2.5 bg-blue-600 dar
1k:bg-claude text-white rounded-lg hover:bg-blue-700 dark:hover:bg-claude-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[(0,a.jsx)(ev.A,{className:"w-4 h-4"}),r?i("actions.processing"):null!=l?l:i("actions.run")]})]})})},e2=e=>{let{currentStep:t,isGenerating:r,onStepClick:l}=e,{t:n}=(0,P.Bd)("agent-content-brief"),i=[{id:1,name:"Keyword Search",view:"keyword-search"},{id:2,name:"Select Data",view:"prompt-editor"},{id:3,name:"Research",view:"competitor-research"},{id:4,name:"Competitor",view:"competitor-analysis"},{id:5,name:"Overview",view:"competitor-results"},{id:6,name:"Brief",view:"content"},{id:7,name:"Content",view:"final-content"}];return(0,a.jsx)("div",{className:"border-b border-gray-200 dark:border-border px-8 py-4 bg-white dark:bg-surface-elevated",children:(0,a.jsx)("div",{className:"flex items-center justify-center max-w-3xl mx-auto",children:i.map((e,o)=>(0,a.jsxs)(s.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)("button",{onClick:()=>l(e.view),disabled:r||t<e.id,className:"w-10 h-10 rounded-full flex items-center justify-center font-semibold transition-all ".concat(t===e.id?"bg-blue-600 dark:bg-orange-500 text-white":t>e.id?"bg-green-600 text-white hover:bg-green-700 cursor-pointer":"bg-gray-200 dark:bg-surface-active text-gray-600 dark:text-ink-muted cursor-not-allowed"," ").concat(r||t<e.id?"opacity-50 cursor-not-allowed":""),children:e.id}),(0,a.jsx)("span",{className:"text-xs mt-2 ".concat(t===e.id?"text-blue-600 dark:text-orange-400 font-medium":t>e.id?"text-green-600 dark:text-green-400":"text-gray-600 dark:text-ink-muted"),children:n("steps.".concat(e.view),{defaultValue:e.name})})]}),o<i.length-1&&(0,a.jsx)("div",{className:"flex-1 h-0.5 mx-4 ".concat(t>e.id?"bg-green-600 dark:bg-green-700":"bg-gray-200 dark:bg-border")})]},e.id))})})},e5=e=>{let{initialData:t,initialResponse:r,recordId:s}=e,{toast:l,showToast:n}=(0,eB.Z)();return(0,a.jsxs)("div",{className:"flex bg-[#faf9f6] dark:bg-surface",children:[(0,a.jsx)(eF.A,{show:l.show,message:l.message,type:l.type}),(0,a.jsx)("div",{className:"flex-1 p-8 h-full bg-[#faf9f6] dark:bg-surface",children:(0,a.jsx)(e0,{showToast:n,initialData:t,initialResponse:r,recordId:s})})]})};var e4=r(30719),e3=r(93514),e6=r(39861);let e8=e=>{var t,r,s,l,n,i,o,d,c,x,u,m,h,g,p,b,f,v,y,k,j,N,w,C,S;let{productResearchResponse:T}=e;if(!T||!T.reportJson)return(0,a.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin w-8 h-8 border-4 border-blue-600 border-t-transparent rounded-full mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:"AI is analyzing the product..."}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"This may take a few minutes"})]})});let{reportJson:A}=T,E=A.product_overview||{},L=A.price_analysis||{},M=A.marketplace_comparision||[],R=A.customer_reviews||{},z=A.complaint_analysis||{},_=A.alternative_products||[],O=A.recommendation||{},I=E.key_metrics||{},D=R.overall_satisfaction||{},P=R.feature_ratings||[],B=R.most_appreciated||[],F=R.main_concerns||[],H=e=>"number"==typeof e?new Intl.NumberFormat(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}).format(e):"N/A",U=e=>e.startsWith("http://")||e.startsWith("https://")?e:"https://"+e;return(0,a.jsxs)("div",{className:"overflow-auto bg-gradient-to-br from-gray-50 via-white to-gray-100",children:[(0,a.jsxs)("div",{className:"text-center mb-16 mt-16 ",children:[(0,a.jsx)("h1",{className:"text-6xl font-extralight text-gray-900 mb-6 tracking-tight leading-tight ",children:"Product Research"}),(0,a.jsx)("p",{className:"text-2xl font-ultralight text-gray-600 max-w-3xl mx-auto leading-relaxed",children:"Comprehensive product analysis with intelligent price comparison and customer sentiment insights"})]}),(0,a.jsx)("div",{className:"flex-1 p-6 bg-gradient-to-br from-gray-50 via-white to-gray-100",children:(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-2xl font-semibold text-gray-900 mb-6 tracking-tight",children:"Product Overview"}),(0,a.jsx)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 rounded-2xl border border-blue-200 p-6",children:(0,a.jsxs)("p",{className:"text-lg text-gray-800 leading-relaxed",children:[(0,a.jsx)("span",{className:"font-semibold text-blue-600",children:E.product_name||"Product Name"})," ","by"," ",(0,a.jsx)("span",{className:"font-medium",children:E.brand||"Brand"})," ",E.description&&"- ".concat(E.description),I.overall_rating&&(0,a.jsxs)(a.Fragment,{children:[", rated"," ",(0,a.jsxs)("span",{className:"font-semibold text-green-600",children:[I.overall_rating.score,"/5"]})," ","from"," ",(0,a.jsxs)("span",{className:"font-medium",children:[I.overall_rating.total_reviews," verified reviews"]})," ","across platforms."]})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-3xl font-extralight text-gray-900 mb-8 tracking-tight",children:"Key Metrics"}),(0,a.jsx)("div",{className:"bg-gradient-to-br from-gray-50 to-white rounded-3xl p-10 border border-gray-100/50 shadow-lg",children:(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-8",children:[(0,a.jsxs)("div",{className:"bg-white rounded-3xl p-8 text-center shadow-lg border border-gray-100/50 hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1",children:[(0,a.jsx)("div",{className:"w-16 h-16 md:w-20 md:h-20 bg-gradient-to-br from-yellow-100 to-orange-100 rounded-full flex items-center justify-center mx-auto mb-6",children:(0,a.jsx)("span",{className:"text-2xl md:text-3xl",children:"â"})}),(0,a.jsx)("div",{className:"text-3xl md:text-4xl font-extralight text-gray-900 mb-3",children:(null===(t=I.overall_rating)||void 0===t?void 0:t.score)||"N/A"}),(0,a.jsx)("div",{className:"text-xs md:text-sm font-medium text-gray-600 uppercase tracking-wider mb-3",children:"Overall Rating"}),(0,a.jsxs)("div",{className:"text-xs text-gray-500",children:[(null===(r=I.overall_rating)||void 0===r?void 0:r.total_reviews)||0," reviews"]})]}),(0,a.jsxs)("div",{className:"bg-white rounded-3xl p-8 text-center shadow-lg border border-gray-100/50 hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1 relative group",children:[(0,a.jsx)("div",{className:"w-16 h-16 md:w-20 md:h-20 bg-gradient-to-br from-green-100 to-emerald-100 rounded-full flex items-center justify-center mx-auto mb-6",children:(0,a.jsx)("span",{className:"text-2xl md:text-3xl",children:"\uD83D\uDCB0"})}),(0,a.jsx)("div",{className:"text-3xl md:text-4xl font-extralight text-green-600 mb-3",children:(null===(s=I.best_price)||void 0===s?void 0:s.amount)!=null?"".concat(I.best_price.currency," ").concat(H(null===(l=I.best_price)||void 0===l?void 0:l.amount)):"N/A"}),(0,a.jsx)("div",{className:"text-xs md:text-sm font-medium text-gray-600 uppercase tracking-wider mb-3",children:"Best Price"}),(0,a.jsx)("div",{className:"text-xs text-gray-500 mb-4",children:(null===(n=I.best_price)||void 0===n?void 0:n.platform)||"Platform"}),(null===(i=I.best_price)||void 0===i?void 0:i.amount)&&(0,a.jsxs)("button",{onClick:()=>{var e;return(null===(e=I.best_price)||void 0===e?void 0:e.url)&&window.open(U(I.best_price.url),"_blank")},className:"inline-flex items-center space-x-2 px-4 py-2 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 text-white text-xs font-medium rounded-full transition-all duration-300 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5 group-hover:scale-105",children:[(0,a.jsx)(e3.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"Buy Now"}),(0,a.jsx)(e6.A,{className:"w-3 h-3"})]})]}),(0,a.jsxs)("div",{className:"bg-white rounded-3xl p-8 text-center shadow-lg border border-gray-100/50 hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1",children:[(0,a.jsx)("div",{className:"w-16 h-16 md:w-20 md:h-20 bg-gradient-to-br from-purple-100 to-indigo-100 rounded-full flex items-center justify-center mx-auto mb-6",children:(0,a.jsx)("span",{className:"text-2xl md:text-3xl",children:"\uD83D\uDC4D"})}),(0,a.jsxs)("div",{className:"text-3xl md:text-4xl font-extralight text-purple-600 mb-3",children:[I.recommend_percentage||0,"%"]}),(0,a.jsx)("div",{className:"text-xs md:text-sm font-medium text-gray-600 uppercase tracking-wider mb-3",children:"Recommend"}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:"Customer satisfaction"})]})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-3xl font-extralight text-gray-900 mb-8 tracking-tight",children:"Price Analysis"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4 sm:gap-6 lg:gap-8 mb-8",children:[(0,a.jsxs)("div",{className:"bg-gradient-to-br from-green-50 to-emerald-50 rounded-3xl p-6 sm:p-8 border border-green-100/50 text-center hover:shadow-lg transition-all duration-300 transform hover:-translate-y-1 group cursor-pointer",children:[(0,a.jsx)("div",{className:"text-2xl sm:text-3xl font-extralight text-green-600 mb-2",children:(null===(o=L.lowest_price)||void 0===o?void 0:o.amount)?"".concat(L.lowest_price.currency," ").concat(H(null===(d=L.lowest_price)||void 0===d?void 0:d.amount)):"N/A"}),(0,a.jsx)("div",{className:"text-xs sm:text-sm font-medium text-green-700 mb-2 sm:mb-3",children:"Lowest Price"}),(0,a.jsxs)("div",{className:"text-xs text-gray-600 leading-tight mb-4",children:[(null===(c=L.lowest_price)||void 0===c?void 0:c.platform)||"Platform",(null===(x=L.lowest_price)||void 0===x?void 0:x.coupon)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("br",{className:"hidden sm:block"}),(0,a.jsx)("span",{className:"sm:hidden",children:" ⢠"}),L.lowest_price.coupon]})]})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-blue-50 to-indigo-50 rounded-3xl p-6 sm:p-8 border border-blue-100/50 text-center hover:shadow-lg transition-all duration-300 transform hover:-translate-y-1",children:[(0,a.jsx)("div",{className:"text-2xl sm:text-3xl font-extralight text-blue-600 mb-2",children:(null===(u=L.average_price)||void 0===u?void 0:u.amount)?"".concat(L.average_price.currency," ").concat(H(null===(m=L.average_price)||void 0===m?void 0:m.amount)):"N/A"}),(0,a.jsx)("div",{className:"text-xs sm:text-sm font-medium text-blue-700 mb-2 sm:mb-3",children:"Average Price"}),(0,a.jsx)("div",{className:"text-xs text-gray-600 leading-tight",children:(null===(h=L.average_price)||void 0===h?void 0:h.platforms_info)||"Multiple platforms"})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-gray-50 to-slate-50 rounded-3xl p-6 sm:p-8 border border-gray-200/50 text-center hover:shadow-lg transition-all duration-300 transform hover:-translate-y-1",children:[(0,a.jsx)("div",{className:"text-2xl sm:text-3xl font-extralight text-gray-900 mb-2",children:L.price_trend||"N/A"}),(0,a.jsx)("div",{className:"text-xs sm:text-sm font-medium text-gray-700 mb-2 sm:mb-3",children:"Price Trend"}),(0,a.jsx)("div",{className:"text-xs text-gray-600 leading-tight",children:L.trend_description||"No trend data"})]})]}),M.length>0&&(0,a.jsxs)("div",{className:"bg-white/90 backdrop-blur-xl rounded-3xl border border-gray-200/50 overflow-hidden shadow-xl",children:[(0,a.jsx)("div",{className:"px-8 py-6 border-b border-gray-100/50 bg-gradient-to-r from-gray-50 to-white",children:(0,a.jsx)("h5",{className:"text-xl font-medium text-gray-900",children:"Marketplace Comparison"})}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{className:"bg-gradient-to-r from-gray-50 to-gray-100",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-8 py-5 text-left text-sm font-medium text-gray-900",children:"Platform"}),(0,a.jsx)("th",{className:"px-8 py-5 text-center text-sm font-medium text-gray-900",children:"Current Price"}),(0,a.jsx)("th",{className:"px-8 py-5 text-center text-sm font-medium text-gray-900",children:"Special Offers"}),(0,a.jsx)("th",{className:"px-8 py-5 text-center text-sm font-medium text-gray-900",children:"Shipping"}),(0,a.jsx)("th",{className:"px-8 py-5 text-center text-sm font-medium text-gray-900",children:"Warranty"}),(0,a.jsx)("th",{className:"px-8 py-5 text-center text-sm font-medium text-gray-900",children:"Overall Score"}),(0,a.jsx)("th",{className:"px-8 py-5 text-center text-sm font-medium text-gray-900",children:"Action"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-gray-100/50",children:M.map((e,t)=>{var r,s,l;return(0,a.jsxs)("tr",{className:"hover:bg-gray-50/50 transition-all duration-300",children:[(0,a.jsx)("td",{className:"px-8 py-6",children:(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)("div",{className:"w-12 h-12 bg-gradient-to-br from-blue-500 to-blue-600 rounded-2xl flex items-center justify-center text-white text-sm font-bold shadow-lg",children:e.platform.charAt(0).toUpperCase()}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-semibold text-gray-900",children:e.platform}),0===t&&(0,a.jsx)("div",{className:"text-xs text-gray-500",children:"Best overall value"})]})]})}),(0,a.jsx)("td",{className:"px-8 py-6 text-center",children:(0,a.jsxs)("span",{className:"text-2xl font-extralight text-gray-900",children:[null===(r=e.current_price)||void 0===r?void 0:r.currency," ",H(null===(s=e.current_price)||void 0===s?void 0:s.amount)]})}),(0,a.jsx)("td",{className:"px-8 py-6 text-center",children:e.special_offers?(0,a.jsx)("span",{className:"inline-flex items-center px-4 py-2 rounded-full text-xs font-medium bg-green-100 text-green-700",children:e.special_offers}):(0,a.jsx)("span",{className:"text-gray-400 font-medium",children:"No discounts"})}),(0,a.jsx)("td",{className:"px-8 py-6 text-center text-gray-600 font-medium",children:e.shipping}),(0,a.jsx)("td",{className:"px-8 py-6 text-center text-gray-600 font-medium",children:e.warranty}),(0,a.jsxs)("td",{className:"px-8 py-6 text-center",children:[(0,a.jsx)("span",{className:"text-2xl font-extralight text-green-600",children:e.overall_score}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:"/5"})]}),(0,a.jsx)("td",{className:"px-8 py-6 text-center",children:(0,a.jsxs)("button",{onClick:()=>{var t;return(null===(t=e.action)||void 0===t?void 0:t.url)&&window.open(U(e.action.url),"_blank")},className:"inline-flex items-center space-x-2 px-6 py-3 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 text-white text-sm font-medium rounded-full transition-all duration-300 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5",children:[(0,a.jsx)(e3.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:(null===(l=e.action)||void 0===l?void 0:l.button_text)||"Buy"}),(0,a.jsx)(e6.A,{className:"w-4 h-4"})]})})]},t)})})]})})]})]}),Object.keys(D).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-3xl font-extralight text-gray-900 mb-4 tracking-tight",children:"Customer Reviews"}),R.scientific_reviewAnalysis&&(0,a.jsx)("div",{className:"bg-blue-50 rounded-2xl border border-blue-100 p-6 mb-8",children:(0,a.jsxs)("div",{className:"flex items-start space-x-4",children:[(0,a.jsx)("div",{className:"w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)("span",{className:"text-2xl",children:"\uD83D\uDD2C"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h5",{className:"text-lg font-semibold text-blue-900 mb-2",children:"Scientific Review Analysis"}),(0,a.jsxs)("p",{className:"text-sm text-blue-800 leading-relaxed",children:[R.scientific_reviewAnalysis.methodology,R.scientific_reviewAnalysis.total_verified_reviews&&" Based on ".concat(R.scientific_eview_anal
1ysis.total_verified_reviews," verified reviews.")]})]})]})}),(0,a.jsxs)("div",{className:"bg-white rounded-2xl border border-gray-200 p-6 mb-6",children:[(0,a.jsx)("h5",{className:"text-lg font-semibold text-gray-900 mb-6",children:"Overall Satisfaction"}),(0,a.jsx)("div",{className:"space-y-4",children:["five_stars","four_stars","three_stars","two_stars","one_star"].map((e,t)=>{let r=5-t,s=D[e];return s?(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsxs)("span",{className:"w-8 text-sm font-medium text-gray-600",children:[r,"â
"]}),(0,a.jsx)("div",{className:"flex-1 bg-gray-100 rounded-full h-3 mx-4",children:(0,a.jsx)("div",{className:"h-3 rounded-full transition-all duration-1000 ".concat(r>=4?"bg-green-500":3===r?"bg-yellow-400":2===r?"bg-orange-400":"bg-red-500"),style:{width:"".concat(s.percentage,"%")}})}),(0,a.jsxs)("span",{className:"w-24 text-right text-sm font-semibold text-gray-900",children:[s.percentage,"% (",s.count,")"]})]},e):null})})]}),P.length>0&&(0,a.jsxs)("div",{className:"bg-white rounded-2xl border border-gray-200 p-6 mb-6",children:[(0,a.jsx)("h5",{className:"text-lg font-semibold text-gray-900 mb-6",children:"Feature Ratings"}),(0,a.jsx)("div",{className:"grid md:grid-cols-2 gap-6",children:P.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,a.jsx)("span",{className:"text-gray-700 font-medium",children:e.feature}),(0,a.jsxs)("span",{className:"font-bold text-green-600",children:[e.score,"%"]})]}),(0,a.jsx)("div",{className:"bg-gray-100 rounded-full h-2",children:(0,a.jsx)("div",{className:"bg-green-500 h-2 rounded-full transition-all duration-1000",style:{width:"".concat(e.score,"%")}})})]},t))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 lg:gap-6",children:[B.length>0&&(0,a.jsxs)("div",{className:"bg-green-50 rounded-2xl border border-green-100 p-4 sm:p-6",children:[(0,a.jsx)("h6",{className:"text-base sm:text-lg font-semibold text-green-800 mb-3 sm:mb-4",children:"Most Appreciated"}),(0,a.jsx)("div",{className:"space-y-2 sm:space-y-3",children:B.map((e,t)=>(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-sm sm:text-base text-green-700",children:e.aspect}),(0,a.jsxs)("span",{className:"text-green-600 font-semibold text-sm sm:text-base",children:[e.score,"%"]})]},t))})]}),F.length>0&&(0,a.jsxs)("div",{className:"bg-red-50 rounded-2xl border border-red-100 p-4 sm:p-6",children:[(0,a.jsx)("h6",{className:"text-base sm:text-lg font-semibold text-red-800 mb-3 sm:mb-4",children:"Main Concerns"}),(0,a.jsx)("div",{className:"space-y-2 sm:space-y-3",children:F.map((e,t)=>(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-sm sm:text-base text-red-700",children:e.concern}),(0,a.jsxs)("span",{className:"text-red-600 font-semibold text-sm sm:text-base",children:[e.score,"%"]})]},t))})]})]})]}),Object.keys(z).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-3xl font-extralight text-gray-900 mb-4 tracking-tight",children:"Complaint Analysis"}),z.methodological_assessment&&(0,a.jsx)("div",{className:"bg-red-50 rounded-2xl border border-red-100 p-6 mb-8",children:(0,a.jsxs)("div",{className:"flex items-start space-x-4",children:[(0,a.jsx)("div",{className:"w-12 h-12 bg-red-100 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsx)("span",{className:"text-2xl",children:"\uD83D\uDCCA"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h5",{className:"text-lg font-semibold text-red-900 mb-2",children:"Methodological Complaint Assessment"}),(0,a.jsx)("p",{className:"text-sm text-red-800 leading-relaxed",children:z.methodological_assessment})]})]})}),(0,a.jsxs)("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[(0,a.jsxs)("div",{className:"bg-red-50 rounded-2xl p-4 border border-red-100 text-center",children:[(0,a.jsx)("div",{className:"text-2xl font-bold text-red-600 mb-1",children:z.total_complaints||0}),(0,a.jsx)("div",{className:"text-xs font-medium text-red-700 uppercase tracking-wide",children:"Total Complaints"}),(0,a.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:z.data_source||"Various sources"})]}),(0,a.jsxs)("div",{className:"bg-yellow-50 rounded-2xl p-4 border border-yellow-100 text-center",children:[(0,a.jsx)("div",{className:"text-2xl font-bold text-yellow-600 mb-1",children:z.per_1000_sales||0}),(0,a.jsx)("div",{className:"text-xs font-medium text-yellow-700 uppercase tracking-wide",children:"Per 1000 Sales"}),(0,a.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:"Complaint rate"})]}),(0,a.jsxs)("div",{className:"bg-green-50 rounded-2xl p-4 border border-green-100 text-center",children:[(0,a.jsxs)("div",{className:"text-2xl font-bold text-green-600 mb-1",children:[z.resolved_percentage||0,"%"]}),(0,a.jsx)("div",{className:"text-xs font-medium text-green-700 uppercase tracking-wide",children:"Resolved"}),(0,a.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:"Success rate"})]}),(0,a.jsxs)("div",{className:"bg-blue-50 rounded-2xl p-4 border border-blue-100 text-center",children:[(0,a.jsx)("div",{className:"text-2xl font-bold text-blue-600 mb-1",children:z.avg_response_time_days||0}),(0,a.jsx)("div",{className:"text-xs font-medium text-blue-700 uppercase tracking-wide",children:"Days"}),(0,a.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:"Avg response time"})]})]}),z.overall_risk_level&&(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4 lg:gap-6",children:[(0,a.jsxs)("div",{className:"bg-white rounded-2xl border border-gray-200 p-6",children:[(0,a.jsx)("h6",{className:"text-lg font-semibold text-gray-800 mb
1-4",children:"Risk Assessment"}),(0,a.jsxs)("div",{className:"p-3 rounded-xl ".concat("LOW"===z.overall_risk_level?"bg-green-100":"MEDIUM"===z.overall_risk_level?"bg-yellow-100":"bg-red-100"),children:[(0,a.jsx)("div",{className:"text-xs font-medium text-gray-800 mb-1",children:"Overall Risk Level"}),(0,a.jsxs)("div",{className:"text-sm font-bold ".concat("LOW"===z.overall_risk_level?"text-green-700":"MEDIUM"===z.overall_risk_level?"text-yellow-700":"text-red-700"),children:[z.overall_risk_level," RISK"]}),(0,a.jsx)("div",{className:"text-xs text-gray-600",children:z.risk_assessment})]})]}),z.most_common_issues&&(0,a.jsxs)("div",{className:"bg-red-50 rounded-2xl border border-red-100 p-6",children:[(0,a.jsx)("h6",{className:"text-lg font-semibold text-red-800 mb-4",children:"Most Common Issues"}),(0,a.jsx)("div",{className:"space-y-3",children:z.most_common_issues.map((e,t)=>(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-sm text-red-700",children:e.issue}),(0,a.jsx)("span",{className:"text-red-600 font-semibold text-sm",children:e.count})]},t))})]})]})]}),_.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-3xl font-extralight text-gray-900 mb-8 tracking-tight",children:"Alternative Products"}),(0,a.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:_.map((e,t)=>{var r,s,l,n,i;return(0,a.jsxs)("div",{className:"bg-white/90 backdrop-blur-xl rounded-3xl border border-gray-200/50 p-8 shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-1 group",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-6",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h6",{className:"text-xl font-medium text-gray-900 mb-3",children:e.product_name}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-4 leading-relaxed",children:e.key_features}),(0,a.jsxs)("div",{className:"flex items-center space-x-4 text-sm text-gray-500 mb-6",children:[(0,a.jsxs)("span",{className:"flex items-center space-x-1",children:[(0,a.jsx)("span",{className:"text-yellow-400",children:"â
"}),(0,a.jsxs)("span",{children:[null===(r=e.rating)||void 0===r?void 0:r.score,"/5"]})]}),(0,a.jsx)("span",{children:"â¢"}),(0,a.jsxs)("span",{children:[null===(s=e.rating)||void 0===s?void 0:s.total_reviews," reviews"]})]})]}),(0,a.jsxs)("div",{className:"text-right ml-6",children:[(0,a.jsxs)("div",{className:"text-3xl font-extralight text-gray-900",children:[null===(l=e.price)||void 0===l?void 0:l.currency," ",H(null===(n=e.price)||void 0===n?void 0:n.amount)]}),(null===(i=e.price)||void 0===i?void 0:i.savings)&&(0,a.jsxs)("div",{className:"text-sm text-green-600 font-medium",children:[" ",e.price.savings]})]})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[e.badge&&(0,a.jsx)("div",{className:"inline-flex items-center px-4 py-2 rounded-full text-xs font-medium ".concat("Premium Alternative"===e.badge?"bg-blue-100 text-blue-700":"Value Option"===e.badge?"bg-green-100 text-green-700":"bg-gray-100 text-gray-700"),children:e.badge}),(0,a.jsxs)("button",{onClick:()=>e.url&&window.open(e.url,"_blank"),className:"inline-flex items-center space-x-2 px-6 py-3 text-white text-sm font-medium rounded-full transition-all duration-300 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5 ".concat("Premium Alternative"===e.badge?"bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700":"Value Option"===e.badge?"bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-700 hover:to-emerald-700":"bg-gradient-to-r from-gray-600 to-gray-700 hover:from-gray-700 hover:to-gray-800"),children:[(0,a.jsx)(e3.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"View"}),(0,a.jsx)(e6.A,{className:"w-4 h-4"})]})]})]},t)})})]}),Object.keys(O).length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-3xl font-extralight text-gray-900 mb-8 tracking-tight",children:"Recommendation"}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-blue-50 via-indigo-50 to-purple-50 rounded-3xl border border-blue-200/50 p-12 shadow-xl",children:[(0,a.jsxs)("div",{className:"text-center mb-10",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-gradient-to-br from-green-100 to-emerald-100 rounded-full mb-6 shadow-lg",children:(0,a.jsx)("svg",{className:"w-10 h-10 text-green-600",fill:"currentColor",viewBox:"0 0 20 20",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}),(0,a.jsx)("h5",{className:"text-3xl font-extralight text-gray-900 mb-4",children:(null===(g=O.recommendation_extra)||void 0===g?void 0:g.verdict)||"Product Analysis Complete"}),(0,a.jsx)("p",{className:"text-gray-600 max-w-3xl mx-auto leading-relaxed text-lg",children:(null===(p=O.recommendation_extra)||void 0===p?void 0:p.summary)||"Based on our comprehensive analysis, here are the key recommendations."})]}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-6 lg:gap-8 mb-8",children:[(0,a.jsxs)("div",{className:"bg-white/90 backdrop-blur-xl rounded-3xl p-6 lg:p-8 text-center shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1",children:[(0,a.jsx)("div",{className:"text-xs lg:text-sm font-medium text-gray-500 uppercase tracking-wider mb-3",children:"Best Time to Buy"}),(0,a.jsx)("div",{className:"text-xl lg:text-2xl font-extralight text-gray-900 mb-2",children:(null===(b=O.best_time_to_buy)||void 0===b?void 0:b.timing)||"Now"}),(0,a.jsx)("div",{className:"text-xs text-gray-600",children:(null===(f=O.best_time_to_buy)||void 0===f?void 0:f.reason)||"Good time to purchase"})]}),(0,a.jsxs)("div",{className:"bg-white/90 backdrop-blur-xl rounded-3xl p-6 lg:p-8 text-center shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1 group cursor-pointer",children:[(0,a.jsx)("div",{className:"text-xs lg:text-sm font-medium text-gray-500 uppercase tracking-wider mb-3",children:"Best Store"}),(0,a.jsx)("div",{className:"text-xl lg:text-2xl font-extralight text-gray-900 mb-2",children:(null===(v=O.best_store)||void 0===v?void 0:v.platform)||"Multiple Options"}),(0,a.jsx)("div",{className:"text-xs text-gray-600 mb-4",children:(null===(y=O.best_store)||void 0===y?void 0:y.price_info)||"Compare prices"}),(null===(k=O.buy_button)||void 0===k?void 0:k.url)&&(0,a.jsx)("div",{className:"mt-auto flex justify-center",children:(0,a.jsxs)("button",{onClick:()=>window.open(O.buy_button.url,"_blank"),className:"inline-flex items-center space-x-2 px-4 py-2 bg-gradient-to-r from-green-600 to-green-700 text-white text-xs font-medium rounded-full",children:[(0,a.jsx)(e3.A,{className:"w-5 h-5"}),(0,a.jsx)("span",{children:"Buy Now"}),(0,a.jsx)(e6.A,{className:"w-5 h-5"})]})})]}),(0,a.jsxs)("div",{className:"bg-white/90 backdrop-blur-xl rounded-3xl p-6 lg:p-8 text-center shadow-lg hover:shadow-xl transition-all duration-300 transform hover:-translate-y-1",children:[(0,a.jsx)("div",{className:"text-xs lg:text-sm font-medium text-gray-500 uppercase tracking-wider mb-3",children:"Risk Level"}),(0,a.jsx)("div",{className:"text-xl lg:text-2xl font-extralight mb-2 ".concat((null===(j=O.risk_level)||void 0===j?void 0:j.level)==="Low"?"text-green-600":(null===(N=O.risk_level)||void 0===N?void 0:N.level)==="Medium"?"text-yellow-600":"text-red-600"),children:(null===(w=O.risk_level)||void 0===w?void 0:w.level)||"Low"}),(0,a.jsx)("div",{className:"text-xs text-gray-600",children:(null===(C=O.risk_level)||void 0===C?void 0:C.description)||"Good product quality"})]})]}),(0,a.jsxs)("div",{className:"bg-white/90 backdrop-blur-xl rounded-3xl p-8 border-l-4 border-blue-500 shadow-lg",children:[(0,a.jsx)("h6",{className:"text-xl font-medium text-gray-900 mb-3",children:"Bottom Line"}),(0,a.jsx)("p",{className:"text-gray-700 leading-relaxed mb-6",children:O.bottom_line||"This product offers good value based on our comprehensive analysis of pricing, reviews, and market comparison."}),(null===(S=O.buy_button)||void 0===S?void 0:S.url)&&(0,a.jsx)("div",{className:"flex justify-center",children:(0,a.jsxs)("button",{onClick:()=>window.open(O.buy_button.url,"_blank"),className:"inline-flex items-center space-x-3 px-8 py-4 bg-gradient-to-r from-green-600 to-green-700 hover:from-green-700 hover:to-green-800 text-white font-medium rounded-2xl transition-all duration-300 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5",children:[(0,a.jsx)(e3.A,{className:"w-5 h-5"}),(0,a.jsx)("span",{children:O.buy_button.text||"Buy at Best Price"}),(0,a.jsx)(e6.A,{className:"w-5 h-5"})]})})]})]})]})]})})]})},e7=()=>(0,a.jsx)(ep(),{id:"3258e1bd9199d0cb",children:":root{--safe-area-inset-top:env(safe-area-inset-top);--safe-area-inset-right:env(safe-area-inset-right);--safe-area-inset-bottom:env(safe-area-inset-bottom);--safe-area-inset-left:env(safe-area-inset-left)}@media(hover:none)and (pointer:coarse){button,input,select,textarea{min-height:44px}}html{-webkit-overflow-scrolling:touch}@media screen and (max-width:768px){input,select,textarea{font-size:16px}}"}),e9=e=>{let{toast:t,showToast:r,setToggleSidebar:l,initialData:i,initialResponse:o,recordId:d}=e,c=(0,y.d4)(e=>
1e.user),[m,h]=(0,s.useState)(!1),[g,p]=(0,s.useState)(!1),[b,f]=(0,s.useState)(""),[v,k]=(0,s.useState)(!1),[j,w]=(0,s.useState)([{id:"productUrl",name:"Product URL",placeholder:"Enter the URL here.",value:""},{id:"yourPriorities",name:"Your Priorities",placeholder:"Enter your priorities here.",value:""},{id:"considerAlternatives",name:"Consider Alternatives",placeholder:"Enter your alternatives with comma between them.",value:""},{id:"marketplacesToCheck",name:"Marketplaces to Check",placeholder:"Enter your marketplaces here with comma between them.",value:""},{id:"complaintConcerns",name:"Complaint Concerns",placeholder:"Enter your complaint concerns here.",value:""}]),[C,S]=(0,s.useState)("ai-selection"),[T,A]=(0,s.useState)([]),E=T.length,[L,M]=(0,s.useState)("all"),[R,z]=(0,s.useState)([]),[_,O]=(0,s.useState)("shared-with-me"),[I,D]=(0,s.useState)(null),[P,B]=(0,s.useState)(!1);(0,s.useEffect)(()=>{var e,t,r,a,s,l,n,d,c;if(o){let e={...o,reportJson:null!==(s=null!==(a=o.reportJson)&&void 0!==a?a:o.report_json)&&void 0!==s?s:null};D(e),e.success&&e.reportJson?(h(!0),B(!1),S("results")):S("prompt-editor")}else i&&S("prompt-editor");if(!i)return;let x=null!==(l=i.url)&&void 0!==l?l:null===(e=i.urls)||void 0===e?void 0:e[0];x&&w(e=>e.map(e=>"productUrl"===e.id?{...e,value:x}:e)),i.priorities&&w(e=>e.map(e=>"yourPriorities"===e.id?{...e,value:i.priorities}:e)),(null===(t=i.alternatives)||void 0===t?void 0:t.length)&&w(e=>e.map(e=>"considerAlternatives"===e.id?{...e,value:i.alternatives.join(",")}:e)),(null===(r=i.marketplaces)||void 0===r?void 0:r.length)&&w(e=>e.map(e=>"marketplacesToCheck"===e.id?{...e,value:i.marketplaces.join(",")}:e)),i.concerns&&w(e=>e.map(e=>"complaintConcerns"===e.id?{...e,value:i.concerns}:e));let u=null!==(n=i.aiId)&&void 0!==n?n:i.model;if(u&&A([u]),o){let e={...o,reportJson:null!==(c=null!==(d=o.reportJson)&&void 0!==d?d:o.report_json)&&void 0!==c?c:null};D(e),e.success&&e.reportJson?(h(!0),B(!1),S("results")):S("prompt-editor")}else S("prompt-editor")},[i,o]);let F=async()=>{if("ai-selection"===C){S("prompt-editor"),h(!1);return}if("results"===C){h(!1),S("prompt-editor");return}if("prompt-editor"===C){p(!0),h(!1),B(!0),l(!1);try{var e,t,a,s,n;let i=(null===(e=j.find(e=>"productUrl"===e.id))||void 0===e?void 0:e.value)||"",o=(null===(t=j.find(e=>"yourPriorities"===e.id))||void 0===t?void 0:t.value)||"",d=(null===(a=j.find(e=>"considerAlternatives"===e.id))||void 0===a?void 0:a.value)||"",x=(null===(s=j.find(e=>"marketplacesToCheck"===e.id))||void 0===s?void 0:s.value)||"",u=(null===(n=j.find(e=>"complaintConcerns"===e.id))||void 0===n?void 0:n.value)||"",m=x.split(",").map(e=>e.trim()).filter(e=>e),g=d.split(",").map(e=>e.trim()).filter(e=>e),p=T[0],f=await eN({aiId:p,url:i,marketplaces:m,alternatives:g,priorities:o,concerns:u,language:"tr",userPrompt:b},null==c?void 0:c.token);D(f),f.success&&f.reportJson?(N.emit(),h(!0),S("results"),l(!1),r("Product research completed successfully!","success")):(r("Product research failed","error"),B(!1))}catch(e){r("Failed to generate product research","error"),B(!1),console.log(e)}finally{p(!1)}}},H=()=>{let e=[{id:"gpt-5.1",name:"GPT-5.1",provider:"OPENAI",description:"High reasoning, complex problem-solving",category:"standard"}],t=(()=>{switch(L){case"standard":return e.filter(e=>"standard"===e.category);case"starred":return e.filter(e=>R.includes(e.id));case"trained":return e.filter(e=>"trained"===e.category);case"shared":return e.filter(e=>e.category===_);default:return e}})(),r=e=>{A(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,a.jsx)("div",{className:"flex-1 overflow-auto min-h-0",children:(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,a.jsx)("div",{className:"sticky top-0 bg-gray-50 z-10 p-8 pb-6",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h3",{className:"text-2xl font-semibold text-gray-900 mb-3",children:"Choose Your AI Models"}),(0,a.jsx)("div",{className:"flex justify-center mb-4",children:(0,a.jsxs)("div",{className:"flex border-b border-gray-200 bg-white rounded-lg p-1 shadow-sm",children:[(0,a.jsx)("button",{onClick:()=>M("all"),className:"px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ".concat("all"===L?"bg-blue-100 text-blue-700 shadow-sm":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:"All"}),(0,a.jsx)("button",{onClick:()=>M("standard"),className:"px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ".concat("standard"===L?"bg-blue-100 text-blue-700 shadow-sm":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:"Standard"}),(0,a.jsx)("button",{onClick:()=>M("starred"),className:"px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ".concat("starred"===L?"bg-blue-100 text-blue-700 shadow-sm":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:"Starred"}),(0,a.jsx)("button",{onClick:()=>M("trained"),className:"px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ".concat("trained"===L?"bg-blue-100 text-blue-700 shadow-sm":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:"Trained"}),(0,a.jsx)("button",{onClick:()=>M("shared"),className:"px-4 py-2 text-sm font-medium rounded-md transition-all duration-200 ".concat("shared"===L?"bg-blue-100 text-blue-700 shadow-sm":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),children:"Shared"})]})}),"shared"===L&&(0,a.jsx)("div",{className:"flex justify-center mb-4",children:(0,a.jsxs)("div",{className:"flex bg-gray-100 rounded-lg p-1",children:[(0,a.jsx)("button",{onClick:()=>O("shared-with-me"),className:"px-3 py-1.5 text-sm font-medium rounded-md transition-all duration-200 ".concat("shared-with-me"===_?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"),children:"Shared with me"}),(0,a.jsx)("button",{onClick:()=>O("shared-by-me"),className:"px-3 py-1.5 text-sm font-medium rounded-md transition-all duration-200 ".concat("shared-by-me"===_?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"),children:"Shared by me"})]})})]})}),(0,a.jsx)("div",{className:"px-8 pb-8",children:0===t.length?(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 rounded-full flex items-center justify-center",children:"starred"===L?(0,a.jsx)(x.A,{className:"w-8 h-8 text-gray-400"}):(0,a.jsxs)("svg",{className:"w-8 h-8 text-gray-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,a.jsx)("path",{d:"M16 16s-1.5-2-4-2-4 2-4 2"}),(0,a.jsx)("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),(0,a.jsx)("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})}),(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"starred"===L?"No starred models":"trained"===L?"No trained models":"shared"===L&&"shared-with-me"===_?"No models shared with you":"shared"===L&&"shared-by-me"===_?"No models shared by you":"No models available"}),(0,a.jsx)("p",{className:"text-gray-500",children:"starred"===L?"Star some models to see them here":"trained"===L?"Create or import fine-tuned models":"shared"===L&&"shared-with-me"===_?"No team members have shared models with you yet":"shared"===L&&"shared-by-me"===_?"Share your custom models with team members":"Try switching to a different tab"})]}):(0,a.jsx)("div",{className:"grid gap-2 mt-6",children:t.map(e=>{var t;let s=T.includes(e.id);return(0,a.jsxs)("div",{className:"group relative bg-white rounded-xl border transition-all duration-300 cursor-pointer hover:shadow-md hover:-translate-y-0.5 ".concat(s?"border-blue-500 shadow-md ring-1 ring-blue-500 ring-opacity-20":"border-gray-200 hover:border-gray-300"),onClick:()=>r(e.id),children:[(0,a.jsx)("div",{className:"p-5",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3 flex-1",children:[(0,a.jsx)("div",{className:"w-8 h-8 flex items-center justify-center text-white text-sm font-semibold",children:(0,a.jsx)("img",{src:null===(t=(0,e4.tL)(e.provider))||void 0===t?void 0:t.src,alt:"nivea",className:"w-20 h-20 flex-shrink-0"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,a.jsx)("h4",{className:"text-base font-semibold text-gray-900",children:e.name}),"trained"===e.category&&(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-700 text-xs font-medium rounded-full",children:"Trained"}),"shared-with-me"===e.category&&(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-700 text-xs font-medium rounded-full",children:"Shared"}),"shared-by-me"===e.category&&(0,a.jsx)("span",{className:"px-2 py-0.5 bg-purple-100 text-purple-700 text-xs font-medium rounded-full",children:"My Share"})]}),(0,a.jsx)("p",{className:"text-gray-600 text-sm leading-relaxed mb-1",children:e.description})]})]}),(0,a.jsx)("div",{className:"flex-shrink-0 ml-3",children:(0,a.jsx)("div",{className:"w-5 h-5 rounded-full border-2 transition-all duration-200 flex items-center justify-center ".concat(s?"border-blue-500 bg-blue-500 scale-105":"border-gray-300 group-hover:border-gray-400"),children:s&&(0,a.jsx)("svg",{className:"w-3 h-3 text-white",f
1ill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})})})})]})}),s&&(0,a.jsx)("div",{className:"absolute inset-0 rounded-xl pointer-events-none opacity-5",style:{backgroundColor:e.color}})]},e.id)})})})]})})},U=()=>I?(0,a.jsx)(e8,{productResearchResponse:I}):(0,a.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin w-8 h-8 border-4 border-blue-600 border-t-transparent rounded-full mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:"AI is analyzing the product..."}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"This may take a few minutes"})]})}),G=()=>(0,a.jsx)("div",{className:"flex-1 p-8 overflow-auto",children:(0,a.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,a.jsxs)("div",{className:"mb-8 bg-white rounded-xl border border-gray-200 shadow-sm p-8",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700",children:"Template Variables"})}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:"Use square brackets to define variables in your prompt."}),(0,a.jsx)("div",{className:"space-y-2",children:j.map(e=>(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"w-36 pr-3",children:(0,a.jsx)("input",{disabled:!0,type:"text",value:e.name,onChange:t=>{w(j.map(r=>r.id===e.id?{...r,name:t.target.value}:r))},onKeyDown:e=>{"Enter"===e.key&&e.target.blur()},onBlur:t=>{let r=t.target.value,a=e.id,s=r.toLowerCase().replace(/\s+/g,"").replace(/[^a-z0-9]/g,"");if(a!==s&&""!==s){let e=RegExp("\\[".concat(a,"\\]"),"g");f(b.replace(e,"[".concat(s,"]"))),w(j.map(e=>e.id===a?{...e,id:s}:e))}},className:"w-full py-2 px-3 border border-gray-300 rounded-lg text-sm font-medium focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200"})}),(0,a.jsx)("input",{type:"text",className:"flex-1 py-2 px-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200",placeholder:e.placeholder,value:e.value,onChange:t=>{w(j.map(r=>r.id===e.id?{...r,value:t.target.value}:r))}})]},e.id))})]}),(0,a.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm",children:[(0,a.jsx)("div",{className:"border-b px-4 py-3 flex justify-between items-start",children:(0,a.jsx)("div",{children:(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 mb-1",children:"Prompt"})})}),(0,a.jsx)("div",{className:"relative",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("textarea",{value:b,onChange:e=>{f(e.target.value)},className:"w-full p-4 resize-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 border-0 font-mono transition-all duration-200 bg-white text-gray-900",placeholder:"Enter your prompt here...",style:{lineHeight:"1.5",fontSize:"14px",height:"calc(100vh - 600px)",minHeight:"200px",maxHeight:"600px"}}),(0,a.jsx)("div",{className:"absolute top-0 left-0 p-4 pointer-events-none w-full h-96 overflow-hidden",style:{lineHeight:"1.5",fontSize:"14px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:(0,a.jsx)("div",{className:"relative",children:b&&[...b.matchAll(/\[([^\]]+)\]/g)].map((e,t)=>{let r=e.index,s=b.substring(0,r).split("\n"),l=s.length-1,n=s[s.length-1].length;return(0,a.jsx)("div",{className:"absolute bg-red-100 border border-red-200 rounded",style:{to
1p:"".concat(21*l,"px"),left:"".concat(8.4*n,"px"),width:"".concat(8.4*e[0].length,"px"),height:"21px",opacity:.3,zIndex:1}},t)})})})]})})]})]})});return(0,a.jsxs)("div",{className:"flex flex-col h-full bg-gray-25",style:{fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif'},children:[(0,a.jsx)(e7,{}),(0,a.jsx)(e=>{let{currentStep:t,isGenerating:r,hasFreshResults:s}=e;return(0,a.jsxs)("div",{className:"border-b border-gray-200 px-8 pt-8 pb-6 bg-white",children:[(0,a.jsx)("div",{className:"flex items-start mb-1",children:(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)("div",{className:"flex items-start justify-between max-w-3xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center cursor-pointer",onClick:()=>{S("ai-selection"),B(!1)},children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full ".concat(1===t?"bg-blue-500 text-white":t>1?"bg-green-500 text-white":"bg-gray-200 text-gray-500"," font-medium z-10 mb-1"),children:"1"}),(0,a.jsx)("div",{className:"text-sm font-medium ".concat(1===t?"text-blue-500":t>1?"text-green-600":"text-gray-500"),children:"AI Model Selection"})]}),(0,a.jsx)("div",{className:"w-24 h-0.5 ".concat(t>=2?"bg-blue-200":"bg-gray-200"," mt-4")}),(0,a.jsxs)("div",{className:"flex flex-col items-center cursor-pointer",onClick:()=>{S("prompt-editor"),B(!1)},children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full ".concat(2===t?"bg-blue-500 text-white":t>2?"bg-green-500 text-white":"bg-gray-200 text-gray-500"," font-medium z-10 mb-1"),children:"2"}),(0,a.jsx)("div",{className:"text-sm font-medium ".concat(2===t?"text-blue-500":t>2?"text-green-600":"text-gray-500"),children:"Prompt Creation"})]}),(0,a.jsx)("div",{className:"w-24 h-0.5 ".concat(t>=3?"bg-blue-200":"bg-gray-200"," mt-4")}),(0,a.jsxs)("div",{className:"flex flex-col items-center ".concat(s&&!r?"cursor-pointer":"cursor-not-allowed opacity-50"),onClick:()=>{s&&!r&&(S("results"),B(!0))},children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full ".concat(3===t?"bg-blue-500 text-white":t>3?"bg-green-500 text-white":"bg-gray-200 text-gray-500"," font-medium z-10 mb-1"),children:"3"}),(0,a.jsx)("div",{className:"text-sm font-medium ".concat(3===t?"text-blue-500":t>3?"text-green-600":"text-gray-500"),children:"Results"})]})]})})}),(0,a.jsx)("div",{className:"text-sm text-blue-500 mt-1 text-center",children:1===t?"Select at least 1 AI model to continue":2===t?"Create your prompt and generate results":"Review and download your results"})]})},{currentStep:"ai-selection"===C?1:"prompt-editor"===C?2:3,isGenerating:g,hasFreshResults:m}),(0,a.jsx)("div",{className:"border-b border-gray-200 px-8 py-6 bg-white",children:(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold",children:"ai-selection"===C?"AI Model Selection":"prompt-editor"===C?"Prompt Creation":"Results"}),"results"===C&&d&&(0,a.jsxs)(u.$n,{onClick:()=>k(!0),variant:"outline",size:"sm",className:"flex items-center",children:[(0,a.jsx)(ef.A,{className:"w-4 h-4 mr-2"}),"Share with team"]})]})}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto min-h-0",children:[" ",P?(0,a.jsxs)(eH.YZ,{direction:"horizontal",children:[(0,a.jsx)(eH.Zk,{defaultSize:50,minSize:30,maxSize:80,className:"flex flex-col",children:"ai-selection"===C?H():G()}),(0,a.jsxs)(eH.TW,{className:"w-1 bg-gray-300 hover:bg-blue-500 cursor-col-resize transition-colors duration-200 relative group",children:[(0,a.jsx)("div",{className:"absolute inset-y-0 -inset-x-1"}),(0,a.jsx)("div",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-1 h-8 rounded-full bg-gray-400 opacity-0 group-hover:opacity-100 group-hover:bg-blue-600 transition-all duration-200"})]}),(0,a.jsx)(eH.Zk,{defaultSize:50,minSize:20,className:"bg-white border-l border-gray-200 overflow-auto",children:U()})]}):(0,a.jsx)("div",{className:"flex-1 overflow-auto",children:"ai-selection"===C?H():"prompt-editor"===C?G():U()})]}),(0,a.jsx)(e=>{let{handleRun:t,view:r,selectedModelCount:s,selectedModels:l,isGenerating:i=!1,onStop:o}=e;return(0,a.jsxs)("div",{className:"h-15 border-t border-gray-200 px-8 flex items-center justify-between bg-gray-50 mb-8",children:[(0,a.jsxs)("div",{className:"text-sm text-gray-600",children:[(0,a.jsx)("span",{className:"font-medium",children:"Selected models:"})," ",l.length>0?(()=>{let e=[{id:"gpt-4.1",name:"ChatGPT 4.1"},{id:"gpt-3.5",name:"GPT O3"},{id:"claude-3",name:"Claude Sonnet 4"},{id:"claude-sonnet",name:"Claude 3.7 Sonnet"},{id:"deepseek-v3",name:"Deepseek-v3"},{id:"deepseek-r1",name:"Deepseek-r1"},{id:"convomind",name:"Convomind"}];return l.map(t=>{let r=e.find(e=>e.id===t);return r?r.name:t}).join(", ")})():"None selected"]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[i&&(0,a.jsxs)("button",{onClick:o,className:"px-6 py-3 bg-red-600 hover:bg-red-700 text-white rounded-lg font-medium flex items-center space-x-2 transition-all duration-200",children:[(0,a.jsx)(n.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Stop"})]}),(0,a.jsxs)("button",{onClick:t,className:"px-6 py-3 ".concat(0===s?"bg-gray-400 cursor-not-allowed":i?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"," text-white rounded-lg font-medium flex items-center space-x-2 transition-all duration-200 shadow-sm"),disabled:"results"!==r&&(0===s||i),children:[(0,a.jsx)(ev.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:0===s?"Select Models":i?"Processing...":"ai-selection"===r?"Continue to Prompt":"prompt-editor"===r?"Generate":"Back to Prompt"})]})]})]})},{handleRun:F,view:C,selectedModelCount:E,selectedModels:T,isGenerating:g,onStop:()=>{p(!1),B(!1)}}),v&&d&&(0,a.jsx)(es,{itemId:d,report:{type:"PRODUCT_RESEARCH",name:"Product Research Report"},onClose:()=>k(!1)})]})},te=e=>{let{setToggleSidebar:t,initialData:r,initialResponse:s,recordId:l}=e,{toast:n,showToast:i}=(0,eB.Z)();return(0,a.jsxs)("div",{className:"flex",style:{backgroundColor:"#faf9f6"},children:[(0,a.jsx)(eF.A,{show:n.show,message:n.message,type:n.type}),(0,a.jsx)("div",{className:"flex-1 p-8 h-screen flex flex-col overflow-hidden min-h-0",style:{backgroundColor:"#faf9f6"},children:(0,a.jsx)(e9,{toast:n,showToast:i,setToggleSidebar:t,initialData:r,initialResponse:s,recordId:l})})]})};var tt=r(78084);let tr=()=>(0,a.jsx)(ep(),{id:"3258e1bd9199d0cb",children:":root{--safe-area-inset-top:env(safe-area-inset-top);--safe-area-inset-right:env(safe-area-inset-right);--safe-area-inset-bottom:env(safe-area-inset-bottom);--safe-area-inset-left:env(safe-area-inset-left)}@media(hover:none)and (pointer:coarse){button,input,select,textarea{min-height:44px}}html{-webkit-overflow-scrolling:touch}@media screen and (max-width:768px){input,select,textarea{font-size:16px}}"}),ta=e=>{var t,r,l;let{toast:i,showToast:o,initialData:d,initialResponse:c,recordId:x}=e,{t:u}=(0,P.Bd)("agent-brief"),m=(0,y.d4)(e=>
1e.user),[h,g]=(0,s.useState)(!1),[p,b]=(0,s.useState)(!1),[f,v]=(0,s.useState)(null),[k,j]=(0,s.useState)('\xdcr\xfcn Adı\n⢠\xdcr\xfcn\xfcn tam adı, marka ve model bilgisiyle birlikte eksiksiz Åekilde yaz.\n\n\xdcr\xfcn\xfcn Temel \xd6zellikleri\n⢠Teknik ve fonksiyonel \xf6zellikleri madde madde belirt.\n⢠İÅlemci, RAM, ekran boyutu, \xe7\xf6z\xfcn\xfcrl\xfck, yenileme hızı, depolama kapasitesi, baÄlantı t\xfcrleri, batarya, iÅletim sistemi, boyut ve aÄırlık gibi veriler eksiksiz yer alsın.\n\nVarsa yeni teknoloji/standartları (\xf6rn: 5G, Wi-Fi 6, Bluetooth 5.3, IP sertifikalar, Gorilla Glass vb.) belirtin.\n\n\xdcretim yeri, kutu i\xe7eriÄi, garanti, GTIN, onarım endeksi gibi \xfcr\xfcn\xfcn temel \xf6zelliklerini nitelendirmeyen maddeler yer almasın.\n\n\n\xdcr\xfcn\xfcn Faydaları ve Avantajları\n⢠\xdcr\xfcn\xfcn kullanıcıya saÄladıÄı faydaları net bir dille a\xe7ıkla.\n⢠Hangi problemleri \xe7\xf6zd\xfcÄ\xfcn\xfc ve g\xfcnl\xfck yaÅamı nasıl kolaylaÅtırdıÄını belirt.\n⢠Kullanıcının neden bu \xfcr\xfcn\xfc tercih etmesi gerektiÄini vurgula.\n\nHedef Kitle\n⢠Bu \xfcr\xfcn kimler i\xe7in uygundur?\n⢠Net bir Åekilde alt kitleleri belirtin. (\xd6rn: \xd6Ärenciler, profesyoneller, fotoÄraf meraklıları, oyuncular vb.)\n\nAlt BaÅlıklarda DeÄinebileceÄimiz \xd6zellikler\n⢠\xdcr\xfcn\xfcn dikkat \xe7ekici y\xf6nlerini alt baÅlıklarla \xf6ne \xe7ıkar. \xdcr\xfcn\xfcn kategorisine baÄlı olarak kullanıcıların en fazla aradıÄı veya sormuÅ olduÄu alt baÅlıklar \xf6ncelikli olsun. \xd6rneÄin; telefon i\xe7in kamera \xf6zelliÄi, iÅlemcisi, Åarj s\xfcresi, ekran \xe7\xf6z\xfcn\xfcrl\xfcÄ\xfc gibi\n⢠Her alt baÅlıÄın altında ilgili \xf6zelliÄin ne iÅe yaradıÄını c\xfcmle ile a\xe7ıkla.\n⢠BaÅlıklar yaratıcı olsun.\n\n⢠Her alt baÅlık \xf6zg\xfcn, merakı tetikleyen ve bilgilendirici olsun. (\xf6rn: âUzun Pil \xd6mr\xfcyle Kesintisiz Kullanımâ, âUltra Net Kamera Deneyimiâ)\n\n\nAnahtar Kelimeler\n⢠Kullanıcıların \xfcr\xfcn\xfc ararken yazabileceÄi kelimeleri belirt.\n⢠Arama eÄilimlerine uygun semantik anahtar kelimeleri se\xe7.\n\nİ\xe7 Linkleme\n⢠\xdcr\xfcne yakın kategorilere veya markaya y\xf6nlendiren link \xf6nerileri ver.\n⢠Anchor text + ge\xe7erli URL ekle (\xf6rnek: Samsung Katlanabilir Telefonlar â https://www.mediamarkt.com.tr/tr/category/katlanabilir-telefonlar-903527.html).\n\n\nİ\xe7erik yazım kuralları:\n\n%100 \xf6zg\xfcn ve kullanıcı dostu olsun.\nTeknik bilgiler doÄru ve eksiksiz aktarılsın.\nKısa, sade ve anlaÅılır c\xfcmleler kullanılmalı.\nAbartı, esprili ve s\xfcsl\xfc anlatımdan ka\xe7ınılmalı.\nProfesyonel, objektif ve g\xfcvenilir bir ton tercih edilmeli.\nKullanıcıya "Siz" diliyle hitap edilmeli.'),[w,C]=(0,s.useState)([{id:"urls",name:"URLs",placeholder:"Enter the URL here.",value:""},{id:"brieflanguage",name:"Brief Language",placeholder:"Enter your brief language here",value:""}]),[S,T]=(0,s.useState)("ai-selection"),[A,E]=(0,s.useState)([]),[L,M]=(0,s.useState)([]),[R,z]=(0,s.useState)(!1),_=A.length,[O,I]=(0,s.use
1State)(!1),[D,B]=(0,s.useState)("daily"),F=(0,s.useRef)(null);console.log("Initial Data:",d),(0,s.useEffect)(()=>{(null==m?void 0:m.token)&&(0,eU.Hs)(m.token,{status:"ACTIVE",agentry:!0}).then(e=>{var t;M(null!==(t=e.agenticAIs)&&void 0!==t?t:[])}).catch(()=>{})},[null==m?void 0:m.token]),(0,s.useEffect)(()=>{let e=e=>{O&&F.current&&!F.current.contains(e.target)&&I(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[O]),(0,s.useEffect)(()=>{var e,t,r,a,s,l;d&&(console.log("Initial Data:",d),(null===(e=d.urls)||void 0===e?void 0:e.length)&&C(e=>e.map(e=>"urls"===e.id?{...e,value:d.urls.join(";")}:e)),d.briefFormat&&j(d.briefFormat),d.briefLanguage&&C(e=>e.map(e=>"brieflanguage"===e.id?{...e,value:d.briefLanguage}:e)),d.aiId&&E([d.aiId]),(null==c?void 0:null===(t=c.briefs)||void 0===t?void 0:t.length)?(v({briefs:c.briefs,successes:null!==(s=null===(r=c.successful_urls)||void 0===r?void 0:r.map(e=>({url:e.url,filename:e.filename})))&&void 0!==s?s:[],errors:null!==(l=null===(a=c.failed_urls)||void 0===a?void 0:a.map(e=>{var t,r;return{url:"string"==typeof e?e:null!==(t=e.url)&&void 0!==t?t:"",error:null!==(r=e.error)&&void 0!==r?r:"Failed"}}))&&void 0!==l?l:[]}),g(!0),T("results")):T("prompt-editor"))},[d,c]);let H=e=>{try{let t=new URL(e).pathname.split("/");return t[t.length-1]}catch(e){return""}},U=(e,t)=>{let r=H(e),a=t.find(e=>e.filename===r);return(null==a?void 0:a.filename)||r||"brief.docx"},G=async e=>{try{let t=await fetch("/api/download-multiple",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:e})});if(!t.ok)throw Error("Download failed");let r=await t.blob(),a=window.URL.createObjectURL(r),s=document.createElement("a");s.href=a,s.download="briefs-".concat(Date.now(),".zip"),document.body.appendChild(s),s.click(),window.URL.revokeObjectURL(a),document.body.removeChild(s),o(u("toast.allDownloaded"),"success")}catch(e){console.error("Error downloading all briefs:",e),o(u("toast.downloadAllFailed"),"error")}},q=async(e,t)=>{try{let r=await fetch("/api/download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileUrl:e,fileName:t,fileType:"brief"})});if(!r.ok)throw Error("Download failed: ".concat(r.status));let a=await r.blob(),s=window.URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=t,document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(s)}catch(e){throw o(u("toast.downloadFileFailed",{filename:t}),"error"),e}},V=async(e,t)=>{try{await q(e,t)}catch(e){o(u("toast.downloadFailed",{filename:t}),"error"),console.error(e)}},W=async()=>{if("ai-selection"===S){T("prompt-editor"),g(!1);return}if("results"===S){g(!1),T("prompt-editor");return}if("prompt-editor"===S){b(!0),g(!1);try{var e,t;let r=(null===(e=w.find(e=>"urls"===e.id))||void 0===e?void 0:e.value)||"",a=(null===(t=w.find(e=>"brieflanguage"===e.id))||void 0===t?void 0:t.value)||"",s=r.split(";").map(e=>e.trim()).filter(e=>e),l=A[0];console.log("Selected AI ID:",A);let n=await ej(null==m?void 0:m.token,{aiId:l,urls:s,briefLanguage:a,briefFormat:k});if(v(n),n.briefs&&n.briefs.length>0){let e=n.briefs.map(e=>({url:e,filename:U(e,n.successes)}));await G(e)}n.briefs&&n.briefs.length>0?(N.emit(),g(!0),T("results")):o(u("toast.noBriefs"),"error")}catch(e){e instanceof Error&&("BudgetExceedRequestError"===e.name?(B&&B("budgetExceed"),I&&I(!0)):o(u("toast.briefFailed"),"error"))}finally{b(!1)}}};return(0,a.jsxs)("div",{className:"flex flex-col h-screen bg-gray-25 dark:bg-surface",style:{fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif'},children:[(0,a.jsx)(tr,{}),(0,a.jsx)(e=>{let{currentStep:t,briefResponse:r,isGenerating:s,hasFreshResults:l}=e;return(0,a.jsxs)("div",{className:"border-b border-gray-200 px-8 pt-8 pb-6 bg-white dark:bg-surface dark:border-border",children:[(0,a.jsx)("div",{className:"flex items-start mb-1",children:(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)("div",{className:"flex items-start justify-between max-w-3xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center cursor-pointer",onClick:()=>T("ai-selection"),children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full ".concat(1===t?"bg-blue-500 dark:bg-claude text-white":t>1?"bg-green-500 text-white":"bg-gray-200 dark:bg-surface-active text-gray-500 dark:text-ink-muted"," font-medium z-10 mb-1"),children:"1"}),(0,a.jsx)("div",{className:"text-sm font-medium ".concat(1===t?"text-blue-500 dark:text-claude":t>1?"text-green-600":"text-gray-500 dark:text-ink-muted"),children:u("header.step1")})]}),(0,a.jsx)("div",{className:"w-24 h-0.5 ".concat(t>=2?"bg-blue-200 dark:bg-claude/30":"bg-gray-200 dark:bg-surface-active"," mt-4")}),(0,a.jsxs)("div",{className:"flex flex-col items-center cursor-pointer",onClick:()=>T("prompt-editor"),children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full ".concat(2===t?"bg-blue-500 dark:bg-claude text-white":t>2?"bg-green-500 text-white":"bg-gray-200 dark:bg-surface-active text-gray-500 dark:text-ink-muted"," font-medium z-10 mb-1"),children:"2"}),(0,a.jsx)("div",{className:"text-sm font-medium ".concat(2===t?"text-blue-500 dark:text-claude":t>2?"text-green-600":"text-gray-500 dark:text-ink-muted"),children:u("header.step2")})]}),(0,a.jsx)("div",{className:"w-24 h-0.5 ".concat(t>=3?"bg-blue-200 dark:bg-claude/30":"bg-gray-200 dark:bg-surface-active"," mt-4")}),(0,a.jsxs)("div",{className:"flex flex-col items-center ".concat(l&&!s?"cursor-pointer":"cursor-not-allowed opacity-50"),onClick:()=>{l&&!s&&T("results")},children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full ".concat(3===t?"bg-blue-500 dark:bg-claude text-white":t>3?"bg-green-500 text-white":"bg-gray-200 dark:bg-surface-active text-gray-500 dark:text-ink-muted"," font-medium z-10 mb-1"),children:"3"}),(0,a.jsx)("div",{className:"text-sm font-medium ".concat(3===t?"text-blue-500 dark:text-claude":t>3?"text-green-600":"text-gray-500 dark:text-ink-muted"),children:u("header.step3")})]})]})})}),(0,a.jsx)("div",{className:"text-sm text-blue-500 dark:text-claude mt-1 text-center",children:1===t?u("steps.hint1"):2===t?u("steps.hint2"):u("steps.hint3")})]})},{currentStep:"ai-selection"===S?1:"prompt-editor"===S?2:3,briefResponse:f,
1isGenerating:p,hasFreshResults:h}),(0,a.jsx)("div",{className:"border-b border-gray-200 px-8 py-6 bg-white dark:bg-surface dark:border-border",children:(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold dark:text-ink-primary",children:"ai-selection"===S?u("header.step1"):"prompt-editor"===S?u("header.step2"):u("header.step3")})," ","results"===S&&x&&(0,a.jsxs)(tt.$,{onClick:()=>z(!0),variant:"outline",size:"sm",className:"flex items-center",children:[(0,a.jsx)(ef.A,{className:"w-4 h-4 mr-2"}),u("header.shareWithTeam")]})]})}),(0,a.jsx)("div",{className:"flex flex-1 overflow-hidden",children:(0,a.jsx)("div",{className:"flex flex-col transition-all duration-300",style:{width:"100%"},children:"ai-selection"===S?(()=>{let e=L.map(e=>{var t;return{id:e.id,name:e.name,provider:e.module,description:null!==(t=e.description)&&void 0!==t?t:"",category:"standard",tag:e.tag}}),t=e=>{E(t=>t.includes(e.tag)?t.filter(t=>t!==e.tag):[...t,e.tag]),console.log("Selected Models:",e)};return(0,a.jsx)("div",{className:"flex-1 overflow-auto",children:(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,a.jsx)("div",{className:"sticky top-0 bg-gray-50 z-10 p-8 pb-6 dark:bg-surface",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h3",{className:"text-2xl font-semibold text-gray-900 dark:text-ink-primary mb-6",children:u("modelSelect.title")}),(0,a.jsx)("div",{className:"bg-white rounded-lg p-3 shadow-sm inline-block dark:bg-surface-elevated",children:(0,a.jsx)("div",{className:"flex items-center justify-center space-x-4",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-lg font-bold text-gray-900 dark:text-ink-primary",children:A.length}),(0,a.jsx)("div",{className:"text-xs text-gray-600 dark:text-ink-muted",children:u("modelSelect.modelsSelected")})]})})})]})}),(0,a.jsx)("div",{className:"px-8 pb-8",children:0===e.length?(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 rounded-full flex items-center justify-center dark:bg-surface-active",children:(0,a.jsxs)("svg",{className:"w-8 h-8 text-gray-400 dark:text-ink-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,a.jsx)("path",{d:"M16 16s-1.5-2-4-2-4 2-4 2"}),(0,a.jsx)("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),(0,a.jsx)("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})}),(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-900 mb-2 dark:text-ink-primary",children:u("modelSelect.noModels")}),(0,a.jsx)("p",{className:"text-gray-500 dark:text-ink-muted",children:u("modelSelect.noModelsHint")})]}):(0,a.jsx)("div",{className:"grid gap-2 mt-6",children:e.map(e=>{var r;let s=A.includes(e.tag);return(0,a.jsxs)("div",{className:"group relative bg-white dark:bg-surface-elevated rounded-xl border transition-all duration-300 cursor-pointer hover:shadow-md hover:-translate-y-0.5 ".concat(s?"border-blue-500 dark:border-claude shadow-md ring-1 ring-blue-500 dark:ring-claude ring-opacity-20":"border-gray-200 dark:border-border hover:border-gray-300 dark:hover:border-ink-muted"),onClick:()=>t(e),children:[(0,a.jsx)("div",{className:"p-5",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3 flex-1",children:[(0,a.jsx)("div",{className:"w-8 h-8 flex items-center justify-center text-white text-sm font-semibold",children:(0,a.jsx)("img",{src:null===(r=(0,e4.tL)(e.provider))||void 0===r?void 0:r.src,alt:"nivea",className:"w-20 h-20 flex-shrink-0"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,a.jsx)("h4",{className:"text-base font-semibold text-gray-900 dark:text-ink-primary",children:e.name}),"trained"===e.category&&(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-700 text-xs font-medium rounded-full",children:u("modelSelect.badgeTrained")}),"shared-with-me"===e.category&&(0,a.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-700 text-xs font-medium rounded-full",children:u("modelSelect.badgeShared")}),"shared-by-me"===e.category&&(0,a.jsx)("span",{className:"px-2 py-0.5 bg-purple-100 text-purple-700 text-xs font-medium rounded-full",children:u("modelSelect.badgeMyShare")})]}),(0,a.jsx)("p",{className:"text-gray-600 text-sm leading-relaxed mb-1 dark:text-ink-muted",children:e.description})]})]}),(0,a.jsx)("div",{className:"flex-shrink-0 ml-3",children:(0,a.jsx)("div",{className:"w-5 h-5 rounded-full border-2 transition-all duration-200 flex items-center justify-center ".concat(s?"border-blue-500 dark:border-claude bg-blue-500 dark:bg-claude scale-105":"border-gray-300 dark:border-border group-hover:border-gray-400 dark:group-hover:border-ink-muted"),children:s&&(0,a.jsx)("svg",{className:"w-3 h-3 text-white",f
1ill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})})})})]})}),s&&(0,a.jsx)("div",{className:"absolute inset-0 rounded-xl pointer-events-none opacity-5",style:{backgroundColor:e.color}})]},e.id)})})})]})})})():"prompt-editor"===S?(0,a.jsx)("div",{className:"flex-1 p-8 overflow-auto",children:(0,a.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,a.jsxs)("div",{className:"mb-8 bg-white rounded-xl border border-gray-200 shadow-sm p-8 dark:bg-surface-elevated dark:border-border",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary",children:u("variables.title")})}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-4 dark:text-ink-muted",children:u("variables.hint")}),(0,a.jsx)("div",{className:"space-y-2",children:w.map(e=>(0,a.jsxs)("div",{className:"flex items-start",children:[(0,a.jsx)("div",{className:"w-36 pr-3 pt-2",children:(0,a.jsx)("input",{disabled:!0,type:"text",value:u("variables.".concat(e.id,".name"),{defaultValue:e.name}),className:"w-full py-2 px-3 border border-gray-300 rounded-lg text-sm font-medium focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude focus:border-blue-500 dark:focus:border-claude transition-all duration-200 dark:border-border dark:bg-surface dark:text-ink-muted"})}),"urls"===e.id?(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsx)("input",{type:"text",className:"w-full py-2 px-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude focus:border-blue-500 dark:focus:border-claude transition-all duration-200 dark:border-border dark:bg-surface dark:text-ink-primary",placeholder:u("variables.".concat(e.id,".placeholder"),{defaultValue:e.placeholder}),onKeyDown:t=>{if("Enter"===t.key&&t.currentTarget.value.trim()){t.preventDefault();let r=t.currentTarget.value.trim(),a=[...e.value?e.value.split(";").filter(e=>e.trim()):[],r].join(";");C(w.map(t=>t.id===e.id?{...t,value:a}:t)),t.currentTarget.value=""}},onBlur:t=>{if(t.currentTarget.value.trim()){let r=t.currentTarget.value.trim(),a=[...e.value?e.value.split(";").filter(e=>e.trim()):[],r].join(";");C(w.map(t=>t.id===e.id?{...t,value:a}:t)),t.currentTarget.value=""}}})}),(0,a.jsx)("div",{className:"border border-gray-200 rounded-lg p-3 bg-gray-50 h-[160px] overflow-y-auto dark:border-border dark:bg-surface",children:e.value&&e.value.split(";").filter(e=>e.trim()).length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:e.value.split(";").filter(e=>e.trim()).map((t,r)=>(0,a.jsxs)("div",{className:"group flex items-center gap-2 bg-blue-50 border border-gray-300 rounded-lg px-3 py-1.5 hover:border-gray-400 transition-all duration-200 shadow-sm dark:bg-blue-900/20 dark:border-border dark:hover:border-ink-muted",children:[(0,a.jsx)("span",{className:"text-sm text-gray-700 max-w-[480px] truncate dark:text-ink-primary",children:t.trim()}),(0,a.jsx)("button",{onClick:()=>{let t=e.value.split(";").filter(e=>e.trim());t.splice(r,1);let a=t.join(";");C(w.map(t=>t.id===e.id?{...t,value:a}:t))},className:"flex-shrink-0 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-full p-0.5 transition-all duration-200 dark:text-ink-muted dark:hover:bg-red-950/20",children:(0,a.jsx)(n.A,{className:"w-3.5 h-3.5"})})]},r))}):(0,a.jsx)("div",{className:"text-sm text-gray-400 text-center py-8 dark:text-ink-muted",children:u("variables.noUrls")})}),e.value&&e.value.split(";").filter(e=>e.trim()).length>0&&(0,a.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-gray-500 dark:text-ink-muted",children:u("variables.urlsAdded",{count:e.value.split(";").filter(e=>e.trim()).length})}),(0,a.jsx)("button",{onClick:()=>{C(w.map(t=>t.id===e.id?{...t,value:""}:t))},className:"text-xs text-red-500 hover:text-red-700 hover:underline transition-colors duration-200",children:u("variables.removeAll")})]})]}):(0,a.jsx)("input",{type:"text",className:"flex-1 py-2 px-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude focus:border-blue-500 dark:focus:border-claude transition-all duration-200 dark:border-border dark:bg-surface dark:text-ink-primary",placeholder:u("variables.".concat(e.id,".placeholder"),{defaultValue:e.placeholder}),value:e.value,onChange:t=>{C(w.map(r=>r.id===e.id?{...r,value:t.target.value}:r))}})]},e.id))})]}),(0,a.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm dark:bg-surface-elevated dark:border-border",children:[(0,a.jsx)("div",{className:"border-b px-4 py-3 flex justify-between items-start dark:border-border",children:(0,a.jsx)("div",{children:(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 mb-1 dark:text-ink-primary",children:u("prompt.title")})})}),(0,a.jsx)("div",{className:"relative",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("textarea",{value:k,onChange:e=>{j(e.target.value)},className:"w-full p-4 resize-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude focus:border-blue-500 dark:focus:border-claude border-0 font-mono transition-all duration-200 bg-white text-gray-900 dark:bg-surface-elevated dark:text-ink-primary",placeholder:u("prompt.placeholder"),style:{lineHeight:"1.5",fontSize:"14px",height:"calc(100vh - 600px)",minHeight:"200px",maxHeight:"600px"}}),(0,a.jsx)("div",{className:"absolute top-0 left-0 p-4 pointer-events-none w-full h-96 overflow-hidden",style:{lineHeight:"1.5",fontSize:"14px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:(0,a.jsx)("div",{className:"relative",children:k&&[...k.matchAll(/\[([^\]]+)\]/g)].map((e,t)=>{let r=e.index,s=k.substring(0,r).split("\n"),l=s.length-1,n=s[s.length-1].length;return(0,a.jsx)("div",{className:"absolute bg-red-100 border border-red-200 rounded",style:{to
1p:"".concat(21*l,"px"),left:"".concat(8.4*n,"px"),width:"".concat(8.4*e[0].length,"px"),height:"21px",opacity:.3,zIndex:1}},t)})})})]})})]})]})}):(0,a.jsx)("div",{className:"flex-1 p-8 overflow-auto",children:(0,a.jsx)("div",{className:"max-w-4xl mx-auto",children:f?f?(0,a.jsxs)("div",{className:"mt-6 bg-white rounded-xl border border-gray-200 shadow-sm p-6 dark:bg-surface-elevated dark:border-border",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary mb-4",children:u("results.title")}),f.successes.length>0&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("h4",{className:"text-md font-medium text-green-600 dark:text-green-400 mb-2",children:u("results.successful",{count:f.successes.length})}),(0,a.jsx)("div",{className:"space-y-2",children:f.successes.map((e,t)=>(0,a.jsxs)("div",{className:"p-3 bg-green-50 dark:bg-green-900/20 rounded-lg",children:[(0,a.jsx)("p",{className:"text-sm text-gray-700 dark:text-ink-primary truncate",children:e.url}),(0,a.jsx)("p",{className:"text-xs text-green-600 dark:text-green-400",children:e.filename})]},t))})]}),f.errors.length>0&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("h4",{className:"text-md font-medium text-red-600 dark:text-red-400 mb-2",children:u("results.failed",{count:f.errors.length})}),(0,a.jsx)("div",{className:"space-y-2",children:f.errors.map((e,t)=>(0,a.jsxs)("div",{className:"p-3 bg-red-50 dark:bg-red-900/20 rounded-lg",children:[(0,a.jsx)("p",{className:"text-sm text-gray-700 dark:text-ink-primary truncate",children:e.url}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:e.error})]},t))})]}),f.briefs.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("h4",{className:"text-md font-medium text-blue-600 dark:text-claude",children:u("results.downloadFiles",{count:f.briefs.length})}),(0,a.jsx)("button",{onClick:()=>G(f.briefs.map(e=>({url:e,filename:U(e,f.successes)}))),className:"px-4 py-2 bg-blue-500 dark:bg-claude text-white text-sm rounded hover:bg-blue-600 dark:hover:bg-claude-hover transition-colors",children:u("results.downloadAll")})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-1 gap-2",children:f.briefs.map((e,t)=>{let r=U(e,f.successes);return(0,a.jsx)("button",{onClick:()=>V(e,r),className:"p-3 border border-gray-200 dark:border-border rounded-lg hover:bg-gray-50 dark:hover:bg-surface-active text-left transition-colors",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsxs)("p",{className:"text-sm text-gray-500 dark:text-ink-muted truncate",children:["\uD83D\uDCC4 ",r]})}),(0,a.jsx)("span",{className:"text-blue-500 dark:text-claude text-sm flex-shrink-0",children:"â¬ï¸"})]})},t)})})]})]}):null:(0,a.jsx)("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm p-8 text-gray-600 dark:bg-surface-elevated dark:border-border dark:text-ink-muted",children:u("results.empty")})})})})}),O&&(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-end justify-center pointer-events-none rounded-lg",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/20 pointer-events-auto",onClick:()=>I(!1)}),(0,a.jsx)("div",{ref:F,className:"relative mb-20 w-full max-w-3xl mx-4 ml-90 pointer-events-auto animate-slide-up",children:(0,a.jsxs)("div",{className:"relative bg-white rounded-lg shadow-2xl",children:[(0,a.jsx)("button",{className:"absolute -top-2 -right-2 text-gray-600 hover:text-gray-900 bg-white rounded-full p-2 shadow-lg z-10 transition-colors",onClick:()=>I(!1),children:(0,a.jsx)(n.A,{className:"h-5 w-5"})}),(0,a.jsx)(eG.A,{limitType:D,onClose:()=>I(!1)})]})})]}),(0,a.jsx)(e=>{let{isOutputLoading:t=!1,handleRun:r,view:s,selectedModelCount:l,selectedModels:n,agenticModels:i}=e,o=n.map(e=>{var t;return null===(t=i.find(t=>t.tag===e))||void 0===t?void 0:t.name}).filter(Boolean).join(", ");return(0,a.jsxs)("div",{className:"h-15 border-t border-gray-200 px-8 flex items-center justify-between bg-gray-50 mb-8 dark:bg-surface-elevated dark:border-border",children:[(0,a.jsxs)("div",{className:"text-sm text-gray-600 dark:text-ink-muted",children:[(0,a.jsx)("span",{className:"font-medium",children:u("footer.selectedModels")})," ",o||u("footer.noneSelected")]}),(0,a.jsx)("div",{className:"flex items-center space-x-4",children:(0,a.jsxs)("button",{onClick:r,className:"px-6 py-3 ".concat(0===l?"bg-gray-400 cursor-not-allowed":t?"bg-gray-400 cursor-not-allowed":"bg-blue-600 dar
1k:bg-claude hover:bg-blue-700 dark:hover:bg-claude-hover"," text-white rounded-lg font-medium flex items-center space-x-2 transition-all duration-200 shadow-sm"),disabled:"results"!==s&&(0===l||t),children:[(0,a.jsx)(ev.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:0===l?u("footer.selectModels"):t?u("footer.processing"):"ai-selection"===s?u("footer.continueToPrompt"):"prompt-editor"===s?u("footer.generate"):u("footer.backToPrompt")})]})})]})},{isOutputLoading:p,handleRun:W,view:S,selectedModelCount:_,selectedModels:A,agenticModels:L}),R&&x&&(0,a.jsx)(es,{itemId:x,report:{type:"BRIEF_OUTLINE",name:(null===(l=w.find(e=>"urls"===e.id))||void 0===l?void 0:null===(r=l.value)||void 0===r?void 0:null===(t=r.split(";")[0])||void 0===t?void 0:t.trim())||u("share.reportName")},onClose:()=>z(!1)})]})},ts=e=>{let{initialData:t,initialResponse:r,recordId:s}=e,{toast:l,showToast:n}=(0,eB.Z)();return(0,a.jsxs)("div",{className:"flex dark:bg-surface",children:[(0,a.jsx)(eF.A,{show:l.show,message:l.message,type:l.type}),(0,a.jsx)("div",{className:"flex-1 p-8 h-screen dark:bg-surface",children:(0,a.jsx)(ta,{toast:l,showToast:n,initialData:t,initialResponse:r,recordId:s})})]})};var tl=r(56588),tn=r(24948),ti=r(48230),to=r.n(ti);let td=()=>(0,a.jsx)(ep(),{id:"3258e1bd9199d0cb",children:":root{--safe-area-inset-top:env(safe-area-inset-top);--safe-area-inset-right:env(safe-area-inset-right);--safe-area-inset-bottom:env(safe-area-inset-bottom);--safe-area-inset-left:env(safe-area-inset-left)}@media(hover:none)and (pointer:coarse){button,input,select,textarea{min-height:44px}}html{-webkit-overflow-scrolling:touch}@media screen and (max-width:768px){input,select,textarea{font-size:16px}}"}),tc=e=>{let{title:t,description:r,icon:s}=e;return(0,a.jsx)("div",{className:"bg-blue-50 dark:bg-surface-elevated border-l-4 border-blue-500 dark:border-border rounded-lg p-4 mb-6 mt-6",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[s&&(0,a.jsx)("div",{className:"flex-shrink-0 mt-0.5 [&_svg]:dark:text-orange-400",children:s}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-blue-900 dark:text-ink-primary mb-1",children:t}),(0,a.jsx)("p",{className:"text-sm text-blue-800 dark:text-ink-secondary",children:r})]})]})})},tx=e=>{let{showToast:t,setToggleSidebar:r,initialData:l,initialResponse:i,recordId:o}=e,{t:d}=(0,P.Bd)("agent-long-description"),c=(0,y.d4)(e=>e.user),[x,m]=(0,s.useState)(!1),[h,g]=(0,s.useState)(!1),[p,b]=(0,s.useState)('You are a professional product description writer.\nThe markdown content above contains the product page HTML with detailed product information.\nUsing this content, create comprehensive, clear, and natural content that aligns with the "User Prompt."'),[f,v]=(0,s.useState)(""),[k,j]=(0,s.useState)(!1),[w,C]=(0,s.useState)([{id:"urls",name:"URLs",placeholder:"Up to 50 product links. There should be no crawling restrictions on your website for the analysis.",value:""},{id:"startTag",name:"Start Tag",placeholder:'Paste the <div class=" with product images here for accurate and detailed output.',value:""},{id:"endTag",name:"End Tag",placeholder:"Closing tag, e.g. </div></div>",value:""}]),[S,T]=(0,s.useState)([]),[A,E]=(0,s.useState)([]),[L,M]=(0,s.useState)("ai-selection"),[R,z]=(0,s.useState)(null),[_,O]=(0,s.useState)(!1),[I,D]=(0,s.useState)(!1),[B,F]=(0,s.use
1State)([]),[H,U]=(0,s.useState)(!0),[G,q]=(0,s.useState)("daily"),[V,W]=(0,s.useState)(!1),J=(0,s.useRef)(null),Y=e=>{try{return new URL(e),!0}catch(e){return!1}},$=e=>e.split(/\r\n|\n|,/).map(e=>e.trim()).filter(Boolean).filter(e=>!/^(url|link|urls|links)$/i.test(e)).map(e=>e.replace(/^["']|["']$/g,"")),X=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=async()=>{try{var e;U(!0);let t=await (0,eU.Hs)(null==c?void 0:c.token,{status:"ACTIVE",agentry:!0}),r=null!==(e=t.agenticAIs)&&void 0!==e?e:[];F(r)}catch(e){console.error("Failed to fetch AI models:",e),t(d("toast.loadModelsFailed"),"error")}finally{U(!1)}};(null==c?void 0:c.token)&&e()},[null==c?void 0:c.token]),(0,s.useEffect)(()=>{var e,t,r;if(!l)return;(null===(e=l.urls)||void 0===e?void 0:e.length)&&C(e=>e.map(e=>"urls"===e.id?{...e,value:l.urls.join(";")}:e)),l.url&&!l.urls&&C(e=>e.map(e=>"urls"===e.id?{...e,value:l.url}:e)),l.systemPrompt&&b(l.systemPrompt),l.userPrompt&&v(l.userPrompt),(null===(t=l.imageTags)||void 0===t?void 0:t.startTag)&&C(e=>e.map(e=>"startTag"===e.id?{...e,value:l.imageTags.startTag}:e)),(null===(r=l.imageTags)||void 0===r?void 0:r.endTag)&&C(e=>e.map(e=>"endTag"===e.id?{...e,value:l.imageTags.endTag}:e)),l.aiId&&T([l.aiId]);let a=Array.isArray(i)?i[0]:i;(null==a?void 0:a.content)?(E((Array.isArray(i)?i:[i]).map(e=>{var t,r,a,s,n,i,o,d;return{modelTag:null!==(r=l.aiId)&&void 0!==r?r:"",modelName:null!==(a=l.aiId)&&void 0!==a?a:"",response:{content:e.content,url:null!==(i=null!==(n=null!==(s=e.url)&&void 0!==s?s:l.url)&&void 0!==n?n:null===(t=l.urls)||void 0===t?void 0:t[0])&&void 0!==i?i:"",wordCount:null!==(d=null!==(o=e.word_count)&&void 0!==o?o:e.wordCount)&&void 0!==d?d:0}}})),m(!0),D(!1),M("results")):M("prompt-editor")},[l,i]);let Z=async()=>{g(!0),m(!1),D(!0),r(!1);try{var e,a,s;let l=(null===(e=w.find(e=>"urls"===e.id))||void 0===e?void 0:e.value)||"",n=(null===(a=w.find(e=>"startTag"===e.id))||void 0===a?void 0:a.value)||"",i=(null===(s=w.find(e=>"endTag"===e.id))||void 0===s?void 0:s.value)||"",o=l.split(";").map(e=>e.trim()).filter(Boolean),x=[];for(let e of S){let r=B.find(t=>t.tag===e),a=r?r.name:e;t(d("toast.generatingWith",{model:a}),"success");let s={aiId:e,systemPrompt:p,userPrompt:f,...o.length>0&&{urls:o},...(n||i)&&{imageTags:{startTag:n,endTag:i}}};(await ew(s,null==c?void 0:c.token)).forEach(t=>{t&&t.content&&x.push({modelTag:e,modelName:o.length>1?"".concat(a," (").concat(t.url,")"):a,response:t})})}E(x),x.length>0?(m(!0),M("results"),r(!1),t(d("toast.generated",{count:x.length}),"success")):(t(d("toast.generationFailedAll"),"error"),D(!1))}catch(e){e instanceof Error?"BudgetExceedRequestError"===e.name&&(q("budgetExceed"),W(!0)):t(d("toast.generationFailed"),"error")}finally{g(!1)}},Q=e=>{var r;let a=null===(r=e.target.files)||void 0===r?void 0:r[0];if(!a)return;if(!a.name.toLowerCase().endsWith(".csv")){t(d("toast.selectCsv"),"error"),e.target.value="";return}if(a.size>2097152){t(d("toast.fileTooLarge"),"error"),e.target.value="";return}let s=new FileReader;s.onload=()=>{let r=$(s.result);if(0===r.length){t(d("toast.noUrlsInFile"),"error"),e.target.value="";return}let a=r.filter(Y),l=r.length-a.length;if(0===a.length){t(d("toast.noValidUrls"),"error"),e.target.value="";return}C(e=>{let r=e.find(e=>"urls"===e.id),s=(null==r?void 0:r.value)?r.value.split(";").filter(e=>e.trim()):[],n=Array.from(new Set([...s,...a]));n.length>50?t(d("toast.maxUrls",{max:50,added:50-s.length}),"error"):l>0?t(d("toast.importedWithSkips",{imported:a.length,skipped:l}),"success"):t(d("toast.imported",{imported:a.length}),"success");let i=n.slice(0,50);return e.map(e=>"urls"===e.id?{...e,value:i.join(";")}:e)}),e.target.value=""},s.onerror=()=>{t(d("toast.readFileFailed"),"error")},s.readAsText(a)},ee=async()=>{if("ai-selection"===L){M("prompt-editor"),m(!1);return}if("prompt-editor"===L){var e,a,s;if(!p.trim()){t(d("toast.enterSystemPrompt"),"error");return}if(!f.trim()){t(d("toast.enterUserPrompt"),"error");return}if(0===S.length){t(d("toast.selectModel"),"error");return}let l=(null===(e=w.find(e=>"urls"===e.id))||void 0===e?void 0:e.value)||"",n=(null===(a=w.find(e=>"startTag"===e.id))||void 0===a?void 0:a.value)||"",i=(null===(s=w.find(e=>"endTag"===e.id))||void 0===s?void 0:s.value)||"",o=l.split(";").map(e=>
1e.trim()).filter(Boolean);if(1===o.length&&n&&i){O(!0),D(!0),r(!1);try{let e={url:o[0],imageTags:{startTag:n,endTag:i}},r=await eC(e,null==c?void 0:c.token);z(r),M("image-generation"),t(d("toast.imagesGenerated"),"success")}catch(e){t(d("toast.imagesFailed"),"error"),D(!1)}finally{O(!1)}return}await Z();return}if("image-generation"===L){await Z(),N.emit();return}if("results"===L){m(!1),M("prompt-editor"),D(!1),E([]),z(null),N.emit();return}},et=()=>h?(0,a.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin w-8 h-8 border-4 border-blue-600 dark:border-orange-500 border-t-transparent dark:border-t-transparent rounded-full mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600 dark:text-ink-secondary",children:d("images.generatingContent")}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-ink-muted mt-2",children:d("images.mayTakeMoments")})]})}):_?(0,a.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin w-8 h-8 border-4 border-blue-600 dark:border-orange-500 border-t-transparent dark:border-t-transparent rounded-full mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600 dark:text-ink-secondary",children:d("images.generatingImages")}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-ink-muted mt-2",children:d("images.mayTakeMoments")})]})}):R&&R.links&&0!==R.links.length?(0,a.jsx)("div",{className:"p-8 overflow-auto h-full bg-white dark:bg-surface",children:(0,a.jsx)("div",{className:"max-w-6xl mx-auto",children:(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-xl border border-gray-200 dark:border-border shadow-sm p-8",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h3",{className:"text-xl font-semibold text-gray-900 dark:text-ink-primary",children:d("images.title")}),(0,a.jsx)("span",{className:"text-sm text-gray-500 dark:text-ink-muted",children:d("images.count",{count:R.links.length})})]}),(0,a.jsxs)("div",{style:{backgroundColor:"#f0f7ff",border:"1px solid #bdd7f5",borderRadius:"8px",padding:"12px 16px",marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px"},children:[(0,a.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{d:"M10 0C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20C15.52 20 20 15.52 20 10C20 4.48 15.52 0 10 0ZM11 15H9V9H11V15ZM11 7H9V5H11V7Z",fill:"#2563eb"})}),(0,a.jsx)("span",{style:{color:"#1e40af",fontSize:"14px"},children:d("images.previewNote")})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:R.links.map((e,t)=>(0,a.jsxs)("div",{className:"relative group bg-white",children:[(0,a.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"block",children:(0,a.jsx)("div",{className:"w-full h-64 bg-white rounded-lg border-2 border-gray-200 overflow-hidden hover:border-blue-400 transition-colors",children:(0,a.jsx)("img",{src:e,alt:d("images.alt",{index:t+1}),className:"w-full h-full object-contain bg-white",style:{display:"block"},onError:e=>{let r=e.currentTarget;r.style.display="none";let a=r.parentElement;if(a&&!a.querySelector(".fallback")){let e=document.createElement("div");e.className="fallback w-full h-full flex flex-col items-center justify-center bg-gray-50",e.innerHTML='\n <svg class="w-16 h-16 text-gray-400 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">\n <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path>\n </svg>\n <p class="text-sm text-gray-600 font-medium mb-2">'.concat(d("images.imageN",{index:t+1}),'</p>
1\n <span class="text-xs text-blue-600 hover:text-blue-700 underline">').concat(d("images.clickToView"),"</span>\n "),a.appendChild(e)}}})})}),(0,a.jsx)("div",{className:"absolute bottom-2 left-2 bg-white bg-opacity-90 px-2 py-1 rounded text-xs text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity",children:d("images.imageN",{index:t+1})})]},t))})]})})}):(0,a.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,a.jsx)("div",{className:"text-center",children:(0,a.jsx)("p",{className:"text-gray-600",children:d("images.noImages")})})}),er=()=>{if(H)return(0,a.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin w-8 h-8 border-4 border-blue-600 dark:border-orange-500 border-t-transparent dark:border-t-transparent rounded-full mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600 dark:text-ink-secondary",children:d("modelSelect.loading")})]})});if(!B)return(0,a.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,a.jsx)("div",{className:"text-center",children:(0,a.jsx)("p",{className:"text-gray-600",children:d("modelSelect.loadFailed")})})});let e=e=>{T(r=>r.includes(e)?r.filter(t=>t!==e):r.length>=3?(t(d("modelSelect.maxThree"),"error"),r):[...r,e])};return(0,a.jsx)("div",{className:"flex flex-col h-full",children:(0,a.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,a.jsxs)("div",{className:"max-w-2xl mx-auto",children:[(0,a.jsx)("div",{className:"sticky top-0 bg-gray-50 dark:bg-surface z-10 p-8 pb-6",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h3",{className:"text-2xl font-semibold text-gray-900 dark:text-ink-primary mb-3",children:d("modelSelect.title")}),(0,a.jsx)("div",{className:"bg-white dark:bg-surface-elevated rounded-lg p-3 shadow-sm dark:shadow-black/20 inline-block",children:(0,a.jsx)("div",{className:"flex items-center justify-center space-x-4",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-lg font-bold text-gray-900 dark:text-ink-primary",children:S.length}),(0,a.jsx)("div",{className:"text-xs text-gray-600 dark:text-ink-muted",children:d("modelSelect.modelsSelected")})]})})})]})}),(0,a.jsx)("div",{className:"px-8 pb-8",children:(0,a.jsx)("div",{className:"grid gap-2 mt-6",children:B.map(t=>{var r;let s=S.includes(t.tag);return(0,a.jsx)("div",{className:"group relative bg-white dark:bg-surface-elevated rounded-xl border transition-all duration-300 cursor-pointer hover:shadow-md hover:-translate-y-0.5 ".concat(s?"border-blue-500 dark:border-claude shadow-md ring-1 ring-blue-500 dark:ring-claude ring-opacity-20":"border-gray-200 dark:border-border hover:border-gray-300 dark:hover:border-border"),onClick:()=>e(t.tag),children:(0,a.jsx)("div",{className:"p-5",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3 flex-1",children:[(0,a.jsx)("div",{className:"w-8 h-8 flex items-center justify-center text-white text-sm font-semibold",children:(0,a.jsx)("img",{src:null===(r=(0,e4.tL)(t.module))||void 0===r?void 0:r.src,alt:t.name,className:"w-10 h-10 flex-shrink-0"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-0.5",children:(0,a.jsx)("h4",{className:"text-base font-semibold text-gray-900 dark:text-ink-primary",children:t.name})}),(0,a.jsx)("p",{className:"text-gray-600 dark:text-ink-secondary text-sm leading-relaxed mb-1",children:t.description})]})]}),(0,a.jsx)("div",{className:"flex-shrink-0 ml-3",children:(0,a.jsx)("div",{className:"w-5 h-5 rounded-full border-2 transition-all duration-200 flex items-center justify-center ".concat(s?"border-blue-500 dark:border-claude bg-blue-500 dark:bg-claude scale-105":"border-gray-300 dark:border-border group-hover:border-gray-400 dark:group-hover:border-ink-muted"),children:s&&(0,a.jsx)("svg",{className:"w-3 h-3 text-white",f
1ill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})})})})]})})},t.id)})})})]})})})},ea=()=>{var e;let t=((null===(e=w.find(e=>"urls"===e.id))||void 0===e?void 0:e.value)||"").split(";").map(e=>e.trim()).filter(Boolean)[0];if(t)try{let e=new URL(t).pathname.split("/");return(e[e.length-1]||e[e.length-2]).replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())||d("results.generatedContent")}catch(e){return d("results.generatedContent")}if(A&&A.length>0){let e=A[0].response.content.split("\n")[0];if(e.startsWith("#"))return e.replace(/^#+\s*/,"").trim()}return d("results.generatedContent")},el=async()=>{try{let e=[];A.forEach((t,r)=>{e.push(new eW.fzL({children:[new eW.NTc({text:t.modelName,bold:!0,size:32})],heading:eW.Fmo.HEADING_1,spacing:{before:480*(0!==r),after:240}}));let a=t.response.content.split("\n"),s=[],l=()=>{s.length>0&&(s.forEach(t=>{e.push(new eW.fzL({children:n(t.text),bullet:{level:t.level},spacing:{before:100,after:100}}))}),s=[])},n=e=>{let t=[];return e.split(/(\*\*[^\*]+?\*\*)/g).forEach((e,r)=>{if(e){if(e.startsWith("**")&&e.endsWith("**")){let r=e.slice(2,-2);t.push(new eW.NTc({text:r,bold:!0}))}else t.push(new eW.NTc(e))}}),t.length>0?t:[new eW.NTc(e)]};for(let t=0;t<a.length;t++){let r=a[t];if("---"===r.trim()||"___"===r.trim()||"***"===r.trim()){l(),e.push(new eW.fzL({text:"",border:{bottom:{color:"CCCCCC",space:1,style:"single",size:6}},spacing:{before:240,after:240}}));continue}if(!r.trim()){l(),e.push(new eW.fzL({text:""}));continue}if(r.startsWith("### ")){l();let t=r.replace("### ","");e.push(new eW.fzL({children:n(t),heading:eW.Fmo.HEADING_3,spacing:{before:240,after:120}}))}else if(r.startsWith("## ")){l();let t=r.replace("## ","");e.push(new eW.fzL({children:n(t),heading:eW.Fmo.HEADING_2,spacing:{before:240,after:120}}))}else if(r.startsWith("# ")){l();let t=r.replace("# ","");e.push(new eW.fzL({children:n(t),heading:eW.Fmo.HEADING_1,spacing:{before:240,after:120}}))}else if(r.match(/^[\-\*]\s+/)){let e=r.replace(/^[\-\*]\s+/,"");s.push({text:e,level:0})}else if(r.match(/^\d+\.\s+/)){l();let t=r.replace(/^\d+\.\s+/,"");e.push(new eW.fzL({children:n(t),numbering:{reference:"numbered-list",level:0},spacing:{before:100,after:100}}))}else l(),e.push(new eW.fzL({children:n(r),spacing:{before:120,after:120}}))}l(),new eW.yoT({numbering:{config:[{reference:"numbered-list",levels:[{level:0,format:"decimal",text:"%1.",alignment:eW.Yus.LEFT}]}]},sections:[{children:e}]}),r<A.length-1&&e.push(new eW.fzL({text:"",border:{bottom:{color:"000000",space:1,style:"single",size:12}},spacing:{before:480,after:480}}))});let r=new eW.yoT({sections:[{children:e}]}),a=await eW.ND6.toBlob(r),s=ea().replace(/[^a-z0-9]/gi,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),l="".concat(s||"content","_").concat(Date.now(),".docx");(0,eJ.saveAs)(a,l),t(d("results.exported"),"success")}catch(e){console.error("Export failed:",e),t(d("results.exportFailed"),"error")}},en=()=>A&&0!==A.length?(0,a.jsx)("div",{className:"p-8 overflow-auto h-full",children:(0,a.jsx)("div",{className:"max-w-4xl mx-auto",children:(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated p-8 rounded-xl",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-xl font-semibold text-gray-900 dark:text-ink-primary",children:ea()}),(0,a.jsxs)("button",{onClick:el,className:"px-4 py-2 bg-transparent border border-gray-200 dark:border-border text-black dark:text-ink-primary rounded-lg font-medium flex items-center space-x-2 transition-all duration-200 hover:bg-gray-50 dark:hover:bg-surface-active",children:[(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,a.jsx)("span",{children:d("results.exportDocx")})]})]}),A.map((e,t)=>(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 border-l-4 border-blue-500 p-4 mb-4",children:(0,a.jsxs)("div",{className:"flex flex-col items-start gap-1",children:[(0,a.jsx)("h4",{className:"text-lg font-bold text-blue-900 dark:text-blue-300",children:e.modelName.split(" (")[0]}
1),(0,a.jsx)(to(),{className:"text-sm text-blue-600 dark:text-blue-400 break-all mt-1",href:e.response.url,target:"_blank",rel:"noopener noreferrer",children:e.response.url}),(0,a.jsx)("span",{className:"text-sm text-blue-700 dark:text-blue-400 mt-1",children:d("results.wordCount",{count:e.response.wordCount})})]})}),e.response.error&&(0,a.jsx)("div",{className:"mb-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:(0,a.jsx)("p",{className:"text-red-700",children:d("results.error",{message:e.response.error})})}),(0,a.jsx)("div",{className:"prose prose-lg max-w-none p-6",children:(0,a.jsx)(tn.oz,{components:{h1:e=>{let{...t}=e;return(0,a.jsx)("h1",{className:"text-3xl font-bold mb-4 text-gray-900 dark:text-ink-primary",...t})},h2:e=>{let{...t}=e;return(0,a.jsx)("h2",{className:"text-2xl font-bold mb-3 mt-6 text-gray-900 dark:text-ink-primary",...t})},h3:e=>{let{...t}=e;return(0,a.jsx)("h3",{className:"text-xl font-bold mb-2 mt-4 text-gray-900 dark:text-ink-primary",...t})},p:e=>{let{...t}=e;return(0,a.jsx)("p",{className:"mb-4 text-gray-700 dark:text-ink-secondary leading-relaxed",...t})},ul:e=>{let{...t}=e;return(0,a.jsx)("ul",{className:"list-disc pl-6 mb-4 space-y-2",...t})},ol:e=>{let{...t}=e;return(0,a.jsx)("ol",{className:"list-decimal pl-6 mb-4 space-y-2",...t})},li:e=>{let{...t}=e;return(0,a.jsx)("li",{className:"text-gray-700 dark:text-ink-secondary",...t})},strong:e=>{let{...t}=e;return(0,a.jsx)("strong",{className:"font-bold text-gray-900 dark:text-ink-primary",...t})},em:e=>{let{...t}=e;return(0,a.jsx)("em",{className:"italic",...t})},code(e){var t,r;let{className:s,children:l,...n}=e;if(!(null===(r=n.node)||void 0===r?void 0:null===(t=r.position)||void 0===t?void 0:t.start.line))return(0,a.jsx)("code",{className:"py-0.5 px-1 mx-0.5 bg-gray-100 dark:bg-surface-active text-gray-900 dark:text-ink-primary font-medium rounded",...n,children:l});let i=/language-(\w+)/.exec(s||""),o=i?i[1]:"text";return(0,a.jsxs)("div",{className:"relative mt-2 mb-4",children:[(0,a.jsx)("div",{className:"bg-gray-100 dark:bg-surface-active text-gray-900 dark:text-ink-primary rounded-t flex justify-between items-center px-3 py-1.5",children:(0,a.jsx)("span",{className:"text-xs font-medium text-gray-900 dark:text-ink-primary",children:o})}),(0,a.jsx)("pre",{className:"bg-gray-50 dark:bg-surface text-gray-900 dark:text-ink-primary p-3 rounded-b mt-0 overflow-x-auto",children:(0,a.jsx)("code",{className:s||"",children:l})})]})}},children:e.response.content})}),t<A.length-1&&(0,a.jsx)("div",{className:"border-t-2 border-gray-300 my-8"})]},e.modelTag))]})})}):(0,a.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin w-8 h-8 border-4 border-blue-600 dark:border-orange-500 border-t-transparent dark:border-t-transparent rounded-full mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600 dark:text-ink-secondary",children:d("images.generatingContent")}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-ink-muted mt-2",children:d("images.mayTakeMoments")})]})}),ei=()=>(0,a.jsx)("div",{className:"h-full overflow-y-auto",children:(0,a.jsx)("div",{className:"p-8",children:(0,a.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,a.jsx)(tc,{title:d("editor.tipTitle"),description:d("editor.tipDescription"),icon:(0,a.jsx)(tl.A,{className:"w-5 h-5 text-blue-500"})}),(0,a.jsx)(tc,{title:d("editor.htmlTitle"),description:d("editor.htmlDescription"),icon:(0,a.jsx)(K.A,{className:"w-5 h-5 text-blue-500"})}),(0,a.jsxs)("div",{className:"mb-8 bg-white dark:bg-surface-elevated rounded-xl border border-gray-200 dark:border-border shadow-sm p-8",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary",children:d("editor.optionalParams")})}),(0,a.jsx)("p",{className:"text-sm text-gray-600 dark:text-ink-secondary mb-4",children:d("editor.optionalParamsHint")}),(0,a.jsx)("div",{className:"space-y-2",children:w.map(e=>(0,a.jsxs)("div",{className:"flex items-start",children:[(0,a.jsx)("div",{className:"w-36 pr-3 pt-2",children:(0,a.jsx)("input",{disabled:!0,type:"text",value:d("variables.".concat(e.id,".n
1ame"),{defaultValue:e.name}),className:"w-full py-2 px-3 border border-gray-300 dark:border-border rounded-lg text-sm font-medium bg-gray-100 dark:bg-surface text-gray-700 dark:text-ink-secondary focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200"})}),"urls"===e.id?(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"mb-2 flex",children:[(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("style",{children:"#input-".concat(e.id,"::placeholder { font-size: 11px; }")}),(0,a.jsx)("input",{id:"input-".concat(e.id),type:"text",className:"w-full py-2 px-3 border border-gray-300 dark:border-border rounded-lg bg-white dark:bg-surface text-gray-800 dark:text-ink-primary placeholder:text-gray-400 dark:placeholder:text-ink-muted focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude/30 focus:border-blue-500 dark:focus:border-claude transition-all duration-200",placeholder:e.placeholder,onKeyDown:r=>{if("Enter"===r.key&&r.currentTarget.value.trim()){r.preventDefault();let a=r.currentTarget.value.trim(),s=e.value?e.value.split(";").filter(e=>e.trim()):[];if(s.length>=50){t(d("editor.maxUrlsInline",{max:50}),"error");return}let l=[...s,a].join(";");C(w.map(t=>t.id===e.id?{...t,value:l}:t)),r.currentTarget.value=""}},onBlur:r=>{if(r.currentTarget.value.trim()){let a=r.currentTarget.value.trim(),s=e.value?e.value.split(";").filter(e=>e.trim()):[];if(s.length>=50){t(d("editor.maxUrlsInline",{max:50}),"error");return}let l=[...s,a].join(";");C(w.map(t=>t.id===e.id?{...t,value:l}:t)),r.currentTarget.value=""}}})," ",(0,a.jsx)("input",{ref:J,type:"file",accept:".csv",onChange:Q,className:"hidden"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.click()},className:"flex items-center gap-1.5 mx-2 px-3 py-2 text-sm border border-gray-300 dark:border-border rounded-lg text-gray-700 dark:text-ink-primary hover:bg-gray-50 dark:hover:bg-surface-active transition-colors whitespace-nowrap",children:[(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),d("editor.importCsv")]})]}),(0,a.jsx)("div",{className:"border border-gray-200 dark:border-border rounded-lg p-3 bg-gray-50 dark:bg-surface h-[160px] overflow-y-auto",children:e.value&&e.value.split(";").filter(e=>e.trim()).length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:e.value.split(";").filter(e=>e.trim()).map((t,r)=>(0,a.jsxs)("div",{className:"group flex items-center gap-2 bg-blue-50 dark:bg-orange-900/20 border border-gray-300 dark:border-orange-500/30 rounded-lg px-3 py-1.5 hover:border-gray-400 dark:hover:border-orange-500/50 transition-all duration-200 shadow-sm",children:[(0,a.jsx)("span",{className:"text-sm text-gray-700 dark:text-ink-primary max-w-[480px] truncate",children:t.trim()}),(0,a.jsx)("button",{onClick:()=>{let t=e.value.split(";").filter(e=>e.trim());t.splice(r,1),C(w.map(r=>r.id===e.id?{...r,value:t.join(";")}:r))},className:"flex-shrink-0 text-gray-400 dark:text-ink-muted hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-full p-0.5 transition-all duration-200",children:(0,a.jsx)(n.A,{className:"w-3.5 h-3.5"})})]},r))}):(0,a.jsx)("div",{className:"text-sm text-gray-400 dark:text-ink-muted text-center py-8",children:d("editor.noUrls")})}),e.value&&e.value.split(";").filter(e=>e.trim()).length>0&&(0,a.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-gray-500 dark:text-ink-muted",children:d("editor.urlsAdded",{count:e.value.split(";").filter(e=>e.trim()).length,max:50})}),(0,a.jsx)("button",{onClick:()=>C(w.map(t=>t.id===e.id?{...t,value:""}:t)),className:"text-xs text-red-500 hover:text-red-700 hover:underline transition-colors duration-200",children:d("editor.removeAll")})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("style",{children:"#input-".concat(e.id,"::placeholder { font-size: 11px; }")}),(0,a.jsx)("input",{type:"text",id:"input-".concat(e.id),className:"flex-1 py-2 px-3 border border-gray-300 dark:border-border rounded-lg bg-white dark:bg-surface text-gray-800 dark:text-ink-primary placeholder:text-gray-400 dark:placeholder:text-ink-muted focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude/30 focus:border-blue-500 dark:focus:border-claude transition-all duration-200",placeholder:d("variables.".concat(e.id,".placeholder"),{defaultValue:e.placeholder}),value:e.value,onChange:t=>{C(w.map(r=>r.id===e.id?{...r,value:t.target.value}:r))}})]})]},e.id))})]}),(0,a.jsxs)("div",{className:"mb-8 bg-white dark:bg-surface-elevated rounded-xl border border-gray-200 dark:border-border shadow-sm",children:[(0,a.jsxs)("div",{className:"border-b border-gray-200 dark:border-border px-4 py-3",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary",children:d("editor.userPrompt")}),(0,a.jsx)("p",{className:"text-sm text-gray-600 dark:text-ink-secondary mt-1",children:d("editor.userPromptHint")})]}),(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)("textarea",{value:f,onChange:e=>v(e.target.value),className:"w-full p-4 resize-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude/30 focus:border-blue-500 dark:focus:border-claude border-0 font-mono transition-all duration-200 bg-white dark:bg-surface-elevated text-gray-900 dark:text-ink-primary placeholder:text-gray-400 dark:placeholder:text-ink-muted",placeholder:'Before writing:\n- Check if the product is a pajama set (pajama top + pajama bottom sold together).\n- If it is a pajama set, mention both "pijama \xfcst\xfc" and "pijama altı" in the description naturally.\n- If it is not a set, do NOT mention "pijama \xfcst\xfc" or "pijama altı"; just write the description for the single product as usual.\n- Use the exact product title in the first sentence.\n- Do NOT start with generic phrases like:\n - "Suwen koleksiyonunun bir par\xe7asıâ¦"\n - "Bu pijama takımıâ¦"\n - "Bu \xfcr\xfcnâ¦"\n\nWriting Style:\n- Description must be simple, fluent, and natural.\n- Do NOT exaggerate or use decorative adjectives like "b\xfcy\xfcleyici", "kusursuz", "m\xfckemmel" etc.\n- Avoid poetic or emotional language; be clear and explanatory.\n- Avoid long sentences.\n- Length: 100-150 words.\n- Output language: Turkish (all text must be in Turkish).\n\nMandatory Information (all must be included in the description and noted as separate bullet points before writing):\n- Form: e.g., âbalconetteâ, âbraletteâ, âv-neckâ\n- Cut/Fit: relaxed, loose, tight, shaping, body-hugging\n- Details: lace, tulle, see-through, padded/with straps\n- Usage Info: adjustable straps, lined, see-through\n- Color & Pattern: minimal pattern, solid, floral, etc.\nFashion Terms should be used in an understandable way\nBullet Output language: Turkish (all text must be in Turkish).\n\nProhibited Information:\n- Fabric or material details must NOT be included.\n\nTask:\n1. Analyze the product HTML content and extract all relevant details.\n2. List all mandatory information as separate bullet points before writing the description.\n3. Create a concise, clear, and explanatory Turkish product description that naturally incorporates all the mandatory points.\
1n4. Mention the brand name "Suwen" only once.\n5. Output ONLY the Turkish product description.\n\nIf the product is basic, do not exaggerate the text.',style:{lineHeight:"1.5",fontSize:"14px",height:"calc(100vh - 700px)",minHeight:"200px",maxHeight:"200px"}})})]}),(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-xl border border-gray-200 dark:border-border shadow-sm",children:[(0,a.jsxs)("div",{className:"border-b border-gray-200 dark:border-border px-4 py-3",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary",children:d("editor.systemPrompt")}),(0,a.jsx)("p",{className:"text-sm text-gray-600 dark:text-ink-secondary mt-1",children:d("editor.systemPromptHint")})]}),(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)("textarea",{value:p,onChange:e=>b(e.target.value),className:"w-full p-4 resize-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude/30 focus:border-blue-500 dark:focus:border-claude border-0 font-mono transition-all duration-200 bg-white dark:bg-surface-elevated text-gray-900 dark:text-ink-primary placeholder:text-gray-400 dark:placeholder:text-ink-muted",placeholder:d("editor.systemPromptPlaceholder"),style:{lineHeight:"1.5",fontSize:"14px",height:"400px",minHeight:"150px"}})})]})]})})});return(0,a.jsxs)("div",{className:"flex flex-col h-screen bg-gray-25 dark:bg-surface",style:{fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif'},children:[(0,a.jsx)(td,{}),(0,a.jsx)(e=>{let{currentStep:t,isGenerating:r,hasFreshResults:s}=e,l=()=>{var e,t,r;let a=(null===(e=w.find(e=>"urls"===e.id))||void 0===e?void 0:e.value)||"",s=(null===(t=w.find(e=>"startTag"===e.id))||void 0===t?void 0:t.value)||"",l=(null===(r=w.find(e=>"endTag"===e.id))||void 0===r?void 0:r.value)||"";return 1===a.split(";").filter(e=>e.trim()).length&&s&&l};return(0,a.jsxs)("div",{className:"border-b border-gray-200 dark:border-border px-8 pt-8 pb-6 bg-white dark:bg-surface-elevated",children:[(0,a.jsx)("div",{className:"flex items-start mb-1",children:(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)("div",{className:"flex items-start justify-between max-w-4xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center cursor-pointer",onClick:()=>{M("ai-selection"),D(!1)},children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full ".concat(1===t?"bg-blue-500 dark:bg-orange-500 text-white":t>1?"bg-green-500 text-white":"bg-gray-200 dark:bg-surface-active text-gray-500 dark:text-ink-muted"," font-medium z-10 mb-1"),children:"1"}),(0,a.jsx)("div",{className:"text-sm font-medium ".concat(1===t?"text-blue-500 dark:text-orange-400":t>1?"text-green-600 dark:text-green-400":"text-gray-500 dark:text-ink-muted"),children:d("steps.ai")})]}),(0,a.jsx)("div",{className:"w-16 h-0.5 ".concat(t>=2?"bg-blue-200 dark:bg-claude/30":"bg-gray-200 dark:bg-border"," mt-4")}),(0,a.jsxs)("div",{className:"flex flex-col items-center cursor-pointer",onClick:()=>{M("prompt-editor"),D(!1)},children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full ".concat(2===t?"bg-blue-500 dark:bg-orange-500 text-white":t>2?"bg-green-500 text-white":"bg-gray-200 dark:bg-surface-active text-gray-500 dark:text-ink-muted"," font-medium z-10 mb-1"),children:"2"}),(0,a.jsx)("div",{className:"text-sm font-medium ".concat(2===t?"text-blue-500 dark:text-orange-400":t>2?"text-green-600 dark:text-green-400":"text-gray-500 dark:text-ink-muted"),children:d("steps.prompt")})]}),(0,a.jsx)("div",{className:"w-16 h-0.5 ".concat(t>=3?"bg-blue-200 dark:bg-claude/30":"bg-gray-200 dark:bg-border"," mt-4")}),(0,a.jsxs)("div",{className:"flex flex-col items-center ".concat(l()&&R?"cursor-pointer":"cursor-not-allowed"," ").concat(l()?"":"opacity-40"),onClick:()=>{l()&&R&&(M("image-generation"),D(!0))},children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full ".concat(3===t?"bg-blue-500 dark:bg-orange-500 text-white":t>3?"bg-green-500 text-white":"bg-gray-200 dark:bg-surface-active text-gray-500 dark:text-ink-muted"," font-medium z-10 mb-1"),children:"3"}),(0,a.jsx)("div",{className:"text-sm font-medium ".concat(3===t?"text-blue-500 dark:text-orange-400":t>3?"text-green-600 dark:text-green-400":"text-gray-500 dark:text-ink-muted"),children:d("steps.images")})]}),(0,a.jsx)("div",{className:"w-16 h-0.5 ".concat(t>=4?"bg-blue-200 dark:bg-claude/30":"bg-gray-200 dark:bg-border"," mt-4")}),(0,a.jsxs)("div",{className:"flex flex-col items-center ".concat(s&&!r?"curs
1or-pointer":"cursor-not-allowed opacity-50"),onClick:()=>{s&&!r&&(M("results"),D(!0))},children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-8 h-8 rounded-full ".concat(4===t?"bg-blue-500 dark:bg-orange-500 text-white":t>4?"bg-green-500 text-white":"bg-gray-200 dark:bg-surface-active text-gray-500 dark:text-ink-muted"," font-medium z-10 mb-1"),children:"4"}),(0,a.jsx)("div",{className:"text-sm font-medium ".concat(4===t?"text-blue-500 dark:text-orange-400":t>4?"text-green-600 dark:text-green-400":"text-gray-500 dark:text-ink-muted"),children:d("steps.results")})]})]})})}),(0,a.jsx)("div",{className:"text-sm text-blue-500 dark:text-orange-400 mt-1 text-center",children:1===t?d("steps.hint1"):2===t?d("steps.hint2"):3===t?l()?d("steps.hint3"):d("steps.hint3Skipped"):d("steps.hint4")})]})},{currentStep:"ai-selection"===L?1:"prompt-editor"===L?2:"image-generation"===L?3:4,isGenerating:h||_,hasFreshResults:x}),(0,a.jsx)("div",{className:"border-b border-gray-200 dark:border-border px-8 py-6 bg-white dark:bg-surface-elevated",children:(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold dark:text-ink-primary",children:"ai-selection"===L?d("header.step1"):"prompt-editor"===L?d("header.step2"):"image-generation"===L?d("header.step3"):d("header.step4")}),"results"===L&&o&&(0,a.jsxs)(u.$n,{onClick:()=>j(!0),variant:"outline",size:"sm",className:"flex items-center",children:[(0,a.jsx)(ef.A,{className:"w-4 h-4 mr-2"}),d("header.shareWithTeam")]})]})}),(0,a.jsx)("div",{className:"flex-1 overflow-hidden",children:I?(0,a.jsxs)(eH.YZ,{direction:"horizontal",children:[(0,a.jsx)(eH.Zk,{defaultSize:50,minSize:30,maxSize:80,className:"flex flex-col",children:"ai-selection"===L?er():ei()}),(0,a.jsxs)(eH.TW,{className:"w-1 bg-gray-300 dark:bg-border hover:bg-blue-500 dark:hover:bg-claude cursor-col-resize transition-colors duration-200 relative group",children:[(0,a.jsx)("div",{className:"absolute inset-y-0 -inset-x-1"}),(0,a.jsx)("div",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-1 h-8 rounded-full bg-gray-400 opacity-0 group-hover:opacity-100 group-hover:bg-blue-600 transition-all duration-200"})]}),(0,a.jsx)(eH.Zk,{defaultSize:50,minSize:20,className:"bg-white dark:bg-surface border-l border-gray-200 dark:border-border",children:"image-generation"===L?et():en()})]}):(0,a.jsx)("div",{className:"h-full",children:"ai-selection"===L?er():"prompt-editor"===L?ei():"image-generation"===L?et():en()})}),(0,a.jsx)(e=>{let{handleRun:t,view:r,selectedModels:s,isGenerating:l=!1,onStop:i}=e;return(0,a.jsxs)("div",{className:"h-15 border-t border-gray-200 dark:border-border px-8 flex items-center justify-between bg-gray-50 dark:bg-surface-elevated mb-8",children:[(0,a.jsxs)("div",{className:"text-sm text-gray-600 dark:text-ink-secondary",children:[(0,a.jsx)("span",{className:"font-medium",children:d("footer.selectedModels",{count:s.length})})," ",s&&0!==s.length?s.map(e=>{let t=B.find(t=>t.tag===e);return t?t.name:e}).join(", "):d("footer.noneSelected")]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[l&&(0,a.jsxs)("button",{onClick:i,className:"px-6 py-3 bg-red-600 hover:bg-red-700 text-white rounded-lg font-medium flex items-center space-x-2 transition-all duration-200",children:[(0,a.jsx)(n.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:d("footer.stop")})]}),(0,a.jsxs)("button",{onClick:t,className:"px-6 py-3 ".concat(0===s.length?"bg-gray-400 dark:bg-surface-active cursor-not-allowed":l||_?"bg-gray-400 dark:bg-surface-active cursor-not-allowed":"bg-blue-600 dark:bg-claude hover:bg-blue-700 dark:hover:bg-claude-hover"," text-white dark:text-white rounded-lg font-medium flex items-center space-x-2 transition-all duration-200 shadow-sm"),disabled:"results"!==r&&(0===s.length||l||_),children:[(0,a.jsx)(ev.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:0===s.length?d("footer.selectModel"):l||_?d("footer.processing"):"ai-selection"===r?d("footer.continueToPrompt"):"prompt-editor"===r?d("footer.generate"):"image-generation"===r?d("footer.continueToContent"):d("footer.backToPrompt")})]})]})]})},{handleRun:ee,view:L,selectedModels:S,isGenerating:h,onStop:()=>{g(!1),D(!1)}}),V&&(0,a.jsx)("div",{ref:X,className:"relative ",children:(0,a.jsx)("div",{className:"absolute bottom-36 mb-4 left-0 right-0 mx-auto w-full max-w-3xl shadow-lg",children:(0,a.jsxs)("div",{className:"relative bg-white rounded shadow-lg",children:[(0,a.jsx)("button",{className:"absolute -top-2 -right-2 text-gray-600 hover:text-gray-900 bg-white rounded-full p-2 shadow-lg z-10 transition-colors",onClick:()=>W(!1),children:(0,a.jsx)(n.A,{className:"h-5 w-5"})}),(0,a.jsx)(eG.A,{limitType:G,onClose:()=>W(!1)})]})})}),k&&o&&(0,a.jsx)(es,{itemId:o,report:{type:"GENERATOR",name:ea()},onClose:()=>j(!1)})]})},tu=e=>{let{setToggleSidebar:t,initialData:r,initialResponse:s,recordId:l}=e,{toast:n,showToast:i}=(0,eB.Z)();return(0,a.jsxs)("div",{className:"flex bg-[#faf9f6] dark:bg-surface",children:[(0,a.jsx)(eF.A,{show:n.show,message:n.message,type:n.type}),(0,a.jsx)("div",{className:"flex-1 p-8 h-full bg-[#faf9f6] dark:bg-surface",children:(0,a.jsx)(tx,{showToast:i,setToggleSidebar:t,initialData:r,initialResponse:s,recordId:l})})]})};var tm=r(72826);let th=e=>{var t,r,l,n,i,o,d,c,m,h,g,p;let{setGlobalPromptTitle:b}
1=e,[f,v]=(0,s.useState)("all"),[y,k]=(0,s.useState)(!1),j=()=>{k(!y)};return(0,a.jsxs)("div",{className:"flex-1 px-8 h-screen",style:{backgroundColor:"#faf9f6"},children:[(0,a.jsx)("div",{className:"border-b border-gray-200 px-0 py-6 bg-white mb-8 -mx-8 px-8",children:(0,a.jsx)("div",{className:"flex justify-between items-center",children:(0,a.jsx)("div",{className:"flex items-center space-x-4",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-2xl font-semibold",children:"Skin Care Assistant"}),(0,a.jsx)("p",{className:"text-gray-600",children:"Personalized skincare recommendations powered by AI"})]})})})}),(0,a.jsx)("div",{className:"flex-1 p-8 overflow-auto",children:(0,a.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,a.jsxs)("div",{className:"mb-6 text-center",children:[(0,a.jsx)("h3",{className:"text-xl font-semibold mb-3",children:"Choose Your AI Models"}),(0,a.jsx)("p",{className:"text-gray-600",children:"Select the AI models that will power your personalized skincare recommendations."})]}),(0,a.jsxs)("div",{className:"flex space-x-1 mb-6 bg-gray-100 p-1 rounded-lg",children:[(0,a.jsx)("button",{className:"flex-1 py-2 px-4 rounded-md font-medium transition-all duration-200 ".concat("all"===f?"bg-white text-blue-600 shadow-sm":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),onClick:()=>v("all"),children:"All"}),(0,a.jsx)("button",{className:"flex-1 py-2 px-4 rounded-md font-medium transition-all duration-200 ".concat("standard"===f?"bg-white text-blue-600 shadow-sm":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),onClick:()=>v("standard"),children:"Standard"}),(0,a.jsx)("button",{className:"flex-1 py-2 px-4 rounded-md font-medium transition-all duration-200 ".concat("starred"===f?"bg-white text-blue-600 shadow-sm":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),onClick:()=>v("starred"),children:"Starred"}),(0,a.jsx)("button",{className:"flex-1 py-2 px-4 rounded-md font-medium transition-all duration-200 ".concat("trained"===f?"bg-white text-blue-600 shadow-sm":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),onClick:()=>v("trained"),children:"Trained"}),(0,a.jsx)("button",{className:"flex-1 py-2 px-4 rounded-md font-medium transition-all duration-200 ".concat("shared"===f?"bg-white text-blue-600 shadow-sm":"text-gray-600 hover:text-gray-900 hover:bg-gray-50"),onClick:()=>v("shared"),children:"Shared"})]}),(0,a.jsx)("div",{className:"text-center mb-6",children:(0,a.jsxs)("p",{className:"text-sm text-gray-600 mb-4",children:["all"===f&&"Browse all available AI models from standard LLMs to custom trained models and shared team resources.","standard"===f&&"Industry-standard AI models with proven performance across various tasks.","starred"===f&&"Your favorite AI models marked for quick access.","trained"===f&&"Custom-trained models specialized for specific domains and use cases.","shared"===f&&"AI models shared by your team members and organization."]})}),(0,a.jsxs)("div",{className:"text-center mb-8",children:[(0,a.jsx)("div",{className:"text-4xl font-bold text-gray-900 mb-1",children:+!!y}),(0,a.jsx)("div",{className:"text-sm text-gray-500 mb-1",children:"Models Selected"}),(0,a.jsx)("div",{className:"text-xs text-gray-400",children:"Select at least one AI model to continue"})]}),"all"===f&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 cursor-pointer transition-all duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(t=(0,e4.tL)("CONVOMIND"))||void 0===t?void 0:t.src,alt:"ConvoMind",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:"ConvoMind"}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"Advanced, intelligent, seamless optimization"})]}),(0,a.jsx)("div",{className:"flex items-center space-x-1",children:(0,a.jsx)(x.A,{className:"w-4 h-4 text-yellow-400 fill-current"})})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",disabled:!0})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 cursor-pointer transition-all duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(r=(0,e4.tL)("ANTHROPIC"))||void 0===r?void 0:r.src,alt:"Claude Sonnet 4",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:"Claude Sonnet 4"}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"Smart, efficient everyday intelligence"})]}),(0,a.jsx)("div",{className:"flex items-center space-x-1",children:(0,a.jsx)(x.A,{className:"w-4 h-4 text-yellow-400 fill-current"})})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",disabled:!0})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg border cursor-pointer transition-all duration-200 ".concat(y?"border-blue-500 bg-blue-100":"border-blue-200 bg-white hover:border-blue-300"),onClick:j,children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(l=(0,e4.tL)("NIVEA"))||void 0===l?void 0:l.src,alt:"NIVEA AI",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"font-medium text-gray-900 flex items-center space-x-2",children:[(0,a.jsx)("span",{children:"NIVEA"}),(0,a.jsx)("span",{className:"px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-full font-medium",children:"TRAINED"})]}),(0,a.jsx)("div",{className:"text-sm text-gray-600",children:"Specialized in NIVEA products and skincare expertise"})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",checked:y,onChange:j,className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",onClick:e=>e.stopPropagation()})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 cursor-pointer transition-all duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(n=(0,e4.tL)("OPENAI"))||void 0===n?void 0:n.src,alt:"o3",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:"o3"}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"Peak-performance logical reasoning"})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",disabled:!0})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 cursor-pointer transition-all duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(i=(0,e4.tL)("ANTHROPIC"))||void 0===i?void 0:i.src,alt:"Claude Opus 4",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:"Claude Opus 4"}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"Maximum capability, deepest understanding"})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",disabled:!0})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 cursor-pointer transition-all duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(o=(0,e4.tL)("GOOGLE"))||void 0===o?void 0:o.src,alt:"Gemini 2.5 Pro",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:"Gemini 2.5 Pro"}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"Google's most capable multimodal model"})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",disabled:!0})]})]})]}),"standard"===f&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 cursor-pointer transition-all duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(d=(0,e4.tL)("CONVOMIND"))||void 0===d?void 0:d.src,alt:"ConvoMind",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:"ConvoMind"}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"Advanced, intelligent, seamless optimization"})]}),(0,a.jsx)("div",{className:"flex items-center space-x-1",children:(0,a.jsx)(x.A,{className:"w-4 h-4 text-yellow-400 fill-current"})})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",disabled:!0})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 cursor-pointer transition-all duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(c=(0,e4.tL)("ANTHROPIC"))||void 0===c?void 0:c.src,alt:"Claude Sonnet 4",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:"Claude Sonnet 4"}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"Smart, efficient everyday intelligence"})]}),(0,a.jsx)("div",{className:"flex items-center space-x-1",children:(0,a.jsx)(x.A,{className:"w-4 h-4 text-yellow-400 fill-current"})})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",disabled:!0})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 cursor-pointer transition-all duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(m=(0,e4.tL)("OPENAI"))||void 0===m?void 0:m.src,alt:"o3",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:"o3"}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"Peak-performance logical reasoning"})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",disabled:!0})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 cursor-pointer transition-all duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(h=(0,e4.tL)("ANTHROPIC"))||void 0===h?void 0:h.src,alt:"Claude Opus 4",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:"Claude Opus 4"}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"Maximum capability, deepest understanding"})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",disabled:!0})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-gray-200 hover:border-gray-300 cursor-pointer transition-all duration-200",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(g=(0,e4.tL)("GOOGLE"))||void 0===g?void 0:g.src,alt:"Gemini 2.5 Pro",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-gray-900",children:"Gemini 2.5 Pro"}),(0,a.jsx)("div",{className:"text-sm text-gray-500",children:"Google's most capable multimodal model"})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",disabled:!0})]})]})]}),"starred"===f&&(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(x.A,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No starred models yet"}),(0,a.jsx)("p",{className:"text-gray-500",children:"Star models from other tabs to see them here"})]}),"trained"===f&&(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsxs)("div",{className:"flex items-center justify-between p-4 rounded-lg border cursor-pointer transition-all duration-200 ".concat(y?"border-blue-500 bg-blue-100":"border-blue-200 bg-white hover:border-blue-300"),onClick:j,children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("img",{src:null===(p=(0,e4.tL)("NIVEA"))||void 0===p?void 0:p.src,alt:"NIVEA AI",className:"w-10 h-10 rounded-lg"}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"font-medium text-gray-900 flex items-center space-x-2",children:[(0,a.jsx)("span",{children:"NIVEA"}),(0,a.jsx)("span",{className:"px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-full font-medium",children:"TRAINED"})]}),(0,a.jsx)("div",{className:"text-sm text-gray-600",children:"Specialized in NIVEA products and skincare expertise"})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("button",{className:"p-1 rounded text-gray-300 hover:text-yellow-500",children:(0,a.jsx)(x.A,{className:"w-4 h-4"})}),(0,a.jsx)("input",{type:"checkbox",checked:y,onChange:j,className:"w-4 h-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500",onClick:e=>e.stopPropagation()})]})]})}),"shared"===f&&(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(tm.A,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No shared models"}),(0,a.jsx)("p",{className:"text-gray-500",chi
1ldren:"Team members haven't shared any models yet"})]})]})}),(0,a.jsx)("div",{className:"fixed bottom-0 left-0 right-0 px-8 py-4 bg-[#faf9f6] shadow-lg z-10",children:(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsxs)(u.$n,{onClick:()=>{y&&b("NIVEA Analysis")},disabled:!y,className:"px-6 py-3 text-white rounded-lg font-medium flex items-center space-x-2 transition-all duration-200 shadow-sm",children:[(0,a.jsx)(ev.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Select Models"})]})})})]})};var tg=r(28067),tp=r(92368);let tb=()=>{var e,t,r;let[l,n]=(0,s.useState)("welcome"),[i,o]=(0,s.useState)(null),[d,c]=(0,s.useState)(0),[x,u]=(0,s.useState)({}),[m,h]=(0,s.useState)(null),[g,p]=(0,s.useState)(!1),b=[{id:"skinType",question:"How would you describe your skin type?",options:["Oily - Shiny appearance, large pores","Dry - Tight feeling, flaking","Combination - Oily T-zone, dry cheeks","Normal - Balanced, problem-free","Sensitive - Redness, irritation tendency"]},{id:"ageRange",question:"What is your age range?",options:["18-25 years","26-35 years","36-45 years","46-55 years","55+ years"]},{id:"mainConcern",question:"What is your main skin concern?",options:["Acne and blemishes","Wrinkles and aging signs","Uneven skin tone and dark spots","Pore appearance","Dryness and lack of moisture","Sensitivity and redness"]},{id:"dailyRoutine",question:"What is your daily skincare routine like?",options:["Just wash with water","Use soap only","Cleanser and moisturizer","Full routine (cleanser, toner, serum, moisturizer)","Irregular skincare"]},{id:"sunProtection",question:"How do you use sunscreen?",options:["Daily regular use","Only in summer","Only when going to the beach","Sometimes when I remember","Never use it"]}],f=[...b,{id:"skinSensitivity",question:"Do you experience allergic reactions on your skin?",options:["Yes, frequently","Sometimes, with certain products","Rarely","Never","Not sure"]},{id:"lifestyle",question:"How would you describe your lifestyle?",options:["Very stressful, irregular sleep","Moderately stressful, normal sleep","Regular and calm","Very active, I exercise","Office work, little movement"]},{id:"dietHabits",question:"What are your eating habits like?",options:["Very healthy, organic products","Try to eat balanced","Fast food heavy","Irregular meal times","Lots of sugary/processed foods"]},{id:"waterIntake",question:"How much water do you drink daily?",options:["2+ liters","1.5-2 liters","1-1.5 liters","Less than 1 liter","Only when thirsty"]},{id:"sleepPattern",question:"How is your sleep pattern?",options:["7-8 hours regular sleep","6-7 hours, sometimes irregular","5-6 hours, frequent waking","Less than 5 hours","Very irregular sleep"]},{id:"hormonalChanges",question:"Do hormonal changes affect your skin?",options:["Yes, during menstrual cycle","During pregnancy/menopause","During stressful times","Haven't noticed","Not applicable as male"]},{id:"environmentalFactors",question:"Which environmental factors are you exposed to?",options:["City pollution","Air-conditioned environments","Very sunny climate","Windy/cold weather","Clean natural environment"]},{id:"currentProducts",question:"What products are you currently using?",options:["No special products","Store brands","Pharmacy products","Premium brands","Natural/organic products"]},{id:"budgetRange",question:"What is your budget range for skincare?",options:["Under $15","$15-45","$45-90","$90-150","Over $150"]},{id:"timeForRoutine",question:"How much time can you dedicate to skincare?",options:["1-2 minutes","3-5 minutes","5-10 minutes","10-15 minutes","15+ minutes"]}],v="short"===i?b:f,y=e=>{o(e),n("questionnaire"),c(0),u({})},k=()=>m?{skinType:"Based on your photo, you appear to have combination skin",concerns:["Some redness detected in T-zone area","Slight dryness visible on cheek area"],recommendations:["Focus on gentle cleansing","Use targeted moisturizing"]}:null,j=e=>{u({...x,[v[d].id]:e}),d<v.length-1?c(d+1):n("photo-upload")},N=()=>{let e=x.skinType;return(null==e?void 0:e.includes("Oily"))?{name:"Nivea Deep Clean",price:"$11.99",image:"\uD83E\uDDFC",desc:"Perfect for oily skin control"}:(null==e?void 0:e.includes("Dry"))?{name:"Nivea Rich Nourish",price:"$14.99",image:"\uD83E\uDD65",desc:"Intensive dry skin care"}:(null==e?void 0:e.includes("Sensitive"))?{name:"Nivea Sensitive Care",price:"$13.99",image:"\uD83C\uDF38",desc:"Gentle formula for sensitive skin"}:{name:"Nivea Daily Essential",price:"$12.99",image:"\uD83D\uDC8E",desc:"All-in-one skincare solution"}};if("welcome"===l)return(0,a.jsx)("div",{className:"overflow-y-auto h-full",children:(0,a.jsxs)("div",{className:"min-h-screen bg-blue-50/30",children:[(0,a.jsxs)("div",{className:"relative bg-gradient-to-br from-blue-500 via-blue-600 to-blue-700 overflow-hidden",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-400/20 to-transparent"}),(0,a.jsx)("div",{className:"absolute top-0 left-1/4 w-96 h-96 bg-white/5 rounded-full blur-3xl"}),(0,a.jsx)("div",{className:"absolute bottom-0 right-1/4 w-80 h-80 bg-blue-300/10 rounded-full blur-3xl"}),(0,a.jsx)("div",{className:"relative max-w-6xl mx-auto px-4 sm:px-6 py-8 sm:py-12 lg:py-16 z-10",children:(0,a.jsxs)("div",{className:"flex items-center space-x-4 sm:sp
1ace-x-6",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"w-16 h-16 sm:w-16 sm:h-16 bg-transparent flex items-center justify-center",children:(0,a.jsx)("div",{className:"w-16 h-16 sm:w-16 sm:h-16 bg-transparent rounded-xl sm:rounded-2xl flex items-center justify-center shadow-inner",children:(0,a.jsx)("img",{src:null===(e=(0,e4.tL)("NIVEA"))||void 0===e?void 0:e.src,alt:"nivea",className:"w-20 h-20 flex-shrink-0"})})}),(0,a.jsx)("div",{className:"absolute -inset-1 bg-gradient-to-br from-blue-400/20 to-transparent rounded-2xl sm:rounded-3xl blur-lg"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl sm:text-4xl font-light text-white tracking-tight",children:"NIVEA"}),(0,a.jsx)("p",{className:"text-lg sm:text-xl text-blue-100 font-light",children:"Skin Analysis"}),(0,a.jsx)("p",{className:"text-sm sm:text-base text-blue-200/80 mt-1",children:"Discover personalized skincare recommendations"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 mt-2 sm:mt-3",children:[(0,a.jsx)("span",{className:"text-blue-300/70 text-xs sm:text-sm",children:"Powered by"}),(0,a.jsx)("span",{className:"text-white font-medium text-xs sm:text-sm",children:"ConvoMind.ai"})]})]})]})})]}),(0,a.jsxs)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-8 sm:py-16",children:[(0,a.jsxs)("div",{className:"text-center mb-12 sm:mb-16",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 sm:w-20 sm:h-20",children:(0,a.jsx)("img",{src:"/nivea/acne.png",alt:"Acne",className:"w-16 h-16 sm:w-20 sm:h-20 object-cover"})}),(0,a.jsxs)("h2",{className:"text-3xl sm:text-5xl font-light text-gray-900 mb-4 sm:mb-6 tracking-tight",children:["Let's Discover",(0,a.jsx)("br",{}),(0,a.jsx)("span",{className:"text-blue-500",children:"Your Skin"})]}),(0,a.jsx)("p",{className:"text-lg sm:text-xl text-gray-600 max-w-2xl mx-auto leading-relaxed px-4",children:"Choose your preferred analysis type to receive personalized NIVEA product recommendations tailored specifically to your skin's unique needs."})]}),(0,a.jsxs)("div",{className:"grid lg:grid-cols-2 gap-6 sm:gap-8 max-w-4xl mx-auto",children:[(0,a.jsxs)("div",{className:"group relative bg-white rounded-2xl sm:rounded-[2.5rem] p-6 sm:p-8 shadow-2xl shadow-blue-500/10 border border-gray-100 hover:shadow-3xl hover:shadow-blue-500/20 transition-all duration-700 hover:-translate-y-2",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/50 to-transparent rounded-2xl sm:rounded-[2.5rem] opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 sm:mb-6",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-12 h-12 sm:w-16 sm:h-16",children:(0,a.jsx)("img",{src:"/nivea/hourglass.png",alt:"Hourglass",className:"w-12 h-12 sm:w-16 sm:h-16 object-cover"})}),(0,a.jsx)("div",{className:"px-3 py-1 sm:px-4 sm:py-2 bg-blue-50 rounded-full",children:(0,a.jsx)("span",{className:"text-xs sm:text-sm font-medium text-blue-600",children:"5 Questions"})})]}),(0,a.jsx)("h3",{className:"text-xl sm:text-2xl font-semibold text-gray-900 mb-2 sm:mb-3",children:"Quick Analysis"}),(0,a.jsx)("p",{className:"text-sm sm:text-base text-gray-600 mb-6 sm:mb-8 leading-relaxed",children:"Fast and efficient skin assessment focusing on essential factors for immediate recommendations."}),(0,a.jsx)("div",{className:"space-y-3 sm:space-y-4 mb-6 sm:mb-8",children:["Completed in 20-30 seconds","Basic skin type analysis","General product recommendations","Optional photo enhancement"].map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-gradient-to-r from-blue-500 to-blue-600 rounded-full flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm sm:text-base text-gray-700",children:e})]},t))}),(0,a.jsxs)("button",{onClick:()=>y("short"),className:"w-full bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white px-6 sm:px-8 py-3 sm:py-4 rounded-xl sm:rounded-2xl font-medium transition-all duration-300 transform group-hover:scale-105 shadow-xl hover:shadow-2xl flex items-center justify-center space-x-3 touch-manipulation",children:[(0,a.jsx)("span",{className:"text-sm sm:text-base",children:"Start Quick Analysis"}),(0,a.jsx)(tg.A,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform group-hover:translate-x-1"})]})]})]}),(0,a.jsxs)("div",{className:"group relative bg-white rounded-2xl sm:rounded-[2.5rem] p-6 sm:p-8 shadow-2xl shadow-purple-500/10 border border-gray-100 hover:shadow-3xl hover:shadow-
1purple-500/20 transition-all duration-700 hover:-translate-y-2",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-50/50 to-transparent rounded-2xl sm:rounded-[2.5rem] opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 sm:mb-6",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-12 h-12 sm:w-16 sm:h-16",children:(0,a.jsx)("img",{src:"/nivea/pigment.png",alt:"Pigment",className:"w-12 h-12 sm:w-16 sm:h-16 object-cover"})}),(0,a.jsx)("div",{className:"px-3 py-1 sm:px-4 sm:py-2 bg-purple-50 rounded-full",children:(0,a.jsx)("span",{className:"text-xs sm:text-sm font-medium text-purple-700",children:"15 Questions"})})]}),(0,a.jsx)("h3",{className:"text-xl sm:text-2xl font-semibold text-gray-900 mb-2 sm:mb-3",children:"Detailed Analysis"}),(0,a.jsx)("p",{className:"text-sm sm:text-base text-gray-600 mb-6 sm:mb-8 leading-relaxed",children:"Comprehensive assessment including lifestyle factors for highly personalized recommendations."}),(0,a.jsx)("div",{className:"space-y-3 sm:space-y-4 mb-6 sm:mb-8",children:["Completed in 2-3 minutes","Comprehensive lifestyle analysis","Highly personalized recommendations","Optional photo enhancement"].map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-gradient-to-r from-purple-500 to-purple-600 rounded-full flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm sm:text-base text-gray-700",children:e})]},t))}),(0,a.jsxs)("button",{onClick:()=>y("long"),className:"w-full bg-gradient-to-r from-purple-500 to-purple-600 hover:from-purple-600 hover:to-purple-700 text-white px-6 sm:px-8 py-3 sm:py-4 rounded-xl sm:rounded-2xl font-medium transition-all duration-300 transform group-hover:scale-105 shadow-xl hover:shadow-2xl flex items-center justify-center space-x-3 touch-manipulation",children:[(0,a.jsx)("span",{className:"text-sm sm:text-base",children:"Start Detailed Analysis"}),(0,a.jsx)(tg.A,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform group-hover:translate-x-1"})]})]})]}),2===d&&(0,a.jsx)("div",{className:"mt-8 sm:mt-12 max-w-md mx-auto",children:(0,a.jsx)("div",{className:"bg-gradient-to-br from-blue-50 to-blue-100 rounded-2xl p-6 border border-blue-200",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-3xl mb-3",children:N().image}),(0,a.jsx)("h4",{className:"font-semibold text-gray-900 mb-1",children:N().name}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-2",children:N().desc}),(0,a.jsx)("p",{className:"text-blue-600 font-bold mb-3",children:N().price}),(0,a.jsx)("p",{className:"text-xs text-blue-700 bg-white/70 px-3 py-1 rounded-full inline-block",children:"Complete your analysis for personalized recommendations!"})]})})})]}),(0,a.jsxs)("div",{className:"mt-16 sm:mt-20",children:[(0,a.jsxs)("div",{className:"text-center mb-8 sm:mb-12",children:[(0,a.jsx)("h3",{className:"text-2xl sm:text-3xl font-light text-gray-900 mb-4",children:"Find Out Your Skin Type and Determine the Right Skincare for You"}),(0,a.jsx)("p",{className:"text-gray-600",children:"Expert guides to help you understand your skin better"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6 sm:gap-8 max-w-5xl mx-auto",children:[{category:"Body",title:"Best Foods for Skin",description:"Discover how a balanced diet can help you achieve healthy skin.",image:"/nivea/BestFood.png",bgColor:"from-orange-50 to-orange-100",borderColor:"border-orange-200",buttonColor:"from-orange-600 to-orange-700 hover:from-orange-700 hover:to-orange-800"},{category:"Skin",title:"Skin Purging",description:"Our guide to help you understand how long does skin purging last & what does skin purging look like, as well as purging skin advice.",image:"/nivea/SkinPurging.png",bgColor:"from-purple-50 to-purple-100",borderColor:"border-purple-200",buttonColor:"from-purple-600 to-purple-700 hover:from-purple-700 hover:to-purple-800"},{category:"Face",title:"Beauty Facts and Myths",description:"Time to do away with outdated myths! Discover the truth.",image:"/nivea/BeautyFacts.png",bgColor:"from-pink-50 to-pink-100",borderColor:"border-pink-200",buttonColor:"from-pink-600 to-pink-700 hover:from-pink-700 hover:to-pink-800"},{category:"Face",title:"Skincare Analysis Online",description:"Discover the perfect products for your skin type by completing our quick & easy skincare analysis survey, and receive results tailored to you.",image:"/nivea/SkinCare.png",bgColor:"from-blue-50 to-blue-100",borderColor:"border-blue-200",buttonColor:"from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700"}].map((e,t)=>(0,a.jsx)("div",{className:"group bg-gradient-to-br ".concat(e.bgColor," rounded-2xl sm:rounded-3xl p-6 sm:p-8 shadow-lg hover:shadow-xl transition-all duration-300 border ").concat(e.borderColor," hover:-translate-y-1 cursor-pointer"),children:(0,a.jsx)("div",{className:"flex flex-col h-full",children:(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("span",{className:"inline-block px-3 py-1 bg-white/70 text-gray-700 text-xs sm:text-sm font-medium rounded-full mb-3",children:e.category}),(0,a.jsx)("div",{className:"w-full h-full mb-4 rounded-xl overflow-hidden",children:(0,a.jsx)("img",{onClick:()=>{console.log("test")},src:e.image,alt:e.title,className:"w-full h-full object-fit transition-transform duration-300 group-hover:scale-110"})})]})})},t))})]})]})]})});if("questionnaire"===l){let e=v[d],r=(d+1)/v.length*100;return(0,a.jsxs)("div",{className:"min-h-screen bg-blue-50/30",children:[(0,a.jsxs)("div",{className:"relative bg-gradient-to-br from-blue-500 via-blue-600 to-blue-700 overflow-hidden",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-400/20 to-transparent"}),(0,a.jsxs)("div",{className:"relative max-w-5xl mx-auto px-4 sm:px-6 py-6 sm:py-8",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3 sm:space-x-6",children:[(0,a.jsx)("button",{onClick:()=>{d>0?c(d-1):n("welcome")},className:"w-10 h-10 sm:w-12 sm:h-12 bg-white/10 backdrop-blur-xl rounded-xl sm:rounded-2xl flex items-center justify-center hover:bg-white/20 transition-all border border-white/20 touch-manipulation",children:(0,a.jsx)(tp.A,{className:"w-5 h-5 sm:w-6 sm:h-6 text-white"})}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)("div",{className:"w-8 h-8 sm:w-10 sm:h-10 bg-transparent rounded-lg sm:rounded-xl flex items-center justify-center ",children:(0,a.jsx)("div",{className:"w-8 h-8 sm:w-10 sm:h-10 bg-transparent roun
1ded-md sm:rounded-lg flex items-center justify-center shadow-inner",children:(0,a.jsx)("img",{src:null===(t=(0,e4.tL)("NIVEA"))||void 0===t?void 0:t.src,alt:"nivea",className:"w-20 h-20 flex-shrink-0"})})})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl sm:text-2xl font-light text-white tracking-tight",children:"NIVEA"}),(0,a.jsxs)("p",{className:"text-sm sm:text-base text-blue-200 mt-1",children:["Question ",d+1," of ",v.length]}),(0,a.jsx)("div",{className:"flex items-center space-x-2 mt-1 sm:mt-2",children:(0,a.jsx)("span",{className:"text-blue-200 text-xs",children:"by ConvoMind.ai"})})]})]})]}),(0,a.jsx)("div",{className:"px-3 py-1 sm:px-4 sm:py-2 bg-white/10 backdrop-blur-xl rounded-full border border-white/20",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"text-white text-xs sm:text-sm font-medium",children:["short"===i?"Quick":"Detailed"," Analysis"]}),(0,a.jsx)("span",{className:"ml-2 mt-1 text-white/70 text-xs",children:"NIVEA"})]})})]}),(0,a.jsx)("div",{className:"mt-6 sm:mt-8",children:(0,a.jsx)("div",{className:"w-full bg-white/20 rounded-full h-1.5 backdrop-blur-sm",children:(0,a.jsx)("div",{className:"bg-white h-1.5 rounded-full transition-all duration-700 shadow-lg",style:{width:"".concat(r,"%")}})})})]})]}),(0,a.jsx)("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 py-8 sm:py-16",children:(0,a.jsxs)("div",{className:"bg-white rounded-2xl sm:rounded-[3rem] shadow-2xl p-6 sm:p-12 border border-gray-100",children:[(0,a.jsx)("h2",{className:"text-2xl sm:text-4xl font-light text-gray-900 mb-8 sm:mb-12 text-center leading-tight tracking-tight",children:e.question}),(0,a.jsx)("div",{className:"space-y-3 sm:space-y-4 max-w-2xl mx-auto",children:e.options.map((e,t)=>(0,a.jsx)("button",{onClick:()=>j(e),className:"group w-full p-4 sm:p-6 text-left bg-gray-50/80 hover:bg-blue-50 border border-gray-200/60 hover:border-blue-400 rounded-xl sm:rounded-2xl transition-all duration-300 transform hover:scale-[1.02] hover:shadow-xl touch-manipulation",children:(0,a.jsxs)("div",{className:"flex items-center space-x-3 sm:space-x-4",children:[(0,a.jsx)("div",{className:"w-5 h-5 sm:w-6 sm:h-6 border-2 border-gray-300 group-hover:border-blue-400 rounded-full flex items-center justify-center transition-colors flex-shrink-0",children:(0,a.jsx)("div",{className:"w-2 h-2 sm:w-2.5 sm:h-2.5 bg-blue-500 rounded-full opacity-0 group-hover:opacity-100 transition-opacity"})}),(0,a.jsx)("span",{className:"text-sm sm:text-base text-gray-800 group-hover:text-blue-900 font-medium leading-relaxed",children:e})]})},t))})]})})]})}if("photo-upload"===l)return(0,a.jsx)("div",{className:"overflow-y-auto h-full",children:(0,a.jsxs)("div",{className:"min-h-screen bg-blue-50/30",children:[(0,a.jsxs)("div",{className:"relative bg-gradient-to-br from-blue-500 via-blue-600 to-blue-700 overflow-hidden",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-400/20 to-transparent"}),(0,a.jsx)("div",{className:"absolute top-0 left-1/3 w-96 h-96 bg-white/5 rounded-full blur-3xl"}),(0,a.jsx)("div",{className:"relative max-w-5xl mx-auto px-6 py-12",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-white/95 backdrop-blur-xl rounded-3xl mb-8 shadow-2xl",children:(0,a.jsxs)("svg",{className:"w-10 h-10 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 13a3 3 0 11-6 0 3 3 0 016 0z"})]})}),(0,a.jsx)("h1",{className:"text-4xl font-light text-white tracking-tight mb-4",children:"Almost Done!"}),(0,a.jsx)("p",{className:"text-xl text-blue-100",children:"Enhance your analysis with a photo"}),(0,a.jsxs)("div",{className:"flex items-center justify-center space-x-2 mt-3",children:[(0,a.jsx)("span",{className:"text-white text-sm",children:"Powered by"}),(0,a.jsx)("span",{className:"text-white font-medium text-sm",children:"ConvoMind.ai"})]})]})})]}),(0,a.jsx)("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 py-8 sm:py-16",children:(0,a.jsxs)("div",{className:"bg-white rounded-2xl sm:rounded-[3rem] shadow-2xl p-6 sm:p-12 border border-gray-100",children:[(0,a.jsxs)("div",{className:"text-center mb-6 sm:mb-8",children:[(0,a.jsx)("h2",{className:"text-2xl sm:text-3xl font-light text-gray-900 mb-3 sm:mb-4 tracking-tight",children:"Want to enhance your results?"}),(0,a.jsx)("p",{className:"text-base sm:text-lg text-gray-600 leading-relaxed max-w-2xl mx-auto px-2",children:"Upload a clear photo of your face for AI-powered visual analysis that will be combined with your questionnaire responses for even more personalized recommendations."})]}),(0,a.jsx)("div",{className:"mb-6 sm:mb-8",children:m?(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsxs)("div",{className:"relative inline-block",children:[(0,a.jsx)("img",{src:m,alt:"Uploaded skin photo",className:"w-48 h-48 sm:w-64 sm:h-64 object-cover rounded-2xl sm:rounded-3xl shadow-2xl mx-auto"}),g&&(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 rounded-2xl sm:rounded-3xl flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-white text-center",children:[(0,a.jsx)("div",{className:"animate-spin w-8 h-8 sm:w-10 sm:h-10 border-2 sm:border-3 border-white border-t-transparent roun
1ded-full mx-auto mb-2 sm:mb-3"}),(0,a.jsx)("p",{className:"text-sm sm:text-base font-medium",children:"Analyzing your photo..."})]})}),(0,a.jsx)("button",{onClick:()=>{h(null),p(!1)},className:"absolute -top-2 -right-2 sm:-top-3 sm:-right-3 w-8 h-8 sm:w-10 sm:h-10 bg-red-500 hover:bg-red-600 text-white rounded-full flex items-center justify-center transition-colors shadow-lg touch-manipulation",children:(0,a.jsx)("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),!g&&(0,a.jsx)("div",{className:"mt-4 sm:mt-6",children:(0,a.jsxs)("div",{className:"inline-flex items-center space-x-2 px-3 py-1 sm:px-4 sm:py-2 bg-blue-100 text-blue-700 rounded-full text-xs sm:text-sm font-medium",children:[(0,a.jsx)("svg",{className:"w-3 h-3 sm:w-4 sm:h-4",fill:"currentColor",viewBox:"0 0 20 20",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),(0,a.jsx)("span",{children:"Photo analysis complete"})]})})]}):(0,a.jsxs)("label",{className:"group block w-full cursor-pointer",children:[(0,a.jsxs)("div",{className:"border-2 border-dashed border-gray-300 group-hover:border-blue-400 rounded-2xl sm:rounded-3xl p-8 sm:p-12 text-center transition-all duration-300 group-hover:bg-blue-50/50",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-12 h-12 sm:w-16 sm:h-16 bg-gray-100 group-hover:bg-blue-100 rounded-xl sm:rounded-2xl mb-4 sm:mb-6 transition-colors",children:(0,a.jsx)("svg",{className:"w-6 h-6 sm:w-8 sm:h-8 text-gray-400 group-hover:text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),(0,a.jsx)("h3",{className:"text-lg sm:text-xl font-semibold text-gray-800 group-hover:text-blue-600 mb-2 sm:mb-3",children:"Upload Your Photo"}),(0,a.jsx)("p",{className:"text-sm sm:text-base text-gray-600 group-hover:text-blue-500 mb-2",children:"Click to select or drag and drop"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-gray-400",children:"JPG, PNG up to 10MB ⢠Best results with clear, front-facing photos"})]}),(0,a.jsx)("input",{type:"file",accept:"image/*",onChange:e=>{let t=e.target.files[0];if(t&&t.type.startsWith("image/")){let e=new FileReader;e.onload=e=>{h(e.target.result),p(!0),setTimeout(()=>{p(!1)},2e3)},e.readAsDataURL(t)}},className:"hidden"})]})}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4 justify-center",children:[(0,a.jsx)("button",{onClick:()=>n("result"),className:"px-6 py-3 sm:px-8 sm:py-4 bg-gray-100 hover:bg-gray-200 text-gray-800 rounded-xl sm:rounded-2xl font-medium transition-all duration-300 hover:shadow-lg touch-manipulation",children:"Skip Photo & View Results"}),m&&!g&&(0,a.jsx)("button",{onClick:()=>n("result"),className:"px-6 py-3 sm:px-8 sm:py-4 bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white rounded-xl sm:rounded-2xl font-medium transition-all duration-300 hover:shadow-xl transform hover:scale-105 touch-manipulation",children:"View Enhanced Results"})]}),(0,a.jsxs)("div",{className:"mt-12 pt-8 border-t border-gray-100",children:[(0,a.jsxs)("div",{className:"text-center mb-6",children:[(0,a.jsx)("h3",{className:"text-xl sm:text-2xl font-light text-gray-900 mb-2",children:"While You Wait..."}),(0,a.jsx)("p",{className:"text-gray-600",children:"Discover our most popular Nivea products"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:[{name:"Anti-Dark Spot Night Complexion Repair",price:"$9.99",image:"/nivea/Product1.png",bestseller:!0},{name:"Anti-Age Night Care",price:"$16.99",image:"/nivea/Product2.png",bestseller:!1},{name:"Men Energy Shower Gel",price:"$13.99",image:"/nivea/Product3.png",bestseller:!0},{name:"Creme Moisturizer Face Body & Hands",price:"$22.99",image:"/nivea/Product4.png",bestseller:!1},{name:"Creme Moisturizer",price:"$10.99",image:"/nivea/Product5.png",bestseller:!0},{name:"Nivea Lotion - Dry Skin",price:"$18.99",image:"/nivea/Product6.png",bestseller:!1}].map((e,t)=>(0,a.jsx)("div",{className:"bg-white rounded-xl p-6 shadow-md hover:shadow-lg transition-all border border-gray-100 hover:-translate-y-1 cursor-pointer h-full",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsx)("div",{className:"h-8 mb-3 flex justify-center",children:e.bestseller&&(0,a.jsx)("div",{className:"bg-red-500 text-white text-xs px-2 py-1 rounded-full",children:"Bestseller"})}),(0,a.jsx)("div",{className:"w-full h-48 mb-4 rounded-lg overflow-hidden flex-shrink-0",children:(0,a.jsx)("img",{src:e.image,alt:e.name,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col justify-between text-center",children:[(0,a.jsx)("div",{className:"h-16 flex items-center justify-center mb-2",children:(0,a.jsx)("h4",{className:"font-medium text-gray-900 text-base leading-tight",children:e.name})}),(0,a.jsx)("p",{className:"text-blue-500 font-bold text-lg",children:e.price})]})]})},t))})]})]})})]})});if("result"===l){let e=(()=>{let e=x.skinType,t=x.ageRange,r=x.mainConcern,a=x.dailyRoutine,s=x.sunProtection,l=k(),n={anal
1ysis:"",products:[],complementaryProducts:[],routine:[],photoInsights:l},i="",o="",d="",c="",u="";(null==e?void 0:e.includes("Oily"))?(o="Your skin produces excess sebum, particularly in the T-zone area, which can lead to enlarged pores and occasional breakouts. This skin type benefits from gentle yet effective cleansing to remove excess oil without over-drying.",n.products=[{price:"$11.99",image:"/nivea/Product1.png"},{price:"$14.99",image:"/nivea/Product2.png"},{price:"$9.99",image:"/nivea/Product3.png"}],n.complementaryProducts=[{name:"NIVEA Clear-Up Strips",price:"$6.99",image:"/nivea/Product4.png"},{name:"NIVEA Oil Control Serum",price:"$18.99",image:"/nivea/Product5.png"}]):(null==e?void 0:e.includes("Dry"))?(o="Your skin lacks adequate moisture and natural oils, often feeling tight, rough, or flaky. This condition requires intensive hydration and barrier repair to restore comfort and smoothness.",n.products=[{price:"$12.99",image:"/nivea/Product1.png"},{price:"$17.99",image:"/nivea/Product2.png"},{price:"$21.99",image:"/nivea/Product3.png"}],n.complementaryProducts=[{name:"NIVEA Hydrating Face Mask",price:"$8.99",image:"/nivea/Product4.png"},{name:"NIVEA Lip Care Essential",price:"$3.99",image:"/nivea/Product6.png"}]):(null==e?void 0:e.includes("Combination"))?(o="You have a mixed skin type with an oily T-zone (forehead, nose, chin) and normal to dry cheeks. This requires a balanced approach that addresses both concerns without overcomplicating your routine.",n.products=[{price:"$10.99",image:"/nivea/Product1.png"},{price:"$13.99",image:"/nivea/Product2.png"},{price:"$11.99",image:"/nivea/Product3.png"}],n.complementaryProducts=[{name:"NIVEA T-Zone Control Strips",price:"$7.99",image:"/nivea/Product4.png"},{name:"NIVEA Multi-Zone Face Mask",price:"$12.99",image:"/nivea/Product5.png"}]):(null==e?void 0:e.includes("Sensitive"))?(o="Your skin is reactive and prone to irritation, redness, or discomfort when exposed to certain ingredients or environmental factors. Gentle, fragrance-free formulations are essential.",n.products=[{price:"$13.99",image:"/nivea/Product1.png"},{price:"$15.99",image:"/nivea/Product2.png"},{price:"$9.99",image:"/nivea/Product3.png"}],n.complementaryProducts=[{name:"NIVEA Sensitive Eye Cream",price:"$16.99",image:"/nivea/Product5.png"},{name:"NIVEA Barrier Repair Balm",price:"$11.99",image:"/nivea/Product6.png"}]):(o="You have well-balanced skin with minimal concerns. Your skin maintains good moisture levels and rarely experiences irritation, making it easier to maintain with consistent basic care.",n.products=[{price:"$10.99",image:"/nivea/Product1.png"},{price:"$12.99",image:"/nivea/Product2.png"},{price:"$14.99",image:"/nivea/Product3.png"}],n.complementaryProducts=[{name:"NIVEA Refreshing Face Mask",price:"$8.99",image:"/nivea/Product4.png"},{name:"NIVEA Vitamin C Serum",price:"$19.99",image:"/nivea/Product5.png"}]),d=(null==t?void 0:t.includes("18-25"))?"At your age, focus on establishing good skincare habits and protecting against environmental damage to maintain your skin's natural resilience.":(null==t?void 0:t.includes("26-35"))?"This is an ideal time to incorporate preventive anti-aging ingredients while maintaining your skin's current health and radiance.":(null==t?void 0:t.includes("36-45"))?"Your skin may be showing early signs of aging. Targeted treatments with anti-aging ingredients can help maintain firmness and reduce fine lines.":(null==t?void 0:t.includes("46-55"))?"Hormonal changes may affect your skin's moisture and elasticity. Rich, nourishing formulations with proven anti-aging ingredients are beneficial.":"Mature skin requires intensive moisture and targeted treatments to address deeper lines, age spots, and loss of firmness.",c=(null==a?void 0:a.includes("Just wash with water"))||(null==a?void 0:a.includes("Use soap only"))?"Consider upgrading to a proper skincare routine with dedicated facial products for better results.":(null==a?void 0:a.includes("Irregular"))?"Consistency is key to seeing improvements. Try to establish a simple morning and evening routine.":"Your current routine shows good commitment to skincare. Small adju
1stments with targeted products can enhance your results.",((null==s?void 0:s.includes("Never use it"))||(null==s?void 0:s.includes("Sometimes when I remember")))&&(u="Daily SPF protection is crucial for preventing premature aging and maintaining healthy skin.");let m="";return l&&(m=" Our AI photo analysis confirms these findings and provides additional visual insights to enhance your personalized recommendations."),i="".concat(o," ").concat(d," ").concat(c," ").concat(u).concat(m).trim(),n.analysis=i,(null==r?void 0:r.includes("aging"))&&n.complementaryProducts.push({name:"NIVEA Anti-Age Face Serum",price:"$24.99",image:"/nivea/Product4.png"}),(null==r?void 0:r.includes("Acne"))&&n.complementaryProducts.push({name:"NIVEA Clear-Up Treatment",price:"$16.99",image:"/nivea/Product5.png"}),((null==r?void 0:r.includes("dark spots"))||(null==r?void 0:r.includes("Uneven skin tone")))&&n.complementaryProducts.push({name:"NIVEA Luminous Brightening Serum",price:"$22.99",image:"/nivea/Product6.png"}),n})();return(0,a.jsx)("div",{className:"overflow-y-auto h-full",children:(0,a.jsxs)("div",{className:"min-h-screen bg-blue-50/30",children:[(0,a.jsxs)("div",{className:"relative bg-gradient-to-br from-blue-500 via-blue-600 to-blue-700 overflow-hidden",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-400/20 to-transparent"}),(0,a.jsx)("div",{className:"absolute top-0 left-1/3 w-96 h-96 bg-white/5 rounded-full blur-3xl"}),(0,a.jsxs)("div",{className:"relative max-w-5xl mx-auto px-6 py-16 text-center",children:[(0,a.jsxs)("div",{className:"flex items-center justify-center space-x-4 mb-6",children:[(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)("div",{className:"w-7 h-7 sm:w-7 sm:h-7 bg-white/95 backdrop-blur-xl rounded-2xl sm:rounded-3xl flex items-center justify-center shadow-2xl border border-white/20",children:(0,a.jsx)("div",{className:"w-7 h-7 sm:w-10 sm:h-10 bg-gradient-to-br from-blue-500 to-blue-600 rounded-xl sm:rounded-2xl flex items-center justify-center shadow-inner",children:(0,a.jsx)("img",{src:null===(r=(0,e4.tL)("NIVEA"))||void 0===r?void 0:r.src,alt:"nivea",className:"w-20 h-20 flex-shrink-0"})})})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-2xl sm:text-3xl font-light text-white tracking-tight",children:"NIVEA"}),(0,a.jsx)("p",{className:"text-sm sm:text-base text-blue-200",children:"Skin Analysis"})]})]}),(0,a.jsx)("h1",{className:"text-5xl font-light text-white tracking-tight mb-4",children:"Analysis Complete!"}),(0,a.jsx)("p",{className:"text-xl text-blue-100",children:"Your personalized recommendations are ready"})]})]}),(0,a.jsx)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-8 sm:py-16",children:(0,a.jsxs)("div",{className:"bg-white rounded-2xl sm:rounded-[3rem] shadow-2xl p-6 sm:p-12 mb-8 sm:mb-12 border border-gray-100",children:[(0,a.jsxs)("div",{className:"text-center mb-8 sm:mb-12",children:[(0,a.jsx)("h2",{className:"text-2xl sm:text-4xl font-light text-gray-900 mb-4 sm:mb-6 tracking-tight",children:"Your Skin Analysis Result"}),(0,a.jsx)("div",{className:"inline-flex items-center justify-center bg-gradient-to-br from-blue-50 to-blue-100 rounded-2xl sm:rounded-3xl px-6 sm:px-8 py-4 sm:py-6 mb-6 sm:mb-8 border border-blue-200 shadow-lg",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"text-lg sm:text-2xl font-semibold text-gray-900",children:["Your skin's biological age: ",(0,a.jsx)("span",{className:"text-blue-600",children:"32"})]}),(0,a.jsx)("p",{className:"text-sm sm:text-base text-gray-600",children:"Detected by AI analysis"})]})}),(0,a.jsx)("p",{className:"text-base sm:text-xl text-gray-600 leading-relaxed max-w-3xl mx-auto px-2",children:e.analysis})]}),e.photoInsights&&(0,a.jsxs)("div",{className:"bg-gradient-to-br from-emerald-50 to-emerald-100/50 rounded-3xl p-8 mb-12 border border-emerald-200/50",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-4 mb-6",children:[(0,a.jsx)("div",{className:"flex items-center justify-center w-12 h-12 bg-gradient-to-br from-emerald-600 to-emerald-700 rounded-xl shadow-lg",children:(0,a.jsxs)("svg",{className:"w-6 h-6 text-white",f
1ill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0118.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 13a3 3 0 11-6 0 3 3 0 016 0z"})]})}),(0,a.jsx)("h3",{className:"text-2xl font-semibold text-gray-900",children:"Photo Analysis Insights"})]}),(0,a.jsxs)("div",{className:"grid md:grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-emerald-800 mb-3",children:"Visual Assessment"}),(0,a.jsx)("p",{className:"text-emerald-700 mb-4",children:e.photoInsights.skinType}),(0,a.jsx)("h4",{className:"font-semibold text-emerald-800 mb-3",children:"Detected Concerns"}),(0,a.jsx)("ul",{className:"space-y-2",children:e.photoInsights.concerns.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start space-x-2",children:[(0,a.jsx)("div",{className:"w-1.5 h-1.5 bg-emerald-600 rounded-full mt-2 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-emerald-700",children:e})]},t))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-semibold text-emerald-800 mb-3",children:"AI Recommendations"}),(0,a.jsx)("ul",{className:"space-y-2",children:e.photoInsights.recommendations.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start space-x-2",children:[(0,a.jsx)("div",{className:"w-1.5 h-1.5 bg-emerald-600 rounded-full mt-2 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-emerald-700",children:e})]},t))}),m&&(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)("img",{src:m,alt:"Analyzed photo",className:"w-24 h-24 object-cover rounded-xl shadow-lg"})})]})]})]}),(0,a.jsxs)("div",{className:"mb-8 sm:mb-12",children:[(0,a.jsx)("h3",{className:"text-2xl sm:text-3xl font-light text-gray-900 mb-6 sm:mb-8 text-center",children:"Your Personalized Recommendations"}),(0,a.jsx)("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6",children:e.products.map((e,t)=>(0,a.jsx)("div",{className:"group bg-gradient-to-br from-blue-50 to-blue-100/50 rounded-2xl sm:rounded-3xl p-6 sm:p-8 border border-blue-200/50 hover:shadow-xl transition-all duration-500 hover:-translate-y-1",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsx)("div",{className:"w-full h-48 sm:h-56 mb-6 rounded-xl overflow-hidden flex-shrink-0",children:(0,a.jsx)("img",{src:e.image,alt:"Nivea Product",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col justify-between text-center",children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)("p",{className:"text-2xl sm:text-3xl font-bold text-blue-500",children:e.price})}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("button",{className:"w-full bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white py-3 px-4 rounded-xl font-medium transition-all duration-300 transform hover:scale-105",children:"Add to Cart"}),(0,a.jsx)("button",{className:"w-full border border-blue-500 text-blue-500 hover:bg-blue-50 py-3 px-4 rounded-xl font-medium transition-all duration-300",children:"View Details"})]})]})]})},t))})]}),(0,a.jsxs)("div",{className:"mb-8 sm:mb-12",children:[(0,a.jsx)("h3",{className:"text-xl sm:text-2xl font-light text-gray-900 mb-6 text-center",children:"Complete Your Routine"}),(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-4",children:e.complementaryProducts.map((e,t)=>(0,a.jsx)("div",{className:"bg-white rounded-xl p-4 shadow-md hover:shadow-lg transition-all border border-gray-100 hover:-translate-y-1 h-full",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsx)("div",{className:"w-full h-32 sm:h-36 mb-3 rounded-lg overflow-hidden flex-shrink-0",children:(0,a.jsx)("img",{src:e.image,alt:e.name,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col justify-between text-center",children:[(0,a.jsx)("p",{className:"text-blue-500 font-bold text-sm mb-3",children:e.price}),(0,a.jsx)("button",{className:"w-full bg-blue-500 hover:bg-blue-600 text-white py-2 px-2 rounded-lg text-xs font-medium transition-colors touch-manipulation",children:"Add"})]})]})},t))})]}),(0,a.jsx)("div",{className:"bg-gradient-to-br from-gray-50 to-gray-100 rounded-3xl p-8 mb-8 sm:mb-12 border border-gray-200",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-blue-500 rounded-2xl mb-6",children:(0,a.jsxs)("svg",{className:"w-8 h-8 text-white",f
1ill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]})}),(0,a.jsx)("h3",{className:"text-2xl font-semibold text-gray-900 mb-3",children:"Find Nivea Near You"}),(0,a.jsx)("p",{className:"text-gray-600 mb-6 max-w-md mx-auto",children:"Discover your recommended products at nearby stores or shop online with fast delivery."}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[(0,a.jsx)("button",{className:"px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white rounded-xl font-medium transition-colors",children:"Find Stores"}),(0,a.jsx)("button",{className:"px-6 py-3 border border-blue-500 text-blue-500 hover:bg-blue-50 rounded-xl font-medium transition-colors",children:"Shop Online"})]})]})}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 sm:gap-6 justify-center mb-6 sm:mb-8",children:[(0,a.jsx)("button",{onClick:()=>{n("welcome"),h(null),p(!1),u({}),o(null),c(0)},className:"px-6 py-3 sm:px-8 sm:py-4 bg-gray-100 hover:bg-gray-200 text-gray-800 rounded-xl sm:rounded-2xl font-medium transition-all duration-300 hover:shadow-lg touch-manipulation",children:"Take New Analysis"}),(0,a.jsx)("button",{className:"px-6 py-3 sm:px-8 sm:py-4 bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white rounded-xl sm:rounded-2xl font-medium transition-all duration-300 hover:shadow-xl transform hover:scale-105 touch-manipulation",children:"Continue Shopping"})]}),(0,a.jsxs)("div",{className:"text-center py-4 sm:py-6 border-t border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-center justify-center space-x-3 mb-2",children:[(0,a.jsx)("div",{className:"w-6 h-6 sm:w-8 sm:h-8 bg-gradient-to-br from-blue-400 to-purple-600 rounded-md sm:rounded-lg flex items-center justify-center",children:(0,a.jsx)("svg",{className:"w-3 h-3 sm:w-4 sm:h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),(0,a.jsx)("span",{className:"text-base sm:text-lg font-semibold text-gray-800",children:"ConvoMind.ai"})]}),(0,a.jsx)("p",{className:"text-gray-600 text-xs sm:text-sm",children:"Advanced AI-powered skin analysis technology"}),(0,a.jsx)("p",{className:"text-gray-500 text-xs mt-1",children:"Empowering personalized beauty recommendations"})]})]})})]})})}};var tf=r(89099),tv=r(69772),ty=r(26952);let tk=e=>{let{results:t,showToast:r,aiModel:s,language:l,country:n,responseLanguage:i}=e,{t:o,i18n:d}=(0,P.Bd)("agent-product-description"),c=async()=>{try{if(0===t.length){r(o("docx.noContent"),"error");return}r(o("docx.generating"),"success");let e=[];e.push(new eW.fzL({children:[new eW.NTc({text:o("docx.title"),bold:!0,size:36})],heading:eW.Fmo.HEADING_1,alignment:eW.Yus.CENTER,spacing:{after:200}})),e.push(new eW.fzL({children:[new eW.NTc({text:o("docx.generated",{datetime:"".concat(new Date().toLocaleDateString(d.language)," ").concat(new Date().toLocaleTimeString(d.language))}),size:18,color:"6B7280"})],alignment:eW.Yus.CENTER,spacing:{after:80}})),e.push(new eW.fzL({children:[new eW.NTc({text:o("docx.aiModel",{model:s}),size:18,color:"6B7280"})],alignment:eW.Yus.CENTER,spacing:{after:80}})),e.push(new eW.fzL({children:[new eW.NTc({text:o("docx.meta",{language:l,country:n,responseLanguage:i}),size:18,color:"6B7280"})],alignment:eW.Yus.CENTER,spacing:{after:400}})),t.forEach((r,a)=>{e.push(new eW.fzL({children:[new eW.NTc({text:"".concat(a+1,". "),bold:!0,size:24,color:"1D4ED8"}),new eW.Mf2({link:r.url,children:[new eW.NTc({text:r.url,bold:!0,size:22,color:"2563EB",underline:{},style:"Hyperlink"})]})],heading:eW.Fmo.HEADING_2,spacing:{before:400,after:200},shading:{fill:"EFF6FF"}
1,border:{left:{color:"3B82F6",space:4,style:"single",size:12}}})),r.response.split("\n").map(e=>e.replace(/^-\s*/,"").trim()).filter(Boolean).forEach(t=>{let r;let a=/\[([^\]]+)\]\(([^)]+)\)/g,s=[],l=0;for(;null!==(r=a.exec(t));)r.index>l&&s.push(new eW.NTc({text:t.slice(l,r.index),size:20})),s.push(new eW.Mf2({link:r[2],children:[new eW.NTc({text:r[1],size:20,color:"2563EB",underline:{},style:"Hyperlink"})]})),l=r.index+r[0].length;l<t.length&&s.push(new eW.NTc({text:t.slice(l),size:20})),e.push(new eW.fzL({children:s.length>0?s:[new eW.NTc({text:t,size:20})],bullet:{level:0},spacing:{before:60,after:60}}))}),a<t.length-1&&e.push(new eW.fzL({text:"",border:{bottom:{color:"E5E7EB",space:1,style:"single",size:6}},spacing:{before:300,after:300}}))});let a=new eW.yoT({sections:[{children:e}]}),c=await eW.ND6.toBlob(a),x="product_descriptions_".concat(new Date().toISOString().split("T")[0],".docx");(0,eJ.saveAs)(c,x),r(o("docx.exported"),"success")}catch(e){r(o("docx.exportFailed",{message:e instanceof Error?e.message:o("docx.unknownError")}),"error")}};return(0,a.jsxs)("button",{onClick:c,disabled:0===t.length,className:"px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)(eV.A,{className:"w-4 h-4"}),o("docx.button")]})},tj=()=>(0,a.jsx)(ep(),{id:"45e2c2b37d2f0c90",children:"@media(hover:none)and (pointer:coarse){button,input,select,textarea{min-height:44px}}html{-webkit-overflow-scrolling:touch}@media screen and (max-width:768px){input,select,textarea{font-size:16px}}"}),tN=e=>{let{title:t,description:r,icon:s}=e;return(0,a.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 border-l-4 border-blue-500 rounded-lg p-4 mb-4 mt-4",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[s&&(0,a.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:s}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-blue-900 dark:text-blue-300 mb-1",children:t}),(0,a.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-400",children:r})]})]})})},tw=e=>{let{item:t,index:r}=e;return(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-xl border border-gray-200 dark:border-border shadow-sm overflow-hidden",children:[(0,a.jsxs)("div",{className:"bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 px-4 py-3 border-b border-gray-200 dark:border-border flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-6 h-6 rounded-full bg-green-600 text-white text-xs flex items-center justify-center font-bold flex-shrink-0",children:r+1}),t.url&&(0,a.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 dark:text-blue-400 hover:underline truncate",children:t.url})]}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)("p",{className:"text-sm text-gray-700 dark:text-ink-primary whitespace-pre-wrap leading-relaxed",children:t.response})})]})},tC=e=>{let{aiModelsData:t,selectedAiModel:r,setSelectedAiModel:s,language:l,setLanguage:i,country:o,setCountry:d,responseLanguage:c,setResponseLanguage:x,isCustomLanguage:u,setIsCustomLanguage:m,isCustomCountry:h,setIsCustomCountry:g,isCustomResponseLanguage:p,setIsCustomResponseLanguage:b,excelFile:f,setExcelFile:v,isDragging:y,setIsDragging:k,fileInputRef:j,showToast:N}=e,{t:w}=(0,P.Bd)("agent-product-description");return(0,a.jsx)("div",{className:"h-full overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-white/20 scrollbar-track-transparent p-6",children:(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-ink-primary",children:w("form.title")}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-ink-secondary mb-2",children:w("form.aiModel")}),(0,a.jsx)(e$.A,{value:r,onChange:s,placeholder:w("form.selectModel"),options:t.map(e=>({value:e.tag,label:e.name}))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-ink-secondary mb-2",children:w("form.language")}),u?(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:l,onCh
1ange:e=>i(e.target.value),placeholder:w("form.customLanguagePlaceholder"),className:"flex-1 py-2 px-3 border border-gray-300 dark:border-border rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude dark:bg-surface dark:text-ink-primary"}),(0,a.jsx)("button",{onClick:()=>{m(!1),i("")},className:"px-3 py-2 text-sm text-gray-600 dark:text-ink-muted border border-gray-300 dark:border-border rounded-lg hover:bg-gray-50 dark:hover:bg-surface-active",children:"â"})]}):(0,a.jsx)(e$.A,{value:l,onChange:e=>{"custom"===e?(m(!0),i("")):i(e)},options:[{value:"en",label:w("languageOptions.en")},{value:"tr",label:w("languageOptions.tr")},{value:"es",label:w("languageOptions.es")},{value:"fr",label:w("languageOptions.fr")},{value:"de",label:w("languageOptions.de")},{value:"custom",label:w("form.others")}]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-ink-secondary mb-2",children:w("form.country")}),h?(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:o,onChange:e=>d(e.target.value),placeholder:w("form.customCountryPlaceholder"),className:"flex-1 py-2 px-3 border border-gray-300 dark:border-border rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude dark:bg-surface dark:text-ink-primary"}),(0,a.jsx)("button",{onClick:()=>{g(!1),d("")},className:"px-3 py-2 text-sm text-gray-600 dark:text-ink-muted border border-gray-300 dark:border-border rounded-lg hover:bg-gray-50 dark:hover:bg-surface-active",children:"â"})]}):(0,a.jsx)(e$.A,{value:o,onChange:e=>{"custom"===e?(g(!0),d("")):d(e)},options:[{value:"uk",label:w("countryOptions.uk")},{value:"us",label:w("countryOptions.us")},{value:"tr",label:w("countryOptions.tr")},{value:"es",label:w("countryOptions.es")},{value:"fr",label:w("countryOptions.fr")},{value:"de",label:w("countryOptions.de")},{value:"custom",label:w("form.others")}]})]})]}),p?(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:c,onChange:e=>x(e.target.value),placeholder:w("form.customResponseLanguagePlaceholder"),className:"flex-1 py-2 px-3 border border-gray-300 dark:border-border rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude dark:bg-surface dark:text-ink-primary"}),(0,a.jsx)("button",{onClick:()=>{b(!1),x("ENGLISH")},className:"px-3 py-2 text-sm text-gray-600 dark:text-ink-muted border border-gray-300 dark:border-border rounded-lg hover:bg-gray-50 dark:hover:bg-surface-active",children:"â"})]}):(0,a.jsx)(e$.A,{value:c,onChange:e=>{"custom"===e?(b(!0),x("")):x(e)},options:[{value:"ENGLISH",label:w("responseLanguageOptions.ENGLISH")},{value:"TURKISH",label:w("responseLanguageOptions.TURKISH")},{value:"GERMAN",label:w("responseLanguageOptions.GERMAN")},{value:"FRENCH",label:w("responseLanguageOptions.FRENCH")},{value:"SPANISH",label:w("responseLanguageOptions.SPANISH")},{value:"custom",label:w("form.others")}]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"block text-sm font-medium text-gray-700 dark:text-ink-secondary mb-2",children:[w("form.excelFile"),(0,a.jsx)("span",{className:"ml-2 text-xs font-normal text-gray-500 dark:text-ink-muted",children:w("form.excelFileHint")})]}),(0,a.jsxs)("div",{onDragOver:e=>{e.preventDefault(),k(!0)},onDragLeave:()=>k(!1),onDrop:e=>{e.preventDefault(),k(!1);let t=e.dataTransfer.files[0];if(t){if(!t.name.endsWith(".xlsx")&&!t.name.endsWith(".xls")){N(w("toast.onlyExcel"),"error");return}v(t)}},onClick:()=>{var e;return null===(e=j.current)||void 0===e?void 0:e.click()},className:"relative cursor-pointer border-2 border-dashed rounded-xl p-5 transition-all duration-200 text-center ".concat(y?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":f?"border-green-400 bg-green-50 dark:bg-green-900/20":"border-gray-300 dark:border-border hover:border-blue-400 hover:bg-gray-50 dark:hover:bg-surface-active"),children:[(0,a.jsx)("input",{ref:j,type:"file",accept:".xlsx,.xls",onChange:e=>{var t;let r=null===(t=e.target.files)||void 0===t?void 0:t[0];if(r){if(!r.name.endsWith(".xlsx")&&!r.name.endsWith(".xls")){N(w("toast.onlyExcel"),"error"),e.target.value="";return}v(r)}},className:"hidden"}),f?(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,a.jsx)(tv.A,{className:"w-7 h-7 text-green-600 dark:text-green-400 flex-shrink-0"}),(0,a.jsxs)("div",{className:"text-left min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-green-700 dark:text-green-400 truncate",children:f.name}),(0,a.jsxs)("p",{className:"text-xs text-green-600 dark:text-green-500",children:[(f.size/1024).toFixed(1)," KB"]}
1)]}),(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),v(null),j.current&&(j.current.value="")},className:"ml-2 p-1 rounded-full hover:bg-green-100 dark:hover:bg-green-900/30 text-green-600 dark:text-green-400 flex-shrink-0",children:(0,a.jsx)(n.A,{className:"w-4 h-4"})})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2 text-gray-500 dark:text-ink-muted",children:[(0,a.jsx)(ty.A,{className:"w-7 h-7 text-gray-400 dark:text-ink-muted"}),(0,a.jsx)("p",{className:"text-sm font-medium",children:w("form.dropExcel")})]})]})]}),(0,a.jsx)(tN,{title:w("hint.title"),description:w("hint.description"),icon:(0,a.jsx)("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})})]})})},tS=e=>{let{isGenerating:t,results:r,showToast:s,selectedAiModelName:l,language:n,country:i,responseLanguage:o}=e,{t:d}=(0,P.Bd)("agent-product-description");return t&&0===r.length?(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center gap-4 bg-white dark:bg-surface",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-16 w-16 border-4 border-gray-100 dark:border-surface-active border-b-blue-600 dark:border-b-claude"}),(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,a.jsx)(tv.A,{className:"w-6 h-6 text-blue-400 dark:text-claude animate-pulse"})})]}),(0,a.jsx)("p",{className:"text-sm font-semibold text-gray-700 dark:text-ink-primary",children:d("result.generating")}),(0,a.jsx)("p",{className:"text-xs text-gray-400 dark:text-ink-muted text-center max-w-xs px-4",children:d("result.generatingHint")}),(0,a.jsx)("div",{className:"flex gap-1 mt-1",children:[0,1,2].map(e=>(0,a.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-400 dark:bg-claude animate-bounce",style:{animationDelay:"".concat(.15*e,"s")}},e))})]}):r.length>0?(0,a.jsxs)("div",{className:"h-full flex flex-col bg-white dark:bg-surface",children:[(0,a.jsxs)("div",{className:"px-6 py-3 border-b border-gray-200 dark:border-border flex items-center gap-3 flex-shrink-0",children:[(0,a.jsx)("span",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center flex-shrink-0",children:(0,a.jsx)("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-700 dark:text-ink-primary",children:d("result.title")}),(0,a.jsx)("span",{className:"px-2 py-0.5 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded-full text-xs font-medium",children:d("result.itemCount",{count:r.length})}),(0,a.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[t&&(0,a.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-blue-600 dark:text-claude",children:[(0,a.jsx)("div",{className:"w-3 h-3 rounded-full border-2 border-blue-300 dark:border-claude/30 border-t-blue-600 dark:border-t-claude animate-spin"}),d("result.processing")]}),(0,a.jsx)(tk,{results:r,showToast:s,aiModel:l,language:n,country:i,responseLanguage:o})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-white/20 scrollbar-track-transparent p-6 space-y-4",children:r.map((e,t)=>(0,a.jsx)(tw,{item:e,index:t},t))})]}):(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center gap-3 bg-white dark:bg-surface text-gray-400 dark:text-ink-muted",children:[(0,a.jsx)(eb.A,{className:"w-14 h-14 opacity-30"}),(0,a.jsx)("p",{className:"text-sm font-medium text-gray-500 dark:text-ink-muted",children:d("result.emptyTitle")}),(0,a.jsx)("p",{className:"text-xs text-gray-400 dark:text-ink-muted",children:d("result.emptyHint")})]})},tT=e=>{var t,r;let{showToast:l,initialData:i,initialResponse:o,recordId:d}=e,{t:c}=(0,P.Bd)("agent-product-description"),x=(0,y.d4)(e=>
1e.user),[m,h]=(0,s.useState)([]),[g,p]=(0,s.useState)(""),[b,f]=(0,s.useState)("en"),[v,k]=(0,s.useState)("uk"),[j,w]=(0,s.useState)("ENGLISH"),[C,S]=(0,s.useState)(!1),[T,A]=(0,s.useState)(!1),[E,L]=(0,s.useState)(!1),[M,R]=(0,s.useState)(null),[z,_]=(0,s.useState)(!1),[O,I]=(0,s.useState)(!1),[D,B]=(0,s.useState)([]),[F,H]=(0,s.useState)("daily"),[U,G]=(0,s.useState)(!1),q=(0,s.useRef)(null),V=(0,s.useRef)(null),[W,J]=(0,s.useState)(!1),K=null!==(r=null===(t=m.find(e=>e.tag===g))||void 0===t?void 0:t.name)&&void 0!==r?r:g,[Y,$]=(0,s.useState)(null);(0,s.useEffect)(()=>{if(B([]),p(""),f("en"),k("uk"),w("ENGLISH"),!o)return;let e=o;if("string"==typeof o)try{e=JSON.parse(o)}catch(e){return}Array.isArray(e)&&B(e.map(e=>{var t,r,a,s,l;return{response:null!==(s=null!==(a=null!==(r=e.responseContent)&&void 0!==r?r:null===(t=e.outputData)||void 0===t?void 0:t.text)&&void 0!==a?a:e.response)&&void 0!==s?s:"",url:null!==(l=e.url)&&void 0!==l?l:""}}))},[o]),(0,s.useEffect)(()=>{i&&(i.aiId&&p(i.aiId),i.language&&f(i.language),i.country&&k(i.country),i.responseLanguage&&w(i.responseLanguage))},[i]),(0,s.useEffect)(()=>{(null==x?void 0:x.token)&&(async()=>{try{var e;let t=await (0,eU.Hs)(x.token,{status:"ACTIVE",agentry:!0}),r=null!==(e=t.agenticAIs)&&void 0!==e?e:[];h(r)}catch(e){l(c("toast.loadModelsFailed"),"error")}})()},[null==x?void 0:x.token]);let X=async()=>{if(!g){l(c("toast.selectModel"),"error");return}if(!M){l(c("toast.uploadExcel"),"error");return}I(!0),B([]);try{var e;let t=await eM(M,{aiId:g,language:b,country:v,responseLanguage:j},null==x?void 0:x.token);B(t),N.emit(),(null==t?void 0:null===(e=t[0])||void 0===e?void 0:e.reportId)&&$(t[0].reportId),l(c("toast.created"),"success")}catch(e){(null==e?void 0:e.name)==="BudgetExceedRequestError"?(H("budgetExceed"),G(!0)):l(c("toast.error",{message:(null==e?void 0:e.message)||c("toast.unknownError")}),"error")}finally{I(!1)}};return(0,a.jsxs)("div",{className:"flex flex-col h-full bg-gray-50 dark:bg-surface",children:[(0,a.jsx)(tj,{}),(0,a.jsxs)("div",{className:"flex items-center justify-between px-5 h-[50px] bg-white dark:bg-surface-elevated border-b border-gray-200 dark:border-border flex-shrink-0",children:[(0,a.jsx)("div",{className:"flex items-center gap-2.5",children:(0,a.jsx)("span",{className:"text-[13px] font-medium text-gray-800 dark:text-ink-primary",children:c("header.title")})}),D.length>0&&d&&(0,a.jsxs)(u.$n,{onClick:()=>J(!0),variant:"outline",size:"sm",className:"flex items-center",children:[(0,a.jsx)(ef.A,{className:"w-4 h-4 mr-2"}),c("header.shareWithTeam")]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,a.jsxs)(eH.YZ,{direction:"horizontal",className:"h-full",children:[(0,a.jsx)(eH.Zk,{defaultSize:40,minSize:25,maxSize:60,className:"flex flex-col bg-white dark:bg-surface-elevated border-r border-gray-200 dark:border-border",children:(0,a.jsx)(tC,{aiModelsData:m,selectedAiModel:g,setSelectedAiModel:p,language:b,setLanguage:f,country:v,setCountry:k,responseLanguage:j,setResponseLanguage:w,isCustomLanguage:C,setIsCustomLanguage:S,isCustomCountry:E,setIsCustomCountry:L,isCustomResponseLanguage:T,setIsCustomResponseLanguage:A,excelFile:M,setExcelFile:R,isDragging:z,setIsDragging:_,fileInputRef:V,showToast:l})}),(0,a.jsxs)(eH.TW,{className:"w-1 bg-gray-200 dark:bg-border hover:bg-blue-500 dark:hover:bg-claude cursor-col-resize transition-colors duration-200 relative group",children:[(0,a.jsx)("div",{className:"absolute inset-y-0 -inset-x-1"}),(0,a.jsx)("div",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-1 h-8 rounded-full bg-gray-400 opacity-0 group-hover:opacity-100 group-hover:bg-blue-600 dark:group-hover:bg-claude transition-all duration-200"})]}),(0,a.jsx)(eH.Zk,{defaultSize:60,minSize:40,className:"flex flex-col",children:(0,a.jsx)(tS,{isGenerating:O,results:D,showToast:l,selectedAiModelName:K,language:b,country:v,responseLanguage:j})})]})}),(0,a.jsx)("div",{className:"border-t border-gray-200 dark:border-border px-6 py-2 bg-white dark:bg-surface-elevated flex-shrink-0",children:(0,a.jsxs)("div",{className:"flex justify-end gap-3",children:[O&&(0,a.jsxs)("button",{onClick:()=>I(!1),className:"px-6 py-2.5 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors flex items-center gap-2",children:[(0,a.jsx)(n.A,{className:"w-4 h-4"})," ",c("actions.stop")]}),(0,a.jsxs)("button",{onClick:X,disabled:O,className:"px-6 py-2.5 bg-blue-600 dar
1k:bg-claude text-white rounded-lg hover:bg-blue-700 dark:hover:bg-claude-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[(0,a.jsx)(ev.A,{className:"w-4 h-4"}),O?c("actions.generating"):c("actions.generate")]})]})}),U&&(0,a.jsx)("div",{ref:q,className:"relative",children:(0,a.jsx)("div",{className:"absolute bottom-36 mb-4 left-0 right-0 mx-auto w-full max-w-3xl shadow-lg",children:(0,a.jsxs)("div",{className:"relative bg-white dark:bg-surface-elevated rounded shadow-lg",children:[(0,a.jsx)("button",{className:"absolute -top-2 -right-2 text-gray-600 dark:text-ink-muted hover:text-gray-900 dark:hover:text-ink-primary bg-white dark:bg-surface-elevated rounded-full p-2 shadow-lg z-10 transition-colors",onClick:()=>G(!1),children:(0,a.jsx)(n.A,{className:"h-5 w-5"})}),(0,a.jsx)(eG.A,{limitType:F,onClose:()=>G(!1)})]})})}),W&&d&&(0,a.jsx)(es,{itemId:d,report:{type:"GENERATOR",name:c("share.reportName")},onClose:()=>J(!1)})]})},tA=e=>{let{initialData:t,initialResponse:r,recordId:s}=e,{toast:l,showToast:n}=(0,eB.Z)();return(0,a.jsxs)("div",{className:"flex h-full bg-surface dark:bg-surface",children:[(0,a.jsx)(eF.A,{show:l.show,message:l.message,type:l.type}),(0,a.jsx)("div",{className:"flex-1 h-full",children:(0,a.jsx)(tT,{showToast:n,initialData:t,initialResponse:r,recordId:s})})]})};function tE(e,t,r){let a=null==r?"":String(r);if(!a)return a;switch(t){case"type":return"Competitive"===a?e("analysisType.competitive"):"Trend & Topic"===a?e("analysisType.trend"):a;case"threadMode":return"Merge threads"===a?e("filters.merged"):"Individual tweets"===a?e("filters.individual"):a;case"tweetLang":return"All languages"===a?e("meta.allLanguages"):a;case"contentTypes":return"None"===a?e("meta.none"):a.split(", ").map(t=>e("filters.".concat(t),{defaultValue:t})).join(", ");case"outputLang":return e("output.".concat(a),{defaultValue:a});case"minEngagement":{if("N/A"===a)return e("meta.na");let t=a.match(/^(\d+)\+ likes\+RT$/);return t?e("meta.minEngValue",{n:t[1]}):a}case"promptLabel":return"Custom"===a?e("meta.customPrompt"):"Saved Report"===a?e("meta.savedReport"):e("promptTemplates.".concat(a),{defaultValue:a});case"timeRange":return e("time.".concat(a),{defaultValue:a});case"fetchMode":return"Auto pagination with soft cap"===a?e("meta.autoPagination"):a;default:return a}}var tL=r(23206),tM=r(12770),tR=r(8131);let tz={BudgetExceedRequestError:"budgetExceed",PlanDailyRequestError:"daily",PlanHourlyRequestError:"hourly"},t_={NOT_ENOUGH_CREDIT:"budgetExceed",BUDGET_EXCEEDED:"budgetExceed",BUDGET_NOT_ENOUGH:"budgetExceed",NO_BUDGET:"budgetExceed",PLAN_MAX_DAILY_REQUEST:"daily",PLAN_MAX_HOURLY_REQUEST:"hourly"},tO=/^[A-Z][A-Z0-9_]*$/,tI=e=>{var t,r;return[null==e?void 0:null===(t=e.errorData)||void 0===t?void 0:t.message,null==e?void 0:null===(r=e.errorData)||void 0===r?void 0:r.error,null==e?void 0:e.message,null==e?void 0:e.name].filter(e=>"string"==typeof e).map(e=>e.trim())},tD=e=>{var t;return null!==(t=tI(e).find(e=>tO.test(e)))&&void 0!==t?t:null},tP=e=>{let t=tz[null==e?void 0:e.name];if(t)return t;for(let t of tI(e)){let e=t_[t];if(e)return e}return null},tB=e=>{var t,r,a;let s=null!==(a=null!==(r=null==e?void 0:e.statusCode)&&void 0!==r?r:null==e?void 0:e.status)&&void 0!==a?a:null==e?void 0:null===(t=e.errorData)||void 0===t?void 0:t.status;return"number"==typeof s?s:null},tF=(e,t,r)=>{let a=tD(e);if(a){let e=t("errors.".concat(a),{defaultValue:""});if(e)return e}let s=tB(e);if(s){let e=t("errors.status".concat(s),{defaultValue:""});if(e)return e;if(s>=500){let e=t("errors.serverError",{defaultValue:""});if(e)return e}}return t(r)},tH="__restored__",tU=/[^a-zA-Z0-9_]/,tG=new Set(["account","accounts","account_id","accountid","account_name","accountname","handle","handles","username","usernames","user_name","user","users","screen_name","screenname","profile","profiles","hesap","hesaplar","hesapadi","hesap_adi","hesapismi","kullanici","kullanicilar","kullaniciadi","kullanici_adi"]),tq=e=>e.toLowerCase().normalize("NFD").replace(/[Ì-ͯ]/g,"").replace(/ı/g,"i").replace(/Å/g,"s").replace(/Ä/g,"g").replace(/ü/g,"u").replace(/ö/g,"o").replace(/ç/g,"c").replace(/[\s\-.]/g,""),tV=e=>tG.has(tq(e)),tW=e=>e.includes("@"),tJ="#cc785c",tK="rgba(204,120,92,0.12)",tY="rgba(204,120,92,0.5)";function t$(e){let{children:t}=e;return(0,a.jsx)("span",{className:"text-[10px] font-medium text-gray-400 dark:text-ink-muted tracking-[0.07em] uppercase mb-2 block",children:t})}function tX(){return(0,a.jsx)("div",{className:"h-[0.5px] bg-[#f0eeea] dark:bg-border my-3.5"})}function tZ(e){let{children:t,className:r=""}=e;return(0,a.jsx)("span",{className:"text-[11px] text-gray-500 dark:text-ink-secondary block mb-1 ".concat(r),children:t})}function tQ(e){let{selected:t,onClick:r,label:s,desc:l}=e,{isDark:n}=(0,er.D)(),i=n?tJ:tR.Hl,o=n?tY:tR.Hl,d=n?t?tY:"#555":t?tR.Hl:"#d1d5db",c=n?t?tJ:"#f5f1e8":t?tR.Hl:"#111";return(0,a.jsxs)("div",{onClick:r,className:"flex items-center gap-2 py-2 px-2.5 rounded-lg cursor-pointer transition-all border-[0.5px]",style:{borderColor:t?o:n?"#3a3a37":"#e5e7eb",background:t?n?tK:"#eef3fb":n?"#30302e":"#fff"},children:[(0,a.jsx)("div",{className:"w-[13px] h-[13px] rounded-full flex items-center justify-center shrink-0 border-[1.5px]",style:{borderColor:d},children:t&&(0,a.jsx)("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:i}})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[11px] font-medium",style:{color:c},children:s}),l&&(0,a.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted mt-px",children:l})]})]})}function t0(e){let{list:t,label:r,color:s,onManage:l,onUpload:n,invalidCount:i=0}=e,{t:o}=(0,P.Bd)("agent-x"),{isDark:d}=(0,er.D)();return(0,a.jsx)("div",{className:"rounded-lg mb-2 overflow-hidden bg-[#f8f7f4] dar
1k:bg-surface border-[0.5px]",style:{borderColor:i>0?"".concat(tR.Ut,"55"):"".concat(s,"33")},children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsxs)("div",{onClick:l,className:"flex-1 py-2.5 px-3 cursor-pointer flex items-center justify-between transition-colors",onMouseEnter:e=>e.currentTarget.style.background="".concat(s,"10"),onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:s}}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[11px] font-medium text-gray-700 dark:text-ink-secondary",children:r}),i>0?(0,a.jsx)("div",{className:"text-[10px] font-medium",style:{color:tR.Ut},children:o("accounts.countInvalid",{invalid:i,total:t.length})}):(0,a.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted",children:o("accounts.count",{count:t.length})})]})]}),(0,a.jsx)("span",{className:"text-[11px] font-medium",style:{color:s},children:o("accounts.manage")})]}),(0,a.jsx)("div",{className:"w-[0.5px] h-9 shrink-0",style:{background:"".concat(s,"33")}}),(0,a.jsxs)("div",{onClick:n,className:"py-2.5 px-3 cursor-pointer flex items-center gap-2 transition-colors",onMouseEnter:e=>e.currentTarget.style.background="".concat(s,"10"),onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,a.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",className:"shrink-0",children:[(0,a.jsx)("path",{d:"M7 2L4 5.5h2v5h2v-5h2L7 2z",fill:d?"#6b7280":"#9ca3af"}),(0,a.jsx)("path",{d:"M2 10.5h10v1.5H2z",fill:d?"#6b7280":"#9ca3af"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[11px] font-medium text-gray-700 dark:text-ink-secondary",children:o("accounts.upload")}),(0,a.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted",children:o("accounts.uploadHint")})]})]})]})})}function t1(e){let{checked:t,onClick:r,label:s,description:l,children:n}=e,{isDark:i}=(0,er.D)();i||tR.Hl;let o=i?tY:tR.Hl,d=i?t?tY:"#555":t?tR.Hl:"#d1d5db",c=i?t?tJ:"transparent":t?tR.Hl:"transparent",x=i?t?tJ:"#d4d0c5":t?tR.Hl:"#374151";return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{onClick:r,className:"flex items-center gap-[7px] py-[7px] px-2.5 rounded-lg cursor-pointer transition-all border-[0.5px]",style:{borderColor:t?o:i?"#3a3a37":"#e5e7eb",background:t?i?tK:"#eef3fb":i?"#30302e":"#fff"},children:[(0,a.jsx)("div",{className:"w-[13px] h-[13px] rounded-[3px] flex items-center justify-center shrink-0 border-[1.5px]",style:{borderColor:d,background:c},children:t&&(0,a.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",stroke:"white",strokeWidth:"1.5",children:(0,a.jsx)("path",{d:"M1.5 4l2 2 3-4"})})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("span",{className:"text-[12px]",style:{color:x,fontWeight:t?500:400},children:s}),l&&(0,a.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted mt-px",children:l})]})]}),n]})}function t2(){return(0,a.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-200 dark:border-surface-active border-t-[#1a3a6b] dark:border-t-[#cc785c] animate-spin shrink-0"})}function t5(e){let{isCompetitive:t,onSelect:r}=e,{t:s}=(0,P.Bd)("agent-x");return(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-1.5 mb-1",children:[(0,a.jsx)(tQ,{selected:!t,onClick:()=>r("trend"),label:s("analysisType.trend"),desc:s("analysisType.trendDesc")}),(0,a.jsx)(tQ,{selected:t,onClick:()=>r("competitive"),label:s("analysisType.competitive"),desc:s("analysisType.competitiveDesc")})]})}function t4(e){let{isCompetitive:t,ownAccounts:r,rivalAccounts:s,trendAccounts:l,uploadWarning:n,setUploadWarning:i,setShowModal:o,ownRef:d,rivalRef:c,trendRef:x,handleFileUpload:u,setOwnAccounts:m,setRivalAccounts:h,setTrendAccounts:g,invalidAccounts:p=[]}=e,{t:b}=(0,P.Bd)("agent-x"),f=(t?r.length+s.length:l.length)>=tR.Uf,v=new Set(p.map(e=>e.toLowerCase()));return(0,a.jsxs)(a.Fragment,{children:[t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{ref:d,type:"file",accept:".xlsx,.xls,.csv",className:"hidden",onChange:e=>{var t;(null===(t=e.target.files)||void 0===t?void 0:t[0])&&u(e.target.files[0],m,[r,s])}}),(0,a.jsx)("input",{ref:c,type:"file",accept:".xlsx,.xls,.csv",className:"hidden",onChange:e=>{var t;(null===(t=e.target.files)||void 0===t?void 0:t[0])&&u(e.target.files[0],h,[r,s])}}),(0,a.jsx)(t0,{list:r,label:b("accounts.own"),color:tR.Hl,onManage:()=>
1o("own"),onUpload:()=>{var e;return null===(e=d.current)||void 0===e?void 0:e.click()},invalidCount:r.filter(e=>v.has(e.handle.toLowerCase())).length}),(0,a.jsx)(t0,{list:s,label:b("accounts.rival"),color:tR.UH,onManage:()=>o("rival"),onUpload:()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.click()},invalidCount:s.filter(e=>v.has(e.handle.toLowerCase())).length})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{ref:x,type:"file",accept:".xlsx,.xls,.csv",className:"hidden",onChange:e=>{var t;(null===(t=e.target.files)||void 0===t?void 0:t[0])&&u(e.target.files[0],g,[l])}}),(0,a.jsx)(t0,{list:l,label:b("accounts.monitored"),color:"#7c3aed",onManage:()=>o("trend"),onUpload:()=>{var e;return null===(e=x.current)||void 0===e?void 0:e.click()},invalidCount:l.filter(e=>v.has(e.handle.toLowerCase())).length})]}),f&&(0,a.jsx)("div",{className:"mt-1 py-[7px] px-2.5 rounded-[7px] bg-[#fff0f0] dark:bg-red-900/20 border-[0.5px] border-[#fca5a5] dark:border-red-500/30",children:(0,a.jsx)("div",{className:"text-[10px]",style:{color:tR.UH},children:b("accounts.limitReached",{max:tR.Uf})})}),n&&(0,a.jsxs)("div",{className:"mt-1 py-[7px] px-2.5 rounded-[7px] bg-[#fffbeb] dark:bg-amber-900/20 border-[0.5px] border-[#fde68a] dark:border-amber-500/30 flex items-start justify-between gap-1.5",children:[(0,a.jsxs)("div",{className:"text-[10px] text-[#92400e] dark:text-amber-400 leading-normal",children:["â ",n]}),(0,a.jsx)("span",{className:"text-[12px] text-gray-400 dark:text-ink-muted cursor-pointer shrink-0",onClick:()=>i(null),children:"\xd7"})]})]})}function t3(e){let{model:t,setModel:r,models:s}=e,{isDark:l}=(0,er.D)(),n=l?"#cc785c":tR.Hl,i=l?"rgba(204,120,92,0.12)":"#eef3fb",o=l?"rgba(204,120,92,0.5)":tR.Hl,d=l?"#3a3a37":"#e5e7eb",c=l?"#30302e":"#fff";return(0,a.jsx)("div",{className:"grid grid-cols-3 gap-1.5 mb-1",children:s.map(e=>{let s=t===e.tag;return(0,a.jsxs)("div",{onClick:()=>r(e.tag),className:"relative rounded-lg py-[9px] px-[11px] cursor-pointer transition-all",style:{border:"".concat(s?"1.5px":"0.5px"," solid ").concat(s?o:d),background:s?i:c},children:[(0,a.jsx)("div",{className:"text-[12px] font-medium text-[#111] dark:text-ink-primary",children:e.name}),s&&(0,a.jsx)("span",{className:"absolute top-[5px] right-2 text-[10px] font-medium",style:{color:n},children:"â"})]},e.tag)})})}let t6="w-full border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[7px] py-2 px-2.5 text-[12px] text-[#111] dark:text-ink-primary bg-[#f9f9f7] dark:bg-surface font-[inherit] outline-none box-border dark:[color-scheme:dark]";function t8(e){let{timeSel:t,setTimeSel:r,customFrom:s,setCustomFrom:l,customFromTime:n,setCustomFromTime:i,customTo:o,setCustomTo:d,customToTime:c,setCustomToTime:x,customRangeDays:u,customRangeExceeded:m,contentFilters:h}=e,{t:g}=(0,P.Bd)("agent-x"),p=h.includes("Incoming replies"),{isDark:b}=(0,er.D)(),f=b?"#cc785c":tR.Hl,v=b?"rgba(204,120,92,0.12)":"#eef3fb",y=b?"rgba(204,120,92,0.5)":tR.Hl,k=b?"#3a3a37":"#e5e7eb";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex gap-[5px] mb-2 flex-wrap",children:tR.p6.map(e=>{let s=t===e.val;return(0,a.jsx)("div",{onClick:()=>r(e.val),className:"flex-1 text-center py-1.5 px-1 rounded-[7px] text-[11px] cursor-pointer transition-all border-[0.5px]",style:{borderColor:s?y:k,background:s?v:"transparent",color:s?f:b?"#a8a39a":"#6b7280",fontWeight:s?500:400},children:g("time.".concat(e.val),{defaultValue:e.label})},e.val)})}),"custom"!==t&&(()=>{let e=tR.Qg[t]||500,r=tR.n1[t]||1e3;return(0,a.jsxs)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted mb-2 py-2 px-2.5 bg-[#f8f7f4] dark:bg-surface rounded-[6px] flex flex-col gap-[3px]",children:[(0,a.jsx)("div",{children:(0,a.jsx)(P.x6,{t:g,i18nKey:"time.capsTweets",values:{cap:e},components:{b:(0,a.jsx)("strong",{className:"text-gray-700 dark:text-ink-secondary"})}})}),p&&(0,a.jsx)("div",{className:"text-gray-400 dark:text-ink-muted",children:(0,a.jsx)(P.x6,{t:g,i18nKey:"time.capsReplies",values:{cap:r},components:{b:(0,a.jsx)("strong",{className:"text-gray-700 dark:text-ink-secondary"})}})})]})})(),"custom"===t&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 mb-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-1.5",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(tZ,{children:g("time.fromDate")}),(0,a.jsx)("input",{type:"date",className:t6,value:s,onChange:e=>l(e.target.value)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(tZ,{children:g("time.fromTime")}),(0,a.jsx)("input",{type:"time",className:t6,value:n,onChange:e=>i(e.target.value)})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-1.5",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(tZ,{children:g("time.toDate")}),(0,a.jsx)("input",{type:"date",className:t6,value:o,onChange:e=>d(e.target.value)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(tZ,{children:g("time.toTime")}),(0,a.jsx)("input",{type:"time",className:t6,value:c,onChange:e=>x(e.target.value)})]})]}),(0,a.jsx)("div",{className:"text-[10px] text-gray-400",children:g("time.maxRange")}),m&&(0,a.jsx)("div",{className:"text-[10px] text-[#c8102e] mt-1",children:g("time.exceeded",{days:u})})]})]})}let t7="rgba(204,120,92,0.5)";function t9(e){let{tweetLang:t,setTweetLang:r,contentFilters:s,toggleFilter:l,setContentFilters:n,threadMode:i,setThreadMode:o,minEngagement:d,setMinEngagement:c}=e,{t:x}=(0,P.Bd)("agent-x"),u=s.includes("Incoming replies"),{isDark:m}=(0,er.D)(),h=m?"#cc785c":tR.Hl,g=m?t7:tR.Hl,p=m?"#3a3a37":"#e5e7eb";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tZ,{children:x("filters.tweetLanguage")}),(0,a.jsx)("div",{className:"flex gap-[5px] mb-2.5 overflow-hidden",children:tR.mN.map(e=>{let s="all"===e.val?6===t.length:t.includes(e.val);return(0,a.jsx)("div",{className:"py-1 px-2.5 rounded-xl text-[11px] cursor-pointer transition-all shrink-0 border-[0.5px]",style:{borderColor:s?g:p,background:s?h:"transparent",color:s?"#fff":m?"#a8a39a":"#6b7280"},onClick:()=>
1{if("all"===e.val){r([...tR.IB]);return}r(t=>t.includes(e.val)?t.filter(t=>t!==e.val):[...t,e.val])},children:"all"===e.val?x("filters.allLanguages"):e.label},e.val)})}),(0,a.jsx)(tZ,{children:x("filters.accountSays")}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5 mb-3",children:tR.Af.map(e=>{let{key:t,label:r}=e;return(0,a.jsx)(t1,{checked:s.includes(t),onClick:()=>l(s,n,t),label:x("filters.".concat(t),{defaultValue:r})},t)})}),(0,a.jsx)(tZ,{children:x("filters.audienceSays")}),(0,a.jsxs)("div",{className:"rounded-lg overflow-hidden border-[0.5px]",style:{borderColor:u?m?t7:tR.Hl+"44":m?"#3a3a37":"#e5e7eb"},children:[(0,a.jsx)(t1,{checked:u,onClick:()=>l(s,n,"Incoming replies"),label:x("filters.incomingReplies"),description:""}),u&&(0,a.jsxs)("div",{className:"py-2.5 px-2.5 pb-3 bg-[#f8f7f4] dark:bg-surface border-t-[0.5px] border-t-[#e5e7eb] dark:border-t-border flex flex-col gap-2.5",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex justify-between mb-[5px]",children:[(0,a.jsx)("span",{className:"text-[11px] text-gray-500 dark:text-ink-muted",children:x("filters.minEngagement")}),(0,a.jsx)("span",{className:"text-[11px] font-medium",style:{color:h},children:x("filters.engagementValue",{count:d})})]}),(0,a.jsx)("input",{type:"range",min:0,max:50,step:1,value:d,onChange:e=>c(Number(e.target.value)),className:"w-full accent-[#cc785c]"}),(0,a.jsxs)("div",{className:"flex justify-between text-[10px] text-gray-400 dark:text-ink-muted mt-[3px]",children:[(0,a.jsx)("span",{children:x("filters.engagementLow")}),(0,a.jsx)("span",{children:x("filters.engagementHigh")})]}),0===d&&(0,a.jsx)("div",{className:"text-[10px] text-[#c8102e] mt-1",children:x("filters.noQualityFilter")})]}),(0,a.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted py-[7px] px-[9px] bg-white dark:bg-surface-elevated rounded-[6px] border-[0.5px] border-[#e5e7eb] dark:border-border leading-relaxed",children:(0,a.jsx)(P.x6,{t:x,i18nKey:"filters.pagination",components:{b:(0,a.jsx)("strong",{className:"text-gray-700 dark:text-ink-secondary"})}})})]})]}),(0,a.jsx)(tZ,{className:"mt-2.5",children:x("filters.threadMode")}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-1.5",children:[(0,a.jsx)(tQ,{selected:"individual"===i,onClick:()=>o("individual"),label:x("filters.individual"),desc:x("filters.individualDesc")}),(0,a.jsx)(tQ,{selected:"merged"===i,onClick:()=>o("merged"),label:x("filters.merged"),desc:x("filters.mergedDesc")})]})]})}let re=["Turkish","English","Both"];function rt(e){let{outputLang:t,setOutputLang:r}=e,{t:s}=(0,P.Bd)("agent-x"),l=re.map(e=>({value:e,label:s("output.".concat(e),{defaultValue:e})}));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tZ,{children:s("output.language")}),(0,a.jsx)(e$.A,{value:t,onChange:r,options:l,className:"mb-1"})]})}function rr(e){let{prompt:t,setPrompt:r,isTemplatePrompt:s,setIsTemplatePrompt:l,promptFocused:n,setPromptFocused:i,PROMPTS:o}=e,{t:d}=(0,P.Bd)("agent-x"),{isDark:c}=(0,er.D)(),x=c?"#cc785c":tR.Hl;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)(t$,{children:d("sections.prompt")}),t.trim()&&!s&&(0,a.jsx)("span",{className:"text-[11px] font-medium cursor-pointer",style:{color:x},children:d("prompt.enhance")})]}),(0,a.jsx)("textarea",{className:"w-full rounded-[7px] py-2 px-2.5 text-[12px] text-[#111] dark:text-ink-primary bg-[#f9f9f7] dark:bg-surface font-[inherit] outline-none box-border leading-relaxed resize-none mb-2 border-[0.5px] placeholder:text-gray-400 dark:placeholder:text-ink-muted",style:{height:n?300:108,borderColor:t.trim()?c?"#3a3a37":"#e5e7eb":c?"#ef4444":"#fca5a5",transition:"height 0.25s ease, border 0.2s",overflow:n?"auto":"hidden"},value:t,onChange:e=>{r(e.target.value),l(!1)},onFocus:()=>i(!0),onBlur:()=>i(!1),placeholder:d("prompt.placeholder")}),(0,a.jsx)("div",{className:"flex gap-[5px]",children:Object.keys(o).map(e=>(0,a.jsx)("div",{className:"flex-1 text-center py-1.5 px-2 rounded-xl text-[11px] cursor-pointer text-gray-500 dark:text-ink-muted bg-transparent border-[0.5px] border-[#e5e7eb] dark:border-border hover:border-[#cc785c] dark:hover:text-claude transition-colors",onClick:()=>{r(o[e]),l(!0)},children:d("promptTemplates.".concat(e),{defaultValue:e})},e))})]})}function ra(e){let{disabled:t,onClick:r}=e,{t:s}=(0,P.Bd)("agent-x");return(0,a.jsx)("div",{className:"py-3 px-[18px] border-t-[0.5px] border-t-[#e5e7eb] dark:border-t-border bg-white dark:bg-surface-elevated shrink-0",children:(0,a.jsxs)("button",{className:"w-full flex items-center justify-center gap-1.5 rounded-[7px] py-2 px-4 text-[12px] font-medium text-white font-[inherit] border-none",style:{background:tR.UH,opacity:t?.4:1,cursor:t?"not-allowed":"pointer"},onClick:()=>{t||r()},children:[(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"white",children:(0,a.jsx)("path",{d:"M2 1.5l8 4-8 4z"})}),s("run.analysis")]})})}function rs(e){let{hook:t}=e,{t:r}=(0,P.Bd)("agent-x"),s=t.prompt.trim()&&!t.customRangeExceeded;return(0,a.jsxs)("div",{className:"h-full min-h-0 border-r-[0.5px] border-r-[#e5e7eb] dark:border-r-border flex flex-col bg-white dark:bg-surface-elevated overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto py-4 px-[18px]",children:[(0,a.jsx)(t$,{children:r("sections.analysisType")}),(0,a.jsx)(t5,{isCompetitive:t.isCompetitive,onSelect:e=>{t.setAnalysisType(e),t.setTab("Summary"),t.setPhase("idle"),t.setPrompt("")}}),(0,a.jsx)(tX,{}),(0,a.jsx)(t$,{children:r("sections.accounts")}),(0,a.jsx)(t4,{isCompetitive:t.isCompetitive,ownAccounts:t.ownAccounts,rivalAccounts:t.rivalAccounts,trendAccounts:t.trendAccounts,uploadWarning:t.uploadWarning,setUploadWarning:t.setUploadWarning,setShowModal:t.setShowModal,ownRef:t.ownRef,rivalRef:t.rivalRef,trendRef:t.trendRef,handleFileUpload:t.handleFileUpload,setOwnAccounts:t.setOwnAccounts,setRivalAccounts:t.setRivalAccounts,setTrendAccounts:t.setTrendAccounts,invalidAccounts:t.invali
1dAccounts}),(0,a.jsx)(tX,{}),(0,a.jsx)(t$,{children:r("sections.model")}),(0,a.jsx)(t3,{model:t.model,setModel:t.setModel,models:t.agenticModels}),(0,a.jsx)(tX,{}),(0,a.jsx)(t$,{children:r("sections.timeRange")}),(0,a.jsx)(t8,{timeSel:t.timeSel,setTimeSel:t.setTimeSel,customFrom:t.customFrom,setCustomFrom:t.setCustomFrom,customFromTime:t.customFromTime,setCustomFromTime:t.setCustomFromTime,customTo:t.customTo,setCustomTo:t.setCustomTo,customToTime:t.customToTime,setCustomToTime:t.setCustomToTime,customRangeDays:t.customRangeDays,customRangeExceeded:t.customRangeExceeded,contentFilters:t.contentFilters}),(0,a.jsx)(tX,{}),(0,a.jsx)(t$,{children:r("sections.filters")}),(0,a.jsx)(t9,{tweetLang:t.tweetLang,setTweetLang:t.setTweetLang,contentFilters:t.contentFilters,toggleFilter:t.toggleFilter,setContentFilters:t.setContentFilters,threadMode:t.threadMode,setThreadMode:t.setThreadMode,minEngagement:t.minEngagement,setMinEngagement:t.setMinEngagement}),(0,a.jsx)(tX,{}),(0,a.jsx)(t$,{children:r("sections.output")}),(0,a.jsx)(rt,{outputLang:t.outputLang,setOutputLang:t.setOutputLang}),(0,a.jsx)(tX,{}),(0,a.jsx)(rr,{prompt:t.prompt,setPrompt:t.setPrompt,isTemplatePrompt:t.isTemplatePrompt,setIsTemplatePrompt:t.setIsTemplatePrompt,promptFocused:t.promptFocused,setPromptFocused:t.setPromptFocused,PROMPTS:t.PROMPTS})]}),(0,a.jsx)(ra,{disabled:!s||t.costLoading||!t.isEditor,onClick:()=>t.calcCost()})]})}function rl(e){let{isCompetitive:t}=e,{t:r}=(0,P.Bd)("agent-x");return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[(0,a.jsx)("div",{className:"w-10 h-10 border-[0.5px] border-[#e5e7eb] dark:border-border rounded-full flex items-center justify-center mb-3",children:(0,a.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",stroke:"#d1d5db",strokeWidth:"1.2",children:[(0,a.jsx)("circle",{cx:"9",cy:"9",r:"7.5"}),(0,a.jsx)("path",{d:"M9 5.5v4l2.5 1.5"})]})}),(0,a.jsx)("div",{className:"text-[13px] font-medium dark:text-ink-primary mb-1.5",children:r("idle.title")}),(0,a.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-ink-muted leading-relaxed",children:r(t?"idle.competitive":"idle.trend")})]})}function rn(e){let{stepDone:t,activeStep:r}=e,{t:s}=(0,P.Bd)("agent-x");return(0,a.jsxs)("div",{className:"flex flex-col gap-2 max-w-[420px]",children:[(0,a.jsx)("div",{className:"text-[12px] font-medium dark:text-ink-primary mb-1",children:s("running.title")}),tR.UT.map((e,l)=>{let n=t.includes(l);return(0,a.jsxs)("div",{className:"flex items-center gap-2.5 py-2.5 px-3 bg-white dark:bg-surface-elevated border-[0.5px] border-[#e5e7eb] dark:border-border rounded-lg transition-opacity duration-300",style:{opacity:l<=r?1:.35},children:[n?(0,a.jsx)("div",{className:"w-3.5 h-3.5 bg-[#dcfce7] dark:bg-green-900/30 rounded-full flex items-center justify-center shrink-0",children:(0,a.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",stroke:"#166534",strokeWidth:"1.5",children:(0,a.jsx)("path",{d:"M1.5 4l2 2 3-4"})})}):r===l?(0,a.jsx)(t2,{}):(0,a.jsx)("div",{className:"w-3.5 h-3.5 border-[0.5px] border-[#e5e7eb] dark:border-border rounded-full shrink-0"}),(0,a.jsx)("span",{className:"text-[12px] ".concat(n?"text-gray-500 dark:text-ink-muted":"text-[#111] dark:text-ink-primary"),children:s("runSteps.".concat(tR.KC[l]),{defaultValue:e})})]},l)})]})}function ri(e){let{onOpenQueues:t,onNewAnalysis:r}=e,{t:s}=(0,P.Bd)("agent-x");return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[(0,a.jsx)("div",{className:"w-10 h-10 border-[0.5px] border-green-200 dark:border-green-900/50 bg-green-50 dark:bg-green-900/20 rounded-full flex items-center justify-center mb-3",children:(0,a.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",stroke:"#16a34a",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M4.5 9.5l3 3 6-7"})})}),(0,a.jsx)("div",{className:"text-[13px] font-medium dark:text-ink-primary mb-1.5",children:s("queued.title")}),(0,a.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-ink-muted leading-relaxed max-w-[320px] mb-4",children:s("queued.description")}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[t&&(0,a.jsx)("button",{onClick:t,className:"px-3 py-1.5 text-[12px] font-medium rounded-md bg-[#1a3a6b] dark:bg-claude text-white hover:opacity-90 transition-opacity",children:s("queued.viewQueue")}),(0,a.jsx)("button",{onClick:r,className:"px-3 py-1.5 text-[12px] rounded-md border-[0.5px] border-[#e5e7eb] dark:border-border text-gray-600 dark:text-ink-secondary hover:bg-gray-50 dark:hover:bg-surface-active transition-colors",children:s("queued.newAnalysis")})]})]})}var ro=r(51742);eY.xI.setOptions({async:!1});let rd=e=>{let{reportMeta:t,content:r,showToast:s}=e,{t:l}=(0,P.Bd)("agent-x"),n=(e,t)=>tE(l,e,t),{isDark:i}=(0,er.D)(),o=e=>{let t=[];
1return e.childNodes.forEach(e=>{var r,a;if(e.nodeType===Node.TEXT_NODE){let a=null===(r=e.textContent)||void 0===r?void 0:r.trim();a&&t.push(new eW.NTc({text:a}))}else if("STRONG"===e.nodeName||"B"===e.nodeName)t.push(new eW.NTc({text:e.textContent||"",bold:!0}));else if("EM"===e.nodeName||"I"===e.nodeName)t.push(new eW.NTc({text:e.textContent||"",italics:!0}));else if("A"===e.nodeName){let r=e.href;t.push(new eW.Mf2({children:[new eW.NTc({text:e.textContent||r,style:"Hyperlink",color:"0563C1",underline:{}})],link:r}))}else{let r=null===(a=e.textContent)||void 0===a?void 0:a.trim();r&&t.push(new eW.NTc({text:r}))}}),t.length>0?t:[new eW.NTc({text:" "})]},d=e=>{let t=new DOMParser().parseFromString(e,"text/html"),r=[],a=(e,t)=>{let r=[];if(e.nodeType===Node.TEXT_NODE){var s;let r=null===(s=e.textContent)||void 0===s?void 0:s.trim();return r&&"ul"!==t&&"ol"!==t?[new eW.NTc({text:r})]:[]}if(e.nodeType===Node.ELEMENT_NODE){let t=e.tagName.toLowerCase();switch(t){case"h1":r.push(new eW.fzL({text:e.textContent||" ",heading:eW.Fmo.HEADING_1,spacing:{before:360,after:240}}));break;case"h2":r.push(new eW.fzL({text:e.textContent||" ",heading:eW.Fmo.HEADING_2,spacing:{before:320,after:200}}));break;case"h3":r.push(new eW.fzL({text:e.textContent||" ",heading:eW.Fmo.HEADING_3,spacing:{before:280,after:160}}));break;case"h4":r.push(new eW.fzL({text:e.textContent||" ",heading:eW.Fmo.HEADING_4,spacing:{before:240,after:120}}));break;case"p":{let t=[];e.childNodes.forEach(e=>{if(e.nodeType===Node.TEXT_NODE){let r=e.textContent;r&&t.push(new eW.NTc({text:r}))}else if("STRONG"===e.nodeName||"B"===e.nodeName)t.push(new eW.NTc({text:e.textContent||"",bold:!0}));else if("EM"===e.nodeName||"I"===e.nodeName)t.push(new eW.NTc({text:e.textContent||"",italics:!0}));else if("A"===e.nodeName){let r=e.href;t.push(new eW.Mf2({children:[new eW.NTc({text:e.textContent||r,style:"Hyperlink",color:"0563C1",underline:{}})],link:r}))}else{let r=e.textContent;r&&t.push(new eW.NTc({text:r}))}}),t.length>0&&r.push(new eW.fzL({children:t,spacing:{before:120,after:120}}));break}case"ul":e.querySelectorAll(":scope > li").forEach(e=>{let t=o(e);r.push(new eW.fzL({children:t,bullet:{level:0},spacing:{before:80,after:80}}))});break;case"ol":e.querySelectorAll(":scope > li").forEach(e=>{let t=o(e);r.push(new eW.fzL({children:t,numbering:{reference:"numbered-list",level:0},spacing:{before:80,after:80}}))});break;case"table":{let t=[];e.querySelectorAll("tr").forEach((e,r)=>{var a;let s=[],l=null!==e.querySelector("th")||(null===(a=e.parentElement)||void 0===a?void 0:a.tagName)==="THEAD";e.querySelectorAll("th, td").forEach(e=>{let t=o(e);s.push(new eW.nA6({children:[new eW.fzL({children:t,spacing:{before:100,after:100}})],shading:l?{fill:"F9FAFB"}:r%2==0?{fill:"FFFFFF"}:{fill:"F9FAFB"},borders:{top:{style:eW.kDD.SINGLE,size:1,color:"D1D5DB"},bottom:{style:eW.kDD.SINGLE,size:1,color:"D1D5DB"},left:{style:eW.kDD.SINGLE,size:1,color:"D1D5DB"},right:{style:eW.kDD.SINGLE,size:1,color:"D1D5DB"}}}))}),s.length>0&&t.push(new eW.Hjg({children:s}))}),t.length>0&&(r.push(new eW.XIK({rows:t,width:{size:100,type:eW.PsV.PERCENTAGE}})),r.push(new eW.fzL({children:[new eW.NTc({text:" "})],spacing:{before:240,after:240}})));break}case"br":r.push(new eW.fzL({children:[new eW.NTc({text:" "})],spacing:{before:80,after:80}}));break;case"hr":r.push(new eW.fzL({children:[new eW.NTc({text:" "})],border:{bottom:{color:"CCCCCC",space:1,style:"single",size:12}},spacing:{before:240,after:240}}));break;case"blockquote":r.push(new eW.fzL({children:[new eW.NTc({text:e.textContent||" ",italics:!0,color:"6B7280"})],spacing:{before:120,after:120},indent:{left:720}}));break;case"strong":case"b":return[new eW.NTc({text:e.textContent||"",bold:!0})];case"em":case"i":return[new eW.NTc({text:e.textContent||"",italics:!0})];default:e.childNodes.forEach(e=>{r.push(...a(e,t))})}}return r};return t.body.childNodes.forEach(e=>{r.push(...a(e))}),r.filter(Boolean)},c=(e,t)=>{let r={style:eW.kDD.SINGLE,size:1,color:"E5E7EB"},a={top:r,bottom:r,left:r,right:r};return new eW.Hjg({children:[new eW.nA6({children:[new eW.fzL({children:[new eW.NTc({text:e,bold:!0,size:20,color:"6B7280"})],spacing:{before:60,after:60}})],width:{size:30,type:eW.PsV.PERCENTAGE},shading:{fill:"F8F7F4"},borders:a}),new eW.nA6({children:[new eW.fzL({children:[new eW.NTc({text:t,size:20})],spacing:{before:60,after:60}})],width:{size:70,type:eW.PsV.PERCENTAGE},borders:a})]})},x=async()=>{try{if(s(l("export.generatingDocx"),"loading"),!r){s(l("export.noContent"),"error");return}let e=[];e.push(new eW.fzL({children:[new eW.NTc({text:l("export.reportTitle"),bold:!0,size:36,color:"1A3A6B"})],heading:eW.Fmo.HEADING_1,spacing:{after:120},alignment:eW.Yus.CENTER})),e.push(new eW.fzL({children:[new eW.NTc({text:l("export.reportSubtitle",{type:n("type",t.type)}),size:24,color:"6B7280"})],spacing:{after:300},alignment:eW.Yus.CENTER}));let a=[];[{label:l("export.rows.date"),value:t.date},{label:l("export.rows.type"),value:n("type",t.type)},{label:l("export.rows.model"),value:t.model},{label:l("export.rows.timeRange"),value:n("timeRange",t.timeRange)},{label:l("export.rows.tweetLang"),value:n("tweetLang",t.tweetLang)},{label:l("export.rows.contentTypes"),value:n("contentTypes",t.contentTypes)},{label:l("export.rows.threadMode"),value:n("threadMode",t.threadMode)},{label:l("export.rows.outputLang"),value:n("outputLang",t.outputLang)},{label:l("export.rows.minEngagement"),value:"N/A"!==t.minEngagement?n("minEngagement",t.minEngagement):null},{label:l("export.rows.ownAccounts"),value:t.ownAccounts},{label:l("export.rows.rivalAccounts"),value:t.rivalAccounts},{label:l("export.rows.trendAccounts"),value:t.trendAccounts},{label:l("export.rows.promptLabel"),value:n("promptLabel",t.promptLabel)}
1].forEach(e=>{e.value&&a.push(c(e.label,e.value))}),a.length>0&&e.push(new eW.XIK({rows:a,width:{size:100,type:eW.PsV.PERCENTAGE}})),e.push(new eW.fzL({children:[new eW.NTc({text:" "})],border:{bottom:{color:"CCCCCC",space:1,style:"single",size:12}},spacing:{before:400,after:400}})),e.push(new eW.fzL({children:[new eW.NTc({text:l("export.aiAnalysis"),bold:!0,size:28,color:"1A3A6B"})],heading:eW.Fmo.HEADING_2,spacing:{before:200,after:240},shading:{fill:"EEF3FB"},border:{top:{color:"C7D9F5",space:1,style:"single",size:6},bottom:{color:"C7D9F5",space:1,style:"single",size:6},left:{color:"C7D9F5",space:1,style:"single",size:6},right:{color:"C7D9F5",space:1,style:"single",size:6}}}));let i=eY.xI.parse(r),o=d(i);e.push(...o);let x=e.filter(e=>null!=e),u=new eW.yoT({numbering:{config:[{reference:"numbered-list",levels:[{level:0,format:"decimal",text:"%1.",alignment:eW.Yus.LEFT}]}]},sections:[{children:x}]}),m=await eW.ND6.toBlob(u),h="x_intelligence_".concat(t.type.toLowerCase().replace(/\s+/g,"_"),"_").concat(new Date().toISOString().split("T")[0],".docx");(0,eJ.saveAs)(m,h),s(l("export.docxDone"),"success")}catch(e){console.error("DOCX export failed:",e),s(l("export.docxFailed",{message:e instanceof Error?e.message:l("export.unknownError")}),"error")}};return(0,a.jsxs)("button",{onClick:x,disabled:!r,style:{width:"100%",background:"transparent",color:i?"#d4d0c5":"#374151",border:"none",padding:"8px 12px",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",gap:8,fontFamily:"inherit",borderRadius:6,transition:"background 0.15s"},onMouseEnter:e=>e.currentTarget.style.background=i?"#3a3a37":"#f5f5f4",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,a.jsx)(ro.A,{size:14,color:i?"#cc785c":"#1a3a6b",strokeWidth:1.8}),l("export.docxButton")]})},rc=e=>{let{reportMeta:t,content:r,showToast:l}=e,{t:n}=(0,P.Bd)("agent-x"),[i,o]=(0,s.useState)(!1),{isDark:d}=(0,er.D)(),c=async()=>{if(!r){l(n("export.noContent"),"error");return}try{o(!0),l(n("export.generatingPdf"),"loading");let e=await fetch("/api/export-pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reportMeta:{...t,type:tE(n,"type",t.type),timeRange:tE(n,"timeRange",t.timeRange),tweetLang:tE(n,"tweetLang",t.tweetLang),contentTypes:tE(n,"contentTypes",t.contentTypes),threadMode:tE(n,"threadMode",t.threadMode),outputLang:tE(n,"outputLang",t.outputLang),minEngagement:tE(n,"minEngagement",t.minEngagement),promptLabel:tE(n,"promptLabel",t.promptLabel)},content:r,labels:{title:n("export.reportTitle"),subtitle:n("export.reportSubtitle",{type:tE(n,"type",t.type)}),analysisHeader:n("export.aiAnalysis"),rows:{date:n("export.rows.date"),type:n("export.rows.type"),model:n("export.rows.model"),timeRange:n("export.rows.timeRange"),tweetLang:n("export.rows.tweetLang"),contentTypes:n("export.rows.contentTypes"),threadMode:n("export.rows.threadMode"),outputLang:n("export.rows.outputLang"),minEngagement:n("export.rows.minEngagement"),ownAccounts:n("export.rows.ownAccounts"),rivalAccounts:n("export.rows.rivalAccounts"),trendAccounts:n("export.rows.trendAccounts"),promptLabel:n("export.rows.promptLabel")}},fileNameType:t.type})});if(!e.ok){let t=n("export.pdfFailed");try{let r=await e.json();t=(null==r?void 0:r.details)||(null==r?void 0:r.error)||t}catch(a){let r=await e.text();r&&(t=r)}throw Error(t)}let a=await e.blob(),s=window.URL.createObjectURL(a),i=function(e){if(!e)return"x-intelligence-report.pdf";let t=e.match(/filename="([^"]+)"/i);return(null==t?void 0:t[1])?t[1]:"x-intelligence-report.pdf"}(e.headers.get("Content-Disposition")),d=document.createElement("a");d.href=s,d.download=i,document.body.appendChild(d),d.click(),d.remove(),window.URL.revokeObjectURL(s),l(n("export.pdfDone"),"success")}catch(e){console.error("PDF export failed:",e),l(e instanceof Error?e.message:n("export.pdfFailed"),"error")}finally{o(!1)}};return(0,a.jsxs)("button",{onClick:c,disabled:!r||i,style:{width:"100%",background:"transparent",color:d?"#d4d0c5":"#374151",border:"none",padding:"8px 12px",fontSize:12,cursor:!r||i?"not-allowed":"pointer",display:"flex",alignItems:"center",gap:8,fontFamily:"inherit",borderRadius:6,transition:"background 0.15s, opacity 0.15s",opacity:!r||i?.6:1},onMouseEnter:e=>{r&&!i&&(e.currentTarget.style.background=d?"#3a3a37":"#f5f5f4")},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:[(0,a.jsx)(ro.A,{size:14,color:"#E97451",strokeWidth:1.8}),i?n("export.pdfExporting"):n("export.pdfButton")]})};function rx(e){let{reportMeta:t,apiResult:r,exportOpen:s,setExportOpen:l,exportMenuRef:n,showToast:i}=e,{t:d}=(0,P.Bd)("agent-x"),c=(e,t)=>tE(d,e,t),x=t?[{lbl:d("summary.analysisType"),val:c("type",t.type)},{lbl:d("summary.model"),val:t.model},{lbl:d("summary.timeRange"),val:c("timeRange",t.timeRange)},{lbl:d("summary.languages"),val:c("tweetLang",t.tweetLang)},{lbl:d("summary.threadMode"),val:c("threadMode",t.threadMode)},{lbl:d("summary.contentTypes"),val:c("contentTypes",t.contentTypes)},{lbl:d("summary.outputLanguage"),val:c("outputLang",t.outputLang)},"N/A"!==t.minEngagement?{lbl:d("summary.minEngagement"),val:c("minEngagement",t.minEngagement)}:null,t.ownAccounts?{lbl:d("summary.ownAccounts"),val:t.ownAccounts}:null,t.rivalAccounts?{lbl:d("summary.rivalAccounts"),val:t.rivalAccounts}:null,t.trendAccounts?{lbl:d("summary.trendAccounts"),val:t.trendAccounts}:null,{lbl:d("summary.prompt"),val:c("promptLabel",t.promptLabel)}
1].filter(Boolean):[];return(0,a.jsxs)("div",{className:"flex flex-col gap-3 animate-[fadeIn_0.4s_ease]",children:[t&&(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated border-[0.5px] border-[#e5e7eb] dark:border-border rounded-xl p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-2.5",children:[(0,a.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-ink-muted",children:d("summary.runDetails")}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted",children:t.date}),r&&(0,a.jsxs)("div",{className:"relative",ref:n,children:[(0,a.jsxs)("button",{onClick:()=>l(e=>!e),className:"bg-transparent text-gray-700 dark:text-ink-secondary border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[7px] py-[5px] px-2.5 text-[11px] cursor-pointer flex items-center gap-[5px] font-[inherit] font-medium hover:bg-gray-50 dark:hover:bg-surface-active transition-colors",children:[(0,a.jsx)(eV.A,{size:12,strokeWidth:2}),d("summary.export"),(0,a.jsx)(o.A,{size:10,className:"transition-transform duration-150",style:{transform:s?"rotate(180deg)":"none"}})]}),s&&(0,a.jsxs)("div",{className:"absolute top-[calc(100%+4px)] right-0 bg-white dark:bg-surface-elevated border-[0.5px] border-[#e5e7eb] dark:border-border rounded-lg shadow-[0_4px_16px_rgba(0,0,0,0.08)] dark:shadow-black/40 z-50 min-w-[170px] overflow-hidden py-1",children:[(0,a.jsx)("div",{onClick:()=>l(!1),className:"px-1 py-px",children:(0,a.jsx)(rc,{reportMeta:t,content:r,showToast:i})}),(0,a.jsx)("div",{onClick:()=>l(!1),className:"px-1 py-px",children:(0,a.jsx)(rd,{reportMeta:t,content:r,showToast:i})})]})]})]})]}),(0,a.jsx)("div",{className:"flex flex-col gap-0.5",children:x.map(e=>(0,a.jsxs)("div",{className:"flex gap-1.5 py-[3px] border-b-[0.5px] border-b-[#f9f9f7] dark:border-b-border",children:[(0,a.jsx)("span",{className:"text-[10px] text-gray-400 dark:text-ink-muted min-w-[130px] shrink-0",children:e.lbl}),(0,a.jsx)("span",{className:"text-[10px] text-gray-700 dark:text-ink-secondary font-medium",children:e.val})]},e.lbl))})]}),r&&(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated border-[0.5px] border-[#e5e7eb] dark:border-border rounded-xl p-4",children:[(0,a.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-ink-muted mb-3",children:d("summary.aiAnalysis")}),(0,a.jsx)(eq.A,{content:r,messageIndex:0})]})]})}var ru=r(81875),rm=r(30207),rh=r(60329);let rg=()=>(0,a.jsx)("div",{className:"w-6 h-6 rounded-[5px] flex items-center justify-center shrink-0 mt-0.5",style:{background:tR.Hl},children:(0,a.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 15 15",fill:"white",children:(0,a.jsx)("path",{d:"M7.5 1L1 4.5v6L7.5 14l6.5-3.5v-6L7.5 1zm0 2L12 5.5 7.5 8 3 5.5 7.5 3zM2.5 7l4 2.2V13L2.5 10.8V7zm5 6V9.2l4-2.2v3.8L7.5 13z"})})});function rp(e){let{chatMessages:t,setChatMessages:r,chatInput:l,setChatInput:n,chatLoading:i,chatStreaming:o,chatEndRef:d,sendChat:c,ragAiId:x,chatFiles:u,setChatFiles:m,chatLengthPercentage:h}=e,{t:g}=(0,P.Bd)("agent-x"),p=s.useRef(null),{isDark:b}=(0,er.D)(),f=[g("chat.q1"),g("chat.q2"),g("chat.q3"),g("chat.q4")],v=e=>{m(t=>t.filter((t,r)=>r!==e))};return(0,a.jsxs)("div",{className:"flex flex-col h-full bg-[#f8f7f4] dark:bg-surface relative",children:[(0,a.jsx)("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:e=>{let t=Array.from(e.target.files||[]);t.length>0&&m(e=>[...e,...t]),e.target.value=""}}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 pt-4 pb-20",children:[(0,a.jsx)("div",{className:"bg-white dark:bg-surface-elevated border border-[#e8e8e5] dark:border-border rounded-xl py-4 px-4 mb-6 flex gap-3 items-start",children:(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"text-[12.5px] font-semibold text-[#111] dark:text-ink-primary mb-1 flex items-center justify-between",children:[(0,a.jsx)("span",{children:g("chat.title")}),h>0&&t.length>0&&(0,a.jsx)(rh.A,{percentage:h})]}),!x&&(0,a.jsxs)("div",{className:"mt-2.5 flex items-center gap-1.5 text-[11px] text-amber-600 dar
1k:text-amber-400 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-500/30 rounded-lg px-2.5 py-1.5",children:[(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[(0,a.jsx)("circle",{cx:"6",cy:"6",r:"5"}),(0,a.jsx)("path",{d:"M6 4v2.5M6 8h.01"})]}),g("chat.needAnalysis")]}),0===t.length&&(0,a.jsx)("div",{className:"mt-3 flex flex-col gap-[6px]",children:f.map((e,t)=>(0,a.jsxs)("div",{onClick:()=>{x&&!i&&n(e)},className:"flex items-start gap-2 py-[3px] group ".concat(x&&!i?"cursor-pointer":"cursor-not-allowed opacity-50"),children:[(0,a.jsx)("span",{className:"text-[11px] font-medium shrink-0 mt-px",style:{color:tR.UH},children:"â"}),(0,a.jsx)("span",{className:"text-[11px] text-gray-500 dark:text-ink-muted leading-relaxed transition-colors group-hover:text-[#1a3a6b] dark:group-hover:text-claude",children:e})]},t))})]})}),t.map((e,r)=>(0,a.jsx)("div",{className:"mb-5",children:"user"===e.role?(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)("div",{className:"bg-[#e8e8e3] dark:bg-surface-active rounded-[16px_16px_4px_16px] py-2.5 px-4 text-[13px] text-[#111] dark:text-ink-primary leading-relaxed max-w-[70%]",children:e.content})}):(0,a.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,a.jsx)(rg,{}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 max-w-[85%]",children:[(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated border border-[#e8e8e5] dark:border-border rounded-[4px_16px_16px_16px] py-3 px-4 text-[13px] text-gray-700 dark:text-ink-secondary",children:[(0,a.jsx)(eq.A,{content:e.content,messageIndex:0}),o&&r===t.length-1&&(0,a.jsx)("span",{className:"inline-block w-[5px] h-[14px] ml-0.5 align-middle rounded-sm",style:{background:b?"#cc785c":tR.Hl,animation:"blink 1s steps(2) infinite"}})]}),!(o&&r===t.length-1)&&e.content&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1.5 pl-1",children:[(0,a.jsxs)("svg",{onClick:()=>{var t;return null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText(e.content)},className:"cursor-pointer opacity-35 hover:opacity-65 transition-opacity",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:b?"#a8a39a":"#6b7280",strokeWidth:"1.2",children:[(0,a.jsx)("rect",{x:"4",y:"4",width:"8",height:"8",rx:"1.5"}),(0,a.jsx)("path",{d:"M2 10V2h8"})]}),(0,a.jsx)("svg",{className:"cursor-pointer opacity-35 hover:opacity-65 transition-opacity",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:b?"#a8a39a":"#6b7280",strokeWidth:"1.2",children:(0,a.jsx)("path",{d:"M2 6.5h2v5H2zM4 6.5l2.5-4.5h.5c.5 0 .8.4.8.9L7.2 5.5H11c.6 0 1 .5.9 1.1l-.8 4c-.1.5-.5.9-1 .9H4V6.5z"})}),(0,a.jsx)("svg",{className:"cursor-pointer opacity-35 hover:opacity-65 transition-opacity",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:b?"#a8a39a":"#6b7280",strokeWidth:"1.2",children:(0,a.jsx)("path",{d:"M2 2.5h2v5H2zM4 7.5l2.5 4.5h.5c.5 0 .8-.4.8-.9L7.2 8.5H11c.6 0 1-.5.9-1.1l-.8-4c-.1-.5-.5-.9-1-.9H4V7.5z"})}),(0,a.jsx)("span",{className:"text-[10px] text-gray-300 dark:text-ink-muted ml-1",children:g("chat.disclaimer")})]})]})]})},r)),i&&!o&&(0,a.jsxs)("div",{className:"flex gap-2.5 items-start mb-4",children:[(0,a.jsx)(rg,{}),(0,a.jsx)("div",{className:"bg-white dark:bg-surface-elevated border border-[#e8e8e5] dark:border-border rounded-[4px_16px_16px_16px] py-3 px-4 flex items-center gap-1.5",children:[0,1,2].map(e=>(0,a.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 dark:bg-ink-muted",style:{animation:"bounce 1.2s ".concat(.2*e,"s infinite")}},e))})]}),(0,a.jsx)("div",{ref:d})]}),(0,a.jsx)("div",{className:"px-6 pb-4 shrink-0",children:h>=100?(0,a.jsx)("div",{className:"bg-white dark:bg-surface-elevated border border-red-200 dark:border-red-500/30 rounded-xl p-5",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2.5 bg-red-50 dark:bg-red-900/20 rounded-full shrink-0",children:(0,a.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,a.jsx)("path",{d:"M12 8v4M12 16h.01"})]})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-[13px] font-semibold text-gray-900 dark:text-ink-primary",children:g("chat.limitTitle")}),(0,a.jsx)("p",{className:"text-[11.5px] text-gray-500 dark:text-ink-muted mt-0.5 leading-relaxed",children:g("chat.limitBody")})]})]})}):(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated border border-[#e8e8e5] dark:border-border rounded-[14px] overflow-hidden shadow-[0_1px_6px_rgba(0,0,0,0.04)] dark:shadow-black/20",children:[u.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-2 px-4 pt-3",children:u.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-1.5 bg-[#f3f3f0] dark:bg-surface border border-[#e5e5e0] dark:border-border rounded-lg py-1 px-2.5 text-[11px] text-gray-600 dark:text-ink-secondary group",children:[(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:b?"#6b7280":"#9ca3af",strokeWidth:"1.3",children:[(0,a.jsx)("path",{d:"M7 1H3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4L7 1z"}),(0,a.jsx)("path",{d:"M7 1v3h3"})]}),(0,a.jsx)("span",{className:"max-w-[120px] truncate",children:e.name}),(0,a.jsx)("svg",{onClick:()=>v(t),className:"cursor-pointer opacity-40 hover:opacity-80 transition-opacity",width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:b?"#a8a39a":"#6b7280",strokeWidth:"1.5",children:(0,a.jsx)("path",{d:"M2 2l6 6M8 2l-6 6"})})]},t))}),(0,a.jsx)("textarea",{rows:2,disabled:i||!x,className:"w-full border-none outline-none pt-3.5 px-4 pb-1.5 text-[13px] font-[inherit] bg-transparent resize-none leading-relaxed box-border placeholder:text-gray-400 dark:placeholder:text-ink-muted ".concat(x?"text-[#111] dark:text-ink-primary":"text-gray-400 dark:text-ink-muted cursor-not-allowed"),placeholder:x?i?g("chat.placeholderWaiting"):g("chat.placeholder"):g("chat.placeholderLocked"),value:l,onCh
1ange:e=>n(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),c())}}),(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 pt-1 pb-2.5",children:[(0,a.jsx)("div",{}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"cursor-pointer opacity-50 hover:opacity-100 transition-opacity text-gray-500 dark:text-ink-muted",children:(0,a.jsx)(ru.A,{onClick:()=>{var e;return null===(e=p.current)||void 0===e?void 0:e.click()},width:18,height:18})}),(0,a.jsx)("div",{onClick:()=>{!i&&x&&l.trim()&&c()},className:"transition-opacity text-gray-600 dark:text-ink-secondary ".concat(x&&l.trim()&&!i?"cursor-pointer":"cursor-not-allowed"),style:{opacity:l.trim()&&x&&!i?1:.3},children:(0,a.jsx)(rm.A,{width:18,height:18})})]})]})]})})]})}let rb=["Summary","Chat","Content & Creative"];function rf(e){let{hook:t,contentCreativeSlot:r,onOpenQueues:s}=e,{t:l}=(0,P.Bd)("agent-x"),{isDark:n}=(0,er.D)(),i=n?"#cc785c":tR.Hl;return(0,a.jsxs)("div",{className:"h-full min-h-0 flex flex-col bg-[#f8f7f4] dark:bg-surface overflow-hidden",children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 h-11 border-b-[0.5px] border-b-[#e5e7eb] dark:border-b-border bg-white dark:bg-surface-elevated shrink-0",children:(0,a.jsx)("div",{className:"flex h-full",children:rb.map(e=>{let r=t.tab===e,s="done"!==t.phase&&"Summary"!==e;return(0,a.jsx)("div",{className:"px-3.5 h-11 flex items-center text-[12px] cursor-pointer transition-all border-b-2",style:{color:r?i:n?"#6b7280":"#9ca3af",borderBottomColor:r?i:"transparent",opacity:s?.35:1},onClick:()=>{s||t.setTab(e)},children:l("tabs.".concat(e),{defaultValue:e})},e)})})}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col",style:{overflowY:"Chat"===t.tab?"hidden":"auto",padding:16*("Chat"!==t.tab)},children:["idle"===t.phase&&(0,a.jsx)(rl,{isCompetitive:t.isCompetitive}),"running"===t.phase&&(0,a.jsx)(rn,{stepDone:t.stepDone,activeStep:t.activeStep}),"queued"===t.phase&&(0,a.jsx)(ri,{onOpenQueues:s,onNewAnalysis:()=>t.setPhase("idle")}),"done"===t.phase&&"Summary"===t.tab&&(0,a.jsx)(rx,{reportMeta:t.reportMeta,apiResult:t.apiResult,exportOpen:t.exportOpen,setExportOpen:t.setExportOpen,exportMenuRef:t.exportMenuRef,showToast:t.showToast}),"done"===t.phase&&"Chat"===t.tab&&t.ragCreating&&(0,a.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,a.jsx)("div",{className:"w-6 h-6 border-2 border-[#1e293b] dark:border-surface-active border-t-transparent dark:border-t-[#cc785c] rounded-full",style:{animation:"spin 1s linear infinite"}}),(0,a.jsx)("span",{className:"text-[13px] text-gray-500 dark:text-ink-muted",children:l("chat.preparing")})]})}),"done"===t.phase&&"Chat"===t.tab&&!t.ragCreating&&(0,a.jsx)(rp,{chatMessages:t.chatMessages,setChatMessages:t.setChatMessages,chatInput:t.chatInput,setChatInput:t.setChatInput,chatLoading:t.chatLoading,chatStreaming:t.chatStreaming,chatEndRef:t.chatEndRef,sendChat:t.sendChat,ragAiId:t.ragAiId,chatFiles:t.chatFiles,setChatFiles:t.setChatFiles,chatLengthPercentage:t.chatLengthPercentage}),"done"===t.phase&&"Content & Creative"===t.tab&&r]})]})}let rv=/[^a-zA-Z0-9_]/,ry=/[^a-zA-Z0-9_]/g,rk=e=>e.replace(/@/g,"").replace(ry,"");function rj(e){let{showModal:t,setShowModal:r,ownAccounts:l,rivalAccounts:n,trendAccounts:i,setOwnAccounts:o,setRivalAccounts:d,setTrendAccounts:c,newOwn:x,setNewOwn:u,newRival:m,setNewRival:h,newTrend:g,setNewTrend:p,addAcc:b,removeAcc:f,handleFileUpload:v,invalidAccounts:y=[],uploadWarning:k=null}=e,{t:j}=(0,P.Bd)("agent-x"),{isDark:N}=(0,er.D)(),[w,C]=(0,s.useState)(null),S=new Set(y.map(e=>e.toLowerCase()));if((0,s.useEffect)(()=>{C(null)},[t]),!t)return null;let T="own"===t,A="rival"===t,E=T?l:A?n:i,L=T?o:A?d:c,M=T?x:A?m:g,R=T?u:A?h:p,z=T?tR.Hl:A?tR.UH:"#7c3aed",_=T?j("accountModal.titleOwn"):A?j("accountModal.titleRival"):j("accountModal.titleMonitored"),O=e=>{let t=e.includes("@"),r=e.replace(/@/g,""),a=rv.test(r);C(t&&a?j("accountModal.warnBoth"):t?j("accountModal.warnAt"):a?j("accountModal.warnChars"):null),R(rk(e))},I=()=>{b(E,L,rk(M),R,T||A?[l,n]:[i])};return(0,a.jsx)("div",{className:"absolute inset-0 bg-black/35 flex items-center justify-center z-50",onClick:()=>r(null),children:(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-xl w-[420px] max-h-[70vh] flex flex-col overflow-hidden shadow-lg dark:shadow-black/50",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between py-3.5 px-[18px] border-b-[0.5px] border-b-[#e5e7eb] dark:border-b-border",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full",style:{background:z}}),(0,a.jsx)("div",{className:"text-[13px] font-medium dark:text-ink-primary",children:_})]}),(0,a.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-ink-muted mt-0.5",children:j("accountModal.subtitle",{count:E.length})})]}),(0,a.jsx)("span",{className:"text-[18px] text-gray-400 dark:text-ink-muted cursor-pointer leading-none",onClick:()=>r(null),children:"\xd7"})]}),(0,a.jsx)("div",{className:"overflow-y-auto flex-1",children:0===E.length?(0,a.jsx)("div",{className:"p-8 text-center text-gray-400 dark:text-ink-muted text-[12px]",children:j("accountModal.empty")}):E.map((e,t)=>{let r=S.has(e.handle.toLowerCase());return(0,a.jsxs)("div",{className:"flex items-center justify-between py-2.5 px-[18px] border-b-[0.5px] border-b-[#f5f5f3] dark:border-b-border ".concat(r?"bg-[#fffbeb] dark:bg-amber-900/20":""),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)("div",{className:"w-[30px] h-[30px] rounded-full flex items-center justify-center text-[10px] font-semibold",style:{background:"".concat(z,"18"),color:z},children:e.handle.slice(0,2).toUpperCase()}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-[13px] font-medium",style:{color:z,textDecoration:r?"line-through":"none"},children:e.handle}),r&&(0,a.jsx)("span",{className:"text-[10px] font-medium",style:{color:tR.Ut},children:j("accountModal.notFound")})]})]}),(0,a.jsx)("span",{className:"text-[16px] text-gray-300 dark:text-ink-muted cursor-pointer px-1",onClick:()=>f(E,L,t),children:"\xd7"})]},t)})}),(0,a.jsxs)("div",{className:"py-3 px-[18px] border-t-[0.5px] border-t-[#e5e7eb] dark:border-t-border flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{className:"flex-1 border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[7px] py-2 px-2.5 text-[12px] text-[#111] dark:text-ink-primary font-[inherit] outline-none bg-[#f9f9f7] dark:bg-surface placeholder:text-gray-400 dark:placeholder:text-ink-muted",placeholder:j("accountModal.inputPlaceholder"),value:M,onChange:e=>O(e.target.value),onKeyDown:e=>{"Enter"===e.key&&I()}}),(0,a.jsx)("button",{onClick:I,className:"border-none rounded-[7px] py-2 px-3.5 text-[12px] curs
1or-pointer font-[inherit] font-medium text-white",style:{background:z},children:j("accountModal.add")})]}),w&&(0,a.jsx)("div",{className:"text-[11px] text-red-500 dark:text-red-400 -mt-1",children:w}),(0,a.jsxs)("div",{onClick:()=>{let e=document.createElement("input");e.type="file",e.accept=".xlsx,.xls,.csv",e.onchange=e=>{e.target.files[0]&&v(e.target.files[0],L,T||A?[l,n]:[i])},e.click()},className:"flex items-center gap-2 py-2 px-2.5 border-[0.5px] border-dashed border-gray-300 dark:border-border rounded-[7px] cursor-pointer bg-[#f9f9f7] dark:bg-surface transition-colors hover:border-gray-500 dark:hover:border-claude",children:[(0,a.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",className:"shrink-0",children:[(0,a.jsx)("path",{d:"M7 2L4 5.5h2v5h2v-5h2L7 2z",fill:N?"#6b7280":"#9ca3af"}),(0,a.jsx)("path",{d:"M2 10.5h10v1.5H2z",fill:N?"#6b7280":"#9ca3af"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[11px] font-medium text-gray-700 dark:text-ink-secondary",children:j("accountModal.upload")}),(0,a.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted",children:j("accountModal.uploadHint")})]})]}),(0,a.jsx)("div",{className:"text-[10px] leading-[1.4] text-gray-400 dark:text-ink-muted",children:j("accountModal.uploadInfo")}),k&&(0,a.jsx)("div",{className:"text-[11px] text-red-500 dark:text-red-400",children:k})]})]})})}function rN(e){var t,r,s,l,n,i;let{costModal:o,setCostModal:d,timeSel:c,startRun:x,costLoading:u}=e,{t:m,i18n:h}=(0,P.Bd)("agent-x"),{isDark:g}=(0,er.D)();if(!o)return null;let p=u||o.estimatedCost<0,b=null!==(t=o.invalidAccounts)&&void 0!==t?t:[],f=!p&&b.length>0,v=[{label:m("cost.accounts"),val:o.accCount},{label:m("cost.timeRange"),val:m("time.".concat(c),{defaultValue:c})},{label:m("cost.totalPosts"),val:m("cost.tweets",{n:(null!==(r=o.totalPosts)&&void 0!==r?r:0).toLocaleString(h.language)})},...o.hasReplies?[{label:m("cost.incomingReplies"),val:m("cost.tweets",{n:(null!==(s=o.totalIncomingTweets)&&void 0!==s?s:0).toLocaleString(h.language)})}]:[]];return(0,a.jsxs)("div",{className:"absolute inset-0 bg-black/35 flex items-center justify-center z-50",onClick:()=>!p&&d(null),children:[(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-[14px] w-[420px] overflow-hidden shadow-[0_8px_32px_rgba(0,0,0,0.12)] dark:shadow-black/50",onClick:e=>e.stopPropagation(),style:{animation:"costModalIn 0.2s ease-out"},children:[(0,a.jsxs)("div",{className:"p-4 px-5 border-b-[0.5px] border-b-[#e5e7eb] dark:border-b-border flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-7 h-7 bg-[#fff8e6] dark:bg-amber-900/30 rounded-[7px] flex items-center justify-center",children:(0,a.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"#d97706",strokeWidth:"1.4",children:[(0,a.jsx)("circle",{cx:"7",cy:"7",r:"6"}),(0,a.jsx)("path",{d:"M7 4v3.5M7 10h.01"})]})}),(0,a.jsx)("span",{className:"text-[13px] font-medium text-[#111] dark:text-ink-primary",children:m(p?"cost.calculating":"cost.title")})]}),(0,a.jsx)("span",{className:"text-[18px] text-gray-400 dark:text-ink-muted cursor-pointer leading-none",onClick:()=>d(null),children:"\xd7"})]}),(0,a.jsxs)("div",{className:"p-4 px-5 flex flex-col gap-2.5",children:[(0,a.jsxs)("div",{className:"bg-[#f8f7f4] dark:bg-surface rounded-lg overflow-hidden border-[0.5px] border-[#e5e7eb] dark:border-border",children:[v.map((e,t)=>(0,a.jsxs)("div",{className:"flex justify-between py-2 px-3 border-b-[0.5px] border-b-[#f0eeea] dark:border-b-border",children:[(0,a.jsx)("span",{className:"text-[11px] text-gray-500 dark:text-ink-muted",children:e.label}),(0,a.jsx)("span",{className:"text-[11px] text-gray-700 dark:text-ink-secondary font-medium",children:e.val})]},t)),(0,a.jsxs)("div",{className:"flex justify-between py-2.5 px-3 bg-white dark:bg-surface-elevated",children:[(0,a.jsx)("span",{className:"text-[12px] font-medium text-[#111] dark:text-ink-primary",children:m("cost.totalTweets")}),(0,a.jsx)("span",{className:"text-[12px] font-medium text-[#111] dark:text-ink-primary",children:((null!==(l=o.totalPosts)&&void 0!==l?l:0)+(null!==(n=o.totalIncomingTweets)&&void 0!==n?n:0)).toLocaleStr
1ing(h.language)})]})]}),(0,a.jsx)("div",{className:"rounded-[10px] py-3.5 px-4 flex items-center justify-between overflow-hidden relative",style:{background:g?"#cc785c":tR.Hl,minHeight:68},children:p?(0,a.jsxs)("div",{className:"flex items-center gap-3 w-full",children:[(0,a.jsxs)("div",{className:"relative w-5 h-5 flex-shrink-0",children:[(0,a.jsx)("div",{className:"absolute inset-0 rounded-full border-2 border-white/20"}),(0,a.jsx)("div",{className:"absolute inset-0 rounded-full border-2 border-transparent border-t-white",style:{animation:"costSpin 0.7s linear infinite"}})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 flex-1",children:[(0,a.jsx)("div",{className:"h-[10px] rounded-full w-24",style:{background:"linear-gradient(90deg, rgba(255,255,255,0.2) 25%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0.2) 75%)",backgroundSize:"200% 100%",animation:"costShimmer 1.5s ease-in-out infinite"}}),(0,a.jsx)("div",{className:"h-[22px] rounded-full w-20",style:{background:"linear-gradient(90deg, rgba(255,255,255,0.15) 25%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.15) 75%)",backgroundSize:"200% 100%",animation:"costShimmer 1.5s ease-in-out infinite"}})]})]}):(0,a.jsxs)("div",{style:{animation:"costFadeIn 0.35s ease-out"},children:[(0,a.jsx)("div",{className:"text-[10px] text-white/70 mb-[3px]",children:m("cost.estimatedLabel")}),(0,a.jsxs)("div",{className:"text-[22px] font-medium text-white",children:["\xa3",(null!==(i=o.estimatedCost)&&void 0!==i?i:0).toFixed(2)]})]})}),f&&(0,a.jsxs)("div",{className:"rounded-[10px] p-3 bg-[#fffbeb] dark:bg-amber-900/20 border-[0.5px] border-[#fde68a] dark:border-amber-500/30",style:{animation:"costFadeIn 0.35s ease-out"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5",children:[(0,a.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:tR.Ut,strokeWidth:"1.4",children:[(0,a.jsx)("circle",{cx:"7",cy:"7",r:"6"}),(0,a.jsx)("path",{d:"M7 4v3.5M7 10h.01"})]}),(0,a.jsx)("span",{className:"text-[11px] font-medium",style:{color:tR.Ut},children:m("cost.invalidCount",{count:b.length})})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.map(e=>(0,a.jsxs)("span",{className:"text-[10px] font-medium py-[2px] px-2 rounded-full bg-white dark:bg-amber-900/30 border-[0.5px] border-[#fde68a] dark:border-amber-500/40 line-through",style:{color:tR.Ut},children:["@",e]},e))}),(0,a.jsx)("div",{className:"text-[10px] text-[#92400e] dark:text-amber-300/80 mt-2 leading-normal",children:m("cost.invalidHint")})]}),!p&&!f&&(0,a.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted leading-relaxed px-0.5",style:{animation:"costFadeIn 0.35s ease-out"},children:(0,a.jsx)(P.x6,{t:m,i18nKey:"cost.info",components:{b:(0,a.jsx)("b",{className:"text-gray-500 dark:text-ink-secondary"})}})})]}),(0,a.jsxs)("div",{className:"py-3 px-5 border-t-[0.5px] border-t-[#e5e7eb] dark:border-t-border flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>d(null),className:"flex-1 bg-[#f8f7f4] dark:bg-surface text-gray-700 dark:text-ink-secondary border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[7px] py-[9px] text-[12px] cursor-pointer font-[inherit] hover:bg-gray-100 dark:hover:bg-surface-active transition-colors",children:m("cost.cancel")}),(0,a.jsxs)("button",{onClick:()=>{d(null),x()},disabled:p||f,className:"flex-[2] border-none rounded-[7px] py-[9px] text-[12px] font-medium cursor-pointer font-[inherit] text-white flex items-center justify-center gap-1.5 disabled:opacity-40 disabled:cursor-not-allowed",style:{background:tR.UH},children:[(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"white",children:(0,a.jsx)("path",{d:"M2 1.5l8 4-8 4z"})}),m("cost.confirm")]})]})]}),(0,a.jsx)("style",{children:"\n @keyframes costSpin {\n to { transform: rotate(360deg); }\n }\n @keyframes costShimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n @keyframes costFadeIn {\n from { opacity: 0; transform: translateY(6px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes costModalIn {\n from { opacity: 0; transform: scale(0.97); }\n to { opacity: 1; transform: scale(1); }\n }\n "})]})}function rw(e){let{hook:t}=e,{t:r}=(0,P.Bd)("agent-x"),{isDark:s}=(0,er.D)(),l=e=>r("goals.items.".concat(e,".label"),{defaultValue:e}),n=s?"#60a5fa":tR.Hl;return t.selectedGoal?null:(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated border-[0.5px] border-[#e5e7eb] dark:border-border rounded-xl overflow-hidden",children:[(0,a.jsxs)("div",{className:"py-3.5 px-4 border-b-[0.5px] border-b-[#f0eeea] dark:border-b-border",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("div",{className:"w-[18px] h-[18px] rounded-full flex items-center justify-center shrink-0",style:{background:tR.Hl},children:(0,a.jsx)("span",{className:"text-[9px] text-white font-semibold",children:"0"})}),(0,a.jsx)("span",{className:"text-[12px] font-medium text-[#111] dark:text-ink-primary",children:r("goals.header")})]}),(0,a.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-ink-muted pl-[26px]",children:r("goals.headerDesc")})]}),(0,a.jsxs)("div",{className:"py-3 px-4 flex flex-col gap-2",children:[!t.aiGoalSuggestion&&!t.aiGoalLoading&&(0,a.jsxs)("div",{onClick:()=>{t.setAiGoalLoading(!0),t.setAiGoalSuggestion(null),t.triggerGoalExecution("ai_decide").finally(()=>{t.setAiGoalLoading(!1)})},className:"flex items-start gap-3 py-[13px] px-[14px] border border-dashed border-[#a5b4fc] dark:border-[#6366f1]/40 rounded-[9px] curs
1or-pointer bg-[linear-gradient(135deg,#eef3fb_0%,#f5f3ff_100%)] dark:bg-none dark:bg-surface-active transition-all duration-150 mb-1",onMouseEnter:e=>{e.currentTarget.style.borderColor=n,e.currentTarget.style.boxShadow="0 0 0 2px ".concat(n,"18")},onMouseLeave:e=>{e.currentTarget.style.borderColor="",e.currentTarget.style.boxShadow="none"},children:[(0,a.jsx)("div",{className:"w-7 h-7 rounded-[7px] flex items-center justify-center shrink-0 mt-[1px]",style:{background:tR.Hl},children:(0,a.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 15 15",fill:"white",children:(0,a.jsx)("path",{d:"M7.5 1L1 4.5v6L7.5 14l6.5-3.5v-6L7.5 1zm0 2L12 5.5 7.5 8 3 5.5 7.5 3zM2.5 7l4 2.2V13L2.5 10.8V7zm5 6V9.2l4-2.2v3.8L7.5 13z"})})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[12px] font-bold mb-[3px]",style:{color:n},children:r("goals.aiDecide")}),(0,a.jsx)("div",{className:"text-[11px] text-gray-500 dark:text-ink-secondary leading-[1.6]",children:r("goals.aiDecideDesc")})]})]}),t.aiGoalLoading&&(0,a.jsxs)("div",{className:"flex items-center gap-2.5 p-3.5 border border-dashed border-[#a5b4fc] dark:border-[#6366f1]/40 rounded-[9px] bg-[linear-gradient(135deg,#eef3fb_0%,#f5f3ff_100%)] dark:bg-none dark:bg-surface-active mb-1",children:[(0,a.jsx)(t2,{}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[12px] font-semibold mb-0.5",style:{color:n},children:r("goals.analysing")}),(0,a.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-ink-muted",children:r("goals.analysingDesc")})]})]}),t.aiGoalSuggestion&&!t.aiGoalLoading&&(()=>{let e=t.aiGoalSuggestion.rankings.filter(e=>e.rank<=3),s=t.aiGoalSuggestion.rankings[0];return(0,a.jsxs)("div",{className:"rounded-[9px] overflow-hidden mb-1",style:{border:"1.5px solid ".concat(n)},children:[(0,a.jsxs)("div",{className:"py-2.5 px-[13px] flex items-center justify-between",style:{background:tR.Hl},children:[(0,a.jsxs)("div",{className:"flex items-center gap-[7px]",children:[(0,a.jsx)("div",{className:"w-[18px] h-[18px] bg-white/15 rounded-[5px] flex items-center justify-center",children:(0,a.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 15 15",fill:"white",children:(0,a.jsx)("path",{d:"M7.5 1L1 4.5v6L7.5 14l6.5-3.5v-6L7.5 1zm0 2L12 5.5 7.5 8 3 5.5 7.5 3zM2.5 7l4 2.2V13L2.5 10.8V7zm5 6V9.2l4-2.2v3.8L7.5 13z"})})}),(0,a.jsx)("span",{className:"text-[11px] text-[#c7d9f5] font-medium",children:r("goals.ranking")})]}),(0,a.jsx)("span",{onClick:()=>t.setAiGoalSuggestion(null),className:"text-[11px] text-[#c7d9f5] cursor-pointer opacity-70",children:r("goals.dismiss")})]}),(0,a.jsx)("div",{className:"flex flex-col",children:e.map((e,t)=>(0,a.jsx)("div",{className:"py-2.5 px-[13px] border-b-[0.5px] border-b-[#f0eeea] dark:border-b-border ".concat(0===t?"bg-[#eef3fb] dark:bg-surface-active":"bg-white dark:bg-surface-elevated"),children:(0,a.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,a.jsx)("div",{className:"w-5 h-5 rounded-full flex items-center justify-center shrink-0 mt-[1px] ".concat(0===t?"":"bg-[#f0eeea] dark:bg-surface"),style:0===t?{background:tR.Hl}:void 0,children:(0,a.jsxs)("span",{className:"text-[10px] font-bold ".concat(0===t?"text-white":"text-gray-400 dark:text-ink-muted"),children:["#",e.rank]})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("div",{className:"text-[12px] ".concat(e.rationale?"mb-1":""," ").concat(0===t?"font-bold":"font-medium text-gray-700 dark:text-ink-secondary"),style:0===t?{color:n}:void 0,children:l(e.goal)}),e.rationale&&(0,a.jsx)("div",{className:"text-[11px] text-gray-500 dark:text-ink-secondary leading-[1.6]",children:e.rationale})]})]})},e.rank))}),(0,a.jsxs)("div",{className:"py-2.5 px-[13px] bg-[#f8f7f4] dark:bg-surface flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>{t.setSelectedGoal(s.goal),t.triggerBriefGeneration(s.goal),t.triggerGoalExecution(s.goal)},className:"flex-[2] text-white border-none rounded-[7px] py-2 text-[11px] font-semibold cursor-pointer font-[inherit]",style:{background:tR.Hl},children:r("goals.confirmRank",{rank:s.rank,goal:l(s.goal)})}),(0,a.jsx)("button",{onClick:()=>t.setAiGoalSuggestion(null),className:"flex-1 bg-white dark:bg-surface-elevated text-gray-700 dark:text-ink-secondary border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[7px] py-2 text-[11px] cursor-pointer font-[inherit]",children:r("goals.cho
1oseManually")})]})]})})(),!t.aiGoalLoading&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 mb-1",children:[(0,a.jsx)("div",{className:"flex-1 h-[0.5px] bg-[#f0eeea] dark:bg-border"}),(0,a.jsx)("span",{className:"text-[10px] text-gray-400 dark:text-ink-muted shrink-0",children:r("goals.orChoose")}),(0,a.jsx)("div",{className:"flex-1 h-[0.5px] bg-[#f0eeea] dark:bg-border"})]}),!t.aiGoalLoading&&tR.lR.map(e=>{let n=s?"".concat(e.color,"40"):e.border;return(0,a.jsxs)("div",{onClick:()=>{t.setSelectedGoal(e.id),t.triggerBriefGeneration(e.id),t.triggerGoalExecution(e.id)},className:"flex items-start gap-3 py-[11px] px-[13px] rounded-[9px] cursor-pointer transition-all duration-150 dark:bg-surface-elevated",style:{border:"0.5px solid ".concat(n),background:s?void 0:e.bg},onMouseEnter:t=>{t.currentTarget.style.borderColor=e.color,t.currentTarget.style.boxShadow="0 0 0 2px ".concat(e.color,"18")},onMouseLeave:e=>{e.currentTarget.style.borderColor=n,e.currentTarget.style.boxShadow="none"},children:[(0,a.jsx)("span",{className:"text-[16px] shrink-0 mt-[1px]",style:{color:e.color,filter:s?"brightness(1.5) saturate(1.15)":void 0},children:e.icon}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[12px] font-semibold mb-[3px]",style:{color:e.color,filter:s?"brightness(1.5) saturate(1.15)":void 0},children:l(e.id)}),(0,a.jsx)("div",{className:"text-[11px] text-gray-500 dark:text-ink-secondary leading-[1.6]",children:r("goals.items.".concat(e.id,".desc"),{defaultValue:e.desc})})]})]},e.id)})]})]})}function rC(e){let{hook:t}=e,{t:r}=(0,P.Bd)("agent-x"),{isDark:s}=(0,er.D)(),l=e=>e?r("goals.items.".concat(e,".label"),{defaultValue:e}):"",n=s?"#60a5fa":tR.Hl;return t.selectedGoal?(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated border-[0.5px] border-[#e5e7eb] dark:border-border rounded-xl overflow-hidden",children:[(0,a.jsxs)("div",{className:"py-3 px-4 border-b-[0.5px] border-b-[#f0eeea] dark:border-b-border flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-[18px] h-[18px] rounded-full flex items-center justify-center shrink-0 ".concat(t.briefConfirmed?"bg-[#dcfce7] dark:bg-green-900/40":""),style:t.briefConfirmed?void 0:{background:tR.Hl},children:t.briefConfirmed?(0,a.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 8 8",fill:"none",className:"text-[#166534] dark:text-green-400",stroke:"currentColor",strokeWidth:"1.8",children:(0,a.jsx)("path",{d:"M1.5 4l2 2 3-4"})}):(0,a.jsx)("span",{className:"text-[9px] text-white font-semibold",children:"1"})}),(0,a.jsx)("span",{className:"text-[12px] font-medium text-[#111] dark:text-ink-primary",children:r("brief.header")}),t.brief&&!t.briefLoading&&(0,a.jsx)("span",{className:"text-[9px] py-[1px] px-[7px] rounded-[4px] bg-[#f0f7ff] dark:bg-surface-active border-[0.5px] border-[#c7d9f5] dark:border-border",style:{color:n},children:r("brief.autoEditable")}),t.selectedGoal&&(0,a.jsx)("span",{className:"text-[9px] py-[1px] px-[7px] rounded-[4px] bg-[#eef3fb] dark:bg-surface-active font-medium",style:{color:n},children:l(t.selectedGoal)})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[t.brief&&!t.briefLoading&&!t.briefConfirmed&&(0,a.jsxs)("div",{onClick:()=>{t.brief||t.briefConfirmed||t.contentOutput||t.imagePromptOutput?t.setShowRegenerateConfirm(!0):t.regenerateBrief(t.selectedGoal)},className:"flex items-center gap-1 text-[11px] text-gray-500 dark:text-ink-secondary cursor-pointer py-[3px] px-2 border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[5px] bg-[#f9f9f7] dark:bg-surface transition-all duration-150",onMouseEnter:e=>{e.currentTarget.style.borderColor=n,e.currentTarget.style.color=n},onMouseLeave:e=>{e.currentTarget.style.borderColor="",e.currentTarget.style.color=""},children:[(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:(0,a.jsx)("path",{d:"M10 6A4 4 0 1 1 6 2M10 2v4H6"})}),r("brief.regenerate")]}),t.briefConfirmed&&(0,a.jsx)("span",{onClick:()=>{t.setBriefConfirmed(!1)},className:"text-[11px] cursor-pointer",style:{color:n},children:r("brief.edit")}),(0,a.jsx)("span",{onClick:()=>t.resetGoalState(),className:"text-[11px] text-gray-400 dark:text-ink-muted cursor-pointer",children:r("brief.changeGoal")})]})]}),t.briefLoading&&(0,a.jsxs)("div",{className:"py-5 px-4 flex items-center gap-2.5",children:[(0,a.jsx)(t2,{}),(0,a.jsx)("span",{className:"text-[11px] text-gray-400 dark:text-ink-muted",children:(0,a.jsx)(P.x6,{t:r,i18nKey:"brief.generating",values:{goal:l(t.selectedGoal)},components:{b:(0,a.jsx)("b",{style:{color:n}})}})})]}),t.brief&&!t.briefLoading&&!t.briefConfirmed&&(0,a.jsxs)("div",{className:"py-3 px-4 flex flex-col gap-0.5",children:[[{key:"objective",label:r("brief.fields.objective")},{key:"audience",label:r("brief.fields.audience")},{key:"keyMessage",label:r("brief.fields.keyMessage")},{key:"platform",label:r("brief.fields.platform")},{key:"tone",label:r("brief.fields.tone")}].map(e=>{let{key:s,label:l}=e;return(0,a.jsxs)("div",{className:"flex gap-0 py-[7px] border-b-[0.5px] border-b-[#f9f9f7] dark:border-b-border",children:[(0,a.jsx)("span",{className:"text-[10px] text-gray-400 dark:text-ink-muted min-w-[110px] shrink-0 pt-0.5",children:l}),t.editingBriefKey===s?(0,a.jsx)("input",{autoFocus:!0,className:"flex-1 text-[11px] text-[#111] dark:text-ink-primary rounded-[5px] py-[3px] px-[7px] font-[inherit] outline-none bg-[#f8f9ff] dar
1k:bg-surface-active",style:{border:"0.5px solid "+n},value:t.brief[s].value,onChange:e=>t.setBrief(t=>({...t,[s]:{value:e.target.value,edited:!0}})),onBlur:()=>t.setEditingBriefKey(null),onKeyDown:e=>"Enter"===e.key&&t.setEditingBriefKey(null)}):(0,a.jsxs)("div",{className:"flex flex-1 items-start justify-between gap-2",children:[(0,a.jsxs)("span",{className:"text-[11px] text-gray-700 dark:text-ink-secondary leading-[1.55]",children:[t.brief[s].value,t.brief[s].edited&&(0,a.jsx)("span",{className:"ml-1.5 text-[9px] py-[1px] px-[5px] rounded-[3px] bg-[#eef3fb] dark:bg-surface-active",style:{color:n},children:r("brief.edited")})]}),(0,a.jsx)("span",{onClick:()=>t.setEditingBriefKey(s),className:"text-[10px] text-gray-400 dark:text-ink-muted cursor-pointer shrink-0 pt-[1px]",children:r("brief.edit")})]})]},s)}),(0,a.jsxs)("div",{className:"mt-2.5 border-[0.5px] border-[#e5e7eb] dark:border-border rounded-lg overflow-hidden",children:[(0,a.jsxs)("div",{onClick:()=>t.setBrandSpecsOpen(e=>!e),className:"flex items-center justify-between py-[11px] px-3 cursor-pointer border border-dashed transition-all duration-150 ".concat(t.brandSpecsOpen?"bg-[#eef3fb] dark:bg-surface-active rounded-t-lg":"bg-white dark:bg-surface-elevated rounded-lg border-[#93c5fd] dark:border-[#6366f1]/40"),style:t.brandSpecsOpen?{borderColor:n}:void 0,onMouseEnter:e=>{e.currentTarget.style.background="".concat(n,"14"),e.currentTarget.style.borderColor=n},onMouseLeave:e=>{t.brandSpecsOpen||(e.currentTarget.style.background="",e.currentTarget.style.borderColor="")},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 12 12",fill:"none",stroke:n,strokeWidth:"1.4",children:[(0,a.jsx)("rect",{x:"1",y:"1",width:"10",height:"10",rx:"2"}),(0,a.jsx)("path",{d:"M4 6h4M6 4v4"})]}),(0,a.jsx)("span",{className:"text-[11px] font-semibold",style:{color:n},children:r("brief.specs.title")}),t.brandSpecs.brandVoice||t.brandSpecs.mandatory||t.brandSpecs.negativeRules||t.brandSpecs.regulatory||t.brandLogo?(0,a.jsx)("span",{className:"text-[9px] py-[2px] px-[7px] rounded-[4px] bg-[#dcfce7] dark:bg-green-900/40 text-[#166534] dark:text-green-400 font-medium",children:r("brief.specs.filled")}):(0,a.jsx)("span",{className:"text-[9px] py-[2px] px-[7px] rounded-[4px] bg-[#eff6ff] dark:bg-surface-active text-[#3b82f6] dark:text-blue-400 border-[0.5px] border-[#bfdbfe] dark:border-border font-medium",children:t.brandSpecsOpen?r("brief.specs.collapseBadge"):r("brief.specs.expandBadge")})]}),(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 10 10",fill:"none",stroke:n,strokeWidth:"1.8",style:{transform:t.brandSpecsOpen?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s",flexShrink:0},children:(0,a.jsx)("path",{d:"M2 3.5l3 3 3-3"})})]}),t.brandSpecsOpen&&(0,a.jsx)("div",{className:"py-2.5 px-3 flex flex-col gap-2.5 bg-[#fafaf8] dark:bg-surface",children:[{key:"brandVoice",label:r("brief.specs.brandVoice"),placeholder:r("brief.specs.brandVoicePlaceholder")},{key:"mandatory",label:r("brief.specs.mandatory"),placeholder:r("brief.specs.mandatoryPlaceholder")},{key:"negativeRules",label:r("brief.specs.negativeRules"),placeholder:r("brief.specs.negativeRulesPlaceholder")},{key:"regulatory",label:r("brief.specs.regulatory"),placeholder:r("brief.specs.regulatoryPlaceholder")}].map(e=>{let{key:s,label:l,placeholder:i}=e,o=t.expandedSpec===s;return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted font-medium mb-1",children:l}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("textarea",{rows:o?6:2,className:"w-full rounded-[6px] py-1.5 pr-7 pl-2 text-[11px] font-[inherit] outline-none bg-white dark:bg-surface-elevated resize-none leading-[1.55] box-border text-gray-700 dark:text-ink-secondary transition-colors duration-150 border ".concat(o?"":"border-[#e5e7eb] dark:border-border"),style:o?{borderColor:n}:void 0,placeholder:i,value:t.brandSpecs[s],onChange:e=>t.setBrandSpecs(t=>({...t,[s]:e.target.value}))}),(0,a.jsx)("span",{onClick:()=>t.setExpandedSpec(o?null:s),title:o?r("brief.specs.collapse"):r("brief.specs.exp
1and"),className:"absolute top-[5px] right-1.5 cursor-pointer flex items-center bg-white dark:bg-surface-elevated rounded-[3px] p-[1px]",style:{opacity:.4},onMouseEnter:e=>e.currentTarget.style.opacity="1",onMouseLeave:e=>e.currentTarget.style.opacity="0.4",children:o?(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500 dark:text-ink-secondary",stroke:"currentColor",strokeWidth:"1.5",children:(0,a.jsx)("path",{d:"M4 2v2H2M2 4l3 3M8 2v2h2M10 4l-3 3M4 10v-2H2M2 8l3-3M8 10v-2h2M10 8l-3-3"})}):(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500 dark:text-ink-secondary",stroke:"currentColor",strokeWidth:"1.5",children:(0,a.jsx)("path",{d:"M1.5 4.5V1.5h3M1.5 1.5l3 3M7.5 1.5h3v3M10.5 1.5l-3 3M1.5 7.5v3h3M1.5 10.5l3-3M7.5 10.5h3v-3M10.5 10.5l-3-3"})})})]})]},s)})})]}),(0,a.jsx)("button",{onClick:()=>{t.setBriefConfirmed(!0),t.setLastCopyType("post"),t.setContentType("post")},className:"mt-3 text-white border-none rounded-[7px] py-2 text-[11px] font-medium cursor-pointer font-[inherit] w-full",style:{background:tR.Hl},children:r("brief.confirm")})]}),t.brief&&t.briefConfirmed&&(0,a.jsxs)("div",{className:"py-2.5 px-4 flex flex-col gap-[3px]",children:[[{key:"objective",label:r("brief.fields.objective")},{key:"keyMessage",label:r("brief.fields.keyMessage")},{key:"platform",label:r("brief.fields.platform")},{key:"tone",label:r("brief.fields.tone")}].map(e=>{let{key:r,label:s}=e;return(0,a.jsxs)("div",{className:"flex gap-2 text-[10px] py-0.5 border-b-[0.5px] border-b-[#f9f9f7] dark:border-b-border",children:[(0,a.jsx)("span",{className:"text-gray-400 dark:text-ink-muted min-w-[110px] shrink-0",children:s}),(0,a.jsx)("span",{className:"text-gray-700 dark:text-ink-secondary font-medium",children:t.brief[r].value})]},r)}),(0,a.jsxs)("div",{className:"mt-2 border-[0.5px] border-[#e5e7eb] dark:border-border rounded-lg overflow-hidden",children:[(0,a.jsxs)("div",{onClick:()=>t.setBrandSpecsOpen(e=>!e),className:"flex items-center justify-between py-[11px] px-3 cursor-pointer border border-dashed transition-all duration-150 ".concat(t.brandSpecsOpen?"bg-[#eef3fb] dark:bg-surface-active rounded-t-lg":"bg-white dark:bg-surface-elevated rounded-lg border-[#93c5fd] dark:border-[#6366f1]/40"),style:t.brandSpecsOpen?{borderColor:n}:void 0,onMouseEnter:e=>{e.currentTarget.style.background="".concat(n,"14"),e.currentTarget.style.borderColor=n},onMouseLeave:e=>{t.brandSpecsOpen||(e.currentTarget.style.background="",e.currentTarget.style.borderColor="")},children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 12 12",fill:"none",stroke:n,strokeWidth:"1.4",children:[(0,a.jsx)("rect",{x:"1",y:"1",width:"10",height:"10",rx:"2"}),(0,a.jsx)("path",{d:"M4 6h4M6 4v4"})]}),(0,a.jsx)("span",{className:"text-[11px] font-semibold",style:{color:n},children:r("brief.specs.title")}),t.brandSpecs.brandVoice||t.brandSpecs.mandatory||t.brandSpecs.negativeRules||t.brandSpecs.regulatory?(0,a.jsx)("span",{className:"text-[9px] py-[2px] px-[7px] rounded-[4px] bg-[#dcfce7] dark:bg-green-900/40 text-[#166534] dark:text-green-400 font-medium",children:r("brief.specs.filled")}):(0,a.jsx)("span",{className:"text-[9px] py-[2px] px-[7px] rounded-[4px] bg-[#eff6ff] dark:bg-surface-active text-[#3b82f6] dark:text-blue-400 border-[0.5px] border-[#bfdbfe] dark:border-border font-medium",children:t.brandSpecsOpen?r("brief.specs.collapseBadge"):r("brief.specs.expandBadge")})]}),(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 10 10",fill:"none",stroke:n,strokeWidth:"1.8",style:{transform:t.brandSpecsOpen?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s",flexShrink:0},children:(0,a.jsx)("path",{d:"M2 3.5l3 3 3-3"})})]}),t.brandSpecsOpen&&(0,a.jsx)("div",{className:"py-2.5 px-3 flex flex-col gap-2.5 bg-[#fafaf8] dark:bg-surface",children:[{key:"brandVoice",label:r("brief.specs.brandVoice"),placeholder:r("brief.specs.brandVoicePlaceholder")},{key:"mandatory",label:r("brief.specs.mandatory"),placeholder:r("brief.specs.mandatoryPlaceholder")},{key:"negativeRules",label:r("brief.specs.negativeRules"),placeholder:r("brief.specs.negativeRulesPlaceholder")},{key:"regulatory",label:r("brief.specs.regulatory"),placeholder:r("brief.specs.regulatoryPlaceholder")}].map(e=>{let{key:s,label:l,placeholder:i}=e,o=t.expandedSpec===s;return(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-ink-muted font-medium mb-1",children:l}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("textarea",{rows:o?6:2,className:"w-full rounded-[6px] py-1.5 pr-7 pl-2 text-[11px] font-[inherit] outline-none bg-white dark:bg-surface-elevated resize-none leading-[1.55] box-border text-gray-700 dark:text-ink-secondary transition-colors duration-150 border ".concat(o?"":"border-[#e5e7eb] dark:border-border"),style:o?{borderColor:n}:void 0,placeholder:i,value:t.brandSpecs[s],onChange:e=>t.setBrandSpecs(t=>({...t,[s]:e.target.value}))}),(0,a.jsx)("span",{onClick:()=>t.setExpandedSpec(o?null:s),title:o?r("brief.specs.collapse"):r("brief.specs.exp
1and"),className:"absolute top-[5px] right-1.5 cursor-pointer flex items-center bg-white dark:bg-surface-elevated rounded-[3px] p-[1px]",style:{opacity:.4},onMouseEnter:e=>e.currentTarget.style.opacity="1",onMouseLeave:e=>e.currentTarget.style.opacity="0.4",children:o?(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500 dark:text-ink-secondary",stroke:"currentColor",strokeWidth:"1.5",children:(0,a.jsx)("path",{d:"M4 2v2H2M2 4l3 3M8 2v2h2M10 4l-3 3M4 10v-2H2M2 8l3-3M8 10v-2h2M10 8l-3-3"})}):(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500 dark:text-ink-secondary",stroke:"currentColor",strokeWidth:"1.5",children:(0,a.jsx)("path",{d:"M1.5 4.5V1.5h3M1.5 1.5l3 3M7.5 1.5h3v3M10.5 1.5l-3 3M1.5 7.5v3h3M1.5 10.5l3-3M7.5 10.5h3v-3M10.5 10.5l-3-3"})})})]})]},s)})})]})]})]}):null}function rS(e){let{hook:t}=e,{t:r}=(0,P.Bd)("agent-x"),{isDark:s}=(0,er.D)(),l=s?"#60a5fa":tR.Hl;return t.selectedGoal&&t.briefConfirmed?(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated border-[0.5px] border-[#e5e7eb] dark:border-border rounded-xl overflow-hidden",style:{animation:"fadeIn 0.3s ease"},children:[(0,a.jsxs)("div",{className:"py-3 px-4 border-b-[0.5px] border-b-[#f0eeea] dark:border-b-border flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-[18px] h-[18px] rounded-full flex items-center justify-center shrink-0",style:{background:tR.Hl},children:(0,a.jsx)("span",{className:"text-[9px] text-white font-semibold",children:"2"})}),(0,a.jsx)("span",{className:"text-[12px] font-medium text-[#111] dark:text-ink-primary",children:r("contentType.header")})]}),(0,a.jsx)("div",{className:"py-3 px-4 flex flex-col gap-3.5",children:(0,a.jsxs)("div",{className:"border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[10px] overflow-hidden",children:[(0,a.jsx)("div",{className:"py-2 px-3 bg-[#f8f7f4] dark:bg-surface border-b-[0.5px] border-b-[#f0eeea] dark:border-b-border",children:(0,a.jsx)("span",{className:"text-[9px] font-semibold text-gray-400 dark:text-ink-muted tracking-[0.07em] uppercase",children:r("contentType.copyGroup")})}),(0,a.jsxs)("div",{className:"py-2.5 px-3 flex flex-col gap-2",children:[(0,a.jsx)("div",{className:"grid grid-cols-2 gap-1.5",children:[{val:"post",label:r("contentType.post"),icon:"â¦"},{val:"ad",label:r("contentType.ad"),icon:"â"}].map(e=>{let s=t.contentType===e.val;return(0,a.jsxs)("div",{onClick:()=>{t.setContentType(e.val),t.setLastCopyType(e.val),t.setContentChannel([]),t.setContentOutput(null),t.setImagePromptOutput(null)},className:"py-[9px] px-2.5 rounded-[7px] cursor-pointer transition-all duration-150 flex items-center gap-[7px] border-[0.5px] ".concat(s?"bg-[#eef3fb] dark:bg-surface-active":"bg-white dark:bg-surface-elevated border-[#e5e7eb] dark:border-border"),style:s?{borderColor:l}:void 0,children:[(0,a.jsx)("span",{className:"text-[13px]",children:e.icon}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[11px] font-medium ".concat(s?"":"text-gray-700 dark:text-ink-secondary"),style:s?{color:l}:void 0,children:e.label}),s&&(0,a.jsx)("div",{className:"text-[9px] mt-[1px]",style:{color:l},children:r("contentType.selected")})]})]},e.val)})}),["post","ad"].includes(t.contentType)&&(0,a.jsxs)("div",{className:"bg-[#f8f7f4] dark:bg-surface rounded-[7px] py-2 px-2.5",children:[(0,a.jsxs)("div",{className:"text-[9px] font-medium text-gray-500 dark:text-ink-secondary mb-[7px] flex items-center gap-[5px]",children:[(0,a.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",className:"text-gray-500 dark:text-ink-secondary",stroke:"currentColor",strokeWidth:"1.3",children:[(0,a.jsx)("rect",{x:"1",y:"1",width:"8",height:"8",rx:"1.5"}),(0,a.jsx)("path",{d:"M3 5l1.5 1.5L7 3"})]}),r("contentType.selectChannels")]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-[5px]",children:("post"===t.contentType?["LinkedIn","TikTok"]:["Microsoft Bing","Taboola","LinkedIn Ads","TikTok Ads"]).map(e=>{let r=t.contentChannel.includes(e);return(0,a.jsxs)("div",{onClick:()=>t.setContentChannel(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),className:"py-1 px-[9px] rounded-[6px] text-[10px] cursor-pointer transition-all duration-150 flex items-center gap-1 border ".concat(r?"text-white":"bg-white dark:bg-surface-elevated text-gray-700 dark:text-ink-secondary border-[#d1d5db] dark:border-border shadow-[0_1px_2px_rgba(0,0,0,0.05)] dark:shadow-none"),style:r?{background:tR.Hl,borderColor:tR.Hl}:void 0,onMouseEnter:e=>{r||(e.currentTarget.style.borderColor=l)},onMouseLeave:e=>{r||(e.currentTarget.style.borderColor="")}
1,children:[(0,a.jsx)("div",{className:"w-[11px] h-[11px] rounded-[3px] flex items-center justify-center shrink-0 ".concat(r?"":"border-[1.5px] border-[#9ca3af] dark:border-border bg-white dark:bg-surface-elevated"),style:r?{border:"1.5px solid rgba(255,255,255,0.6)",background:"rgba(255,255,255,0.2)"}:void 0,children:r&&(0,a.jsx)("svg",{width:"6",height:"6",viewBox:"0 0 8 8",fill:"none",stroke:"white",strokeWidth:"2",children:(0,a.jsx)("path",{d:"M1.5 4l2 2 3-4"})})}),e]},e)})})]}),["post","ad"].includes(t.contentType)&&(0,a.jsx)("button",{onClick:()=>{0!==t.contentChannel.length&&t.generateCopy()},className:"py-[9px] rounded-[7px] border-none text-[11px] font-medium flex items-center justify-center gap-1.5 w-full font-[inherit] transition-colors duration-200 ".concat(t.contentChannel.length>0?"text-white cursor-pointer":"bg-[#e5e7eb] dark:bg-surface text-gray-400 dark:text-ink-muted cursor-default"),style:t.contentChannel.length>0?{background:tR.UH}:void 0,children:t.contentLoading?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t2,{}),(0,a.jsx)("span",{children:r("contentType.generating")})]}):0===t.contentChannel.length?(0,a.jsx)("span",{children:r("contentType.needChannel")}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"white",children:(0,a.jsx)("path",{d:"M2 1.5l8 4-8 4z"})}),(0,a.jsx)("span",{children:r("contentType.generateFor",{channels:t.contentChannel.join(", ")})})]})})]})]})})]}):null}function rT(e){let{hook:t}=e,{t:r}=(0,P.Bd)("agent-x"),{isDark:s}=(0,er.D)(),l=e=>r("contentOutput.partLabels.".concat(e),{defaultValue:e}),n=s?"#60a5fa":tR.Hl;return t.contentOutput?(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[14px] overflow-hidden shadow-[0_1px_4px_rgba(0,0,0,0.04)] dark:shadow-none",style:{animation:"fadeIn 0.4s ease"},children:[(0,a.jsxs)("div",{className:"py-[13px] px-4 border-b-[0.5px] border-b-[#f0eeea] dark:border-b-border flex items-center justify-between bg-[#fafaf8] dark:bg-surface",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-5 h-5 rounded-full flex items-center justify-center shrink-0 bg-[#dcfce7] dark:bg-green-900/40 shadow-[0_0_0_3px_#bbf7d0] dark:shadow-[0_0_0_3px_rgba(34,197,94,0.3)]",children:(0,a.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 8 8",fill:"none",className:"text-[#166534] dark:text-green-400",stroke:"currentColor",strokeWidth:"2",children:(0,a.jsx)("path",{d:"M1.5 4l2 2 3-4"})})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[12px] font-semibold text-[#111] dark:text-ink-primary tracking-[-0.01em]",children:r("contentOutput.header")}),(0,a.jsx)("span",{className:"text-[10px] text-gray-400 dark:text-ink-muted ml-2",children:r("contentOutput.channels",{count:t.contentOutput.length})})]})]}),(0,a.jsx)("span",{className:"text-[10px] py-[3px] px-[9px] rounded-full bg-[#dcfce7] dark:bg-green-900/40 text-[#166534] dark:text-green-400 font-medium tracking-[0.01em]",children:r("contentOutput.ready")})]}),(0,a.jsx)("div",{className:"py-3.5 px-4 flex flex-col gap-3",children:t.contentOutput.map((e,i)=>{let o=e=>"cta"===e.toLowerCase(),d=e.parts.filter(e=>!o(e.label)),c=e.parts.find(e=>o(e.label)),x={Caption:3e3,Hook:50,Body:100,Headline:70,Description:90,"Intro text":150,"Thumbnail copy":20};return(0,a.jsxs)("div",{className:"border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[11px] overflow-hidden bg-white dark:bg-surface-elevated shadow-[0_1px_3px_rgba(0,0,0,0.04)] dark:shadow-none",children:[(0,a.jsxs)("div",{className:"py-2.5 px-3.5 bg-[#f8f7f4] dark:bg-surface border-b-[0.5px] border-b-[#f0eeea] dark:border-b-border flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-[7px]",children:[(0,a.jsx)("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:n}}),(0,a.jsx)("span",{className:"text-[11px] font-semibold tracking-[-0.01em]",style:{color:n},children:e.channel})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-[9px] text-gray-400 dark:text-ink-muted bg-white dark:bg-surface-elevated py-0.5 px-2 rounded-full border-[0.5px] border-[#e5e7eb] dark:border-border font-medium",children:r("contentOutput.types.".concat(e.contentType),{defaultValue:e.contentType})}),(0,a.jsx)("span",{className:"text-[10px] text-gray-400 dark:text-ink-muted cursor-pointer py-0.5 px-2 border-[0.5px] border-[#e5e7eb] dark:border-border rounded-full bg-white dark:bg-surface-elevated font-medium transition-all duration-150",onMouseEnter:e=>{e.currentTarget.style.borderColor=n,e.currentTarget.style.color=n},onMouseLeave:e=>{e.currentTarget.style.borderColor="",e.currentTarget.style.color=""},onClick:()=>{var t;return null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText(e.parts.map(e=>"".concat(e.label,":\n").concat(e.text)).join("\n\n"))},children:r("contentOutput.copyAll")})]})]}),(0,a.jsxs)("div",{className:"py-3 px-3.5 flex flex-col gap-2.5",children:[d.map((e,o)=>{var d,c;let u=null!==(c=null===(d=e.text)||void 0===d?void 0:d.length)&&void 0!==c?c:0,m=x[e.label],h=m&&e.characterCount>m,g=m&&e.characterCount>.85*m;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-[5px]",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold text-gray-700 dark:text-ink-secondary tracking-[0.01em]",children:l(e.label)}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[m&&(0,a.jsx)("div",{className:"h-[3px] w-10 rounded-[2px] bg-[#f0eeea] dark:bg-border overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-[2px] transition-[width,background] duration-200 ".concat(h?"bg-red-600 dark:bg-red-500":g?"bg-amber-500 dark:bg-amber-400":"bg-[#86efac] dark:bg-green-400/70"),style:{width:"".concat(Math.min(u/m*100,100),"%")}})}),(0,a.jsxs)("span",{className:"text-[9px] tabular-nums ".concat(h?"text-red-600 dark:text-red-400 font-semibold":g?"text-amber-600 dar
1k:text-amber-400 font-normal":"text-gray-400 dark:text-ink-muted font-normal"),children:[u,m?" / ".concat(m):""]}),(0,a.jsx)("span",{className:"text-[9px] text-[#c7d9f5] dark:text-blue-300/70 cursor-pointer py-[1px] px-1.5 border-[0.5px] border-[#e5e7eb] dark:border-border rounded-full bg-white dark:bg-surface-elevated transition-all duration-150",onMouseEnter:e=>{e.currentTarget.style.borderColor=n,e.currentTarget.style.color=n},onMouseLeave:e=>{e.currentTarget.style.borderColor="",e.currentTarget.style.color=""},onClick:()=>{var t;return null===(t=navigator.clipboard)||void 0===t?void 0:t.writeText(e.text)},children:r("contentOutput.copy")})]})]}),(0,a.jsx)("textarea",{rows:"Caption"===e.label?5:"Intro text"===e.label?3:2,className:"w-full rounded-[8px] py-2 px-2.5 text-[11px] font-[inherit] leading-[1.7] resize-y outline-none box-border transition-colors duration-150 text-gray-700 dark:text-ink-secondary border ".concat(h?"border-red-300 dark:border-red-800/60 bg-red-50 dark:bg-red-950/20":"border-[#e5e7eb] dark:border-border bg-[#fafaf8] dark:bg-surface"),value:e.text,onChange:r=>{let a=null==t?void 0:t.contentOutput.map((t,a)=>a!==i?t:{...t,parts:t.parts.map(t=>t.label!==e.label?t:{...t,text:r.target.value,characterCount:r.target.value.length})});t.setContentOutput(a)},onFocus:e=>{h||(e.target.style.borderColor=n),e.target.style.background=s?"":"#fff"},onBlur:e=>{e.target.style.borderColor="",e.target.style.background=""}})]},o)}),c&&(()=>{var e,s;let l=null!==(s=null===(e=c.text)||void 0===e?void 0:e.length)&&void 0!==s?s:0,o=l>40;return(0,a.jsxs)("div",{className:"mt-0.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-[5px]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-[10px] font-bold tracking-[0.03em]",style:{color:n},children:"CTA"}),(0,a.jsx)("span",{className:"text-[9px] text-gray-400 dark:text-ink-muted bg-[#eef3fb] dark:bg-surface-active py-[1px] px-1.5 rounded-full",children:r("contentOutput.callToAction")})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsxs)("span",{className:"text-[9px] tabular-nums ".concat(o?"text-red-600 dark:text-red-400":"text-gray-400 dark:text-ink-muted"),children:[l," / ",40]}),(0,a.jsx)("span",{className:"text-[9px] text-[#c7d9f5] dark:text-blue-300/70 cursor-pointer py-[1px] px-1.5 border-[0.5px] border-[#e5e7eb] dark:border-border rounded-full bg-white dark:bg-surface-elevated transition-all duration-150",onMouseEnter:e=>{e.currentTarget.style.borderColor=n,e.currentTarget.style.color=n},onMouseLeave:e=>{e.currentTarget.style.borderColor="",e.currentTarget.style.color=""},onClick:()=>{var e;return null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText(c.text)},children:r("contentOutput.copy")})]})]}),(0,a.jsxs)("div",{className:"flex items-center rounded-[8px] py-0.5 pr-1.5 pl-3 gap-2 border ".concat(o?"bg-red-50 dark:bg-red-950/20 border-red-300 dark:border-red-800/60":"bg-[#eef3fb] dark:bg-surface-active border-[#c7d9f5] dark:border-border"),children:[(0,a.jsx)("input",{className:"flex-1 border-none outline-none text-[12px] font-[inherit] font-semibold bg-transparent py-[5px] tracking-[-0.01em]",style:{color:n},value:c.text,onChange:e=>{let r=t.contentOutput.map((t,r)=>r!==i?t:{...t,parts:t.parts.map(t=>"cta"!==t.label.toLowerCase()?t:{...t,text:e.target.value,characterCount:e.target.value.length})});t.setContentOutput(r)}}),(0,a.jsx)("div",{className:"w-[0.5px] h-[18px] bg-[#c7d9f5] dark:bg-border shrink-0"}),(0,a.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:n,strokeWidth:"1.5",className:"shrink-0",style:{opacity:.5},children:(0,a.jsx)("path",{d:"M2 6h8M7 3l3 3-3 3"})})]})]})})()]})]},i)})})]}):null}var rA=r(56253);function rE(e){let{hook:t}=e,{t:r}=(0,P.Bd)("agent-x"),s=e=>r("studio.names.".concat(e),{defaultValue:e});return t.briefConfirmed?(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[14px] overflow-hidden shadow-[0_1px_4px_rgba(0,0,0,0.04)] dark:shadow-none",style:{animation:"fadeIn 0.4s ease"},children:[(0,a.jsxs)("div",{className:"py-[13px] px-4 border-b-[0.5px] border-b-[#f0eeea] dark:border-b-border flex items-center gap-2 bg-[#fafaf8] dark:bg-surface",children:[(0,a.jsx)("div",{className:"w-5 h-5 rounded-full flex items-center justify-center shrink-0 ".concat(t.studioResult?"bg-green-100 dark:bg-green-900/40 shadow-[0_0_0_3px_#bbf7d0] dark:shadow-[0_0_0_3px_rgba(34,197,94,0.3)]":"bg-violet-100 dar
1k:bg-violet-900/40 shadow-[0_0_0_3px_#ede9fe] dark:shadow-[0_0_0_3px_rgba(124,58,237,0.3)]"),children:t.studioResult?(0,a.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 8 8",fill:"none",className:"text-green-800 dark:text-green-400",stroke:"currentColor",strokeWidth:"2",children:(0,a.jsx)("path",{d:"M1.5 4l2 2 3-4"})}):(0,a.jsx)("span",{className:"text-[9px] text-violet-600 dark:text-violet-400 font-bold",children:"4"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[12px] font-semibold text-[#111] dark:text-ink-primary tracking-[-0.01em]",children:r("studio.header")}),t.studioResult&&(0,a.jsxs)("span",{className:"text-[10px] text-gray-400 dark:text-ink-muted ml-2",children:[s(t.studioResult.studioType),t.studioResult.channel?" \xb7 ".concat(t.studioResult.channel):""]})]})]}),(0,a.jsxs)("div",{className:"py-3.5 px-4 flex flex-col gap-3",children:[(0,a.jsx)("div",{className:"grid grid-cols-3 gap-2",children:[{val:"image",label:r("studio.types.image"),icon:"⬡",studio:r("studio.names.image"),desc:r("studio.descs.image")},{val:"video",label:r("studio.types.video"),icon:"â¶",studio:r("studio.names.video"),desc:r("studio.descs.video")},{val:"music",label:r("studio.types.music"),icon:"âª",studio:r("studio.names.music"),desc:r("studio.descs.music")}].map(e=>{let r=t.studioType===e.val;return(0,a.jsxs)("div",{onClick:()=>{t.setStudioType(e.val),t.setStudioResult(null),t.setStudioChannel([])},className:"py-3 px-2 rounded-[10px] cursor-pointer text-center transition-all duration-150 border ".concat(r?"border-[1.5px] border-violet-600 bg-violet-50 dark:bg-violet-900/30 shadow-[0_0_0_3px_#ede9fe] dark:shadow-[0_0_0_3px_rgba(124,58,237,0.25)]":"border-[0.5px] border-[#e5e7eb] dark:border-border bg-white dark:bg-surface-elevated shadow-[0_1px_2px_rgba(0,0,0,0.04)] dark:shadow-none"),children:[(0,a.jsx)("div",{className:"text-xl mb-[5px] leading-none",children:e.icon}),(0,a.jsx)("div",{className:"text-[11px] font-semibold mb-0.5 ".concat(r?"text-violet-600 dark:text-violet-400":"text-gray-700 dark:text-ink-secondary"),children:e.label}),(0,a.jsx)("div",{className:"text-[9px] ".concat(r?"text-violet-400 dark:text-violet-300":"text-gray-400 dark:text-ink-muted"),children:e.desc})]},e.val)})}),["image","video"].includes(t.studioType)&&(0,a.jsxs)("div",{className:"bg-[#f8f7f4] dark:bg-surface rounded-[9px] py-2.5 px-3 border-[0.5px] border-[#f0eeea] dark:border-border",children:[(0,a.jsx)("div",{className:"text-[10px] font-medium text-gray-500 dark:text-ink-secondary mb-2",children:r("studio.targetChannel")}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:[{ch:"LinkedIn",spec:"1200\xd7627px"},{ch:"TikTok",spec:"1080\xd71920px \xb7 9:16"},{ch:"Microsoft Bing",spec:"1200\xd7628px"},{ch:"Taboola",spec:"1200\xd7800px"}].map(e=>{let{ch:r,spec:s}=e,l=t.studioChannel[0]===r;return(0,a.jsxs)("div",{onClick:()=>{t.setStudioChannel(l?[]:[r]),t.setStudioResult(null)},className:"py-1.5 px-3 rounded-full text-[10px] cursor-pointer transition-all duration-150 flex items-center gap-1.5 border ".concat(l?"bg-violet-600 text-white border-violet-600 shadow-[0_0_0_2px_#ede9fe] dark:shadow-[0_0_0_2px_rgba(124,58,237,0.25)]":"bg-white dark:bg-surface-elevated text-gray-700 dark:text-ink-secondary border-[#e5e7eb] dark:border-border"),onMouseEnter:e=>{l||(e.currentTarget.style.borderColor="#7c3aed",e.currentTarget.style.color="#7c3aed")},onMouseLeave:e=>{l||(e.currentTarget.style.borderColor="",e.currentTarget.style.color="")},children:[(0,a.jsx)("div",{className:"w-[7px] h-[7px] rounded-full shrink-0 ".concat(l?"bg-white/70":"bg-[#d1d5db] dark:bg-border"),children:l&&(0,a.jsx)("div",{className:"w-full h-full rounded-full bg-white"})}),(0,a.jsx)("span",{className:l?"font-semibold":"font-normal",children:r}),l&&(0,a.jsx)("span",{className:"text-[8px] text-white/70 ml-0.5",children:s})]},r)})}),t.studioChannel[0]&&!["image","video"].some((e,t)=>!1)&&(0,a.jsxs)("div",{className:"mt-2 text-[9px] text-violet-400 dark:text-violet-300 flex items-center gap-1",children:[(0,a.jsxs)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",className:"text-violet-400 dark:text-violet-300",stroke:"currentColor",strokeWidth:"1.3",children:[(0,a.jsx)("circle",{cx:"5",cy:"5",r:"4"}),(0,a.jsx)("path",{d:"M5 3v2.5l1.5 1"})]}),{LinkedIn:"1200\xd7627px \xb7 1:1.91 \xb7 professional tone",TikTok:"1080\xd71920px \xb7 9:16 \xb7 hook-first","Microsoft Bing":"1200\xd7628px \xb7 editorial \xb7 high intent",Taboola:"1200\xd7800px \xb7 3:2 \xb7 native feel"}[t.studioChannel[0]]||""]})]}),["image","video","music"].includes(t.studioType)&&!t.studioLoading&&!t.studioResult&&(()=>{let e=["image","video"].includes(t.studioType)&&!t.studioChannel[0];return(0,a.jsxs)("button",{onClick:()=>{e||t.generateStudioPrompt()},className:"rounded-[10px] py-[11px] text-[11px] font-semibold flex items-center justify-center gap-[7px] w-full font-[inherit] transition-all duration-200 tracking-[-0.01em] ".concat(e?"bg-gray-100 dark:bg-surface text-gray-400 dark:text-ink-muted border-[0.5px] border-[#e5e7eb] dark:border-border
1cursor-not-allowed":"bg-violet-600 text-white border-none cursor-pointer"),children:[(0,a.jsx)("span",{className:"text-[14px]",children:{image:"⬡",video:"â¶",music:"âª"}[t.studioType]}),(0,a.jsx)("span",{children:e?r("studio.needChannel"):r("studio.sendTo",{studio:s(t.studioType)})})]})})(),t.studioLoading&&(0,a.jsxs)("div",{className:"rounded-[10px] border-[0.5px] border-[#ddd6fe] dark:border-violet-800/40 overflow-hidden",children:[(0,a.jsx)("div",{className:"h-[3px] bg-violet-100 dark:bg-violet-900/40 relative overflow-hidden",children:(0,a.jsx)("div",{style:{position:"absolute",top:0,left:0,height:"100%",width:"40%",background:"linear-gradient(90deg, transparent, #7c3aed, transparent)",animation:"spin 1.5s linear infinite",transformOrigin:"center"}})}),(0,a.jsxs)("div",{className:"pt-3.5 px-3.5 pb-4 bg-violet-50 dark:bg-violet-950/20 flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-violet-100 dark:bg-violet-900/40 rounded-lg flex items-center justify-center shrink-0",children:(0,a.jsx)(t2,{})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"text-[12px] font-semibold text-violet-700 dark:text-violet-300 tracking-[-0.01em]",children:[r("studio.generatingIn",{studio:s(t.studioType)}),t.studioChannel[0]?" \xb7 ".concat(t.studioChannel[0]):""]}),(0,a.jsx)("div",{className:"text-[10px] text-violet-400 dark:text-violet-300 mt-0.5",children:r("studio.mayTake")})]})]}),(0,a.jsx)("div",{className:"flex flex-col gap-1.5 pl-1",children:[{label:r("studio.steps.analysing"),done:!0},{label:r("studio.steps.building",{type:r("studio.types.".concat(t.studioType),{defaultValue:t.studioType})}),done:!0},{label:r("studio.steps.sending"),done:!1,active:!0},{label:r("studio.steps.finalising"),done:!1}].map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-[14px] h-[14px] rounded-full shrink-0 flex items-center justify-center ".concat(e.done?"bg-violet-600 border-none":e.active?"bg-violet-100 dark:bg-violet-900/40 border-[1.5px] border-violet-600":"bg-transparent border-[1.5px] border-violet-200 dark:border-violet-800/40"),children:e.done?(0,a.jsx)("svg",{width:"7",height:"7",viewBox:"0 0 8 8",fill:"none",stroke:"white",strokeWidth:"2",children:(0,a.jsx)("path",{d:"M1.5 4l2 2 3-4"})}):e.active?(0,a.jsx)("div",{className:"w-[5px] h-[5px] rounded-full bg-violet-600"}):null}),(0,a.jsx)("span",{className:"text-[10px] ".concat(e.done?"text-violet-600 dark:text-violet-400":e.active?"text-violet-700 dark:text-violet-300":"text-violet-300 dark:text-violet-800/60"," ").concat(e.active?"font-medium":"font-normal"),children:e.label})]},t))})]})]}),t.studioResult&&!t.studioLoading&&(0,a.jsxs)("div",{className:"rounded-[10px] border-[0.5px] border-green-300 dark:border-green-800/40 overflow-hidden shadow-[0_1px_6px_rgba(22,101,52,0.08)] dark:shadow-none",children:[(0,a.jsxs)("div",{className:"py-3.5 px-4 flex items-center gap-3 bg-[linear-gradient(135deg,#f0fdf4_0%,#dcfce7_100%)] dark:bg-none dark:bg-emerald-950/40",children:[(0,a.jsx)("div",{className:"w-9 h-9 bg-white dark:bg-surface-elevated rounded-[10px] flex items-center justify-center shrink-0 shadow-[0_1px_4px_rgba(0,0,0,0.08)] dark:shadow-none",children:(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 8 8",fill:"none",className:"text-green-800 dark:text-green-400",stroke:"currentColor",strokeWidth:"2",children:(0,a.jsx)("path",{d:"M1.5 4l2 2 3-4"})})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("div",{className:"text-[13px] font-bold text-green-900 dark:text-green-300 tracking-[-0.02em] mb-[3px]",children:r("studio.ready",{studio:s(t.studioResult.studioType)})}),(0,a.jsxs)("div",{className:"text-[10px] text-green-800 dark:text-green-400 flex items-center gap-[5px]",children:[t.studioResult.channel&&(0,a.jsx)("span",{className:"bg-green-200 dark:bg-green-800/40 py-[1px] px-[7px] rounded-full font-medium",children:t.studioResult.channel}),(0,a.jsx)("span",{children:r("studio.projectCreated")})]})]})]}),(0,a.jsx)("div",{className:"py-3 px-4 bg-white dark:bg-surface-elevated flex gap-2 border-t-[0.5px] border-t-green-100 dark:border-t-green-900/40",children:(0,a.jsxs)("a",{onClick:e=>{var r;e.preventDefault();let a=new URLSearchParams;t.studioResult.generationPrompt&&a.set("prompt",t.studioResult.generationPrompt),t.studioResult.negativePrompt&&a.set("negativePrompt",t.studioResult.negativePrompt),"music"===t.studioResult.studioType&&t.studioResult.campaignAlignment&&a.set("styleInstructions",t.studioResult.campaignAlignment);let s=null!==(r=({image:"/editor/image",video:"/editor/video",music:"/editor/music"})[t.studioResult.studioType])&&void 0!==r?r:"/editor/image";rA.router.push("".concat(s,"?").concat(a.toString()))},className:"flex-[2] flex items-center justify-center gap-[7px] bg-green-800 dark:bg-green-700 text-white rounded-[9px] py-2.5 text-[12px] font-semibold cursor-pointer no-underline tracking-[-0.01em] transition-colors duration-150",onMouseEnter:e=>e.currentTarget.style.background="#14532d",onMouseLeave:e=>e.currentTarget.style.background="",children:[(0,a.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",stroke:"white",strokeWidth:"1.8",children:(0,a.jsx)("path",{d:"M2 6h8M7 3l3 3-3 3"})}
1),r("studio.goToProject")]})})]})]})]}):null}function rL(e){let{hook:t}=e;return(0,a.jsxs)("div",{className:"flex flex-col gap-3.5 animate-[fadeIn_0.4s_ease]",children:[(0,a.jsx)(rw,{hook:t}),(0,a.jsx)(rC,{hook:t}),(0,a.jsx)(rS,{hook:t}),(0,a.jsx)(rT,{hook:t}),(0,a.jsx)(rE,{hook:t})]})}function rM(e){let{hook:t}=e,{t:r}=(0,P.Bd)("agent-x");if(!t.showRegenerateConfirm)return null;let s=[t.brief?r("regenerateBrief.lostBrief"):null,t.briefConfirmed?r("regenerateBrief.lostConfirmed"):null,t.contentOutput?r("regenerateBrief.lostCopy"):null,t.imagePromptOutput?r("regenerateBrief.lostStudio"):null].filter(Boolean);return(0,a.jsx)("div",{className:"absolute inset-0 bg-black/35 flex items-center justify-center z-50",onClick:()=>t.setShowRegenerateConfirm(!1),children:(0,a.jsxs)("div",{className:"bg-white dark:bg-surface-elevated rounded-[14px] w-[380px] overflow-hidden shadow-[0_8px_32px_rgba(0,0,0,0.14)] dark:shadow-black/50",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"py-4 px-5 border-b-[0.5px] border-b-[#e5e7eb] dark:border-b-border flex items-center gap-2.5",children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-[#fff8e6] dark:bg-amber-900/30 rounded-lg flex items-center justify-center flex-shrink-0",children:(0,a.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 14 14",fill:"none",stroke:"#d97706",strokeWidth:"1.5",children:[(0,a.jsx)("circle",{cx:"7",cy:"7",r:"6"}),(0,a.jsx)("path",{d:"M7 4v3.5M7 10h.01"})]})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[13px] font-semibold text-[#111] dark:text-ink-primary",children:r("regenerateBrief.title")}),(0,a.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-ink-muted mt-0.5",children:r("regenerateBrief.subtitle")})]})]}),(0,a.jsx)("div",{className:"py-3.5 px-5",children:(0,a.jsxs)("div",{className:"text-[11px] text-gray-500 dark:text-ink-muted leading-[1.7] bg-[#f8f7f4] dark:bg-surface rounded-lg py-2.5 px-3 border-[0.5px] border-[#f0eeea] dark:border-border",children:[s.map((e,t)=>(0,a.jsx)("div",{className:"text-[11px] text-gray-500 dark:text-ink-muted mb-[3px]",children:e},t)),(0,a.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-ink-muted mt-1.5",children:r("regenerateBrief.allLost")})]})}),(0,a.jsxs)("div",{className:"py-3 px-5 border-t-[0.5px] border-t-[#e5e7eb] dark:border-t-border flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>t.setShowRegenerateConfirm(!1),className:"flex-1 bg-[#f8f7f4] dark:bg-surface text-gray-700 dark:text-ink-secondary border-[0.5px] border-[#e5e7eb] dark:border-border rounded-[7px] py-[9px] text-[12px] cursor-pointer font-[inherit] hover:bg-gray-100 dark:hover:bg-surface-active transition-colors",children:r("regenerateBrief.cancel")}),(0,a.jsx)("button",{onClick:()=>{t.setShowRegenerateConfirm(!1),t.regenerateBrief(t.selectedGoal)},className:"flex-[2] text-white border-none rounded-[7px] py-[9px] text-[12px] font-medium cursor-pointer font-[inherit]",style:{background:tR.UH},children:r("regenerateBrief.confirm")})]})]})})}var rR=r(22540),rz=r(52442),r_=r(26079),rO=r(16451),rI=r(94201),rD=r(2580);let rP=e=>{let{isOpen:t,onClose:r,shareUrl:s,reportName:l,onCopyLink:i,copied:o}=e,{t:d}=(0,P.Bd)("agent-x");return t?(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:(0,a.jsxs)("div",{className:"relative w-full max-w-2xl rounded-2xl bg-white dark:bg-[#262624] shadow-2xl",children:[(0,a.jsxs)("div",{className:"px-6 py-5 border-b dark:border-white/10",children:[(0,a.jsx)("button",{onClick:r,className:"absolute right-4 top-4 roun
1ded-full p-1.5 text-gray-400 dark:text-white/30 hover:text-gray-600 dark:hover:text-white/60 hover:bg-gray-100 dark:hover:bg-white/10 transition-all","aria-label":d("publishModal.close"),children:(0,a.jsx)(n.A,{size:20})}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"rounded-full bg-gray-100 dark:bg-white/10 p-2.5",children:(0,a.jsx)(rR.A,{size:22,className:"text-gray-700 dark:text-white/70"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white/90",children:d("publishModal.title")}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-white/40 mt-0.5",children:l?d("publishModal.subtitleWithName",{name:l}):d("publishModal.subtitle")})]})]})]}),(0,a.jsxs)("div",{className:"p-6 space-y-5",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 rounded-xl bg-amber-50 dark:bg-amber-900/15 border border-amber-200 dark:border-amber-700/30 p-4",children:[(0,a.jsx)(K.A,{size:20,className:"text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"text-sm text-amber-900 dark:text-amber-300",children:[(0,a.jsx)("p",{className:"font-medium mb-1",children:d("publishModal.whenYouPublish")}),(0,a.jsxs)("ul",{className:"space-y-1 text-amber-800 dark:text-amber-400",children:[(0,a.jsxs)("li",{children:["⢠",d("publishModal.bullet1")]}),(0,a.jsxs)("li",{children:["⢠",d("publishModal.bullet2")]}),(0,a.jsxs)("li",{children:["⢠",d("publishModal.bullet3")]})]})]})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 rounded-lg border border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-white/5",children:[(0,a.jsx)("div",{className:"rounded-lg bg-gray-200 dark:bg-white/10 p-2.5",children:(0,a.jsx)(rz.A,{size:20,className:"text-gray-700 dark:text-white/60"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white/90",children:d("publishModal.publicAccess")}),(0,a.jsx)("p",{className:"text-xs text-gray-600 dark:text-white/40 mt-0.5",children:d("publishModal.publicAccessDesc")})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 rounded-lg border border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-white/5",children:[(0,a.jsx)("div",{className:"rounded-lg bg-gray-200 dark:bg-white/10 p-2.5",children:(0,a.jsx)(r_.A,{size:20,className:"text-gray-700 dark:text-white/60"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white/90",children:d("publishModal.shareable")}),(0,a.jsx)("p",{className:"text-xs text-gray-600 dark:text-white/40 mt-0.5",children:d("publishModal.shareableDesc")})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 p-4 rounded-lg border border-gray-200 dark:border-white/10 bg-gray-50 dark:bg-white/5",children:[(0,a.jsx)("div",{className:"rounded-lg bg-gray-200 dark:bg-white/10 p-2.5",children:(0,a.jsx)(rO.A,{size:20,className:"text-gray-700 dark:text-white/60"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white/90",children:d("publishModal.readOnly")}),(0,a.jsx)("p",{className:"text-xs text-gray-600 dark:text-white/40 mt-0.5",children:d("publishModal.readOnlyDesc")})]})]})]}),(0,a.jsx)("div",{className:"rounded-lg bg-amber-50 dark:bg-amber-900/15 border border-amber-200 dark:border-amber-700/30 p-3",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(q.A,{size:16,className:"text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"}),(0,a.jsx)("p",{className:"text-xs text-amber-900 dark:text-amber-300",children:(0,a.jsx)(P.x6,{t:d,i18nKey:"publishModal.privacyNote",components:{b:(0,a.jsx)("span",{className:"font-semibold"}),em:(0,a.jsx)("span",{className:"font-medium"})}})})]})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-white/70 mb-2",children:d("publishModal.linkLabel")}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"flex-1 relative",children:[(0,a.jsx)("input",{readOnly:!0,value:s,className:"w-full rounded-lg border border-gray-300 dark:border-white/10 bg-gray-50 dark:bg-[#1e1e1b] px-4 py-3 text-sm pr-10 text-gray-700 dark:text-white/60 focus:outline-none focus:ring-2 focus:ring-gray-400 dark:focus:ring-white/20"}),(0,a.jsx)(rI.A,{size:16,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 dark:text-white/30"})]}),(0,a.jsx)("button",{onClick:i,className:"inline-flex items-center gap-2 rounded-lg bg-gray-900 dark:bg-white/10 hover:bg-gray-800 dark:hover:bg-white/20 border dark:border-white/10 px-4 py-3 text-sm font-medium text-white transition-colors",children:o?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(W.A,{size:16}),d("publishModal.copied")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(rD.A,{size:16}),d("publishModal.copyLink")]})})]})]})]})]})}):null};var rB=r(25418);let rF=function(){var e;let{initialData:t,initialResponse:r,recordId:l,ragCreated:i,isEditor:o=!0,onOpenQueues:d}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=function(e,t,r,a){let l=!(arguments.length>4)||void 0===arguments[4]||arguments[4],{t:n,i18n:i}=(0,P.Bd)("agent-x"),o=(0,y.d4)(e=>e.user),{toast:d,showToast:c}
1=(0,eB.Z)(),[x,u]=(0,s.useState)("trend"),[m,h]=(0,s.useState)(""),[g,p]=(0,s.useState)([]),[b,f]=(0,s.useState)([]),[v,k]=(0,s.useState)([]),[j,w]=(0,s.useState)([]),[C,S]=(0,s.useState)(""),[T,A]=(0,s.useState)(""),[E,L]=(0,s.useState)(""),[M,R]=(0,s.useState)(null),[z,_]=(0,s.useState)(null),[O,I]=(0,s.useState)(!1),[D,B]=(0,s.useState)("budgetExceed"),[F,H]=(0,s.useState)("7d"),[U,G]=(0,s.useState)(""),[q,V]=(0,s.useState)("00:00"),[W,J]=(0,s.useState)(""),[K,Y]=(0,s.useState)("23:59"),[$,X]=(0,s.useState)(!1),Z=(0,s.useMemo)(()=>U&&W?Math.round((new Date(W).getTime()-new Date(U).getTime())/864e5):0,[U,W]),[Q,ee]=(0,s.useState)(["tr","en"]),[et,er]=(0,s.useState)(["Tweets","Retweets","Outgoing replies","Incoming replies"]),[ea,es]=(0,s.useState)("merged"),[el,en]=(0,s.useState)(5),[ei,eo]=(0,s.useState)("Turkish"),[ed,ec]=(0,s.useState)(""),[ex,eu]=(0,s.useState)(!1),[em,eh]=(0,s.useState)(!1),[eg,ep]=(0,s.useState)("idle"),[eb,ef]=(0,s.useState)(null),[ev,ey]=(0,s.useState)(null),[ek,ej]=(0,s.useState)(null),[eN,ew]=(0,s.useState)([]),[eC,eS]=(0,s.useState)(0),[eT,eA]=(0,s.useState)(null),[eE,eL]=(0,s.useState)([]),[eM,eP]=(0,s.useState)(()=>{{let e=new URLSearchParams(window.location.search).get("xTab");if("Summary"===e||"Chat"===e||"Content & Creative"===e)return e}return"Summary"}
1),[eF,eH]=(0,s.useState)([]),[eG,eq]=(0,s.useState)(""),[eV,eW]=(0,s.useState)(!1),[eJ,eK]=(0,s.useState)(null),[eY,e$]=(0,s.useState)(null),[eX,eZ]=(0,s.useState)(null),[eQ,e0]=(0,s.useState)(null),[e1,e2]=(0,s.useState)(!1),[e5,e4]=(0,s.useState)(!1),[e3,e6]=(0,s.useState)([]),[e8,e7]=(0,s.useState)(0),[e9,te]=(0,s.useState)("post"),[tt,tr]=(0,s.useState)([]),[ta,ts]=(0,s.useState)("image"),[tl,tn]=(0,s.useState)([]),[ti,to]=(0,s.useState)(null),[td,tc]=(0,s.useState)("professional"),[tx,tu]=(0,s.useState)(null),[tm,th]=(0,s.useState)(!1),[tg,tp]=(0,s.useState)(null),[tb,tf]=(0,s.useState)(null),[tv,ty]=(0,s.useState)(!1),[tk,tj]=(0,s.useState)(!1),[tN,tw]=(0,s.useState)(null),[tC,tS]=(0,s.useState)(!1),[tT,tA]=(0,s.useState)(null),[tE,tz]=(0,s.useState)(null),[t_,tO]=(0,s.useState)({brandVoice:"",mandatory:"",negativeRules:"",regulatory:""}),[tI,tD]=(0,s.useState)(null),[tB,tG]=(0,s.useState)(!1),[tq,tJ]=(0,s.useState)(null),[tK,tY]=(0,s.useState)(!1),[t$,tX]=(0,s.useState)(null),[tZ,tQ]=(0,s.useState)(!1),[t0,t1]=(0,s.useState)(!1),[t2,t5]=(0,s.useState)(!1),t4=(0,s.useRef)(null),t3=(0,s.useRef)(null),t6=(0,s.useRef)(null),t8=(0,s.useRef)(null),t7=(0,s.useRef)(null),[t9,re]=(0,s.useState)(null),rt=(0,s.useRef)(null),rr=(0,s.useRef)(null),ra=(0,s.useRef)(null),rs=(0,s.useRef)(null),rl="competitive"===x,rn=rl?tR.qM:tR._k,ri=(0,s.useCallback)(e=>{eP(e);{let t=new URLSearchParams(window.location.search);t.set("xTab",e);let r="".concat(window.location.pathname,"?").concat(t.toString());window.history.pushState({...window.history.state,as:r,url:r},"",r)}},[]);(0,s.useEffect)(()=>{(null==o?void 0:o.token)&&(0,eU.Hs)(o.token,{status:"ACTIVE",agentry:!0}).then(e=>{var t;let r=null!==(t=e.agenticAIs)&&void 0!==t?t:[];p(r),r.length>0&&h(e=>{if(!e)return r[0].tag;let t=r.find(t=>t.tag.toLowerCase()===e.toLowerCase());return t?t.tag:e})}).catch(()=>{})},[null==o?void 0:o.token]),(0,s.useEffect)(()=>{var r,a,s,l,n,i,o,d,c,x,u,m,h,g,p,b,f,v,y,k,j,N,w,C,S,T,A,E;if(!e||!t)return;let L=e.generateCopyRequest,M=e.studioPromptRequest,R=t.goalResponse,z=t.generateCopyResponse,_=t.studioPromptResponse;console.log(t.goalResponse,"initialResponse"),R&&(re(R),rt.current=R,rr.current=tH,R.rankings&&tJ({rankings:R.rankings}));let O=(null==L?void 0:L.selectedGoal)||(null==M?void 0:M.selectedGoal)||null;O&&tD(O);let I=(null==L?void 0:L.brief)||(null==M?void 0:M.brief);I&&(tf({objective:{value:null!==(a=I.objective)&&void 0!==a?a:"",edited:!1},audience:{value:null!==(s=I.audience)&&void 0!==s?s:"",edited:!1},platform:{value:null!==(l=I.platform)&&void 0!==l?l:"",edited:!1},tone:{value:null!==(n=I.tone)&&void 0!==n?n:"",edited:!1},keyMessage:{value:null!==(o=null!==(i=I.key_message)&&void 0!==i?i:I.keyMessage)&&void 0!==o?o:"",edited:!1}}),tj(!0));let D=(null==L?void 0:L.brandSpecs)||(null==M?void 0:M.brandSpecs);D&&tO({brandVoice:null!==(c=null!==(d=D.brand_voice)&&void 0!==d?d:D.brandVoice)&&void 0!==c?c:"",mandatory:null!==(x=D.mandatory)&&void 0!==x?x:"",negativeRules:null!==(m=null!==(u=D.negative_rules)&&void 0!==u?u:D.negativeRules)&&void 0!==m?m:"",regulatory:null!==(h=D.regulatory)&&void 0!==h?h:""}),(null==L?void 0:L.contentType)&&te(L.contentType),(null==z?void 0:null===(r=z.channels)||void 0===r?void 0:r.length)&&(tu(z.channels),tr(z.channels.map(e=>e.channel))),(null==M?void 0:M.studioType)&&ts(M.studioType),(null==M?void 0:M.targetChannel)&&tn([M.targetChannel]),_&&tX({studioType:null!==(b=null!==(p=null!==(g=_.studio_type)&&void 0!==g?g:_.studioType)&&void 0!==p?p:null==M?void 0:M.studioType)&&void 0!==b?b:"",channel:null!==(v=null!==(f=_.channel)&&void 0!==f?f:null==M?void 0:M.targetChannel)&&void 0!==v?v:null,projectId:null!==(k=null!==(y=_.projectId)&&void 0!==y?y:_.project_id)&&void 0!==k?k:"",projectUrl:null!==(N=null!==(j=_.projectUrl)&&void 0!==j?j:_.project_url)&&void 0!==N?N:"",generationPrompt:null!==(C=null!==(w=_.generation_prompt)&&void 0!==w?w:_.generationPrompt)&&void 0!==C?C:"",negativePrompt:null!==(T=null!==(S=_.negative_prompt)&&void 0!==S?S:_.negativePrompt)&&void 0!==T?T:"",campaignAlignment:null!==(E=null!==(A=_.campaign_alignment)&&void 0!==A?A:_.campaignAlignment)&&void 0!==E?E:""})},[e,t]),(0,s.useEffect)(()=>{let e=e=>{t7.current&&!t7.current.contains(e.target)&&t1(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,s.useEffect)(()=>
1{if(!e1)return;let e=setInterval(()=>{var e;null===(e=t4.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},400);return()=>clearInterval(e)},[e1]),(0,s.useEffect)(()=>{let e=document.createElement("style");return e.textContent="\n@keyframes spin{to{transform:rotate(360deg)}}\n@keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}\n@keyframes bounce{0%,80%,100%{transform:translateY(0)}40%{transform:translateY(-5px)}}\n@keyframes blink{0%{opacity:1}50%{opacity:0}100%{opacity:1}}\n ",document.head.appendChild(e),()=>{try{document.head.removeChild(e)}catch(e){}}},[]),(0,s.useEffect)(()=>{var s,l,n,o,d,c,x,g,p,b,v,y,j,N,C,S,T;if(!e||!t)return;let A=e.xAgentRequest,E=A.userPostsRequest||{},L="competitive"===A.analysisType;u(L?"competitive":"trend"),A.aiId&&h(A.aiId),A.prompt&&(ec(A.prompt),eu(Object.values({...tR.qM,...tR._k}).includes(A.prompt))),A.outputLanguage&&eo(A.outputLanguage),L?((null===(p=E.users)||void 0===p?void 0:p.length)&&f(E.users.map(e=>({handle:e.user||e}))),(null===(b=E.rivalUsers)||void 0===b?void 0:b.length)&&k(E.rivalUsers.map(e=>({handle:e.user||e})))):(null===(v=E.users)||void 0===v?void 0:v.length)&&w(E.users.map(e=>({handle:e.user||e}))),(null===(s=E.languages)||void 0===s?void 0:s.length)&&ee(E.languages);let M=[];(null===(l=E.includes)||void 0===l?void 0:l.tweets)&&M.push("Tweets"),(null===(n=E.includes)||void 0===n?void 0:n.retweets)&&M.push("Retweets"),(null===(o=E.includes)||void 0===o?void 0:o.outgoingReplies)&&M.push("Outgoing replies"),(null===(d=E.incomingTweets)||void 0===d?void 0:d.maxResults)>0&&M.push("Incoming replies"),M.length&&er(M),E.threadMode&&es("merged"===E.threadMode?"merged":"individual"),(null===(c=E.incomingTweets)||void 0===c?void 0:c.likeCount)&&en(E.incomingTweets.likeCount),(null===(x=E.timeRange)||void 0===x?void 0:x.startDate)&&(null===(g=E.timeRange)||void 0===g?void 0:g.endDate)&&(H("custom"),G(E.timeRange.startDate.slice(0,10)),V(E.timeRange.startDate.slice(11,16)||"00:00"),J(E.timeRange.endDate.slice(0,10)),Y(E.timeRange.endDate.slice(11,16)||"23:59")),t.outputText&&(ef(t.outputText),ep("done"),ew([0,1,2,3]),eS(4),r&&e$(r),r&&a?eK(r):eK(null),eZ(null),ej({date:new Date().toLocaleString(i.language,{day:"2-digit",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"}),type:L?"Competitive":"Trend & Topic",model:A.aiId||m,timeRange:"".concat((null===(j=E.timeRange)||void 0===j?void 0:null===(y=j.startDate)||void 0===y?void 0:y.slice(0,16))||""," â ").concat((null===(C=E.timeRange)||void 0===C?void 0:null===(N=C.endDate)||void 0===N?void 0:N.slice(0,16))||""),fetchMode:"Auto pagination with soft cap",tweetLang:(E.languages||[]).map(e=>e.toUpperCase()).join(", ")||"All languages",contentTypes:M.join(", ")||"None",threadMode:"merged"===E.threadMode?"Merge threads":"Individual tweets",outputLang:A.outputLanguage||ei,minEngagement:(null===(S=E.incomingTweets)||void 0===S?void 0:S.maxResults)>0?((null===(T=E.incomingTweets)||void 0===T?void 0:T.likeCount)||0)+"+ likes+RT":"N/A",ownAccounts:L?(E.users||[]).map(e=>e.user||e).join(", "):null,rivalAccounts:L?(E.rivalUsers||[]).map(e=>e.user||e).join(", "):null,trendAccounts:L?null:(E.users||[]).map(e=>e.user||e).join(", "),promptLabel:"Saved Report"}),eH([]),eq(""),eW(!1),e2(!1),e0(null),new URLSearchParams(window.location.search).get("xTab")||ri("Summary"))},[e,t]),(0,s.useEffect)(()=>{"Content & Creative"!==eM||"done"!==eg||tI||(tf(null),tj(!1),ty(!1),tG(!1),tJ(null))},[eM,eg]),(0,s.useEffect)(()=>{"Chat"===eM&&"done"===eg&&(a||t2?eJ&&rk():rm())},[eM,eg,eJ]);let ro=(0,s.useCallback)(async()=>{if(["image","video"].includes(ta)&&!tl[0])return;tY(!0),tX(null);let e=tl[0]||"",t=(null!=tx?tx:[]).filter(e=>tt.some(t=>{var r,a;return(null===(r=e.channel)||void 0===r?void 0:r.toLowerCase().includes(t.toLowerCase()))||t.toLowerCase().includes(null===(a=e.channel)||void 0===a?void 0:a.toLowerCase())})),r=t.flatMap(e=>{var r;return(null!==(r=e.parts)&&void 0!==r?r:[]).map(r=>{var a,s;return{label:t.length>1?"".concat(e.channel," - ").concat(r.label):r.label,text:r.text,characterCount:null!==(s=null!==(a=r.characterCount)&&void 0!==a?a:r.character_count)&&void 0!==s?s:0}})});try{var a,s,l,n,i,d,c,x,u,h,g,p,b,f,v,y,k,j,N;let w={objective:null!==(x=null==tb?void 0:null===(a=tb.objective)||void 0===a?void 0:a.value)&&void 0!==x?x:"",audience:null!==(u=null==tb?void 0:null===(s=tb.audience)||void 0===s?void 0:s.value)&&void 0!==u?u:"",platform:null!==(h=null==tb?void 0:null===(l=tb.platform)||void 0===l?void 0:l.value)&&void 0!==h?h:"",tone:null!==(g=null==tb?void 0:null===(n=tb.tone)||void 0===n?void 0:n.value)&&void 0!==g?g:"",keyMessage:null!==(p=null==tb?void 0:null===(i=tb.keyMessage)||void 0===i?void 0:i.value)&&void 0!==p?p:""},C={agentId:null!=eY?eY:"",selectedGoal:null!=tI?tI:"",brief:w,brandSpecs:{brandVoice:t_.brandVoice,mandatory:t_.mandatory,negativeRules:t_.negativeRules,regulatory:t_.regulatory},brandLogo:!!tT,studioType:ta,targetChannel:e,channelCopy:t.length?{channel:t.map(e=>e.channel).join(", "),contentType:null!==(f=null!==(b=null===(d=t[0])||void 0===d?void 0:d.content_type)&&void 0!==b?b:null===(c=t[0])||void 0===c?void 0:c.contentType)&&void 0!==f?f:"post",parts:r}:{channel:e,contentType:"post",parts:[]},aiId:"gpt-5.4"===m?"gpt-5.5":m,language:ei},S=await eR(C,null==o?void 0:o.token);tX({studioType:ta,channel:e||null,projectId:null!==(v=S.projectId)&&void 0!==v?v:"",projectUrl:null!==(y=S.projectUrl)&&void 0!==y?y:"",generationPrompt:null!==(k=S.generationPrompt)&&void 0!==k?k:"",negativePrompt:null!==(j=S.negativePrompt)&&void 0!==j?j:"",campaignAlignment:null!==(N=S.
1campaignAlignment)&&void 0!==N?N:""})}catch(e){console.error("generateStudioPrompt error:",e),ru(e,"toast.studioFailed")}finally{tY(!1)}},[ta,tl,tx,tt,tb,t_,tT,eY,tI,m,ei,null==o?void 0:o.token]);function rd(e,t,r){var a;if(t.rankings&&tJ({rankings:t.rankings}),"ai_decide"===e)return;let s=null===(a=t.briefs)||void 0===a?void 0:a[e];s?tf({objective:{value:s.objective,edited:!1},audience:{value:s.audience,edited:!1},keyMessage:{value:s.key_message,edited:!1},platform:{value:s.platform,edited:!1},tone:{value:s.tone,edited:!1}}):c(n(r?"toast.briefNotFound":"toast.briefFailed"),"error")}async function rc(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!eY||!(null==o?void 0:o.token)){ty(!1);return}let r=[null!=eY?eY:"","gpt-5.4"===m?"gpt-5.5":m,rl?"competitive":"trend_topic",ei,b.map(e=>e.handle).join(","),v.map(e=>e.handle).join(",")].join("|");if(!t&&rt.current&&(rr.current===r||rr.current===tH)){rd(e,rt.current,!0),ty(!1);return}try{var a;(t||!ra.current||rs.current!==r)&&(rs.current=r,ra.current=e_({agentId:eY,aiId:"gpt-5.4"===m?"gpt-5.5":m,analysisType:rl?"competitive":"trend_topic",ownAccounts:b.length?b.map(e=>e.handle):[""],rivalAccounts:v.length?v.map(e=>e.handle):[""],language:ei},o.token).finally(()=>{rs.current===r&&(ra.current=null)}));let s=await ra.current,l=null!==(a=null==s?void 0:s.goalResponse)&&void 0!==a?a:s;if(!l){c(n("toast.goalFailed"),"error"),ty(!1);return}rt.current=l,rr.current=r,re(l),rd(e,l,!1),ty(!1)}catch(e){console.error("Goal execution failed:",e),ru(e,"toast.goalFailed"),ty(!1)}}let rx=(0,s.useCallback)(async()=>{if(tt.length){th(!0),tu(null),tp(null);try{var e,t,r,a,s,l,n,i,d,c,x;let u={objective:null!==(l=null==tb?void 0:null===(e=tb.objective)||void 0===e?void 0:e.value)&&void 0!==l?l:"",audience:null!==(n=null==tb?void 0:null===(t=tb.audience)||void 0===t?void 0:t.value)&&void 0!==n?n:"",platform:null!==(i=null==tb?void 0:null===(r=tb.platform)||void 0===r?void 0:r.value)&&void 0!==i?i:"",tone:null!==(d=null==tb?void 0:null===(a=tb.tone)||void 0===a?void 0:a.value)&&void 0!==d?d:"",keyMessage:null!==(c=null==tb?void 0:null===(s=tb.keyMessage)||void 0===s?void 0:s.value)&&void 0!==c?c:""},h={agentId:eY,selectedGoal:null!=tI?tI:"",contentType:e9,brief:u,brandSpecs:{brandVoice:t_.brandVoice,mandatory:t_.mandatory,negativeRules:t_.negativeRules,regulatory:t_.regulatory},aiId:"gpt-5.4"===m?"gpt-5.5":m,language:ei},g=await eD(h,null==o?void 0:o.token),p=(null!==(x=g.channels)&&void 0!==x?x:[]).filter(e=>tt.some(t=>{var r,a;return(null===(r=e.channel)||void 0===r?void 0:r.toLowerCase().includes(t.toLowerCase()))||t.toLowerCase().includes(null===(a=e.channel)||void 0===a?void 0:a.toLowerCase())}));tu(p)}catch(e){console.error("generateCopy error:",e),ru(e,"toast.contentFailed")}finally{th(!1)}}},[tt,e9,tb,t_,eY,m,tI,ei,null==o?void 0:o.token]);function ru(e,t){let r=tP(e);return r?(B(r),I(!0),!0):(c(tF(e,n,t),"error"),!1)}async function rm(){if(r&&(null==o?void 0:o.token)&&!t2){t5(!0),c(n("toast.chatCreating"),"loading");try{let e=ed.length>100?ed.slice(0,100)+"...":ed,t=await eO(r,{name:"X Analysis â ".concat(rl?"Competitive":"Trend"," â ").concat(crypto.randomUUID()),description:e,tags:[],categories:[],aiTag:m,documentIds:[]},null==o?void 0:o.token);(null==t?void 0:t.id)?(eK(r),e$(r),c(n("toast.chatReady"),"success")):c(n("toast.chatCreateFailed"),"error")}catch(e){console.error("RAG retry failed:",e),ru(e,"toast.chatCreateFailed")}finally{t5(!1)}}}async function rh(e,t,r){if(!e)return;let a=tR.Uf;_(null),eL([]);let s=await e.arrayBuffer(),l=tM.LF(s,{type:"array"}),i=l.Sheets[l.SheetNames[0]],o=tM.Wp.sheet_to_json(i,{header:1}),d=o.findIndex(e=>(e||[]).some(e=>String(null!=e?e:"").trim())),c=[],x=0,u=0;o.forEach((e,t)=>{(e||[]).forEach(e=>{let r=String(null!=e?e:"").trim();if(r&&!(t===d&&tV(r))){if(tW(r)){x++;return}if(tU.test(r)){u++;return}c.push(r)}})});let m=[];x>0&&m.push(n("toast.uploadAtIgnored",{count:x})),u>0&&m.push(n("toast.uploadInvalid",{count:u})),t(e=>{let t=[...e],s=(r||[]).filter(t=>t!==e).reduce((e,t)=>e+t.length,0),l=0;return c.forEach(e=>{!t.find(t=>t.handle===e)&&t.length+s<a?t.push({handle:e}):!t.find(t=>t.handle===e)&&l++}),l>0&&m.push(n("toast.uploadLimit",{count:l,limit:a})),m.length>0&&setTimeout(()=>_(m.join(" ")),0),t})}async function rg(){let e=tR.Qg[F]||500,t=tR.n1[F]||1e3,r=rl?b.length+v.length:j.length,a=et.includes("Incoming replies");eL([]),eA({accCount:r,hasReplies:a,totalPosts:0,totalIncomingTweets:0,estimatedCost:-1,users:[],rivalUsers:[],invalidAccounts:[]}),X(!0);try{var s;let l=await eI({users:rl?b.map(e=>e.handle):j.map(e=>e.handle),rivalUsers:rl?v.map(e=>e.handle):[],timeRange:rp(),tweetsMaxResults:e,languages:Q,includes:{tweets:et.includes("Tweets"),retweets:et.includes("Retweets"),outgoingReplies:et.includes("Outgoing replies")},incomingTweets:{maxResults:t,likeCount:et.includes("Incoming replies")?el:0},threadMode:"merged"===ea?"merged":"individual",sortOrder:"recency"},null==o?void 0:o.token),n=null!==(s=l.invalidUsernames)&&void 0!==s?s:[];eL(n),eA({accCount:r,hasReplies:a,totalPosts:l.totalPosts,totalIncomingTweets:l.totalIncomingTweets,estimatedCost:l.estimatedCost,users:l.userIds,rivalUsers:l.rivalUserIds,invalidAccounts:n})}catch(e){eA(null),ru(e,"toast.costFailed")}finally{X(!1)}}function rp(){if("custom"===F)return{startDate:"".concat(U,"T").concat(q,":00"),endDate:"".concat(W,"T").concat(K,":59")};let e=new Date,t=e.toISOString().slice(0,19);return{startDate:new Date(e.getTime()-(tR.rf[F]||tR.rf["7d"])).toISOString().slice(0,19),endDate:t}}async function rb(){var e;
1ej({date:new Date().toLocaleString(i.language,{day:"2-digit",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"}),type:rl?"Competitive":"Trend & Topic",model:m,timeRange:"custom"===F?"".concat(U," ").concat(q," â ").concat(W," ").concat(K):F,fetchMode:"Auto pagination with soft cap",tweetLang:6===Q.length?"All languages":Q.map(e=>e.toUpperCase()).join(", "),contentTypes:et.join(", ")||"None",threadMode:"merged"===ea?"Merge threads":"Individual tweets",outputLang:ei,minEngagement:et.includes("Incoming replies")?el+"+ likes+RT":"N/A",ownAccounts:rl?b.map(e=>e.handle).join(", "):null,rivalAccounts:rl?v.map(e=>e.handle).join(", "):null,trendAccounts:rl?null:j.map(e=>e.handle).join(", "),promptLabel:Object.keys(rn).find(e=>rn[e]===ed)||"Custom"}),ep("running"),ew([]),eS(0),ey(null),e4(!1),[900,1800,2800].forEach((e,t)=>setTimeout(()=>{eS(t+1),ew(e=>[...e,t])},e));let t={userPostsRequest:{users:(null==eT?void 0:eT.users)||[],...rl&&(null==eT?void 0:null===(e=eT.rivalUsers)||void 0===e?void 0:e.length)&&{rivalUsers:eT.rivalUsers},timeRange:rp(),tweetsMaxResults:tR.Qg[F],languages:Q,includes:{tweets:et.includes("Tweets"),retweets:et.includes("Retweets"),outgoingReplies:et.includes("Outgoing replies")},incomingTweets:{maxResults:tR.n1[F],likeCount:et.includes("Incoming replies")?el:0},threadMode:"merged"===ea?"merged":"individual",sortOrder:"recency"},prompt:ed,analysisType:rl?"competitive":"trend_topic",outputLanguage:ei,aiId:m};try{await ez(t,null==o?void 0:o.token),ep("queued"),c(n("toast.queued"),"success"),N.emit()}catch(e){console.error("X agent run failed:",e),ey(ru(e,"toast.analysisFailed")?n("errors.usageLimit"):tF(e,n,"toast.analysisFailed")),ep("idle")}}function rf(e){ty(!0),tj(!1),tf(null),tu(null),tp(null)}async function rv(e){let t=null!=e?e:tI;t&&(ry(),rf(t),await rc(t,!0))}function ry(){rt.current=null,rr.current=null,ra.current=null,rs.current=null,re(null)}async function rk(){if(r&&(null==o?void 0:o.token)){eW(!0);try{var e,t,a;let s=await (0,tL.HR)(r,o.token);if(!(null==s?void 0:null===(e=s.records)||void 0===e?void 0:e.length)){eW(!1);return}let l=[],n=new Set(s.records.map(e=>e.id)),i=s.records.find(e=>!n.has(e.parentId));for(i||(i=[...s.records].sort((e,t)=>new Date(e.requestTime).getTime()-new Date(t.requestTime).getTime())[0]);i;)l.push({role:"user",content:i.requestObject.message}),l.push({role:"assistant",content:null!==(a=null===(t=i.responseObject)||void 0===t?void 0:t.message)&&void 0!==a?a:""}),i=s.records.find(e=>e.parentId===i.id);eH(l);let d=[...s.records].sort((e,t)=>new Date(t.requestTime).getTime()-new Date(e.requestTime).getTime())[0];(null==d?void 0:d.id)&&e0(d.id),(null==d?void 0:d.sessionId)&&eZ(d.sessionId),(null==d?void 0:d.remainedUsage)&&e7(100-d.remainedUsage),e4(!0)}catch(e){console.error("Chat history load error:",e),ru(e,"toast.chatHistoryFailed")}finally{eW(!1)}}}let rj=(0,s.useRef)("");async function rN(){let e=eG.trim();if(!e||eV||!eJ)return;let t={role:"user",content:e};eH(e=>[...e,t]),eq("");let r=e3.length>0?e3:null;e6([]),eW(!0),e2(!0),eH(e=>[...e,{role:"assistant",content:""}]),rj.current="";let a=e=>{console.error("Chat streaming error:",e),eW(!1),e2(!1),eH(e=>e.length>0&&"assistant"===e[e.length-1].role&&!e[e.length-1].content?e.slice(0,-1):e),ru(e,"toast.chatRequestFailed")};try{await (0,tL.Eb)(e,null==o?void 0:o.token,e=>{if(e.content){rj.current+=e.content;let t=rj.current;eH(e=>{let r=[...e],a=r[r.length-1];return(null==a?void 0:a.role)==="assistant"&&(r[r.length-1]={...a,content:t}),r})}},a,e=>{eW(!1),e2(!1),(null==e?void 0:e.sessionId)&&!eX&&eZ(e.sessionId),(null==e?void 0:e.id)&&e0(e.id),(null==e?void 0:e.remainedUsage)!==void 0&&e7(100-e.remainedUsage);let t=(null==e?void 0:e.responseContent)||rj.current;eH(e=>{let r=[...e],a=r[r.length-1];return(null==a?void 0:a.role)==="assistant"&&(r[r.length-1]={...a,content:t}),r}),rj.current="",setTimeout(()=>{var e;return null===(e=t4.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth"})},50)},!1,eX,eQ,eJ,r,eY)}catch(e){a(e)}}return{user:o,toast:d,showToast:c,isEditor:l,analysisType:x,setAnalysisType:u,model:m,setModel:h,agenticModels:g,isCompetitive:rl,PROMPTS:rn,ownAccounts:b,setOwnAccounts:f,rivalAccounts:v,setRivalAccounts:k,trendAccounts:j,setTrendAccounts:w,newOwn:C,setNewOwn:S,newRival:T,setNewRival:A,newTrend:E,setNewTrend:L,showModal:M,setShowModal:R,uploadWarning:z,setUploadWarning:_,showUsageLimitModal:O,setShowUsageLimitModal:I,usageLimitType:D,handleAgentError:ru,timeSel:F,setTimeSel:H,customFrom:U,setCustomFrom:G,customFromTime:q,setCustomFromTime:V,customTo:W,setCustomTo:J,customToTime:K,setCustomToTime:Y,customRangeDays:Z,customRangeExceeded:Z>90,tweetLang:Q,setTweetLang:ee,contentFilters:et,setContentFilters:er,threadMode:ea,setThreadMode:es,minEngagement:el,setMinEngagement:en,outputLang:ei,setOutputLang:eo,prompt:ed,setPrompt:ec,isTemplatePrompt:ex,setIsTemplatePrompt:eu,promptFocused:em,setPromptFocused:eh,phase:eg,setPhase:ep,apiResult:eb,setApiResult:ef,apiError:ev,setApiError:ey,reportMeta:ek,setReportMeta:ej,stepDone:eN,setStepDone:ew,activeStep:eC,setA
1ctiveStep:eS,costModal:eT,setCostModal:eA,costLoading:$,invalidAccounts:eE,setInvalidAccounts:eL,tab:eM,setTab:ri,chatMessages:eF,setChatMessages:eH,chatInput:eG,setChatInput:eq,chatLoading:eV,setChatLoading:eW,ragAiId:eJ,agentId:eY,chatSessionId:eX,setChatSessionId:eZ,chatParentId:eQ,setChatParentId:e0,chatStreaming:e1,setChatStreaming:e2,ragCreating:t2,chatFiles:e3,setChatFiles:e6,chatHistoryLoaded:e5,setChatHistoryLoaded:e4,chatLengthPercentage:e8,contentType:e9,setContentType:te,contentChannel:tt,setContentChannel:tr,lastCopyType:ti,setLastCopyType:to,contentTonee:td,setContentTonee:tc,contentOutput:tx,setContentOutput:tu,contentLoading:tm,setContentLoading:th,imagePromptOutput:tg,setImagePromptOutput:tp,brief:tb,setBrief:tf,briefLoading:tv,setBriefLoading:ty,briefConfirmed:tk,setBriefConfirmed:tj,editingBriefKey:tN,setEditingBriefKey:tw,brandSpecsOpen:tC,setBrandSpecsOpen:tS,brandLogo:tT,setBrandLogo:tA,expandedSpec:tE,setExpandedSpec:tz,brandSpecs:t_,setBrandSpecs:tO,selectedGoal:tI,setSelectedGoal:tD,aiGoalLoading:tB,setAiGoalLoading:tG,aiGoalSuggestion:tq,setAiGoalSuggestion:tJ,studioLoading:tK,setStudioLoading:tY,studioResult:t$,setStudioResult:tX,showRegenerateConfirm:tZ,setShowRegenerateConfirm:tQ,goalExecutionCache:t9,setGoalExecutionCache:re,exportOpen:t0,setExportOpen:t1,chatEndRef:t4,ownRef:t3,rivalRef:t6,trendRef:t8,exportMenuRef:t7,addAcc:function(e,t,r,a,s){let l=r.trim();if(l){if(e.find(e=>e.handle===l)){a("");return}s.reduce((e,t)=>e+t.length,0)>=tR.Uf||(t(e=>[...e,{handle:l}]),a(""),eL([]))}},removeAcc:function(e,t,r){t(e.filter((e,t)=>t!==r)),eL([])},handleFileUpload:rh,toggleFilter:function(e,t,r){t(e=>e.includes(r)?e.filter(e=>e!==r):[...e,r])},calcCost:rg,getTimeRange:rp,startRun:rb,triggerBriefGeneration:rf,resetGoalState:function(){tD(null),tf(null),tj(!1),ty(!1),tu(null),tp(null),tJ(null),tG(!1)},clearGoalCache:ry,regenerateBrief:rv,sendChat:rN,triggerGoalExecution:rc,generateCopy:rx,generateStudioPrompt:ro,studioType:ta,setStudioType:ts,studioChannel:tl,setStudioChannel:tn}}(t,r,l,i,o),{t:x}=(0,P.Bd)("agent-x"),m=(0,y.d4)(e=>e.user),[h,g]=(0,s.useState)(!1),[p,b]=(0,s.useState)(!1),[f,v]=(0,s.useState)(!1),[k,j]=(0,s.useState)(""),[w,C]=(0,s.useState)(!1),S=c.agentId||l,T="done"===c.phase,A=async()=>{if(!f&&S){if(!(null==m?void 0:m.token)){c.toast.show&&console.error("Missing user token for publish");return}v(!0);try{let e;let t={itemId:S,publicShareType:"PROMPT_REPORT"};e=(await (0,rB.nC)(t,m.token)).data?(await (0,rB.x)(t,m.token)).data:(await (0,rB.JK)(t,m.token)).data;let r=window.location.origin;j("".concat(r,"/publish/agents/").concat(e)),b(!0)}catch(e){console.error("Error while creating public link:",e),c.handleAgentError(e,"toast.publishFailed")}finally{v(!1)}}},E=async()=>{if(k)try{await navigator.clipboard.writeText(k),C(!0),setTimeout(()=>C(!1),2e3)}catch(t){let e=document.createElement("textarea");e.value=k,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),C(!0),setTimeout(()=>C(!1),2e3)}},L=(null===(e=c.reportMeta)||void 0===e?void 0:e.type)?x("report.name",{type:tE(x,"type",c.reportMeta.type),date:c.reportMeta.date}):void 0;return(0,a.jsxs)("div",{className:"flex flex-col h-screen font-['DM_Sans','Segoe_UI',sans-serif] bg-[#f8f7f4] dark:bg-surface text-[#111] dark:text-ink-primary",children:[(0,a.jsx)(eF.A,{show:c.toast.show,message:c.toast.message,type:c.toast.type}),(0,a.jsxs)("div",{className:"flex items-center justify-between px-5 h-[50px] bg-white dark:bg-surface-elevated border-b-[0.5px] border-b-[#e5e7eb] dark:border-b-border shrink-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)("div",{className:"w-7 h-7 rounded-[6px] flex items-center justify-center",style:{background:tR.Hl},children:(0,a.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"white",children:(0,a.jsx)("path",{d:"M7.5 1L1 4.5v6L7.5 14l6.5-3.5v-6L7.5 1zm0 2L12 5.5 7.5 8 3 5.5 7.5 3zM2.5 7l4 2.2V13L2.5 10.8V7zm5 6V9.2l4-2.2v3.8L7.5 13z"})})}),(0,a.jsx)("span",{className:"text-[13px] font-medium dark:text-ink-primary",children:"X Intelligence Agent"})]}),T&&S&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(u.$n,{onClick:()=>g(!0),variant:"outline",size:"sm",className:"flex items-center",children:[(0,a.jsx)(ef.A,{className:"w-4 h-4 mr-2"}),x("navbar.shareWithTeam")]}),(0,a.jsxs)(u.$n,{onClick:A,variant:"outline",size:"sm",disabled:f,className:"flex items-center",children:[(0,a.jsx)(rR.A,{className:"w-4 h-4 mr-2"}),x(f?"navbar.publishing":"navbar.publish")]})]})]}),c.apiError&&(0,a.jsx)("div",{className:"py-2 px-3 bg-red-100 border-[0.5px] border-red-300 rounded-[7px] text-[11px] text-red-900 mb-2",children:c.apiError}),(0,a.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,a.jsxs)(eH.YZ,{direction:"horizontal",className:"h-full w-full",children:[(0,a.jsx)(eH.Zk,{defaultSize:25,minSize:20,children:(0,a.jsx)(rs,{hook:c})}),(0,a.jsx)(eH.TW,{className:"w-1 bg-gray-200 dark:bg-border hover:bg-gray-500 dark:hover:bg-claude cursor-col-resize transition-colors duration-200 relative group"}),(0,a.jsx)(eH.Zk,{defaultSize:75,minSize:30,children:(0,a.jsx)(rf,{hook:c,contentCreativeSlot:(0,a.jsx)(rL,{hook:c}),onOpenQueues:d})})]})}),(0,a.jsx)(rN,{costModal:c.costModal,setCostModal:c.setCostModal,timeSel:c.timeSel,startRun:c.startRun,costLoading:c.costLoading}),(0,a.jsx)(rj,{showModal:c.showModal,setShowModal:c.setShowModal,ownAccounts:c.ownAccounts,rivalAccounts:c.rivalAccounts,trendAccounts:c.trendAccounts,setOwnAccounts:c.setOwnAccounts,setRivalAccounts:c.setRivalAccounts,setTrendAccounts:c.setTrendAccounts,newOwn:c.newOwn,setNewOwn:c.setNewOwn,newRival:c.newRival,setNewRival:c.setNewRival,newTrend:c.newTrend,setNewTrend:c.setNewTrend,addAcc:c.addAcc,removeAcc:c.removeAcc,handleFileUpload:c.handleFileUpload,invalidAccounts:c.invalidAccounts,uploadWarning:c.uploadWarning}),(0,a.jsx)(rM,{hook:c}),h&&S&&(0,a.jsx)(es,{itemId:S,report:{type:"X_AGENT",name:L},onClose:()=>g(!1)}),c.showUsageLimitModal&&(0,a.jsx)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/50 p-4",onClick:()=>c.setShowUsageLimitModal(!1),children:(0,a.jsxs)("div",{className:"relative w-full max-w-3xl",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("button",{className:"absolute -top-2 -right-2 z-10 rounded-full bg-white dark:bg-surface-elevated p-2 shadow-lg text-gray-600 dark:text-ink-muted hover:text-gray-900 dark:hover:text-ink-primary transition-colors",onClick:()=>c.setShowUsageLimitModal(!1),"aria-label":x("errors.close"),children:(0,a.jsx)(n.A,{className:"h-5 w-5"})}),(0,a.jsx)(eG.A,{limitType:c.usageLimitType,onClose:()=>c.setShowUsageLimitModal(!1)})]})}),(0,a.jsx)(rP,{isOpen:p,onClose:()=>b(!1),shareUrl:k,reportName:L,onCopyLink:E,copied:w})]})},rH=e=>{let{reports:t,title:r,onClose:l,onSelect:i,getDisplayName:o}=e,{renameReport:d,toggleFavorite:c,deleteForEveryone:x,deleteForMe:u}
1=eu(),[m,h]=(0,s.useState)(t),[g,p]=(0,s.useState)(null),[b,f]=(0,s.useState)(null),[v,y]=(0,s.useState)(""),[k,j]=(0,s.useState)(!1),[N,w]=(0,s.useState)(null),[C,S]=(0,s.useState)(null);(0,s.useEffect)(()=>{h(t)},[t]),(0,s.useEffect)(()=>{let e=()=>p(null);return null!==g&&document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[g]);let T=(e,t)=>h(r=>r.map(r=>ee(r)===e?{...r,...t}:r)),A=e=>h(t=>t.filter(t=>ee(t)!==e)),E=(e,t)=>{e.stopPropagation(),p(e=>e===t?null:t)},L=(e,t)=>{e.stopPropagation(),t.isEditor&&(f(ee(t)),y(o(t)),p(null))},M=async(e,t)=>{if(e.stopPropagation(),!v.trim()||k)return;let r=ee(t);j(!0);try{await d(r,v.trim()),T(r,{name:v.trim()})}catch(e){console.error("Failed to rename:",e)}finally{j(!1),f(null)}},R=e=>{e.stopPropagation(),f(null)},z=async(e,t)=>{e.stopPropagation(),p(null);try{await c(t),T(ee(t),{favorite:!t.favorite})}catch(e){console.error("Failed to update favorite:",e)}},_=(e,t)=>{e.stopPropagation(),p(null),S(ee(t))},O=async(e,t)=>{if(e.stopPropagation(),p(null),t.isEditor){w(ee(t));return}let r=ee(t);try{await u(r),A(r)}catch(e){console.error("Failed to delete:",e)}};return(0,a.jsxs)("div",{className:"flex flex-col border-r border-l border-gray-200 dark:border-border transition-all duration-300 bg-[#faf9f6] dark:bg-surface",style:{width:"280px",minWidth:"280px",maxWidth:"280px",height:"100%",flexShrink:0},children:[(0,a.jsx)("div",{className:"p-5 border-b border-gray-200 dark:border-border bg-[#faf9f6] dark:bg-surface",children:(0,a.jsxs)("div",{className:"flex justify-between items-center gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-gray-400 dark:text-ink-muted whitespace-nowrap",children:r}),(0,a.jsx)("div",{className:"flex-1 h-px bg-gray-200 dark:bg-border"}),(0,a.jsxs)("span",{className:"text-[10px] text-gray-400 dark:text-ink-muted whitespace-nowrap",children:["(",m.length,")"]})]}),(0,a.jsx)("button",{onClick:l,className:"p-1 rounded-md text-gray-400 dark:text-ink-muted hover:text-gray-700 dark:hover:text-ink-primary hover:bg-gray-100 dark:hover:bg-surface-active transition-colors flex-shrink-0",children:(0,a.jsx)(n.A,{className:"w-4 h-4"})})]})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-3 bg-[#faf9f6] dark:bg-surface",children:(0,a.jsx)("div",{className:"space-y-0.5",children:m.map(e=>{let t=ee(e);return(0,a.jsx)(eo,{report:e,displayName:o(e),showFavoriteStar:!0,isEditing:b===t,editTitle:v,isSubmitting:k,menuOpen:g===t,onSelect:i,onToggleMenu:E,onStartRename:L,onEditTitleChange:y,onSubmitRename:M,onCancelRename:R,onToggleFavorite:z,onShare:_,onDelete:O},t)})})}),N&&(()=>{let e=m.find(e=>ee(e)===N);if(!e)return null;let t=ee(e);return(0,a.jsx)(B,{report:e,onDeleteForEveryone:async()=>{w(null);try{await x(t),A(t)}catch(e){console.error("Failed to delete:",e)}},onDeleteForMe:async()=>{w(null);try{await u(t),A(t)}catch(e){console.error("Failed to delete for me:",e)}},onCancel:()=>w(null)})})(),C&&(()=>{let e=m.find(e=>ee(e)===C);return e?(0,a.jsx)(es,{itemId:C,report:e,onClose:()=>S(null)}):null})()]})};var rU=r(37085),rG=r.n(rU),rq=r(63876),rV=r(15066),rW=r(72020);let rJ=e=>{let{data:t,previewRowCount:r=5}=e,{t:s}=(0,P.Bd)("agent-category-finder"),{headers:l,rows:n}=t,i=n.slice(0,r),o=Math.max(0,n.length-i.length);return(0,a.jsxs)("div",{className:"rounded-lg border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated",style:{maxWidth:"100%"},children:[(0,a.jsx)("div",{className:"overflow-auto",style:{maxWidth:"100%"},children:(0,a.jsxs)("table",{className:"text-sm border-collapse w-max",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"bg-gray-50 dark:bg-surface-active",children:[(0,a.jsx)("th",{className:"sticky top-0 left-0 z-20 bg-gray-50 dark:bg-surface-active border-b border-r border-gray-200 dark:border-border px-4 py-3 text-left text-xs font-semibold text-gray-500 dark:text-ink-muted w-14",scope:"col",children:"#"}),l.map((e,t)=>(0,a.jsx)("th",{scope:"col",className:"sticky top-0 z-10 bg-gray-50 dark:bg-surface-active border-b border-gray-200 dark:border-border px-4 py-3 text-left text-xs font-semibold text-gray-600 dark:text-ink-secondary whitespace-nowrap",title:e,children:e},t))]})}),(0,a.jsx)("tbody",{children:i.map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-gray-100 dark:border-border hover:bg-blue-50/40 dark:hover:bg-surface-active transition-colors",children:[(0,a.jsx)("td",{className:"sticky left-0 z-10 bg-white dark:bg-surface-elevated border-r border-gray-100 dark:border-border px-4 py-2.5 text-xs text-gray-400 dark:text-ink-muted tabular-nums",children:t}),e.map((e,t)=>(0,a.jsx)("td",{className:"px-4 py-2.5 text-gray-800 dark:text-ink-primary whitespace-nowrap max-w-[420px]",title:e,children:(0,a.jsx)("div",{className:"truncate",children:e})},t))]},t))})]})}),o>0&&(0,a.jsx)("div",{className:"border-t border-gray-100 dark:border-border bg-gray-50/60 dark:bg-surface-active px-4 py-2 text-xs text-gray-500 dark:text-ink-muted",children:s("preview.showingFirst",{shown:i.length,total:n.length.toLocaleStr
1ing()})})]})};var rK=r(97986),rY=r(6776),r$=r(14920),rX=r(43168),rZ=r(95313);let rQ=e=>{let{value:t,onChange:r,options:l,placeholder:d="Select...",searchThreshold:c=8,className:x=""}=e,[u,m]=(0,s.useState)(!1),[h,g]=(0,s.useState)(""),p=(0,s.useRef)(null),b=(0,s.useRef)(null),f=l.find(e=>e.value===t&&!e.disabled),v=l.filter(e=>!e.disabled).length>=c,y=(0,s.useMemo)(()=>{if(!h.trim())return l;let e=h.trim().toLowerCase(),t=[],r=null;for(let a of l){if(a.disabled){r=a;continue}a.label.toLowerCase().includes(e)&&(r&&(t.push(r),r=null),t.push(a))}return t},[l,h]);return(0,s.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&(m(!1),g(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,s.useEffect)(()=>{if(u&&v){let e=setTimeout(()=>{var e;return null===(e=b.current)||void 0===e?void 0:e.focus()},0);return()=>clearTimeout(e)}},[u,v]),(0,a.jsxs)("div",{ref:p,className:"relative ".concat(x),children:[(0,a.jsxs)("button",{type:"button",onClick:()=>m(e=>!e),className:"w-full py-2 px-3 border border-gray-300 dark:border-border rounded-lg bg-white dark:bg-surface text-left text-sm flex items-center justify-between focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-claude focus:border-blue-500 dark:focus:border-claude",children:[(0,a.jsx)("span",{className:"truncate ".concat(f?"text-gray-900 dark:text-ink-primary":"text-gray-400 dark:text-ink-muted"),children:f?f.label:d}),(0,a.jsx)(o.A,{className:"w-4 h-4 text-gray-500 dark:text-ink-muted transition-transform duration-200 flex-shrink-0 ml-2 ".concat(u?"rotate-180":"")})]}),u&&(0,a.jsxs)("div",{className:"absolute z-50 mt-1 w-full bg-white dark:bg-surface-elevated border border-gray-200 dark:border-border rounded-xl shadow-lg dark:shadow-black/40 overflow-hidden",children:[v&&(0,a.jsx)("div",{className:"p-2 border-b border-gray-100 dark:border-border bg-gray-50/60 dark:bg-surface",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(i.A,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400 dark:text-ink-muted pointer-events-none"}),(0,a.jsx)("input",{ref:b,type:"text",value:h,onChange:e=>g(e.target.value),placeholder:"Searchâ¦",className:"w-full py-1.5 pl-8 pr-7 text-sm bg-white dark:bg-surface-active border border-gray-200 dark:border-border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500/30 dark:focus:ring-claude/30 focus:border-blue-500 dark:focus:border-claude text-gray-800 dark:text-ink-primary placeholder:text-gray-400 dark:placeholder:text-ink-muted",onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),g(""),m(!1))}}),h&&(0,a.jsx)("button",{type:"button",onClick:()=>g(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-gray-400 dark:text-ink-muted hover:text-gray-600 dark:hover:text-ink-primary p-0.5 rounded","aria-label":"Clear search",children:(0,a.jsx)(n.A,{className:"w-3.5 h-3.5"})})]})}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto",children:0===y.length?(0,a.jsxs)("div",{className:"px-4 py-6 text-center text-sm text-gray-400 dark:text-ink-muted",children:["No matches for â",h,"â"]}):y.map((e,s)=>e.disabled?(0,a.jsx)("div",{className:"px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-400 dark:text-ink-muted bg-gray-50 dark:bg-surface border-b border-gray-100 dark:border-border select-none",children:e.label},"".concat(e.value,"-").concat(s)):(0,a.jsx)("button",{type:"button",onClick:()=>{r(e.value),m(!1),g("")},className:"w-full text-left px-4 py-2.5 text-sm transition-colors hover:bg-blue-50 hover:text-blue-700 dark:hover:bg-claude/10 dark:hover:text-claude ".concat(e.value===t?"bg-blue-600 dark:bg-claude text-white hover:bg-blue-600 dark:hover:bg-claude hover:text-white dark:hover:text-white":"text-gray-700 dark:text-ink-secondary"),children:e.label},"".concat(e.value,"-").concat(s)))})]})]})},r0={productNameColumn:"",breadCrumbColumn:"auto",stockColumn:"auto",breadCrumbFilter:[],sampleSize:100,excludeOutStock:!0,currentCategories:[],outStockText:"",minimumRepeat:3,volume:1e3,languageCode:"tr",location:"Turkiye",aiTag:"gpt-5.4",volumeFilter:!0},r1="w-full py-2 px-3 border border-gray-300 dark:border-border rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500/30 dark:focus:ring-claude/30 focus:border-blue-500 dark:focus:border-claude transition-colors bg-white dark:bg-surface dark:text-ink-primary dark:[color-scheme:dark]",r2=e=>{let{label:t,value:r,onChange:s,headers:l,specialOptions:n=[],placeholder:i,required:o=!1}=e,{t:d}=(0,P.Bd)("agent-category-finder"),c=[];return n.length>0&&(c.push({value:"__group_default__",label:d("settings.groupDefault"),disabled:!0}),c.push(...n)),l.length>0&&(c.push({value:"__group_columns__",label:d("settings.groupColumns"),disabled:!0}),c.push(...l.map(e=>({value:e,label:e})))),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsxs)("label",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:[t,o&&(0,a.jsx)("span",{className:"text-red-500 ml-0.5",children:"*"})]}),(0,a.jsx)(rQ,{value:r,onChange:s,options:c,placeholder:null!=i?i:d("settings.selectColumn")})]})},r5=e=>{let{icon:t,title:r}=e;return(0,a.jsxs)("header",{className:"flex items-center gap-2 px-4 py-3 border-b border-gray-100 dark:border-border",children:[t,(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-800 dark:text-ink-primary",children:r})]})},r4=e=>{let{headers:t,value:r,onChange:s,onStartAnalysis:l,isRunning:i=!1,aiModels:o=[]}=e,{t:d}=(0,P.Bd)("agent-category-finder"),c=(e,t)=>s({...r,[e]:t}),x=r.productNameColumn.trim().length>0,u=o.map(e=>({value:e.tag,label:e.name}));return(0,a.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,a.jsxs)("section",{className:"rounded-xl border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated",children:[(0,a.jsx)(r5,{icon:(0,a.jsx)(rK.A,{className:"w-4 h-4 text-gray-500 dark:text-ink-muted"}),title:d("settings.aiSelection")}),(0,a.jsx)("div",{className:"px-4 py-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:d("settings.model")}),(0,a.jsx)(e$.A,{value:r.aiTag,onChange:e=>c("aiTag",e),options:u,placeholder:d("settings.selectModel")})]})})]}),(0,a.jsxs)("section",{className:"rounded-xl border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated",children:[(0,a.jsx)(r5,{icon:(0,a.jsx)(rY.A,{className:"w-4 h-4 text-gray-500 dark:text-ink-muted"}),title:d("settings.columnSelection")}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 px-4 py-4",children:[(0,a.jsx)(r2,{label:d("settings.productNameColumn"),value:r.productNameColumn,onChange:e=>c("productNameColumn",e),headers:t,required:!0}),(0,a.jsx)(r2,{label:d("settings.breadcrumbColumn"),value:r.breadCrumbColumn,onChange:e=>c("breadCrumbColumn",e),headers:t,specialOptions:[{value:"auto",label:d("settings.auto")},{value:"none",label:d("settings.none")}]})]}),(0,a.jsxs)("label",{className:"flex items-start cursor-pointer mb-2 ml-5",children:[(0,a.jsx)("input",{type:"checkbox",checked:r.excludeOutStock,onChange:e=>{e.target.checked?s({...r,excludeOutStock:!0}):s({...r,excludeOutStock:!1,stockColumn:"auto",outStockText:""})},className:"w-4 h-4 rounded border-gray-300 dark:border-border text-blue-600 dar
1k:text-claude focus:ring-2 focus:ring-blue-500/30 cursor-pointer"}),(0,a.jsx)("span",{className:"ml-2 text-sm text-gray-700 dark:text-ink-primary select-none",children:d("settings.excludeOutOfStock")})]}),r.excludeOutStock&&(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 px-4 py-4",children:[(0,a.jsx)(r2,{label:d("settings.stockColumn"),value:r.stockColumn,onChange:e=>c("stockColumn",e),headers:t,specialOptions:[{value:"auto",label:d("settings.auto")}]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:d("settings.outOfStockText")}),(0,a.jsx)("input",{type:"text",value:r.outStockText,onChange:e=>c("outStockText",e.target.value),className:r1})]})]})]}),(0,a.jsxs)("section",{className:"rounded-xl border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated",children:[(0,a.jsx)(r5,{icon:(0,a.jsx)(r$.A,{className:"w-4 h-4 text-gray-500 dark:text-ink-muted"}),title:d("settings.filterSettings")}),(0,a.jsxs)("div",{className:"px-4 py-4",children:[(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-2",children:(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsxs)("label",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:[d("settings.sampleSize")," ",(0,a.jsx)("span",{className:"text-gray-400 dark:text-ink-muted font-normal ml-1",children:d("settings.sampleSizeHint")})]}),(0,a.jsx)("input",{type:"number",min:0,value:r.sampleSize,onChange:e=>{let t=parseInt(e.target.value,10);c("sampleSize",Number.isFinite(t)&&t>=0?t:0)},className:r1})]})}),(0,a.jsx)("label",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:d("settings.breadcrumbFilter")}),(0,a.jsx)("input",{type:"text",placeholder:d("settings.breadcrumbFilterPlaceholder"),className:"".concat(r1," mt-1"),onKeyDown:e=>{if("Enter"===e.key&&e.currentTarget.value.trim()){e.preventDefault();let t=e.currentTarget.value.trim();r.breadCrumbFilter.includes(t)||c("breadCrumbFilter",[...r.breadCrumbFilter,t]),e.currentTarget.value=""}},onBlur:e=>{let t=e.currentTarget.value.trim();t&&!r.breadCrumbFilter.includes(t)&&(c("breadCrumbFilter",[...r.breadCrumbFilter,t]),e.currentTarget.value="")}}),(0,a.jsx)("div",{className:"mt-2 border border-gray-200 dark:border-border rounded-lg p-3 bg-gray-50 dark:bg-surface min-h-[64px]",children:r.breadCrumbFilter.length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:r.breadCrumbFilter.map((e,t)=>(0,a.jsxs)("div",{className:"group flex items-center gap-2 bg-blue-50 dark:bg-orange-900/20 border border-blue-200 dark:border-orange-500/30 rounded-lg px-3 py-1.5 shadow-sm",children:[(0,a.jsx)("span",{className:"text-sm text-gray-700 dark:text-ink-primary max-w-[280px] truncate",children:e}),(0,a.jsx)("button",{type:"button",onClick:()=>c("breadCrumbFilter",r.breadCrumbFilter.filter((e,r)=>r!==t)),className:"flex-shrink-0 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-full p-0.5 transition-colors",children:(0,a.jsx)(n.A,{className:"w-3.5 h-3.5"})})]},"".concat(e,"-").concat(t)))}):(0,a.jsx)("div",{className:"text-sm text-gray-400 dark:text-ink-muted text-center py-3",children:d("settings.noFilterTerms")})}),r.breadCrumbFilter.length>0&&(0,a.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-gray-500 dark:text-ink-muted",children:d("settings.termsAdded",{count:r.breadCrumbFilter.length})}),(0,a.jsx)("button",{type:"button",onClick:()=>c("breadCrumbFilter",[]),className:"text-xs text-gray-500 dark:text-ink-muted hover:text-red-500 transition-colors",children:d("settings.clearAll")})]})]}),(0,a.jsxs)("div",{className:"px-4 py-4",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:d("settings.existingCategories")}),(0,a.jsx)("input",{type:"text",placeholder:d("settings.existingCategoriesPlaceholder"),className:"".concat(r1," mt-1"),onKeyDown:e=>{if("Enter"===e.key&&e.currentTarget.value.trim()){e.preventDefault();let t=e.currentTarget.value.trim();r.currentCategories.includes(t)||c("currentCategories",[...r.currentCategories,t]),e.currentTarget.value=""}},onBlur:e=>{let t=e.currentTarget.value.trim();t&&!r.currentCategories.includes(t)&&(c("currentCategories",[...r.currentCategories,t]),e.currentTarget.value="")}}),(0,a.jsx)("div",{className:"mt-2 border border-gray-200 dark:border-border rounded-lg p-3 bg-gray-50 dark:bg-surface min-h-[64px]",children:r.currentCategories.length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:r.currentCategories.map((e,t)=>(0,a.jsxs)("div",{className:"group flex items-center gap-2 bg-blue-50 dark:bg-orange-900/20 border border-blue-200 dark:border-orange-500/30 rounded-lg px-3 py-1.5 shadow-sm",children:[(0,a.jsx)("span",{className:"text-sm text-gray-700 dark:text-ink-primary max-w-[280px] truncate",children:e}),(0,a.jsx)("button",{type:"button",onClick:()=>c("currentCategories",r.currentCategories.filter((e,r)=>r!==t)),className:"flex-shrink-0 text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-full p-0.5 transition-colors",children:(0,a.jsx)(n.A,{className:"w-3.5 h-3.5"})})]},"".concat(e,"-").concat(t)))}):(0,a.jsx)("div",{className:"text-sm text-gray-400 dark:text-ink-muted text-center py-3",children:d("settings.noCategories")})}),r.currentCategories.length>0&&(0,a.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-xs text-gray-500 dark:text-ink-muted",children:d("settings.categoriesAdded",{count:r.currentCategories.length})}),(0,a.jsx)("button",{type:"button",onClick:()=>c("currentCategories",[]),className:"text-xs text-gray-500 dark:text-ink-muted hover:text-red-500 transition-colors",children:d("settings.clearAll")})]})]})]}),(0,a.jsxs)("section",{className:"rounded-xl border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated",children:[(0,a.jsx)(r5,{icon:(0,a.jsx)(rX.A,{className:"w-4 h-4 text-gray-500 dark:text-ink-muted"}),title:d("settings.analysisParameters")}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 px-4 py-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:d("settings.minimumRepeat")}),(0,a.jsx)("input",{type:"number",min:0,value:r.minimumRepeat,onChange:e=>{let t=e.target.value;if(""===t)return;let r=parseInt(t,10);Number.isFinite(r)&&r>=0&&c("minimumRepeat",r)},className:r1})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:d("settings.minimumVolume")}),(0,a.jsx)("input",{type:"number",min:0,value:r.volume,onChange:e=>{let t=parseInt(e.target.value,10);c("volume",Number.isFinite(t)&&t>=0?t:0)},className:r1})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:d("settings.language")}),(0,a.jsx)("input",{type:"text",value:r.languageCode,onChange:e=>c("languageCode",e.target.value),className:r1})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:d("settings.location")}),(0,a.jsx)("input",{type:"text",value:r.location,onChange:e=>c("location",e.target.value),className:r1})]})]}),(0,a.jsxs)("label",{className:"flex items-start cursor-pointer mb-2 ml-5",children:[(0,a.jsx)("input",{type:"checkbox",checked:r.volumeFilter,onChange:e=>c("volumeFilter",e.target.checked),className:"w-4 h-4 rounded border-gray-300 dark:border-border text-blue-600 focus:ring-2 focus:ring-blue-500/30 cursor-pointer"}),(0,a.jsx)("span",{className:"ml-2 text-sm text-gray-700 dark:text-ink-primary select-none",children:d("settings.volumeFilter")})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("button",{type:"button",onClick:l,disabled:!x||i,className:["relative w-full rounded-lg px-4 py-2.5 text-sm font-semibold transition-all overflow-hidden","flex items-center justify-center gap-2",i?"bg-blue-600 dar
1k:bg-claude text-white cursor-not-allowed":x?"bg-blue-600 dark:bg-claude text-white hover:bg-blue-700 dark:hover:bg-claude-hover active:bg-blue-800 shadow-sm hover:shadow":"bg-gray-100 dark:bg-surface-active text-gray-400 dark:text-ink-muted cursor-not-allowed"].join(" "),children:(0,a.jsx)("span",{className:"relative flex items-center gap-2",children:i?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(rZ.A,{className:"w-4 h-4 animate-spin"}),d("settings.analyzing")]}):d("settings.startAnalysis")})}),!x&&!i&&(0,a.jsx)("p",{className:"mt-1.5 text-xs text-gray-500 dark:text-ink-muted",children:d("settings.selectProductNameHint")})]})]})};var r3=r(60383),r6=r(9526);let r8=[{key:"PRODUCT_SEARCH",label:"Product Search",icon:i.A},{key:"CATEGORY_FILTER",label:"Category Filter",icon:r3.A},{key:"LLM_FILTER",label:"LLM Filter",icon:rK.A},{key:"VOLUME_FILTER",label:"Volume Filter",icon:r6.A},{key:"FINISHED",label:"Finished",icon:rW.A}],r7=e=>{if(!e)return 0;let t=parseFloat(e.replace("%",""));return Number.isFinite(t)?Math.max(0,Math.min(100,t)):0},r9=e=>{let{event:t,error:r,isRunning:s}=e,{t:l}=(0,P.Bd)("agent-category-finder"),n=null==t?void 0:t.status,i=r7(null==t?void 0:t.progress),o="FINISHED"===n,d=n?r8.findIndex(e=>e.key===n):-1;return(0,a.jsxs)("div",{className:"px-6 py-6 flex flex-col gap-5",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-gray-900 dark:text-ink-primary leading-tight",children:l("result.progressTitle")}),(0,a.jsx)("p",{className:"text-xs text-gray-500 dark:text-ink-muted mt-0.5",children:o?l("result.complete"):s?l("result.streaming"):l("result.waiting")})]}),r&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-red-200 dark:border-red-500/30 bg-red-50 dark:bg-red-900/20 px-3 py-2.5",children:[(0,a.jsx)(rV.A,{className:"w-4 h-4 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),(0,a.jsx)("div",{className:"text-sm text-red-700 dark:text-red-400",children:r})]}),(0,a.jsxs)("div",{className:"rounded-xl border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary",children:l("result.overallProgress")}),(0,a.jsxs)("span",{className:"text-xs font-semibold text-gray-900 dark:text-ink-primary tabular-nums",children:[i.toFixed(1),"%"]})]}),(0,a.jsx)("div",{className:"w-full h-2 bg-gray-100 dark:bg-surface-active rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full transition-all duration-300 ease-out ".concat(o?"bg-green-500":"bg-blue-500 dark:bg-claude"),style:{width:"".concat(i,"%")}})})]}),(0,a.jsxs)("div",{className:"rounded-xl border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated p-4",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-gray-600 dark:text-ink-secondary mb-3",children:l("result.stagesTitle")}),(0,a.jsx)("ol",{className:"flex flex-col gap-2",children:r8.map((e,r)=>{let s=r===d&&!o,n=o||d>-1&&r<d,i=s?rZ.A:e.icon;return(0,a.jsxs)("li",{className:"flex items-center gap-3 rounded-lg px-3 py-2 transition-colors ".concat(s?"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-500/30":n?"bg-green-50/50 dark:bg-green-900/10 border border-green-100 dark:border-green-500/20":"bg-gray-50/40 dark:bg-surface-active/30 border border-transparent"),children:[(0,a.jsx)(i,{className:"w-4 h-4 flex-shrink-0 ".concat(s?"text-blue-600 dark:text-blue-400 animate-spin":n?"text-green-600 dark:text-green-400":"text-gray-400 dark:text-ink-muted")}),(0,a.jsx)("span",{className:"text-sm ".concat(s?"font-medium text-blue-900 dark:text-blue-300":n?"text-green-800 dark:text-green-400":"text-gray-500 dark:text-ink-muted"),children:l("stages.".concat(e.key),{defaultValue:e.label})}),s&&(null==t?void 0:t.productName)&&(0,a.jsx)("span",{className:"ml-auto text-xs text-gray-500 dark:text-ink-muted truncate max-w-[55%]",title:t.productName,children:t.productName})]},e.key)})})]}),o&&t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"rounded-xl border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated overflow-hidden",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-border",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-800 dark:text-ink-primary",children:l("result.categories")}),(0,a.jsx)("span",{className:"text-xs text-gray-500 dark:text-ink-muted tabular-nums",children:t.categoryNames.length})]}),0===t.categoryNames.length?(0,a.jsx)("div",{className:"text-sm text-gray-400 dark:text-ink-muted text-center py-6",children:l("result.noCategoriesFound")}):(0,a.jsx)("div",{className:"overflow-auto max-h-[400px]",children:(0,a.jsxs)("table",{className:"text-sm border-collapse w-full",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"bg-gray-50 dark:bg-surface-active",children:[(0,a.jsx)("th",{className:"sticky top-0 z-10 bg-gray-50 dark:bg-surface-active border-b border-gray-200 dark:border-border px-4 py-2.5 text-left text-xs font-semibold text-gray-500 dark:text-ink-muted w-14",children:"#"}),(0,a.jsx)("th",{className:"sticky top-0 z-10 bg-gray-50 dark:bg-surface-active border-b border-gray-200 dark:border-border px-4 py-2.5 text-left text-xs font-semibold text-gray-600 dark:text-ink-secondary",children:l("result.categoryColumn")})]})}),(0,a.jsx)("tbody",{children:t.categoryNames.map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-gray-100 dark:border-border hover:bg-blue-50/40 dark:hover:bg-surface-active transition-colors",children:[(0,a.jsx)("td",{className:"px-4 py-2 text-xs text-gray-400 dark:text-ink-muted tabular-nums",children:t+1}),(0,a.jsx)("td",{className:"px-4 py-2 text-gray-800 dark:text-ink-primary",children:e})]},"cat-".concat(t)))})]})})]}),(0,a.jsxs)("div",{className:"rounded-xl border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated overflow-hidden",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-border",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-800 dark:text-ink-primary",children:l("result.grayAreaCategories")}),(0,a.jsx)("span",{className:"text-xs text-gray-500 dark:text-ink-muted tabular-nums",children:t.greyCategoryNames.length})]}),0===t.greyCategoryNames.length?(0,a.jsx)("div",{className:"text-sm text-gray-400 dark:text-ink-muted text-center py-6",children:l("result.noCategoriesFound")}):(0,a.jsx)("div",{className:"overflow-auto max-h-[400px]",children:(0,a.jsxs)("table",{className:"text-sm border-collapse w-full",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"bg-gray-50 dark:bg-surface-active",children:[(0,a.jsx)("th",{className:"sticky top-0 z-10 bg-gray-50 dark:bg-surface-active border-b border-gray-200 dark:border-border px-4 py-2.5 text-left text-xs font-semibold text-gray-500 dark:text-ink-muted w-14",children:"#"}),(0,a.jsx)("th",{className:"sticky top-0 z-10 bg-gray-50 dark:bg-surface-active border-b border-gray-200 dark:border-border px-4 py-2.5 text-left text-xs font-semibold text-gray-600 dark:text-ink-secondary",children:l("result.categoryColumn")})]})}),(0,a.jsx)("tbody",{children:t.greyCategoryNames.map((e,t)=>(0,a.jsxs)("tr",{className:"border-b border-gray-100 dark:border-border hover:bg-gray-50/60 dark:hover:bg-surface-active transition-colors",children:[(0,a.jsx)("td",{className:"px-4 py-2 text-xs text-gray-400 dark:text-ink-muted tabular-nums",children:t+1}),(0,a.jsx)("td",{className:"px-4 py-2 text-gray-500 dark:text-ink-secondary",children:e})]},"grey-".concat(t)))})]})})]})]})]})},ae=["text/csv","application/vnd.ms-excel"],at=e=>e<1024?"".concat(e," B"):e<1048576?"".concat((e/1024).toFixed(1)," KB"):"".concat((e/1048576).toFixed(2)," MB"),ar=e=>!!ae.includes(e.type)||/\.csv$/i.test(e.name),aa=()=>{let{t:e}=(0,P.Bd)("agent-category-finder"),t=(0,y.d4)(e=>
1e.user),[r,l]=(0,s.useState)(null),[i,d]=(0,s.useState)(null),[c,x]=(0,s.useState)(null),[u,m]=(0,s.useState)(!1),[h,g]=(0,s.useState)(!1),[p,b]=(0,s.useState)(r0),f=(0,s.useRef)(null),[v,k]=(0,s.useState)(!0),j=(0,s.useCallback)(()=>{l(null),d(null),x(null),g(!1),b(r0),w(null),S(null),A(!1),f.current&&(f.current.value="")},[]),[N,w]=(0,s.useState)(null),[C,S]=(0,s.useState)(null),[T,A]=(0,s.useState)(!1),[E,L]=(0,s.useState)([]);(0,s.useEffect)(()=>{(null==t?void 0:t.token)&&(0,eU.Hs)(t.token,{status:"ACTIVE",agentry:!0}).then(e=>{var t;L(null!==(t=e.agenticAIs)&&void 0!==t?t:[])}).catch(()=>{})},[null==t?void 0:t.token]);let M=(0,s.useCallback)(t=>{if(x(null),!ar(t)){x(e("errors.onlyCsv"));return}if(t.size>0xa00000){x(e("errors.tooLarge",{size:at(t.size)}));return}if(0===t.size){x(e("errors.empty"));return}l(t),g(!0),d(null),b(r0),rG().parse(t,{header:!0,skipEmptyLines:"greedy",delimiter:"",transformHeader:(e,t)=>e&&e.trim().length?e.trim():"Column ".concat(t+1),complete:t=>{var r,a,s,n,i,o;let c=null!==(a=t.data)&&void 0!==a?a:[],u=null!==(s=null===(r=t.meta)||void 0===r?void 0:r.fields)&&void 0!==s?s:[];if(!u.length||!c.length){g(!1),x(e("errors.unreadable")),l(null);return}let m=Object.values(null!==(n=c[0])&&void 0!==n?n:{}),h=u.length,p=1===h&&/[,;\t|]/.test((null!==(i=m[0])&&void 0!==i?i:"").toString()),b=Math.min(5,c.length),f=c.slice(0,b).filter(e=>{let t=Object.values(e).filter(e=>null!=e).length;return Math.abs(h-t)/Math.max(h,t)>.3}).length>=Math.ceil(b/2),v=(null!==(o=t.errors)&&void 0!==o?o:[]).filter(e=>"Quotes"===e.type||"FieldMismatch"===e.type).length>Math.max(2,c.length/2);if(p||f||v){g(!1),x(e("errors.malformed")),l(null);return}let y=c.map(e=>u.map(t=>{var r;return(null!==(r=e[t])&&void 0!==r?r:"").toString()}));d({headers:u,rows:y}),g(!1)},error:t=>{g(!1),x(e("errors.parseFailed",{message:t.message})),l(null)}})},[e]),R=(0,s.useMemo)(()=>i?{rowCount:i.rows.length,colCount:i.headers.length}:null,[i]),z=(0,s.useCallback)(async()=>{if(!r)return;w(null),S(null),A(!0);let e={...p};try{await eP(null==t?void 0:t.token,r,e,{onEvent:e=>w(e),onError:e=>S(e.message),onComplete:()=>A(!1)})}catch(e){A(!1)}},[null==t?void 0:t.token,r,p]);return(0,a.jsx)("div",{className:"h-full w-full min-w-0 min-h-0 overflow-hidden bg-[#faf9f6] dark:bg-surface",children:(0,a.jsxs)(eH.YZ,{direction:"horizontal",className:"h-full w-full",children:[(0,a.jsx)(eH.Zk,{defaultSize:55,minSize:40,className:"h-full",children:(0,a.jsxs)("div",{className:"h-full w-full min-w-0 overflow-y-auto px-6 py-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg bg-blue-100 dark:bg-orange-900/30 flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(rq.A,{className:"w-5 h-5 text-blue-600 dark:text-orange-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-gray-900 dark:text-ink-primary leading-tight",children:e("header.title")}),(0,a.jsx)("p",{className:"text-xs text-gray-500 dark:text-ink-muted mt-0.5",children:e("header.subtitle")})]})]}),(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-gray-500 dark:text-ink-muted",children:e("header.sourceLabel")})}),!r&&(0,a.jsxs)("div",{onDrop:e=>{var t;e.preventDefault(),e.stopPropagation(),m(!1);let r=null===(t=e.dataTransfer.files)||void 0===t?void 0:t[0];r&&M(r)},onDragOver:e=>{e.preventDefault(),e.stopPropagation(),u||m(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),m(!1)},onClick:()=>{var e;return null===(e=f.current)||void 0===e?void 0:e.click()},role:"button",tabIndex:0,onKeyDown:e=>{if("Enter"===e.key||" "===e.key){var t;e.preventDefault(),null===(t=f.current)||void 0===t||t.click()}},className:["relative w-full rounded-xl border-2 border-dashed transition-all cursor-pointer","flex flex-col items-center justify-center text-center px-6 py-10",u?"border-blue-500 bg-blue-50/60 dark:bg-blue-900/20":"border-gray-300 dark:border-border bg-white dark:bg-surface-elevated hover:border-blue-400 hover:bg-blue-50/30 dark:hover:bg-surface-active"].join(" "),children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-full bg-blue-100 dar
1k:bg-orange-900/30 flex items-center justify-center mb-3",children:(0,a.jsx)(ty.A,{className:"w-5 h-5 text-blue-600 dark:text-orange-400"})}),(0,a.jsx)("div",{className:"text-sm font-medium text-gray-800 dark:text-ink-primary",children:u?e("upload.drop"):e("upload.prompt")}),(0,a.jsx)("div",{className:"text-xs text-gray-500 dark:text-ink-muted mt-1",children:e("upload.hint")}),(0,a.jsx)("input",{ref:f,type:"file",accept:".csv,text/csv",className:"hidden",onChange:e=>{var t;let r=null===(t=e.target.files)||void 0===t?void 0:t[0];r&&M(r)}})]}),c&&(0,a.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-lg border border-red-200 dark:border-red-500/30 bg-red-50 dark:bg-red-900/20 px-3 py-2.5",children:[(0,a.jsx)(rV.A,{className:"w-4 h-4 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),(0,a.jsx)("div",{className:"text-sm text-red-700 dark:text-red-400",children:c})]}),h&&(0,a.jsxs)("div",{className:"mt-3 flex items-center gap-2 rounded-lg border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated px-3 py-2.5",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-blue-600 dark:border-claude border-t-transparent"}),(0,a.jsx)("div",{className:"text-sm text-gray-700 dark:text-ink-primary",children:e("upload.reading")})]}),r&&i&&!h&&(0,a.jsxs)("div",{className:"mt-3 flex items-center gap-3 rounded-lg border border-green-200 dark:border-green-500/30 bg-green-50 dark:bg-green-900/20 px-3 py-2.5",children:[(0,a.jsx)(rW.A,{className:"w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)(tv.A,{className:"w-4 h-4 text-green-700 dark:text-green-400 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium text-green-800 dark:text-green-400 truncate",title:r.name,children:r.name})]}),(0,a.jsx)("div",{className:"text-xs text-green-700/80 dark:text-green-500 mt-0.5",children:e("upload.fileMeta",{size:at(r.size),rows:null==R?void 0:R.rowCount.toLocaleString(),columns:null==R?void 0:R.colCount})})]}),(0,a.jsx)("button",{type:"button",onClick:j,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 transition-colors","aria-label":e("upload.removeFile"),children:(0,a.jsx)(n.A,{className:"w-4 h-4 text-green-700 dark:text-green-400"})})]}),i&&!h&&(0,a.jsxs)("div",{className:"mt-6",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>k(e=>!e),className:"w-full flex items-center justify-between mb-2 group","aria-expanded":v,children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(o.A,{className:"w-4 h-4 text-gray-500 dark:text-ink-muted transition-transform duration-200 ".concat(v?"":"-rotate-90")}),(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-800 dark:text-ink-primary group-hover:text-gray-900 dark:group-hover:text-white",children:e("preview.title")})]}),(0,a.jsxs)("span",{className:"text-xs text-gray-500 dark:text-ink-muted",children:[null==R?void 0:R.rowCount.toLocaleString()," \xd7 ",null==R?void 0:R.colCount]})]}),v&&(0,a.jsx)(rJ,{data:i})]}),i&&!h&&(0,a.jsxs)("div",{className:"mt-6",children:[(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-800 dark:text-ink-primary",children:e("settings.title")}),(0,a.jsx)("p",{className:"text-xs text-gray-500 dark:text-ink-muted mt-0.5",children:e("settings.subtitle")})]}),(0,a.jsx)(r4,{headers:i.headers,value:p,onChange:b,onStartAnalysis:z,isRunning:T,aiModels:E})]})]})}),(0,a.jsx)(eH.TW,{className:"w-1.5 bg-transparent hover:bg-blue-200/60 dark:hover:bg-claude/20 transition-colors data-[resize-handle-state=drag]:bg-blue-300 dark:data-[resize-handle-state=drag]:bg-claude/30 relative",children:(0,a.jsx)("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-px bg-gray-200 dark:bg-border"})}),(0,a.jsx)(eH.Zk,{defaultSize:45,minSize:35,className:"h-full",children:(0,a.jsx)("div",{className:"h-full w-full min-w-0 overflow-y-auto bg-white dark:bg-surface-elevated",children:N||T||C?(0,a.jsx)(r9,{event:N,error:C,isRunning:T}):(0,a.jsx)("div",{className:"h-full flex items-center justify-center px-6 py-6",children:(0,a.jsxs)("div",{className:"text-center max-w-sm",children:[(0,a.jsx)("div",{className:"w-14 h-14 roun
1ded-full bg-gray-100 dark:bg-surface-active mx-auto flex items-center justify-center mb-4",children:(0,a.jsx)(rq.A,{className:"w-6 h-6 text-gray-400 dark:text-ink-muted"})}),(0,a.jsx)("h3",{className:"text-base font-semibold text-gray-800 dark:text-ink-primary mb-1.5",children:e("result.idleTitle")}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-ink-muted leading-relaxed",children:i?e("result.idleReady"):e("result.idleUpload")})]})})})})]})})};var as=r(61997);let al=async(e,t)=>{var r,a;let s=await fetch("".concat("https://api-prod.convomind.ai/api/v1","/queue/search"),{method:"POST",headers:{"Content-Type":"application/json",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!s.ok){let e=await s.json().catch(()=>null);(0,ey.h)(e,s)}let l=await s.json();return{totalRecords:null!==(r=null==l?void 0:l.totalRecords)&&void 0!==r?r:0,records:null!==(a=null==l?void 0:l.records)&&void 0!==a?a:[]}},an={WORKING:"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",FINISHED:"bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-300",FAILED:"bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-300"},ai=e=>{let{agentType:t}=e,{t:r}=(0,P.Bd)("agents-shell"),l=(0,y.d4)(e=>e.user),n=L(t),[i,o]=(0,s.useState)([]),[d,x]=(0,s.useState)(0),[u,m]=(0,s.useState)(1),[h,g]=(0,s.useState)(!1),[p,b]=(0,s.useState)(!1),[f,v]=(0,s.useState)(!1),k=(0,s.useCallback)(async e=>{if(!(null==l?void 0:l.token))return;let r=e>1;r?b(!0):g(!0),v(!1);try{let a=await al({agents:[t],page:e,size:20},l.token);o(e=>r?[...e,...a.records]:a.records),x(a.totalRecords),m(e)}catch(e){console.error("Failed to load queue:",e),v(!0)}finally{r?b(!1):g(!1)}},[t,null==l?void 0:l.token]);(0,s.useEffect)(()=>{k(1)},[k]);let j=(0,s.useRef)(i),w=(0,s.useRef)(u),C=(0,s.useRef)(!1);(0,s.useEffect)(()=>{j.current=i,w.current=u},[i,u]);let S=(0,s.useCallback)(async()=>{if((null==l?void 0:l.token)&&!C.current){C.current=!0;try{let e=await al({agents:[t],page:1,size:20*w.current},l.token),r=new Map(j.current.map(e=>[e.id,e.status])),a=e.records.some(e=>"WORKING"===r.get(e.id)&&"WORKING"!==e.status);o(e.records),x(e.totalRecords),a&&N.emit()}catch(e){console.error("Failed to refresh queue:",e)}finally{C.current=!1}}},[t,null==l?void 0:l.token]),T=i.some(e=>"WORKING"===e.status);return(0,s.useEffect)(()=>{if(!T)return;let e=null,t=()=>{e&&clearInterval(e),e=setInterval(S,3e4)},r=()=>{e&&clearInterval(e),e=null},a=()=>{if("hidden"===document.visibilityState){r();return}S(),t()};return"hidden"!==document.visibilityState&&t(),document.addEventListener("visibilitychange",a),window.addEventListener("focus",a),()=>{r(),document.removeEventListener("visibilitychange",a),window.removeEventListener("focus",a)}},[T,S]),(0,a.jsxs)("div",{className:"h-full p-6 overflow-y-auto bg-[#faf9f6] dark:bg-surface",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-base ".concat(n.color),children:n.icon}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-800 dark:text-ink-primary",children:n.agentName||n.label}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-ink-muted",children:r("queues.subtitle")})]})]}),(0,a.jsxs)("button",{onClick:()=>k(1),disabled:h,className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-border text-gray-600 dark:text-ink-secondary hover:bg-gray-50 dark:hover:bg-surface-active disabled:opacity-60 transition-colors",children:[(0,a.jsx)(as.A,{className:"w-4 h-4 ".concat(h?"animate-spin":"")}),r("queues.refresh")]})]}),h&&0===i.length?(0,a.jsx)("div",{className:"flex items-center justify-center h-48",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-10 w-10 border-b-2 border-blue-600 dark:border-claude"})}):f?(0,a.jsxs)("div",{className:"text-center py-16 text-gray-500 dark:text-ink-muted",children:[(0,a.jsx)("p",{className:"text-sm",children:r("queues.loadFailed")}),(0,a.jsx)("button",{onClick:()=>k(1),className:"text-sm mt-2 underline hover:text-gray-700 dark:hover:text-ink-primary",children:r("queues.retry")})]}):0===i.length?(0,a.jsxs)("div",{className:"text-center py-16 text-gray-500 dark:text-ink-muted",children:[(0,a.jsx)(c.A,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),(0,a.jsx)("p",{children:r("queues.empty")})]}):(0,a.jsxs)("div",{className:"border border-gray-200 dark:border-border rounded-lg bg-white dark:bg-surface-elevated overflow-hidden",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_180px_140px] gap-4 px-4 py-2.5 text-xs font-medium text-gray-500 dark:text-ink-muted border-b border-gray-200 dark:border-border",children:[(0,a.jsx)("span",{children:r("queues.columns.request")}),(0,a.jsx)("span",{children:r("queues.columns.model")}),(0,a.jsx)("span",{children:r("queues.columns.status")})]}),i.map(e=>{var t;let s=null!==(t=an[e.status])&&void 0!==t?t:"bg-gray-100 text-gray-600 dark:bg-surface-active dark:text-ink-muted";return(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_180px_140px] gap-4 items-center px-4 py-3 text-sm border-b last:border-b-0 border-gray-100 dark:border-border",children:[(0,a.jsx)("span",{className:"font-mono text-xs text-gray-600 dark:text-ink-secondary truncate",children:e.id}),(0,a.jsx)("span",{className:"text-gray-700 dark:text-ink-secondary truncate",children:e.ai||"â"}),(0,a.jsx)("span",{children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ".concat(s),children:["WORKING"===e.status&&(0,a.jsx)(rZ.A,{className:"w-3 h-3 animate-spin"}),r("queues.status.".concat(e.status),{defaultValue:e.status})]})})]},e.id)})]}),!f&&i.length>0&&(0,a.jsxs)("div",{className:"flex items-center justify-between mt-3",children:[(0,a.jsx)("span",{className:"text-xs text-gray-500 dark:text-ink-muted",children:r("queues.total",{count:d})}),i.length<d&&(0,a.jsx)("button",{onClick:()=>k(u+1),disabled:p,className:"px-3 py-1.5 text-xs text-gray-600 dark:text-ink-secondary rounded-lg border border-gray-200 dark:border-border hover:bg-gray-50 dark:hover:bg-surface-active disabled:opacity-60 transition-colors",children:p?r("queues.loading"):r("queues.loadMore")})]})]})};var ao=r(33673),ad=r(17765),ac=r(27473),ax=r(6497),au=r(92297),am=r(59558),ah=r(6246),ag=r(14413),ap=r(51173),ab=r(46420),af=r(64680);function av(e){let{open:t,onClose:r,urls:l,limit:i,warning:o,setWarning:d,addUrls:c,removeUrl:x,clearUrls:u,onUpload:m,locked:h}=e,{t:g}
1=(0,P.Bd)("agent-content-studio"),[p,b]=(0,s.useState)("");if((0,s.useEffect)(()=>{t&&(b(""),d(null))},[t,d]),!t)return null;let f=l.length>=i,v=()=>{p.trim()&&c(p)&&b("")};return(0,a.jsx)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/60 p-4",onClick:r,children:(0,a.jsxs)("div",{className:"w-full max-w-[520px] max-h-[80vh] flex flex-col overflow-hidden rounded-2xl border border-neutral-800 bg-neutral-950 shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-neutral-800 px-5 py-3.5",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[14px] font-medium text-neutral-100",children:[(0,a.jsx)(am.A,{size:14,className:"text-sky-400"}),g("urlList.title")]}),(0,a.jsx)("p",{className:"mt-0.5 text-[11.5px] text-neutral-500",children:g("urlList.count",{count:l.length,max:i})})]}),(0,a.jsx)("button",{onClick:r,className:"p-1 text-neutral-500 hover:text-neutral-200 transition-colors","aria-label":g("actions.cancel"),children:(0,a.jsx)(n.A,{size:16})})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===l.length?(0,a.jsx)("p",{className:"px-5 py-10 text-center text-[12.5px] text-neutral-600",children:g("urlList.empty")}):l.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 border-b border-neutral-900 px-5 py-2.5",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-2.5",children:[(0,a.jsx)("span",{className:"w-6 shrink-0 text-[11px] tabular-nums text-neutral-600",children:t+1}),(0,a.jsx)("span",{className:"truncate text-[12.5px] text-neutral-300",children:e})]}),!h&&(0,a.jsx)("button",{onClick:()=>x(t),className:"shrink-0 p-1 text-neutral-600 hover:text-rose-400 transition-colors",children:(0,a.jsx)(n.A,{size:14})})]},"".concat(e,"-").concat(t)))}),!h&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 border-t border-neutral-800 px-5 py-3",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{value:p,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),v())},disabled:f,placeholder:g("urlList.inputPlaceholder"),className:"flex-1 rounded-xl border border-neutral-800 bg-neutral-900 px-3 py-2 text-[12.5px] text-neutral-100 placeholder-neutral-600 outline-none transition-colors focus:border-sky-500/70 disabled:opacity-60"}),(0,a.jsx)("button",{onClick:v,disabled:f,className:"rounded-xl bg-sky-500/90 px-3.5 py-2 text-[12.5px] font-medium text-white transition-colors hover:bg-sky-500 disabled:cursor-not-allowed disabled:opacity-50",children:g("tags.add")})]}),(0,a.jsx)("p",{className:"text-[11px] leading-[1.5] text-neutral-500",children:g("urlList.inputHint")}),(0,a.jsxs)("button",{onClick:()=>{let e=document.createElement("input");e.type="file",e.accept=".xlsx,.xls,.csv",e.onchange=e=>{var t;(null===(t=e.target.files)||void 0===t?void 0:t[0])&&m(e.target.files[0])},e.click()},disabled:f,className:"flex items-center gap-2 rounded-xl border border-dashed border-neutral-700 bg-neutral-900/60 px-3 py-2 text-left transition-colors hover:border-neutral-500 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)(ty.A,{size:13,className:"shrink-0 text-neutral-500"}),(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"block text-[11.5px] font-medium text-neutral-300",children:g("urlList.upload")}),(0,a.jsx)("span",{className:"block text-[10.5px] text-neutral-500",children:g("urlList.uploadHint")})]})]}),f&&(0,a.jsx)("p",{className:"text-[11px] text-amber-400",children:g("urlList.limitReached",{max:i})}),o&&(0,a.jsx)("p",{className:"text-[11px] text-rose-400",children:o}),l.length>0&&(0,a.jsxs)("button",{onClick:u,className:"flex items-center gap-1.5 self-start text-[11.5px] text-neutral-500 transition-colors hover:text-rose-400",children:[(0,a.jsx)(D.A,{size:12})," ",g("urlList.clear")]})]})]})})}let ay="https://api-prod.convomind.ai/api/v1",ak=(e,t)=>{var r,a;return null!==(a=null==e?void 0:null===(r=e[t.toUpperCase()])||void 0===r?void 0:r.trim())&&void 0!==a?a:""},aj=async e=>{try{let t=await fetch("".concat(ay,"/agents/generator/briefs/industries"),{method:"GET",headers:{Accept:"application/json",Authorization:"Bearer ".concat(e)}});if(!t.ok){let e=await t.json().catch(()=>null);throw Error("API Error: ".concat(t.status," - ").concat(e?JSON.stringify(e):t.statusText))}return await t.json()}catch(e){throw console.error("Failed to fetch industries:",e),e}},aN=e=>{if((null==e?void 0:e.data)==="BUDGET_EXCEEDED"||(null==e?void 0:e.data)==="NOT_ENOUGH_CREDIT"){let e=Error("Budget exceeded");throw e.name="BudgetExceedRequestError",e}},aw=async e=>{var t,r;let a=null===(t=e.body)||void 0===t?void 0:t.getReader();if(!a){let t=JSON.parse((await e.text()).replace(/^data:\s*/gm,"").trim());return aN(t),t}let s=new TextDecoder,l="";for(;;){let{done:e,value:t}=await a.read();t&&(l+=s.decode(t,{stream:!0}));let n=l.split("\n");for(let t of(l=e?"":null!==(r=n.pop())&&void 0!==r?r:"",n)){let e;let r=t.replace(/^data:\s*/,"").trim();if(r){try{e=JSON.parse(r)}catch(e){continue}return a.cancel().catch(()=>{}),aN(e),e}}if(e)break}throw Error("No valid JSON found in the response.")},aC=async(e,t)=>{try{let r=await fetch("".concat(ay,"/agents/generator/briefs"),{method:"POST",headers:{"Content-Type":"application/json",Connection:"keep-alive",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}return await aw(r)}catch(e){throw console.error("Failed to generate content brief:",e),e}},aS=async(e,t)=>{try{let r=await fetch("".concat(ay,"/agents/generator/briefs/approve"),{method:"POST",headers:{"Content-Type":"application/json",Connection:"keep-alive",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}return await aw(r)}catch(e){throw console.error("Failed to approve content brief:",e),e}},aT=async(e,t)=>{try{let r=await fetch("".concat(ay,"/agents/generator/briefs/productDescription"),{method:"POST",headers:{"Content-Type":"application/json",Connection:"keep-alive",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!r.ok){let e=await r.json().catch(()=>null);(0,ey.h)(e,r)}return await aw(r)}catch(e){throw console.error("Failed to generate product description:",e),e}},aA={from:"",to:""},aE=["url","urls","link","links","adres","baglanti","baÄlantı"],aL=e=>aE.includes(e.trim().toLowerCase()),aM=e=>/^https?:\/\/[^\s/.]+\.[^\s/]{2,}(\/\S*)?$/i.test(e),aR="- Okuyucuya doÄrudan hitap eden âsizâ, âsizinâ, âihtiya\xe7larınızâ, âeviniz i\xe7inâ gibi ifadelerden ka\xe7ınılmalıdır. İ\xe7erik dili daima nesnel, genel ve bilgilendirici bir yapıda olmalıdır.\n- Metin veya paragraflara âBu sayfaâ, âBu \xfcr\xfcnâ, âBu kategoriâ gibi sayfayı doÄrudan iÅaret eden ifadelerle baÅlanmamalıdır. İ\xe7erik, konuyu doÄrudan a\xe7ıklayan ve bilgi sunan bir anlatımla baÅlamalıdır.\n- Alt baÅlıklar yalnızca ilgili sayfanın arama niyetini karÅılayan, konu kapsamını destekleyen ve SEO performansına katkı saÄlayabilecek baÅlıklardan oluÅturulmalıdır. Konuyla doÄrudan iliÅkili olmayan veya yalnızca metni uzatmaya y\xf6nelik alt baÅlıklara yer verilmemelidir.\n- İ\xe7erikte kullanılan baÅlık ve alt baÅlıklar, ilgili anahtar kelimelerin yanı sıra kullanıcıların konu hakkında merak edebileceÄi anlamlı ve doÄal arama sorgularını da kapsamalıdır.\n- Anlatım, anahtar kelime yoÄunluÄunu artırmaya odaklanmak yerine konu b\xfct\xfcnl\xfcÄ\xfc, bilgi derinliÄi ve arama niyetinin karÅılanması \xf6nceliklendirilerek oluÅturulmalıdır.",az="- Avoid addressing the reader directly with words such as âyouâ, âyourâ, âyour needsâ or âfor your homeâ. The content must always read as objective, general and informative.\n- Do not open a text or a paragraph with phrases that point at the page itself, such as âThis pageâ, âThis productâ or âThis categoryâ. Start with an account that explains the subject and delivers information.\n- Subheadings must only cover what answers the page's search intent, supports the scope of the topic and can contribute to SEO performance. Leave out subheadings that are unrelated to the topic or that only pad the text.\n- Headings and subheadings must cover the relevant keywords as well as the meaningful, natural search queries readers may have about the topic.\n- Write for topical coherence, depth of information and search intent rather than for keyword density.",a_=e=>e.trim().toLowerCase().startsWith("tr")?aR:az,aO=e=>!e.trim()||e===aR||e===az,aI=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.find(e=>null!=e)};function aD(e){var t,r,a,s;return e&&"object"==typeof e?{aiKnowledge:null!==(t=aI(e.ai_knowledge,e.aiKnowledge))&&void 0!==t?t:"",technologies:null!==(r=e.technologies)&&void 0!==r?r:"",visualAnalysis:null!==(a=aI(e.visual_analysis,e.visualAnalysis))&&void 0!==a?a:"",productDescription:null!==(s=aI(e.product_description,e.productDescription))&&void 0!==s?s:""}:null}let aP={fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'DM Sans', 'Segoe UI', sans-serif"},aB={fontFamily:"ui-monospace, 'SF Mono', Menlo, monospace"},aF=[{id:"Brand",desc:"Brief first, then long-form content + FAQ schema"},{id:"Category",desc:"Brief first, then intent-driven content + FAQ schema"},{id:"Product",desc:"Brief, then content, then a conversion-focused description"}],aH=[{id:0,key:"brandSite",label:"Brand & Site",icon:rz.A},{id:1,key:"rules",label:"Rules",icon:ao.A},{id:2,key:"page",label:"Page",icon:ad.A}],aU={light:{text:"#262626",heading:"#111827",border:"#d4d4d4",thBg:"#f5f5f5",link:"#0284c7"},dark:{text:"#d4d4d4",heading:"#fafafa",border:"#3f3f3f",thBg:"#262626",link:"#7dd3fc"}};function aG(e){let{children:t,required:r,optional:s}=e,{t:l}=(0,P.Bd)("agent-content-studio");return(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-[13px] font-medium text-neutral-300 mb-1.5",children:[t,r&&(0,a.jsx)("span",{className:"text-rose-400",children:"*"}),s&&(0,a.jsx)("span",{className:"text-[11px] font-normal text-neutral-500",children:l("common.optional")})]})}function aq(e){let{label:t,required:r,optional:s,hint:l,error:n,children:i}=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)(aG,{required:r,optional:s,children:t}),i,n?(0,a.jsxs)("p",{className:"mt-1.5 flex items-center gap-1 text-[12px] text-rose-400",children:[(0,a.jsx)(rV.A,{size:12}),n]}):l?(0,a.jsx)("p",{className:"mt-1.5 text-[12px] text-neutral-500",children:l}):null]})}let aV=e=>"w-full rounded-xl bg-neutral-900 border px-3.5 py-2.5 text-[14px] text-neutral-100 placeholder-neutral-600 outline-none transition-colors disabled:opacity-60 disabled:cursor-not-allowed ".concat(e?"border-rose-500/60 focus:border-rose-400":"border-neutral-800 focus:border-sky-500/70");function aW(e){let{on:t,onChange:r,label:s,desc:l,disabled:n}=e;return(0,a.jsxs)("button",{type:"button",disabled:n,onClick:()=>r(!t),className:"w-full flex items-start gap-3 text-left disabled:opacity-60 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"mt-0.5 relative inline-flex h-6 w-10 shrink-0 rounded-full transition-colors ".concat(t?"bg-sky-500":"bg-neutral-700"),children:(0,a.jsx)("span",{className:"absolute top-0.5 h-5 w-5 rounded-full bg-white transition-transform ".concat(t?"translate-x-[18px]":"translate-x-0.5")})}),(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"block text-[14px] font-medium text-neutral-200",children:s}),l&&(0,a.jsx)("span",{className:"block text-[12px] text-neutral-500 mt-0.5",children:l})]})]})}function aJ(e){let{tags:t,setTags:r,placeholder:l,disabled:i}=e,{t:o}
1=(0,P.Bd)("agent-content-studio"),[d,c]=(0,s.useState)(""),x=()=>{let e=d.trim();e&&!t.includes(e)&&r([...t,e]),c("")};return(0,a.jsxs)("div",{className:"rounded-xl bg-neutral-900 border border-neutral-800 p-2.5 transition-colors ".concat(i?"opacity-60":"focus-within:border-sky-500/70"),children:[(0,a.jsxs)("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:[t.map(e=>(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-lg bg-neutral-800 px-2 py-1 text-[12px] text-neutral-300",children:[e,!i&&(0,a.jsx)("button",{onClick:()=>r(t.filter(t=>t!==e)),className:"text-neutral-500 hover:text-rose-400",children:(0,a.jsx)(n.A,{size:12})})]},e)),0===t.length&&(0,a.jsx)("span",{className:"text-[12px] text-neutral-600 px-1 py-1",children:o("tags.empty")})]}),!i&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),x())},placeholder:l,className:"flex-1 bg-transparent text-[13px] text-neutral-200 placeholder-neutral-600 outline-none px-1"}),(0,a.jsx)("button",{onClick:x,className:"rounded-lg bg-neutral-800 px-2.5 py-1 text-[12px] text-neutral-300 hover:bg-neutral-700 transition-colors",children:o("tags.add")})]})]})}function aK(e){let{text:t,label:r}=e,{t:l}=(0,P.Bd)("agent-content-studio"),[n,i]=(0,s.useState)(!1),o=async()=>{try{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),2e3)}catch(e){}};return(0,a.jsxs)("button",{onClick:o,className:"flex items-center gap-1.5 rounded-lg bg-neutral-800 px-2.5 py-1 text-[12px] text-neutral-300 hover:bg-neutral-700 transition-colors",children:[n?(0,a.jsx)(W.A,{size:12,className:"text-emerald-400"}):(0,a.jsx)(rD.A,{size:12}),n?l("actions.copied"):null!=r?r:l("actions.copy")]})}function aY(e,t){return t&&!e.includes(t)?[t,...e]:e}function a$(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"text/plain",a=new Blob([t],{type:r}),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download=e,l.click(),URL.revokeObjectURL(s)}function aX(){var e,t;let{initialData:r,initialResponse:l,recordId:i,isEditor:o=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},d=function(e,t,r){var a,l,n,i,o,d,c,x,u,m,h,g,p,b,f,v,k,j,w;let C=!(arguments.length>3)||void 0===arguments[3]||arguments[3],{t:S}=(0,P.Bd)("agent-content-studio"),T=(0,y.d4)(e=>e.user),A=(0,s.useMemo)(()=>(function(e,t){var r,a,s,l,n,i,o,d,c,x;let u=function(e){var t,r,a,s,l,n,i,o,d,c,x,u,m,h,g,p,b,f,v,y,k,j,N,w,C;let S=null!==(r=null==e?void 0:e.step1)&&void 0!==r?r:e;if(!S||!S.project&&!S.page)return null!=S?S:{};let T=null!==(a=S.page)&&void 0!==a?a:{},A=null!==(s=S.user)&&void 0!==s?s:{},E=null!==(l=S.project)&&void 0!==l?l:{},L=null!==(n=aI(T.image_tags,T.imageTags))&&void 0!==n?n:{};return{brandName:null!==(i=aI(E.site_name,E.siteName))&&void 0!==i?i:"",domain:null!==(o=E.domain)&&void 0!==o?o:"",sector:null!==(d=S.industry)&&void 0!==d?d:"",lang:null!==(c=aI(S.lang,E.language))&&void 0!==c?c:"",model:null!==(x=aI(S.aiId,S.ai_id,null==e?void 0:null===(t=e.aiNames)||void 0===t?void 0:t[0]))&&void 0!==x?x:"",pageType:aI(T.page_type,T.pageType),url:null!==(u=T.url)&&void 0!==u?u:"",pageContent:null!==(m=aI(T.scrape_markdown,T.scrapeMarkdown))&&void 0!==m?m:"",productName:null!==(h=aI(T.product_name,T.productName))&&void 0!==h?h:"",imageStartTag:null!==(g=aI(L.start_tag,L.startTag))&&void 0!==g?g:"",imageEndTag:null!==(p=aI(L.end_tag,L.endTag))&&void 0!==p?p:"",brandVoice:null!==(b=A.tone)&&void 0!==b?b:"",cliches:null!==(f=aI(S.bannedPhrases,S.banned_phrases))&&void 0!==f?f:[],knownBrands:null!==(v=aI(S.knownBrands,S.known_brands))&&void 0!==v?v:[],abbrMap:null!==(y=aI(A.abbreviation_map,A.abbreviationMap))&&void 0!==y?y:{},internalOnly:null===(k=aI(E.internal_links_only,E.internalLinks))||void 0===k||k,urlList:null!==(j=aI(E.url_list,E.urlList,A.url_list,A.urlList))&&void 0!==j?j:[],faqSchema:null===(N=aI(A.faq_schema,A.faqSchema))||void 0===N||N,minFaq:null!==(w=aI(A.min_faq_questions,A.minFaqQuestions))&&void 0!==w?w:5,visionOn:null===(C=aI(A.vision_analysis,A.visionAnalysis))||void 0===C||C}}(e),m=null!=t?t:{};if("string"==typeof m.brief||void 0!==m.output){let e=null!==(s=m.output)&&void 0!==s?s:null;return{form:u,brief:null!==(l=m.brief)&&void 0!==l?l:"",output:e,sources:null,warnings:[],stage:e?"content":m.brief?"brief":"idle"}}let h=null!==(n=aI(null==e?void 0:null===(r=e.step2)||void 0===r?void 0:r.approvedBrief,null==e?void 0:null===(a=e.step2)||void 0===a?void 0:a.approved_brief))&&void 0!==n?n:"",g=null!==(i=aI(m.brief_markdown,m.briefMarkdown))&&void 0!==i?i:"",p=h||g,b=null!==(o=m.html)&&void 0!==o?o:"",f=b?{html:b,schema:null!==(d=aI(m.inline_schema,m.inlineSchema))&&void 0!==d?d:""}:null,v=null!==(c=m.kind)&&void 0!==c?c:"";return{form:u,brief:p,output:f,sources:aD(m.sources),warnings:null!==(x=m.warnings)&&void 0!==x?x:[],stage:"product_description"===v?"description":"content"===v?"content":"brief"===v?"brief":f?"content":p?"brief":"idle"}}
1)(e,t),[e,t]),E=A.form,[L,M]=(0,s.useState)(r),[R,z]=(0,s.useState)({}),[_,O]=(0,s.useState)(!1),I=(0,s.useMemo)(()=>Object.entries(R).filter(e=>{let[,t]=e;return t.some(e=>e.enabled)}).map(e=>{let[t]=e;return t}),[R]),[D,B]=(0,s.useState)(!1),F=(0,s.useCallback)(()=>{!D&&!_&&(null==T?void 0:T.token)&&(O(!0),aj(T.token).then(e=>{z(null!=e?e:{}),B(!0)}).catch(()=>z({})).finally(()=>O(!1)))},[D,_,null==T?void 0:T.token]);(0,s.useEffect)(()=>{A.form.sector&&F()},[A.form.sector,F]);let[H,U]=(0,s.useState)(A.stage),[G,q]=(0,s.useState)(2*!!e),[V,W]=(0,s.useState)(!1),[J,K]=(0,s.useState)(!1),[Y,$]=(0,s.useState)(""),[X,Z]=(0,s.useState)(""),[Q,ee]=(0,s.useState)(!1),[et,er]=(0,s.useState)("budgetExceed"),ea=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"errors.requestFailed",r=tP(e);if(r){er(r),ee(!0),Z("");return}Z(tF(e,S,t))},[es,el]=(0,s.useState)(null!==(a=null==E?void 0:E.brandName)&&void 0!==a?a:""),[en,ei]=(0,s.useState)(null!==(l=null==E?void 0:E.domain)&&void 0!==l?l:""),[eo,ed]=(0,s.use
1State)(null!==(n=null==E?void 0:E.sector)&&void 0!==n?n:""),[ec,ex]=(0,s.useState)(null!==(i=null==E?void 0:E.lang)&&void 0!==i?i:""),[eu,em]=(0,s.useState)(null!==(o=null==E?void 0:E.model)&&void 0!==o?o:""),[eh,eg]=(0,s.useState)([]),[ep,eb]=(0,s.useState)(null!==(d=null==E?void 0:E.cliches)&&void 0!==d?d:[]),[ef,ev]=(0,s.useState)(null!==(c=null==E?void 0:E.knownBrands)&&void 0!==c?c:[]),[ey,ek]=(0,s.useState)((null==E?void 0:E.brandVoice)||a_(null!==(x=null==E?void 0:E.lang)&&void 0!==x?x:""));(0,s.useEffect)(()=>{(null==T?void 0:T.token)&&(0,eU.Hs)(T.token,{status:"ACTIVE",agentry:!0}).then(e=>{var t;let r=null!==(t=e.agenticAIs)&&void 0!==t?t:[];eg(r),em(e=>{var t,a;return e||(null!==(a=null===(t=r[0])||void 0===t?void 0:t.tag)&&void 0!==a?a:"")})}).catch(()=>{})},[null==T?void 0:T.token]);let ej=(0,s.useMemo)(()=>{var e;return(eo&&null!==(e=R[eo])&&void 0!==e?e:[]).filter(e=>e.enabled)},[R,eo]),eN=(0,s.useMemo)(()=>ej.map(e=>e.lang),[ej]),ew=(0,s.useMemo)(()=>{var e;return null!==(e=ej.find(e=>e.lang===ec))&&void 0!==e?e:null},[ej,ec]),eC=e=>{var t,r;eb(null!==(t=null==e?void 0:e.presetData.bannedPhrases)&&void 0!==t?t:[]),ev(null!==(r=null==e?void 0:e.presetData.knownBrands)&&void 0!==r?r:[])},eS=e=>ek(t=>aO(t)?a_(e):t),eT=(0,s.useCallback)(e=>{var t,r,a;let s=(null!==(r=R[e])&&void 0!==r?r:[]).filter(e=>e.enabled),l=s.some(e=>e.lang===ec)?ec:null!==(a=null===(t=s[0])||void 0===t?void 0:t.lang)&&void 0!==a?a:"";ed(e),ex(l),eC(s.find(e=>e.lang===l)),eS(l)},[R,ec]),eA=(0,s.useCallback)(e=>{ex(e),eC(ej.find(t=>t.lang===e)),eS(e)},[ej]),[eE,eL]=(0,s.useState)(()=>{var e;let t=Object.entries(null!==(e=null==E?void 0:E.abbrMap)&&void 0!==e?e:{}).map(e=>{let[t,r]=e;return{from:t,to:r}});return t.length?t:[aA]}),[eM,eR]=(0,s.useState)(null===(u=null==E?void 0:E.internalOnly)||void 0===u||u),[ez,e_]=(0,s.useState)(null!==(m=null==E?void 0:E.urlList)&&void 0!==m?m:[]),[eO,eI]=(0,s.useState)(null),eD=(0,s.useCallback)(e=>{eR(e),e||(e_([]),eI(null))},[]),eP=(0,s.useCallback)(e=>{let t=[];e.invalid&&t.push(S("urlList.warnInvalid",{count:e.invalid})),e.duplicate&&t.push(S("urlList.warnDuplicate",{count:e.duplicate})),e.skipped&&t.push(S("urlList.warnSkipped",{count:e.skipped,max:150})),eI(t.length?t.join(" "):null)},[S]),eB=(0,s.useCallback)(e=>{let t=e.split(/[\s,;]+/).filter(Boolean),r=[...ez],a=new Set(r),s=0,l=0,n=0,i=0;return t.forEach(e=>{if(!aM(e)){l++;return}if(a.has(e)){n++;return}if(r.length>=150){i++;return}r.push(e),a.add(e),s++}),s&&e_(r),eP({invalid:l,duplicate:n,skipped:i}),s},[ez,eP]),eF=(0,s.useCallback)(e=>e_(t=>t.filter((t,r)=>r!==e)),[]),eH=(0,s.useCallback)(()=>{e_([]),eI(null)},[]),eG=(0,s.useCallback)(async e=>{if(e){eI(null);try{let t=await e.arrayBuffer(),r=tM.LF(t,{type:"array"}),a=r.Sheets[r.SheetNames[0]],s=tM.Wp.sheet_to_json(a,{header:1}),l=s.findIndex(e=>(e||[]).some(e=>String(null!=e?e:"").trim())),n=[];s.forEach((e,t)=>{(e||[]).forEach(e=>{let r=String(null!=e?e:"").trim();r&&(t===l&&aL(r)||n.push(r))})}),eB(n.join("\n"))}catch(e){eI(S("urlList.uploadFailed"))}}},[eB,S]),[eq,eV]=(0,s.useState)(null===(h=null==E?void 0:E.faqSchema)||void 0===h||h),[eW,eJ]=(0,s.useState)(null!==(g=null==E?void 0:E.minFaq)&&void 0!==g?g:5),[eK,eY]=(0,s.useState)(null!==(p=null==E?void 0:E.pageType)&&void 0!==p?p:"Category"),[e$,eX]=(0,s.useState)(null!==(b=null==E?void 0:E.url)&&void 0!==b?b:""),[eZ,eQ]=(0,s.use
1State)(null!==(f=null==E?void 0:E.pageContent)&&void 0!==f?f:""),[e0,e1]=(0,s.useState)(null!==(v=null==E?void 0:E.productName)&&void 0!==v?v:""),[e2,e5]=(0,s.useState)(null!==(k=null==E?void 0:E.imageStartTag)&&void 0!==k?k:""),[e4,e3]=(0,s.useState)(null!==(j=null==E?void 0:E.imageEndTag)&&void 0!==j?j:""),[e6,e8]=(0,s.useState)(A.brief),[e7,e9]=(0,s.useState)(null!=r?r:""),[te,tt]=(0,s.useState)("brief"===A.stage?A.warnings:[]),[tr,ta]=(0,s.useState)(""),[ts,tl]=(0,s.useState)("content"===A.stage?A.warnings:[]),[tn,ti]=(0,s.useState)(""),[to,td]=(0,s.useState)("description"===A.stage?A.warnings:[]),[tc,tx]=(0,s.useState)(A.sources),[tu,tm]=(0,s.useState)(A.output),[th,tg]=(0,s.useState)("preview"),[tp,tb]=(0,s.useState)(null===(w=null==E?void 0:E.visionOn)||void 0===w||w),tf="Product"===eK,tv=tf&&tp,ty=(0,s.useMemo)(()=>{var e;return ak(null==ew?void 0:null===(e=ew.presetData)||void 0===e?void 0:e.pageTypeHints,eK)},[ew,eK]),tk=(0,s.useMemo)(()=>Object.fromEntries(eE.filter(e=>e.from&&e.to).map(e=>[e.from,e.to])),[eE]),tj=()=>{let e={url:e$.trim(),pageType:eK};if(eZ.trim()&&(e.scrapeMarkdown=eZ.trim()),tf&&e0.trim()&&(e.productName=e0.trim()),tv){let t=e2.trim(),r=e4.trim();(t||r)&&(e.imageTags={...t?{startTag:t}:{},...r?{endTag:r}:{}})}let t={faqSchema:eq,visionAnalysis:tv};eq&&(t.minFaqQuestions=eW),ey.trim()&&(t.tone=ey.trim()),Object.keys(tk).length&&(t.abbreviationMap=tk);let r={domain:en.trim(),siteName:es.trim(),language:ec,internalLinks:eM,urlList:eM?ez:[]},a={industry:eo,lang:ec,project:r,page:e,user:t,aiId:eu};return ep.length&&(a.bannedPhrases=ep),ef.length&&(a.knownBrands=ef),a},tN=JSON.stringify(tj()),[tw,tC]=(0,s.useState)(null);(0,s.useEffect)(()=>{null===tw&&"idle"!==H&&eu&&tC(tN)},[tw,H,eu,tN]);let tS="idle"!==H&&null!==tw&&tN!==tw,tT=(0,s.useCallback)(e=>{if(!e||e===L)return;M(e);let t=new URLSearchParams(window.location.search);t.set("agent","content-studio"),t.set("recordId",e),t.set("isEditor","true"),window.history.replaceState(window.history.state,"","?".concat(t.toString()))},[L]),tA=/^https?:\/\/[^\s.]+\.[^\s]{2,}/.test(en.trim()),tE={brandName:es.trim()?null:S("errors.brandName"),domain:en.trim()?tA?null:S("errors.domainInvalid"):S("errors.domainRequired"),sector:eo?null:S("errors.sector"),lang:eo?ec?null:S("errors.lang"):S("errors.sectorFirst"),model:eu?null:S("errors.model"),url:e$.trim()?null:S("errors.url"),productName:tf&&!e0.trim()?S("errors.productName"):null,pageContent:null},tL=!tE.brandName&&!tE.domain&&!tE.sector&&!tE.lang&&!tE.model,tR=!tE.url&&!tE.productName,tz=0===G?tL:2!==G||tR,t_=async()=>{if(!tR){W(!0);return}Z(""),K(!0),$(S("busy.brief"));try{var e,t,r,a;let s=tj(),l=await aC(s,null==T?void 0:T.token);tC(JSON.stringify(s)),e9(null!==(e=l.id)&&void 0!==e?e:""),tt(null!==(t=l.warnings)&&void 0!==t?t:[]),e8(null!==(r=l.briefMarkdown)&&void 0!==r?r:""),tm(null),U("brief"),tT(null!==(a=l.id)&&void 0!==a?a:""),N.emit()}catch(e){ea(e)}finally{K(!1)}},tO=async()=>{if(e6.trim()){if(!e7){Z(S("errors.noBriefId"));return}Z(""),K(!0),$(S("busy.content"));try{var e,t,r,a;let s=await aS({approvedBrief:e6,agentId:e7},null==T?void 0:T.token);ta(null!==(e=s.id)&&void 0!==e?e:""),tl(null!==(t=s.warnings)&&void 0!==t?t:[]);let l={html:null!==(r=s.html)&&void 0!==r?r:"",schema:null!==(a=s.inlineSchema)&&void 0!==a?a:""};tm(l),tg("preview"),U("content"),tT(e7),N.emit()}catch(e){ea(e)}finally{K(!1)}}},tI=async()=>{if(!e7){Z(S("errors.noRunId"));return}Z(""),K(!0),$(S("busy.description"));try{var e,t,r,a;let s=await aT({aiId:eu,agentId:e7},null==T?void 0:T.token);ti(null!==(e=s.id)&&void 0!==e?e:""),td(null!==(t=s.warnings)&&void 0!==t?t:[]),tx(aD(s.sources));let l={html:null!==(r=s.html)&&void 0!==r?r:"",schema:null!==(a=s.inlineSchema)&&void 0!==a?a:""};tm(l),tg("preview"),U("description"),tT(e7),N.emit()}catch(e){ea(e)}finally{K(!1)}},tD=tu?tu.html+(tu.schema?"\n\n"+tu.schema:""):"";return{recordId:L,visionOn:tp,setVisionOn:tb,visionActive:tv,isEditor:C,stage:H,setStage:U,step:G,setStep:q,touched:V,setTouched:W,busy:J,busyLabel:Y,apiError:X,showUsageLimitModal:Q,setShowUsageLimitModal:ee,usageLimitType:et,handleApiFailure:ea,brandName:es,setBrandName:el,domain:en,setDomain:ei,sector:eo,setSector:eT,industries:I,industriesLoading:_,loadIndustries:F,lang:ec,setLang:eA,languages:eN,selectedPreset:ew,model:eu,setModel:em,aiModels:eh,brandVoice:ey,setBrandVoice:ek,cliches:ep,setCliches:eb,knownBrands:ef,setKnownBrands:ev,abbr:eE,setAbbr:eL,setAbbrRow:(e,t,r)=>eL(eE.map((a,s)=>s===e?{...a,[t]:r}:a)),internalOnly:eM,setInternalOnly:eD,urlList:ez,urlLimit:150,urlWarning:eO,setUrlWarning:eI,addUrls:eB,removeUrl:eF,clearUrls:eH,handleUrlFileUpload:eG,faqSchema:eq,setFaqSchema:eV,minFaq:eW,setMinFaq
1:eJ,pageType:eK,setPageType:eY,pageTypeHint:ty,url:e$,setUrl:eX,pageContent:eZ,setPageContent:eQ,productName:e0,setProductName:e1,imageStartTag:e2,setImageStartTag:e5,imageEndTag:e4,setImageEndTag:e3,brief:e6,setBrief:e8,briefId:e7,briefWarnings:te,contentId:tr,contentWarnings:ts,descriptionId:tn,descriptionWarnings:to,sources:tc,output:tu,tab:th,setTab:tg,isProduct:tf,requestDirty:tS,errors:tE,canNext:tz,next:()=>{if(!tz){W(!0);return}W(!1),q(e=>Math.min(e+1,2))},back:()=>{W(!1),q(e=>Math.max(e-1,0))},generate:t_,approveAndGenerate:tO,generateDescription:tI,buildBriefRequest:tj,fullExport:tD}}(r,l,i,o),{t:c}=(0,P.Bd)("agent-content-studio"),{isDark:x}=(0,er.D)(),[m,h]=(0,s.useState)(!1),[g,p]=(0,s.useState)(!1),[b,f]=(0,s.useState)(!1);(0,s.useEffect)(()=>{d.internalOnly||f(!1)},[d.internalOnly]);let[v,k]=(0,s.useState)(window.innerWidth>=860);(0,s.useEffect)(()=>{let e=()=>k(window.innerWidth>=860);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let[j,w]=(0,s.useState)("view"),[C,S]=(0,s.useState)(""),T=()=>{S(d.brief),w("edit")},A=async()=>{await d.generate(),w("view")},E=x?aU.dark:aU.light,L=!o,M=!d.brief.trim()||d.requestDirty,R="content"===d.stage||"description"===d.stage,z=R&&!!d.recordId,_=d.brandName?c("report.nameWithBrand",{brand:d.brandName}):c("report.nameFallback"),O=null!==(t=null===(e=d.aiModels.find(e=>e.tag===d.model))||void 0===e?void 0:e.name)&&void 0!==t?t:d.model;return(0,a.jsxs)("div",{style:{...aP,height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},className:"bg-neutral-950 dark:bg-surface text-neutral-200 dark:text-ink-primary",children:[(0,a.jsxs)("header",{className:"border-b border-neutral-800/80 dark:border-border px-6 py-4 flex items-center justify-between shrink-0",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-[15px] font-semibold text-white dark:text-ink-primary leading-tight",children:"Content Studio"}),(0,a.jsxs)("p",{className:"text-[12px] text-neutral-500 dark:text-ink-muted leading-tight",children:["ConvoMind",d.brandName?" \xb7 ".concat(d.brandName):""]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[z&&(0,a.jsxs)(u.$n,{onClick:()=>h(!0),variant:"outline",size:"sm",className:"flex items-center",children:[(0,a.jsx)(ef.A,{className:"w-4 h-4 mr-2"}),c("header.shareWithTeam")]}),(0,a.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] text-neutral-500 dark:text-ink-muted",children:[(0,a.jsx)(ac.A,{size:12,className:"text-indigo-400"})," ",O]})]})]}),(0,a.jsxs)("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:v?"400px 1fr":"1fr",gridTemplateRows:v?"1fr":"auto auto",overflowY:v?"hidden":"auto"},children:[(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},className:v?"border-r border-neutral-800/80 dark:border-border":"border-b border-neutral-800/80 dark:border-border",children:[(0,a.jsx)("div",{className:"px-5 pt-4 pb-3 border-b border-neutral-800/60 dark:border-border shrink-0",children:(0,a.jsx)("div",{className:"flex items-center gap-1.5",children:aH.map((e,t)=>{let r=e.icon,s=t===d.step,l=t<d.step;return(0,a.jsxs)("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[(0,a.jsxs)("button",{onClick:()=>t<d.step&&d.setStep(t),className:"flex items-center gap-1.5 rounded-lg px-2 py-1.5 transition-colors min-w-0 ".concat(s?"bg-sky-500/15 text-sky-300":l?"text-emerald-400 hover:bg-neutral-900":"text-neutral-600"),children:[(0,a.jsx)("span",{className:"h-5 w-5 shrink-0 rounded-md flex items-center justify-center ".concat(s?"bg-sky-500 text-white":l?"bg-emerald-500/20":"bg-neutral-800"),children:l?(0,a.jsx)(W.A,{size:11}):(0,a.jsx)(r,{size:11})}),(0,a.jsx)("span",{className:"text-[12px] font-medium truncate",children:c("steps.".concat(e.key),{defaultValue:e.label})})]}),t<aH.length-1&&(0,a.jsx)("div",{className:"h-px flex-1 ".concat(l?"bg-emerald-500/40":"bg-neutral-800")})]},e.id)})})}),(0,a.jsxs)("div",{style:{flex:1,minHeight:0,overflowY:"auto"},className:"px-5 py-5 space-y-5",children:[d.requestDirty&&o&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3.5 py-2.5 text-[12px] text-amber-200",children:[(0,a.jsx)(rV.A,{size:13,className:"mt-0.5 shrink-0"}),(0,a.jsx)("span",{children:c("notice.stale")})]}),0===d.step&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(aq,{label:c("fields.brandName"),required:!0,error:d.touched?d.errors.brandName:null,children:(0,a.jsx)("input",{value:d.brandName,onChange:e=>d.setBrandName(e.target.value),disabled:L,placeholder:c("fields.brandNamePlaceholder"),className:aV(d.touched&&d.errors.brandName)})}),(0,a.jsx)(aq,{label:c("fields.domain"),required:!0,error:d.touched?d.errors.domain:null,hint:c("fields.domainHint"),children:(0,a.jsx)("input",{value:d.domain,onChange:e=>d.setDomain(e.target.value),disabled:L,placeholder:"https://www.example-store.com",className:aV(d.touched&&d.errors.domain)})}),(0,a.jsx)(aq,{label:c("fields.industry"),required:!0,error:d.touched?d.errors.sector:null,children:(0,a.jsx)(e$.A,{value:d.sector,onChange:e=>{d.setSector(e),p(!1)},onOpen:d.loadIndustries,disabled:L,placeholder:c("common.select"),options:aY(d.industries,d.sector).map(e=>({value:e,label:e}))})}),(0,a.jsx)(aq,{label:c("fields.language"),required:!0,error:g||d.touched?d.errors.lang:null,hint:c("fields.languageHint"),children:(0,a.jsxs)("div",{className:"relative ".concat(d.sector?"":"opacity-60"),children:[(0,a.jsx)(e$.A,{value:d.lang,onChange:d.set
1Lang,onOpen:d.loadIndustries,disabled:L,placeholder:d.sector?c("common.select"):c("fields.languageLocked"),options:aY(d.languages,d.lang).map(e=>({value:e,label:e}))}),!d.sector&&!L&&(0,a.jsx)("button",{type:"button","aria-label":c("fields.languageLocked"),onClick:()=>p(!0),className:"absolute inset-0 z-10 cursor-not-allowed rounded-lg"})]})}),(0,a.jsx)(aq,{label:c("fields.model"),required:!0,error:d.touched?d.errors.model:null,hint:c("fields.modelHint"),children:(0,a.jsx)(e$.A,{value:d.model,onChange:d.setModel,disabled:L,placeholder:c("fields.modelPlaceholder"),options:[...d.aiModels.map(e=>({value:e.tag,label:e.name})),...d.model&&!d.aiModels.some(e=>e.tag===d.model)?[{value:d.model,label:d.model}]:[]]})})]}),1===d.step&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-[12px] text-neutral-500 -mb-1",children:c("fields.rulesIntro")}),(0,a.jsx)(aq,{label:c("fields.brandVoice"),optional:!0,children:(0,a.jsx)("textarea",{value:d.brandVoice,onChange:e=>d.setBrandVoice(e.target.value),disabled:L,rows:8,placeholder:c("fields.brandVoicePlaceholder"),className:aV(!1)+" resize-y"})}),(0,a.jsx)(aq,{label:c("fields.cliches"),optional:!0,hint:c("fields.presetHint"),children:(0,a.jsx)(aJ,{tags:d.cliches,setTags:d.setCliches,disabled:L,placeholder:c("fields.clichesPlaceholder")})}),(0,a.jsx)(aq,{label:c("fields.knownBrands"),optional:!0,hint:c("fields.presetHint"),children:(0,a.jsx)(aJ,{tags:d.knownBrands,setTags:d.setKnownBrands,disabled:L,placeholder:c("fields.knownBrandsPlaceholder")})}),(0,a.jsx)(aq,{label:c("fields.abbr"),optional:!0,hint:c("fields.abbrHint"),children:(0,a.jsxs)("div",{className:"space-y-2",children:[d.abbr.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{value:e.from,onChange:e=>d.setAbbrRow(t,"from",e.target.value),disabled:L,placeholder:c("fields.abbrFromPlaceholder"),className:aV(!1)+" !w-24 text-center"}),(0,a.jsx)(ax.A,{size:14,className:"text-neutral-600 shrink-0"}),(0,a.jsx)("input",{value:e.to,onChange:e=>d.setAbbrRow(t,"to",e.target.value),disabled:L,placeholder:c("fields.abbrToPlaceholder"),className:aV(!1)}),!L&&(0,a.jsx)("button",{onClick:()=>d.setAbbr(d.abbr.filter((e,r)=>r!==t)),className:"text-neutral-600 hover:text-rose-400 shrink-0 p-1",children:(0,a.jsx)(n.A,{size:15})})]},t)),!L&&(0,a.jsxs)("button",{onClick:()=>d.setAbbr([...d.abbr,{from:"",to:""}]),className:"flex items-center gap-1.5 text-[13px] text-sky-400 hover:text-sky-300 transition-colors",children:[(0,a.jsx)(au.A,{size:14})," ",c("fields.addRow")]})]})}),(0,a.jsxs)("div",{className:"rounded-2xl border border-neutral-800 bg-neutral-900/60 p-4 space-y-4",children:[(0,a.jsx)(aW,{on:d.faqSchema,onChange:d.setFaqSchema,disabled:L,label:c("toggles.faqSchema"),desc:c("toggles.faqSchemaDesc")}),d.faqSchema&&(0,a.jsxs)("div",{className:"flex items-center gap-3 pl-[52px]",children:[(0,a.jsx)("span",{className:"text-[13px] text-neutral-400",children:c("fields.minFaq")}),(0,a.jsx)("input",{type:"number",min:3,max:15,value:d.minFaq,onChange:e=>d.setMinFaq(Math.max(3,Math.min(15,Number(e.target.value)||3))),disabled:L,className:aV(!1)+" !w-20 text-center"})]})]})]}),2===d.step&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(aq,{label:c("fields.pageType"),required:!0,children:(0,a.jsx)("div",{className:"space-y-2",children:aF.map(e=>{let t=d.pageType===e.id;return(0,a.jsxs)("button",{type:"button",disabled:L,onClick:()=>d.setPageType(e.id),className:"w-full flex items-center gap-3 rounded-xl border px-3.5 py-2.5 text-left transition-colors disabled:cursor-not-allowed ".concat(t?"border-sky-500/60 bg-sky-500/10":"border-neutral-800 bg-neutral-900 ".concat(L?"opacity-60":"hover:border-neutral-700")),children:[(0,a.jsx)("span",{className:"h-4 w-4 shrink-0 rounded-full border flex items-center justify-center ".concat(t?"border-sky-400":"border-neutral-600"),children:t&&(0,a.jsx)("span",{className:"h-2 w-2 rounded-full bg-sky-400"})}),(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"block text-[14px] font-medium text-neutral-100",children:c("pageTypes.".concat(e.id,".label"),{defaultValue:e.id})}),(0,a.jsx)("span",{className:"block text-[11.5px] text-neutral-500 mt-0.5",children:c("pageTypes.".concat(e.id,".desc"),{defaultValue:e.desc})})]})]},e.id)})})}),d.isProduct&&(0,a.jsx)(aq,{label:c("fields.productName"),required:!0,error:d.touched?d.errors.productName:null,hint:c("fields.productNameHint"),children:(0,a.jsx)("input",{value:d.productName,onChange:e=>d.setProductName(e.target.value),disabled:L,placeholder:c("fields.productNamePlaceholder"),className:aV(d.touched&&d.errors.productName)})}),d.isProduct&&(0,a.jsxs)("div",{className:"rounded-2xl border border-neutral-800 bg-neutral-900/60 p-4 space-y-4",children:[(0,a.jsx)("p",{className:"text-[12px] uppercase tracking-wide text-neutral-500",children:c("fields.pipelineOptions")}),(0,a.jsx)(aW,{on:d.visionOn,onChange:d.setVisionOn,disabled:L,label:c("toggles.vision"),desc:c("toggles.visionDesc")}),d.visionActive&&(0,a.jsxs)("div",{className:"pl-[52px] grid grid-cols-2 items-end gap-3",children:[(0,a.jsx)(aq,{label:c("fields.imageStartTag"),optional:!0,children:(0,a.jsx)("input",{value:d.imageStartTag,onChange:e=>d.setImageStartTag(e.target.value),disabled:L,placeholder:c("fields.imageStartPlaceholder"),className:aV(!1)})}),(0,a.jsx)(aq,{label:c("fields.imageEndTag"),optional:!0,children:(0,a.jsx)("input",{value:d.imageEndTag,onChange:e=>d.setImageEndTag(e.target.value),disabled:L,placeholder:c("fields.imageEndPlaceholder"),className:aV(!1)})})]}),(0,a.jsx)("p",{className:"text-[11px] text-neutral-600 pl-[52px]",children:c("fields.pipelineNote")})]}),(0,a.jsx)(aq,{label:c("fields.url"),required:!0,error:d.touched?d.errors.url:null,children:(0,a.jsx)("input",{value:d.url,onChange:e=>d.setUrl(e.target.value),disabled:L,placeholder:"".concat(d.domain||"https://www.example-store.com","/nike/"),className:aV(d.touched&&d.errors.url)})}),(0,a.jsxs)("div",{className:"rounded-2xl border border-neutral-800 bg-neutral-900/60 p-4 space-y-4",children:[(0,a.jsx)(aW,{on:d.internalOnly,onChange:d.setInternalOnly,disabled:L,label:c("toggles.internalOnly"),desc:c("toggles.internalOnlyDesc")}
1),d.internalOnly&&(0,a.jsx)("div",{className:"pl-[52px]",children:(0,a.jsxs)("button",{type:"button",onClick:()=>f(!0),className:"w-full flex items-center justify-between gap-3 rounded-xl border border-neutral-800 bg-neutral-900 px-3.5 py-2.5 text-left transition-colors hover:border-neutral-700",children:[(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-medium text-neutral-200",children:[(0,a.jsx)(am.A,{size:13,className:"text-sky-400"}),c("urlList.title")]}),(0,a.jsx)("span",{className:"block text-[11.5px] text-neutral-500 mt-0.5",children:d.urlList.length?c("urlList.count",{count:d.urlList.length,max:d.urlLimit}):c("urlList.summaryEmpty")})]}),(0,a.jsx)("span",{className:"shrink-0 text-[12px] text-sky-400",children:L?c("actions.view"):c("urlList.manage")})]})})]})]})]}),(0,a.jsxs)("div",{className:"px-5 py-4 border-t border-neutral-800/60 dark:border-border flex items-center justify-between shrink-0",children:[(0,a.jsxs)("button",{onClick:d.back,disabled:0===d.step||d.busy,className:"flex items-center gap-1.5 rounded-xl px-3.5 py-2 text-[13px] font-medium transition-colors ".concat(0===d.step?"text-neutral-700 cursor-not-allowed":"text-neutral-300 hover:bg-neutral-900"),children:[(0,a.jsx)(ah.A,{size:15})," ",c("actions.back")]}),d.step<2?(0,a.jsxs)("button",{onClick:d.next,className:"flex items-center gap-1.5 rounded-xl px-4 py-2 text-[13px] font-semibold transition-colors ".concat(d.canNext?"bg-sky-500 text-white hover:bg-sky-400":"bg-neutral-800 text-neutral-500"),children:[c("actions.continue")," ",(0,a.jsx)(tg.A,{size:15})]}):(0,a.jsx)("button",{onClick:A,disabled:d.busy||!o,className:"flex items-center gap-2 rounded-xl px-4 py-2 text-[13px] font-semibold transition-colors ".concat(d.busy?"bg-neutral-800 text-neutral-500":"bg-emerald-500 text-white hover:bg-emerald-400"),children:d.busy?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(rZ.A,{size:14,className:"animate-spin"})," ",c("actions.generating")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ag.A,{size:14})," ",c("actions.generateBrief")]})})]})]}),(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},className:"bg-neutral-950 dark:bg-surface",children:[(0,a.jsxs)("div",{style:{minHeight:52},className:"px-6 py-3 border-b border-neutral-800/60 dark:border-border flex items-center justify-between shrink-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:["idle"===d.stage&&(0,a.jsx)("span",{className:"text-[13px] text-neutral-500",children:c("output.title")}),"brief"===d.stage&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ad.A,{size:14,className:"text-amber-400 shrink-0"}),(0,a.jsx)("span",{className:"text-[13px] font-medium text-neutral-200 truncate",children:c("output.briefStage")})]}),"content"===d.stage&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(W.A,{size:14,className:"text-emerald-400 shrink-0"}),(0,a.jsxs)("span",{className:"text-[13px] font-medium text-emerald-300 truncate",children:[c("output.contentReady"),d.url?" â ".concat(d.url):""]})]}),"description"===d.stage&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(W.A,{size:14,className:"text-emerald-400 shrink-0"}),(0,a.jsxs)("span",{className:"text-[13px] font-medium text-emerald-300 truncate",children:[c("output.descriptionReady"),d.url?" â ".concat(d.url):""]})]})]}),"brief"===d.stage&&!d.busy&&(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,a.jsx)(aK,{text:d.brief}),(0,a.jsxs)("button",{onClick:()=>a$("brief.md",d.brief,"text/markdown"),className:"flex items-center gap-1.5 rounded-lg bg-neutral-800 px-2.5 py-1 text-[12px] text-neutral-300 hover:bg-neutral-700 transition-colors",children:[(0,a.jsx)(eV.A,{size:12})," ",c("actions.download")]})]}),R&&d.output&&(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,a.jsx)(aK,{text:d.fullExport,label:c("actions.copyAll")}),(0,a.jsxs)("button",{onClick:()=>a$("description"===d.stage?"product-description.html":"content.html",d.fullExport,"text/html"),className:"flex items-center gap-1.5 rounded-lg bg-emerald-500 px-2.5 py-1 text-[12px] font-medium text-white hover:bg-emerald-400 transition-colors",children:[(0,a.jsx)(eV.A,{size:12})," ",c("actions.downloadHtml")]})]})]}),(0,a.jsxs)("div",{style:{flex:1,minHeight:0,overflowY:"auto"},className:"p-6",children:[d.apiError&&(0,a.jsxs)("div",{className:"mb-4 rounded-xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-[13px] text-rose-300 flex items-center gap-2",children:[(0,a.jsx)(rV.A,{size:14})," ",d.apiError]}),"idle"===d.stage&&!d.busy&&(0,a.jsxs)("div",{style:{minHeight:300},className:"h-full flex flex-col items-center justify-center text-center",children:[(0,a.jsx)("div",{className:"h-12 w-12 rounded-2xl bg-neutral-900 border border-neutral-800 flex items-center justify-center mb-4",children:(0,a.jsx)(ap.A,{size:20,className:"text-neutral-600"})}),(0,a.jsx)("p",{className:"text-[14px] text-neutral-400 mb-1.5",children:c("output.emptyTitle")}),(0,a.jsx)("p",{className:"text-[12px] text-neutral-600 max-w-sm leading-relaxed",children:(0,a.jsx)(P.x6,{t:c,i18nKey:"output.emptyBody",components:{b:(0,a.jsx)("span",{className:"text-neutral-400"}),c:(0,a.jsx)("span",{className:"text-neutral-400"}),d:(0,a.jsx)("span",{className:"text-neutral-400"})}})})]}),d.busy&&(0,a.jsxs)("div",{style:{minHeight:300},className:"h-full flex flex-col items-center justify-center text-center",children:[(0,a.jsx)(rZ.A,{size:24,className:"text-sky-400 animate-spin mb
1-3"}),(0,a.jsx)("p",{className:"text-[14px] text-neutral-300",children:d.busyLabel}),(0,a.jsx)("p",{className:"text-[12px] text-neutral-600 mt-1",children:c("output.busyHint")})]}),"brief"===d.stage&&!d.busy&&(0,a.jsxs)("div",{className:"flex flex-col gap-3 h-full",children:[d.briefWarnings.length>0&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-[12.5px] text-amber-200",children:d.briefWarnings.map(e=>(0,a.jsxs)("p",{className:"flex items-start gap-1.5",children:[(0,a.jsx)(rV.A,{size:13,className:"mt-0.5 shrink-0"}),e]},e))}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[[["view",c("actions.view"),V.A],["edit",c("actions.edit"),ad.A]].map(e=>{let[t,r,s]=e;return(0,a.jsxs)("button",{onClick:()=>{o&&t!==j&&("edit"===t?T():w("view"))},className:"flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] font-medium transition-colors ".concat(j===t?"bg-sky-500/15 text-sky-300":"text-neutral-500 hover:text-neutral-300"," ").concat(o||"edit"!==t?"":"opacity-40 cursor-not-allowed"),children:[(0,a.jsx)(s,{size:13})," ",r]},t)}),(0,a.jsx)("span",{className:"ml-2 text-[11px] text-neutral-600 hidden sm:block",children:"view"===j?c("brief.readOnlyHint"):c("brief.editingHint")}),"edit"===j&&o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)("button",{onClick:()=>{d.setBrief(C),w("view")},className:"flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] font-medium text-neutral-400 hover:text-rose-300 hover:bg-rose-500/10 transition-colors",children:[(0,a.jsx)(n.A,{size:13})," ",c("actions.cancel")]}),(0,a.jsxs)("button",{onClick:()=>w("view"),className:"flex items-center gap-1.5 rounded-lg bg-neutral-800 px-3 py-1.5 text-[13px] font-medium text-neutral-200 hover:bg-neutral-700 transition-colors",children:[(0,a.jsx)(W.A,{size:13})," ",c("actions.done")]})]})]}),"view"===j?(0,a.jsx)("div",{style:{minHeight:380},className:"flex-1 overflow-auto rounded-2xl border border-neutral-800 bg-neutral-900/50 p-5",children:(0,a.jsx)(eq.A,{content:d.brief,messageIndex:0})}):(0,a.jsx)("textarea",{value:d.brief,onChange:e=>d.setBrief(e.target.value),style:{...aB,minHeight:380},className:"flex-1 w-full rounded-2xl border border-neutral-800 bg-neutral-900/50 p-4 text-[12.5px] leading-relaxed text-neutral-200 outline-none resize-none focus:border-sky-500/50 transition-colors"}),o&&(0,a.jsxs)("div",{className:"flex items-center justify-end gap-3",children:[d.requestDirty&&(0,a.jsx)("span",{className:"text-[11.5px] text-amber-300/90",children:c("notice.staleShort")}),(0,a.jsxs)("button",{onClick:d.approveAndGenerate,disabled:M||d.busy,title:d.requestDirty?c("notice.staleShort"):"",className:"flex items-center gap-2 rounded-xl px-5 py-2.5 text-[14px] font-semibold transition-colors ".concat(M?"bg-neutral-800 text-neutral-500 cursor-not-allowed":"bg-emerald-500 text-white hover:bg-emerald-400"),children:[(0,a.jsx)(W.A,{size:15})," ",c("actions.approve")]})]})]}),R&&d.output&&!d.busy&&(0,a.jsxs)("div",{className:"space-y-3",children:[("description"===d.stage?d.descriptionWarnings:d.contentWarnings).length>0&&(0,a.jsx)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-[12.5px] text-amber-200",children:("description"===d.stage?d.descriptionWarnings:d.contentWarnings).map(e=>(0,a.jsxs)("p",{className:"flex items-start gap-1.5",children:[(0,a.jsx)(rV.A,{size:13,className:"mt-0.5 shrink-0"}),e]},e))}),(0,a.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[[["preview",c("tabs.preview"),V.A],["html",c("tabs.html"),ab.A],...d.output.schema?[["schema",c("tabs.schema"),af.A]]:[],...d.brief?[["brief",c("tabs.brief"),ad.A]]:[],...d.sources?[["knowledge",c("tabs.knowledge"),ap.A],["technologies",c("tabs.technologies"),ac.A],["productSource",c("tabs.productSource"),ao.A],...d.sources.visualAnalysis?[["visual",c("tabs.visual"),V.A]]:[]]:[]].map(e=>{let[t,r,s]=e;return(0,a.jsxs)("button",{onClick:()=>d.setTab(t),className:"flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] font-medium transition-colors ".concat(d.tab===t?"bg-sky-500/15 text-sky-300":"text-neutral-500 hover:text-neutral-300"),children:[(0,a.jsx)(s,{size:13})," ",r]},t)}
1),(0,a.jsx)("div",{className:"flex-1"}),o&&(0,a.jsxs)("button",{onClick:()=>{S(d.brief),w("edit"),d.setStage("brief")},className:"flex items-center gap-1.5 rounded-lg bg-neutral-900 border border-neutral-800 px-3 py-1.5 text-[12px] text-neutral-300 hover:border-neutral-700 transition-colors",children:[(0,a.jsx)(ad.A,{size:12})," ",c("actions.editBrief")]})]}),o&&d.isProduct&&"content"===d.stage&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-2xl border border-neutral-800 bg-neutral-900/60 px-4 py-3",children:[(0,a.jsx)("p",{className:"text-[12px] text-neutral-400",children:d.requestDirty?c("notice.staleShort"):c("description.cta")}),(0,a.jsxs)("button",{onClick:d.generateDescription,disabled:d.requestDirty||d.busy,title:d.requestDirty?c("notice.staleShort"):"",className:"flex items-center gap-2 shrink-0 rounded-xl px-4 py-2 text-[13px] font-semibold transition-colors ".concat(d.requestDirty?"bg-neutral-800 text-neutral-500 cursor-not-allowed":"bg-emerald-500 text-white hover:bg-emerald-400"),children:[(0,a.jsx)(ag.A,{size:14})," ",c("actions.generateDescription")]})]}),o&&"description"===d.stage&&(0,a.jsxs)("div",{className:"flex items-center justify-end gap-3",children:[d.requestDirty&&(0,a.jsx)("span",{className:"text-[11.5px] text-amber-300/90",children:c("notice.staleShort")}),(0,a.jsxs)("button",{onClick:d.generateDescription,disabled:d.requestDirty||d.busy,title:d.requestDirty?c("notice.staleShort"):"",className:"flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-[12px] transition-colors ".concat(d.requestDirty?"bg-neutral-900 border-neutral-800 text-neutral-600 cursor-not-allowed":"bg-neutral-900 border-neutral-800 text-neutral-300 hover:border-neutral-700"),children:[(0,a.jsx)(ag.A,{size:12})," ",c("actions.regenerateDescription")]})]}),"preview"===d.tab&&(0,a.jsxs)("div",{className:"rounded-2xl border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated p-6 overflow-auto",children:[(0,a.jsx)("style",{children:"\n .cs-preview { font-size: 14px; line-height: 1.6; color: ".concat(E.text,"; }\n .cs-preview h1, .cs-preview h2, .cs-preview h3, .cs-preview h4 { color: ").concat(E.heading,"; }\n .cs-preview h1 { font-size: 22px; font-weight: 700; margin: 0 0 12px; }\n .cs-preview h2 { font-size: 17px; font-weight: 600; margin: 20px 0 8px; }\n .cs-preview h3 { font-size: 15px; font-weight: 600; margin: 12px 0 4px; }\n .cs-preview p { margin: 0 0 10px; }\n .cs-preview ul, .cs-preview ol { margin: 0 0 10px; padding-left: 22px; }\n .cs-preview li { list-style: disc; margin-bottom: 4px; }\n .cs-preview table { width: 100%; border-collapse: collapse; margin: 12px 0; }\n .cs-preview th { text-align: left; border: 1px solid ").concat(E.border,"; background: ").concat(E.thBg,"; padding: 8px; color: ").concat(E.heading,"; }\n .cs-preview td { border: 1px solid ").concat(E.border,"; padding: 8px; }\n .cs-preview a { color: ").concat(E.link,"; text-decoration: underline; }\n .cs-preview strong { font-weight: 600; color: ").concat(E.heading,"; }\n .cs-preview hr { border: 0; border-top: 1px solid ").concat(E.border,"; margin: 14px 0; }\n .cs-preview blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 3px solid ").concat(E.border,"; }\n .cs-preview code { background: ").concat(E.thBg,"; padding: 1px 4px; border-radius: 4px; }\n ")}),(0,a.jsx)("div",{className:"cs-preview",dangerouslySetInnerHTML:{__html:d.output.html}})]}),"html"===d.tab&&(0,a.jsxs)("div",{className:"rounded-2xl border border-neutral-800 bg-neutral-900/50 overflow-hidden",children:[(0,a.jsx)("div",{className:"flex items-center justify-end px-4 py-2 border-b border-neutral-800",children:(0,a.jsx)(aK,{text:d.output.html})}),(0,a.jsx)("pre",{style:aB,className:"p-4 text-[11.5px] leading-relaxed text-sky-200/90 overflow-auto whitespace-pre-wrap",children:d.output.html})]}
1),"schema"===d.tab&&d.output.schema&&(0,a.jsxs)("div",{className:"rounded-2xl border border-neutral-800 bg-neutral-900/50 overflow-hidden",children:[(0,a.jsx)("div",{className:"flex items-center justify-end px-4 py-2 border-b border-neutral-800",children:(0,a.jsx)(aK,{text:d.output.schema})}),(0,a.jsx)("pre",{style:aB,className:"p-4 text-[11.5px] leading-relaxed text-emerald-200/90 overflow-auto whitespace-pre-wrap",children:d.output.schema})]}),"brief"===d.tab&&d.brief&&(0,a.jsxs)("div",{className:"rounded-2xl border border-neutral-800 bg-neutral-900/50 overflow-hidden",children:[(0,a.jsx)("div",{className:"flex items-center justify-end px-4 py-2 border-b border-neutral-800",children:(0,a.jsx)(aK,{text:d.brief})}),(0,a.jsx)("div",{className:"p-5 overflow-auto",children:(0,a.jsx)(eq.A,{content:d.brief,messageIndex:0})})]}),d.sources&&[["knowledge",d.sources.aiKnowledge],["technologies",d.sources.technologies],["visual",d.sources.visualAnalysis]].map(e=>{let[t,r]=e;return d.tab!==t?null:(0,a.jsxs)("div",{className:"rounded-2xl border border-neutral-800 bg-neutral-900/50 overflow-hidden",children:[(0,a.jsx)("div",{className:"flex items-center justify-end px-4 py-2 border-b border-neutral-800",children:(0,a.jsx)(aK,{text:r})}),(0,a.jsx)("div",{className:"p-5 overflow-auto",children:r?(0,a.jsx)(eq.A,{content:r,messageIndex:0}):(0,a.jsx)("p",{className:"text-[13px] text-neutral-500",children:c("sources.empty")})})]},t)}),"productSource"===d.tab&&d.sources&&(0,a.jsxs)("div",{className:"rounded-2xl border border-neutral-800 bg-neutral-900/50 overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-2 border-b border-neutral-800",children:[(0,a.jsx)("span",{className:"text-[11.5px] text-neutral-500",children:c("sources.rawNote")}),(0,a.jsx)(aK,{text:d.sources.productDescription})]}),d.sources.productDescription?(0,a.jsx)("pre",{style:aB,className:"p-4 text-[11.5px] leading-relaxed text-neutral-300 overflow-auto whitespace-pre-wrap",children:d.sources.productDescription}):(0,a.jsx)("p",{className:"p-5 text-[13px] text-neutral-500",children:c("sources.rawEmpty")})]})]})]})]})]}),(0,a.jsx)(av,{open:b&&d.internalOnly,onClose:()=>f(!1),urls:d.urlList,limit:d.urlLimit,warning:d.urlWarning,setWarning:d.setUrlWarning,addUrls:d.addUrls,removeUrl:d.removeUrl,clearUrls:d.clearUrls,onUpload:d.handleUrlFileUpload,locked:L}),d.showUsageLimitModal&&(0,a.jsx)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/50 p-4",onClick:()=>d.setShowUsageLimitModal(!1),children:(0,a.jsxs)("div",{className:"relative w-full max-w-3xl",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("button",{className:"absolute -top-2 -right-2 z-10 rounded-full bg-white dark:bg-surface-elevated p-2 shadow-lg text-gray-600 dark:text-ink-muted hover:text-gray-900 dark:hover:text-ink-primary transition-colors",onClick:()=>d.setShowUsageLimitModal(!1),"aria-label":c("errors.close"),children:(0,a.jsx)(n.A,{className:"h-5 w-5"})}),(0,a.jsx)(eG.A,{limitType:d.usageLimitType,onClose:()=>d.setShowUsageLimitModal(!1)})]})}),m&&d.recordId&&(0,a.jsx)(es,{itemId:d.recordId,report:{type:"CONTENT_GENERATION",name:_},onClose:()=>h(!1)})]})}var aZ=r(46104);let aQ="https://api-prod.convomind.ai/api/v1",a0=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.find(e=>null!=e)},a1=e=>{var t;return e&&Array.isArray(e.hints)?{id:e.id,adGroupName:null!==(t=a0(e.adGroupName,e.ad_group_name))&&void 0!==t?t:"",intentVerb:a0(e.intentVerb,e.intent_verb),topic:e.topic,stage:e.stage,entryMode:a0(e.entryMode,e.entry_mode),landingPageUrl:a0(e.landingPageUrl,e.landing_page_url),adTitle:a0(e.adTitle,e.ad_title),hints:e.hints,conflictFlag:a0(e.conflictFlag,e.conflict_flag),qaStatus:a0(e.qaStatus,e.qa_status),qaNotes:a0(e.qaNotes,e.qa_notes)}:null},a2=async e=>{let t=await fetch("".concat(aQ,"/agents/context-hints/markets"),{method:"GET",headers:{Accept:"application/json",...e&&{Authorization:"Bearer ".concat(e)}}});if(!t.ok)throw Error("API Error: ".concat(t.status));return await t.json()},a5=async(e,t)=>{try{let a=await fetch("".concat(aQ,"/agents/context-hints"),{method:"POST",headers:{"Content-Type":"application/json",Connection:"keep-alive",...t&&{Authorization:"Bearer ".concat(t)}},body:JSON.stringify(e)});if(!a.ok){let e=await a.json().catch(()=>null);(0,ey.h)(e,a)}let s=await aw(a),l=a1(s);if(!l){var r;let e=Error(null!==(r=null==s?void 0:s.message)&&void 0!==r?r:"REQUEST_FAILED");throw e.errorData=s,e.status=null==s?void 0:s.status,e}return l}catch(e){throw console.error("Failed to generate context hints:",e),e}},a4=e=>/^https?:\/\/[^\s/.]+\.[^\s/]{2,}(\/\S*)?$/i.test(e.trim()),a3=e=>{let t=null==e?"":String(e);return/[",\n]/.test(t)?'"'.concat(t.replace(/"/g,'""'),'"'):t},a6=["ad_group_name","intent_verb","topic","stage","vertical_profile","hint_set_version","hint_index","hint_text","source_intent_unit_ids","lp_url","ad_title","ad_copy_angle","entry_mode","conflict_flag","qa_status","qa_notes"],a8={fontFamily:"-apple-system, BlinkMacSystemFont, 'SF Pro Display', 'DM Sans', 'Segoe UI', sans-serif"},a7={fontFamily:"ui-monospace, 'SF Mono', Menlo, monospace"},a9=["tr","en"],se=e=>"w-full rounded-xl bg-neutral-900 border px-3.5 py-2.5 text-[14px] text-neutral-100 placeholder-neutral-600 outline-none transition-colors disabled:opacity-60 disabled:cursor-not-allowed ".concat(e?"border-rose-500/60 focus:border-rose-400":"border-neutral-800 focus:border-sky-500/70"),st=e=>"".concat(se(e)," focus:ring-0 dark:bg-neutral-900 ").concat(e?"dark:border-rose-500/60 dark:focus:border-rose-400":"dark:border-neutral-800 dark:focus:border-sky-500/70");function sr(e){let{label:t,required:r,optional:s,hint:l,error:n,children:i}=e,{t:o}=(0,P.Bd)("agent-context-hints");return(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-[13px] font-medium text-neutral-300 mb-1.5",children:[t,r&&(0,a.jsx)("span",{className:"text-rose-400",children:"*"}),s&&(0,a.jsx)("span",{className:"text-[11px] font-normal text-neutral-500",children:o("common.optional")})]}),i,n?(0,a.jsxs)("p",{className:"mt-1.5 flex items-center gap-1 text-[12px] text-rose-400",children:[(0,a.jsx)(rV.A,{size:12}),n]}):l?(0,a.jsx)("p",{className:"mt-1.5 text-[12px] text-neutral-500",children:l}):null]})}function sa(e){let{title:t,children:r}=e;return(0,a.jsxs)("section",{className:"space-y-4",children:[(0,a.jsx)("h2",{className:"text-[11px] font-semibold uppercase tracking-wider text-neutral-500",children:t}),r]})}function ss(e){let{tags:t,setTags:r,placeholder:l,disabled:i}=e,{t:o}
1=(0,P.Bd)("agent-context-hints"),[d,c]=(0,s.useState)(""),x=()=>{let e=d.trim();e&&!t.includes(e)&&r([...t,e]),c("")};return(0,a.jsxs)("div",{className:"rounded-xl bg-neutral-900 border border-neutral-800 p-2.5 transition-colors ".concat(i?"opacity-60":"focus-within:border-sky-500/70"),children:[t.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:t.map(e=>(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-lg bg-neutral-800 px-2 py-1 text-[12px] text-neutral-300",children:[e,!i&&(0,a.jsx)("button",{onClick:()=>r(t.filter(t=>t!==e)),className:"text-neutral-500 hover:text-rose-400",children:(0,a.jsx)(n.A,{size:12})})]},e))}),!i&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),x())},placeholder:l,className:"flex-1 bg-transparent text-[13px] text-neutral-200 placeholder-neutral-600 outline-none px-1"}),(0,a.jsx)("button",{onClick:x,className:"rounded-lg bg-neutral-800 px-2.5 py-1 text-[12px] text-neutral-300 hover:bg-neutral-700 transition-colors",children:o("tags.add")})]})]})}function sl(e){let{text:t,label:r}=e,{t:l}=(0,P.Bd)("agent-context-hints"),[n,i]=(0,s.useState)(!1),o=async()=>{try{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),2e3)}catch(e){}};return(0,a.jsxs)("button",{onClick:o,className:"flex items-center gap-1.5 rounded-lg bg-neutral-800 px-2.5 py-1 text-[12px] text-neutral-300 hover:bg-neutral-700 transition-colors",children:[n?(0,a.jsx)(W.A,{size:12,className:"text-emerald-400"}):(0,a.jsx)(rD.A,{size:12}),n?l("actions.copied"):null!=r?r:l("actions.copy")]})}function sn(e){let{label:t,value:r}=e;return r?(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-[11px] text-neutral-500",children:t}),(0,a.jsx)("div",{className:"text-[13px] text-neutral-200 truncate",style:a7,title:r,children:r})]}):null}function si(){var e,t,r;let{initialData:l,initialResponse:i,recordId:o,isEditor:d=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=function(e,t,r){var a,l,n,i,o,d,c,x,u,m,h,g,p,b,f,v,k,j;let w=!(arguments.length>3)||void 0===arguments[3]||arguments[3],{t:C}=(0,P.Bd)("agent-context-hints"),S=(0,y.d4)(e=>e.user),T=null!=e?e:{},A=null!==(l=T.brandContext)&&void 0!==l?l:{},[E,L]=(0,s.useState)(null!==(n=T.clientName)&&void 0!==n?n:""),[M,R]=(0,s.useState)(null!==(i=T.vertical)&&void 0!==i?i:"generic"),[z,_]=(0,s.useState)(null!==(o=T.targetMarket)&&void 0!==o?o:"TR"),[O,I]=(0,s.use
1State)(null!==(d=T.lang)&&void 0!==d?d:"tr"),[D,B]=(0,s.useState)(null!==(c=T.landingPageUrl)&&void 0!==c?c:""),[F,H]=(0,s.useState)(null!==(x=T.landingPageContent)&&void 0!==x?x:""),[U,G]=(0,s.useState)(null!==(u=T.adGroupName)&&void 0!==u?u:""),[q,V]=(0,s.useState)(null!==(m=T.adGroupDescription)&&void 0!==m?m:""),[W,J]=(0,s.useState)(null!==(h=T.evidence)&&void 0!==h?h:""),[K,Y]=(0,s.useState)(null!==(g=A.differentiators)&&void 0!==g?g:[]),[$,X]=(0,s.useState)(null!==(p=A.forbiddenClaims)&&void 0!==p?p:[]),[Z,Q]=(0,s.useState)(null!==(b=A.preferredLanguage)&&void 0!==b?b:[]),[ee,et]=(0,s.useState)(null!==(f=A.avoidLanguage)&&void 0!==f?f:[]),[er,ea]=(0,s.useState)(null!==(v=T.hintCount)&&void 0!==v?v:3),[es,el]=(0,s.useState)(null!==(j=null!==(k=T.aiId)&&void 0!==k?k:null===(a=T.aiNames)||void 0===a?void 0:a[0])&&void 0!==j?j:""),[en,ei]=(0,s.useState)([]),[eo,ed]=(0,s.useState)(()=>a1(t)),[ec,ex]=(0,s.useState)(r),[eu,em]=(0,s.useState)(!1),[eh,eg]=(0,s.useState)(!1),[ep,eb]=(0,s.useState)(""),[ef,ev]=(0,s.useState)(!1),[ey,ek]=(0,s.useState)("budgetExceed");(0,s.useEffect)(()=>{(null==S?void 0:S.token)&&(0,eU.Hs)(S.token,{status:"ACTIVE",agentry:!0}).then(e=>{var t;let r=null!==(t=e.agenticAIs)&&void 0!==t?t:[];ei(r),el(e=>{var t,a;return e||(null!==(a=null===(t=r[0])||void 0===t?void 0:t.tag)&&void 0!==a?a:"")})}).catch(()=>{})},[null==S?void 0:S.token]);let[ej,eN]=(0,s.useState)([]);(0,s.useEffect)(()=>{(null==S?void 0:S.token)&&a2(S.token).then(e=>eN(Array.isArray(e)?e:[])).catch(()=>{})},[null==S?void 0:S.token]);let ew=z.trim().toUpperCase(),eC=!ej.length||!ew||ej.includes(ew),eS=!!ew&&("tr"===O&&"TR"!==ew||"en"===O&&"TR"===ew),eT=U.trim()?"both-fixed":"lp-fixed",eA={clientName:E.trim()?null:C("errors.clientName"),targetMarket:z.trim()?null:C("errors.targetMarket"),lang:O.trim()?null:C("errors.lang"),landingPageUrl:D.trim()?a4(D)?null:C("errors.urlInvalid"):C("errors.urlRequired"),model:es?null:C("errors.model")},eE=Object.values(eA).every(e=>!e),eL=()=>{let e={clientName:E.trim(),vertical:M,targetMarket:z.trim().toUpperCase(),lang:O.trim(),landingPageUrl:D.trim(),hintCount:er,aiId:es};F.trim()&&(e.landingPageContent=F.trim()),U.trim()&&(e.adGroupName=U.trim()),q.trim()&&(e.adGroupDescription=q.trim()),W.trim()&&(e.evidence=W.trim());let t={...K.length?{differentiators:K}:{},...$.length?{forbiddenClaims:$}:{},...Z.length?{preferredLanguage:Z}:{},...ee.length?{avoidLanguage:ee}:{}};return Object.keys(t).length&&(e.brandContext=t),e},eM=(0,s.useCallback)(e=>{if(!e||e===ec)return;ex(e);let t=new URLSearchParams(window.location.search);t.set("agent","context-hints"),t.set("recordId",e),t.set("isEditor","true"),window.history.replaceState(window.history.state,"","?".concat(t.toString()))},[ec]),eR=async()=>{if(!eE){eg(!0);return}eb(""),em(!0);try{let e=await a5(eL(),null==S?void 0:S.token);ed(e),eM(e.id),N.emit()}catch(t){let e=tP(t);e?(ek(e),ev(!0)):eb(tF(t,C,"errors.requestFailed"))}finally{em(!1)}},ez=(0,s.useMemo)(()=>{var e;return(null!==(e=null==eo?void 0:eo.hints)&&void 0!==e?e:[]).map(e=>"".concat(e.index,". ").concat(e.text)).join("\n")},[eo]);return{locked:!w,clientName:E,setClientName:L,vertical:M,setVertical:R,targetMarket:z,setTargetMarket:_,lang:O,setLang:I,landingPageUrl:D,setLandingPageUrl:B,landingPageContent:F,setLandingPageContent:H,adGroupName:U,setAdGroupName:G,adGroupDescription:q,setAdGroupDescription:V,evidence:W,setEvidence:J,differentiators:K,setDifferentiators:Y,forbiddenClaims:$,setForbiddenClaims:X,preferredLanguage:Z,setPreferredLanguage:Q,avoidLanguage:ee,setAvoidLanguage:et,hintCount:er,setHintCount:ea,model:es,setModel:el,aiModels:en,markets:ej,marketSupported:eC,langMismatch:eS,mode:eT,errors:eA,touched:eh,busy:eu,apiError:ep,result:eo,recordId:ec,generate:eR,hintsText:ez,downloadCsv:()=>{if(!eo)return;let e=eo.hints.map(e=>{var t;return[eo.adGroupName,eo.intentVerb,eo.topic,eo.stage,M,"v1",e.index,e.text,e.evidence,null!==(t=eo.landingPageUrl)&&void 0!==t?t:D,eo.adTitle,e.angle,eo.entryMode,eo.conflictFlag,eo.qaStatus,eo.qaNotes].map(a3).join(",")}),t=new Blob(["\uFEFF"+[a6.join(","),...e].join("\n")],{type:"text/csv;charset=utf-8"}),r=URL.createObjectURL(t),a=document.createElement("a");a.href=r,a.download="adgroup-brief-".concat((E||"context-hints").trim().toLowerCase().replace(/\s+/g,"-"),".csv"),a.click(),URL.revokeObjectURL(r)},showUsageLimitModal:ef,setShowUsageLimitModal:ev,usageLimitType:ey}}(l,i,o,d),{t:x}
1=(0,P.Bd)("agent-context-hints"),[m,h]=(0,s.useState)(!1),[g,p]=(0,s.useState)(window.innerWidth>=860);(0,s.useEffect)(()=>{let e=()=>p(window.innerWidth>=860);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let b=c.locked,f=e=>c.touched?c.errors[e]:null,v=null!==(r=null===(e=c.aiModels.find(e=>e.tag===c.model))||void 0===e?void 0:e.name)&&void 0!==r?r:c.model,k=c.result,j=(null==k?void 0:null===(t=k.qaStatus)||void 0===t?void 0:t.toLowerCase())==="pass",w=c.clientName?x("report.nameWithClient",{client:c.clientName}):x("report.nameFallback");return(0,a.jsxs)("div",{style:{...a8,height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},className:"bg-neutral-950 dark:bg-surface text-neutral-200 dark:text-ink-primary",children:[(0,a.jsxs)("header",{className:"border-b border-neutral-800/80 dark:border-border px-6 py-4 flex items-center justify-between shrink-0",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-[15px] font-semibold text-white dark:text-ink-primary leading-tight",children:"Context Hints"}),(0,a.jsxs)("p",{className:"text-[12px] text-neutral-500 dark:text-ink-muted leading-tight",children:[x("header.subtitle"),c.clientName?" \xb7 ".concat(c.clientName):""]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[k&&c.recordId&&(0,a.jsxs)(u.$n,{onClick:()=>h(!0),variant:"outline",size:"sm",className:"flex items-center",children:[(0,a.jsx)(ef.A,{className:"w-4 h-4 mr-2"}),x("header.shareWithTeam")]}),v&&(0,a.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] text-neutral-500 dark:text-ink-muted",children:[(0,a.jsx)(ac.A,{size:12,className:"text-indigo-400"})," ",v]})]})]}),(0,a.jsxs)("div",{style:{flex:1,minHeight:0,display:"grid",gridTemplateColumns:g?"420px 1fr":"1fr",gridTemplateRows:g?"1fr":"auto auto",overflowY:g?"hidden":"auto"},children:[(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},className:g?"border-r border-neutral-800/80 dark:border-border":"border-b border-neutral-800/80 dark:border-border",children:[(0,a.jsxs)("div",{style:{flex:1,minHeight:0,overflowY:"auto"},className:"px-5 py-5 space-y-7",children:[(0,a.jsxs)(sa,{title:x("sections.scope"),children:[(0,a.jsx)(sr,{label:x("fields.clientName"),required:!0,error:f("clientName"),children:(0,a.jsx)("input",{value:c.clientName,onChange:e=>c.setClientName(e.target.value),disabled:b,placeholder:x("fields.clientNamePlaceholder"),className:se(f("clientName"))})}),(0,a.jsx)(sr,{label:x("fields.lang"),required:!0,error:f("lang"),children:(0,a.jsx)(e$.A,{value:c.lang,onChange:c.setLang,disabled:b,options:a9.map(e=>({value:e,label:x("langs.".concat(e))})),triggerClassName:st(f("lang"))})}),(0,a.jsx)(sr,{label:x("fields.targetMarket"),required:!0,error:f("targetMarket"),hint:x("fields.targetMarketHint"),children:(0,a.jsx)("input",{value:c.targetMarket,onChange:e=>c.setTargetMarket(e.target.value.toUpperCase()),disabled:b,maxLength:2,placeholder:"US",className:se(f("targetMarket")),style:a7})}),c.targetMarket.trim()&&!c.marketSupported&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3.5 py-2.5 text-[12px] text-amber-200",children:[(0,a.jsx)(rV.A,{size:13,className:"mt-0.5 shrink-0"}),(0,a.jsx)("span",{children:x("notice.unsupportedMarket",{market:c.targetMarket})})]}),c.langMismatch&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3.5 py-2.5 text-[12px] text-amber-200",children:[(0,a.jsx)(rV.A,{size:13,className:"mt-0.5 shrink-0"}),(0,a.jsx)("span",{children:x("notice.langMismatch",{market:c.targetMarket,lang:x("langs.".concat(c.lang))})})]})]}),(0,a.jsxs)(sa,{title:x("sections.adGroup"),children:[(0,a.jsx)(sr,{label:x("fields.landingPageUrl"),required:!0,error:f("landingPageUrl"),children:(0,a.jsx)("input",{value:c.landingPageUrl,onChange:e=>c.setLandingPageUrl(e.target.value),disabled:b,placeholder:"https://www.example.com/product",className:se(f("landingPageUrl"))})}),(0,a.jsx)(sr,{label:x("fields.landingPageContent"),optional:!0,hint:x("fields.landingPageContentHint"),children:(0,a.jsx)("textarea",{value:c.landingPageContent,onChange:e=>c.setLandingPageContent(e.target.value),disabled:b,rows:5,placeholder:x("fields.landingPageContentPlaceholder"),className:"".concat(se()," resize-y")})}),(0,a.jsx)(sr,{label:x("fields.adGroupName"),optional:!0,hint:x("both-fixed"===c.mode?"fields.adGroupGivenHint":"fields.adGroupEmptyHint"),children:(0,a.jsx)("input",{value:c.adGroupName,onChange:e=>c.setAdGroupName(e.target.value),disabled:b,placeholder:"elektrikli-kompakt-suv | evaluating | solution_aware",className:se()})}),(0,a.jsx)(sr,{label:x("fields.adGroupDescription"),optional:!0,children:(0,a.jsx)("input",{value:c.adGroupDescription,onChange:e=>c.setAdGroupDescription(e.target.value),disabled:b,placeholder:x("fields.adGroupDescriptionPlaceholder"),className:se()})}),(0,a.jsx)(sr,{label:x("fields.hintCount"),required:!0,children:(0,a.jsx)("div",{className:"flex gap-2",children:Array.from({length:3},(e,t)=>3+t).map(e=>(0,a.jsx)("button",{type:"button",disabled:b,onClick:()=>c.setHintCount(e),className:"flex-1 rounded-xl border py-2 text-[14px] font-medium transition-colors disabled:opacity-60 ".concat(c.hintCount===e?"border-sky-500/70 bg-sky-500/15 text-sky-300":"border-neutral-800 bg-neutral-900 text-neutral-400 hover:border-neutral-700"),children:e},e))})})]}),(0,a.jsx)(sa,{title:x("sections.evidence"),children:(0,a.jsx)(sr,{label:x("fields.evidence"),optional:!0,hint:x("fields.evidenceHint"),children:(0,a.jsx)("textarea",{value:c.evidence,onChange:e=>c.setEvidence(e.target.value),disabled:b,rows:5,placeholder:x("fields.evidencePlaceholder"),className:"".concat(se()," resize-y")})})}),(0,a.jsxs)(sa,{title:x("sections.brand"),children:[(0,a.jsx)(sr,{label:x("fields.differentiators"),optional:!0,children:(0,a.jsx)(ss,{tags:c.differentiators,setTags:c.setDifferentiators,placeholder:x("fields.differentiatorsPlaceholder"),disabled:b})}),(0,a.jsx)(sr,{label:x("fields.forbiddenClaims"),optional:!0,children:(0,a.jsx)(ss,{tags:c.forbiddenClaims,setTags:c.setForbiddenClaims,placeholder:x("fields.forbiddenClaimsPlaceholder"),disabled:b})}),(0,a.jsx)(sr,{label:x("fields.preferredLanguage"),optional:!0,children:(0,a.jsx)(ss,{tags:c.preferredLanguage,setTags:c.setPreferredLanguage,placeholder:x("fields.preferredLanguagePlaceholder"),disabled:b})}),(0,a.jsx)(sr,{label:x("fields.avoidLanguage"),optional:!0,children:(0,a.jsx)(ss,{tags:c.avoidLanguage,setTags:c.setAvoidLanguage,placeholder:x("fields.avoidLanguagePlaceholder"),disabled:b})})]}),(0,a.jsx)(sa,{title:x("sections.model"),children:(0,a.jsx)(sr,{label:x("fields.model"),required:!0,error:f("model"),children:(0,a.jsx)(e$.A,{value:c.model,onChange:c.setModel,disabled:b,placeholder:x("fields.modelPlaceholder"),triggerClassName:st(f("model")),options:[...c.aiModels.map(e=>({value:e.tag,label:e.name})),...c.model&&!c.aiModels.some(e=>e.tag===c.model)?[{value:c.model,label:c.model}]:[]]})})})]}),!b&&(0,a.jsxs)("div",{className:"px-5 py-4 border-t border-neutral-800/60 dark:border-border shrink-0 space-y-3",children:[c.apiError&&(0,a.jsxs)("p",{className:"flex items-start gap-1.5 text-[12px] text-rose-400",children:[(0,a.jsx)(rV.A,{size:13,className:"mt-0.5 shrink-0"}),c.apiError]}),(0,a.jsxs)("button",{onClick:c.generate,disabled:c.busy,className:"w-full flex items-center justify-center gap-2 rounded-xl bg-sky-500 hover:bg-sky-400 disabled:opacity-60 disabled:cursor-not-allowed px-4 py-2.5 text-[14px] font-semibold text-white transition-colors",children:[c.busy?(0,a.jsx)(rZ.A,{size:15,className:"animate-spin"}):(0,a.jsx)(ap.A,{size:15}),c.busy?x("actions.generating"):k?x("actions.regenerate"):x("actions.generate")]})]})]}),(0,a.jsx)("div",{style:{minHeight:0,overflowY:"auto"},className:"px-6 py-6",children:c.busy&&!k?(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center gap-3 text-neutral-500",children:[(0,a.jsx)(rZ.A,{size:28,className:"animate-spin text-sky-400"}),(0,a.jsx)("p",{className:"text-[13px]",children:x("busy.generating")})]}):k?(0,a.jsxs)("div",{className:"space-y-5 max-w-8xl ".concat(c.busy?"opacity-50":""),children:[(0,a.jsxs)("div",{className:"rounded-2xl border border-neutral-800 bg-neutral-900/60 p-5 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"text-[11px] uppercase tracking-wider text-neutral-500 mb-1",children:x("result.adGroup")}),(0,a.jsx)("div",{className:"text-[15px] font-semibold text-white break-words",style:a7,children:k.adGroupName})]}),k.entryMode&&(0,a.jsx)("span",{className:"shrink-0 rounded-lg bg-neutral-800 px-2 py-1 text-[11px] text-neutral-300",style:a7,children:k.entryMode})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,a.jsx)(sn,{label:
1x("result.intentVerb"),value:k.intentVerb}),(0,a.jsx)(sn,{label:x("result.stage"),value:k.stage}),(0,a.jsx)(sn,{label:x("result.topic"),value:k.topic}),(0,a.jsx)(sn,{label:x("result.adTitle"),value:k.adTitle})]}),k.landingPageUrl&&(0,a.jsx)("a",{href:k.landingPageUrl,target:"_blank",rel:"noopener noreferrer",className:"block text-[12px] text-sky-400 hover:underline truncate",children:k.landingPageUrl})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-[13px] font-semibold text-neutral-300",children:x("result.hints",{n:k.hints.length})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(sl,{text:c.hintsText,label:x("actions.copyAll")}),(0,a.jsxs)("button",{onClick:c.downloadCsv,className:"flex items-center gap-1.5 rounded-lg bg-neutral-800 px-2.5 py-1 text-[12px] text-neutral-300 hover:bg-neutral-700 transition-colors",children:[(0,a.jsx)(eV.A,{size:12}),x("actions.downloadCsv")]})]})]}),k.hints.map(e=>(0,a.jsx)("div",{className:"rounded-2xl border border-neutral-800 bg-neutral-900/60 p-4",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"mt-0.5 h-6 w-6 shrink-0 rounded-lg bg-sky-500/15 text-sky-300 flex items-center justify-center text-[12px] font-semibold",children:e.index}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,a.jsx)("p",{className:"text-[14px] leading-relaxed text-neutral-100",children:e.text}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[12px] text-neutral-500",children:[e.angle&&(0,a.jsxs)("span",{children:[(0,a.jsxs)("span",{className:"text-neutral-600",children:[x("result.angle"),":"]})," ",e.angle]}),e.evidence&&(0,a.jsxs)("span",{children:[(0,a.jsxs)("span",{className:"text-neutral-600",children:[x("result.evidence"),":"]})," ",e.evidence]})]})]}),(0,a.jsx)(sl,{text:e.text})]})},e.index))]}),k.conflictFlag&&(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-[13px] text-amber-200",children:[(0,a.jsx)(rV.A,{size:14,className:"mt-0.5 shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium mb-0.5",children:x("result.conflict")}),(0,a.jsx)("div",{children:k.conflictFlag})]})]}),k.qaStatus&&(0,a.jsxs)("div",{className:"rounded-xl border px-4 py-3 text-[13px] ".concat(j?"border-emerald-500/30 bg-emerald-500/10 text-emerald-200":"border-rose-500/30 bg-rose-500/10 text-rose-200"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 font-medium mb-1",children:[j?(0,a.jsx)(rW.A,{size:14}):(0,a.jsx)(aZ.A,{size:14}),x("result.qa"),": ",j?"PASS":"FAIL"]}),k.qaNotes&&(0,a.jsx)("p",{className:"text-[12px] opacity-90",children:k.qaNotes})]})]}):(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center gap-3 text-center text-neutral-500 max-w-md mx-auto",children:[(0,a.jsx)(r$.A,{size:32,className:"text-neutral-700"}),(0,a.jsx)("p",{className:"text-[14px] text-neutral-300",children:x("empty.title")}),(0,a.jsx)("p",{className:"text-[12px]",children:x("empty.body")})]})})]}),c.showUsageLimitModal&&(0,a.jsx)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/50 p-4",onClick:()=>c.setShowUsageLimitModal(!1),children:(0,a.jsxs)("div",{className:"relative w-full max-w-3xl",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("button",{className:"absolute -top-2 -right-2 z-10 rounded-full bg-white dark:bg-surface-elevated p-2 shadow-lg text-gray-600 dark:text-ink-muted hover:text-gray-900 dark:hover:text-ink-primary transition-colors",onClick:()=>c.setShowUsageLimitModal(!1),"aria-label":x("errors.close"),children:(0,a.jsx)(n.A,{className:"h-5 w-5"})}),(0,a.jsx)(eG.A,{limitType:c.usageLimitType,onClose:()=>c.setShowUsageLimitModal(!1)})]})}),m&&c.recordId&&(0,a.jsx)(es,{itemId:c.recordId,report:{type:"CONTEXT_HINT",name:w},onClose:()=>h(!1)})]})}let so=e=>{let{selectedCategory:t,categories:r,onTemplateSelect:s,availableAgents:l,disabledPermissions:n}=e,{t:i}=(0,P.Bd)("agents-shell"),o=e=>"All Categories"===e?i("sidebar.allCategories"):i("categories.".concat(e),{defaultValue:null!=e?e:""}),d=e=>{let t=Object.keys(h).find(t=>g[t]===e);return!(!t||!l.includes(t)||n.includes(t))};return t&&"All Categories"!==t.name&&t.templates&&t.templates.length>0?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold dark:text-ink-primary mb-4",children:i("page.categoryTemplates",{category:o(t.name)})}),t.templates.filter(e=>d(e)).map((e,r)=>(0,a.jsxs)("div",{className:"flex items-start gap-3 p-4 rounded-lg border border-gray-200 dark:border-border bg-white dark:bg-surface-elevated cursor-pointer hover:bg-gray-50 dark:hover:bg-surface-active transition-colors",onClick:()=>s(e,t.name),children:[(0,a.jsx)("div",{className:"w-12 h-12 bg-blue-100 dar
1k:bg-blue-900/30 rounded-lg flex items-center justify-center flex-shrink-0",children:(0,a.jsxs)("svg",{className:"w-6 h-6 text-blue-600 dark:text-blue-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,a.jsx)("polyline",{points:"14 2 14 8 20 8"})]})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"font-medium text-lg text-gray-900 dark:text-ink-primary mb-1",children:e}),(0,a.jsx)("div",{className:"text-sm text-gray-600 dark:text-ink-muted",children:b(e,t.name)})]})]},r))]}):t&&"All Categories"!==t.name&&t.templates&&0===t.templates.length?(0,a.jsxs)("div",{className:"text-center py-16 text-gray-500 dark:text-ink-muted",children:[(0,a.jsxs)("svg",{className:"w-16 h-16 mx-auto mb-4 opacity-50",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,a.jsx)("polyline",{points:"14 2 14 8 20 8"})]}),(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-900 dark:text-ink-primary mb-2",children:i("page.noTemplates")}),(0,a.jsx)("p",{children:i("page.noTemplatesInCategory",{category:o(t.name)})})]}):t&&"All Categories"===t.name&&r?(0,a.jsx)("div",{className:"space-y-6",children:r.map((e,t)=>(0,a.jsxs)("div",{className:"border border-gray-200 dark:border-border rounded-lg p-4 bg-white dark:bg-surface-elevated",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)("span",{className:e.color,children:e.icon}),(0,a.jsx)("div",{className:"font-medium text-base text-gray-900 dark:text-ink-primary",children:o(e.name)})]}),e.templates&&e.templates.filter(e=>d(e)).length>0?(0,a.jsx)("div",{className:"space-y-2",children:e.templates.filter(e=>d(e)).map((t,r)=>(0,a.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg border border-gray-100 dark:border-border cursor-pointer hover:bg-gray-50 dark:hover:bg-surface-active transition-colors",onClick:()=>s(t,e.name),children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center flex-shrink-0",children:(0,a.jsxs)("svg",{className:"w-4 h-4 text-blue-600 dark:text-blue-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,a.jsx)("polyline",{points:"14 2 14 8 20 8"})]})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"font-medium text-sm text-gray-900 dark:text-ink-primary",children:t}),(0,a.jsx)("div",{className:"text-xs text-gray-500 dark:text-ink-muted",children:b(t,e.name)})]})]},r))}):(0,a.jsx)("div",{className:"text-sm text-gray-500 dark:text-ink-muted px-1 py-2",children:i("page.noTemplatesHere")})]},t))}):(0,a.jsxs)("div",{className:"text-center py-16 text-gray-500 dark:text-ink-muted",children:[(0,a.jsx)("svg",{className:"w-16 h-16 mx-auto mb-4 opacity-50",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-900 dark:text-ink-primary mb-2",children:i("page.selectCategory")}),(0,a.jsx)("p",{children:i("page.selectCategoryHint")})]})},sd=()=>{let{t:e}=(0,P.Bd)("agents-shell"),t=(0,tf.useRouter)(),[r,l]=(0,s.useState)(null),[n,i]=(0,s.useState)(!0),[o,d]=(0,s.useState)({name:"All Categories",icon:"\uD83D\uDCC1",color:"text-yellow-500"}),c=(0,y.d4)(e=>e.user),[x,u]=(0,s.useState)([]),[p,b]=(0,s.useState)(!0),[f,j]=(0,s.useState)(null),[N,C]=(0,s.useState)([]),[S,T]=(0,s.useState)(!1),[A,L]=(0,s.useState)(()=>{let e=new URLSearchParams(window.location.search).get("queueAgent");return e&&E.includes(e)?e:null}),M=e=>e.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),_=(0,s.useMemo)(()=>{let e=null;
1return(e=new URLSearchParams(window.location.search).get("agent"))&&m.L.filter(e=>e.templates&&e.templates.length>0).flatMap(e=>e.templates).find(t=>M(t)===e)||null},[t.isReady,t.query.agent]);(0,s.useEffect)(()=>{(async()=>{if(null==c?void 0:c.token)try{let e=await (0,Y.YX)(c.token),t=Array.isArray(e)?e.map(e=>e.permission):[];C(t)}catch(e){console.error("Failed to fetch disabled permissions:",e)}})()},[null==c?void 0:c.token]),(0,s.useEffect)(()=>{(async()=>{if(null==c?void 0:c.token)try{var e;let t=await (0,Y.yC)(c.token);u([...null!==(e=t.availableAgents)&&void 0!==e?e:[]])}catch(e){console.error("Failed to fetch user details:",e)}finally{b(!1)}})()},[null==c?void 0:c.token]),(0,s.useEffect)(()=>{if(!p&&_){let e=Object.keys(h).find(e=>g[e]===_);if(e&&!x.includes(e)||e&&N.includes(e)){D(),l(null);return}}},[p,_,x,N]);let I=(0,s.useCallback)((e,t)=>{{let r=new URLSearchParams(window.location.search).get("xTab"),a=new URLSearchParams;a.set("agent",M(e)),(null==t?void 0:t.recordId)&&a.set("recordId",t.recordId),(null==t?void 0:t.isEditor)!==void 0&&a.set("isEditor",String(t.isEditor)),r&&a.set("xTab",r);let s="/agentic-frameworks?".concat(a.toString());window.history.pushState({...window.history.state,as:s,url:s},"",s)}},[]),D=(0,s.useCallback)(()=>{window.history.pushState({...window.history.state,as:"/agentic-frameworks",url:"/agentic-frameworks"},"","/agentic-frameworks")},[]),B=function(){let e=(0,y.d4)(e=>{var t;return null===(t=e.user)||void 0===t?void 0:t.token}),t=(0,v.jE)();return(0,s.useCallback)(r=>t.fetchQuery({queryKey:[...O,r],queryFn:()=>(0,k.N5)(r,e),staleTime:0}),[t,e])}(),F=(0,s.useCallback)(e=>{l(null),L(e),i(!0),t.replace("/agentic-frameworks?sidebarTab=queues&queueAgent=".concat(e),void 0,{shallow:!0})},[t]),H=(0,s.useCallback)(()=>F(w.X_AGENT),[F]),U=(0,s.useCallback)(e=>{var t,r,a,s,n,i;let o=R(e.type);if(!o)return;let d=m.L.filter(e=>{var t;return(null===(t=e.templates)||void 0===t?void 0:t.length)>0}).flatMap(e=>e.templates.map(t=>({name:t,description:"Template for ".concat(e.name.toLowerCase()),category:e.name,categoryIcon:e.icon,categoryColor:e.color}))).find(e=>e.name===o);if(!d)return;let c={},x=null;try{c="string"==typeof e.request?JSON.parse(e.request):null!==(t=e.request)&&void 0!==t?t:{}}catch(e){}try{x="string"==typeof e.response?JSON.parse(e.response):null!==(r=e.response)&&void 0!==r?r:null}catch(t){console.error("response parse error:",t),console.error("raw response string:",e.response)}let u=x;if("CONTENT_CREATION"===e.type){let e=null!==(s=null==x?void 0:x.data)&&void 0!==s?s:x;u={[null!==(n=null==c?void 0:null===(a=c.aiModels)||void 0===a?void 0:a[0])&&void 0!==n?n:"Result"]:e}}I(o,{recordId:e.id,isEditor:e.isEditor}),l({...d,initialData:{...c,aiNames:e.aiNames},initialResponse:u,recordId:e.id,ragCreated:e.ragCreated,isEditor:null===(i=e.isEditor)||void 0===i||i})},[m.L,I]),G=(0,s.useCallback)(async e=>{var t,r,a;let s=null!==(t=null==e?void 0:e.id)&&void 0!==t?t:null==e?void 0:e._id;if(s){T(!0);try{let t=await B(s);U({...t,type:null!==(r=e.type)&&void 0!==r?r:t.type,isEditor:null!==(a=e.isEditor)&&void 0!==a?a:t.isEditor})}catch(e){console.error("Failed to load report detail:",e)}finally{T(!1)}}},[B,U]),q=(0,s.useMemo)(()=>new URLSearchParams(window.location.search).get("recordId"),[t.isReady,t.query.recordId]),V=(0,s.useMemo)(()=>{{let e=new URLSearchParams(window.location.search).get("isEditor");return null===e||"true"===e}},[t.isReady,t.query.isEditor]);(0,s.useEffect)(()=>{if(_&&!r){if(q){(async()=>{T(!0);try{let e=await B(q);U({...e,type:z(_),isEditor:V})}catch(e){console.error("Failed to restore report from URL:",e)}finally{T(!1)}})();return}let e=m.L.filter(e=>e.templates&&e.templates.length>0).flatMap(e=>e.templates.map(t=>({name:t,description:"Template for ".concat(e.name.toLowerCase()),category:e.name,categoryIcon:e.icon,categoryColor:e.color}))).find(e=>e.name===_);e&&l({...e,recordId:null!=q?q:void 0,isEditor:V})}},[_,q,V]);let W=(()=>{var e,t,s;if(!r)return null;switch(r.name){case"NIVEA Analysis":return(0,a.jsx)(tb,{});case"Discover Your Skin":return(0,a.jsx)(th,{setGlobalPromptTitle:e=>{e!==r.name&&l(t=>({...t,name:e}))}});case"Product Outline Brief Generator":return(0,a.jsx)(ts,{initialData:null==r?void 0:r.initialData,initialResponse:null==r?void 0:r.initialResponse,recordId:null==r?void 0:r.recordId});case"Product Research":return(0,a.jsx)(te,{setToggleSidebar:i,initialData:null==r?void 0:r.initialData,initialResponse:null==r?void 0:r.initialResponse,recordId:null==r?void 0:r.recordId});case"Product Long Description Generator":return(0,a.jsx)(tu,{setToggleSidebar:i,initialData:null==r?void 0:r.initialData,initialResponse:null==r?void 0:r.initialResponse,recordId:null==r?void 0:r.recordId});case"Content Brief Generation":return(0,a.jsx)(e5,{initialData:null==r?void 0:r.initialData,initialResponse:null==r?void 0:r.initialResponse,recordId:null==r?void 0:r.recordId});case"Product Scrape & Description Generator":return(0,a.jsx)(tA,{initialData:null==r?void 0:r.initialData,initialResponse:null==r?void 0:r.initialResponse,recordId:null==r?void 0:r.recordId});case"X Intelligence Agent":return(0,a.jsx)(rF,{initialData:null==r?void 0:r.initialData,initialResponse:null==r?void 0:r.initialResponse,recordId:null==r?void 0:r.recordId,ragCreated:null==r?void 0:r.ragCreated,isEditor:null===(e=null==r?void 0:r.isEditor)||void 0===e||e,onOpenQueues:H},(null==r?void 0:r.recordId)||"new");case"Content Studio":return(0,a.jsx)(aX,{initialData:null==r?void 0:r.initialData,initialResponse:null==r?void 0:r.initialResponse,recordId:null==r?void 0:r.recordId,isEditor:null===(t=null==r?void 0:r.isEditor)||void 0===t||t},(null==r?void 0:r.recordId)||"new");case"Context Hints":return(0,a.jsx)(si,{initialData:null==r?void 0:r.initialData,initialResponse:null==r?void 0:r.initialResponse,recordId:null==r?void 0:r.recordId,isEditor:null===(s=null==r?void 0:r.isEditor)||void 0===s||s},(null==r?void 0:r.recordId)||"new");case"Category Finder":return(0,a.jsx)(aa,{});default:return null}})();return(0,a.jsxs)("div",{className:"flex h-full overflow-hidden",style:{width:"0",minWidth:"100%",maxWidth:"100%"},children:[n&&(0,a.jsx)(eh,{onAgentSelect:e=>{L(null),e?I(e.name):D(),l(e)},selectedAgent:r,selectedCategory:o,setSelectedCategory:d,onClose:()=>i(!1),availableAgents:x,loading:p,onSavedReportSelect:G,onOverflowPanel:e=>j(e),disabledPermissions:N,selectedQueueAgent:A,onQueueAgentSelect:F}),f&&(0,a.jsx)(rH,{reports:f.reports,title:f.title,icon:f.icon,onClose:()=>j(null),onSelect:e=>{G(e),j(null)},getDisplayName:Q}),(0,a.jsx)("div",{className:"flex-1 overflow-hidden min-h-0 min-w-0",children:p||S?(0,a.jsxs)("div",{className:"h-full p-6 bg-[#faf9f6] dark:bg-surface",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-800 dark:text-ink-primary mb-6",children:e("page.selectAgent")}),(0,a.jsx)("div",{className:"flex items-center justify-center h-48",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-10 w-10 border-b-2 border-blue-600 dar
1k:border-claude"})})]}):W?(0,a.jsx)("div",{className:"h-full flex flex-col",children:(0,a.jsx)("div",{className:"flex-1 overflow-hidden min-w-0",children:W})}):A?(0,a.jsx)(ai,{agentType:A},A):(0,a.jsxs)("div",{className:"h-full p-6 overflow-y-auto bg-[#faf9f6] dark:bg-surface",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-6",children:(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-800 dark:text-ink-primary",children:e("page.selectAgent")})}),(0,a.jsx)(so,{selectedCategory:o,categories:m.L,onTemplateSelect:(e,t)=>{let r={name:e,description:"Template for ".concat(t.toLowerCase()),category:t};I(e),l(r)},availableAgents:x,disabledPermissions:N})]})})]})}}},e=>{var t=t=>e(e.s=t);e.O(0,[2333,505,9509,1025,2054,4948,2909,7914,6304,6455,9573,2188,4007,8196,9825,3090,8131,636,6593,8792],()=>t(30122)),_N_E=e.O()}]);
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.