PageSourceSearch

https://tobira.ai/assets/ChatArea-bnto8V49.js

js tobira.ai collected 2026-10-04 22:56:19 UTC 9,695 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-CALoA9jz.js","assets/WidgetV8-itKS_A3P.js","assets/index-BRBTbfEW.js","assets/index-BWrWWlbU.css","assets/chunk-guard-BqltwLxW.js","assets/WidgetV8-DK1oB1bB.css","assets/MessageDetails-CPKvsF05.js","assets/MessageDetails-DUtqxpuR.css","assets/Handoff-D4yGPGLa.js","assets/LazyMarkdown-BPKEy7kc.js","assets/Handoff-BJiQm7gW.css","assets/FilePreview-BBiaIozz.js","assets/FilePreview-CMVNTYmr.css"])))=>i.map(i=>d[i]);
2import{au as t,b9 as se,a$ as ie,at as l,b2 as ce,aV as ue,b6 as de,ba as q,aZ as b}from"./index-BRBTbfEW.js";import{f as fe,a as ve,V as we,w as T,b as pe,v as he,c as me,p as be,d as xe}from"./WidgetV8-itKS_A3P.js";import{b as y,r as je,l as g}from"./chunk-guard-BqltwLxW.js";import{p as N,V as ke,a as _e}from"./LazyMarkdown-BPKEy7kc.js";function ye({attachment:e,file:r,copy:o,onOpen:a}){const s=[e.extension,ve(e.size)].filter(Boolean).join(" · "),d=!!r||e.kind==="image"&&!!e.previewUrl,i=t.jsxs(t.Fragment,{children:[e.kind==="image"&&e.previewUrl?t.jsx("img",{className:"wv8-file__thumb",src:e.previewUrl,alt:""}):t.jsx("span",{className:"wv8-file__ext","aria-hidden":"true",children:e.extension}),t.jsxs("span",{className:"wv8-attachment-copy",children:[t.jsx("strong",{children:e.name}),t.jsx("small",{children:s})]})]});return d?t.jsx("button",{type:"button",className:"wv8-sent-document","aria-label":`${o.openFile}: ${e.name}`,onClick:()=>a({attachment:e,file:r}),children:i}):t.jsx("div",{className:"wv8-sent-document",children:i})}function z({attachments:e,copy:r,onOpen:o}){return e.length===0?null:t.jsx("div",{className:"wv8-sent-files",children:e.map((a,s)=>t.jsx(ye,{attachment:a,file:fe(a),copy:r,onOpen:o},`${a.name}-${s}`))})}function Y(e){let r=e;for(let o=0;o<5;o+=1){const{bookingUrl:a,visibleText:s}=se(r);if(!a)return r;r=s}return r}const ge=new Set(ie.map(e=>we[e].teamHandoffRequest));function Ce(e,r){let o=-1;for(let s=e.length-1;s>=0;s-=1){const d=e[s];if(d.role==="user"&&ge.has(d.content.trim())){o=s;break}}if(o<0)return null;const a=e.slice(o+1).filter(s=>s.role==="agent"&&!s.welcome);return a.length===0?{requestKey:r(e[o]),afterKey:null,replies:0}:{requestKey:r(e[o]),afterKey:r(a[0]),replies:a.length}}const Ee=je(()=>b(()=>import("./api-CALoA9jz.js"),__vite__mapDeps([0,1,2,3,4,5]))),Ne=g(()=>b(()=>import("./MessageDetails-CPKvsF05.js"),__vite__mapDeps([6,2,3,7])),e=>({default:e.HumanByline})),Ae=g(()=>b(()=>import("./MessageDetails-CPKvsF05.js"),__vite__mapDeps([6,2,3,7])),e=>({default:e.AnswerTools})),J=()=>b(()=>import("./Handoff-D4yGPGLa.js"),__vite__mapDeps([8,2,3,0,1,4,5,9,10])),Se=g(J,e=>({default:e.V8HandoffAfterAnswer})),Q=()=>b(()=>import("./FilePreview-BBiaIozz.js"),__vite__mapDeps([11,2,3,1,4,5,12])),Ve=g(Q,e=>({default:e.V8FilePreview})),X=()=>b(()=>import("./index-BRBTbfEW.js").then(e=>e.bg),__vite__mapDeps([2,3])),Re=g(X,e=>({default:e.EmailGateCard})),Te=[{after:0,key:"initial"},{after:4e3,key:"checkingDetails"},{after:9e3,key:"puttingTogether"},{after:16e3,key:"almostThere"}];function Z(e,r){let o="initial";for(const a of Te)r>=a.after&&(o=a.key);return(q[e]??q.en)[o]}function m(e){return e.id??`${e.role}:${e.createdAt??""}:${e.content.slice(0,48)}`}function A(e){return e.attachments??(e.attachment?[e.attachment]:[])}function Le(e,r){const[o,a]=l.useState(()=>Date.now()),s=l.useRef(null),d=l.useRef(new Set),i=l.useRef(e);return i.current=e,l.useEffect(()=>{if(r){s.current===null&&(s.current=Date.now(),d.current=new Set(i.current.map(m))),a(Date.now());const x=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(x)}},[r]),l.useEffect(()=>{r||s.current===null||(s.current=null,![...e].reverse().find(w=>w.role==="agent"&&!w.welcome&&!w.notice&&!d.current.has(m(w))))||be("receive")},[r,e]),r&&s.current!==null?Math.max(0,o-s.current):0}function L({agentName:e,logo:r}){return t.jsxs("div",{className:"wv8-agent-byline",children:[t.jsx("span",{className:"wv8-brand-mark","aria-hidden":"true",children:r?t.jsx("img",{src:r,alt:""}):e.slice(0,1).toUpperCase()}),e]})}function Pe(e){const r=e.chat,{locale:o,bootstrap:a,onBookConsultation:s,showBooking:d=!1}=e,i=xe(o);l.useEffect(()=>T(Q),[]),l.useEffect(()=>T(J),[]);const p=ce(a.widget);l.useEffect(()=>p.email_gate!=="off"?T(X):void 0,[p.email_gate]);const x=a.displayName||a.handle||"Agent",w=pe(a),h=r.sending||r.agentTyping,P=a.widget_booking_available===!0,f=r.messages,ee=Le(f,h),S=Ce(f,m),[te,F]=l.useState({}),[D,O]=l.useState(null),[j,k]=l.useState(null),[ne,re]=l.useState(null),[B,ae]=l.useState(!1),V=l.useRef(null),oe=l.useCallback((n,c,v)=>{const _=r.token;_&&(O(null),F(u=>({...u,[n]:v})),Ee().then(u=>u.postV8Feedback(_,n,v)).catch(u=>{console.warn("[widget-v8] feedback failed",u),F(R=>({...R,[n]:c})),O(n)}))},[r.token]);l.useEffect(()=>{h&&N()},[h]),l.useEffect(()=>{var v;const n=(v=V.current)==null?void 0:v.closest(".wv8");
2if(!n){N();return}if(n.hasAttribute("data-open")){N();return}const c=new MutationObserver(()=>{n.hasAttribute("data-open")&&(c.disconnect(),N())});return c.observe(n,{attributes:!0,attributeFilter:["data-open"]}),()=>c.disconnect()},[]);const M=f.some(n=>n.role==="user");l.useEffect(()=>{const n=V.current;if(n){if(!M&&!h){const c=n.closest(".wv8-view-container");c&&(c.scrollTop=0);return}typeof n.scrollIntoView=="function"&&n.scrollIntoView({block:"end"})}},[f.length,r.streamedReply,h,M]);const I=ue(r.messages),C=I.action==="prompt"?I.decision_id:null,le=p.email_gate!=="off"&&(B||C!==null&&r.contactEmailChecked&&!r.hasCapturedEmail&&ne!==C),U=i.recovery;return t.jsxs("div",{className:"wv8-chat-area wv8-chat","aria-live":"off",children:[f.length&&e.aiNotice?t.jsx("p",{className:"wv8-ai-first-line","data-v8-ai-disclosure":!0,children:he(o)}):null,f.map(n=>{var G,$,H,K,W;const c=m(n);if(n.role==="user")return t.jsxs("div",{className:"wv8-message wv8-user","data-guest-message-id":n.id,children:[t.jsx(z,{attachments:A(n),copy:i,onOpen:k}),n.content?t.jsx("div",{className:"wv8-user-bubble",dir:"auto",children:n.content}):null,n.recoveryContent?t.jsx("button",{type:"button",className:"wv8-recovery",onClick:()=>r.retryMessage(n.recoveryContent),children:U}):null]},c);const v=(n.id?te[n.id]:void 0)??n.feedback??"none",_=d&&((H=($=(G=n.response)==null?void 0:G.structured)==null?void 0:$.booking_offer)==null?void 0:H.mode)==="widget",u=me(n,i,a.displayName||a.handle),R=P||_?Y(u):u;return t.jsxs("div",{className:"wv8-message wv8-agent","data-guest-message-id":n.id,children:[n.humanReply?t.jsx(y,{children:t.jsx(l.Suspense,{fallback:t.jsx(L,{agentName:n.humanReply.name}),children:t.jsx(Ne,{name:n.humanReply.name,joined:n.humanJoined===!0,locale:o,bootstrap:a})})}):t.jsx(L,{agentName:x,logo:w}),t.jsx(z,{attachments:A(n),copy:i,onOpen:k}),n.content?t.jsx("div",{className:"wv8-agent-answer",dir:"auto",children:t.jsx(ke,{content:R,attachmentUrls:f.flatMap(A).flatMap(E=>E.previewUrl?[E.previewUrl]:[]),downloadCsvLabel:i.downloadCsv,sourcesLabel:i.sources,closeLabel:i.closePreview})}):null,((W=(K=n.response)==null?void 0:K.structured)==null?void 0:W.memory_updated)===!0?t.jsx("div",{className:"wv8-thought","data-v8-memory-updated":!0,children:i.memoryUpdated}):null,_?t.jsx("button",{type:"button",className:"wv8-booking-offer",onClick:()=>s(de(r.messages)),children:i.bookConsultation}):null,n.recoveryContent?t.jsx("button",{type:"button",className:"wv8-recovery",onClick:()=>r.retryMessage(n.recoveryContent),children:U}):null,!n.welcome&&n.content?t.jsx(y,{children:t.jsx(l.Suspense,{fallback:null,children:t.jsx(Ae,{message:u===n.content?n:{...n,content:u},copy:i,feedback:v,feedbackEnabled:!!(n.id&&r.token),onFeedback:E=>n.id&&oe(n.id,v,E)})})}):null,D&&D===n.id?t.jsx("p",{className:"wv8-inline-error",role:"alert",children:i.feedbackFailed}):null,(S==null?void 0:S.afterKey)===c?t.jsx(y,{retryOnAction:!0,children:t.jsx(l.Suspense,{fallback:null,children:t.jsx(Se,{chat:r,locale:o,keyOf:m})})}):null]},c)}),h?t.jsxs("div",{className:"wv8-message wv8-agent wv8-is-streaming","data-v8-live":!0,children:[t.jsx(L,{agentName:x,logo:w}),r.streamedReply?t.jsx("div",{className:"wv8-agent-answer",dir:"auto","aria-busy":"true",children:t.jsx(_e,{content:P?Y(r.streamedReply):r.streamedReply,attachmentUrls:f.flatMap(A).flatMap(n=>n.previewUrl?[n.previewUrl]:[]),downloadCsvLabel:i.downloadCsv,sourcesLabel:i.sources,closeLabel:i.close})}):t.jsxs("div",{className:"wv8-thinking wv8-work-status","data-v8-wait":!0,children:[t.jsx("span",{className:"wv8-work-pulse","aria-hidden":"true"}),t.jsx("span",{className:"wv8-work-label",role:"status",children:Z(o,ee)})]})]}):null,le&&p.email_gate!=="off"?t.jsx(y,{children:t.jsx(l.Suspense,{fallback:null,children:t.jsx(Re,{mode:p.email_gate,email:r.contactEmail,captured:B,language:o,onEmailChange:r.setContactEmail,onChoosePlan:e.onChoosePlan,onCapture:async n=>{const c=await r.captureContactEmail(n);return c===!0&&ae(!0),c},onDismiss:()=>{C&&re(C)}})})}):null,j?t.jsx(y,{onError:()=>k(null),children:t.jsx(l.Suspense,{fallback:t.jsxs("div",{className:"wv8-preview",role:"dialog","aria-modal":"true","aria-label":j.attachment.name,"aria-busy":"true",children:[t.jsxs("div",{className:"wv8-preview__bar",children:[t.jsx("strong",{children:j.attachment.name}),t.jsx("button",{type:"button",className:"wv8-icon-button",onClick:()=>k(null),"aria-label":i.closePreview,children:"×"})]}),t.jsx("div",{className:"wv8-preview__body"})]}),children:t.jsx(Ve,{attachment:j.attachment,file:j.file,copy:i,onClose:()=>k(null)})})}):null,t.jsx("div",{ref:V,className:"wv8-chat-end","aria-hidden":"true"})]})}const Me=Object.freeze(Object.defineProperty({__proto__:null,ChatArea:Pe,v8MessageKey:m,v8WaitLabel:Z},Symbol.toStringTag,{value:"Module"}));
2export{Me as C,Ce as v};

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.