1import{r as p,d2 as N,j as e,dP as M,d1 as y}from"./vendor-DprLDDrC.js";import{c as E,e as T,i as O,l as z,d as B,M as L,f as V,C as W,g as v,h as F,P as K,j as X}from"./ui-action-host-DnVMXmK3.js";import{b as H}from"./paymentFieldClassifier-BDgLdQ3e.js";import{c2 as j,c1 as D,cL as R,cM as k,cN as A,cO as $,cP as G,aM as U,cQ as Y,cR as q,aT as _,cS as J}from"./LottieImpl-DaRvn7Qn.js";import{b as Q}from"./vendor-ui-kit-BL-OerwB.js";import"./i18n-DznWhzBQ.js";import"./vendor-chat-3haxGrZO.js";import"./vendor-forms-CHjJo1CC.js";import"./vendor-table-CIPYyGae.js";import"./git-merge-xy_EfJnL.js";import"./vendor-openreplay-ZS97veM7.js";import"./vendor-charts-BndeHeTK.js";import"./vendor-inputs-DGGjyQLA.js";import"./monaco-BMTZF0u8.js";import"./reactflow-BggrmjQL.js";import"./vendor-media-DRJuq8Rr.js";import"./network-CwP5_7kq.js";import"./pencil-line-B-KFaB86.js";import"./cpu-C1Dz500G.js";import"./list-checks-DkCuCnSN.js";import"./microscope-e_ogGgi3.js";import"./loader-Vy8xhsos.js";import"./power-DuyYoIpZ.js";import"./map-B-rQn1vG.js";import"./hammer-nAtm26xL.js";import"./wrench-BPAkkSd7.js";import"./terminal-62PgeZ1P.js";import"./radio-BtnyM9uC.js";import"./link-2-DpPc6hIS.js";import"./navigation-BojNuDmp.js";import"./square-plus-CTubHJWx.js";import"./templatesCatalog-CUYmvXYt.js";import"./arrow-down-DE2Ij5HG.js";import"./useMbaModalChannels-Mz91Ql3o.js";import"./useMbaFeatureEnabled-Bt42rQMG.js";import"./ui-action-registry-DoUntrHf.js";import"./plug-CWxnCGK-.js";import"./grip-vertical-BSmE-fys.js";import"./square-BzuqDCwr.js";import"./key-C-5arIqb.js";import"./image-plus-CQ6xgJc3.js";import"./folder-Ccpy9xN4.js";import"./tags-CMJb-jhz.js";import"./utils.toolbar-9QBDpAhF.js";import"./querySkills.hook-CLdVjYRA.js";import"./TesterQrTabs-B8DQNE2J.js";import"./paperclip-CRKXtzsq.js";import"./file-spreadsheet-C4M2U712.js";import"./chart-line-Gi0O7X7R.js";import"./mic-CP9cM6no.js";import"./arrow-up-CmbxAuIQ.js";import"./tools.constants-B5SslDuD.js";import"./utils-BLhcMx8X.js";import"./queryFlow-DZN7onR4.js";import"./outputs.repository-DhiXG6SA.js";import"./tools.query-CvY5J-YO.js";import"./constants.toolbar-8LgJjvW2.js";import"./WhatsappFlow.Icon-CWFmxcy5.js";import"./globe-DQ4UVkyj.js";import"./book-user-Do1-F1_q.js";import"./grid-2x2-plus-Ca_ktqKY.js";import"./code-xml-CT8PXdH9.js";import"./edgeRepository-DiNcA8es.js";import"./index-D4X3Hu0Z.js";import"./useAuthApps-CDQRJtIn.js";import"./payment-routing-Bw40ouiH.js";import"./CopyIcon-DW41XDBq.js";import"./SpinnerIcon-kdcW4toL.js";import"./LazyPdfPage-DyHV-8HP.js";import"./CornerBordersIcon-CsYVkVKB.js";import"./useSkillIdParam.hook-BbC8ugr6.js";import"./useWorkflowDropHandler-sICQz2r7.js";import"./equal-D302zZds.js";import"./equal-not-CzrBaUDT.js";import"./search-x-BAgSFcmO.js";import"./contants.output-BY6ldXLE.js";import"./McpDetailPreviewModal-udlqem7u.js";import"./useIntegrationInstall-Dqs3J4NV.js";import"./ViewPlanDetailsLink-CGPCkzAG.js";import"./UpgradeToProductionModal-CP3Suu3J.js";import"./text-area-field-DqJuAwK6.js";import"./ChevronDown.Icon-MNjp3_Q2.js";import"./ArrowSelect-DVOTH16n.js";import"./shield-check-nG7rHyB2.js";import"./AppIcon-DlOPpRhR.js";import"./JelouLogoIcon-CeShhQX1.js";import"./key-round-C1RK0zkr.js";import"./map-pin-MNq1IKa8.js";import"./flask-conical-B3lyv2pO.js";import"./layout-template-D-Ucic6h.js";import"./circle-user-DDlcIS3g.js";import"./predefined-skills.constants-B8KbidPC.js";import"./routeContext-aMKKvFEA.js";import"./channels.constants-C1bJL3iN.js";import"./UserGroupIcon-HT9F1do3.js";import"./Web.Icon-DSG7Wh1i.js";import"./headset-CV_i5W7t.js";import"./empty-D0phYANu.js";import"./circle-minus-dS3MSVPP.js";import"./folder-open-DyKetnqC.js";import"./utils-BNuSr94n.js";import"./whatsappCalling-CuRv7aB6.js";import"./vendor-syntax-Bh8KO_iT.js";import"./arrow-right-left-CjlQGBrP.js";import"./variable-Dewyl-G9.js";import"./hourglass-BpwT07PC.js";import"./flag-CCSgvIRX.js";import"./funnel-Bs0bYvnc.js";import"./qr-code-DBKIC2xm.js";import"./useOrganizationId-B5aSbOLL.js";import"./star-BdxNqA2V.js";import"./shield-Cp0fDOly.js";import"./cloud-upload-CZSQ3Pry.js";import"./share-2-CFaoAV0a.js";import"./package-B3UWrp-L.js";import"./shopping-cart-BdD75aUD.js";import"./rectangle-ellipsis-BTuj-Rke.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"5adbf7c9c7f9db84dea58cbd00b35c020926e800"};var m=new t.Error().stack;m&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[m]="92c4b2fe-0f99-4457-ae84-fba562f5aac0",t._sentryDebugIdIdentifier="sentry-dbid-92c4b2fe-0f99-4457-ae84-fba562f5aac0")}catch{}})();function Z({sessionId:t,apiUrl:m,apiKey:n,loadMessages:l,loadHistoricalItems:a,onSessionNotFound:i,skipRestore:r=!1}){const h=p.useRef(null),c=p.useRef(l);c.current=l;const b=p.useRef(a);b.current=a;const g=p.useRef(i);g.current=i,p.useEffect(()=>{if(!t||h.current===t||r)return;const s=new AbortController,x=H(n);return fetch(`${m}/sessions/${t}/messages?limit=100`,{...x,signal:s.signal}).then(o=>{var d;if(o.status===404)return(d=g.current)==null||d.call(g),null;if(o.status===401||o.status===403)return null;if(!o.ok)throw new Error("Failed to restore session");return o.json()}).then(o=>{var I;if(h.current=t,!o)return;let d;if(o.items&&o.items.length>0)d=E(o.items);else if(o.messages&&o.messages.length>0){const P=o.messages.map(S=>({...S,type:"message",summarizedBy:S.summarizedBy??null}));d=E(P)}else return;const w=T(d);(I=b.current)==null||I.call(b,d),c.current(w)}).catch(o=>{if(O(o)){z("session-switch","useDirectSessionRestore");return}}),()=>s.abort()},[t,m,n,r])}const u=440,f=320;function tt(){const t=localStorage.getItem("auth_token");if(t)return t}function et({surface:t,onClose:m}){const{t:n}=y(),{clearChat:l}=X(),{messages:a}=v(),i=p.useCallback(()=>{var w;l(),(w=t==null?void 0:t.onNewChat)==null||w.call(t)},[l,t]),r=p.useCallback(()=>{var w;l(),(w=t==null?void 0:t.onResetEmbeddedSession)==null||w.call(t)},[l,t==null?void 0:t.onResetEmbeddedSession]),h=t!=null&&t.title?n(t.title):n("jelouAgent","Jelou Agent"),c=t?!!t.onNewChat||t.headerAction==="new-chat":!0,g=((t==null?void 0:t.newChatVariant)??"new")==="clean",s=g&&a.length===0,x=g?n("studio.cleanChat","Clean chat"):n("studio.newChat","New chat"),o=!!(t!=null&&t.onResetEmbeddedSession),d=(t==null?void 0:t.closeIcon)==="close"?U:Y;return e.jsxs("header",{className:"flex items-center justify-between px-4 py-3 bg-white shrink-0 border-b border-neutral-500/30",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"flex h-[1.7rem] w-[1.7rem] shrink-0 items-center justify-center rounded-lg border border-[#2ecde2] bg-white",children:e.jsx(q,{className:"w-4 h-4 text-[#2ec
1de2] shrink-0",strokeWidth:1.5})}),e.jsx("span",{className:"text-normal font-semibold text-neutral-700 truncate leading-[22px]",children:h})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[c&&e.jsx(Q,{tooltipSettings:{content:e.jsx("div",{className:"whitespace-nowrap text-xs font-semibold p-0",children:x}),placement:"bottom"},children:e.jsx("button",{type:"button",onClick:i,disabled:s,className:"w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-200 enabled:cursor-pointer enabled:hover:bg-hover enabled:active:scale-95 disabled:cursor-not-allowed disabled:opacity-40","aria-label":x,children:g?e.jsx(_,{className:"w-4 h-4 text-neutral-500",strokeWidth:1.5}):e.jsx(J,{className:"w-4 h-4 text-neutral-500",strokeWidth:1.5})})}),o&&e.jsx("button",{type:"button",onClick:r,className:"w-8 h-8 flex items-center justify-center cursor-pointer rounded-md hover:bg-hover active:scale-95 transition-colors duration-200","aria-label":n("clearChat","Clear chat"),children:e.jsx(_,{className:"w-4 h-4 text-gray-500",strokeWidth:1.5})}),e.jsx("button",{type:"button",onClick:m,className:"w-8 h-8 flex items-center justify-center cursor-pointer rounded-md hover:bg-hover active:scale-95 transition-colors duration-200","aria-label":n("close","Close"),children:e.jsx(d,{className:"w-4 h-4 text-neutral-500",strokeWidth:1.5})})]})]})}function ot({surface:t,onSuggestionClick:m}){var i;const{t:n}=y(),l=t.emptyStateTitleKey?n(t.emptyStateTitleKey):"",a=t.emptyStateDescriptionKey?n(t.emptyStateDescriptionKey):"";return e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-6 px-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[l&&e.jsx("p",{className:"text-sm font-bold leading-5 text-neutral-700",children:l}),a&&e.jsx("p",{className:"text-xs leading-4 text-neutral-700",children:a})]}),e.jsx("div",{className:"flex w-full flex-col gap-2",children:(i=t.suggestions)==null?void 0:i.map(r=>{const h=n(r.labelKey);return e.jsx("button",{type:"button",onClick:()=>m(h),className:"flex h-10 items-center justify-center rounded-lg border border-[#e3e5ec] bg-white px-3 text-center text-xs leading-4 text-neutral-500 transition-colors hover:bg-background-default-slate",children:h},r.labelKey)})})]})}function C({surface:t,onClose:m,isOpen:n}){const{t:l}=y(),{messages:a}=v(),[i,r]=p.useState(),h=t!=null&&t.placeholder?l(t.placeholder):l("globalAi.placeholder","Ask anything..."),c=(t==null?void 0:t.suggestions)&&t.suggestions.length>0&&a.length===0,b=p.useCallback(s=>{r(s)},[]),g=p.useCallback(()=>{r(void 0)},[]);return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(et,{surface:t,onClose:m}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[c?e.jsx(ot,{surface:t,onSuggestionClick:b}):e.jsx(F,{className:"flex-1"}),e.jsx(K,{placeholder:h,isOpen:n,draftMessage:i,onDraftConsumed:g,disableModeSwitcher:t==null?void 0:t.disableModeSwitcher,disableSkillMentions:t==null?void 0:t.disableIntegrations})]})]})}function it({sessionId:t,onSessionNotFound:m}){const{loadMessages:n,loadHistoricalItems:l,messages:a,isLoading:i}=v(),r=i||a.length>0;return Z({sessionId:t,apiUrl:j,apiKey:D||void 0,loadMessages:n,loadHistoricalItems:l,onSessionNotFound:m,skipRestore:r}),null}function nt({surface:t,readyToAnimate:m}){const n=(t==null?void 0:t.positioning)??"fixed-overlay",l=(t==null?void 0:t.width)??(n==="fixed-overlay"?u:f),a=R(o=>o.isOpen),i=R(o=>o.setIsOpen),{pathname:r}=M(),[h,c]=p.useState(k);p.useEffect(()=>{if(n!=="fixed-overlay")return;const o=()=>c(k());return window.addEventListener(A,o),()=>window.removeEventListener(A,o)},[n]);const b=p.useCallback(()=>{t!=null&&t.onClose?t.onClose():i(!1)},[t,i]);if(n==="embedded"){const o=(t==null?void 0:t.isOpen)??!0,d=m&&o;return e.jsx("div",{...o?{}:{inert:""},"aria-hidden":!o,className:"jelou-widget flex h-full shrink-0 flex-col overflow-hidden border-r bg-white",style:{width:d?l:0,borderRightColor:d?"rgb(220 222 228)":"transparent",transition:d?"width 300ms ease-out, border-right-color 0ms":"width 300ms ease-out, border-right-color 0ms 300ms",willChange:"width"},children:e.jsx("div",{className:`flex h-full min-w-0 flex-col transition-opacity duration-300 ease-out ${d?"opacity-100":"pointer-events-none opacity-0"}`,style:{width:l}
1,children:e.jsx(C,{surface:t,onClose:b,isOpen:o})})})}if(n==="bare")return e.jsx("div",{className:"jelou-widget flex h-full min-h-0 flex-col",children:e.jsx(C,{surface:t,onClose:b,isOpen:(t==null?void 0:t.isOpen)??!0})});if(n==="embedded-overlay"){const o=(t==null?void 0:t.isOpen)??!0,d=m&&o;return e.jsx("div",{...o?{}:{inert:""},"aria-hidden":!o,className:"jelou-widget absolute top-0 left-0 z-10 flex h-full flex-col overflow-hidden border-r border-neutral-200 bg-white shadow-[4px_0_12px_rgba(0,0,0,0.08)]",style:{width:l,opacity:d?1:0,transform:d?"translateX(0)":"translateX(-100%)",transition:d?"transform 700ms cubic-bezier(0.22, 1, 0.36, 1), opacity 500ms ease-out":"transform 550ms cubic-bezier(0.4, 0, 0.2, 1), opacity 400ms ease-in"},children:e.jsx(C,{surface:t,onClose:b,isOpen:o})})}const s=$.includes(r)||h===G.FIXED_EXPANDED?"16rem":"4rem",x=m&&a;return e.jsx("div",{...a?{}:{inert:""},"aria-hidden":!a,className:`jelou-widget hidden md:flex fixed top-[calc(48px_+_var(--jou-status-strip-h,0px))] bottom-0 flex-col bg-white border-r-1 border-neutral-200 z-40 shadow-[4px_0_12px_rgba(0,0,0,0.04)] ${x?"opacity-100":"opacity-0 pointer-events-none"}`,style:{left:s,width:l,transform:x?"translateX(0)":"translateX(-100%)",transition:x?"transform 700ms cubic-bezier(0.22, 1, 0.36, 1), opacity 700ms cubic-bezier(0.22, 1, 0.36, 1), left 300ms ease-in-out":"transform 900ms cubic-bezier(0.4, 0, 0.2, 1), opacity 900ms cubic-bezier(0.4, 0, 0.2, 1), left 300ms ease-in-out"},children:e.jsx(C,{surface:t,onClose:b,isOpen:a})})}function xo({surface:t,readyToAnimate:m,onMounted:n}){const l=p.useRef(!1);p.useEffect(()=>{n==null||n()},[n]),p.useEffect(()=>{l.current=!1},[t==null?void 0:t.sessionId]);const a=p.useCallback(()=>{var s;l.current||(l.current=!0,t!=null&&t.onSessionRestoreNotFound?t.onSessionRestoreNotFound():(s=t==null?void 0:t.onResetEmbeddedSession)==null||s.call(t))},[t==null?void 0:t.onSessionRestoreNotFound,t==null?void 0:t.onResetEmbeddedSession]),i=N(s=>s.userSession),r=N(s=>s.company),h=(r==null?void 0:r.organizationId)??(r==null?void 0:r.organization_id),c=p.useMemo(()=>{const s=i==null?void 0:i.realUser,x=(s==null?void 0:s.userId)??(i==null?void 0:i.id),o=(s==null?void 0:s.email)??(i==null?void 0:i.email),d=(s==null?void 0:s.names)??(i==null?void 0:i.names),w=i==null?void 0:i.companyId;if(!(!x||!w))return{id:`${x}:${w}`,email:o??"",name:d??"",brainsUserId:String(x),studioUserId:String(x),companyId:w,organizationId:h}},[i,h]),{downloadInsightsReport:b}=B();return j?e.jsx(L,{children:e.jsx(V,{userId:c==null?void 0:c.brainsUserId,organizationId:h,children:e.jsxs(W,{apiUrl:j,apiKey:D||void 0,user:c,getAuthToken:tt,...(t==null?void 0:t.sessionId)&&{sessionId:t.sessionId},...(t==null?void 0:t.initialMode)&&{initialMode:t.initialMode},...(t==null?void 0:t.getContext)&&{getContext:t.getContext},disableWorkflow:t==null?void 0:t.disableWorkflow,disableIntegrations:t==null?void 0:t.disableIntegrations,disableModeSwitcher:t==null?void 0:t.disableModeSwitcher,analyticsSource:"global_panel",...(t==null?void 0:t.onSessionPersist)&&{onSessionCreated:t.onSessionPersist},onInsightsReportExportRequest:b,children:[(t==null?void 0:t.sessionId)&&e.jsx(it,{sessionId:t.sessionId,onSessionNotFound:a},t.sessionId),e.jsx(nt,{surface:t,readyToAnimate:m})]})})}):null}export{xo as default}; 2//# sourceMappingURL=GlobalAiPanelBody-DqK-1SNM.js.map
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.