@accurix/centrinfo-widget 5.1.0 → 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.
@@ -0,0 +1,3516 @@
1
+ let e=require(`preact`),t=require(`preact/hooks`),n=require(`preact/jsx-runtime`);var r=class extends Error{constructor(e,t,n){super(t),this.status=e,this.retryAfterSeconds=n,this.name=`ApiError`}};function i(e){"@babel/helpers - typeof";return i=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},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const c=()=>({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:[]}),l=`Sara is an AI assistant; answers may be imperfect.`,u=`Accurix is an AI assistant; answers may be imperfect.`,d=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.`)},f=(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}},p=15e3,m=6e4,h=12e4,g=[`/transcribe`,`/speak`,`/attachments`,`/stream`],_=[`/book-demo`,`/schedule-callback`],v=e=>{let t=e.split(`?`)[0]??e;return _.some(e=>t.includes(`/public-chat${e}`))?12e4:g.some(e=>t.includes(`/public-chat${e}`))||t.endsWith(`/public-chat`)?6e4:15e3},y=e=>{let t=e.headers?.get?.(`Retry-After`),n=t?Number(t):NaN;return Number.isFinite(n)&&n>=0?n:void 0},b=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 x=class{constructor(e,t,n,r,i={},a,o,c=`floating`){this.baseUrl=e,this.token=t,this.gifApiKey=n,this.analyticsContextToken=r,this.bootstrapOverrides=i,this.identityToken=a,this.identityTokenProvider=o,this.chatSurface=c,s(this,`cachedIdentity`,null),s(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?b(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,i=!1,a=setTimeout(()=>{i=!0,n.abort()},v(e)),o=t.signal,s=()=>n.abort();o?.aborted?n.abort():o?.addEventListener(`abort`,s,{once:!0});try{return await fetch(e,{...t,signal:n.signal})}catch(e){throw i&&!o?.aborted?new r(408,`The request took too long. Please try again.`):e}finally{clearTimeout(a),o?.removeEventListener(`abort`,s)}}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=C(t)??`request failed (${e.status})`;throw new r(e.status,n,y(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 d(`bootstrap request failed with ${e.status}`),f(c(),this.bootstrapOverrides);let t=await this.json(e);return f({...c(),...t},this.bootstrapOverrides)}catch(e){return d(e instanceof Error?e.message:`bootstrap request failed`),f(c(),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)):w(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:E(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(S(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 r(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 S=(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},C=e=>{let t=e?.message;if(Array.isArray(t))return t.join(`, `);if(typeof t==`string`)return t},w=async(e,t)=>{let n=e.getReader(),i=new TextDecoder,a={answer:``,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1,requestedContactFields:[],conversationEnded:!1},o=``;for(;;){let{done:e,value:s}=await n.read();if(e)break;o+=i.decode(s,{stream:!0});let c;for(;(c=o.indexOf(`
2
+
3
+ `))!==-1;){let e=o.slice(0,c);o=o.slice(c+2);let n=T(e);if(n){if(n.event===`error`)throw new r(502,n.data?.message??`stream error`);if(n.event===`chunk`&&typeof n.data?.text==`string`)a.answer+=n.data.text,t.onChunk(n.data.text);else if(n.event===`reset`)a.answer=``,t.onReset?.();else if(n.event===`final`&&n.data)typeof n.data.answer==`string`&&(a.answer=n.data.answer),a.sources=n.data.sources??[],a.suggestedReplies=n.data.suggestedReplies??[],a.availableActions=n.data.availableActions??[],a.actions=n.data.actions??[],a.selectedAction=n.data.selectedAction,a.handoffOffered=!!n.data.handoffOffered,a.requestedContactFields=E(n.data.requestedContactFields),a.conversationEnded=!!n.data.conversationEnded,a.liveMode=n.data.liveMode,a.assignedAgentName=n.data.assignedAgentName,a.visualization=n.data.visualization,a.artifacts=n.data.artifacts,a.audioBase64=n.data.audioBase64,a.mimeType=n.data.mimeType,t.onTextReady?.();else if(n.event===`audio`&&n.data)typeof n.data.seq==`number`?(a.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})):(a.audioBase64=n.data.audioBase64,a.mimeType=n.data.mimeType);else if(n.event===`done`)return a}}}return a},T=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}}},E=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[];let D=()=>Promise.resolve().then(()=>require(`./dev-transports-KlSdSZpj.cjs`));const O=e=>new x(e.apiBaseUrl,e.token,e.gifApiKey,e.analyticsContextToken,{agentName:e.agentName,agentAvatarUrl:e.agentAvatarUrl},e.identityToken,e.getIdentityToken,e.chatSurface),k=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`)}},A=e=>e.demo?k(async()=>new(await(D())).MockTransport):e.preview?k(async()=>{let{PreviewTransport:t}=await D();return new t(O(e),e.strings)}):O(e),j=420,M=12,N=11,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),ee=(e,t=12,n=8)=>Math.ceil(t+e+n),I=(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},L=e=>Array.isArray(e)?e:e?[e]:[],R=(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=R(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=L(e.xAxis),r=L(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=L(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=I(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,ee(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`,provenanceCalculated:`Calculated results`,provenanceGoverned:`Based on current values`,comparison:`Comparison`,conclusions:`What we can conclude`,whyItMatters:`Why it matters`,limits:`Important limits`,investigate:`Investigate further`,evidenceList:`Supporting evidence`,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.`,sourceNoteCalculated:`AI-assisted wording based on calculated results.`,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…`,stillWorkingDetailed:`Still working on the detailed explanation…`,detailedReady:`Detailed explanation ready.`,detailedUnavailable:`A detailed explanation is not available right now.`,detailedRetry:`Try again`,region:`Explanation`,drivers:`What is driving it`,driversHint:`Measured association, not proof of cause`,anomalies:`Unusual values`,supplementaryFindings:`Also in the data`,frameworks:`General guidance, not from your data`,dataGaps:`Missing data`,segment:`Segment:`,tasks:`Tasks`,inProgress:`in progress`,expand:`Expand explanation`,collapse:`Collapse explanation`,reasonWrongNumbers:`Wrong numbers`,reasonMissingComparison:`Missing comparison`,reasonUnclear:`Unclear`,reasonTooLong:`Too long`},W=[{id:`wrong_numbers`,label:`Wrong numbers`},{id:`missing_comparison`,label:`Missing comparison`},{id:`unclear`,label:`Unclear`},{id:`too_long`,label:`Too long`}],G=500,te=e=>e===`ai_grounded`||e===`rag_deterministic_analysis`,K=(e,t={})=>{let n={...U,...t};return te(e.source)||e.level===`detailed`?e.answerComplete===!0?n.provenanceAI:n.provenanceCalculated:e.level===`basic`?n.basicExplanation:n.provenanceGoverned},q=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``}},J=e=>{switch(e){case`confirmed_zero`:return`confirmed`;case`empty_bucket`:case`unconfirmed_zero`:return`caution`;case`missing`:return`missing`;default:return`neutral`}},ne=e=>!e||e===`observed`||e===`confirmed_zero`,re=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`},ie=/^\d{4}-\d{2}-\d{2}$/,ae=(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)}},oe=(e,t)=>ae(e,`en-CA`,{year:`numeric`,month:`2-digit`,day:`2-digit`},t),se=(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=oe(r,t.timezone)===oe(t.now??new Date,t.timezone);return ae(r,t.locale,a?i:{...i,month:`short`,day:`numeric`},t.timezone)},ce=(e,t={})=>{let n=e.timezone?.trim(),r=se(e.checkedAt,{...t,timezone:n});return[n?`Times in ${n}`:``,r?`Checked ${r}`:``].filter(Boolean).join(` · `)},le=(e,t,n)=>{let r=e?.trim();if(!r)return``;if(ie.test(r)){let e=new Date(`${r}T00:00:00Z`);return Number.isNaN(e.getTime())?r:ae(e,t,{day:`numeric`,month:`short`,year:`numeric`},`UTC`)}let i=new Date(r);return Number.isNaN(i.getTime())?r:ae(i,t,{day:`numeric`,month:`short`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1},n)},ue=(e,t={})=>{if(!e)return``;let n=e.timezone?.trim()||t.timezone?.trim(),r=le(e.start,t.locale,n),i=le(e.end,t.locale,n);return r&&i?`${r} – ${i} (end not included)`:r?`From ${r}`:i?`Before ${i}`:``},de=(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=ie.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`}},Y=(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}:ne(e.status)?ne(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`}},fe=e=>e&&[`day`,`week`,`month`,`quarter`,`year`].includes(e)?e:`period`,X=e=>e===`day`?`vs yesterday at this time`:`vs same point last ${fe(e)}`,pe=(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 ${fe(e.grain)}s`,o=e.cutoffSource===`data_as_of`?`, the time of the latest record`:``;return`Compared up to ${i} ${a}${o}${r?` (${r})`:``}`},me=(e,t,n,r={format:String})=>{if(!e||!e.comparisonBasis||e.comparisonBasis===`complete`)return;let i=e.comparisonBasis,a=Y(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 ${fe(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=Y({value:l,status:t.status},{value:e.previousToDateValue,status:`observed`}),a=pe(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:X(e.grain),secondary:f,compactSecondary:p,title:a}}return{basis:i,kind:`neutral`,tone:`neutral`,label:n.label,copy:X(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}},he=e=>e?.grain===`day`?`Yesterday at this time`:`Same point last ${fe(e?.grain)}`,ge=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):``},_e=(e,t)=>{let n=ge(t);if(!(!n||!e)){if(e.previousPeriod?.start&&ge(e.previousPeriod.start)===n)return`previous`;if(e.currentPeriod?.start&&ge(e.currentPeriod.start)===n)return`current`}},ve=(e,t,n,r={format:String})=>{if(!e||!e.series?.length||!e.comparisonBasis||e.comparisonBasis===`complete`)return;let i=_e(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:me({...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)}},ye=e=>!!(e&&e.seriesField&&e.series?.length&&e.comparisonBasis&&e.comparisonBasis!==`complete`&&e.comparisonBasis!==`not_comparable`),be=e=>{if(!ye(e))return;let t=e.currentPeriod?.label||`Current period`;return e.comparisonBasis===`like_for_like`?`${t} so far, compared with ${he(e).toLowerCase()}`:`${t} so far; the previous period is shown in full, so the bars are not like for like`},xe=(e,t,n)=>{if(!t)return[];if(t.side===`previous`)return typeof t.fullValue==`number`&&t.toDate?[`Full ${e?.grain===`day`?`day`:fe(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]:[]:[]},Se=`__previous_to_date`,Ce=`Previous to date`,we=(e,t)=>{let n=e.trim().toLowerCase(),r=t.trim().toLowerCase();return n===r||n.endsWith(`.${r}`)||r.endsWith(`.${n}`)},Te=e=>{let t=e.periodComparison,n=e.rows;if(!n?.length||!ye(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(Se))return e;let a=i.find(e=>we(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=>we(t.measureField,e)):void 0)??i.find(e=>o(e)?.semanticRole===`measure`),l=n.map(e=>{let n=s?_e(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,[Se]:i}}),u={...(c?o(c):void 0)??{dataType:`number`,semanticRole:`measure`},key:Se,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,Se]:e.columns,columnMetadata:r.length?[...r,u]:e.columnMetadata}},Ee=e=>!!(e?.lastPeriodInProgress||e?.caveats?.some(e=>e.code===`incomplete_final_period`)||e?.periodComparison?.currentPeriod?.inProgress),De=`In progress`,Z=(e,t)=>t(String(e??``).replace(/\s+/g,` `).trim()).trim(),Oe=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e.toLocaleString(t):``,ke=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},Ae=[`summary`,`headline`,`in summary`,`in short`,`overall`,`in brief`,`key finding`,`answer`],je=e=>{let t=String(e??``).toLowerCase().replace(/[^\p{L}\p{N}]+/gu,` `).trim(),n=Ae.find(e=>t.startsWith(`${e} `));return n?t.slice(n.length+1):t},Me=(e,t)=>{let n=je(e),r=je(t);return!n||!r?!1:n===r||n.startsWith(`${r} `)||r.startsWith(`${n} `)},Ne=(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=q(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=ue(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=Oe(d.value,n);return e?{valueText:e}:{}})(),...p?{statusLabel:p}:{},statusTone:J(f),...d.statusReason?.trim()?{statusReason:Z(d.statusReason,i)}:{},...m===`card`?{sourceLabel:U.sourceCard}:m===`supporting_query`?{sourceLabel:U.sourceSupportingQuery}:{},sourceTargets:ke(d.source),...(()=>{let r=se(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=te(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&&!Me(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=q(t),a=e.valueText?.trim()||Oe(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:J(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=>Me(t.text,e.text))===t).filter(e=>!Me(e.text,p.text)&&!(h&&Me(e.text,h.text))).slice(0,_),b=[p.text,h?.text??``,...y.map(e=>e.text)],x=e=>!!e&&!b.some(t=>Me(t,e)),S=[];for(let t of e.drivers??[]){let e=Z(t?.text,i);x(e)&&(S.push({text:e,basis:t.basis?.trim()||`other`,citations:u(t.evidenceIds)}),b.push(e))}let C=[];for(let t of e.anomalies??[]){let e=Z(t?.text,i);x(e)&&(C.push({text:e,citations:u(t.evidenceIds)}),b.push(e))}let w=[];for(let t of e.supplementaryFindings??[]){let e=Z(t,i);x(e)&&(w.push(e),b.push(e))}let T=(e.dataGaps??[]).map(e=>({concept:Z(e?.concept,i),text:Z(e?.text,i)})).filter(e=>e.text),E=(e.frameworks??[]).map(e=>({name:Z(e?.name,i),guidance:Z(e?.guidance,i),fields:(e?.fieldMapping??[]).filter(e=>e.status===`available`&&e.field?.trim()).map(e=>`${e.concept.trim()} → ${String(e.field).trim()}`),missing:(e?.fieldMapping??[]).filter(e=>e.status===`missing`&&e.concept?.trim()).map(e=>e.concept.trim())})).filter(e=>e.guidance).slice(0,3),D=Z(e.businessMeaning,i),O=D?{text:D,citations:u(e.businessMeaningEvidenceIds)}:void 0,k=[],A=e=>{e.text&&!k.some(t=>t.text===e.text)&&k.push(e)},j=(e.limitations??[]).map(e=>e.toLowerCase());for(let e of g){let t=j.some(t=>t.includes(e.label.toLowerCase())&&t.includes(`in progress`));e.inProgress&&!t&&A({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`)&&A({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`&&A({kind:`missing`,text:`${e.label} is missing${e.reason?`: ${e.reason.replace(/\.$/,``)}`:``}.`,...e.citation?{citation:e.citation}:{}})}e.currentPeriodInProgress&&!g.some(e=>e.inProgress)&&A({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);A({kind:`missing`,text:Pe(t),...e?{citation:e}:{}})}(e.dataFreshness?.status===`delayed`||e.dataFreshness?.status===`no_data`)&&A({kind:`freshness`,text:de(e.dataFreshness,e.checkedAt,n).description});for(let t of e.limitations??[]){let e=Z(t,i);e&&A({kind:`limitation`,text:e})}let M=(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),N=(e.recommendations??[]).map(e=>({title:Z(e.action,i),why:Z(e.why,i),...e.successMetric?.trim()?{watch:Z(e.successMetric,i)}:{},...e.segment?.trim()?{segment:Z(e.segment,i)}:{},citations:u(e.evidenceIds)})).filter(e=>e.title).slice(0,t.maxRecommendations??3),P=Z(e.forecast?.text,i),F=P?{badge:re(e.forecast?.qualityStatus),text:P,...e.forecast?.limitations?.trim()?{note:Z(e.forecast.limitations,i)}:{}}:void 0,ee=(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 I=Z(e.conversationalPreface,i);return{...e.explanationId?.trim()?{explanationId:e.explanationId.trim()}:{},ai:d,lead:{eyebrow:r.eyebrow,provenance:K(e,r),...I?{preface:I}:{},headline:p,...h?{summary:h}:{}},comparison:g,conclusions:y,...O?{businessMeaning:O}:{},drivers:S,anomalies:C,supplementaryFindings:w,dataGaps:T,limits:k,checkedLine:ce(e,{locale:n,now:t.now}),investigate:{causes:M,recommendations:N,...F?{outlook:F}:{},followUps:ee,frameworks:E},hasInvestigate:M.length>0||N.length>0||!!F||ee.length>0||E.length>0||s.length>0,evidence:s,evidenceById:c,sourceNote:d?e.answerComplete===!0?r.sourceNoteAI:r.sourceNoteCalculated:r.sourceNoteGoverned}},Pe=e=>`${e.label.trim()} could not be established: ${e.reason.trim()}`,Fe=e=>`[${e.index}]`,Ie=(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},Le=e=>{let t=new Set(W.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}:{}}},Re=(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 ze=class{constructor(e,t,n,r={}){this.explanationId=e,this.submit=t,this.onChange=n,this.context=r,s(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(Le({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 Be={delaysMs:[1e3,2e3,4e3],capMs:45e3,graceMs:5e3,stillWorkingMs:15e3},Ve=e=>e===`pending`||e===`ready`||e===`failed`?e:`not_requested`,He=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?e*1e3:0,Ue=e=>Ve(e?.aiExplanation?.status);var We=class{constructor(e,t,n,r={}){this.transport=t,this.onChange=n,s(this,`state`,void 0),s(this,`handle`,void 0),s(this,`disposed`,!1),s(this,`generation`,0),s(this,`attempt`,0),s(this,`startedAt`,0),s(this,`delays`,void 0),s(this,`capMs`,void 0),s(this,`graceMs`,void 0),s(this,`stillWorkingMs`,void 0),s(this,`windowMs`,0),s(this,`now`,void 0),s(this,`schedule`,void 0),s(this,`cancelTimer`,void 0),s(this,`isVisible`,void 0),s(this,`onSettled`,void 0),s(this,`inFlight`,null),s(this,`pausedAt`,null),s(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:Be.delaysMs,this.capMs=r.capMs??Be.capMs,this.graceMs=r.graceMs??Be.graceMs,this.stillWorkingMs=r.stillWorkingMs??Be.stillWorkingMs,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=Ue(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:``,stillWorking:!1}}extendWindow(e){let t=He(e);if(t<=0)return;let n=this.now()-this.startedAt;this.windowMs=Math.max(this.windowMs,n+t+this.graceMs)}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,this.windowMs=this.capMs,this.extendWindow(this.state.explanation.aiExplanation?.waitSeconds),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,t=Math.max(this.windowMs,this.capMs);if(e>=t){this.fail(!0);return}!this.state.stillWorking&&this.state.status===`pending`&&e>=this.stillWorkingMs&&this.set({stillWorking:!0});let n=this.delays[Math.min(this.attempt,this.delays.length-1)]??4e3;this.attempt+=1;let r=this.generation;this.handle=this.schedule(()=>{this.pollOnce(r)},Math.min(n,Math.max(0,t-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=Ve(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,stillWorking:!1});return}if(t===`pending`){this.extendWindow(e.waitSeconds),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:``,stillWorking:!1});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,stillWorking:!1})}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(Ve(n.status)===`pending`){this.set({status:`pending`,retrying:!1,retryAvailable:!1,announcement:U.preparingDetailed,stillWorking:!1}),this.startedAt=this.now(),this.attempt=0,this.windowMs=this.capMs,this.extendWindow(n.waitSeconds),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 Ge=/^(\d{4})-(\d{2})-(\d{2})$/,Ke=/^(\d{4})-(\d{2})$/,qe=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?$/,Je=/(?:Z|[+-]\d{2}:?\d{2})$/i,Ye=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=Ge.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=Ke.exec(t),n)return{date:new Date(Date.UTC(Number(n[1]),Number(n[2])-1,1)),calendar:!0,hasTime:!1};if(n=qe.exec(t),n&&!Je.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}},Xe=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`}},Ze=e=>{let t=e.map(Ye).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`},Qe=(e,t)=>{try{return new Intl.DateTimeFormat(e,t)}catch{return new Intl.DateTimeFormat(e,{...t,timeZone:`UTC`})}},$e=(e,t,n={})=>{let r=Ye(e);if(!r)return;let i=t?.grain??Xe(t?.formatPattern)??n.grain,a=r.calendar?`UTC`:n.timezone||void 0,{date:o}=r;switch(i){case`year`:return Qe(n.locale,{year:`numeric`,timeZone:a}).format(o);case`quarter`:{let e=Number(Qe(`en-US`,{month:`numeric`,timeZone:a}).format(o)),t=Qe(n.locale,{year:`numeric`,timeZone:a}).format(o);return`Q${Math.floor((e-1)/3)+1} ${t}`}case`month`:return Qe(n.locale,{month:`short`,year:`numeric`,timeZone:a}).format(o);case`week`:case`day`:return Qe(n.locale,{day:`numeric`,month:`short`,year:`numeric`,timeZone:a}).format(o);case`hour`:return Qe(n.locale,{day:`numeric`,month:`short`,hour:`numeric`,minute:`2-digit`,timeZone:a}).format(o);default:return Qe(n.locale,{dateStyle:`medium`,...r.hasTime?{timeStyle:`short`}:{},timeZone:a}).format(o)}},et=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}},tt=(e,t)=>{let n=et(e);return n?{minimumFractionDigits:n.min,maximumFractionDigits:n.max}:{maximumFractionDigits:t}},nt=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},rt=(e,t)=>t&&Math.abs(e)>=1e4?`compact`:`standard`,it=(e,t={})=>new Intl.NumberFormat(t.locale,{notation:rt(e,t.compact),...tt(t.pattern,t.maxFractionDigits??2)}).format(e),at=(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:rt(e,n.compact),...et(n.pattern)?tt(n.pattern,2):{}}).format(e)}catch{}return it(e,{...n,maxFractionDigits:2})},ot=(e,t={})=>{let n=!!(t.pattern&&/(?<!\\)%/.test(t.pattern)),r=tt(t.pattern,2);return new Intl.NumberFormat(t.locale,{style:`percent`,...r}).format(n?e:e/100)},st=(e,t,n={})=>{let{locale:r,compact:i}=n;return t?.dataType===`currency`?at(e,t.currencyCode||n.currencyCode,{locale:r,compact:i,pattern:t.formatPattern}):t?.dataType===`percent`?ot(e,{locale:r,pattern:t.formatPattern}):it(e,{locale:r,compact:i,pattern:t?.formatPattern,maxFractionDigits:n.maxFractionDigits})},ct=(e,t,n={})=>{if(e==null||e===``)return`—`;if(t?.dataType===`date`||t?.dataType===`datetime`){let r=$e(e,t,n);if(r)return r}if(t?.dataType===`currency`||t?.dataType===`percent`){let r=nt(e);if(r!==null)return st(r,t,n)}if(typeof e==`number`&&Number.isFinite(e))return st(e,t,{...n,maxFractionDigits:4});if(typeof e==`boolean`)return e?n.yes??`Yes`:n.no??`No`;let r=String(e);return t?.semanticRole===`dimension`&&/^[a-z][a-z0-9]*(?:_[a-z0-9]+)+$/.test(r)?r.replaceAll(`_`,` `).replace(/^\w/,e=>e.toUpperCase()):r},lt={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`},ut=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>String(t[n]??``)),dt=e=>Object.fromEntries(Object.entries(e??{}).filter(([,e])=>e!=null)),ft=e=>({...lt,...dt(e),explanation:{...e?.explanation}}),pt=4;let mt=()=>Promise.resolve().then(()=>require(`./echarts-runtime-BfpVL8xu.cjs`)),ht=null,gt=!1;const _t=()=>(ht||(ht=mt().catch(e=>{throw ht=null,e})),ht),vt={background:`#ffffff`,border:`#dce4e9`,muted:`#5b7186`,surface:`#ffffff`,text:`#0f1e2a`,colors:[`#2f7f55`,`#2563eb`,`#b45309`,`#7c3aed`]},yt=`cf-widget-category-zoom`,bt=.68,xt=2,St=e=>({startIndex:0,endIndex:Math.max(0,e-1)}),Ct=(e,t)=>{if(t<=0)return St(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))))}},wt=(e,t,n)=>{let r=Ct(e,n);if(n<=2)return St(n);let i=r.endIndex-r.startIndex+1,a=t===`in`?Math.max(2,Math.floor(i*bt)):Math.min(n,Math.ceil(i/bt));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}},Tt=(e,t,n=lt)=>{let r=e.length;if(r===0)return n.zoomNone;let i=Ct(t,r);return i.startIndex===0&&i.endIndex===r-1?ut(r===1?n.zoomAllOne:n.zoomAllMany,{count:r}):ut(n.zoomRange,{start:e[i.startIndex]??``,end:e[i.endIndex]??``,visible:i.endIndex-i.startIndex+1,count:r})},Et=e=>{let t=e.replaceAll(`_`,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`Value`},Dt=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},Ot=nt,kt=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)}`},At=(e,t)=>t?e.columnMetadata?.find(e=>e.key===t):void 0,jt=(e,t)=>{let n=At(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},Mt=(e,t)=>At(e,t)?.label?.trim()||Et(t),Nt=(e,t,n,r)=>({locale:t,timezone:e.timezone||e.periodComparison?.timezone,grain:r,yes:n.yes,no:n.no}),Pt=e=>e?.dataType===`date`||e?.dataType===`datetime`||e?.semanticRole===`date`,Ft=(e,t,n)=>{let r=At(e,t);if(Pt(r))return r?.grain??e.periodComparison?.grain??Ze(n.map(e=>e[t]))},It=(e,t,n,r,i,a)=>{if(n==null||n===``)return r.notSet;let o=At(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(Pt(o)){let t=$e(n,o,Nt(e,i,r,a));if(t)return t}return ct(n,o,{locale:i})},Lt=(e,t,n,r=!1,i)=>st(e,t,{locale:i,compact:r,currencyCode:n?.currency?.code&&!n.currency.isMixed?n.currency.code:void 0}),Rt=(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},zt=e=>e.chartRecommendation?.categoryField?.trim()||e.label?.trim()||e.columnMetadata?.find(e=>[`date`,`dimension`,`geography`,`boolean`].includes(e.semanticRole))?.key||e.columns?.[0],Bt=e=>e.chartRecommendation?.seriesField?.trim()||e.seriesField?.trim()||e.series?.trim()||void 0,Vt=(e,t,n)=>{let r=Dt([...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=>Ot(e[t])!==null))},Ht=(e,t,n,r,i,a,o)=>{let s=i?` ${ut(a.seriesLimited,{shown:r.length,total:r.length+i})}`:``,c=(t,n)=>Lt(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?`${ut(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?`${ut(a.summaryHighest,{category:l.category,series:l.series.name,value:c(l.value,l.series.valueColumn)})}${s}`:`${a.summaryNoComparison}${s}`},Ut=(e,t,n={})=>{let r=ft(n.labels),i=n.locale,a=Rt(e,t),o=zt(e),s=e.rows??[];if(!a||!o||s.length===0)return null;let c=Bt(e),l=Vt(e,o,c);if(l.length===0)return null;let u=l.length===1?c:void 0,d=Ft(e,o,s),f=l[0],p=u&&ye(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=>Lt(t,jt(e,f??``),e,!1,i),g=e=>p&&m?ve(p,e[m.time],e[m.group],{format:h,locale:i}):void 0,_=(e,t)=>p?.comparisonBasis===`like_for_like`&&ve(p,e,p.series?.[0]?.key)?.side===`previous`?he(p):t,v=[],y=new Set;s.forEach(t=>{let n=kt(t[o]);if(y.has(n))return;y.add(n);let a=It(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=kt(a[u]);if(n.has(o))return;n.add(o);let c=It(e,u,a[u],r,i,Ft(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(kt(e[u])!==t.key)return;let i=kt(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:Ot(e[c]))}}),{field:c,name:t.label,values:v.map(e=>n.get(e.key)??null),valueColumn:jt(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:Mt(e,t),values:s.map(e=>Ot(e[t])),valueColumn:jt(e,t)}));if(S.length===0)return null;let C=Mt(e,o),w=r.chartValues;u?w=Mt(e,l[0]):S.length===1&&(w=S[0].name);let T=e.title?.trim()||ut(r.chartTitle,{measure:w,dimension:C}),E;if(At(e,o)?.semanticRole===`date`&&v.length>1&&Ee(e)){let e=``;s.forEach(t=>{let n=String(t[o]??``);n>e&&(e=n)});let t=v.findIndex(t=>t.key===kt(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:be(p)}:{},locale:i,labels:r,summary:Ht(e,a,b,S,x,r,i)}},Wt=[{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`}],Gt={sum:`aggregationSum`,avg:`aggregationAvg`,min:`aggregationMin`,max:`aggregationMax`,count:`aggregationCount`,count_distinct:`aggregationCountDistinct`},Kt=(e,t=lt)=>String(t[Gt[e]]),qt=(e,t)=>{let n=e.columnMetadata?.find(e=>e.key===t)?.allowedAggregations;return n?.length?Wt.filter(e=>n.includes(e.value)):[...Wt]},Jt=(e,t,n)=>{let r=zt(e);if(!r||!Vt(e,r,Bt(e)).includes(t)||!qt(e,t).some(e=>e.value===n))return;let i=Wt.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 ${Mt(e,t)} for each ${Mt(e,r)}. Return a chart and show a table if this app permits it.`},Yt=(e,t=lt)=>{if(e.presentation===`table`||e.presentation===`kpi`)return[];let n=Ut(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},Xt=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(Lt(t.value,n?.valueColumn,void 0,!1,e.locale))}`})].filter(Boolean).join(`<br/>`)},Zt=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=>Lt(t,n?.valueColumn,void 0,!1,e.locale);return[`${String(t.marker??``)}${r(String(t.seriesName??``))}: ${r(a(t.value))}`,...xe(e.comparison,i,a).map(e=>`<span style="opacity:.75">${r(e)}</span>`)]});return[i?`<strong>${r(i)}</strong>`:``,...a].filter(Boolean).join(`<br/>`)},Qt=(e,{expanded:t=!1,reducedMotion:n=!1,theme:r=vt,zoomWindow:i=St(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=Ct(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:Xt(e)}:e.comparison?{formatter:Zt(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:yt,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=>Lt(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=>Lt(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)}]})}},$t=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]=vt.colors;return{background:n([`--rv-bg`,`--cf-bg`],vt.background),border:n([`--rv-border`,`--cf-border`],vt.border),muted:n([`--rv-muted`,`--cf-muted`],vt.muted),surface:n([`--rv-surface`,`--cf-surface`],vt.surface),text:n([`--rv-text`,`--cf-text`],vt.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)]}},en=[`data-theme`,`data-color-scheme`,`class`,`style`],tn=(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:en});let e=i.parentNode;i=e instanceof ShadowRoot?e.host:e}n.push(()=>r.disconnect())}return()=>n.forEach(e=>e())},nn=({model:e,expanded:r=!1,classPrefix:i=`cf`})=>{let a=(0,t.useRef)(null),o=(0,t.useRef)(null),[s,c]=(0,t.useState)(()=>({model:e,window:St(e.categories.length)})),[l,u]=(0,t.useState)(!1),d=s.model===e?Ct(s.window,e.categories.length):St(e.categories.length),f=(0,t.useRef)(d);f.current=d;let p=t=>{let n=Ct(t,e.categories.length);f.current=n,c({model:e,window:n}),o.current?.dispatchAction({type:`dataZoom`,dataZoomId:yt,startValue:n.startIndex,endValue:n.endIndex})},[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(0),[v,y]=(0,t.useState)(0);(0,t.useEffect)(()=>{let e=a.current;if(e)return tn(e,()=>y(e=>e+1))},[]),(0,t.useEffect)(()=>{let e=a.current;if(!e)return;let t=!1,n=null;return _t().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)});o.current=i;let a=()=>{i.resize(),_(Math.round(e.clientWidth/40))},s=typeof ResizeObserver>`u`?null:new ResizeObserver(a);s?.observe(e),s||window.addEventListener(`resize`,a,{passive:!0}),n=()=>{s?.disconnect(),s||window.removeEventListener(`resize`,a),i.dispose(),o.current=null},h(!0)}).catch(()=>{t||u(!0)}),()=>{t=!0,n?.()}},[]),(0,t.useEffect)(()=>{let t=a.current,n=o.current;if(!t||!n)return;let i=typeof matchMedia<`u`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;n.setOption(B(Qt(e,{expanded:r,reducedMotion:i,theme:$t(t),zoomWindow:f.current}),t.clientWidth),{lazyUpdate:!0,notMerge:!0}),n.resize()},[r,e,m,v,g]);let b=e.labels,x=!l&&e.categories.length>2,S=d.endIndex-d.startIndex+1,C=d.startIndex===0&&d.endIndex===e.categories.length-1,w=x&&S>2,T=x&&!C;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{ref:a,class:`${i}-analytics-echart${r?` is-expanded`:``}`,role:`img`,"aria-label":`${e.title}. ${e.summary}`,"data-chart-status":l?`fallback`:`ready`,children:l?(0,n.jsx)(`span`,{class:`${i}-analytics-echart__fallback`,children:e.summary}):null}),e.comparisonNote?(0,n.jsx)(`p`,{class:`${i}-analytics-comparison-note`,"data-comparison-note":!0,style:`margin:4px 2px 0;font-size:11px;color:var(--rv-muted,#5b7186)`,children:e.comparisonNote}):null,x?(0,n.jsxs)(`div`,{class:`${i}-analytics-zoom`,children:[(0,n.jsx)(`span`,{class:`${i}-analytics-zoom__range`,"aria-live":`polite`,"aria-atomic":`true`,children:Tt(e.categories,d,b)}),(0,n.jsxs)(`div`,{class:`${i}-analytics-zoom__controls`,role:`group`,"aria-label":b.zoomControls,children:[(0,n.jsx)(`button`,{type:`button`,"aria-label":b.zoomOut,title:b.zoomOut,disabled:!T,onClick:()=>p(wt(f.current,`out`,e.categories.length)),children:`−`}),(0,n.jsx)(`button`,{type:`button`,class:`${i}-analytics-zoom__reset`,"aria-label":b.zoomReset,title:b.zoomReset,disabled:C,onClick:()=>p(St(e.categories.length)),children:b.zoomResetShort}),(0,n.jsx)(`button`,{type:`button`,"aria-label":b.zoomIn,title:b.zoomIn,disabled:!w,onClick:()=>p(wt(f.current,`in`,e.categories.length)),children:`+`})]})]}):null]})},rn=e=>{let t=e.replaceAll(`_`,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:`Value`},an=(e,t)=>(t?.length?t:Object.keys(e[0]??{})).map(e=>typeof e==`string`?{key:e,label:rn(e)}:{...e,label:e.label?.trim()||rn(e.key)}),on=(e,t,n,r={})=>ct(e,n,{...r,locale:t??r.locale}),sn=e=>{let t=String(e??``);return/[",\r\n]/.test(t)?`"${t.replaceAll(`"`,`""`)}"`:t},cn=(e,t)=>{let n=an(e,t);return[n.map(e=>sn(e.label)).join(`,`),...e.map(e=>n.map(t=>sn(e[t.key])).join(`,`))].join(`\r
90
+ `)},ln=({label:e,options:r,value:i,onChange:a,classPrefix:o})=>{let s=(0,t.useRef)(null),c=(0,t.useRef)(null),[l,u]=(0,t.useState)(i),[d,f]=(0,t.useState)(!1);(0,t.useEffect)(()=>u(i),[i]);let p=e=>`${o}-${e}`,m=e=>{u(e),s.current&&(s.current.dataset.value=e,s.current.open=!1,s.current.querySelector(`summary`)?.focus()),a?.(e)};return(0,n.jsxs)(`details`,{ref:s,"data-result-popover":!0,"data-result-select":!0,"data-value":l,class:p(`sdk-select`),onToggle:e=>{let t=e.currentTarget.open;f(t);let n=c.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(!s.current?.open||!n.isConnected)return;let e=s.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:[(0,n.jsxs)(`summary`,{class:p(`sdk-select-trigger`),role:`combobox`,"aria-label":e,"aria-haspopup":`listbox`,"aria-expanded":d,children:[(0,n.jsx)(`span`,{children:r.find(([e])=>e===l)?.[1]??l}),(0,n.jsx)(`span`,{"aria-hidden":`true`,children:`⌄`})]}),(0,n.jsx)(`div`,{ref:c,class:p(`sdk-select-list`),role:`listbox`,"aria-label":e,popover:`manual`,children:r.map(([e,t])=>(0,n.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":e===l,onClick:()=>m(e),children:t},e))})]})},un=({rows:e,columns:t,maxRows:r=6,locale:i,format:a,expanded:o=!1,classNames:s,emptyLabel:c=`No rows returned.`})=>{let l=an(e,t),u=o?e:e.slice(0,Math.max(1,r));return e.length===0||l.length===0?(0,n.jsx)(`div`,{class:s?.note,children:c}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{class:s?.wrap,role:`region`,"aria-label":`Result table with ${e.length} ${e.length===1?`row`:`rows`}`,tabIndex:0,children:(0,n.jsxs)(`table`,{class:s?.table,children:[(0,n.jsxs)(`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`]}),(0,n.jsx)(`thead`,{children:(0,n.jsx)(`tr`,{children:l.map(e=>(0,n.jsx)(`th`,{scope:`col`,children:e.label},e.key))})}),(0,n.jsx)(`tbody`,{children:u.map((e,t)=>(0,n.jsx)(`tr`,{children:l.map(t=>(0,n.jsx)(`td`,{children:on(e[t.key],i,t,a)},t.key))},t))})]})}),!o&&e.length>u.length?(0,n.jsxs)(`div`,{class:s?.note,children:[`Showing `,u.length,` of `,e.length,` rows. Expand to view all rows.`]}):null]})},dn=(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())}},fn=({rows:e,columns:r,maxRows:i=100,locale:a,format:o,expanded:s=!1,classPrefix:c=`cr`,pageSize:l=10})=>{let u=(0,t.useMemo)(()=>an(e,r),[r,e]),d=u.map(e=>e.key).join(`\0`),[f,p]=(0,t.useState)(()=>u.map(e=>e.key)),[m,h]=(0,t.useState)(``),[g,_]=(0,t.useState)(),[v,y]=(0,t.useState)(`asc`),[b,x]=(0,t.useState)({}),[S,C]=(0,t.useState)(),[w,T]=(0,t.useState)([]),[E,D]=(0,t.useState)({}),[O,k]=(0,t.useState)(()=>u.map(e=>e.key)),[A,j]=(0,t.useState)(!1),[M,N]=(0,t.useState)([]),[P,F]=(0,t.useState)(`table`),[ee,I]=(0,t.useState)(1),[L,R]=(0,t.useState)(l),z=(0,t.useRef)(null);(0,t.useEffect)(()=>{let e=e=>{let t=e.composedPath();z.current?.querySelectorAll(`details[data-result-popover][open]`).forEach(e=>{t.includes(e)||(e.open=!1)})},t=e=>{let t=[...z.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)}},[]),(0,t.useEffect)(()=>{p(u.map(e=>e.key)),_(void 0),x({}),C(void 0),T([]),D({}),k(u.map(e=>e.key)),N([]),I(1)},[d]);let B=O.map(e=>u.find(t=>t.key===e)).filter(e=>!!(e&&f.includes(e.key))),V=(0,t.useMemo)(()=>{let t=m.toLocaleLowerCase(a),n=e.map((e,t)=>({row:e,index:t})).filter(({row:e})=>B.some(n=>on(e[n.key],a,n,o).toLocaleLowerCase(a).includes(t))&&Object.entries(b).every(([t,n])=>{let r=u.find(e=>e.key===t);return dn(e[t],on(e[t],a,r,o),n)}));return g?n.sort((e,t)=>{let n=e.row[g],r=t.row[g],i=typeof n==`number`?n:NaN,o=typeof r==`number`?r:NaN,s=!Number.isNaN(i)&&!Number.isNaN(o)?i-o:String(n??``).localeCompare(String(r??``),a,{numeric:!0,sensitivity:`base`});return v===`asc`?s:-s}):n},[B,b,o,a,m,u,e,v,g]),H=V.slice(0,Math.max(1,i)),U=Math.max(1,Math.ceil(H.length/L)),W=Math.min(ee,U),G=s?H:H.slice((W-1)*L,W*L),te=G.length>0&&G.every(({index:e})=>M.includes(e)),K=e=>`${c}-${e}`,q=()=>{p(u.map(e=>e.key)),k(u.map(e=>e.key)),D({}),_(void 0),y(`asc`),x({}),C(void 0),T([]),j(!1),h(``),N([]),F(`table`),I(1)};if(e.length===0||u.length===0)return(0,n.jsx)(`div`,{class:K(`table-note`),children:`No rows returned.`});let J=e=>{let t=new Set(G.map(({index:e})=>e));N(n=>e?[...new Set([...n,...t])]:n.filter(e=>!t.has(e)))};return(0,n.jsxs)(`section`,{ref:z,class:K(`data-table`),children:[(0,n.jsxs)(`div`,{class:K(`table-fields`),children:[(0,n.jsx)(`strong`,{children:`Fields`}),(0,n.jsx)(`div`,{class:K(`field-list`),children:u.map(e=>(0,n.jsx)(`span`,{class:K(`field-chip`),children:e.label},e.key))}),(0,n.jsxs)(`span`,{class:K(`table-field-count`),children:[e.length.toLocaleString(a),` rows`]})]}),(0,n.jsxs)(`div`,{class:K(`table-controls`),children:[(0,n.jsxs)(`label`,{class:K(`table-search`),children:[(0,n.jsx)(`span`,{"aria-hidden":`true`,children:`⌕`}),(0,n.jsx)(`input`,{type:`search`,value:m,placeholder:`Search this result...`,"aria-label":`Search this result`,onInput:e=>{h(e.currentTarget.value.trim()),I(1)}})]}),(0,n.jsx)(`div`,{class:K(`table-modes`),role:`group`,"aria-label":`Table display mode`,children:[`table`,`matrix`].map(e=>(0,n.jsx)(`button`,{type:`button`,class:`${K(`segment`)}${P===e?` is-active`:``}`,"aria-pressed":P===e,onClick:()=>F(e),children:e===`table`?`Table`:`Matrix`},e))})]}),(0,n.jsxs)(`div`,{class:K(`table-column-bar`),children:[(0,n.jsxs)(`details`,{"data-result-popover":!0,class:K(`column-picker`),children:[(0,n.jsx)(`summary`,{children:`Columns`}),(0,n.jsx)(`div`,{class:K(`column-menu`),children:O.map((e,t)=>{let r=u.find(t=>t.key===e);return r?(0,n.jsxs)(`div`,{class:K(`column-picker-row`),children:[(0,n.jsxs)(`label`,{children:[(0,n.jsx)(`input`,{type:`checkbox`,checked:f.includes(r.key),onChange:e=>{let t=e.currentTarget.checked;p(e=>t?[...new Set([...e,r.key])]:e.length>1?e.filter(e=>e!==r.key):e)}}),(0,n.jsx)(`span`,{children:E[r.key]||r.label})]}),(0,n.jsx)(`button`,{type:`button`,"aria-label":`Move ${r.label} left`,disabled:t===0,onClick:()=>k(e=>{let n=[...e];return[n[t-1],n[t]]=[n[t],n[t-1]],n}),children:`↑`}),(0,n.jsx)(`button`,{type:`button`,"aria-label":`Move ${r.label} right`,disabled:t===O.length-1,onClick:()=>k(e=>{let n=[...e];return[n[t+1],n[t]]=[n[t],n[t+1]],n}),children:`↓`})]},r.key):null})})]}),(0,n.jsx)(`button`,{type:`button`,class:K(`table-view-button`),"aria-pressed":A,onClick:()=>j(e=>!e),children:A?`Comfortable rows`:`Compact rows`}),(0,n.jsx)(`button`,{type:`button`,class:K(`table-view-button`),onClick:q,children:`Reset view`})]}),Object.keys(b).length?(0,n.jsx)(`div`,{class:K(`table-filter-bar`),children:Object.entries(b).map(([e,t])=>{let r=u.find(t=>t.key===e);return(0,n.jsxs)(`button`,{type:`button`,class:K(`table-filter-chip`),"aria-label":`Clear ${r?.label??e} filter`,onClick:()=>x(t=>{let n={...t};return delete n[e],n}),children:[E[e]||r?.label||e,` `,t.operator.replaceAll(`_`,` `),` `,t.value,` ×`]},e)})}):null,(0,n.jsx)(`div`,{class:K(`table-wrap`),role:`region`,"aria-label":`Scrollable result table`,tabIndex:0,children:(0,n.jsxs)(`table`,{class:`${K(`table`)}${P===`matrix`?` is-matrix`:``}${A?` is-compact`:``}`,children:[(0,n.jsxs)(`caption`,{class:K(`visually-hidden`),children:[`Result table with `,V.length,` `,V.length===1?`row`:`rows`]}),(0,n.jsx)(`thead`,{children:(0,n.jsxs)(`tr`,{children:[(0,n.jsx)(`th`,{class:K(`select-cell`),children:(0,n.jsx)(`input`,{type:`checkbox`,"aria-label":`Select all visible rows`,checked:te,onChange:e=>J(e.currentTarget.checked)})}),B.map(e=>(0,n.jsxs)(`th`,{scope:`col`,class:S===e.key?`is-pinned`:void 0,style:S===e.key?{left:`34px`}:void 0,"aria-sort":g===e.key?v===`asc`?`ascending`:`descending`:`none`,children:[(0,n.jsxs)(`button`,{type:`button`,class:K(`table-sort`),"aria-label":`Sort by ${e.label}`,onClick:()=>{g===e.key?y(e=>e===`asc`?`desc`:`asc`):(_(e.key),y(`asc`)),I(1)},children:[(0,n.jsx)(`span`,{children:E[e.key]||e.label}),(0,n.jsx)(`span`,{class:K(`sort-direction`),"aria-hidden":`true`,children:g===e.key?v===`asc`?`↑`:`↓`:`↕`})]}),(0,n.jsxs)(`details`,{"data-result-popover":!0,class:K(`table-column-menu`),onToggle:e=>{let t=e.currentTarget,n=t.querySelector(`.${K(`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}z.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:[(0,n.jsx)(`summary`,{"aria-label":`Actions for ${e.label}`,children:`⋯`}),(0,n.jsxs)(`div`,{class:K(`table-column-panel`),popover:`manual`,children:[(0,n.jsx)(`strong`,{children:E[e.key]||e.label}),(0,n.jsx)(`button`,{type:`button`,onClick:()=>{_(e.key),y(`asc`),I(1)},children:`Sort ascending`}),(0,n.jsx)(`button`,{type:`button`,onClick:()=>{_(e.key),y(`desc`),I(1)},children:`Sort descending`}),(0,n.jsx)(`span`,{children:`Filter values`}),(0,n.jsx)(ln,{classPrefix:c,label:`Filter operator for ${e.label}`,value:b[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`]]}),(0,n.jsx)(`input`,{type:`text`,"aria-label":`Filter value for ${e.label}`,defaultValue:b[e.key]?.value??``,placeholder:`Enter a value`}),(0,n.jsx)(`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;x(t=>{let n={...t};return r?n[e.key]={operator:i,value:r}:delete n[e.key],n}),I(1),t.currentTarget.closest(`details`).open=!1},children:`Apply filter`}),(0,n.jsx)(`button`,{type:`button`,onClick:t=>{C(t=>t===e.key?void 0:e.key),k(t=>[e.key,...t.filter(t=>t!==e.key)]),t.currentTarget.closest(`details`).open=!1},children:S===e.key?`Unpin column`:`Pin column`}),(0,n.jsx)(`button`,{type:`button`,onClick:t=>{T(t=>t.includes(e.key)?t.filter(t=>t!==e.key):[...t,e.key]),t.currentTarget.closest(`details`).open=!1},children:w.includes(e.key)?`Do not wrap text`:`Wrap text`}),(0,n.jsx)(`input`,{type:`text`,"aria-label":`Display name for ${e.label}`,defaultValue:E[e.key]||e.label,maxLength:80}),(0,n.jsx)(`button`,{type:`button`,onClick:t=>{let n=t.currentTarget.parentElement.querySelector(`input[aria-label^="Display name"]`).value.trim();D(t=>({...t,[e.key]:n||e.label||e.key})),t.currentTarget.closest(`details`).open=!1},children:`Apply display name`})]})]})]},e.key))]})}),(0,n.jsx)(`tbody`,{children:G.map(({row:e,index:t})=>(0,n.jsxs)(`tr`,{class:M.includes(t)?`is-selected`:void 0,children:[(0,n.jsx)(`td`,{class:K(`select-cell`),children:(0,n.jsx)(`input`,{type:`checkbox`,"aria-label":`Select row ${t+1}`,checked:M.includes(t),onChange:e=>N(n=>e.currentTarget.checked?[...new Set([...n,t])]:n.filter(e=>e!==t))})}),B.map(t=>(0,n.jsx)(`td`,{class:`${w.includes(t.key)?`is-wrapped`:``} ${S===t.key?`is-pinned`:``}`.trim(),style:S===t.key?{left:`34px`}:void 0,children:on(e[t.key],a,t,o)},t.key))]},t))})]})}),(0,n.jsxs)(`div`,{class:K(`table-summary`),children:[(0,n.jsx)(`span`,{children:H.length?`${((W-1)*L+1).toLocaleString(a)}-${Math.min(W*L,H.length).toLocaleString(a)} of ${V.length.toLocaleString(a)}`:`0 of ${V.length.toLocaleString(a)}`}),s?(0,n.jsx)(`span`,{children:e.length>i?`First ${i.toLocaleString(a)} rows available`:`All returned rows loaded`}):(0,n.jsxs)(`div`,{class:K(`table-pagination`),"aria-label":`Table pagination`,children:[(0,n.jsxs)(`label`,{children:[(0,n.jsx)(`span`,{children:`Rows`}),(0,n.jsx)(ln,{classPrefix:c,label:`Rows per page`,value:String(L),options:[[`10`,`10`],[`25`,`25`],[`50`,`50`]],onChange:e=>{R(Number(e)),I(1)}})]}),(0,n.jsx)(`button`,{type:`button`,"aria-label":`Previous page`,disabled:W<=1,onClick:()=>I(e=>Math.max(1,e-1)),children:`‹`}),(0,n.jsxs)(`span`,{children:[W,` / `,U]}),(0,n.jsx)(`button`,{type:`button`,"aria-label":`Next page`,disabled:W>=U,onClick:()=>I(e=>Math.min(U,e+1)),children:`›`})]})]})]})},pn=(e,t,n)=>{let r=ft(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:ut(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:ut(r.filtersApplied,{count:e.appliedFilters.length})}),i},mn=e=>e.columns?.length?e.columns:Object.keys(e.rows?.[0]??{}),hn=e=>{let t=e.rows??[],n=e.currency?.code&&!e.currency.isMixed?e.currency.code:void 0;return mn(e).map(r=>{let i=e.columnMetadata?.find(e=>e.key===r);if(!i)return{key:r,label:rn(r)};let a=i.dataType===`date`||i.dataType===`datetime`||i.semanticRole===`date`;return{key:r,label:i.label,dataType:i.dataType,semanticRole:i.semanticRole,currencyCode:i.currencyCode||(i.dataType===`currency`?n:void 0),formatPattern:i.formatPattern,grain:a?i.grain??e.periodComparison?.grain??Ze(t.map(e=>e[r])):void 0}})},gn=(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=>nt(n[e])!==null)??t[1]??t[0]},_n=(e,t,n=`analytics-result.csv`)=>{if(typeof document>`u`||e.length===0)return;let r=cn(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)},vn=new Set,yn=e=>{let t=e.composedPath();vn.forEach(e=>{e.isOpen()&&!e.contains(t)&&e.close(!1)})},bn=e=>{if(e.key===`Escape`){for(let t of vn)if(t.isOpen()){t.close(!0),e.preventDefault();return}}},xn=e=>(vn.size===0&&typeof document<`u`&&(document.addEventListener(`pointerdown`,yn),document.addEventListener(`keydown`,bn)),vn.add(e),()=>{vn.delete(e),vn.size===0&&typeof document<`u`&&(document.removeEventListener(`pointerdown`,yn),document.removeEventListener(`keydown`,bn))}),Sn=({children:e,size:t=15})=>(0,n.jsx)(`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}),Cn=()=>(0,n.jsx)(Sn,{children:(0,n.jsx)(`path`,{d:`M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7`})}),wn=()=>(0,n.jsx)(Sn,{children:(0,n.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})}),Tn=()=>(0,n.jsx)(Sn,{size:13,children:(0,n.jsx)(`path`,{d:`m6 9 6 6 6-6`})}),En=()=>(0,n.jsx)(Sn,{size:13,children:(0,n.jsx)(`path`,{d:`m5 12 5 5L20 7`})}),Dn=({type:e,className:t})=>(0,n.jsxs)(`svg`,{viewBox:`0 0 32 32`,"aria-hidden":`true`,class:t,fill:`none`,children:[(0,n.jsx)(`path`,{d:`M6 26h21M6 7v19`,stroke:`var(--rv-muted)`,"stroke-width":`1.4`,"stroke-linecap":`round`}),e===`line`?(0,n.jsx)(`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`?(0,n.jsx)(n.Fragment,{children:[9,15,21].map((e,t)=>(0,n.jsxs)(`g`,{children:[(0,n.jsx)(`rect`,{x:e,y:18-t*2,width:`4`,height:8+t*2,fill:`var(--rv-chart-2)`,rx:`0.6`}),(0,n.jsx)(`rect`,{x:e,y:13-t,width:`4`,height:`5`,fill:`var(--rv-chart-3)`,rx:`0.6`}),(0,n.jsx)(`rect`,{x:e,y:9-t,width:`4`,height:`4`,fill:`var(--rv-chart-1)`,rx:`0.6`})]},e))}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`rect`,{x:`9`,y:`18`,width:`4`,height:`8`,fill:`var(--rv-chart-2)`,rx:`0.7`}),(0,n.jsx)(`rect`,{x:`15`,y:`13`,width:`4`,height:`13`,fill:`var(--rv-chart-2)`,rx:`0.7`}),(0,n.jsx)(`rect`,{x:`21`,y:`8`,width:`4`,height:`18`,fill:`var(--rv-chart-2)`,rx:`0.7`})]})]}),On=e=>{let[n,r]=(0,t.useState)(!1),i=(0,t.useRef)(null),a=(0,t.useRef)(null),o=(0,t.useRef)(n);return o.current=n,(0,t.useEffect)(()=>xn({isOpen:()=>o.current,contains:e=>!!(i.current&&e.includes(i.current)||a.current&&e.includes(a.current)),close:e=>{r(!1),e&&i.current?.focus()}}),[]),(0,t.useLayoutEffect)(()=>{if(!n)return;let t=()=>{let t=i.current,n=a.current;if(!t||!n)return;n.style.left=`0px`,n.style.top=`0px`;let r=n.getBoundingClientRect(),o=t.getBoundingClientRect(),s=document.documentElement.clientWidth||window.innerWidth,c=document.documentElement.clientHeight||window.innerHeight,l=getComputedStyle(t).direction===`rtl`,u=e===`end`===l?o.left:o.right-r.width;u=Math.max(8,Math.min(u,s-r.width-8));let d=o.bottom+7;d+r.height>c-8&&o.top-7-r.height>8&&(d=o.top-7-r.height),n.style.left=`${u-r.left}px`,n.style.top=`${d-r.top}px`};return t(),window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),a.current?.querySelector(`[aria-selected="true"], button`)?.focus({preventScroll:!0}),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0)}},[n,e]),{open:n,setOpen:r,triggerRef:i,layerRef:a}},kn=({visualization:e,field:t,prefix:r,labels:i,locale:a,headerTitle:o})=>{let s=e.rows??[],c=e.columnMetadata?.find(e=>e.key===t),l=t?s[0]?.[t]:void 0,u=nt(l),d=t=>Lt(t,c,e,!1,a),f=u===null?String(l??i.noValue):d(u),p=e.periodComparison,m=!p?.measureField||p.measureField===t,h=t?nt(s[1]?.[t]):null,g=u!==null&&p&&m?me(p,{value:u,status:`observed`,label:p.currentPeriod?.label},{value:h??p.previousFullValue??p.previousToDateValue,status:`observed`,label:p.previousPeriod?.label},{format:d,locale:a}):void 0,_=c?.label??(t?rn(t):i.currentValue);return(0,n.jsxs)(`section`,{class:`${r}-analytics-kpi`,"aria-label":o??_,"data-testid":`analytics-kpi`,children:[(0,n.jsx)(`div`,{class:`${r}-analytics-kpi__label`,children:_}),(0,n.jsx)(`div`,{class:`${r}-analytics-kpi__value`,children:f}),g?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`div`,{class:`${r}-analytics-kpi__change is-${g.tone}`,"data-comparison-basis":g.basis,title:g.title,children:[(0,n.jsx)(`span`,{children:g.label}),g.copy?(0,n.jsx)(`span`,{class:`${r}-analytics-kpi__copy`,children:g.copy}):null]}),g.secondary?(0,n.jsx)(`div`,{class:`${r}-analytics-kpi__secondary`,children:g.secondary}):null]}):null]})},An=({visualization:e,classPrefix:r,labels:i,locale:a,expanded:o=!1,onExpand:s,onClose:c,expandControlId:l,onFollowUp:u,onDownload:d,headerActions:f,leading:p,children:m,dataToggle:h,cardRef:g,maxTableRows:_=100})=>{let v=(0,t.useMemo)(()=>ft(i),[i]),y=(0,t.useMemo)(()=>Ut(e,void 0,{labels:v,locale:a}),[e,v,a]),[b,x]=(0,t.useState)(y?.type);(0,t.useEffect)(()=>x(y?.type),[y]);let[S,C]=(0,t.useState)(!1),w=(0,t.useMemo)(()=>Yt(e,v),[e,v]),T=(0,t.useMemo)(()=>Ut(e,b,{labels:v,locale:a}),[e,b,v,a]),E=b??T?.type??y?.type,D=w.find(e=>e.type===E),O=[...new Set(T?.series.map(e=>e.field)??[])],k=On(`end`),A=On(`start`),j=e.rows??[],M=mn(e),N=(0,t.useMemo)(()=>Te(e),[e]),P=(0,t.useMemo)(()=>hn(N),[N]),F=(0,t.useMemo)(()=>({locale:a,timezone:e.timezone||e.periodComparison?.timezone,yes:v.yes,no:v.no}),[a,e.timezone,e.periodComparison?.timezone,v]),ee=pn(e,v,a),I=d===!1||!e.downloadAvailable?null:()=>(d??_n)(M,j),L=ee.length?(0,n.jsxs)(`details`,{class:`${r}-analytics-inspect`,children:[(0,n.jsx)(`summary`,{children:v.aboutResult}),(0,n.jsx)(`dl`,{children:ee.map(e=>(0,n.jsxs)(`div`,{children:[(0,n.jsx)(`dt`,{children:e.label}),(0,n.jsx)(`dd`,{children:e.value})]},e.label))})]}):null,R=(()=>{let t=e.freshness?.answeredAt,n=t?new Date(t):null;return!n||Number.isNaN(n.getTime())?v.liveData:ut(v.updatedAt,{time:new Intl.DateTimeFormat(a,{hour:`numeric`,minute:`2-digit`}).format(n)})})(),z=e.rowCount??j.length,B=e.appliedFilters?.length??0,V=(0,n.jsxs)(`div`,{class:`${r}-analytics-meta`,"data-testid":`analytics-result-meta`,role:`group`,"aria-label":v.resultDetails,children:[(0,n.jsxs)(`span`,{children:[(0,n.jsx)(`span`,{"aria-hidden":`true`,class:`${r}-analytics-meta__dot`}),R]}),e.reportingPeriod?.label?(0,n.jsx)(`span`,{children:e.reportingPeriod.label}):null,(0,n.jsx)(`span`,{children:ut(z===1?v.rowOne:v.rowMany,{count:z})}),B>0?(0,n.jsx)(`span`,{children:ut(B===1?v.filtersOne:v.filtersMany,{count:B})}):null]}),H=(t,i,a,d=v.expandChart)=>(0,n.jsxs)(`div`,{class:`${r}-analytics-result`,children:[(0,n.jsxs)(`section`,{ref:g,class:`${r}-analytics-visualization${o?` is-expanded`:``}`,"aria-label":t,children:[(0,n.jsxs)(`div`,{class:`${r}-analytics-visualization__header`,children:[(0,n.jsxs)(`div`,{children:[(0,n.jsx)(`div`,{class:`${r}-analytics-visualization__title`,children:t}),V]}),(0,n.jsxs)(`div`,{class:`${r}-analytics-visualization__actions`,children:[a,f,o&&c?(0,n.jsx)(`button`,{type:`button`,class:`${r}-analytics-visualization__close`,"aria-label":v.restoreView,title:v.restoreView,onClick:c,children:(0,n.jsx)(wn,{})}):s&&e.expandable!==!1?(0,n.jsx)(`button`,{type:`button`,class:`${r}-analytics-visualization__expand`,"aria-label":d,title:d,"data-visualization-message":l,onClick:s,children:(0,n.jsx)(Cn,{})}):null]})]}),p,i,L,m]}),(0,n.jsxs)(`div`,{class:`${r}-analytics-layer`,children:[u?(0,n.jsx)(`div`,{ref:A.layerRef,class:`${r}-analytics-chart-picker__menu`,style:{position:`fixed`},role:`menu`,"aria-label":v.aggregate,hidden:!A.open,children:O.flatMap(t=>qt(e,t).map(i=>{let a=e.columnMetadata?.find(e=>e.key===t)?.label??rn(t);return(0,n.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{let n=Jt(e,t,i.value);n&&u(n),A.setOpen(!1)},children:(0,n.jsxs)(`span`,{class:`${r}-analytics-chart-picker__copy`,children:[(0,n.jsxs)(`strong`,{children:[Kt(i.value,v),` · `,a]}),(0,n.jsx)(`small`,{children:v.aggregateCharge})]})},`${t}:${i.value}`)}))}):null,(0,n.jsx)(`div`,{ref:k.layerRef,class:`${r}-analytics-chart-picker__menu`,style:{position:`fixed`},role:`listbox`,"aria-label":v.chartType,hidden:!k.open,children:w.map(e=>{let t=e.type===E;return(0,n.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,class:t?`is-selected`:``,onClick:()=>{x(e.type),k.setOpen(!1),k.triggerRef.current?.focus()},children:[(0,n.jsx)(`span`,{class:`${r}-analytics-chart-picker__icon`,children:(0,n.jsx)(Dn,{type:e.type,className:`${r}-chart-type-icon`})}),(0,n.jsxs)(`span`,{class:`${r}-analytics-chart-picker__copy`,children:[(0,n.jsx)(`strong`,{children:e.label}),(0,n.jsx)(`small`,{children:e.hint})]}),t?(0,n.jsx)(En,{}):null]},e.type)})})]})]}),U=(0,n.jsx)(fn,{rows:N.rows??j,columns:P,maxRows:_,expanded:o,classPrefix:r,locale:a,format:F}),W=()=>e.tableAvailable===!1||M.length===0?null:H(e.title?.trim()||v.resultDetails,(0,n.jsx)(n.Fragment,{children:U}),I?(0,n.jsx)(`button`,{type:`button`,class:`${r}-analytics-visualization__download`,onClick:I,children:v.download}):null,v.expandTable);if(j.length===0)return(0,n.jsxs)(n.Fragment,{children:[p,(0,n.jsxs)(`section`,{class:`${r}-analytics-empty`,role:`status`,"data-testid":`analytics-empty-state`,children:[(0,n.jsx)(`p`,{children:v.noMatchTitle}),(0,n.jsx)(`p`,{children:v.noMatchBody})]}),L,m]});if(e.presentation===`table`||!e.presentation&&e.type===`table`)return W()??(0,n.jsx)(n.Fragment,{children:m});let G=h&&e.tableAvailable!==!1?(0,n.jsx)(`button`,{type:`button`,class:`${r}-analytics-visualization__download`,"aria-expanded":S,onClick:()=>C(e=>{let t=!e;return h.onToggle?.(t),t}),children:S?v.hideData:v.viewData}):null,te=S?(0,n.jsx)(`div`,{class:`${r}-analytics-data`,children:U}):null;return e.presentation===`kpi`||!e.presentation&&e.type===`kpi`?H(v.liveMetric,(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(kn,{visualization:e,field:gn(e,M),prefix:r,labels:v,locale:a}),G,te]})):T?H(T.title,(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(nn,{model:T,expanded:o,classPrefix:r}),I?(0,n.jsx)(`button`,{type:`button`,class:`${r}-analytics-visualization__download`,onClick:I,children:v.downloadData}):null,G,te]}),(0,n.jsxs)(n.Fragment,{children:[u?(0,n.jsx)(`div`,{class:`${r}-analytics-chart-picker ${r}-analytics-chart-picker--aggregation`,children:(0,n.jsxs)(`button`,{type:`button`,ref:A.triggerRef,"aria-haspopup":`menu`,"aria-expanded":A.open,"aria-label":v.aggregate,title:v.aggregateTitle,onClick:()=>{k.setOpen(!1),A.setOpen(!A.open)},children:[(0,n.jsx)(`span`,{class:`${r}-analytics-chart-picker__current`,children:(0,n.jsx)(`span`,{children:v.aggregate})}),(0,n.jsx)(Tn,{})]})}):null,w.length>1?(0,n.jsx)(`div`,{class:`${r}-analytics-chart-picker`,children:(0,n.jsxs)(`button`,{type:`button`,ref:k.triggerRef,"aria-haspopup":`listbox`,"aria-expanded":k.open,"aria-label":v.chooseChartType,title:v.chooseChartType,onClick:()=>{A.setOpen(!1),k.setOpen(!k.open)},children:[(0,n.jsxs)(`span`,{class:`${r}-analytics-chart-picker__current`,children:[(0,n.jsx)(Dn,{type:E??T.type,className:`${r}-chart-type-icon`}),(0,n.jsx)(`span`,{children:D?.label??v.chartFallback})]}),(0,n.jsx)(Tn,{})]})}):null]})):W()??(0,n.jsx)(n.Fragment,{children:m})},jn=[`#2563eb`,`#b45309`,`#7c3aed`],Mn=[`#60a5fa`,`#fbbf24`,`#a78bfa`],Nn=(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
+ `},Pn=16e3;var Fn=class{constructor(e){s(this,`ratio`,void 0),s(this,`position`,0),s(this,`carry`,[]),this.ratio=e/Pn}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 In=(e,t=Pn)=>{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`})},Ln=e=>e.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu,` `).split(/\s+/).filter(e=>e.length>1),Rn=(e,t)=>{let n=Ln(e);if(n.length===0||!t.trim())return!1;let r=new Set(Ln(t));return n.filter(e=>r.has(e)).length/n.length>=.7},zn=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()},Bn=(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 zn(i)||(i.trim()?`The detailed results are available in the chat.`:``)},Vn=300,Hn=()=>{let e=globalThis;if(e.__voiceDebug)return!0;try{return e.localStorage?.getItem(`accurix.voiceDebug`)===`1`}catch{return!1}};var Un=class{constructor(e=()=>Date.now()){this.now=e,s(this,`entries`,[]),s(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),Hn()&&console.debug(`VOICEDBG ${e} ${t?JSON.stringify(t):``}`)}list(){return this.entries.slice()}};const Wn=Pn/50,Gn=20,Kn=500,qn=120,Jn=300,Yn=280,Xn=600,Zn=300,Qn=12e3,$n=25e3,er=300,tr=2e4,nr=60,rr=400,ir=250,ar=8e-4,or=.1,sr=2.8,cr=1.8,lr=.006,ur=.004,dr=1.8,fr=1.4,pr=2e3,mr=2e3;var hr=class{constructor(e){this.options=e,s(this,`endSilenceMs`,void 0),s(this,`pending`,new Float32Array),s(this,`levels`,[]),s(this,`framesSinceFloor`,0),s(this,`floor`,ar*4),s(this,`recentSpeech`,[]),s(this,`preroll`,[]),s(this,`silentMs`,0),s(this,`inputSilent`,!1),s(this,`outputActive`,!1),s(this,`turns`,[]),s(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(ar,t[Math.floor(t.length*.1)]??ar)}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:In(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 gr=2048,_r=[300,1e3,2500],vr=()=>typeof navigator<`u`&&typeof navigator.mediaDevices?.getUserMedia==`function`&&typeof globalThis.AudioContext==`function`,yr=e=>{let t=e?.name;return t===`NotAllowedError`||t===`SecurityError`?`permission-denied`:t===`NotFoundError`||t===`OverconstrainedError`?`no-device`:`error`};var br=class{constructor(e){this.options=e,s(this,`log`,new Un),s(this,`turns`,void 0),s(this,`mic`,`off`),s(this,`reason`,void 0),s(this,`muted`,!1),s(this,`inputSilent`,!1),s(this,`stream`,null),s(this,`context`,null),s(this,`source`,null),s(this,`processor`,null),s(this,`sink`,null),s(this,`downsampler`,null),s(this,`deviceId`,void 0),s(this,`generation`,0),s(this,`recoveryAttempt`,0),s(this,`recoveryTimer`,null),s(this,`lastSnapshot`,``),s(this,`groupId`,void 0),s(this,`onTrackEnded`,()=>{this.log.add(`track-ended`),this.recover(`track-ended`)}),s(this,`onTrackMuteChange`,()=>{let e=this.stream?.getAudioTracks()[0];this.log.add(`track-mute-change`,{muted:!!e?.muted}),this.refreshMic()}),s(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()}),s(this,`onDeviceChange`,()=>{this.checkDevices()}),this.deviceId=e.deviceId,this.turns=new hr({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??(vr()?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=yr(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 Fn(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=_r[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 xr=(0,e.createContext)(U),Sr=()=>(0,t.useContext)(xr),Cr=(e,n)=>{let r=(0,t.useRef)(n);r.current=n;let i=(0,t.useRef)(()=>void 0),a=e.aiExplanation?.explanationId??e.explanationId??``,o=(0,t.useMemo)(()=>{let t=r.current;return new We(e,t?{poll:(e,t)=>r.current.poll(e,t),...t.retry?{retry:(e,t)=>r.current.retry(e,t)}:{}}:void 0,e=>i.current(e),{onSettled:e=>r.current?.settled?.(a,e)})},[a,e.aiExplanation?.status===`pending`?`pending`:`settled`,!!n]),[s,c]=(0,t.useState)(o.state);return(0,t.useEffect)(()=>(i.current=c,c(o.state),o.start(),()=>o.dispose()),[o]),[s.status===`ready`?s:{...s,explanation:e},o]},wr=({prefix:e,state:t,onRetry:r})=>{let i=Sr();return(0,n.jsxs)(`div`,{class:`${e}-xp__ai`,"data-ai-status":t.status,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[t.status===`pending`?(0,n.jsx)(`p`,{class:`${e}-xp__ai-note`,children:t.stillWorking?i.stillWorkingDetailed:i.preparingDetailed}):null,t.status===`failed`?(0,n.jsxs)(`p`,{class:`${e}-xp__ai-note`,children:[i.detailedUnavailable,t.retryAvailable?(0,n.jsx)(`button`,{type:`button`,class:`${e}-xp__ai-retry`,disabled:t.retrying,onClick:r,children:i.detailedRetry}):null]}):null,t.status===`ready`&&t.announcement?(0,n.jsx)(`span`,{class:`${e}-xp__sr`,children:t.announcement}):null]})},Tr=({citations:e,step:t,prefix:r,active:i,onToggle:a,evidenceById:o})=>{let s=Sr();return e.length===0?null:(0,n.jsx)(n.Fragment,{children:e.map(e=>{let c=i?.id===e.id&&i.step===t;return(0,n.jsx)(`button`,{type:`button`,class:`${r}-xp__cite`,"data-evidence-id":e.id,"aria-expanded":c,"aria-label":`${s.citationLabel} ${e.index}: ${o[e.id]?.text??``}`.trim(),onClick:n=>a(e.id,t,n.currentTarget),children:Fe(e).slice(1,-1)},e.id)})})},Er=(e,t)=>e.sourceTargets.find(e=>t?t(e):!0),Dr=({evidence:e,prefix:r,onClose:i,onOpenSource:a,canOpenSource:o})=>{let s=Sr(),c=(0,t.useRef)(null);(0,t.useEffect)(()=>{c.current?.focus()},[e.id]);let l=a?Er(e,o):void 0;return(0,n.jsxs)(`div`,{ref:c,class:`${r}-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(),i())},children:[(0,n.jsxs)(`div`,{class:`${r}-xp__evidence-head`,children:[(0,n.jsxs)(`p`,{class:`${r}-xp__evidence-text`,children:[`[`,e.index,`] `,e.text]}),(0,n.jsx)(`button`,{type:`button`,class:`${r}-xp__close`,"aria-label":s.closeEvidence,onClick:i,children:`×`})]}),(0,n.jsx)(`dl`,{class:`${r}-xp__evidence-rows`,children:Ie(e,s).map(e=>(0,n.jsxs)(`div`,{style:{display:`contents`},"data-row":e.key,children:[(0,n.jsx)(`dt`,{children:e.label}),(0,n.jsx)(`dd`,{children:e.value})]},e.key))}),l&&a?(0,n.jsx)(`div`,{class:`${r}-xp__evidence-actions`,children:(0,n.jsx)(`button`,{type:`button`,class:`${r}-xp__button`,onClick:()=>a(l,e),children:s.openSource})}):null]})},Or=({down:e})=>(0,n.jsx)(`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:(0,n.jsx)(`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`})}),kr=(e,t,n)=>t===`wrong_numbers`?e.reasonWrongNumbers:t===`missing_comparison`?e.reasonMissingComparison:t===`unclear`?e.reasonUnclear:t===`too_long`?e.reasonTooLong:n,Ar=({prefix:e,explanationId:r,submit:i,context:a})=>{let o=Sr(),[s,c]=(0,t.useState)({phase:`idle`,reasons:[],comment:``}),l=(0,t.useMemo)(()=>new ze(r,i,c,a),[r]),u=s.phase===`saving`;return(0,n.jsxs)(`div`,{class:`${e}-xp__feedback`,"data-testid":`analytics-explanation-feedback`,children:[s.phase===`done`?(0,n.jsxs)(`div`,{class:`${e}-xp__feedback-row`,role:`status`,children:[(0,n.jsx)(`span`,{class:`${e}-xp__feedback-note`,children:o.feedbackThanks}),(0,n.jsx)(`button`,{type:`button`,class:`${e}-xp__button`,onClick:()=>void l.undo(),children:o.feedbackUndo})]}):(0,n.jsxs)(`div`,{class:`${e}-xp__feedback-row`,children:[(0,n.jsx)(`span`,{class:`${e}-xp__feedback-label`,children:o.feedbackPrompt}),(0,n.jsx)(`button`,{type:`button`,class:`${e}-xp__vote`,"aria-label":o.feedbackHelpful,"aria-pressed":s.rating===`up`,disabled:u,onClick:()=>void l.vote(`up`),children:(0,n.jsx)(Or,{down:!1})}),(0,n.jsx)(`button`,{type:`button`,class:`${e}-xp__vote`,"aria-label":o.feedbackNotHelpful,"aria-pressed":s.rating===`down`,disabled:u,onClick:()=>void l.vote(`down`),children:(0,n.jsx)(Or,{down:!0})})]}),s.phase===`details`||u&&s.rating===`down`?(0,n.jsxs)(`form`,{class:`${e}-xp__feedback-form`,onSubmit:e=>{e.preventDefault(),l.send()},children:[(0,n.jsxs)(`fieldset`,{class:`${e}-xp__reasons`,children:[(0,n.jsx)(`legend`,{children:o.feedbackReasonsPrompt}),W.map(t=>(0,n.jsx)(`button`,{type:`button`,class:`${e}-xp__reason`,"aria-pressed":s.reasons.includes(t.id),onClick:()=>l.toggleReason(t.id),children:kr(o,t.id,t.label)},t.id))]}),(0,n.jsx)(`textarea`,{class:`${e}-xp__comment`,"aria-label":o.feedbackCommentPlaceholder,placeholder:o.feedbackCommentPlaceholder,maxLength:500,value:s.comment,onInput:e=>l.setComment(e.currentTarget.value)}),(0,n.jsx)(`div`,{class:`${e}-xp__feedback-row`,children:(0,n.jsx)(`button`,{type:`submit`,class:`${e}-xp__button is-primary`,disabled:u,children:o.feedbackSubmit})})]}):null,s.error?(0,n.jsx)(`p`,{class:`${e}-xp__feedback-error`,role:`alert`,children:s.error}):null]})},jr=({aiTransport:e,...r})=>{let[i,a]=Cr(r.explanation,e),o=Mr(r.explanation),s=(0,t.useMemo)(()=>({...U,...r.copy}),[r.copy]);return(0,n.jsx)(xr.Provider,{value:s,children:(0,n.jsx)(Nr,{...r,explanation:i.explanation,aiStatus:o?(0,n.jsx)(wr,{prefix:r.classPrefix,state:i,onRetry:()=>void a.retry()}):null})})},Mr=e=>!!(e.aiExplanation&&e.aiExplanation.status!==`not_requested`),Nr=({explanation:e,aiStatus:r,classPrefix:i,showLead:a=!0,investigateOpen:o=!1,onFollowUp:s,onOpenSource:c,canOpenSource:l,onFeedback:u,feedbackContext:d,onExpand:f,onCollapse:p,expanded:m=!1,...h})=>{let g=Sr(),_=(0,t.useRef)(null),v=(0,t.useRef)(null),y=(0,t.useRef)(!1),b=()=>{let e=_.current,t=e?.getRootNode(),n=t&&`activeElement`in t?t.activeElement:null;return!!(e&&n&&e.contains(n))},x=(0,t.useMemo)(()=>(y.current=b(),Ne(e,{...h,copy:g})),[e,h.locale,h.cleanText,g]),[S,C]=(0,t.useState)(),w=(0,t.useRef)(null);(0,t.useLayoutEffect)(()=>{S&&(x.evidenceById[S.id]&&_.current?.querySelector(`[data-testid="analytics-explanation-evidence"]`)||(C(void 0),y.current&&!b()&&(v.current??_.current)?.focus()))},[x]);let T=(e,t,n)=>{w.current=n,C(n=>n?.id===e&&n.step===t?void 0:{id:e,step:t})},E=()=>{C(void 0);let e=w.current;e?.isConnected?e.focus():(v.current??_.current)?.focus()},D=(e,t)=>(0,n.jsx)(Tr,{citations:e,step:t,prefix:i,active:S,onToggle:T,evidenceById:x.evidenceById}),O=e=>{if(!S||S.step!==e)return null;let t=x.evidenceById[S.id];return t?(0,n.jsx)(Dr,{evidence:t,prefix:i,onClose:E,onOpenSource:c,canOpenSource:l}):null},k=(e,t)=>(0,n.jsxs)(n.Fragment,{children:[e.text,D(e.citations,t)]}),{investigate:A}=x;return(0,n.jsxs)(`section`,{ref:_,class:`${i}-xp${m?` is-expanded`:``}${f||p?` has-expand`:``}`,"data-testid":`analytics-explanation`,"aria-label":g.region,tabIndex:-1,children:[m&&p?(0,n.jsx)(`button`,{type:`button`,class:`${i}-xp__expand`,"aria-label":g.collapse,title:g.collapse,onClick:p,children:`×`}):f?(0,n.jsx)(`button`,{type:`button`,class:`${i}-xp__expand`,"aria-label":g.expand,title:g.expand,"data-testid":`analytics-explanation-expand`,onClick:f,children:`⤢`}):null,a?(0,n.jsxs)(`div`,{class:`${i}-xp__lead`,"data-step":`lead`,children:[x.lead.preface?(0,n.jsx)(`p`,{class:`${i}-xp__preface`,children:x.lead.preface}):null,(0,n.jsxs)(`div`,{class:`${i}-xp__meta`,children:[(0,n.jsx)(`span`,{class:`${i}-xp__eyebrow`,children:x.lead.eyebrow}),(0,n.jsx)(`span`,{class:`${i}-xp__provenance`,children:x.lead.provenance})]}),(0,n.jsx)(`h3`,{class:`${i}-xp__headline`,ref:v,tabIndex:-1,children:k(x.lead.headline,`lead`)}),x.lead.summary?(0,n.jsx)(`p`,{class:`${i}-xp__summary`,children:k(x.lead.summary,`lead`)}):null,O(`lead`)]}):null,r,x.comparison.length>0?(0,n.jsxs)(`section`,{class:`${i}-xp__step`,"data-step":`comparison`,children:[(0,n.jsx)(`h4`,{class:`${i}-xp__title`,children:g.comparison}),(0,n.jsx)(`ul`,{class:`${i}-xp__periods`,children:x.comparison.map(e=>(0,n.jsxs)(`li`,{class:`${i}-xp__period`,"data-status":e.status??`observed`,children:[(0,n.jsx)(`span`,{class:`${i}-xp__period-label`,children:e.label}),e.valueText?(0,n.jsx)(`span`,{class:`${i}-xp__period-value`,children:e.valueText}):null,e.statusLabel?(0,n.jsx)(`span`,{class:`${i}-xp__chip is-${e.statusTone}`,children:e.statusLabel}):null,e.inProgress?(0,n.jsx)(`span`,{class:`${i}-xp__chip is-progress`,children:g.inProgress}):null,e.citation?D([e.citation],`comparison`):null,e.reason?(0,n.jsx)(`small`,{class:`${i}-xp__period-reason`,children:e.reason}):null]},e.key))}),O(`comparison`)]}):null,x.conclusions.length>0||x.businessMeaning?(0,n.jsxs)(`section`,{class:`${i}-xp__step`,"data-step":`conclusions`,children:[(0,n.jsx)(`h4`,{class:`${i}-xp__title`,children:g.conclusions}),x.conclusions.length>0?(0,n.jsx)(`ul`,{class:`${i}-xp__list`,children:x.conclusions.map(e=>(0,n.jsx)(`li`,{children:k(e,`conclusions`)},e.text))}):null,x.businessMeaning?(0,n.jsxs)(`p`,{class:`${i}-xp__meaning`,children:[(0,n.jsxs)(`strong`,{children:[g.whyItMatters,`: `]}),k(x.businessMeaning,`conclusions`)]}):null,O(`conclusions`)]}):null,x.limits.length>0?(0,n.jsxs)(`section`,{class:`${i}-xp__step`,"data-step":`limits`,children:[(0,n.jsx)(`h4`,{class:`${i}-xp__title`,children:g.limits}),(0,n.jsx)(`ul`,{class:`${i}-xp__list ${i}-xp__limits`,children:x.limits.map(e=>(0,n.jsxs)(`li`,{"data-kind":e.kind,children:[e.text,e.citation?D([e.citation],`limits`):null]},e.text))}),O(`limits`)]}):null,x.checkedLine?(0,n.jsx)(`p`,{class:`${i}-xp__checked`,"data-step":`checked`,children:x.checkedLine}):null,x.hasInvestigate?(0,n.jsxs)(`details`,{class:`${i}-xp__investigate`,"data-step":`investigate`,open:o,children:[(0,n.jsx)(`summary`,{children:g.investigate}),(0,n.jsxs)(`div`,{class:`${i}-xp__investigate-body`,children:[A.causes.length>0?(0,n.jsxs)(`div`,{class:`${i}-xp__group`,children:[(0,n.jsxs)(`div`,{class:`${i}-xp__group-head`,children:[(0,n.jsx)(`h4`,{class:`${i}-xp__title`,children:g.causes}),(0,n.jsx)(`span`,{class:`${i}-xp__hint`,children:g.causesHint})]}),A.causes.map(e=>(0,n.jsxs)(`article`,{class:`${i}-xp__card`,children:[(0,n.jsxs)(`p`,{class:`${i}-xp__card-title`,children:[e.title,D(e.citations,`investigate`)]}),e.howToCheck?(0,n.jsxs)(`p`,{class:`${i}-xp__card-body`,children:[g.howToCheck,` `,e.howToCheck]}):null]},e.title))]}):null,A.recommendations.length>0?(0,n.jsxs)(`div`,{class:`${i}-xp__group`,children:[(0,n.jsx)(`h4`,{class:`${i}-xp__title`,children:g.recommendations}),A.recommendations.map(e=>(0,n.jsxs)(`article`,{class:`${i}-xp__card`,children:[(0,n.jsxs)(`p`,{class:`${i}-xp__card-title`,children:[e.title,D(e.citations,`investigate`)]}),e.why?(0,n.jsx)(`p`,{class:`${i}-xp__card-body`,children:e.why}):null,e.watch?(0,n.jsxs)(`p`,{class:`${i}-xp__card-body`,children:[g.watch,` `,e.watch]}):null]},e.title))]}):null,A.outlook?(0,n.jsxs)(`div`,{class:`${i}-xp__group`,children:[(0,n.jsxs)(`div`,{class:`${i}-xp__group-head`,children:[(0,n.jsx)(`h4`,{class:`${i}-xp__title`,children:g.outlook}),(0,n.jsx)(`span`,{class:`${i}-xp__hint`,children:A.outlook.badge})]}),(0,n.jsx)(`p`,{class:`${i}-xp__card-body`,children:A.outlook.text}),A.outlook.note?(0,n.jsx)(`p`,{class:`${i}-xp__card-body`,children:A.outlook.note}):null]}):null,s&&A.followUps.length>0?(0,n.jsxs)(`div`,{class:`${i}-xp__group`,children:[(0,n.jsx)(`h4`,{class:`${i}-xp__title`,children:g.followUps}),(0,n.jsx)(`div`,{class:`${i}-xp__questions`,children:A.followUps.map(e=>(0,n.jsx)(`button`,{type:`button`,class:`${i}-xp__question`,onClick:()=>s(e),children:e},e))})]}):null,x.evidence.length>0?(0,n.jsxs)(`div`,{class:`${i}-xp__group`,children:[(0,n.jsx)(`h4`,{class:`${i}-xp__title`,children:g.evidenceList}),(0,n.jsx)(`ul`,{class:`${i}-xp__list`,children:x.evidence.map(e=>(0,n.jsxs)(`li`,{children:[e.text,D([{id:e.id,index:e.index}],`investigate`)]},e.id))})]}):null,O(`investigate`)]})]}):null,(0,n.jsx)(`p`,{class:`${i}-xp__source`,children:x.sourceNote}),u&&x.explanationId?(0,n.jsx)(Ar,{prefix:i,explanationId:x.explanationId,submit:u,context:d}):null]})},Pr=[{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(`.`)}],Fr={"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`}]}},Ir={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]??``),Lr=(e,t,n)=>!t||e.includes(t)?e:`${e} ${Q(n.caseReference,{reference:t})}`,Rr=e=>e?{...Ir,...e}:Ir,zr=(0,e.createContext)(Ir),Br=zr.Provider,Vr=(0,e.createContext)(void 0),Hr=Vr.Provider,Ur=()=>(0,t.useContext)(Vr),Wr=new Set([`ar`,`he`,`iw`,`fa`,`ur`,`ps`,`sd`,`ug`,`yi`,`dv`,`ckb`]),Gr=(e,t)=>{if(t===`ltr`||t===`rtl`)return t;let n=(e??``).trim().toLowerCase().split(/[-_]/)[0]??``;return Wr.has(n)?`rtl`:`ltr`},Kr=()=>(0,t.useContext)(zr),qr=[[`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})),Jr=e=>[...e.toUpperCase()].map(e=>String.fromCodePoint(127397+e.charCodeAt(0))).join(``),Yr=()=>{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 qr.find(t=>t.iso===e)??qr.find(e=>e.iso===`US`)},Xr=e=>{let t=Yr(),n=e?.trim()??``;if(!n.startsWith(`+`))return{country:t,national:n.replace(/\D/g,``)};let r=n.replace(/\D/g,``),i=[...qr].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)}},Zr=(e,t)=>{let n=t.replace(/\D/g,``).replace(/^0+/,``);return n?`+${e.dial}${n}`:``},Qr=e=>{let t=e.replace(/\D/g,``);return e.startsWith(`+`)&&t.length>=8&&t.length<=15},$=(e,t)=>(0,n.jsx)(`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}),$r=e=>(0,n.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,n.jsx)(`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`})}),ei=e=>$((0,n.jsx)(`path`,{d:`m6 9 6 6 6-6`}),e),ti=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`m22 2-7 20-4-9-9-4Z`}),(0,n.jsx)(`path`,{d:`M22 2 11 13`})]}),e),ni=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z`}),(0,n.jsx)(`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`}),(0,n.jsx)(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`22`})]}),e),ri=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M9 9v1a3 3 0 0 0 4.24 2.73`}),(0,n.jsx)(`path`,{d:`M15 5.5V5a3 3 0 0 0-5.94-.6`}),(0,n.jsx)(`path`,{d:`M19 10v2a7 7 0 0 1-9.9 6.36`}),(0,n.jsx)(`path`,{d:`M5 10v2a6.98 6.98 0 0 0 1.11 3.79`}),(0,n.jsx)(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`22`}),(0,n.jsx)(`line`,{x1:`2`,y1:`2`,x2:`22`,y2:`22`})]}),e),ii=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M15 3h6v6`}),(0,n.jsx)(`path`,{d:`M10 14 21 3`}),(0,n.jsx)(`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})]}),e),ai=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`}),(0,n.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,n.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,n.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]}),e),oi=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`}),(0,n.jsx)(`path`,{d:`m22 7-10 5L2 7`})]}),e),si=e=>$((0,n.jsx)(`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),ci=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M4 14v-2a8 8 0 0 1 16 0v2`}),(0,n.jsx)(`path`,{d:`M18 19h-2`}),(0,n.jsx)(`rect`,{x:`3`,y:`13`,width:`4`,height:`6`,rx:`2`}),(0,n.jsx)(`rect`,{x:`17`,y:`13`,width:`4`,height:`6`,rx:`2`})]}),e),li=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4Z`}),(0,n.jsx)(`path`,{d:`M8 9h8M8 13h5`})]}),e),ui=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M3 4h18M4 4v12h16V4M12 16v5M8 21h8`}),(0,n.jsx)(`path`,{d:`m8 12 2.5-2.5 2 2L16 8`})]}),e),di=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6`}),(0,n.jsx)(`path`,{d:`M3 9h12M7 2v4M12 2v4`}),(0,n.jsx)(`circle`,{cx:`17`,cy:`17`,r:`4`}),(0,n.jsx)(`path`,{d:`M17 15v2l1.5 1`})]}),e),fi=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M4 4h16v16H5a3 3 0 0 1-3-3V6`}),(0,n.jsx)(`path`,{d:`M8 8h8M8 12h8M8 16h5`})]}),e),pi=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,n.jsx)(`path`,{d:`M8.5 14.5a4 4 0 0 0 7 0`}),(0,n.jsx)(`line`,{x1:`9`,y1:`9.5`,x2:`9.01`,y2:`9.5`}),(0,n.jsx)(`line`,{x1:`15`,y1:`9.5`,x2:`15.01`,y2:`9.5`})]}),e),mi=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,n.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}),e),hi=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,n.jsx)(`path`,{d:`M15.5 8.5a5 5 0 0 1 0 7`}),(0,n.jsx)(`path`,{d:`M19 5a9 9 0 0 1 0 14`})]}),e),gi=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4z`}),(0,n.jsx)(`line`,{x1:`22`,y1:`9`,x2:`16`,y2:`15`}),(0,n.jsx)(`line`,{x1:`16`,y1:`9`,x2:`22`,y2:`15`})]}),e),_i=e=>$((0,n.jsx)(`path`,{d:`M20 6 9 17l-5-5`}),e),vi=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,n.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),e),yi=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M1 4v6h6`}),(0,n.jsx)(`path`,{d:`M3.51 15a9 9 0 1 0 2.13-9.36L1 10`})]}),e),bi=e=>$((0,n.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`}),e),xi=e=>$((0,n.jsx)(`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),Si=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M18.36 6.64a9 9 0 1 1-12.73 0`}),(0,n.jsx)(`line`,{x1:`12`,y1:`2`,x2:`12`,y2:`12`})]}),e),Ci=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,n.jsx)(`path`,{d:`M12 7v5l3 2`})]}),e),wi=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M7 10v12`}),(0,n.jsx)(`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),Ti=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M17 14V2`}),(0,n.jsx)(`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),Ei=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M15 3h6v6`}),(0,n.jsx)(`path`,{d:`M9 21H3v-6`}),(0,n.jsx)(`path`,{d:`M21 3l-7 7`}),(0,n.jsx)(`path`,{d:`M3 21l7-7`})]}),e),Di=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`path`,{d:`M9 3v6H3`}),(0,n.jsx)(`path`,{d:`M15 21v-6h6`}),(0,n.jsx)(`path`,{d:`M9 9 2 2`}),(0,n.jsx)(`path`,{d:`M15 15l7 7`})]}),e),Oi=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`14`,rx:`2`}),(0,n.jsx)(`rect`,{x:`11`,y:`11`,width:`8`,height:`6`,rx:`1`,fill:`currentColor`,stroke:`none`})]}),e),ki=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`rect`,{x:`4`,y:`5`,width:`16`,height:`14`,rx:`2`}),(0,n.jsx)(`path`,{d:`M12 15V9`}),(0,n.jsx)(`path`,{d:`m8.5 12.5 3.5-3.5 3.5 3.5`})]}),e),Ai=e=>$((0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,n.jsx)(`path`,{d:`m19 12-7 7-7-7`})]}),e),ji=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\(https?:\/\/[^\s)]+\))|(\[[^\]]+\]\([^\s)]+\))|(https?:\/\/[^\s)]+)/g,Mi=e=>e.replace(/([^\n])\s+((?:[-*•]|\d+\.)\s+)(?=(?:\*\*[^*\n]{1,80}\*\*|[A-Z][A-Za-z0-9/& -]{1,50}:))/g,`$1
164
+ $2`),Ni=e=>{let t=[],r=0,i=0,a;for(ji.lastIndex=0;(a=ji.exec(e))!==null;){a.index>r&&t.push(e.slice(r,a.index));let o=a[0];if(o.startsWith("`"))t.push((0,n.jsx)(`code`,{class:`cf-md-code`,children:o.slice(1,-1)},i++));else if(o.startsWith(`**`))t.push((0,n.jsx)(`strong`,{children:o.slice(2,-2)},i++));else if(o.startsWith(`[`)&&!/\]\(https?:\/\//.test(o))t.push(/^\[([^\]]+)\]/.exec(o)?.[1]??o);else if(o.startsWith(`[`)){let e=/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/.exec(o),r=e?e[1]:o,a=e?e[2]:`#`;t.push((0,n.jsx)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer nofollow`,children:r},i++))}else t.push((0,n.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer nofollow`,children:o},i++));r=a.index+o.length}return r<e.length&&t.push(e.slice(r)),t},Pi=/^(```|#{1,6}\s|\s*[-*•]\s|\s*\d+\.\s)/,Fi=(e,t,r)=>{let i=`cf-md-h cf-md-h--${Math.min(e,6)}`;return e<=2?(0,n.jsx)(`h3`,{class:i,children:t},r):e===3?(0,n.jsx)(`h4`,{class:i,children:t},r):(0,n.jsx)(`h5`,{class:i,children:t},r)},Ii=e=>{let t=Mi(e.replace(/\r\n/g,`
165
+ `)).split(`
166
+ `),r=[],i=0,a=0;for(;a<t.length;){let e=t[a];if(e.trim().startsWith("```")){let e=[];for(a++;a<t.length&&!t[a].trim().startsWith("```");)e.push(t[a]),a++;a++,r.push((0,n.jsx)(`pre`,{class:`cf-md-pre`,children:(0,n.jsx)(`code`,{children:e.join(`
167
+ `)})},i++));continue}if(e.trim()===``){a++;continue}let o=/^(#{1,6})\s+(.*)$/.exec(e);if(o){r.push(Fi(o[1].length,Ni(o[2]),i++)),a++;continue}if(/^\s*[-*•]\s+/.test(e)){let e=[];for(;a<t.length&&/^\s*[-*•]\s+/.test(t[a]);)e.push((0,n.jsx)(`li`,{children:Ni(t[a].replace(/^\s*[-*•]\s+/,``))},e.length)),a++;r.push((0,n.jsx)(`ul`,{class:`cf-md-list`,children:e},i++));continue}if(/^\s*\d+\.\s+/.test(e)){let e=[];for(;a<t.length&&/^\s*\d+\.\s+/.test(t[a]);)e.push((0,n.jsx)(`li`,{children:Ni(t[a].replace(/^\s*\d+\.\s+/,``))},e.length)),a++;r.push((0,n.jsx)(`ol`,{class:`cf-md-list`,children:e},i++));continue}let s=[e];for(a++;a<t.length&&t[a].trim()!==``&&!Pi.test(t[a]);)s.push(t[a]),a++;let c=s.join(` `);if(/:\s*$/.test(c)&&a<t.length&&/^(?:\s*[-*•]\s+|\s*\d+\.\s+)/.test(t[a])){let e=/^(.*[.!?])\s+([^.!?]{2,120}:)$/.exec(c);e&&r.push((0,n.jsx)(`p`,{children:Ni(e[1])},i++)),r.push((0,n.jsx)(`p`,{class:`cf-md-list-intro`,children:Ni(e?.[2]??c)},i++))}else r.push((0,n.jsx)(`p`,{children:Ni(c)},i++))}return r},Li=e=>H(e),Ri=()=>{let e=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let t=requestAnimationFrame(()=>e.current?.scrollIntoView?.({block:`end`}));return()=>cancelAnimationFrame(t)},[]),e},zi=e=>e.trim().split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()??``).join(``)||`🤖`,Bi=e=>{let t=e?.avatarId?.trim().toLowerCase().replace(/[^a-z0-9-]/g,`-`);return t?` cf-avatar-preset--${t}`:``},Vi={"support-guide":`SG`,"sales-host":`SH`,"calm-advisor":`CA`,"technical-guide":`TG`,"school-desk":`SD`,"front-office":`FO`},Hi=e=>{let t=e?.avatarId?.trim().toLowerCase();return t&&Vi[t]||(e?zi(e.agentName):`·`)},Ui=({persona:e,small:t,hideWhenMissing:r})=>{let i=t?`cf-msg__avatar`:`cf-header__avatar`,a=e?.agentAvatarUrl?.trim();return a?(0,n.jsx)(`span`,{class:i,children:(0,n.jsx)(`img`,{src:a,alt:``})}):r?null:(0,n.jsx)(`span`,{class:`${i}${Bi(e)}`,children:Hi(e)})},Wi=()=>{let e=Kr(),[r,i]=(0,t.useState)(0),a=[`Understanding your question`,`Checking approved information`,`Preparing your answer`];return(0,t.useEffect)(()=>{let e=[window.setTimeout(()=>i(1),1800),window.setTimeout(()=>i(2),5e3)];return()=>e.forEach(e=>window.clearTimeout(e))},[]),(0,n.jsxs)(`div`,{class:`cf-msg__bubble cf-typing`,"aria-label":e.assistantTyping,children:[(0,n.jsx)(`span`,{class:`cf-typing__label`,"aria-live":`polite`,children:a[r]}),(0,n.jsx)(`span`,{class:`cf-typing__dot`}),(0,n.jsx)(`span`,{class:`cf-typing__dot`}),(0,n.jsx)(`span`,{class:`cf-typing__dot`})]})},Gi=3,Ki=({msg:e})=>{if(!e.sources||e.sources.length===0)return null;let t=new Set,r=[];for(let n of e.sources){let i=(n.url||n.title||``).toLowerCase();!i||t.has(i)||n.url&&e.content.includes(n.url)||(t.add(i),r.push(n))}if(r.length===0)return null;let i=r.slice(0,3),a=r.length-i.length;return(0,n.jsxs)(`div`,{class:`cf-sources`,children:[i.map((e,t)=>e.url?(0,n.jsxs)(`a`,{class:`cf-source`,href:e.url,target:`_blank`,rel:`noopener noreferrer nofollow`,title:e.title||e.url,children:[(0,n.jsx)(ii,{}),(0,n.jsx)(`span`,{children:e.title||e.url})]},t):(0,n.jsxs)(`span`,{class:`cf-source`,title:e.title,children:[(0,n.jsx)(ii,{}),(0,n.jsx)(`span`,{children:e.title})]},t)),a>0&&(0,n.jsxs)(`span`,{class:`cf-source cf-source--more`,children:[`+`,a,` more`]})]})},qi=({replies:e,onPick:t})=>e&&e.length>0?(0,n.jsx)(`div`,{class:`cf-chips`,children:e.map((e,r)=>(0,n.jsx)(`button`,{type:`button`,class:`cf-chip`,onClick:()=>t(e),children:e},r))}):null,Ji=({persona:e,starters:t,onPick:r,onFocusComposer:i,speaking:a,voiceState:o=`idle`,replyPending:s=!1,pinned:c=!1,muted:l=!1,onToggleMute:u,onEndCall:d,onTalkNow:f,showTalkNow:p=!1,micLevel:m=0,theaterMode:h=!1,onToggleTheater:g,onMinimize:_,audioDevices:v=[],selectedAudioDeviceId:y=``,onSelectAudioDevice:b,connectingOnly:x=!1})=>{if(!e)return null;let S=!!(e.allowVoiceInput&&e.talkbackMode&&e.talkbackMode!==`text`);if(!(S||e.widgetModule===`assistant`))return null;let C=e.agentAvatarUrl?.trim()||``,w=e.assistantMediaUrl?.trim()||C,T=e.assistantMediaKind===`video`&&!!w,E=t.slice(0,3),D=o!==`idle`,O=o===`idle`?`Speak with ${e.agentName}`:`End voice chat`,k=c&&S&&!D&&!a,A=o===`connecting`||o===`processing`||D&&s,j=[`cf-assistant-card__stage`,`cf-assistant-card__stage--local`,D?`is-live`:``,A?`is-thinking`:``,Ma(o)&&!l?`is-listening`:``,a||o===`speaking`?`is-speaking`:``,l?`is-muted`:``].filter(Boolean).join(` `),M=Ma(o)&&!l?{"--cf-listen":String(Math.max(.18,Math.min(1,m*8)))}:void 0,N=A&&(0,n.jsxs)(`span`,{class:`cf-call-ripple`,"aria-hidden":`true`,children:[(0,n.jsx)(`span`,{}),(0,n.jsx)(`span`,{}),(0,n.jsx)(`span`,{})]});if(x)return(0,n.jsxs)(`div`,{class:`cf-assistant-card cf-assistant-card--connecting`,"aria-live":`polite`,children:[(0,n.jsxs)(`div`,{class:`cf-assistant-card__connecting-avatar`,children:[C?(0,n.jsx)(`img`,{src:C,alt:``}):(0,n.jsx)(`span`,{class:`cf-assistant-card__connecting-face${Bi(e)}`,children:Hi(e)}),N]}),(0,n.jsxs)(`div`,{class:`cf-assistant-card__connecting-copy`,children:[(0,n.jsx)(`span`,{class:`cf-assistant-card__connecting-eyebrow`,children:e.agentName}),(0,n.jsx)(`strong`,{children:`Connecting with the AI…`})]})]});let P=D&&d&&(0,n.jsx)(La,{voiceState:o,muted:l,onToggleMute:u??(()=>{}),onEndCall:d,onTalkNow:f??(()=>{}),showTalkNow:p,micLevel:m,theaterMode:h,onToggleTheater:g??(()=>{}),onMinimize:_??(()=>{}),audioDevices:v,selectedAudioDeviceId:y,onSelectAudioDevice:b??(()=>{})});return k?(0,n.jsx)(`div`,{class:`cf-assistant-card cf-assistant-card--pinned cf-assistant-card--compact`,children:(0,n.jsxs)(`button`,{type:`button`,class:`cf-assistant-card__compact-speak`,onClick:i,children:[C?(0,n.jsx)(`span`,{class:`cf-assistant-card__compact-avatar`,children:(0,n.jsx)(`img`,{src:C,alt:``})}):null,(0,n.jsx)(`span`,{class:`cf-assistant-card__compact-mic`,"aria-hidden":`true`,children:(0,n.jsx)(ni,{})}),(0,n.jsx)(`span`,{class:`cf-assistant-card__compact-label`,children:O})]})}):(0,n.jsxs)(`div`,{class:`cf-assistant-card ${c?`cf-assistant-card--pinned`:``} ${a?`is-speaking`:``}`,children:[(w||S)&&(0,n.jsxs)(`div`,{class:j,style:M,children:[(0,n.jsxs)(`div`,{class:`cf-assistant-card__media ${w?`cf-assistant-card__media--uploaded`:`cf-assistant-card__media--generated`}${Bi(e)}`,children:[T?(0,n.jsx)(`video`,{src:w,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):w?(0,n.jsx)(`img`,{src:w,alt:``}):(0,n.jsx)(`div`,{class:`cf-assistant-card__avatar-stage${Bi(e)}`,children:(0,n.jsxs)(`div`,{class:`cf-assistant-card__face`,children:[(0,n.jsx)(`span`,{class:`cf-assistant-card__initials`,children:Hi(e)}),(0,n.jsx)(`span`,{class:`cf-assistant-card__eye cf-assistant-card__eye--left`}),(0,n.jsx)(`span`,{class:`cf-assistant-card__eye cf-assistant-card__eye--right`}),(0,n.jsx)(`span`,{class:`cf-assistant-card__mouth`})]})}),w&&!T&&(0,n.jsx)(`span`,{class:`cf-assistant-card__mouth cf-assistant-card__mouth--overlay`}),(0,n.jsx)(`span`,{class:`cf-avatar-aura cf-avatar-aura--one`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{class:`cf-avatar-aura cf-avatar-aura--two`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{class:`cf-avatar-listen-ring`,"aria-hidden":`true`}),(0,n.jsxs)(`span`,{class:`cf-avatar-wave`,"aria-hidden":`true`,children:[(0,n.jsx)(`span`,{}),(0,n.jsx)(`span`,{}),(0,n.jsx)(`span`,{}),(0,n.jsx)(`span`,{})]})]}),N,D&&(0,n.jsx)(`span`,{class:`cf-call-status`,role:`status`,"aria-live":`polite`,children:Na(o)}),S&&(P||(0,n.jsxs)(`button`,{type:`button`,class:`cf-assistant-card__speak`,onClick:i,children:[(0,n.jsx)(ni,{}),O]}))]}),!c&&(0,n.jsxs)(n.Fragment,{children:[e.agentDescription?(0,n.jsx)(`p`,{class:`cf-assistant-card__copy`,children:e.agentDescription}):(0,n.jsx)(`p`,{class:`cf-assistant-card__copy`,children:e.greeting}),E.length>0&&(0,n.jsx)(`div`,{class:`cf-assistant-card__chips`,children:E.map(e=>(0,n.jsx)(`button`,{type:`button`,class:`cf-assistant-card__chip`,onClick:()=>r(e),children:e},e))}),e.disclaimerText||e.assistantPrivacyUrl?(0,n.jsxs)(`p`,{class:`cf-assistant-card__privacy`,children:[e.disclaimerText||`This chat may be recorded for quality and support.`,e.assistantPrivacyUrl?(0,n.jsxs)(n.Fragment,{children:[` `,(0,n.jsx)(`a`,{href:e.assistantPrivacyUrl,target:`_blank`,rel:`noopener noreferrer nofollow`,children:`Privacy Policy`})]}):null]}):null]})]})},Yi={calendar:ai,"calendar-clock":di,headset:ci,mail:oi,message:li,newsletter:fi,phone:si,presentation:ui,lifebuoy:ci},Xi=e=>Yi[e]??oi,Zi=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`}},Qi={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`}},$i=(e,t,n={})=>Array.isArray(e)?e.filter(e=>e.readiness!==`unavailable`).map(e=>ea(e,n[e.id])):(t??[]).flatMap(e=>{let t=Qi[e];if(!t)return[];let n=Zi({...t,id:e}),r=Fr[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=>ea(e,n[e.id])),ea=(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]}))}},ta=(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)})}`},na=({label:e,required:r,value:i,onInput:a})=>{let o=(0,t.useMemo)(()=>Xr(i),[]),[s,c]=(0,t.useState)(o.country.iso),[l,u]=(0,t.useState)(o.national),[d,f]=(0,t.useState)(!1),[p,m]=(0,t.useState)(``),h=(0,t.useRef)(null),g=qr.find(e=>e.iso===s)??o.country,_=(0,t.useMemo)(()=>{let e=p.trim().toLowerCase().replace(/^\+/,``);return e?qr.filter(t=>t.name.toLowerCase().includes(e)||t.iso.toLowerCase().includes(e)||t.dial.includes(e)):qr},[p]);(0,t.useEffect)(()=>{if(!d)return;let e=e=>{h.current&&!e.composedPath().includes(h.current)&&f(!1)},t=e=>{e.key===`Escape`&&f(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[d]);let v=e=>{let t=qr.find(t=>t.iso===e)??g;c(t.iso),f(!1),m(``),a(Zr(t,l))};return(0,n.jsxs)(`div`,{class:`cf-phone`,role:`group`,"aria-label":`${e}${r?` *`:``}`,ref:h,children:[(0,n.jsxs)(`span`,{class:`cf-phone__label`,children:[e,r?` *`:``]}),(0,n.jsxs)(`div`,{class:`cf-phone__control`,children:[(0,n.jsxs)(`button`,{type:`button`,class:`cf-phone__country`,"aria-label":`${g.name}, +${g.dial}. Choose country and calling code`,"aria-haspopup":`listbox`,"aria-expanded":d,onClick:()=>f(e=>!e),children:[(0,n.jsx)(`span`,{"aria-hidden":`true`,children:Jr(g.iso)}),(0,n.jsxs)(`span`,{class:`cf-phone__country-code`,children:[`+`,g.dial]}),(0,n.jsx)(ei,{})]}),(0,n.jsx)(`input`,{class:`cf-phone__input`,type:`tel`,inputMode:`numeric`,pattern:`[0-9]*`,autoComplete:`tel-national`,maxLength:15,placeholder:`8028509941`,value:l,"aria-label":e,onInput:e=>{let t=e.target,n=t.value.replace(/\D/g,``);t.value=n,u(n),a(Zr(g,n))}})]}),d?(0,n.jsxs)(`div`,{class:`cf-phone__menu`,children:[(0,n.jsx)(`input`,{class:`cf-phone__search`,type:`search`,placeholder:`Search country or code`,"aria-label":`Search countries`,value:p,autoFocus:!0,onInput:e=>m(e.target.value)}),(0,n.jsx)(`div`,{class:`cf-phone__options`,role:`listbox`,"aria-label":`Countries`,children:_.length>0?_.map(e=>(0,n.jsxs)(`button`,{type:`button`,class:`cf-phone__option ${e.iso===g.iso?`is-selected`:``}`,role:`option`,"aria-selected":e.iso===g.iso,onClick:()=>v(e.iso),children:[(0,n.jsx)(`span`,{"aria-hidden":`true`,children:Jr(e.iso)}),(0,n.jsx)(`span`,{class:`cf-phone__option-name`,children:e.name}),(0,n.jsxs)(`span`,{class:`cf-phone__option-code`,children:[`+`,e.dial]})]},e.iso)):(0,n.jsx)(`div`,{class:`cf-phone__empty`,children:`No countries found`})})]}):null]})},ra=({field:e,value:t,onInput:r})=>{if(e.kind===`tel`)return(0,n.jsx)(na,{label:e.label,required:e.required,value:t,onInput:r});let i=e.placeholder??e.label,a={class:`cf-form__input`,placeholder:e.required?`${i} *`:i,value:t,"aria-label":e.label,onInput:e=>r(e.target.value)};return e.kind===`textarea`?(0,n.jsx)(`textarea`,{rows:2,...a}):(0,n.jsx)(`input`,{type:e.kind,...a})},ia=({spec:e,visitor:r,onSubmit:i,onCancel:a})=>{let o=Kr(),s=Ri(),[c,l]=(0,t.useState)(()=>{let t={};for(let n of e.fields)n.identity&&r[n.identity]&&(t[n.key]=r[n.identity]);return t}),[u,d]=(0,t.useState)(`idle`),[f,p]=(0,t.useState)(``),m=e=>!!(e.identity&&r[e.identity]?.trim()),h=e.fields.filter(e=>!m(e)),g=h.every(e=>!e.required||(c[e.key]?.trim()??``)!==``),_=r.email||r.name||``;return u===`done`?(0,n.jsxs)(`div`,{class:`cf-form cf-form--done`,children:[(0,n.jsx)(_i,{}),(0,n.jsx)(`span`,{children:f})]}):(0,n.jsxs)(`div`,{class:`cf-form`,ref:s,children:[h.length===0&&_&&(0,n.jsx)(`div`,{class:`cf-form__as`,children:Q(o.actionAs,{identity:_})}),h.map(e=>(0,n.jsx)(ra,{field:e,value:c[e.key]??``,onInput:t=>l(n=>({...n,[e.key]:t}))},e.key)),u===`error`&&(0,n.jsx)(`div`,{class:`cf-form__err`,children:o.formError}),(0,n.jsxs)(`div`,{class:`cf-form__actions`,children:[a&&(0,n.jsx)(`button`,{type:`button`,class:`cf-form__cancel`,onClick:a,children:o.cancel}),(0,n.jsx)(`button`,{type:`button`,class:`cf-form__submit`,disabled:!g||u===`submitting`,onClick:async()=>{if(!g||u===`submitting`)return;d(`submitting`);let t={},n={};for(let r of e.fields){let e=c[r.key]?.trim();e&&(t[r.key]=e,r.identity&&(n[r.identity]=e))}try{let e=await i(t,n);p(Lr(e.note||o.formThanks,e.caseReference,o)),d(`done`)}catch{d(`error`)}},children:u===`submitting`?o.sending:e.submit})]})]})},aa=e=>String(e).padStart(2,`0`),oa=()=>{let e=[];for(let t=9;t<=17;t++)e.push(`${aa(t)}:00`),e.push(`${aa(t)}:30`);return e},sa=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})},ca=(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}`}},la=(e,t)=>{let[n,r]=t.split(`:`).map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate(),n??0,r??0)},ua=(e,t)=>{let n=la(e,t);try{return new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n)}catch{return t}},da=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||``}catch{return``}},fa=(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}},pa=(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`)},ma=({actionId:e,fields:r=Fr[`book-demo`].fields,visitor:i,onSubmit:a,onCancel:o,onDemoSlots:s,onConfirmHostedBooking:c,scheduler:l,title:u,submitLabel:d})=>{let f=e===`public_schedule_callback`,p=f?Fr[`schedule-callback`]:Fr[`book-demo`],m=u?.trim()||p.title,h=Kr(),g=Ri(),_=!!(!f&&l?.connected&&l.provider===`calendly`),v=_?h.bookingOpenScheduler:d?.trim()||p.submit,y=!!(l?.connected&&l.mode===`event`&&!_&&(l.availability===void 0||l.availability.calendarIds.length>0)),b=Math.min(60,Math.max(1,l?.availability?.bookingWindowDays??14)),x=(0,t.useMemo)(()=>sa(b),[b]),[S,C]=(0,t.useState)(null),[w,T]=(0,t.useState)(y?`loading`:`request_only`),[E,D]=(0,t.useState)(l?.availability?.slotDurationMinutes??30),[O,k]=(0,t.useState)(da()||l?.availability?.timezone||``),A=(0,t.useMemo)(()=>y?w!==`available`||S===null?[]:[...new Set([...S].map(e=>{let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}))].sort():oa(),[S,w,y]),[j,M]=(0,t.useState)((0,t.useMemo)(()=>{let e=Date.now();for(let t=0;t<x.length;t++)if(A.some(n=>la(x[t],n).getTime()>e))return t;return 0},[x,A])),[N,P]=(0,t.useState)(null),[F,ee]=(0,t.useState)(i.name??``),[I,L]=(0,t.useState)(i.email??``),[R,z]=(0,t.useState)(i.phone??``),[B,V]=(0,t.useState)(``),[H,U]=(0,t.useState)(`idle`),[W,G]=(0,t.useState)(``),[te,K]=(0,t.useState)(!1),[q,J]=(0,t.useState)(``),[ne,re]=(0,t.useState)(`scheduler`),[ie,ae]=(0,t.useState)(null),[oe,se]=(0,t.useState)(`idle`),[ce,le]=(0,t.useState)(``),[ue,de]=(0,t.useState)(``),[Y,fe]=(0,t.useState)(``),X=(0,t.useRef)(null),pe=async(e,t,n)=>{se(`loading`);try{let r=await c?.(e,t,n);if(!r?.confirmed)throw Error(`booking confirmation unavailable`);let i=r?.meetingUrl||r?.eventLink||``,a=r?.rescheduleUrl||r?.cancelUrl||``;J(i||a),re(i?`meeting`:`manage`),se(`idle`),K(!1),G(Lr(h.bookingScheduled,ue,h))}catch{se(`error`),K(!0),G(h.bookingDetailsUnavailable)}};(0,t.useEffect)(()=>{if(!ce)return;let e=e=>{if(!pa(e,X.current)||e.data.event!==`calendly.event_scheduled`)return;let t=e.data.payload,n=t?.event?.uri?.trim()||``,r=t?.invitee?.uri?.trim()||``;Y&&n&&r?(ae({eventUri:n,inviteeUri:r}),pe(Y,n,r),G(h.bookingCheckingDetails)):(se(`error`),K(!0),G(h.bookingDetailsUnavailable)),le(``),U(`done`)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[c,ue,Y,ce,h]),(0,t.useEffect)(()=>{if(!y||w!==`available`||S===null)return;let e=x.findIndex(e=>A.some(t=>S.has(la(e,t).getTime())));e>=0&&M(e)},[S,w,x,y,A]);let me=!!(!f&&l?.connected&&(l.mode===`link`||l.provider===`calendly`)),he=async()=>{if(H===`submitting`||H===`scheduling`||!i.name?.trim()&&!F.trim()||!i.email?.trim()&&!I.trim())return;U(`submitting`);let e={};I.trim()&&(e.email=I.trim()),F.trim()&&(e.name=F.trim());try{let t=await a({...I.trim()?{visitorEmail:I.trim()}:{},...F.trim()?{visitorName:F.trim()}:{}},e),n=t.booking?.schedulingLink||l?.bookingLink||``;if(!n){U(`error`);return}J(n),re(`scheduler`),de(t.caseReference||``),fe(t.inquiryId||``),le(fa(n,{name:F.trim()||i.name,email:I.trim()||i.email})),U(`scheduling`)}catch{U(`error`)}},[ge,_e]=(0,t.useState)(new Set),[ve,ye]=(0,t.useState)([]),[be,xe]=(0,t.useState)(0),[Se,Ce]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!s)return;let e=!0,t=new Date,n=new Date;return n.setDate(n.getDate()+b+1),s(t.toISOString(),n.toISOString()).then(t=>{if(e)if(_e(new Set(t.taken.map(e=>Date.parse(e)).filter(e=>!Number.isNaN(e)))),ye(t.busy.map(e=>[Date.parse(e.start),Date.parse(e.end)]).filter(([e,t])=>!Number.isNaN(e)&&!Number.isNaN(t))),D(t.slotDurationMinutes??30),k(da()||t.timezone||``),y){if(t.status!==`available`||!Array.isArray(t.available)){C(null),T(`unavailable`);return}C(new Set(t.available.map(e=>Date.parse(e)).filter(e=>!Number.isNaN(e)))),T(`available`)}else T(t.status??`request_only`)}).catch(()=>{!e||!y||(C(null),T(`unavailable`))}),()=>{e=!1}},[b,y,s,be]);let we=!!i.email?.trim(),Te=!!i.name?.trim(),Ee=!!i.phone?.trim(),De=R,Z=!!N&&(!y||w===`available`)&&(Te||F.trim()!==``)&&(f?Ee||Qr(De):we||I.trim()!==``),Oe=(f?i.phone||i.name:i.email||i.name)||``,ke=e=>r.find(t=>t.key===e),Ae=ke(`visitorName`)?.label||p.fields.find(e=>e.key===`visitorName`).label,je=ke(`visitorEmail`)?.label||h.handoffEmail,Me=ke(`visitorPhone`),Ne=ke(`topic`),Pe=e=>ge.has(la(x[j],e).getTime()),Fe=e=>la(x[j],e).getTime()<=Date.now(),Ie=E*60*1e3,Le=e=>{let t=la(x[j],e).getTime(),n=t+Ie;return ve.some(([e,r])=>t<r&&n>e)},Re=e=>!y||S?.has(la(x[j],e).getTime())===!0,ze=async()=>{if(!Z||H===`submitting`||!N)return;U(`submitting`),Ce(!1);let e=la(x[j],N),t=ca(x[j],N),n={};F.trim()&&(n.name=F.trim()),f?De&&(n.phone=De):I.trim()&&(n.email=I.trim());try{let r=await a(f?{bestTime:t,slotAt:e.toISOString(),visitorTimezone:da()||`UTC`,...De?{visitorPhone:De}:{},...F.trim()?{visitorName:F.trim()}:{},...B.trim()?{topic:B.trim()}:{}}:{preferredAt:t,slotAt:e.toISOString(),visitorTimezone:da()||`UTC`,...I.trim()?{visitorEmail:I.trim()}:{},...F.trim()?{visitorName:F.trim()}:{}},n);if(!f&&r.booking?.mode===`link`&&r.booking.schedulingLink?.trim()){let e=r.booking.schedulingLink.trim();J(e),de(r.caseReference||``),fe(r.inquiryId||``),le(fa(e,{name:F.trim()||i.name,email:I.trim()||i.email})),U(`scheduling`);return}if(r.booking?.confirmed)G(Lr(r.note||Q(f?h.bookingCallbackConfirmed:h.bookingConfirmed,{when:t}),r.caseReference,h)),J(r.booking.meetingUrl||r.booking.rescheduleUrl||r.booking.cancelUrl||r.booking.eventLink||``),re(r.booking.meetingUrl||r.booking.eventLink?`meeting`:`manage`);else if(r.booking?.verificationPending){K(!0);let e=r.booking.eventLink||r.booking.meetingUrl||``;/^https?:\/\//i.test(e)&&(J(e),re(`unverified`)),G(Lr(r.note||Q(h.bookingVerificationPending,{when:t}),r.caseReference,h))}else G(Lr(r.note||Q(f?h.bookingCallbackRequested:h.bookingRequested,{when:t}),r.caseReference,h));U(`done`)}catch(t){t?.status===409?(_e(t=>new Set(t).add(e.getTime())),P(null),Ce(!0),xe(e=>e+1),U(`idle`)):U(`error`)}},Be=()=>{le(``),U(`idle`),o?.()};return H===`scheduling`&&ce?(0,n.jsxs)(`div`,{class:`cf-scheduler-overlay`,role:`dialog`,"aria-modal":`true`,"aria-label":m,children:[(0,n.jsxs)(`header`,{class:`cf-scheduler-overlay__head`,children:[(0,n.jsx)(`button`,{type:`button`,class:`cf-scheduler-overlay__back`,onClick:Be,children:h.bookingBackToChat}),(0,n.jsx)(`strong`,{children:m}),(0,n.jsxs)(`div`,{class:`cf-scheduler-overlay__tools`,children:[(0,n.jsxs)(`a`,{href:q,target:`_blank`,rel:`noopener noreferrer`,children:[h.bookingOpenNewTab,` `,(0,n.jsx)(ii,{})]}),(0,n.jsx)(`button`,{type:`button`,"aria-label":h.bookingCloseScheduler,onClick:Be,children:(0,n.jsx)(mi,{})})]})]}),(0,n.jsxs)(`div`,{class:`cf-scheduler-overlay__body`,children:[(0,n.jsx)(`div`,{class:`cf-scheduler-overlay__loading`,children:h.bookingLoadingScheduler}),(0,n.jsx)(`iframe`,{ref:X,class:`cf-scheduler-overlay__frame`,src:ce,title:m,allow:`camera; microphone; fullscreen; payment`})]})]}):H===`done`?(0,n.jsxs)(`div`,{class:`cf-form cf-form--done${te?` cf-form--pending`:``}`,role:te?`alert`:`status`,children:[!te&&(0,n.jsx)(_i,{}),(0,n.jsx)(`span`,{children:W}),oe===`loading`&&(0,n.jsx)(`span`,{role:`status`,children:h.bookingCheckingDetails}),oe===`error`&&(0,n.jsxs)(`div`,{class:`cf-booking__receipt-error`,role:`alert`,children:[(0,n.jsx)(`span`,{children:h.bookingDetailsUnavailable}),ie&&Y&&c&&(0,n.jsx)(`button`,{type:`button`,class:`cf-booking__back`,onClick:()=>void pe(Y,ie.eventUri,ie.inviteeUri),children:h.bookingRetryDetails})]}),q&&(0,n.jsxs)(`a`,{class:`cf-booking__link`,href:q,target:`_blank`,rel:`noopener noreferrer`,children:[ne===`meeting`?h.bookingMeetingLink:ne===`manage`?h.bookingManageLink:ne===`unverified`?h.bookingUnverifiedLink:h.bookingOpenScheduler,` `,(0,n.jsx)(ii,{}),(0,n.jsx)(`span`,{class:`cf-booking__url`,children:q})]}),o&&(0,n.jsx)(`button`,{type:`button`,class:`cf-booking__back`,onClick:o,children:h.bookingBackToChat})]}):me?(0,n.jsxs)(`div`,{class:`cf-form cf-booking`,ref:g,children:[(0,n.jsx)(`div`,{class:`cf-booking__hint`,children:Q(h.bookingViaProvider,{provider:l?.label??h.bookingSchedulerFallback})}),we?Oe?(0,n.jsx)(`div`,{class:`cf-form__as`,children:Q(h.actionAs,{identity:Oe})}):null:(0,n.jsxs)(n.Fragment,{children:[!i.name?.trim()&&(0,n.jsx)(`input`,{class:`cf-form__input`,type:`text`,placeholder:`${Ae} *`,value:F,"aria-label":Ae,onInput:e=>ee(e.target.value)}),(0,n.jsx)(`input`,{class:`cf-form__input`,type:`email`,placeholder:`${je} *`,value:I,"aria-label":je,onInput:e=>L(e.target.value)})]}),H===`error`&&(0,n.jsx)(`div`,{class:`cf-form__err`,children:h.formError}),(0,n.jsxs)(`div`,{class:`cf-form__actions`,children:[o&&(0,n.jsx)(`button`,{type:`button`,class:`cf-form__cancel`,onClick:o,children:h.cancel}),(0,n.jsx)(`button`,{type:`button`,class:`cf-form__submit`,disabled:H===`submitting`||!i.name?.trim()&&F.trim()===``||!we&&I.trim()===``,onClick:he,children:H===`submitting`?h.sending:h.bookingOpenScheduler})]})]}):(0,n.jsxs)(`div`,{class:`cf-form cf-booking`,ref:g,children:[(0,n.jsxs)(`div`,{class:`cf-booking__hint`,children:[h.bookingPickTime,` ·`,` `,(0,n.jsx)(`span`,{class:`cf-booking__dur`,children:Q(f?h.bookingCallbackDuration:h.bookingDuration,{count:String(E)})}),O?(0,n.jsx)(`span`,{class:`cf-booking__timezone`,children:Q(h.bookingTimezone,{timezone:O})}):null]}),y&&w===`loading`?(0,n.jsx)(`div`,{class:`cf-booking__state`,role:`status`,children:h.bookingCheckingAvailability}):null,y&&w===`unavailable`?(0,n.jsx)(`div`,{class:`cf-form__err`,role:`alert`,children:h.bookingAvailabilityUnavailable}):null,y&&w===`available`&&A.length===0?(0,n.jsx)(`div`,{class:`cf-booking__state`,role:`status`,children:h.bookingNoSlots}):null,A.length>0?(0,n.jsx)(`div`,{class:`cf-booking__dates`,role:`tablist`,"aria-label":h.bookingPickDay,children:x.map((e,t)=>(0,n.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===j,disabled:y&&w===`available`&&!A.some(t=>S?.has(la(e,t).getTime())),class:`cf-booking__date ${t===j?`is-selected`:``}`,onClick:()=>{M(t),P(null)},children:[(0,n.jsx)(`span`,{class:`cf-booking__dow`,children:e.toLocaleDateString(void 0,{weekday:`short`})}),(0,n.jsx)(`span`,{class:`cf-booking__dom`,children:e.getDate()})]},t))}):null,A.length>0?(0,n.jsx)(`div`,{class:`cf-booking__slots`,role:`listbox`,"aria-label":h.bookingPickTimeLabel,children:A.map(e=>{let t=Fe(e),r=Le(e),i=Pe(e),a=Re(e),o=i||t||r||!a;return(0,n.jsx)(`button`,{type:`button`,role:`option`,"aria-selected":N===e,disabled:o,title:t?h.bookingEarlierToday:r?h.bookingCalendarBusy:i?h.bookingAlreadyBooked:a?void 0:h.bookingNotOffered,class:`cf-booking__slot ${N===e?`is-selected`:``} ${o?`is-taken`:``}`,onClick:()=>P(e),children:ua(x[j],e)},e)})}):null,Se&&(0,n.jsx)(`div`,{class:`cf-form__err`,children:h.bookingSlotTaken}),Oe?(0,n.jsx)(`div`,{class:`cf-form__as`,children:Q(h.actionAs,{identity:Oe})}):null,!Te&&(0,n.jsx)(`input`,{class:`cf-form__input`,type:`text`,placeholder:`${Ae} *`,value:F,"aria-label":Ae,onInput:e=>ee(e.target.value)}),f&&!Ee&&(0,n.jsx)(na,{label:Me?.label??`Phone number`,required:!0,value:R,onInput:z}),f&&Ne?(0,n.jsx)(`input`,{class:`cf-form__input`,type:`text`,placeholder:Ne.placeholder||Ne.label,value:B,"aria-label":Ne.label,onInput:e=>V(e.target.value)}):null,!f&&!we&&(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(`input`,{class:`cf-form__input`,type:`email`,placeholder:`${je} *`,value:I,"aria-label":je,onInput:e=>L(e.target.value)})}),H===`error`&&(0,n.jsx)(`div`,{class:`cf-form__err`,children:h.formError}),(0,n.jsxs)(`div`,{class:`cf-form__actions`,children:[o&&(0,n.jsx)(`button`,{type:`button`,class:`cf-form__cancel`,onClick:o,children:h.cancel}),(0,n.jsx)(`button`,{type:`button`,class:`cf-form__submit`,disabled:!Z||H===`submitting`,onClick:ze,children:H===`submitting`?h.sending:v})]})]})},ha=({actions:e,descriptors:r,visitor:i,onSubmitForm:a,onDemoSlots:o,onConfirmHostedBooking:s,scheduler:c,exclude:l=[],openAction:u,showTrigger:d=!0,translations:f={},onClose:p})=>{let m=Kr(),[h,g]=(0,t.useState)(null),[_,v]=(0,t.useState)(!1),y=(0,t.useRef)(null),b=(0,t.useRef)(null),x=(0,t.useRef)(!1),S=(0,t.useRef)(null),C=(0,t.useRef)(void 0),w=(0,t.useRef)(!1),T=(0,t.useMemo)(()=>`cf-actions-${Math.random().toString(36).slice(2,9)}`,[]),E=(0,t.useMemo)(()=>$i(r,e,f).filter(e=>!l.includes(e.id)&&!l.includes(e.endpoint)),[r,e,l,f]);(0,t.useEffect)(()=>{if(!u){C.current=void 0;return}C.current!==u&&E.some(e=>e.id===u)&&(C.current=u,w.current=!0,g(u),v(!0))},[u,E]);let D=h?E.find(e=>e.id===h):void 0,O=(0,t.useCallback)(()=>{if(p){p();return}x.current=!0,S.current=y.current||b.current?.closest(`.cf-panel`)?.querySelector(`.cf-footer-actions .cf-action-trigger, .cf-textarea`)||null,w.current=!1,g(null),v(!1)},[p]),k=(0,t.useCallback)(()=>{w.current?O():p?p():g(null)},[p,O]);(0,t.useLayoutEffect)(()=>{_||!x.current||(x.current=!1,S.current?.focus(),S.current=null)},[_]);let A=(0,t.useRef)({drawerOpen:_,activeId:h});if(A.current={drawerOpen:_,activeId:h},(0,t.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let{drawerOpen:t,activeId:n}=A.current;!t&&!n||(e.stopPropagation(),n?k():O())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[k,O]),(0,t.useEffect)(()=>{if(!_)return;let e=b.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()}},[_,h]),E.length===0||!d&&!_)return null;let j=_?D?(0,n.jsxs)(`div`,{ref:b,id:T,class:`cf-action-drawer is-open`,role:`dialog`,"aria-modal":`false`,"aria-label":D.formTitle||D.label,children:[(0,n.jsx)(`div`,{class:`cf-action-drawer__handle`,"aria-hidden":`true`}),(0,n.jsxs)(`div`,{class:`cf-action-drawer__head`,children:[(0,n.jsxs)(`div`,{children:[(0,n.jsx)(`strong`,{children:D.formTitle||D.label}),D.legacyFallback?(0,n.jsx)(`small`,{class:`cf-action-test-mode`,children:m.actionTestMode}):null]}),(0,n.jsx)(`button`,{type:`button`,class:`cf-action-drawer__close`,"aria-label":m.actionClose,onClick:k,children:(0,n.jsx)(mi,{})})]}),D.readiness===`degraded`&&D.readinessNote?(0,n.jsx)(`p`,{class:`cf-action-drawer__note cf-action-drawer__note--warn`,role:`status`,children:D.readinessNote}):null,D.presentation===`booking`||D.endpoint===`book-demo`||D.endpoint===`schedule-callback`?(0,n.jsx)(ma,{actionId:D.id,fields:D.fields,visitor:i,title:D.formTitle,submitLabel:D.submitLabel,onCancel:k,onSubmit:(e,t)=>a(D.id,e,t,D.endpoint),onDemoSlots:o,onConfirmHostedBooking:s,scheduler:c}):(0,n.jsx)(ia,{spec:{title:D.formTitle||D.label,submit:D.submitLabel,fields:D.endpoint===`request-callback`?D.fields.filter(e=>e.key!==`bestTime`):D.fields},visitor:i,onCancel:k,onSubmit:(e,t)=>a(D.id,e,t,D.endpoint)})]}):(0,n.jsxs)(`div`,{ref:b,id:T,class:`cf-action-drawer cf-action-drawer--menu`,role:`dialog`,"aria-modal":`false`,"aria-label":m.actionChoose,children:[(0,n.jsx)(`div`,{class:`cf-action-drawer__handle`,"aria-hidden":`true`}),(0,n.jsxs)(`div`,{class:`cf-action-drawer__head`,children:[(0,n.jsxs)(`div`,{children:[(0,n.jsx)(`span`,{class:`cf-action-drawer__eyebrow`,children:m.actionNeedHelp}),(0,n.jsx)(`strong`,{children:m.actionChoose})]}),(0,n.jsx)(`button`,{type:`button`,class:`cf-action-drawer__close`,"aria-label":m.actionClose,onClick:O,children:(0,n.jsx)(mi,{})})]}),(0,n.jsx)(`div`,{class:`cf-action-drawer__grid`,children:E.map(e=>{let t=Xi(e.icon);return(0,n.jsxs)(`button`,{type:`button`,class:`cf-action-card`,onClick:()=>{w.current=!1,g(e.id)},children:[(0,n.jsx)(`span`,{class:`cf-action-card__icon cf-action-card__icon--${e.category}`,children:(0,n.jsx)(t,{})}),(0,n.jsxs)(`span`,{class:`cf-action-card__copy`,children:[(0,n.jsx)(`strong`,{children:e.label}),e.legacyFallback?(0,n.jsx)(`small`,{class:`cf-action-test-mode`,children:m.actionTestMode}):null,(0,n.jsx)(`small`,{children:e.description}),e.readiness===`degraded`&&e.readinessNote?(0,n.jsx)(`small`,{class:`cf-action-card__warn`,children:e.readinessNote}):null]}),(0,n.jsx)(ei,{})]},e.id)})}),(0,n.jsx)(`p`,{class:`cf-action-drawer__note`,children:m.actionFooter})]}):null;return(0,n.jsxs)(`div`,{class:`cf-action-shell`,children:[d&&(0,n.jsxs)(`button`,{ref:y,type:`button`,class:`cf-action-trigger`,hidden:_,"aria-expanded":_,"aria-controls":T,onClick:()=>_?O():v(!0),children:[(0,n.jsx)(`span`,{class:`cf-action-trigger__icon`,children:(0,n.jsx)(oi,{})}),(0,n.jsxs)(`span`,{class:`cf-action-trigger__copy`,children:[(0,n.jsx)(`strong`,{children:m.actionContactOptions}),(0,n.jsx)(`small`,{children:ta(E,m)})]}),(0,n.jsx)(ei,{})]}),j]})},ga=({hasEmail:e,visitor:r,question:i,onSubmitForm:a})=>{let o=Kr(),[s,c]=(0,t.useState)(!1),[l,u]=(0,t.useState)(!1),[d,f]=(0,t.useState)(r.name??``),[p,m]=(0,t.useState)(r.email??``);if(e)return(0,n.jsxs)(`div`,{class:`cf-handoff cf-handoff--done`,children:[(0,n.jsx)(_i,{}),(0,n.jsx)(`span`,{children:`We’ve alerted the team. If someone is available, they can continue here.`})]});if(s){let e=r.email||p;return(0,n.jsxs)(`div`,{class:`cf-handoff cf-handoff--done`,children:[(0,n.jsx)(_i,{}),(0,n.jsx)(`span`,{children:Q(o.handoffShared,{email:e})})]})}let h=async()=>{if(!(!p.trim()||l)){u(!0);try{await a(`inquiry`,{visitorEmail:p.trim(),...d.trim()?{visitorName:d.trim()}:{},message:i||`I had a question the assistant couldn’t answer.`,subject:`Help request from chat`},{email:p.trim(),name:d.trim()||void 0}),c(!0)}catch{u(!1)}}};return(0,n.jsxs)(`div`,{class:`cf-handoff`,children:[(0,n.jsx)(`div`,{class:`cf-handoff__title`,children:o.handoffTitle}),(0,n.jsx)(`input`,{class:`cf-form__input`,type:`text`,placeholder:o.handoffName,value:d,"aria-label":o.handoffName,onInput:e=>f(e.target.value)}),(0,n.jsx)(`input`,{class:`cf-form__input`,type:`email`,placeholder:`${o.handoffEmail} *`,value:p,"aria-label":o.handoffEmail,onInput:e=>m(e.target.value)}),(0,n.jsx)(`button`,{type:`button`,class:`cf-form__submit`,disabled:!p.trim()||l,onClick:h,children:l?o.sending:o.handoffNotify})]})},_a=({text:e})=>{let r=Kr(),[i,a]=(0,t.useState)(!1);return(0,n.jsxs)(`button`,{type:`button`,class:`cf-tool`,onClick:async()=>{try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1500)}catch{}},"aria-label":r.copy,children:[i?(0,n.jsx)(_i,{}):(0,n.jsx)(vi,{}),i?r.copied:r.copy]})},va=({items:e,onPick:t})=>e.length===0?null:(0,n.jsx)(`div`,{class:`cf-starters`,children:e.map((e,r)=>(0,n.jsx)(`button`,{type:`button`,class:`cf-starter`,onClick:()=>t(e),children:e},r))}),ya=({items:e})=>{let t=e.filter(e=>e.label.trim()&&e.url.trim()).slice(0,4);return t.length===0?null:(0,n.jsx)(`div`,{class:`cf-featured-links`,children:t.map((e,t)=>(0,n.jsxs)(`a`,{class:`cf-featured-link`,href:e.url,target:`_blank`,rel:`noopener noreferrer nofollow`,title:e.label,children:[(0,n.jsx)(ii,{}),(0,n.jsx)(`span`,{children:e.label})]},`${e.url}-${t}`))})},ba=({msg:e,onRate:r})=>{let i=Kr(),[a,o]=(0,t.useState)(!1),[s,c]=(0,t.useState)(``),l=e.feedback,u=()=>{r(e.id,`up`),o(!1)},d=()=>{r(e.id,`down`),o(!0)},f=()=>{r(e.id,`down`,s.trim()),o(!1)};return(0,n.jsxs)(`div`,{class:`cf-feedback`,children:[(0,n.jsxs)(`div`,{class:`cf-feedback__row`,children:[(0,n.jsx)(`span`,{class:`cf-feedback__label`,children:i.feedbackAnswerPrompt}),(0,n.jsx)(`button`,{type:`button`,class:`cf-feedback__btn ${l===`up`?`is-active`:``}`,"aria-label":`${i.feedbackHelpful} answer`,"aria-pressed":l===`up`,onClick:u,children:(0,n.jsx)(wi,{})}),(0,n.jsx)(`button`,{type:`button`,class:`cf-feedback__btn ${l===`down`?`is-active`:``}`,"aria-label":`${i.feedbackNotHelpful} answer`,"aria-pressed":l===`down`,onClick:d,children:(0,n.jsx)(Ti,{})}),l&&!a&&(0,n.jsx)(`span`,{class:`cf-feedback__thanks`,children:i.feedbackThanks})]}),a&&l===`down`&&(0,n.jsxs)(`div`,{class:`cf-feedback__comment`,children:[(0,n.jsx)(`textarea`,{class:`cf-feedback__input`,rows:2,placeholder:i.feedbackCommentPlaceholder,value:s,onInput:e=>c(e.target.value)}),(0,n.jsx)(`button`,{type:`button`,class:`cf-feedback__send`,onClick:f,children:i.feedbackSend})]})]})},xa=e=>e.attachments??(e.attachmentName?[{id:e.attachmentId,name:e.attachmentName}]:[]),Sa=({msg:e,persona:t,isLast:r,visitor:i,hasEmail:a,lastQuestion:o,showActions:s,onPickReply:c,onSubmitForm:l,onDemoSlots:u,onConfirmHostedBooking:d,onRetry:f,ratable:p,onRate:m,onExpandVisualization:h,onExpandExplanation:g,onReconnect:_,onOpenAttachment:v,onExplanationFeedback:y,explanationTransport:b,onOpenAnalyticsSource:x})=>{let S=Kr(),C=Ur(),w=e.role===`user`,T=e.liveEventType??``,E=e.content.trim().toLowerCase(),D=T===`handoff_queued`||T===`agent_joined`||T===`agent_left`||T===`ai_handback`||T===`conversation_ended`||E.includes(`joined the chat`)||E.includes(`left the chat`)||E.includes(`support agents will be with you`),O=e.role===`system`||D,k=e.requestedContactFields?.includes(`email`)===!0,A=r&&!w&&!O&&!e.reconnectOffer&&!!(e.handoffOffered||k),j=A&&!a?[`inquiry`]:[],M=!e.pending&&!e.streaming,N=[...e.artifacts??[],...e.visualization&&!(e.artifacts??[]).some(e=>e.type===`visualization`)?[{type:`visualization`,visualization:e.visualization}]:[]],P=e.visualization?Li(e.visualization):void 0,F=!w&&P?(0,n.jsx)(`div`,{class:`cf-analytics-explanation`,"data-testid":`inline-analytics-explanation`,"data-explanation-message":e.id,children:(0,n.jsx)(jr,{classPrefix:`cf`,copy:S.analytics?.explanation,locale:C,onExpand:g?()=>g(e.id):void 0,explanation:P,onFollowUp:c,onFeedback:y,aiTransport:b,canOpenSource:e=>!!x&&(e.kind===`liveboard_tile`||e.kind===`insight`),onOpenSource:x?t=>{(t.kind===`liveboard_tile`||t.kind===`insight`)&&x({kind:t.kind,id:t.id,...e.visualization?.appliedFilters?.length?{appliedFilters:e.visualization.appliedFilters}:{}})}:void 0,maxFollowUps:3,showLead:!P.headline?.trim()||!e.content.toLocaleLowerCase().includes(P.headline.trim().toLocaleLowerCase())})}):null;return O?(0,n.jsx)(`div`,{class:`cf-msg cf-msg--system`,children:(0,n.jsxs)(`div`,{class:`cf-system-event`,children:[(0,n.jsx)(`div`,{class:`cf-system-event__mark`,"aria-hidden":`true`}),(0,n.jsx)(`div`,{class:`cf-system-event__text`,children:e.content}),_&&(0,n.jsx)(`button`,{type:`button`,class:`cf-system-event__action`,onClick:_,children:S.reconnectSupport}),e.createdAt&&(0,n.jsx)(`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`})})]})}):(0,n.jsxs)(`div`,{class:`cf-msg cf-msg--${w?`user`:`agent`}`,children:[!w&&(0,n.jsx)(Ui,{persona:t,small:!0}),(0,n.jsxs)(`div`,{class:`cf-msg__col${!w&&s?` cf-msg__col--actions`:``}`,children:[e.pending&&e.content===``?(0,n.jsx)(Wi,{}):e.imageUrl?(0,n.jsxs)(`div`,{class:`cf-msg__bubble cf-msg__bubble--media`,children:[(0,n.jsx)(`img`,{class:`cf-msg__media`,src:e.imageUrl,alt:`GIF`}),e.content&&(0,n.jsx)(`span`,{class:`cf-msg__caption`,children:e.content})]}):(0,n.jsxs)(`div`,{class:`cf-msg__bubble`,children:[w?e.content:Ii(e.content),e.streaming&&(0,n.jsx)(`span`,{class:`cf-caret`,"aria-hidden":`true`})]}),F,w?null:N.map((t,r)=>t.type===`visualization`&&t.visualization?(0,n.jsx)(wa,{visualization:t.visualization,onFollowUp:c,onExpand:h?()=>h(e.id):void 0,expandControlId:e.id},`visualization-${r}`):t.type===`image`&&(t.data||t.uri?.startsWith(`https://`))&&[`image/png`,`image/jpeg`,`image/webp`].includes(t.mimeType??``)?(0,n.jsxs)(`figure`,{class:`cf-artifact`,children:[t.title?(0,n.jsx)(`figcaption`,{children:t.title}):null,(0,n.jsx)(`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?(0,n.jsx)(`p`,{children:t.caption}):null]},`image-${r}`):t.type===`video`&&t.uri?.startsWith(`https://`)&&(t.mimeType??``).startsWith(`video/`)?(0,n.jsxs)(`figure`,{class:`cf-artifact`,children:[t.title?(0,n.jsx)(`figcaption`,{children:t.title}):null,(0,n.jsx)(`video`,{controls:!0,preload:`metadata`,playsInline:!0,src:t.uri}),t.caption&&t.caption!==t.title?(0,n.jsx)(`p`,{children:t.caption}):null]},`video-${r}`):t.type===`resource_link`&&t.uri?.startsWith(`https://`)?(0,n.jsxs)(`a`,{class:`cf-artifact-link`,href:t.uri,target:`_blank`,rel:`noopener noreferrer nofollow`,children:[(0,n.jsx)(`strong`,{children:t.title||t.name||`Open result`}),t.caption?(0,n.jsx)(`span`,{children:t.caption}):null]},`link-${r}`):null),!w&&e.resultExpired&&!e.visualization?(0,n.jsxs)(`p`,{class:`cf-analytics-expired`,"data-testid":`analytics-result-expired`,children:[e.resultExpired.title?(0,n.jsxs)(`strong`,{children:[e.resultExpired.title,`. `]}):null,S.resultExpired]}):null,w&&xa(e).length>0&&(0,n.jsx)(`div`,{class:`cf-attach-row cf-attach-row--sent`,children:xa(e).map((t,r)=>v?(0,n.jsxs)(`button`,{type:`button`,class:`cf-attach-chip cf-attach-chip--open`,title:Q(S.attachOpen,{name:t.name}),"aria-label":Q(S.attachOpen,{name:t.name}),onClick:()=>v(e,t,r),children:[(0,n.jsx)(xi,{}),(0,n.jsx)(`span`,{children:t.name})]},`${t.id??t.name}-${r}`):(0,n.jsxs)(`div`,{class:`cf-attach-chip`,title:t.name,children:[(0,n.jsx)(xi,{}),(0,n.jsx)(`span`,{children:t.name})]},`${t.id??t.name}-${r}`))}),!w&&(0,n.jsxs)(n.Fragment,{children:[M&&(e.error||e.content)&&(0,n.jsxs)(`div`,{class:`cf-msg__actions`,children:[(0,n.jsx)(`div`,{class:`cf-msg__tools`,children:e.error?(0,n.jsxs)(`button`,{type:`button`,class:`cf-tool`,onClick:()=>f(e.id,e.retryText??``),children:[(0,n.jsx)(yi,{}),S.retry]}):(0,n.jsx)(_a,{text:e.content})}),p&&!e.error&&e.content?(0,n.jsx)(ba,{msg:e,onRate:m}):null]}),(0,n.jsx)(Ki,{msg:e}),r&&(0,n.jsx)(qi,{replies:e.suggestedReplies,onPick:c}),A&&(0,n.jsx)(ga,{hasEmail:a,visitor:i,question:o,onSubmitForm:l}),s&&(0,n.jsx)(ha,{showTrigger:!1,actions:e.availableActions,descriptors:e.actions,openAction:e.selectedAction,visitor:i,onSubmitForm:l,onDemoSlots:u,onConfirmHostedBooking:d,scheduler:t?.scheduler,exclude:j})]})]})]})},Ca=({visualization:e,onClose:t,onFollowUp:r,onFeedback:i,transport:a,onOpenSource:o})=>{let s=Kr(),c=Ur(),l=Li(e);return l?(0,n.jsx)(`div`,{class:`cf-analytics-explanation is-expanded`,"data-testid":`expanded-analytics-explanation`,children:(0,n.jsx)(jr,{classPrefix:`cf`,explanation:l,copy:s.analytics?.explanation,locale:c,expanded:!0,onCollapse:t,onFollowUp:r,onFeedback:i,aiTransport:a,canOpenSource:e=>!!o&&(e.kind===`liveboard_tile`||e.kind===`insight`),onOpenSource:o?t=>{(t.kind===`liveboard_tile`||t.kind===`insight`)&&o({kind:t.kind,id:t.id,...e.appliedFilters?.length?{appliedFilters:e.appliedFilters}:{}})}:void 0})}):null},wa=({visualization:e,expanded:t=!1,onExpand:r,onClose:i,onFollowUp:a,expandControlId:o})=>{let s=Kr(),c=Ur();return(0,n.jsx)(An,{visualization:e,classPrefix:`cf`,labels:s.analytics,locale:c,expanded:t,onExpand:r,onClose:i,onFollowUp:a,expandControlId:o})},Ta=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]??``),r.onerror=n,r.readAsDataURL(e)}),Ea=({onPick:e})=>(0,n.jsx)(`div`,{class:`cf-picker cf-emoji`,children:Pr.map(t=>(0,n.jsxs)(`div`,{class:`cf-emoji__group`,children:[(0,n.jsx)(`div`,{class:`cf-emoji__label`,children:t.name}),(0,n.jsx)(`div`,{class:`cf-emoji__grid`,children:t.emojis.map((t,r)=>(0,n.jsx)(`button`,{type:`button`,class:`cf-emoji__btn`,onClick:()=>e(t),"aria-label":t,children:t},r))})]},t.name))}),Da=({onSearch:e,onPick:r})=>{let i=Kr(),[a,o]=(0,t.useState)(``),[s,c]=(0,t.useState)([]),[l,u]=(0,t.useState)(!0);return(0,t.useEffect)(()=>{let t=!0;u(!0);let n=setTimeout(()=>{e(a).then(e=>t&&(c(e),u(!1))).catch(()=>t&&(c([]),u(!1)))},300);return()=>{t=!1,clearTimeout(n)}},[a,e]),(0,n.jsxs)(`div`,{class:`cf-picker cf-gif`,children:[(0,n.jsx)(`input`,{class:`cf-gif__search`,placeholder:i.searchGifs,value:a,"aria-label":i.searchGifs,onInput:e=>o(e.target.value)}),(0,n.jsx)(`div`,{class:`cf-gif__grid`,children:l?(0,n.jsx)(`div`,{class:`cf-gif__hint`,children:i.searchingGifs}):s.length===0?(0,n.jsx)(`div`,{class:`cf-gif__hint`,children:i.noGifs}):s.map(e=>(0,n.jsx)(`button`,{type:`button`,class:`cf-gif__item`,onClick:()=>r(e.url),"aria-label":e.alt,children:(0,n.jsx)(`img`,{src:e.preview,alt:e.alt,loading:`lazy`})},e.id))}),(0,n.jsx)(`div`,{class:`cf-gif__powered`,children:`via Tenor`})]})},Oa=5*1024*1024,ka=5,Aa=`image/png,image/jpeg,image/webp,image/gif,application/pdf`,ja=15e3,Ma=e=>e===`listening`||e===`hearing`,Na=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``}},Pa=.004,Fa=({muted:e,listening:t,micLevel:r,onToggleMute:i})=>(0,n.jsx)(`button`,{type:`button`,class:`cf-call-btn ${e?`is-muted`:``} ${t?`is-listening`:``} ${t&&r>=.004?`is-hot`:``}`,"aria-label":e?`Unmute microphone`:`Mute microphone`,"aria-pressed":e,onClick:i,style:t?{"--cf-wave":String(Math.max(.2,Math.min(1,r*6)))}:void 0,children:e?(0,n.jsx)(ri,{}):(0,n.jsx)(ni,{})}),Ia=({audioDevices:e,selectedAudioDeviceId:r,onSelectAudioDevice:i})=>{let[a,o]=(0,t.useState)(!1),[s,c]=(0,t.useState)(null),l=(0,t.useRef)(null);(0,t.useEffect)(()=>{if(!a)return;let e=e=>{l.current&&!e.composedPath().includes(l.current)&&o(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[a]),(0,t.useLayoutEffect)(()=>{if(!a){c(null);return}let e=l.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;c({up:o,maxHeight:Math.max(72,Math.floor(o?i:r))})},[a]);let u=[{deviceId:``,label:`Default microphone`},...e];return(0,n.jsxs)(`div`,{class:`cf-call-more`,ref:l,children:[(0,n.jsx)(`button`,{type:`button`,class:`cf-call-btn cf-call-btn--microphones`,"aria-label":`Choose microphone`,"aria-expanded":a,onClick:()=>o(e=>!e),children:(0,n.jsx)(ei,{})}),a&&(0,n.jsxs)(`div`,{class:`cf-call-menu${s?.up?` cf-call-menu--up`:``}`,role:`menu`,style:s?{maxHeight:`${s.maxHeight}px`}:{visibility:`hidden`},children:[(0,n.jsx)(`div`,{class:`cf-call-menu__label`,children:`Microphone`}),u.map(e=>(0,n.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e.deviceId===r,class:`cf-call-menu__item ${e.deviceId===r?`is-active`:``}`,onClick:()=>{i(e.deviceId),o(!1)},children:[e.deviceId===r?(0,n.jsx)(_i,{}):(0,n.jsx)(`span`,{class:`cf-call-menu__spacer`}),(0,n.jsx)(`span`,{children:e.label})]},e.deviceId))]})]})},La=({voiceState:e,muted:t,onToggleMute:r,onEndCall:i,onTalkNow:a,showTalkNow:o,micLevel:s,theaterMode:c,onToggleTheater:l,onMinimize:u,audioDevices:d,selectedAudioDeviceId:f,onSelectAudioDevice:p})=>(0,n.jsxs)(`div`,{class:`cf-call-controls`,children:[(0,n.jsx)(Fa,{muted:t,listening:Ma(e)&&!t,micLevel:s,onToggleMute:r}),(0,n.jsx)(Ia,{audioDevices:d,selectedAudioDeviceId:f,onSelectAudioDevice:p}),o&&(0,n.jsx)(`button`,{type:`button`,class:`cf-call-btn cf-call-btn--talk`,"aria-label":`Talk now`,onClick:a,children:(0,n.jsx)(ni,{})}),(0,n.jsx)(`button`,{type:`button`,class:`cf-call-btn`,"aria-label":c?`Exit expanded view`:`Expand view`,"aria-pressed":c,onClick:l,children:c?(0,n.jsx)(Di,{}):(0,n.jsx)(Ei,{})}),(0,n.jsx)(`button`,{type:`button`,class:`cf-call-btn`,"aria-label":`Minimize voice chat`,onClick:u,children:(0,n.jsx)(Oi,{})}),(0,n.jsx)(`button`,{type:`button`,class:`cf-call-btn cf-call-btn--end`,"aria-label":`End voice chat`,onClick:i,children:(0,n.jsx)(Si,{})})]}),Ra=({persona:e,voiceState:t,muted:r,onToggleMute:i,onEndCall:a,micLevel:o,onExpand:s})=>{let c=e=>e.stopPropagation(),l=e?.assistantMediaUrl?.trim()||e?.agentAvatarUrl?.trim()||``,u=e?.assistantMediaKind===`video`&&!!l,d=e?.agentName||`Assistant`;return(0,n.jsxs)(`div`,{class:[`cf-floating-call-card`,Ma(t)&&!r?`is-listening`:``,t===`speaking`?`is-speaking`:``,t===`processing`||t===`connecting`?`is-thinking`:``,r?`is-muted`:``].filter(Boolean).join(` `),style:Ma(t)&&!r?{"--cf-listen":String(Math.max(.18,Math.min(1,o*8)))}:void 0,role:`button`,tabIndex:0,"aria-label":`Reopen voice chat with ${d}`,onClick:s,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},children:[(0,n.jsx)(`div`,{class:`cf-floating-call-card__media`,"aria-hidden":`true`,children:l?u?(0,n.jsx)(`video`,{src:l,muted:!0,loop:!0,playsInline:!0,autoPlay:!0}):(0,n.jsx)(`img`,{src:l,alt:``}):(0,n.jsxs)(`div`,{class:`cf-floating-call-card__avatar${Bi(e)}`,children:[(0,n.jsx)(`span`,{children:Hi(e)}),(0,n.jsx)(`span`,{class:`cf-floating-call-card__eye cf-floating-call-card__eye--left`}),(0,n.jsx)(`span`,{class:`cf-floating-call-card__eye cf-floating-call-card__eye--right`}),(0,n.jsx)(`span`,{class:`cf-floating-call-card__mouth`})]})}),(0,n.jsx)(`div`,{class:`cf-floating-call-card__shade`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{class:`cf-floating-call-card__status`,role:`status`,"aria-live":`polite`,children:Na(t)}),(0,n.jsxs)(`div`,{class:`cf-floating-call-card__controls`,onClick:c,onKeyDown:c,role:`presentation`,children:[(0,n.jsx)(Fa,{muted:r,listening:Ma(t)&&!r,micLevel:o,onToggleMute:i}),(0,n.jsx)(`button`,{type:`button`,class:`cf-call-btn cf-call-btn--restore`,"aria-label":`Restore voice chat`,onClick:e=>{c(e),s()},children:(0,n.jsx)(ki,{})}),(0,n.jsx)(`button`,{type:`button`,class:`cf-call-btn cf-call-btn--end`,"aria-label":`End voice chat`,onClick:e=>{c(e),a()},children:(0,n.jsx)(Si,{})})]})]})},za=(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 Na(e)}},Ba=({draftStore:e,onSend:i,onSendGif:a,onTyping:o,disabled:s,allowVoice:c,onTranscribe:l,gifEnabled:u,onSearchGifs:d,allowAttach:f,analyzeAttachments:p=!0,onUpload:m,voiceStartSignal:h=0,onVoiceStateChange:g,onPreviewAttachment:_})=>{let v=Kr(),[y,b]=(0,t.useState)(()=>e.value),x=t=>{let n=typeof t==`function`?t(y):t;e.value=n,b(n)},[S,C]=(0,t.useState)(!1),[w,T]=(0,t.useState)(!1),[E,D]=(0,t.useState)(`idle`),[O,k]=(0,t.useState)(`none`),[A,j]=(0,t.useState)([]),M=(0,t.useRef)([]);M.current=A;let N=(0,t.useRef)(0),[P,F]=(0,t.useState)(!1),[ee,I]=(0,t.useState)(!1),[L,R]=(0,t.useState)(``),z=(0,t.useRef)(null),B=(0,t.useRef)(null),V=(0,t.useRef)(null),H=(0,t.useRef)(0),U=(0,t.useRef)(null),W=(0,t.useRef)(void 0),G=e=>{D(e),g?.(e)},te=()=>{W.current&&window.clearTimeout(W.current),W.current=void 0};(0,t.useEffect)(()=>{let e=z.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,110)}px`)},[y]),(0,t.useEffect)(()=>()=>{for(let e of M.current)e.previewUrl&&URL.revokeObjectURL(e.previewUrl)},[]);let K=e=>{j(t=>{let n=t.find(t=>t.key===e);return n?.previewUrl&&URL.revokeObjectURL(n.previewUrl),t.filter(t=>t.key!==e)})},q=()=>j([]);(0,t.useEffect)(()=>{if(O===`none`)return;let e=e=>{B.current&&!e.composedPath().includes(B.current)&&k(`none`)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[O]);let J=e=>k(t=>t===e?`none`:e),ne=e=>{let t=z.current;if(!t){x(t=>t+e);return}let n=t.selectionStart??y.length,r=t.selectionEnd??y.length;x(y.slice(0,n)+e+y.slice(r)),requestAnimationFrame(()=>{t.focus();let r=n+e.length;t.setSelectionRange(r,r)})},re=e=>{k(`none`),a(e)},ie=async e=>{if(e.length===0)return;R(``);let t=H.current,n=5-M.current.length-N.current;if(n<=0){R(Q(v.attachLimit,{count:`5`}));return}let r=e.slice(0,n);N.current+=r.length,F(!0);for(let e of r){if(t!==H.current)break;try{await ae(e,t)}finally{t===H.current&&(--N.current,F(N.current>0))}}t===H.current&&e.length>r.length&&R(Q(v.attachLimit,{count:`5`}))},ae=async(e,t)=>{if(e.size>5242880){R(v.attachTooLarge);return}if(!m){R(v.attachFailed);return}try{let n=await Ta(e);if(t!==H.current)return;let r=await m(n,e.type||`application/octet-stream`,e.name,p);if(t!==H.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};j(e=>[...e,i])}catch(e){if(t!==H.current)return;e instanceof r&&e.status===413?R(v.attachTooLarge):e instanceof r&&[400,415,503].includes(e.status)?R(e.message):R(v.attachFailed)}},oe=async e=>{let t=e.target,n=Array.from(t.files??[]);t.value=``,await ie(n)},se=()=>{H.current+=1,N.current=0,F(!1),R(``)},ce=(!!y.trim()||A.length>0)&&!s&&!P&&!w,le=()=>{ce&&(i(y,A.length>0?{attachments:A.map(e=>({id:e.id,name:e.name,text:e.text,file:e.file}))}:void 0),o?.(!1),x(``),q(),R(``))},ue=e=>{let t=e.trim();if(!t||s){G(`misunderstood`);return}let n=y.trim();i(n?`${n} ${t}`:t),o?.(!1),x(``),q(),R(``),G(`idle`)},de=e=>{if(e.key===`Enter`&&!e.shiftKey){if(s)return;e.preventDefault(),le()}else e.key===`Escape`&&O!==`none`&&(e.preventDefault(),e.stopPropagation(),k(`none`))},Y=()=>{te(),U.current?.stop(`dictation-ended`),U.current=null,C(!1),T(!1)},fe=async()=>{let e=U.current;if(e){let{mic:t,processing:n}=e.snapshot;t===`hearing`||n?e.finishTurn():(Y(),G(`idle`));return}let t=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||void 0;G(`connecting`);let n=new br({transcribe:async({audio:e,mimeType:n,durationSeconds:r})=>l(await Ta(e),n,t,r),listener:{state:({mic:e,processing:t,reason:r})=>{if(U.current===n){if(e===`unavailable`){if(r===`permission-denied`||r===`unsupported`||r===`no-device`||r===`error`){Y(),G(`denied`);return}G(`unavailable`);return}C(e===`listening`||e===`hearing`),T(t),e===`starting`?G(`connecting`):t&&e!==`hearing`?G(`processing`):e===`hearing`?G(`hearing`):e===`listening`&&G(`listening`)}},speechStart:()=>te(),turn:e=>{U.current===n&&(Y(),ue(e.text))},noise:e=>{U.current===n&&(Y(),G(e.reason===`transcribe-failed`?`misunderstood`:`noise`))}}});U.current=n,W.current=window.setTimeout(()=>{U.current===n&&(Y(),G(`noise`))},15e3),await n.start()};return(0,t.useEffect)(()=>{!h||!c||s||S||w||fe()},[h]),(0,t.useEffect)(()=>()=>{te(),U.current?.stop(`unmounted`),U.current=null},[]),(0,n.jsxs)(`div`,{class:`cf-composer ${ee?`is-dragging`:``}`,ref:B,onDragEnter:e=>{f&&(e.preventDefault(),I(!0))},onDragOver:e=>{f&&e.preventDefault()},onDragLeave:e=>{e.currentTarget===e.target&&I(!1)},onDrop:e=>{f&&(e.preventDefault(),I(!1),ie(Array.from(e.dataTransfer?.files??[])))},children:[O===`emoji`&&(0,n.jsx)(Ea,{onPick:ne}),O===`gif`&&(0,n.jsx)(Da,{onSearch:d,onPick:re}),(A.length>0||P||L)&&(0,n.jsxs)(`div`,{class:`cf-attach-row`,role:`list`,"aria-label":v.attachedFiles,children:[A.map(e=>(0,n.jsxs)(`span`,{class:`cf-attach-chip`,role:`listitem`,title:e.name,children:[(0,n.jsxs)(`button`,{type:`button`,class:`cf-attach-open`,"aria-label":Q(v.attachOpen,{name:e.name}),disabled:!_,onClick:()=>_?.(e.file,e.name),children:[e.previewUrl?(0,n.jsx)(`img`,{class:`cf-attach-preview`,src:e.previewUrl,alt:``}):(0,n.jsx)(xi,{}),(0,n.jsxs)(`span`,{class:`cf-attach-copy`,children:[(0,n.jsx)(`span`,{children:e.name}),(0,n.jsx)(`small`,{children:e.analysisFailed?v.attachAnalysisFailed:`${Math.max(1,Math.ceil(e.size/1024))} KB`})]})]}),(0,n.jsx)(`button`,{type:`button`,class:`cf-attach-x`,"aria-label":Q(v.removeAttachmentNamed,{name:e.name}),onClick:()=>K(e.key),children:(0,n.jsx)(mi,{})})]},e.key)),P&&(0,n.jsxs)(`span`,{class:`cf-attach-status`,children:[(0,n.jsx)(`span`,{children:v.attaching}),(0,n.jsx)(`button`,{type:`button`,onClick:se,children:v.cancel})]}),L&&!P&&(0,n.jsx)(`span`,{class:`cf-attach-status cf-attach-status--err`,children:L})]}),E!==`idle`&&(0,n.jsxs)(`div`,{class:`cf-voice-state`,"aria-live":`polite`,children:[(0,n.jsx)(`span`,{class:`cf-voice-state__dot ${S?`is-live`:``}`}),za(E,v)]}),(0,n.jsxs)(`div`,{class:`cf-composer__field`,children:[(0,n.jsx)(`button`,{type:`button`,class:`cf-iconbtn ${O===`emoji`?`is-active`:``}`,"aria-label":v.emoji,"aria-pressed":O===`emoji`,onClick:()=>J(`emoji`),children:O===`emoji`?(0,n.jsx)(mi,{}):(0,n.jsx)(pi,{})}),u&&(0,n.jsx)(`button`,{type:`button`,class:`cf-iconbtn cf-gifbtn ${O===`gif`?`is-active`:``}`,"aria-label":v.gifs,"aria-pressed":O===`gif`,onClick:()=>J(`gif`),children:(0,n.jsx)(`span`,{class:`cf-gif-label`,children:`GIF`})}),f&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`input`,{ref:V,type:`file`,class:`cf-file-input`,accept:`image/png,image/jpeg,image/webp,image/gif,application/pdf`,multiple:!0,onChange:oe,tabIndex:-1,"aria-hidden":`true`}),(0,n.jsx)(`button`,{type:`button`,class:`cf-iconbtn`,"aria-label":v.attachFile,disabled:P,onClick:()=>V.current?.click(),children:(0,n.jsx)(xi,{})})]}),(0,n.jsx)(`textarea`,{ref:z,class:`cf-textarea`,rows:1,placeholder:v.composerPlaceholder,value:y,"aria-label":v.composerPlaceholder,"aria-busy":s,onInput:e=>{let t=e.target.value;x(t),o?.(!!t.trim())},onPaste:e=>{let t=Array.from(e.clipboardData?.files??[]);!f||t.length===0||(e.preventDefault(),ie(t))},onKeyDown:de}),c&&(0,n.jsx)(`button`,{type:`button`,class:`cf-iconbtn cf-mic ${S?`is-recording`:``}`,"aria-label":S?v.stopRecording:v.recordVoice,"aria-pressed":S,disabled:w||s,onClick:fe,children:(0,n.jsx)(ni,{})}),(0,n.jsx)(`button`,{type:`button`,class:`cf-send`,"aria-label":v.send,disabled:!ce,onClick:le,children:(0,n.jsx)(ti,{})})]})]})},Va=e=>e.replace(/\[[^\]]{0,60}\]/g,` `).replace(/\(([^)]{0,60})\)/g,(e,t)=>Ha.has(t.trim().toLowerCase().replace(/[.!?,…]+$/,``).replace(/\s+/g,` `))?` `:e).replace(/\*[^*]{0,60}\*/g,` `).replace(/\s+/g,` `).trim(),Ha=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(`.`)),Ua=/^\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?(?:\s*(?:-|–|—|to|-->)\s*\d{1,2}:\d{2}(?::\d{2})?(?:[.,]\d+)?)?$/,Wa=e=>{let t=e.trim().toLowerCase().replace(/[()[\]*]/g,` `).replace(/[.!?,…]+$/,``).replace(/\s+/g,` `).trim();return!t||/^(?:sh+\s*)+$/.test(t)||Ua.test(t)?!0:Ha.has(t)},Ga=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},Ka=e=>{let t=Va(e);return Wa(t)||Ga(t)?``:t},qa=(e,t)=>Rn(e,t);let Ja=!0,Ya=null;const Xa=e=>{Ja=e},Za=()=>{let e=typeof window<`u`?window.AudioContext??window.webkitAudioContext:void 0;if(!e)return null;if(!Ya)try{Ya=new e}catch{return null}return Ya.state===`suspended`&&Ya.resume(),Ya},Qa=(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)},$a=e=>{if(!Ja)return;let t=Za();if(!t)return;let n=t.currentTime;try{e===`open`?(Qa(t,523,n,.12,`sine`,.05),Qa(t,784,n+.08,.16,`sine`,.05)):e===`send`?Qa(t,660,n,.08,`triangle`,.04):e===`receive`&&(Qa(t,880,n,.1,`sine`,.045),Qa(t,1175,n+.09,.14,`sine`,.045))}catch{}},eo=[`audio/webm;codecs=opus`,`audio/webm`,`audio/ogg;codecs=opus`,`audio/ogg`],to=()=>{if(typeof navigator>`u`||!navigator.mediaDevices?.getSupportedConstraints)return{};try{return navigator.mediaDevices.getSupportedConstraints()}catch{return{}}},no=(e=``,t=to())=>{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},ro=(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}}},io=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)}),ao=e=>{let t=globalThis.MediaRecorder;if(typeof t?.isTypeSupported==`function`){for(let n of eo)if(t.isTypeSupported(n))try{return new t(e,{mimeType:n})}catch{}}return new t(e)},oo=e=>{if(!(!e||e.state!==`recording`)){try{e.requestData()}catch{}e.stop()}},so=(e,t)=>e?.status===429?t.errorRateLimit:t.errorGeneric,co=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),lo=(e,t)=>{let n=co(),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},uo=/!?\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,fo=/https?:\/\/[^\s)]+/g,po=e=>zn(e).replace(uo,`$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(fo,e=>e.replace(/^https?:\/\//,``).replace(/^www\./,``).replace(/\/$/,``)).replace(/[ \t]+\n/g,`
168
+ `).replace(/\n{3,}/g,`
169
+
170
+ `).replace(/[ \t]{2,}/g,` `).trim(),mo=(e,t)=>po(Bn(e,t)),ho=45e3,go=e=>e.type===`visualization`,_o=e=>{let t=!!e.visualization,n=(e.artifacts??[]).some(go);if(!t&&!n)return e;let{visualization:r,artifacts:i,...a}=e,o=(i??[]).filter(e=>!go(e)),s=r?.title??(i??[]).find(go)?.visualization?.title??e.resultExpired?.title;return{...a,...o.length>0?{artifacts:o}:{},resultExpired:s?{title:s}:{}}},vo=e=>e.map(_o),yo=(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}}}}},bo=e=>e instanceof DOMException&&(e.name===`QuotaExceededError`||e.name===`NS_ERROR_DOM_QUOTA_REACHED`),xo=(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(!bo(e))return!1;i=i.slice(Math.ceil(i.length/2))}try{e.removeItem(t)}catch{}return!1},So=(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=vo(r.messages);i.some((e,t)=>e!==r.messages[t])&&e.setItem(t,JSON.stringify({...r,messages:i}))}}catch{}},Co=(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}}},wo=()=>typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.round(Math.random()*1e9)}`,To=(e,t)=>{typeof console>`u`||console.warn(`[centrinfo-widget] ${e}`,t??{})},Eo=(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},Do=e=>{try{return e===`none`?null:e===`session`?sessionStorage:localStorage}catch{return null}},Oo=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)},ko=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{}},Ao=e=>{let t=e.user?.externalId?.trim()||e.user?.userId?.trim()||e.user?.email?.trim().toLowerCase()||ko(e.identityToken)||(e.identityToken||e.getIdentityToken?`authenticated`:`anonymous`);return`${e.token.slice(0,12)}:${e.chatSurface}:${Oo(t)}`},jo=e=>`${e.chatSurface}:${wo()}`,Mo=e=>e.slice(0,12),No=e=>`centrinfo:session:${e}`,Po=e=>`centrinfo:visitor:${e}`,Fo=(e,t)=>`centrinfo:chat:${e}:${t}`,Io=e=>`centrinfo:history:${e}`,Lo=1e3,Ro=20,zo=720*60*60*1e3,Bo=1440*60*1e3,Vo=(e,t)=>{try{return JSON.parse(e?.getItem(Po(t))||`{}`)}catch{return{}}},Ho=(e,t,n)=>{if(!e)return jo(n);try{let r=No(t),i=e.getItem(r);if(i)return i;let a=jo(n);return e.setItem(r,a),a}catch{return jo(n)}},Uo=(e,t,n)=>{if(!e)return{};try{let r=e.getItem(Fo(t,n));return r?JSON.parse(r):{}}catch{return{}}},Wo=(e,t,n)=>{let{ts:r,expiresAt:i,messages:a}=Uo(e,t,n);return!Array.isArray(a)||typeof i==`number`&&Date.now()>i||typeof r==`number`&&Date.now()-r>zo?[]:vo(a)},Go=(e,t,n)=>{let{ts:r,expiresAt:i,messages:a,ended:o}=Uo(e,t,n);return!Array.isArray(a)||a.length===0||typeof i==`number`&&Date.now()>i||typeof r==`number`&&Date.now()-r>zo?!1:o===!0||typeof r==`number`&&Date.now()-r>864e5},Ko=e=>Number.isFinite(e??NaN)?Math.max(5,Math.min(200,Math.round(e))):50,qo=e=>Number.isFinite(e??NaN)?Math.max(1,Math.min(365,Math.round(e)))*24*60*60*1e3:zo,Jo=(e,t,n,r,i,a,o,s)=>{if(e)try{if(!a){e.removeItem(Fo(t,n));return}let c=r.filter(e=>!e.pending).slice(-o);if(c.length===0)return;let l=Date.now();xo(e,Fo(t,n),e=>JSON.stringify({ts:l,expiresAt:l+s,messages:vo(e),ended:i}),c)}catch{}},Yo=(e,t)=>{if(!e)return[];try{let n=e.getItem(Io(t)),r=n?JSON.parse(n):[];return Array.isArray(r)?r:[]}catch{return[]}},Xo=(e,t,n)=>{if(e)try{e.setItem(Io(t),JSON.stringify(n.slice(0,20)))}catch{}},Zo=(e,t)=>{if(e)try{let n=`centrinfo:chat:${t}:`,r=new Set([No(t),Po(t),Io(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{}},Qo=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`},$o=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}),es=e=>(e??[]).find(e=>e.category===`support`&&e.enabled&&e.readiness!==`unavailable`&&(e.liveHandoff??e.id===`public_contact_support`)),ts=(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}}},ns=(e,n,r=!0)=>{let i=(0,t.useRef)(Do(n.persistence)).current,a=Ao(n),o=(0,t.useRef)(Ho(i,a,n)),s=(0,t.useRef)(null),c=(0,t.useRef)(null),l=(0,t.useRef)(null),u=(0,t.useRef)(null),d=(0,t.useRef)(null),f=(0,t.useRef)(null),p=(0,t.useRef)(new Map),m=(0,t.useRef)(!1),h=(0,t.useRef)(void 0),g=(0,t.useRef)(null),_=(0,t.useRef)({}),v=(0,t.useRef)({}),[y,b]=(0,t.useState)(null),[x,S]=(0,t.useState)(()=>Wo(i,a,o.current)),C=(0,t.useRef)(null);C.current||(C.current=Co(1e3));let w=(0,t.useRef)(x.length>0),T=(0,t.useRef)(x.some(e=>e.role===`user`)),[E,D]=(0,t.useState)(!1),[O,k]=(0,t.useState)(!1),[A,j]=(0,t.useState)({status:`idle`}),M=(0,t.useRef)({}),[N,P]=(0,t.useState)(()=>Go(i,a,o.current)),[F,ee]=(0,t.useState)(()=>Vo(i,a)),[I,L]=(0,t.useState)(()=>Yo(i,a)),[R,z]=(0,t.useState)(null),[B,V]=(0,t.useState)([]),[H,U]=(0,t.useState)(`ai`),[W,G]=(0,t.useState)(void 0),[te,K]=(0,t.useState)(void 0),q=(0,t.useRef)(new Date().toISOString()),J=(0,t.useRef)(void 0),ne=(0,t.useRef)(!1),re=(0,t.useRef)(0),ie=(0,t.useRef)(F);(0,t.useEffect)(()=>{ie.current=F},[F]);let ae=y?.memoryEnabled!==!1,oe=Ko(y?.memoryMessageCap),se=qo(y?.memoryRetentionDays),ce=(0,t.useCallback)(()=>{s.current?.abort(),C.current?.cancel(),Zo(i,a),Zo(i,Mo(n.token));let e=jo(n);o.current=e;try{i?.setItem(No(a),e)}catch{}z(null),V([]),P(!1),L([]),ee({}),U(`ai`),G(void 0),K(void 0),q.current=new Date().toISOString(),S(y?[{id:wo(),role:`assistant`,content:y.greeting,availableActions:y.availableActions,actions:y.actions}]:[])},[i,a,n.token,y]),le=(0,t.useCallback)(e=>{try{i?.setItem(Po(a),JSON.stringify(e))}catch{}},[i,a]),ue=(0,t.useCallback)(t=>{let n=(t.email??``).trim().toLowerCase(),r=(ie.current.email??``).trim().toLowerCase();n&&r&&n!==r&&ce();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 le(t),t}),e.identify(o.current,t).catch(()=>{})},[e,le,ce]),de=(0,t.useRef)(0),Y=(0,t.useCallback)(e=>{de.current=Date.now(),b(e),S(t=>{if(t.length===0)return[{id:wo(),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})},[]);(0,t.useEffect)(()=>{if(y?.memoryEnabled===!1){C.current?.cancel();try{i?.removeItem(Fo(a,o.current))}catch{}Xo(i,a,[]),L([]),z(null),V([]),S(e=>w.current?(w.current=!1,y?[{id:wo(),role:`assistant`,content:y.greeting,availableActions:y.availableActions,actions:y.actions}]:[]):e)}},[y,i,a]);let fe=(0,t.useCallback)(async()=>{Y(await e.bootstrap())},[Y,e]);(0,t.useEffect)(()=>{let t=!0,n=e=>e.messages.map(e=>yo({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)Jo(i,a,t.sessionId,n(t),t.ended,!0,oe,se);Xo(i,a,r),L(r);let s=e.conversations.find(t=>t.sessionId===e.activeSessionId);if(!s||T.current)return;let c=n(s);o.current=s.sessionId,w.current=c.length>0;try{i?.setItem(No(a),s.sessionId)}catch{}let l=c[c.length-1]?.createdAt;l&&(q.current=l),P(s.ended),S(c)}).catch(()=>{}),()=>{t=!1}},[oe,se,a,i,e]),(0,t.useEffect)(()=>{let t=!0;return de.current=Date.now(),e.bootstrap().then(e=>{t&&Y(e)}),n.user&&ue(n.user),()=>{t=!1}},[Y,e]),(0,t.useEffect)(()=>{let e=n.configRefreshSeconds;if(!r||e<=0||typeof window>`u`)return;let t=!0,i=!1,a=Math.max(10,e)*1e3,o=()=>typeof document>`u`||document.visibilityState!==`hidden`,s=async()=>{if(!(!t||i||!o())){i=!0;try{await fe()}catch{}finally{i=!1}}};Date.now()-de.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)}},[r,n.configRefreshSeconds,fe]),(0,t.useEffect)(()=>{let e=o.current;C.current.schedule(()=>Jo(i,a,e,x,N,ae,oe,se))},[x,N,i,a,ae,oe,se]),(0,t.useEffect)(()=>{let e=C.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()}},[]),(0,t.useEffect)(()=>{So(i,`centrinfo:chat:`)},[i]),(0,t.useEffect)(()=>{if(!r||N||R)return;let t=()=>{document.visibilityState===`visible`&&e.presence(o.current)};t();let n=window.setInterval(t,1e4);return document.addEventListener(`visibilitychange`,t),()=>{window.clearInterval(n),document.removeEventListener(`visibilitychange`,t)}},[r,N,e,R]),(0,t.useEffect)(()=>{if(!r||N||R)return;let t=!0,i=!1,a=0,s,c=()=>{s!==void 0&&window.clearTimeout(s),!(!t||document.hidden)&&(s=window.setTimeout(()=>{l()},Math.min(3e4,2200*2**a)))},l=async()=>{if(!(i||document.hidden||!t)){i=!0;try{let r=await e.liveEvents(o.current,q.current);if(!t)return;if(a=0,U(r.mode),G(r.assignedAgentName||void 0),K(r.agentTyping?r.agentTypingName||r.assignedAgentName||`Agent`:void 0),r.conversationEnded){P(!0),U(`ai`),G(void 0),K(void 0),S(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=q.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),$o(n)});q.current=e,S(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`)&&$a(`receive`)}}catch{a=Math.min(a+1,4)}finally{i=!1,c()}}},u=()=>{document.hidden?s!==void 0&&window.clearTimeout(s):l()};return document.addEventListener(`visibilitychange`,u),document.hidden||l(),()=>{t=!1,s!==void 0&&window.clearTimeout(s),document.removeEventListener(`visibilitychange`,u)}},[r,n.strings.conversationEnded,e,N,R]),(0,t.useEffect)(()=>{if(!ae){Xo(i,a,[]),L(e=>e.length>0?[]:e);return}x.some(e=>e.role===`user`)&&L(e=>{let t=o.current,n=[{sessionId:t,ts:Date.now(),title:Qo(x),ended:N},...e.filter(e=>e.sessionId!==t)];return Xo(i,a,n),n.slice(0,20)})},[x,N,i,a,ae]);let X=(0,t.useCallback)((e,t)=>{S(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),pe=(0,t.useCallback)(()=>{h.current!==void 0&&typeof window<`u`&&window.clearInterval(h.current),h.current=void 0},[]),me=(0,t.useCallback)((e,t)=>{pe(),delete _.current[e],g.current===e&&(g.current=null),X(e,{content:t,pending:!1,streaming:!1})},[pe,X]),he=(0,t.useCallback)((e,t,n)=>{let r=t.trim();if(!r||typeof window>`u`){me(e,r);return}pe(),g.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}),h.current=window.setInterval(()=>{s+=1,X(e,{content:i.slice(0,s).join(``),pending:!1,streaming:s<i.length}),s>=i.length&&(pe(),delete _.current[e],g.current===e&&(g.current=null),X(e,{content:r,pending:!1,streaming:!1}))},o)},[pe,me,X]),ge=(0,t.useCallback)(()=>{let e=g.current;pe(),g.current=null;let t=_.current;_.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})},[pe,X]),_e=(0,t.useCallback)(t=>{if(N||R||H===`ai`||typeof window>`u`)return;if(J.current!==void 0&&window.clearTimeout(J.current),!t){if(!ne.current)return;ne.current=!1,re.current=0,e.typing(o.current,!1).catch(()=>{});return}let n=Date.now();(!ne.current||n-re.current>2500)&&(ne.current=!0,re.current=n,e.typing(o.current,!0).catch(()=>{})),J.current=window.setTimeout(()=>{ne.current&&(ne.current=!1,re.current=0,e.typing(o.current,!1).catch(()=>{}))},1600)},[e,N,R,H]);(0,t.useEffect)(()=>()=>{J.current!==void 0&&typeof window<`u`&&window.clearTimeout(J.current)},[]),(0,t.useEffect)(()=>()=>pe(),[pe]);let ve=(0,t.useCallback)((t,i,a={})=>{ge(),D(!0);let l=co(),p=!1,h=new AbortController;s.current=h;let g=!!(y?.allowVoiceInput&&y?.voiceOutputEnabled&&y.talkbackMode!==`text`),b=!!a.forceVoicePlayback,x=e=>{b&&j(t=>t.agentId===i?{status:e,agentId:i}:t)};b&&j({status:`answering`,agentId:i});let C={pending:new Map,nextSeq:0,highestSeq:-1,playing:!1,ended:!1,started:!1,stopped:!1,utterance:null},w=()=>{f.current===F&&(f.current=null),C.started&&(C.started=!1,k(!1),x(`done`))},T=()=>{C.stopped||C.started||(C.started=!0,lo(`voice-first-audio`,l),k(!0),x(`speaking`))},E=()=>typeof window<`u`&&`speechSynthesis`in window&&typeof SpeechSynthesisUtterance<`u`,O=()=>{u.current&&C.playing&&(u.current.pause(),u.current=null),C.utterance&&(d.current===C.utterance&&(d.current=null),C.utterance=null,E()&&window.speechSynthesis.cancel()),C.playing=!1},A=(e,t)=>{let n=e?.trim();if(!n||!E())return!1;let r=new SpeechSynthesisUtterance(n);return r.rate=y?.voiceSpeed??1,r.lang=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||`en-US`,r.onstart=T,r.onend=t,r.onerror=t,C.utterance=r,d.current=r,window.speechSynthesis.speak(r),m.current&&window.speechSynthesis.pause(),!0},M=()=>{for(;!C.stopped&&!C.playing;){let e=C.pending.get(C.nextSeq);if(!e&&C.ended&&C.pending.size>0&&(C.nextSeq=Math.min(...C.pending.keys()),e=C.pending.get(C.nextSeq)),!e){C.ended&&w();return}if(C.pending.delete(C.nextSeq),C.nextSeq+=1,N(e))return}},N=e=>{let t=!1,n=()=>{t||(t=!0,d.current===C.utterance&&(d.current=null),C.utterance=null,C.playing=!1,M())};if(!e.audioBase64||typeof Audio>`u`)return C.playing=A(e.text,n),C.playing;let r=new Audio(`data:${e.mimeType||`audio/mpeg`};base64,${e.audioBase64}`);r.playbackRate=y?.voiceSpeed??1,r.volume=m.current?.2:1,C.playing=!0,u.current=r;let i=!1,a=!1,o=()=>{t||a||(a=!0,u.current===r&&(u.current=null),!(!i&&!C.stopped&&A(e.text,n))&&n())};return r.onended=()=>{u.current===r&&(u.current=null),n()},r.onerror=o,r.play().then(()=>{i=!0,T()}).catch(o),!0},F=()=>{C.stopped=!0,C.pending.clear(),O(),w()};e.stream(t,o.current,{voicePlaybackRequested:!!a.forceVoicePlayback,clientMessageId:a.clientMessageId,attachmentId:a.attachmentId,attachmentIds:a.attachmentIds,signal:h.signal,onChunk:e=>{e&&!p&&(p=!0,lo(`data-first-chunk`,l)),a.forceVoicePlayback&&e&&(v.current[i]=!0),S(t=>t.map(t=>t.id===i?{...t,content:t.content+e,pending:!1,streaming:!0}:t))},onTextReady:()=>{S(e=>e.map(e=>e.id===i?{...e,pending:!1,streaming:!1}:e))},onReset:()=>{S(e=>e.map(e=>e.id===i?{...e,content:``,pending:!0,streaming:!1}:e)),C.pending.clear(),C.nextSeq=C.highestSeq+1,O()},onAudioSegment:e=>{!b||C.stopped||e.seq<C.nextSeq||C.pending.has(e.seq)||(f.current=F,C.highestSeq=Math.max(C.highestSeq,e.seq),C.pending.set(e.seq,e),M())}}).then(t=>{if(r&&!t.conversationEnded&&typeof document<`u`&&document.visibilityState===`visible`&&e.presence(o.current),t.liveMode&&(U(t.liveMode),G(t.assignedAgentName||void 0)),t.liveMode&&t.liveMode!==`ai`&&!t.answer.trim()){S(e=>e.filter(e=>e.id!==i)),x(`done`);return}let s=!!v.current[i];delete v.current[i];let c=!!(a.forceVoicePlayback&&g&&!t.liveAudio&&t.audioBase64&&t.answer.trim()&&!s);if(c&&(_.current[i]=t.answer),S(e=>e.map(e=>e.id===i?{...e,content:c?``:t.answer||e.content||n.strings.emptyReply,pending:!1,streaming:c,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)),$a(`receive`),t.liveAudio?(C.ended=!0,M()):a.forceVoicePlayback&&!t.audioBase64&&To(g?`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:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode,voiceProvider:y?.voiceProvider,hasAudioBase64:!!t.audioBase64}),a.forceVoicePlayback&&!t.liveAudio){let e=Eo(u,d,t.audioBase64,t.mimeType,y?.voiceSpeed??1,mo(t.answer,t.visualization),!0,e=>{k(!0),x(`speaking`),c&&he(i,t.answer,e)},()=>{k(!1),x(`done`),c&&me(i,t.answer)});e||x(`done`),c&&!e&&me(i,t.answer)}t.answer&&n.onMessage?.({role:`assistant`,content:t.answer}),t.handoffOffered&&n.onHandoff?.(),t.conversationEnded&&P(!0)}).catch(e=>{if(h.signal.aborted){C.stopped||F(),delete v.current[i],S(e=>e.flatMap(e=>e.id===i?e.content.trim()?[{...e,pending:!1,streaming:!1}]:[]:[e])),x(`done`);return}x(`failed`),delete v.current[i],X(i,{content:so(e,n.strings),pending:!1,streaming:!1,error:!0,retryText:t})}).finally(()=>{lo(`data-complete`,l),delete v.current[i],s.current===h&&(D(!1),s.current=null,c.current?.agentId===i&&(c.current=null))})},[e,r,n,X,y?.allowVoiceInput,y?.talkbackMode,y?.voiceOutputEnabled,y?.voiceSpeed,ge]),ye=(0,t.useCallback)((e,t={})=>{let r=e.trim(),{imageUrl:i,attachmentName:a,attachmentText:o,attachmentId:l,attachmentFile:u,forceVoicePlayback:d,userMessageId:f}=t,m=t.attachments??(a||l||o?[{id:l,name:a??``,text:o,file:u}]:[]);if(!r&&!i&&m.length===0||s.current&&!s.current.signal.aborted||N)return;T.current=!0;let h=r;!h&&m.length>0&&(h=`Please look at the attached file.`),!h&&i&&(h=i);let g=m.map(e=>({id:e.id,name:e.name})),_=m.flatMap(e=>e.id?[e.id]:[]),v={id:f||wo(),role:`user`,content:r,imageUrl:i,attachments:g.length>0?g:void 0};m.forEach((e,t)=>{e.file&&(p.current.set(`${v.id}:${t}`,e.file),e.id&&p.current.set(e.id,e.file))});let y=wo();S(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}]),$a(`send`),n.onMessage?.({role:`user`,content:h}),M.current[y]=v.id,c.current={userId:v.id,agentId:y,text:r,backendText:h},ve(h,y,{forceVoicePlayback:d,clientMessageId:v.id,attachmentId:_[0],attachmentIds:_})},[N,n,ve]),be=(0,t.useCallback)((e,t,r,i,a)=>{let o=wo();S(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}),M.current[o]=e.userId,c.current={userId:e.userId,agentId:o,text:t,backendText:r},ve(r,o,{forceVoicePlayback:i.forceVoicePlayback,clientMessageId:wo()})},[n,ve]),xe=(0,t.useCallback)((e,t={})=>{let n=e.trim();if(!n||N)return;let r=s.current&&!s.current.signal.aborted?c.current:null,i=r??l.current;if(l.current=null,!i){ye(n,t);return}r&&s.current?.abort(),be(i,`${i.text} ${n}`.replace(/\s+/g,` `).trim(),`${i.backendText}\n${n}`.trim(),t,n)},[N,be,ye]),Se=(0,t.useCallback)(()=>{let e=s.current&&!s.current.signal.aborted?c.current:null;return e?(l.current=e,s.current?.abort(),!0):!1},[]),Ce=(0,t.useCallback)(()=>{let e=l.current;l.current=null,!(!e||N)&&be(e,e.text,e.backendText,{forceVoicePlayback:!0})},[N,be]),we=(0,t.useCallback)(()=>s.current?.abort(),[]),Te=(0,t.useCallback)(e=>{m.current=e;let t=u.current;t&&(t.volume=e?.2:1),d.current&&typeof window<`u`&&`speechSynthesis`in window&&(e?window.speechSynthesis.pause():window.speechSynthesis.resume())},[]),Ee=(0,t.useCallback)(()=>{f.current?.(),f.current=null,m.current=!1,ge(),j(e=>e.status===`speaking`||e.status===`answering`?{...e,status:`done`}:e),u.current?.pause(),u.current=null,typeof window<`u`&&`speechSynthesis`in window&&window.speechSynthesis.cancel(),d.current=null,k(!1)},[ge]),De=(0,t.useCallback)(t=>{let n=po(t);if(!n)return Promise.resolve(!1);ge();let r=!!(y?.allowVoiceInput&&y?.voiceOutputEnabled&&y.talkbackMode!==`text`),i=(e,t)=>new Promise(r=>{let i=!1;Eo(u,d,e,t,y?.voiceSpeed??1,n,!0,()=>{i=!0,k(!0)},()=>{k(!1),r(i)})||(k(!1),r(!1))});return r?e.speak(n).then(e=>e.audioBase64?i(e.audioBase64,e.mimeType):(To(`Talkback prompt TTS did not return provider audio.`,{providerReady:e.providerReady,message:e.message,voiceProvider:y?.voiceProvider,voiceOutputEnabled:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode}),i())).catch(e=>(To(`Talkback prompt TTS request failed before audio playback.`,{error:e instanceof Error?e.message:String(e),voiceProvider:y?.voiceProvider,voiceOutputEnabled:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode}),i())):(To(`Talkback prompt wanted voice, but the loaded widget token config has provider TTS disabled.`,{voiceOutputEnabled:y?.voiceOutputEnabled,talkbackMode:y?.talkbackMode,voiceProvider:y?.voiceProvider}),i())},[y?.allowVoiceInput,y?.talkbackMode,y?.voiceOutputEnabled,y?.voiceSpeed,ge,e]),Z=(0,t.useCallback)((e,t,n={})=>{if(E||N||!t)return;X(e,{content:``,pending:!0,streaming:!1,error:!1}),$a(`send`);let r=x.findIndex(t=>t.id===e),i=r>0?x[r-1]:void 0;ve(t,e,{...n,clientMessageId:M.current[e]??(i?.role===`user`?i.id:void 0)})},[E,N,x,X,ve]),Oe=(0,t.useCallback)((t,n,r)=>{X(t,{feedback:n});let i=x.findIndex(e=>e.id===t),a=i>=0?x[i]?.content:void 0,s;for(let e=i-1;e>=0;e--)if(x[e]?.role===`user`){s=x[e]?.content;break}e.sendFeedback({sessionId:o.current,messageId:t,rating:n,comment:r,question:s,answer:a}).catch(()=>{})},[e,X,x]),ke=(0,t.useCallback)(e=>{let t=e.content.trim();if(!t)return;let n=e.id.trim()||wo();S(e=>e.some(e=>e.id===n)?e:[...e,{id:n,role:`assistant`,content:t,createdAt:new Date().toISOString()}])},[]),Ae=(0,t.useCallback)(async(t,r,i={},a)=>{n.onAction?.(t);let s=t===`public_contact_support`||t===`public_submit_inquiry`?{actionId:t}:{},c=await e.action(t,{sessionId:o.current,...r,...s},a),l={};return i.name?.trim()&&(l.name=i.name.trim()),i.email?.trim()&&(l.email=i.email.trim()),i.phone?.trim()&&(l.phone=i.phone.trim()),Object.keys(l).length>0&&(ee(e=>{let t={...e,...l};return le(t),t}),l.email&&t!==`contact`&&e.action(`contact`,{sessionId:o.current,...l}).catch(()=>{})),ke({id:c.receipt?.id||wo(),content:c.receipt?.content||c.note||(c.caseReference?`Action completed.\nReference: ${c.caseReference}`:`Action completed.`)}),$a(`receive`),c},[e,n,le,ke]),je=(0,t.useCallback)(async(t,n,r)=>{let i=await e.confirmHostedBooking?.({sessionId:o.current,inquiryId:t,eventUri:n,inviteeUri:r});return i?.receipt&&ke(i.receipt),i},[e,ke]),Me=(0,t.useCallback)(e=>{let t=e.trim();t&&S(e=>e.some(e=>e.role===`assistant`&&e.content===t)?e:[...e,{id:wo(),role:`assistant`,content:t}])},[]),Ne=(0,t.useCallback)(()=>{let e=es(y?.actions);return e?(S(t=>[...t,{id:wo(),role:`assistant`,content:n.strings.reconnectPrompt,actions:[e],selectedAction:e.id,handoffOffered:!0,reconnectOffer:!0,createdAt:new Date().toISOString()}]),!0):!1},[n.strings.reconnectPrompt,y?.actions]),Pe=(0,t.useCallback)(e=>{T.current=!0;let t=wo();return S(n=>[...n,{id:t,role:`user`,content:e.trim(),pending:!0}]),t},[]),Fe=(0,t.useCallback)((e,t)=>{S(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),Ie=(0,t.useCallback)(e=>{S(t=>t.filter(t=>t.id!==e))},[]),Le=(0,t.useCallback)(async(t,n=`widget`)=>{if(!e.sendExplanationFeedback)throw Error(`Explanation feedback is unavailable.`);await e.sendExplanationFeedback({...t,sessionId:o.current,surface:n})},[e]),Re=(0,t.useCallback)((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,o.current,t,r)),settled:(e,t)=>{t!==`not_requested`&&S(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,o.current,t))}:{}}},[e]),ze=(0,t.useCallback)((t,n)=>{e.sendFeedback({sessionId:o.current,messageId:`__csat__`,rating:t,comment:n}).catch(()=>{})},[e]),Be=(0,t.useCallback)(async(t,n,r,i)=>{let a=co();try{if(typeof t!=`string`&&e.transcribeAudio)return await e.transcribeAudio(t,n,r,i);let a=typeof t==`string`?t:await io(t);return await e.transcribe(a,n,r,i)}finally{lo(`voice-transcription`,a)}},[e]),Ve=(0,t.useCallback)(async(t,n,r=0)=>{let i=p.current.get(`${t.id}:${r}`)??(n.id?p.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,o.current)},[e]),He=(0,t.useCallback)((t,n,r,i)=>e.uploadAttachment?e.uploadAttachment(t,n,r,o.current,i):Promise.reject(Error(`File upload is unavailable`)),[e]),Ue=(0,t.useCallback)(t=>e.searchGifs(t),[e]),We=(0,t.useCallback)((t,n)=>e.demoSlots(t,n),[e]),Ge=(0,t.useCallback)(e=>ye(``,{imageUrl:e}),[ye]),Ke=n.demo||!!n.gifApiKey,qe=(0,t.useCallback)(()=>{s.current?.abort(),P(!0),e.endConversation(o.current).catch(()=>{})},[e]),Je=(0,t.useCallback)(()=>{s.current?.abort();let e=jo(n);o.current=e;try{i?.setItem(No(a),e)}catch{}z(null),V([]),P(!1),U(`ai`),G(void 0),K(void 0),q.current=new Date().toISOString(),S(y?[{id:wo(),role:`assistant`,content:y.greeting,availableActions:y.availableActions,actions:y.actions}]:[])},[i,a,y]),Ye=(0,t.useCallback)(e=>{if(ae){if(e===o.current){z(null);return}V(Wo(i,a,e)),z(e)}},[i,a,ae]),Xe=(0,t.useCallback)(()=>{z(null),V([])},[]);return{persona:y,messages:x,sending:E,assistantSpeaking:O,voiceReply:A,visitor:F,starters:n.starters.length>0?n.starters:y?.starterQuestions??[],featuredLinks:y?.featuredLinks??[],hasEmail:!!F.email,liveMode:H,assignedAgentName:W,agentTypingName:te,send:ye,amend:xe,hold:Se,resumeHeld:Ce,duckSpeaking:Te,sendGif:Ge,notifyTyping:_e,stop:we,retry:Z,rateMessage:Oe,rateExplanation:Le,explanationTransport:Re,injectAssistant:Me,reconnectSupport:Ne,appendUserDraft:Pe,patchMessage:Fe,removeMessage:Ie,submitCsat:ze,submitForm:Ae,confirmHostedBooking:je,transcribe:Be,uploadAttachment:He,loadAttachment:Ve,searchGifs:Ue,demoSlots:We,gifEnabled:Ke,identify:ue,ended:N,endConversation:qe,startNew:Je,history:ae?I:[],viewingSessionId:R,viewMessages:B,openConversation:Ye,closeHistoryView:Xe,shutdown:ce,stopSpeaking:Ee,speakAssistantText:De}},rs=`https://api.accurixtech.com`,is=()=>typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||`en`,as=(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]},os=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()||is(),n=as(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:Rr({...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:Gr(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}},ss=`
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
+ ${Re(`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
+ ${Nn(`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:jn,chartDark:Mn,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
+ `;Object.defineProperty(exports,`A`,{enumerable:!0,get:function(){return ei}}),Object.defineProperty(exports,`B`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return Sa}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return Ii}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return wa}}),Object.defineProperty(exports,`F`,{enumerable:!0,get:function(){return bi}}),Object.defineProperty(exports,`G`,{enumerable:!0,get:function(){return un}}),Object.defineProperty(exports,`H`,{enumerable:!0,get:function(){return br}}),Object.defineProperty(exports,`I`,{enumerable:!0,get:function(){return Ti}}),Object.defineProperty(exports,`J`,{enumerable:!0,get:function(){return nn}}),Object.defineProperty(exports,`K`,{enumerable:!0,get:function(){return on}}),Object.defineProperty(exports,`L`,{enumerable:!0,get:function(){return wi}}),Object.defineProperty(exports,`M`,{enumerable:!0,get:function(){return Ci}}),Object.defineProperty(exports,`N`,{enumerable:!0,get:function(){return gi}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return Ai}}),Object.defineProperty(exports,`P`,{enumerable:!0,get:function(){return hi}}),Object.defineProperty(exports,`R`,{enumerable:!0,get:function(){return Hr}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return Ra}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return Ca}}),Object.defineProperty(exports,`U`,{enumerable:!0,get:function(){return Rn}}),Object.defineProperty(exports,`V`,{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(exports,`W`,{enumerable:!0,get:function(){return pn}}),Object.defineProperty(exports,`X`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`Y`,{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(exports,`Z`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return ha}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return ns}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return Ba}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return no}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return Xa}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return qa}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return Ka}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return Va}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return ts}}),Object.defineProperty(exports,`j`,{enumerable:!0,get:function(){return Si}}),Object.defineProperty(exports,`k`,{enumerable:!0,get:function(){return $r}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return oo}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return Ga}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return os}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return ro}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return Wa}}),Object.defineProperty(exports,`q`,{enumerable:!0,get:function(){return cn}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return es}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return ao}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ss}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return $a}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return Ui}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return va}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return ya}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return Ji}}),Object.defineProperty(exports,`z`,{enumerable:!0,get:function(){return Br}});