1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,665990,52956,579880,e=>{"use strict";var s=e.i(830182),r=e.i(511737),t=e.i(961120),a=e.i(163171),l=e.i(535909),n=e.i(139315),i=e.i(180663),d=e.i(683223),o=e.i(338412),c=e.i(506332);let m=(0,e.i(236066).default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);e.s(["Send",0,m],52956);var u=e.i(172300),x=e.i(970065),p=e.i(167881),h=e.i(630374),f=e.i(23750),g=e.i(184762),b=e.i(28518),j=e.i(371624);function y({error:e,variant:r="error"}){let a=(0,t.useTranslations)("surface.ahtiMessage"),l=e.fromRegistry?e.what:`${a("hedgingPrefix")}${e.what}`,n="warning"===r;return(0,s.jsxs)(j.motion.div,{initial:{opacity:0,scale:.85,y:6},animate:{opacity:1,scale:1,y:0},transition:{type:"spring",stiffness:400,damping:25},className:"flex items-end gap-3",children:[(0,s.jsx)("img",{src:"/ahti-error.png",alt:"",className:"h-20 w-20 object-contain object-bottom shrink-0 self-end"}),(0,s.jsxs)("div",{className:`flex-1 rounded-xl rounded-bl-none px-4 py-3 space-y-1.5 ${n?"bg-lantern-soft":"bg-muted/60 border border-border/50"}`,children:[(0,s.jsx)("p",{className:`text-sm font-semibold leading-snug ${n?"text-lantern-ink":"text-foreground"}`,children:l}),(0,s.jsx)("p",{className:`text-sm leading-snug ${n?"text-lantern-ink/80":"text-muted-foreground"}`,children:e.means}),(0,s.jsx)("p",{className:`text-sm font-medium leading-snug ${n?"text-lantern-ink":"text-foreground"}`,children:e.action})]})]})}var N=e.i(21158);function v({message:e}){let a=(0,t.useTranslations)("surface.response.success"),l=(0,t.useTranslations)("surface.processing.done"),[n]=(0,r.useState)(()=>(0,N.getDoneMessage)(Date.now()));return(0,s.jsxs)(j.motion.div,{initial:{opacity:0,scale:.85,y:6},animate:{opacity:1,scale:1,y:0},transition:{type:"spring",stiffness:400,damping:25},className:"flex items-end gap-3",children:[(0,s.jsx)("img",{src:N.PROCESSING_SUCCESS_IMAGE,alt:"",className:"h-20 w-20 object-contain object-bottom shrink-0 self-end"}),(0,s.jsxs)("div",{className:"flex-1 rounded-xl rounded-bl-none px-4 py-3 bg-sea-glass-soft",children:[(0,s.jsx)("p",{className:"text-sm font-semibold leading-snug",children:a("title")}),(0,s.jsx)("p",{className:"text-sm leading-snug",children:e}),(0,s.jsx)("p",{className:"text-sm leading-snug text-muted-foreground mt-2",children:l(n)})]})]})}function w({children:e}){let t=(0,r.useRef)(null);return(0,r.useEffect)(()=>{t.current?.focus()},[]),(0,s.jsx)("h1",{ref:t,tabIndex:-1,className:"text-xl font-semibold tracking-[-0.015em] text-foreground m-0 mb
1-1.5 outline-none focus-visible:focus-ring",children:e})}function k({children:e}){return(0,s.jsx)("p",{className:"text-sm text-foreground/75 m-0 mb-[18px]",children:e})}function S({succeeded:e,failed:r,hint:a}){let l=(0,t.useTranslations)("surface.response.batch");return(0,s.jsxs)("div",{className:"bg-muted/60 rounded-lg px-3.5 py-2.5 text-xs text-foreground flex items-center flex-wrap gap-x-4 gap-y-1 mb-3.5",children:[(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-sea-glass","aria-hidden":"true"}),l("succeeded",{count:e})]}),r>0&&(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-destructive","aria-hidden":"true"}),l("failed",{count:r})]}),a&&(0,s.jsx)("span",{className:"text-muted-foreground ml-auto",children:a})]})}var C=e.i(647163);function T({status:e,label:r,sub:a,url:l,actionLabel:n,expandable:i,expanded:d,onToggleExpanded:m,children:u}){let x=(0,t.useTranslations)("surface.response.batch"),p="failure"===e,h=n??x(p?"details":"open"),f=(0,C.cn)("block rounded-lg border border-border border-l-[3px] px-3.5 py-3 my-1.5 no-underline text-foreground transition-colors",p?"border-l-destructive":"border-l-primary",l&&"hover:bg-muted/40"),g=(0,C.cn)("inline-block w-1.5 h-1.5 rounded-full shrink-0","failure"===e?"bg-destructive":"success"===e?"bg-sea-glass":"bg-muted-foreground"),b=(0,C.cn)("shrink-0 text-xs font-medium border px-2.5 py-1 rounded-full",p?"text-destructive border-destructive/30":"text-primary border-border dark:text-foreground"),j=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,s.jsx)("span",{className:g,"aria-hidden":"true"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 text-sm",children:[(0,s.jsx)("span",{className:"font-medium",children:r}),a&&(0,s.jsx)("span",{className:(0,C.cn)("ml-1.5 text-xs",p?"text-destructive":"text-muted-foreground"),children:a})]}),l&&(0,s.jsxs)("span",{className:b,children:[h," â"]}),i&&(0,s.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),m?.()},className:"shrink-0 p-1 text-muted-foreground hover:text-foreground","aria-label":x(d?"collapse":"expand"),children:d?(0,s.jsx)(c.ChevronUp,{className:"h-3.5 w-3.5"}):(0,s.jsx)(o.ChevronDown,{className:"h-3.5 w-3.5"})})]}),i&&d&&u]});return l?(0,s.jsx)("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:f,children:j}):(0,s.jsx)("div",{className:f,children:j})}var A=e.i(98318),F=e.i(688782);function P({href:e,children:t,variant:a="primary",fullWidth:l,external:n,download:i,trailingGlyph:d}){let o="primary"===a,[c,m]=(0,r.useState)(e);(0,r.useEffect)(()=>{let s=i?(0,F.resolveDownloadHref)(e):e;m(e=>e===s?e:s)},[i,e]);let u=n??(c.startsWith("http://")||c.startsWith("https://")),x=null===d?null:d??(o?" â":null),p=(0,C.cn)("inline-flex items-center justify-center gap-2 rounded-lg text-sm font-semibold transition-colors no-underline",o?"bg-primary text-primary-foreground px-6 py-3 hover:bg-primary/90":"border border-border text-foreground px-4 py-2 hover:bg-muted",l??o?"w-full":"w-auto"),h=(0,s.jsxs)(s.Fragment,{children:[t,x&&(0,s.jsx)("span",{"aria-hidden":"true",children:x})]});return u||i?(0,s.jsx)("a",{href:c,className:p,target:u?"_blank":void 0,rel:u?"noopener noreferrer":void 0,download:"string"==typeof i?i:i?"":void 0,children:h}):(0,s.jsx)(A.default,{href:e,className:p,children:h})}function L({orgName:e,markUrl:r}){let a=(0,t.useTranslations)("surface.response");return(0,s.jsxs)("div",{className:"bg-primary text-primary-foreground px-6 py-6 flex items-center gap-3",children:[r?(0,s.jsx)("img",{src:r,alt:"",width:32,height:32,className:"block rounded-lg bg-white shrink-0"}):(0,s.jsx)("span",{className:"inline-flex items-center justify-center w-8 h-8 rounded-lg bg-white text-primary text-sm font-bold shrink-0",children:"A"}),(0,s.jsx)("span",{className:"flex-1 text-2xl font-bold tracking-[-0.01em] leading-none [font-family:var(--font-kalam),'Comic_Sans_MS',cursive] truncate",children:e}),(0,s.jsx)("span",{className:"text-eyebrow text-primary-foreground
1/60 shrink-0",children:a("viaAhti")})]})}function U({orgName:e}){let r=(0,t.useTranslations)("surface.response");return(0,s.jsx)("div",{className:"border-t border-border mt-[22px] pt-3.5 text-sm italic text-muted-foreground [font-family:var(--font-kalam),'Comic_Sans_MS',cursive]",children:r("signature",{org:e})})}let D=(0,r.createContext)(void 0);function I(){return(0,r.useContext)(D)}e.s(["ActionRouteProvider",0,function({orgSlug:e,children:r}){return(0,s.jsx)(D.Provider,{value:e,children:r})},"useActionRouteOrgSlug",0,I],579880);var z=e.i(777043);function R({followups:e}){let r=I();return e&&0!==e.length?(0,s.jsx)("div",{className:"flex flex-col gap-2",children:e.map((e,t)=>(0,s.jsx)(P,{href:r?(0,z.toAuthenticatedActionHref)(r,e.href):e.href,variant:0===t?"primary":"secondary",fullWidth:!0,children:e.label},e.id))}):null}function $({file:e}){return e.mimeType.startsWith("image/")?(0,s.jsx)("div",{className:"overflow-hidden rounded-lg border border-border",children:(0,s.jsx)("img",{src:e.downloadUrl,alt:e.fileName,className:"h-auto max-w-full"})}):e.mimeType.startsWith("video/")?(0,s.jsx)("div",{className:"overflow-hidden rounded-lg border border-border",children:(0,s.jsx)("video",{controls:!0,src:e.downloadUrl,className:"h-auto w-full max-w-full"})}):null}function M({reference:e}){let r=(0,t.useTranslations)("surface.backofficeHandoff");return(0,s.jsxs)("div",{className:"rounded-lg border border-primary/25 border-l-[3px] border-l-primary bg-selected px-3.5 py-3 text-sm text-foreground",children:[(0,s.jsx)("p",{className:"font-medium",children:r("accepted")}),(0,s.jsx)("p",{className:"mt-1 text-foreground/75",children:r("reference",{reference:e})})]})}var O=e.i(156075),q=e.i(720460);function W(){let e=(0,t.useTranslations)("surface.response.file"),s=(0,O.useFormat)();return r=>{let t=function(e){if(void 0!==e.expiresAt&&null!==e.expiresAt){let s=new Date(e.expiresAt);if(!Number.isNaN(s.getTime()))return s}let s=function(e){if(!e)return null;let s=e;if(/^https?:\/\//.test(e))try{s=new URL(e).searchParams.get("token")??""}catch{return null}let r=s.split(".");if(3!==r.length||!/^\d+$/.test(r[1]))return null;let t=Number(r[1]);return Number.isSafeInteger(t)?t:null}(e.downloadUrl);return null===s?null:new Date(s)}(r);return t?e("expiresAt",{date:s.dateTime(t)}):e("expiresIn",{time:r.expiresIn})}}function B({responseData:e}){let r=(0,t.useTranslations)("surface.response.generation"),a=(0,O.useFormat)(),l=K(e.generated)?_(e.generated.generated):null,n=K(e.generated)?_(e.generated.skipped):null,i=K(e.generated)?_(e.generated.needsAttention):null;return null===l||null===n||null===i?null:(0,s.jsx)("section",{className:"grid gap-3 sm:grid-cols-3","aria-label":r("label"),children:[["generated",l],["skipped",n],["needsAttention",i]].map(([e,t])=>(0,s.jsxs)("div",{className:"rounded-xl border bg-card p-4",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r(e)}),(0,s.jsx)("p",{className:"mt-1 text-2xl font-semibold",children:a.number(t)})]},e))})}function E({result:e}){let r=(0,t.useTranslations)("surface.response.techPack"),a=W(),l=e.techPackIdentity,n=e.files?.find(e=>"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"===e.mimeType),i=e.files?.find(e=>"application/pdf"===e.mimeType);return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(w,{children:r("title")}),(0,s.jsx)(k,{children:r("identity",{product:l.productKey,season:l.seasonKey})})]}),e.bundle&&(0,s.jsx)(X,{fileName:e.bundle.fileName,size:e.bundle.size,downloadUrl:e.bundle.downloadUrl,primary:!0,primaryLabel:r("downloadBoth"),expiresLabel:a(e.bundle)}),(0,s.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[n&&(0,s.jsx)(X,{fileName:n.fileName,size:n.size,downloadUrl:n.downloadUrl,primary:!1,primaryLabel:r("downloadExcel"),expiresLabel:a(n)}),i&&(0,s.jsx)(X,{fileName:i.fileName,size:i.size,downloadUrl:i.downloadUrl,primary:!1,primaryLabel:r("downloadPdf"),expiresLabel:a(i)})]})]})}function H({result:e}){let r={...K(e.response)?e.response:{},...K(e.data)?e.data:{}},a=K(r.parentPreflight)?r.parentPreflight:K(e.parentPreflight)?e.parentPreflight:{},l=_(a.matchedProducts),n=_(r.productsAttempted??l),i=_(r.productsCreated??a.readyProducts),d=_(r.productsFailed??a.blockedProducts),o=Array.isArray(r.failedParents)?r.failedParents.filter(K):[],c=_(r.groupedPdfCount??e.groupedPdfCount),m=K(r.labelScope)?r.labelScope:K(e.labelScope)?e.labelScope:{},u=[m.brandLabel,m.seasonLabel,m.packageLabel].filter(e=>"string"==typeof e&&e.trim().length>0),x=e.bundle??e.file,p=(e.files??[]).filter(e=>"application/pdf"===e.mimeType),h=(0,q.useServerMessage)(),f=(0,t.useTranslations)("surface.response.labelFiles"),g=W(),j="string"==typeof e.error?e.error:e.error?.what??"",N="string"==typeof e.error?h(e):j,v=Array.isArray(r.labelPackageGroups)?r.labelPackageGroups.filter(K):[],S=Array.isArray(r.noLabelParents)?r.noLabelParents.filter(K):[],C=Array.isArray(r.attentionParents)?r.attentionParents.filter(K):[],T=e=>"string"==typeof e.code?h({code:e.code,params:e.params,message:e.reason},{field:"message",unknownCode:"text"}):String(e.reason??f("needsAttention")),A=v.length>0||K(r.batchPreview)||"number"==typeof r.parentPdfCount||"number"==typeof r.noLabelCount||"number"==typeof r.attentionCount;if(!e.success){let r=/zip|download/i.test(j);return(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(w,{children:r?f("notReadyTitle"):f("failedTitle")}),(0,s.jsx)(k,{children:r?f("zipFailed"):f("noneSaved")}),e.error&&((0,b.isHumanError)(e.error)?(0,s.jsx)(y,{error:e.error,variant:"error"}):(0,s.jsx)("p",{className:"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:N}))]})}if(A){let t=_(r.parentPdfCount),a=_(r.noLabelCount??S.length),l=_(r.attentionCount??C.length),n=e.titleCode?h({code:e.titleCode,params:e.titleParams,message:e.title},{field:"message",unknownCode:"text"}):"string"==typeof e.title?e.title:"string"==typeof r.title?r.title:x?f("readyTitle"):l>0?f("attentionTitle"):f("noneTitle");return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(w,{children:n}),(0,s.jsx)(k,{children:f("batchSummary",{parentPdfs:t,noLabel:a,attention:l})}),0===t&&l>0&&C.map(e=>(0,s.jsxs)("p",{className:"mt-2 text-sm text-destructive",children:[String(e.sku??e.articleCode??f("article")),": ",T(e)
1]},String(e.articleCode)))]}),x&&(0,s.jsx)(X,{fileName:x.fileName,size:x.size,downloadUrl:x.downloadUrl,primary:!0,primaryLabel:f("downloadZip"),expiresLabel:g(x)}),(0,s.jsxs)("section",{className:"space-y-2","aria-labelledby":"label-package-result-title",children:[(0,s.jsx)("h2",{id:"label-package-result-title",className:"text-sm font-semibold",children:f("byPackage")}),v.map(e=>{let r=Array.isArray(e.generatedParents)?e.generatedParents.filter(K):[],t=Array.isArray(e.attentionParents)?e.attentionParents.filter(K):[];return(0,s.jsxs)("details",{className:"rounded-lg border px-3 py-2",children:[(0,s.jsx)("summary",{className:"cursor-pointer list-none text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,s.jsxs)("span",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{children:String(e.packageLabel??e.packageKey??f("labelPackage"))}),(0,s.jsx)("span",{className:"text-xs font-normal text-muted-foreground",children:[f("packageGenerated",{count:r.length}),...t.length>0?[f("packageAttention",{count:t.length})]:[]].join(" · ")})]})}),(0,s.jsxs)("div",{className:"mt-2 space-y-2 border-t pt-2",children:[r.map(e=>{let r=p.find(s=>s.fileName===e.fileName);return(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 text-xs",children:[(0,s.jsxs)("span",{className:"min-w-0 truncate",children:[String(e.label??e.articleCode??f("article"))," ",(0,s.jsxs)("span",{className:"text-muted-foreground",children:["· ",String(e.sku??"")]})]}),r&&(0,s.jsx)(X,{fileName:r.fileName,size:r.size,downloadUrl:r.downloadUrl,primary:!1,primaryLabel:f("downloadPdf"),expiresLabel:g(r)})]},String(e.articleCode??e.fileName))}),t.map(e=>(0,s.jsxs)("div",{className:"rounded-lg bg-lantern-soft px-2 py-1.5 text-xs",children:[String(e.label??e.articleCode??f("article"))," ",(0,s.jsxs)("span",{className:"text-muted-foreground",children:["· ",String(e.sku??"")]}),(0,s.jsx)("span",{className:"ml-2 text-muted-foreground",children:T(e)})]},String(e.articleCode)))]})]},String(e.packageKey))}),S.length>0&&(0,s.jsxs)("details",{className:"rounded-lg border px-3 py-2",children:[(0,s.jsx)("summary",{className:"cursor-pointer list-none text-sm font-medium",children:f("noLabelRequired")}),(0,s.jsx)("div",{className:"mt-2 space-y-1 border-t pt-2 text-xs text-muted-foreground",children:S.map(e=>(0,s.jsxs)("div",{children:[String(e.label??e.articleCode)," ",(0,s.jsxs)("span",{children:["· ",String(e.sku??"")]})]},String(e.articleCode)))})]}),C.length>0&&(0,s.jsxs)("details",{className:"rounded-lg bg-lantern-soft px-3 py-2",children:[(0,s.jsx)("summary",{className:"cursor-pointer list-none text-sm font-medium",children:f("needsAttention")}),(0,s.jsx)("div",{className:"mt-2 space-y-1 border-t pt-2 text-xs text-muted-foreground",children:C.map(e=>(0,s.jsxs)("div",{children:[String(e.label??e.articleCode)," ",(0,s.jsxs)("span",{children:["· ",String(e.sku??"")]}),(0,s.jsx)("span",{className:"ml-2",children:T(e)})]},String(e.articleCode)))})]})]})]})}return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(w,{children:x?f("readyTitle"):f("finishedTitle")}),u.length>0&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:u.join(" · ")}),n>0&&(0,s.jsx)(k,{children:[f("matchedCount",{count:l}),f("attemptedCount",{count:n}),f("withFilesCount",{count:i}),...d>0?[f("withoutFilesCount",{count:d})]:[]].join(" · ")})]}),x&&(0,s.jsx)(X,{fileName:x.fileName,size:x.size,downloadUrl:x.downloadUrl,primary:!0,primaryLabel:f("downloadZip"),expiresLabel:g(x)}),(0,s.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[(0,s.jsx)(G,{label:f("matched"),value:l}),(0,s.jsx)(G,{label:f("attempted"),value:n}),(0,s.jsx)(G,{label:f("withFiles"),value:i,tone:"ready"}),(0,s.jsx)(G,{label:f("withoutFiles"),value:d,tone:"blocked"})]}),o.length>0&&(0,s.jsxs)("details",{className:"rounded-lg bg-lantern-soft px-3 py-2",children:[(0,s.jsx)("summary",{className:"cursor-pointer text-sm font-medium",children:f("viewFailed",{count:o.length})}),(0,s.jsx)("div",{className:"mt-2 max-h-64 space-y-2 overflow-y-auto pr-1",children:o.map(e=>(0,s.jsxs)("div",{className:"rounded-lg border bg-background px-3 py-2 text-xs",children:[(0,s.jsx)("p",{className:"font-medium",children:String(e.label??e.articleCode??f("product"))}),Array.isArray(e.missing)&&e.missing.length>0&&(0,s.jsx)("p",{className:"mt-1 text-muted-foreground",children:f("missing",{fields:e.missing.map(e=>String(e)).join(", ")})})]},String(e.articleCode??e.label)))})]}),(0,s.jsx)("p",{className:"text-sm font-medium",children:f("groupedPdfs",{count:c}
1)}),p.length>0&&(0,s.jsxs)("details",{className:"rounded-lg border border-border/70 px-3 py-2",children:[(0,s.jsx)("summary",{className:"cursor-pointer text-sm font-medium",children:f("showFiles")}),(0,s.jsx)("div",{className:"mt-2 space-y-2",children:p.map(e=>(0,s.jsx)(X,{fileName:e.fileName,size:e.size,downloadUrl:e.downloadUrl,primary:!1,primaryLabel:f("downloadPdf"),expiresLabel:g(e)},e.fileId||e.fileName))})]})]})}function K(e){return!!(e&&"object"==typeof e&&!Array.isArray(e))}function _(e){return"number"==typeof e&&Number.isFinite(e)?e:0}function G({label:e,value:r,tone:t}){let a=(0,O.useFormat)();return(0,s.jsxs)("div",{className:"rounded-lg border px-3 py-2",children:[(0,s.jsx)("p",{className:(0,C.cn)("text-lg font-semibold","ready"===t&&"text-primary","blocked"===t&&"text-lantern-ink"),children:a.number(r)}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e})]})}function J({result:e}){let r=(0,t.useTranslations)("surface.response.qa");return(0,s.jsxs)("div",{className:"space-y-3",children:[e.qaSummary&&(0,s.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 px-3.5 py-3",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:r("title")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r("checked",{rows:e.qaSummary.rowsTranslated,groups:e.qaSummary.groupsChecked})})]}),e.dryRun&&(0,s.jsx)("span",{className:(0,C.cn)("rounded-full px-2 py-1 text-xs font-medium",!1===e.canRunFull?"bg-destructive/10 text-destructive":"bg-selected text-selected-foreground"),children:r(!1===e.canRunFull?"needsReview":"dryRun")})]}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2 text-xs",children:[(0,s.jsx)(Z,{label:r("warnings"),value:e.qaSummary.warningsFound}),(0,s.jsx)(Z,{label:r("blocking"),value:e.qaSummary.blockingFailures}),(0,s.jsx)(Z,{label:r("groups"),value:e.qaSummary.groupsChecked})]}),e.qaSummary.terminologyDecisions&&e.qaSummary.terminologyDecisions.length>0&&(0,s.jsxs)("div",{className:"mt-3 space-y-1",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:r("terminology")}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.qaSummary.terminologyDecisions.map(e=>(0,s.jsx)("span",{className:"rounded-full bg-background px-2 py-1 text-xs text-foreground",children:e},e))})]})]}),e.previewTable&&(0,s.jsxs)("div",{className:"rounded-lg border border-border",children:[(0,s.jsx)("div",{className:"border-b border-border px-3.5 py-2",children:(0,s.jsx)("p",{className:"text-sm font-medium",children:r("previewTitle")})}),(0,s.jsx)("div",{className:"max-h-96 overflow-auto",children:(0,s.jsxs)("table",{className:"w-full min-w-max text-left text-xs",children:[(0,s.jsx)("thead",{className:"sticky top-0 bg-muted text-muted-foreground",children:(0,s.jsx)("tr",{children:e.previewTable.columns.map(e=>(0,s.jsx)("th",{className:"px-3 py-2 font-medium",children:e},e))})}),(0,s.jsx)("tbody",{children:e.previewTable.rows.map((r,t)=>(0,s.jsx)("tr",{className:"border-t border-border/70",children:e.previewTable.columns.map(e=>(0,s.jsx)("td",{className:"max-w-64 px-3 py-2 align-top text-foreground",children:(0,s.jsx)("span",{className:"line-clamp-3 break-words",children:String(r[e]??"")})},e))},t))})]})})]}),(0,s.jsx)(V,{result:e})]})}function Z({label:e,value:r}){let t=(0,O.useFormat)();return(0,s.jsxs)("div",{className:"rounded-lg bg-background px-2 py-1.5",children:[(0,s.jsx)("p",{className:"font-medium text-foreground",children:t.number(r)}),(0,s.jsx)("p",{className:"text-muted-foreground",children:e})]})}let Q={blocking:"severityBlocking",warning:"severityWarning",info:"severityInfo"};function V({result:e}){let r=(0,t.useTranslations)("surface.response.qa"),a=[...e.blockingFindings??[],...e.warnings??[],...e.info??[]];return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-1.5",children:a.slice(0,8).map((e,t)=>(0,s.jsxs)("div",{className:(0,C.cn)("rounded-lg border px-3 py-2 text-xs","blocking"===e.severity?"border-destructive/30 bg-destructive/5 text-destructive":"border-border bg-muted/30 text-foreground"),children:[(0,s.jsx)("p",{className:"font-medium",children:r(Q[e.severity])}),(0,s.jsx)("p",{className:"mt-0.5",children:e.message}),e.suggestedFix&&(0,s.jsx)("p",{className:"mt-1 text-muted-foreground",children:e.suggestedFix})]},`${e.severity}-${e.rowIndex??"all"}-${t}`))})}function X({fileName:e,size:r,downloadUrl:t,primary:a,primaryLabel:n,expiresLabel:i}){let d,o=(0,O.useFormat)();return(0,s.jsxs)("div",{className:"rounded-lg border border-border border-l-[3px] border-l-primary px-3.5 py-3 space-y-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(d={minimumFractionDigits:1,maximumFractionDigits:1},r<1024?`${o.number(r)} B`:r<1048576?`${o.number(r/1024,d)} KB`:`${o.number(r/1048576,d)} MB`)," · ",i]})]}),(0,s.jsxs)(P,{href:t,download:e,external:!1,variant:a?"primary":"secondary",fullWidth:!0,trailingGlyph:null,children:[(0,s.jsx)(l.Download,{className:"h-4 w-4"}),n]})]})}function Y({results:e,successCount:a,failCount:l}){let n=(0,t.useTranslations)("surface.response.batch"),[i,d]=(0,r.useState)(e.length<=5||l>0),o=[...e].sort((e,s)=>{let r="repair"===e.detail;return r!==("repair"===s.detail)?r?1:-1:e.success===s.success?0:e.success?1:-1}),c=e.some(e=>e.externalUrl);return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(S,{succeeded:a,failed:l,hint:c?n("hint"):void 0}),!i&&(0,s.jsx)("button",{onClick:()=>d(!0),className:"text-sm text-primary hover:underline",children:n("showAll",{count:e.length})}),i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"space-y-0 max-h-96 overflow-y-auto -mx-1 px-1",children:o.map((e,r)=>(0,s.jsx)(et,{item:e},r))}),e.length>5&&(0,s.jsx)("button",{onClick:()=>d(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:n("collapse")})]})]})}function ee({result:e,labels:a}){let n=(0,t.useTranslations)("surface.response"),i=e.batchResults??[],d=i.filter(e=>!e.success).length,[o,c]=(0,r.useState)(i.length<=5||d>0),m=o?i:i.slice(0,5),u=new Set(i.flatMap(e=>(e.files??[]).map(e=>e.fileId))),x=e.combinedFile?.fileId,p=(e.supportingFiles??[]).filter(s=>!u.has(s.fileId)&&s.fileId!==x&&s.fileId!==e.bundle?.fileId);return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold",children:a.salesOrders}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:i.length})]}),(e.combinedFile||e.bundle)&&(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[e.combinedFile&&(0,s.jsxs)(P,{href:e.combinedFile.downloadUrl,download:e.comb
1inedFile.fileName,variant:"primary",fullWidth:!1,external:!1,trailingGlyph:null,children:[(0,s.jsx)(l.Download,{className:"h-4 w-4"}),a.downloadCombined]}),e.bundle&&(0,s.jsxs)(P,{href:e.bundle.downloadUrl,download:e.bundle.fileName,variant:"secondary",fullWidth:!1,external:!1,trailingGlyph:null,children:[(0,s.jsx)(l.Download,{className:"h-4 w-4"}),a.downloadAll]})]}),(0,s.jsx)(S,{succeeded:i.filter(e=>e.success).length,failed:d,hint:i.some(e=>e.externalUrl)?n("batch.hint"):void 0}),(0,s.jsx)("div",{className:"space-y-1.5",children:m.map((e,r)=>(0,s.jsx)(es,{item:e,labels:a},`${e.salesOrderId??e.tranId??e.label}-${r}`))}),!o&&i.length>5&&(0,s.jsx)("button",{type:"button",onClick:()=>c(!0),className:"text-sm text-primary hover:underline",children:a.showAll}),o&&i.length>5&&(0,s.jsx)("button",{type:"button",onClick:()=>c(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:n("batch.collapse")}),p.length>0&&(0,s.jsxs)("details",{className:"rounded-lg border border-border px-3.5 py-3",children:[(0,s.jsx)("summary",{className:"cursor-pointer text-sm font-medium",children:a.otherFiles}),(0,s.jsx)("div",{className:"mt-2 space-y-1.5",children:p.map(e=>(0,s.jsx)(er,{file:e,labels:a},e.fileId))})]})]})}function es({item:e,labels:t}){let a=(0,q.useServerMessage)(),[l,n]=(0,r.useState)(!1),i=!!(e.success&&e.details?.lineItems?.length),d=i||!!(e.detail&&e.detail.length>80),m=e.tranId||e.label,u=e.customerName&&e.customerName!==e.label?e.customerName:void 0,x=e.files??[];return(0,s.jsxs)("div",{className:(0,C.cn)("rounded-lg border border-border border-l-[3px] px-3.5 py-3",e.success?"border-l-primary":"border-l-destructive"),children:[(0,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)("span",{className:(0,C.cn)("mt-1.5 inline-block h-1.5 w-1.5 shrink-0 rounded-full",e.success?"bg-sea-glass":"bg-destructive"),"aria-hidden":"true"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[(0,s.jsx)("span",{className:"text-sm font-medium",children:m}),u&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:u})]}),e.detail&&!d&&(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:e.detail}),e.success&&e.externalUrl&&(0,s.jsxs)("a",{href:e.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex text-xs font-medium text-primary hover:underline",children:[t.openInNetSuite," â"]}),!e.success&&e.error&&(0,s.jsx)("p",{className:"mt-1 text-xs text-destructive",children:"string"==typeof e.error?a(e):e.error.what}),e.success&&x.length>0&&(0,s.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:x.map(e=>(0,s.jsx)(er,{file:e,labels:t},e.fileId))})]}),d&&(0,s.jsx)("button",{type:"button",onClick:()=>n(e=>!e),className:"shrink-0 rounded-lg p-1 text-muted-foreground hover:text-foreground","aria-label":l?t.collapse:t.expand,children:l?(0,s.jsx)(c.ChevronUp,{className:"h-3.5 w-3.5"}):(0,s.jsx)(o.ChevronDown,{className:"h-3.5 w-3.5"})})]}),l&&e.detail&&e.detail.length>80&&(0,s.jsx)("p",{className:"mt-2 pl-4 text-xs text-muted-foreground whitespace-pre-wrap wrap-break-word",children:e.detail}),l&&i&&e.details&&(0,s.jsx)(ea,{details:e.details})]})}function er({file:e,labels:r}){let t=e.mimeType.includes("pdf")||e.fileName.toLowerCase().endsWith(".pdf");return(0,s.jsxs)("a",{href:e.downloadUrl,download:e.fileName,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-2 py-1 text-xs font-medium text-foreground hover:bg-muted","aria-label":`${t?r.pdf:r.xlsx}: ${e.fileName}`,title:r.expires(e),children:[(0,s.jsx)(l.Download,{className:"h-3 w-3","aria-hidden":"true"}),t?r.pdf:r.xlsx]})}function et({item:e}){let t=(0,q.useServerMessage)(),[a,l]=(0,r.useState)(!1),n="string"==typeof e.detail?e.detail:void 0,i=!!(n&&n.length>80),d=!!(e.error&&!e.success),o=!!(e.success&&e.details?.lineItems?.length),c=i||d||o,m=function({detailStr:e,isDetailLong:s,item:r,errorText:t}){return e&&!s?e:r.success||"string"!=typeof r.error?void 0:t}
1({detailStr:n,isDetailLong:i,item:e,errorText:t(e)});return(0,s.jsxs)(T,{status:e.success?"success":"failure",label:e.label,sub:m,url:e.externalUrl,expandable:c,expanded:a,onToggleExpanded:()=>l(!a),children:[n&&i&&(0,s.jsx)("p",{className:"mt-2 ml-4 text-xs text-muted-foreground whitespace-pre-wrap wrap-break-word",children:n}),e.error&&!e.success&&(0,s.jsx)("div",{className:"mt-2 ml-4 text-xs text-destructive whitespace-pre-wrap wrap-break-word",children:"string"==typeof e.error?t(e):e.error.what}),o&&e.details&&(0,s.jsx)(ea,{details:e.details})]})}function ea({details:e}){let r=(0,O.useFormat)(),a=(0,t.useTranslations)("surface.response.quickView"),l=s=>e.currency?r.currency(s,e.currency,{maximumFractionDigits:2}):r.number(s,{maximumFractionDigits:2});return(0,s.jsx)("div",{className:"mt-2 ml-4 rounded-lg border border-border/60 bg-muted/30 px-3 py-2",children:(0,s.jsxs)("table",{className:"w-full text-xs tabular-nums",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"text-left text-eyebrow text-muted-foreground",children:[(0,s.jsx)("th",{className:"py-1 pr-3 font-medium",children:a("item")}),(0,s.jsx)("th",{className:"py-1 pr-3 font-medium",children:a("name")}),(0,s.jsx)("th",{className:"py-1 pr-3 font-medium",children:a("size")}),(0,s.jsx)("th",{className:"py-1 pr-3 text-right font-medium",children:a("quantity")}),(0,s.jsx)("th",{className:"py-1 pr-3 text-right font-medium",children:a("rate")}),(0,s.jsx)("th",{className:"py-1 text-right font-medium",children:a("amount")})]})}),(0,s.jsx)("tbody",{children:e.lineItems.map((e,t)=>(0,s.jsxs)("tr",{className:"border-t border-border/40",children:[(0,s.jsx)("td",{className:"py-1 pr-3 font-mono text-xs",children:e.itemCode}),(0,s.jsx)("td",{className:"py-1 pr-3 text-muted-foreground",children:e.displayName??"â"}),(0,s.jsx)("td",{className:"py-1 pr-3 text-muted-foreground",children:e.size??"â"}),(0,s.jsx)("td",{className:"py-1 pr-3 text-right",children:r.number(e.quantity)}),(0,s.jsx)("td",{className:"py-1 pr-3 text-right",children:null!=e.rate?l(e.rate):"â"}),(0,s.jsx)("td",{className:"py-1 text-right",children:null!=e.amount?l(e.amount):"â"})]},`${e.itemCode}-${t}`))}),(0,s.jsx)("tfoot",{children:(0,s.jsxs)("tr",{className:"border-t border-border/60 text-xs text-muted-foreground",children:[(0,s.jsx)("td",{className:"py-1 pr-3",colSpan:3,children:a("total")}),(0,s.jsx)("td",{className:"py-1 pr-3 text-right",children:r.number(e.totalQuantity)}),(0,s.jsx)("td",{className:"py-1 pr-3"}),(0,s.jsx)("td",{className:"py-1 text-right font-medium",children:null!=e.totalAmount?l(e.totalAmount):""})]})})]})})}e.s(["ActionResponseDisplay",0,function({result:e,actionTitle:l,onStartNew:j,embedded:N=!1,standalone:S=!1,orgName:T="Ahti",inputPayload:A,actionId:F,workflowId:D,hideControls:I=!1,onRetryPreview:z,onBack:O,onTryAgain:_}){var G,Z;let Q=(0,t.useTranslations)("surface.response"),es=(0,t.useTranslations)("states"),er=(0,q.useServerMessage)(),et=W(),[ea,el]=(0,r.useState)(!1),[en,ei]=(0,r.useState)(!1),[ed,eo]=(0,r.useState)(!1),[ec,em]=(0,r.useState)(""),[eu,ex]=(0,r.useState)(""),[ep,eh]=(0,r.useState)(!1),[ef,eg]=(0,r.useState)("idle"),[eb,ej]=(0,r.useState)(!1),[ey,eN]=(0,r.useState)(!1),[ev,ew]=(0,r.useState)(""),[ek,eS]=(0,r.useState)(!1),[eC,eT]=(0,r.useState)("idle"),[eA,eF]=(0,r.useState)(!1),eP={success:e.success,message:e.message,error:e.error,file:e.file,response:e.rawResponse},eL=async()=>{if(ec.trim()){eh(!0),eg("idle");try{(await fetch("/api/action-runs/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({recipientEmail:ec.trim(),actionName:l,resultData:eP,notes:eu.trim()||void 0})})).ok?(eg("success"),setTimeout(()=>{eo(!1),em(""),ex(""),ej(!1),eg("idle")},1500)):eg("error")}catch{eg("error")}finally{eh(!1)}}},eU=async()=>{if(ev.trim()){eS(!0),eT("idle");try{(await fetch("/api/action-runs/report-problem",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:ev.trim(),actionTitle:l,actionId:F??null,result:{success:e.success,message:e.message,error:e.error}})})).ok?(eT("success"),setTimeout(()=>{eN(!1),ew(""),eT("idle")},1500)):eT("error")}catch{eT("error")}finally{eS(!1)}}},eD=e.batchResults??[],eI=eD.filter(e=>!e.success).length,ez=eD.length-eI,eR=eD.length>0,e$="create-sales-orders"===D&&"compact-v1"===e.salesOrderPresentation,eM=K(e.response)?e.response:{},eO="create-sales-materials"===D&&"labels"===eM.assetKind,eq="generate-label-files"===D||eO,eW="v1"===e.techPackPresentation&&!!e.techPackIdentity,eB=eR&&ez>0&&eI>0,eE=e.success&&!eB,eH=!e.success||eR&&0===ez&&eI>0,eK=async()=>{let s=e.rawResponse??{success:e.success,message:e.message,data:e.data,error:e.error};try{await navigator.clipboard.writeText(JSON.stringify(s,null,2)),ei(!0),setTimeout(()=>ei(!1),2e3)}catch{console.error("Failed to copy to clipboard")}},e_=async()=>
1{if(e.retry&&z&&!eA){eF(!0);try{await z(e.retry.previewId)}finally{eF(!1)}}},eG=!!e.file||Array.isArray(e.files)&&e.files.length>0,eJ=function({success:e,succeeded:s,failed:r,hasFile:t}){return s+r>0?0===r?1===s?{kind:"allSuccessSingle"}:{kind:"allSuccessMany",count:s}:0===s?1===r?{kind:"allFailureSingle"}:{kind:"allFailureMany",count:r}:{kind:"partial",succeeded:s,failed:r}:e?t?{kind:"fileReady"}:null:{kind:"fullFailure"}}({success:e.success,succeeded:ez,failed:eI,hasFile:eG}),eZ=eJ?function(e,s){switch(s.kind){case"allSuccessSingle":return e("lede.allSuccessSingle");case"allSuccessMany":return e("lede.allSuccessMany",{count:s.count});case"allFailureSingle":return e("lede.allFailureSingle");case"allFailureMany":return e("lede.allFailureMany",{count:s.count});case"partial":return 1===s.failed?e("lede.partialOne",{succeeded:s.succeeded}):e("lede.partialMany",{succeeded:s.succeeded,failed:s.failed});case"fileReady":return e("lede.fileReady");case"fullFailure":return e("lede.fullFailure")}}(Q,eJ):null,eQ=e.message||e.code?er(e,{params:{action:l}}):Q("success.description",{action:l}),eV=function(e,s){let r=(e,r,t)=>({id:e.fileId||e.fileName,fileName:e.fileName,size:e.size,downloadUrl:e.downloadUrl,primary:r,primaryLabel:t,expiresLabel:s.expires(e)});if(e.files&&e.files.length>0){let t=[];for(let a of(e.bundle&&t.push(r(e.bundle,!0,s.downloadAllLabel)),e.files))t.push(r(a,!e.bundle,s.downloadLabel));return t}return e.file?[r(e.file,!0,s.downloadLabel)]:[]}(e,{downloadLabel:Q("file.download"),downloadAllLabel:Q("file.downloadAll"),expires:et}),eX=(e.files??(e.file?[e.file]:[])).filter(e=>e.mimeType.startsWith("image/")||e.mimeType.startsWith("video/")),eY=(G=e,Z=Q("links.viewExternal"),G.externalLinks?.length?G.externalLinks:G.externalUrl?[{url:G.externalUrl,label:Z}]:[]),e0=!!(e.previewTable||e.qaSummary),e1=e.titleCode?er({code:e.titleCode,params:e.titleParams,message:e.title},{field:"message",unknownCode:"text"}):e.title&&e.title.length>0?e.title:l,e3=(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(w,{children:e1}),eZ&&(0,s.jsx)(k,{children:eZ})]}),eE&&(0,s.jsx)(v,{message:eQ}),!eq&&(0,s.jsx)(B,{responseData:eM}),e.backofficeHandoff?.status==="open"&&(0,s.jsx)(M,{reference:e.backofficeHandoff.reference}),e0&&(0,s.jsx)(J,{result:e}),!e0&&(0,s.jsx)(V,{result:e}),eR&&(e$?(0,s.jsx)(ee,{result:e,labels:{salesOrders:Q("batch.salesOrders"),openInNetSuite:Q("batch.openInNetSuite"),showAll:Q("batch.showAllSalesOrders",{count:eD.length}),otherFiles:Q("batch.otherFiles"),downloadCombined:Q("batch.downloadCombined"),downloadAll:Q("batch.downloadAllFiles"),xlsx:Q("batch.xlsx"),pdf:Q("batch.pdf"),download:Q("file.download"),expires:et,expand:Q("batch.expand"),collapse:Q("batch.collapse")}}):(0,s.jsx)(Y,{results:eD,successCount:ez,failCount:eI})),!eE&&(0,b.isHumanError)(e.error)&&(0,s.jsx)(y,{error:e.error,variant:eB?"warning":"error"}),e.retry&&z&&(0,s.jsxs)("div",{className:"rounded-xl border bg-muted/40 p-4",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold",children:Q("retryDestinations.title")}),(0,s.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:Q("retryDestinations.description",{count:e.retry.targetCount})}),(0,s.jsxs)(p.Button,{type:"button",className:"mt-3",variant:"outline",disabled:eA,onClick:()=>void e_(),children:[eA&&(0,s.jsx)(u.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),Q("retryDestinations.button")]})]}),eH&&!(0,b.isHumanError)(e.error)&&e.error&&(0,s.jsx)("div",{className:"rounded-lg border border-destructive/30 border-l-[3px] border-l-destructive bg-muted/60 px-3.5 py-3 text-sm text-foreground",children:"string"==typeof e.error?er(e):Q("error.description")}),eX.length>0&&(0,s.jsx)("div",{className:(0,C.cn)("grid gap-3",eX.length>1&&"md:grid-cols-2"),children:eX.map(e=>(0,s.jsx)($,{file:e},e.fileId||e.fileName))}),!e$&&eV.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:eV.map(({id:e,...r})=>(0,s.jsx)(X,{...r},e))}),e$&&e.artifactWarnings&&e.artifactWarnings.length>0&&(0,s.jsxs)("details",{className:"rounded-lg bg-lantern-soft px-3.5 py-3",children:[(0,s.jsx)("summary",{className:"cursor-pointer text-sm font-medium text-foreground",children:Q("batch.artifactWarnings")}),(0,s.jsx)("ul",{className:"mt-2 space-y-1.5 text-xs text-muted-foreground",children:e.artifactWarnings.map((e,r)=>(0,s.jsx)("li",{children:e},`${e}-${r}`))})]}),(0,s.jsx)(R,{followups:e.followups}),eY.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-2 pt-1",children:eY.map(e=>(0,s.jsx)(P,{href:e.url,variant:"secondary",children:er.knows(e)?er({...e,message:e.label},{field:"message"}):e.label},e.url))})]}),e2=function({embedded:e,standalone:r,orgName:t,mainContent:a}){return e?a:r?(0,s.jsxs)(x.Card,{className:"overflow-hidden p-0 gap-0",children:[(0,s.jsx)(L,{orgName:t}),(0,s.jsxs)(x.CardContent,{className:"p-6 space-y-4",children:[a,(0,s.jsx)(U,{orgName:t})]})]}):(0,s.jsx)(x.Card,{children:(0,s.jsx)(x.CardContent,{className:"p-5",children:a})})}({embedded:N,standalone:S,orgName:T,mainContent:eq?(0,s.jsx)(H,{result:e}):eW?(0,s.jsx)(E,{result:e}):e3});return(0,s.jsxs)("div",{className:(0,C.cn)("space-y-4",N?"":"max-w-2xl mx-auto"),children:[e2,!I&&(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[O&&_&&(0,s.jsx)(p.Button,{onClick:_,className:"flex-1",children:es("tryAgain")}),O&&(0,s.jsx)(p.Button,{onClick:O,className:_?void 0:"flex-1",variant:"outline",children:Q("back")}),j&&!O&&(0,s.jsxs)(p.Button,{onClick:j,className:"flex-1",variant:"outline",children:[(0,s.jsx)(n.RefreshCw,{className:"mr-2 h-4 w-4"}),Q(eq||"create-sales-materials"===D?"generateAnother":"submitAnother")]}),(0,s.jsxs)(p.Button,{onClick:()=>eo(!0),variant:"outline",size:"sm",children:[(0,s.jsx)(m,{className:"mr-2 h-3.5 w-3.5"}),Q("share.button")]}),(0,s.jsxs)(p.Button,{onClick:()=>eN(!0),variant:"outline",size:"sm",children:[(0,s.jsx)(a.AlertTriangle,{className:"mr-2 h-3.5 w-3.5"}),Q("report.button")]})]}),(0,s.jsx)(h.Dialog,{open:ed,onOpenChange:e=>{eo(e),e||(eg("idle"),ej(!1))},children:(0,s.jsxs)(h.DialogContent,{size:"sm",children:[(0,s.jsx)(h.DialogHeader,{children:(0,s.jsx)(h.DialogTitle,{className:"text-base",children:Q("share.title")})}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(f.Input,{type:"email",placeholder:Q("share.emailPlaceholder"),value:ec,onChange:e=>em(e.target.value),disabled:ep,className:"flex-1",onKeyDown:e=>{"Enter"===e.key&&eL()}}),(0,s.jsx)(p.Button,{onClick:eL,disabled:!ec.trim()||ep,size:"default",className:"shrink-0",children:ep?(0,s.jsx)(u.Loader2,{className:"h-4 w-4 animate-spin"}):"success"===ef?(0,s.jsx)(d.Check,{className:"h-4 w-4"}):(0,s.jsx)(m,{className:"h-4 w-4"})})]}),eb?(0,s.jsx)(g.Textarea,{placeholder:Q("share.notesPlaceholder"),value:eu,onChange:e=>ex(e.target.value),disabled:ep,rows:2,className:"text-sm resize-none"}):(0,s.jsxs)("button",{onClick:()=>ej(!0),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:["+ ",Q("share.notesLabel")]}),"success"===ef&&(0,s.jsx)("p",{className:"text-xs text-sea-glass-ink",children:Q("share.sent")}
1),"error"===ef&&(0,s.jsx)("p",{className:"text-xs text-lingon-ink",children:Q("share.error")})]})]})}),(0,s.jsx)(h.Dialog,{open:ey,onOpenChange:e=>{eN(e),e||eT("idle")},children:(0,s.jsxs)(h.DialogContent,{size:"sm",children:[(0,s.jsx)(h.DialogHeader,{children:(0,s.jsx)(h.DialogTitle,{className:"text-base",children:Q("report.title")})}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(g.Textarea,{placeholder:Q("report.placeholder"),value:ev,onChange:e=>ew(e.target.value),disabled:ek,rows:3,className:"text-sm resize-none"}),(0,s.jsxs)(p.Button,{onClick:eU,disabled:!ev.trim()||ek,size:"default",className:"w-full",children:[ek?(0,s.jsx)(u.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):"success"===eC?(0,s.jsx)(d.Check,{className:"mr-2 h-4 w-4"}):(0,s.jsx)(a.AlertTriangle,{className:"mr-2 h-4 w-4"}),Q("report.send")]}),"success"===eC&&(0,s.jsx)("p",{className:"text-xs text-sea-glass-ink",children:Q("report.sent")}),"error"===eC&&(0,s.jsx)("p",{className:"text-xs text-lingon-ink",children:Q("report.error")})]})]})}),null!=e.rawResponse&&(0,s.jsxs)("div",{className:"pt-2",children:[(0,s.jsxs)("button",{onClick:()=>el(!ea),className:"flex items-center gap-1 text-xs text-muted-foreground/60 hover:text-muted-foreground transition-colors",children:[ea?(0,s.jsx)(c.ChevronUp,{className:"h-3 w-3"}):(0,s.jsx)(o.ChevronDown,{className:"h-3 w-3"}),Q("technical.toggle")]}),ea&&(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,s.jsx)("div",{className:"bg-muted/50 rounded-lg p-3 overflow-x-auto",children:(0,s.jsx)("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap wrap-break-word",children:JSON.stringify(e.rawResponse,null,2)})}),(0,s.jsx)("button",{onClick:eK,className:"flex items-center gap-1 text-xs text-muted-foreground/60 hover:text-muted-foreground transition-colors",children:en?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.Check,{className:"h-3 w-3"}),Q("technical.copied")]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Copy,{className:"h-3 w-3"}),Q("technical.copy")]})})]})]})]})}],665990)}]);
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.