@accurix/centrinfo-widget 5.1.1 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3516 +0,0 @@
1
- import{createContext as e}from"preact";import{useCallback as t,useContext as n,useEffect as r,useLayoutEffect as i,useMemo as a,useRef as o,useState as s}from"preact/hooks";import{Fragment as c,jsx as l,jsxs as u}from"preact/jsx-runtime";var d=class extends Error{constructor(e,t,n){super(t),this.status=e,this.retryAfterSeconds=n,this.name=`ApiError`}};function f(e){"@babel/helpers - typeof";return f=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},f(e)}function p(e,t){if(f(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(f(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function m(e){var t=p(e,`string`);return f(t)==`symbol`?t:t+``}function h(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const g=()=>({agentName:`Accurix`,greeting:`Hi! 👋 How can I help you today?`,widgetModule:`chat`,assistantMediaKind:`image`,soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:`text`,allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[]}),_=e=>{typeof console>`u`||console.warn(`[centrinfo-widget] Could not load saved widget configuration from the API (${e}). Showing default widget chrome. Check data-token, data-api-base, CORS, and backend availability.`)},v=(e,t={})=>{let n=(e.disclaimerText?.trim())?.toLowerCase(),r=t.agentName?.trim()||e.agentName?.trim()||`Accurix`,i=t.agentAvatarUrl?.trim()||e.agentAvatarUrl?.trim();return{...e,allowVoiceInput:!!(e.allowVoiceInput&&e.talkbackMode&&e.talkbackMode!==`text`),voiceOutputEnabled:!!(e.voiceOutputEnabled&&e.talkbackMode&&e.talkbackMode!==`text`),agentName:r,agentAvatarUrl:i||void 0,disclaimerText:n===`sara is an ai assistant; answers may be imperfect.`||n?.includes(`sara is an ai assistant`)?`Accurix is an AI assistant; answers may be imperfect.`:e.disclaimerText}},y=[`/transcribe`,`/speak`,`/attachments`,`/stream`],b=[`/book-demo`,`/schedule-callback`],x=e=>{let t=e.split(`?`)[0]??e;return b.some(e=>t.includes(`/public-chat${e}`))?12e4:y.some(e=>t.includes(`/public-chat${e}`))||t.endsWith(`/public-chat`)?6e4:15e3},S=e=>{let t=e.headers?.get?.(`Retry-After`),n=t?Number(t):NaN;return Number.isFinite(n)&&n>=0?n:void 0},C=e=>{try{let t=e.split(`.`)[1];if(!t)return null;let n=atob(t.replace(/-/g,`+`).replace(/_/g,`/`)),r=JSON.parse(n).exp;return typeof r==`number`&&Number.isFinite(r)?r*1e3:null}catch{return null}};var w=class{constructor(e,t,n,r,i={},a,o,s=`floating`){this.baseUrl=e,this.token=t,this.gifApiKey=n,this.analyticsContextToken=r,this.bootstrapOverrides=i,this.identityToken=a,this.identityTokenProvider=o,this.chatSurface=s,h(this,`cachedIdentity`,null),h(this,`identityFlight`,null)}async currentIdentityToken(){if(!this.identityTokenProvider)return this.identityToken;let e=this.cachedIdentity;return e&&Date.now()<e.refreshAt?e.token:(this.identityFlight??(this.identityFlight=(async()=>{try{let e=(await this.identityTokenProvider()??``).trim();this.identityToken=e||void 0;let t=e?C(e):null;return this.cachedIdentity=e&&t!==null?{token:e,refreshAt:t-6e4}:null,this.identityToken}finally{this.identityFlight=null}})()),this.identityFlight)}async fetchT(e,t={}){let n=new AbortController,r=!1,i=setTimeout(()=>{r=!0,n.abort()},x(e)),a=t.signal,o=()=>n.abort();a?.aborted?n.abort():a?.addEventListener(`abort`,o,{once:!0});try{return await fetch(e,{...t,signal:n.signal})}catch(e){throw r&&!a?.aborted?new d(408,`The request took too long. Please try again.`):e}finally{clearTimeout(i),a?.removeEventListener(`abort`,o)}}headers(e=!0){let t={Authorization:`Bearer ${this.token}`};return e&&(t[`Content-Type`]=`application/json`),t}async json(e){let t;try{t=await e.json()}catch{t=void 0}if(!e.ok){let n=E(t)??`request failed (${e.status})`;throw new d(e.status,n,S(e))}return t?.data??t}async bootstrap(){try{let e=await this.fetchT(`${this.baseUrl}/public-chat/bootstrap`,{headers:this.headers(!1)});if(!e.ok)return _(`bootstrap request failed with ${e.status}`),v(g(),this.bootstrapOverrides);let t=await this.json(e);return v({...g(),...t},this.bootstrapOverrides)}catch(e){return _(e instanceof Error?e.message:`bootstrap request failed`),v(g(),this.bootstrapOverrides)}}async history(){let e=await this.currentIdentityToken();if(!e)return{conversations:[]};let t=await this.fetchT(`${this.baseUrl}/public-chat/history`,{method:`POST`,headers:this.headers(),body:JSON.stringify({identityToken:e,surface:this.chatSurface})}),n=await this.json(t);return{activeSessionId:n.activeSessionId,conversations:Array.isArray(n.conversations)?n.conversations:[]}}async stream(e,t,n){let r=await this.currentIdentityToken(),i=await this.fetchT(`${this.baseUrl}/public-chat/stream`,{method:`POST`,headers:this.headers(),body:JSON.stringify({question:e,sessionId:t,clientMessageId:n.clientMessageId,attachmentId:n.attachmentId,attachmentIds:n.attachmentIds,voicePlaybackRequested:!!n.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:r,surface:this.chatSurface}),signal:n.signal});return!i.ok||!i.body?((i.status===429||i.status===401)&&await this.json(i),this.send(e,t,n)):D(i.body,n)}async liveEvents(e,t){let n=`sessionId=${encodeURIComponent(e)}&after=${encodeURIComponent(t)}`,r=await this.fetchT(`${this.baseUrl}/public-chat/live-events?${n}`,{headers:this.headers(!1)}),i=await this.json(r);return{mode:i.mode??`ai`,assignedAgentName:i.assignedAgentName,agentTyping:!!i.agentTyping,agentTypingName:i.agentTypingName,conversationEnded:!!i.conversationEnded,events:i.events??[]}}async typing(e,t){try{let n=await this.fetchT(`${this.baseUrl}/public-chat/typing`,{method:`POST`,headers:this.headers(),body:JSON.stringify({sessionId:e,isTyping:t})});if(!n.ok)try{await n.text()}catch{}}catch{}}async presence(e){try{await this.fetchT(`${this.baseUrl}/public-chat/presence`,{method:`POST`,headers:this.headers(),body:JSON.stringify({sessionId:e})})}catch{}}async send(e,t,n){let r=await this.currentIdentityToken(),i=await this.fetchT(`${this.baseUrl}/public-chat`,{method:`POST`,headers:this.headers(),body:JSON.stringify({question:e,sessionId:t,clientMessageId:n.clientMessageId,attachmentId:n.attachmentId,attachmentIds:n.attachmentIds,voicePlaybackRequested:!!n.voicePlaybackRequested,analyticsContextToken:this.analyticsContextToken,identityToken:r,surface:this.chatSurface}),signal:n.signal}),a=await this.json(i);return n.onChunk(a.answer??``),{answer:a.answer??``,sources:a.sources??[],suggestedReplies:a.suggestedReplies??[],availableActions:a.availableActions??[],actions:a.actions??[],selectedAction:a.selectedAction,handoffOffered:a.handoffOffered??!1,requestedContactFields:k(a.requestedContactFields),conversationEnded:a.conversationEnded??!1,liveMode:a.liveMode,assignedAgentName:a.assignedAgentName,audioBase64:a.audioBase64,mimeType:a.mimeType,visualization:a.visualization,artifacts:a.artifacts}}async action(e,t,n){let r=n?.trim()||(e===`contact-support`?`inquiry`:e),i=await this.fetchT(`${this.baseUrl}/public-chat/${r}`,{method:`POST`,headers:this.headers(),body:JSON.stringify(t)}),a=await this.json(i);return{ok:!0,note:a?.note,receipt:a?.receipt,booking:a?.booking,caseReference:a?.caseReference||void 0,inquiryId:a?.inquiryId||a?.inquiry?.id||void 0}}async confirmHostedBooking(e){let t=await this.fetchT(`${this.baseUrl}/public-chat/book-demo/confirm`,{method:`POST`,headers:this.headers(),body:JSON.stringify(e)}),n=await this.json(t);if(!n?.booking)throw Error(`Calendar booking confirmation was unavailable.`);return{...n.booking,receipt:n.receipt}}async speak(e){let t=await this.fetchT(`${this.baseUrl}/public-chat/speak`,{method:`POST`,headers:this.headers(),body:JSON.stringify({text:e})}),n=await this.json(t);return{providerReady:!!n.providerReady,message:n.message,audioBase64:n.audioBase64,mimeType:n.mimeType}}async identify(e,t){if(!(!e||!t))try{let n=await this.fetchT(`${this.baseUrl}/public-chat/identify`,{method:`POST`,headers:this.headers(),body:JSON.stringify(T(e,t))});if(!n.ok)try{await n.text()}catch{}}catch{}}async transcribe(e,t,n,r){let i=await this.fetchT(`${this.baseUrl}/public-chat/transcribe`,{method:`POST`,headers:this.headers(),body:JSON.stringify({audioBase64:e,mimeType:t,languageHint:n,durationSeconds:r})});return(await this.json(i)).text??``}async transcribeAudio(e,t,n,r){let i=new FormData;i.append(`audio`,e,`voice-recording`),i.append(`mimeType`,t||e.type||`audio/webm`),n&&i.append(`languageHint`,n),r!==void 0&&Number.isFinite(r)&&i.append(`durationSeconds`,String(r));let a=await this.fetchT(`${this.baseUrl}/public-chat/transcribe`,{method:`POST`,headers:this.headers(!1),body:i});return(await this.json(a)).text??``}async endConversation(e){try{let t=await this.fetchT(`${this.baseUrl}/public-chat/end`,{method:`POST`,headers:this.headers(),body:JSON.stringify({sessionId:e})});if(!t.ok)try{await t.text()}catch{}}catch{}}async sendFeedback(e){try{let t=await this.fetchT(`${this.baseUrl}/public-chat/feedback`,{method:`POST`,headers:this.headers(),body:JSON.stringify(e)});if(!t.ok)try{await t.text()}catch{}}catch{}}async sendExplanationFeedback(e){let t=await this.fetchT(`${this.baseUrl}/public-chat/explanation-feedback`,{method:`POST`,headers:this.headers(),body:JSON.stringify(e)});await this.json(t)}async fetchExplanation(e,t,n=`widget`,r){let i=await this.fetchT(`${this.baseUrl}/public-chat/analytics-explanations/${encodeURIComponent(e)}?sessionId=${encodeURIComponent(t)}&surface=${n}`,{method:`GET`,headers:this.headers(!1),signal:r});return this.explanationJob(i,e)}async retryExplanation(e,t,n=`widget`){let r=await this.fetchT(`${this.baseUrl}/public-chat/analytics-explanations/${encodeURIComponent(e)}/retry`,{method:`POST`,headers:this.headers(),body:JSON.stringify({sessionId:t,surface:n})});return this.explanationJob(r,e)}async explanationJob(e,t){return e.status===404||e.status===410?{status:`failed`,explanationId:t,retryAvailable:!1}:this.json(e)}async uploadAttachment(e,t,n,r,i){let a=await this.fetchT(`${this.baseUrl}/public-chat/attachments`,{method:`POST`,headers:this.headers(),body:JSON.stringify({fileBase64:e,mimeType:t,filename:n,sessionId:r,analyze:i})});return this.json(a)}async fetchAttachment(e,t){let n=await this.fetchT(`${this.baseUrl}/public-chat/attachments/${encodeURIComponent(e)}?sessionId=${encodeURIComponent(t)}`,{headers:this.headers(!1)});if(!n.ok)throw new d(n.status,`This file is no longer available.`);return n.blob()}async demoSlots(e,t){let n=`from=${encodeURIComponent(e)}&to=${encodeURIComponent(t)}`,r=await this.fetchT(`${this.baseUrl}/public-chat/demo-slots?${n}`,{headers:this.headers(!1)});if(!r.ok){let e=Error(`Calendar availability is temporarily unavailable.`);throw e.status=r.status,e}let i=await this.json(r);return{status:i?.status,reason:i?.reason,timezone:i?.timezone,slotDurationMinutes:i?.slotDurationMinutes,available:i?.available,taken:i?.taken??[],busy:i?.busy??[]}}async searchGifs(e){if(!this.gifApiKey)return[];let t=`https://tenor.googleapis.com/v2/search?q=${encodeURIComponent(e.trim()||`trending`)}&key=${this.gifApiKey}&limit=24&media_filter=tinygif,gif&contentfilter=high`;try{let e=await this.fetchT(t,{});return e.ok?((await e.json()).results??[]).map(e=>({id:e.id,url:e.media_formats?.gif?.url??e.media_formats?.tinygif?.url??``,preview:e.media_formats?.tinygif?.url??e.media_formats?.gif?.url??``,alt:e.content_description||`GIF`})).filter(e=>e.url):[]}catch{return[]}}};const T=(e,t)=>{let n={...t.customAttributes??{},...t.metadata??{}};t.createdAt!==void 0&&(n.createdAt=t.createdAt),t.avatarUrl&&(n.avatarUrl=t.avatarUrl),t.company&&(n.company=t.company);let r={sessionId:e},i=t.externalId??t.userId;return i&&(r.externalId=i),t.email&&(r.email=t.email),t.firstName&&(r.firstName=t.firstName),t.lastName&&(r.lastName=t.lastName),t.name&&(r.name=t.name),t.phone&&(r.phone=t.phone),Object.keys(n).length>0&&(r.metadata=n),r},E=e=>{let t=e?.message;if(Array.isArray(t))return t.join(`, `);if(typeof t==`string`)return t},D=async(e,t)=>{let n=e.getReader(),r=new TextDecoder,i={answer:``,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1,requestedContactFields:[],conversationEnded:!1},a=``;for(;;){let{done:e,value:o}=await n.read();if(e)break;a+=r.decode(o,{stream:!0});let s;for(;(s=a.indexOf(`
2
-
3
- `))!==-1;){let e=a.slice(0,s);a=a.slice(s+2);let n=O(e);if(n){if(n.event===`error`)throw new d(502,n.data?.message??`stream error`);if(n.event===`chunk`&&typeof n.data?.text==`string`)i.answer+=n.data.text,t.onChunk(n.data.text);else if(n.event===`reset`)i.answer=``,t.onReset?.();else if(n.event===`final`&&n.data)typeof n.data.answer==`string`&&(i.answer=n.data.answer),i.sources=n.data.sources??[],i.suggestedReplies=n.data.suggestedReplies??[],i.availableActions=n.data.availableActions??[],i.actions=n.data.actions??[],i.selectedAction=n.data.selectedAction,i.handoffOffered=!!n.data.handoffOffered,i.requestedContactFields=k(n.data.requestedContactFields),i.conversationEnded=!!n.data.conversationEnded,i.liveMode=n.data.liveMode,i.assignedAgentName=n.data.assignedAgentName,i.visualization=n.data.visualization,i.artifacts=n.data.artifacts,i.audioBase64=n.data.audioBase64,i.mimeType=n.data.mimeType,t.onTextReady?.();else if(n.event===`audio`&&n.data)typeof n.data.seq==`number`?(i.liveAudio=!0,t.onAudioSegment?.({seq:n.data.seq,audioBase64:n.data.audioBase64??``,mimeType:n.data.mimeType,text:typeof n.data.text==`string`?n.data.text:void 0})):(i.audioBase64=n.data.audioBase64,i.mimeType=n.data.mimeType);else if(n.event===`done`)return i}}}return i},O=e=>{let t=`message`,n=[];for(let r of e.split(`
4
- `))r.startsWith(`event:`)?t=r.slice(6).trim():r.startsWith(`data:`)&&n.push(r.slice(5).trim());if(n.length===0)return{event:t};try{return{event:t,data:JSON.parse(n.join(`
5
- `))}}catch{return{event:t}}},k=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[];let A=()=>import(`./dev-transports-DqSPyIEz.mjs`);const j=e=>new w(e.apiBaseUrl,e.token,e.gifApiKey,e.analyticsContextToken,{agentName:e.agentName,agentAvatarUrl:e.agentAvatarUrl},e.identityToken,e.getIdentityToken,e.chatSurface),M=e=>{let t=t=>(...n)=>e().then(e=>e[t].apply(e,n));return{bootstrap:t(`bootstrap`),history:t(`history`),stream:t(`stream`),liveEvents:t(`liveEvents`),presence:t(`presence`),typing:t(`typing`),action:t(`action`),speak:t(`speak`),transcribe:t(`transcribe`),searchGifs:t(`searchGifs`),demoSlots:t(`demoSlots`),identify:t(`identify`),endConversation:t(`endConversation`),sendFeedback:t(`sendFeedback`),sendExplanationFeedback:t(`sendExplanationFeedback`),uploadAttachment:t(`uploadAttachment`)}},N=e=>e.demo?M(async()=>new(await(A())).MockTransport):e.preview?M(async()=>{let{PreviewTransport:t}=await A();return new t(j(e),e.strings)}):j(e),P=(e,t=11)=>{let n=0;for(let t of e)n+=(t.codePointAt(0)??0)>11904?1:.58;return Math.ceil(n*t)},F=(e,t=12,n=20)=>Math.max(n,Math.ceil(e)+t),I=(e,t=12,n=8)=>Math.ceil(t+e+n),L=(e,t,n=11)=>e.length===0||Math.max(...e.map(e=>P(e,n)))<=t-4?{kind:`native`}:e.length>12?{kind:`auto`}:Math.floor((t-4)/(.58*n))>=6?{kind:`truncate`,width:Math.max(16,Math.floor(t-4))}:{kind:`rotate`,rotate:40,width:72},R=e=>Array.isArray(e)?e:e?[e]:[],ee=(e,t)=>{let n=[];for(let r of e)if(Array.isArray(r.data))for(let e of r.data){let r=e;e&&typeof e==`object`&&!Array.isArray(e)&&(r=e.value),Array.isArray(r)&&(r=r[t?0:1]),typeof r==`number`&&Number.isFinite(r)&&n.push(r)}return n},z=(e,t,n)=>{let r=e.axisLabel?.formatter,i=ee(t,n),a=typeof e.min==`number`?e.min:Math.min(0,...i),o=typeof e.max==`number`?e.max:Math.max(0,...i)*1.1,s=i.length||e.min!==void 0?[a,o]:[];return s.length?Math.max(...s.map(e=>{let t=String(e);try{typeof r==`function`&&(t=String(r(e)))}catch{}return P(t)})):P(`00000`)},B=(e,t)=>{if(!(t>0)||Array.isArray(e.grid))return e;let n=R(e.xAxis),r=R(e.yAxis),i=r[0]?.type===`category`,a=i?r[0]:n[0],o=i?n[0]:r[0];if(!a||a.type!==`category`||!o||o.type!==`value`)return e;let s=t<420,c=R(e.series),l={...e.grid??{}},u=(a.data??[]).map(e=>String(e&&typeof e==`object`?e.value??``:e)),d={...e,grid:l},f={...a},p={...o},m=0;if(i)s&&(m=Math.min(t*.35,90),f={...f,axisLabel:{...a.axisLabel,width:Math.floor(m),overflow:`truncate`,ellipsis:`…`}},l.left=8);else{let e=z(o,c,!1);if(m=e+8,s&&!o.name)l.left=8;else if(o.name){let t=F(e);p={...p,nameGap:Math.min(o.nameGap??t,t)},m+=18}}if(!i){let e=typeof l.left==`number`?l.left:0,n=typeof l.right==`number`?l.right:0,r=L(u,Math.max(40,t-e-n-m)/Math.max(1,u.length)),i=a.axisLabel?.fontSize??11,o=i+2;if(r.kind===`truncate`||r.kind===`rotate`){let e=r.kind===`rotate`?r.rotate:0;if(f.axisLabel={...a.axisLabel,interval:0,hideOverlap:!1,rotate:e,width:r.width,overflow:`truncate`,ellipsis:`…`},e){let t=Math.max(0,...u.map(e=>P(e,i))),n=Math.min(r.width,t);o=Math.ceil(n*Math.sin(e*Math.PI/180))+i}}a.name&&s?f.nameGap=Math.min(a.nameGap??99,I(o,6,4)):s&&l.containLabel===!0&&typeof l.bottom==`number`&&(l.bottom=Math.min(l.bottom,8))}return i?(d.yAxis=Array.isArray(e.yAxis)?[f,...r.slice(1)]:f,d.xAxis=Array.isArray(e.xAxis)?[p,...n.slice(1)]:p):(d.xAxis=Array.isArray(e.xAxis)?[f,...n.slice(1)]:f,d.yAxis=Array.isArray(e.yAxis)?[p,...r.slice(1)]:p),d},V=e=>!!(e?.headline?.trim()||e?.summary?.trim()),H=(e,t={})=>{let n=e?.explanation??void 0,r=e?.businessAnalysis?.explanation??void 0,i=[t.requested??void 0,n?.source===`ai_grounded`?n:void 0,r,n];for(let e of i)if(e&&V(e))return e;return t.fallback?.()},U={eyebrow:`Answer from your data`,provenanceAI:`AI-assisted · evidence checked`,provenanceGoverned:`Based on current values`,comparison:`Comparison`,conclusions:`What we can conclude`,whyItMatters:`Why it matters`,limits:`Important limits`,investigate:`Investigate further`,evidenceList:`Evidence checked`,causes:`Possible causes`,causesHint:`Not proven causes`,howToCheck:`How to check:`,recommendations:`Recommended next steps`,watch:`Watch:`,outlook:`Outlook`,followUps:`Ask a follow-up`,sourceNoteAI:`AI-assisted wording, checked against the live values shown here.`,sourceNoteGoverned:`Based only on the live values shown here.`,evidence:`Evidence`,evidenceMetric:`Metric`,evidencePeriod:`Period`,evidenceTimezone:`Timezone`,evidenceFilters:`Filters`,evidenceValue:`Value`,evidenceStatus:`Status`,evidenceSource:`Source`,evidenceChecked:`Checked`,openSource:`Open source`,closeEvidence:`Close evidence details`,citationLabel:`Show evidence`,sourceCard:`This card`,sourceSupportingQuery:`Supporting query`,feedbackPrompt:`Was this explanation helpful?`,feedbackHelpful:`Helpful explanation`,feedbackNotHelpful:`Unhelpful explanation`,feedbackReasonsPrompt:`What went wrong? (optional)`,feedbackCommentPlaceholder:`Anything else? (optional)`,feedbackSubmit:`Send feedback`,feedbackThanks:`Thanks for the feedback.`,feedbackUndo:`Undo`,feedbackError:`Feedback could not be saved. Try again.`,notComparable:`Not comparable yet`,basicExplanation:`Basic explanation`,preparingDetailed:`Preparing a detailed explanation…`,detailedReady:`Detailed explanation ready.`,detailedUnavailable:`A detailed explanation is not available right now.`,detailedRetry:`Try again`,region:`Explanation`,inProgress:`in progress`,expand:`Expand explanation`,collapse:`Collapse explanation`,reasonWrongNumbers:`Wrong numbers`,reasonMissingComparison:`Missing comparison`,reasonUnclear:`Unclear`,reasonTooLong:`Too long`},te=[{id:`wrong_numbers`,label:`Wrong numbers`},{id:`missing_comparison`,label:`Missing comparison`},{id:`unclear`,label:`Unclear`},{id:`too_long`,label:`Too long`}],W=e=>e===`ai_grounded`||e===`rag_deterministic_analysis`,G=e=>{switch(e){case`confirmed_zero`:return`confirmed 0`;case`empty_bucket`:case`unconfirmed_zero`:return`no records yet`;case`missing`:return`missing`;default:return``}},K=e=>{switch(e){case`confirmed_zero`:return`confirmed`;case`empty_bucket`:case`unconfirmed_zero`:return`caution`;case`missing`:return`missing`;default:return`neutral`}},q=e=>!e||e===`observed`||e===`confirmed_zero`,J=e=>{let t=(e??``).trim().toLowerCase().replaceAll(`-`,`_`);return t===`low`||t===`low_quality`?`Low-confidence forecast`:t===`medium`||t===`directional`?`Directional forecast`:t===`high`||t===`validated`||t===`trusted`?`Validated forecast`:`Forecast estimate`},ne=/^\d{4}-\d{2}-\d{2}$/,Y=(e,t,n,r)=>{try{return new Intl.DateTimeFormat(t,r?{...n,timeZone:r}:n).format(e)}catch{return new Intl.DateTimeFormat(t,n).format(e)}},re=(e,t)=>Y(e,`en-CA`,{year:`numeric`,month:`2-digit`,day:`2-digit`},t),ie=(e,t={})=>{let n=e?.trim();if(!n)return``;let r=new Date(n);if(Number.isNaN(r.getTime()))return``;let i={hour:`2-digit`,minute:`2-digit`,hour12:!1},a=re(r,t.timezone)===re(t.now??new Date,t.timezone);return Y(r,t.locale,a?i:{...i,month:`short`,day:`numeric`},t.timezone)},ae=(e,t={})=>{let n=e.timezone?.trim(),r=ie(e.checkedAt,{...t,timezone:n});return[n?`Times in ${n}`:``,r?`Checked ${r}`:``].filter(Boolean).join(` · `)},oe=(e,t,n)=>{let r=e?.trim();if(!r)return``;if(ne.test(r)){let e=new Date(`${r}T00:00:00Z`);return Number.isNaN(e.getTime())?r:Y(e,t,{day:`numeric`,month:`short`,year:`numeric`},`UTC`)}let i=new Date(r);return Number.isNaN(i.getTime())?r:Y(i,t,{day:`numeric`,month:`short`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1},n)},se=(e,t={})=>{if(!e)return``;let n=e.timezone?.trim()||t.timezone?.trim(),r=oe(e.start,t.locale,n),i=oe(e.end,t.locale,n);return r&&i?`${r} – ${i} (end not included)`:r?`From ${r}`:i?`Before ${i}`:``},ce=(e,t,n)=>{if(!e)return{label:`Updated`,description:`Source freshness is unavailable.`,tone:`neutral`};if(e.status===`current`)return{label:`Fresh`,description:`Source data is current.`,tone:`success`};if(e.status===`no_data`)return{label:`No source data`,description:`No source data is available for this period or an earlier period.`,tone:`neutral`};if(e.status!==`delayed`)return{label:`Updated`,description:`Source freshness is unavailable.`,tone:`neutral`};let r=e=>{if(!e)return``;let t=ne.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(t.getTime())?``:new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`}).format(t)},i=r(e.dataAsOf),a=r(t);return{label:`${a?`Checked ${a} · `:``}Latest record${i?` ${i}`:``}`,description:`Latest matching record${i?`: ${i}`:` date is unavailable`}. An older record alone does not prove a source delay.`,tone:`neutral`}},le=(e,t)=>{let n=typeof e.value==`number`&&Number.isFinite(e.value)?e.value:null,r=typeof t.value==`number`&&Number.isFinite(t.value)?t.value:null;return e.status===`missing`||t.status===`missing`||n===null||r===null?{kind:`not_comparable`,reason:`missing`,label:U.notComparable}:q(e.status)?q(t.status)?r===0?{kind:`not_comparable`,reason:`previous_zero`,label:n===0?`No change (0)`:n>0?`Up from 0`:`Down from 0`}:{kind:`change`,percent:(n-r)/Math.abs(r)*100}:{kind:`not_comparable`,reason:`previous_no_records`,label:U.notComparable}:{kind:`not_comparable`,reason:`current_no_records`,label:`${e.label?.trim()||`Current period`}: no records yet`}},ue=e=>e&&[`day`,`week`,`month`,`quarter`,`year`].includes(e)?e:`period`,de=e=>e===`day`?`vs yesterday at this time`:`vs same point last ${ue(e)}`,fe=(e,t)=>{if(!e.cutoffAt)return;let n=new Date(e.cutoffAt);if(Number.isNaN(n.getTime()))return;let r=e.timezone||void 0,i=``;try{i=new Intl.DateTimeFormat(t,{...e.grain===`day`?{}:{weekday:`short`,day:`numeric`,month:`short`},hour:`2-digit`,minute:`2-digit`,timeZone:r}).format(n)}catch{i=n.toISOString()}let a=e.grain===`day`?`on both days`:`in both ${ue(e.grain)}s`,o=e.cutoffSource===`data_as_of`?`, the time of the latest record`:``;return`Compared up to ${i} ${a}${o}${r?` (${r})`:``}`},pe=(e,t,n,r={format:String})=>{if(!e||!e.comparisonBasis||e.comparisonBasis===`complete`)return;let i=e.comparisonBasis,a=le(t,n);if(a.kind===`not_comparable`&&a.reason!==`previous_zero`)return{basis:i,kind:`neutral`,tone:`neutral`,label:a.label,copy:``,reason:a.reason};let o=r.format,s=e.currentPeriod?.label||t.label||`Current period`,c=e.previousPeriod?.label||n.label||`Previous period`,l=typeof t.value==`number`?t.value:e.currentValue,u=typeof e.previousFullValue==`number`?e.previousFullValue:typeof n.value==`number`?n.value:void 0,d=e.grain===`day`?`full day`:`full ${ue(e.grain)}`,f=u===void 0?void 0:`${c} ${d}: ${o(u)}`,p=u===void 0?void 0:`${d.charAt(0).toUpperCase()}${d.slice(1)}: ${o(u)}`;if(i===`like_for_like`&&typeof e.previousToDateValue==`number`&&typeof l==`number`){let n=le({value:l,status:t.status},{value:e.previousToDateValue,status:`observed`}),a=fe(e,r.locale);if(n.kind===`change`){let t=n.percent;return{basis:i,kind:`change`,percent:t,tone:t===0?`neutral`:t>0?`positive`:`negative`,label:`${t>0?`↑`:t<0?`↓`:`→`} ${Math.abs(t).toFixed(1)}%`,copy:de(e.grain),secondary:f,compactSecondary:p,title:a}}return{basis:i,kind:`neutral`,tone:`neutral`,label:n.label,copy:de(e.grain),secondary:f,compactSecondary:p,title:a,reason:n.reason}}if(i===`not_comparable`)return{basis:i,kind:`neutral`,tone:`neutral`,label:`Not comparable`,copy:e.reason||``,reason:e.reason};let m=[typeof l==`number`?`${s} so far: ${o(l)}`:`${s}: in progress`];return u!==void 0&&m.push(`${c}: ${o(u)} (${d})`),{basis:`current_in_progress_no_time`,kind:`neutral`,tone:`neutral`,label:m.join(` · `),copy:``,title:e.reason,reason:e.reason}},me=e=>e?.grain===`day`?`Yesterday at this time`:`Same point last ${ue(e?.grain)}`,he=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?``:e.toISOString().slice(0,10);let t=typeof e==`string`?e.trim():``;return/^\d{4}-\d{2}-\d{2}/.test(t)?t.slice(0,10):``},X=(e,t)=>{let n=he(t);if(!(!n||!e)){if(e.previousPeriod?.start&&he(e.previousPeriod.start)===n)return`previous`;if(e.currentPeriod?.start&&he(e.currentPeriod.start)===n)return`current`}},ge=(e,t,n,r={format:String})=>{if(!e||!e.series?.length||!e.comparisonBasis||e.comparisonBasis===`complete`)return;let i=X(e,t);if(!i)return;let a=String(n??``),o=e.series.find(e=>e.key===a);if(!o)return;let s=e.comparisonBasis;if(i===`previous`){let e=s===`like_for_like`&&typeof o.previousToDateValue==`number`;return{side:i,basis:s,toDate:e,plotValue:e?o.previousToDateValue:void 0,fullValue:o.previousFullValue}}return{side:i,basis:s,toDate:!1,display:pe({...e,currentValue:o.currentValue,previousToDateValue:o.previousToDateValue,previousFullValue:o.previousFullValue},{value:o.currentValue,status:o.currentValue===void 0?`missing`:`observed`},{value:o.previousFullValue,status:o.previousFullValue===void 0?`missing`:`observed`},r)}},_e=e=>!!(e&&e.seriesField&&e.series?.length&&e.comparisonBasis&&e.comparisonBasis!==`complete`&&e.comparisonBasis!==`not_comparable`),ve=e=>{if(!_e(e))return;let t=e.currentPeriod?.label||`Current period`;return e.comparisonBasis===`like_for_like`?`${t} so far, compared with ${me(e).toLowerCase()}`:`${t} so far; the previous period is shown in full, so the bars are not like for like`},ye=(e,t,n)=>{if(!t)return[];if(t.side===`previous`)return typeof t.fullValue==`number`&&t.toDate?[`Full ${e?.grain===`day`?`day`:ue(e?.grain)}: ${n(t.fullValue)}`]:[];let r=t.display;return r?r.kind===`change`&&r.percent!==void 0?[`${r.label} ${r.copy}`.trim()]:r.kind===`neutral`&&r.label&&t.basis===`like_for_like`?[r.label]:[]:[]},be=`__previous_to_date`,xe=(e,t)=>{let n=e.trim().toLowerCase(),r=t.trim().toLowerCase();return n===r||n.endsWith(`.${r}`)||r.endsWith(`.${n}`)},Se=e=>{let t=e.periodComparison,n=e.rows;if(!n?.length||!_e(t)||t.comparisonBasis!==`like_for_like`||!t.series?.some(e=>typeof e.previousToDateValue==`number`))return e;let r=e.columnMetadata??[],i=e.columns?.filter(Boolean)??(r.length?r.map(e=>String(e.key??e.name??``)).filter(Boolean):Object.keys(n[0]??{}));if(i.includes(be))return e;let a=i.find(e=>xe(t.seriesField,e));if(!a)return e;let o=e=>r.find(t=>(t.key??t.name)===e),s=i.find(e=>{let t=o(e);return t?.semanticRole===`date`||t?.role===`date`||t?.dataType===`date`||t?.dataType===`datetime`}),c=(t.measureField?i.find(e=>xe(t.measureField,e)):void 0)??i.find(e=>o(e)?.semanticRole===`measure`),l=n.map(e=>{let n=s?X(t,e[s]):`current`,r=t.series?.find(t=>t.key===String(e[a]??``)),i=n&&typeof r?.previousToDateValue==`number`?r.previousToDateValue:null;return{...e,[be]:i}}),u={...(c?o(c):void 0)??{dataType:`number`,semanticRole:`measure`},key:be,name:void 0,label:`Previous to date`,aggregation:`none`,sourceField:void 0,priority:`secondary`,groupable:!1,filterable:!1};return{...e,rows:l,columns:e.columns?[...e.columns,be]:e.columns,columnMetadata:r.length?[...r,u]:e.columnMetadata}},Ce=e=>!!(e?.lastPeriodInProgress||e?.caveats?.some(e=>e.code===`incomplete_final_period`)||e?.periodComparison?.currentPeriod?.inProgress),Z=(e,t)=>t(String(e??``).replace(/\s+/g,` `).trim()).trim(),we=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e.toLocaleString(t):``,Te=e=>{let t=[];return e?.liveboardTileId?.trim()&&t.push({kind:`liveboard_tile`,id:e.liveboardTileId.trim()}),e?.insightId?.trim()&&t.push({kind:`insight`,id:e.insightId.trim()}),e?.queryRunId?.trim()&&t.push({kind:`query_run`,id:e.queryRunId.trim()}),t},Ee=(e,t={})=>{let{locale:n}=t,r={...U,...t.copy},i=t.cleanText??(e=>e),a=e.timezone?.trim()||void 0,o=new Map;for(let t of e.evidenceItems??[])t?.id?.trim()&&!o.has(t.id.trim())&&o.set(t.id.trim(),t);let s=[],c={},l=r=>{let l=r?.trim();if(!l)return;let u=c[l];if(u)return{id:l,index:u.index};let d=o.get(l);if(!d)return;let f=d.valueStatus,p=G(f)||(f===`observed`?`observed`:``),m=d.source?.kind,h={id:l,index:s.length+1,text:Z(d.text,i),...d.metric?.trim()?{metric:d.metric.trim()}:{},...d.period?.label?.trim()?{periodLabel:d.period.label.trim()}:{},...(()=>{let e=se(d.period,{locale:n,timezone:a});return e?{periodRange:e}:{}})(),...d.period?.timezone?.trim()||a?{timezone:d.period?.timezone?.trim()||a}:{},...d.filters?.length?{filters:d.filters.map(e=>e.trim()).filter(Boolean)}:{},...(()=>{let e=we(d.value,n);return e?{valueText:e}:{}})(),...p?{statusLabel:p}:{},statusTone:K(f),...d.statusReason?.trim()?{statusReason:Z(d.statusReason,i)}:{},...m===`card`?{sourceLabel:U.sourceCard}:m===`supporting_query`?{sourceLabel:U.sourceSupportingQuery}:{},sourceTargets:Te(d.source),...(()=>{let r=ie(d.checkedAt??e.checkedAt,{locale:n,timezone:a,now:t.now});return r?{checkedText:r}:{}})()};return h.filters&&h.filters.length===0&&delete h.filters,s.push(h),c[l]=h,{id:l,index:h.index}},u=e=>{let t=new Set,n=[];for(let r of e??[]){let e=l(r);e&&!t.has(e.id)&&(t.add(e.id),n.push(e))}return n},d=W(e.source)||e.level===`detailed`,f=Z(e.headline,i)||Z(e.summary,i),p={text:f,citations:u(e.headlineEvidenceIds)},m=Z(e.summary,i),h=m&&m!==f?{text:m,citations:u(e.summaryEvidenceIds)}:void 0;if(!h&&m&&e.summaryEvidenceIds?.length)for(let t of u(e.summaryEvidenceIds))p.citations.some(e=>e.id===t.id)||p.citations.push(t);let g=(e.periods??[]).filter(e=>e?.label?.trim()).map(e=>{let t=e.valueStatus,r=G(t),a=e.valueText?.trim()||we(e.value,n)||(t===`missing`?`—`:``),s=r?e.statusReason?.trim()||o.get(e.evidenceId?.trim()??``)?.statusReason?.trim():``,c=l(e.evidenceId);return{key:e.evidenceId||`${e.label}-${e.start??``}-${e.end??``}`,label:e.label.trim(),valueText:a,...t?{status:t}:{},statusLabel:r,statusTone:K(t),inProgress:!!e.inProgress,current:!!e.current,...s?{reason:Z(s,i)}:{},...c?{citation:c}:{}}}),_=t.maxConclusions??4,v=(e.evidenceStatements??[]).map(e=>({text:Z(e.text,i),citations:u(e.evidenceIds)})).filter(e=>e.text),y=(v.length>0?v:(e.evidence??[]).map(e=>Z(e,i)).filter(Boolean).map(e=>({text:e,citations:[]}))).filter((e,t,n)=>n.findIndex(t=>t.text===e.text)===t).filter(e=>e.text!==p.text&&e.text!==h?.text).slice(0,_),b=Z(e.businessMeaning,i),x=b?{text:b,citations:u(e.businessMeaningEvidenceIds)}:void 0,S=[],C=e=>{e.text&&!S.some(t=>t.text===e.text)&&S.push(e)},w=(e.limitations??[]).map(e=>e.toLowerCase());for(let e of g){let t=w.some(t=>t.includes(e.label.toLowerCase())&&t.includes(`in progress`));e.inProgress&&!t&&C({kind:`in_progress`,text:`${e.label} is still in progress, so its total can still change.`,...e.citation?{citation:e.citation}:{}}),(e.status===`empty_bucket`||e.status===`unconfirmed_zero`)&&C({kind:`no_records`,text:`${e.label} has no records yet. This is not a confirmed 0${e.reason?`: ${e.reason.replace(/\.$/,``)}`:``}.`,...e.citation?{citation:e.citation}:{}}),e.status===`missing`&&C({kind:`missing`,text:`${e.label} is missing${e.reason?`: ${e.reason.replace(/\.$/,``)}`:``}.`,...e.citation?{citation:e.citation}:{}})}e.currentPeriodInProgress&&!g.some(e=>e.inProgress)&&C({kind:`in_progress`,text:`The current period is still in progress, so its total can still change.`});for(let t of e.missing??[]){if(!t?.label?.trim()||!t.reason?.trim())continue;let e=l(t.evidenceId);C({kind:`missing`,text:De(t),...e?{citation:e}:{}})}(e.dataFreshness?.status===`delayed`||e.dataFreshness?.status===`no_data`)&&C({kind:`freshness`,text:ce(e.dataFreshness,e.checkedAt,n).description});for(let t of e.limitations??[]){let e=Z(t,i);e&&C({kind:`limitation`,text:e})}let T=(e.possibleDrivers??[]).map(e=>({title:Z(e.hypothesis,i),howToCheck:Z(e.howToCheck,i),citations:u(e.evidenceIds)})).filter(e=>e.title).slice(0,t.maxCauses??3),E=(e.recommendations??[]).map(e=>({title:Z(e.action,i),why:Z(e.why,i),...e.successMetric?.trim()?{watch:Z(e.successMetric,i)}:{},citations:u(e.evidenceIds)})).filter(e=>e.title).slice(0,t.maxRecommendations??3),D=Z(e.forecast?.text,i),O=D?{badge:J(e.forecast?.qualityStatus),text:D,...e.forecast?.limitations?.trim()?{note:Z(e.forecast.limitations,i)}:{}}:void 0,k=(e.followUps??[]).map(e=>Z(e,i)).filter(Boolean).filter((e,t,n)=>n.indexOf(e)===t).slice(0,t.maxFollowUps??4);for(let e of o.keys())l(e);let A=Z(e.conversationalPreface,i);return{...e.explanationId?.trim()?{explanationId:e.explanationId.trim()}:{},ai:d,lead:{eyebrow:r.eyebrow,provenance:d?r.provenanceAI:e.level===`basic`?r.basicExplanation:r.provenanceGoverned,...A?{preface:A}:{},headline:p,...h?{summary:h}:{}},comparison:g,conclusions:y,...x?{businessMeaning:x}:{},limits:S,checkedLine:ae(e,{locale:n,now:t.now}),investigate:{causes:T,recommendations:E,...O?{outlook:O}:{},followUps:k},hasInvestigate:T.length>0||E.length>0||!!O||k.length>0||s.length>0,evidence:s,evidenceById:c,sourceNote:d?r.sourceNoteAI:r.sourceNoteGoverned}},De=e=>`${e.label.trim()} could not be established: ${e.reason.trim()}`,Oe=e=>`[${e.index}]`,ke=(e,t)=>{let n={...U,...t},r=[];e.metric&&r.push({key:`metric`,label:n.evidenceMetric,value:e.metric});let i=[e.periodLabel,e.periodRange].filter(Boolean).join(` · `);i&&r.push({key:`period`,label:n.evidencePeriod,value:i}),e.timezone&&r.push({key:`timezone`,label:n.evidenceTimezone,value:e.timezone}),e.filters?.length&&r.push({key:`filters`,label:n.evidenceFilters,value:e.filters.join(`; `)});let a=[e.valueText,e.statusLabel].filter(Boolean).join(` · `);return a&&r.push({key:`value`,label:n.evidenceValue,value:a}),e.statusReason&&r.push({key:`reason`,label:n.evidenceStatus,value:e.statusReason}),e.sourceLabel&&r.push({key:`source`,label:n.evidenceSource,value:e.sourceLabel}),e.checkedText&&r.push({key:`checked`,label:n.evidenceChecked,value:e.checkedText}),r},Ae=e=>{let t=new Set(te.map(e=>e.id)),n=Array.from(e.comment??``).map(e=>{let t=e.charCodeAt(0);return t<32||t>=127&&t<=159?` `:e}).join(``).replace(/\s+/g,` `).trim(),r=e.rating===`down`?[...new Set(e.reasons??[])].filter(e=>t.has(e)).slice(0,4):[];return{explanationId:e.explanationId,rating:e.rating,...r.length?{reasons:r}:{},...e.rating!==`clear`&&n?{comment:Array.from(n).slice(0,500).join(``)}:{},...e.modelId?{modelId:e.modelId}:{},...typeof e.modelVersion==`number`&&e.modelVersion>0?{modelVersion:e.modelVersion}:{}}},je=(e,t)=>{let n=`.${e}-xp`;return`
6
- ${n}{display:grid;gap:12px;color:${t.text};font-size:13px;line-height:1.55;min-width:0}
7
- ${n} h3,${n} h4,${n} p,${n} ul,${n} ol,${n} dl,${n} dd{margin:0}
8
- ${n} ul,${n} ol{padding:0;list-style:none}
9
- ${n}__lead{display:grid;gap:6px}
10
- ${n}__meta{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px}
11
- ${n}__eyebrow{color:${t.accent};font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase}
12
- ${n}__provenance{display:inline-flex;align-items:center;gap:6px;color:${t.muted};font-size:11px;font-weight:600}
13
- ${n}__provenance::before{content:"";width:6px;height:6px;border-radius:999px;background:${t.accent}}
14
- ${n}__preface{color:${t.muted}}
15
- ${n}__headline{color:${t.text};font-size:16px;font-weight:700;line-height:1.4;letter-spacing:-.01em}
16
- ${n}__summary{color:${t.muted}}
17
- ${n}{position:relative}
18
- ${n}__expand{position:absolute;inset-block-start:0;inset-inline-end:0;display:grid;width:28px;height:28px;place-items:center;border:1px solid ${t.border};border-radius:8px;background:${t.surface};color:${t.text};font:inherit;font-size:14px;line-height:1;cursor:pointer}
19
- ${n}.is-expanded{max-width:none;font-size:14px}
20
- ${n}.has-expand ${n}__lead{padding-inline-end:36px}
21
- ${n}__ai{min-height:18px;color:${t.muted};font-size:12px}
22
- ${n}__ai-note{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin:0}
23
- ${n}__ai[data-ai-status="pending"] ${n}__ai-note::before{content:"";width:6px;height:6px;border-radius:999px;background:${t.accent};animation:${n.replace(/[^a-z0-9]/gi,``)}-ai-pulse 1.2s ease-in-out infinite}
24
- ${n}__ai-retry{border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.text};font:inherit;font-weight:600;padding:2px 10px;cursor:pointer}
25
- ${n}__ai-retry:disabled{opacity:.6;cursor:default}
26
- ${n}__sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
27
- @keyframes ${n.replace(/[^a-z0-9]/gi,``)}-ai-pulse{0%,100%{opacity:.35}50%{opacity:1}}
28
- @media (prefers-reduced-motion:reduce){${n}__ai-note::before{animation:none}}
29
- ${n}__step{display:grid;gap:8px;border-top:1px solid ${t.border};padding-top:12px}
30
- ${n}__title{color:${t.text};font-size:12px;font-weight:700}
31
- ${n}__periods{display:grid;gap:6px}
32
- ${n}__period{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;border:1px solid ${t.border};border-radius:10px;background:${t.subtle};padding:8px 10px}
33
- ${n}__period-label{min-width:0;flex:1 1 auto;color:${t.muted};font-weight:600}
34
- ${n}__period-value{color:${t.text};font-size:15px;font-weight:700;font-variant-numeric:tabular-nums}
35
- ${n}__period-reason{flex-basis:100%;color:${t.muted};font-size:11px}
36
- ${n}__chip{display:inline-flex;align-items:center;border-radius:999px;padding:2px 8px;font-size:11px;font-weight:650;white-space:nowrap;border:1px solid transparent}
37
- ${n}__chip.is-confirmed{background:color-mix(in srgb,${t.success} 12%,transparent);color:${t.text};border-color:color-mix(in srgb,${t.success} 35%,transparent)}
38
- ${n}__chip.is-caution{background:color-mix(in srgb,${t.warning} 14%,transparent);color:${t.text};border-color:color-mix(in srgb,${t.warning} 40%,transparent)}
39
- ${n}__chip.is-missing{background:color-mix(in srgb,${t.danger} 10%,transparent);color:${t.text};border-color:color-mix(in srgb,${t.danger} 35%,transparent)}
40
- ${n}__chip.is-progress{background:transparent;color:${t.muted};border-color:${t.border}}
41
- ${n}__list{display:grid;gap:6px}
42
- ${n}__list>li{position:relative;padding-inline-start:14px;color:${t.text}}
43
- ${n}__list>li::before{content:"";position:absolute;inset-inline-start:2px;top:.62em;width:5px;height:5px;border-radius:999px;background:${t.accent}}
44
- ${n}__limits>li::before{background:${t.warning}}
45
- ${n}__meaning{border-inline-start:2px solid ${t.accent};border-start-end-radius:8px;border-end-end-radius:8px;background:color-mix(in srgb,${t.accent} 7%,transparent);padding:8px 10px;color:${t.text}}
46
- ${n}__meaning strong{font-weight:700}
47
- ${n}__checked{color:${t.muted};font-size:11px}
48
- ${n}__cite{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;margin-inline-start:3px;vertical-align:middle;border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.accent};font:inherit;font-size:11px;font-weight:700;line-height:1;padding:0 5px;cursor:pointer}
49
- ${n}__cite:hover,${n}__cite[aria-expanded="true"]{border-color:${t.accent};background:color-mix(in srgb,${t.accent} 10%,${t.surface})}
50
- ${n} button:focus-visible,${n} summary:focus-visible,${n} textarea:focus-visible{outline:2px solid ${t.accent};outline-offset:2px}
51
- ${n}__evidence-panel{display:grid;gap:8px;border:1px solid color-mix(in srgb,${t.accent} 35%,${t.border});border-radius:10px;background:${t.surface};padding:10px 12px;box-shadow:0 6px 18px color-mix(in srgb,${t.text} 12%,transparent)}
52
- ${n}__evidence-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
53
- ${n}__evidence-text{color:${t.text};font-weight:650}
54
- ${n}__evidence-rows{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:4px 12px;font-size:12px}
55
- ${n}__evidence-rows dt{color:${t.muted}}
56
- ${n}__evidence-rows dd{color:${t.text};overflow-wrap:anywhere}
57
- ${n}__evidence-actions{display:flex;flex-wrap:wrap;gap:8px}
58
- ${n}__button{display:inline-flex;align-items:center;gap:6px;min-height:32px;border:1px solid ${t.border};border-radius:8px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;font-weight:600;padding:5px 10px;cursor:pointer}
59
- ${n}__button:hover{border-color:${t.accent}}
60
- ${n}__button.is-primary{border-color:${t.accent};background:${t.accent};color:${t.onAccent??`#fff`}}
61
- ${n}__close{border:0;background:transparent;color:${t.muted};font:inherit;font-size:16px;line-height:1;padding:2px 6px;cursor:pointer;border-radius:6px}
62
- ${n}__investigate{border-top:1px solid ${t.border};padding-top:10px}
63
- ${n}__investigate>summary{cursor:pointer;color:${t.text};font-weight:700;list-style:revert}
64
- ${n}__investigate-body{display:grid;gap:12px;margin-top:10px}
65
- ${n}__group{display:grid;gap:6px}
66
- ${n}__group-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 8px}
67
- ${n}__hint{color:${t.muted};font-size:11px;font-weight:600}
68
- ${n}__card{border-radius:8px;background:${t.subtle};padding:8px 10px}
69
- ${n}__card-title{color:${t.text};font-weight:700}
70
- ${n}__card-body{margin-top:2px;color:${t.muted};font-size:12px}
71
- ${n}__questions{display:flex;flex-wrap:wrap;gap:6px}
72
- ${n}__question{border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;padding:6px 10px;text-align:start;cursor:pointer}
73
- ${n}__question:hover{border-color:${t.accent}}
74
- ${n}__source{color:${t.muted};font-size:11px}
75
- ${n}__feedback{display:grid;gap:8px;border-top:1px solid ${t.border};padding-top:10px}
76
- ${n}__feedback-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
77
- ${n}__feedback-label{color:${t.muted};font-size:12px;font-weight:600}
78
- ${n}__vote{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:0;border-radius:8px;background:transparent;color:${t.muted};font:inherit;cursor:pointer}
79
- ${n}__vote:hover{background:color-mix(in srgb,${t.accent} 10%,transparent);color:${t.accent}}
80
- ${n}__vote svg{width:15px;height:15px}
81
- ${n}__vote[aria-pressed="true"]{color:${t.accent};background:color-mix(in srgb,${t.accent} 12%,transparent)}
82
- ${n}__reasons{display:flex;flex-wrap:wrap;gap:6px;border:0;margin:0;padding:0}
83
- ${n}__reasons legend{margin-bottom:6px;color:${t.muted};font-size:12px;padding:0}
84
- ${n}__reason{border:1px solid ${t.border};border-radius:999px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;padding:4px 10px;cursor:pointer}
85
- ${n}__reason[aria-pressed="true"]{border-color:${t.accent};background:color-mix(in srgb,${t.accent} 12%,${t.surface})}
86
- ${n}__comment{width:100%;box-sizing:border-box;min-height:56px;resize:vertical;border:1px solid ${t.border};border-radius:8px;background:${t.surface};color:${t.text};font:inherit;font-size:12px;padding:8px}
87
- ${n}__feedback-note{color:${t.muted};font-size:12px}
88
- ${n}__feedback-error{color:${t.danger};font-size:12px}
89
- `};var Me=class{constructor(e,t,n,r={}){this.explanationId=e,this.submit=t,this.onChange=n,this.context=r,h(this,`state`,{phase:`idle`,reasons:[],comment:``})}set(e){this.state={...this.state,...e},this.onChange(this.state)}async save(e,t){let n=this.state;this.set({phase:`saving`,error:void 0});try{await this.submit(Ae({explanationId:this.explanationId,...this.context,...e})),this.set({...t,error:void 0})}catch{this.set({phase:n.phase===`details`?`details`:`error`,rating:n.rating,error:U.feedbackError})}}vote(e){return this.state.phase===`saving`?Promise.resolve():this.save({rating:e},e===`up`?{phase:`done`,rating:e,reasons:[],comment:``}:{phase:`details`,rating:e})}toggleReason(e){let t=this.state.reasons.includes(e)?this.state.reasons.filter(t=>t!==e):[...this.state.reasons,e];this.set({reasons:t})}setComment(e){this.set({comment:Array.from(e).slice(0,500).join(``)})}send(){return this.state.phase===`saving`?Promise.resolve():this.save({rating:`down`,reasons:this.state.reasons,comment:this.state.comment},{phase:`done`,rating:`down`})}undo(){return this.state.phase===`saving`?Promise.resolve():this.save({rating:`clear`},{phase:`idle`,rating:void 0,reasons:[],comment:``})}};const Ne={delaysMs:[1e3,2e3,4e3],capMs:45e3},Pe=e=>e===`pending`||e===`ready`||e===`failed`?e:`not_requested`,Fe=e=>Pe(e?.aiExplanation?.status);var Ie=class{constructor(e,t,n,r={}){this.transport=t,this.onChange=n,h(this,`state`,void 0),h(this,`handle`,void 0),h(this,`disposed`,!1),h(this,`generation`,0),h(this,`attempt`,0),h(this,`startedAt`,0),h(this,`delays`,void 0),h(this,`capMs`,void 0),h(this,`now`,void 0),h(this,`schedule`,void 0),h(this,`cancelTimer`,void 0),h(this,`isVisible`,void 0),h(this,`onSettled`,void 0),h(this,`inFlight`,null),h(this,`pausedAt`,null),h(this,`onVisibilityChange`,()=>{this.disposed||this.pausedAt===null||!this.isVisible()||(this.startedAt+=this.now()-this.pausedAt,this.pausedAt=null,this.queue())}),this.delays=r.delaysMs?.length?r.delaysMs:Ne.delaysMs,this.capMs=r.capMs??Ne.capMs,this.now=r.now??(()=>Date.now()),this.schedule=r.schedule??((e,t)=>setTimeout(e,t)),this.cancelTimer=r.cancel??(e=>clearTimeout(e)),this.isVisible=r.isVisible??(()=>typeof document>`u`||document.visibilityState!==`hidden`),this.onSettled=r.onSettled;let i=Fe(e),a=i===`pending`&&!t?`not_requested`:i;this.state={status:a,explanation:e,retryAvailable:a===`failed`&&this.canRetry(e.aiExplanation?.retryAvailable),retrying:!1,announcement:``}}get explanationId(){return this.state.explanation.aiExplanation?.explanationId||this.state.explanation.explanationId||``}canRetry(e){return!!this.transport?.retry&&e!==!1}set(e){if(this.disposed)return;let t=this.state.status;this.state={...this.state,...e},this.onChange(this.state);let n=this.state.status;n!==t&&(n===`ready`||n===`failed`||n===`not_requested`)&&this.onSettled?.(n)}start(){this.state.status!==`pending`||!this.explanationId||(this.disposed=!1,this.startedAt=this.now(),this.attempt=0,typeof document<`u`&&document.addEventListener(`visibilitychange`,this.onVisibilityChange),this.queue())}queue(){if(this.disposed)return;if(!this.isVisible()){this.pausedAt??(this.pausedAt=this.now());return}let e=this.now()-this.startedAt;if(e>=this.capMs){this.fail(!0);return}let t=this.delays[Math.min(this.attempt,this.delays.length-1)]??4e3;this.attempt+=1;let n=this.generation;this.handle=this.schedule(()=>{this.pollOnce(n)},Math.min(t,Math.max(0,this.capMs-e)))}async pollOnce(e){if(this.disposed||e!==this.generation||!this.transport)return;if(!this.isVisible()){this.pausedAt??(this.pausedAt=this.now());return}let t=new AbortController;this.inFlight=t;try{let n=await this.transport.poll(this.explanationId,t.signal);if(this.disposed||e!==this.generation)return;this.apply(n)}catch{if(this.disposed||e!==this.generation)return;this.queue()}finally{this.inFlight===t&&(this.inFlight=null)}}apply(e){let t=Pe(e.status);if(this.applyBasicUpdate(e,t),t===`ready`&&e.explanation&&V(e.explanation)){this.set({status:`ready`,explanation:e.explanation,retryAvailable:!1,retrying:!1,announcement:U.detailedReady});return}if(t===`pending`){this.state.status!==`pending`&&this.set({status:`pending`,retrying:!1,announcement:``}),this.queue();return}if(t===`not_requested`){this.set({status:`not_requested`,retryAvailable:!1,retrying:!1,announcement:``});return}this.fail(this.canRetry(e.retryAvailable))}applyBasicUpdate(e,t){let n=e.basic;if(!n||t===`ready`||this.state.status===`ready`||!V(n))return;let r=this.state.explanation;n.headline===r.headline&&n.summary===r.summary||this.set({explanation:{...n,explanationId:r.explanationId??n.explanationId,aiExplanation:r.aiExplanation,level:r.level}})}fail(e){this.generation+=1,this.set({status:`failed`,retryAvailable:e&&this.canRetry(!0),retrying:!1,announcement:U.detailedUnavailable})}async retry(){if(!this.transport?.retry||this.state.retrying||this.state.status===`ready`)return;let e=this.explanationId;if(!e)return;this.generation+=1;let t=this.generation;this.set({retrying:!0,announcement:``});try{let n=await this.transport.retry(e);if(this.disposed||t!==this.generation)return;if(Pe(n.status)===`pending`){this.set({status:`pending`,retrying:!1,retryAvailable:!1,announcement:U.preparingDetailed}),this.startedAt=this.now(),this.attempt=0,this.queue();return}this.apply(n)}catch{if(this.disposed||t!==this.generation)return;this.set({status:`failed`,retrying:!1,retryAvailable:!1,announcement:U.detailedUnavailable})}}dispose(){this.disposed=!0,this.generation+=1,this.inFlight?.abort(),this.inFlight=null,this.handle!==void 0&&this.cancelTimer(this.handle),typeof document<`u`&&document.removeEventListener(`visibilitychange`,this.onVisibilityChange)}};const Le=/^(\d{4})-(\d{2})-(\d{2})$/,Re=/^(\d{4})-(\d{2})$/,ze=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/,Be=/(?:Z|[+-]\d{2}:?\d{2})$/i,Ve=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:{date:e,calendar:!1,hasTime:!0};if(typeof e==`number`&&Number.isFinite(e))return{date:new Date(e),calendar:!1,hasTime:!0};if(typeof e!=`string`)return null;let t=e.trim(),n=Le.exec(t);if(n)return{date:new Date(Date.UTC(Number(n[1]),Number(n[2])-1,Number(n[3]))),calendar:!0,hasTime:!1};if(n=Re.exec(t),n)return{date:new Date(Date.UTC(Number(n[1]),Number(n[2])-1,1)),calendar:!0,hasTime:!1};if(n=ze.exec(t),n&&!Be.test(t))return{date:new Date(Date.UTC(Number(n[1]),Number(n[2])-1,Number(n[3]),Number(n[4]),Number(n[5]),Number(n[6]??0))),calendar:!0,hasTime:!0};if(!/^\d{4}-\d{2}-\d{2}T/.test(t))return null;let r=new Date(t);return Number.isNaN(r.getTime())?null:{date:r,calendar:!1,hasTime:!0}},He=e=>{if(e){if(/h/i.test(e)&&/:/.test(e))return`hour`;if(/d{2}/i.test(e))return`day`;if(/q/i.test(e))return`quarter`;if(/M{2,}/.test(e))return`month`;if(/y{2,}/i.test(e))return`year`}},Ue=e=>{let t=e.map(Ve).filter(e=>e!==null);if(t.length===0)return;let n=e=>e.date.getUTCHours()+e.date.getUTCMinutes();return t.some(e=>e.hasTime&&n(e)!==0)?t.every(e=>e.date.getUTCMinutes()===0)?`hour`:void 0:t.length>1&&t.every(e=>e.date.getUTCDate()===1)?`month`:`day`},We=(e,t)=>{try{return new Intl.DateTimeFormat(e,t)}catch{return new Intl.DateTimeFormat(e,{...t,timeZone:`UTC`})}},Ge=(e,t,n={})=>{let r=Ve(e);if(!r)return;let i=t?.grain??He(t?.formatPattern)??n.grain,a=r.calendar?`UTC`:n.timezone||void 0,{date:o}=r;switch(i){case`year`:return We(n.locale,{year:`numeric`,timeZone:a}).format(o);case`quarter`:{let e=Number(We(`en-US`,{month:`numeric`,timeZone:a}).format(o)),t=We(n.locale,{year:`numeric`,timeZone:a}).format(o);return`Q${Math.floor((e-1)/3)+1} ${t}`}case`month`:return We(n.locale,{month:`short`,year:`numeric`,timeZone:a}).format(o);case`week`:case`day`:return We(n.locale,{day:`numeric`,month:`short`,year:`numeric`,timeZone:a}).format(o);case`hour`:return We(n.locale,{day:`numeric`,month:`short`,hour:`numeric`,minute:`2-digit`,timeZone:a}).format(o);default:return We(n.locale,{dateStyle:`medium`,...r.hasTime?{timeStyle:`short`}:{},timeZone:a}).format(o)}},Ke=e=>{let t=e?/\.([0#]+)/.exec(e):null;if(!t)return;let n=t[1];return{min:(n.match(/0/g)??[]).length,max:n.length}},qe=(e,t)=>{let n=Ke(e);return n?{minimumFractionDigits:n.min,maximumFractionDigits:n.max}:{maximumFractionDigits:t}},Je=e=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim()){let t=Number(e);if(Number.isFinite(t))return t}return null},Ye=(e,t)=>t&&Math.abs(e)>=1e4?`compact`:`standard`,Xe=(e,t={})=>new Intl.NumberFormat(t.locale,{notation:Ye(e,t.compact),...qe(t.pattern,t.maxFractionDigits??2)}).format(e),Ze=(e,t,n={})=>{let r=t?.trim().toUpperCase();if(r&&/^[A-Z]{3}$/.test(r))try{return new Intl.NumberFormat(n.locale,{style:`currency`,currency:r,notation:Ye(e,n.compact),...Ke(n.pattern)?qe(n.pattern,2):{}}).format(e)}catch{}return Xe(e,{...n,maxFractionDigits:2})},Qe=(e,t={})=>{let n=!!(t.pattern&&/(?<!\\)%/.test(t.pattern)),r=qe(t.pattern,2);return new Intl.NumberFormat(t.locale,{style:`percent`,...r}).format(n?e:e/100)},$e=(e,t,n={})=>{let{locale:r,compact:i}=n;return t?.dataType===`currency`?Ze(e,t.currencyCode||n.currencyCode,{locale:r,compact:i,pattern:t.formatPattern}):t?.dataType===`percent`?Qe(e,{locale:r,pattern:t.formatPattern}):Xe(e,{locale:r,compact:i,pattern:t?.formatPattern,maxFractionDigits:n.maxFractionDigits})},et=(e,t,n={})=>{if(e==null||e===``)return`—`;if(t?.dataType===`date`||t?.dataType===`datetime`){let r=Ge(e,t,n);if(r)return r}if(t?.dataType===`currency`||t?.dataType===`percent`){let r=Je(e);if(r!==null)return $e(r,t,n)}return typeof e==`number`&&Number.isFinite(e)?$e(e,t,{...n,maxFractionDigits:4}):typeof e==`boolean`?e?n.yes??`Yes`:n.no??`No`:String(e)},tt={resultDetails:`Result details`,liveMetric:`Live metric`,currentValue:`Current value`,noMatchTitle:`No matching data`,noMatchBody:`No approved records matched this question.`,chartType:`Chart type`,chooseChartType:`Choose chart type`,aggregate:`Aggregate`,aggregateTitle:`Ask for a new governed calculation`,aggregateCharge:`New governed answer. Query charges may apply.`,chartFallback:`Chart`,chartLine:`Line`,chartBar:`Bar`,chartStackedBar:`Stacked bar`,chartLineHint:`Best for change over time.`,chartBarHint:`Compare categories or ranked values.`,chartStackedBarHint:`Compare totals and their parts.`,aggregationSum:`Total`,aggregationAvg:`Average`,aggregationMin:`Minimum`,aggregationMax:`Maximum`,aggregationCount:`Total count`,aggregationCountDistinct:`Unique count`,download:`Download`,downloadData:`Download this data`,expandTable:`Expand table`,expandChart:`Expand chart`,restoreView:`Restore assistant view`,aboutResult:`About this result`,aboutPeriod:`Period`,aboutResults:`Results`,aboutChecked:`Checked`,aboutTimezone:`Timezone`,aboutSourceData:`Source data`,aboutFilters:`Filters`,rowOne:`{count} row`,rowMany:`{count} rows`,filtersOne:`{count} applied filter`,filtersMany:`{count} applied filters`,filtersApplied:`{count} applied`,notSet:`Not set`,noValue:`No value`,yes:`Yes`,no:`No`,chartValues:`Values`,chartTitle:`{measure} by {dimension}`,seriesLimited:`Showing {shown} of {total} series.`,summaryLatest:`Latest ({category}): {values}.`,summaryNoTrend:`No numeric trend values are available.`,summaryHighest:`Highest: {category}, {series} {value}.`,summaryNoComparison:`No numeric comparison values are available.`,zoomControls:`Chart zoom controls`,zoomIn:`Zoom in chart`,zoomOut:`Zoom out chart`,zoomReset:`Reset chart zoom`,zoomResetShort:`Reset`,zoomNone:`No chart points`,zoomAllOne:`All {count} point`,zoomAllMany:`All {count} points`,zoomRange:`{start} – {end} · {visible} of {count} points`,inProgress:`in progress`,newContent:`New content`,updatedAt:`Updated {time}`,liveData:`Live data`,viewData:`View data`,hideData:`Hide data`,inProgressLegend:`In progress`,governedResult:`Governed result`},nt=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??``)),rt=e=>Object.fromEntries(Object.entries(e??{}).filter(([,e])=>e!=null)),it=e=>({...tt,...rt(e),explanation:{...e?.explanation}});let at=()=>import(`./echarts-runtime-Bu1uy4oO.mjs`),ot=null;const st=()=>(ot||(ot=at().catch(e=>{throw ot=null,e})),ot),ct={background:`#ffffff`,border:`#dce4e9`,muted:`#5b7186`,surface:`#ffffff`,text:`#0f1e2a`,colors:[`#2f7f55`,`#2563eb`,`#b45309`,`#7c3aed`]},lt=`cf-widget-category-zoom`,ut=.68,dt=e=>({startIndex:0,endIndex:Math.max(0,e-1)}),ft=(e,t)=>{if(t<=0)return dt(0);let n=t-1,r=Math.max(0,Math.min(n,Math.floor(Math.min(e.startIndex,e.endIndex))));return{startIndex:r,endIndex:Math.max(r,Math.min(n,Math.floor(Math.max(e.startIndex,e.endIndex))))}},pt=(e,t,n)=>{let r=ft(e,n);if(n<=2)return dt(n);let i=r.endIndex-r.startIndex+1,a=t===`in`?Math.max(2,Math.floor(i*ut)):Math.min(n,Math.ceil(i/ut));if(a===i)return r;let o=(r.startIndex+r.endIndex)/2,s=n-a,c=Math.max(0,Math.min(s,Math.round(o-(a-1)/2)));return{startIndex:c,endIndex:c+a-1}},mt=(e,t,n=tt)=>{let r=e.length;if(r===0)return n.zoomNone;let i=ft(t,r);return i.startIndex===0&&i.endIndex===r-1?nt(r===1?n.zoomAllOne:n.zoomAllMany,{count:r}):nt(n.zoomRange,{start:e[i.startIndex]??``,end:e[i.endIndex]??``,visible:i.endIndex-i.startIndex+1,count:r})},ht=e=>{let t=e.replaceAll(`_`,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`Value`},gt=e=>{let t=new Set,n=[];return e.forEach(e=>{let r=e?.trim();!r||t.has(r)||(t.add(r),n.push(r))}),n},_t=Je,vt=e=>{if(e===null)return`null:`;if(e===void 0)return`undefined:`;if(typeof e==`object`)try{return`object:${JSON.stringify(e)}`}catch{return`object:`}return`${typeof e}:${String(e)}`},yt=(e,t)=>t?e.columnMetadata?.find(e=>e.key===t):void 0,bt=(e,t)=>{let n=yt(e,t);if(!n||n.currencyCode||n.dataType!==`currency`)return n;let r=e.currency;return r?.code&&!r.isMixed?{...n,currencyCode:r.code}:n},xt=(e,t)=>yt(e,t)?.label?.trim()||ht(t),St=(e,t,n,r)=>({locale:t,timezone:e.timezone||e.periodComparison?.timezone,grain:r,yes:n.yes,no:n.no}),Ct=e=>e?.dataType===`date`||e?.dataType===`datetime`||e?.semanticRole===`date`,wt=(e,t,n)=>{let r=yt(e,t);if(Ct(r))return r?.grain??e.periodComparison?.grain??Ue(n.map(e=>e[t]))},Tt=(e,t,n,r,i,a)=>{if(n==null||n===``)return r.notSet;let o=yt(e,t);if(o?.dataType===`boolean`){let e=String(n).trim().toLowerCase();return n===!1||n===0||[`0`,`false`,`no`].includes(e)?r.no:r.yes}if(Ct(o)){let t=Ge(n,o,St(e,i,r,a));if(t)return t}return String(n)},Et=(e,t,n,r=!1,i)=>$e(e,t,{locale:i,compact:r,currencyCode:n?.currency?.code&&!n.currency.isMixed?n.currency.code:void 0}),Dt=(e,t)=>{if(e.presentation===`table`||e.presentation===`kpi`)return null;if(t)return t;let n=e.chartRecommendation?.type;return n===`line`||n===`bar`||n===`stacked_bar`?n:e.type===`line`||e.type===`bar`||e.type===`stacked_bar`?e.type:null},Ot=e=>e.chartRecommendation?.categoryField?.trim()||e.label?.trim()||e.columnMetadata?.find(e=>[`date`,`dimension`,`geography`,`boolean`].includes(e.semanticRole))?.key||e.columns?.[0],kt=e=>e.chartRecommendation?.seriesField?.trim()||e.seriesField?.trim()||e.series?.trim()||void 0,At=(e,t,n)=>{let r=gt([...e.chartRecommendation?.valueFields??[],...e.valueFields??[],e.value,...e.columnMetadata?.filter(e=>e.semanticRole===`measure`).map(e=>e.key)??[]]),i=new Set([...e.columns??[],...e.columnMetadata?.map(e=>e.key)??[],...Object.keys(e.rows?.[0]??{})]);return r.filter(e=>e!==t&&e!==n&&i.has(e)).filter(t=>e.rows?.some(e=>_t(e[t])!==null))},jt=(e,t,n,r,i,a,o)=>{let s=i?` ${nt(a.seriesLimited,{shown:r.length,total:r.length+i})}`:``,c=(t,n)=>Et(t,n,e,!1,o);if(t===`line`){let e=n.length-1,t=r.map(t=>{let n=t.values[e];return n==null?null:`${t.name}: ${c(n,t.valueColumn)}`}).filter(e=>!!e);return t.length?`${nt(a.summaryLatest,{category:n[e]??``,values:t.join(`; `)})}${s}`:`${a.summaryNoTrend}${s}`}let l;return r.forEach(e=>{e.values.forEach((t,r)=>{t===null||l&&t<=l.value||(l={category:n[r]??a.notSet,series:e,value:t})})}),l?`${nt(a.summaryHighest,{category:l.category,series:l.series.name,value:c(l.value,l.series.valueColumn)})}${s}`:`${a.summaryNoComparison}${s}`},Mt=(e,t,n={})=>{let r=it(n.labels),i=n.locale,a=Dt(e,t),o=Ot(e),s=e.rows??[];if(!a||!o||s.length===0)return null;let c=kt(e),l=At(e,o,c);if(l.length===0)return null;let u=l.length===1?c:void 0,d=wt(e,o,s),f=l[0],p=u&&_e(e.periodComparison)&&(!e.periodComparison.measureField||!f||f===e.periodComparison.measureField||f.endsWith(`.${e.periodComparison.measureField}`)||e.periodComparison.measureField.endsWith(`.${f}`))?e.periodComparison:void 0,m=(()=>{if(!p?.seriesField||!u)return;let e=(e,t)=>e===t||e.endsWith(`.${t}`)||t.endsWith(`.${e}`);if(e(p.seriesField,o))return{group:o,time:u,timeIsSeries:!0};if(e(p.seriesField,u))return{group:u,time:o,timeIsSeries:!1}})(),h=t=>Et(t,bt(e,f??``),e,!1,i),g=e=>p&&m?ge(p,e[m.time],e[m.group],{format:h,locale:i}):void 0,_=(e,t)=>p?.comparisonBasis===`like_for_like`&&ge(p,e,p.series?.[0]?.key)?.side===`previous`?me(p):t,v=[],y=new Set;s.forEach(t=>{let n=vt(t[o]);if(y.has(n))return;y.add(n);let a=Tt(e,o,t[o],r,i,d);v.push({key:n,label:m&&!m.timeIsSeries?_(t[o],a):a})});let b=v.map(e=>e.label),x=0,S;if(u){let t=[],n=new Set;s.forEach(a=>{let o=vt(a[u]);if(n.has(o))return;n.add(o);let c=Tt(e,u,a[u],r,i,wt(e,u,s));t.push({key:o,label:m?.timeIsSeries?_(a[u],c):c})});let a=t.slice(0,4);x=Math.max(0,t.length-a.length);let c=l[0];S=a.map(t=>{let n=new Map,r=new Map;return s.forEach(e=>{if(vt(e[u])!==t.key)return;let i=vt(e[o]);if(!n.has(i)){let t=g(e);r.set(i,t),n.set(i,t?.side===`previous`&&t.plotValue!==void 0?t.plotValue:_t(e[c]))}}),{field:c,name:t.label,values:v.map(e=>n.get(e.key)??null),valueColumn:bt(e,c),...m?{points:v.map(e=>r.get(e.key))}:{}}})}else x=Math.max(0,l.length-4),S=l.slice(0,4).map(t=>({field:t,name:xt(e,t),values:s.map(e=>_t(e[t])),valueColumn:bt(e,t)}));if(S.length===0)return null;let C=xt(e,o),w=r.chartValues;u?w=xt(e,l[0]):S.length===1&&(w=S[0].name);let T=e.title?.trim()||nt(r.chartTitle,{measure:w,dimension:C}),E;if(yt(e,o)?.semanticRole===`date`&&v.length>1&&Ce(e)){let e=``;s.forEach(t=>{let n=String(t[o]??``);n>e&&(e=n)});let t=v.findIndex(t=>t.key===vt(e));t>=0&&(E=t)}return{type:a,title:T,xAxisTitle:C,yAxisTitle:w,categories:b,series:S,omittedSeriesCount:x,inProgressIndex:E,...m&&p?{comparison:p,comparisonNote:ve(p)}:{},locale:i,labels:r,summary:jt(e,a,b,S,x,r,i)}},Nt=[{value:`sum`,label:`Total`},{value:`avg`,label:`Average`},{value:`min`,label:`Minimum`},{value:`max`,label:`Maximum`},{value:`count`,label:`Total count`},{value:`count_distinct`,label:`Unique count`}],Pt={sum:`aggregationSum`,avg:`aggregationAvg`,min:`aggregationMin`,max:`aggregationMax`,count:`aggregationCount`,count_distinct:`aggregationCountDistinct`},Ft=(e,t=tt)=>String(t[Pt[e]]),It=(e,t)=>{let n=e.columnMetadata?.find(e=>e.key===t)?.allowedAggregations;return n?.length?Nt.filter(e=>n.includes(e.value)):[...Nt]},Lt=(e,t,n)=>{let r=Ot(e);if(!r||!At(e,r,kt(e)).includes(t)||!It(e,t).some(e=>e.value===n))return;let i=Nt.find(e=>e.value===n)?.label;if(i)return`Using the same approved data, filters, and period as "${e.title?.trim()||e.label?.trim()||`the previous chart`}", calculate ${i.toLowerCase()} of ${xt(e,t)} for each ${xt(e,r)}. Return a chart and show a table if this app permits it.`},Rt=(e,t=tt)=>{if(e.presentation===`table`||e.presentation===`kpi`)return[];let n=Mt(e);if(!n)return[];let r=[{type:`line`,label:t.chartLine,hint:t.chartLineHint},{type:`bar`,label:t.chartBar,hint:t.chartBarHint}];return n.series.length>1&&r.push({type:`stacked_bar`,label:t.chartStackedBar,hint:t.chartStackedBarHint}),r},zt=e=>t=>{let n=e.inProgressIndex??-1,r=(Array.isArray(t)?t:[t]).filter(e=>{if(!e||typeof e!=`object`)return!1;let t=String(e.seriesId??``).startsWith(`in-progress:`),r=e.dataIndex,i=e.value;return t?r===n:!(r===n&&i==null)}),i=String(r[0]?.axisValueLabel??r[0]?.name??``),a=e=>e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`);return[i?`<strong>${a(i)}</strong>`:``,...r.map(t=>{let n=e.series[Math.floor(Number(t.seriesIndex)/2)]??e.series[0];return`${String(t.marker??``)}${a(String(t.seriesName??``))}: ${a(Et(t.value,n?.valueColumn,void 0,!1,e.locale))}`})].filter(Boolean).join(`<br/>`)},Bt=e=>t=>{let n=(Array.isArray(t)?t:[t]).filter(e=>!!e&&typeof e==`object`),r=e=>e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`),i=String(n[0]?.axisValueLabel??n[0]?.name??``),a=n.flatMap(t=>{let n=e.series[Number(t.seriesIndex)]??e.series[0],i=n?.points?.[Number(t.dataIndex)],a=t=>Et(t,n?.valueColumn,void 0,!1,e.locale);return[`${String(t.marker??``)}${r(String(t.seriesName??``))}: ${r(a(t.value))}`,...ye(e.comparison,i,a).map(e=>`<span style="opacity:.75">${r(e)}</span>`)]});return[i?`<strong>${r(i)}</strong>`:``,...a].filter(Boolean).join(`<br/>`)},Vt=(e,{expanded:t=!1,reducedMotion:n=!1,theme:r=ct,zoomWindow:i=dt(e.categories.length)}={})=>{let a=e.series.length>1||e.type===`line`&&(e.inProgressIndex??0)>0,o=e.type===`stacked_bar`,s=e.categories.length>2,c=ft(i,e.categories.length);return{animation:!n,animationDuration:n?0:260,aria:{enabled:!0,decal:{show:!0},label:{description:`${e.title}. ${e.summary}`}},backgroundColor:`transparent`,color:r.colors,textStyle:{color:r.text,fontFamily:`inherit`},grid:{top:a?t?48:42:14,right:12,bottom:t?18:10,left:10,containLabel:!0},legend:{show:a,type:`scroll`,top:0,left:`center`,itemWidth:12,itemHeight:8,textStyle:{color:r.muted,fontSize:t?11:10}},tooltip:{trigger:`axis`,...e.type===`line`&&(e.inProgressIndex??0)>0?{formatter:zt(e)}:e.comparison?{formatter:Bt(e)}:{},triggerOn:`mousemove|click`,confine:!0,backgroundColor:r.surface,borderColor:r.border,borderWidth:1,textStyle:{color:r.text,fontSize:12},axisPointer:{type:`line`,lineStyle:{color:r.muted,opacity:.5}}},dataZoom:s?[{id:lt,type:`inside`,xAxisIndex:0,startValue:c.startIndex,endValue:c.endIndex,minValueSpan:1,filterMode:`filter`,disabled:!0}]:void 0,xAxis:{type:`category`,data:e.categories,name:e.xAxisTitle,nameLocation:`middle`,nameGap:t?38:32,nameTextStyle:{color:r.muted,fontSize:t?11:10},axisLine:{lineStyle:{color:r.border}},axisTick:{show:!1},axisLabel:{color:r.muted,fontSize:t?11:9,hideOverlap:!0,interval:`auto`,rotate:!t&&e.categories.length>5?28:0,formatter:e=>e.length>(t?18:11)?`${e.slice(0,t?16:9)}…`:e}},yAxis:{type:`value`,name:e.yAxisTitle,nameLocation:`middle`,nameGap:t?52:44,nameTextStyle:{color:r.muted,fontSize:t?11:10},axisLabel:{color:r.muted,fontSize:t?11:9,formatter:t=>Et(t,e.series[0]?.valueColumn,void 0,!0,e.locale)},axisLine:{show:!1},axisTick:{show:!1},splitNumber:4,splitLine:{lineStyle:{color:r.border,opacity:.75}}},series:e.series.flatMap((n,i)=>{let a=e.inProgressIndex??-1,s={type:e.type===`line`?`line`:`bar`,name:n.name,data:n.values,stack:o?`total`:void 0,connectNulls:!1,showSymbol:e.type===`line`&&e.categories.length<=18,symbol:`circle`,symbolSize:t?7:6,smooth:!1,maxBarWidth:t?38:28,lineStyle:e.type===`line`?{width:t?3:2.5}:void 0,itemStyle:e.type===`line`?{borderColor:r.background,borderWidth:2}:{borderRadius:o?0:[4,4,0,0]},emphasis:{focus:`series`},tooltip:{valueFormatter:t=>Et(t,n.valueColumn,void 0,!1,e.locale)}};if(a<0)return[s];let c=r.colors[i%r.colors.length];return e.type===`line`?a===0?[s]:[{...s,lineStyle:{...s.lineStyle,color:c},itemStyle:{...s.itemStyle,color:c},data:n.values.map((e,t)=>t===a?null:e)},{...s,id:`in-progress:${i}`,name:e.labels.inProgressLegend||`In progress`,showSymbol:!0,symbol:`emptyCircle`,lineStyle:{width:t?3:2.5,type:`dashed`,color:c,opacity:.6},itemStyle:{color:c,opacity:.6},data:n.values.map((e,t)=>t===a||t===a-1?e:null)}]:[{...s,data:n.values.map((e,t)=>t===a?{value:e,itemStyle:{opacity:.45,borderType:`dashed`,borderWidth:1.5,borderColor:c}}:e)}]})}},Ht=e=>{let t=getComputedStyle(e),n=(e,n)=>{for(let n of e){let e=t.getPropertyValue(n).trim();if(e)return e}return n},[r,i,a,o]=ct.colors;return{background:n([`--rv-bg`,`--cf-bg`],ct.background),border:n([`--rv-border`,`--cf-border`],ct.border),muted:n([`--rv-muted`,`--cf-muted`],ct.muted),surface:n([`--rv-surface`,`--cf-surface`],ct.surface),text:n([`--rv-text`,`--cf-text`],ct.text),colors:[n([`--rv-chart-1`,`--rv-accent`,`--cf-accent`],r),n([`--rv-chart-2`],i),n([`--rv-chart-3`],a),n([`--rv-chart-4`],o)]}},Ut=[`data-theme`,`data-color-scheme`,`class`,`style`],Wt=(e,t)=>{let n=[];if(typeof matchMedia<`u`){let e=matchMedia(`(prefers-color-scheme: dark)`);e.addEventListener?.(`change`,t),n.push(()=>e.removeEventListener?.(`change`,t))}if(typeof MutationObserver<`u`){let r=new MutationObserver(t),i=e;for(;i;){i instanceof Element&&r.observe(i,{attributes:!0,attributeFilter:Ut});let e=i.parentNode;i=e instanceof ShadowRoot?e.host:e}n.push(()=>r.disconnect())}return()=>n.forEach(e=>e())},Gt=({model:e,expanded:t=!1,classPrefix:n=`cf`})=>{let i=o(null),a=o(null),[d,f]=s(()=>({model:e,window:dt(e.categories.length)})),[p,m]=s(!1),h=d.model===e?ft(d.window,e.categories.length):dt(e.categories.length),g=o(h);g.current=h;let _=t=>{let n=ft(t,e.categories.length);g.current=n,f({model:e,window:n}),a.current?.dispatchAction({type:`dataZoom`,dataZoomId:lt,startValue:n.startIndex,endValue:n.endIndex})},[v,y]=s(!1),[b,x]=s(0),[S,C]=s(0);r(()=>{let e=i.current;if(e)return Wt(e,()=>C(e=>e+1))},[]),r(()=>{let e=i.current;if(!e)return;let t=!1,n=null;return st().then(({init:r})=>{if(t||!e.isConnected||typeof navigator<`u`&&navigator.userAgent.toLowerCase().includes(`jsdom`))return;let i=r(e,null,{renderer:`canvas`,devicePixelRatio:Math.min(window.devicePixelRatio||1,2)});a.current=i;let o=()=>{i.resize(),x(Math.round(e.clientWidth/40))},s=typeof ResizeObserver>`u`?null:new ResizeObserver(o);s?.observe(e),s||window.addEventListener(`resize`,o,{passive:!0}),n=()=>{s?.disconnect(),s||window.removeEventListener(`resize`,o),i.dispose(),a.current=null},y(!0)}).catch(()=>{t||m(!0)}),()=>{t=!0,n?.()}},[]),r(()=>{let n=i.current,r=a.current;if(!n||!r)return;let o=typeof matchMedia<`u`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.setOption(B(Vt(e,{expanded:t,reducedMotion:o,theme:Ht(n),zoomWindow:g.current}),n.clientWidth),{lazyUpdate:!0,notMerge:!0}),r.resize()},[t,e,v,S,b]);let w=e.labels,T=!p&&e.categories.length>2,E=h.endIndex-h.startIndex+1,D=h.startIndex===0&&h.endIndex===e.categories.length-1,O=T&&E>2,k=T&&!D;return u(c,{children:[l(`div`,{ref:i,class:`${n}-analytics-echart${t?` is-expanded`:``}`,role:`img`,"aria-label":`${e.title}. ${e.summary}`,"data-chart-status":p?`fallback`:`ready`,children:p?l(`span`,{class:`${n}-analytics-echart__fallback`,children:e.summary}):null}),e.comparisonNote?l(`p`,{class:`${n}-analytics-comparison-note`,"data-comparison-note":!0,style:`margin:4px 2px 0;font-size:11px;color:var(--rv-muted,#5b7186)`,children:e.comparisonNote}):null,T?u(`div`,{class:`${n}-analytics-zoom`,children:[l(`span`,{class:`${n}-analytics-zoom__range`,"aria-live":`polite`,"aria-atomic":`true`,children:mt(e.categories,h,w)}),u(`div`,{class:`${n}-analytics-zoom__controls`,role:`group`,"aria-label":w.zoomControls,children:[l(`button`,{type:`button`,"aria-label":w.zoomOut,title:w.zoomOut,disabled:!k,onClick:()=>_(pt(g.current,`out`,e.categories.length)),children:`−`}),l(`button`,{type:`button`,class:`${n}-analytics-zoom__reset`,"aria-label":w.zoomReset,title:w.zoomReset,disabled:D,onClick:()=>_(dt(e.categories.length)),children:w.zoomResetShort}),l(`button`,{type:`button`,"aria-label":w.zoomIn,title:w.zoomIn,disabled:!O,onClick:()=>_(pt(g.current,`in`,e.categories.length)),children:`+`})]})]}):null]})},Kt=e=>{let t=e.replaceAll(`_`,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`Value`},qt=(e,t)=>(t?.length?t:Object.keys(e[0]??{})).map(e=>typeof e==`string`?{key:e,label:Kt(e)}:{...e,label:e.label?.trim()||Kt(e.key)}),Jt=(e,t,n,r={})=>et(e,n,{...r,locale:t??r.locale}),Yt=e=>{let t=String(e??``);return/[",\r\n]/.test(t)?`"${t.replaceAll(`"`,`""`)}"`:t},Xt=(e,t)=>{let n=qt(e,t);return[n.map(e=>Yt(e.label)).join(`,`),...e.map(e=>n.map(t=>Yt(e[t.key])).join(`,`))].join(`\r
90
- `)},Zt=({label:e,options:t,value:n,onChange:i,classPrefix:a})=>{let c=o(null),d=o(null),[f,p]=s(n),[m,h]=s(!1);r(()=>p(n),[n]);let g=e=>`${a}-${e}`,_=e=>{p(e),c.current&&(c.current.dataset.value=e,c.current.open=!1,c.current.querySelector(`summary`)?.focus()),i?.(e)};return u(`details`,{ref:c,"data-result-popover":!0,"data-result-select":!0,"data-value":f,class:g(`sdk-select`),onToggle:e=>{let t=e.currentTarget.open;h(t);let n=d.current;if(n){if(n.setAttribute(`popover`,`manual`),!t){typeof n.hidePopover==`function`&&n.matches(`:popover-open`)&&n.hidePopover();return}typeof n.showPopover==`function`&&!n.matches(`:popover-open`)&&n.showPopover(),requestAnimationFrame(()=>{if(!c.current?.open||!n.isConnected)return;let e=c.current.querySelector(`summary`).getBoundingClientRect(),t=Math.max(e.width,Math.min(220,innerWidth-24)),r=Math.min(n.scrollHeight,240);n.style.width=`${t}px`,n.style.left=`${Math.max(12,Math.min(e.left,innerWidth-t-12))}px`,n.style.top=`${e.bottom+r+6<=innerHeight-12?e.bottom+6:Math.max(12,e.top-r-6)}px`})}},children:[u(`summary`,{class:g(`sdk-select-trigger`),role:`combobox`,"aria-label":e,"aria-haspopup":`listbox`,"aria-expanded":m,children:[l(`span`,{children:t.find(([e])=>e===f)?.[1]??f}),l(`span`,{"aria-hidden":`true`,children:`⌄`})]}),l(`div`,{ref:d,class:g(`sdk-select-list`),role:`listbox`,"aria-label":e,popover:`manual`,children:t.map(([e,t])=>l(`button`,{type:`button`,role:`option`,"aria-selected":e===f,onClick:()=>_(e),children:t},e))})]})},Qt=({rows:e,columns:t,maxRows:n=6,locale:r,format:i,expanded:a=!1,classNames:o,emptyLabel:s=`No rows returned.`})=>{let d=qt(e,t),f=a?e:e.slice(0,Math.max(1,n));return e.length===0||d.length===0?l(`div`,{class:o?.note,children:s}):u(c,{children:[l(`div`,{class:o?.wrap,role:`region`,"aria-label":`Result table with ${e.length} ${e.length===1?`row`:`rows`}`,tabIndex:0,children:u(`table`,{class:o?.table,children:[u(`caption`,{style:`position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)`,children:[`Result table with `,e.length,` `,e.length===1?`row`:`rows`]}),l(`thead`,{children:l(`tr`,{children:d.map(e=>l(`th`,{scope:`col`,children:e.label},e.key))})}),l(`tbody`,{children:f.map((e,t)=>l(`tr`,{children:d.map(t=>l(`td`,{children:Jt(e[t.key],r,t,i)},t.key))},t))})]})}),!a&&e.length>f.length?u(`div`,{class:o?.note,children:[`Showing `,f.length,` of `,e.length,` rows. Expand to view all rows.`]}):null]})},$t=(e,t,n)=>{let r=n.value.trim();if(!r)return!0;let i=String(e??``),a=typeof e==`number`?e:NaN,o=Number(r),s=!Number.isNaN(a)&&!Number.isNaN(o)?a-o:i.localeCompare(r,void 0,{numeric:!0,sensitivity:`base`});switch(n.operator){case`equals`:return s===0;case`not_equals`:return s!==0;case`gt`:return s>0;case`gte`:return s>=0;case`lt`:return s<0;case`lte`:return s<=0;default:return i.toLocaleLowerCase().includes(r.toLocaleLowerCase())||t.toLocaleLowerCase().includes(r.toLocaleLowerCase())}},en=({rows:e,columns:t,maxRows:n=100,locale:i,format:c,expanded:d=!1,classPrefix:f=`cr`,pageSize:p=10})=>{let m=a(()=>qt(e,t),[t,e]),h=m.map(e=>e.key).join(`\0`),[g,_]=s(()=>m.map(e=>e.key)),[v,y]=s(``),[b,x]=s(),[S,C]=s(`asc`),[w,T]=s({}),[E,D]=s(),[O,k]=s([]),[A,j]=s({}),[M,N]=s(()=>m.map(e=>e.key)),[P,F]=s(!1),[I,L]=s([]),[R,ee]=s(`table`),[z,B]=s(1),[V,H]=s(p),U=o(null);r(()=>{let e=e=>{let t=e.composedPath();U.current?.querySelectorAll(`details[data-result-popover][open]`).forEach(e=>{t.includes(e)||(e.open=!1)})},t=e=>{let t=[...U.current?.querySelectorAll(`details[data-result-popover][open]`)??[]].at(-1);e.key!==`Escape`||!t||(t.open=!1,t.querySelector(`summary`)?.focus(),e.preventDefault())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[]),r(()=>{_(m.map(e=>e.key)),x(void 0),T({}),D(void 0),k([]),j({}),N(m.map(e=>e.key)),L([]),B(1)},[h]);let te=M.map(e=>m.find(t=>t.key===e)).filter(e=>!!(e&&g.includes(e.key))),W=a(()=>{let t=v.toLocaleLowerCase(i),n=e.map((e,t)=>({row:e,index:t})).filter(({row:e})=>te.some(n=>Jt(e[n.key],i,n,c).toLocaleLowerCase(i).includes(t))&&Object.entries(w).every(([t,n])=>{let r=m.find(e=>e.key===t);return $t(e[t],Jt(e[t],i,r,c),n)}));return b?n.sort((e,t)=>{let n=e.row[b],r=t.row[b],a=typeof n==`number`?n:NaN,o=typeof r==`number`?r:NaN,s=!Number.isNaN(a)&&!Number.isNaN(o)?a-o:String(n??``).localeCompare(String(r??``),i,{numeric:!0,sensitivity:`base`});return S===`asc`?s:-s}):n},[te,w,c,i,v,m,e,S,b]),G=W.slice(0,Math.max(1,n)),K=Math.max(1,Math.ceil(G.length/V)),q=Math.min(z,K),J=d?G:G.slice((q-1)*V,q*V),ne=J.length>0&&J.every(({index:e})=>I.includes(e)),Y=e=>`${f}-${e}`,re=()=>{_(m.map(e=>e.key)),N(m.map(e=>e.key)),j({}),x(void 0),C(`asc`),T({}),D(void 0),k([]),F(!1),y(``),L([]),ee(`table`),B(1)};if(e.length===0||m.length===0)return l(`div`,{class:Y(`table-note`),children:`No rows returned.`});let ie=e=>{let t=new Set(J.map(({index:e})=>e));L(n=>e?[...new Set([...n,...t])]:n.filter(e=>!t.has(e)))};return u(`section`,{ref:U,class:Y(`data-table`),children:[u(`div`,{class:Y(`table-fields`),children:[l(`strong`,{children:`Fields`}),l(`div`,{class:Y(`field-list`),children:m.map(e=>l(`span`,{class:Y(`field-chip`),children:e.label},e.key))}),u(`span`,{class:Y(`table-field-count`),children:[e.length.toLocaleString(i),` rows`]})]}),u(`div`,{class:Y(`table-controls`),children:[u(`label`,{class:Y(`table-search`),children:[l(`span`,{"aria-hidden":`true`,children:`⌕`}),l(`input`,{type:`search`,value:v,placeholder:`Search this result...`,"aria-label":`Search this result`,onInput:e=>{y(e.currentTarget.value.trim()),B(1)}})]}),l(`div`,{class:Y(`table-modes`),role:`group`,"aria-label":`Table display mode`,children:[`table`,`matrix`].map(e=>l(`button`,{type:`button`,class:`${Y(`segment`)}${R===e?` is-active`:``}`,"aria-pressed":R===e,onClick:()=>ee(e),children:e===`table`?`Table`:`Matrix`},e))})]}),u(`div`,{class:Y(`table-column-bar`),children:[u(`details`,{"data-result-popover":!0,class:Y(`column-picker`),children:[l(`summary`,{children:`Columns`}),l(`div`,{class:Y(`column-menu`),children:M.map((e,t)=>{let n=m.find(t=>t.key===e);return n?u(`div`,{class:Y(`column-picker-row`),children:[u(`label`,{children:[l(`input`,{type:`checkbox`,checked:g.includes(n.key),onChange:e=>{let t=e.currentTarget.checked;_(e=>t?[...new Set([...e,n.key])]:e.length>1?e.filter(e=>e!==n.key):e)}}),l(`span`,{children:A[n.key]||n.label})]}),l(`button`,{type:`button`,"aria-label":`Move ${n.label} left`,disabled:t===0,onClick:()=>N(e=>{let n=[...e];return[n[t-1],n[t]]=[n[t],n[t-1]],n}),children:`↑`}),l(`button`,{type:`button`,"aria-label":`Move ${n.label} right`,disabled:t===M.length-1,onClick:()=>N(e=>{let n=[...e];return[n[t+1],n[t]]=[n[t],n[t+1]],n}),children:`↓`})]},n.key):null})})]}),l(`button`,{type:`button`,class:Y(`table-view-button`),"aria-pressed":P,onClick:()=>F(e=>!e),children:P?`Comfortable rows`:`Compact rows`}),l(`button`,{type:`button`,class:Y(`table-view-button`),onClick:re,children:`Reset view`})]}),Object.keys(w).length?l(`div`,{class:Y(`table-filter-bar`),children:Object.entries(w).map(([e,t])=>{let n=m.find(t=>t.key===e);return u(`button`,{type:`button`,class:Y(`table-filter-chip`),"aria-label":`Clear ${n?.label??e} filter`,onClick:()=>T(t=>{let n={...t};return delete n[e],n}),children:[A[e]||n?.label||e,` `,t.operator.replaceAll(`_`,` `),` `,t.value,` ×`]},e)})}):null,l(`div`,{class:Y(`table-wrap`),role:`region`,"aria-label":`Scrollable result table`,tabIndex:0,children:u(`table`,{class:`${Y(`table`)}${R===`matrix`?` is-matrix`:``}${P?` is-compact`:``}`,children:[u(`caption`,{class:Y(`visually-hidden`),children:[`Result table with `,W.length,` `,W.length===1?`row`:`rows`]}),l(`thead`,{children:u(`tr`,{children:[l(`th`,{class:Y(`select-cell`),children:l(`input`,{type:`checkbox`,"aria-label":`Select all visible rows`,checked:ne,onChange:e=>ie(e.currentTarget.checked)})}),te.map(e=>u(`th`,{scope:`col`,class:E===e.key?`is-pinned`:void 0,style:E===e.key?{left:`34px`}:void 0,"aria-sort":b===e.key?S===`asc`?`ascending`:`descending`:`none`,children:[u(`button`,{type:`button`,class:Y(`table-sort`),"aria-label":`Sort by ${e.label}`,onClick:()=>{b===e.key?C(e=>e===`asc`?`desc`:`asc`):(x(e.key),C(`asc`)),B(1)},children:[l(`span`,{children:A[e.key]||e.label}),l(`span`,{class:Y(`sort-direction`),"aria-hidden":`true`,children:b===e.key?S===`asc`?`↑`:`↓`:`↕`})]}),u(`details`,{"data-result-popover":!0,class:Y(`table-column-menu`),onToggle:e=>{let t=e.currentTarget,n=t.querySelector(`.${Y(`table-column-panel`)}`);if(n?.setAttribute(`popover`,`manual`),!t.open){n&&typeof n.hidePopover==`function`&&n.matches(`:popover-open`)&&n.hidePopover(),t.querySelectorAll(`details[data-result-select][open]`).forEach(e=>{e.open=!1});return}U.current?.querySelectorAll(`details[data-result-popover][open]`).forEach(e=>{e!==t&&!t.contains(e)&&(e.open=!1)}),n&&typeof n.showPopover==`function`&&!n.matches(`:popover-open`)&&n.showPopover(),requestAnimationFrame(()=>{if(!t.open||!t.isConnected)return;let e=t.querySelector(`summary`)?.getBoundingClientRect();if(!e||!n)return;let{width:r,height:i}=n.getBoundingClientRect(),a=e.bottom+i+5<=innerHeight-12?e.bottom+5:e.top-i-5;n.style.left=`${Math.max(12,Math.min(e.right-r,innerWidth-r-12))}px`,n.style.top=`${Math.max(12,Math.min(a,innerHeight-i-12))}px`})},children:[l(`summary`,{"aria-label":`Actions for ${e.label}`,children:`⋯`}),u(`div`,{class:Y(`table-column-panel`),popover:`manual`,children:[l(`strong`,{children:A[e.key]||e.label}),l(`button`,{type:`button`,onClick:()=>{x(e.key),C(`asc`),B(1)},children:`Sort ascending`}),l(`button`,{type:`button`,onClick:()=>{x(e.key),C(`desc`),B(1)},children:`Sort descending`}),l(`span`,{children:`Filter values`}),l(Zt,{classPrefix:f,label:`Filter operator for ${e.label}`,value:w[e.key]?.operator??`contains`,options:[[`contains`,`Contains`],[`equals`,`Equals`],[`not_equals`,`Does not equal`],[`gt`,`Greater than`],[`gte`,`At least`],[`lt`,`Less than`],[`lte`,`At most`]]}),l(`input`,{type:`text`,"aria-label":`Filter value for ${e.label}`,defaultValue:w[e.key]?.value??``,placeholder:`Enter a value`}),l(`button`,{type:`button`,onClick:t=>{let n=t.currentTarget.parentElement,r=n.querySelector(`input[aria-label^="Filter value"]`).value.trim(),i=n.querySelector(`[data-result-select]`).dataset.value;T(t=>{let n={...t};return r?n[e.key]={operator:i,value:r}:delete n[e.key],n}),B(1),t.currentTarget.closest(`details`).open=!1},children:`Apply filter`}),l(`button`,{type:`button`,onClick:t=>{D(t=>t===e.key?void 0:e.key),N(t=>[e.key,...t.filter(t=>t!==e.key)]),t.currentTarget.closest(`details`).open=!1},children:E===e.key?`Unpin column`:`Pin column`}),l(`button`,{type:`button`,onClick:t=>{k(t=>t.includes(e.key)?t.filter(t=>t!==e.key):[...t,e.key]),t.currentTarget.closest(`details`).open=!1},children:O.includes(e.key)?`Do not wrap text`:`Wrap text`}),l(`input`,{type:`text`,"aria-label":`Display name for ${e.label}`,defaultValue:A[e.key]||e.label,maxLength:80}),l(`button`,{type:`button`,onClick:t=>{let n=t.currentTarget.parentElement.querySelector(`input[aria-label^="Display name"]`).value.trim();j(t=>({...t,[e.key]:n||e.label||e.key})),t.currentTarget.closest(`details`).open=!1},children:`Apply display name`})]})]})]},e.key))]})}),l(`tbody`,{children:J.map(({row:e,index:t})=>u(`tr`,{class:I.includes(t)?`is-selected`:void 0,children:[l(`td`,{class:Y(`select-cell`),children:l(`input`,{type:`checkbox`,"aria-label":`Select row ${t+1}`,checked:I.includes(t),onChange:e=>L(n=>e.currentTarget.checked?[...new Set([...n,t])]:n.filter(e=>e!==t))})}),te.map(t=>l(`td`,{class:`${O.includes(t.key)?`is-wrapped`:``} ${E===t.key?`is-pinned`:``}`.trim(),style:E===t.key?{left:`34px`}:void 0,children:Jt(e[t.key],i,t,c)},t.key))]},t))})]})}),u(`div`,{class:Y(`table-summary`),children:[l(`span`,{children:G.length?`${((q-1)*V+1).toLocaleString(i)}-${Math.min(q*V,G.length).toLocaleString(i)} of ${W.length.toLocaleString(i)}`:`0 of ${W.length.toLocaleString(i)}`}),d?l(`span`,{children:e.length>n?`First ${n.toLocaleString(i)} rows available`:`All returned rows loaded`}):u(`div`,{class:Y(`table-pagination`),"aria-label":`Table pagination`,children:[u(`label`,{children:[l(`span`,{children:`Rows`}),l(Zt,{classPrefix:f,label:`Rows per page`,value:String(V),options:[[`10`,`10`],[`25`,`25`],[`50`,`50`]],onChange:e=>{H(Number(e)),B(1)}})]}),l(`button`,{type:`button`,"aria-label":`Previous page`,disabled:q<=1,onClick:()=>B(e=>Math.max(1,e-1)),children:`‹`}),u(`span`,{children:[q,` / `,K]}),l(`button`,{type:`button`,"aria-label":`Next page`,disabled:q>=K,onClick:()=>B(e=>Math.min(K,e+1)),children:`›`})]})]})]})},tn=(e,t,n)=>{let r=it(t),i=[],a=e.reportingPeriod?.label?.trim();a&&i.push({label:r.aboutPeriod,value:a});let o=e.rowCount??e.rows?.length;typeof o==`number`&&i.push({label:r.aboutResults,value:nt(o===1?r.rowOne:r.rowMany,{count:o})});let s=e.explanation?.checkedAt??e.freshness?.answeredAt,c=e.explanation?.timezone??e.timezone??e.reportingPeriod?.timezone;if(s){let e=new Date(s),t=s;if(!Number.isNaN(e.getTime()))try{t=new Intl.DateTimeFormat(n,{dateStyle:`medium`,timeStyle:`short`,...c?{timeZone:c}:{}}).format(e)}catch{t=e.toLocaleString(n)}i.push({label:r.aboutChecked,value:t})}c&&i.push({label:r.aboutTimezone,value:c});let l=e.explanation?.dataFreshness?.status??e.freshness?.status;return l&&l!==`unknown`&&i.push({label:r.aboutSourceData,value:l.replaceAll(`_`,` `)}),e.appliedFilters?.length&&i.push({label:r.aboutFilters,value:nt(r.filtersApplied,{count:e.appliedFilters.length})}),i},nn=e=>e.columns?.length?e.columns:Object.keys(e.rows?.[0]??{}),rn=e=>{let t=e.rows??[],n=e.currency?.code&&!e.currency.isMixed?e.currency.code:void 0;return nn(e).map(r=>{let i=e.columnMetadata?.find(e=>e.key===r);if(!i)return{key:r,label:Kt(r)};let a=i.dataType===`date`||i.dataType===`datetime`||i.semanticRole===`date`;return{key:r,label:i.label,dataType:i.dataType,currencyCode:i.currencyCode||(i.dataType===`currency`?n:void 0),formatPattern:i.formatPattern,grain:a?i.grain??e.periodComparison?.grain??Ue(t.map(e=>e[r])):void 0}})},an=(e,t)=>{let n=e.rows?.[0]??{};return e.chartRecommendation?.valueFields?.[0]??e.valueFields?.[0]??e.value??e.columnMetadata?.find(e=>e.semanticRole===`measure`&&e.key in n)?.key??t.find(e=>Je(n[e])!==null)??t[1]??t[0]},on=(e,t,n=`analytics-result.csv`)=>{if(typeof document>`u`||e.length===0)return;let r=Xt(t,e),i=URL.createObjectURL(new Blob([r],{type:`text/csv;charset=utf-8`})),a=document.createElement(`a`);a.href=i,a.download=n,a.click(),URL.revokeObjectURL(i)},sn=new Set,cn=e=>{let t=e.composedPath();sn.forEach(e=>{e.isOpen()&&!e.contains(t)&&e.close(!1)})},ln=e=>{if(e.key===`Escape`){for(let t of sn)if(t.isOpen()){t.close(!0),e.preventDefault();return}}},un=e=>(sn.size===0&&typeof document<`u`&&(document.addEventListener(`pointerdown`,cn),document.addEventListener(`keydown`,ln)),sn.add(e),()=>{sn.delete(e),sn.size===0&&typeof document<`u`&&(document.removeEventListener(`pointerdown`,cn),document.removeEventListener(`keydown`,ln))}),dn=({children:e,size:t=15})=>l(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,focusable:`false`,children:e}),fn=()=>l(dn,{children:l(`path`,{d:`M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7`})}),pn=()=>l(dn,{children:l(`path`,{d:`M18 6 6 18M6 6l12 12`})}),mn=()=>l(dn,{size:13,children:l(`path`,{d:`m6 9 6 6 6-6`})}),hn=()=>l(dn,{size:13,children:l(`path`,{d:`m5 12 5 5L20 7`})}),gn=({type:e,className:t})=>u(`svg`,{viewBox:`0 0 32 32`,"aria-hidden":`true`,class:t,fill:`none`,children:[l(`path`,{d:`M6 26h21M6 7v19`,stroke:`var(--rv-muted)`,"stroke-width":`1.4`,"stroke-linecap":`round`}),e===`line`?l(`path`,{d:`M8 21c4-7 7 2 11-6 2.5-5 4.5-2 7-7`,stroke:`var(--rv-chart-2)`,"stroke-width":`2.1`,"stroke-linecap":`round`,"stroke-linejoin":`round`}):e===`stacked_bar`?l(c,{children:[9,15,21].map((e,t)=>u(`g`,{children:[l(`rect`,{x:e,y:18-t*2,width:`4`,height:8+t*2,fill:`var(--rv-chart-2)`,rx:`0.6`}),l(`rect`,{x:e,y:13-t,width:`4`,height:`5`,fill:`var(--rv-chart-3)`,rx:`0.6`}),l(`rect`,{x:e,y:9-t,width:`4`,height:`4`,fill:`var(--rv-chart-1)`,rx:`0.6`})]},e))}):u(c,{children:[l(`rect`,{x:`9`,y:`18`,width:`4`,height:`8`,fill:`var(--rv-chart-2)`,rx:`0.7`}),l(`rect`,{x:`15`,y:`13`,width:`4`,height:`13`,fill:`var(--rv-chart-2)`,rx:`0.7`}),l(`rect`,{x:`21`,y:`8`,width:`4`,height:`18`,fill:`var(--rv-chart-2)`,rx:`0.7`})]})]}),_n=e=>{let[t,n]=s(!1),a=o(null),c=o(null),l=o(t);return l.current=t,r(()=>un({isOpen:()=>l.current,contains:e=>!!(a.current&&e.includes(a.current)||c.current&&e.includes(c.current)),close:e=>{n(!1),e&&a.current?.focus()}}),[]),i(()=>{if(!t)return;let n=()=>{let t=a.current,n=c.current;if(!t||!n)return;n.style.left=`0px`,n.style.top=`0px`;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),o=document.documentElement.clientWidth||window.innerWidth,s=document.documentElement.clientHeight||window.innerHeight,l=getComputedStyle(t).direction===`rtl`,u=e===`end`===l?i.left:i.right-r.width;u=Math.max(8,Math.min(u,o-r.width-8));let d=i.bottom+7;d+r.height>s-8&&i.top-7-r.height>8&&(d=i.top-7-r.height),n.style.left=`${u-r.left}px`,n.style.top=`${d-r.top}px`};return n(),window.addEventListener(`resize`,n),window.addEventListener(`scroll`,n,!0),c.current?.querySelector(`[aria-selected="true"], button`)?.focus({preventScroll:!0}),()=>{window.removeEventListener(`resize`,n),window.removeEventListener(`scroll`,n,!0)}},[t,e]),{open:t,setOpen:n,triggerRef:a,layerRef:c}},vn=({visualization:e,field:t,prefix:n,labels:r,locale:i,headerTitle:a})=>{let o=e.rows??[],s=e.columnMetadata?.find(e=>e.key===t),d=t?o[0]?.[t]:void 0,f=Je(d),p=t=>Et(t,s,e,!1,i),m=f===null?String(d??r.noValue):p(f),h=e.periodComparison,g=!h?.measureField||h.measureField===t,_=t?Je(o[1]?.[t]):null,v=f!==null&&h&&g?pe(h,{value:f,status:`observed`,label:h.currentPeriod?.label},{value:_??h.previousFullValue??h.previousToDateValue,status:`observed`,label:h.previousPeriod?.label},{format:p,locale:i}):void 0,y=s?.label??(t?Kt(t):r.currentValue);return u(`section`,{class:`${n}-analytics-kpi`,"aria-label":a??y,"data-testid":`analytics-kpi`,children:[l(`div`,{class:`${n}-analytics-kpi__label`,children:y}),l(`div`,{class:`${n}-analytics-kpi__value`,children:m}),v?u(c,{children:[u(`div`,{class:`${n}-analytics-kpi__change is-${v.tone}`,"data-comparison-basis":v.basis,title:v.title,children:[l(`span`,{children:v.label}),v.copy?l(`span`,{class:`${n}-analytics-kpi__copy`,children:v.copy}):null]}),v.secondary?l(`div`,{class:`${n}-analytics-kpi__secondary`,children:v.secondary}):null]}):null]})},yn=({visualization:e,classPrefix:t,labels:n,locale:i,expanded:o=!1,onExpand:d,onClose:f,expandControlId:p,onFollowUp:m,onDownload:h,headerActions:g,children:_,dataToggle:v,cardRef:y,maxTableRows:b=100})=>{let x=a(()=>it(n),[n]),S=a(()=>Mt(e,void 0,{labels:x,locale:i}),[e,x,i]),[C,w]=s(S?.type);r(()=>w(S?.type),[S]);let[T,E]=s(!1),D=a(()=>Rt(e,x),[e,x]),O=a(()=>Mt(e,C,{labels:x,locale:i}),[e,C,x,i]),k=C??O?.type??S?.type,A=D.find(e=>e.type===k),j=[...new Set(O?.series.map(e=>e.field)??[])],M=_n(`end`),N=_n(`start`),P=e.rows??[],F=nn(e),I=a(()=>Se(e),[e]),L=a(()=>rn(I),[I]),R=a(()=>({locale:i,timezone:e.timezone||e.periodComparison?.timezone,yes:x.yes,no:x.no}),[i,e.timezone,e.periodComparison?.timezone,x]),ee=tn(e,x,i),z=h===!1||!e.downloadAvailable?null:()=>(h??on)(F,P),B=ee.length?u(`details`,{class:`${t}-analytics-inspect`,children:[l(`summary`,{children:x.aboutResult}),l(`dl`,{children:ee.map(e=>u(`div`,{children:[l(`dt`,{children:e.label}),l(`dd`,{children:e.value})]},e.label))})]}):null,V=(()=>{let t=e.freshness?.answeredAt,n=t?new Date(t):null;return!n||Number.isNaN(n.getTime())?x.liveData:nt(x.updatedAt,{time:new Intl.DateTimeFormat(i,{hour:`numeric`,minute:`2-digit`}).format(n)})})(),H=e.rowCount??P.length,U=e.appliedFilters?.length??0,te=u(`div`,{class:`${t}-analytics-meta`,"data-testid":`analytics-result-meta`,role:`group`,"aria-label":x.resultDetails,children:[u(`span`,{children:[l(`span`,{"aria-hidden":`true`,class:`${t}-analytics-meta__dot`}),V]}),e.reportingPeriod?.label?l(`span`,{children:e.reportingPeriod.label}):null,l(`span`,{children:nt(H===1?x.rowOne:x.rowMany,{count:H})}),U>0?l(`span`,{children:nt(U===1?x.filtersOne:x.filtersMany,{count:U})}):null]}),W=(n,r,i,a=x.expandChart)=>u(`div`,{class:`${t}-analytics-result`,children:[u(`section`,{ref:y,class:`${t}-analytics-visualization${o?` is-expanded`:``}`,"aria-label":n,children:[u(`div`,{class:`${t}-analytics-visualization__header`,children:[u(`div`,{children:[l(`div`,{class:`${t}-analytics-visualization__title`,children:n}),te]}),u(`div`,{class:`${t}-analytics-visualization__actions`,children:[i,g,o&&f?l(`button`,{type:`button`,class:`${t}-analytics-visualization__close`,"aria-label":x.restoreView,title:x.restoreView,onClick:f,children:l(pn,{})}):d&&e.expandable!==!1?l(`button`,{type:`button`,class:`${t}-analytics-visualization__expand`,"aria-label":a,title:a,"data-visualization-message":p,onClick:d,children:l(fn,{})}):null]})]}),r,B,_]}),u(`div`,{class:`${t}-analytics-layer`,children:[m?l(`div`,{ref:N.layerRef,class:`${t}-analytics-chart-picker__menu`,style:{position:`fixed`},role:`menu`,"aria-label":x.aggregate,hidden:!N.open,children:j.flatMap(n=>It(e,n).map(r=>{let i=e.columnMetadata?.find(e=>e.key===n)?.label??Kt(n);return l(`button`,{type:`button`,role:`menuitem`,onClick:()=>{let t=Lt(e,n,r.value);t&&m(t),N.setOpen(!1)},children:u(`span`,{class:`${t}-analytics-chart-picker__copy`,children:[u(`strong`,{children:[Ft(r.value,x),` · `,i]}),l(`small`,{children:x.aggregateCharge})]})},`${n}:${r.value}`)}))}):null,l(`div`,{ref:M.layerRef,class:`${t}-analytics-chart-picker__menu`,style:{position:`fixed`},role:`listbox`,"aria-label":x.chartType,hidden:!M.open,children:D.map(e=>{let n=e.type===k;return u(`button`,{type:`button`,role:`option`,"aria-selected":n,class:n?`is-selected`:``,onClick:()=>{w(e.type),M.setOpen(!1),M.triggerRef.current?.focus()},children:[l(`span`,{class:`${t}-analytics-chart-picker__icon`,children:l(gn,{type:e.type,className:`${t}-chart-type-icon`})}),u(`span`,{class:`${t}-analytics-chart-picker__copy`,children:[l(`strong`,{children:e.label}),l(`small`,{children:e.hint})]}),n?l(hn,{}):null]},e.type)})})]})]}),G=l(en,{rows:I.rows??P,columns:L,maxRows:b,expanded:o,classPrefix:t,locale:i,format:R}),K=()=>e.tableAvailable===!1||F.length===0?null:W(e.title?.trim()||x.resultDetails,l(c,{children:G}),z?l(`button`,{type:`button`,class:`${t}-analytics-visualization__download`,onClick:z,children:x.download}):null,x.expandTable);if(P.length===0)return u(c,{children:[u(`section`,{class:`${t}-analytics-empty`,role:`status`,"data-testid":`analytics-empty-state`,children:[l(`p`,{children:x.noMatchTitle}),l(`p`,{children:x.noMatchBody})]}),B,_]});if(e.presentation===`table`||!e.presentation&&e.type===`table`)return K()??l(c,{children:_});let q=v&&e.tableAvailable!==!1?l(`button`,{type:`button`,class:`${t}-analytics-visualization__download`,"aria-expanded":T,onClick:()=>E(e=>{let t=!e;return v.onToggle?.(t),t}),children:T?x.hideData:x.viewData}):null,J=T?l(`div`,{class:`${t}-analytics-data`,children:G}):null;return e.presentation===`kpi`||!e.presentation&&e.type===`kpi`?W(x.liveMetric,u(c,{children:[l(vn,{visualization:e,field:an(e,F),prefix:t,labels:x,locale:i}),q,J]})):O?W(O.title,u(c,{children:[l(Gt,{model:O,expanded:o,classPrefix:t}),z?l(`button`,{type:`button`,class:`${t}-analytics-visualization__download`,onClick:z,children:x.downloadData}):null,q,J]}),u(c,{children:[m?l(`div`,{class:`${t}-analytics-chart-picker ${t}-analytics-chart-picker--aggregation`,children:u(`button`,{type:`button`,ref:N.triggerRef,"aria-haspopup":`menu`,"aria-expanded":N.open,"aria-label":x.aggregate,title:x.aggregateTitle,onClick:()=>{M.setOpen(!1),N.setOpen(!N.open)},children:[l(`span`,{class:`${t}-analytics-chart-picker__current`,children:l(`span`,{children:x.aggregate})}),l(mn,{})]})}):null,D.length>1?l(`div`,{class:`${t}-analytics-chart-picker`,children:u(`button`,{type:`button`,ref:M.triggerRef,"aria-haspopup":`listbox`,"aria-expanded":M.open,"aria-label":x.chooseChartType,title:x.chooseChartType,onClick:()=>{N.setOpen(!1),M.setOpen(!M.open)},children:[u(`span`,{class:`${t}-analytics-chart-picker__current`,children:[l(gn,{type:k??O.type,className:`${t}-chart-type-icon`}),l(`span`,{children:A?.label??x.chartFallback})]}),l(mn,{})]})}):null]})):K()??l(c,{children:_})},bn=[`#2563eb`,`#b45309`,`#7c3aed`],xn=[`#60a5fa`,`#fbbf24`,`#a78bfa`],Sn=(e,t)=>{let n=`.${e}-analytics-visualization`,r=`.${e}-analytics-result`,i=`.${e}-analytics-chart-picker`,a=`.${e}-analytics-kpi`;return`
91
- ${r}{
92
- display:contents;
93
- --rv-bg:${t.bg};--rv-surface:${t.surface};--rv-surface-2:${t.surface2};--rv-text:${t.text};
94
- --rv-muted:${t.muted};--rv-border:${t.border};--rv-accent:${t.accent};--rv-on-accent:${t.onAccent};
95
- --rv-chart-1:${t.accent};--rv-chart-2:${t.chart[0]};--rv-chart-3:${t.chart[1]};--rv-chart-4:${t.chart[2]};
96
- }
97
- ${t.darkSelector} ${r}{--rv-chart-2:${t.chartDark[0]};--rv-chart-3:${t.chartDark[1]};--rv-chart-4:${t.chartDark[2]}}
98
- ${n}{box-sizing:border-box;width:100%;max-width:100%;margin-block-start:8px;min-width:0;overflow:hidden;border:1px solid var(--rv-border);border-radius:13px;background:var(--rv-surface);padding:12px;color:var(--rv-muted);font-size:11px}
99
- ${n}.is-expanded{display:flex;min-height:100%;flex-direction:column;margin:0;border:0;border-radius:0;background:transparent;padding:0}
100
- ${n}__header{display:flex;width:100%;min-width:0;min-height:32px;align-items:center;justify-content:space-between;gap:10px}
101
- ${n}__header>div:first-child{min-width:0}
102
- ${n}__actions{display:flex;flex:0 0 auto;align-items:center;gap:6px}
103
- ${n}__title{overflow:hidden;color:var(--rv-muted);font-size:10px;font-weight:750;letter-spacing:.08em;text-overflow:ellipsis;text-transform:uppercase;white-space:nowrap}
104
- .${e}-analytics-meta{display:flex;flex-wrap:wrap;align-items:center;gap:3px 7px;margin-block-start:4px;color:var(--rv-muted);font-size:9px;line-height:1.35}
105
- .${e}-analytics-meta__dot{display:inline-block;width:5px;height:5px;margin-inline-end:4px;border-radius:999px;background:var(--rv-accent)}
106
- ${n}__download{width:fit-content;min-height:32px;margin-block-start:6px;border:1px solid var(--rv-border);border-radius:8px;background:var(--rv-surface);padding:6px 9px;color:var(--rv-text);font:inherit;font-size:10px;font-weight:700;cursor:pointer}
107
- ${n}__header ${n}__download{margin:0}
108
- ${n}__download:hover{border-color:var(--rv-accent);color:var(--rv-accent)}
109
- ${n}__expand,${n}__close{display:grid;width:30px;height:30px;flex:0 0 auto;place-items:center;border:1px solid var(--rv-border);border-radius:9px;background:var(--rv-bg);color:var(--rv-text);cursor:pointer}
110
- ${n}__expand:hover,${n}__close:hover{background:var(--rv-surface-2)}
111
- ${n} button:focus-visible,${n} summary:focus-visible,${r} ${i}__menu button:focus-visible{outline:2px solid var(--rv-accent);outline-offset:2px}
112
- .${e}-analytics-inspect{margin-block-start:10px;padding-block-start:9px;border-block-start:1px solid var(--rv-border);color:var(--rv-muted);font-size:11px}
113
- .${e}-analytics-inspect summary{width:max-content;max-width:100%;cursor:pointer;color:var(--rv-text);font-weight:650}
114
- .${e}-analytics-inspect dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;margin:10px 0 0}
115
- .${e}-analytics-inspect dt{margin:0;color:var(--rv-muted)}
116
- .${e}-analytics-inspect dd{margin:2px 0 0;color:var(--rv-text);overflow-wrap:anywhere}
117
- .${e}-analytics-data{margin-block-start:8px}
118
- ${i}{position:relative;display:inline-flex;min-width:0;color:var(--rv-muted);font-size:9px;font-weight:700}
119
- ${i}>button{display:inline-flex;min-width:92px;max-width:138px;height:30px;align-items:center;gap:6px;border:1px solid var(--rv-border);border-radius:8px;background:var(--rv-bg);padding:0 8px;color:var(--rv-text);font:inherit;cursor:pointer;transition:border-color .16s ease,background .16s ease}
120
- ${i}>button:hover,${i}>button[aria-expanded="true"]{border-color:var(--rv-accent);background:color-mix(in oklab,var(--rv-accent) 9%,var(--rv-bg))}
121
- ${i}>button>svg:last-child{flex:0 0 13px;margin-inline-start:auto;color:var(--rv-muted);transition:transform .16s ease}
122
- ${i}>button[aria-expanded="true"]>svg:last-child{transform:rotate(180deg)}
123
- ${i}__current{display:inline-flex;min-width:0;align-items:center;gap:6px}
124
- ${i}__current>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
125
- .${e}-chart-type-icon{width:17px;height:17px;flex:0 0 17px}
126
- ${i}__menu{z-index:2147483000;display:grid;min-width:196px;max-width:calc(100vw - 16px);max-height:min(400px,calc(100dvh - 32px));overflow-y:auto;overscroll-behavior:contain;padding:6px;border:1px solid var(--rv-border);border-radius:12px;background:var(--rv-bg);color:var(--rv-text);font-size:9px;box-shadow:0 18px 45px rgb(0 0 0/.22)}
127
- ${i}__menu[hidden]{display:none}
128
- ${i}__menu button{display:flex;width:100%;min-height:46px;align-items:flex-start;gap:8px;border:0;border-radius:9px;background:transparent;padding:7px;color:var(--rv-text);font:inherit;text-align:start;cursor:pointer}
129
- ${i}__menu button:hover,${i}__menu button.is-selected{background:color-mix(in oklab,var(--rv-accent) 10%,var(--rv-bg))}
130
- ${i}__menu button>svg:last-child{flex:0 0 13px;margin-block-start:4px}
131
- ${i}__icon{display:inline-flex;width:30px;height:30px;flex:0 0 30px;align-items:center;justify-content:center;border-radius:9px;background:var(--rv-surface-2);box-shadow:inset 0 0 0 1px var(--rv-border)}
132
- ${i}__icon .${e}-chart-type-icon{width:25px;height:25px;flex-basis:25px}
133
- ${i}__copy{display:grid;min-width:0;flex:1;gap:2px}
134
- ${i}__copy strong{font-size:10px;line-height:1.25}
135
- ${i}__copy small{color:var(--rv-muted);font-size:9px;font-weight:560;line-height:1.3}
136
- ${a}{padding:9px 0 5px}
137
- ${a}__label{color:var(--rv-muted);font-size:9px;font-weight:700;letter-spacing:.06em;text-transform:uppercase}
138
- ${a}__value{margin-block-start:5px;color:var(--rv-text);font-size:30px;font-weight:750;letter-spacing:-.035em;line-height:1}
139
- ${a}__change{display:inline-flex;flex-wrap:wrap;gap:2px 6px;margin-block-start:8px;font-size:11px;font-weight:700;color:var(--rv-muted)}
140
- ${a}__change.is-positive{color:var(--rv-success,#15803d)}
141
- ${a}__change.is-negative{color:var(--rv-danger,#b42318)}
142
- ${a}__copy{font-weight:560;color:var(--rv-muted)}
143
- ${a}__secondary{margin-block-start:3px;color:var(--rv-muted);font-size:10px}
144
- .${e}-analytics-empty{margin-block-start:8px;border:1px dashed var(--rv-border);border-radius:11px;padding:18px 14px;color:var(--rv-text);text-align:center}
145
- .${e}-analytics-empty p{margin:0}
146
- .${e}-analytics-empty p+p{margin-block-start:4px;color:var(--rv-muted);font-size:10px}
147
- .${e}-analytics-echart{position:relative;width:100%;height:196px;min-width:0}
148
- ${n}.is-expanded .${e}-analytics-echart{height:auto;min-height:310px;flex:1}
149
- .${e}-analytics-echart canvas:focus-visible{outline:2px solid var(--rv-accent);outline-offset:-2px}
150
- .${e}-analytics-echart__fallback{display:grid;height:100%;place-items:center;border:1px dashed var(--rv-border);border-radius:9px;padding:16px;color:var(--rv-muted);text-align:center;line-height:1.5}
151
- .${e}-analytics-zoom{display:flex;min-width:0;align-items:center;justify-content:space-between;gap:8px;margin-block-start:4px;border-block-start:1px solid var(--rv-border);padding-block-start:8px}
152
- .${e}-analytics-zoom__range{min-width:0;overflow:hidden;color:var(--rv-muted);font-size:10px;font-weight:650;line-height:1.3;text-overflow:ellipsis;white-space:nowrap}
153
- .${e}-analytics-zoom__controls{display:inline-flex;flex:0 0 auto;align-items:center;overflow:hidden;border:1px solid var(--rv-border);border-radius:9px;background:var(--rv-bg)}
154
- .${e}-analytics-zoom__controls button{display:grid;min-width:40px;height:40px;place-items:center;border:0;border-radius:0;background:transparent;color:var(--rv-text);font:inherit;font-size:16px;font-weight:700;line-height:1;cursor:pointer}
155
- .${e}-analytics-zoom__controls button+button{border-inline-start:1px solid var(--rv-border)}
156
- .${e}-analytics-zoom__controls button:hover:not(:disabled){background:var(--rv-surface-2)}
157
- .${e}-analytics-zoom__controls button:focus-visible{position:relative;z-index:1;outline:2px solid var(--rv-accent);outline-offset:-2px}
158
- .${e}-analytics-zoom__controls button:disabled{cursor:not-allowed;opacity:.38}
159
- .${e}-analytics-zoom__controls .${e}-analytics-zoom__reset{min-width:56px;padding:0 10px;font-size:10px;font-weight:700}
160
- `},Cn=16e3;var wn=class{constructor(e){h(this,`ratio`,void 0),h(this,`position`,0),h(this,`carry`,[]),this.ratio=e/Cn}process(e){if(this.ratio===1)return e.slice();let t=this.carry.length?Float32Array.from([...this.carry,...e]):e,n=[],r=this.position;for(;r+this.ratio<=t.length;){let e=Math.floor(r),i=Math.min(t.length,Math.floor(r+this.ratio)),a=0;for(let n=e;n<i;n+=1)a+=t[n]??0;n.push(i>e?a/(i-e):0),r+=this.ratio}let i=Math.floor(r);return this.carry=Array.from(t.subarray(i)),this.position=r-i,Float32Array.from(n)}};const Tn=(e,t=Cn)=>{let n=e.reduce((e,t)=>e+t.length,0),r=new ArrayBuffer(44+n*2),i=new DataView(r),a=(e,t)=>{for(let n=0;n<t.length;n+=1)i.setUint8(e+n,t.charCodeAt(n))};a(0,`RIFF`),i.setUint32(4,36+n*2,!0),a(8,`WAVE`),a(12,`fmt `),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),a(36,`data`),i.setUint32(40,n*2,!0);let o=44;for(let t of e)for(let e=0;e<t.length;e+=1){let n=Math.max(-1,Math.min(1,t[e]??0));i.setInt16(o,n<0?n*32768:n*32767,!0),o+=2}return new Blob([r],{type:`audio/wav`})},En=e=>e.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu,` `).split(/\s+/).filter(e=>e.length>1),Dn=(e,t)=>{let n=En(e);if(n.length===0||!t.trim())return!1;let r=new Set(En(t));return n.filter(e=>r.has(e)).length/n.length>=.7},On=e=>{let t=e.replace(/```[\s\S]*?```/g,``).split(`
161
- `),n=new Set;for(let e=1;e<t.length;e+=1){let r=t[e]?.trim().replace(/^\|/,``).replace(/\|$/,``);if(!(!t[e-1]?.includes(`|`)||!r||!r.split(`|`).every(e=>/^\s*:?-{3,}:?\s*$/.test(e)))){n.add(e-1),n.add(e);for(let r=e+1;r<t.length&&t[r]?.includes(`|`);r+=1)n.add(r)}}return t.filter((e,t)=>!n.has(t)).join(`
162
- `).trim()},kn=(e,t)=>{let n=t?.explanation,r=[n?.summary?.trim()||n?.headline?.trim(),n?.businessMeaning?.trim(),...n?.limitations??[]].filter(e=>!!e?.trim()),i=r.length?[...new Set(r)].join(`
163
- `):e;return On(i)||(i.trim()?`The detailed results are available in the chat.`:``)},An=()=>{let e=globalThis;if(e.__voiceDebug)return!0;try{return e.localStorage?.getItem(`accurix.voiceDebug`)===`1`}catch{return!1}};var jn=class{constructor(e=()=>Date.now()){this.now=e,h(this,`entries`,[]),h(this,`startedAt`,void 0),this.startedAt=e(),globalThis.__accurixVoiceLog=()=>this.list()}add(e,t){let n={at:Math.round(this.now()-this.startedAt),event:e,detail:t};this.entries.push(n),this.entries.length>300&&this.entries.splice(0,this.entries.length-300),An()&&console.debug(`VOICEDBG ${e} ${t?JSON.stringify(t):``}`)}list(){return this.entries.slice()}};Cn/50;const Mn=8e-4;var Nn=class{constructor(e){this.options=e,h(this,`endSilenceMs`,void 0),h(this,`pending`,new Float32Array),h(this,`levels`,[]),h(this,`framesSinceFloor`,0),h(this,`floor`,Mn*4),h(this,`recentSpeech`,[]),h(this,`preroll`,[]),h(this,`silentMs`,0),h(this,`inputSilent`,!1),h(this,`outputActive`,!1),h(this,`turns`,[]),h(this,`nextTurnId`,1),this.endSilenceMs=e.endSilenceMs??2e3}get hearing(){return this.current()?.capturing??!1}get processing(){return this.turns.some(e=>!e.capturing&&!e.cancelled)}feed(e){let t=e;this.pending.length&&(t=new Float32Array(this.pending.length+e.length),t.set(this.pending),t.set(e,this.pending.length));let n=0;for(;n+320<=t.length;)this.frame(t.slice(n,n+320)),n+=320;this.pending=t.slice(n)}setOutputActive(e){this.outputActive!==e&&(this.outputActive=e,this.options.log.add(`output`,{active:e}))}finishTurn(){let e=this.current();e&&(e.capturing?this.endTurn(e,`done`):e.closed||(e.closed=!0,e.endedBy=`done`,this.options.log.add(`turn-done`,{turn:e.id})))}reset(e){for(let e of this.turns)e.cancelled=!0;this.turns.length&&this.options.log.add(`turns-dropped`,{reason:e,count:this.turns.length}),this.turns=[],this.preroll=[],this.recentSpeech=[],this.pending=new Float32Array,this.options.onChange()}current(){return this.turns[this.turns.length-1]}frame(e){let t=0,n=0;for(let r=0;r<e.length;r+=1){let i=e[r]??0;t+=i*i,n=Math.max(n,Math.abs(i))}let r=Math.sqrt(t/e.length);this.trackInputSilence(n);let i=this.current();!i?.capturing&&!this.outputActive&&this.trackFloor(r);let a=this.outputActive,o=Math.max(.006,this.floor*2.8)*(a?1.8:1),s=Math.max(.004,this.floor*1.8)*(a?1.4:1),c=r>=o,l=r>=s;if(!i?.capturing){for(this.preroll.push(e);this.preroll.length*20>500;)this.preroll.shift();this.recentSpeech.push(c);let t=(a?600:300)/20;for(;this.recentSpeech.length>t;)this.recentSpeech.shift();let n=this.recentSpeech.filter(Boolean).length*20;n>=(a?280:120)&&this.beginCapture(n);return}i.chunk.push(e),i.chunkMs+=20,i.durationMs+=20,c&&(i.voicedMs+=20,i.chunkVoicedMs+=20),i.quietMs=l?0:i.quietMs+20,a&&(i.overlappedOutput=!0),i.quietMs>=this.endSilenceMs?this.endTurn(i,`silence`):(i.chunkMs>=25e3||i.chunkMs>=12e3&&i.quietMs>=300||i.chunkMs>=2e4&&i.quietMs>=60)&&this.cutChunk(i)}trackFloor(e){if(this.levels.push(e),this.levels.length>250&&this.levels.shift(),this.framesSinceFloor+=1,this.framesSinceFloor<10&&this.levels.length>10)return;this.framesSinceFloor=0;let t=this.levels.slice().sort((e,t)=>e-t);this.floor=Math.max(Mn,t[Math.floor(t.length*.1)]??Mn)}trackInputSilence(e){this.silentMs=e===0?this.silentMs+20:0;let t=this.silentMs>=2e3;t!==this.inputSilent&&(this.inputSilent=t,this.options.log.add(`input-silent`,{silent:t}),this.options.onInputSilent?.(t))}beginCapture(e){let t=this.current(),n;t&&!t.capturing&&!t.closed?(n=t,n.capturing=!0,this.options.log.add(`turn-resumed`,{turn:n.id})):(n={id:this.nextTurnId++,capturing:!0,closed:!1,endedBy:`silence`,chunk:[],chunkMs:0,chunkVoicedMs:0,quietMs:0,voicedMs:0,durationMs:0,overlappedOutput:this.outputActive,results:[],chunkCount:0,cancelled:!1},this.turns.push(n),this.options.log.add(`turn-start`,{turn:n.id,overOutput:this.outputActive}),this.options.listener.speechStart?.({turnId:n.id,overlappedOutput:this.outputActive})),n.chunk.push(...this.preroll),n.chunkMs+=this.preroll.length*20,n.durationMs+=this.preroll.length*20,n.voicedMs+=e,n.chunkVoicedMs+=e,n.quietMs=0,this.preroll=[],this.recentSpeech=[],this.options.onChange()}endTurn(e,t){let n=Math.max(0,Math.floor((e.quietMs-400)/20));if(n>0&&(e.chunk.splice(e.chunk.length-Math.min(n,e.chunk.length)),e.chunkMs=e.chunk.length*20),e.capturing=!1,e.endedBy=t,t===`done`&&(e.closed=!0),this.options.log.add(`turn-end`,{turn:e.id,by:t,ms:e.durationMs,voicedMs:e.voicedMs}),e.chunkCount===0&&e.voicedMs<300){this.turns=this.turns.filter(t=>t!==e),this.options.log.add(`turn-noise`,{turn:e.id,reason:`too-short`}),this.options.listener.noise?.({id:e.id,reason:`too-short`,overlappedOutput:e.overlappedOutput}),this.options.onChange();return}this.cutChunk(e),this.options.onChange(),this.settle()}cutChunk(e){if(e.chunk.length===0)return;let t=e.chunk,n=e.chunkCount;e.chunkCount+=1,e.results[n]=void 0,e.chunk=[];let r=t.length*20,i=e.chunkVoicedMs;if(e.chunkMs=0,e.chunkVoicedMs=0,i===0&&n>0){e.results[n]=``;return}this.options.log.add(`chunk`,{turn:e.id,index:n,ms:r}),this.options.transcribe({audio:Tn(t),mimeType:`audio/wav`,durationSeconds:r/1e3,turnId:e.id,chunkIndex:n}).then(e=>(e??``).trim(),()=>null).then(t=>{if(e.cancelled)return;e.results[n]=t,this.options.log.add(`chunk-text`,{turn:e.id,index:n,chars:t===null?-1:t.length});let r=[];for(let t of e.results){if(t===void 0)break;t&&r.push(t)}r.length&&this.options.listener.partial?.({turnId:e.id,text:r.join(` `)}),this.settle()})}settle(){for(;this.turns.length;){let e=this.turns[0];if(!e||e.capturing||e.results.some(e=>e===void 0))return;this.turns.shift();let t=e.results.filter(e=>typeof e==`string`&&e!==``),n=e.results.every(e=>e===null),r=t.join(` `).replace(/\s+/g,` `).trim();if(r)this.options.log.add(`turn`,{turn:e.id,chars:r.length,by:e.endedBy}),this.options.listener.turn?.({id:e.id,text:r,durationMs:e.durationMs,endedBy:e.endedBy,overlappedOutput:e.overlappedOutput});else{let t=n?`transcribe-failed`:`empty-transcript`;this.options.log.add(`turn-noise`,{turn:e.id,reason:t}),this.options.listener.noise?.({id:e.id,reason:t,overlappedOutput:e.overlappedOutput})}this.options.onChange()}}};const Pn=[300,1e3,2500],Fn=()=>typeof navigator<`u`&&typeof navigator.mediaDevices?.getUserMedia==`function`&&typeof globalThis.AudioContext==`function`,In=e=>{let t=e?.name;return t===`NotAllowedError`||t===`SecurityError`?`permission-denied`:t===`NotFoundError`||t===`OverconstrainedError`?`no-device`:`error`};var Ln=class{constructor(e){this.options=e,h(this,`log`,new jn),h(this,`turns`,void 0),h(this,`mic`,`off`),h(this,`reason`,void 0),h(this,`muted`,!1),h(this,`inputSilent`,!1),h(this,`stream`,null),h(this,`context`,null),h(this,`source`,null),h(this,`processor`,null),h(this,`sink`,null),h(this,`downsampler`,null),h(this,`deviceId`,void 0),h(this,`generation`,0),h(this,`recoveryAttempt`,0),h(this,`recoveryTimer`,null),h(this,`lastSnapshot`,``),h(this,`groupId`,void 0),h(this,`onTrackEnded`,()=>{this.log.add(`track-ended`),this.recover(`track-ended`)}),h(this,`onTrackMuteChange`,()=>{let e=this.stream?.getAudioTracks()[0];this.log.add(`track-mute-change`,{muted:!!e?.muted}),this.refreshMic()}),h(this,`onContextState`,()=>{let e=this.context?.state;this.log.add(`audio-state`,{state:e}),(e===`suspended`||e===`interrupted`)&&this.context?.resume().catch(()=>void 0),this.refreshMic()}),h(this,`onDeviceChange`,()=>{this.checkDevices()}),this.deviceId=e.deviceId,this.turns=new Nn({transcribe:e.transcribe,listener:e.listener,log:this.log,endSilenceMs:e.endSilenceMs,onChange:()=>this.publish(),onInputSilent:e=>{this.inputSilent=e,this.publish()}})}get snapshot(){let e=this.mic,t=this.reason;return e===`listening`&&this.inputSilent&&(e=`unavailable`,t=`input-silent`),e===`listening`&&this.turns.hearing&&(e=`hearing`),{mic:e,processing:this.turns.processing,reason:e===`unavailable`?t:void 0}}get active(){return this.mic!==`off`}async start(){this.mic===`off`&&(this.log.add(`start`),this.mediaDevices()?.addEventListener(`devicechange`,this.onDeviceChange),await this.open(`start`))}stop(e=`stopped`){this.mic!==`off`&&(this.log.add(`stop`,{reason:e}),this.generation+=1,this.clearRecovery(),this.mediaDevices()?.removeEventListener(`devicechange`,this.onDeviceChange),this.turns.reset(e),this.close(),this.context?.close().catch(()=>void 0),this.context=null,this.setMic(`off`))}setMuted(e){if(!(this.muted===e||this.mic===`off`)){this.muted=e,this.log.add(e?`mute`:`unmute`);for(let t of this.stream?.getAudioTracks()??[])t.enabled=!e;e?(this.turns.reset(`muted`),this.setMic(`muted`)):this.refreshMic()}}finishTurn(){this.log.add(`done-pressed`),this.turns.finishTurn()}setOutputActive(e){this.turns.setOutputActive(e)}async selectDevice(e){e!==this.deviceId&&(this.deviceId=e,this.mic!==`off`&&(this.log.add(`device-selected`),this.turns.reset(`device-selected`),this.close(),await this.open(`device-selected`)))}mediaDevices(){return this.options.media?.mediaDevices??(typeof navigator<`u`?navigator.mediaDevices:void 0)}async open(e){let t=++this.generation;this.setMic(`starting`);let n=this.options.media?.getUserMedia??(Fn()?e=>navigator.mediaDevices.getUserMedia(e):null);if(!n){this.unavailable(`unsupported`);return}let r;try{r=await n({audio:{...this.deviceId?{deviceId:{exact:this.deviceId}}:{},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}})}catch(n){if(t!==this.generation)return;let r=In(n);if(this.log.add(`mic-open-failed`,{why:e,reason:r}),r===`no-device`&&this.deviceId){this.deviceId=void 0,await this.open(`default-device`);return}this.unavailable(r);return}if(t!==this.generation){r.getTracks().forEach(e=>e.stop());return}try{this.connect(r)}catch(e){this.log.add(`audio-setup-failed`,{message:String(e?.name??`error`)}),r.getTracks().forEach(e=>e.stop()),this.unavailable(`error`);return}this.recoveryAttempt=0,this.groupId=r.getAudioTracks()[0]?.getSettings?.().groupId,this.log.add(`mic-open`,{why:e}),this.refreshMic()}connect(e){this.stream=e;for(let t of e.getAudioTracks())t.enabled=!this.muted,t.addEventListener(`ended`,this.onTrackEnded),t.addEventListener(`mute`,this.onTrackMuteChange),t.addEventListener(`unmute`,this.onTrackMuteChange);let t=this.context??this.options.media?.createAudioContext?.()??new globalThis.AudioContext;this.context||(this.context=t,t.addEventListener(`statechange`,this.onContextState)),t.state===`suspended`&&t.resume().catch(()=>void 0),this.downsampler=new wn(t.sampleRate),this.source=t.createMediaStreamSource(e),this.processor=t.createScriptProcessor(2048,1,1),this.sink=t.createGain(),this.sink.gain.value=0,this.processor.onaudioprocess=e=>{if(this.muted||!this.downsampler)return;let t=this.downsampler.process(e.inputBuffer.getChannelData(0));if(this.turns.feed(t),this.options.listener.level&&t.length){let e=0;for(let n of t)e+=n*n;this.options.listener.level(Math.sqrt(e/t.length))}},this.source.connect(this.processor),this.processor.connect(this.sink),this.sink.connect(t.destination)}close(){this.processor&&(this.processor.onaudioprocess=null),this.source?.disconnect(),this.processor?.disconnect(),this.sink?.disconnect(),this.source=null,this.processor=null,this.sink=null;for(let e of this.stream?.getTracks()??[])e.removeEventListener(`ended`,this.onTrackEnded),e.removeEventListener(`mute`,this.onTrackMuteChange),e.removeEventListener(`unmute`,this.onTrackMuteChange),e.stop();this.stream=null,this.inputSilent=!1}refreshMic(){if(this.mic===`off`)return;if(this.muted)return this.setMic(`muted`);let e=this.stream?.getAudioTracks()[0];if(!e||e.readyState!==`live`)return this.unavailable(`device-lost`);if(e.muted)return this.unavailable(`track-muted`);if(this.context&&this.context.state!==`running`)return this.unavailable(`audio-suspended`);this.reason=void 0,this.setMic(`listening`)}unavailable(e){this.reason=e,this.setMic(`unavailable`)}setMic(e){this.mic!==e&&this.log.add(`mic`,{state:e,reason:e===`unavailable`?this.reason:void 0}),this.mic=e,this.publish()}publish(){let e=this.snapshot,t=JSON.stringify(e);t!==this.lastSnapshot&&(this.lastSnapshot=t,this.options.listener.state?.(e))}recover(e){if(this.mic===`off`||this.recoveryTimer)return;let t=Pn[this.recoveryAttempt];if(this.turns.reset(e),this.close(),t===void 0){this.log.add(`mic-recovery-gave-up`,{why:e}),this.unavailable(`device-lost`);return}this.recoveryAttempt+=1,this.unavailable(`device-lost`),this.log.add(`mic-recovering`,{why:e,attempt:this.recoveryAttempt}),this.recoveryTimer=setTimeout(()=>{this.recoveryTimer=null,this.mic!==`off`&&this.open(e)},t)}clearRecovery(){this.recoveryTimer&&clearTimeout(this.recoveryTimer),this.recoveryTimer=null,this.recoveryAttempt=0}async checkDevices(){let e=this.stream?.getAudioTracks()[0];if(!e||e.readyState!==`live`){this.log.add(`device-change`,{live:!1}),this.recover(`device-change`);return}let t=[];try{t=(await this.mediaDevices()?.enumerateDevices()??[]).filter(e=>e.kind===`audioinput`)}catch{return}let n=t.some(e=>!this.groupId||e.groupId===this.groupId),r=t.find(e=>e.deviceId===`default`),i=!this.deviceId&&r!==void 0&&this.groupId!==void 0&&r.groupId!==this.groupId;this.log.add(`device-change`,{live:!0,ours:n,defaultMoved:i}),(!n||i)&&this.recover(`device-change`)}};const Rn=e(U),zn=()=>n(Rn),Bn=(e,t)=>{let n=o(t);n.current=t;let i=o(()=>void 0),c=e.aiExplanation?.explanationId??e.explanationId??``,l=a(()=>{let t=n.current;return new Ie(e,t?{poll:(e,t)=>n.current.poll(e,t),...t.retry?{retry:(e,t)=>n.current.retry(e,t)}:{}}:void 0,e=>i.current(e),{onSettled:e=>n.current?.settled?.(c,e)})},[c,e.aiExplanation?.status===`pending`?`pending`:`settled`,!!t]),[u,d]=s(l.state);return r(()=>(i.current=d,d(l.state),l.start(),()=>l.dispose()),[l]),[u.status===`ready`?u:{...u,explanation:e},l]},Vn=({prefix:e,state:t,onRetry:n})=>{let r=zn();return u(`div`,{class:`${e}-xp__ai`,"data-ai-status":t.status,children:[t.status===`pending`?l(`p`,{class:`${e}-xp__ai-note`,children:r.preparingDetailed}):null,t.status===`failed`?u(`p`,{class:`${e}-xp__ai-note`,children:[r.detailedUnavailable,t.retryAvailable?l(`button`,{type:`button`,class:`${e}-xp__ai-retry`,disabled:t.retrying,onClick:n,children:r.detailedRetry}):null]}):null,l(`span`,{class:`${e}-xp__sr`,role:`status`,"aria-live":`polite`,children:t.announcement})]})},Hn=({citations:e,step:t,prefix:n,active:r,onToggle:i,evidenceById:a})=>{let o=zn();return e.length===0?null:l(c,{children:e.map(e=>{let s=r?.id===e.id&&r.step===t;return l(`button`,{type:`button`,class:`${n}-xp__cite`,"data-evidence-id":e.id,"aria-expanded":s,"aria-label":`${o.citationLabel} ${e.index}: ${a[e.id]?.text??``}`.trim(),onClick:n=>i(e.id,t,n.currentTarget),children:Oe(e).slice(1,-1)},e.id)})})},Un=(e,t)=>e.sourceTargets.find(e=>t?t(e):!0),Wn=({evidence:e,prefix:t,onClose:n,onOpenSource:i,canOpenSource:a})=>{let s=zn(),c=o(null);r(()=>{c.current?.focus()},[e.id]);let d=i?Un(e,a):void 0;return u(`div`,{ref:c,class:`${t}-xp__evidence-panel`,role:`region`,tabIndex:-1,"aria-label":`${s.evidence} ${e.index}`,"data-testid":`analytics-explanation-evidence`,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),n())},children:[u(`div`,{class:`${t}-xp__evidence-head`,children:[u(`p`,{class:`${t}-xp__evidence-text`,children:[`[`,e.index,`] `,e.text]}),l(`button`,{type:`button`,class:`${t}-xp__close`,"aria-label":s.closeEvidence,onClick:n,children:`×`})]}),l(`dl`,{class:`${t}-xp__evidence-rows`,children:ke(e,s).map(e=>u(`div`,{style:{display:`contents`},"data-row":e.key,children:[l(`dt`,{children:e.label}),l(`dd`,{children:e.value})]},e.key))}),d&&i?l(`div`,{class:`${t}-xp__evidence-actions`,children:l(`button`,{type:`button`,class:`${t}-xp__button`,onClick:()=>i(d,e),children:s.openSource})}):null]})},Gn=({down:e})=>l(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,focusable:`false`,style:e?{transform:`scaleY(-1)`}:void 0,children:l(`path`,{d:`M7 10v11H3V10h4Zm0 0 4-7a2 2 0 0 1 2 2v4h6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.8 21H7`})}),Kn=(e,t,n)=>t===`wrong_numbers`?e.reasonWrongNumbers:t===`missing_comparison`?e.reasonMissingComparison:t===`unclear`?e.reasonUnclear:t===`too_long`?e.reasonTooLong:n,qn=({prefix:e,explanationId:t,submit:n,context:r})=>{let i=zn(),[o,c]=s({phase:`idle`,reasons:[],comment:``}),d=a(()=>new Me(t,n,c,r),[t]),f=o.phase===`saving`;return u(`div`,{class:`${e}-xp__feedback`,"data-testid":`analytics-explanation-feedback`,children:[o.phase===`done`?u(`div`,{class:`${e}-xp__feedback-row`,role:`status`,children:[l(`span`,{class:`${e}-xp__feedback-note`,children:i.feedbackThanks}),l(`button`,{type:`button`,class:`${e}-xp__button`,onClick:()=>void d.undo(),children:i.feedbackUndo})]}):u(`div`,{class:`${e}-xp__feedback-row`,children:[l(`span`,{class:`${e}-xp__feedback-label`,children:i.feedbackPrompt}),l(`button`,{type:`button`,class:`${e}-xp__vote`,"aria-label":i.feedbackHelpful,"aria-pressed":o.rating===`up`,disabled:f,onClick:()=>void d.vote(`up`),children:l(Gn,{down:!1})}),l(`button`,{type:`button`,class:`${e}-xp__vote`,"aria-label":i.feedbackNotHelpful,"aria-pressed":o.rating===`down`,disabled:f,onClick:()=>void d.vote(`down`),children:l(Gn,{down:!0})})]}),o.phase===`details`||f&&o.rating===`down`?u(`form`,{class:`${e}-xp__feedback-form`,onSubmit:e=>{e.preventDefault(),d.send()},children:[u(`fieldset`,{class:`${e}-xp__reasons`,children:[l(`legend`,{children:i.feedbackReasonsPrompt}),te.map(t=>l(`button`,{type:`button`,class:`${e}-xp__reason`,"aria-pressed":o.reasons.includes(t.id),onClick:()=>d.toggleReason(t.id),children:Kn(i,t.id,t.label)},t.id))]}),l(`textarea`,{class:`${e}-xp__comment`,"aria-label":i.feedbackCommentPlaceholder,placeholder:i.feedbackCommentPlaceholder,maxLength:500,value:o.comment,onInput:e=>d.setComment(e.currentTarget.value)}),l(`div`,{class:`${e}-xp__feedback-row`,children:l(`button`,{type:`submit`,class:`${e}-xp__button is-primary`,disabled:f,children:i.feedbackSubmit})})]}):null,o.error?l(`p`,{class:`${e}-xp__feedback-error`,role:`alert`,children:o.error}):null]})},Jn=({aiTransport:e,...t})=>{let[n,r]=Bn(t.explanation,e),i=Yn(t.explanation),o=a(()=>({...U,...t.copy}),[t.copy]);return l(Rn.Provider,{value:o,children:l(Xn,{...t,explanation:n.explanation,aiStatus:i?l(Vn,{prefix:t.classPrefix,state:n,onRetry:()=>void r.retry()}):null})})},Yn=e=>!!(e.aiExplanation&&e.aiExplanation.status!==`not_requested`),Xn=({explanation:e,aiStatus:t,classPrefix:n,showLead:r=!0,investigateOpen:d=!1,onFollowUp:f,onOpenSource:p,canOpenSource:m,onFeedback:h,feedbackContext:g,onExpand:_,onCollapse:v,expanded:y=!1,...b})=>{let x=zn(),S=o(null),C=o(null),w=o(!1),T=()=>{let e=S.current,t=e?.getRootNode(),n=t&&`activeElement`in t?t.activeElement:null;return!!(e&&n&&e.contains(n))},E=a(()=>(w.current=T(),Ee(e,{...b,copy:x})),[e,b.locale,b.cleanText,x]),[D,O]=s(),k=o(null);i(()=>{D&&(E.evidenceById[D.id]&&S.current?.querySelector(`[data-testid="analytics-explanation-evidence"]`)||(O(void 0),w.current&&!T()&&(C.current??S.current)?.focus()))},[E]);let A=(e,t,n)=>{k.current=n,O(n=>n?.id===e&&n.step===t?void 0:{id:e,step:t})},j=()=>{O(void 0);let e=k.current;e?.isConnected?e.focus():(C.current??S.current)?.focus()},M=(e,t)=>l(Hn,{citations:e,step:t,prefix:n,active:D,onToggle:A,evidenceById:E.evidenceById}),N=e=>{if(!D||D.step!==e)return null;let t=E.evidenceById[D.id];return t?l(Wn,{evidence:t,prefix:n,onClose:j,onOpenSource:p,canOpenSource:m}):null},P=(e,t)=>u(c,{children:[e.text,M(e.citations,t)]}),{investigate:F}=E;return u(`section`,{ref:S,class:`${n}-xp${y?` is-expanded`:``}${_||v?` has-expand`:``}`,"data-testid":`analytics-explanation`,"aria-label":x.region,tabIndex:-1,children:[y&&v?l(`button`,{type:`button`,class:`${n}-xp__expand`,"aria-label":x.collapse,title:x.collapse,onClick:v,children:`×`}):_?l(`button`,{type:`button`,class:`${n}-xp__expand`,"aria-label":x.expand,title:x.expand,"data-testid":`analytics-explanation-expand`,onClick:_,children:`⤢`}):null,r?u(`div`,{class:`${n}-xp__lead`,"data-step":`lead`,children:[E.lead.preface?l(`p`,{class:`${n}-xp__preface`,children:E.lead.preface}):null,u(`div`,{class:`${n}-xp__meta`,children:[l(`span`,{class:`${n}-xp__eyebrow`,children:E.lead.eyebrow}),l(`span`,{class:`${n}-xp__provenance`,children:E.lead.provenance})]}),l(`h3`,{class:`${n}-xp__headline`,ref:C,tabIndex:-1,children:P(E.lead.headline,`lead`)}),E.lead.summary?l(`p`,{class:`${n}-xp__summary`,children:P(E.lead.summary,`lead`)}):null,N(`lead`)]}):null,t,E.comparison.length>0?u(`section`,{class:`${n}-xp__step`,"data-step":`comparison`,children:[l(`h4`,{class:`${n}-xp__title`,children:x.comparison}),l(`ul`,{class:`${n}-xp__periods`,children:E.comparison.map(e=>u(`li`,{class:`${n}-xp__period`,"data-status":e.status??`observed`,children:[l(`span`,{class:`${n}-xp__period-label`,children:e.label}),e.valueText?l(`span`,{class:`${n}-xp__period-value`,children:e.valueText}):null,e.statusLabel?l(`span`,{class:`${n}-xp__chip is-${e.statusTone}`,children:e.statusLabel}):null,e.inProgress?l(`span`,{class:`${n}-xp__chip is-progress`,children:x.inProgress}):null,e.citation?M([e.citation],`comparison`):null,e.reason?l(`small`,{class:`${n}-xp__period-reason`,children:e.reason}):null]},e.key))}),N(`comparison`)]}):null,E.conclusions.length>0||E.businessMeaning?u(`section`,{class:`${n}-xp__step`,"data-step":`conclusions`,children:[l(`h4`,{class:`${n}-xp__title`,children:x.conclusions}),E.conclusions.length>0?l(`ul`,{class:`${n}-xp__list`,children:E.conclusions.map(e=>l(`li`,{children:P(e,`conclusions`)},e.text))}):null,E.businessMeaning?u(`p`,{class:`${n}-xp__meaning`,children:[u(`strong`,{children:[x.whyItMatters,`: `]}),P(E.businessMeaning,`conclusions`)]}):null,N(`conclusions`)]}):null,E.limits.length>0?u(`section`,{class:`${n}-xp__step`,"data-step":`limits`,children:[l(`h4`,{class:`${n}-xp__title`,children:x.limits}),l(`ul`,{class:`${n}-xp__list ${n}-xp__limits`,children:E.limits.map(e=>u(`li`,{"data-kind":e.kind,children:[e.text,e.citation?M([e.citation],`limits`):null]},e.text))}),N(`limits`)]}):null,E.checkedLine?l(`p`,{class:`${n}-xp__checked`,"data-step":`checked`,children:E.checkedLine}):null,E.hasInvestigate?u(`details`,{class:`${n}-xp__investigate`,"data-step":`investigate`,open:d,children:[l(`summary`,{children:x.investigate}),u(`div`,{class:`${n}-xp__investigate-body`,children:[F.causes.length>0?u(`div`,{class:`${n}-xp__group`,children:[u(`div`,{class:`${n}-xp__group-head`,children:[l(`h4`,{class:`${n}-xp__title`,children:x.causes}),l(`span`,{class:`${n}-xp__hint`,children:x.causesHint})]}),F.causes.map(e=>u(`article`,{class:`${n}-xp__card`,children:[u(`p`,{class:`${n}-xp__card-title`,children:[e.title,M(e.citations,`investigate`)]}),e.howToCheck?u(`p`,{class:`${n}-xp__card-body`,children:[x.howToCheck,` `,e.howToCheck]}):null]},e.title))]}):null,F.recommendations.length>0?u(`div`,{class:`${n}-xp__group`,children:[l(`h4`,{class:`${n}-xp__title`,children:x.recommendations}),F.recommendations.map(e=>u(`article`,{class:`${n}-xp__card`,children:[u(`p`,{class:`${n}-xp__card-title`,children:[e.title,M(e.citations,`investigate`)]}),e.why?l(`p`,{class:`${n}-xp__card-body`,children:e.why}):null,e.watch?u(`p`,{class:`${n}-xp__card-body`,children:[x.watch,` `,e.watch]}):null]},e.title))]}):null,F.outlook?u(`div`,{class:`${n}-xp__group`,children:[u(`div`,{class:`${n}-xp__group-head`,children:[l(`h4`,{class:`${n}-xp__title`,children:x.outlook}),l(`span`,{class:`${n}-xp__hint`,children:F.outlook.badge})]}),l(`p`,{class:`${n}-xp__card-body`,children:F.outlook.text}),F.outlook.note?l(`p`,{class:`${n}-xp__card-body`,children:F.outlook.note}):null]}):null,f&&F.followUps.length>0?u(`div`,{class:`${n}-xp__group`,children:[l(`h4`,{class:`${n}-xp__title`,children:x.followUps}),l(`div`,{class:`${n}-xp__questions`,children:F.followUps.map(e=>l(`button`,{type:`button`,class:`${n}-xp__question`,onClick:()=>f(e),children:e},e))})]}):null,E.evidence.length>0?u(`div`,{class:`${n}-xp__group`,children:[l(`h4`,{class:`${n}-xp__title`,children:x.evidenceList}),l(`ul`,{class:`${n}-xp__list`,children:E.evidence.map(e=>u(`li`,{children:[e.text,M([{id:e.id,index:e.index}],`investigate`)]},e.id))})]}):null,N(`investigate`)]})]}):null,l(`p`,{class:`${n}-xp__source`,children:E.sourceNote}),h&&E.explanationId?l(qn,{prefix:n,explanationId:E.explanationId,submit:h,context:g}):null]})},Zn=[{name:`Smileys`,emojis:`😀.😃.😄.😁.😅.😂.🤣.😊.😇.🙂.🙃.😉.😌.😍.🥰.😘.😋.😛.😜.🤪.🤗.🤭.🤔.🤐.😐.😶.😏.🙄.😴.🥳.😎.🤓.🥺.😢.😭.😤.😠.🤯.😬.😱.🤩.🥱`.split(`.`)},{name:`Gestures`,emojis:[`👍`,`👎`,`👌`,`🤌`,`✌️`,`🤞`,`🤟`,`🤘`,`🤙`,`👈`,`👉`,`👆`,`👇`,`✋`,`🖐️`,`👋`,`🤝`,`🙏`,`💪`,`👏`,`🙌`,`👐`,`🤲`,`🫶`]},{name:`Hearts & symbols`,emojis:`❤️.🧡.💛.💚.💙.💜.🖤.🤍.💔.❣️.💕.💖.💘.💝.✨.⭐.🌟.💫.🔥.🎉.🎊.✅.❌.⚡.💯.🚀`.split(`.`)},{name:`Animals & nature`,emojis:[`🐶`,`🐱`,`🦊`,`🐻`,`🐼`,`🐨`,`🦁`,`🐮`,`🐸`,`🐵`,`🐧`,`🦄`,`🐝`,`🦋`,`🐢`,`🐬`,`🌷`,`🌸`,`🌹`,`🌻`,`🌳`,`🍀`]},{name:`Food & drink`,emojis:[`🍎`,`🍌`,`🍉`,`🍓`,`🍒`,`🥑`,`🍔`,`🍟`,`🍕`,`🌮`,`🍿`,`🍩`,`🍪`,`🎂`,`☕`,`🍵`,`🍺`,`🥂`,`🍷`]},{name:`Objects & travel`,emojis:`🚀.✈️.🚗.🏠.📦.📱.💻.⌚.📷.💡.🔑.🎁.📌.✏️.📝.📞.📧.💰.📈.⏰.🔔.🎯.🏆.🎮.🎵.💬.👀`.split(`.`)}],Qn={"contact-support":{title:`Contact support`,submit:`Request support`,fields:[{key:`visitorName`,label:`Full name`,kind:`text`,required:!0,identity:`name`},{key:`visitorEmail`,label:`Email`,kind:`email`,required:!0,identity:`email`},{key:`subject`,label:`Subject`,kind:`text`,required:!0},{key:`message`,label:`Message`,kind:`textarea`,required:!0,placeholder:`Describe what you need help with.`}]},inquiry:{title:`Leave a message`,submit:`Send message`,fields:[{key:`visitorName`,label:`Full name`,kind:`text`,required:!0,identity:`name`},{key:`visitorEmail`,label:`Email`,kind:`email`,required:!0,identity:`email`},{key:`message`,label:`Message`,kind:`textarea`,required:!0,placeholder:`How can we help?`}]},contact:{title:`Share your details`,submit:`Save`,fields:[{key:`name`,label:`Full name`,kind:`text`,required:!0,identity:`name`},{key:`email`,label:`Email`,kind:`email`,required:!0,identity:`email`},{key:`phone`,label:`Phone`,kind:`tel`,required:!0,identity:`phone`}]},"book-demo":{title:`Book a demo`,submit:`Request demo`,fields:[{key:`visitorName`,label:`Full name`,kind:`text`,required:!0,identity:`name`},{key:`visitorEmail`,label:`Email`,kind:`email`,required:!0,identity:`email`},{key:`preferredAt`,label:`Preferred time`,kind:`text`,placeholder:`e.g. Thursday 3pm`},{key:`notes`,label:`Notes`,kind:`textarea`,placeholder:`Anything we should know?`}]},"request-callback":{title:`Request a callback`,submit:`Request callback`,fields:[{key:`visitorName`,label:`Full name`,kind:`text`,required:!0,identity:`name`},{key:`visitorPhone`,label:`Phone number`,kind:`tel`,required:!0,identity:`phone`},{key:`topic`,label:`Topic`,kind:`text`,placeholder:`What should we call about?`}]},"schedule-callback":{title:`Schedule a callback`,submit:`Schedule callback`,fields:[{key:`visitorName`,label:`Full name`,kind:`text`,required:!0,identity:`name`},{key:`visitorPhone`,label:`Phone number`,kind:`tel`,required:!0,identity:`phone`},{key:`topic`,label:`Topic`,kind:`text`,placeholder:`What should we call about?`}]},"subscribe-newsletter":{title:`Subscribe`,submit:`Subscribe`,fields:[{key:`visitorName`,label:`Full name`,kind:`text`,required:!0,identity:`name`},{key:`visitorEmail`,label:`Email`,kind:`email`,required:!0,identity:`email`}]}},$n={openChat:`Open chat`,closeChat:`Close chat`,closeHistory:`Close conversation history`,unreadMessage:`1 unread message`,unreadMessages:`{count} unread messages`,muteSounds:`Mute sounds`,unmuteSounds:`Unmute sounds`,statusOnline:`Online · replies instantly`,statusOffline:`Away · leave a message`,liveSupport:`Live support`,reconnectSupport:`Reconnect to support`,reconnectPrompt:`I can bring a teammate back into this chat.`,waitingForTeam:`AI helping · team notified`,assistantName:`Assistant`,chatName:`Chat`,welcomeLabel:`{name} welcome`,welcomeEyebrow:`Ready when you are`,welcomePrompt:`Ask a question, leave a message, or book a demo.`,agentTyping:`{name} is typing…`,expandedAnalyticsResult:`Expanded analytics result`,privacyAndData:`Privacy and local data`,muteMicrophone:`Mute microphone`,unmuteMicrophone:`Unmute microphone`,chooseMicrophone:`Choose microphone`,defaultMicrophone:`Default microphone`,microphone:`Microphone`,talkNow:`Talk now`,expandView:`Expand view`,exitExpandedView:`Exit expanded view`,minimizeVoiceChat:`Minimize voice chat`,endVoiceChat:`End voice chat`,restoreVoiceChat:`Restore voice chat`,reopenVoiceChat:`Reopen voice chat with {name}`,voiceConnecting:`Connecting…`,voiceListening:`Listening…`,voiceHearing:`Hearing you…`,voiceUnavailable:`Can’t hear you — check your microphone.`,voiceProcessing:`Transcribing…`,voiceSpeaking:`Speaking…`,voiceNoise:`No clear speech heard. Move closer to the mic and try again.`,voiceMisunderstood:`Could not transcribe that. Please try again or type your message.`,voiceDenied:`Microphone unavailable. Allow access or type your message.`,composerPlaceholder:`Type your message…`,send:`Send message`,emoji:`Emoji`,gifs:`GIFs`,attachFile:`Attach a file`,recordVoice:`Record a voice message`,stopRecording:`Stop recording`,actionTestMode:`Test mode`,stop:`Stop`,copy:`Copy`,copied:`Copied`,retry:`Retry`,clearChat:`Clear conversation`,clearChatConfirm:`Clear this conversation?`,clearChatConfirmBody:`This clears the messages on this device and starts a fresh chat.`,clearConfirmCta:`Clear chat`,endChat:`End conversation`,endChatConfirm:`End this conversation?`,endChatConfirmBody:`You won't be able to send more messages in this chat, but you can start a new one anytime.`,endConfirmCta:`End conversation`,conversationEnded:`This conversation has ended.`,startNewChat:`Start a new conversation`,pastConversations:`Past conversations`,viewingPast:`Viewing a past conversation (read-only)`,backToChat:`Back to current chat`,historyEnded:`ended`,feedbackHelpful:`Helpful`,feedbackNotHelpful:`Not helpful`,feedbackAnswerPrompt:`Was this answer helpful?`,feedbackThanks:`Thanks for the feedback`,csatPrompt:`How was this chat?`,feedbackCommentPlaceholder:`What went wrong? (optional)`,feedbackSend:`Send`,cancel:`Cancel`,newMessages:`New messages`,poweredBy:`Powered by`,searchGifs:`Search GIFs…`,searchingGifs:`Searching…`,noGifs:`No GIFs found`,assistantTyping:`Assistant is typing`,emptyReply:`Sorry, I couldn't generate a reply.`,errorGeneric:`Something went wrong reaching the assistant. Please try again.`,errorRateLimit:`You’re sending messages a little fast — give it a second and try again.`,resultExpired:`This result is not stored on this device. Ask again to see it.`,attaching:`Reading file…`,attachTooLarge:`That file is too large (max 5 MB).`,attachFailed:`Could not attach that file. Check its type and try again.`,attachPreviewTitle:`Preview of {name}`,attachOpen:`Preview {name}`,attachDownload:`Download`,attachPreviewClose:`Close preview`,attachPreviewLoading:`Loading file…`,attachPreviewFailed:`This file can’t be shown right now. It may have expired.`,attachPreviewUnsupported:`This file can’t be previewed here. Download it to open it.`,attachAnalysisFailed:`Saved for the team; AI could not read it.`,removeAttachment:`Remove attachment`,attachLimit:`You can attach up to {count} files to one message.`,attachedFiles:`Attached files`,removeAttachmentNamed:`Remove {name}`,dropFileHere:`Drop the file here`,clearDeviceData:`Clear conversations from this device`,clearDeviceDataBody:`This removes locally stored conversations and visitor details from this browser. It cannot be undone.`,clearDeviceDataCta:`Clear this device`,handoffTitle:`Want our team to follow up?`,handoffName:`Name (optional)`,handoffEmail:`Your email`,handoffNotify:`Notify the team`,sending:`Sending…`,handoffShared:`I’ve shared this with our team — they’ll get back to you at {email}.`,formThanks:`Thanks! We’ll be in touch.`,caseReference:`Reference: {reference}`,formError:`Something went wrong — please try again.`,actionContactOptions:`Contact options`,actionGetInTouch:`Get in touch`,actionMore:`+{count} more`,actionNeedHelp:`Need help?`,actionChoose:`Choose what you want to do`,actionFooter:`We’ll ask for your full name and the best email or phone so the team can reach you.`,actionCategorySupport:`Support`,actionCategorySales:`Talk to sales`,actionCategoryMarketing:`Stay in touch`,actionClose:`Close`,actionAs:`as {identity}`,bookingPickTime:`What time works best?`,bookingPickDay:`Pick a day`,bookingPickTimeLabel:`Pick a time`,bookingDuration:`{count}-minute demo`,bookingCallbackDuration:`{count}-minute callback`,bookingTimezone:`Times shown in {timezone}`,bookingSchedulerFallback:`the scheduler`,bookingCheckingAvailability:`Checking calendar availability…`,bookingNoSlots:`No available times were found in this booking window.`,bookingAvailabilityUnavailable:`Calendar availability is temporarily unavailable. Please try again shortly.`,bookingEarlierToday:`Earlier today`,bookingCalendarBusy:`Busy on the calendar`,bookingAlreadyBooked:`Already booked`,bookingNotOffered:`Not offered by the calendar`,bookingRequested:`Demo requested for {when}. The team will follow up.`,bookingVerificationPending:`We received your request for {when}, but could not verify the calendar booking. The team will check it. Please do not book this time again.`,bookingCallbackRequested:`Callback requested for {when}.`,bookingCallbackConfirmed:`Your callback is scheduled for {when}.`,bookingConfirmed:`Your demo is booked for {when}.`,bookingSlotTaken:`That time was just taken — please pick another.`,bookingViaProvider:`Pick a time that works for you on {provider}.`,bookingOpenScheduler:`Open the scheduler`,bookingLinkOpened:`Opening the scheduler — pick a time that suits you. 📅`,bookingScheduled:`Your demo is booked. Your booking details are saved in this chat.`,bookingBackToChat:`Back to chat`,bookingOpenNewTab:`Open in new tab`,bookingCloseScheduler:`Close scheduler`,bookingLoadingScheduler:`Loading scheduler…`,bookingMeetingLink:`Meeting link`,bookingManageLink:`Manage booking`,bookingCheckingDetails:`Getting your meeting link…`,bookingDetailsUnavailable:`We could not verify the booking details yet. Try checking again here; please do not book the same time twice.`,bookingUnverifiedLink:`View unverified calendar record`,bookingRetryDetails:`Retry`,previewReply:`👋 This is a preview — replies here are samples. Publish the widget on your site to chat with the live AI.`,previewActionNote:`Preview — nothing was actually sent. This works for real once you publish.`,previewBanner:`Preview — sample replies, no AI`},Q=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>t[n]??``),er=(e,t,n)=>!t||e.includes(t)?e:`${e} ${Q(n.caseReference,{reference:t})}`,tr=e=>e?{...$n,...e}:$n,nr=e($n),rr=nr.Provider,ir=e(void 0),ar=ir.Provider,or=()=>n(ir),sr=new Set([`ar`,`he`,`iw`,`fa`,`ur`,`ps`,`sd`,`ug`,`yi`,`dv`,`ckb`]),cr=(e,t)=>{if(t===`ltr`||t===`rtl`)return t;let n=(e??``).trim().toLowerCase().split(/[-_]/)[0]??``;return sr.has(n)?`rtl`:`ltr`},lr=()=>n(nr),ur=[[`AF`,`Afghanistan`,`93`],[`AL`,`Albania`,`355`],[`DZ`,`Algeria`,`213`],[`AS`,`American Samoa`,`1684`],[`AD`,`Andorra`,`376`],[`AO`,`Angola`,`244`],[`AI`,`Anguilla`,`1264`],[`AG`,`Antigua and Barbuda`,`1268`],[`AR`,`Argentina`,`54`],[`AM`,`Armenia`,`374`],[`AW`,`Aruba`,`297`],[`AU`,`Australia`,`61`],[`AT`,`Austria`,`43`],[`AZ`,`Azerbaijan`,`994`],[`BS`,`Bahamas`,`1242`],[`BH`,`Bahrain`,`973`],[`BD`,`Bangladesh`,`880`],[`BB`,`Barbados`,`1246`],[`BY`,`Belarus`,`375`],[`BE`,`Belgium`,`32`],[`BZ`,`Belize`,`501`],[`BJ`,`Benin`,`229`],[`BM`,`Bermuda`,`1441`],[`BT`,`Bhutan`,`975`],[`BO`,`Bolivia`,`591`],[`BA`,`Bosnia and Herzegovina`,`387`],[`BW`,`Botswana`,`267`],[`BR`,`Brazil`,`55`],[`BN`,`Brunei`,`673`],[`BG`,`Bulgaria`,`359`],[`BF`,`Burkina Faso`,`226`],[`BI`,`Burundi`,`257`],[`CV`,`Cabo Verde`,`238`],[`KH`,`Cambodia`,`855`],[`CM`,`Cameroon`,`237`],[`CA`,`Canada`,`1`],[`KY`,`Cayman Islands`,`1345`],[`CF`,`Central African Republic`,`236`],[`TD`,`Chad`,`235`],[`CL`,`Chile`,`56`],[`CN`,`China`,`86`],[`CO`,`Colombia`,`57`],[`KM`,`Comoros`,`269`],[`CG`,`Congo`,`242`],[`CD`,`Congo, Democratic Republic`,`243`],[`CK`,`Cook Islands`,`682`],[`CR`,`Costa Rica`,`506`],[`CI`,`Cote d'Ivoire`,`225`],[`HR`,`Croatia`,`385`],[`CU`,`Cuba`,`53`],[`CW`,`Curacao`,`599`],[`CY`,`Cyprus`,`357`],[`CZ`,`Czechia`,`420`],[`DK`,`Denmark`,`45`],[`DJ`,`Djibouti`,`253`],[`DM`,`Dominica`,`1767`],[`DO`,`Dominican Republic`,`1809`],[`EC`,`Ecuador`,`593`],[`EG`,`Egypt`,`20`],[`SV`,`El Salvador`,`503`],[`GQ`,`Equatorial Guinea`,`240`],[`ER`,`Eritrea`,`291`],[`EE`,`Estonia`,`372`],[`SZ`,`Eswatini`,`268`],[`ET`,`Ethiopia`,`251`],[`FO`,`Faroe Islands`,`298`],[`FJ`,`Fiji`,`679`],[`FI`,`Finland`,`358`],[`FR`,`France`,`33`],[`GF`,`French Guiana`,`594`],[`PF`,`French Polynesia`,`689`],[`GA`,`Gabon`,`241`],[`GM`,`Gambia`,`220`],[`GE`,`Georgia`,`995`],[`DE`,`Germany`,`49`],[`GH`,`Ghana`,`233`],[`GI`,`Gibraltar`,`350`],[`GR`,`Greece`,`30`],[`GL`,`Greenland`,`299`],[`GD`,`Grenada`,`1473`],[`GP`,`Guadeloupe`,`590`],[`GU`,`Guam`,`1671`],[`GT`,`Guatemala`,`502`],[`GG`,`Guernsey`,`44`],[`GN`,`Guinea`,`224`],[`GW`,`Guinea-Bissau`,`245`],[`GY`,`Guyana`,`592`],[`HT`,`Haiti`,`509`],[`HN`,`Honduras`,`504`],[`HK`,`Hong Kong`,`852`],[`HU`,`Hungary`,`36`],[`IS`,`Iceland`,`354`],[`IN`,`India`,`91`],[`ID`,`Indonesia`,`62`],[`IR`,`Iran`,`98`],[`IQ`,`Iraq`,`964`],[`IE`,`Ireland`,`353`],[`IM`,`Isle of Man`,`44`],[`IL`,`Israel`,`972`],[`IT`,`Italy`,`39`],[`JM`,`Jamaica`,`1876`],[`JP`,`Japan`,`81`],[`JE`,`Jersey`,`44`],[`JO`,`Jordan`,`962`],[`KZ`,`Kazakhstan`,`7`],[`KE`,`Kenya`,`254`],[`KI`,`Kiribati`,`686`],[`XK`,`Kosovo`,`383`],[`KW`,`Kuwait`,`965`],[`KG`,`Kyrgyzstan`,`996`],[`LA`,`Laos`,`856`],[`LV`,`Latvia`,`371`],[`LB`,`Lebanon`,`961`],[`LS`,`Lesotho`,`266`],[`LR`,`Liberia`,`231`],[`LY`,`Libya`,`218`],[`LI`,`Liechtenstein`,`423`],[`LT`,`Lithuania`,`370`],[`LU`,`Luxembourg`,`352`],[`MO`,`Macao`,`853`],[`MG`,`Madagascar`,`261`],[`MW`,`Malawi`,`265`],[`MY`,`Malaysia`,`60`],[`MV`,`Maldives`,`960`],[`ML`,`Mali`,`223`],[`MT`,`Malta`,`356`],[`MH`,`Marshall Islands`,`692`],[`MQ`,`Martinique`,`596`],[`MR`,`Mauritania`,`222`],[`MU`,`Mauritius`,`230`],[`MX`,`Mexico`,`52`],[`FM`,`Micronesia`,`691`],[`MD`,`Moldova`,`373`],[`MC`,`Monaco`,`377`],[`MN`,`Mongolia`,`976`],[`ME`,`Montenegro`,`382`],[`MS`,`Montserrat`,`1664`],[`MA`,`Morocco`,`212`],[`MZ`,`Mozambique`,`258`],[`MM`,`Myanmar`,`95`],[`NA`,`Namibia`,`264`],[`NR`,`Nauru`,`674`],[`NP`,`Nepal`,`977`],[`NL`,`Netherlands`,`31`],[`NC`,`New Caledonia`,`687`],[`NZ`,`New Zealand`,`64`],[`NI`,`Nicaragua`,`505`],[`NE`,`Niger`,`227`],[`NG`,`Nigeria`,`234`],[`NU`,`Niue`,`683`],[`KP`,`North Korea`,`850`],[`MK`,`North Macedonia`,`389`],[`MP`,`Northern Mariana Islands`,`1670`],[`NO`,`Norway`,`47`],[`OM`,`Oman`,`968`],[`PK`,`Pakistan`,`92`],[`PW`,`Palau`,`680`],[`PS`,`Palestine`,`970`],[`PA`,`Panama`,`507`],[`PG`,`Papua New Guinea`,`675`],[`PY`,`Paraguay`,`595`],[`PE`,`Peru`,`51`],[`PH`,`Philippines`,`63`],[`PL`,`Poland`,`48`],[`PT`,`Portugal`,`351`],[`PR`,`Puerto Rico`,`1787`],[`QA`,`Qatar`,`974`],[`RE`,`Reunion`,`262`],[`RO`,`Romania`,`40`],[`RU`,`Russia`,`7`],[`RW`,`Rwanda`,`250`],[`KN`,`Saint Kitts and Nevis`,`1869`],[`LC`,`Saint Lucia`,`1758`],[`VC`,`Saint Vincent and the Grenadines`,`1784`],[`WS`,`Samoa`,`685`],[`SM`,`San Marino`,`378`],[`ST`,`Sao Tome and Principe`,`239`],[`SA`,`Saudi Arabia`,`966`],[`SN`,`Senegal`,`221`],[`RS`,`Serbia`,`381`],[`SC`,`Seychelles`,`248`],[`SL`,`Sierra Leone`,`232`],[`SG`,`Singapore`,`65`],[`SK`,`Slovakia`,`421`],[`SI`,`Slovenia`,`386`],[`SB`,`Solomon Islands`,`677`],[`SO`,`Somalia`,`252`],[`ZA`,`South Africa`,`27`],[`KR`,`South Korea`,`82`],[`SS`,`South Sudan`,`211`],[`ES`,`Spain`,`34`],[`LK`,`Sri Lanka`,`94`],[`SD`,`Sudan`,`249`],[`SR`,`Suriname`,`597`],[`SE`,`Sweden`,`46`],[`CH`,`Switzerland`,`41`],[`SY`,`Syria`,`963`],[`TW`,`Taiwan`,`886`],[`TJ`,`Tajikistan`,`992`],[`TZ`,`Tanzania`,`255`],[`TH`,`Thailand`,`66`],[`TL`,`Timor-Leste`,`670`],[`TG`,`Togo`,`228`],[`TO`,`Tonga`,`676`],[`TT`,`Trinidad and Tobago`,`1868`],[`TN`,`Tunisia`,`216`],[`TR`,`Turkey`,`90`],[`TM`,`Turkmenistan`,`993`],[`TC`,`Turks and Caicos Islands`,`1649`],[`TV`,`Tuvalu`,`688`],[`UG`,`Uganda`,`256`],[`UA`,`Ukraine`,`380`],[`AE`,`United Arab Emirates`,`971`],[`GB`,`United Kingdom`,`44`],[`US`,`United States`,`1`],[`UY`,`Uruguay`,`598`],[`UZ`,`Uzbekistan`,`998`],[`VU`,`Vanuatu`,`678`],[`VA`,`Vatican City`,`39`],[`VE`,`Venezuela`,`58`],[`VN`,`Vietnam`,`84`],[`VG`,`Virgin Islands, British`,`1284`],[`VI`,`Virgin Islands, U.S.`,`1340`],[`YE`,`Yemen`,`967`],[`ZM`,`Zambia`,`260`],[`ZW`,`Zimbabwe`,`263`]].map(([e,t,n])=>({iso:e,name:t,dial:n})),dr=e=>[...e.toUpperCase()].map(e=>String.fromCodePoint(127397+e.charCodeAt(0))).join(``),fr=()=>{let e=``;try{if(Intl.DateTimeFormat().resolvedOptions().timeZone===`Africa/Lagos`&&(e=`NG`),!e){let t=navigator.languages?.[0]||navigator.language;e=new Intl.Locale(t).region||``}}catch{e=``}return ur.find(t=>t.iso===e)??ur.find(e=>e.iso===`US`)},pr=e=>{let t=fr(),n=e?.trim()??``;if(!n.startsWith(`+`))return{country:t,national:n.replace(/\D/g,``)};let r=n.replace(/\D/g,``),i=[...ur].sort((e,t)=>t.dial.length-e.dial.length).find(e=>r.startsWith(e.dial))??t;return{country:i,national:r.slice(i.dial.length)}},mr=(e,t)=>{let n=t.replace(/\D/g,``).replace(/^0+/,``);return n?`+${e.dial}${n}`:``},hr=e=>{let t=e.replace(/\D/g,``);return e.startsWith(`+`)&&t.length>=8&&t.length<=15},$=(e,t)=>l(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,...t,children:e}),gr=e=>l(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:l(`path`,{"fill-rule":`evenodd`,"clip-rule":`evenodd`,d:`M5 3.25h14A3.75 3.75 0 0 1 22.75 7v6A3.75 3.75 0 0 1 19 16.75h-7.19l-4.26 3.84A.75.75 0 0 1 6.25 20v-3.32A3.75 3.75 0 0 1 2.25 13V7A3.75 3.75 0 0 1 6 3.25Zm3 7.75a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z`})}),_r=e=>$(l(`path`,{d:`m6 9 6 6 6-6`}),e),vr=e=>$(u(c,{children:[l(`path`,{d:`m22 2-7 20-4-9-9-4Z`}),l(`path`,{d:`M22 2 11 13`})]}),e),yr=e=>$(u(c,{children:[l(`path`,{d:`M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z`}),l(`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`}),l(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`22`})]}),e),br=e=>$(u(c,{children:[l(`path`,{d:`M9 9v1a3 3 0 0 0 4.24 2.73`}),l(`path`,{d:`M15 5.5V5a3 3 0 0 0-5.94-.6`}),l(`path`,{d:`M19 10v2a7 7 0 0 1-9.9 6.36`}),l(`path`,{d:`M5 10v2a6.98 6.98 0 0 0 1.11 3.79`}),l(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`22`}),l(`line`,{x1:`2`,y1:`2`,x2:`22`,y2:`22`})]}),e),xr=e=>$(u(c,{children:[l(`path`,{d:`M15 3h6v6`}),l(`path`,{d:`M10 14 21 3`}),l(`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})]}),e),Sr=e=>$(u(c,{children:[l(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`}),l(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),l(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),l(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]}),e),Cr=e=>$(u(c,{children:[l(`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`}),l(`path`,{d:`m22 7-10 5L2 7`})]}),e),wr=e=>$(l(`path`,{d:`M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92Z`}),e),Tr=e=>$(u(c,{children:[l(`path`,{d:`M4 14v-2a8 8 0 0 1 16 0v2`}),l(`path`,{d:`M18 19h-2`}),l(`rect`,{x:`3`,y:`13`,width:`4`,height:`6`,rx:`2`}),l(`rect`,{x:`17`,y:`13`,width:`4`,height:`6`,rx:`2`})]}),e),Er=e=>$(u(c,{children:[l(`path`,{d:`M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4Z`}),l(`path`,{d:`M8 9h8M8 13h5`})]}),e),Dr=e=>$(u(c,{children:[l(`path`,{d:`M3 4h18M4 4v12h16V4M12 16v5M8 21h8`}),l(`path`,{d:`m8 12 2.5-2.5 2 2L16 8`})]}),e),Or=e=>$(u(c,{children:[l(`path`,{d:`M15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6`}),l(`path`,{d:`M3 9h12M7 2v4M12 2v4`}),l(`circle`,{cx:`17`,cy:`17`,r:`4`}),l(`path`,{d:`M17 15v2l1.5 1`})]}),e),kr=e=>$(u(c,{children:[l(`path`,{d:`M4 4h16v16H5a3 3 0 0 1-3-3V6`}),l(`path`,{d:`M8 8h8M8 12h8M8 16h5`})]}),e),Ar=e=>$(u(c,{children:[l(`circle`,{cx:`12`,cy:`12`,r:`9`}),l(`path`,{d:`M8.5 14.5a4 4 0 0 0 7 0`}),l(`line`,{x1:`9`,y1:`9.5`,x2:`9.01`,y2:`9.5`}),l(`line`,{x1:`15`,y1:`9.5`,x2:`15.01`,y2:`9.5`})]}),e),jr=e=>$(u(c,{children:[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}),e),Mr=e=>$(u(c,{children:[l(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),l(`path`,{d:`M15.5 8.5a5 5 0 0 1 0 7`}),l(`path`,{d:`M19 5a9 9 0 0 1 0 14`})]}),e),Nr=e=>$(u(c,{children:[l(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),l(`line`,{x1:`22`,y1:`9`,x2:`16`,y2:`15`}),l(`line`,{x1:`16`,y1:`9`,x2:`22`,y2:`15`})]}),e),Pr=e=>$(l(`path`,{d:`M20 6 9 17l-5-5`}),e),Fr=e=>$(u(c,{children:[l(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),l(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),e),Ir=e=>$(u(c,{children:[l(`path`,{d:`M1 4v6h6`}),l(`path`,{d:`M3.51 15a9 9 0 1 0 2.13-9.36L1 10`})]}),e),Lr=e=>$(l(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`}),e),Rr=e=>$(l(`path`,{d:`M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`}),e),zr=e=>$(u(c,{children:[l(`path`,{d:`M18.36 6.64a9 9 0 1 1-12.73 0`}),l(`line`,{x1:`12`,y1:`2`,x2:`12`,y2:`12`})]}),e),Br=e=>$(u(c,{children:[l(`circle`,{cx:`12`,cy:`12`,r:`9`}),l(`path`,{d:`M12 7v5l3 2`})]}),e),Vr=e=>$(u(c,{children:[l(`path`,{d:`M7 10v12`}),l(`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`})]}),e),Hr=e=>$(u(c,{children:[l(`path`,{d:`M17 14V2`}),l(`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`})]}),e),Ur=e=>$(u(c,{children:[l(`path`,{d:`M15 3h6v6`}),l(`path`,{d:`M9 21H3v-6`}),l(`path`,{d:`M21 3l-7 7`}),l(`path`,{d:`M3 21l7-7`})]}),e),Wr=e=>$(u(c,{children:[l(`path`,{d:`M9 3v6H3`}),l(`path`,{d:`M15 21v-6h6`}),l(`path`,{d:`M9 9 2 2`}),l(`path`,{d:`M15 15l7 7`})]}),e),Gr=e=>$(u(c,{children:[l(`rect`,{x:`3`,y:`4`,width:`18`,height:`14`,rx:`2`}),l(`rect`,{x:`11`,y:`11`,width:`8`,height:`6`,rx:`1`,fill:`currentColor`,stroke:`none`})]}),e),Kr=e=>$(u(c,{children:[l(`rect`,{x:`4`,y:`5`,width:`16`,height:`14`,rx:`2`}),l(`path`,{d:`M12 15V9`}),l(`path`,{d:`m8.5 12.5 3.5-3.5 3.5 3.5`})]}),e),qr=e=>$(u(c,{children:[l(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),l(`path`,{d:`m19 12-7 7-7-7`})]}),e),Jr=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\(https?:\/\/[^\s)]+\))|(\[[^\]]+\]\([^\s)]+\))|(https?:\/\/[^\s)]+)/g,Yr=e=>e.replace(/([^\n])\s+((?:[-*•]|\d+\.)\s+)(?=(?:\*\*[^*\n]{1,80}\*\*|[A-Z][A-Za-z0-9/& -]{1,50}:))/g,`$1
164
- $2`),Xr=e=>{let t=[],n=0,r=0,i;for(Jr.lastIndex=0;(i=Jr.exec(e))!==null;){i.index>n&&t.push(e.slice(n,i.index));let a=i[0];if(a.startsWith("`"))t.push(l(`code`,{class:`cf-md-code`,children:a.slice(1,-1)},r++));else if(a.startsWith(`**`))t.push(l(`strong`,{children:a.slice(2,-2)},r++));else if(a.startsWith(`[`)&&!/\]\(https?:\/\//.test(a))t.push(/^\[([^\]]+)\]/.exec(a)?.[1]??a);else if(a.startsWith(`[`)){let e=/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/.exec(a),n=e?e[1]:a,i=e?e[2]:`#`;t.push(l(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer nofollow`,children:n},r++))}else t.push(l(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer nofollow`,children:a},r++));n=i.index+a.length}return n<e.length&&t.push(e.slice(n)),t},Zr=/^(```|#{1,6}\s|\s*[-*•]\s|\s*\d+\.\s)/,Qr=(e,t,n)=>{let r=`cf-md-h cf-md-h--${Math.min(e,6)}`;return l(e<=2?`h3`:e===3?`h4`:`h5`,{class:r,children:t},n)},$r=e=>{let t=Yr(e.replace(/\r\n/g,`
165
- `)).split(`
166
- `),n=[],r=0,i=0;for(;i<t.length;){let e=t[i];if(e.trim().startsWith("```")){let e=[];for(i++;i<t.length&&!t[i].trim().startsWith("```");)e.push(t[i]),i++;i++,n.push(l(`pre`,{class:`cf-md-pre`,children:l(`code`,{children:e.join(`
167
- `)})},r++));continue}if(e.trim()===``){i++;continue}let a=/^(#{1,6})\s+(.*)$/.exec(e);if(a){n.push(Qr(a[1].length,Xr(a[2]),r++)),i++;continue}if(/^\s*[-*•]\s+/.test(e)){let e=[];for(;i<t.length&&/^\s*[-*•]\s+/.test(t[i]);)e.push(l(`li`,{children:Xr(t[i].replace(/^\s*[-*•]\s+/,``))},e.length)),i++;n.push(l(`ul`,{class:`cf-md-list`,children:e},r++));continue}if(/^\s*\d+\.\s+/.test(e)){let e=[];for(;i<t.length&&/^\s*\d+\.\s+/.test(t[i]);)e.push(l(`li`,{children:Xr(t[i].replace(/^\s*\d+\.\s+/,``))},e.length)),i++;n.push(l(`ol`,{class:`cf-md-list`,children:e},r++));continue}let o=[e];for(i++;i<t.length&&t[i].trim()!==``&&!Zr.test(t[i]);)o.push(t[i]),i++;let s=o.join(` `);if(/:\s*$/.test(s)&&i<t.length&&/^(?:\s*[-*•]\s+|\s*\d+\.\s+)/.test(t[i])){let e=/^(.*[.!?])\s+([^.!?]{2,120}:)$/.exec(s);e&&n.push(l(`p`,{children:Xr(e[1])},r++)),n.push(l(`p`,{class:`cf-md-list-intro`,children:Xr(e?.[2]??s)},r++))}else n.push(l(`p`,{children:Xr(s)},r++))}return n},ei=e=>H(e),ti=()=>{let e=o(null);return r(()=>{let t=requestAnimationFrame(()=>e.current?.scrollIntoView?.({block:`end`}));return()=>cancelAnimationFrame(t)},[]),e},ni=e=>e.trim().split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()??``).join(``)||`🤖`,ri=e=>{let t=e?.avatarId?.trim().toLowerCase().replace(/[^a-z0-9-]/g,`-`);return t?` cf-avatar-preset--${t}`:``},ii={"support-guide":`SG`,"sales-host":`SH`,"calm-advisor":`CA`,"technical-guide":`TG`,"school-desk":`SD`,"front-office":`FO`},ai=e=>{let t=e?.avatarId?.trim().toLowerCase();return t&&ii[t]||(e?ni(e.agentName):`·`)},oi=({persona:e,small:t,hideWhenMissing:n})=>{let r=t?`cf-msg__avatar`:`cf-header__avatar`,i=e?.agentAvatarUrl?.trim();return i?l(`span`,{class:r,children:l(`img`,{src:i,alt:``})}):n?null:l(`span`,{class:`${r}${ri(e)}`,children:ai(e)})},si=()=>{let e=lr(),[t,n]=s(0),i=[`Understanding your question`,`Checking approved information`,`Preparing your answer`];return r(()=>{let e=[window.setTimeout(()=>n(1),1800),window.setTimeout(()=>n(2),5e3)];return()=>e.forEach(e=>window.clearTimeout(e))},[]),u(`div`,{class:`cf-msg__bubble cf-typing`,"aria-label":e.assistantTyping,children:[l(`span`,{class:`cf-typing__label`,"aria-live":`polite`,children:i[t]}),l(`span`,{class:`cf-typing__dot`}),l(`span`,{class:`cf-typing__dot`}),l(`span`,{class:`cf-typing__dot`})]})},ci=({msg:e})=>{if(!e.sources||e.sources.length===0)return null;let t=new Set,n=[];for(let r of e.sources){let i=(r.url||r.title||``).toLowerCase();!i||t.has(i)||r.url&&e.content.includes(r.url)||(t.add(i),n.push(r))}if(n.length===0)return null;let r=n.slice(0,3),i=n.length-r.length;return u(`div`,{class:`cf-sources`,children:[r.map((e,t)=>e.url?u(`a`,{class:`cf-source`,href:e.url,target:`_blank`,rel:`noopener noreferrer nofollow`,title:e.title||e.url,children:[l(xr,{}),l(`span`,{children:e.title||e.url})]},t):u(`span`,{class:`cf-source`,title:e.title,children:[l(xr,{}),l(`span`,{children:e.title})]},t)),i>0&&u(`span`,{class:`cf-source cf-source--more`,children:[`+`,i,` more`]})]})},li=({replies:e,onPick:t})=>e&&e.length>0?l(`div`,{class:`cf-chips`,children:e.map((e,n)=>l(`button`,{type:`button`,class:`cf-chip`,onClick:()=>t(e),children:e},n))}):null,ui=({persona:e,starters:t,onPick:n,onFocusComposer:r,speaking:i,voiceState:a=`idle`,replyPending:o=!1,pinned:s=!1,muted:d=!1,onToggleMute:f,onEndCall:p,onTalkNow:m,showTalkNow:h=!1,micLevel:g=0,theaterMode:_=!1,onToggleTheater:v,onMinimize:y,audioDevices:b=[],selectedAudioDeviceId:x=``,onSelectAudioDevice:S,connectingOnly:C=!1})=>{if(!e)return null;let w=!!(e.allowVoiceInput&&e.talkbackMode&&e.talkbackMode!==`text`);if(!(w||e.widgetModule===`assistant`))return null;let T=e.agentAvatarUrl?.trim()||``,E=e.assistantMediaUrl?.trim()||T,D=e.assistantMediaKind===`video`&&!!E,O=t.slice(0,3),k=a!==`idle`,A=a===`idle`?`Speak with ${e.agentName}`:`End voice chat`,j=s&&w&&!k&&!i,M=a===`connecting`||a===`processing`||k&&o,N=[`cf-assistant-card__stage`,`cf-assistant-card__stage--local`,k?`is-live`:``,M?`is-thinking`:``,Wi(a)&&!d?`is-listening`:``,i||a===`speaking`?`is-speaking`:``,d?`is-muted`:``].filter(Boolean).join(` `),P=Wi(a)&&!d?{"--cf-listen":String(Math.max(.18,Math.min(1,g*8)))}:void 0,F=M&&u(`span`,{class:`cf-call-ripple`,"aria-hidden":`true`,children:[l(`span`,{}),l(`span`,{}),l(`span`,{})]});if(C)return u(`div`,{class:`cf-assistant-card cf-assistant-card--connecting`,"aria-live":`polite`,children:[u(`div`,{class:`cf-assistant-card__connecting-avatar`,children:[T?l(`img`,{src:T,alt:``}):l(`span`,{class:`cf-assistant-card__connecting-face${ri(e)}`,children:ai(e)}),F]}),u(`div`,{class:`cf-assistant-card__connecting-copy`,children:[l(`span`,{class:`cf-assistant-card__connecting-eyebrow`,children:e.agentName}),l(`strong`,{children:`Connecting with the AI…`})]})]});let I=k&&p&&l(Ji,{voiceState:a,muted:d,onToggleMute:f??(()=>{}),onEndCall:p,onTalkNow:m??(()=>{}),showTalkNow:h,micLevel:g,theaterMode:_,onToggleTheater:v??(()=>{}),onMinimize:y??(()=>{}),audioDevices:b,selectedAudioDeviceId:x,onSelectAudioDevice:S??(()=>{})});return j?l(`div`,{class:`cf-assistant-card cf-assistant-card--pinned cf-assistant-card--compact`,children:u(`button`,{type:`button`,class:`cf-assistant-card__compact-speak`,onClick:r,children:[T?l(`span`,{class:`cf-assistant-card__compact-avatar`,children:l(`img`,{src:T,alt:``})}):null,l(`span`,{class:`cf-assistant-card__compact-mic`,"aria-hidden":`true`,children:l(yr,{})}),l(`span`,{class:`cf-assistant-card__compact-label`,children:A})]})}):u(`div`,{class:`cf-assistant-card ${s?`cf-assistant-card--pinned`:``} ${i?`is-speaking`:``}`,children:[(E||w)&&u(`div`,{class:N,style:P,children:[u(`div`,{class:`cf-assistant-card__media ${E?`cf-assistant-card__media--uploaded`:`cf-assistant-card__media--generated`}${ri(e)}`,children:[D?l(`video`,{src:E,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):E?l(`img`,{src:E,alt:``}):l(`div`,{class:`cf-assistant-card__avatar-stage${ri(e)}`,children:u(`div`,{class:`cf-assistant-card__face`,children:[l(`span`,{class:`cf-assistant-card__initials`,children:ai(e)}),l(`span`,{class:`cf-assistant-card__eye cf-assistant-card__eye--left`}),l(`span`,{class:`cf-assistant-card__eye cf-assistant-card__eye--right`}),l(`span`,{class:`cf-assistant-card__mouth`})]})}),E&&!D&&l(`span`,{class:`cf-assistant-card__mouth cf-assistant-card__mouth--overlay`}),l(`span`,{class:`cf-avatar-aura cf-avatar-aura--one`,"aria-hidden":`true`}),l(`span`,{class:`cf-avatar-aura cf-avatar-aura--two`,"aria-hidden":`true`}),l(`span`,{class:`cf-avatar-listen-ring`,"aria-hidden":`true`}),u(`span`,{class:`cf-avatar-wave`,"aria-hidden":`true`,children:[l(`span`,{}),l(`span`,{}),l(`span`,{}),l(`span`,{})]})]}),F,k&&l(`span`,{class:`cf-call-status`,role:`status`,"aria-live":`polite`,children:Gi(a)}),w&&(I||u(`button`,{type:`button`,class:`cf-assistant-card__speak`,onClick:r,children:[l(yr,{}),A]}))]}),!s&&u(c,{children:[e.agentDescription?l(`p`,{class:`cf-assistant-card__copy`,children:e.agentDescription}):l(`p`,{class:`cf-assistant-card__copy`,children:e.greeting}),O.length>0&&l(`div`,{class:`cf-assistant-card__chips`,children:O.map(e=>l(`button`,{type:`button`,class:`cf-assistant-card__chip`,onClick:()=>n(e),children:e},e))}),e.disclaimerText||e.assistantPrivacyUrl?u(`p`,{class:`cf-assistant-card__privacy`,children:[e.disclaimerText||`This chat may be recorded for quality and support.`,e.assistantPrivacyUrl?u(c,{children:[` `,l(`a`,{href:e.assistantPrivacyUrl,target:`_blank`,rel:`noopener noreferrer nofollow`,children:`Privacy Policy`})]}):null]}):null]})]})},di={calendar:Sr,"calendar-clock":Or,headset:Tr,mail:Cr,message:Er,newsletter:kr,phone:wr,presentation:Dr,lifebuoy:Tr},fi=e=>di[e]??Cr,pi=e=>{if(e.id===`public_contact_support`)return`contact-support`;switch(e.endpoint){case`book-demo`:return`book-demo`;case`request-callback`:return`request-callback`;case`schedule-callback`:return`schedule-callback`;case`subscribe-newsletter`:return`subscribe-newsletter`;case`contact`:return`contact`;default:return`inquiry`}},mi={public_contact_support:{label:`Contact support`,description:`Send your request to the support team.`,category:`support`,icon:`headset`,endpoint:`inquiry`},public_submit_inquiry:{label:`Leave a message`,description:`Send your question and contact details.`,category:`support`,icon:`message`,endpoint:`inquiry`},public_book_demo:{label:`Book a demo`,description:`Request a demo from the team.`,category:`sales`,icon:`presentation`,endpoint:`book-demo`},public_request_callback:{label:`Request a callback`,description:`Ask the next available sales teammate to call you.`,category:`sales`,icon:`phone`,endpoint:`request-callback`},public_schedule_callback:{label:`Schedule a callback`,description:`Choose an available date and time for a call.`,category:`sales`,icon:`calendar-clock`,endpoint:`schedule-callback`},public_subscribe_newsletter:{label:`Subscribe`,description:`Get product updates.`,category:`marketing`,icon:`newsletter`,endpoint:`subscribe-newsletter`}},hi=(e,t,n={})=>Array.isArray(e)?e.filter(e=>e.readiness!==`unavailable`).map(e=>gi(e,n[e.id])):(t??[]).flatMap(e=>{let t=mi[e];if(!t)return[];let n=pi({...t,id:e}),r=Qn[n];return[{...t,id:e,presentation:n===`book-demo`||n===`schedule-callback`?`booking`:`form`,formTitle:r.title,submitLabel:r.submit,fields:r.fields,delivery:``,prompt:``,shortLabel:t.label.toLowerCase(),enabled:!0,readiness:`available`,legacyFallback:!0}]}).map(e=>gi(e,n[e.id])),gi=(e,t)=>{if(!t)return e;let n=t.fields??{};return{...e,...Object.fromEntries(Object.entries(t).filter(([e,t])=>e!==`fields`&&t!==void 0)),fields:e.fields.map(e=>({...e,...n[e.key]}))}},_i=(e,t)=>{let n=e.map(e=>e.label);return n.length===0?t.actionGetInTouch:n.length<=3?n.join(`, `):`${n.slice(0,2).join(`, `)} ${Q(t.actionMore,{count:String(n.length-2)})}`},vi=({label:e,required:t,value:n,onInput:i})=>{let c=a(()=>pr(n),[]),[d,f]=s(c.country.iso),[p,m]=s(c.national),[h,g]=s(!1),[_,v]=s(``),y=o(null),b=ur.find(e=>e.iso===d)??c.country,x=a(()=>{let e=_.trim().toLowerCase().replace(/^\+/,``);return e?ur.filter(t=>t.name.toLowerCase().includes(e)||t.iso.toLowerCase().includes(e)||t.dial.includes(e)):ur},[_]);r(()=>{if(!h)return;let e=e=>{y.current&&!e.composedPath().includes(y.current)&&g(!1)},t=e=>{e.key===`Escape`&&g(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[h]);let S=e=>{let t=ur.find(t=>t.iso===e)??b;f(t.iso),g(!1),v(``),i(mr(t,p))};return u(`div`,{class:`cf-phone`,role:`group`,"aria-label":`${e}${t?` *`:``}`,ref:y,children:[u(`span`,{class:`cf-phone__label`,children:[e,t?` *`:``]}),u(`div`,{class:`cf-phone__control`,children:[u(`button`,{type:`button`,class:`cf-phone__country`,"aria-label":`${b.name}, +${b.dial}. Choose country and calling code`,"aria-haspopup":`listbox`,"aria-expanded":h,onClick:()=>g(e=>!e),children:[l(`span`,{"aria-hidden":`true`,children:dr(b.iso)}),u(`span`,{class:`cf-phone__country-code`,children:[`+`,b.dial]}),l(_r,{})]}),l(`input`,{class:`cf-phone__input`,type:`tel`,inputMode:`numeric`,pattern:`[0-9]*`,autoComplete:`tel-national`,maxLength:15,placeholder:`8028509941`,value:p,"aria-label":e,onInput:e=>{let t=e.target,n=t.value.replace(/\D/g,``);t.value=n,m(n),i(mr(b,n))}})]}),h?u(`div`,{class:`cf-phone__menu`,children:[l(`input`,{class:`cf-phone__search`,type:`search`,placeholder:`Search country or code`,"aria-label":`Search countries`,value:_,autoFocus:!0,onInput:e=>v(e.target.value)}),l(`div`,{class:`cf-phone__options`,role:`listbox`,"aria-label":`Countries`,children:x.length>0?x.map(e=>u(`button`,{type:`button`,class:`cf-phone__option ${e.iso===b.iso?`is-selected`:``}`,role:`option`,"aria-selected":e.iso===b.iso,onClick:()=>S(e.iso),children:[l(`span`,{"aria-hidden":`true`,children:dr(e.iso)}),l(`span`,{class:`cf-phone__option-name`,children:e.name}),u(`span`,{class:`cf-phone__option-code`,children:[`+`,e.dial]})]},e.iso)):l(`div`,{class:`cf-phone__empty`,children:`No countries found`})})]}):null]})},yi=({field:e,value:t,onInput:n})=>{if(e.kind===`tel`)return l(vi,{label:e.label,required:e.required,value:t,onInput:n});let r=e.placeholder??e.label,i={class:`cf-form__input`,placeholder:e.required?`${r} *`:r,value:t,"aria-label":e.label,onInput:e=>n(e.target.value)};return e.kind===`textarea`?l(`textarea`,{rows:2,...i}):l(`input`,{type:e.kind,...i})},bi=({spec:e,visitor:t,onSubmit:n,onCancel:r})=>{let i=lr(),a=ti(),[o,c]=s(()=>{let n={};for(let r of e.fields)r.identity&&t[r.identity]&&(n[r.key]=t[r.identity]);return n}),[d,f]=s(`idle`),[p,m]=s(``),h=e=>!!(e.identity&&t[e.identity]?.trim()),g=e.fields.filter(e=>!h(e)),_=g.every(e=>!e.required||(o[e.key]?.trim()??``)!==``),v=t.email||t.name||``;return d===`done`?u(`div`,{class:`cf-form cf-form--done`,children:[l(Pr,{}),l(`span`,{children:p})]}):u(`div`,{class:`cf-form`,ref:a,children:[g.length===0&&v&&l(`div`,{class:`cf-form__as`,children:Q(i.actionAs,{identity:v})}),g.map(e=>l(yi,{field:e,value:o[e.key]??``,onInput:t=>c(n=>({...n,[e.key]:t}))},e.key)),d===`error`&&l(`div`,{class:`cf-form__err`,children:i.formError}),u(`div`,{class:`cf-form__actions`,children:[r&&l(`button`,{type:`button`,class:`cf-form__cancel`,onClick:r,children:i.cancel}),l(`button`,{type:`button`,class:`cf-form__submit`,disabled:!_||d===`submitting`,onClick:async()=>{if(!_||d===`submitting`)return;f(`submitting`);let t={},r={};for(let n of e.fields){let e=o[n.key]?.trim();e&&(t[n.key]=e,n.identity&&(r[n.identity]=e))}try{let e=await n(t,r);m(er(e.note||i.formThanks,e.caseReference,i)),f(`done`)}catch{f(`error`)}},children:d===`submitting`?i.sending:e.submit})]})]})},xi=e=>String(e).padStart(2,`0`),Si=()=>{let e=[];for(let t=9;t<=17;t++)e.push(`${xi(t)}:00`),e.push(`${xi(t)}:30`);return e},Ci=e=>{let t=new Date;return t.setHours(0,0,0,0),Array.from({length:e},(e,n)=>{let r=new Date(t);return r.setDate(t.getDate()+n),r})},wi=(e,t)=>{let[n,r]=t.split(`:`).map(Number),i=new Date(e.getFullYear(),e.getMonth(),e.getDate(),n??0,r??0);try{return new Intl.DateTimeFormat(void 0,{weekday:`short`,day:`numeric`,month:`short`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`}).format(i)}catch{return`${e.toDateString()} ${t}`}},Ti=(e,t)=>{let[n,r]=t.split(`:`).map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate(),n??0,r??0)},Ei=(e,t)=>{let n=Ti(e,t);try{return new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n)}catch{return t}},Di=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||``}catch{return``}},Oi=(e,t)=>{try{let n=new URL(e);return n.searchParams.set(`embed_type`,`Inline`),globalThis.location?.hostname&&n.searchParams.set(`embed_domain`,globalThis.location.hostname),t.name?.trim()&&n.searchParams.set(`name`,t.name.trim()),t.email?.trim()&&n.searchParams.set(`email`,t.email.trim()),n.toString()}catch{return e}},ki=(e,t)=>{if(!t?.contentWindow||e.source!==t.contentWindow)return!1;try{let t=new URL(e.origin).hostname;if(t!==`calendly.com`&&!t.endsWith(`.calendly.com`))return!1}catch{return!1}return!!(e.data&&typeof e.data==`object`&&typeof e.data.event==`string`)},Ai=({actionId:e,fields:t=Qn[`book-demo`].fields,visitor:n,onSubmit:i,onCancel:d,onDemoSlots:f,onConfirmHostedBooking:p,scheduler:m,title:h,submitLabel:g})=>{let _=e===`public_schedule_callback`,v=_?Qn[`schedule-callback`]:Qn[`book-demo`],y=h?.trim()||v.title,b=lr(),x=ti(),S=!!(!_&&m?.connected&&m.provider===`calendly`),C=S?b.bookingOpenScheduler:g?.trim()||v.submit,w=!!(m?.connected&&m.mode===`event`&&!S&&(m.availability===void 0||m.availability.calendarIds.length>0)),T=Math.min(60,Math.max(1,m?.availability?.bookingWindowDays??14)),E=a(()=>Ci(T),[T]),[D,O]=s(null),[k,A]=s(w?`loading`:`request_only`),[j,M]=s(m?.availability?.slotDurationMinutes??30),[N,P]=s(Di()||m?.availability?.timezone||``),F=a(()=>w?k!==`available`||D===null?[]:[...new Set([...D].map(e=>{let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}))].sort():Si(),[D,k,w]),[I,L]=s(a(()=>{let e=Date.now();for(let t=0;t<E.length;t++)if(F.some(n=>Ti(E[t],n).getTime()>e))return t;return 0},[E,F])),[R,ee]=s(null),[z,B]=s(n.name??``),[V,H]=s(n.email??``),[U,te]=s(n.phone??``),[W,G]=s(``),[K,q]=s(`idle`),[J,ne]=s(``),[Y,re]=s(!1),[ie,ae]=s(``),[oe,se]=s(`scheduler`),[ce,le]=s(null),[ue,de]=s(`idle`),[fe,pe]=s(``),[me,he]=s(``),[X,ge]=s(``),_e=o(null),ve=async(e,t,n)=>{de(`loading`);try{let r=await p?.(e,t,n);if(!r?.confirmed)throw Error(`booking confirmation unavailable`);let i=r?.meetingUrl||r?.eventLink||``,a=r?.rescheduleUrl||r?.cancelUrl||``;ae(i||a),se(i?`meeting`:`manage`),de(`idle`),re(!1),ne(er(b.bookingScheduled,me,b))}catch{de(`error`),re(!0),ne(b.bookingDetailsUnavailable)}};r(()=>{if(!fe)return;let e=e=>{if(!ki(e,_e.current)||e.data.event!==`calendly.event_scheduled`)return;let t=e.data.payload,n=t?.event?.uri?.trim()||``,r=t?.invitee?.uri?.trim()||``;X&&n&&r?(le({eventUri:n,inviteeUri:r}),ve(X,n,r),ne(b.bookingCheckingDetails)):(de(`error`),re(!0),ne(b.bookingDetailsUnavailable)),pe(``),q(`done`)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[p,me,X,fe,b]),r(()=>{if(!w||k!==`available`||D===null)return;let e=E.findIndex(e=>F.some(t=>D.has(Ti(e,t).getTime())));e>=0&&L(e)},[D,k,E,w,F]);let ye=!!(!_&&m?.connected&&(m.mode===`link`||m.provider===`calendly`)),be=async()=>{if(K===`submitting`||K===`scheduling`||!n.name?.trim()&&!z.trim()||!n.email?.trim()&&!V.trim())return;q(`submitting`);let e={};V.trim()&&(e.email=V.trim()),z.trim()&&(e.name=z.trim());try{let t=await i({...V.trim()?{visitorEmail:V.trim()}:{},...z.trim()?{visitorName:z.trim()}:{}},e),r=t.booking?.schedulingLink||m?.bookingLink||``;if(!r){q(`error`);return}ae(r),se(`scheduler`),he(t.caseReference||``),ge(t.inquiryId||``),pe(Oi(r,{name:z.trim()||n.name,email:V.trim()||n.email})),q(`scheduling`)}catch{q(`error`)}},[xe,Se]=s(new Set),[Ce,Z]=s([]),[we,Te]=s(0),[Ee,De]=s(!1);r(()=>{if(!f)return;let e=!0,t=new Date,n=new Date;return n.setDate(n.getDate()+T+1),f(t.toISOString(),n.toISOString()).then(t=>{if(e)if(Se(new Set(t.taken.map(e=>Date.parse(e)).filter(e=>!Number.isNaN(e)))),Z(t.busy.map(e=>[Date.parse(e.start),Date.parse(e.end)]).filter(([e,t])=>!Number.isNaN(e)&&!Number.isNaN(t))),M(t.slotDurationMinutes??30),P(Di()||t.timezone||``),w){if(t.status!==`available`||!Array.isArray(t.available)){O(null),A(`unavailable`);return}O(new Set(t.available.map(e=>Date.parse(e)).filter(e=>!Number.isNaN(e)))),A(`available`)}else A(t.status??`request_only`)}).catch(()=>{!e||!w||(O(null),A(`unavailable`))}),()=>{e=!1}},[T,w,f,we]);let Oe=!!n.email?.trim(),ke=!!n.name?.trim(),Ae=!!n.phone?.trim(),je=U,Me=!!R&&(!w||k===`available`)&&(ke||z.trim()!==``)&&(_?Ae||hr(je):Oe||V.trim()!==``),Ne=(_?n.phone||n.name:n.email||n.name)||``,Pe=e=>t.find(t=>t.key===e),Fe=Pe(`visitorName`)?.label||v.fields.find(e=>e.key===`visitorName`).label,Ie=Pe(`visitorEmail`)?.label||b.handoffEmail,Le=Pe(`visitorPhone`),Re=Pe(`topic`),ze=e=>xe.has(Ti(E[I],e).getTime()),Be=e=>Ti(E[I],e).getTime()<=Date.now(),Ve=j*60*1e3,He=e=>{let t=Ti(E[I],e).getTime(),n=t+Ve;return Ce.some(([e,r])=>t<r&&n>e)},Ue=e=>!w||D?.has(Ti(E[I],e).getTime())===!0,We=async()=>{if(!Me||K===`submitting`||!R)return;q(`submitting`),De(!1);let e=Ti(E[I],R),t=wi(E[I],R),r={};z.trim()&&(r.name=z.trim()),_?je&&(r.phone=je):V.trim()&&(r.email=V.trim());try{let a=await i(_?{bestTime:t,slotAt:e.toISOString(),visitorTimezone:Di()||`UTC`,...je?{visitorPhone:je}:{},...z.trim()?{visitorName:z.trim()}:{},...W.trim()?{topic:W.trim()}:{}}:{preferredAt:t,slotAt:e.toISOString(),visitorTimezone:Di()||`UTC`,...V.trim()?{visitorEmail:V.trim()}:{},...z.trim()?{visitorName:z.trim()}:{}},r);if(!_&&a.booking?.mode===`link`&&a.booking.schedulingLink?.trim()){let e=a.booking.schedulingLink.trim();ae(e),he(a.caseReference||``),ge(a.inquiryId||``),pe(Oi(e,{name:z.trim()||n.name,email:V.trim()||n.email})),q(`scheduling`);return}if(a.booking?.confirmed)ne(er(a.note||Q(_?b.bookingCallbackConfirmed:b.bookingConfirmed,{when:t}),a.caseReference,b)),ae(a.booking.meetingUrl||a.booking.rescheduleUrl||a.booking.cancelUrl||a.booking.eventLink||``),se(a.booking.meetingUrl||a.booking.eventLink?`meeting`:`manage`);else if(a.booking?.verificationPending){re(!0);let e=a.booking.eventLink||a.booking.meetingUrl||``;/^https?:\/\//i.test(e)&&(ae(e),se(`unverified`)),ne(er(a.note||Q(b.bookingVerificationPending,{when:t}),a.caseReference,b))}else ne(er(a.note||Q(_?b.bookingCallbackRequested:b.bookingRequested,{when:t}),a.caseReference,b));q(`done`)}catch(t){t?.status===409?(Se(t=>new Set(t).add(e.getTime())),ee(null),De(!0),Te(e=>e+1),q(`idle`)):q(`error`)}},Ge=()=>{pe(``),q(`idle`),d?.()};return K===`scheduling`&&fe?u(`div`,{class:`cf-scheduler-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":y,children:[u(`header`,{class:`cf-scheduler-overlay__head`,children:[l(`button`,{type:`button`,class:`cf-scheduler-overlay__back`,onClick:Ge,children:b.bookingBackToChat}),l(`strong`,{children:y}),u(`div`,{class:`cf-scheduler-overlay__tools`,children:[u(`a`,{href:ie,target:`_blank`,rel:`noopener noreferrer`,children:[b.bookingOpenNewTab,` `,l(xr,{})]}),l(`button`,{type:`button`,"aria-label":b.bookingCloseScheduler,onClick:Ge,children:l(jr,{})})]})]}),u(`div`,{class:`cf-scheduler-overlay__body`,children:[l(`div`,{class:`cf-scheduler-overlay__loading`,children:b.bookingLoadingScheduler}),l(`iframe`,{ref:_e,class:`cf-scheduler-overlay__frame`,src:fe,title:y,allow:`camera; microphone; fullscreen; payment`})]})]}):K===`done`?u(`div`,{class:`cf-form cf-form--done${Y?` cf-form--pending`:``}`,role:Y?`alert`:`status`,children:[!Y&&l(Pr,{}),l(`span`,{children:J}),ue===`loading`&&l(`span`,{role:`status`,children:b.bookingCheckingDetails}),ue===`error`&&u(`div`,{class:`cf-booking__receipt-error`,role:`alert`,children:[l(`span`,{children:b.bookingDetailsUnavailable}),ce&&X&&p&&l(`button`,{type:`button`,class:`cf-booking__back`,onClick:()=>void ve(X,ce.eventUri,ce.inviteeUri),children:b.bookingRetryDetails})]}),ie&&u(`a`,{class:`cf-booking__link`,href:ie,target:`_blank`,rel:`noopener noreferrer`,children:[oe===`meeting`?b.bookingMeetingLink:oe===`manage`?b.bookingManageLink:oe===`unverified`?b.bookingUnverifiedLink:b.bookingOpenScheduler,` `,l(xr,{}),l(`span`,{class:`cf-booking__url`,children:ie})]}),d&&l(`button`,{type:`button`,class:`cf-booking__back`,onClick:d,children:b.bookingBackToChat})]}):ye?u(`div`,{class:`cf-form cf-booking`,ref:x,children:[l(`div`,{class:`cf-booking__hint`,children:Q(b.bookingViaProvider,{provider:m?.label??b.bookingSchedulerFallback})}),Oe?Ne?l(`div`,{class:`cf-form__as`,children:Q(b.actionAs,{identity:Ne})}):null:u(c,{children:[!n.name?.trim()&&l(`input`,{class:`cf-form__input`,type:`text`,placeholder:`${Fe} *`,value:z,"aria-label":Fe,onInput:e=>B(e.target.value)}),l(`input`,{class:`cf-form__input`,type:`email`,placeholder:`${Ie} *`,value:V,"aria-label":Ie,onInput:e=>H(e.target.value)})]}),K===`error`&&l(`div`,{class:`cf-form__err`,children:b.formError}),u(`div`,{class:`cf-form__actions`,children:[d&&l(`button`,{type:`button`,class:`cf-form__cancel`,onClick:d,children:b.cancel}),l(`button`,{type:`button`,class:`cf-form__submit`,disabled:K===`submitting`||!n.name?.trim()&&z.trim()===``||!Oe&&V.trim()===``,onClick:be,children:K===`submitting`?b.sending:b.bookingOpenScheduler})]})]}):u(`div`,{class:`cf-form cf-booking`,ref:x,children:[u(`div`,{class:`cf-booking__hint`,children:[b.bookingPickTime,` ·`,` `,l(`span`,{class:`cf-booking__dur`,children:Q(_?b.bookingCallbackDuration:b.bookingDuration,{count:String(j)})}),N?l(`span`,{class:`cf-booking__timezone`,children:Q(b.bookingTimezone,{timezone:N})}):null]}),w&&k===`loading`?l(`div`,{class:`cf-booking__state`,role:`status`,children:b.bookingCheckingAvailability}):null,w&&k===`unavailable`?l(`div`,{class:`cf-form__err`,role:`alert`,children:b.bookingAvailabilityUnavailable}):null,w&&k===`available`&&F.length===0?l(`div`,{class:`cf-booking__state`,role:`status`,children:b.bookingNoSlots}):null,F.length>0?l(`div`,{class:`cf-booking__dates`,role:`tablist`,"aria-label":b.bookingPickDay,children:E.map((e,t)=>u(`button`,{type:`button`,role:`tab`,"aria-selected":t===I,disabled:w&&k===`available`&&!F.some(t=>D?.has(Ti(e,t).getTime())),class:`cf-booking__date ${t===I?`is-selected`:``}`,onClick:()=>{L(t),ee(null)},children:[l(`span`,{class:`cf-booking__dow`,children:e.toLocaleDateString(void 0,{weekday:`short`})}),l(`span`,{class:`cf-booking__dom`,children:e.getDate()})]},t))}):null,F.length>0?l(`div`,{class:`cf-booking__slots`,role:`listbox`,"aria-label":b.bookingPickTimeLabel,children:F.map(e=>{let t=Be(e),n=He(e),r=ze(e),i=Ue(e),a=r||t||n||!i;return l(`button`,{type:`button`,role:`option`,"aria-selected":R===e,disabled:a,title:t?b.bookingEarlierToday:n?b.bookingCalendarBusy:r?b.bookingAlreadyBooked:i?void 0:b.bookingNotOffered,class:`cf-booking__slot ${R===e?`is-selected`:``} ${a?`is-taken`:``}`,onClick:()=>ee(e),children:Ei(E[I],e)},e)})}):null,Ee&&l(`div`,{class:`cf-form__err`,children:b.bookingSlotTaken}),Ne?l(`div`,{class:`cf-form__as`,children:Q(b.actionAs,{identity:Ne})}):null,!ke&&l(`input`,{class:`cf-form__input`,type:`text`,placeholder:`${Fe} *`,value:z,"aria-label":Fe,onInput:e=>B(e.target.value)}),_&&!Ae&&l(vi,{label:Le?.label??`Phone number`,required:!0,value:U,onInput:te}),_&&Re?l(`input`,{class:`cf-form__input`,type:`text`,placeholder:Re.placeholder||Re.label,value:W,"aria-label":Re.label,onInput:e=>G(e.target.value)}):null,!_&&!Oe&&l(c,{children:l(`input`,{class:`cf-form__input`,type:`email`,placeholder:`${Ie} *`,value:V,"aria-label":Ie,onInput:e=>H(e.target.value)})}),K===`error`&&l(`div`,{class:`cf-form__err`,children:b.formError}),u(`div`,{class:`cf-form__actions`,children:[d&&l(`button`,{type:`button`,class:`cf-form__cancel`,onClick:d,children:b.cancel}),l(`button`,{type:`button`,class:`cf-form__submit`,disabled:!Me||K===`submitting`,onClick:We,children:K===`submitting`?b.sending:C})]})]})},ji=({actions:e,descriptors:n,visitor:c,onSubmitForm:d,onDemoSlots:f,onConfirmHostedBooking:p,scheduler:m,exclude:h=[],openAction:g,showTrigger:_=!0,translations:v={},onClose:y})=>{let b=lr(),[x,S]=s(null),[C,w]=s(!1),T=o(null),E=o(null),D=o(!1),O=o(null),k=o(void 0),A=o(!1),j=a(()=>`cf-actions-${Math.random().toString(36).slice(2,9)}`,[]),M=a(()=>hi(n,e,v).filter(e=>!h.includes(e.id)&&!h.includes(e.endpoint)),[n,e,h,v]);r(()=>{if(!g){k.current=void 0;return}k.current!==g&&M.some(e=>e.id===g)&&(k.current=g,A.current=!0,S(g),w(!0))},[g,M]);let N=x?M.find(e=>e.id===x):void 0,P=t(()=>{if(y){y();return}D.current=!0,O.current=T.current||E.current?.closest(`.cf-panel`)?.querySelector(`.cf-footer-actions .cf-action-trigger, .cf-textarea`)||null,A.current=!1,S(null),w(!1)},[y]),F=t(()=>{A.current?P():y?y():S(null)},[y,P]);i(()=>{C||!D.current||(D.current=!1,O.current?.focus(),O.current=null)},[C]);let I=o({drawerOpen:C,activeId:x});if(I.current={drawerOpen:C,activeId:x},r(()=>{let e=e=>{if(e.key!==`Escape`)return;let{drawerOpen:t,activeId:n}=I.current;!t&&!n||(e.stopPropagation(),n?F():P())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[F,P]),r(()=>{if(!C)return;let e=E.current;if(!e)return;e.querySelector(`button, input, textarea, select`)?.focus({preventScroll:!0});let t,n=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(()=>e.scrollIntoView?.({block:`nearest`}))};n();let r=e.closest(`.cf-body`)&&typeof ResizeObserver==`function`?new ResizeObserver(n):null;return r?.observe(e),()=>{cancelAnimationFrame(t),r?.disconnect()}},[C,x]),M.length===0||!_&&!C)return null;let L=C?N?u(`div`,{ref:E,id:j,class:`cf-action-drawer is-open`,role:`dialog`,"aria-modal":`false`,"aria-label":N.formTitle||N.label,children:[l(`div`,{class:`cf-action-drawer__handle`,"aria-hidden":`true`}),u(`div`,{class:`cf-action-drawer__head`,children:[u(`div`,{children:[l(`strong`,{children:N.formTitle||N.label}),N.legacyFallback?l(`small`,{class:`cf-action-test-mode`,children:b.actionTestMode}):null]}),l(`button`,{type:`button`,class:`cf-action-drawer__close`,"aria-label":b.actionClose,onClick:F,children:l(jr,{})})]}),N.readiness===`degraded`&&N.readinessNote?l(`p`,{class:`cf-action-drawer__note cf-action-drawer__note--warn`,role:`status`,children:N.readinessNote}):null,N.presentation===`booking`||N.endpoint===`book-demo`||N.endpoint===`schedule-callback`?l(Ai,{actionId:N.id,fields:N.fields,visitor:c,title:N.formTitle,submitLabel:N.submitLabel,onCancel:F,onSubmit:(e,t)=>d(N.id,e,t,N.endpoint),onDemoSlots:f,onConfirmHostedBooking:p,scheduler:m}):l(bi,{spec:{title:N.formTitle||N.label,submit:N.submitLabel,fields:N.endpoint===`request-callback`?N.fields.filter(e=>e.key!==`bestTime`):N.fields},visitor:c,onCancel:F,onSubmit:(e,t)=>d(N.id,e,t,N.endpoint)})]}):u(`div`,{ref:E,id:j,class:`cf-action-drawer cf-action-drawer--menu`,role:`dialog`,"aria-modal":`false`,"aria-label":b.actionChoose,children:[l(`div`,{class:`cf-action-drawer__handle`,"aria-hidden":`true`}),u(`div`,{class:`cf-action-drawer__head`,children:[u(`div`,{children:[l(`span`,{class:`cf-action-drawer__eyebrow`,children:b.actionNeedHelp}),l(`strong`,{children:b.actionChoose})]}),l(`button`,{type:`button`,class:`cf-action-drawer__close`,"aria-label":b.actionClose,onClick:P,children:l(jr,{})})]}),l(`div`,{class:`cf-action-drawer__grid`,children:M.map(e=>{let t=fi(e.icon);return u(`button`,{type:`button`,class:`cf-action-card`,onClick:()=>{A.current=!1,S(e.id)},children:[l(`span`,{class:`cf-action-card__icon cf-action-card__icon--${e.category}`,children:l(t,{})}),u(`span`,{class:`cf-action-card__copy`,children:[l(`strong`,{children:e.label}),e.legacyFallback?l(`small`,{class:`cf-action-test-mode`,children:b.actionTestMode}):null,l(`small`,{children:e.description}),e.readiness===`degraded`&&e.readinessNote?l(`small`,{class:`cf-action-card__warn`,children:e.readinessNote}):null]}),l(_r,{})]},e.id)})}),l(`p`,{class:`cf-action-drawer__note`,children:b.actionFooter})]}):null;return u(`div`,{class:`cf-action-shell`,children:[_&&u(`button`,{ref:T,type:`button`,class:`cf-action-trigger`,hidden:C,"aria-expanded":C,"aria-controls":j,onClick:()=>C?P():w(!0),children:[l(`span`,{class:`cf-action-trigger__icon`,children:l(Cr,{})}),u(`span`,{class:`cf-action-trigger__copy`,children:[l(`strong`,{children:b.actionContactOptions}),l(`small`,{children:_i(M,b)})]}),l(_r,{})]}),L]})},Mi=({hasEmail:e,visitor:t,question:n,onSubmitForm:r})=>{let i=lr(),[a,o]=s(!1),[c,d]=s(!1),[f,p]=s(t.name??``),[m,h]=s(t.email??``);if(e)return u(`div`,{class:`cf-handoff cf-handoff--done`,children:[l(Pr,{}),l(`span`,{children:`We’ve alerted the team. If someone is available, they can continue here.`})]});if(a){let e=t.email||m;return u(`div`,{class:`cf-handoff cf-handoff--done`,children:[l(Pr,{}),l(`span`,{children:Q(i.handoffShared,{email:e})})]})}let g=async()=>{if(!(!m.trim()||c)){d(!0);try{await r(`inquiry`,{visitorEmail:m.trim(),...f.trim()?{visitorName:f.trim()}:{},message:n||`I had a question the assistant couldn’t answer.`,subject:`Help request from chat`},{email:m.trim(),name:f.trim()||void 0}),o(!0)}catch{d(!1)}}};return u(`div`,{class:`cf-handoff`,children:[l(`div`,{class:`cf-handoff__title`,children:i.handoffTitle}),l(`input`,{class:`cf-form__input`,type:`text`,placeholder:i.handoffName,value:f,"aria-label":i.handoffName,onInput:e=>p(e.target.value)}),l(`input`,{class:`cf-form__input`,type:`email`,placeholder:`${i.handoffEmail} *`,value:m,"aria-label":i.handoffEmail,onInput:e=>h(e.target.value)}),l(`button`,{type:`button`,class:`cf-form__submit`,disabled:!m.trim()||c,onClick:g,children:c?i.sending:i.handoffNotify})]})},Ni=({text:e})=>{let t=lr(),[n,r]=s(!1);return u(`button`,{type:`button`,class:`cf-tool`,onClick:async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}},"aria-label":t.copy,children:[l(n?Pr:Fr,{}),n?t.copied:t.copy]})},Pi=({items:e,onPick:t})=>e.length===0?null:l(`div`,{class:`cf-starters`,children:e.map((e,n)=>l(`button`,{type:`button`,class:`cf-starter`,onClick:()=>t(e),children:e},n))}),Fi=({items:e})=>{let t=e.filter(e=>e.label.trim()&&e.url.trim()).slice(0,4);return t.length===0?null:l(`div`,{class:`cf-featured-links`,children:t.map((e,t)=>u(`a`,{class:`cf-featured-link`,href:e.url,target:`_blank`,rel:`noopener noreferrer nofollow`,title:e.label,children:[l(xr,{}),l(`span`,{children:e.label})]},`${e.url}-${t}`))})},Ii=({msg:e,onRate:t})=>{let n=lr(),[r,i]=s(!1),[a,o]=s(``),c=e.feedback,d=()=>{t(e.id,`up`),i(!1)},f=()=>{t(e.id,`down`),i(!0)},p=()=>{t(e.id,`down`,a.trim()),i(!1)};return u(`div`,{class:`cf-feedback`,children:[u(`div`,{class:`cf-feedback__row`,children:[l(`span`,{class:`cf-feedback__label`,children:n.feedbackAnswerPrompt}),l(`button`,{type:`button`,class:`cf-feedback__btn ${c===`up`?`is-active`:``}`,"aria-label":`${n.feedbackHelpful} answer`,"aria-pressed":c===`up`,onClick:d,children:l(Vr,{})}),l(`button`,{type:`button`,class:`cf-feedback__btn ${c===`down`?`is-active`:``}`,"aria-label":`${n.feedbackNotHelpful} answer`,"aria-pressed":c===`down`,onClick:f,children:l(Hr,{})}),c&&!r&&l(`span`,{class:`cf-feedback__thanks`,children:n.feedbackThanks})]}),r&&c===`down`&&u(`div`,{class:`cf-feedback__comment`,children:[l(`textarea`,{class:`cf-feedback__input`,rows:2,placeholder:n.feedbackCommentPlaceholder,value:a,onInput:e=>o(e.target.value)}),l(`button`,{type:`button`,class:`cf-feedback__send`,onClick:p,children:n.feedbackSend})]})]})},Li=e=>e.attachments??(e.attachmentName?[{id:e.attachmentId,name:e.attachmentName}]:[]),Ri=({msg:e,persona:t,isLast:n,visitor:r,hasEmail:i,lastQuestion:a,showActions:o,onPickReply:s,onSubmitForm:d,onDemoSlots:f,onConfirmHostedBooking:p,onRetry:m,ratable:h,onRate:g,onExpandVisualization:_,onExpandExplanation:v,onReconnect:y,onOpenAttachment:b,onExplanationFeedback:x,explanationTransport:S,onOpenAnalyticsSource:C})=>{let w=lr(),T=or(),E=e.role===`user`,D=e.liveEventType??``,O=e.content.trim().toLowerCase(),k=D===`handoff_queued`||D===`agent_joined`||D===`agent_left`||D===`ai_handback`||D===`conversation_ended`||O.includes(`joined the chat`)||O.includes(`left the chat`)||O.includes(`support agents will be with you`),A=e.role===`system`||k,j=e.requestedContactFields?.includes(`email`)===!0,M=n&&!E&&!A&&!e.reconnectOffer&&!!(e.handoffOffered||j),N=M&&!i?[`inquiry`]:[],P=!e.pending&&!e.streaming,F=[...e.artifacts??[],...e.visualization&&!(e.artifacts??[]).some(e=>e.type===`visualization`)?[{type:`visualization`,visualization:e.visualization}]:[]];return A?l(`div`,{class:`cf-msg cf-msg--system`,children:u(`div`,{class:`cf-system-event`,children:[l(`div`,{class:`cf-system-event__mark`,"aria-hidden":`true`}),l(`div`,{class:`cf-system-event__text`,children:e.content}),y&&l(`button`,{type:`button`,class:`cf-system-event__action`,onClick:y,children:w.reconnectSupport}),e.createdAt&&l(`div`,{class:`cf-system-event__time`,children:new Date(e.createdAt).toLocaleString(void 0,{day:`2-digit`,month:`short`,year:`numeric`,hour:`numeric`,minute:`2-digit`})})]})}):u(`div`,{class:`cf-msg cf-msg--${E?`user`:`agent`}`,children:[!E&&l(oi,{persona:t,small:!0}),u(`div`,{class:`cf-msg__col${!E&&o?` cf-msg__col--actions`:``}`,children:[e.pending&&e.content===``?l(si,{}):e.imageUrl?u(`div`,{class:`cf-msg__bubble cf-msg__bubble--media`,children:[l(`img`,{class:`cf-msg__media`,src:e.imageUrl,alt:`GIF`}),e.content&&l(`span`,{class:`cf-msg__caption`,children:e.content})]}):u(`div`,{class:`cf-msg__bubble`,children:[E?e.content:$r(e.content),e.streaming&&l(`span`,{class:`cf-caret`,"aria-hidden":`true`})]}),E?null:F.map((t,n)=>t.type===`visualization`&&t.visualization?l(Bi,{visualization:t.visualization,onFollowUp:s,onExpand:_?()=>_(e.id):void 0,expandControlId:e.id},`visualization-${n}`):t.type===`image`&&(t.data||t.uri?.startsWith(`https://`))&&[`image/png`,`image/jpeg`,`image/webp`].includes(t.mimeType??``)?u(`figure`,{class:`cf-artifact`,children:[t.title?l(`figcaption`,{children:t.title}):null,l(`img`,{src:t.uri||`data:${t.mimeType};base64,${t.data}`,alt:t.altText||t.caption||t.title||`Tool result`}),t.caption&&t.caption!==t.title?l(`p`,{children:t.caption}):null]},`image-${n}`):t.type===`video`&&t.uri?.startsWith(`https://`)&&(t.mimeType??``).startsWith(`video/`)?u(`figure`,{class:`cf-artifact`,children:[t.title?l(`figcaption`,{children:t.title}):null,l(`video`,{controls:!0,preload:`metadata`,playsInline:!0,src:t.uri}),t.caption&&t.caption!==t.title?l(`p`,{children:t.caption}):null]},`video-${n}`):t.type===`resource_link`&&t.uri?.startsWith(`https://`)?u(`a`,{class:`cf-artifact-link`,href:t.uri,target:`_blank`,rel:`noopener noreferrer nofollow`,children:[l(`strong`,{children:t.title||t.name||`Open result`}),t.caption?l(`span`,{children:t.caption}):null]},`link-${n}`):null),!E&&e.resultExpired&&!e.visualization?u(`p`,{class:`cf-analytics-expired`,"data-testid":`analytics-result-expired`,children:[e.resultExpired.title?u(`strong`,{children:[e.resultExpired.title,`. `]}):null,w.resultExpired]}):null,!E&&e.visualization&&ei(e.visualization)?l(`div`,{class:`cf-analytics-explanation`,"data-testid":`inline-analytics-explanation`,"data-explanation-message":e.id,children:l(Jn,{classPrefix:`cf`,copy:w.analytics?.explanation,locale:T,onExpand:v?()=>v(e.id):void 0,explanation:ei(e.visualization),onFollowUp:s,onFeedback:x,aiTransport:S,canOpenSource:e=>!!C&&(e.kind===`liveboard_tile`||e.kind===`insight`),onOpenSource:C?t=>{(t.kind===`liveboard_tile`||t.kind===`insight`)&&C({kind:t.kind,id:t.id,...e.visualization?.appliedFilters?.length?{appliedFilters:e.visualization.appliedFilters}:{}})}:void 0,maxFollowUps:3,showLead:(()=>{let t=ei(e.visualization).headline?.trim().toLocaleLowerCase();return!t||!e.content.toLocaleLowerCase().includes(t)})()})}):null,E&&Li(e).length>0&&l(`div`,{class:`cf-attach-row cf-attach-row--sent`,children:Li(e).map((t,n)=>b?u(`button`,{type:`button`,class:`cf-attach-chip cf-attach-chip--open`,title:Q(w.attachOpen,{name:t.name}),"aria-label":Q(w.attachOpen,{name:t.name}),onClick:()=>b(e,t,n),children:[l(Rr,{}),l(`span`,{children:t.name})]},`${t.id??t.name}-${n}`):u(`div`,{class:`cf-attach-chip`,title:t.name,children:[l(Rr,{}),l(`span`,{children:t.name})]},`${t.id??t.name}-${n}`))}),!E&&u(c,{children:[P&&(e.error||e.content)&&u(`div`,{class:`cf-msg__actions`,children:[l(`div`,{class:`cf-msg__tools`,children:e.error?u(`button`,{type:`button`,class:`cf-tool`,onClick:()=>m(e.id,e.retryText??``),children:[l(Ir,{}),w.retry]}):l(Ni,{text:e.content})}),h&&!e.error&&e.content?l(Ii,{msg:e,onRate:g}):null]}),l(ci,{msg:e}),n&&l(li,{replies:e.suggestedReplies,onPick:s}),M&&l(Mi,{hasEmail:i,visitor:r,question:a,onSubmitForm:d}),o&&l(ji,{showTrigger:!1,actions:e.availableActions,descriptors:e.actions,openAction:e.selectedAction,visitor:r,onSubmitForm:d,onDemoSlots:f,onConfirmHostedBooking:p,scheduler:t?.scheduler,exclude:N})]})]})]})},zi=({visualization:e,onClose:t,onFollowUp:n,onFeedback:r,transport:i,onOpenSource:a})=>{let o=lr(),s=or(),c=ei(e);return c?l(`div`,{class:`cf-analytics-explanation is-expanded`,"data-testid":`expanded-analytics-explanation`,children:l(Jn,{classPrefix:`cf`,explanation:c,copy:o.analytics?.explanation,locale:s,expanded:!0,onCollapse:t,onFollowUp:n,onFeedback:r,aiTransport:i,canOpenSource:e=>!!a&&(e.kind===`liveboard_tile`||e.kind===`insight`),onOpenSource:a?t=>{(t.kind===`liveboard_tile`||t.kind===`insight`)&&a({kind:t.kind,id:t.id,...e.appliedFilters?.length?{appliedFilters:e.appliedFilters}:{}})}:void 0})}):null},Bi=({visualization:e,expanded:t=!1,onExpand:n,onClose:r,onFollowUp:i,expandControlId:a})=>{let o=lr(),s=or();return l(yn,{visualization:e,classPrefix:`cf`,labels:o.analytics,locale:s,expanded:t,onExpand:n,onClose:r,onFollowUp:i,expandControlId:a})},Vi=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]??``),r.onerror=n,r.readAsDataURL(e)}),Hi=({onPick:e})=>l(`div`,{class:`cf-picker cf-emoji`,children:Zn.map(t=>u(`div`,{class:`cf-emoji__group`,children:[l(`div`,{class:`cf-emoji__label`,children:t.name}),l(`div`,{class:`cf-emoji__grid`,children:t.emojis.map((t,n)=>l(`button`,{type:`button`,class:`cf-emoji__btn`,onClick:()=>e(t),"aria-label":t,children:t},n))})]},t.name))}),Ui=({onSearch:e,onPick:t})=>{let n=lr(),[i,a]=s(``),[o,c]=s([]),[d,f]=s(!0);return r(()=>{let t=!0;f(!0);let n=setTimeout(()=>{e(i).then(e=>t&&(c(e),f(!1))).catch(()=>t&&(c([]),f(!1)))},300);return()=>{t=!1,clearTimeout(n)}},[i,e]),u(`div`,{class:`cf-picker cf-gif`,children:[l(`input`,{class:`cf-gif__search`,placeholder:n.searchGifs,value:i,"aria-label":n.searchGifs,onInput:e=>a(e.target.value)}),l(`div`,{class:`cf-gif__grid`,children:d?l(`div`,{class:`cf-gif__hint`,children:n.searchingGifs}):o.length===0?l(`div`,{class:`cf-gif__hint`,children:n.noGifs}):o.map(e=>l(`button`,{type:`button`,class:`cf-gif__item`,onClick:()=>t(e.url),"aria-label":e.alt,children:l(`img`,{src:e.preview,alt:e.alt,loading:`lazy`})},e.id))}),l(`div`,{class:`cf-gif__powered`,children:`via Tenor`})]})},Wi=e=>e===`listening`||e===`hearing`,Gi=e=>{switch(e){case`connecting`:return`Connecting with AI…`;case`listening`:return`Listening now — go ahead.`;case`hearing`:return`Hearing you…`;case`unavailable`:return`I can’t hear you — check your microphone.`;case`speaking`:return`AI is speaking — talk to interrupt.`;case`processing`:return`Working on it — keep talking to add more.`;case`noise`:return`I couldn't hear clear words. Try again closer to the mic.`;case`misunderstood`:return`I didn't understand that. Please try again.`;case`denied`:return`Microphone access is blocked. Allow the mic or type your question.`;case`muted`:return`Muted — tap the mic to unmute.`;case`timeout`:return`Didn't hear anything for a while — ending the call.`;default:return``}},Ki=({muted:e,listening:t,micLevel:n,onToggleMute:r})=>l(`button`,{type:`button`,class:`cf-call-btn ${e?`is-muted`:``} ${t?`is-listening`:``} ${t&&n>=.004?`is-hot`:``}`,"aria-label":e?`Unmute microphone`:`Mute microphone`,"aria-pressed":e,onClick:r,style:t?{"--cf-wave":String(Math.max(.2,Math.min(1,n*6)))}:void 0,children:l(e?br:yr,{})}),qi=({audioDevices:e,selectedAudioDeviceId:t,onSelectAudioDevice:n})=>{let[a,c]=s(!1),[d,f]=s(null),p=o(null);r(()=>{if(!a)return;let e=e=>{p.current&&!e.composedPath().includes(p.current)&&c(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[a]),i(()=>{if(!a){f(null);return}let e=p.current;if(!e)return;let t=new DOMRect(0,0,window.innerWidth,window.innerHeight);for(let n=e.parentElement;n;n=n.parentElement){let e=getComputedStyle(n);if(e.overflow!==`visible`||e.overflowY!==`visible`){t=n.getBoundingClientRect();break}}let n=e.getBoundingClientRect(),r=t.bottom-n.bottom-16,i=n.top-t.top-16,o=i>r;f({up:o,maxHeight:Math.max(72,Math.floor(o?i:r))})},[a]);let m=[{deviceId:``,label:`Default microphone`},...e];return u(`div`,{class:`cf-call-more`,ref:p,children:[l(`button`,{type:`button`,class:`cf-call-btn cf-call-btn--microphones`,"aria-label":`Choose microphone`,"aria-expanded":a,onClick:()=>c(e=>!e),children:l(_r,{})}),a&&u(`div`,{class:`cf-call-menu${d?.up?` cf-call-menu--up`:``}`,role:`menu`,style:d?{maxHeight:`${d.maxHeight}px`}:{visibility:`hidden`},children:[l(`div`,{class:`cf-call-menu__label`,children:`Microphone`}),m.map(e=>u(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e.deviceId===t,class:`cf-call-menu__item ${e.deviceId===t?`is-active`:``}`,onClick:()=>{n(e.deviceId),c(!1)},children:[e.deviceId===t?l(Pr,{}):l(`span`,{class:`cf-call-menu__spacer`}),l(`span`,{children:e.label})]},e.deviceId))]})]})},Ji=({voiceState:e,muted:t,onToggleMute:n,onEndCall:r,onTalkNow:i,showTalkNow:a,micLevel:o,theaterMode:s,onToggleTheater:c,onMinimize:d,audioDevices:f,selectedAudioDeviceId:p,onSelectAudioDevice:m})=>u(`div`,{class:`cf-call-controls`,children:[l(Ki,{muted:t,listening:Wi(e)&&!t,micLevel:o,onToggleMute:n}),l(qi,{audioDevices:f,selectedAudioDeviceId:p,onSelectAudioDevice:m}),a&&l(`button`,{type:`button`,class:`cf-call-btn cf-call-btn--talk`,"aria-label":`Talk now`,onClick:i,children:l(yr,{})}),l(`button`,{type:`button`,class:`cf-call-btn`,"aria-label":s?`Exit expanded view`:`Expand view`,"aria-pressed":s,onClick:c,children:l(s?Wr:Ur,{})}),l(`button`,{type:`button`,class:`cf-call-btn`,"aria-label":`Minimize voice chat`,onClick:d,children:l(Gr,{})}),l(`button`,{type:`button`,class:`cf-call-btn cf-call-btn--end`,"aria-label":`End voice chat`,onClick:r,children:l(zr,{})})]}),Yi=({persona:e,voiceState:t,muted:n,onToggleMute:r,onEndCall:i,micLevel:a,onExpand:o})=>{let s=e=>e.stopPropagation(),c=e?.assistantMediaUrl?.trim()||e?.agentAvatarUrl?.trim()||``,d=e?.assistantMediaKind===`video`&&!!c,f=e?.agentName||`Assistant`;return u(`div`,{class:[`cf-floating-call-card`,Wi(t)&&!n?`is-listening`:``,t===`speaking`?`is-speaking`:``,t===`processing`||t===`connecting`?`is-thinking`:``,n?`is-muted`:``].filter(Boolean).join(` `),style:Wi(t)&&!n?{"--cf-listen":String(Math.max(.18,Math.min(1,a*8)))}:void 0,role:`button`,tabIndex:0,"aria-label":`Reopen voice chat with ${f}`,onClick:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},children:[l(`div`,{class:`cf-floating-call-card__media`,"aria-hidden":`true`,children:c?d?l(`video`,{src:c,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):l(`img`,{src:c,alt:``}):u(`div`,{class:`cf-floating-call-card__avatar${ri(e)}`,children:[l(`span`,{children:ai(e)}),l(`span`,{class:`cf-floating-call-card__eye cf-floating-call-card__eye--left`}),l(`span`,{class:`cf-floating-call-card__eye cf-floating-call-card__eye--right`}),l(`span`,{class:`cf-floating-call-card__mouth`})]})}),l(`div`,{class:`cf-floating-call-card__shade`,"aria-hidden":`true`}),l(`span`,{class:`cf-floating-call-card__status`,role:`status`,"aria-live":`polite`,children:Gi(t)}),u(`div`,{class:`cf-floating-call-card__controls`,onClick:s,onKeyDown:s,role:`presentation`,children:[l(Ki,{muted:n,listening:Wi(t)&&!n,micLevel:a,onToggleMute:r}),l(`button`,{type:`button`,class:`cf-call-btn cf-call-btn--restore`,"aria-label":`Restore voice chat`,onClick:e=>{s(e),o()},children:l(Kr,{})}),l(`button`,{type:`button`,class:`cf-call-btn cf-call-btn--end`,"aria-label":`End voice chat`,onClick:e=>{s(e),i()},children:l(zr,{})})]})]})},Xi=(e,t)=>{switch(e){case`connecting`:return t.voiceConnecting;case`listening`:return t.voiceListening;case`hearing`:return t.voiceHearing;case`unavailable`:return t.voiceUnavailable;case`processing`:return t.voiceProcessing;case`speaking`:return t.voiceSpeaking;case`noise`:return t.voiceNoise;case`misunderstood`:return t.voiceMisunderstood;case`denied`:return t.voiceDenied;default:return Gi(e)}},Zi=({draftStore:e,onSend:t,onSendGif:n,onTyping:i,disabled:a,allowVoice:f,onTranscribe:p,gifEnabled:m,onSearchGifs:h,allowAttach:g,analyzeAttachments:_=!0,onUpload:v,voiceStartSignal:y=0,onVoiceStateChange:b,onPreviewAttachment:x})=>{let S=lr(),[C,w]=s(()=>e.value),T=t=>{let n=typeof t==`function`?t(C):t;e.value=n,w(n)},[E,D]=s(!1),[O,k]=s(!1),[A,j]=s(`idle`),[M,N]=s(`none`),[P,F]=s([]),I=o([]);I.current=P;let L=o(0),[R,ee]=s(!1),[z,B]=s(!1),[V,H]=s(``),U=o(null),te=o(null),W=o(null),G=o(0),K=o(null),q=o(void 0),J=e=>{j(e),b?.(e)},ne=()=>{q.current&&window.clearTimeout(q.current),q.current=void 0};r(()=>{let e=U.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,110)}px`)},[C]),r(()=>()=>{for(let e of I.current)e.previewUrl&&URL.revokeObjectURL(e.previewUrl)},[]);let Y=e=>{F(t=>{let n=t.find(t=>t.key===e);return n?.previewUrl&&URL.revokeObjectURL(n.previewUrl),t.filter(t=>t.key!==e)})},re=()=>F([]);r(()=>{if(M===`none`)return;let e=e=>{te.current&&!e.composedPath().includes(te.current)&&N(`none`)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[M]);let ie=e=>N(t=>t===e?`none`:e),ae=e=>{let t=U.current;if(!t){T(t=>t+e);return}let n=t.selectionStart??C.length,r=t.selectionEnd??C.length;T(C.slice(0,n)+e+C.slice(r)),requestAnimationFrame(()=>{t.focus();let r=n+e.length;t.setSelectionRange(r,r)})},oe=e=>{N(`none`),n(e)},se=async e=>{if(e.length===0)return;H(``);let t=G.current,n=5-I.current.length-L.current;if(n<=0){H(Q(S.attachLimit,{count:`5`}));return}let r=e.slice(0,n);L.current+=r.length,ee(!0);for(let e of r){if(t!==G.current)break;try{await ce(e,t)}finally{t===G.current&&(--L.current,ee(L.current>0))}}t===G.current&&e.length>r.length&&H(Q(S.attachLimit,{count:`5`}))},ce=async(e,t)=>{if(e.size>5242880){H(S.attachTooLarge);return}if(!v){H(S.attachFailed);return}try{let n=await Vi(e);if(t!==G.current)return;let r=await v(n,e.type||`application/octet-stream`,e.name,_);if(t!==G.current)return;let i={key:`${r.id||e.name}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,id:r.id,analysisFailed:r.analysisFailed,name:e.name,text:r.text,mimeType:e.type||`application/octet-stream`,size:e.size,previewUrl:e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,file:e};F(e=>[...e,i])}catch(e){if(t!==G.current)return;e instanceof d&&e.status===413?H(S.attachTooLarge):e instanceof d&&[400,415,503].includes(e.status)?H(e.message):H(S.attachFailed)}},le=async e=>{let t=e.target,n=Array.from(t.files??[]);t.value=``,await se(n)},ue=()=>{G.current+=1,L.current=0,ee(!1),H(``)},de=(!!C.trim()||P.length>0)&&!a&&!R&&!O,fe=()=>{de&&(t(C,P.length>0?{attachments:P.map(e=>({id:e.id,name:e.name,text:e.text,file:e.file}))}:void 0),i?.(!1),T(``),re(),H(``))},pe=e=>{let n=e.trim();if(!n||a){J(`misunderstood`);return}let r=C.trim();t(r?`${r} ${n}`:n),i?.(!1),T(``),re(),H(``),J(`idle`)},me=e=>{if(e.key===`Enter`&&!e.shiftKey){if(a)return;e.preventDefault(),fe()}else e.key===`Escape`&&M!==`none`&&(e.preventDefault(),e.stopPropagation(),N(`none`))},he=()=>{ne(),K.current?.stop(`dictation-ended`),K.current=null,D(!1),k(!1)},X=async()=>{let e=K.current;if(e){let{mic:t,processing:n}=e.snapshot;t===`hearing`||n?e.finishTurn():(he(),J(`idle`));return}let t=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||void 0;J(`connecting`);let n=new Ln({transcribe:async({audio:e,mimeType:n,durationSeconds:r})=>p(await Vi(e),n,t,r),listener:{state:({mic:e,processing:t,reason:r})=>{if(K.current===n){if(e===`unavailable`){if(r===`permission-denied`||r===`unsupported`||r===`no-device`||r===`error`){he(),J(`denied`);return}J(`unavailable`);return}D(e===`listening`||e===`hearing`),k(t),e===`starting`?J(`connecting`):t&&e!==`hearing`?J(`processing`):e===`hearing`?J(`hearing`):e===`listening`&&J(`listening`)}},speechStart:()=>ne(),turn:e=>{K.current===n&&(he(),pe(e.text))},noise:e=>{K.current===n&&(he(),J(e.reason===`transcribe-failed`?`misunderstood`:`noise`))}}});K.current=n,q.current=window.setTimeout(()=>{K.current===n&&(he(),J(`noise`))},15e3),await n.start()};return r(()=>{!y||!f||a||E||O||X()},[y]),r(()=>()=>{ne(),K.current?.stop(`unmounted`),K.current=null},[]),u(`div`,{class:`cf-composer ${z?`is-dragging`:``}`,ref:te,onDragEnter:e=>{g&&(e.preventDefault(),B(!0))},onDragOver:e=>{g&&e.preventDefault()},onDragLeave:e=>{e.currentTarget===e.target&&B(!1)},onDrop:e=>{g&&(e.preventDefault(),B(!1),se(Array.from(e.dataTransfer?.files??[])))},children:[M===`emoji`&&l(Hi,{onPick:ae}),M===`gif`&&l(Ui,{onSearch:h,onPick:oe}),(P.length>0||R||V)&&u(`div`,{class:`cf-attach-row`,role:`list`,"aria-label":S.attachedFiles,children:[P.map(e=>u(`span`,{class:`cf-attach-chip`,role:`listitem`,title:e.name,children:[u(`button`,{type:`button`,class:`cf-attach-open`,"aria-label":Q(S.attachOpen,{name:e.name}),disabled:!x,onClick:()=>x?.(e.file,e.name),children:[e.previewUrl?l(`img`,{class:`cf-attach-preview`,src:e.previewUrl,alt:``}):l(Rr,{}),u(`span`,{class:`cf-attach-copy`,children:[l(`span`,{children:e.name}),l(`small`,{children:e.analysisFailed?S.attachAnalysisFailed:`${Math.max(1,Math.ceil(e.size/1024))} KB`})]})]}),l(`button`,{type:`button`,class:`cf-attach-x`,"aria-label":Q(S.removeAttachmentNamed,{name:e.name}),onClick:()=>Y(e.key),children:l(jr,{})})]},e.key)),R&&u(`span`,{class:`cf-attach-status`,children:[l(`span`,{children:S.attaching}),l(`button`,{type:`button`,onClick:ue,children:S.cancel})]}),V&&!R&&l(`span`,{class:`cf-attach-status cf-attach-status--err`,children:V})]}),A!==`idle`&&u(`div`,{class:`cf-voice-state`,"aria-live":`polite`,children:[l(`span`,{class:`cf-voice-state__dot ${E?`is-live`:``}`}),Xi(A,S)]}),u(`div`,{class:`cf-composer__field`,children:[l(`button`,{type:`button`,class:`cf-iconbtn ${M===`emoji`?`is-active`:``}`,"aria-label":S.emoji,"aria-pressed":M===`emoji`,onClick:()=>ie(`emoji`),children:l(M===`emoji`?jr:Ar,{})}),m&&l(`button`,{type:`button`,class:`cf-iconbtn cf-gifbtn ${M===`gif`?`is-active`:``}`,"aria-label":S.gifs,"aria-pressed":M===`gif`,onClick:()=>ie(`gif`),children:l(`span`,{class:`cf-gif-label`,children:`GIF`})}),g&&u(c,{children:[l(`input`,{ref:W,type:`file`,class:`cf-file-input`,accept:`image/png,image/jpeg,image/webp,image/gif,application/pdf`,multiple:!0,onChange:le,tabIndex:-1,"aria-hidden":`true`}),l(`button`,{type:`button`,class:`cf-iconbtn`,"aria-label":S.attachFile,disabled:R,onClick:()=>W.current?.click(),children:l(Rr,{})})]}),l(`textarea`,{ref:U,class:`cf-textarea`,rows:1,placeholder:S.composerPlaceholder,value:C,"aria-label":S.composerPlaceholder,"aria-busy":a,onInput:e=>{let t=e.target.value;T(t),i?.(!!t.trim())},onPaste:e=>{let t=Array.from(e.clipboardData?.files??[]);!g||t.length===0||(e.preventDefault(),se(t))},onKeyDown:me}),f&&l(`button`,{type:`button`,class:`cf-iconbtn cf-mic ${E?`is-recording`:``}`,"aria-label":E?S.stopRecording:S.recordVoice,"aria-pressed":E,disabled:O||a,onClick:X,children:l(yr,{})}),l(`button`,{type:`button`,class:`cf-send`,"aria-label":S.send,disabled:!de,onClick:fe,children:l(vr,{})})]})]})},Qi=e=>e.replace(/\[[^\]]{0,60}\]/g,` `).replace(/\(([^)]{0,60})\)/g,(e,t)=>$i.has(t.trim().toLowerCase().replace(/[.!?,…]+$/,``).replace(/\s+/g,` `))?` `:e).replace(/\*[^*]{0,60}\*/g,` `).replace(/\s+/g,` `).trim(),$i=new Set(`background noise.engine noise.noise.inaudible.unintelligible.silence.no speech.static.music.laughter.applause.wind.breathing.click.clicks.clicking.mouse click.mouse clicks.beep.beeps.beeping.tap.taps.tapping.typing.keyboard typing.cough.coughing.sigh.hmm.mm.mmm.uh.um.ah.oh`.split(`.`)),ea=/^\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?(?:\s*(?:-|–|—|to|-->)\s*\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?)?$/,ta=e=>{let t=e.trim().toLowerCase().replace(/[()[\]*]/g,` `).replace(/[.!?,…]+$/,``).replace(/\s+/g,` `).trim();return!t||/^(?:sh+\s*)+$/.test(t)||ea.test(t)?!0:$i.has(t)},na=e=>{let t=e.trim().toLowerCase().replace(/\s+/g,` `);return t?/^(?:transcribe|transcription|transcribed text)[.!:]*$/.test(t)?!0:t.includes(`transcribe this audio recording verbatim`)||t.includes(`preserve the spoken language and any code-switching`)||t.includes(`output only the transcribed text, no commentary`):!1},ra=e=>{let t=Qi(e);return ta(t)||na(t)?``:t},ia=(e,t)=>Dn(e,t);let aa=!0,oa=null;const sa=e=>{aa=e},ca=()=>{let e=typeof window<`u`?window.AudioContext??window.webkitAudioContext:void 0;if(!e)return null;if(!oa)try{oa=new e}catch{return null}return oa.state===`suspended`&&oa.resume(),oa},la=(e,t,n,r,i,a)=>{let o=e.createOscillator(),s=e.createGain();o.type=i,o.frequency.setValueAtTime(t,n),o.connect(s),s.connect(e.destination),s.gain.setValueAtTime(1e-4,n),s.gain.exponentialRampToValueAtTime(a,n+.012),s.gain.exponentialRampToValueAtTime(1e-4,n+r),o.start(n),o.stop(n+r+.03)},ua=e=>{if(!aa)return;let t=ca();if(!t)return;let n=t.currentTime;try{e===`open`?(la(t,523,n,.12,`sine`,.05),la(t,784,n+.08,.16,`sine`,.05)):e===`send`?la(t,660,n,.08,`triangle`,.04):e===`receive`&&(la(t,880,n,.1,`sine`,.045),la(t,1175,n+.09,.14,`sine`,.045))}catch{}},da=[`audio/webm;codecs=opus`,`audio/webm`,`audio/ogg;codecs=opus`,`audio/ogg`],fa=()=>{if(typeof navigator>`u`||!navigator.mediaDevices?.getSupportedConstraints)return{};try{return navigator.mediaDevices.getSupportedConstraints()}catch{return{}}},pa=(e=``,t=fa())=>{let n={...e?{deviceId:{exact:e}}:{}};return t.echoCancellation&&(n.echoCancellation={ideal:!0}),t.noiseSuppression&&(n.noiseSuppression={ideal:!0}),t.autoGainControl&&(n.autoGainControl={ideal:!0}),t.channelCount&&(n.channelCount={ideal:1}),t.voiceIsolation&&(n.voiceIsolation={ideal:!0}),n},ma=(e={})=>{let t=Math.max(2,e.calibrationSamples??6),n=Math.max(t,e.ambientWindowSamples??72),r=Math.min(.5,Math.max(0,e.ambientPercentile??.2)),i=Math.min(1,Math.max(.01,e.smoothing??.22)),a=Math.max(2**-52,e.minimumNoiseFloor??5e-4),o=Math.max(1.1,e.speechToNoiseRatio??2.7),s=Math.min(o,Math.max(1,e.quietToNoiseRatio??1.55)),c=Math.max(250,e.minimumEndSilenceMs??650),l=Math.max(c,e.maximumEndSilenceMs??1100),u=[],d=a,f=d*o,p=0;return{observe:e=>{let m=Number.isFinite(e)?Math.max(0,e):0;if(u.length<t||m<=f){u.push(m),u.length>n&&u.shift();let e=[...u].sort((e,t)=>e-t),t=Math.min(e.length-1,Math.floor((e.length-1)*r)),o=Math.max(a,e[t]??a);d+=(o-d)*i}f=d*o;let h=d*s,g=u.length>=t,_=g&&m>=f;_&&(p=Math.max(p,m/Math.max(d,a)));let v=Math.min(1,Math.max(0,(p-o)/o)),y=Math.round(l-(l-c)*v);return{speech:_,quiet:g&&m<=h,calibrated:g,noiseFloor:d,speechThreshold:f,quietThreshold:h,endOfSpeechDelayMs:y}},reset:()=>{u=[],d=a,f=d*o,p=0}}},ha=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result??``).split(`,`)[1]??``),r.onerror=()=>n(r.error),r.readAsDataURL(e)}),ga=e=>{let t=globalThis.MediaRecorder;if(typeof t?.isTypeSupported==`function`){for(let n of da)if(t.isTypeSupported(n))try{return new t(e,{mimeType:n})}catch{}}return new t(e)},_a=e=>{if(!(!e||e.state!==`recording`)){try{e.requestData()}catch{}e.stop()}},va=(e,t)=>e?.status===429?t.errorRateLimit:t.errorGeneric,ya=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),ba=(e,t)=>{let n=ya(),r={stage:e,durationMs:Math.max(0,n-t)};try{performance.measure(`centrinfo-widget:${e}`,{start:t,end:n})}catch{}return typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(`centrinfo:performance`,{detail:r})),r},xa=/!?\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,Sa=/https?:\/\/[^\s)]+/g,Ca=e=>On(e).replace(xa,`$1`).replace(/`([^`]+)`/g,`$1`).replace(/\*\*([^*]+)\*\*/g,`$1`).replace(/__([^_]+)__/g,`$1`).replace(/(^|[\s([{])\*([^*\n]{1,120})\*(?=[\s.,;:!?)}\]]|$)/g,`$1$2`).replace(/(^|[\s([{])_([^_\n]{1,120})_(?=[\s.,;:!?)}\]]|$)/g,`$1$2`).replace(/^\s{0,3}#{1,6}\s+/gm,``).replace(/^\s{0,3}[-*+]\s+/gm,``).replace(/^\s{0,3}\d+\.\s+/gm,``).replace(/\s+\*/g,` `).replace(/\*\s+/g,` `).replace(/[*_]{2,}/g,``).replace(Sa,e=>e.replace(/^https?:\/\//,``).replace(/^www\./,``).replace(/\/$/,``)).replace(/[ \t]+\n/g,`
168
- `).replace(/\n{3,}/g,`
169
-
170
- `).replace(/[ \t]{2,}/g,` `).trim(),wa=(e,t)=>Ca(kn(e,t)),Ta=e=>e.type===`visualization`,Ea=e=>{let t=!!e.visualization,n=(e.artifacts??[]).some(Ta);if(!t&&!n)return e;let{visualization:r,artifacts:i,...a}=e,o=(i??[]).filter(e=>!Ta(e)),s=r?.title??(i??[]).find(Ta)?.visualization?.title??e.resultExpired?.title;return{...a,...o.length>0?{artifacts:o}:{},resultExpired:s?{title:s}:{}}},Da=e=>e.map(Ea),Oa=(e,t=Date.now())=>{let n=e.visualization?.explanation?.aiExplanation;if(!e.visualization?.explanation||!n||n.status!==`pending`)return e;let r=e.createdAt?Date.parse(e.createdAt):NaN;return Number.isFinite(r)&&t-r<45e3?e:{...e,visualization:{...e.visualization,explanation:{...e.visualization.explanation,aiExplanation:{...n,status:`failed`,retryAvailable:!1}}}}},ka=e=>e instanceof DOMException&&(e.name===`QuotaExceededError`||e.name===`NS_ERROR_DOM_QUOTA_REACHED`),Aa=(e,t,n,r)=>{let i=r;for(let r=0;r<4&&i.length>0;r+=1)try{return e.setItem(t,n(i)),!0}catch(e){if(!ka(e))return!1;i=i.slice(Math.ceil(i.length/2))}try{e.removeItem(t)}catch{}return!1},ja=(e,t)=>{if(e)try{let n=[];for(let r=0;r<e.length;r+=1){let i=e.key(r);i?.startsWith(t)&&n.push(i)}for(let t of n){let n=e.getItem(t);if(!n)continue;let r=JSON.parse(n);if(!Array.isArray(r.messages))continue;let i=Da(r.messages);i.some((e,t)=>e!==r.messages[t])&&e.setItem(t,JSON.stringify({...r,messages:i}))}}catch{}},Ma=(e,t=()=>Date.now())=>{let n=null,r=null,i=-1/0,a=()=>{r!==null&&(clearTimeout(r),r=null);let e=n;n=null,e&&(i=t(),e())};return{schedule:o=>{if(n=o,r!==null)return;let s=e-(t()-i);s<=0?a():r=setTimeout(a,s)},flush:a,cancel:()=>{r!==null&&clearTimeout(r),r=null,n=null}}},Na=()=>typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.round(Math.random()*1e9)}`,Pa=(e,t)=>{typeof console>`u`||console.warn(`[centrinfo-widget] ${e}`,t??{})},Fa=(e,t,n,r,i=1,a,o=!1,s,c)=>{e.current?.pause(),e.current=null,typeof window<`u`&&`speechSynthesis`in window&&window.speechSynthesis.cancel(),t.current=null;let l=()=>{let e=a?.trim();if(!o||!e||typeof window>`u`||!(`speechSynthesis`in window)||typeof SpeechSynthesisUtterance>`u`)return!1;let n=new SpeechSynthesisUtterance(e),r=!1,l=()=>{r||(r=!0,t.current===n&&(t.current=null,c?.()))};return n.rate=i,n.lang=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||`en-US`,n.onend=l,n.onerror=l,t.current=n,s?.(),window.speechSynthesis.cancel(),window.speechSynthesis.speak(n),!0};if(!n||typeof Audio>`u`)return l();let u=new Audio(`data:${r||`audio/mpeg`};base64,${n}`),d=!1,f=!1,p=()=>{d||(d=!0,e.current===u&&(e.current=null,c?.()))},m=()=>{if(!d){if(f||e.current!==u){p();return}d=!0,e.current=null,l()||c?.()}};return u.playbackRate=i,u.onended=p,u.onerror=m,e.current=u,u.play().then(()=>{if(!d){if(e.current!==u){p();return}f=!0,s?.(Number.isFinite(u.duration)?u.duration*1e3:void 0)}}).catch(m),!0},Ia=e=>{try{return e===`none`?null:e===`session`?sessionStorage:localStorage}catch{return null}},La=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)},Ra=e=>{try{let t=e?.split(`.`)[1];if(!t)return;let n=t.replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n.padEnd(Math.ceil(n.length/4)*4,`=`)));for(let e of[`sub`,`external_user_id`,`user_id`]){let t=r[e];if(typeof t==`string`&&t.trim())return t.trim()}}catch{}},za=e=>{let t=e.user?.externalId?.trim()||e.user?.userId?.trim()||e.user?.email?.trim().toLowerCase()||Ra(e.identityToken)||(e.identityToken||e.getIdentityToken?`authenticated`:`anonymous`);return`${e.token.slice(0,12)}:${e.chatSurface}:${La(t)}`},Ba=e=>`${e.chatSurface}:${Na()}`,Va=e=>e.slice(0,12),Ha=e=>`centrinfo:session:${e}`,Ua=e=>`centrinfo:visitor:${e}`,Wa=(e,t)=>`centrinfo:chat:${e}:${t}`,Ga=e=>`centrinfo:history:${e}`,Ka=720*60*60*1e3,qa=(e,t)=>{try{return JSON.parse(e?.getItem(Ua(t))||`{}`)}catch{return{}}},Ja=(e,t,n)=>{if(!e)return Ba(n);try{let r=Ha(t),i=e.getItem(r);if(i)return i;let a=Ba(n);return e.setItem(r,a),a}catch{return Ba(n)}},Ya=(e,t,n)=>{if(!e)return{};try{let r=e.getItem(Wa(t,n));return r?JSON.parse(r):{}}catch{return{}}},Xa=(e,t,n)=>{let{ts:r,expiresAt:i,messages:a}=Ya(e,t,n);return!Array.isArray(a)||typeof i==`number`&&Date.now()>i||typeof r==`number`&&Date.now()-r>Ka?[]:Da(a)},Za=(e,t,n)=>{let{ts:r,expiresAt:i,messages:a,ended:o}=Ya(e,t,n);return!Array.isArray(a)||a.length===0||typeof i==`number`&&Date.now()>i||typeof r==`number`&&Date.now()-r>Ka?!1:o===!0||typeof r==`number`&&Date.now()-r>864e5},Qa=e=>Number.isFinite(e??NaN)?Math.max(5,Math.min(200,Math.round(e))):50,$a=e=>Number.isFinite(e??NaN)?Math.max(1,Math.min(365,Math.round(e)))*24*60*60*1e3:Ka,eo=(e,t,n,r,i,a,o,s)=>{if(e)try{if(!a){e.removeItem(Wa(t,n));return}let c=r.filter(e=>!e.pending).slice(-o);if(c.length===0)return;let l=Date.now();Aa(e,Wa(t,n),e=>JSON.stringify({ts:l,expiresAt:l+s,messages:Da(e),ended:i}),c)}catch{}},to=(e,t)=>{if(!e)return[];try{let n=e.getItem(Ga(t)),r=n?JSON.parse(n):[];return Array.isArray(r)?r:[]}catch{return[]}},no=(e,t,n)=>{if(e)try{e.setItem(Ga(t),JSON.stringify(n.slice(0,20)))}catch{}},ro=(e,t)=>{if(e)try{let n=`centrinfo:chat:${t}:`,r=new Set([Ha(t),Ua(t),Ga(t)]),i=[];for(let t=0;t<e.length;t++){let a=e.key(t);a&&(r.has(a)||a.startsWith(n))&&i.push(a)}i.forEach(t=>e.removeItem(t))}catch{}},io=e=>{let t=(e.find(e=>e.role===`user`&&e.content.trim())?.content||e.find(e=>e.content.trim())?.content||``).trim().replace(/\s+/g,` `);return t.length>60?t.slice(0,60)+`…`:t||`Conversation`},ao=e=>({id:`live:${e.id}`,role:e.type===`chat`||e.type===`ai_resume`?`assistant`:`system`,content:e.content,authorName:e.authorName,liveEventType:e.type,createdAt:e.createdAt,offerReconnect:e.type===`ai_handback`&&e.reconnectOffered===!0}),oo=e=>(e??[]).find(e=>e.category===`support`&&e.enabled&&e.readiness!==`unavailable`&&(e.liveHandoff??e.id===`public_contact_support`)),so=(e,t)=>{if(t===`ai`)for(let t=e.length-1;t>=0;t--){let n=e[t];if(n){if(n.reconnectOffer)return;if(n.liveEventType===`ai_handback`)return n.offerReconnect?n.id:void 0}}},co=(e,n,i=!0)=>{let a=o(Ia(n.persistence)).current,c=za(n),l=o(Ja(a,c,n)),u=o(null),d=o(null),f=o(null),p=o(null),m=o(null),h=o(null),g=o(new Map),_=o(!1),v=o(void 0),y=o(null),b=o({}),x=o({}),[S,C]=s(null),[w,T]=s(()=>Xa(a,c,l.current)),E=o(null);E.current||(E.current=Ma(1e3));let D=o(w.length>0),O=o(w.some(e=>e.role===`user`)),[k,A]=s(!1),[j,M]=s(!1),[N,P]=s({status:`idle`}),F=o({}),[I,L]=s(()=>Za(a,c,l.current)),[R,ee]=s(()=>qa(a,c)),[z,B]=s(()=>to(a,c)),[V,H]=s(null),[U,te]=s([]),[W,G]=s(`ai`),[K,q]=s(void 0),[J,ne]=s(void 0),Y=o(new Date().toISOString()),re=o(void 0),ie=o(!1),ae=o(0),oe=o(R);r(()=>{oe.current=R},[R]);let se=S?.memoryEnabled!==!1,ce=Qa(S?.memoryMessageCap),le=$a(S?.memoryRetentionDays),ue=t(()=>{u.current?.abort(),E.current?.cancel(),ro(a,c),ro(a,Va(n.token));let e=Ba(n);l.current=e;try{a?.setItem(Ha(c),e)}catch{}H(null),te([]),L(!1),B([]),ee({}),G(`ai`),q(void 0),ne(void 0),Y.current=new Date().toISOString(),T(S?[{id:Na(),role:`assistant`,content:S.greeting,availableActions:S.availableActions,actions:S.actions}]:[])},[a,c,n.token,S]),de=t(e=>{try{a?.setItem(Ua(c),JSON.stringify(e))}catch{}},[a,c]),fe=t(t=>{let n=(t.email??``).trim().toLowerCase(),r=(oe.current.email??``).trim().toLowerCase();n&&r&&n!==r&&ue();let i={};t.email?.trim()&&(i.email=t.email.trim()),t.phone?.trim()&&(i.phone=t.phone.trim());let a=[t.firstName,t.lastName].filter(e=>!!e?.trim()).join(` `).trim()||t.name?.trim()||``;a&&(i.name=a),Object.keys(i).length>0&&ee(e=>{let t={...i,...e};return de(t),t}),e.identify(l.current,t).catch(()=>{})},[e,de,ue]),pe=o(0),me=t(e=>{pe.current=Date.now(),C(e),T(t=>{if(t.length===0)return[{id:Na(),role:`assistant`,content:e.greeting,availableActions:e.availableActions,actions:e.actions}];let n=t.some(e=>e.role===`user`),r=t[0];return!n&&r?.role===`assistant`?[{...r,content:e.greeting,availableActions:e.availableActions,actions:e.actions},...t.slice(1)]:t})},[]);r(()=>{if(S?.memoryEnabled===!1){E.current?.cancel();try{a?.removeItem(Wa(c,l.current))}catch{}no(a,c,[]),B([]),H(null),te([]),T(e=>D.current?(D.current=!1,S?[{id:Na(),role:`assistant`,content:S.greeting,availableActions:S.availableActions,actions:S.actions}]:[]):e)}},[S,a,c]);let he=t(async()=>{me(await e.bootstrap())},[me,e]);r(()=>{let t=!0,n=e=>e.messages.map(e=>Oa({id:e.id,role:e.role,content:e.content,authorName:e.authorName,liveEventType:e.messageType,offerReconnect:e.messageType===`ai_handback`&&e.reconnectOffered===!0,sources:e.sources,visualization:e.visualization,artifacts:e.artifacts,createdAt:e.createdAt}));return e.history().then(e=>{if(!t||e.conversations.length===0)return;let r=e.conversations.map(e=>({sessionId:e.sessionId,ts:Date.parse(e.lastSeenAt)||Date.now(),title:e.title,ended:e.ended}));for(let t of e.conversations)eo(a,c,t.sessionId,n(t),t.ended,!0,ce,le);no(a,c,r),B(r);let i=e.conversations.find(t=>t.sessionId===e.activeSessionId);if(!i||O.current)return;let o=n(i);l.current=i.sessionId,D.current=o.length>0;try{a?.setItem(Ha(c),i.sessionId)}catch{}let s=o[o.length-1]?.createdAt;s&&(Y.current=s),L(i.ended),T(o)}).catch(()=>{}),()=>{t=!1}},[ce,le,c,a,e]),r(()=>{let t=!0;return pe.current=Date.now(),e.bootstrap().then(e=>{t&&me(e)}),n.user&&fe(n.user),()=>{t=!1}},[me,e]),r(()=>{let e=n.configRefreshSeconds;if(!i||e<=0||typeof window>`u`)return;let t=!0,r=!1,a=Math.max(10,e)*1e3,o=()=>typeof document>`u`||document.visibilityState!==`hidden`,s=async()=>{if(!(!t||r||!o())){r=!0;try{await he()}catch{}finally{r=!1}}};Date.now()-pe.current>=a&&s();let c=window.setInterval(s,a),l=()=>void s(),u=()=>void s();return window.addEventListener(`focus`,l),document?.addEventListener?.(`visibilitychange`,u),()=>{t=!1,window.clearInterval(c),window.removeEventListener(`focus`,l),document?.removeEventListener?.(`visibilitychange`,u)}},[i,n.configRefreshSeconds,he]),r(()=>{let e=l.current;E.current.schedule(()=>eo(a,c,e,w,I,se,ce,le))},[w,I,a,c,se,ce,le]),r(()=>{let e=E.current,t=()=>{document.visibilityState===`hidden`&&e.flush()};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`pagehide`,e.flush),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`pagehide`,e.flush),e.flush()}},[]),r(()=>{ja(a,`centrinfo:chat:`)},[a]),r(()=>{if(!i||I||V)return;let t=()=>{document.visibilityState===`visible`&&e.presence(l.current)};t();let n=window.setInterval(t,1e4);return document.addEventListener(`visibilitychange`,t),()=>{window.clearInterval(n),document.removeEventListener(`visibilitychange`,t)}},[i,I,e,V]),r(()=>{if(!i||I||V)return;let t=!0,r=!1,a=0,o,s=()=>{o!==void 0&&window.clearTimeout(o),!(!t||document.hidden)&&(o=window.setTimeout(()=>{c()},Math.min(3e4,2200*2**a)))},c=async()=>{if(!(r||document.hidden||!t)){r=!0;try{let r=await e.liveEvents(l.current,Y.current);if(!t)return;if(a=0,G(r.mode),q(r.assignedAgentName||void 0),ne(r.agentTyping?r.agentTypingName||r.assignedAgentName||`Agent`:void 0),r.conversationEnded){L(!0),G(`ai`),q(void 0),ne(void 0),T(e=>e.some(e=>e.id===`live:conversation-ended`)?e:[...e,{id:`live:conversation-ended`,role:`system`,content:n.strings.conversationEnded,liveEventType:`conversation_ended`,createdAt:new Date().toISOString()}]);return}if(r.events.length>0){let e=Y.current,t=Date.parse(e),n=r.events.map(n=>{let r=Date.parse(n.createdAt);return Number.isFinite(r)&&r>t&&(t=r,e=n.createdAt),ao(n)});Y.current=e,T(e=>{let t=new Set(e.map(e=>e.id)),r=n.filter(e=>!t.has(e.id));return r.length>0?[...e,...r]:e}),n.some(e=>e.role===`assistant`)&&ua(`receive`)}}catch{a=Math.min(a+1,4)}finally{r=!1,s()}}},u=()=>{document.hidden?o!==void 0&&window.clearTimeout(o):c()};return document.addEventListener(`visibilitychange`,u),document.hidden||c(),()=>{t=!1,o!==void 0&&window.clearTimeout(o),document.removeEventListener(`visibilitychange`,u)}},[i,n.strings.conversationEnded,e,I,V]),r(()=>{if(!se){no(a,c,[]),B(e=>e.length>0?[]:e);return}w.some(e=>e.role===`user`)&&B(e=>{let t=l.current,n=[{sessionId:t,ts:Date.now(),title:io(w),ended:I},...e.filter(e=>e.sessionId!==t)];return no(a,c,n),n.slice(0,20)})},[w,I,a,c,se]);let X=t((e,t)=>{T(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),ge=t(()=>{v.current!==void 0&&typeof window<`u`&&window.clearInterval(v.current),v.current=void 0},[]),_e=t((e,t)=>{ge(),delete b.current[e],y.current===e&&(y.current=null),X(e,{content:t,pending:!1,streaming:!1})},[ge,X]),ve=t((e,t,n)=>{let r=t.trim();if(!r||typeof window>`u`){_e(e,r);return}ge(),y.current=e;let i=r.match(/\S+\s*/g)??[r],a=n&&n>0?n:i.length*95,o=Math.max(28,Math.min(150,a/Math.max(i.length,1))),s=0;X(e,{content:``,pending:!1,streaming:!0}),v.current=window.setInterval(()=>{s+=1,X(e,{content:i.slice(0,s).join(``),pending:!1,streaming:s<i.length}),s>=i.length&&(ge(),delete b.current[e],y.current===e&&(y.current=null),X(e,{content:r,pending:!1,streaming:!1}))},o)},[ge,_e,X]),ye=t(()=>{let e=y.current;ge(),y.current=null;let t=b.current;b.current={};for(let[e,n]of Object.entries(t))X(e,{content:n,pending:!1,streaming:!1});e&&!(e in t)&&X(e,{pending:!1,streaming:!1})},[ge,X]),be=t(t=>{if(I||V||W===`ai`||typeof window>`u`)return;if(re.current!==void 0&&window.clearTimeout(re.current),!t){if(!ie.current)return;ie.current=!1,ae.current=0,e.typing(l.current,!1).catch(()=>{});return}let n=Date.now();(!ie.current||n-ae.current>2500)&&(ie.current=!0,ae.current=n,e.typing(l.current,!0).catch(()=>{})),re.current=window.setTimeout(()=>{ie.current&&(ie.current=!1,ae.current=0,e.typing(l.current,!1).catch(()=>{}))},1600)},[e,I,V,W]);r(()=>()=>{re.current!==void 0&&typeof window<`u`&&window.clearTimeout(re.current)},[]),r(()=>()=>ge(),[ge]);let xe=t((t,r,a={})=>{ye(),A(!0);let o=ya(),s=!1,c=new AbortController;u.current=c;let f=!!(S?.allowVoiceInput&&S?.voiceOutputEnabled&&S.talkbackMode!==`text`),g=!!a.forceVoicePlayback,v=e=>{g&&P(t=>t.agentId===r?{status:e,agentId:r}:t)};g&&P({status:`answering`,agentId:r});let y={pending:new Map,nextSeq:0,highestSeq:-1,playing:!1,ended:!1,started:!1,stopped:!1,utterance:null},C=()=>{h.current===N&&(h.current=null),y.started&&(y.started=!1,M(!1),v(`done`))},w=()=>{y.stopped||y.started||(y.started=!0,ba(`voice-first-audio`,o),M(!0),v(`speaking`))},E=()=>typeof window<`u`&&`speechSynthesis`in window&&typeof SpeechSynthesisUtterance<`u`,D=()=>{p.current&&y.playing&&(p.current.pause(),p.current=null),y.utterance&&(m.current===y.utterance&&(m.current=null),y.utterance=null,E()&&window.speechSynthesis.cancel()),y.playing=!1},O=(e,t)=>{let n=e?.trim();if(!n||!E())return!1;let r=new SpeechSynthesisUtterance(n);return r.rate=S?.voiceSpeed??1,r.lang=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||`en-US`,r.onstart=w,r.onend=t,r.onerror=t,y.utterance=r,m.current=r,window.speechSynthesis.speak(r),_.current&&window.speechSynthesis.pause(),!0},k=()=>{for(;!y.stopped&&!y.playing;){let e=y.pending.get(y.nextSeq);if(!e&&y.ended&&y.pending.size>0&&(y.nextSeq=Math.min(...y.pending.keys()),e=y.pending.get(y.nextSeq)),!e){y.ended&&C();return}if(y.pending.delete(y.nextSeq),y.nextSeq+=1,j(e))return}},j=e=>{let t=!1,n=()=>{t||(t=!0,m.current===y.utterance&&(m.current=null),y.utterance=null,y.playing=!1,k())};if(!e.audioBase64||typeof Audio>`u`)return y.playing=O(e.text,n),y.playing;let r=new Audio(`data:${e.mimeType||`audio/mpeg`};base64,${e.audioBase64}`);r.playbackRate=S?.voiceSpeed??1,r.volume=_.current?.2:1,y.playing=!0,p.current=r;let i=!1,a=!1,o=()=>{t||a||(a=!0,p.current===r&&(p.current=null),!(!i&&!y.stopped&&O(e.text,n))&&n())};return r.onended=()=>{p.current===r&&(p.current=null),n()},r.onerror=o,r.play().then(()=>{i=!0,w()}).catch(o),!0},N=()=>{y.stopped=!0,y.pending.clear(),D(),C()};e.stream(t,l.current,{voicePlaybackRequested:!!a.forceVoicePlayback,clientMessageId:a.clientMessageId,attachmentId:a.attachmentId,attachmentIds:a.attachmentIds,signal:c.signal,onChunk:e=>{e&&!s&&(s=!0,ba(`data-first-chunk`,o)),a.forceVoicePlayback&&e&&(x.current[r]=!0),T(t=>t.map(t=>t.id===r?{...t,content:t.content+e,pending:!1,streaming:!0}:t))},onTextReady:()=>{T(e=>e.map(e=>e.id===r?{...e,pending:!1,streaming:!1}:e))},onReset:()=>{T(e=>e.map(e=>e.id===r?{...e,content:``,pending:!0,streaming:!1}:e)),y.pending.clear(),y.nextSeq=y.highestSeq+1,D()},onAudioSegment:e=>{!g||y.stopped||e.seq<y.nextSeq||y.pending.has(e.seq)||(h.current=N,y.highestSeq=Math.max(y.highestSeq,e.seq),y.pending.set(e.seq,e),k())}}).then(t=>{if(i&&!t.conversationEnded&&typeof document<`u`&&document.visibilityState===`visible`&&e.presence(l.current),t.liveMode&&(G(t.liveMode),q(t.assignedAgentName||void 0)),t.liveMode&&t.liveMode!==`ai`&&!t.answer.trim()){T(e=>e.filter(e=>e.id!==r)),v(`done`);return}let o=!!x.current[r];delete x.current[r];let s=!!(a.forceVoicePlayback&&f&&!t.liveAudio&&t.audioBase64&&t.answer.trim()&&!o);if(s&&(b.current[r]=t.answer),T(e=>e.map(e=>e.id===r?{...e,content:s?``:t.answer||e.content||n.strings.emptyReply,pending:!1,streaming:s,error:!1,retryText:void 0,sources:t.sources,suggestedReplies:t.suggestedReplies,availableActions:t.availableActions,actions:t.actions,selectedAction:t.selectedAction,handoffOffered:t.handoffOffered,requestedContactFields:t.requestedContactFields,visualization:t.visualization,artifacts:t.artifacts}:e)),ua(`receive`),t.liveAudio?(y.ended=!0,k()):a.forceVoicePlayback&&!t.audioBase64&&Pa(f?`Talkback expected backend TTS audio, but the chat response did not include audioBase64.`:`Talkback voice was requested, but the loaded widget token config does not enable provider TTS.`,{voiceOutputEnabled:S?.voiceOutputEnabled,talkbackMode:S?.talkbackMode,voiceProvider:S?.voiceProvider,hasAudioBase64:!!t.audioBase64}),a.forceVoicePlayback&&!t.liveAudio){let e=Fa(p,m,t.audioBase64,t.mimeType,S?.voiceSpeed??1,wa(t.answer,t.visualization),!0,e=>{M(!0),v(`speaking`),s&&ve(r,t.answer,e)},()=>{M(!1),v(`done`),s&&_e(r,t.answer)});e||v(`done`),s&&!e&&_e(r,t.answer)}t.answer&&n.onMessage?.({role:`assistant`,content:t.answer}),t.handoffOffered&&n.onHandoff?.(),t.conversationEnded&&L(!0)}).catch(e=>{if(c.signal.aborted){y.stopped||N(),delete x.current[r],T(e=>e.flatMap(e=>e.id===r?e.content.trim()?[{...e,pending:!1,streaming:!1}]:[]:[e])),v(`done`);return}v(`failed`),delete x.current[r],X(r,{content:va(e,n.strings),pending:!1,streaming:!1,error:!0,retryText:t})}).finally(()=>{ba(`data-complete`,o),delete x.current[r],u.current===c&&(A(!1),u.current=null,d.current?.agentId===r&&(d.current=null))})},[e,i,n,X,S?.allowVoiceInput,S?.talkbackMode,S?.voiceOutputEnabled,S?.voiceSpeed,ye]),Se=t((e,t={})=>{let r=e.trim(),{imageUrl:i,attachmentName:a,attachmentText:o,attachmentId:s,attachmentFile:c,forceVoicePlayback:l,userMessageId:f}=t,p=t.attachments??(a||s||o?[{id:s,name:a??``,text:o,file:c}]:[]);if(!r&&!i&&p.length===0||u.current&&!u.current.signal.aborted||I)return;O.current=!0;let m=r;!m&&p.length>0&&(m=`Please look at the attached file.`),!m&&i&&(m=i);let h=p.map(e=>({id:e.id,name:e.name})),_=p.flatMap(e=>e.id?[e.id]:[]),v={id:f||Na(),role:`user`,content:r,imageUrl:i,attachments:h.length>0?h:void 0};p.forEach((e,t)=>{e.file&&(g.current.set(`${v.id}:${t}`,e.file),e.id&&g.current.set(e.id,e.file))});let y=Na();T(e=>[...f&&e.some(e=>e.id===f)?e.map(e=>e.id===f?{...e,content:r,pending:!1,streaming:!1,imageUrl:i,attachments:v.attachments}:e):[...e,v],{id:y,role:`assistant`,content:``,pending:!0}]),ua(`send`),n.onMessage?.({role:`user`,content:m}),F.current[y]=v.id,d.current={userId:v.id,agentId:y,text:r,backendText:m},xe(m,y,{forceVoicePlayback:l,clientMessageId:v.id,attachmentId:_[0],attachmentIds:_})},[I,n,xe]),Ce=t((e,t,r,i,a)=>{let o=Na();T(n=>[...n.filter(t=>t.id!==e.agentId&&(!i.userMessageId||t.id!==i.userMessageId)).map(n=>n.id===e.userId?{...n,content:t,pending:!1,streaming:!1}:n),{id:o,role:`assistant`,content:``,pending:!0}]),a&&n.onMessage?.({role:`user`,content:a}),F.current[o]=e.userId,d.current={userId:e.userId,agentId:o,text:t,backendText:r},xe(r,o,{forceVoicePlayback:i.forceVoicePlayback,clientMessageId:Na()})},[n,xe]),Z=t((e,t={})=>{let n=e.trim();if(!n||I)return;let r=u.current&&!u.current.signal.aborted?d.current:null,i=r??f.current;if(f.current=null,!i){Se(n,t);return}r&&u.current?.abort(),Ce(i,`${i.text} ${n}`.replace(/\s+/g,` `).trim(),`${i.backendText}\n${n}`.trim(),t,n)},[I,Ce,Se]),we=t(()=>{let e=u.current&&!u.current.signal.aborted?d.current:null;return e?(f.current=e,u.current?.abort(),!0):!1},[]),Te=t(()=>{let e=f.current;f.current=null,!(!e||I)&&Ce(e,e.text,e.backendText,{forceVoicePlayback:!0})},[I,Ce]),Ee=t(()=>u.current?.abort(),[]),De=t(e=>{_.current=e;let t=p.current;t&&(t.volume=e?.2:1),m.current&&typeof window<`u`&&`speechSynthesis`in window&&(e?window.speechSynthesis.pause():window.speechSynthesis.resume())},[]),Oe=t(()=>{h.current?.(),h.current=null,_.current=!1,ye(),P(e=>e.status===`speaking`||e.status===`answering`?{...e,status:`done`}:e),p.current?.pause(),p.current=null,typeof window<`u`&&`speechSynthesis`in window&&window.speechSynthesis.cancel(),m.current=null,M(!1)},[ye]),ke=t(t=>{let n=Ca(t);if(!n)return Promise.resolve(!1);ye();let r=!!(S?.allowVoiceInput&&S?.voiceOutputEnabled&&S.talkbackMode!==`text`),i=(e,t)=>new Promise(r=>{let i=!1;Fa(p,m,e,t,S?.voiceSpeed??1,n,!0,()=>{i=!0,M(!0)},()=>{M(!1),r(i)})||(M(!1),r(!1))});return r?e.speak(n).then(e=>e.audioBase64?i(e.audioBase64,e.mimeType):(Pa(`Talkback prompt TTS did not return provider audio.`,{providerReady:e.providerReady,message:e.message,voiceProvider:S?.voiceProvider,voiceOutputEnabled:S?.voiceOutputEnabled,talkbackMode:S?.talkbackMode}),i())).catch(e=>(Pa(`Talkback prompt TTS request failed before audio playback.`,{error:e instanceof Error?e.message:String(e),voiceProvider:S?.voiceProvider,voiceOutputEnabled:S?.voiceOutputEnabled,talkbackMode:S?.talkbackMode}),i())):(Pa(`Talkback prompt wanted voice, but the loaded widget token config has provider TTS disabled.`,{voiceOutputEnabled:S?.voiceOutputEnabled,talkbackMode:S?.talkbackMode,voiceProvider:S?.voiceProvider}),i())},[S?.allowVoiceInput,S?.talkbackMode,S?.voiceOutputEnabled,S?.voiceSpeed,ye,e]),Ae=t((e,t,n={})=>{if(k||I||!t)return;X(e,{content:``,pending:!0,streaming:!1,error:!1}),ua(`send`);let r=w.findIndex(t=>t.id===e),i=r>0?w[r-1]:void 0;xe(t,e,{...n,clientMessageId:F.current[e]??(i?.role===`user`?i.id:void 0)})},[k,I,w,X,xe]),je=t((t,n,r)=>{X(t,{feedback:n});let i=w.findIndex(e=>e.id===t),a=i>=0?w[i]?.content:void 0,o;for(let e=i-1;e>=0;e--)if(w[e]?.role===`user`){o=w[e]?.content;break}e.sendFeedback({sessionId:l.current,messageId:t,rating:n,comment:r,question:o,answer:a}).catch(()=>{})},[e,X,w]),Me=t(e=>{let t=e.content.trim();if(!t)return;let n=e.id.trim()||Na();T(e=>e.some(e=>e.id===n)?e:[...e,{id:n,role:`assistant`,content:t,createdAt:new Date().toISOString()}])},[]),Ne=t(async(t,r,i={},a)=>{n.onAction?.(t);let o=t===`public_contact_support`||t===`public_submit_inquiry`?{actionId:t}:{},s=await e.action(t,{sessionId:l.current,...r,...o},a),c={};return i.name?.trim()&&(c.name=i.name.trim()),i.email?.trim()&&(c.email=i.email.trim()),i.phone?.trim()&&(c.phone=i.phone.trim()),Object.keys(c).length>0&&(ee(e=>{let t={...e,...c};return de(t),t}),c.email&&t!==`contact`&&e.action(`contact`,{sessionId:l.current,...c}).catch(()=>{})),Me({id:s.receipt?.id||Na(),content:s.receipt?.content||s.note||(s.caseReference?`Action completed.\nReference: ${s.caseReference}`:`Action completed.`)}),ua(`receive`),s},[e,n,de,Me]),Pe=t(async(t,n,r)=>{let i=await e.confirmHostedBooking?.({sessionId:l.current,inquiryId:t,eventUri:n,inviteeUri:r});return i?.receipt&&Me(i.receipt),i},[e,Me]),Fe=t(e=>{let t=e.trim();t&&T(e=>e.some(e=>e.role===`assistant`&&e.content===t)?e:[...e,{id:Na(),role:`assistant`,content:t}])},[]),Ie=t(()=>{let e=oo(S?.actions);return e?(T(t=>[...t,{id:Na(),role:`assistant`,content:n.strings.reconnectPrompt,actions:[e],selectedAction:e.id,handoffOffered:!0,reconnectOffer:!0,createdAt:new Date().toISOString()}]),!0):!1},[n.strings.reconnectPrompt,S?.actions]),Le=t(e=>{O.current=!0;let t=Na();return T(n=>[...n,{id:t,role:`user`,content:e.trim(),pending:!0}]),t},[]),Re=t((e,t)=>{T(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),ze=t(e=>{T(t=>t.filter(t=>t.id!==e))},[]),Be=t(async(t,n=`widget`)=>{if(!e.sendExplanationFeedback)throw Error(`Explanation feedback is unavailable.`);await e.sendExplanationFeedback({...t,sessionId:l.current,surface:n})},[e]),Ve=t((t=`widget`)=>{let n=e.fetchExplanation?.bind(e);if(!n)return;let r=e.retryExplanation?.bind(e),i=e=>e;return{poll:async(e,r)=>i(await n(e,l.current,t,r)),settled:(e,t)=>{t!==`not_requested`&&T(n=>n.map(n=>{let r=n.visualization?.explanation?.aiExplanation;return!r||(r.explanationId??n.visualization?.explanation?.explanationId)!==e||r.status===t?n:{...n,visualization:{...n.visualization,explanation:{...n.visualization.explanation,aiExplanation:{...r,status:t}}}}}))},...r?{retry:async e=>i(await r(e,l.current,t))}:{}}},[e]),He=t((t,n)=>{e.sendFeedback({sessionId:l.current,messageId:`__csat__`,rating:t,comment:n}).catch(()=>{})},[e]),Ue=t(async(t,n,r,i)=>{let a=ya();try{if(typeof t!=`string`&&e.transcribeAudio)return await e.transcribeAudio(t,n,r,i);let a=typeof t==`string`?t:await ha(t);return await e.transcribe(a,n,r,i)}finally{ba(`voice-transcription`,a)}},[e]),We=t(async(t,n,r=0)=>{let i=g.current.get(`${t.id}:${r}`)??(n.id?g.current.get(n.id):void 0);if(i)return i;if(!n.id||!e.fetchAttachment)throw Error(`This file is no longer available.`);return e.fetchAttachment(n.id,l.current)},[e]),Ge=t((t,n,r,i)=>e.uploadAttachment?e.uploadAttachment(t,n,r,l.current,i):Promise.reject(Error(`File upload is unavailable`)),[e]),Ke=t(t=>e.searchGifs(t),[e]),qe=t((t,n)=>e.demoSlots(t,n),[e]),Je=t(e=>Se(``,{imageUrl:e}),[Se]),Ye=n.demo||!!n.gifApiKey,Xe=t(()=>{u.current?.abort(),L(!0),e.endConversation(l.current).catch(()=>{})},[e]),Ze=t(()=>{u.current?.abort();let e=Ba(n);l.current=e;try{a?.setItem(Ha(c),e)}catch{}H(null),te([]),L(!1),G(`ai`),q(void 0),ne(void 0),Y.current=new Date().toISOString(),T(S?[{id:Na(),role:`assistant`,content:S.greeting,availableActions:S.availableActions,actions:S.actions}]:[])},[a,c,S]),Qe=t(e=>{if(se){if(e===l.current){H(null);return}te(Xa(a,c,e)),H(e)}},[a,c,se]),$e=t(()=>{H(null),te([])},[]);return{persona:S,messages:w,sending:k,assistantSpeaking:j,voiceReply:N,visitor:R,starters:n.starters.length>0?n.starters:S?.starterQuestions??[],featuredLinks:S?.featuredLinks??[],hasEmail:!!R.email,liveMode:W,assignedAgentName:K,agentTypingName:J,send:Se,amend:Z,hold:we,resumeHeld:Te,duckSpeaking:De,sendGif:Je,notifyTyping:be,stop:Ee,retry:Ae,rateMessage:je,rateExplanation:Be,explanationTransport:Ve,injectAssistant:Fe,reconnectSupport:Ie,appendUserDraft:Le,patchMessage:Re,removeMessage:ze,submitCsat:He,submitForm:Ne,confirmHostedBooking:Pe,transcribe:Ue,uploadAttachment:Ge,loadAttachment:We,searchGifs:Ke,demoSlots:qe,gifEnabled:Ye,identify:fe,ended:I,endConversation:Xe,startNew:Ze,history:se?z:[],viewingSessionId:V,viewMessages:U,openConversation:Qe,closeHistoryView:$e,shutdown:ue,stopSpeaking:Oe,speakAssistantText:ke}},lo=()=>typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||`en`,uo=(e,t)=>{if(!e)return;let n=t.trim().toLowerCase(),r=n.split(`-`)[0]??n,i=Object.entries(e);return i.find(([e])=>e.toLowerCase()===n)?.[1]??i.find(([e])=>e.toLowerCase()===r)?.[1]},fo=e=>{if(!e||typeof e.token!=`string`||e.token.length===0)throw Error("[centrinfo-widget] `token` is required — pass your pub_* token to Centrinfo.init({ token }).");let t=e.locale?.trim()||lo(),n=uo(e.translations,t);return{token:e.token,chatSurface:e.chatSurface??`floating`,analyticsContextToken:e.analyticsContextToken,identityToken:e.identityToken,getIdentityToken:e.getIdentityToken,apiBaseUrl:(e.apiBaseUrl??`https://api.accurixtech.com`).replace(/\/$/,``),accentColor:e.accentColor,themeTokens:e.themeTokens,agentName:e.agentName?.trim()||void 0,agentAvatarUrl:e.agentAvatarUrl?.trim()||void 0,launcherIcon:e.launcherIcon,gifApiKey:e.gifApiKey,theme:e.theme??`auto`,openByDefault:e.openByDefault??!1,sound:e.sound??!0,starters:e.starters??[],strings:tr({...n?.labels,...e.labels,...n?.labels?.analytics||e.labels?.analytics?{analytics:{...n?.labels?.analytics,...e.labels?.analytics,explanation:{...n?.labels?.analytics?.explanation,...e.labels?.analytics?.explanation}}}:{}}),locale:t,dir:cr(t,e.dir),actionTranslations:n?.actions??{},persistence:e.persistence??`local`,attachments:e.attachments??!0,zIndex:e.zIndex??2147483e3,styleNonce:e.styleNonce?.trim()??``,demo:e.demo??!1,preview:e.preview??!1,alignment:e.alignment===`left`?`left`:`right`,horizontalPadding:typeof e.horizontalPadding==`number`?e.horizontalPadding:20,verticalPadding:typeof e.verticalPadding==`number`?e.verticalPadding:20,hideDefaultLauncher:e.hideDefaultLauncher??!1,customLauncherSelector:e.customLauncherSelector,sessionDurationMinutes:typeof e.sessionDurationMinutes==`number`?e.sessionDurationMinutes:0,configRefreshSeconds:typeof e.configRefreshSeconds==`number`?e.configRefreshSeconds:30,proactiveMessage:e.proactiveMessage,proactiveDelaySeconds:typeof e.proactiveDelaySeconds==`number`?e.proactiveDelaySeconds:5,proactiveOnPaths:e.proactiveOnPaths,csat:e.csat??!0,user:e.user,onOpen:e.onOpen,onClose:e.onClose,onShow:e.onShow,onHide:e.onHide,onUnreadChange:e.onUnreadChange,onMessage:e.onMessage,onOpenAnalyticsSource:e.onOpenAnalyticsSource,onAction:e.onAction,onHandoff:e.onHandoff}},po=`
171
- :host {
172
- all: initial;
173
- }
174
- .cf-root {
175
- --cf-accent: #2f7f55;
176
- --cf-accent-2: #2f7de8;
177
- --cf-accent-ink: #ffffff;
178
- --cf-bg: #ffffff;
179
- --cf-surface: #f4f6f8;
180
- --cf-surface-2: #eef1f4;
181
- --cf-text: #0f1e2a;
182
- --cf-muted: #5b7186;
183
- --cf-border: #e4e9ee;
184
- --cf-danger: #b42318;
185
- --cf-success: #15803d;
186
- --cf-warning: #b45309;
187
- --cf-shadow: 0 12px 48px -12px rgba(15, 30, 42, 0.4), 0 4px 12px -4px rgba(15, 30, 42, 0.2);
188
- --cf-radius: 18px;
189
- --cf-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
190
-
191
- position: fixed;
192
- bottom: 0;
193
- right: 0;
194
- font-family: var(--cf-font);
195
- font-size: 14px;
196
- line-height: 1.45;
197
- color: var(--cf-text);
198
- -webkit-font-smoothing: antialiased;
199
- }
200
- .cf-root[data-theme='dark'] {
201
- --cf-accent-ink: #ffffff;
202
- --cf-bg: #0f1c27;
203
- --cf-surface: #1a2a37;
204
- --cf-surface-2: #213442;
205
- --cf-text: #eef3f7;
206
- --cf-muted: #93a7b6;
207
- --cf-border: #2a3d4c;
208
- --cf-success: #4ade80;
209
- --cf-warning: #fbbf24;
210
- --cf-danger: #f87171;
211
- --cf-shadow: 0 12px 48px -12px rgba(0, 0, 0, 0.6), 0 4px 12px -4px rgba(0, 0, 0, 0.4);
212
- }
213
- .cf-root *,
214
- .cf-root *::before,
215
- .cf-root *::after {
216
- box-sizing: border-box;
217
- }
218
- /* :where() keeps this reset at ZERO added specificity, so component button
219
- styles (.cf-launcher, .cf-send, .cf-chip, .cf-action) win over it. Without
220
- it, ".cf-root button" (class+element) out-specifies ".cf-launcher" (class)
221
- and silently wipes every button background — the launcher rendered white. */
222
- .cf-root :where(button) {
223
- font-family: inherit;
224
- cursor: pointer;
225
- border: none;
226
- background: none;
227
- padding: 0;
228
- color: inherit;
229
- }
230
-
231
- /* ---------- Launcher ---------- */
232
- .cf-launcher {
233
- position: fixed;
234
- bottom: var(--cf-v-pad, 20px);
235
- right: var(--cf-h-pad, 20px);
236
- z-index: 1;
237
- /* The host element is pointer-events: none so it can't swallow
238
- clicks on host-page UI behind it (see mount.tsx). Re-enable here
239
- on the only two visible surfaces (launcher + panel) so they DO
240
- receive clicks where they're actually drawn. */
241
- pointer-events: auto;
242
- width: 60px;
243
- height: 60px;
244
- border-radius: 50%;
245
- background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 140%);
246
- color: var(--cf-accent-ink);
247
- display: grid;
248
- place-items: center;
249
- box-shadow: 0 8px 24px -6px rgba(15, 30, 42, 0.45);
250
- transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
251
- animation: cf-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
252
- }
253
- .cf-launcher:hover {
254
- transform: scale(1.06);
255
- box-shadow: 0 12px 28px -6px rgba(15, 30, 42, 0.5);
256
- }
257
- .cf-launcher:active {
258
- transform: scale(0.95);
259
- }
260
- .cf-launcher:focus-visible {
261
- outline: 3px solid var(--cf-accent-2);
262
- outline-offset: 3px;
263
- }
264
- .cf-launcher svg {
265
- width: 30px;
266
- height: 30px;
267
- transition: transform 0.25s ease, opacity 0.2s ease;
268
- }
269
- /* Custom org logo in the launcher (config.launcherIcon). */
270
- .cf-launcher__img {
271
- width: 34px;
272
- height: 34px;
273
- border-radius: 50%;
274
- object-fit: cover;
275
- }
276
- .cf-launcher__badge {
277
- position: absolute;
278
- top: -2px;
279
- right: -2px;
280
- min-width: 20px;
281
- height: 20px;
282
- padding: 0 5px;
283
- border-radius: 10px;
284
- background: #f25767;
285
- color: #fff;
286
- font-size: 11px;
287
- font-weight: 700;
288
- display: grid;
289
- place-items: center;
290
- box-shadow: 0 0 0 2px var(--cf-bg);
291
- animation: cf-badge-pop 0.3s ease both;
292
- }
293
-
294
- /* ---------- Panel ---------- */
295
- .cf-panel {
296
- position: fixed;
297
- /* Pair to .cf-launcher's pointer-events: auto — the host element
298
- itself is pointer-events: none, so each visible surface re-enables. */
299
- pointer-events: auto;
300
- bottom: var(--cf-v-pad, 20px);
301
- right: var(--cf-h-pad, 20px);
302
- /* Above the launcher so the open chat covers it (no second button showing). */
303
- z-index: 2;
304
- width: 384px;
305
- max-width: calc(100vw - 32px);
306
- height: min(88vh, 820px);
307
- min-height: 560px;
308
- max-height: calc(100vh - 40px);
309
- background: var(--cf-bg);
310
- border-radius: var(--cf-radius);
311
- box-shadow: var(--cf-shadow);
312
- /* Grid (not flex) so theater mode below can reflow header/video/chat into a
313
- two-column split purely in CSS, without reordering the DOM. */
314
- display: grid;
315
- grid-template-columns: minmax(0, 1fr);
316
- grid-template-rows: auto auto minmax(0, 1fr);
317
- grid-template-areas: 'header' 'video' 'chat';
318
- overflow: hidden;
319
- transform-origin: bottom right;
320
- opacity: 0;
321
- transform: scale(0.94);
322
- pointer-events: none;
323
- transition: opacity 0.22s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
324
- height 0.28s ease, width 0.28s ease;
325
- }
326
- .cf-panel.is-open {
327
- opacity: 1;
328
- transform: scale(1);
329
- pointer-events: auto;
330
- }
331
-
332
- .cf-panel > .cf-header { grid-area: header; }
333
- /* Stacked ABOVE .cf-panel__chat (which sits right below it in the docked
334
- layout) so the call bar's popover — which opens downward and overlaps
335
- that space — paints over the transcript instead of getting interleaved
336
- with message bubbles underneath it. */
337
- .cf-panel__video {
338
- grid-area: video;
339
- position: relative;
340
- z-index: 5;
341
- min-width: 0;
342
- }
343
- .cf-panel__chat {
344
- grid-area: chat;
345
- display: flex;
346
- flex-direction: column;
347
- min-height: 0;
348
- min-width: 0;
349
- }
350
- /* A live voice call gets more room for the transcript underneath the avatar card. */
351
- .cf-panel.cf-panel--call {
352
- height: min(90vh, 840px);
353
- }
354
- .cf-panel.cf-panel--voice-connecting {
355
- height: min(72vh, 560px);
356
- min-height: 420px;
357
- grid-template-rows: auto minmax(0, 1fr);
358
- grid-template-areas: 'header' 'video';
359
- }
360
- .cf-panel--voice-connecting .cf-panel__video {
361
- display: grid;
362
- min-height: 0;
363
- }
364
- /* Expanded "theater" view — video and chat side by side in a large centered
365
- modal instead of the corner bubble. Only reachable from an active call's
366
- expand button, so it never applies below the existing mobile breakpoint. */
367
- @media (min-width: 640px) {
368
- .cf-panel.cf-panel--theater {
369
- inset: 0;
370
- margin: auto;
371
- width: min(1040px, calc(100vw - 48px));
372
- height: min(760px, calc(100vh - 48px));
373
- max-width: none;
374
- max-height: none;
375
- grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
376
- grid-template-rows: auto minmax(0, 1fr);
377
- grid-template-areas: 'header header' 'video chat';
378
- }
379
- .cf-panel.cf-panel--theater.is-open {
380
- transform: none;
381
- }
382
- .cf-panel--theater .cf-panel__video { height: 100%; }
383
- .cf-panel--theater .cf-assistant-card--pinned {
384
- height: 100%;
385
- margin: 0;
386
- padding: 0;
387
- border: 0;
388
- border-right: 1px solid var(--cf-border);
389
- }
390
- .cf-panel--theater .cf-assistant-card--pinned .cf-assistant-card__stage {
391
- height: 100%;
392
- border-radius: 0;
393
- }
394
- .cf-panel--theater .cf-assistant-card__media--generated .cf-assistant-card__face {
395
- width: min(220px, 38vw);
396
- height: min(220px, 38vw);
397
- }
398
- .cf-panel--theater .cf-assistant-card__media--generated .cf-assistant-card__initials {
399
- font-size: clamp(42px, 7vw, 76px);
400
- transform: translateY(-14px);
401
- }
402
- .cf-panel--theater .cf-assistant-card__media--generated .cf-assistant-card__eye {
403
- top: 43%;
404
- width: 11px;
405
- height: 11px;
406
- }
407
- .cf-panel--theater .cf-assistant-card__media--generated .cf-assistant-card__eye--left { left: 34%; }
408
- .cf-panel--theater .cf-assistant-card__media--generated .cf-assistant-card__eye--right { right: 34%; }
409
- .cf-panel--theater .cf-assistant-card__media--generated .cf-assistant-card__mouth {
410
- bottom: 27%;
411
- width: 52px;
412
- height: 8px;
413
- }
414
- .cf-panel--theater .cf-avatar-wave {
415
- bottom: 92px;
416
- }
417
- /* The call bar sits near the BOTTOM of the full-height theater video pane
418
- (vs. near the top of the short docked card), so its popover flips to
419
- open upward here — there's room above it, none below. */
420
- .cf-panel--theater .cf-call-menu {
421
- top: auto;
422
- bottom: calc(100% + 8px);
423
- }
424
- }
425
- .cf-theater-backdrop {
426
- position: fixed;
427
- inset: 0;
428
- z-index: 1;
429
- background: rgba(10, 14, 20, 0.55);
430
- pointer-events: auto;
431
- }
432
-
433
- /* Left-aligned messenger (alignment: 'left') — dock to the left edge. */
434
- .cf-root[data-align='left'] .cf-launcher { right: auto; left: var(--cf-h-pad, 20px); }
435
- .cf-root[data-align='left'] .cf-panel { right: auto; left: var(--cf-h-pad, 20px); transform-origin: bottom left; }
436
-
437
- /* ---------- Header ---------- */
438
- .cf-header {
439
- position: relative;
440
- padding: 16px 14px 18px 18px;
441
- background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 150%);
442
- color: var(--cf-accent-ink);
443
- display: flex;
444
- align-items: center;
445
- gap: 10px;
446
- flex-shrink: 0;
447
- }
448
- .cf-header__avatar {
449
- width: 42px;
450
- height: 42px;
451
- border-radius: 50%;
452
- background: rgba(255, 255, 255, 0.18);
453
- display: grid;
454
- place-items: center;
455
- font-weight: 700;
456
- font-size: 17px;
457
- overflow: hidden;
458
- flex-shrink: 0;
459
- box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
460
- }
461
- .cf-header__avatar img {
462
- width: 100%;
463
- height: 100%;
464
- object-fit: cover;
465
- }
466
- .cf-header__avatar[class*='cf-avatar-preset--'],
467
- .cf-msg__avatar[class*='cf-avatar-preset--'] {
468
- background: linear-gradient(135deg, var(--cf-avatar-a, var(--cf-accent)), var(--cf-avatar-b, var(--cf-accent-2)));
469
- }
470
- .cf-header__meta {
471
- min-width: 0;
472
- flex: 1 1 auto;
473
- }
474
- .cf-header__name {
475
- font-weight: 700;
476
- font-size: 16px;
477
- letter-spacing: -0.2px;
478
- white-space: nowrap;
479
- overflow: hidden;
480
- text-overflow: ellipsis;
481
- }
482
- .cf-header__status {
483
- display: flex;
484
- align-items: center;
485
- gap: 6px;
486
- font-size: 12.5px;
487
- opacity: 0.9;
488
- margin-top: 1px;
489
- min-width: 0;
490
- }
491
- .cf-header__status::before {
492
- content: '';
493
- width: 7px;
494
- height: 7px;
495
- border-radius: 50%;
496
- background: #7ee2a8;
497
- box-shadow: 0 0 0 2px rgba(126, 226, 168, 0.3);
498
- flex-shrink: 0;
499
- }
500
- /* Keep the status on one line — the icons no longer squeeze it to wrap. */
501
- .cf-header__status-text {
502
- white-space: nowrap;
503
- overflow: hidden;
504
- text-overflow: ellipsis;
505
- }
506
- /* Action icons cluster tightly together, separated from the meta by the
507
- header gap, and never shrink (so the meta yields space first). */
508
- .cf-header__actions {
509
- display: flex;
510
- align-items: center;
511
- gap: 2px;
512
- flex-shrink: 0;
513
- }
514
- .cf-header__btn {
515
- width: 30px;
516
- height: 30px;
517
- border-radius: 8px;
518
- display: grid;
519
- place-items: center;
520
- color: var(--cf-accent-ink);
521
- opacity: 0.85;
522
- transition: background 0.15s ease, opacity 0.15s ease;
523
- flex-shrink: 0;
524
- }
525
- .cf-header__btn:hover {
526
- background: rgba(255, 255, 255, 0.16);
527
- opacity: 1;
528
- }
529
- .cf-header__btn svg {
530
- width: 17px;
531
- height: 17px;
532
- }
533
- .cf-header__btn:focus-visible {
534
- outline: 2px solid #fff;
535
- outline-offset: 1px;
536
- }
537
-
538
- /* Preview-mode banner (data-preview) — sample replies, no AI. */
539
- .cf-preview-banner {
540
- flex-shrink: 0;
541
- padding: 5px 12px;
542
- text-align: center;
543
- font-size: 11.5px;
544
- font-weight: 600;
545
- letter-spacing: 0.2px;
546
- color: #7a5b00;
547
- background: #fff3cd;
548
- border-bottom: 1px solid #ffe69c;
549
- }
550
- .cf-root[data-theme='dark'] .cf-preview-banner {
551
- color: #ffe08a;
552
- background: #3a3320;
553
- border-bottom-color: #4d4427;
554
- }
555
-
556
- /* ---------- Body / messages ---------- */
557
- .cf-body {
558
- flex: 1 1 0;
559
- min-height: 0;
560
- overflow-y: auto;
561
- /* Never scroll/shift horizontally — a long source pill or code line is
562
- clipped, not allowed to push the whole thread sideways. */
563
- overflow-x: hidden;
564
- padding: 12px 14px 8px;
565
- display: flex;
566
- flex-direction: column;
567
- gap: 12px;
568
- scroll-behavior: smooth;
569
- background: var(--cf-bg);
570
- }
571
- .cf-body::-webkit-scrollbar {
572
- width: 8px;
573
- }
574
- .cf-body::-webkit-scrollbar-thumb {
575
- background: var(--cf-border);
576
- border-radius: 4px;
577
- }
578
- .cf-empty-welcome {
579
- display: flex;
580
- flex-direction: column;
581
- gap: 5px;
582
- margin: 4px 0 2px;
583
- padding: 14px 14px 13px;
584
- border-radius: 18px;
585
- background:
586
- radial-gradient(circle at 14% 0%, color-mix(in oklab, var(--cf-accent) 20%, transparent), transparent 34%),
587
- linear-gradient(135deg, color-mix(in oklab, var(--cf-surface) 88%, var(--cf-bg)), var(--cf-bg));
588
- border: 1px solid color-mix(in oklab, var(--cf-border) 78%, var(--cf-accent));
589
- }
590
- .cf-empty-welcome__eyebrow {
591
- color: var(--cf-accent);
592
- font-size: 10px;
593
- font-weight: 800;
594
- letter-spacing: 0.11em;
595
- text-transform: uppercase;
596
- }
597
- .cf-empty-welcome h2 {
598
- margin: 0;
599
- color: var(--cf-text);
600
- font-size: 17px;
601
- line-height: 1.15;
602
- letter-spacing: -0.02em;
603
- }
604
- .cf-empty-welcome p {
605
- margin: 0;
606
- color: var(--cf-muted);
607
- font-size: 12.8px;
608
- line-height: 1.45;
609
- }
610
- .cf-msg {
611
- display: flex;
612
- gap: 8px;
613
- min-width: 0;
614
- max-width: 100%;
615
- animation: cf-msg-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
616
- }
617
- .cf-msg--user {
618
- justify-content: flex-end;
619
- }
620
- .cf-msg--system {
621
- justify-content: center;
622
- margin: 4px 0;
623
- }
624
- .cf-msg__avatar {
625
- width: 26px;
626
- height: 26px;
627
- border-radius: 50%;
628
- background: linear-gradient(135deg, var(--cf-accent, #2f7f55), var(--cf-accent-2, #2f7de8));
629
- color: #fff;
630
- display: grid;
631
- place-items: center;
632
- font-size: 11px;
633
- font-weight: 700;
634
- flex-shrink: 0;
635
- overflow: hidden;
636
- align-self: flex-end;
637
- }
638
- .cf-msg__avatar img { width: 100%; height: 100%; object-fit: cover; }
639
- .cf-msg__bubble {
640
- padding: 10px 13px;
641
- border-radius: 16px;
642
- max-width: 100%;
643
- /* break-word (not anywhere) only breaks words too long to fit — so short
644
- words like "Hello" never split mid-word. */
645
- overflow-wrap: break-word;
646
- white-space: pre-wrap;
647
- font-size: 13.5px;
648
- }
649
- .cf-msg--agent .cf-msg__bubble {
650
- background: var(--cf-surface);
651
- border-bottom-left-radius: 5px;
652
- color: var(--cf-text);
653
- }
654
- .cf-msg--user .cf-msg__bubble {
655
- background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
656
- color: var(--cf-accent-ink);
657
- border-bottom-right-radius: 5px;
658
- }
659
- .cf-msg__bubble a {
660
- color: inherit;
661
- text-decoration: underline;
662
- }
663
- .cf-msg__bubble strong { font-weight: 700; }
664
- .cf-msg__bubble p { margin: 0 0 8px; }
665
- .cf-msg__bubble p:last-child { margin-bottom: 0; }
666
- .cf-msg__col { min-width: 0; max-width: 85%; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
667
- .cf-msg__col--actions { flex: 1; max-width: 100%; }
668
- .cf-msg--user .cf-msg__col { align-items: flex-end; }
669
- .cf-artifact {
670
- width: min(100%, 560px);
671
- overflow: hidden;
672
- margin: 0;
673
- border: 1px solid var(--cf-border);
674
- border-radius: 12px;
675
- background: var(--cf-surface);
676
- }
677
- .cf-artifact figcaption { padding: 10px 12px 0; color: var(--cf-text); font-size: 12px; font-weight: 750; }
678
- .cf-artifact img, .cf-artifact video { display: block; width: 100%; height: auto; margin-top: 9px; }
679
- .cf-artifact p { margin: 0 !important; padding: 8px 12px 10px; color: var(--cf-muted); font-size: 10px; }
680
- .cf-artifact-link {
681
- display: grid;
682
- width: min(100%, 560px);
683
- gap: 3px;
684
- border: 1px solid var(--cf-border);
685
- border-radius: 10px;
686
- background: var(--cf-surface);
687
- padding: 10px 12px;
688
- color: var(--cf-text);
689
- text-decoration: none;
690
- }
691
- .cf-artifact-link:hover { border-color: var(--cf-accent); }
692
- .cf-artifact-link span { color: var(--cf-muted); font-size: 10px; }
693
- .cf-system-event {
694
- width: min(280px, 88%);
695
- display: flex;
696
- flex-direction: column;
697
- align-items: center;
698
- gap: 4px;
699
- text-align: center;
700
- color: var(--cf-muted);
701
- }
702
- .cf-system-event__mark {
703
- width: 7px;
704
- height: 7px;
705
- border-radius: 999px;
706
- background: color-mix(in srgb, var(--cf-accent, #2f7f55) 72%, transparent);
707
- box-shadow: 0 0 0 4px color-mix(in srgb, var(--cf-accent, #2f7f55) 12%, transparent);
708
- }
709
- .cf-system-event__text {
710
- max-width: 100%;
711
- padding: 7px 11px;
712
- border: 1px solid var(--cf-border);
713
- border-radius: 999px;
714
- background: color-mix(in srgb, var(--cf-surface, #ffffff) 86%, transparent);
715
- font-size: 12.5px;
716
- font-weight: 600;
717
- line-height: 1.35;
718
- color: var(--cf-muted);
719
- overflow-wrap: break-word;
720
- }
721
- .cf-system-event__action {
722
- padding: 6px 12px;
723
- border: 1px solid color-mix(in srgb, var(--cf-accent, #2f7f55) 45%, var(--cf-border));
724
- border-radius: 999px;
725
- background: var(--cf-bg);
726
- color: var(--cf-accent, #2f7f55);
727
- font: inherit;
728
- font-size: 12.5px;
729
- font-weight: 650;
730
- cursor: pointer;
731
- }
732
- .cf-system-event__action:hover { background: color-mix(in srgb, var(--cf-accent, #2f7f55) 8%, var(--cf-bg)); }
733
- .cf-system-event__action:focus-visible { outline: 2px solid var(--cf-accent, #2f7f55); outline-offset: 2px; }
734
- .cf-system-event__time {
735
- font-size: 11px;
736
- line-height: 1.2;
737
- color: var(--cf-muted);
738
- }
739
-
740
- /* ---------- Markdown in answers ---------- */
741
- .cf-msg__bubble .cf-md-h {
742
- margin: 12px 0 5px;
743
- color: var(--cf-text);
744
- font-size: 14.5px;
745
- font-weight: 750;
746
- line-height: 1.3;
747
- }
748
- .cf-msg__bubble .cf-md-h:first-child { margin-top: 0; }
749
- .cf-msg__bubble .cf-md-h--1,
750
- .cf-msg__bubble .cf-md-h--2 { font-size: 15.5px; }
751
- .cf-msg__bubble p.cf-md-list-intro {
752
- margin: 11px 0 5px;
753
- color: var(--cf-text);
754
- font-weight: 750;
755
- line-height: 1.35;
756
- }
757
- .cf-msg__bubble ul.cf-md-list,
758
- .cf-msg__bubble ol.cf-md-list {
759
- display: grid;
760
- gap: 9px;
761
- margin: 8px 0 11px;
762
- padding: 0;
763
- list-style: none;
764
- }
765
- .cf-msg__bubble .cf-md-list li {
766
- position: relative;
767
- min-width: 0;
768
- padding-left: 18px;
769
- line-height: 1.52;
770
- }
771
- .cf-msg__bubble ul.cf-md-list > li::before {
772
- position: absolute;
773
- top: .58em;
774
- left: 2px;
775
- width: 6px;
776
- height: 6px;
777
- border-radius: 50%;
778
- background: var(--cf-accent);
779
- content: "";
780
- }
781
- .cf-msg__bubble ol.cf-md-list { counter-reset: cf-answer-item; }
782
- .cf-msg__bubble ol.cf-md-list > li { padding-left: 25px; counter-increment: cf-answer-item; }
783
- .cf-msg__bubble ol.cf-md-list > li::before {
784
- position: absolute;
785
- top: .08em;
786
- left: 0;
787
- display: grid;
788
- width: 19px;
789
- height: 19px;
790
- place-items: center;
791
- border-radius: 50%;
792
- color: var(--cf-accent);
793
- background: var(--cf-accent-soft);
794
- content: counter(cf-answer-item);
795
- font-size: 10px;
796
- font-weight: 750;
797
- }
798
- .cf-msg__bubble .cf-md-list li > strong:first-child {
799
- display: inline;
800
- color: var(--cf-text);
801
- font-weight: 750;
802
- }
803
- .cf-md-code {
804
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
805
- font-size: 0.86em;
806
- background: var(--cf-surface-2);
807
- padding: 1px 5px;
808
- border-radius: 5px;
809
- }
810
- .cf-msg--user .cf-md-code { background: rgba(255, 255, 255, 0.22); }
811
- .cf-md-pre {
812
- margin: 6px 0;
813
- padding: 10px 12px;
814
- background: var(--cf-surface-2);
815
- border: 1px solid var(--cf-border);
816
- border-radius: 10px;
817
- overflow-x: auto;
818
- }
819
- .cf-md-pre code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: pre; color: var(--cf-text); }
820
- .cf-msg--user .cf-md-pre { background: rgba(0, 0, 0, 0.18); border-color: rgba(255, 255, 255, 0.18); }
821
- .cf-msg--user .cf-md-pre code { color: var(--cf-accent-ink); }
822
-
823
- /* streaming caret */
824
- .cf-caret {
825
- display: inline-block;
826
- width: 7px;
827
- height: 1em;
828
- margin-left: 2px;
829
- vertical-align: text-bottom;
830
- background: var(--cf-accent);
831
- border-radius: 1px;
832
- animation: cf-blink 1s step-end infinite;
833
- }
834
- @keyframes cf-blink {
835
- 0%, 100% { opacity: 1; }
836
- 50% { opacity: 0; }
837
- }
838
-
839
- /* message tools (copy / retry) */
840
- .cf-msg__actions { display: flex; align-items: flex-start; gap: 2px; }
841
- .cf-msg__tools { display: flex; gap: 6px; }
842
- .cf-tool {
843
- display: inline-flex;
844
- align-items: center;
845
- gap: 5px;
846
- font-size: 12px;
847
- color: var(--cf-muted);
848
- padding: 3px 7px;
849
- border-radius: 7px;
850
- opacity: 0.6;
851
- transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
852
- }
853
- .cf-msg:hover .cf-tool { opacity: 1; }
854
- .cf-tool:hover { background: var(--cf-surface); color: var(--cf-text); }
855
- .cf-tool svg { width: 13px; height: 13px; }
856
-
857
- /* Per-message 👍/👎 feedback. */
858
- .cf-feedback { margin-top: 0; }
859
- .cf-feedback__row { display: flex; align-items: center; gap: 4px; }
860
- .cf-feedback__label { margin-right: 4px; color: var(--cf-muted); font-size: 11.5px; }
861
- .cf-feedback__btn {
862
- display: inline-flex;
863
- align-items: center;
864
- justify-content: center;
865
- width: 26px;
866
- height: 26px;
867
- border-radius: 7px;
868
- color: var(--cf-muted);
869
- opacity: 0.6;
870
- cursor: pointer;
871
- transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
872
- }
873
- .cf-msg:hover .cf-feedback__btn { opacity: 1; }
874
- .cf-feedback__btn:hover { background: var(--cf-surface); color: var(--cf-text); }
875
- .cf-feedback__btn.is-active { opacity: 1; color: var(--cf-accent); background: var(--cf-surface); }
876
- .cf-feedback__btn svg { width: 14px; height: 14px; }
877
- .cf-feedback__thanks { margin-left: 4px; font-size: 11.5px; color: var(--cf-muted); }
878
- .cf-feedback__comment { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-width: 260px; }
879
- .cf-feedback__input {
880
- width: 100%;
881
- resize: none;
882
- font: inherit;
883
- font-size: 12.5px;
884
- line-height: 1.4;
885
- color: var(--cf-text);
886
- background: var(--cf-bg);
887
- border: 1px solid var(--cf-border);
888
- border-radius: 9px;
889
- padding: 7px 9px;
890
- box-sizing: border-box;
891
- }
892
- .cf-feedback__input:focus { outline: none; border-color: var(--cf-accent); }
893
- .cf-feedback__send {
894
- align-self: flex-end;
895
- font-size: 12px;
896
- font-weight: 600;
897
- color: var(--cf-accent-ink);
898
- background: var(--cf-accent);
899
- border: none;
900
- border-radius: 999px;
901
- padding: 5px 14px;
902
- cursor: pointer;
903
- transition: opacity 0.15s ease;
904
- }
905
- .cf-feedback__send:hover { opacity: 0.9; }
906
-
907
- /* conversation starters */
908
- .cf-starters {
909
- display: flex;
910
- flex-direction: column;
911
- align-items: flex-start;
912
- min-width: 0;
913
- gap: 8px;
914
- margin: 2px 0 4px 34px;
915
- }
916
- .cf-starter {
917
- max-width: 100%;
918
- padding: 8px 12px;
919
- border-radius: 14px;
920
- border: 1px solid var(--cf-border);
921
- background: var(--cf-bg);
922
- color: var(--cf-text);
923
- font-size: 12.8px;
924
- font-weight: 500;
925
- text-align: left;
926
- overflow-wrap: anywhere;
927
- transition: border-color 0.15s ease, transform 0.1s ease;
928
- }
929
- .cf-starter:hover { border-color: var(--cf-accent); }
930
- .cf-starter:active { transform: scale(0.98); }
931
- .cf-starter:focus-visible {
932
- outline: 2px solid var(--cf-accent-2);
933
- outline-offset: 2px;
934
- }
935
- .cf-featured-links {
936
- display: flex;
937
- flex-wrap: wrap;
938
- align-items: flex-start;
939
- min-width: 0;
940
- gap: 8px;
941
- margin: 2px 0 4px;
942
- }
943
- .cf-featured-link {
944
- flex: 0 1 auto;
945
- min-width: 0;
946
- max-width: 100%;
947
- display: inline-flex;
948
- align-items: center;
949
- gap: 7px;
950
- min-width: 0;
951
- min-height: 34px;
952
- padding: 7px 11px;
953
- border-radius: 999px;
954
- border: 1px solid color-mix(in srgb, var(--cf-accent) 55%, var(--cf-border));
955
- background: color-mix(in srgb, var(--cf-accent) 10%, var(--cf-bg));
956
- color: var(--cf-text);
957
- font-size: 13px;
958
- font-weight: 500;
959
- text-decoration: none;
960
- transition: border-color 0.15s ease, background-color 0.15s ease;
961
- }
962
- .cf-featured-link svg {
963
- width: 14px;
964
- height: 14px;
965
- flex: 0 0 14px;
966
- }
967
- .cf-featured-link svg {
968
- width: 14px;
969
- height: 14px;
970
- flex: 0 0 14px;
971
- color: var(--cf-accent);
972
- }
973
- .cf-featured-link span {
974
- min-width: 0;
975
- overflow: hidden;
976
- text-overflow: ellipsis;
977
- white-space: nowrap;
978
- }
979
- .cf-featured-link:hover {
980
- border-color: var(--cf-accent);
981
- background: color-mix(in srgb, var(--cf-accent) 16%, var(--cf-bg));
982
- }
983
- .cf-featured-link:focus-visible {
984
- outline: 2px solid var(--cf-accent-2);
985
- outline-offset: 2px;
986
- }
987
-
988
- /* stop generating */
989
- .cf-stopbar { display: flex; justify-content: center; padding: 6px 0 2px; flex-shrink: 0; }
990
- .cf-stop {
991
- display: inline-flex;
992
- align-items: center;
993
- gap: 6px;
994
- font-size: 12.5px;
995
- font-weight: 600;
996
- color: var(--cf-muted);
997
- background: var(--cf-bg);
998
- border: 1px solid var(--cf-border);
999
- border-radius: 999px;
1000
- padding: 6px 14px;
1001
- box-shadow: var(--cf-shadow);
1002
- transition: border-color 0.15s ease, color 0.15s ease;
1003
- }
1004
- .cf-stop:hover { border-color: var(--cf-accent); color: var(--cf-text); }
1005
- .cf-stop svg { width: 13px; height: 13px; }
1006
-
1007
- /* typing */
1008
- .cf-typing {
1009
- max-width: 100%;
1010
- flex-wrap: wrap;
1011
- display: inline-flex;
1012
- align-items: center;
1013
- gap: 4px;
1014
- padding: 10px 13px;
1015
- min-width: 98px;
1016
- }
1017
- .cf-typing__label {
1018
- min-width: 0;
1019
- overflow-wrap: anywhere;
1020
- margin-right: 3px;
1021
- color: var(--cf-muted);
1022
- font-size: 12px;
1023
- font-weight: 650;
1024
- }
1025
- .cf-typing__dot {
1026
- width: 5px;
1027
- height: 5px;
1028
- border-radius: 50%;
1029
- background: var(--cf-muted);
1030
- animation: cf-typing 1.1s infinite ease-in-out;
1031
- }
1032
- .cf-typing__dot:nth-child(2) { animation-delay: 0.15s; }
1033
- .cf-typing__dot:nth-child(3) { animation-delay: 0.3s; }
1034
-
1035
- /* sources */
1036
- .cf-sources {
1037
- display: flex;
1038
- flex-wrap: wrap;
1039
- gap: 6px;
1040
- /* Tie the row to the message column so a long title can't widen the thread. */
1041
- max-width: 100%;
1042
- min-width: 0;
1043
- }
1044
- .cf-source {
1045
- display: inline-flex;
1046
- align-items: center;
1047
- gap: 5px;
1048
- padding: 5px 10px;
1049
- border-radius: 999px;
1050
- background: var(--cf-surface-2);
1051
- border: 1px solid var(--cf-border);
1052
- color: var(--cf-muted);
1053
- font-size: 12px;
1054
- text-decoration: none;
1055
- max-width: 100%;
1056
- min-width: 0;
1057
- transition: border-color 0.15s ease, color 0.15s ease;
1058
- }
1059
- .cf-source:hover { color: var(--cf-text); border-color: var(--cf-accent); }
1060
- .cf-source--more { color: var(--cf-muted); cursor: default; }
1061
- .cf-source--more:hover { border-color: var(--cf-border); color: var(--cf-muted); }
1062
- .cf-source svg { width: 12px; height: 12px; flex-shrink: 0; }
1063
- .cf-source span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1064
-
1065
- /* chips + actions */
1066
- .cf-chips, .cf-actions {
1067
- display: flex;
1068
- flex-wrap: wrap;
1069
- gap: 8px;
1070
- }
1071
- .cf-chip {
1072
- padding: 8px 13px;
1073
- border-radius: 999px;
1074
- background: var(--cf-bg);
1075
- border: 1.5px solid var(--cf-accent);
1076
- color: var(--cf-accent);
1077
- font-size: 13px;
1078
- font-weight: 600;
1079
- transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
1080
- }
1081
- .cf-root[data-theme='dark'] .cf-chip { color: var(--cf-text); border-color: var(--cf-border); }
1082
- .cf-chip:hover { background: var(--cf-accent); color: var(--cf-accent-ink); }
1083
- .cf-chip:active { transform: scale(0.97); }
1084
- .cf-chip:focus-visible { outline: 2px solid var(--cf-accent-2); outline-offset: 2px; }
1085
- .cf-action {
1086
- display: inline-flex;
1087
- align-items: center;
1088
- gap: 7px;
1089
- padding: 9px 14px;
1090
- border-radius: 12px;
1091
- background: var(--cf-surface);
1092
- border: 1px solid var(--cf-border);
1093
- color: var(--cf-text);
1094
- font-size: 12.8px;
1095
- font-weight: 600;
1096
- transition: border-color 0.15s ease, transform 0.1s ease;
1097
- }
1098
- .cf-action:hover { border-color: var(--cf-accent); }
1099
- .cf-action:active { transform: scale(0.98); }
1100
- .cf-action svg { width: 15px; height: 15px; color: var(--cf-accent); }
1101
-
1102
- /* ---------- Inline forms + handoff card ---------- */
1103
- .cf-action-shell {
1104
- display: flex;
1105
- flex-direction: column;
1106
- gap: 8px;
1107
- width: 100%;
1108
- min-width: 0;
1109
- max-width: 100%;
1110
- }
1111
-
1112
- .cf-form {
1113
- display: flex;
1114
- flex-direction: column;
1115
- gap: 8px;
1116
- width: 100%;
1117
- min-width: 0;
1118
- max-width: 300px;
1119
- padding: 12px;
1120
- border-radius: 14px;
1121
- border: 1px solid var(--cf-border);
1122
- background: var(--cf-surface);
1123
- animation: cf-msg-in 0.2s ease both;
1124
- }
1125
- .cf-form__title { font-size: 13.5px; font-weight: 700; color: var(--cf-fg, var(--cf-text)); }
1126
- .cf-form__as { font-size: 12.5px; color: var(--cf-muted); margin-top: -2px; overflow-wrap: anywhere; }
1127
- .cf-form__input {
1128
- width: 100%;
1129
- min-width: 0;
1130
- max-width: 100%;
1131
- padding: 9px 11px;
1132
- border: 1.5px solid var(--cf-border);
1133
- border-radius: 10px;
1134
- background: var(--cf-bg);
1135
- color: var(--cf-text);
1136
- font-family: inherit;
1137
- font-size: 14px;
1138
- outline: none;
1139
- resize: none;
1140
- }
1141
- .cf-form__input:focus { border-color: var(--cf-accent); }
1142
- .cf-form__input::placeholder { color: var(--cf-muted); }
1143
- .cf-phone {
1144
- position: relative;
1145
- display: grid;
1146
- gap: 5px;
1147
- }
1148
- .cf-phone__label {
1149
- color: var(--cf-muted);
1150
- font-size: 11px;
1151
- font-weight: 600;
1152
- }
1153
- .cf-phone__control {
1154
- display: grid;
1155
- grid-template-columns: 92px minmax(0, 1fr);
1156
- overflow: hidden;
1157
- border: 1.5px solid var(--cf-border);
1158
- border-radius: 8px;
1159
- background: var(--cf-bg);
1160
- transition: border-color 0.15s ease, box-shadow 0.15s ease;
1161
- }
1162
- .cf-phone__control:focus-within {
1163
- border-color: var(--cf-accent);
1164
- box-shadow: 0 0 0 2px color-mix(in oklab, var(--cf-accent) 14%, transparent);
1165
- }
1166
- .cf-phone__input {
1167
- width: 100%;
1168
- min-width: 0;
1169
- box-sizing: border-box;
1170
- border: 0;
1171
- border-radius: 0;
1172
- background: transparent;
1173
- color: var(--cf-text);
1174
- font: inherit;
1175
- font-size: 13.5px;
1176
- padding: 10px;
1177
- outline: none;
1178
- }
1179
- .cf-phone__input::placeholder { color: var(--cf-muted); }
1180
- .cf-phone__country {
1181
- display: grid;
1182
- grid-template-columns: 20px 1fr 14px;
1183
- align-items: center;
1184
- gap: 4px;
1185
- border-right: 1px solid var(--cf-border);
1186
- padding: 8px 7px;
1187
- color: var(--cf-text);
1188
- font-size: 13px;
1189
- text-align: left;
1190
- white-space: nowrap;
1191
- }
1192
- .cf-phone__country-code { overflow: hidden; text-overflow: clip; }
1193
- .cf-phone__country svg {
1194
- width: 13px;
1195
- height: 13px;
1196
- color: var(--cf-muted);
1197
- }
1198
- .cf-phone__country[aria-expanded="true"] svg { transform: rotate(180deg); }
1199
- .cf-phone__menu {
1200
- display: grid;
1201
- gap: 6px;
1202
- margin-top: 1px;
1203
- padding: 7px;
1204
- border: 1px solid var(--cf-border);
1205
- border-radius: 8px;
1206
- background: var(--cf-surface);
1207
- box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
1208
- }
1209
- .cf-phone__search {
1210
- width: 100%;
1211
- box-sizing: border-box;
1212
- border: 1px solid var(--cf-border);
1213
- border-radius: 6px;
1214
- background: var(--cf-bg);
1215
- color: var(--cf-text);
1216
- font: inherit;
1217
- font-size: 12.5px;
1218
- outline: none;
1219
- padding: 8px 9px;
1220
- }
1221
- .cf-phone__search:focus { border-color: var(--cf-accent); }
1222
- .cf-phone__options {
1223
- display: grid;
1224
- max-height: 124px;
1225
- overflow-y: auto;
1226
- overscroll-behavior: contain;
1227
- scrollbar-width: thin;
1228
- }
1229
- .cf-phone__option {
1230
- display: grid;
1231
- grid-template-columns: 22px minmax(0, 1fr) auto;
1232
- align-items: center;
1233
- gap: 6px;
1234
- width: 100%;
1235
- min-height: 34px;
1236
- padding: 6px 7px;
1237
- border-radius: 5px;
1238
- color: var(--cf-text);
1239
- font-size: 12.5px;
1240
- text-align: left;
1241
- }
1242
- .cf-phone__option:hover,
1243
- .cf-phone__option.is-selected {
1244
- background: color-mix(in oklab, var(--cf-accent) 12%, var(--cf-bg));
1245
- }
1246
- .cf-phone__option.is-selected { color: var(--cf-accent-strong); font-weight: 600; }
1247
- .cf-phone__option-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1248
- .cf-phone__option-code { color: var(--cf-muted); font-variant-numeric: tabular-nums; }
1249
- .cf-phone__empty { padding: 12px 8px; color: var(--cf-muted); font-size: 12px; text-align: center; }
1250
- .cf-form__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 2px; }
1251
- .cf-form__submit {
1252
- min-height: 36px;
1253
- max-width: 100%;
1254
- padding: 8px 14px;
1255
- border-radius: 10px;
1256
- font-size: 13.5px;
1257
- font-weight: 600;
1258
- background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
1259
- color: var(--cf-accent-ink);
1260
- overflow-wrap: anywhere;
1261
- transition: opacity 0.15s ease, transform 0.1s ease;
1262
- }
1263
- .cf-form__submit:disabled { opacity: 0.45; cursor: default; }
1264
- .cf-form__submit:not(:disabled):active { transform: scale(0.97); }
1265
- .cf-form__cancel { padding: 8px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--cf-muted); }
1266
- .cf-form__cancel:hover { color: var(--cf-text); }
1267
- .cf-form__err { font-size: 12.5px; color: #f25767; }
1268
- .cf-form--done {
1269
- flex-direction: column;
1270
- align-items: center;
1271
- justify-content: center;
1272
- gap: 10px;
1273
- min-height: 112px;
1274
- padding: 18px 16px;
1275
- font-size: 13.5px;
1276
- color: var(--cf-text);
1277
- text-align: center;
1278
- }
1279
- .cf-form--done svg { width: 24px; height: 24px; color: var(--cf-accent); flex-shrink: 0; }
1280
- .cf-form--done > span { max-width: 28ch; line-height: 1.5; }
1281
- .cf-booking__link {
1282
- display: flex;
1283
- align-items: center;
1284
- flex-wrap: wrap;
1285
- justify-content: center;
1286
- gap: 4px;
1287
- font-size: 13px;
1288
- font-weight: 600;
1289
- color: var(--cf-accent);
1290
- text-decoration: none;
1291
- flex-basis: 100%;
1292
- }
1293
- .cf-booking__link svg { width: 13px; height: 13px; }
1294
- .cf-booking__link:hover { text-decoration: underline; }
1295
- .cf-booking__url { flex-basis: 100%; overflow-wrap: anywhere; font-size: 11px; font-weight: 400; }
1296
- .cf-booking__receipt-error { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; line-height: 1.5; color: var(--cf-muted); }
1297
- .cf-booking__back {
1298
- flex-basis: 100%;
1299
- width: fit-content;
1300
- margin-top: 2px;
1301
- padding: 7px 11px !important;
1302
- border: 1px solid var(--cf-border) !important;
1303
- border-radius: 8px;
1304
- background: var(--cf-bg) !important;
1305
- color: var(--cf-text) !important;
1306
- font-size: 12.5px;
1307
- font-weight: 650;
1308
- }
1309
-
1310
- .cf-scheduler-overlay {
1311
- position: fixed;
1312
- inset: 0;
1313
- z-index: 30;
1314
- display: grid;
1315
- grid-template-rows: auto minmax(0, 1fr);
1316
- width: 100%;
1317
- height: 100%;
1318
- min-width: 0;
1319
- min-height: 0;
1320
- overflow: hidden;
1321
- pointer-events: auto;
1322
- background: var(--cf-bg);
1323
- color: var(--cf-text);
1324
- }
1325
- .cf-scheduler-overlay__head {
1326
- display: grid;
1327
- grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
1328
- align-items: center;
1329
- gap: 12px;
1330
- min-height: 56px;
1331
- padding: 8px 14px;
1332
- border-bottom: 1px solid var(--cf-border);
1333
- background: var(--cf-bg);
1334
- }
1335
- .cf-scheduler-overlay__head strong {
1336
- overflow: hidden;
1337
- color: var(--cf-text);
1338
- font-size: 14px;
1339
- text-overflow: ellipsis;
1340
- white-space: nowrap;
1341
- }
1342
- .cf-scheduler-overlay__back {
1343
- justify-self: start;
1344
- min-height: 34px;
1345
- padding: 7px 10px !important;
1346
- border: 1px solid var(--cf-border) !important;
1347
- border-radius: 8px;
1348
- background: var(--cf-surface) !important;
1349
- color: var(--cf-text) !important;
1350
- font-size: 12.5px;
1351
- font-weight: 650;
1352
- }
1353
- .cf-scheduler-overlay__tools {
1354
- display: flex;
1355
- align-items: center;
1356
- justify-content: flex-end;
1357
- gap: 8px;
1358
- min-width: 0;
1359
- }
1360
- .cf-scheduler-overlay__tools a {
1361
- display: inline-flex;
1362
- align-items: center;
1363
- gap: 5px;
1364
- min-height: 34px;
1365
- padding: 7px 9px;
1366
- border: 1px solid var(--cf-border);
1367
- border-radius: 8px;
1368
- color: var(--cf-text);
1369
- font-size: 12px;
1370
- font-weight: 600;
1371
- text-decoration: none;
1372
- white-space: nowrap;
1373
- }
1374
- .cf-scheduler-overlay__tools a svg { width: 13px; height: 13px; }
1375
- .cf-scheduler-overlay__tools button {
1376
- display: inline-grid;
1377
- place-items: center;
1378
- flex: 0 0 34px;
1379
- width: 34px;
1380
- height: 34px;
1381
- border: 1px solid var(--cf-border) !important;
1382
- border-radius: 8px;
1383
- background: var(--cf-surface) !important;
1384
- color: var(--cf-muted) !important;
1385
- }
1386
- .cf-scheduler-overlay__tools button svg { width: 15px; height: 15px; }
1387
- .cf-scheduler-overlay__body {
1388
- position: relative;
1389
- min-height: 0;
1390
- background: #ffffff;
1391
- }
1392
- .cf-scheduler-overlay__loading {
1393
- position: absolute;
1394
- inset: 0;
1395
- display: grid;
1396
- place-items: center;
1397
- color: var(--cf-muted);
1398
- font-size: 13px;
1399
- }
1400
- .cf-scheduler-overlay__frame {
1401
- position: relative;
1402
- z-index: 1;
1403
- display: block;
1404
- width: 100%;
1405
- height: 100%;
1406
- border: 0;
1407
- background: #ffffff;
1408
- }
1409
-
1410
- @media (max-width: 520px) {
1411
- .cf-scheduler-overlay__head {
1412
- grid-template-columns: auto minmax(0, 1fr);
1413
- gap: 8px;
1414
- padding-inline: 10px;
1415
- }
1416
- .cf-scheduler-overlay__head > strong { display: none; }
1417
- .cf-scheduler-overlay__tools a { padding-inline: 8px; }
1418
- }
1419
-
1420
- .cf-handoff {
1421
- display: flex;
1422
- flex-direction: column;
1423
- gap: 8px;
1424
- width: 100%;
1425
- max-width: 300px;
1426
- padding: 12px;
1427
- border-radius: 14px;
1428
- border: 1.5px solid var(--cf-accent);
1429
- background: color-mix(in oklab, var(--cf-accent) 8%, var(--cf-bg));
1430
- animation: cf-msg-in 0.2s ease both;
1431
- }
1432
- .cf-handoff__title { font-size: 13.5px; font-weight: 700; color: var(--cf-text); }
1433
-
1434
- /* ---------- Demo booking picker ---------- */
1435
- .cf-booking { max-width: 320px; }
1436
- .cf-booking__hint { font-size: 12.5px; color: var(--cf-muted); margin-top: -2px; line-height: 1.45; overflow-wrap: anywhere; }
1437
- .cf-booking__dur { font-weight: 600; color: var(--cf-text); }
1438
- .cf-booking__timezone { display: block; margin-top: 3px; font-size: 11.5px; }
1439
- .cf-booking__state {
1440
- padding: 12px;
1441
- border: 1px dashed var(--cf-border);
1442
- border-radius: 10px;
1443
- background: var(--cf-bg-soft);
1444
- color: var(--cf-muted);
1445
- font-size: 12px;
1446
- line-height: 1.45;
1447
- text-align: center;
1448
- }
1449
- .cf-booking__dates {
1450
- display: flex;
1451
- gap: 6px;
1452
- width: 100%;
1453
- min-width: 0;
1454
- max-width: 100%;
1455
- overflow-x: auto;
1456
- padding-bottom: 4px;
1457
- scrollbar-width: thin;
1458
- }
1459
- .cf-booking__dates::-webkit-scrollbar { height: 5px; }
1460
- .cf-booking__dates::-webkit-scrollbar-thumb { background: var(--cf-border); border-radius: 3px; }
1461
- .cf-booking__date {
1462
- flex-shrink: 0;
1463
- display: flex;
1464
- flex-direction: column;
1465
- align-items: center;
1466
- gap: 1px;
1467
- width: 46px;
1468
- padding: 7px 0;
1469
- border-radius: 10px;
1470
- border: 1px solid var(--cf-border);
1471
- background: var(--cf-bg);
1472
- color: var(--cf-text);
1473
- transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
1474
- }
1475
- .cf-booking__date:hover { border-color: var(--cf-accent); }
1476
- .cf-booking__date:active { transform: scale(0.96); }
1477
- .cf-booking__date.is-selected {
1478
- border-color: var(--cf-accent);
1479
- background: color-mix(in oklab, var(--cf-accent) 14%, var(--cf-bg));
1480
- color: var(--cf-accent);
1481
- }
1482
- .cf-root[data-theme='dark'] .cf-booking__date.is-selected { color: var(--cf-text); }
1483
- .cf-booking__dow { font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--cf-muted); }
1484
- .cf-booking__date.is-selected .cf-booking__dow { color: inherit; }
1485
- .cf-booking__dom { font-size: 15px; font-weight: 700; line-height: 1.1; }
1486
- .cf-booking__slots {
1487
- display: grid;
1488
- grid-template-columns: repeat(auto-fit, minmax(min(100%, 80px), 1fr));
1489
- width: 100%;
1490
- min-width: 0;
1491
- gap: 6px;
1492
- max-height: 156px;
1493
- overflow-y: auto;
1494
- padding: 2px;
1495
- }
1496
- .cf-booking__slots::-webkit-scrollbar { width: 6px; }
1497
- .cf-booking__slots::-webkit-scrollbar-thumb { background: var(--cf-border); border-radius: 3px; }
1498
- .cf-booking__slot {
1499
- min-width: 0;
1500
- min-height: 36px;
1501
- padding: 8px 4px;
1502
- border-radius: 9px;
1503
- border: 1px solid var(--cf-border);
1504
- background: var(--cf-bg);
1505
- color: var(--cf-accent);
1506
- font-size: 13px;
1507
- font-weight: 600;
1508
- transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.1s ease;
1509
- }
1510
- .cf-root[data-theme='dark'] .cf-booking__slot { color: var(--cf-text); }
1511
- .cf-booking__slot:hover { border-color: var(--cf-accent); }
1512
- .cf-booking__slot:active { transform: scale(0.96); }
1513
- .cf-booking__slot.is-selected {
1514
- background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
1515
- color: var(--cf-accent-ink);
1516
- border-color: var(--cf-accent);
1517
- }
1518
- .cf-booking__slot.is-taken,
1519
- .cf-booking__slot:disabled {
1520
- color: var(--cf-muted);
1521
- background: var(--cf-surface);
1522
- border-color: var(--cf-border);
1523
- text-decoration: line-through;
1524
- cursor: not-allowed;
1525
- opacity: 0.55;
1526
- }
1527
- .cf-booking__slot.is-taken:hover { border-color: var(--cf-border); }
1528
- .cf-handoff--done {
1529
- flex-direction: row;
1530
- align-items: center;
1531
- border-color: var(--cf-border);
1532
- background: var(--cf-surface);
1533
- font-size: 13.5px;
1534
- }
1535
- .cf-handoff--done svg { width: 18px; height: 18px; color: var(--cf-accent); flex-shrink: 0; }
1536
-
1537
- /* note (action confirmation) */
1538
- .cf-note {
1539
- align-self: center;
1540
- font-size: 12.5px;
1541
- color: var(--cf-muted);
1542
- background: var(--cf-surface);
1543
- padding: 7px 12px;
1544
- border-radius: 999px;
1545
- animation: cf-msg-in 0.3s ease both;
1546
- }
1547
-
1548
- /* ---------- Composer ---------- */
1549
- .cf-composer {
1550
- flex-shrink: 0;
1551
- padding: 10px 12px;
1552
- border-top: 1px solid var(--cf-border);
1553
- background: var(--cf-bg);
1554
- }
1555
- .cf-live-typing {
1556
- flex-shrink: 0;
1557
- padding: 8px 14px 0;
1558
- color: var(--cf-muted);
1559
- font-size: 12px;
1560
- background: var(--cf-bg);
1561
- }
1562
- .cf-composer__field {
1563
- display: flex;
1564
- align-items: flex-end;
1565
- gap: 6px;
1566
- background: var(--cf-surface);
1567
- border: 1.5px solid var(--cf-border);
1568
- border-radius: 14px;
1569
- padding: 6px 6px 6px 12px;
1570
- transition: border-color 0.15s ease;
1571
- }
1572
- .cf-composer__field:focus-within { border-color: var(--cf-accent); }
1573
- .cf-voice-state {
1574
- display: inline-flex;
1575
- align-items: center;
1576
- gap: 8px;
1577
- margin: 0 0 8px 2px;
1578
- color: var(--cf-muted);
1579
- font-size: 12.5px;
1580
- }
1581
- .cf-voice-state__dot {
1582
- width: 8px;
1583
- height: 8px;
1584
- border-radius: 999px;
1585
- background: var(--cf-accent);
1586
- }
1587
- .cf-voice-state__dot.is-live {
1588
- animation: cf-pulse 1s infinite;
1589
- }
1590
- .cf-textarea {
1591
- flex: 1;
1592
- border: none;
1593
- background: none;
1594
- resize: none;
1595
- outline: none;
1596
- font-family: inherit;
1597
- font-size: 14.5px;
1598
- color: var(--cf-text);
1599
- max-height: 110px;
1600
- line-height: 1.45;
1601
- padding: 6px 0;
1602
- }
1603
- .cf-textarea::placeholder { color: var(--cf-muted); }
1604
- .cf-iconbtn {
1605
- width: 36px;
1606
- height: 36px;
1607
- border-radius: 10px;
1608
- display: grid;
1609
- place-items: center;
1610
- flex-shrink: 0;
1611
- color: var(--cf-muted);
1612
- transition: background 0.15s ease, color 0.15s ease;
1613
- }
1614
- .cf-iconbtn:hover { background: var(--cf-surface-2); color: var(--cf-text); }
1615
- .cf-iconbtn:focus-visible { outline: 2px solid var(--cf-accent-2); outline-offset: 1px; }
1616
- .cf-iconbtn svg { width: 19px; height: 19px; }
1617
- .cf-send {
1618
- width: 36px;
1619
- height: 36px;
1620
- border-radius: 10px;
1621
- display: grid;
1622
- place-items: center;
1623
- flex-shrink: 0;
1624
- background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
1625
- color: var(--cf-accent-ink);
1626
- transition: opacity 0.15s ease, transform 0.1s ease;
1627
- }
1628
- .cf-send:disabled { opacity: 0.4; cursor: default; }
1629
- .cf-send:not(:disabled):hover { transform: scale(1.05); }
1630
- .cf-send:not(:disabled):active { transform: scale(0.94); }
1631
- .cf-send svg { width: 18px; height: 18px; }
1632
- .cf-mic.is-recording { color: #f25767; animation: cf-pulse 1s infinite; }
1633
-
1634
- .cf-iconbtn.is-active { background: var(--cf-surface-2); color: var(--cf-accent); }
1635
- .cf-gif-label { font-size: 11px; font-weight: 800; letter-spacing: 0.5px; }
1636
-
1637
- /* ---------- Emoji + GIF pickers ---------- */
1638
- .cf-composer { position: relative; }
1639
- .cf-picker {
1640
- position: absolute;
1641
- left: 8px;
1642
- right: 8px;
1643
- bottom: calc(100% - 4px);
1644
- background: var(--cf-bg);
1645
- border: 1px solid var(--cf-border);
1646
- border-radius: 14px;
1647
- box-shadow: var(--cf-shadow);
1648
- overflow: hidden;
1649
- animation: cf-msg-in 0.18s ease both;
1650
- z-index: 2;
1651
- }
1652
- .cf-emoji { max-height: 260px; overflow-y: auto; padding: 8px 10px 10px; }
1653
- .cf-emoji__label {
1654
- font-size: 11px;
1655
- font-weight: 700;
1656
- text-transform: uppercase;
1657
- letter-spacing: 0.5px;
1658
- color: var(--cf-muted);
1659
- margin: 8px 2px 4px;
1660
- }
1661
- .cf-emoji__grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
1662
- .cf-emoji__btn {
1663
- font-size: 21px;
1664
- line-height: 1;
1665
- height: 34px;
1666
- border-radius: 8px;
1667
- transition: background 0.12s ease, transform 0.08s ease;
1668
- }
1669
- .cf-emoji__btn:hover { background: var(--cf-surface); }
1670
- .cf-emoji__btn:active { transform: scale(0.9); }
1671
-
1672
- .cf-gif { display: flex; flex-direction: column; max-height: 320px; }
1673
- .cf-gif__search {
1674
- margin: 10px 10px 8px;
1675
- padding: 9px 12px;
1676
- border: 1.5px solid var(--cf-border);
1677
- border-radius: 10px;
1678
- background: var(--cf-surface);
1679
- color: var(--cf-text);
1680
- font-family: inherit;
1681
- font-size: 14px;
1682
- outline: none;
1683
- }
1684
- .cf-gif__search:focus { border-color: var(--cf-accent); }
1685
- .cf-gif__search::placeholder { color: var(--cf-muted); }
1686
- .cf-gif__grid {
1687
- flex: 1;
1688
- overflow-y: auto;
1689
- display: grid;
1690
- grid-template-columns: 1fr 1fr;
1691
- gap: 6px;
1692
- padding: 0 10px 8px;
1693
- align-content: start;
1694
- }
1695
- .cf-gif__item {
1696
- border-radius: 10px;
1697
- overflow: hidden;
1698
- background: var(--cf-surface);
1699
- aspect-ratio: 1 / 1;
1700
- transition: transform 0.1s ease, box-shadow 0.12s ease;
1701
- }
1702
- .cf-gif__item:hover { transform: scale(1.03); box-shadow: 0 0 0 2px var(--cf-accent); }
1703
- .cf-gif__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
1704
- .cf-gif__hint { grid-column: 1 / -1; text-align: center; color: var(--cf-muted); font-size: 13px; padding: 24px 0; }
1705
- .cf-gif__powered { text-align: right; font-size: 10px; color: var(--cf-muted); padding: 0 12px 8px; }
1706
-
1707
- /* Inline media (GIF) in a message bubble. */
1708
- .cf-msg__bubble--media { padding: 4px; background: var(--cf-surface); overflow: hidden; }
1709
- .cf-msg--user .cf-msg__bubble--media { background: var(--cf-surface-2); }
1710
- .cf-msg__media { display: block; max-width: 200px; width: 100%; border-radius: 12px; }
1711
- .cf-msg__caption { display: block; padding: 4px 6px 2px; font-size: 14px; }
1712
-
1713
- .cf-footer {
1714
- text-align: center;
1715
- padding: 7px 0 9px;
1716
- font-size: 11px;
1717
- color: var(--cf-muted);
1718
- }
1719
- .cf-footer a { color: var(--cf-muted); text-decoration: none; font-weight: 600; }
1720
- .cf-footer a:hover { color: var(--cf-accent); }
1721
-
1722
- /* ---------- Footer lead actions ---------- */
1723
- .cf-footer-actions {
1724
- flex-shrink: 0;
1725
- padding: 6px 14px 5px;
1726
- background: var(--cf-bg);
1727
- border-top: 1px solid var(--cf-border);
1728
- }
1729
- .cf-action-trigger {
1730
- display: grid;
1731
- grid-template-columns: 28px minmax(0, 1fr) 16px;
1732
- align-items: center;
1733
- gap: 8px;
1734
- width: 100%;
1735
- min-height: 40px;
1736
- border: 1px solid color-mix(in oklab, var(--cf-border) 86%, var(--cf-accent));
1737
- border-radius: 14px;
1738
- padding: 6px 9px;
1739
- background:
1740
- radial-gradient(circle at 15% 0%, color-mix(in oklab, var(--cf-accent) 15%, transparent), transparent 40%),
1741
- color-mix(in oklab, var(--cf-bg-soft) 78%, transparent);
1742
- color: var(--cf-text);
1743
- text-align: left;
1744
- cursor: pointer;
1745
- box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
1746
- }
1747
- .cf-action-trigger[hidden] {
1748
- display: none;
1749
- }
1750
- .cf-action-trigger:hover {
1751
- border-color: color-mix(in oklab, var(--cf-accent) 46%, var(--cf-border));
1752
- }
1753
- .cf-action-trigger > svg {
1754
- width: 14px;
1755
- height: 14px;
1756
- color: var(--cf-muted);
1757
- }
1758
- .cf-action-trigger__icon {
1759
- display: inline-flex;
1760
- align-items: center;
1761
- justify-content: center;
1762
- width: 28px;
1763
- height: 28px;
1764
- border-radius: 10px;
1765
- background: color-mix(in oklab, var(--cf-accent) 15%, transparent);
1766
- color: var(--cf-accent);
1767
- }
1768
- .cf-action-trigger__icon svg { width: 14px; height: 14px; }
1769
- .cf-action-trigger__copy {
1770
- display: grid;
1771
- gap: 1px;
1772
- min-width: 0;
1773
- }
1774
- .cf-action-trigger__copy strong {
1775
- font-size: 12px;
1776
- line-height: 1.1;
1777
- }
1778
- .cf-action-trigger__copy small {
1779
- overflow: hidden;
1780
- color: var(--cf-muted);
1781
- font-size: 10.5px;
1782
- line-height: 1.2;
1783
- text-overflow: ellipsis;
1784
- white-space: nowrap;
1785
- }
1786
- .cf-action-drawer {
1787
- width: 100%;
1788
- min-width: 0;
1789
- max-width: 100%;
1790
- border: 1px solid color-mix(in oklab, var(--cf-border) 86%, var(--cf-accent));
1791
- border-radius: 18px 18px 12px 12px;
1792
- padding: 7px;
1793
- background:
1794
- radial-gradient(circle at 18% 0%, color-mix(in oklab, var(--cf-accent) 16%, transparent), transparent 38%),
1795
- color-mix(in oklab, var(--cf-bg) 94%, #ffffff);
1796
- box-shadow: 0 -10px 34px rgba(15, 23, 42, 0.14);
1797
- /* Do not retain the animation's transform: a transformed ancestor becomes
1798
- the containing block for the fixed Calendly overlay and clips it to this
1799
- short drawer instead of the full widget panel. */
1800
- animation: cf-drawer-up 0.24s cubic-bezier(0.22, 1, 0.36, 1) backwards;
1801
- }
1802
- .cf-action-drawer__handle {
1803
- width: 36px;
1804
- height: 3px;
1805
- margin: 0 auto 6px;
1806
- border-radius: 999px;
1807
- background: color-mix(in oklab, var(--cf-muted) 42%, transparent);
1808
- }
1809
- .cf-action-drawer__head {
1810
- position: sticky;
1811
- top: -7px;
1812
- z-index: 1;
1813
- display: flex;
1814
- align-items: center;
1815
- justify-content: space-between;
1816
- gap: 10px;
1817
- padding: 0 3px 6px;
1818
- background: var(--cf-bg);
1819
- color: var(--cf-text);
1820
- }
1821
- .cf-action-drawer__head strong {
1822
- display: block;
1823
- font-size: 13px;
1824
- line-height: 1.2;
1825
- overflow-wrap: anywhere;
1826
- }
1827
- .cf-action-drawer__head > div { min-width: 0; }
1828
- .cf-action-drawer__eyebrow {
1829
- display: block;
1830
- margin-bottom: 2px;
1831
- font-size: 9px;
1832
- font-weight: 800;
1833
- letter-spacing: 0.16em;
1834
- text-transform: uppercase;
1835
- color: var(--cf-muted);
1836
- }
1837
- .cf-action-drawer__close {
1838
- display: inline-flex;
1839
- flex-shrink: 0;
1840
- align-items: center;
1841
- justify-content: center;
1842
- width: 28px;
1843
- height: 28px;
1844
- border: 1px solid var(--cf-border);
1845
- border-radius: 999px;
1846
- background: var(--cf-bg-soft);
1847
- color: var(--cf-muted);
1848
- cursor: pointer;
1849
- }
1850
- .cf-action-drawer__close svg { width: 14px; height: 14px; }
1851
- .cf-action-drawer__grid {
1852
- display: grid;
1853
- gap: 6px;
1854
- }
1855
- .cf-action-card {
1856
- display: grid;
1857
- grid-template-columns: 30px minmax(0, 1fr) 14px;
1858
- align-items: center;
1859
- gap: 8px;
1860
- width: 100%;
1861
- border: 1px solid var(--cf-border);
1862
- border-radius: 8px;
1863
- padding: 7px 8px;
1864
- background: color-mix(in oklab, var(--cf-bg-soft) 72%, transparent);
1865
- color: var(--cf-text);
1866
- text-align: left;
1867
- cursor: pointer;
1868
- transition:
1869
- transform 0.16s ease,
1870
- border-color 0.16s ease,
1871
- background 0.16s ease;
1872
- }
1873
- .cf-action-card:hover {
1874
- border-color: color-mix(in oklab, var(--cf-accent) 44%, var(--cf-border));
1875
- background: color-mix(in oklab, var(--cf-accent) 9%, var(--cf-bg-soft));
1876
- }
1877
- .cf-action-card:active { transform: translateY(1px); }
1878
- .cf-action-card > svg {
1879
- width: 13px;
1880
- height: 13px;
1881
- color: var(--cf-muted);
1882
- transform: rotate(-90deg);
1883
- }
1884
- .cf-action-card__icon {
1885
- display: inline-flex;
1886
- align-items: center;
1887
- justify-content: center;
1888
- width: 30px;
1889
- height: 30px;
1890
- border-radius: 7px;
1891
- background: color-mix(in oklab, var(--cf-accent) 14%, transparent);
1892
- color: var(--cf-accent);
1893
- }
1894
- .cf-action-card__icon--support {
1895
- background: color-mix(in oklab, #16a36a 14%, transparent);
1896
- color: #118354;
1897
- }
1898
- .cf-action-card__icon--sales {
1899
- background: color-mix(in oklab, #2378d4 14%, transparent);
1900
- color: #1d67b6;
1901
- }
1902
- .cf-action-card__icon--marketing {
1903
- background: color-mix(in oklab, #d88616 16%, transparent);
1904
- color: #a86208;
1905
- }
1906
- .cf-action-card__icon svg { width: 14px; height: 14px; }
1907
- .cf-action-card__copy {
1908
- display: grid;
1909
- gap: 2px;
1910
- min-width: 0;
1911
- }
1912
- .cf-action-card__copy strong {
1913
- font-size: 12px;
1914
- line-height: 1.2;
1915
- }
1916
- .cf-action-card__copy small {
1917
- overflow: hidden;
1918
- color: var(--cf-muted);
1919
- font-size: 10.5px;
1920
- line-height: 1.25;
1921
- text-overflow: ellipsis;
1922
- white-space: nowrap;
1923
- }
1924
- .cf-action-drawer__note {
1925
- margin: 6px 3px 0;
1926
- color: var(--cf-muted);
1927
- font-size: 10px;
1928
- line-height: 1.25;
1929
- }
1930
-
1931
- .cf-action-test-mode {
1932
- display: inline-flex;
1933
- width: fit-content;
1934
- margin-top: 3px;
1935
- padding: 2px 7px;
1936
- border: 1px solid color-mix(in srgb, var(--cf-accent) 32%, transparent);
1937
- border-radius: 999px;
1938
- color: var(--cf-accent-strong);
1939
- background: color-mix(in srgb, var(--cf-accent) 9%, white);
1940
- font-size: 10px;
1941
- font-weight: 700;
1942
- letter-spacing: 0.04em;
1943
- text-transform: uppercase;
1944
- }
1945
- .cf-action-drawer .cf-form,
1946
- .cf-action-drawer .cf-booking {
1947
- max-width: none;
1948
- margin: 0;
1949
- border: 0;
1950
- background: transparent;
1951
- box-shadow: none;
1952
- }
1953
- .cf-action-drawer .cf-form__actions {
1954
- position: sticky;
1955
- bottom: -7px;
1956
- z-index: 1;
1957
- padding-top: 8px;
1958
- background: var(--cf-bg);
1959
- }
1960
- .cf-footer-actions .cf-actions {
1961
- display: grid;
1962
- grid-template-columns: repeat(2, minmax(0, 1fr));
1963
- gap: 7px;
1964
- }
1965
- .cf-footer-actions .cf-action {
1966
- justify-content: center;
1967
- min-width: 0;
1968
- gap: 5px;
1969
- min-height: 32px;
1970
- border-radius: 11px;
1971
- padding: 6px 8px;
1972
- font-size: 12px;
1973
- line-height: 1.15;
1974
- font-weight: 650;
1975
- }
1976
- .cf-footer-actions .cf-action svg {
1977
- width: 13px;
1978
- height: 13px;
1979
- }
1980
- .cf-footer-actions .cf-form,
1981
- .cf-footer-actions .cf-booking {
1982
- max-width: none;
1983
- }
1984
- .cf-body .cf-action-drawer,
1985
- .cf-footer-actions .cf-action-drawer {
1986
- max-height: min(420px, 45dvh);
1987
- overflow-y: auto;
1988
- overflow-x: hidden;
1989
- overscroll-behavior: contain;
1990
- scrollbar-width: thin;
1991
- }
1992
-
1993
- @keyframes cf-drawer-up {
1994
- from {
1995
- opacity: 0;
1996
- transform: translateY(14px) scale(0.98);
1997
- }
1998
- to {
1999
- opacity: 1;
2000
- transform: translateY(0) scale(1);
2001
- }
2002
- }
2003
-
2004
- /* ---------- Assistant card module ---------- */
2005
- .cf-assistant-card {
2006
- display: flex;
2007
- flex-direction: column;
2008
- gap: 12px;
2009
- margin: 0 2px 4px;
2010
- animation: cf-msg-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
2011
- }
2012
- .cf-assistant-card--pinned {
2013
- flex-shrink: 0;
2014
- gap: 0;
2015
- margin: 0;
2016
- padding: 8px 14px 10px;
2017
- border-bottom: 1px solid var(--cf-border);
2018
- background: var(--cf-bg);
2019
- }
2020
- .cf-assistant-card--compact {
2021
- align-items: flex-start;
2022
- padding-top: 10px;
2023
- padding-bottom: 12px;
2024
- }
2025
- .cf-assistant-card__compact-speak {
2026
- position: relative;
2027
- isolation: isolate;
2028
- display: inline-flex;
2029
- align-items: center;
2030
- gap: 8px;
2031
- max-width: 100%;
2032
- min-height: 44px;
2033
- padding: 5px 15px 5px 6px;
2034
- border-radius: 999px;
2035
- background:
2036
- linear-gradient(180deg, color-mix(in oklab, var(--cf-accent) 13%, var(--cf-surface)), color-mix(in oklab, var(--cf-bg) 92%, var(--cf-surface))),
2037
- var(--cf-bg);
2038
- border: 1px solid color-mix(in oklab, var(--cf-accent) 58%, var(--cf-border));
2039
- color: var(--cf-text);
2040
- box-shadow:
2041
- inset 0 1px 0 color-mix(in oklab, #fff 13%, transparent),
2042
- 0 13px 30px -22px color-mix(in oklab, var(--cf-accent) 60%, #000);
2043
- font-size: 12.25px;
2044
- font-weight: 750;
2045
- line-height: 1;
2046
- transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
2047
- overflow: hidden;
2048
- }
2049
- .cf-assistant-card__compact-speak::before {
2050
- content: '';
2051
- position: absolute;
2052
- inset: 1px;
2053
- z-index: -1;
2054
- border-radius: inherit;
2055
- background:
2056
- radial-gradient(circle at 20% 10%, color-mix(in oklab, var(--cf-accent) 28%, transparent), transparent 42%),
2057
- radial-gradient(circle at 85% 100%, color-mix(in oklab, var(--cf-accent-2) 18%, transparent), transparent 38%);
2058
- opacity: 0.76;
2059
- pointer-events: none;
2060
- }
2061
- .cf-assistant-card__compact-speak:hover {
2062
- border-color: color-mix(in oklab, var(--cf-accent) 82%, var(--cf-border));
2063
- box-shadow:
2064
- inset 0 1px 0 color-mix(in oklab, #fff 15%, transparent),
2065
- 0 16px 34px -22px color-mix(in oklab, var(--cf-accent) 76%, #000);
2066
- }
2067
- .cf-assistant-card__compact-speak:active { transform: scale(0.98); }
2068
- .cf-assistant-card__compact-speak:focus-visible {
2069
- outline: 2px solid var(--cf-accent-2);
2070
- outline-offset: 2px;
2071
- }
2072
- .cf-assistant-card__compact-mic {
2073
- width: 24px;
2074
- height: 24px;
2075
- margin-left: -14px;
2076
- border-radius: 999px;
2077
- display: inline-flex;
2078
- align-items: center;
2079
- justify-content: center;
2080
- flex-shrink: 0;
2081
- color: var(--cf-accent);
2082
- background: color-mix(in oklab, var(--cf-bg) 90%, transparent);
2083
- border: 1px solid color-mix(in oklab, var(--cf-accent) 48%, var(--cf-border));
2084
- box-shadow: 0 7px 18px -12px rgba(0, 0, 0, 0.75);
2085
- }
2086
- .cf-assistant-card__compact-mic svg {
2087
- width: 13px;
2088
- height: 13px;
2089
- color: var(--cf-accent);
2090
- flex-shrink: 0;
2091
- }
2092
- .cf-assistant-card__compact-mic:first-child {
2093
- margin-left: 0;
2094
- }
2095
- .cf-assistant-card__compact-label {
2096
- min-width: 0;
2097
- overflow: hidden;
2098
- text-overflow: ellipsis;
2099
- white-space: nowrap;
2100
- letter-spacing: 0.01em;
2101
- }
2102
- .cf-assistant-card__compact-avatar {
2103
- width: 34px;
2104
- height: 34px;
2105
- border-radius: 999px;
2106
- display: grid;
2107
- place-items: center;
2108
- flex-shrink: 0;
2109
- overflow: hidden;
2110
- color: #fff;
2111
- background: linear-gradient(135deg, var(--cf-avatar-a, var(--cf-accent)), var(--cf-avatar-b, var(--cf-accent-2)));
2112
- border: 1px solid color-mix(in oklab, #fff 24%, transparent);
2113
- box-shadow:
2114
- 0 0 0 3px color-mix(in oklab, var(--cf-accent) 16%, transparent),
2115
- inset 0 1px 0 color-mix(in oklab, #fff 18%, transparent);
2116
- font-size: 11px;
2117
- font-weight: 800;
2118
- }
2119
- .cf-assistant-card__compact-avatar img {
2120
- width: 100%;
2121
- height: 100%;
2122
- object-fit: cover;
2123
- }
2124
- .cf-assistant-card--pinned .cf-assistant-card__stage {
2125
- height: 132px;
2126
- min-height: 0;
2127
- border-radius: 13px;
2128
- }
2129
- /* The stage sizes/positions the card's video area; .cf-assistant-card__media
2130
- inside it stays overflow: hidden for the rounded image/video corners,
2131
- while interactive controls sit as a stage sibling so their popovers
2132
- aren't clipped by it. */
2133
- .cf-assistant-card__stage {
2134
- position: relative;
2135
- border-radius: 12px;
2136
- aspect-ratio: 16 / 9;
2137
- }
2138
- .cf-assistant-card__voice-only {
2139
- position: relative;
2140
- display: flex;
2141
- align-items: center;
2142
- justify-content: center;
2143
- width: 100%;
2144
- min-height: 44px;
2145
- align-self: stretch;
2146
- }
2147
- .cf-assistant-card__media {
2148
- position: absolute;
2149
- inset: 0;
2150
- overflow: hidden;
2151
- border-radius: inherit;
2152
- background: var(--cf-surface);
2153
- border: 1px solid var(--cf-border);
2154
- }
2155
- .cf-assistant-card__stage--local {
2156
- isolation: isolate;
2157
- overflow: hidden;
2158
- background:
2159
- radial-gradient(circle at 30% 18%, color-mix(in oklab, var(--cf-accent) 18%, transparent), transparent 36%),
2160
- linear-gradient(145deg, color-mix(in oklab, var(--cf-surface) 72%, var(--cf-bg)), var(--cf-bg));
2161
- border: 1px solid color-mix(in oklab, var(--cf-border) 82%, var(--cf-accent));
2162
- box-shadow:
2163
- inset 0 1px 0 color-mix(in oklab, #fff 9%, transparent),
2164
- 0 22px 44px -34px color-mix(in oklab, var(--cf-accent) 46%, #000);
2165
- }
2166
- .cf-assistant-card__stage--local.is-live {
2167
- height: 188px;
2168
- aspect-ratio: auto;
2169
- }
2170
- .cf-assistant-card--pinned .cf-assistant-card__stage--local.is-live {
2171
- height: 154px;
2172
- }
2173
- .cf-assistant-card__stage--local.is-speaking {
2174
- box-shadow:
2175
- inset 0 1px 0 color-mix(in oklab, #fff 11%, transparent),
2176
- 0 20px 54px -28px color-mix(in oklab, var(--cf-accent) 72%, #000);
2177
- }
2178
- .cf-assistant-card__stage--local.is-listening {
2179
- border-color: color-mix(in oklab, var(--cf-accent) 62%, var(--cf-border));
2180
- }
2181
- .cf-assistant-card__stage--local.is-muted {
2182
- filter: saturate(0.72);
2183
- }
2184
- .cf-assistant-card__stage--local .cf-assistant-card__media {
2185
- z-index: 1;
2186
- border: 0;
2187
- background:
2188
- radial-gradient(circle at 50% 42%, color-mix(in oklab, var(--cf-accent) 18%, transparent), transparent 38%),
2189
- color-mix(in oklab, var(--cf-bg) 92%, var(--cf-surface));
2190
- }
2191
- .cf-assistant-card__media--uploaded::after {
2192
- content: '';
2193
- position: absolute;
2194
- inset: 0;
2195
- pointer-events: none;
2196
- background:
2197
- radial-gradient(circle at 50% 50%, transparent 28%, rgba(2, 6, 23, 0.08) 62%, rgba(2, 6, 23, 0.34) 100%),
2198
- linear-gradient(180deg, transparent 52%, rgba(2, 6, 23, 0.26));
2199
- }
2200
- .cf-assistant-card__media img,
2201
- .cf-assistant-card__media video {
2202
- width: 100%;
2203
- height: 100%;
2204
- display: block;
2205
- object-fit: cover;
2206
- }
2207
- .cf-avatar-aura {
2208
- position: absolute;
2209
- left: 50%;
2210
- top: 50%;
2211
- width: 104px;
2212
- height: 104px;
2213
- border-radius: 999px;
2214
- transform: translate(-50%, -50%) scale(0.88);
2215
- border: 1px solid color-mix(in oklab, var(--cf-accent) 42%, transparent);
2216
- opacity: 0;
2217
- pointer-events: none;
2218
- z-index: 3;
2219
- }
2220
- .cf-avatar-aura--two {
2221
- width: 142px;
2222
- height: 142px;
2223
- }
2224
- .cf-assistant-card__stage--local.is-speaking .cf-avatar-aura--one {
2225
- animation: cf-avatar-breathe 1.35s ease-in-out infinite;
2226
- }
2227
- .cf-assistant-card__stage--local.is-speaking .cf-avatar-aura--two {
2228
- animation: cf-avatar-breathe 1.35s ease-in-out infinite 0.32s;
2229
- }
2230
- .cf-avatar-listen-ring {
2231
- position: absolute;
2232
- left: 50%;
2233
- top: 50%;
2234
- width: calc(112px + (var(--cf-listen, 0.2) * 42px));
2235
- height: calc(112px + (var(--cf-listen, 0.2) * 42px));
2236
- border-radius: 999px;
2237
- transform: translate(-50%, -50%);
2238
- border: 2px solid color-mix(in oklab, var(--cf-accent) 58%, transparent);
2239
- box-shadow: 0 0 calc(14px + (var(--cf-listen, 0.2) * 24px)) color-mix(in oklab, var(--cf-accent) 34%, transparent);
2240
- opacity: 0;
2241
- pointer-events: none;
2242
- z-index: 4;
2243
- }
2244
- .cf-assistant-card__stage--local.is-listening .cf-avatar-listen-ring {
2245
- opacity: calc(0.36 + (var(--cf-listen, 0.2) * 0.42));
2246
- }
2247
- .cf-avatar-wave {
2248
- position: absolute;
2249
- left: 50%;
2250
- bottom: 46px;
2251
- z-index: 6;
2252
- display: inline-flex;
2253
- align-items: center;
2254
- justify-content: center;
2255
- gap: 4px;
2256
- min-width: 58px;
2257
- height: 25px;
2258
- padding: 5px 8px;
2259
- border-radius: 999px;
2260
- transform: translateX(-50%) translateY(8px);
2261
- background: color-mix(in oklab, var(--cf-bg) 82%, transparent);
2262
- border: 1px solid color-mix(in oklab, var(--cf-accent) 36%, transparent);
2263
- opacity: 0;
2264
- pointer-events: none;
2265
- backdrop-filter: blur(10px);
2266
- }
2267
- .cf-avatar-wave span {
2268
- width: 4px;
2269
- height: 8px;
2270
- border-radius: 999px;
2271
- background: color-mix(in oklab, var(--cf-accent) 88%, #fff);
2272
- transform-origin: center;
2273
- }
2274
- .cf-assistant-card__stage--local.is-speaking .cf-avatar-wave {
2275
- opacity: 1;
2276
- transform: translateX(-50%) translateY(0);
2277
- }
2278
- .cf-assistant-card__stage--local.is-speaking .cf-avatar-wave span {
2279
- animation: cf-avatar-wave 0.58s ease-in-out infinite;
2280
- }
2281
- .cf-assistant-card__stage--local.is-speaking .cf-avatar-wave span:nth-child(2) { animation-delay: 0.1s; }
2282
- .cf-assistant-card__stage--local.is-speaking .cf-avatar-wave span:nth-child(3) { animation-delay: 0.2s; }
2283
- .cf-assistant-card__stage--local.is-speaking .cf-avatar-wave span:nth-child(4) { animation-delay: 0.3s; }
2284
- .cf-assistant-card__stage--local.is-thinking .cf-assistant-card__media::before {
2285
- content: '';
2286
- position: absolute;
2287
- inset: -35%;
2288
- z-index: 5;
2289
- pointer-events: none;
2290
- background: linear-gradient(115deg, transparent 42%, color-mix(in oklab, var(--cf-accent) 20%, transparent) 50%, transparent 58%);
2291
- animation: cf-avatar-thinking 1.45s ease-in-out infinite;
2292
- }
2293
- .cf-assistant-card__avatar-stage {
2294
- position: absolute;
2295
- inset: 0;
2296
- display: grid;
2297
- place-items: center;
2298
- --cf-avatar-a: var(--cf-accent);
2299
- --cf-avatar-b: color-mix(in oklab, var(--cf-accent) 70%, #0f1f2e);
2300
- --cf-avatar-glow: color-mix(in oklab, var(--cf-accent) 38%, transparent);
2301
- background:
2302
- radial-gradient(circle at 35% 30%, var(--cf-avatar-glow), transparent 32%),
2303
- linear-gradient(145deg, color-mix(in oklab, var(--cf-avatar-a) 18%, var(--cf-bg)), var(--cf-surface-2));
2304
- }
2305
- .cf-assistant-card__face {
2306
- position: relative;
2307
- width: 128px;
2308
- height: 128px;
2309
- border-radius: 999px;
2310
- display: grid;
2311
- place-items: center;
2312
- color: #fff;
2313
- background: linear-gradient(145deg, var(--cf-avatar-a), var(--cf-avatar-b));
2314
- box-shadow: 0 22px 44px -28px rgba(0, 0, 0, 0.75);
2315
- z-index: 2;
2316
- }
2317
- .cf-assistant-card__stage--local.is-speaking .cf-assistant-card__face {
2318
- animation: cf-avatar-nod 1.6s ease-in-out infinite;
2319
- }
2320
- .cf-assistant-card__stage--local.is-listening .cf-assistant-card__face {
2321
- box-shadow:
2322
- 0 22px 44px -28px rgba(0, 0, 0, 0.75),
2323
- 0 0 0 calc(5px + (var(--cf-listen, 0.2) * 6px)) color-mix(in oklab, var(--cf-accent) 16%, transparent);
2324
- }
2325
- .cf-assistant-card--pinned .cf-assistant-card__face {
2326
- width: 72px;
2327
- height: 72px;
2328
- }
2329
- .cf-avatar-preset--support-guide {
2330
- --cf-avatar-a: #10b981;
2331
- --cf-avatar-b: #0f766e;
2332
- --cf-avatar-glow: rgba(16, 185, 129, 0.34);
2333
- }
2334
- .cf-avatar-preset--sales-host {
2335
- --cf-avatar-a: #3b82f6;
2336
- --cf-avatar-b: #4338ca;
2337
- --cf-avatar-glow: rgba(59, 130, 246, 0.34);
2338
- }
2339
- .cf-avatar-preset--calm-advisor {
2340
- --cf-avatar-a: #64748b;
2341
- --cf-avatar-b: #0f172a;
2342
- --cf-avatar-glow: rgba(100, 116, 139, 0.34);
2343
- }
2344
- .cf-avatar-preset--technical-guide {
2345
- --cf-avatar-a: #06b6d4;
2346
- --cf-avatar-b: #1d4ed8;
2347
- --cf-avatar-glow: rgba(6, 182, 212, 0.34);
2348
- }
2349
- .cf-avatar-preset--school-desk {
2350
- --cf-avatar-a: #8b5cf6;
2351
- --cf-avatar-b: #6d28d9;
2352
- --cf-avatar-glow: rgba(139, 92, 246, 0.34);
2353
- }
2354
- .cf-avatar-preset--front-office {
2355
- --cf-avatar-a: #f59e0b;
2356
- --cf-avatar-b: #c2410c;
2357
- --cf-avatar-glow: rgba(245, 158, 11, 0.34);
2358
- }
2359
- .cf-assistant-card__initials {
2360
- transform: translateY(-12px);
2361
- font-size: 34px;
2362
- font-weight: 800;
2363
- }
2364
- .cf-assistant-card--pinned .cf-assistant-card__initials {
2365
- transform: translateY(-6px);
2366
- font-size: 19px;
2367
- }
2368
- .cf-assistant-card__eye {
2369
- position: absolute;
2370
- top: 58px;
2371
- width: 8px;
2372
- height: 8px;
2373
- border-radius: 999px;
2374
- background: rgba(255, 255, 255, 0.9);
2375
- }
2376
- .cf-assistant-card__eye--left { left: 42px; }
2377
- .cf-assistant-card__eye--right { right: 42px; }
2378
- .cf-assistant-card--pinned .cf-assistant-card__eye {
2379
- top: 33px;
2380
- width: 5px;
2381
- height: 5px;
2382
- }
2383
- .cf-assistant-card--pinned .cf-assistant-card__eye--left { left: 23px; }
2384
- .cf-assistant-card--pinned .cf-assistant-card__eye--right { right: 23px; }
2385
- .cf-assistant-card__mouth {
2386
- position: absolute;
2387
- left: 50%;
2388
- bottom: 31px;
2389
- width: 34px;
2390
- height: 6px;
2391
- transform: translateX(-50%);
2392
- border-radius: 999px;
2393
- background: rgba(255, 255, 255, 0.9);
2394
- }
2395
- .cf-assistant-card--pinned .cf-assistant-card__mouth {
2396
- bottom: 18px;
2397
- width: 20px;
2398
- height: 4px;
2399
- }
2400
- .cf-assistant-card.is-speaking .cf-assistant-card__mouth {
2401
- animation: cf-mouth-talk 0.24s ease-in-out infinite alternate;
2402
- }
2403
- .cf-assistant-card__stage--local.is-speaking .cf-assistant-card__mouth {
2404
- animation: cf-mouth-talk 0.24s ease-in-out infinite alternate;
2405
- }
2406
- .cf-assistant-card__mouth--overlay {
2407
- z-index: 6;
2408
- bottom: 39px;
2409
- width: 42px;
2410
- height: 7px;
2411
- opacity: 0;
2412
- background: color-mix(in oklab, #fff 90%, var(--cf-accent));
2413
- box-shadow:
2414
- 0 0 0 4px rgba(2, 6, 23, 0.22),
2415
- 0 10px 22px -10px rgba(0, 0, 0, 0.85);
2416
- }
2417
- .cf-assistant-card__stage--local.is-speaking .cf-assistant-card__mouth--overlay {
2418
- opacity: 1;
2419
- }
2420
- .cf-assistant-card--pinned .cf-assistant-card__mouth--overlay {
2421
- bottom: 42px;
2422
- }
2423
- @keyframes cf-mouth-talk {
2424
- from { height: 5px; width: 28px; border-radius: 999px; }
2425
- to { height: 20px; width: 22px; border-radius: 45% 45% 55% 55%; }
2426
- }
2427
- @keyframes cf-avatar-breathe {
2428
- 0%, 100% { opacity: 0.16; transform: translate(-50%, -50%) scale(0.82); }
2429
- 50% { opacity: 0.58; transform: translate(-50%, -50%) scale(1.12); }
2430
- }
2431
- @keyframes cf-avatar-wave {
2432
- 0%, 100% { transform: scaleY(0.62); opacity: 0.72; }
2433
- 50% { transform: scaleY(1.85); opacity: 1; }
2434
- }
2435
- @keyframes cf-avatar-thinking {
2436
- 0% { transform: translateX(-18%); opacity: 0; }
2437
- 38% { opacity: 1; }
2438
- 100% { transform: translateX(18%); opacity: 0; }
2439
- }
2440
- @keyframes cf-avatar-nod {
2441
- 0%, 100% { transform: translateY(0) scale(1); }
2442
- 45% { transform: translateY(-2px) scale(1.012); }
2443
- }
2444
- .cf-assistant-card__speak {
2445
- position: absolute;
2446
- left: 50%;
2447
- bottom: 12px;
2448
- transform: translateX(-50%);
2449
- display: inline-flex;
2450
- align-items: center;
2451
- gap: 7px;
2452
- max-width: calc(100% - 24px);
2453
- padding: 8px 12px;
2454
- border-radius: 999px;
2455
- background: color-mix(in oklab, var(--cf-bg) 92%, transparent);
2456
- color: var(--cf-accent);
2457
- box-shadow: 0 10px 22px -14px rgba(15, 30, 42, 0.6);
2458
- font-size: 12.5px;
2459
- font-weight: 700;
2460
- white-space: nowrap;
2461
- }
2462
- .cf-assistant-card--pinned .cf-assistant-card__speak {
2463
- padding: 6px 10px;
2464
- font-size: 11.5px;
2465
- }
2466
- .cf-assistant-card__speak svg { width: 15px; height: 15px; }
2467
- .cf-assistant-card__voice-only .cf-assistant-card__speak,
2468
- .cf-assistant-card__voice-only .cf-call-controls {
2469
- position: static;
2470
- transform: none;
2471
- max-width: 100%;
2472
- }
2473
- .cf-assistant-card--connecting {
2474
- min-height: 100%;
2475
- display: grid;
2476
- place-items: center;
2477
- align-content: center;
2478
- gap: 18px;
2479
- padding: 34px 24px 42px;
2480
- text-align: center;
2481
- border-top: 1px solid var(--cf-border);
2482
- background:
2483
- radial-gradient(circle at 50% 38%, color-mix(in oklab, var(--cf-accent) 16%, transparent), transparent 36%),
2484
- linear-gradient(180deg, color-mix(in oklab, var(--cf-surface) 72%, var(--cf-bg)), var(--cf-bg));
2485
- }
2486
- .cf-assistant-card__connecting-avatar {
2487
- position: relative;
2488
- width: 118px;
2489
- height: 118px;
2490
- display: grid;
2491
- place-items: center;
2492
- }
2493
- .cf-assistant-card__connecting-avatar img,
2494
- .cf-assistant-card__connecting-face {
2495
- width: 92px;
2496
- height: 92px;
2497
- border-radius: 999px;
2498
- display: grid;
2499
- place-items: center;
2500
- object-fit: cover;
2501
- color: #fff;
2502
- font-size: 28px;
2503
- font-weight: 850;
2504
- letter-spacing: -0.04em;
2505
- background: linear-gradient(145deg, var(--cf-accent), var(--cf-accent-2));
2506
- border: 1px solid color-mix(in oklab, #fff 30%, transparent);
2507
- box-shadow:
2508
- 0 22px 48px -24px color-mix(in oklab, var(--cf-accent) 60%, #000),
2509
- 0 0 0 8px color-mix(in oklab, var(--cf-accent) 10%, transparent);
2510
- z-index: 2;
2511
- }
2512
- .cf-assistant-card__connecting-copy {
2513
- display: grid;
2514
- gap: 6px;
2515
- }
2516
- .cf-assistant-card__connecting-eyebrow {
2517
- color: var(--cf-muted);
2518
- font-size: 11px;
2519
- font-weight: 800;
2520
- letter-spacing: 0.12em;
2521
- text-transform: uppercase;
2522
- }
2523
- .cf-assistant-card__connecting-copy strong {
2524
- color: var(--cf-text);
2525
- font-size: 18px;
2526
- line-height: 1.25;
2527
- }
2528
- .cf-assistant-card--connecting .cf-call-ripple {
2529
- inset: -18px;
2530
- border-radius: 999px;
2531
- }
2532
- .cf-assistant-card--connecting .cf-call-ripple span {
2533
- width: 92px;
2534
- height: 92px;
2535
- }
2536
-
2537
- /* ---------- Call "working" ripple ----------
2538
- Concentric rings pulsing out from the avatar's center while the call is
2539
- connecting / transcribing / waiting for the reply — the classic "ringing
2540
- call" cue, so busy moments read as live activity instead of a freeze. */
2541
- .cf-call-ripple {
2542
- position: absolute;
2543
- inset: 0;
2544
- display: grid;
2545
- place-items: center;
2546
- pointer-events: none;
2547
- overflow: hidden;
2548
- border-radius: inherit;
2549
- }
2550
- .cf-call-ripple span {
2551
- position: absolute;
2552
- width: 74px;
2553
- height: 74px;
2554
- border-radius: 999px;
2555
- border: 2px solid var(--cf-accent);
2556
- opacity: 0;
2557
- animation: cf-call-ripple 1.8s ease-out infinite;
2558
- }
2559
- .cf-call-ripple span:nth-child(2) { animation-delay: 0.6s; }
2560
- .cf-call-ripple span:nth-child(3) { animation-delay: 1.2s; }
2561
- @keyframes cf-call-ripple {
2562
- 0% { transform: scale(0.9); opacity: 0.55; }
2563
- 100% { transform: scale(2.6); opacity: 0; }
2564
- }
2565
- @media (prefers-reduced-motion: reduce) {
2566
- .cf-call-ripple span { animation: none; opacity: 0.25; transform: scale(1.4); }
2567
- .cf-call-ripple span:nth-child(2), .cf-call-ripple span:nth-child(3) { display: none; }
2568
- }
2569
-
2570
- /* ---------- In-call controls (mic / audio picker / expand / minimize / end) ---------- */
2571
- .cf-call-controls {
2572
- position: absolute;
2573
- left: 50%;
2574
- bottom: 12px;
2575
- transform: translateX(-50%);
2576
- display: inline-flex;
2577
- align-items: center;
2578
- gap: 4px;
2579
- max-width: calc(100% - 24px);
2580
- padding: 5px 7px;
2581
- border-radius: 999px;
2582
- background: color-mix(in oklab, var(--cf-bg) 94%, transparent);
2583
- border: 1px solid color-mix(in oklab, var(--cf-border) 72%, transparent);
2584
- box-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.7);
2585
- z-index: 30;
2586
- }
2587
- .cf-call-status,
2588
- .cf-floating-call-card__status {
2589
- position: absolute;
2590
- top: 10px;
2591
- left: 50%;
2592
- transform: translateX(-50%);
2593
- z-index: 30;
2594
- width: max-content;
2595
- max-width: calc(100% - 24px);
2596
- padding: 5px 9px;
2597
- border-radius: 6px;
2598
- background: color-mix(in oklab, var(--cf-bg) 94%, transparent);
2599
- color: var(--cf-text);
2600
- font-size: 11px;
2601
- font-weight: 600;
2602
- line-height: 1.3;
2603
- text-align: center;
2604
- pointer-events: none;
2605
- }
2606
- .cf-assistant-card--pinned .cf-call-controls { padding: 4px 6px; gap: 4px; }
2607
- .cf-call-btn {
2608
- position: relative;
2609
- flex-shrink: 0;
2610
- width: 30px;
2611
- height: 30px;
2612
- border-radius: 999px;
2613
- display: inline-flex;
2614
- align-items: center;
2615
- justify-content: center;
2616
- gap: 6px;
2617
- color: var(--cf-text);
2618
- background: color-mix(in oklab, var(--cf-surface) 88%, transparent);
2619
- border: 1px solid color-mix(in oklab, var(--cf-border) 76%, transparent);
2620
- transition: background 0.15s ease, transform 0.12s ease, color 0.15s ease;
2621
- }
2622
- .cf-call-btn:hover { background: color-mix(in oklab, var(--cf-accent) 10%, var(--cf-surface)); }
2623
- .cf-call-btn:active { transform: scale(0.94); }
2624
- .cf-call-btn svg { width: 14px; height: 14px; }
2625
- .cf-call-btn--microphones {
2626
- width: 24px;
2627
- margin-left: -5px;
2628
- border-top-left-radius: 10px;
2629
- border-bottom-left-radius: 10px;
2630
- }
2631
- .cf-call-btn--microphones svg { width: 13px; height: 13px; }
2632
- .cf-call-btn--restore svg { width: 15px; height: 15px; }
2633
- .cf-call-btn.is-muted {
2634
- color: #fff;
2635
- background: var(--cf-muted);
2636
- border-color: transparent;
2637
- }
2638
- /* Live-listening cue: a soft ring around the mic button that breathes with
2639
- the mic level, instead of a separate waveform element eating up row width. */
2640
- .cf-call-btn.is-listening::after {
2641
- content: '';
2642
- position: absolute;
2643
- inset: -4px;
2644
- border-radius: inherit;
2645
- border: 2px solid var(--cf-accent);
2646
- opacity: calc(0.25 + var(--cf-wave, 0.2) * 0.5);
2647
- transform: scale(calc(1 + var(--cf-wave, 0.2) * 0.22));
2648
- transition: transform 0.09s ease, opacity 0.09s ease;
2649
- pointer-events: none;
2650
- }
2651
- /* Your voice is actually registering: the mic fills with the accent color
2652
- and the ring flares, so "it hears me" is unmistakable at a glance. */
2653
- .cf-call-btn.is-listening.is-hot {
2654
- color: var(--cf-accent-ink);
2655
- background: var(--cf-accent);
2656
- border-color: transparent;
2657
- }
2658
- .cf-call-btn.is-listening.is-hot::after {
2659
- border-width: 3px;
2660
- opacity: calc(0.5 + var(--cf-wave, 0.2) * 0.5);
2661
- transform: scale(calc(1.08 + var(--cf-wave, 0.2) * 0.35));
2662
- box-shadow: 0 0 12px 2px color-mix(in oklab, var(--cf-accent) 55%, transparent);
2663
- }
2664
- .cf-call-btn--talk {
2665
- color: var(--cf-accent-ink);
2666
- background: var(--cf-accent);
2667
- border-color: transparent;
2668
- }
2669
- .cf-call-btn--end {
2670
- color: #fff;
2671
- background: #e5484d;
2672
- border-color: transparent;
2673
- }
2674
- .cf-call-btn--end:hover { background: #dc3d42; }
2675
- /* Microphone selector popover. */
2676
- .cf-call-more { position: static; display: inline-flex; z-index: 40; }
2677
- .cf-call-menu {
2678
- position: absolute;
2679
- top: calc(100% + 8px);
2680
- bottom: auto;
2681
- left: 50%;
2682
- transform: translateX(-50%);
2683
- display: flex;
2684
- flex-direction: column;
2685
- gap: 2px;
2686
- width: min(240px, calc(var(--cf-panel-w, 388px) - 72px), calc(100vw - 64px));
2687
- min-width: 0;
2688
- max-width: calc(100vw - 64px);
2689
- max-height: min(300px, calc(100vh - 220px));
2690
- overflow-y: auto;
2691
- padding: 8px;
2692
- border-radius: 14px;
2693
- background: color-mix(in oklab, var(--cf-bg) 98%, #000);
2694
- border: 1px solid color-mix(in oklab, var(--cf-border) 74%, transparent);
2695
- box-shadow: 0 18px 45px -20px rgba(0, 0, 0, 0.78);
2696
- z-index: 60;
2697
- }
2698
- .cf-call-menu.cf-call-menu--up {
2699
- top: auto;
2700
- bottom: calc(100% + 8px);
2701
- }
2702
- .cf-call-menu__label {
2703
- margin: 8px 8px 4px;
2704
- color: var(--cf-muted);
2705
- font-size: 11px;
2706
- font-weight: 700;
2707
- text-transform: uppercase;
2708
- letter-spacing: 0.08em;
2709
- }
2710
- .cf-call-menu__item {
2711
- display: flex;
2712
- align-items: center;
2713
- gap: 8px;
2714
- min-width: 0;
2715
- padding: 8px 9px;
2716
- border-radius: 10px;
2717
- color: var(--cf-text);
2718
- font-size: 12.5px;
2719
- text-align: left;
2720
- white-space: nowrap;
2721
- overflow: hidden;
2722
- }
2723
- .cf-call-menu__item span:last-child {
2724
- min-width: 0;
2725
- overflow: hidden;
2726
- text-overflow: ellipsis;
2727
- }
2728
- .cf-call-menu__item:hover { background: color-mix(in oklab, var(--cf-accent) 12%, var(--cf-surface)); }
2729
- .cf-call-menu__item.is-active { color: var(--cf-accent); font-weight: 600; }
2730
- .cf-call-menu__item svg { width: 13px; height: 13px; flex-shrink: 0; }
2731
- .cf-call-menu__spacer { width: 13px; flex-shrink: 0; }
2732
- /* Detached floating avatar card — replaces the launcher while a call runs minimized. */
2733
- .cf-floating-call-card {
2734
- position: fixed;
2735
- bottom: var(--cf-v-pad, 20px);
2736
- right: var(--cf-h-pad, 20px);
2737
- z-index: 1;
2738
- pointer-events: auto;
2739
- width: min(340px, calc(100vw - 32px));
2740
- aspect-ratio: 16 / 9;
2741
- overflow: hidden;
2742
- border-radius: 14px;
2743
- background: var(--cf-bg);
2744
- border: 1px solid color-mix(in oklab, var(--cf-border) 74%, transparent);
2745
- box-shadow: 0 20px 48px -20px rgba(0, 0, 0, 0.72);
2746
- animation: cf-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
2747
- }
2748
- .cf-root[data-align='left'] .cf-floating-call-card { right: auto; left: var(--cf-h-pad, 20px); }
2749
- .cf-floating-call-card__media,
2750
- .cf-floating-call-card__shade {
2751
- position: absolute;
2752
- inset: 0;
2753
- }
2754
- .cf-floating-call-card__media img,
2755
- .cf-floating-call-card__media video {
2756
- width: 100%;
2757
- height: 100%;
2758
- object-fit: cover;
2759
- }
2760
- .cf-floating-call-card__shade {
2761
- background:
2762
- linear-gradient(to bottom, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.18)),
2763
- radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.08), transparent 42%);
2764
- pointer-events: none;
2765
- }
2766
- .cf-floating-call-card__status { top: 12px; }
2767
- .cf-floating-call-card__avatar {
2768
- position: absolute;
2769
- inset: 0;
2770
- display: flex;
2771
- align-items: center;
2772
- justify-content: center;
2773
- color: #fff;
2774
- background: linear-gradient(145deg, var(--cf-accent), var(--cf-accent-2));
2775
- }
2776
- .cf-floating-call-card.is-muted {
2777
- filter: saturate(0.72);
2778
- }
2779
- .cf-floating-call-card.is-listening {
2780
- border-color: color-mix(in oklab, var(--cf-accent) 62%, var(--cf-border));
2781
- box-shadow:
2782
- 0 20px 48px -20px rgba(0, 0, 0, 0.72),
2783
- 0 0 calc(12px + (var(--cf-listen, 0.2) * 18px)) color-mix(in oklab, var(--cf-accent) 28%, transparent);
2784
- }
2785
- .cf-floating-call-card.is-thinking .cf-floating-call-card__shade::before {
2786
- content: '';
2787
- position: absolute;
2788
- inset: -45%;
2789
- background: linear-gradient(115deg, transparent 42%, color-mix(in oklab, var(--cf-accent) 22%, transparent) 50%, transparent 58%);
2790
- animation: cf-avatar-thinking 1.45s ease-in-out infinite;
2791
- }
2792
- .cf-floating-call-card.is-speaking .cf-floating-call-card__avatar,
2793
- .cf-floating-call-card.is-speaking .cf-floating-call-card__media img {
2794
- animation: cf-avatar-nod 1.6s ease-in-out infinite;
2795
- }
2796
- .cf-floating-call-card__avatar > span:first-child {
2797
- font-size: clamp(64px, 22vw, 118px);
2798
- font-weight: 800;
2799
- line-height: 1;
2800
- }
2801
- .cf-floating-call-card__eye,
2802
- .cf-floating-call-card__mouth {
2803
- position: absolute;
2804
- background: rgba(255, 255, 255, 0.9);
2805
- }
2806
- .cf-floating-call-card__eye {
2807
- top: 37%;
2808
- width: 8px;
2809
- height: 8px;
2810
- border-radius: 999px;
2811
- }
2812
- .cf-floating-call-card__eye--left { left: 38%; }
2813
- .cf-floating-call-card__eye--right { right: 38%; }
2814
- .cf-floating-call-card__mouth {
2815
- bottom: 31%;
2816
- width: 34px;
2817
- height: 6px;
2818
- border-radius: 999px;
2819
- }
2820
- .cf-floating-call-card.is-speaking .cf-floating-call-card__mouth {
2821
- animation: cf-mouth-talk 0.24s ease-in-out infinite alternate;
2822
- }
2823
- .cf-floating-call-card__controls {
2824
- position: absolute;
2825
- left: 50%;
2826
- bottom: 12px;
2827
- transform: translateX(-50%);
2828
- display: inline-flex;
2829
- align-items: center;
2830
- gap: 4px;
2831
- padding: 5px 7px;
2832
- border-radius: 999px;
2833
- background: color-mix(in oklab, var(--cf-bg) 92%, transparent);
2834
- border: 1px solid color-mix(in oklab, var(--cf-border) 70%, transparent);
2835
- box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.74);
2836
- }
2837
- .cf-assistant-card__copy {
2838
- margin: 0;
2839
- color: var(--cf-text);
2840
- font-size: 14px;
2841
- line-height: 1.55;
2842
- }
2843
- .cf-assistant-card__chips {
2844
- display: flex;
2845
- flex-wrap: wrap;
2846
- gap: 7px;
2847
- }
2848
- .cf-assistant-card__chip {
2849
- max-width: 100%;
2850
- border-radius: 6px;
2851
- padding: 7px 9px;
2852
- background: color-mix(in oklab, var(--cf-accent) 12%, var(--cf-bg));
2853
- color: var(--cf-accent);
2854
- font-size: 12.5px;
2855
- line-height: 1.2;
2856
- }
2857
- .cf-assistant-card__chip:hover { background: color-mix(in oklab, var(--cf-accent) 18%, var(--cf-bg)); }
2858
- .cf-assistant-card__privacy {
2859
- margin: -2px 0 0;
2860
- color: var(--cf-muted);
2861
- font-size: 10.5px;
2862
- line-height: 1.4;
2863
- text-align: center;
2864
- }
2865
- .cf-assistant-card__privacy a {
2866
- color: var(--cf-muted);
2867
- text-decoration: underline;
2868
- text-underline-offset: 2px;
2869
- }
2870
-
2871
- /* Offline presence dot (amber instead of green). */
2872
- .cf-header__status--offline::before { background: #e2c07e; box-shadow: 0 0 0 2px rgba(226, 192, 126, 0.3); }
2873
-
2874
- /* Disclaimer fine-print under the composer. */
2875
- .cf-disclaimer { padding: 0 16px 2px; font-size: 10.5px; line-height: 1.45; color: var(--cf-muted); text-align: center; }
2876
-
2877
- /* Read-only banner shown while viewing a past conversation. */
2878
- .cf-viewing-banner {
2879
- padding: 7px 16px;
2880
- font-size: 12px;
2881
- font-weight: 600;
2882
- text-align: center;
2883
- color: var(--cf-muted);
2884
- background: var(--cf-surface);
2885
- border-bottom: 1px solid var(--cf-border);
2886
- flex-shrink: 0;
2887
- }
2888
-
2889
- /* Past-conversations history panel (over the chat, like the confirm dialog). */
2890
- .cf-history {
2891
- width: min(340px, 90%);
2892
- max-height: 70%;
2893
- display: flex;
2894
- flex-direction: column;
2895
- background: var(--cf-bg);
2896
- border-radius: 14px;
2897
- box-shadow: var(--cf-shadow);
2898
- overflow: hidden;
2899
- }
2900
- .cf-history__head {
2901
- display: flex;
2902
- align-items: center;
2903
- justify-content: space-between;
2904
- padding: 12px 14px;
2905
- font-size: 14px;
2906
- font-weight: 700;
2907
- color: var(--cf-text);
2908
- border-bottom: 1px solid var(--cf-border);
2909
- }
2910
- .cf-history__list { overflow-y: auto; padding: 6px; }
2911
- .cf-history__item {
2912
- display: flex;
2913
- flex-direction: column;
2914
- gap: 2px;
2915
- width: 100%;
2916
- text-align: left;
2917
- padding: 9px 10px;
2918
- border-radius: 9px;
2919
- cursor: pointer;
2920
- transition: background 0.15s ease;
2921
- }
2922
- .cf-history__item:hover { background: var(--cf-surface); }
2923
- .cf-history__item.is-active { background: var(--cf-surface); }
2924
- .cf-history__title { font-size: 13px; color: var(--cf-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
2925
- .cf-history__meta { font-size: 11px; color: var(--cf-muted); }
2926
-
2927
- /* Ended-conversation bar — replaces the composer once the chat is closed. */
2928
- .cf-ended {
2929
- display: flex;
2930
- flex-direction: column;
2931
- align-items: center;
2932
- gap: 10px;
2933
- padding: 14px 16px 16px;
2934
- flex-shrink: 0;
2935
- text-align: center;
2936
- }
2937
- .cf-ended__text { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--cf-muted); }
2938
- .cf-csat { display: inline-flex; align-items: center; gap: 8px; }
2939
- .cf-csat__q { font-size: 12.5px; color: var(--cf-muted); }
2940
- .cf-csat__btn {
2941
- display: inline-flex;
2942
- align-items: center;
2943
- justify-content: center;
2944
- width: 30px;
2945
- height: 30px;
2946
- border-radius: 8px;
2947
- color: var(--cf-muted);
2948
- cursor: pointer;
2949
- transition: background 0.15s ease, color 0.15s ease;
2950
- }
2951
- .cf-csat__btn:hover { background: var(--cf-surface); color: var(--cf-accent); }
2952
- .cf-csat__btn svg { width: 16px; height: 16px; }
2953
- .cf-ended__btn {
2954
- font-size: 13px;
2955
- font-weight: 600;
2956
- color: var(--cf-accent-ink);
2957
- background: var(--cf-accent);
2958
- border: none;
2959
- border-radius: 999px;
2960
- padding: 9px 18px;
2961
- cursor: pointer;
2962
- transition: opacity 0.15s ease;
2963
- }
2964
- .cf-ended__btn:hover { opacity: 0.9; }
2965
- .cf-ended__btn:focus-visible { outline: 2px solid var(--cf-accent); outline-offset: 2px; }
2966
-
2967
- /* "↓ New messages" pill — shown when a reply streams in while scrolled up. */
2968
- .cf-newmsg {
2969
- /* Sticky inside the scroll body: pins to the bottom of the visible thread,
2970
- just above the composer (never overlapping it). Horizontal centering via
2971
- align-self so it doesn't fight the entrance animation's transform. */
2972
- position: sticky;
2973
- bottom: 10px;
2974
- align-self: center;
2975
- z-index: 3;
2976
- pointer-events: auto;
2977
- display: inline-flex;
2978
- align-items: center;
2979
- gap: 6px;
2980
- font-size: 12.5px;
2981
- font-weight: 600;
2982
- color: var(--cf-accent-ink);
2983
- background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
2984
- border-radius: 999px;
2985
- padding: 7px 14px;
2986
- box-shadow: var(--cf-shadow);
2987
- animation: cf-msg-in 0.2s ease both;
2988
- }
2989
- .cf-newmsg svg { width: 14px; height: 14px; }
2990
-
2991
- /* ---------- Clear-chat confirm dialog (in-widget, replaces window.confirm) ---------- */
2992
- .cf-confirm {
2993
- position: absolute;
2994
- inset: 0;
2995
- z-index: 6;
2996
- pointer-events: auto;
2997
- display: grid;
2998
- place-items: center;
2999
- padding: 22px;
3000
- background: color-mix(in oklab, var(--cf-bg) 62%, transparent);
3001
- backdrop-filter: blur(2px);
3002
- animation: cf-fade-in 0.14s ease both;
3003
- }
3004
- .cf-confirm__card {
3005
- width: 100%;
3006
- max-width: 300px;
3007
- background: var(--cf-bg);
3008
- border: 1px solid var(--cf-border);
3009
- border-radius: 16px;
3010
- box-shadow: var(--cf-shadow);
3011
- padding: 18px;
3012
- text-align: center;
3013
- animation: cf-msg-in 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
3014
- }
3015
- .cf-confirm__title { font-size: 15px; font-weight: 700; color: var(--cf-text); }
3016
- .cf-confirm__body { margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--cf-muted); }
3017
- .cf-confirm__actions { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }
3018
- .cf-confirm__btn {
3019
- padding: 9px 16px;
3020
- border-radius: 10px;
3021
- font-size: 13.5px;
3022
- font-weight: 600;
3023
- transition: transform 0.1s ease, opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
3024
- }
3025
- .cf-confirm__btn:active { transform: scale(0.97); }
3026
- .cf-confirm__btn:focus-visible { outline: 2px solid var(--cf-accent-2); outline-offset: 2px; }
3027
- .cf-confirm__btn--cancel { background: var(--cf-surface); color: var(--cf-text); border: 1px solid var(--cf-border); }
3028
- .cf-confirm__btn--cancel:hover { border-color: var(--cf-accent); }
3029
- .cf-confirm__btn--danger { background: #f25767; color: #fff; }
3030
- .cf-confirm__btn--danger:hover { opacity: 0.9; }
3031
-
3032
- /* Visually-hidden live region (announces the final answer only). */
3033
- .cf-sr-live {
3034
- position: absolute;
3035
- width: 1px;
3036
- height: 1px;
3037
- padding: 0;
3038
- margin: -1px;
3039
- overflow: hidden;
3040
- clip: rect(0 0 0 0);
3041
- white-space: nowrap;
3042
- border: 0;
3043
- }
3044
-
3045
- /* ---------- Attachments ---------- */
3046
- .cf-file-input { display: none; }
3047
- .cf-iconbtn:disabled { opacity: 0.4; cursor: default; }
3048
- .cf-attach-row {
3049
- display: flex;
3050
- align-items: center;
3051
- gap: 6px;
3052
- padding: 0 4px 8px;
3053
- overflow-x: auto;
3054
- overscroll-behavior-x: contain;
3055
- scroll-snap-type: x proximity;
3056
- scrollbar-width: thin;
3057
- }
3058
- .cf-attach-row > * { flex-shrink: 0; scroll-snap-align: start; }
3059
- .cf-attach-row .cf-attach-chip { max-width: 220px; }
3060
- .cf-attach-row .cf-attach-status { white-space: nowrap; }
3061
- .cf-attach-status { font-size: 12px; color: var(--cf-muted); }
3062
- .cf-attach-status--err { color: #f25767; }
3063
- .cf-attach-chip {
3064
- display: inline-flex;
3065
- align-items: center;
3066
- gap: 6px;
3067
- max-width: 100%;
3068
- padding: 5px 6px 5px 10px;
3069
- border-radius: 999px;
3070
- background: var(--cf-surface-2);
3071
- border: 1px solid var(--cf-border);
3072
- color: var(--cf-text);
3073
- font-size: 12px;
3074
- }
3075
- .cf-attach-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3076
- .cf-attach-chip svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--cf-muted); }
3077
- .cf-attach-row--sent { max-width: 100%; margin-top: 6px; padding: 0 0 2px; }
3078
- /* Right-aligned without justify-content, so overflowing chips stay scrollable. */
3079
- .cf-attach-row--sent > :first-child { margin-left: auto; }
3080
- .cf-attach-chip--open { cursor: pointer; font: inherit; text-align: left; }
3081
- .cf-attach-chip--open:hover, .cf-attach-open:hover:not(:disabled) { border-color: var(--cf-accent); color: var(--cf-accent); }
3082
- .cf-attach-chip--open:focus-visible, .cf-attach-open:focus-visible { outline: 2px solid var(--cf-accent); outline-offset: 2px; }
3083
- .cf-attach-open { display: inline-flex; min-width: 0; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 6px; }
3084
- .cf-attach-open:disabled { cursor: default; }
3085
- .cf-preview { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: color-mix(in oklab, #000 55%, transparent); }
3086
- .cf-preview__frame { display: flex; flex-direction: column; width: 100%; max-width: 720px; height: 100%; max-height: 640px; overflow: hidden; border-radius: 12px; background: var(--cf-surface); border: 1px solid var(--cf-border); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35); }
3087
- .cf-preview__bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--cf-border); }
3088
- .cf-preview__name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--cf-text); }
3089
- .cf-preview__btn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--cf-border); background: var(--cf-surface-2); color: var(--cf-text); font: inherit; font-size: 12px; text-decoration: none; cursor: pointer; }
3090
- .cf-preview__btn:hover { border-color: var(--cf-accent); color: var(--cf-accent); }
3091
- .cf-preview__btn:focus-visible { outline: 2px solid var(--cf-accent); outline-offset: 2px; }
3092
- .cf-preview__close { padding: 0; width: 32px; }
3093
- .cf-preview__body { display: grid; flex: 1; min-height: 0; place-items: center; overflow: auto; background: var(--cf-surface-2); }
3094
- .cf-preview__image { max-width: 100%; max-height: 100%; object-fit: contain; }
3095
- .cf-preview__pdf { width: 100%; height: 100%; border: 0; background: #fff; }
3096
- .cf-preview__note { margin: 0; padding: 24px; color: var(--cf-muted); font-size: 13px; text-align: center; }
3097
- .cf-attach-x { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--cf-muted); flex-shrink: 0; }
3098
- .cf-attach-x:hover { background: var(--cf-surface); color: var(--cf-text); }
3099
- .cf-attach-x svg { width: 11px; height: 11px; }
3100
-
3101
- /* ---------- Keyframes ---------- */
3102
- @keyframes cf-pop {
3103
- from { transform: scale(0); opacity: 0; }
3104
- to { transform: scale(1); opacity: 1; }
3105
- }
3106
- @keyframes cf-badge-pop {
3107
- from { transform: scale(0); }
3108
- to { transform: scale(1); }
3109
- }
3110
- @keyframes cf-msg-in {
3111
- from { opacity: 0; transform: translateY(8px); }
3112
- to { opacity: 1; transform: none; }
3113
- }
3114
- @keyframes cf-fade-in {
3115
- from { opacity: 0; }
3116
- to { opacity: 1; }
3117
- }
3118
- @keyframes cf-typing {
3119
- 0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
3120
- 40% { opacity: 1; transform: translateY(-4px); }
3121
- }
3122
- @keyframes cf-pulse {
3123
- 0%, 100% { opacity: 1; }
3124
- 50% { opacity: 0.4; }
3125
- }
3126
-
3127
- @media (prefers-reduced-motion: reduce) {
3128
- .cf-root *, .cf-root *::before, .cf-root *::after {
3129
- animation-duration: 0.01ms !important;
3130
- animation-iteration-count: 1 !important;
3131
- transition-duration: 0.01ms !important;
3132
- scroll-behavior: auto !important;
3133
- }
3134
- }
3135
- .cf-analytics-table-wrap {
3136
- box-sizing: border-box;
3137
- width: 100%;
3138
- max-width: 100%;
3139
- margin-top: 9px;
3140
- max-height: 210px;
3141
- overflow: auto;
3142
- border: 1px solid var(--cf-border);
3143
- border-radius: 9px;
3144
- scrollbar-width: thin;
3145
- }
3146
- .cf-analytics-visualization.is-expanded .cf-analytics-table-wrap {
3147
- min-height: 0;
3148
- max-height: none;
3149
- flex: 1;
3150
- margin-top: 14px;
3151
- }
3152
- .cf-analytics-table {
3153
- width: 100%;
3154
- border-collapse: collapse;
3155
- color: var(--cf-text);
3156
- font-size: 10px;
3157
- white-space: nowrap;
3158
- }
3159
- .cf-analytics-table th,
3160
- .cf-analytics-table td {
3161
- border-bottom: 1px solid var(--cf-border);
3162
- padding: 8px 9px;
3163
- text-align: left;
3164
- }
3165
- .cf-analytics-table th {
3166
- position: sticky;
3167
- top: 0;
3168
- background: var(--cf-surface-2);
3169
- color: var(--cf-muted);
3170
- font-weight: 700;
3171
- text-transform: capitalize;
3172
- }
3173
- .cf-analytics-table tbody tr:last-child td { border-bottom: 0; }
3174
- .cf-analytics-table-note {
3175
- margin: 7px 2px 0;
3176
- color: var(--cf-muted);
3177
- font-size: 9px;
3178
- line-height: 1.4;
3179
- }
3180
- .cf-data-table {
3181
- display: flex;
3182
- min-width: 0;
3183
- min-height: 0;
3184
- flex: 1;
3185
- flex-direction: column;
3186
- margin-top: 10px;
3187
- overflow: hidden;
3188
- border: 1px solid var(--cf-border);
3189
- border-radius: 9px;
3190
- background: var(--cf-bg);
3191
- }
3192
- .cf-table-fields {
3193
- display: flex;
3194
- min-width: 0;
3195
- min-height: 38px;
3196
- align-items: center;
3197
- gap: 6px;
3198
- padding: 7px 8px;
3199
- border-bottom: 1px solid var(--cf-border);
3200
- color: var(--cf-muted);
3201
- font-size: 9px;
3202
- }
3203
- .cf-table-fields > strong {
3204
- flex: 0 0 auto;
3205
- color: var(--cf-muted);
3206
- font-size: 8px;
3207
- letter-spacing: .06em;
3208
- text-transform: uppercase;
3209
- }
3210
- .cf-field-list {
3211
- display: flex;
3212
- min-width: 0;
3213
- gap: 5px;
3214
- overflow: auto hidden;
3215
- scrollbar-width: none;
3216
- }
3217
- .cf-field-chip {
3218
- flex: 0 0 auto;
3219
- padding: 4px 6px;
3220
- border-radius: 6px;
3221
- background: color-mix(in srgb, var(--cf-accent) 11%, var(--cf-bg));
3222
- color: var(--cf-accent);
3223
- font-weight: 650;
3224
- }
3225
- .cf-table-field-count { margin-left: auto;white-space: nowrap; }
3226
- .cf-table-controls {
3227
- display: grid;
3228
- grid-template-columns: minmax(110px, 1fr) auto;
3229
- gap: 6px;
3230
- padding: 7px 8px 5px;
3231
- }
3232
- .cf-table-search {
3233
- display: flex;
3234
- min-width: 0;
3235
- align-items: center;
3236
- gap: 5px;
3237
- padding: 0 7px;
3238
- border: 1px solid var(--cf-border);
3239
- border-radius: 7px;
3240
- background: var(--cf-bg);
3241
- color: var(--cf-muted);
3242
- }
3243
- .cf-table-search input {
3244
- width: 100%;
3245
- min-width: 0;
3246
- height: 28px;
3247
- border: 0;
3248
- outline: 0;
3249
- background: transparent;
3250
- color: var(--cf-text);
3251
- font: 500 9px/1 var(--cf-font);
3252
- }
3253
- .cf-table-modes {
3254
- display: inline-flex;
3255
- padding: 2px;
3256
- border: 1px solid var(--cf-border);
3257
- border-radius: 8px;
3258
- background: var(--cf-surface);
3259
- }
3260
- .cf-segment {
3261
- min-height: 26px;
3262
- border-radius: 6px;
3263
- padding: 0 7px !important;
3264
- color: var(--cf-muted) !important;
3265
- font-size: 9px;
3266
- font-weight: 650;
3267
- }
3268
- .cf-segment.is-active { background: var(--cf-accent) !important;color: var(--cf-accent-ink) !important; }
3269
- .cf-table-column-bar { display: flex;align-items: center;flex-wrap: wrap;gap: 5px;padding: 0 8px 7px; }
3270
- .cf-table-view-button { min-height: 27px;padding: 4px 6px;border: 1px solid var(--cf-border);border-radius: 7px;background: var(--cf-bg);color: var(--cf-text);cursor: pointer;font-size: 9px; }
3271
- .cf-table-view-button[aria-pressed="true"] { background: var(--cf-surface); }
3272
- .cf-table-filter-bar { display: flex;flex-wrap: wrap;gap: 4px;padding: 4px 8px; }
3273
- .cf-table-filter-chip { padding: 4px 7px;border: 0;border-radius: 999px;background: var(--cf-surface);color: var(--cf-accent);cursor: pointer;font-size: 9px; }
3274
- .cf-column-picker { position: relative; }
3275
- .cf-column-picker > summary {
3276
- min-height: 27px;
3277
- padding: 6px 8px;
3278
- border: 1px solid var(--cf-border);
3279
- border-radius: 7px;
3280
- cursor: pointer;
3281
- list-style: none;
3282
- color: var(--cf-text);
3283
- font-size: 9px;
3284
- font-weight: 650;
3285
- }
3286
- .cf-column-picker > summary::-webkit-details-marker { display: none; }
3287
- .cf-column-menu {
3288
- position: absolute;
3289
- z-index: 5;
3290
- top: calc(100% + 4px);
3291
- left: 0;
3292
- display: grid;
3293
- min-width: 160px;
3294
- gap: 6px;
3295
- padding: 9px;
3296
- border: 1px solid var(--cf-border);
3297
- border-radius: 8px;
3298
- background: var(--cf-bg);
3299
- box-shadow: 0 10px 24px rgba(15,30,42,.16);
3300
- }
3301
- .cf-column-menu label { display: flex;align-items: center;gap: 7px;color: var(--cf-text);font-size: 9px; }
3302
- .cf-column-picker-row { display: flex;align-items: center;gap: 3px; }
3303
- .cf-column-picker-row label { min-width: 0;flex: 1; }
3304
- .cf-column-picker-row button { width: 22px;height: 22px;border: 0;border-radius: 5px;background: transparent;color: var(--cf-muted);cursor: pointer; }
3305
- .cf-column-picker-row button:disabled { opacity: .4;cursor: default; }
3306
- .cf-table-wrap {
3307
- position: relative;
3308
- min-height: 0;
3309
- max-height: 210px;
3310
- overflow: auto;
3311
- border-top: 1px solid var(--cf-border);
3312
- scrollbar-width: thin;
3313
- }
3314
- .cf-analytics-visualization.is-expanded .cf-table-wrap { max-height: none;flex: 1; }
3315
- .cf-table { width: 100%;border-collapse: separate;border-spacing: 0;color: var(--cf-text);font-size: 10px; }
3316
- .cf-table th { position: sticky;top: 0;z-index: 1;background: var(--cf-surface);color: var(--cf-muted);font-size: 9px;font-weight: 720;text-align: left; }
3317
- .cf-table th,.cf-table td { padding: 8px 9px;border-bottom: 1px solid var(--cf-border);white-space: nowrap; }
3318
- .cf-table.is-compact th,.cf-table.is-compact td { padding-top: 4px;padding-bottom: 4px; }
3319
- .cf-table td.is-wrapped { min-width: 110px;max-width: 240px;white-space: normal;overflow-wrap: anywhere; }
3320
- .cf-table th.is-pinned,.cf-table td.is-pinned { position: sticky;z-index: 2;background: var(--cf-bg);box-shadow: 3px 0 6px -5px var(--cf-muted); }
3321
- .cf-table th.is-pinned { z-index: 4;background: var(--cf-surface); }
3322
- .cf-table th:not(.cf-select-cell) { min-width: 100px; }
3323
- .cf-table th:not(.cf-select-cell) .cf-table-sort { max-width: calc(100% - 18px); }
3324
- .cf-table-column-menu { position: absolute;right: 3px;top: 4px; }
3325
- .cf-table-column-menu > summary { display: flex;width: 17px;height: 17px;align-items: center;justify-content: center;border-radius: 4px;list-style: none;cursor: pointer; }
3326
- .cf-table-column-menu > summary::-webkit-details-marker { display: none; }
3327
- .cf-table-column-menu > summary:hover { background: var(--cf-surface); }
3328
- .cf-table-column-panel { position: fixed;z-index: 2147483000;display: grid;gap: 4px;width: min(220px,calc(100vw - 20px));max-height: 65vh;overflow: auto;margin: 0;padding: 9px;border: 1px solid var(--cf-border);border-radius: 9px;background: var(--cf-bg);box-shadow: 0 12px 30px rgba(15,30,42,.2);color: var(--cf-text);text-align: left; }
3329
- .cf-table-column-panel > strong { padding: 4px 6px;font-size: 10px; }
3330
- .cf-table-column-panel > span { padding: 7px 6px 2px;border-top: 1px solid var(--cf-border);font-size: 9px;font-weight: 750;text-transform: uppercase; }
3331
- .cf-table-column-panel input,.cf-table-column-panel select { min-width: 0;height: 27px;padding: 4px 6px;border: 1px solid var(--cf-border);border-radius: 6px;background: var(--cf-bg);color: var(--cf-text);font-size: 9px; }
3332
- .cf-table-column-panel button { padding: 6px 7px;border: 0;border-radius: 6px;background: transparent;color: var(--cf-text);cursor: pointer;font-size: 9px;text-align: left; }
3333
- .cf-table-column-panel button:hover { background: var(--cf-surface); }
3334
- .cf-sdk-select { position: relative;min-width: 0; }
3335
- .cf-sdk-select-trigger { display: flex;min-height: 27px;align-items: center;justify-content: space-between;gap: 7px;padding: 4px 7px;border: 1px solid var(--cf-border);border-radius: 6px;background: var(--cf-bg);color: var(--cf-text);cursor: pointer;list-style: none;font-size: 9px; }
3336
- .cf-sdk-select-trigger::-webkit-details-marker { display: none; }
3337
- .cf-sdk-select-trigger:focus-visible { outline: 2px solid var(--cf-accent);outline-offset: 2px; }
3338
- .cf-sdk-select-list { position: fixed;z-index: 2147483000;display: none;max-height: 220px;overflow: auto;margin: 0;padding: 4px;border: 1px solid var(--cf-border);border-radius: 7px;background: var(--cf-bg);box-shadow: 0 12px 28px rgba(15,30,42,.2); }
3339
- .cf-sdk-select-list:popover-open,.cf-sdk-select[open] > .cf-sdk-select-list:not(:popover-open) { display: grid; }
3340
- .cf-sdk-select-list button { padding: 6px 8px;border: 0;border-radius: 5px;background: transparent;color: var(--cf-text);cursor: pointer;font-size: 9px;text-align: left; }
3341
- .cf-sdk-select-list button:hover,.cf-sdk-select-list button[aria-selected="true"] { background: var(--cf-surface); }
3342
- .cf-table .cf-select-cell { width: 28px;padding-right: 3px;text-align: center; }
3343
- .cf-table input[type="checkbox"],.cf-column-menu input[type="checkbox"] { width: 13px;height: 13px;accent-color: var(--cf-accent); }
3344
- .cf-table-sort { display: flex !important;width: 100%;align-items: center;gap: 5px;color: inherit !important;font: inherit;text-align: left; }
3345
- .cf-sort-direction { color: var(--cf-muted);font-size: 10px; }
3346
- .cf-table.is-matrix tbody td:not(.cf-select-cell) { background: color-mix(in srgb,var(--cf-accent) 7%,var(--cf-bg)); }
3347
- .cf-table tbody tr:hover,.cf-table tbody tr.is-selected { background: color-mix(in srgb,var(--cf-accent) 10%,var(--cf-bg)); }
3348
- .cf-table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--cf-accent); }
3349
- .cf-show-more { position: sticky;left: 50%;bottom: 6px;transform: translateX(-50%);margin: 8px auto;padding: 6px 9px !important;border: 1px solid var(--cf-border) !important;border-radius: 7px;background: var(--cf-bg) !important;font-size: 9px;font-weight: 650; }
3350
- .cf-table-summary { display: flex;align-items: center;justify-content: space-between;gap: 8px;padding: 7px 9px;color: var(--cf-muted);font-size: 8px; }
3351
- .cf-visually-hidden { position: absolute;width: 1px;height: 1px;overflow: hidden;clip: rect(0 0 0 0); }
3352
- @media (max-width: 430px) {
3353
- .cf-table-modes { display: none; }
3354
- .cf-table-controls { grid-template-columns: 1fr; }
3355
- .cf-table-summary span:last-child { display: none; }
3356
- }
3357
- .cf-analytics-focus {
3358
- height: 100%;
3359
- min-height: 0;
3360
- overflow: auto;
3361
- background: var(--cf-bg);
3362
- padding: 18px;
3363
- }
3364
- @media (min-width: 640px) {
3365
- .cf-panel.cf-panel--analytics-focus {
3366
- grid-template-columns: minmax(0, 1fr);
3367
- grid-template-rows: auto minmax(0, 1fr);
3368
- grid-template-areas: 'header' 'video';
3369
- }
3370
- .cf-panel--analytics-focus .cf-panel__video { height: 100%; }
3371
- .cf-panel--analytics-focus .cf-panel__chat { display: none; }
3372
- }
3373
- .cf-analytics-expired {
3374
- margin: 8px 0 0;
3375
- padding: 8px 10px;
3376
- border: 1px dashed var(--cf-border);
3377
- border-radius: 10px;
3378
- color: var(--cf-muted);
3379
- font-size: 12.5px;
3380
- }
3381
- .cf-analytics-explanation {
3382
- margin-top: 10px;
3383
- overflow: hidden;
3384
- border: 1px solid var(--cf-border);
3385
- border-radius: 12px;
3386
- background: var(--cf-surface);
3387
- color: var(--cf-text);
3388
- padding: 12px;
3389
- }
3390
- .cf-analytics-explanation.is-expanded { margin: 0; border: 0; border-radius: 0; background: transparent; padding: 0; }
3391
- .cf-analytics-explanation .cf-xp { font-size: 12px; }
3392
- .cf-analytics-explanation.is-expanded .cf-xp { font-size: 14px; }
3393
- .cf-analytics-explanation .cf-xp__headline { font-size: 15px; }
3394
- ${je(`cf`,{surface:`var(--cf-surface)`,subtle:`var(--cf-bg)`,text:`var(--cf-text)`,muted:`var(--cf-muted)`,border:`var(--cf-border)`,accent:`var(--cf-accent)`,warning:`var(--cf-warning)`,danger:`var(--cf-danger)`,success:`var(--cf-success)`,onAccent:`var(--cf-accent-ink)`})}
3395
- ${Sn(`cf`,{bg:`var(--cf-bg)`,surface:`var(--cf-surface)`,surface2:`var(--cf-surface-2)`,text:`var(--cf-text)`,muted:`var(--cf-muted)`,border:`var(--cf-border)`,accent:`var(--cf-accent)`,onAccent:`var(--cf-accent-ink)`,chart:bn,chartDark:xn,darkSelector:`.cf-root[data-theme='dark']`})}
3396
-
3397
- @media (max-width: 639px) {
3398
- .cf-panel.cf-panel--analytics-focus {
3399
- inset: 12px;
3400
- width: auto;
3401
- height: auto;
3402
- min-height: 0;
3403
- max-width: none;
3404
- max-height: none;
3405
- grid-template-rows: auto minmax(0, 1fr);
3406
- grid-template-areas: 'header' 'video';
3407
- transform-origin: center;
3408
- }
3409
- .cf-panel--analytics-focus .cf-panel__video { height: 100%; }
3410
- .cf-panel--analytics-focus .cf-panel__chat { display: none; }
3411
- .cf-analytics-focus { padding: 14px; }
3412
- .cf-analytics-visualization.is-expanded .cf-analytics-echart { min-height: 260px; }
3413
- }
3414
-
3415
- /* Production embed hardening: dynamic mobile viewports, safe areas, and touch. */
3416
- @supports (height: 100dvh) {
3417
- .cf-panel { height: min(88dvh, 820px); max-height: calc(100dvh - 40px); }
3418
- .cf-panel.cf-panel--call { height: min(90dvh, 840px); }
3419
- .cf-panel.cf-panel--voice-connecting { height: min(72dvh, 560px); }
3420
- }
3421
- .cf-history__footer {
3422
- flex: 0 0 auto;
3423
- border-top: 1px solid var(--cf-border);
3424
- padding: 10px 12px;
3425
- }
3426
- .cf-history__clear {
3427
- width: 100%;
3428
- min-height: 38px;
3429
- border-radius: 9px !important;
3430
- color: var(--cf-danger) !important;
3431
- font-size: 12px;
3432
- font-weight: 700;
3433
- }
3434
- .cf-history__clear:hover { background: color-mix(in srgb, var(--cf-danger) 8%, var(--cf-bg)) !important; }
3435
- .cf-history__clear:focus-visible { outline: 2px solid var(--cf-danger); outline-offset: 2px; }
3436
- .cf-footer__privacy {
3437
- border-radius: 5px !important;
3438
- color: inherit !important;
3439
- font: inherit;
3440
- text-decoration: underline;
3441
- text-underline-offset: 2px;
3442
- }
3443
- .cf-footer__privacy:focus-visible { outline: 2px solid var(--cf-accent); outline-offset: 2px; }
3444
- .cf-composer.is-dragging { box-shadow: inset 0 0 0 2px var(--cf-accent); }
3445
- .cf-attach-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
3446
- .cf-attach-status button {
3447
- min-height: 28px;
3448
- border-radius: 7px !important;
3449
- padding: 0 8px !important;
3450
- color: var(--cf-accent) !important;
3451
- font-size: 11px;
3452
- font-weight: 700;
3453
- }
3454
- .cf-attach-preview {
3455
- width: 32px;
3456
- height: 32px;
3457
- flex: 0 0 32px;
3458
- border-radius: 7px;
3459
- object-fit: cover;
3460
- }
3461
- .cf-attach-copy { display: grid; min-width: 0; gap: 1px; }
3462
- .cf-attach-copy > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3463
- .cf-attach-copy small { color: var(--cf-muted); font-size: 9px; font-weight: 600; }
3464
-
3465
- @media (max-width: 639px) {
3466
- .cf-panel {
3467
- top: max(8px, env(safe-area-inset-top));
3468
- right: max(8px, env(safe-area-inset-right));
3469
- bottom: max(8px, env(safe-area-inset-bottom));
3470
- left: max(8px, env(safe-area-inset-left));
3471
- width: auto;
3472
- height: auto;
3473
- min-height: 0;
3474
- max-width: none;
3475
- max-height: none;
3476
- border-radius: 16px;
3477
- }
3478
- .cf-launcher {
3479
- right: max(var(--cf-h-pad, 20px), env(safe-area-inset-right));
3480
- bottom: max(var(--cf-v-pad, 20px), env(safe-area-inset-bottom));
3481
- }
3482
- .cf-root[data-align='left'] .cf-launcher {
3483
- right: auto;
3484
- left: max(var(--cf-h-pad, 20px), env(safe-area-inset-left));
3485
- }
3486
- .cf-root[data-align='left'] .cf-panel {
3487
- right: max(8px, env(safe-area-inset-right));
3488
- left: max(8px, env(safe-area-inset-left));
3489
- }
3490
- .cf-panel.cf-panel--call,
3491
- .cf-panel.cf-panel--voice-connecting,
3492
- .cf-panel.cf-panel--analytics-focus {
3493
- top: max(8px, env(safe-area-inset-top));
3494
- right: max(8px, env(safe-area-inset-right));
3495
- bottom: max(8px, env(safe-area-inset-bottom));
3496
- left: max(8px, env(safe-area-inset-left));
3497
- width: auto;
3498
- height: auto;
3499
- min-height: 0;
3500
- max-width: none;
3501
- max-height: none;
3502
- }
3503
- .cf-header__btn { width: 40px; height: 40px; }
3504
- .cf-feedback__btn { width: 36px; height: 36px; }
3505
- .cf-iconbtn, .cf-send { min-width: 40px; min-height: 40px; }
3506
- }
3507
- @media (min-width: 640px) and (max-height: 599px) {
3508
- .cf-panel,
3509
- .cf-panel.cf-panel--call,
3510
- .cf-panel.cf-panel--voice-connecting {
3511
- height: calc(100dvh - 24px);
3512
- min-height: 0;
3513
- max-height: calc(100dvh - 24px);
3514
- }
3515
- }
3516
- `;export{_r as A,Q as B,Ri as C,$r as D,Bi as E,Lr as F,Qt as G,Ln as H,Hr as I,Gt as J,Jt as K,Vr as L,Br as M,Nr as N,qr as O,Mr as P,ar as R,Yi as S,zi as T,Dn as U,lr as V,tn as W,N as X,Mt as Y,h as Z,ji as _,co as a,Zi as b,pa as c,sa as d,ia as f,ra as g,Qi as h,so as i,zr as j,gr as k,_a as l,na as m,fo as n,ma as o,ta as p,Xt as q,oo as r,ga as s,po as t,ua as u,oi as v,Pi as w,Fi as x,ui as y,rr as z};