1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4085],{14471:(e,t,r)=>{"use strict";r.d(t,{p:()=>x});var a=r(37876),n=r(48230),l=r.n(n),o=r(89023),i=r(44372),s=r(34906),c=r(18050),d=r(42298),u=r(15565),m=r(32411);let p={"no-data":{icon:o.A,titleKey:"emptyState.noDataTitle",descriptionKey:"emptyState.noDataDesc",tint:"text-primary bg-primary/10"},"no-results":{icon:i.A,titleKey:"emptyState.noResultsTitle",descriptionKey:"emptyState.noResultsDesc",tint:"text-accent bg-accent/10"},"no-permission":{icon:s.A,titleKey:"emptyState.noPermissionTitle",descriptionKey:"emptyState.noPermissionDesc",tint:"text-amber-600 bg-amber-500/10"},error:{icon:c.A,titleKey:"emptyState.errorTitle",descriptionKey:"emptyState.errorDesc",tint:"text-red-600 bg-red-500/10"}};function x(e){let{variant:t="no-data",title:r,description:n,icon:o,action:i,hrefAction:s,compact:c,className:x}=e,{t:f}=(0,m.Bd)(),h=p[t],y=null!=o?o:h.icon;return(0,a.jsxs)("div",{className:(0,u.cn)("flex flex-col items-center justify-center rounded-3xl border border-dashed border-border/60 bg-muted/30 text-center",c?"px-5 py-10":"px-6 py-14",x),children:[(0,a.jsx)("div",{className:(0,u.cn)("mb-5 flex items-center justify-center rounded-2xl",c?"h-12 w-12":"h-16 w-16",h.tint),children:(0,a.jsx)(y,{className:c?"h-6 w-6":"h-8 w-8",strokeWidth:1.75})}),(0,a.jsx)("h3",{className:(0,u.cn)("font-semibold text-foreground",c?"text-base":"text-lg"),children:null!=r?r:f(h.titleKey)}),(0,a.jsx)("p",{className:"mt-1.5 max-w-sm text-sm text-muted-foreground",children:null!=n?n:f(h.descriptionKey)}),i&&(0,a.jsx)(d.$,{onClick:i.onClick,className:"mt-6 rounded-xl",children:i.label}),!i&&s&&(0,a.jsx)(d.$,{asChild:!0,className:"mt-6 rounded-xl",children:(0,a.jsx)(l(),{href:s.href,children:s.label})})]})}},15750:(e,t,r)=>{"use strict";r.d(t,{i:()=>s});var a=r(14232),n=r(29395),l=r(69801);async function o(e,t,r){try{let a=await (0,l.hJ)("/api/modules/".concat(e,"/domains/").concat(t),{appTenantId:null!=r?r:void 0,signal:"undefined"!=typeof AbortSignal&&"timeout"in AbortSignal?AbortSignal.timeout(12e3):void 0});if(a.ok){let e=await a.json();if(e.success&&e.data)return{data:e.data,source:"aws"}}}catch(e){}return{data:{module:e,domain:t},source:"aws"}}var i=r(47912);function s(e,t){let{effectiveTenant:r}=(0,n.M)(),[l,s]=(0,a.useState)(null),[c,d]=(0,a.useState)(!0),[u,m]=(0,a.useState)("aws");return(0,a.useEffect)(()=>{let a=!1;return d(!0),(0,i.w)(o(e,t,null==r?void 0:r.id),12e3,()=>({data:{module:e,domain:t},source:"aws"})).then(e=>{let{data:t,source:r}=e;a||(s(t),m(r))}).finally(()=>{a||d(!1)}),()=>{a=!0}},[e,t,null==r?void 0:r.id]),{data:l,loading:c,source:u}}},17796:(e,t,r)=>{"use strict";r.d(t,{f:()=>i});var a=r(37876),n=r(50629),l=r(14471),o=r(32411);function i(e){let{loading:t,error:r,empty:i,emptyTitle:s,emptyDescription:c,emptyIcon:d,emptyAction:u,emptyHrefAction:m,onRetry:p,compact:x,children:f}=e,{t:h}=(0,o.Bd)();return t?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 rounded-3xl border border-dashed border-border/60 bg-muted/20 ".concat(x?"px-5 py-10":"px-6 py-14"),children:[(0,a.jsx)(n.A,{className:"h-5 w-5 animate-spin text-muted-foreground"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:h("crmState.loading")})]}):r?(0,a.jsx)(l.p,{variant:"error",title:h("crmState.errorTitle"),description:r,compact:x,action:p?{label:h("crmState.retry"),onClick:p}:void 0}):i?(0,a.jsx)(l.p,{variant:"no-data",title:null!=s?s:h("crmState.emptyTitle"),description:null!=c?c:h("crmState.emptyDescription"),icon:d,action:u,hrefAction:m,compact:x}):(0,a.jsx)(a.Fragment,{children:f})}},20249:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(18443).A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},21572:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>F});var a=r(37876),n=r(14232),l=r(32411),o=r(15750),i=r(99108),s=r(44204),c=r(59550),d=r(31188),u=r(42298),m=r(17796),p=r(29395),x=r
1(69801);async function f(e){try{return(await e.json()).error||"Request failed (".concat(e.status,")")}catch(t){return"Request failed (".concat(e.status,")")}}async function h(e){try{let t=await (0,x.hJ)("/api/crm/copilot/sessions",{appTenantId:null!=e?e:void 0});if(!t.ok)return{data:[],error:await f(t)};let r=await t.json();if(!r.success)return{data:[],error:r.error||"Failed to load sessions"};return{data:Array.isArray(r.data)?r.data:[],error:null}}catch(e){return{data:[],error:e instanceof Error?e.message:"Network error"}}}async function y(e,t){try{let r=await (0,x.hJ)("/api/crm/copilot/sessions",{method:"POST",appTenantId:null!=t?t:void 0,body:JSON.stringify(e)});if(!r.ok)return{data:null,error:await f(r)};let a=await r.json();if(!a.success)return{data:null,error:a.error||"Failed to create session"};return{data:a.data,error:null}}catch(e){return{data:null,error:e instanceof Error?e.message:"Network error"}}}async function v(e,t){try{let r=await (0,x.hJ)("/api/crm/copilot/sessions/".concat(encodeURIComponent(e),"/messages"),{appTenantId:null!=t?t:void 0});if(!r.ok)return{data:[],error:await f(r)};let a=await r.json();if(!a.success)return{data:[],error:a.error||"Failed to load messages"};return{data:Array.isArray(a.data)?a.data:[],error:null}}catch(e){return{data:[],error:e instanceof Error?e.message:"Network error"}}}async function g(e,t,r){try{let a=await (0,x.hJ)("/api/crm/copilot/sessions/".concat(encodeURIComponent(e),"/messages"),{method:"POST",appTenantId:null!=r?r:void 0,body:JSON.stringify(t)});if(!a.ok)return{data:null,error:await f(a)};let n=await a.json();if(!n.success)return{data:null,error:n.error||"Failed to send message"};return{data:n.data,error:null}}catch(e){return{data:null,error:e instanceof Error?e.message:"Network error"}}}async function b(e,t,r){try{let a=await (0,x.hJ)("/api/crm/copilot/messages/".concat(encodeURIComponent(e)),{method:"PATCH",appTenantId:null!=r?r:void 0,body:JSON.stringify({feedback:t})});if(!a.ok)return{data:null,error:await f(a)};let n=await a.json();if(!n.success)return{data:null,error:n.error||"Failed to save feedback"};return{data:n.data,error:null}}catch(e){return{data:null,error:e instanceof Error?e.message:"Network error"}}}async function j(e,t){try{let r=await (0,x.hJ)("/api/crm/copilot/briefing?accountId=".concat(encodeURIComponent(e)),{appTenantId:null!=t?t:void 0});if(!r.ok)return{data:null,error:await f(r)};let a=await r.json();if(!a.success)return{data:null,error:a.error||"Failed to load briefing"};return{data:a.data,error:null}}catch(e){return{data:null,error:e instanceof Error?e.message:"Network error"}}}async function w(e,t){try{let r=await (0,x.hJ)("/api/crm/copilot/notes",{method:"POST",appTenantId:null!=t?t:void 0,body:JSON.stringify(e)});if(!r.ok)return{data:null,error:await f(r)};let a=await r.json();if(!a.success)return{data:null,error:a.error||"Failed to create note"};return{data:a.data,error:null}}catch(e){return{data:null,error:e instanceof Error?e.message:"Network error"}}}async function C(e,t){try{let r=await (0,x.hJ)("/api/crm/copilot/notes/".concat(encodeURIComponent(e)),{method:"DELETE",appTenantId:null!=t?t:void 0});if(!r.ok)return{ok:!1,error:await f(r)};let a=await r.json();if(!a.success)return{ok:!1,error:a.error||"Failed to delete note"};return{ok:!0,error:null}}catch(e){return{ok:!1,error:e instanceof Error?e.message:"Network error"}}}var N=r(85633),k=r(41810),S=r(77653),T=r(15565),A=r(41632),R=r(20249),_=r(86170),E=r(74719);function F(){var e,t,r,x,f,F,P,D;let{t:M,locale:I}=(0,l.Bd)(),{toast:J}=(0,k.dj)(),{data:K,loading:B,source:$}=(0,o.i)("CRM","intelligence"),{sessions:q,messages:U,activeSessionId:L,setActiveSessionId:Z,briefing:z,loading:H,messagesLoading:G,sending:V,error:W,reload:X,createSession:Q,sendMessage:Y,regenerate:ee,feedback:et,loadBriefing:er,addNote:ea,removeNote:en}=function(){let{effectiveTenant:e}
1=(0,p.M)(),[t,r]=(0,n.useState)([]),[a,l]=(0,n.useState)([]),[o,i]=(0,n.useState)(""),[s,c]=(0,n.useState)(null),[d,u]=(0,n.useState)(!0),[m,x]=(0,n.useState)(!1),[f,N]=(0,n.useState)(!1),[k,S]=(0,n.useState)(null),T=(0,n.useCallback)(async()=>{var t;u(!0),S(null);let a=await h(null==e?void 0:e.id);r(a.data),S(a.error),!o&&(null==(t=a.data[0])?void 0:t.id)&&i(a.data[0].id),u(!1)},[null==e?void 0:e.id,o]);(0,n.useEffect)(()=>{T()},[null==e?void 0:e.id]);let A=(0,n.useCallback)(async t=>{if(!t)return void l([]);x(!0);let r=await v(t,null==e?void 0:e.id);l(r.data),r.error&&S(r.error),x(!1)},[null==e?void 0:e.id]);(0,n.useEffect)(()=>{o&&A(o)},[o,A]);let R=(0,n.useCallback)(async t=>{let a=await y(t,null==e?void 0:e.id);return a.error||!a.data?(S(a.error||"Failed to create session"),!1):(r(e=>[a.data,...e]),i(a.data.id),l([]),!0)},[null==e?void 0:e.id]),_=(0,n.useCallback)(async(t,r)=>{if(!o||!t.trim())return!1;N(!0),S(null);let a=await g(o,{message:t,locale:r},null==e?void 0:e.id);return(N(!1),a.error||!a.data)?(S(a.error||"Failed to send"),!1):(l(e=>{let t=[...e];return a.data.userMessage&&t.push(a.data.userMessage),t.push(a.data.assistantMessage),t}),!0)},[o,null==e?void 0:e.id]),E=(0,n.useCallback)(async(t,r)=>{if(!o)return!1;N(!0),S(null);let a=await g(o,{regenerateFromMessageId:t,locale:r,message:""},null==e?void 0:e.id);return(N(!1),a.error||!a.data)?(S(a.error||"Failed to regenerate"),!1):(await A(o),!0)},[o,null==e?void 0:e.id,A]),F=(0,n.useCallback)(async(t,r)=>{let a=await b(t,r,null==e?void 0:e.id);return a.error||!a.data?(S(a.error||"Failed to save feedback"),!1):(l(e=>e.map(e=>e.id===t?a.data:e)),!0)},[null==e?void 0:e.id]),O=(0,n.useCallback)(async t=>{if(!t)return void c(null);S(null);let r=await j(t,null==e?void 0:e.id);if(r.error){S(r.error),c(null);return}c(r.data)},[null==e?void 0:e.id]);
1return{sessions:t,messages:a,activeSessionId:o,setActiveSessionId:i,briefing:s,loading:d,messagesLoading:m,sending:f,error:k,reload:T,createSession:R,sendMessage:_,regenerate:E,feedback:F,loadBriefing:O,addNote:(0,n.useCallback)(async t=>{let r=await w(t,null==e?void 0:e.id);return r.error||!r.data?(S(r.error||"Failed to save note"),!1):(c(e=>e?{...e,notes:[r.data,...e.notes||[]]}:e),!0)},[null==e?void 0:e.id]),removeNote:(0,n.useCallback)(async t=>{let r=await C(t,null==e?void 0:e.id);return r.ok?(c(e=>e?{...e,notes:(e.notes||[]).filter(e=>e.id!==t)}:e),!0):(S(r.error||"Failed to delete note"),!1)},[null==e?void 0:e.id])}}(),{customers:el}=(0,N.h)(),[eo,ei]=(0,n.useState)("chat"),[es,ec]=(0,n.useState)(""),[ed,eu]=(0,n.useState)(""),[em,ep]=(0,n.useState)(""),[ex,ef]=(0,n.useState)(!1);(0,n.useEffect)(()=>{ed&&er(ed)},[ed,er]);let eh=async()=>{var e;ef(!0);let t=await Q({title:ed&&(null==(e=el.find(e=>e.id===ed))?void 0:e.name)||"Session",accountExternalId:ed||void 0});ef(!1),t&&ei("chat")},ey=async()=>{es.trim()&&(ec(""),await Y(es,I)||ec(es))},ev=async e=>{try{await navigator.clipboard.writeText(e),J({title:M("crmCopilot.copied")})}catch(e){}};return(0,a.jsx)(s.e,{title:M("crmCopilot.title"),subtitle:M("crmCopilot.subtitle"),children:(0,a.jsxs)(i.H,{loading:B,source:$,data:K,children:[(0,a.jsx)(c.k,{title:M("crmCopilot.seoTitle"),description:M("crmCopilot.subtitle")}),(0,a.jsxs)("div",{className:"space-y-6 p-4 sm:p-6 max-w-7xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold",children:M("crmCopilot.title")}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:M("crmCopilot.subtitle")})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[(0,a.jsxs)("select",{className:"rounded-xl border border-border bg-background px-3 py-2 text-sm",value:ed,onChange:e=>eu(e.target.value),children:[(0,a.jsx)("option",{value:"",children:M("crmCopilot.noAccount")}),(el||[]).map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,a.jsx)(u.$,{className:"rounded-xl",disabled:ex,onClick:()=>void eh(),children:M("crmCopilot.newSession")})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 rounded-2xl border border-border bg-card p-1.5",children:[{id:"chat",label:M("crmCopilot.tabChat")},{id:"briefing",label:M("crmCopilot.tabBriefing")}].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>ei(e.id),className:(0,T.cn)("rounded-xl px-4 py-2 text-xs font-semibold transition",eo===e.id?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:e.label},e.id))}),"chat"===eo&&(0,a.jsxs)("div",{className:"grid lg:grid-cols-[220px_1fr] gap-4",children:[(0,a.jsxs)(d.Zp,{className:"p-3 rounded-2xl space-y-2 h-fit",children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-muted-foreground px-1",children:M("crmCopilot.sessions")}),(0,a.jsx)(m.f,{loading:H,error:W,empty:!H&&!W&&0===q.length,emptyTitle:M("crmCopilot.noSessions"),emptyDescription:M("crmCopilot.emptyChatDesc"),onRetry:X,compact:!0,children:(0,a.jsx)("div",{className:"space-y-1 max-h-[420px] overflow-y-auto",children:q.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>Z(e.id),className:(0,T.cn)("w-full text-left rounded-xl px-3 py-2 text-xs font-medium",L===e.id?"bg-primary text-primary-foreground":"hover:bg-muted"),children:e.title},e.id))})})]}),(0,a.jsxs)(d.Zp,{className:"rounded-2xl flex flex-col min-h-[480px]",children:[(0,a.jsx)(m.f,{loading:G&&0===U.length,error:W&&0===U.length?W:null,empty:!G&&!W&&!!L&&0===U.length,emptyTitle:M("crmCopilot.emptyChatTitle"),emptyDescription:M("crmCopilot.emptyChatDesc"),onRetry:()=>X(),children:(0,a.jsxs)("div",{className:"flex-1 space-y-3 p-4 overflow-y-auto max-h-[420px]",children:[!L&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground text-center py-12",children:M("crmCopilot.noSessions")}),U.map(e=>(0,a.jsxs)("div",{className:(0,T.cn)("rounded-2xl px-4 py-3 text-sm whitespace-pre-wrap","user"===e.role?"bg-primary text-primary-foreground ml-8":"bg-muted mr-8"),children:[(0,a.jsx)("p",{children:e.content}),"assistant"===e.role&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 mt-3",children:[(0,a.jsxs)(u.$,{size:"sm",variant:"secondary",onClick:()=>void ev(e.content),children:[(0,a.jsx)(A.A,{className:"h-3.5 w-3.5 mr-1"}),M("crmCopilot.copy")]}),(0,a.jsxs)(u.$,{size:"sm",variant:"secondary",disabled:V,onClick:()=>void ee(e.id,I),children:[(0,a.jsx)(R.A,{className:"h-3.5 w-3.5 mr-1"}),M("crmCopilot.regenerate")]}),(0,a.jsxs)(u.$,{size:"sm",variant:"up"===e.feedback?"default":"secondary",onClick:()=>void et(e.id,"up"===e.feedback?"":"up"),children:[(0,a.jsx)(_.A,{className:"h-3.5 w-3.5 mr-1"}),M("crmCopilot.feedbackUp")]}),(0,a.jsxs)(u.$,{size:"sm",variant:"down"===e.feedback?"default":"secondary",onClick:()=>void et(e.id,"down"===e.feedback?"":"down"),children:[(0,a.jsx)(E.A,{className:"h-3.5 w-3.5 mr-1"}),M("crmCopilot.feedbackDown")]}),(0,a.jsx)("span",{className:"text-[10px] self-center text-muted-foreground",children:"bedrock"===e.source?M("crmCopilot.sourceBedrock"):M("crmCopilot.sourceUnavailable")})]})]},e.id))]})}),(0,a.jsxs)("div",{className:"border-t p-3 flex gap-2",children:[(0,a.jsx)("input",{className:"flex-1 rounded-xl border border-border bg-background px-3 py-2 text-sm",placeholder:M("crmCopilot.placeholder"),value:es,disabled:!L||V,onChange:e=>ec(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ey())}}),(0,a.jsx)(u.$,{className:"rounded-xl",disabled:!L||V||!es.trim(),onClick:()=>void ey(),children:M("crmCopilot.send")})]})]})]}),"briefing"===eo&&(0,a.jsx)(m.f,{loading:!1,error:W,empty:!ed,emptyTitle:M("crmCopilot.emptyBriefingTitle"),emptyDescription:M("crmCopilot.emptyBriefingDesc"),onRetry:X,children:z&&(0,a.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,a.jsxs)(d.Zp,{className:"p-4 rounded-2xl space-y-2",children:[(0,a.jsx)("h3",{className:"font-semibold",children:(null==(e=z.account)?void 0:e.name)||"â"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:[null==(t=z.account)?void 0:t.industry,null==(r=z.account)?void 0:r.country].filter(
1Boolean).join(" \xb7 ")})]}),(0,a.jsx)(O,{title:M("crmCopilot.deals"),empty:!(null==(x=z.deals)?void 0:x.length),children:(z.deals||[]).map(e=>(0,a.jsxs)("li",{className:"text-sm",children:[e.name," \xb7 ",e.stage," \xb7 ",(0,S.Ue)(e.value)," \xb7 ",e.closeDate]},e.id))}),(0,a.jsx)(O,{title:M("crmCopilot.quotes"),empty:!(null==(f=z.quotes)?void 0:f.length),children:(z.quotes||[]).map(e=>(0,a.jsxs)("li",{className:"text-sm",children:[e.id," \xb7 ",e.status," \xb7 ",(0,S.Ue)(e.total)]},e.id))}),(0,a.jsx)(O,{title:M("crmCopilot.activities"),empty:!(null==(F=z.activities)?void 0:F.length),children:(z.activities||[]).slice(0,10).map(e=>(0,a.jsxs)("li",{className:"text-sm",children:["[",e.type,"] ",e.text]},e.id))}),(0,a.jsx)(O,{title:M("crmCopilot.calls"),empty:!(null==(P=z.calls)?void 0:P.length),children:(z.calls||[]).slice(0,10).map(e=>(0,a.jsxs)("li",{className:"text-sm",children:[e.contactName," \xb7 ",e.outcome," â ",e.notes]},e.id))}),(0,a.jsx)(O,{title:M("crmCopilot.approvals"),empty:!(null==(D=z.approvals)?void 0:D.length),children:(z.approvals||[]).map(e=>(0,a.jsxs)("li",{className:"text-sm",children:[e.dealName," \xb7 ",e.status]},e.id))}),(0,a.jsxs)(d.Zp,{className:"p-4 rounded-2xl md:col-span-2 space-y-3",children:[(0,a.jsx)("h3",{className:"font-semibold",children:M("crmCopilot.notes")}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("input",{className:"flex-1 rounded-xl border border-border px-3 py-2 text-sm",placeholder:M("crmCopilot.notePlaceholder"),value:em,onChange:e=>ep(e.target.value)}),(0,a.jsx)(u.$,{disabled:!em.trim()||!ed,onClick:async()=>{await ea({accountExternalId:ed,body:em.trim()})&&(ep(""),J({title:M("crmCopilot.saved")}))},children:M("crmCopilot.addNote")})]}),(0,a.jsx)("ul",{className:"space-y-2",children:(z.notes||[]).map(e=>(0,a.jsxs)("li",{className:"flex items-start justify-between gap-2 rounded-xl border border-border/60 px-3 py-2 text-sm",children:[(0,a.jsxs)("span",{children:[(0,a.jsxs)("span",{className:"font-medium",children:[e.authorName||"â",": "]}),e.body]}),(0,a.jsx)(u.$,{size:"sm",variant:"ghost",onClick:()=>void en(e.id),children:M("crmCopilot.deleteNote")})]},e.id))})]})]})})]})]})})}function O(e){let{title:t,empty:r,children:n}=e;return(0,a.jsxs)(d.Zp,{className:"p-4 rounded-2xl space-y-2",children:[(0,a.jsx)("h3",{className:"font-semibold",children:t}),r?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"â"}):(0,a.jsx)("ul",{className:"space-y-1",children:n})]})}},22586:(e,t,r)=>{"use strict";r.d(t,{VF:()=>s,sG:()=>c});var a=r(37876),n=r(14232),l=r(76423),o=r(15565);let i=(0,n.createContext)(!1);function s(e){let{active:t,children:r}=e;return(0,a.jsx)(i.Provider,{value:t,children:r})}function c(e){let{className:t,source:r="aws"}=e;return(0,n.useContext)(i)||"mock"===r?null:(0,a.jsx)(l.E,{variant:"outline",className:(0,o.cn)("text-[10px] font-semibold uppercase tracking-wide","border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",t),children:"Live data"})}},31188:(e,t,r)=>{"use strict";r.d(t,{BT:()=>c,Wu:()=>d,ZB:()=>s,Zp:()=>o,aR:()=>i,wL:()=>u});var a=r(37876),n=r(14232),l=r(15565);let o=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("rounded-2xl bg-card text-card-foreground ring-1 ring-border/40 shadow-[0_10px_30px_-12px_rgba(15,23,42,0.18),0_3px_10px_-3px_rgba(15,23,42,0.08)] transition-shadow duration-300 hover:shadow-[0_18px_40px_-14px_rgba(15,23,42,0.24),0_5px_14px_-4px_rgba(15,23,42,0.10)]",r),...n})});o.displayName="Card";let i=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",r),...n})});i.displayName="CardHeader";let s=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("font-semibold leading-none tracking-tight",r),...n})});s.displayName="CardTitle";let c=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",r),...n})});c.displayName="CardDescription";let d=n.forwardRef((e,t)=>
1{let{className:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",r),...n})});d.displayName="CardContent";let u=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,a.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",r),...n})});u.displayName="CardFooter"},41632:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(18443).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},44372:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(18443).A)("SearchX",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},47912:(e,t,r)=>{"use strict";function a(e,t,r){return new Promise(a=>{let n=!1,l=setTimeout(()=>{n||(n=!0,a(r()))},t);e.then(e=>{n||(n=!0,clearTimeout(l),a(e))},()=>{n||(n=!0,clearTimeout(l),a(r()))})})}r.d(t,{w:()=>a})},48244:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/crm/copilot",function(){return r(21572)}])},59550:(e,t,r)=>{"use strict";r.d(t,{k:()=>d});var a=r(37876),n=r(77328),l=r.n(n);function o(e){return e.replace(/\/$/,"")}function i(){return o("https://cmoalto.cmogroup.io")}r(65364);let s=i();!function(){let e="https://cmoalto.cmogroup.io";e?o(e):i()}();let c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",t=e.startsWith("/")?e:"/".concat(e);return"".concat(s).concat(t)}("/brand/og-image.png");function d(e){let{title:t="CMO ALTO",description:r="CMO ALTO â Global ERP SaaS for enterprise operations, finance, HR, CRM, and more.",image:n=c,url:o=s}=e;return(0,a.jsxs)(l(),{children:[(0,a.jsx)("title",{children:t}),(0,a.jsx)("meta",{name:"description",content:r}),(0,a.jsx)("link",{rel:"icon",href:"/favicon.ico"}),(0,a.jsx)("meta",{property:"og:title",content:t}),(0,a.jsx)("meta",{property:"og:description",content:r}),n&&(0,a.jsx)("meta",{property:"og:image",content:n}),o&&(0,a.jsx)("meta",{property:"og:url",content:o}),(0,a.jsx)("meta",{property:"og:type",content:"website"}),(0,a.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,a.jsx)("meta",{name:"twitter:title",content:t}),(0,a.jsx)("meta",{name:"twitter:description",content:r}),n&&(0,a.jsx)("meta",{name:"twitter:image",content:n})]})}},64453:(e,t,r)=>{"use strict";r.d(t,{OP:()=>o,SS:()=>c,sf:()=>l,yA:()=>d});var a=r(31241);let n={};function l(){for(let e of Object.keys(n))delete n[e]}function o(e){l(),e&&function e(t,r){for(let[a,l]of(r&&(n[r]=t),Object.entries(t))){let t=r?"".concat(r,".").concat(a):a;null===l||"object"!=typeof l||Array.isArray(l)?n[t]=l:e(l,t)}}(e,"")}function i(e){return Object.prototype.hasOwnProperty.call(n,e)}function s(e){if(Array.isArray(e))return[];if(null==e)return e;if("string"==typeof e)return"â";if("number"==typeof e)return 0;if("boolean"==typeof e)return!1;if("object"==typeof e){let t={};for(let[r,a]of Object.entries(e))t[r]=s(a);return t}return e}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return new Proxy((0,a.t4)()?[]:t,{get(t,r){let a=i(e)?n[e]:t,l=Array.isArray(a)?a:t,o=Reflect.get(l,r);return"function"==typeof o?o.bind(l):o}})}function d(e,t){return new Proxy(t,{get(t,r){if(i(e)){let l=n[e];return l&&"object"==typeof l&&r in l?Reflect.get(l,r):(0,a.t4)()?s(Reflect.get(t,r)):Reflect.get(t,r)}return(0,a.t4)()?s(Reflect.get(t,r)):Reflect.get(t,r)}})}},77328:(e,t,r)=>{e.exports=r(29269)},85633:(e,t,r)=>{"use strict";r.d(t,{h:()=>i});var a=r(14232),n=r(29395),l=r(79270),o=r(47912);function i(e){var t;let{effectiveTenant:r}=(0,n.M)(),i=null!=(t=null==e?void 0:e.lifecycleStage)?t:"Customer",[s,c]=(0,a.useState)([]),[d,u]=(0,a.useState)(!0),[m,p]=(0,a.useState)(!1),[x,f]=(0,a.useState)(null),[h,y]=(0,a.useState)("aws"),[v,g]=(0,a.useState)(!1),[b,j]=(0,a.useState)(1),[w,C]=(0,a.useState)(0),[N,k]=(0,a.useState)(1),[S,T]=(0,a.useState)(""),[A,R]=(0,a.useState)(""),[_,E]=(0,a.useState)(""),[F,O]=(0,a.useState)(""),[P,D]=(0,a.useState)(""),[M,I]=(0,a.useState)([]),[J,K]=(0,a.useState)([]),B=(0,a.useCallback)(async()=>{u(!0),f(null);try{let[e,t]=await Promise.all([(0,o.w)((0,l.Tq)(null==r?void 0:r.id,{page:b,limit:100,search:A,lifecycleStage:i,prospectCategory:_||void 0,province:F||void 0,contactStatus:P||void 0}),12e3,()=>({data:[],total:0,page:b,limit:100,totalPages:1,source:"aws",unavailable:!0})),(0,o.w)((0,l.al)(null==r?void 0:r.id,{lifecycleStage:i,search:A,prospectCategory:_||void 0,province:F||void 0,contactStatus:P||void 0}),12e3,()=>({categories:[],provinces:[],unavailable:!0}))]);c(Array.isArray(e.data)?e.data:[]),C(e.total),k(e.totalPages),y(e.source),I(t.categories),K(t.provinces);let a=e.unavailable||t.unavailable;g(a),a&&f("Aurora CRM backend")}catch(e){c([]),I([]),K([]),g(!0),f("Aurora CRM backend")}finally{u(!1),p(!0)}},[null==r?void 0:r.id,b,A,i,_,F,P]);(0,a.useEffect)(()=>{B()},[B]),(0,a.useEffect)(()=>{let e=window.setTimeout(()=>{R(S.trim()),j(1)},450);return()=>window.clearTimeout(e)},[S]);let $=(0,a.useCallback)(e=>{T(e)},[]),q=(0,a.useCallback)(e=>{E(e),j(1)},[]),U=(0,a.useCallback)(e=>{O(e),j(1)},[]),L=(0,a.useCallback)(e=>{D(e),j(1)},[]),Z=(0,a.useCallback)(async e=>{let t=await (0,l.Db)(e,null==r?void 0:r.id);return t?(c(e=>[t,...e].slice(0,100)),C(e=>e+1)):f("Failed to create customer â check connection and try again"),t},[null==r?void 0:r.id]),z=(0,a.useCallback)(async(e,t)=>{let a=await (0,l.EG)(e,t,null==r?void 0:r.id);return a?c(t=>t.map(t=>
1t.id===e?a:t)):f("Failed to update customer â check connection and try again"),a},[null==r?void 0:r.id]),H=(0,a.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=await (0,l.bO)(e,t,null==r?void 0:r.id);return a?(c(t=>t.filter(t=>t.id!==e)),C(e=>Math.max(0,e-1)),a):(f("à¹à¸£à¸´à¹à¸¡à¸à¸²à¸£à¸à¸´à¸à¸à¹à¸à¹à¸¡à¹à¸ªà¸³à¹à¸£à¹à¸ à¸à¸£à¸¸à¸à¸²à¸¥à¸à¸à¸à¸µà¸à¸à¸£à¸±à¹à¸"),null)},[null==r?void 0:r.id]),G=(0,a.useCallback)(async()=>{let e=await (0,l.Q6)(null==r?void 0:r.id);return e?(c([]),C(0),k(1),j(1),e):(f("Failed to reset Customer Master â check permission and try again"),null)},[null==r?void 0:r.id]);return{customers:s,loading:d,initialLoading:d&&!m,error:x,source:h,backendUnavailable:v,page:b,total:w,totalPages:N,search:S,setSearch:$,category:_,setCategory:q,province:F,setProvince:U,contactStatus:P,setContactStatus:L,categoryFacets:M,provinceFacets:J,setPage:j,reload:B,addCustomer:Z,updateCustomer:z,engageProspect:H,resetAllCustomers:G}}},99108:(e,t,r)=>{"use strict";r.d(t,{H:()=>d});var a=r(37876),n=r(14232),l=r(22586),o=r(64453);let i=(0,n.createContext)(null);function s(e){let{data:t,children:r}=e;return(0,a.jsx)(i.Provider,{value:t,children:r})}var c=r(32411);function d(e){let{loading:t,source:r,data:i=null,children:d}=e,{t:u}=(0,c.Bd)(),[m,p]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(!t)return void p(!1);p(!1);let e=window.setTimeout(()=>p(!0),15e3);return()=>window.clearTimeout(e)},[t]);let x=t&&!m;!x&&i&&(0,o.OP)(i),(0,n.useEffect)(()=>()=>(0,o.sf)(),[]);let f=!x&&"aws"===r;return(0,a.jsxs)("div",{className:"space-y-6 animate-fade-up",children:[f&&(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(l.sG,{source:r})}),x?(0,a.jsx)("p",{className:"text-sm text-muted-foreground text-center py-12",children:u("common.loadingAurora")}):(0,a.jsx)(l.VF,{active:f,children:(0,a.jsx)(s,{data:i,children:d})})]})}}},e=>{e.O(0,[3665,9270,636,6593,8792],()=>e(e.s=48244)),_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.