@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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "packageName": "@accurix/centrinfo-widget",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "fileName": "centrinfo-widget.js",
5
- "cdnPath": "centrinfo/js/sdk-centrinfo-widget-v5.1.0/centrinfo-widget.js",
6
- "bytes": 389905,
7
- "gzipBytes": 113120,
8
- "sha256": "ada2da563e5af309b949a1771f2a1069b217216e7357fb67d199de43f80875f7",
9
- "sri": "sha256-raLaVj5a8wm5SaF3HyoQabIXIW5zV/tn0ZneQ/gIdfc=",
5
+ "cdnPath": "centrinfo/js/sdk-centrinfo-widget-v5.1.2/centrinfo-widget.js",
6
+ "bytes": 395619,
7
+ "gzipBytes": 114645,
8
+ "sha256": "ca659ba7770094d8c33b84c35aa94c424e3a196e40e9fe98af926af2e0d58dc8",
9
+ "sri": "sha256-ymWbp3cAlNjDO4TDWqlMQk46GW5A6f6Yr5Jq8uDVjcg=",
10
10
  "chunks": [
11
11
  {
12
12
  "fileName": "centrinfo-widget-charts.js",
@@ -16,9 +16,9 @@
16
16
  },
17
17
  {
18
18
  "fileName": "centrinfo-widget-dev.js",
19
- "bytes": 15356,
20
- "gzipBytes": 4983,
21
- "sri": "sha256-7b2VcAN/5oc0rrBxp0Th9uIlF7D4HxsydV6vkZtLYGQ="
19
+ "bytes": 15339,
20
+ "gzipBytes": 4970,
21
+ "sri": "sha256-AhvOMKbTFFzXwDiNZOPUR8bESECXAU81E/cjm1J7eyY="
22
22
  }
23
23
  ]
24
24
  }
@@ -1 +1 @@
1
- const e=e=>new Promise(t=>setTimeout(t,e)),t={agentName:`Accurix`,agentAvatarUrl:``,widgetModule:`assistant`,assistantMediaUrl:`https://images.unsplash.com/photo-1494790108377-be9c29b29330`,assistantMediaKind:`image`,assistantPrivacyUrl:`https://accurix.tech/privacy`,soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:`avatar`,avatarProvider:`demo`,avatarId:`accurix-demo`,greeting:`Hi! I'm Accurix, the AI assistant for Accurix. Ask me anything about products, pricing, or documentation — or book a demo.`,allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[`public_book_demo`,`public_capture_contact`,`public_submit_inquiry`],agentDescription:`I help with Accurix products, pricing, and documentation.`,welcomeSubtitle:`Ask me anything — most answers are instant.`,disclaimerText:`Accurix is an AI assistant; answers may be imperfect.`,starterQuestions:[`What can Accurix help with?`,`How do I get started?`,`What's your pricing?`],featuredLinks:[{label:`Accurix founders`,url:`https://accurix.tech/about`},{label:`Pricing`,url:`https://accurix.tech/pricing`}]},n=[{match:/demo chart|monthly orders|orders by status/i,result:{answer:`Orders moved in different directions by status in the latest month. The chart below shows one line for submitted, approved, and fulfilled orders.`,sources:[],suggestedReplies:[`Show a demo KPI`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`chart`,type:`line`,title:`Monthly orders by status`,reportingPeriod:{label:`January–August 2025`,timezone:`Africa/Lagos`},timezone:`Africa/Lagos`,freshness:{status:`live`,answeredAt:`2026-10-09T10:00:00Z`},appliedFilters:[{field:`status`,operator:`in`,value:[`Submitted`,`Approved`,`Fulfilled`]}],columns:[`month`,`status`,`order_count`],rows:[{month:`2025-01-01`,status:`Submitted`,order_count:12},{month:`2025-01-01`,status:`Approved`,order_count:16},{month:`2025-01-01`,status:`Fulfilled`,order_count:14},{month:`2025-02-01`,status:`Submitted`,order_count:14},{month:`2025-02-01`,status:`Approved`,order_count:15},{month:`2025-02-01`,status:`Fulfilled`,order_count:15},{month:`2025-03-01`,status:`Submitted`,order_count:13},{month:`2025-03-01`,status:`Approved`,order_count:17},{month:`2025-03-01`,status:`Fulfilled`,order_count:16},{month:`2025-04-01`,status:`Submitted`,order_count:15},{month:`2025-04-01`,status:`Approved`,order_count:16},{month:`2025-04-01`,status:`Fulfilled`,order_count:17},{month:`2025-05-01`,status:`Submitted`,order_count:16},{month:`2025-05-01`,status:`Approved`,order_count:18},{month:`2025-05-01`,status:`Fulfilled`,order_count:17},{month:`2025-06-01`,status:`Submitted`,order_count:17},{month:`2025-06-01`,status:`Approved`,order_count:17},{month:`2025-06-01`,status:`Fulfilled`,order_count:18},{month:`2025-07-01`,status:`Submitted`,order_count:18},{month:`2025-07-01`,status:`Approved`,order_count:19},{month:`2025-07-01`,status:`Fulfilled`,order_count:18},{month:`2025-08-01`,status:`Submitted`,order_count:19},{month:`2025-08-01`,status:`Approved`,order_count:18},{month:`2025-08-01`,status:`Fulfilled`,order_count:19}],rowCount:24,columnMetadata:[{key:`month`,label:`Order month`,dataType:`date`,semanticRole:`date`},{key:`status`,label:`Status`,dataType:`text`,semanticRole:`dimension`},{key:`order_count`,label:`Distinct order count`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],chartRecommendation:{type:`line`,mode:`time_series`,categoryField:`month`,valueFields:[`order_count`],seriesField:`status`},expandable:!0,tableAvailable:!1,explanation:{headline:`The latest results moved in different directions by status.`,summary:`Submitted and fulfilled orders increased, while approved orders decreased.`,evidence:[`Submitted orders increased from 18 in July to 19 in August.`,`Approved orders decreased from 19 in July to 18 in August.`,`Fulfilled orders increased from 18 in July to 19 in August.`],businessMeaning:`Overall order activity is steady, but the small approval decline is worth watching if it continues.`,followUps:[`Which status changed the most?`,`How does this compare with the prior quarter?`],source:`governed_result`}}}},{match:/demo kpi|active accounts/i,result:{answer:`There are 5,632 active accounts in the current demo result.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`kpi`,type:`kpi`,title:`Active accounts`,columns:[`active_accounts`],value:`active_accounts`,rows:[{active_accounts:5632}],rowCount:1,columnMetadata:[{key:`active_accounts`,label:`Active accounts`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],explanation:{headline:`Active accounts are 5,632.`,summary:`This is the latest value in the demo result.`,evidence:[`The displayed active-account count is 5,632.`],source:`governed_result`}}}},{match:/demo table|account health/i,result:{answer:`Nine accounts are included in this governed result. The table shows a compact preview and can be expanded to inspect every permitted row.`,sources:[],suggestedReplies:[`Show a demo chart`,`Test the hidden table response`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,title:`Account health`,columns:[`account_name`,`region`,`health_score`,`renewal_month`],rows:[{account_name:`Northstar Industries`,region:`West`,health_score:94,renewal_month:`August`},{account_name:`Apex Group`,region:`East`,health_score:91,renewal_month:`September`},{account_name:`Summit Retail`,region:`North`,health_score:88,renewal_month:`August`},{account_name:`Harbor Logistics`,region:`South`,health_score:86,renewal_month:`October`},{account_name:`Brightline Media`,region:`West`,health_score:84,renewal_month:`November`},{account_name:`Redwood Labs`,region:`East`,health_score:82,renewal_month:`September`},{account_name:`Atlas Foods`,region:`North`,health_score:79,renewal_month:`December`},{account_name:`Cedar Health`,region:`South`,health_score:77,renewal_month:`October`},{account_name:`Bluewave Energy`,region:`West`,health_score:74,renewal_month:`December`}],rowCount:9,columnMetadata:[{key:`account_name`,label:`Account`,dataType:`text`,semanticRole:`dimension`},{key:`region`,label:`Region`,dataType:`text`,semanticRole:`geography`},{key:`health_score`,label:`Health score`,dataType:`number`,semanticRole:`measure`},{key:`renewal_month`,label:`Renewal month`,dataType:`text`,semanticRole:`date`}],expandable:!0,tableAvailable:!0,downloadAvailable:!0,explanation:{headline:`Nine accounts are available for review.`,summary:`Health scores range from 74 to 94 across four regions.`,evidence:[`Northstar Industries has the highest health score at 94.`],source:`governed_result`}}}},{match:/hidden table|table response/i,result:{answer:`Three accounts need attention. The public widget explains the result without exposing its underlying rows.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo KPI`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,columns:[`account_name`,`risk_score`],rows:[{account_name:`Private account A`,risk_score:91},{account_name:`Private account B`,risk_score:87},{account_name:`Private account C`,risk_score:82}],rowCount:3,tableAvailable:!1,explanation:{headline:`Three accounts need attention.`,summary:`The written result is available without displaying a public data table.`,evidence:[`Three accounts matched the approved attention rule.`],source:`governed_result`}}}},{match:/^\s*(hi+|hey+|hello|yo|sup|howdy|hola|thanks|thank you|thx|good (morning|afternoon|evening))\b/i,result:{answer:`Hello! 👋 How can I help you today?`,sources:[],suggestedReplies:[`How do I track a shipment?`,`How does customs work?`],handoffOffered:!1}},{match:/track|shipment|where|status/i,result:{answer:`Centrinfo can answer from your indexed knowledge base, public website, connected files, and approved organization tools. It keeps answers grounded in your configured sources and can hand a conversation to your team when the AI is not enough.`,sources:[{title:`Centrinfo public widget`,url:`https://accurix.tech/centrinfo`}],suggestedReplies:[`How does the widget work?`,`Can a human take over?`],handoffOffered:!1}},{match:/custom|clear|duty|tariff|import/i,result:{answer:`Accurix connects your organization knowledge, channels, integrations, and public widget in one place. You can configure which sources the AI can use, which tools visitors can trigger, and when your team should take over live chat.`,sources:[{title:`Accurix documentation`,url:`https://accurix.tech/docs`}],suggestedReplies:[`Which tools can I connect?`,`How do permissions work?`],handoffOffered:!1}},{match:/price|cost|pricing|plan|quote/i,result:{answer:`Accurix uses a usage-based pricing model. Organizations keep an active subscription and spend credits as the AI answers, searches, and uses tools. Credit top-ups can extend usage when the subscription grant runs low.`,sources:[{title:`Pricing`,url:`https://accurix.tech/pricing`}],suggestedReplies:[`How do credits work?`,`Can I top up credits?`],handoffOffered:!1}}],r={answer:`That's a great question — I don't have a confident answer from Accurix's published docs yet. Want me to pass it to the team so a human can follow up? You can also book a quick demo.`,sources:[],suggestedReplies:[`What can you help with?`],handoffOffered:!0},i=e=>n.find(t=>t.match.test(e))?.result??r;var a=class{async history(){return{conversations:[]}}async bootstrap(){return await e(180),t}async stream(n,r,a){await e(550);let o=i(n),s=o.answer.split(/(\s+)/);for(let t of s){if(a.signal?.aborted)break;a.onChunk(t),await e(18+Math.min(40,t.length*6))}return{...o,availableActions:t.availableActions}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async presence(e){}async typing(){await e(20)}async action(t,n){return await e(450),{ok:!0,note:{"book-demo":`Demo requested — we'll email you a few times that work. 📅`,contact:`Got it — saved your details. ✅`,"contact-support":`Support request sent. The team can follow up from this chat. ✅`,inquiry:`Thanks! We'll get back to you shortly. ✉️`,"request-callback":`We'll call you back soon. 📞`,"schedule-callback":`Your callback has been scheduled.`,"subscribe-newsletter":`You're subscribed. 🎉`}[t]}}async speak(){return await e(120),{providerReady:!1,message:`Demo voice provider is not connected.`}}async transcribe(t,n,r,i){return await e(700),`How do I track a shipment?`}async uploadAttachment(e,t,n){return{id:`demo-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async identify(t,n){await e(50)}async endConversation(t){await e(50)}async sendFeedback(){await e(50)}async sendExplanationFeedback(){await e(50)}async demoSlots(t,n){return await e(150),{taken:[[11,0],[15,0]].map(([e,t])=>{let n=new Date;return n.setHours(e,t,0,0),n.toISOString()}),busy:[]}}async searchGifs(t){await e(280);let n=t.trim().toLowerCase(),r=n?l.filter(e=>e.alt.includes(n)||e.tags.some(e=>e.includes(n)||n.includes(e))):l;return(r.length>0?r:l).map(e=>({id:e.id,url:c(e.emoji,e.anim),preview:c(e.emoji,e.anim),alt:e.alt}))}};const o=`<animateTransform attributeName='transform' attributeType='XML' type='translate' values='0 0;0 -16;0 0' dur='0.7s' repeatCount='indefinite'/>`,s=`<animateTransform attributeName='transform' attributeType='XML' type='rotate' values='-14 64 110;14 64 110;-14 64 110' dur='0.9s' repeatCount='indefinite'/>`,c=(e,t)=>{let n=`<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128'><rect width='128' height='128' rx='14' fill='#eef1f4'/><text x='64' y='88' font-size='64' text-anchor='middle'>${e}${t}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(n)}`},l=[{id:`g1`,emoji:`👍`,alt:`thumbs up`,tags:[`thumbs`,`yes`,`ok`,`great`,`good`],anim:o},{id:`g2`,emoji:`🎉`,alt:`celebrate`,tags:[`party`,`yay`,`congrats`,`celebrate`],anim:s},{id:`g3`,emoji:`👋`,alt:`wave hello`,tags:[`hi`,`hello`,`hey`,`wave`,`bye`],anim:s},{id:`g4`,emoji:`❤️`,alt:`heart`,tags:[`love`,`thanks`,`heart`],anim:o},{id:`g5`,emoji:`🤔`,alt:`thinking`,tags:[`hmm`,`think`,`thinking`],anim:s},{id:`g6`,emoji:`😂`,alt:`laughing`,tags:[`lol`,`funny`,`haha`,`laugh`],anim:o},{id:`g7`,emoji:`🔥`,alt:`fire`,tags:[`fire`,`hot`,`lit`,`awesome`],anim:o},{id:`g8`,emoji:`🚀`,alt:`rocket`,tags:[`rocket`,`launch`,`fast`,`go`],anim:s}],u=e=>new Promise(t=>setTimeout(t,e));var d=class{constructor(e,t){this.real=e,this.strings=t}bootstrap(){return this.real.bootstrap()}async history(){return{conversations:[]}}async stream(e,t,n){await u(300);for(let e of this.strings.previewReply.split(/(\s+)/)){if(n.signal?.aborted)break;n.onChunk(e),await u(16)}return{answer:this.strings.previewReply,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async presence(e){}async typing(){}async action(){return await u(250),{ok:!0,note:this.strings.previewActionNote}}async speak(){return{providerReady:!1,message:`Preview voice provider is not connected.`}}async identify(){}async endConversation(){}async sendFeedback(){}async sendExplanationFeedback(){}async transcribe(e,t,n,r){return``}async uploadAttachment(e,t,n){return{id:`preview-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async searchGifs(){return[]}async demoSlots(){return{taken:[],busy:[]}}};export{a as MockTransport,d as PreviewTransport};
1
+ const e=e=>new Promise(t=>setTimeout(t,e)),t={agentName:`Accurix`,agentAvatarUrl:``,widgetModule:`assistant`,assistantMediaUrl:`https://images.unsplash.com/photo-1494790108377-be9c29b29330`,assistantMediaKind:`image`,assistantPrivacyUrl:`https://accurix.tech/privacy`,soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:`avatar`,avatarProvider:`demo`,avatarId:`accurix-demo`,greeting:`Hi! I'm Accurix, the AI assistant for Accurix. Ask me anything about products, pricing, or documentation — or book a demo.`,allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[`public_book_demo`,`public_capture_contact`,`public_submit_inquiry`],agentDescription:`I help with Accurix products, pricing, and documentation.`,welcomeSubtitle:`Ask me anything — most answers are instant.`,disclaimerText:`Accurix is an AI assistant; answers may be imperfect.`,starterQuestions:[`What can Accurix help with?`,`How do I get started?`,`What's your pricing?`],featuredLinks:[{label:`Accurix founders`,url:`https://accurix.tech/about`},{label:`Pricing`,url:`https://accurix.tech/pricing`}]},n=[{match:/demo chart|monthly orders|orders by status/i,result:{answer:`Orders moved in different directions by status in the latest month. The chart below shows one line for submitted, approved, and fulfilled orders.`,sources:[],suggestedReplies:[`Show a demo KPI`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`chart`,type:`line`,title:`Monthly orders by status`,reportingPeriod:{label:`January–August 2025`,timezone:`Africa/Lagos`},timezone:`Africa/Lagos`,freshness:{status:`live`,answeredAt:`2026-10-09T10:00:00Z`},appliedFilters:[{field:`status`,operator:`in`,value:[`Submitted`,`Approved`,`Fulfilled`]}],columns:[`month`,`status`,`order_count`],rows:[{month:`2025-01-01`,status:`Submitted`,order_count:12},{month:`2025-01-01`,status:`Approved`,order_count:16},{month:`2025-01-01`,status:`Fulfilled`,order_count:14},{month:`2025-02-01`,status:`Submitted`,order_count:14},{month:`2025-02-01`,status:`Approved`,order_count:15},{month:`2025-02-01`,status:`Fulfilled`,order_count:15},{month:`2025-03-01`,status:`Submitted`,order_count:13},{month:`2025-03-01`,status:`Approved`,order_count:17},{month:`2025-03-01`,status:`Fulfilled`,order_count:16},{month:`2025-04-01`,status:`Submitted`,order_count:15},{month:`2025-04-01`,status:`Approved`,order_count:16},{month:`2025-04-01`,status:`Fulfilled`,order_count:17},{month:`2025-05-01`,status:`Submitted`,order_count:16},{month:`2025-05-01`,status:`Approved`,order_count:18},{month:`2025-05-01`,status:`Fulfilled`,order_count:17},{month:`2025-06-01`,status:`Submitted`,order_count:17},{month:`2025-06-01`,status:`Approved`,order_count:17},{month:`2025-06-01`,status:`Fulfilled`,order_count:18},{month:`2025-07-01`,status:`Submitted`,order_count:18},{month:`2025-07-01`,status:`Approved`,order_count:19},{month:`2025-07-01`,status:`Fulfilled`,order_count:18},{month:`2025-08-01`,status:`Submitted`,order_count:19},{month:`2025-08-01`,status:`Approved`,order_count:18},{month:`2025-08-01`,status:`Fulfilled`,order_count:19}],rowCount:24,columnMetadata:[{key:`month`,label:`Order month`,dataType:`date`,semanticRole:`date`},{key:`status`,label:`Status`,dataType:`text`,semanticRole:`dimension`},{key:`order_count`,label:`Distinct order count`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],chartRecommendation:{type:`line`,mode:`time_series`,categoryField:`month`,valueFields:[`order_count`],seriesField:`status`},expandable:!0,tableAvailable:!1,explanation:{headline:`The latest results moved in different directions by status.`,summary:`Submitted and fulfilled orders increased, while approved orders decreased.`,evidence:[`Submitted orders increased from 18 in July to 19 in August.`,`Approved orders decreased from 19 in July to 18 in August.`,`Fulfilled orders increased from 18 in July to 19 in August.`],businessMeaning:`Overall order activity is steady, but the small approval decline is worth watching if it continues.`,followUps:[`Which status changed the most?`,`How does this compare with the prior quarter?`],source:`governed_result`}}}},{match:/demo kpi|active accounts/i,result:{answer:`There are 5,632 active accounts in the current demo result.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`kpi`,type:`kpi`,title:`Active accounts`,columns:[`active_accounts`],value:`active_accounts`,rows:[{active_accounts:5632}],rowCount:1,columnMetadata:[{key:`active_accounts`,label:`Active accounts`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],explanation:{headline:`Active accounts are 5,632.`,summary:`This is the latest value in the demo result.`,evidence:[`The displayed active-account count is 5,632.`],source:`governed_result`}}}},{match:/demo table|account health/i,result:{answer:`Nine accounts are included in this governed result. The table shows a compact preview and can be expanded to inspect every permitted row.`,sources:[],suggestedReplies:[`Show a demo chart`,`Test the hidden table response`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,title:`Account health`,columns:[`account_name`,`region`,`health_score`,`renewal_month`],rows:[{account_name:`Northstar Industries`,region:`West`,health_score:94,renewal_month:`August`},{account_name:`Apex Group`,region:`East`,health_score:91,renewal_month:`September`},{account_name:`Summit Retail`,region:`North`,health_score:88,renewal_month:`August`},{account_name:`Harbor Logistics`,region:`South`,health_score:86,renewal_month:`October`},{account_name:`Brightline Media`,region:`West`,health_score:84,renewal_month:`November`},{account_name:`Redwood Labs`,region:`East`,health_score:82,renewal_month:`September`},{account_name:`Atlas Foods`,region:`North`,health_score:79,renewal_month:`December`},{account_name:`Cedar Health`,region:`South`,health_score:77,renewal_month:`October`},{account_name:`Bluewave Energy`,region:`West`,health_score:74,renewal_month:`December`}],rowCount:9,columnMetadata:[{key:`account_name`,label:`Account`,dataType:`text`,semanticRole:`dimension`},{key:`region`,label:`Region`,dataType:`text`,semanticRole:`geography`},{key:`health_score`,label:`Health score`,dataType:`number`,semanticRole:`measure`},{key:`renewal_month`,label:`Renewal month`,dataType:`text`,semanticRole:`date`}],expandable:!0,tableAvailable:!0,downloadAvailable:!0,explanation:{headline:`Nine accounts are available for review.`,summary:`Health scores range from 74 to 94 across four regions.`,evidence:[`Northstar Industries has the highest health score at 94.`],source:`governed_result`}}}},{match:/hidden table|table response/i,result:{answer:`Three accounts need attention. The public widget explains the result without exposing its underlying rows.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo KPI`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,columns:[`account_name`,`risk_score`],rows:[{account_name:`Private account A`,risk_score:91},{account_name:`Private account B`,risk_score:87},{account_name:`Private account C`,risk_score:82}],rowCount:3,tableAvailable:!1,explanation:{headline:`Three accounts need attention.`,summary:`The written result is available without displaying a public data table.`,evidence:[`Three accounts matched the approved attention rule.`],source:`governed_result`}}}},{match:/^\s*(hi+|hey+|hello|yo|sup|howdy|hola|thanks|thank you|thx|good (morning|afternoon|evening))\b/i,result:{answer:`Hello! 👋 How can I help you today?`,sources:[],suggestedReplies:[`How do I track a shipment?`,`How does customs work?`],handoffOffered:!1}},{match:/track|shipment|where|status/i,result:{answer:`Centrinfo can answer from your indexed knowledge base, public website, connected files, and approved organization tools. It keeps answers grounded in your configured sources and can hand a conversation to your team when the AI is not enough.`,sources:[{title:`Centrinfo public widget`,url:`https://accurix.tech/centrinfo`}],suggestedReplies:[`How does the widget work?`,`Can a human take over?`],handoffOffered:!1}},{match:/custom|clear|duty|tariff|import/i,result:{answer:`Accurix connects your organization knowledge, channels, integrations, and public widget in one place. You can configure which sources the AI can use, which tools visitors can trigger, and when your team should take over live chat.`,sources:[{title:`Accurix documentation`,url:`https://accurix.tech/docs`}],suggestedReplies:[`Which tools can I connect?`,`How do permissions work?`],handoffOffered:!1}},{match:/price|cost|pricing|plan|quote/i,result:{answer:`Accurix uses a usage-based pricing model. Organizations keep an active subscription and spend credits as the AI answers, searches, and uses tools. Credit top-ups can extend usage when the subscription grant runs low.`,sources:[{title:`Pricing`,url:`https://accurix.tech/pricing`}],suggestedReplies:[`How do credits work?`,`Can I top up credits?`],handoffOffered:!1}}],r={answer:`That's a great question — I don't have a confident answer from Accurix's published docs yet. Want me to pass it to the team so a human can follow up? You can also book a quick demo.`,sources:[],suggestedReplies:[`What can you help with?`],handoffOffered:!0},i=e=>n.find(t=>t.match.test(e))?.result??r;var a=class{async history(){return{conversations:[]}}async bootstrap(){return await e(180),t}async stream(n,r,a){await e(550);let o=i(n),s=o.answer.split(/(\s+)/);for(let t of s){if(a.signal?.aborted)break;a.onChunk(t),await e(18+Math.min(40,t.length*6))}return{...o,availableActions:t.availableActions}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async presence(e){}async typing(){await e(20)}async action(t,n){return await e(450),{ok:!0,note:{"book-demo":`Demo requested. The team will follow up. 📅`,contact:`Got it — saved your details. ✅`,"contact-support":`Support request sent. The team can follow up from this chat. ✅`,inquiry:`Thanks! We'll get back to you shortly. ✉️`,"request-callback":`We'll call you back soon. 📞`,"schedule-callback":`Your callback has been scheduled.`,"subscribe-newsletter":`You're subscribed. 🎉`}[t]}}async speak(){return await e(120),{providerReady:!1,message:`Demo voice provider is not connected.`}}async transcribe(t,n,r,i){return await e(700),`How do I track a shipment?`}async uploadAttachment(e,t,n){return{id:`demo-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async identify(t,n){await e(50)}async endConversation(t){await e(50)}async sendFeedback(){await e(50)}async sendExplanationFeedback(){await e(50)}async demoSlots(t,n){return await e(150),{taken:[[11,0],[15,0]].map(([e,t])=>{let n=new Date;return n.setHours(e,t,0,0),n.toISOString()}),busy:[]}}async searchGifs(t){await e(280);let n=t.trim().toLowerCase(),r=n?l.filter(e=>e.alt.includes(n)||e.tags.some(e=>e.includes(n)||n.includes(e))):l;return(r.length>0?r:l).map(e=>({id:e.id,url:c(e.emoji,e.anim),preview:c(e.emoji,e.anim),alt:e.alt}))}};const o=`<animateTransform attributeName='transform' attributeType='XML' type='translate' values='0 0;0 -16;0 0' dur='0.7s' repeatCount='indefinite'/>`,s=`<animateTransform attributeName='transform' attributeType='XML' type='rotate' values='-14 64 110;14 64 110;-14 64 110' dur='0.9s' repeatCount='indefinite'/>`,c=(e,t)=>{let n=`<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128'><rect width='128' height='128' rx='14' fill='#eef1f4'/><text x='64' y='88' font-size='64' text-anchor='middle'>${e}${t}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(n)}`},l=[{id:`g1`,emoji:`👍`,alt:`thumbs up`,tags:[`thumbs`,`yes`,`ok`,`great`,`good`],anim:o},{id:`g2`,emoji:`🎉`,alt:`celebrate`,tags:[`party`,`yay`,`congrats`,`celebrate`],anim:s},{id:`g3`,emoji:`👋`,alt:`wave hello`,tags:[`hi`,`hello`,`hey`,`wave`,`bye`],anim:s},{id:`g4`,emoji:`❤️`,alt:`heart`,tags:[`love`,`thanks`,`heart`],anim:o},{id:`g5`,emoji:`🤔`,alt:`thinking`,tags:[`hmm`,`think`,`thinking`],anim:s},{id:`g6`,emoji:`😂`,alt:`laughing`,tags:[`lol`,`funny`,`haha`,`laugh`],anim:o},{id:`g7`,emoji:`🔥`,alt:`fire`,tags:[`fire`,`hot`,`lit`,`awesome`],anim:o},{id:`g8`,emoji:`🚀`,alt:`rocket`,tags:[`rocket`,`launch`,`fast`,`go`],anim:s}],u=e=>new Promise(t=>setTimeout(t,e));var d=class{constructor(e,t){this.real=e,this.strings=t}bootstrap(){return this.real.bootstrap()}async history(){return{conversations:[]}}async stream(e,t,n){await u(300);for(let e of this.strings.previewReply.split(/(\s+)/)){if(n.signal?.aborted)break;n.onChunk(e),await u(16)}return{answer:this.strings.previewReply,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async presence(e){}async typing(){}async action(){return await u(250),{ok:!0,note:this.strings.previewActionNote}}async speak(){return{providerReady:!1,message:`Preview voice provider is not connected.`}}async identify(){}async endConversation(){}async sendFeedback(){}async sendExplanationFeedback(){}async transcribe(e,t,n,r){return``}async uploadAttachment(e,t,n){return{id:`preview-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async searchGifs(){return[]}async demoSlots(){return{taken:[],busy:[]}}};export{a as MockTransport,d as PreviewTransport};
@@ -1 +1 @@
1
- const e=e=>new Promise(t=>setTimeout(t,e)),t={agentName:`Accurix`,agentAvatarUrl:``,widgetModule:`assistant`,assistantMediaUrl:`https://images.unsplash.com/photo-1494790108377-be9c29b29330`,assistantMediaKind:`image`,assistantPrivacyUrl:`https://accurix.tech/privacy`,soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:`avatar`,avatarProvider:`demo`,avatarId:`accurix-demo`,greeting:`Hi! I'm Accurix, the AI assistant for Accurix. Ask me anything about products, pricing, or documentation — or book a demo.`,allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[`public_book_demo`,`public_capture_contact`,`public_submit_inquiry`],agentDescription:`I help with Accurix products, pricing, and documentation.`,welcomeSubtitle:`Ask me anything — most answers are instant.`,disclaimerText:`Accurix is an AI assistant; answers may be imperfect.`,starterQuestions:[`What can Accurix help with?`,`How do I get started?`,`What's your pricing?`],featuredLinks:[{label:`Accurix founders`,url:`https://accurix.tech/about`},{label:`Pricing`,url:`https://accurix.tech/pricing`}]},n=[{match:/demo chart|monthly orders|orders by status/i,result:{answer:`Orders moved in different directions by status in the latest month. The chart below shows one line for submitted, approved, and fulfilled orders.`,sources:[],suggestedReplies:[`Show a demo KPI`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`chart`,type:`line`,title:`Monthly orders by status`,reportingPeriod:{label:`January–August 2025`,timezone:`Africa/Lagos`},timezone:`Africa/Lagos`,freshness:{status:`live`,answeredAt:`2026-10-09T10:00:00Z`},appliedFilters:[{field:`status`,operator:`in`,value:[`Submitted`,`Approved`,`Fulfilled`]}],columns:[`month`,`status`,`order_count`],rows:[{month:`2025-01-01`,status:`Submitted`,order_count:12},{month:`2025-01-01`,status:`Approved`,order_count:16},{month:`2025-01-01`,status:`Fulfilled`,order_count:14},{month:`2025-02-01`,status:`Submitted`,order_count:14},{month:`2025-02-01`,status:`Approved`,order_count:15},{month:`2025-02-01`,status:`Fulfilled`,order_count:15},{month:`2025-03-01`,status:`Submitted`,order_count:13},{month:`2025-03-01`,status:`Approved`,order_count:17},{month:`2025-03-01`,status:`Fulfilled`,order_count:16},{month:`2025-04-01`,status:`Submitted`,order_count:15},{month:`2025-04-01`,status:`Approved`,order_count:16},{month:`2025-04-01`,status:`Fulfilled`,order_count:17},{month:`2025-05-01`,status:`Submitted`,order_count:16},{month:`2025-05-01`,status:`Approved`,order_count:18},{month:`2025-05-01`,status:`Fulfilled`,order_count:17},{month:`2025-06-01`,status:`Submitted`,order_count:17},{month:`2025-06-01`,status:`Approved`,order_count:17},{month:`2025-06-01`,status:`Fulfilled`,order_count:18},{month:`2025-07-01`,status:`Submitted`,order_count:18},{month:`2025-07-01`,status:`Approved`,order_count:19},{month:`2025-07-01`,status:`Fulfilled`,order_count:18},{month:`2025-08-01`,status:`Submitted`,order_count:19},{month:`2025-08-01`,status:`Approved`,order_count:18},{month:`2025-08-01`,status:`Fulfilled`,order_count:19}],rowCount:24,columnMetadata:[{key:`month`,label:`Order month`,dataType:`date`,semanticRole:`date`},{key:`status`,label:`Status`,dataType:`text`,semanticRole:`dimension`},{key:`order_count`,label:`Distinct order count`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],chartRecommendation:{type:`line`,mode:`time_series`,categoryField:`month`,valueFields:[`order_count`],seriesField:`status`},expandable:!0,tableAvailable:!1,explanation:{headline:`The latest results moved in different directions by status.`,summary:`Submitted and fulfilled orders increased, while approved orders decreased.`,evidence:[`Submitted orders increased from 18 in July to 19 in August.`,`Approved orders decreased from 19 in July to 18 in August.`,`Fulfilled orders increased from 18 in July to 19 in August.`],businessMeaning:`Overall order activity is steady, but the small approval decline is worth watching if it continues.`,followUps:[`Which status changed the most?`,`How does this compare with the prior quarter?`],source:`governed_result`}}}},{match:/demo kpi|active accounts/i,result:{answer:`There are 5,632 active accounts in the current demo result.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`kpi`,type:`kpi`,title:`Active accounts`,columns:[`active_accounts`],value:`active_accounts`,rows:[{active_accounts:5632}],rowCount:1,columnMetadata:[{key:`active_accounts`,label:`Active accounts`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],explanation:{headline:`Active accounts are 5,632.`,summary:`This is the latest value in the demo result.`,evidence:[`The displayed active-account count is 5,632.`],source:`governed_result`}}}},{match:/demo table|account health/i,result:{answer:`Nine accounts are included in this governed result. The table shows a compact preview and can be expanded to inspect every permitted row.`,sources:[],suggestedReplies:[`Show a demo chart`,`Test the hidden table response`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,title:`Account health`,columns:[`account_name`,`region`,`health_score`,`renewal_month`],rows:[{account_name:`Northstar Industries`,region:`West`,health_score:94,renewal_month:`August`},{account_name:`Apex Group`,region:`East`,health_score:91,renewal_month:`September`},{account_name:`Summit Retail`,region:`North`,health_score:88,renewal_month:`August`},{account_name:`Harbor Logistics`,region:`South`,health_score:86,renewal_month:`October`},{account_name:`Brightline Media`,region:`West`,health_score:84,renewal_month:`November`},{account_name:`Redwood Labs`,region:`East`,health_score:82,renewal_month:`September`},{account_name:`Atlas Foods`,region:`North`,health_score:79,renewal_month:`December`},{account_name:`Cedar Health`,region:`South`,health_score:77,renewal_month:`October`},{account_name:`Bluewave Energy`,region:`West`,health_score:74,renewal_month:`December`}],rowCount:9,columnMetadata:[{key:`account_name`,label:`Account`,dataType:`text`,semanticRole:`dimension`},{key:`region`,label:`Region`,dataType:`text`,semanticRole:`geography`},{key:`health_score`,label:`Health score`,dataType:`number`,semanticRole:`measure`},{key:`renewal_month`,label:`Renewal month`,dataType:`text`,semanticRole:`date`}],expandable:!0,tableAvailable:!0,downloadAvailable:!0,explanation:{headline:`Nine accounts are available for review.`,summary:`Health scores range from 74 to 94 across four regions.`,evidence:[`Northstar Industries has the highest health score at 94.`],source:`governed_result`}}}},{match:/hidden table|table response/i,result:{answer:`Three accounts need attention. The public widget explains the result without exposing its underlying rows.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo KPI`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,columns:[`account_name`,`risk_score`],rows:[{account_name:`Private account A`,risk_score:91},{account_name:`Private account B`,risk_score:87},{account_name:`Private account C`,risk_score:82}],rowCount:3,tableAvailable:!1,explanation:{headline:`Three accounts need attention.`,summary:`The written result is available without displaying a public data table.`,evidence:[`Three accounts matched the approved attention rule.`],source:`governed_result`}}}},{match:/^\s*(hi+|hey+|hello|yo|sup|howdy|hola|thanks|thank you|thx|good (morning|afternoon|evening))\b/i,result:{answer:`Hello! 👋 How can I help you today?`,sources:[],suggestedReplies:[`How do I track a shipment?`,`How does customs work?`],handoffOffered:!1}},{match:/track|shipment|where|status/i,result:{answer:`Centrinfo can answer from your indexed knowledge base, public website, connected files, and approved organization tools. It keeps answers grounded in your configured sources and can hand a conversation to your team when the AI is not enough.`,sources:[{title:`Centrinfo public widget`,url:`https://accurix.tech/centrinfo`}],suggestedReplies:[`How does the widget work?`,`Can a human take over?`],handoffOffered:!1}},{match:/custom|clear|duty|tariff|import/i,result:{answer:`Accurix connects your organization knowledge, channels, integrations, and public widget in one place. You can configure which sources the AI can use, which tools visitors can trigger, and when your team should take over live chat.`,sources:[{title:`Accurix documentation`,url:`https://accurix.tech/docs`}],suggestedReplies:[`Which tools can I connect?`,`How do permissions work?`],handoffOffered:!1}},{match:/price|cost|pricing|plan|quote/i,result:{answer:`Accurix uses a usage-based pricing model. Organizations keep an active subscription and spend credits as the AI answers, searches, and uses tools. Credit top-ups can extend usage when the subscription grant runs low.`,sources:[{title:`Pricing`,url:`https://accurix.tech/pricing`}],suggestedReplies:[`How do credits work?`,`Can I top up credits?`],handoffOffered:!1}}],r={answer:`That's a great question — I don't have a confident answer from Accurix's published docs yet. Want me to pass it to the team so a human can follow up? You can also book a quick demo.`,sources:[],suggestedReplies:[`What can you help with?`],handoffOffered:!0},i=e=>n.find(t=>t.match.test(e))?.result??r;var a=class{async history(){return{conversations:[]}}async bootstrap(){return await e(180),t}async stream(n,r,a){await e(550);let o=i(n),s=o.answer.split(/(\s+)/);for(let t of s){if(a.signal?.aborted)break;a.onChunk(t),await e(18+Math.min(40,t.length*6))}return{...o,availableActions:t.availableActions}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async presence(e){}async typing(){await e(20)}async action(t,n){return await e(450),{ok:!0,note:{"book-demo":`Demo requested — we'll email you a few times that work. 📅`,contact:`Got it — saved your details. ✅`,"contact-support":`Support request sent. The team can follow up from this chat. ✅`,inquiry:`Thanks! We'll get back to you shortly. ✉️`,"request-callback":`We'll call you back soon. 📞`,"schedule-callback":`Your callback has been scheduled.`,"subscribe-newsletter":`You're subscribed. 🎉`}[t]}}async speak(){return await e(120),{providerReady:!1,message:`Demo voice provider is not connected.`}}async transcribe(t,n,r,i){return await e(700),`How do I track a shipment?`}async uploadAttachment(e,t,n){return{id:`demo-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async identify(t,n){await e(50)}async endConversation(t){await e(50)}async sendFeedback(){await e(50)}async sendExplanationFeedback(){await e(50)}async demoSlots(t,n){return await e(150),{taken:[[11,0],[15,0]].map(([e,t])=>{let n=new Date;return n.setHours(e,t,0,0),n.toISOString()}),busy:[]}}async searchGifs(t){await e(280);let n=t.trim().toLowerCase(),r=n?l.filter(e=>e.alt.includes(n)||e.tags.some(e=>e.includes(n)||n.includes(e))):l;return(r.length>0?r:l).map(e=>({id:e.id,url:c(e.emoji,e.anim),preview:c(e.emoji,e.anim),alt:e.alt}))}};const o=`<animateTransform attributeName='transform' attributeType='XML' type='translate' values='0 0;0 -16;0 0' dur='0.7s' repeatCount='indefinite'/>`,s=`<animateTransform attributeName='transform' attributeType='XML' type='rotate' values='-14 64 110;14 64 110;-14 64 110' dur='0.9s' repeatCount='indefinite'/>`,c=(e,t)=>{let n=`<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128'><rect width='128' height='128' rx='14' fill='#eef1f4'/><text x='64' y='88' font-size='64' text-anchor='middle'>${e}${t}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(n)}`},l=[{id:`g1`,emoji:`👍`,alt:`thumbs up`,tags:[`thumbs`,`yes`,`ok`,`great`,`good`],anim:o},{id:`g2`,emoji:`🎉`,alt:`celebrate`,tags:[`party`,`yay`,`congrats`,`celebrate`],anim:s},{id:`g3`,emoji:`👋`,alt:`wave hello`,tags:[`hi`,`hello`,`hey`,`wave`,`bye`],anim:s},{id:`g4`,emoji:`❤️`,alt:`heart`,tags:[`love`,`thanks`,`heart`],anim:o},{id:`g5`,emoji:`🤔`,alt:`thinking`,tags:[`hmm`,`think`,`thinking`],anim:s},{id:`g6`,emoji:`😂`,alt:`laughing`,tags:[`lol`,`funny`,`haha`,`laugh`],anim:o},{id:`g7`,emoji:`🔥`,alt:`fire`,tags:[`fire`,`hot`,`lit`,`awesome`],anim:o},{id:`g8`,emoji:`🚀`,alt:`rocket`,tags:[`rocket`,`launch`,`fast`,`go`],anim:s}],u=e=>new Promise(t=>setTimeout(t,e));var d=class{constructor(e,t){this.real=e,this.strings=t}bootstrap(){return this.real.bootstrap()}async history(){return{conversations:[]}}async stream(e,t,n){await u(300);for(let e of this.strings.previewReply.split(/(\s+)/)){if(n.signal?.aborted)break;n.onChunk(e),await u(16)}return{answer:this.strings.previewReply,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async presence(e){}async typing(){}async action(){return await u(250),{ok:!0,note:this.strings.previewActionNote}}async speak(){return{providerReady:!1,message:`Preview voice provider is not connected.`}}async identify(){}async endConversation(){}async sendFeedback(){}async sendExplanationFeedback(){}async transcribe(e,t,n,r){return``}async uploadAttachment(e,t,n){return{id:`preview-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async searchGifs(){return[]}async demoSlots(){return{taken:[],busy:[]}}};exports.MockTransport=a,exports.PreviewTransport=d;
1
+ const e=e=>new Promise(t=>setTimeout(t,e)),t={agentName:`Accurix`,agentAvatarUrl:``,widgetModule:`assistant`,assistantMediaUrl:`https://images.unsplash.com/photo-1494790108377-be9c29b29330`,assistantMediaKind:`image`,assistantPrivacyUrl:`https://accurix.tech/privacy`,soundEnabled:!0,voiceOutputEnabled:!1,talkbackMode:`avatar`,avatarProvider:`demo`,avatarId:`accurix-demo`,greeting:`Hi! I'm Accurix, the AI assistant for Accurix. Ask me anything about products, pricing, or documentation — or book a demo.`,allowVoiceInput:!1,memoryEnabled:!0,memoryRetentionDays:30,memoryMessageCap:50,availableActions:[`public_book_demo`,`public_capture_contact`,`public_submit_inquiry`],agentDescription:`I help with Accurix products, pricing, and documentation.`,welcomeSubtitle:`Ask me anything — most answers are instant.`,disclaimerText:`Accurix is an AI assistant; answers may be imperfect.`,starterQuestions:[`What can Accurix help with?`,`How do I get started?`,`What's your pricing?`],featuredLinks:[{label:`Accurix founders`,url:`https://accurix.tech/about`},{label:`Pricing`,url:`https://accurix.tech/pricing`}]},n=[{match:/demo chart|monthly orders|orders by status/i,result:{answer:`Orders moved in different directions by status in the latest month. The chart below shows one line for submitted, approved, and fulfilled orders.`,sources:[],suggestedReplies:[`Show a demo KPI`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`chart`,type:`line`,title:`Monthly orders by status`,reportingPeriod:{label:`January–August 2025`,timezone:`Africa/Lagos`},timezone:`Africa/Lagos`,freshness:{status:`live`,answeredAt:`2026-10-09T10:00:00Z`},appliedFilters:[{field:`status`,operator:`in`,value:[`Submitted`,`Approved`,`Fulfilled`]}],columns:[`month`,`status`,`order_count`],rows:[{month:`2025-01-01`,status:`Submitted`,order_count:12},{month:`2025-01-01`,status:`Approved`,order_count:16},{month:`2025-01-01`,status:`Fulfilled`,order_count:14},{month:`2025-02-01`,status:`Submitted`,order_count:14},{month:`2025-02-01`,status:`Approved`,order_count:15},{month:`2025-02-01`,status:`Fulfilled`,order_count:15},{month:`2025-03-01`,status:`Submitted`,order_count:13},{month:`2025-03-01`,status:`Approved`,order_count:17},{month:`2025-03-01`,status:`Fulfilled`,order_count:16},{month:`2025-04-01`,status:`Submitted`,order_count:15},{month:`2025-04-01`,status:`Approved`,order_count:16},{month:`2025-04-01`,status:`Fulfilled`,order_count:17},{month:`2025-05-01`,status:`Submitted`,order_count:16},{month:`2025-05-01`,status:`Approved`,order_count:18},{month:`2025-05-01`,status:`Fulfilled`,order_count:17},{month:`2025-06-01`,status:`Submitted`,order_count:17},{month:`2025-06-01`,status:`Approved`,order_count:17},{month:`2025-06-01`,status:`Fulfilled`,order_count:18},{month:`2025-07-01`,status:`Submitted`,order_count:18},{month:`2025-07-01`,status:`Approved`,order_count:19},{month:`2025-07-01`,status:`Fulfilled`,order_count:18},{month:`2025-08-01`,status:`Submitted`,order_count:19},{month:`2025-08-01`,status:`Approved`,order_count:18},{month:`2025-08-01`,status:`Fulfilled`,order_count:19}],rowCount:24,columnMetadata:[{key:`month`,label:`Order month`,dataType:`date`,semanticRole:`date`},{key:`status`,label:`Status`,dataType:`text`,semanticRole:`dimension`},{key:`order_count`,label:`Distinct order count`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],chartRecommendation:{type:`line`,mode:`time_series`,categoryField:`month`,valueFields:[`order_count`],seriesField:`status`},expandable:!0,tableAvailable:!1,explanation:{headline:`The latest results moved in different directions by status.`,summary:`Submitted and fulfilled orders increased, while approved orders decreased.`,evidence:[`Submitted orders increased from 18 in July to 19 in August.`,`Approved orders decreased from 19 in July to 18 in August.`,`Fulfilled orders increased from 18 in July to 19 in August.`],businessMeaning:`Overall order activity is steady, but the small approval decline is worth watching if it continues.`,followUps:[`Which status changed the most?`,`How does this compare with the prior quarter?`],source:`governed_result`}}}},{match:/demo kpi|active accounts/i,result:{answer:`There are 5,632 active accounts in the current demo result.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo table`],handoffOffered:!1,visualization:{version:1,presentation:`kpi`,type:`kpi`,title:`Active accounts`,columns:[`active_accounts`],value:`active_accounts`,rows:[{active_accounts:5632}],rowCount:1,columnMetadata:[{key:`active_accounts`,label:`Active accounts`,dataType:`number`,semanticRole:`measure`,aggregation:`count_distinct`}],explanation:{headline:`Active accounts are 5,632.`,summary:`This is the latest value in the demo result.`,evidence:[`The displayed active-account count is 5,632.`],source:`governed_result`}}}},{match:/demo table|account health/i,result:{answer:`Nine accounts are included in this governed result. The table shows a compact preview and can be expanded to inspect every permitted row.`,sources:[],suggestedReplies:[`Show a demo chart`,`Test the hidden table response`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,title:`Account health`,columns:[`account_name`,`region`,`health_score`,`renewal_month`],rows:[{account_name:`Northstar Industries`,region:`West`,health_score:94,renewal_month:`August`},{account_name:`Apex Group`,region:`East`,health_score:91,renewal_month:`September`},{account_name:`Summit Retail`,region:`North`,health_score:88,renewal_month:`August`},{account_name:`Harbor Logistics`,region:`South`,health_score:86,renewal_month:`October`},{account_name:`Brightline Media`,region:`West`,health_score:84,renewal_month:`November`},{account_name:`Redwood Labs`,region:`East`,health_score:82,renewal_month:`September`},{account_name:`Atlas Foods`,region:`North`,health_score:79,renewal_month:`December`},{account_name:`Cedar Health`,region:`South`,health_score:77,renewal_month:`October`},{account_name:`Bluewave Energy`,region:`West`,health_score:74,renewal_month:`December`}],rowCount:9,columnMetadata:[{key:`account_name`,label:`Account`,dataType:`text`,semanticRole:`dimension`},{key:`region`,label:`Region`,dataType:`text`,semanticRole:`geography`},{key:`health_score`,label:`Health score`,dataType:`number`,semanticRole:`measure`},{key:`renewal_month`,label:`Renewal month`,dataType:`text`,semanticRole:`date`}],expandable:!0,tableAvailable:!0,downloadAvailable:!0,explanation:{headline:`Nine accounts are available for review.`,summary:`Health scores range from 74 to 94 across four regions.`,evidence:[`Northstar Industries has the highest health score at 94.`],source:`governed_result`}}}},{match:/hidden table|table response/i,result:{answer:`Three accounts need attention. The public widget explains the result without exposing its underlying rows.`,sources:[],suggestedReplies:[`Show a demo chart`,`Show a demo KPI`],handoffOffered:!1,visualization:{version:1,presentation:`table`,type:`table`,columns:[`account_name`,`risk_score`],rows:[{account_name:`Private account A`,risk_score:91},{account_name:`Private account B`,risk_score:87},{account_name:`Private account C`,risk_score:82}],rowCount:3,tableAvailable:!1,explanation:{headline:`Three accounts need attention.`,summary:`The written result is available without displaying a public data table.`,evidence:[`Three accounts matched the approved attention rule.`],source:`governed_result`}}}},{match:/^\s*(hi+|hey+|hello|yo|sup|howdy|hola|thanks|thank you|thx|good (morning|afternoon|evening))\b/i,result:{answer:`Hello! 👋 How can I help you today?`,sources:[],suggestedReplies:[`How do I track a shipment?`,`How does customs work?`],handoffOffered:!1}},{match:/track|shipment|where|status/i,result:{answer:`Centrinfo can answer from your indexed knowledge base, public website, connected files, and approved organization tools. It keeps answers grounded in your configured sources and can hand a conversation to your team when the AI is not enough.`,sources:[{title:`Centrinfo public widget`,url:`https://accurix.tech/centrinfo`}],suggestedReplies:[`How does the widget work?`,`Can a human take over?`],handoffOffered:!1}},{match:/custom|clear|duty|tariff|import/i,result:{answer:`Accurix connects your organization knowledge, channels, integrations, and public widget in one place. You can configure which sources the AI can use, which tools visitors can trigger, and when your team should take over live chat.`,sources:[{title:`Accurix documentation`,url:`https://accurix.tech/docs`}],suggestedReplies:[`Which tools can I connect?`,`How do permissions work?`],handoffOffered:!1}},{match:/price|cost|pricing|plan|quote/i,result:{answer:`Accurix uses a usage-based pricing model. Organizations keep an active subscription and spend credits as the AI answers, searches, and uses tools. Credit top-ups can extend usage when the subscription grant runs low.`,sources:[{title:`Pricing`,url:`https://accurix.tech/pricing`}],suggestedReplies:[`How do credits work?`,`Can I top up credits?`],handoffOffered:!1}}],r={answer:`That's a great question — I don't have a confident answer from Accurix's published docs yet. Want me to pass it to the team so a human can follow up? You can also book a quick demo.`,sources:[],suggestedReplies:[`What can you help with?`],handoffOffered:!0},i=e=>n.find(t=>t.match.test(e))?.result??r;var a=class{async history(){return{conversations:[]}}async bootstrap(){return await e(180),t}async stream(n,r,a){await e(550);let o=i(n),s=o.answer.split(/(\s+)/);for(let t of s){if(a.signal?.aborted)break;a.onChunk(t),await e(18+Math.min(40,t.length*6))}return{...o,availableActions:t.availableActions}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async presence(e){}async typing(){await e(20)}async action(t,n){return await e(450),{ok:!0,note:{"book-demo":`Demo requested. The team will follow up. 📅`,contact:`Got it — saved your details. ✅`,"contact-support":`Support request sent. The team can follow up from this chat. ✅`,inquiry:`Thanks! We'll get back to you shortly. ✉️`,"request-callback":`We'll call you back soon. 📞`,"schedule-callback":`Your callback has been scheduled.`,"subscribe-newsletter":`You're subscribed. 🎉`}[t]}}async speak(){return await e(120),{providerReady:!1,message:`Demo voice provider is not connected.`}}async transcribe(t,n,r,i){return await e(700),`How do I track a shipment?`}async uploadAttachment(e,t,n){return{id:`demo-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async identify(t,n){await e(50)}async endConversation(t){await e(50)}async sendFeedback(){await e(50)}async sendExplanationFeedback(){await e(50)}async demoSlots(t,n){return await e(150),{taken:[[11,0],[15,0]].map(([e,t])=>{let n=new Date;return n.setHours(e,t,0,0),n.toISOString()}),busy:[]}}async searchGifs(t){await e(280);let n=t.trim().toLowerCase(),r=n?l.filter(e=>e.alt.includes(n)||e.tags.some(e=>e.includes(n)||n.includes(e))):l;return(r.length>0?r:l).map(e=>({id:e.id,url:c(e.emoji,e.anim),preview:c(e.emoji,e.anim),alt:e.alt}))}};const o=`<animateTransform attributeName='transform' attributeType='XML' type='translate' values='0 0;0 -16;0 0' dur='0.7s' repeatCount='indefinite'/>`,s=`<animateTransform attributeName='transform' attributeType='XML' type='rotate' values='-14 64 110;14 64 110;-14 64 110' dur='0.9s' repeatCount='indefinite'/>`,c=(e,t)=>{let n=`<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128'><rect width='128' height='128' rx='14' fill='#eef1f4'/><text x='64' y='88' font-size='64' text-anchor='middle'>${e}${t}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(n)}`},l=[{id:`g1`,emoji:`👍`,alt:`thumbs up`,tags:[`thumbs`,`yes`,`ok`,`great`,`good`],anim:o},{id:`g2`,emoji:`🎉`,alt:`celebrate`,tags:[`party`,`yay`,`congrats`,`celebrate`],anim:s},{id:`g3`,emoji:`👋`,alt:`wave hello`,tags:[`hi`,`hello`,`hey`,`wave`,`bye`],anim:s},{id:`g4`,emoji:`❤️`,alt:`heart`,tags:[`love`,`thanks`,`heart`],anim:o},{id:`g5`,emoji:`🤔`,alt:`thinking`,tags:[`hmm`,`think`,`thinking`],anim:s},{id:`g6`,emoji:`😂`,alt:`laughing`,tags:[`lol`,`funny`,`haha`,`laugh`],anim:o},{id:`g7`,emoji:`🔥`,alt:`fire`,tags:[`fire`,`hot`,`lit`,`awesome`],anim:o},{id:`g8`,emoji:`🚀`,alt:`rocket`,tags:[`rocket`,`launch`,`fast`,`go`],anim:s}],u=e=>new Promise(t=>setTimeout(t,e));var d=class{constructor(e,t){this.real=e,this.strings=t}bootstrap(){return this.real.bootstrap()}async history(){return{conversations:[]}}async stream(e,t,n){await u(300);for(let e of this.strings.previewReply.split(/(\s+)/)){if(n.signal?.aborted)break;n.onChunk(e),await u(16)}return{answer:this.strings.previewReply,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1}}async liveEvents(){return{mode:`ai`,conversationEnded:!1,events:[]}}async presence(e){}async typing(){}async action(){return await u(250),{ok:!0,note:this.strings.previewActionNote}}async speak(){return{providerReady:!1,message:`Preview voice provider is not connected.`}}async identify(){}async endConversation(){}async sendFeedback(){}async sendExplanationFeedback(){}async transcribe(e,t,n,r){return``}async uploadAttachment(e,t,n){return{id:`preview-${Date.now()}`,text:`Attached file: ${n}`,analysisFailed:!1}}async searchGifs(){return[]}async demoSlots(){return{taken:[],busy:[]}}};exports.MockTransport=a,exports.PreviewTransport=d;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./styles-BH7P8Q_3.cjs`);let t=require(`preact`),n=require(`preact/hooks`),r=require(`preact/jsx-runtime`);const i=(e,t)=>{if(typeof MutationObserver>`u`)return()=>void 0;let n=e.scrollHeight,r=0,i=()=>{r=0;let i=e.scrollHeight,a=i>n,o=t.isAtBottom();n=i,a&&(o?(e.scrollTop=e.scrollHeight,t.onFollow?.()):t.onUnseen?.())},a=new MutationObserver(()=>{r||(r=typeof requestAnimationFrame==`function`?requestAnimationFrame(i):setTimeout(i,0))});return a.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{a.disconnect(),r&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r)}},a=e=>e.startsWith(`image/`)?`image`:e===`application/pdf`?`pdf`:`other`,o=({state:t,onClose:i})=>{let o=e.V(),s=(0,n.useRef)(null);(0,n.useEffect)(()=>{s.current?.focus();let e=e=>{e.key===`Escape`&&(e.stopPropagation(),i())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[i]);let c=t.status===`ready`?a(t.mimeType):`other`;return(0,r.jsx)(`div`,{class:`cf-preview`,role:`dialog`,"aria-modal":`true`,"aria-label":e.B(o.attachPreviewTitle,{name:t.name}),onClick:e=>{e.target===e.currentTarget&&i()},children:(0,r.jsxs)(`div`,{class:`cf-preview__frame`,children:[(0,r.jsxs)(`div`,{class:`cf-preview__bar`,children:[(0,r.jsx)(`span`,{class:`cf-preview__name`,title:t.name,children:t.name}),t.status===`ready`&&(0,r.jsx)(`a`,{class:`cf-preview__btn`,href:t.url,download:t.name,children:o.attachDownload}),(0,r.jsx)(`button`,{ref:s,type:`button`,class:`cf-preview__btn cf-preview__close`,"aria-label":o.attachPreviewClose,onClick:i,children:`✕`})]}),(0,r.jsxs)(`div`,{class:`cf-preview__body`,children:[t.status===`loading`&&(0,r.jsx)(`p`,{class:`cf-preview__note`,children:o.attachPreviewLoading}),t.status===`error`&&(0,r.jsx)(`p`,{class:`cf-preview__note`,children:o.attachPreviewFailed}),t.status===`ready`&&c===`image`&&(0,r.jsx)(`img`,{class:`cf-preview__image`,src:t.url,alt:t.name}),t.status===`ready`&&c===`pdf`&&(0,r.jsx)(`iframe`,{class:`cf-preview__pdf`,src:t.url,title:t.name}),t.status===`ready`&&c===`other`&&(0,r.jsx)(`p`,{class:`cf-preview__note`,children:o.attachPreviewUnsupported})]})]})})},s=({name:t,greeting:n})=>{let i=e.V();return(0,r.jsxs)(`section`,{class:`cf-empty-welcome`,"aria-label":e.B(i.welcomeLabel,{name:t}),children:[(0,r.jsx)(`span`,{class:`cf-empty-welcome__eyebrow`,children:i.welcomeEyebrow}),(0,r.jsx)(`h2`,{children:t}),(0,r.jsx)(`p`,{children:n||i.welcomePrompt})]})},c=(e,t,n)=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n();return}if(e.key!==`Tab`)return;let r=Array.from(t.querySelectorAll(`button, [href], textarea, input, select, [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`&&e.tabIndex>=0);if(r.length===0)return;let i=t.getRootNode(),a=e.composedPath()[0],o=a instanceof HTMLElement?a:`activeElement`in i?i.activeElement:document.activeElement,s=r[0],c=r[r.length-1];e.shiftKey&&(o===s||!t.contains(o))?(e.preventDefault(),e.stopPropagation(),c.focus()):!e.shiftKey&&(o===c||!t.contains(o))&&(e.preventDefault(),e.stopPropagation(),s.focus())},l=new Map,ee=e=>{if(!e||typeof document>`u`||typeof CanvasRenderingContext2D>`u`)return;let t=document.createElement(`canvas`).getContext(`2d`);if(!t)return;t.fillStyle=`#010203`,t.fillStyle=e;let n=t.fillStyle;if(n===`#010203`&&e.trim().toLowerCase()!==`#010203`)return;let r=n.match(/^#([\da-f]{6})$/i)?.[1];if(r)return[Number.parseInt(r.slice(0,2),16),Number.parseInt(r.slice(2,4),16),Number.parseInt(r.slice(4,6),16),1];let i=n.match(/^rgba?\(([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:[, /]+([\d.]+))?\)$/i);if(!i)return;let a=i.slice(1,5).map(Number);if(!a.some(e=>!Number.isFinite(e)))return[a[0],a[1],a[2],a[3]??1]},te=(e,t=`#ffffff`)=>{let n=`${e??``}|${t}`;if(l.has(n))return l.get(n);let r=ee(e),i=ee(t)??[255,255,255,1];if(!r){l.set(n,void 0);return}let a=r[3],o=r.slice(0,3).map((e,t)=>e*a+i[t]*(1-a)).map(e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}),s=o[0]*.2126+o[1]*.7152+o[2]*.0722,c=1.05/(s+.05)>=(s+.05)/.059?`#ffffff`:`#0f1e2a`;return l.set(n,c),c},ne=e=>{let[t,r]=(0,n.useState)(`light`);return(0,n.useEffect)(()=>{if(e!==`auto`||typeof matchMedia>`u`)return;let t=matchMedia(`(prefers-color-scheme: dark)`),n=()=>r(t.matches?`dark`:`light`);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),e===`auto`?t:e},u=6e4,d=90,re={end:`end the call`,mute:`mute your microphone`,minimize:`minimize the chat`,expand:`expand the view`,shrink:`exit the expanded view`},ie=e=>e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s']/gu,` `).replace(/\s+/g,` `).trim(),ae=[{action:`shrink`,re:/\b(?:exit|leave|quit|close)\b[\s\w]*\b(?:full ?screen|expanded|theat(?:er|re))\b|\bshrink\b|\bsmaller view\b/},{action:`end`,re:/\b(?:end|close|stop|finish|hang ?up|quit|exit)\b[\s\w]*\b(?:call|chat|conversation|convo|session|talking)\b|\bhang ?up\b|\bgood ?bye\b|^bye(?: bye)?$/},{action:`mute`,re:/\bmute\b|\bstop listening\b/},{action:`minimize`,re:/\bminimi[sz]e\b|\bhide\b[\s\w]*\b(?:chat|call|window|widget)\b/},{action:`expand`,re:/\bexpand\b|\bmaximi[sz]e\b|\bfull ?screen\b|\btheat(?:er|re) mode\b|\bbigger view\b/}],oe=/^(?:yes|yeah|yep|yup|sure|correct|confirm|affirmative|go ahead|do it|please do|ok(?:ay)?)\b/,se=/^(?:no|nope|nah|cancel|never ?mind|don'?t|stop)\b/,ce=/^(?:end|close|stop|finish|hang ?up|quit|exit|bye|good ?bye)\b/,le=e=>{let t=ie(e);if(!t)return null;for(let{action:e,re:n}of ae)if(n.test(t)){let n=t.split(` `).length;return{action:e,confident:e===`end`?n<=10:n<=6}}return null},ue=e=>`I didn't catch yes or no. Say yes to ${re[e]}, or no to keep talking.`,f=({transport:t,config:a,bindControls:l,composerDraftStore:ee})=>{let u=a.strings,[d,ae]=(0,n.useState)(a.openByDefault),{persona:f,messages:p,sending:m,assistantSpeaking:h,visitor:de,hasEmail:fe,liveMode:g,assignedAgentName:pe,agentTypingName:me,starters:he,featuredLinks:ge,send:_,sendGif:_e,notifyTyping:ve,stop:ye,amend:be,hold:xe,resumeHeld:Se,duckSpeaking:Ce,retry:we,rateMessage:Te,rateExplanation:Ee,explanationTransport:De,injectAssistant:Oe,reconnectSupport:ke,appendUserDraft:Ae,patchMessage:v,removeMessage:je,submitCsat:Me,submitForm:Ne,confirmHostedBooking:Pe,transcribe:Fe,uploadAttachment:Ie,loadAttachment:Le,searchGifs:Re,demoSlots:ze,gifEnabled:Be,identify:Ve,ended:y,endConversation:He,startNew:Ue,history:We,viewingSessionId:Ge,viewMessages:Ke,openConversation:qe,closeHistoryView:Je,shutdown:Ye,stopSpeaking:b,speakAssistantText:Xe}=e.a(t,a,d),Ze=e.i(p,g),[Qe,$e]=(0,n.useState)(null),et=(0,n.useRef)(0),tt=(0,n.useCallback)((e,t,n)=>{n===et.current&&$e({status:`ready`,name:t,url:URL.createObjectURL(e),mimeType:e.type||`application/octet-stream`})},[]),nt=(0,n.useCallback)((e,t,n)=>{let r=t.name,i=++et.current;$e({status:`loading`,name:r}),Le(e,t,n).then(e=>tt(e,r,i),()=>{i===et.current&&$e({status:`error`,name:r})})},[Le,tt]),rt=(0,n.useCallback)((e,t)=>tt(e,t,++et.current),[tt]),it=(0,n.useCallback)(()=>{et.current+=1,$e(null)},[]);(0,n.useEffect)(()=>()=>{Qe?.status===`ready`&&URL.revokeObjectURL(Qe.url)},[Qe]);let at=!!e.r(f?.actions),[x,ot]=(0,n.useState)(0),[S,st]=(0,n.useState)({mic:`off`,processing:!1}),[ct,lt]=(0,n.useState)(null),[ut,dt]=(0,n.useState)(!1),[C,ft]=(0,n.useState)(!1),[pt,mt]=(0,n.useState)(!1),[ht,gt]=(0,n.useState)(!1),[_t,vt]=(0,n.useState)(0),[w,T]=(0,n.useState)(!1),[yt,E]=(0,n.useState)(null),[bt,xt]=(0,n.useState)(null),[St,Ct]=(0,n.useState)([]),[wt,Tt]=(0,n.useState)(``),[Et,Dt]=(0,n.useState)(()=>{try{return localStorage.getItem(`centrinfo:muted`)===`1`}catch{return!1}}),Ot=ne(a.theme),kt=f?.soundEnabled??!0;(0,n.useEffect)(()=>{e.d(a.sound&&kt&&!Et)},[a.sound,kt,Et]);let At=(0,n.useCallback)(()=>{Dt(e=>{let t=!e;try{localStorage.setItem(`centrinfo:muted`,t?`1`:`0`)}catch{}return t})},[]),D=(0,n.useRef)(null),jt=(0,n.useRef)(null),Mt=(0,n.useRef)(null),Nt=(0,n.useRef)(0),O=(0,n.useRef)(!1),k=(0,n.useRef)(!1),A=(0,n.useRef)(null),j=(0,n.useRef)(0),Pt=(0,n.useRef)(void 0),Ft=(0,n.useRef)(0),It=(0,n.useRef)(null),M=(0,n.useRef)(!1),N=(0,n.useRef)(null),P=(0,n.useRef)(``),Lt=(0,n.useRef)(()=>{}),Rt=(0,n.useRef)(``),zt=(0,n.useRef)(m),Bt=(0,n.useRef)(_);Bt.current=_;let Vt=(0,n.useRef)(be);Vt.current=be;let Ht=(0,n.useRef)(Fe);Ht.current=Fe;let F=(0,n.useRef)(!1),I=(0,n.useRef)(!1),Ut=(0,n.useRef)(``);Ut.current=[...p].reverse().find(e=>e.role===`assistant`)?.content??``;let Wt=(0,n.useRef)(h);zt.current=m,Wt.current=h;let L=C?ut?`timeout`:ht||S.mic===`muted`?`muted`:S.mic===`unavailable`?S.reason===`permission-denied`||S.reason===`unsupported`?`denied`:`unavailable`:S.mic===`off`||S.mic===`starting`?`connecting`:S.mic===`hearing`?`hearing`:h?`speaking`:ct??(S.processing||m?`processing`:`listening`):`idle`,[Gt,Kt]=(0,n.useState)(!0),[qt,R]=(0,n.useState)(!1),Jt=(0,n.useRef)(0),[z,B]=(0,n.useState)(!1),[V,H]=(0,n.useState)(!1),Yt=(0,n.useRef)(null),[U,W]=(0,n.useState)(!1),Xt=(0,n.useRef)({value:``}),Zt=ee??Xt.current,Qt=(0,n.useRef)({confirmEnd:z,confirmClear:V,showHistory:U});Qt.current={confirmEnd:z,confirmClear:V,showHistory:U};let[$t,en]=(0,n.useState)(!1),G=!!Ge,tn=G?Ke:p,nn=tn.find(e=>e.id===yt&&e.visualization)?.visualization,rn=tn.find(e=>e.id===bt&&e.visualization);(0,n.useEffect)(()=>{!bt||rn||(xt(null),T(!1))},[bt,rn]),(0,n.useEffect)(()=>{!yt||nn||(E(null),T(!1))},[nn,yt]);let K=(0,n.useCallback)(()=>{ae(!0),ot(0),e.u(`open`),a.onOpen?.(),a.onShow?.()},[a]),q=(0,n.useCallback)(()=>{ae(!1),T(!1),E(null),a.onClose?.(),a.onHide?.(),jt.current?.focus()},[a]),an=(0,n.useCallback)(()=>d?q():K(),[d,K,q]),on=(0,n.useCallback)(()=>B(!0),[]),sn=(0,n.useCallback)(()=>{He(),B(!1)},[He]),cn=(0,n.useCallback)(()=>{Ue(),R(!1),Kt(!0)},[Ue]);(0,n.useEffect)(()=>{z&&Yt.current?.focus()},[z]),(0,n.useEffect)(()=>{l({open:K,close:q,toggle:an,identify:Ve,startNew:Ue,endConversation:He,shutdown:Ye})},[l,K,q,an,Ve,Ue,He,Ye]),(0,n.useEffect)(()=>{let e=p.filter(e=>e.role===`assistant`&&!e.pending).length;if(d){Nt.current=e;return}e>Nt.current&&ot(e-Nt.current)},[p,d]),(0,n.useEffect)(()=>{a.onUnreadChange?.(x)},[x,a]),(0,n.useEffect)(()=>{let e=a.sessionDurationMinutes;if(!e||e<=0)return;let t=setTimeout(()=>Ye(),e*60*1e3);return()=>clearTimeout(t)},[a.sessionDurationMinutes,p,d,Ye]),(0,n.useEffect)(()=>{let e=a.customLauncherSelector;if(!e||typeof document>`u`)return;let t=[];try{t=Array.from(document.querySelectorAll(e))}catch{return}let n=e=>{e.preventDefault(),an()};return t.forEach(e=>e.addEventListener(`click`,n)),()=>t.forEach(e=>e.removeEventListener(`click`,n))},[a.customLauncherSelector,an]);let ln=(0,n.useRef)(!1);(0,n.useEffect)(()=>{let e=a.proactiveMessage?.trim();if(!e||ln.current)return;let t=a.proactiveOnPaths??[],n=typeof location<`u`?location.pathname:``;if(t.length>0&&!t.some(e=>n.includes(e)))return;let r=`centrinfo:proactive:${a.token.slice(0,12)}`;try{if(sessionStorage.getItem(r)===`1`)return}catch{}let i=setTimeout(()=>{if(!(d||y||p.some(e=>e.role===`user`))){ln.current=!0;try{sessionStorage.setItem(r,`1`)}catch{}Oe(e),K()}},Math.max(0,a.proactiveDelaySeconds)*1e3);return()=>clearTimeout(i)},[a.proactiveMessage]),(0,n.useEffect)(()=>{let e=Mt.current;if(!d||!e)return;let t=p[p.length-1],n=Date.now()<Jt.current;t?.role===`user`||Gt||n?(requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight}),R(!1),n&&Kt(!0)):R(!0)},[p,d,m,Gt]);let un=(0,n.useRef)(!0);un.current=Gt,(0,n.useEffect)(()=>{let e=Mt.current;if(!(!d||!e))return i(e,{isAtBottom:()=>un.current,onUnseen:()=>R(!0)})},[d,G]);let dn=(0,n.useCallback)(()=>{let e=Mt.current;if(!e)return;if(O.current&&!G){Kt(!0),R(!1);return}let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;Kt(t),t&&R(!1)},[G]),J=(0,n.useCallback)(()=>{let e=Mt.current;e&&(e.scrollTop=e.scrollHeight),R(!1),Kt(!0)},[]),fn=(0,n.useCallback)(()=>{Jt.current=Date.now()+3e3,requestAnimationFrame(J)},[J]);(0,n.useEffect)(()=>{if(!d||G||!C||L===`connecting`)return;Jt.current=Date.now()+6e4,J();let e=requestAnimationFrame(()=>{J(),requestAnimationFrame(J)}),t=[80,180,360].map(e=>window.setTimeout(J,e));return()=>{cancelAnimationFrame(e),t.forEach(e=>window.clearTimeout(e))}},[h,p,d,J,m,C,G,L]);let pn=(0,n.useCallback)(()=>{D.current?.querySelector(`.cf-textarea`)?.focus()},[]),Y=(0,n.useCallback)((e,t)=>{lt(e),Pt.current&&window.clearTimeout(Pt.current),Pt.current=window.setTimeout(()=>lt(null),3e3),t&&!k.current&&Xe(t)},[Xe]),mn=(0,n.useCallback)(e=>{let t=N.current;if(t)return t;fn();let n=Ae(e);return N.current=n,v(n,{content:P.current||e,pending:!0,streaming:!1}),n},[Ae,fn,v]),X=(0,n.useCallback)(()=>{let e=N.current;if(e){if(P.current){v(e,{content:P.current,pending:!0});return}N.current=null,je(e)}},[v,je]),Z=(0,n.useCallback)(()=>{I.current&&(I.current=!1,Ce(!1)),F.current&&(F.current=!1,Se())},[Ce,Se]),Q=(0,n.useCallback)(()=>{O.current=!1,A.current?.stop(`call-ended`),A.current=null,F.current=!1,I.current=!1,k.current=!1,It.current=null,M.current=!1;let e=N.current;N.current=null,P.current=``,e&&je(e),Pt.current&&window.clearTimeout(Pt.current),lt(null),dt(!1),st({mic:`off`,processing:!1}),vt(0),ft(!1),mt(!1),gt(!1),T(!1),E(null),b()},[je,b]),hn=(0,n.useCallback)(()=>{w&&E(null),T(!w)},[w]),gn=(0,n.useCallback)(e=>{E(e),T(!0)},[]),_n=(0,n.useCallback)(e=>{xt(e),T(!0)},[]),vn=(0,n.useCallback)(()=>{let e=yt,t=bt;E(null),xt(null),T(!1),window.requestAnimationFrame(()=>{(t?D.current?.querySelector(`[data-explanation-message="${t}"]`)?.querySelector(`[data-testid="analytics-explanation-expand"]`):Array.from(D.current?.querySelectorAll(`[data-visualization-message]`)??[]).find(t=>t.dataset.visualizationMessage===e))?.focus()})},[yt,bt]),yn=(0,n.useCallback)(()=>{E(null),xt(null),T(!1)},[]),bn=(0,n.useCallback)((e,t,n=!1)=>{if(fn(),t&&(v(t,{content:e,pending:!1,streaming:!1}),N.current===t&&(N.current=null)),P.current=``,n){b(),Vt.current(e,{forceVoicePlayback:!0,userMessageId:t});return}O.current&&(xe()?Vt.current(e,{forceVoicePlayback:!0,userMessageId:t}):Bt.current(e,{forceVoicePlayback:!0,userMessageId:t}))},[fn,xe,v,b]),$=(0,n.useCallback)(e=>{Oe(e),Xe(e)},[Oe,Xe]),xn=(0,n.useCallback)(()=>{if(j.current=Date.now(),lt(null),Wt.current){I.current=!0,Ce(!0);return}F.current||(F.current=xe()),mn(`Listening...`)},[Ce,mn,xe]),Sn=(0,n.useCallback)(e=>{let t=N.current;!t||I.current||v(t,{content:`${[P.current,e].filter(Boolean).join(` `)} ...`,pending:!0})},[v]),Cn=(0,n.useCallback)(t=>{j.current=Date.now();let n=[P.current,t.text].map(e=>e.trim()).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();if((I.current||t.overlappedOutput)&&e.U(t.text,Ut.current)){X(),Z();return}if(!n||e.p(n)||e.m(n)){let e=I.current||F.current;X(),Z(),e||Y(`misunderstood`);return}I.current&&(I.current=!1,ye(),b());let r=It.current;if(r){P.current=``,X();let e=ie(n);if(oe.test(e)||r===`end`&&ce.test(e)){It.current=null,Lt.current(r);return}if(se.test(e)){It.current=null,$(`Okay, never mind — what would you like to know?`);return}$(ue(r));return}let i=le(n);if(i){if(P.current=``,X(),Z(),i.confident){Lt.current(i.action);return}It.current=i.action,$(`Just to confirm — you want me to ${re[i.action]}? Please say yes or no.`);return}let a=mn(n);v(a,{content:n,pending:!0});let o=F.current;F.current=!1,bn(n,a,o)},[mn,v,Z,bn,X,Y,$,ye,b]),wn=(0,n.useCallback)(e=>{j.current=Date.now();let t=I.current||F.current;if(X(),Z(),!(t||e.overlappedOutput||e.reason===`too-short`)){if(e.reason===`transcribe-failed`){Y(`misunderstood`,`I couldn't transcribe that. Please try again, or type your question.`);return}Y(`noise`)}},[Z,X,Y]),Tn=(0,n.useRef)({speechStart:xn,partial:Sn,turn:Cn,noise:wn});Tn.current={speechStart:xn,partial:Sn,turn:Cn,noise:wn};let En=(0,n.useCallback)(()=>{navigator.mediaDevices?.enumerateDevices().then(e=>{Ct(e.filter(e=>e.kind===`audioinput`).map((e,t)=>({deviceId:e.deviceId,label:e.label||`Microphone ${t+1}`})))}).catch(()=>{})},[]),Dn=(0,n.useCallback)(()=>{if(O.current){Q();return}if(pn(),!f?.allowVoiceInput||!f.talkbackMode||f.talkbackMode===`text`||zt.current||y||G)return;j.current=Date.now(),k.current=!1,O.current=!0,gt(!1),ft(!0),mt(!1),dt(!1);let t=!1,n=new e.H({deviceId:Rt.current||void 0,transcribe:async({audio:t,mimeType:n,durationSeconds:r})=>{let i=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||void 0;return e.h(await Ht.current(t,n,i,r))},listener:{state:e=>{st(e),e.mic!==`starting`&&e.mic!==`off`&&mt(!0),!t&&e.mic===`listening`&&(t=!0,En())},speechStart:()=>Tn.current.speechStart(),partial:({text:e})=>Tn.current.partial(e),turn:e=>Tn.current.turn(e),noise:e=>Tn.current.noise(e),level:e=>{let t=performance.now();t-Ft.current<90||(Ft.current=t,vt(e))}}});A.current=n,n.setOutputActive(Wt.current),n.start()},[Q,y,pn,f,En,G]),On=(0,n.useCallback)(()=>{let e=!k.current;k.current=e,gt(e),A.current?.setMuted(e),e?(P.current=``,X(),Z()):j.current=Date.now()},[Z,X]),kn=(0,n.useCallback)(e=>{switch(j.current=Date.now(),e){case`end`:M.current=!0,$(`Okay — ending our call now. Goodbye!`),window.setTimeout(()=>{M.current&&(M.current=!1,Q())},2e3);break;case`mute`:k.current||On(),$(`Muted. Tap the mic button when you want me to listen again.`);break;case`minimize`:q(),$(`Minimized — I'm still listening. Tap the call pill to bring the chat back.`);break;case`expand`:T(!0),$(`Sure — expanding the view.`);break;case`shrink`:E(null),T(!1),$(`Okay — back to the smaller view.`);break}},[q,Q,$,On]);(0,n.useEffect)(()=>{Lt.current=kn},[kn]);let An=(0,n.useRef)(!1);(0,n.useEffect)(()=>{An.current&&!h&&M.current&&(M.current=!1,Q()),An.current=h},[h,Q]);let jn=(0,n.useCallback)(e=>{Rt.current=e,Tt(e),A.current?.selectDevice(e||void 0)},[]),Mn=(0,n.useCallback)(()=>{!O.current||k.current||(I.current=!1,F.current=!1,ye(),b(),j.current=Date.now())},[ye,b]);(0,n.useEffect)(()=>{A.current?.setOutputActive(h),j.current=Date.now()},[h]),(0,n.useEffect)(()=>{if(L!==`denied`)return;let e=window.setTimeout(()=>Q(),3500);return()=>window.clearTimeout(e)},[Q,L]),(0,n.useEffect)(()=>{if(!C)return;let e=window.setInterval(()=>{let e=A.current;!e||k.current||zt.current||Wt.current||e.snapshot.mic===`hearing`||e.snapshot.processing||Date.now()-j.current<6e4||(A.current?.log.add(`call-timeout`),dt(!0),window.setTimeout(()=>Q(),2400))},5e3);return()=>window.clearInterval(e)},[Q,C]);let Nn=C&&!ht&&(m||h);(0,n.useEffect)(()=>()=>Q(),[Q]);let[Pn,Fn]=(0,n.useState)(``),In=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(In.current&&!m){let e=[...p].reverse().find(e=>e.role===`assistant`&&!e.streaming&&!e.pending&&e.content);e&&Fn(e.content)}In.current=m},[m,p]),(0,n.useLayoutEffect)(()=>{if(!d)return;let e=D.current,t=z||V?e?.querySelector(`.cf-confirm__card`):U?e?.querySelector(`.cf-history`):null;if(!t)return;let n=t.getRootNode(),r=`activeElement`in n?n.activeElement:document.activeElement;(!r||!t.contains(r))&&t.querySelector(`button, [href], textarea, input, [tabindex]:not([tabindex="-1"])`)?.focus()},[V,z,d,U]),(0,n.useEffect)(()=>{if(!d)return;let e=D.current,t=z||V?e?.querySelector(`.cf-confirm__card`):U?e?.querySelector(`.cf-history`):null,n=e?.querySelectorAll(`:scope > .cf-header, :scope > .cf-panel__video, :scope > .cf-panel__chat`);n?.forEach(e=>{t?(e.setAttribute(`inert`,``),e.setAttribute(`aria-hidden`,`true`)):(e.removeAttribute(`inert`),e.removeAttribute(`aria-hidden`))}),t||requestAnimationFrame(()=>e?.querySelector(`.cf-textarea`)?.focus());let r=e=>{if(e.key===`Escape`){e.preventDefault();let t=Qt.current;if(t.confirmEnd){B(!1);return}if(t.confirmClear){H(!1);return}if(t.showHistory){W(!1);return}q();return}if(e.key!==`Tab`||!t)return;let n=t.querySelectorAll(`button, [href], textarea, input, [tabindex]:not([tabindex="-1"])`),r=Array.from(n).filter(e=>!e.hasAttribute(`disabled`));if(r.length===0)return;let i=r[0],a=r[r.length-1],o=t.getRootNode()instanceof ShadowRoot?t.getRootNode().activeElement:document.activeElement;e.shiftKey&&o===i?(e.preventDefault(),a.focus()):!e.shiftKey&&o===a&&(e.preventDefault(),i.focus())};return e?.addEventListener(`keydown`,r),()=>{e?.removeEventListener(`keydown`,r),n?.forEach(e=>{e.removeAttribute(`inert`),e.removeAttribute(`aria-hidden`)})}},[d,q,z,V,U]),(0,n.useEffect)(()=>{let e=D.current;e&&(d?e.removeAttribute(`inert`):e.setAttribute(`inert`,``))},[d]);let Ln=a.accentColor??a.themeTokens?.accent??f?.accentColor,Rn=a.themeTokens?.accentText??te(Ln,a.themeTokens?.background??(Ot===`dark`?`#0f1c27`:`#ffffff`)),zn={zIndex:a.zIndex,"--cf-h-pad":`${a.horizontalPadding}px`,"--cf-v-pad":`${a.verticalPadding}px`,...Rn?{"--cf-accent-ink":Rn}:{},...a.themeTokens?.accentStrong?{"--cf-accent-2":a.themeTokens.accentStrong}:{},...a.themeTokens?.background?{"--cf-bg":a.themeTokens.background}:{},...a.themeTokens?.surface?{"--cf-surface":a.themeTokens.surface}:{},...a.themeTokens?.surfaceMuted?{"--cf-surface-2":a.themeTokens.surfaceMuted}:{},...a.themeTokens?.text?{"--cf-text":a.themeTokens.text}:{},...a.themeTokens?.mutedText?{"--cf-muted":a.themeTokens.mutedText}:{},...a.themeTokens?.border?{"--cf-border":a.themeTokens.border}:{},...a.themeTokens?.shadow?{"--cf-shadow":a.themeTokens.shadow}:{},...a.themeTokens?.radius?{"--cf-radius":a.themeTokens.radius}:{},...a.themeTokens?.fontFamily?{"--cf-font":a.themeTokens.fontFamily}:{},...a.themeTokens?.success?{"--cf-success":a.themeTokens.success}:{},...a.themeTokens?.warning?{"--cf-warning":a.themeTokens.warning}:{},...a.themeTokens?.danger?{"--cf-danger":a.themeTokens.danger}:{},...Ln?{"--cf-accent":Ln,"--cf-accent-2":a.themeTokens?.accentStrong??`color-mix(in oklab, ${Ln} 76%, #14141f)`}:{}},Bn=e=>_(e),Vn=[...p].reverse().find(e=>e.role===`user`&&e.content.trim())?.content??``,Hn=p.some(e=>e.role===`user`),Un=!!(f?.allowVoiceInput&&f?.talkbackMode&&f.talkbackMode!==`text`),Wn=Un,Gn=!G&&Wn&&!Hn?tn.filter((e,t)=>!(t===0&&e.role===`assistant`)):tn,Kn=g===`human`&&pe?pe:f?.agentName??u.chatName,qn=g===`human`?u.liveSupport:g===`queued`?u.waitingForTeam:f?.offline?u.statusOffline:u.statusOnline,Jn=!y&&!G?f?.availableActions:void 0,Yn=!y&&!G?f?.actions:void 0,Xn=C&&!pt&&L===`connecting`&&!G;return(0,r.jsx)(e.z,{value:u,children:(0,r.jsx)(e.R,{value:a.locale,children:(0,r.jsxs)(`div`,{class:`cf-root`,dir:a.dir,"data-theme":Ot,"data-align":a.alignment,"data-display":`floating`,style:zn,children:[w&&d&&(0,r.jsx)(`div`,{class:`cf-theater-backdrop`,onClick:yn}),(0,r.jsxs)(`div`,{ref:D,class:`cf-panel ${d?`is-open`:``} ${C?`cf-panel--call`:``} ${Xn?`cf-panel--voice-connecting`:``} ${w&&d?`cf-panel--theater`:``} ${nn||rn?`cf-panel--analytics-focus`:``}`,role:`dialog`,"aria-modal":`false`,"aria-label":`${u.chatName}: ${f?.agentName??u.assistantName}`,"aria-hidden":!d,children:[Qe&&d&&(0,r.jsx)(o,{state:Qe,onClose:it}),(0,r.jsxs)(`div`,{class:`cf-header`,children:[(0,r.jsx)(e.v,{persona:f,hideWhenMissing:!0}),(0,r.jsxs)(`div`,{class:`cf-header__meta`,children:[(0,r.jsx)(`div`,{class:`cf-header__name`,children:Kn}),(0,r.jsx)(`div`,{class:`cf-header__status ${g===`ai`&&f?.offline?`cf-header__status--offline`:``}`,children:(0,r.jsx)(`span`,{class:`cf-header__status-text`,children:qn})})]}),(0,r.jsxs)(`div`,{class:`cf-header__actions`,children:[We.length>0&&(0,r.jsx)(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":u.pastConversations,title:u.pastConversations,"aria-pressed":U,onClick:()=>W(e=>!e),children:(0,r.jsx)(e.M,{})}),Hn&&!y&&!G&&(0,r.jsx)(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":u.endChat,title:u.endChat,onClick:on,children:(0,r.jsx)(e.j,{})}),a.sound&&kt&&(0,r.jsx)(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":Et?u.unmuteSounds:u.muteSounds,"aria-pressed":Et,onClick:At,children:Et?(0,r.jsx)(e.N,{}):(0,r.jsx)(e.P,{})}),(0,r.jsx)(`button`,{type:`button`,class:`cf-header__btn cf-header__close`,"aria-label":u.closeChat,onClick:q,children:(0,r.jsx)(e.A,{})})]})]}),(0,r.jsx)(`div`,{class:`cf-panel__video`,children:nn?(0,r.jsx)(`div`,{class:`cf-analytics-focus`,role:`region`,"aria-label":u.expandedAnalyticsResult,children:(0,r.jsx)(e.E,{visualization:nn,expanded:!0,onFollowUp:e=>{vn(),_(e)},onClose:vn})}):rn?.visualization?(0,r.jsx)(`div`,{class:`cf-analytics-focus`,role:`region`,"aria-label":u.expandedAnalyticsResult,children:(0,r.jsx)(e.T,{visualization:rn.visualization,onClose:vn,onFollowUp:e=>{vn(),_(e)},onFeedback:G?void 0:Ee,transport:G?void 0:De(`widget`),onOpenSource:a.onOpenAnalyticsSource})}):!G&&Wn?(0,r.jsx)(e.y,{persona:f,starters:[],onPick:_,onFocusComposer:Dn,speaking:h,voiceState:L,replyPending:C&&m&&!h,pinned:!0,muted:ht,onToggleMute:On,onEndCall:Q,onTalkNow:Mn,showTalkNow:Nn,micLevel:_t,theaterMode:w,onToggleTheater:hn,onMinimize:q,audioDevices:St,selectedAudioDeviceId:wt,onSelectAudioDevice:jn,connectingOnly:Xn}):null}),!Xn&&(0,r.jsxs)(`div`,{class:`cf-panel__chat`,children:[a.preview&&(0,r.jsx)(`div`,{class:`cf-preview-banner`,children:u.previewBanner}),G&&(0,r.jsx)(`div`,{class:`cf-viewing-banner`,children:u.viewingPast}),(0,r.jsxs)(`div`,{class:`cf-body`,ref:Mt,role:`log`,onScroll:dn,children:[Gn.map((t,n)=>(0,r.jsx)(e.C,{msg:t,persona:f,isLast:!G&&n===Gn.length-1,visitor:de,hasEmail:fe,lastQuestion:Vn,showActions:!G&&n===Gn.length-1&&!!(t.handoffOffered||t.selectedAction),onPickReply:Bn,onSubmitForm:Ne,onDemoSlots:ze,onConfirmHostedBooking:Pe,onRetry:we,ratable:!G&&Gn.slice(0,n).some(e=>e.role===`user`),onRate:Te,onExplanationFeedback:G?void 0:Ee,explanationTransport:G?void 0:De(`widget`),onOpenAnalyticsSource:a.onOpenAnalyticsSource,onExpandVisualization:G?void 0:gn,onExpandExplanation:G?void 0:_n,onOpenAttachment:nt,onReconnect:!G&&!y&&at&&t.id===Ze?ke:void 0},t.id)),!Hn&&!G&&(0,r.jsxs)(r.Fragment,{children:[Gn.length===0&&(0,r.jsx)(s,{name:f?.agentName??u.assistantName,greeting:f?.greeting}),(0,r.jsx)(e.w,{items:he,onPick:_}),(0,r.jsx)(e.x,{items:ge})]}),qt&&(0,r.jsxs)(`button`,{type:`button`,class:`cf-newmsg`,onClick:J,children:[(0,r.jsx)(e.O,{}),u.newMessages]})]}),(0,r.jsx)(`div`,{class:`cf-sr-live`,"aria-live":`polite`,"aria-atomic":`true`,children:Pn}),m&&!y&&!G&&(0,r.jsx)(`div`,{class:`cf-stopbar`,children:(0,r.jsxs)(`button`,{type:`button`,class:`cf-stop`,onClick:ye,children:[(0,r.jsx)(e.F,{}),u.stop]})}),G?(0,r.jsx)(`div`,{class:`cf-ended`,children:(0,r.jsx)(`button`,{type:`button`,class:`cf-ended__btn`,onClick:Je,children:u.backToChat})}):y?(0,r.jsxs)(`div`,{class:`cf-ended`,children:[(0,r.jsx)(`p`,{class:`cf-ended__text`,children:u.conversationEnded}),a.csat&&Hn?$t?(0,r.jsx)(`p`,{class:`cf-ended__text`,children:u.feedbackThanks}):(0,r.jsxs)(`div`,{class:`cf-csat`,children:[(0,r.jsx)(`span`,{class:`cf-csat__q`,children:u.csatPrompt}),(0,r.jsx)(`button`,{type:`button`,class:`cf-csat__btn`,"aria-label":u.feedbackHelpful,onClick:()=>{Me(`up`),en(!0)},children:(0,r.jsx)(e.L,{})}),(0,r.jsx)(`button`,{type:`button`,class:`cf-csat__btn`,"aria-label":u.feedbackNotHelpful,onClick:()=>{Me(`down`),en(!0)},children:(0,r.jsx)(e.I,{})})]}):null,(0,r.jsx)(`button`,{type:`button`,class:`cf-ended__btn`,onClick:cn,children:u.startNewChat})]}):(0,r.jsxs)(r.Fragment,{children:[me?(0,r.jsx)(`div`,{class:`cf-live-typing`,"aria-live":`polite`,children:e.B(u.agentTyping,{name:me})}):null,Jn&&Jn.length>0&&(0,r.jsx)(`div`,{class:`cf-footer-actions`,children:(0,r.jsx)(e._,{actions:Jn,descriptors:Yn,visitor:de,onSubmitForm:Ne,onDemoSlots:ze,onConfirmHostedBooking:Pe,scheduler:f?.scheduler,translations:a.actionTranslations})},`footer-actions`),(0,r.jsx)(e.b,{draftStore:Zt,onSend:_,onSendGif:_e,onTyping:ve,disabled:m,allowVoice:Un,onTranscribe:Fe,gifEnabled:Be,onSearchGifs:Re,allowAttach:a.attachments,analyzeAttachments:!0,onUpload:Ie,onPreviewAttachment:rt},`composer`)]}),!y&&f?.disclaimerText&&(0,r.jsx)(`div`,{class:`cf-disclaimer`,children:f.disclaimerText}),(0,r.jsxs)(`div`,{class:`cf-footer`,children:[(0,r.jsx)(`button`,{type:`button`,class:`cf-footer__privacy`,"aria-label":u.clearDeviceData,onClick:()=>H(!0),children:u.privacyAndData}),(0,r.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),u.poweredBy,` `,(0,r.jsx)(`a`,{href:`https://accurix.tech/centrinfo`,target:`_blank`,rel:`noopener noreferrer`,children:`Centrinfo`})]})]}),z&&(0,r.jsx)(`div`,{class:`cf-confirm`,onClick:()=>B(!1),children:(0,r.jsxs)(`div`,{class:`cf-confirm__card`,role:`alertdialog`,"aria-modal":`true`,"aria-label":u.endChatConfirm,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>c(e,e.currentTarget,()=>B(!1)),children:[(0,r.jsx)(`div`,{class:`cf-confirm__title`,children:u.endChatConfirm}),(0,r.jsx)(`div`,{class:`cf-confirm__body`,children:u.endChatConfirmBody}),(0,r.jsxs)(`div`,{class:`cf-confirm__actions`,children:[(0,r.jsx)(`button`,{ref:Yt,type:`button`,class:`cf-confirm__btn cf-confirm__btn--cancel`,onClick:()=>B(!1),children:u.cancel}),(0,r.jsx)(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--danger`,onClick:sn,children:u.endConfirmCta})]})]})},`confirm-end`),U&&(0,r.jsx)(`div`,{class:`cf-confirm`,onClick:()=>W(!1),children:(0,r.jsxs)(`div`,{class:`cf-history`,role:`dialog`,"aria-modal":`true`,"aria-label":u.pastConversations,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>c(e,e.currentTarget,()=>W(!1)),children:[(0,r.jsxs)(`div`,{class:`cf-history__head`,children:[(0,r.jsx)(`span`,{children:u.pastConversations}),(0,r.jsx)(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":u.closeHistory,onClick:()=>W(!1),children:(0,r.jsx)(e.A,{})})]}),(0,r.jsx)(`div`,{class:`cf-history__list`,children:We.map(e=>(0,r.jsxs)(`button`,{type:`button`,class:`cf-history__item ${e.sessionId===Ge?`is-active`:``}`,onClick:()=>{qe(e.sessionId),W(!1)},children:[(0,r.jsx)(`span`,{class:`cf-history__title`,children:e.title}),(0,r.jsxs)(`span`,{class:`cf-history__meta`,children:[new Date(e.ts).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),e.ended?` · ${u.historyEnded}`:``]})]},e.sessionId))}),(0,r.jsx)(`div`,{class:`cf-history__footer`,children:(0,r.jsx)(`button`,{type:`button`,class:`cf-history__clear`,onClick:()=>{W(!1),H(!0)},children:u.clearDeviceData})})]})},`history`),V&&(0,r.jsx)(`div`,{class:`cf-confirm`,onClick:()=>H(!1),children:(0,r.jsxs)(`div`,{class:`cf-confirm__card`,role:`alertdialog`,"aria-modal":`true`,"aria-label":u.clearDeviceData,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>c(e,e.currentTarget,()=>H(!1)),children:[(0,r.jsx)(`div`,{class:`cf-confirm__title`,children:u.clearDeviceData}),(0,r.jsx)(`div`,{class:`cf-confirm__body`,children:u.clearDeviceDataBody}),(0,r.jsxs)(`div`,{class:`cf-confirm__actions`,children:[(0,r.jsx)(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--cancel`,onClick:()=>H(!1),children:u.cancel}),(0,r.jsx)(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--danger`,onClick:()=>{H(!1),Ye()},children:u.clearDeviceDataCta})]})]})},`confirm-clear`)]}),C&&!d?(0,r.jsx)(e.S,{persona:f,voiceState:L,muted:ht,onToggleMute:On,onEndCall:Q,micLevel:_t,onExpand:K}):w&&d?null:!a.hideDefaultLauncher&&(0,r.jsxs)(`button`,{ref:jt,type:`button`,class:`cf-launcher`,"aria-label":d?u.closeChat:x>0?`${u.openChat}. ${x===1?u.unreadMessage:e.B(u.unreadMessages,{count:String(x)})}`:u.openChat,"aria-expanded":d,onClick:an,children:[a.launcherIcon?(0,r.jsx)(`img`,{class:`cf-launcher__img`,src:a.launcherIcon,alt:``}):(0,r.jsx)(e.k,{}),!d&&x>0&&(0,r.jsx)(`span`,{class:`cf-launcher__badge`,"aria-hidden":`true`,children:x>99?`99+`:x})]})]})})})},p=`centrinfo-widget`;var m=class extends HTMLElement{constructor(...t){super(...t),e.Z(this,`controls`,null),e.Z(this,`composerDraftStore`,{value:``})}mountWith(n){let i=e.n(n),a=this.shadowRoot??this.attachShadow({mode:`open`});if(this.style.zIndex=String(i.zIndex),`adoptedStyleSheets`in Document.prototype&&typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`){let t=new CSSStyleSheet;t.replaceSync(e.t),a.adoptedStyleSheets=[t]}else{let t=document.createElement(`style`);i.styleNonce&&(t.nonce=i.styleNonce),t.textContent=e.t,a.appendChild(t)}(0,t.render)((0,r.jsx)(f,{transport:e.X(i),config:i,bindControls:e=>this.controls=e,composerDraftStore:this.composerDraftStore}),a)}open(){this.controls?.open()}close(){this.controls?.close()}toggle(){this.controls?.toggle()}identify(e){this.controls?.identify(e)}clear(){this.controls?.startNew()}shutdown(){this.controls?.shutdown()}unmount(){this.shadowRoot&&(0,t.render)(null,this.shadowRoot)}};typeof customElements<`u`&&!customElements.get(p)&&customElements.define(p,m);const h=(e,t=document.body)=>{if(typeof document>`u`)throw Error(`[centrinfo-widget] createWidget must run in a browser.`);let n=document.createElement(p);return n.style.pointerEvents=`none`,n.style.position=`fixed`,n.style.inset=`0`,n.style.width=`0`,n.style.height=`0`,t.appendChild(n),n.mountWith(e),{open:()=>n.open(),close:()=>n.close(),toggle:()=>n.toggle(),show:()=>n.open(),hide:()=>n.close(),identify:e=>n.identify(e),update:e=>n.identify(e),clear:()=>n.clear(),shutdown:()=>n.shutdown(),logout:()=>n.shutdown(),destroy:()=>{n.unmount(),n.remove()}}},de=e=>h(e);let fe=null;const g=e=>{fe?.destroy();let t=de(e);return fe=t,t},pe={init:g,createWidget:de};exports.Centrinfo=pe,exports.createWidget=de,exports.init=g;
1
+ const e=require(`./styles-CwxqspIz.cjs`);let t=require(`preact`),n=require(`preact/hooks`),r=require(`preact/jsx-runtime`);const i=(e,t)=>{if(typeof MutationObserver>`u`)return()=>void 0;let n=e.scrollHeight,r=0,i=()=>{r=0;let i=e.scrollHeight,a=i>n,o=t.isAtBottom();n=i,a&&(o?(e.scrollTop=e.scrollHeight,t.onFollow?.()):t.onUnseen?.())},a=new MutationObserver(()=>{r||(r=typeof requestAnimationFrame==`function`?requestAnimationFrame(i):setTimeout(i,0))});return a.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{a.disconnect(),r&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r)}},a=e=>e.startsWith(`image/`)?`image`:e===`application/pdf`?`pdf`:`other`,o=({state:t,onClose:i})=>{let o=e.V(),s=(0,n.useRef)(null);(0,n.useEffect)(()=>{s.current?.focus();let e=e=>{e.key===`Escape`&&(e.stopPropagation(),i())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[i]);let c=t.status===`ready`?a(t.mimeType):`other`;return(0,r.jsx)(`div`,{class:`cf-preview`,role:`dialog`,"aria-modal":`true`,"aria-label":e.B(o.attachPreviewTitle,{name:t.name}),onClick:e=>{e.target===e.currentTarget&&i()},children:(0,r.jsxs)(`div`,{class:`cf-preview__frame`,children:[(0,r.jsxs)(`div`,{class:`cf-preview__bar`,children:[(0,r.jsx)(`span`,{class:`cf-preview__name`,title:t.name,children:t.name}),t.status===`ready`&&(0,r.jsx)(`a`,{class:`cf-preview__btn`,href:t.url,download:t.name,children:o.attachDownload}),(0,r.jsx)(`button`,{ref:s,type:`button`,class:`cf-preview__btn cf-preview__close`,"aria-label":o.attachPreviewClose,onClick:i,children:`✕`})]}),(0,r.jsxs)(`div`,{class:`cf-preview__body`,children:[t.status===`loading`&&(0,r.jsx)(`p`,{class:`cf-preview__note`,children:o.attachPreviewLoading}),t.status===`error`&&(0,r.jsx)(`p`,{class:`cf-preview__note`,children:o.attachPreviewFailed}),t.status===`ready`&&c===`image`&&(0,r.jsx)(`img`,{class:`cf-preview__image`,src:t.url,alt:t.name}),t.status===`ready`&&c===`pdf`&&(0,r.jsx)(`iframe`,{class:`cf-preview__pdf`,src:t.url,title:t.name}),t.status===`ready`&&c===`other`&&(0,r.jsx)(`p`,{class:`cf-preview__note`,children:o.attachPreviewUnsupported})]})]})})},s=({name:t,greeting:n})=>{let i=e.V();return(0,r.jsxs)(`section`,{class:`cf-empty-welcome`,"aria-label":e.B(i.welcomeLabel,{name:t}),children:[(0,r.jsx)(`span`,{class:`cf-empty-welcome__eyebrow`,children:i.welcomeEyebrow}),(0,r.jsx)(`h2`,{children:t}),(0,r.jsx)(`p`,{children:n||i.welcomePrompt})]})},c=(e,t,n)=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n();return}if(e.key!==`Tab`)return;let r=Array.from(t.querySelectorAll(`button, [href], textarea, input, select, [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`&&e.tabIndex>=0);if(r.length===0)return;let i=t.getRootNode(),a=e.composedPath()[0],o=a instanceof HTMLElement?a:`activeElement`in i?i.activeElement:document.activeElement,s=r[0],c=r[r.length-1];e.shiftKey&&(o===s||!t.contains(o))?(e.preventDefault(),e.stopPropagation(),c.focus()):!e.shiftKey&&(o===c||!t.contains(o))&&(e.preventDefault(),e.stopPropagation(),s.focus())},l=new Map,ee=e=>{if(!e||typeof document>`u`||typeof CanvasRenderingContext2D>`u`)return;let t=document.createElement(`canvas`).getContext(`2d`);if(!t)return;t.fillStyle=`#010203`,t.fillStyle=e;let n=t.fillStyle;if(n===`#010203`&&e.trim().toLowerCase()!==`#010203`)return;let r=n.match(/^#([\da-f]{6})$/i)?.[1];if(r)return[Number.parseInt(r.slice(0,2),16),Number.parseInt(r.slice(2,4),16),Number.parseInt(r.slice(4,6),16),1];let i=n.match(/^rgba?\(([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:[, /]+([\d.]+))?\)$/i);if(!i)return;let a=i.slice(1,5).map(Number);if(!a.some(e=>!Number.isFinite(e)))return[a[0],a[1],a[2],a[3]??1]},te=(e,t=`#ffffff`)=>{let n=`${e??``}|${t}`;if(l.has(n))return l.get(n);let r=ee(e),i=ee(t)??[255,255,255,1];if(!r){l.set(n,void 0);return}let a=r[3],o=r.slice(0,3).map((e,t)=>e*a+i[t]*(1-a)).map(e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}),s=o[0]*.2126+o[1]*.7152+o[2]*.0722,c=1.05/(s+.05)>=(s+.05)/.059?`#ffffff`:`#0f1e2a`;return l.set(n,c),c},ne=e=>{let[t,r]=(0,n.useState)(`light`);return(0,n.useEffect)(()=>{if(e!==`auto`||typeof matchMedia>`u`)return;let t=matchMedia(`(prefers-color-scheme: dark)`),n=()=>r(t.matches?`dark`:`light`);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),e===`auto`?t:e},u=6e4,d=90,re={end:`end the call`,mute:`mute your microphone`,minimize:`minimize the chat`,expand:`expand the view`,shrink:`exit the expanded view`},ie=e=>e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s']/gu,` `).replace(/\s+/g,` `).trim(),ae=[{action:`shrink`,re:/\b(?:exit|leave|quit|close)\b[\s\w]*\b(?:full ?screen|expanded|theat(?:er|re))\b|\bshrink\b|\bsmaller view\b/},{action:`end`,re:/\b(?:end|close|stop|finish|hang ?up|quit|exit)\b[\s\w]*\b(?:call|chat|conversation|convo|session|talking)\b|\bhang ?up\b|\bgood ?bye\b|^bye(?: bye)?$/},{action:`mute`,re:/\bmute\b|\bstop listening\b/},{action:`minimize`,re:/\bminimi[sz]e\b|\bhide\b[\s\w]*\b(?:chat|call|window|widget)\b/},{action:`expand`,re:/\bexpand\b|\bmaximi[sz]e\b|\bfull ?screen\b|\btheat(?:er|re) mode\b|\bbigger view\b/}],oe=/^(?:yes|yeah|yep|yup|sure|correct|confirm|affirmative|go ahead|do it|please do|ok(?:ay)?)\b/,se=/^(?:no|nope|nah|cancel|never ?mind|don'?t|stop)\b/,ce=/^(?:end|close|stop|finish|hang ?up|quit|exit|bye|good ?bye)\b/,le=e=>{let t=ie(e);if(!t)return null;for(let{action:e,re:n}of ae)if(n.test(t)){let n=t.split(` `).length;return{action:e,confident:e===`end`?n<=10:n<=6}}return null},ue=e=>`I didn't catch yes or no. Say yes to ${re[e]}, or no to keep talking.`,f=({transport:t,config:a,bindControls:l,composerDraftStore:ee})=>{let u=a.strings,[d,ae]=(0,n.useState)(a.openByDefault),{persona:f,messages:p,sending:m,assistantSpeaking:h,visitor:de,hasEmail:fe,liveMode:g,assignedAgentName:pe,agentTypingName:me,starters:he,featuredLinks:ge,send:_,sendGif:_e,notifyTyping:ve,stop:ye,amend:be,hold:xe,resumeHeld:Se,duckSpeaking:Ce,retry:we,rateMessage:Te,rateExplanation:Ee,explanationTransport:De,injectAssistant:Oe,reconnectSupport:ke,appendUserDraft:Ae,patchMessage:v,removeMessage:je,submitCsat:Me,submitForm:Ne,confirmHostedBooking:Pe,transcribe:Fe,uploadAttachment:Ie,loadAttachment:Le,searchGifs:Re,demoSlots:ze,gifEnabled:Be,identify:Ve,ended:y,endConversation:He,startNew:Ue,history:We,viewingSessionId:Ge,viewMessages:Ke,openConversation:qe,closeHistoryView:Je,shutdown:Ye,stopSpeaking:b,speakAssistantText:Xe}=e.a(t,a,d),Ze=e.i(p,g),[Qe,$e]=(0,n.useState)(null),et=(0,n.useRef)(0),tt=(0,n.useCallback)((e,t,n)=>{n===et.current&&$e({status:`ready`,name:t,url:URL.createObjectURL(e),mimeType:e.type||`application/octet-stream`})},[]),nt=(0,n.useCallback)((e,t,n)=>{let r=t.name,i=++et.current;$e({status:`loading`,name:r}),Le(e,t,n).then(e=>tt(e,r,i),()=>{i===et.current&&$e({status:`error`,name:r})})},[Le,tt]),rt=(0,n.useCallback)((e,t)=>tt(e,t,++et.current),[tt]),it=(0,n.useCallback)(()=>{et.current+=1,$e(null)},[]);(0,n.useEffect)(()=>()=>{Qe?.status===`ready`&&URL.revokeObjectURL(Qe.url)},[Qe]);let at=!!e.r(f?.actions),[x,ot]=(0,n.useState)(0),[S,st]=(0,n.useState)({mic:`off`,processing:!1}),[ct,lt]=(0,n.useState)(null),[ut,dt]=(0,n.useState)(!1),[C,ft]=(0,n.useState)(!1),[pt,mt]=(0,n.useState)(!1),[ht,gt]=(0,n.useState)(!1),[_t,vt]=(0,n.useState)(0),[w,T]=(0,n.useState)(!1),[yt,E]=(0,n.useState)(null),[bt,xt]=(0,n.useState)(null),[St,Ct]=(0,n.useState)([]),[wt,Tt]=(0,n.useState)(``),[Et,Dt]=(0,n.useState)(()=>{try{return localStorage.getItem(`centrinfo:muted`)===`1`}catch{return!1}}),Ot=ne(a.theme),kt=f?.soundEnabled??!0;(0,n.useEffect)(()=>{e.d(a.sound&&kt&&!Et)},[a.sound,kt,Et]);let At=(0,n.useCallback)(()=>{Dt(e=>{let t=!e;try{localStorage.setItem(`centrinfo:muted`,t?`1`:`0`)}catch{}return t})},[]),D=(0,n.useRef)(null),jt=(0,n.useRef)(null),Mt=(0,n.useRef)(null),Nt=(0,n.useRef)(0),O=(0,n.useRef)(!1),k=(0,n.useRef)(!1),A=(0,n.useRef)(null),j=(0,n.useRef)(0),Pt=(0,n.useRef)(void 0),Ft=(0,n.useRef)(0),It=(0,n.useRef)(null),M=(0,n.useRef)(!1),N=(0,n.useRef)(null),P=(0,n.useRef)(``),Lt=(0,n.useRef)(()=>{}),Rt=(0,n.useRef)(``),zt=(0,n.useRef)(m),Bt=(0,n.useRef)(_);Bt.current=_;let Vt=(0,n.useRef)(be);Vt.current=be;let Ht=(0,n.useRef)(Fe);Ht.current=Fe;let F=(0,n.useRef)(!1),I=(0,n.useRef)(!1),Ut=(0,n.useRef)(``);Ut.current=[...p].reverse().find(e=>e.role===`assistant`)?.content??``;let Wt=(0,n.useRef)(h);zt.current=m,Wt.current=h;let L=C?ut?`timeout`:ht||S.mic===`muted`?`muted`:S.mic===`unavailable`?S.reason===`permission-denied`||S.reason===`unsupported`?`denied`:`unavailable`:S.mic===`off`||S.mic===`starting`?`connecting`:S.mic===`hearing`?`hearing`:h?`speaking`:ct??(S.processing||m?`processing`:`listening`):`idle`,[Gt,Kt]=(0,n.useState)(!0),[qt,R]=(0,n.useState)(!1),Jt=(0,n.useRef)(0),[z,B]=(0,n.useState)(!1),[V,H]=(0,n.useState)(!1),Yt=(0,n.useRef)(null),[U,W]=(0,n.useState)(!1),Xt=(0,n.useRef)({value:``}),Zt=ee??Xt.current,Qt=(0,n.useRef)({confirmEnd:z,confirmClear:V,showHistory:U});Qt.current={confirmEnd:z,confirmClear:V,showHistory:U};let[$t,en]=(0,n.useState)(!1),G=!!Ge,tn=G?Ke:p,nn=tn.find(e=>e.id===yt&&e.visualization)?.visualization,rn=tn.find(e=>e.id===bt&&e.visualization);(0,n.useEffect)(()=>{!bt||rn||(xt(null),T(!1))},[bt,rn]),(0,n.useEffect)(()=>{!yt||nn||(E(null),T(!1))},[nn,yt]);let K=(0,n.useCallback)(()=>{ae(!0),ot(0),e.u(`open`),a.onOpen?.(),a.onShow?.()},[a]),q=(0,n.useCallback)(()=>{ae(!1),T(!1),E(null),a.onClose?.(),a.onHide?.(),jt.current?.focus()},[a]),J=(0,n.useCallback)(()=>d?q():K(),[d,K,q]),an=(0,n.useCallback)(()=>B(!0),[]),on=(0,n.useCallback)(()=>{He(),B(!1)},[He]),sn=(0,n.useCallback)(()=>{Ue(),R(!1),Kt(!0)},[Ue]);(0,n.useEffect)(()=>{z&&Yt.current?.focus()},[z]),(0,n.useEffect)(()=>{l({open:K,close:q,toggle:J,identify:Ve,startNew:Ue,endConversation:He,shutdown:Ye})},[l,K,q,J,Ve,Ue,He,Ye]),(0,n.useEffect)(()=>{let e=p.filter(e=>e.role===`assistant`&&!e.pending).length;if(d){Nt.current=e;return}e>Nt.current&&ot(e-Nt.current)},[p,d]),(0,n.useEffect)(()=>{a.onUnreadChange?.(x)},[x,a]),(0,n.useEffect)(()=>{let e=a.sessionDurationMinutes;if(!e||e<=0)return;let t=setTimeout(()=>Ye(),e*60*1e3);return()=>clearTimeout(t)},[a.sessionDurationMinutes,p,d,Ye]),(0,n.useEffect)(()=>{let e=a.customLauncherSelector;if(!e||typeof document>`u`)return;let t=[];try{t=Array.from(document.querySelectorAll(e))}catch{return}let n=e=>{e.preventDefault(),J()};return t.forEach(e=>e.addEventListener(`click`,n)),()=>t.forEach(e=>e.removeEventListener(`click`,n))},[a.customLauncherSelector,J]);let cn=(0,n.useRef)(!1);(0,n.useEffect)(()=>{let e=a.proactiveMessage?.trim();if(!e||cn.current)return;let t=a.proactiveOnPaths??[],n=typeof location<`u`?location.pathname:``;if(t.length>0&&!t.some(e=>n.includes(e)))return;let r=`centrinfo:proactive:${a.token.slice(0,12)}`;try{if(sessionStorage.getItem(r)===`1`)return}catch{}let i=setTimeout(()=>{if(!(d||y||p.some(e=>e.role===`user`))){cn.current=!0;try{sessionStorage.setItem(r,`1`)}catch{}Oe(e),K()}},Math.max(0,a.proactiveDelaySeconds)*1e3);return()=>clearTimeout(i)},[a.proactiveMessage]),(0,n.useEffect)(()=>{let e=Mt.current;if(!d||!e)return;let t=p[p.length-1],n=Date.now()<Jt.current;t?.role===`user`||Gt||n?(requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight}),R(!1),n&&Kt(!0)):R(!0)},[p,d,m,Gt]);let ln=(0,n.useRef)(!0);ln.current=Gt,(0,n.useEffect)(()=>{let e=Mt.current;if(!(!d||!e))return i(e,{isAtBottom:()=>ln.current,onUnseen:()=>R(!0)})},[d,G]);let un=(0,n.useCallback)(()=>{let e=Mt.current;if(!e)return;if(O.current&&!G){Kt(!0),R(!1);return}let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;Kt(t),t&&R(!1)},[G]),Y=(0,n.useCallback)(()=>{let e=Mt.current;e&&(e.scrollTop=e.scrollHeight),R(!1),Kt(!0)},[]),dn=(0,n.useCallback)(()=>{Jt.current=Date.now()+3e3,requestAnimationFrame(Y)},[Y]);(0,n.useEffect)(()=>{if(!d||G||!C||L===`connecting`)return;Jt.current=Date.now()+6e4,Y();let e=requestAnimationFrame(()=>{Y(),requestAnimationFrame(Y)}),t=[80,180,360].map(e=>window.setTimeout(Y,e));return()=>{cancelAnimationFrame(e),t.forEach(e=>window.clearTimeout(e))}},[h,p,d,Y,m,C,G,L]);let fn=(0,n.useCallback)(()=>{D.current?.querySelector(`.cf-textarea`)?.focus()},[]),pn=(0,n.useCallback)((e,t)=>{lt(e),Pt.current&&window.clearTimeout(Pt.current),Pt.current=window.setTimeout(()=>lt(null),3e3),t&&!k.current&&Xe(t)},[Xe]),mn=(0,n.useCallback)(e=>{let t=N.current;if(t)return t;dn();let n=Ae(e);return N.current=n,v(n,{content:P.current||e,pending:!0,streaming:!1}),n},[Ae,dn,v]),X=(0,n.useCallback)(()=>{let e=N.current;if(e){if(P.current){v(e,{content:P.current,pending:!0});return}N.current=null,je(e)}},[v,je]),Z=(0,n.useCallback)(()=>{I.current&&(I.current=!1,Ce(!1)),F.current&&(F.current=!1,Se())},[Ce,Se]),Q=(0,n.useCallback)(()=>{O.current=!1,A.current?.stop(`call-ended`),A.current=null,F.current=!1,I.current=!1,k.current=!1,It.current=null,M.current=!1;let e=N.current;N.current=null,P.current=``,e&&je(e),Pt.current&&window.clearTimeout(Pt.current),lt(null),dt(!1),st({mic:`off`,processing:!1}),vt(0),ft(!1),mt(!1),gt(!1),T(!1),E(null),b()},[je,b]),hn=(0,n.useCallback)(()=>{w&&E(null),T(!w)},[w]),gn=(0,n.useCallback)(e=>{E(e),T(!0)},[]),_n=(0,n.useCallback)(e=>{xt(e),T(!0)},[]),vn=(0,n.useCallback)(()=>{let e=yt,t=bt;E(null),xt(null),T(!1),window.requestAnimationFrame(()=>{(t?D.current?.querySelector(`[data-explanation-message="${t}"]`)?.querySelector(`[data-testid="analytics-explanation-expand"]`):Array.from(D.current?.querySelectorAll(`[data-visualization-message]`)??[]).find(t=>t.dataset.visualizationMessage===e))?.focus()})},[yt,bt]),yn=(0,n.useCallback)(()=>{E(null),xt(null),T(!1)},[]),bn=(0,n.useCallback)((e,t,n=!1)=>{if(dn(),t&&(v(t,{content:e,pending:!1,streaming:!1}),N.current===t&&(N.current=null)),P.current=``,n){b(),Vt.current(e,{forceVoicePlayback:!0,userMessageId:t});return}O.current&&(xe()?Vt.current(e,{forceVoicePlayback:!0,userMessageId:t}):Bt.current(e,{forceVoicePlayback:!0,userMessageId:t}))},[dn,xe,v,b]),$=(0,n.useCallback)(e=>{Oe(e),Xe(e)},[Oe,Xe]),xn=(0,n.useCallback)(()=>{if(j.current=Date.now(),lt(null),Wt.current){I.current=!0,Ce(!0);return}F.current||(F.current=xe()),mn(`Listening...`)},[Ce,mn,xe]),Sn=(0,n.useCallback)(e=>{let t=N.current;!t||I.current||v(t,{content:`${[P.current,e].filter(Boolean).join(` `)} ...`,pending:!0})},[v]),Cn=(0,n.useCallback)(t=>{j.current=Date.now();let n=[P.current,t.text].map(e=>e.trim()).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();if((I.current||t.overlappedOutput)&&e.U(t.text,Ut.current)){X(),Z();return}if(!n||e.p(n)||e.m(n)){let e=I.current||F.current;X(),Z(),e||pn(`misunderstood`);return}I.current&&(I.current=!1,ye(),b());let r=It.current;if(r){P.current=``,X();let e=ie(n);if(oe.test(e)||r===`end`&&ce.test(e)){It.current=null,Lt.current(r);return}if(se.test(e)){It.current=null,$(`Okay, never mind — what would you like to know?`);return}$(ue(r));return}let i=le(n);if(i){if(P.current=``,X(),Z(),i.confident){Lt.current(i.action);return}It.current=i.action,$(`Just to confirm — you want me to ${re[i.action]}? Please say yes or no.`);return}let a=mn(n);v(a,{content:n,pending:!0});let o=F.current;F.current=!1,bn(n,a,o)},[mn,v,Z,bn,X,pn,$,ye,b]),wn=(0,n.useCallback)(e=>{j.current=Date.now();let t=I.current||F.current;if(X(),Z(),!(t||e.overlappedOutput||e.reason===`too-short`)){if(e.reason===`transcribe-failed`){pn(`misunderstood`,`I couldn't transcribe that. Please try again, or type your question.`);return}pn(`noise`)}},[Z,X,pn]),Tn=(0,n.useRef)({speechStart:xn,partial:Sn,turn:Cn,noise:wn});Tn.current={speechStart:xn,partial:Sn,turn:Cn,noise:wn};let En=(0,n.useCallback)(()=>{navigator.mediaDevices?.enumerateDevices().then(e=>{Ct(e.filter(e=>e.kind===`audioinput`).map((e,t)=>({deviceId:e.deviceId,label:e.label||`Microphone ${t+1}`})))}).catch(()=>{})},[]),Dn=(0,n.useCallback)(()=>{if(O.current){Q();return}if(fn(),!f?.allowVoiceInput||!f.talkbackMode||f.talkbackMode===`text`||zt.current||y||G)return;j.current=Date.now(),k.current=!1,O.current=!0,gt(!1),ft(!0),mt(!1),dt(!1);let t=!1,n=new e.H({deviceId:Rt.current||void 0,transcribe:async({audio:t,mimeType:n,durationSeconds:r})=>{let i=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||void 0;return e.h(await Ht.current(t,n,i,r))},listener:{state:e=>{st(e),e.mic!==`starting`&&e.mic!==`off`&&mt(!0),!t&&e.mic===`listening`&&(t=!0,En())},speechStart:()=>Tn.current.speechStart(),partial:({text:e})=>Tn.current.partial(e),turn:e=>Tn.current.turn(e),noise:e=>Tn.current.noise(e),level:e=>{let t=performance.now();t-Ft.current<90||(Ft.current=t,vt(e))}}});A.current=n,n.setOutputActive(Wt.current),n.start()},[Q,y,fn,f,En,G]),On=(0,n.useCallback)(()=>{let e=!k.current;k.current=e,gt(e),A.current?.setMuted(e),e?(P.current=``,X(),Z()):j.current=Date.now()},[Z,X]),kn=(0,n.useCallback)(e=>{switch(j.current=Date.now(),e){case`end`:M.current=!0,$(`Okay — ending our call now. Goodbye!`),window.setTimeout(()=>{M.current&&(M.current=!1,Q())},2e3);break;case`mute`:k.current||On(),$(`Muted. Tap the mic button when you want me to listen again.`);break;case`minimize`:q(),$(`Minimized — I'm still listening. Tap the call pill to bring the chat back.`);break;case`expand`:T(!0),$(`Sure — expanding the view.`);break;case`shrink`:E(null),T(!1),$(`Okay — back to the smaller view.`);break}},[q,Q,$,On]);(0,n.useEffect)(()=>{Lt.current=kn},[kn]);let An=(0,n.useRef)(!1);(0,n.useEffect)(()=>{An.current&&!h&&M.current&&(M.current=!1,Q()),An.current=h},[h,Q]);let jn=(0,n.useCallback)(e=>{Rt.current=e,Tt(e),A.current?.selectDevice(e||void 0)},[]),Mn=(0,n.useCallback)(()=>{!O.current||k.current||(I.current=!1,F.current=!1,ye(),b(),j.current=Date.now())},[ye,b]);(0,n.useEffect)(()=>{A.current?.setOutputActive(h),j.current=Date.now()},[h]),(0,n.useEffect)(()=>{if(L!==`denied`)return;let e=window.setTimeout(()=>Q(),3500);return()=>window.clearTimeout(e)},[Q,L]),(0,n.useEffect)(()=>{if(!C)return;let e=window.setInterval(()=>{let e=A.current;!e||k.current||zt.current||Wt.current||e.snapshot.mic===`hearing`||e.snapshot.processing||Date.now()-j.current<6e4||(A.current?.log.add(`call-timeout`),dt(!0),window.setTimeout(()=>Q(),2400))},5e3);return()=>window.clearInterval(e)},[Q,C]);let Nn=C&&!ht&&(m||h);(0,n.useEffect)(()=>()=>Q(),[Q]);let[Pn,Fn]=(0,n.useState)(``),In=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(In.current&&!m){let e=[...p].reverse().find(e=>e.role===`assistant`&&!e.streaming&&!e.pending&&e.content);e&&Fn(e.content)}In.current=m},[m,p]),(0,n.useLayoutEffect)(()=>{if(!d)return;let e=D.current,t=z||V?e?.querySelector(`.cf-confirm__card`):U?e?.querySelector(`.cf-history`):null;if(!t)return;let n=t.getRootNode(),r=`activeElement`in n?n.activeElement:document.activeElement;(!r||!t.contains(r))&&t.querySelector(`button, [href], textarea, input, [tabindex]:not([tabindex="-1"])`)?.focus()},[V,z,d,U]),(0,n.useEffect)(()=>{if(!d)return;let e=D.current,t=z||V?e?.querySelector(`.cf-confirm__card`):U?e?.querySelector(`.cf-history`):null,n=e?.querySelectorAll(`:scope > .cf-header, :scope > .cf-panel__video, :scope > .cf-panel__chat`);n?.forEach(e=>{t?(e.setAttribute(`inert`,``),e.setAttribute(`aria-hidden`,`true`)):(e.removeAttribute(`inert`),e.removeAttribute(`aria-hidden`))}),t||requestAnimationFrame(()=>e?.querySelector(`.cf-textarea`)?.focus());let r=n=>{if(n.key===`Escape`){n.preventDefault();let t=Qt.current;if(t.confirmEnd){B(!1);return}if(t.confirmClear){H(!1);return}if(t.showHistory){W(!1);return}if(e?.querySelector(`.cf-action-drawer`))return;q();return}if(n.key!==`Tab`||!t)return;let r=t.querySelectorAll(`button, [href], textarea, input, [tabindex]:not([tabindex="-1"])`),i=Array.from(r).filter(e=>!e.hasAttribute(`disabled`));if(i.length===0)return;let a=i[0],o=i[i.length-1],s=t.getRootNode()instanceof ShadowRoot?t.getRootNode().activeElement:document.activeElement;n.shiftKey&&s===a?(n.preventDefault(),o.focus()):!n.shiftKey&&s===o&&(n.preventDefault(),a.focus())};return e?.addEventListener(`keydown`,r),()=>{e?.removeEventListener(`keydown`,r),n?.forEach(e=>{e.removeAttribute(`inert`),e.removeAttribute(`aria-hidden`)})}},[d,q,z,V,U]),(0,n.useEffect)(()=>{let e=D.current;e&&(d?e.removeAttribute(`inert`):e.setAttribute(`inert`,``))},[d]);let Ln=a.accentColor??a.themeTokens?.accent??f?.accentColor,Rn=a.themeTokens?.accentText??te(Ln,a.themeTokens?.background??(Ot===`dark`?`#0f1c27`:`#ffffff`)),zn={zIndex:a.zIndex,"--cf-h-pad":`${a.horizontalPadding}px`,"--cf-v-pad":`${a.verticalPadding}px`,...Rn?{"--cf-accent-ink":Rn}:{},...a.themeTokens?.accentStrong?{"--cf-accent-2":a.themeTokens.accentStrong}:{},...a.themeTokens?.background?{"--cf-bg":a.themeTokens.background}:{},...a.themeTokens?.surface?{"--cf-surface":a.themeTokens.surface}:{},...a.themeTokens?.surfaceMuted?{"--cf-surface-2":a.themeTokens.surfaceMuted}:{},...a.themeTokens?.text?{"--cf-text":a.themeTokens.text}:{},...a.themeTokens?.mutedText?{"--cf-muted":a.themeTokens.mutedText}:{},...a.themeTokens?.border?{"--cf-border":a.themeTokens.border}:{},...a.themeTokens?.shadow?{"--cf-shadow":a.themeTokens.shadow}:{},...a.themeTokens?.radius?{"--cf-radius":a.themeTokens.radius}:{},...a.themeTokens?.fontFamily?{"--cf-font":a.themeTokens.fontFamily}:{},...a.themeTokens?.success?{"--cf-success":a.themeTokens.success}:{},...a.themeTokens?.warning?{"--cf-warning":a.themeTokens.warning}:{},...a.themeTokens?.danger?{"--cf-danger":a.themeTokens.danger}:{},...Ln?{"--cf-accent":Ln,"--cf-accent-2":a.themeTokens?.accentStrong??`color-mix(in oklab, ${Ln} 76%, #14141f)`}:{}},Bn=e=>_(e),Vn=[...p].reverse().find(e=>e.role===`user`&&e.content.trim())?.content??``,Hn=p.some(e=>e.role===`user`),Un=!!(f?.allowVoiceInput&&f?.talkbackMode&&f.talkbackMode!==`text`),Wn=Un,Gn=!G&&Wn&&!Hn?tn.filter((e,t)=>!(t===0&&e.role===`assistant`)):tn,Kn=g===`human`&&pe?pe:f?.agentName??u.chatName,qn=g===`human`?u.liveSupport:g===`queued`?u.waitingForTeam:f?.offline?u.statusOffline:u.statusOnline,Jn=!y&&!G?f?.availableActions:void 0,Yn=!y&&!G?f?.actions:void 0,Xn=C&&!pt&&L===`connecting`&&!G;return(0,r.jsx)(e.z,{value:u,children:(0,r.jsx)(e.R,{value:a.locale,children:(0,r.jsxs)(`div`,{class:`cf-root`,dir:a.dir,"data-theme":Ot,"data-align":a.alignment,"data-display":`floating`,style:zn,children:[w&&d&&(0,r.jsx)(`div`,{class:`cf-theater-backdrop`,onClick:yn}),(0,r.jsxs)(`div`,{ref:D,class:`cf-panel ${d?`is-open`:``} ${C?`cf-panel--call`:``} ${Xn?`cf-panel--voice-connecting`:``} ${w&&d?`cf-panel--theater`:``} ${nn||rn?`cf-panel--analytics-focus`:``}`,role:`dialog`,"aria-modal":`false`,"aria-label":`${u.chatName}: ${f?.agentName??u.assistantName}`,"aria-hidden":!d,children:[Qe&&d&&(0,r.jsx)(o,{state:Qe,onClose:it}),(0,r.jsxs)(`div`,{class:`cf-header`,children:[(0,r.jsx)(e.v,{persona:f,hideWhenMissing:!0}),(0,r.jsxs)(`div`,{class:`cf-header__meta`,children:[(0,r.jsx)(`div`,{class:`cf-header__name`,children:Kn}),(0,r.jsx)(`div`,{class:`cf-header__status ${g===`ai`&&f?.offline?`cf-header__status--offline`:``}`,children:(0,r.jsx)(`span`,{class:`cf-header__status-text`,children:qn})})]}),(0,r.jsxs)(`div`,{class:`cf-header__actions`,children:[We.length>0&&(0,r.jsx)(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":u.pastConversations,title:u.pastConversations,"aria-pressed":U,onClick:()=>W(e=>!e),children:(0,r.jsx)(e.M,{})}),Hn&&!y&&!G&&(0,r.jsx)(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":u.endChat,title:u.endChat,onClick:an,children:(0,r.jsx)(e.j,{})}),a.sound&&kt&&(0,r.jsx)(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":Et?u.unmuteSounds:u.muteSounds,"aria-pressed":Et,onClick:At,children:Et?(0,r.jsx)(e.N,{}):(0,r.jsx)(e.P,{})}),(0,r.jsx)(`button`,{type:`button`,class:`cf-header__btn cf-header__close`,"aria-label":u.closeChat,onClick:q,children:(0,r.jsx)(e.A,{})})]})]}),(0,r.jsx)(`div`,{class:`cf-panel__video`,children:nn?(0,r.jsx)(`div`,{class:`cf-analytics-focus`,role:`region`,"aria-label":u.expandedAnalyticsResult,children:(0,r.jsx)(e.E,{visualization:nn,expanded:!0,onFollowUp:e=>{vn(),_(e)},onClose:vn})}):rn?.visualization?(0,r.jsx)(`div`,{class:`cf-analytics-focus`,role:`region`,"aria-label":u.expandedAnalyticsResult,children:(0,r.jsx)(e.T,{visualization:rn.visualization,onClose:vn,onFollowUp:e=>{vn(),_(e)},onFeedback:G?void 0:Ee,transport:G?void 0:De(`widget`),onOpenSource:a.onOpenAnalyticsSource})}):!G&&Wn?(0,r.jsx)(e.y,{persona:f,starters:[],onPick:_,onFocusComposer:Dn,speaking:h,voiceState:L,replyPending:C&&m&&!h,pinned:!0,muted:ht,onToggleMute:On,onEndCall:Q,onTalkNow:Mn,showTalkNow:Nn,micLevel:_t,theaterMode:w,onToggleTheater:hn,onMinimize:q,audioDevices:St,selectedAudioDeviceId:wt,onSelectAudioDevice:jn,connectingOnly:Xn}):null}),!Xn&&(0,r.jsxs)(`div`,{class:`cf-panel__chat`,children:[a.preview&&(0,r.jsx)(`div`,{class:`cf-preview-banner`,children:u.previewBanner}),G&&(0,r.jsx)(`div`,{class:`cf-viewing-banner`,children:u.viewingPast}),(0,r.jsxs)(`div`,{class:`cf-body`,ref:Mt,role:`log`,onScroll:un,children:[Gn.map((t,n)=>(0,r.jsx)(e.C,{msg:t,persona:f,isLast:!G&&n===Gn.length-1,visitor:de,hasEmail:fe,lastQuestion:Vn,showActions:!G&&n===Gn.length-1&&!!(t.handoffOffered||t.selectedAction),onPickReply:Bn,onSubmitForm:Ne,onDemoSlots:ze,onConfirmHostedBooking:Pe,onRetry:we,ratable:!G&&Gn.slice(0,n).some(e=>e.role===`user`),onRate:Te,onExplanationFeedback:G?void 0:Ee,explanationTransport:G?void 0:De(`widget`),onOpenAnalyticsSource:a.onOpenAnalyticsSource,onExpandVisualization:G?void 0:gn,onExpandExplanation:G?void 0:_n,onOpenAttachment:nt,onReconnect:!G&&!y&&at&&t.id===Ze?ke:void 0},t.id)),!Hn&&!G&&(0,r.jsxs)(r.Fragment,{children:[Gn.length===0&&(0,r.jsx)(s,{name:f?.agentName??u.assistantName,greeting:f?.greeting}),(0,r.jsx)(e.w,{items:he,onPick:_}),(0,r.jsx)(e.x,{items:ge})]}),qt&&(0,r.jsxs)(`button`,{type:`button`,class:`cf-newmsg`,onClick:Y,children:[(0,r.jsx)(e.O,{}),u.newMessages]})]}),(0,r.jsx)(`div`,{class:`cf-sr-live`,"aria-live":`polite`,"aria-atomic":`true`,children:Pn}),m&&!y&&!G&&(0,r.jsx)(`div`,{class:`cf-stopbar`,children:(0,r.jsxs)(`button`,{type:`button`,class:`cf-stop`,onClick:ye,children:[(0,r.jsx)(e.F,{}),u.stop]})}),G?(0,r.jsx)(`div`,{class:`cf-ended`,children:(0,r.jsx)(`button`,{type:`button`,class:`cf-ended__btn`,onClick:Je,children:u.backToChat})}):y?(0,r.jsxs)(`div`,{class:`cf-ended`,children:[(0,r.jsx)(`p`,{class:`cf-ended__text`,children:u.conversationEnded}),a.csat&&Hn?$t?(0,r.jsx)(`p`,{class:`cf-ended__text`,children:u.feedbackThanks}):(0,r.jsxs)(`div`,{class:`cf-csat`,children:[(0,r.jsx)(`span`,{class:`cf-csat__q`,children:u.csatPrompt}),(0,r.jsx)(`button`,{type:`button`,class:`cf-csat__btn`,"aria-label":u.feedbackHelpful,onClick:()=>{Me(`up`),en(!0)},children:(0,r.jsx)(e.L,{})}),(0,r.jsx)(`button`,{type:`button`,class:`cf-csat__btn`,"aria-label":u.feedbackNotHelpful,onClick:()=>{Me(`down`),en(!0)},children:(0,r.jsx)(e.I,{})})]}):null,(0,r.jsx)(`button`,{type:`button`,class:`cf-ended__btn`,onClick:sn,children:u.startNewChat})]}):(0,r.jsxs)(r.Fragment,{children:[me?(0,r.jsx)(`div`,{class:`cf-live-typing`,"aria-live":`polite`,children:e.B(u.agentTyping,{name:me})}):null,Jn&&Jn.length>0&&(0,r.jsx)(`div`,{class:`cf-footer-actions`,children:(0,r.jsx)(e._,{actions:Jn,descriptors:Yn,visitor:de,onSubmitForm:Ne,onDemoSlots:ze,onConfirmHostedBooking:Pe,scheduler:f?.scheduler,translations:a.actionTranslations})},`footer-actions`),(0,r.jsx)(e.b,{draftStore:Zt,onSend:_,onSendGif:_e,onTyping:ve,disabled:m,allowVoice:Un,onTranscribe:Fe,gifEnabled:Be,onSearchGifs:Re,allowAttach:a.attachments,analyzeAttachments:!0,onUpload:Ie,onPreviewAttachment:rt},`composer`)]}),!y&&f?.disclaimerText&&(0,r.jsx)(`div`,{class:`cf-disclaimer`,children:f.disclaimerText}),(0,r.jsxs)(`div`,{class:`cf-footer`,children:[(0,r.jsx)(`button`,{type:`button`,class:`cf-footer__privacy`,"aria-label":u.clearDeviceData,onClick:()=>H(!0),children:u.privacyAndData}),(0,r.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),u.poweredBy,` `,(0,r.jsx)(`a`,{href:`https://accurix.tech/centrinfo`,target:`_blank`,rel:`noopener noreferrer`,children:`Centrinfo`})]})]}),z&&(0,r.jsx)(`div`,{class:`cf-confirm`,onClick:()=>B(!1),children:(0,r.jsxs)(`div`,{class:`cf-confirm__card`,role:`alertdialog`,"aria-modal":`true`,"aria-label":u.endChatConfirm,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>c(e,e.currentTarget,()=>B(!1)),children:[(0,r.jsx)(`div`,{class:`cf-confirm__title`,children:u.endChatConfirm}),(0,r.jsx)(`div`,{class:`cf-confirm__body`,children:u.endChatConfirmBody}),(0,r.jsxs)(`div`,{class:`cf-confirm__actions`,children:[(0,r.jsx)(`button`,{ref:Yt,type:`button`,class:`cf-confirm__btn cf-confirm__btn--cancel`,onClick:()=>B(!1),children:u.cancel}),(0,r.jsx)(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--danger`,onClick:on,children:u.endConfirmCta})]})]})},`confirm-end`),U&&(0,r.jsx)(`div`,{class:`cf-confirm`,onClick:()=>W(!1),children:(0,r.jsxs)(`div`,{class:`cf-history`,role:`dialog`,"aria-modal":`true`,"aria-label":u.pastConversations,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>c(e,e.currentTarget,()=>W(!1)),children:[(0,r.jsxs)(`div`,{class:`cf-history__head`,children:[(0,r.jsx)(`span`,{children:u.pastConversations}),(0,r.jsx)(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":u.closeHistory,onClick:()=>W(!1),children:(0,r.jsx)(e.A,{})})]}),(0,r.jsx)(`div`,{class:`cf-history__list`,children:We.map(e=>(0,r.jsxs)(`button`,{type:`button`,class:`cf-history__item ${e.sessionId===Ge?`is-active`:``}`,onClick:()=>{qe(e.sessionId),W(!1)},children:[(0,r.jsx)(`span`,{class:`cf-history__title`,children:e.title}),(0,r.jsxs)(`span`,{class:`cf-history__meta`,children:[new Date(e.ts).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),e.ended?` · ${u.historyEnded}`:``]})]},e.sessionId))}),(0,r.jsx)(`div`,{class:`cf-history__footer`,children:(0,r.jsx)(`button`,{type:`button`,class:`cf-history__clear`,onClick:()=>{W(!1),H(!0)},children:u.clearDeviceData})})]})},`history`),V&&(0,r.jsx)(`div`,{class:`cf-confirm`,onClick:()=>H(!1),children:(0,r.jsxs)(`div`,{class:`cf-confirm__card`,role:`alertdialog`,"aria-modal":`true`,"aria-label":u.clearDeviceData,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>c(e,e.currentTarget,()=>H(!1)),children:[(0,r.jsx)(`div`,{class:`cf-confirm__title`,children:u.clearDeviceData}),(0,r.jsx)(`div`,{class:`cf-confirm__body`,children:u.clearDeviceDataBody}),(0,r.jsxs)(`div`,{class:`cf-confirm__actions`,children:[(0,r.jsx)(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--cancel`,onClick:()=>H(!1),children:u.cancel}),(0,r.jsx)(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--danger`,onClick:()=>{H(!1),Ye()},children:u.clearDeviceDataCta})]})]})},`confirm-clear`)]}),C&&!d?(0,r.jsx)(e.S,{persona:f,voiceState:L,muted:ht,onToggleMute:On,onEndCall:Q,micLevel:_t,onExpand:K}):w&&d?null:!a.hideDefaultLauncher&&(0,r.jsxs)(`button`,{ref:jt,type:`button`,class:`cf-launcher`,"aria-label":d?u.closeChat:x>0?`${u.openChat}. ${x===1?u.unreadMessage:e.B(u.unreadMessages,{count:String(x)})}`:u.openChat,"aria-expanded":d,onClick:J,children:[a.launcherIcon?(0,r.jsx)(`img`,{class:`cf-launcher__img`,src:a.launcherIcon,alt:``}):(0,r.jsx)(e.k,{}),!d&&x>0&&(0,r.jsx)(`span`,{class:`cf-launcher__badge`,"aria-hidden":`true`,children:x>99?`99+`:x})]})]})})})},p=`centrinfo-widget`;var m=class extends HTMLElement{constructor(...t){super(...t),e.Z(this,`controls`,null),e.Z(this,`composerDraftStore`,{value:``})}mountWith(n){let i=e.n(n),a=this.shadowRoot??this.attachShadow({mode:`open`});if(this.style.zIndex=String(i.zIndex),`adoptedStyleSheets`in Document.prototype&&typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`){let t=new CSSStyleSheet;t.replaceSync(e.t),a.adoptedStyleSheets=[t]}else{let t=document.createElement(`style`);i.styleNonce&&(t.nonce=i.styleNonce),t.textContent=e.t,a.appendChild(t)}(0,t.render)((0,r.jsx)(f,{transport:e.X(i),config:i,bindControls:e=>this.controls=e,composerDraftStore:this.composerDraftStore}),a)}open(){this.controls?.open()}close(){this.controls?.close()}toggle(){this.controls?.toggle()}identify(e){this.controls?.identify(e)}clear(){this.controls?.startNew()}shutdown(){this.controls?.shutdown()}unmount(){this.shadowRoot&&(0,t.render)(null,this.shadowRoot)}};typeof customElements<`u`&&!customElements.get(p)&&customElements.define(p,m);const h=(e,t=document.body)=>{if(typeof document>`u`)throw Error(`[centrinfo-widget] createWidget must run in a browser.`);let n=document.createElement(p);return n.style.pointerEvents=`none`,n.style.position=`fixed`,n.style.inset=`0`,n.style.width=`0`,n.style.height=`0`,t.appendChild(n),n.mountWith(e),{open:()=>n.open(),close:()=>n.close(),toggle:()=>n.toggle(),show:()=>n.open(),hide:()=>n.close(),identify:e=>n.identify(e),update:e=>n.identify(e),clear:()=>n.clear(),shutdown:()=>n.shutdown(),logout:()=>n.shutdown(),destroy:()=>{n.unmount(),n.remove()}}},de=e=>h(e);let fe=null;const g=e=>{fe?.destroy();let t=de(e);return fe=t,t},pe={init:g,createWidget:de};exports.Centrinfo=pe,exports.createWidget=de,exports.init=g;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { d as WidgetHandle, f as WidgetThemeTokens, p as WidgetUser, u as WidgetConfig, w as WidgetStrings } from "./types-CYFMH8yg.cjs";
1
+ import { d as WidgetHandle, f as WidgetThemeTokens, p as WidgetUser, u as WidgetConfig, w as WidgetStrings } from "./types-BuoTcoZu.cjs";
2
2
 
3
3
  //#region src/mount.d.ts
4
4
  /** Create + mount the floating public messenger. */
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { d as WidgetHandle, f as WidgetThemeTokens, p as WidgetUser, u as WidgetConfig, w as WidgetStrings } from "./types-D82dr33R.mjs";
1
+ import { d as WidgetHandle, f as WidgetThemeTokens, p as WidgetUser, u as WidgetConfig, w as WidgetStrings } from "./types-3zpBBhPI.mjs";
2
2
 
3
3
  //#region src/mount.d.ts
4
4
  /** Create + mount the floating public messenger. */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { d as WidgetHandle, f as WidgetThemeTokens, p as WidgetUser, u as WidgetConfig, w as WidgetStrings } from "./types-D82dr33R.mjs";
1
+ import { d as WidgetHandle, f as WidgetThemeTokens, p as WidgetUser, u as WidgetConfig, w as WidgetStrings } from "./types-3zpBBhPI.mjs";
2
2
 
3
3
  //#region src/mount.d.ts
4
4
  /** Create + mount the floating public messenger. */
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{A as e,B as t,C as n,E as r,F as i,H as a,I as o,L as ee,M as te,N as ne,O as re,P as ie,R as ae,S as oe,T as se,U as ce,V as le,X as s,Z as ue,_ as de,a as fe,b as pe,d as me,h as he,i as ge,j as _e,k as ve,m as ye,n as be,p as xe,r as Se,t as c,u as Ce,v as we,w as Te,x as Ee,y as De,z as Oe}from"./styles-DwSTSmZb.mjs";import{render as l}from"preact";import{useCallback as u,useEffect as d,useLayoutEffect as ke,useRef as f,useState as p}from"preact/hooks";import{Fragment as Ae,jsx as m,jsxs as h}from"preact/jsx-runtime";const je=(e,t)=>{if(typeof MutationObserver>`u`)return()=>void 0;let n=e.scrollHeight,r=0,i=()=>{r=0;let i=e.scrollHeight,a=i>n,o=t.isAtBottom();n=i,a&&(o?(e.scrollTop=e.scrollHeight,t.onFollow?.()):t.onUnseen?.())},a=new MutationObserver(()=>{r||(r=typeof requestAnimationFrame==`function`?requestAnimationFrame(i):setTimeout(i,0))});return a.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{a.disconnect(),r&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r)}},Me=e=>e.startsWith(`image/`)?`image`:e===`application/pdf`?`pdf`:`other`,Ne=({state:e,onClose:n})=>{let r=le(),i=f(null);d(()=>{i.current?.focus();let e=e=>{e.key===`Escape`&&(e.stopPropagation(),n())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[n]);let a=e.status===`ready`?Me(e.mimeType):`other`;return m(`div`,{class:`cf-preview`,role:`dialog`,"aria-modal":`true`,"aria-label":t(r.attachPreviewTitle,{name:e.name}),onClick:e=>{e.target===e.currentTarget&&n()},children:h(`div`,{class:`cf-preview__frame`,children:[h(`div`,{class:`cf-preview__bar`,children:[m(`span`,{class:`cf-preview__name`,title:e.name,children:e.name}),e.status===`ready`&&m(`a`,{class:`cf-preview__btn`,href:e.url,download:e.name,children:r.attachDownload}),m(`button`,{ref:i,type:`button`,class:`cf-preview__btn cf-preview__close`,"aria-label":r.attachPreviewClose,onClick:n,children:`✕`})]}),h(`div`,{class:`cf-preview__body`,children:[e.status===`loading`&&m(`p`,{class:`cf-preview__note`,children:r.attachPreviewLoading}),e.status===`error`&&m(`p`,{class:`cf-preview__note`,children:r.attachPreviewFailed}),e.status===`ready`&&a===`image`&&m(`img`,{class:`cf-preview__image`,src:e.url,alt:e.name}),e.status===`ready`&&a===`pdf`&&m(`iframe`,{class:`cf-preview__pdf`,src:e.url,title:e.name}),e.status===`ready`&&a===`other`&&m(`p`,{class:`cf-preview__note`,children:r.attachPreviewUnsupported})]})]})})},Pe=({name:e,greeting:n})=>{let r=le();return h(`section`,{class:`cf-empty-welcome`,"aria-label":t(r.welcomeLabel,{name:e}),children:[m(`span`,{class:`cf-empty-welcome__eyebrow`,children:r.welcomeEyebrow}),m(`h2`,{children:e}),m(`p`,{children:n||r.welcomePrompt})]})},Fe=(e,t,n)=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n();return}if(e.key!==`Tab`)return;let r=Array.from(t.querySelectorAll(`button, [href], textarea, input, select, [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`&&e.tabIndex>=0);if(r.length===0)return;let i=t.getRootNode(),a=e.composedPath()[0],o=a instanceof HTMLElement?a:`activeElement`in i?i.activeElement:document.activeElement,ee=r[0],te=r[r.length-1];e.shiftKey&&(o===ee||!t.contains(o))?(e.preventDefault(),e.stopPropagation(),te.focus()):!e.shiftKey&&(o===te||!t.contains(o))&&(e.preventDefault(),e.stopPropagation(),ee.focus())},g=new Map,_=e=>{if(!e||typeof document>`u`||typeof CanvasRenderingContext2D>`u`)return;let t=document.createElement(`canvas`).getContext(`2d`);if(!t)return;t.fillStyle=`#010203`,t.fillStyle=e;let n=t.fillStyle;if(n===`#010203`&&e.trim().toLowerCase()!==`#010203`)return;let r=n.match(/^#([\da-f]{6})$/i)?.[1];if(r)return[Number.parseInt(r.slice(0,2),16),Number.parseInt(r.slice(2,4),16),Number.parseInt(r.slice(4,6),16),1];let i=n.match(/^rgba?\(([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:[, /]+([\d.]+))?\)$/i);if(!i)return;let a=i.slice(1,5).map(Number);if(!a.some(e=>!Number.isFinite(e)))return[a[0],a[1],a[2],a[3]??1]},Ie=(e,t=`#ffffff`)=>{let n=`${e??``}|${t}`;if(g.has(n))return g.get(n);let r=_(e),i=_(t)??[255,255,255,1];if(!r){g.set(n,void 0);return}let a=r[3],o=r.slice(0,3).map((e,t)=>e*a+i[t]*(1-a)).map(e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}),ee=o[0]*.2126+o[1]*.7152+o[2]*.0722,te=1.05/(ee+.05)>=(ee+.05)/.059?`#ffffff`:`#0f1e2a`;return g.set(n,te),te},Le=e=>{let[t,n]=p(`light`);return d(()=>{if(e!==`auto`||typeof matchMedia>`u`)return;let t=matchMedia(`(prefers-color-scheme: dark)`),r=()=>n(t.matches?`dark`:`light`);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),e===`auto`?t:e},Re={end:`end the call`,mute:`mute your microphone`,minimize:`minimize the chat`,expand:`expand the view`,shrink:`exit the expanded view`},ze=e=>e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s']/gu,` `).replace(/\s+/g,` `).trim(),v=[{action:`shrink`,re:/\b(?:exit|leave|quit|close)\b[\s\w]*\b(?:full ?screen|expanded|theat(?:er|re))\b|\bshrink\b|\bsmaller view\b/},{action:`end`,re:/\b(?:end|close|stop|finish|hang ?up|quit|exit)\b[\s\w]*\b(?:call|chat|conversation|convo|session|talking)\b|\bhang ?up\b|\bgood ?bye\b|^bye(?: bye)?$/},{action:`mute`,re:/\bmute\b|\bstop listening\b/},{action:`minimize`,re:/\bminimi[sz]e\b|\bhide\b[\s\w]*\b(?:chat|call|window|widget)\b/},{action:`expand`,re:/\bexpand\b|\bmaximi[sz]e\b|\bfull ?screen\b|\btheat(?:er|re) mode\b|\bbigger view\b/}],Be=/^(?:yes|yeah|yep|yup|sure|correct|confirm|affirmative|go ahead|do it|please do|ok(?:ay)?)\b/,Ve=/^(?:no|nope|nah|cancel|never ?mind|don'?t|stop)\b/,He=/^(?:end|close|stop|finish|hang ?up|quit|exit|bye|good ?bye)\b/,Ue=e=>{let t=ze(e);if(!t)return null;for(let{action:e,re:n}of v)if(n.test(t)){let n=t.split(` `).length;return{action:e,confident:e===`end`?n<=10:n<=6}}return null},We=e=>`I didn't catch yes or no. Say yes to ${Re[e]}, or no to keep talking.`,y=({transport:le,config:s,bindControls:ue,composerDraftStore:be})=>{let c=s.strings,[l,Me]=p(s.openByDefault),{persona:g,messages:_,sending:v,assistantSpeaking:y,visitor:Ge,hasEmail:Ke,liveMode:b,assignedAgentName:qe,agentTypingName:Je,starters:Ye,featuredLinks:Xe,send:x,sendGif:Ze,notifyTyping:Qe,stop:$e,amend:et,hold:tt,resumeHeld:nt,duckSpeaking:rt,retry:it,rateMessage:at,rateExplanation:ot,explanationTransport:st,injectAssistant:ct,reconnectSupport:lt,appendUserDraft:ut,patchMessage:S,removeMessage:dt,submitCsat:ft,submitForm:pt,confirmHostedBooking:mt,transcribe:ht,uploadAttachment:gt,loadAttachment:_t,searchGifs:vt,demoSlots:yt,gifEnabled:bt,identify:xt,ended:C,endConversation:St,startNew:Ct,history:wt,viewingSessionId:Tt,viewMessages:Et,openConversation:Dt,closeHistoryView:Ot,shutdown:kt,stopSpeaking:w,speakAssistantText:At}=fe(le,s,l),jt=ge(_,b),[Mt,Nt]=p(null),Pt=f(0),Ft=u((e,t,n)=>{n===Pt.current&&Nt({status:`ready`,name:t,url:URL.createObjectURL(e),mimeType:e.type||`application/octet-stream`})},[]),It=u((e,t,n)=>{let r=t.name,i=++Pt.current;Nt({status:`loading`,name:r}),_t(e,t,n).then(e=>Ft(e,r,i),()=>{i===Pt.current&&Nt({status:`error`,name:r})})},[_t,Ft]),Lt=u((e,t)=>Ft(e,t,++Pt.current),[Ft]),Rt=u(()=>{Pt.current+=1,Nt(null)},[]);d(()=>()=>{Mt?.status===`ready`&&URL.revokeObjectURL(Mt.url)},[Mt]);let zt=!!Se(g?.actions),[T,Bt]=p(0),[E,Vt]=p({mic:`off`,processing:!1}),[Ht,Ut]=p(null),[Wt,Gt]=p(!1),[D,Kt]=p(!1),[qt,Jt]=p(!1),[Yt,Xt]=p(!1),[Zt,Qt]=p(0),[O,k]=p(!1),[$t,A]=p(null),[en,tn]=p(null),[nn,rn]=p([]),[an,on]=p(``),[sn,cn]=p(()=>{try{return localStorage.getItem(`centrinfo:muted`)===`1`}catch{return!1}}),ln=Le(s.theme),un=g?.soundEnabled??!0;d(()=>{me(s.sound&&un&&!sn)},[s.sound,un,sn]);let dn=u(()=>{cn(e=>{let t=!e;try{localStorage.setItem(`centrinfo:muted`,t?`1`:`0`)}catch{}return t})},[]),j=f(null),fn=f(null),pn=f(null),mn=f(0),M=f(!1),N=f(!1),P=f(null),F=f(0),hn=f(void 0),gn=f(0),_n=f(null),vn=f(!1),I=f(null),L=f(``),yn=f(()=>{}),bn=f(``),xn=f(v),Sn=f(x);Sn.current=x;let Cn=f(et);Cn.current=et;let wn=f(ht);wn.current=ht;let R=f(!1),z=f(!1),Tn=f(``);Tn.current=[..._].reverse().find(e=>e.role===`assistant`)?.content??``;let En=f(y);xn.current=v,En.current=y;let B=D?Wt?`timeout`:Yt||E.mic===`muted`?`muted`:E.mic===`unavailable`?E.reason===`permission-denied`||E.reason===`unsupported`?`denied`:`unavailable`:E.mic===`off`||E.mic===`starting`?`connecting`:E.mic===`hearing`?`hearing`:y?`speaking`:Ht??(E.processing||v?`processing`:`listening`):`idle`,[Dn,On]=p(!0),[kn,V]=p(!1),An=f(0),[H,jn]=p(!1),[U,W]=p(!1),Mn=f(null),[G,K]=p(!1),Nn=f({value:``}),Pn=be??Nn.current,Fn=f({confirmEnd:H,confirmClear:U,showHistory:G});Fn.current={confirmEnd:H,confirmClear:U,showHistory:G};let[In,Ln]=p(!1),q=!!Tt,Rn=q?Et:_,zn=Rn.find(e=>e.id===$t&&e.visualization)?.visualization,Bn=Rn.find(e=>e.id===en&&e.visualization);d(()=>{!en||Bn||(tn(null),k(!1))},[en,Bn]),d(()=>{!$t||zn||(A(null),k(!1))},[zn,$t]);let Vn=u(()=>{Me(!0),Bt(0),Ce(`open`),s.onOpen?.(),s.onShow?.()},[s]),J=u(()=>{Me(!1),k(!1),A(null),s.onClose?.(),s.onHide?.(),fn.current?.focus()},[s]),Hn=u(()=>l?J():Vn(),[l,Vn,J]),Un=u(()=>jn(!0),[]),Wn=u(()=>{St(),jn(!1)},[St]),Gn=u(()=>{Ct(),V(!1),On(!0)},[Ct]);d(()=>{H&&Mn.current?.focus()},[H]),d(()=>{ue({open:Vn,close:J,toggle:Hn,identify:xt,startNew:Ct,endConversation:St,shutdown:kt})},[ue,Vn,J,Hn,xt,Ct,St,kt]),d(()=>{let e=_.filter(e=>e.role===`assistant`&&!e.pending).length;if(l){mn.current=e;return}e>mn.current&&Bt(e-mn.current)},[_,l]),d(()=>{s.onUnreadChange?.(T)},[T,s]),d(()=>{let e=s.sessionDurationMinutes;if(!e||e<=0)return;let t=setTimeout(()=>kt(),e*60*1e3);return()=>clearTimeout(t)},[s.sessionDurationMinutes,_,l,kt]),d(()=>{let e=s.customLauncherSelector;if(!e||typeof document>`u`)return;let t=[];try{t=Array.from(document.querySelectorAll(e))}catch{return}let n=e=>{e.preventDefault(),Hn()};return t.forEach(e=>e.addEventListener(`click`,n)),()=>t.forEach(e=>e.removeEventListener(`click`,n))},[s.customLauncherSelector,Hn]);let Kn=f(!1);d(()=>{let e=s.proactiveMessage?.trim();if(!e||Kn.current)return;let t=s.proactiveOnPaths??[],n=typeof location<`u`?location.pathname:``;if(t.length>0&&!t.some(e=>n.includes(e)))return;let r=`centrinfo:proactive:${s.token.slice(0,12)}`;try{if(sessionStorage.getItem(r)===`1`)return}catch{}let i=setTimeout(()=>{if(!(l||C||_.some(e=>e.role===`user`))){Kn.current=!0;try{sessionStorage.setItem(r,`1`)}catch{}ct(e),Vn()}},Math.max(0,s.proactiveDelaySeconds)*1e3);return()=>clearTimeout(i)},[s.proactiveMessage]),d(()=>{let e=pn.current;if(!l||!e)return;let t=_[_.length-1],n=Date.now()<An.current;t?.role===`user`||Dn||n?(requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight}),V(!1),n&&On(!0)):V(!0)},[_,l,v,Dn]);let qn=f(!0);qn.current=Dn,d(()=>{let e=pn.current;if(!(!l||!e))return je(e,{isAtBottom:()=>qn.current,onUnseen:()=>V(!0)})},[l,q]);let Jn=u(()=>{let e=pn.current;if(!e)return;if(M.current&&!q){On(!0),V(!1);return}let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;On(t),t&&V(!1)},[q]),Y=u(()=>{let e=pn.current;e&&(e.scrollTop=e.scrollHeight),V(!1),On(!0)},[]),Yn=u(()=>{An.current=Date.now()+3e3,requestAnimationFrame(Y)},[Y]);d(()=>{if(!l||q||!D||B===`connecting`)return;An.current=Date.now()+6e4,Y();let e=requestAnimationFrame(()=>{Y(),requestAnimationFrame(Y)}),t=[80,180,360].map(e=>window.setTimeout(Y,e));return()=>{cancelAnimationFrame(e),t.forEach(e=>window.clearTimeout(e))}},[y,_,l,Y,v,D,q,B]);let Xn=u(()=>{j.current?.querySelector(`.cf-textarea`)?.focus()},[]),Zn=u((e,t)=>{Ut(e),hn.current&&window.clearTimeout(hn.current),hn.current=window.setTimeout(()=>Ut(null),3e3),t&&!N.current&&At(t)},[At]),Qn=u(e=>{let t=I.current;if(t)return t;Yn();let n=ut(e);return I.current=n,S(n,{content:L.current||e,pending:!0,streaming:!1}),n},[ut,Yn,S]),X=u(()=>{let e=I.current;if(e){if(L.current){S(e,{content:L.current,pending:!0});return}I.current=null,dt(e)}},[S,dt]),Z=u(()=>{z.current&&(z.current=!1,rt(!1)),R.current&&(R.current=!1,nt())},[rt,nt]),Q=u(()=>{M.current=!1,P.current?.stop(`call-ended`),P.current=null,R.current=!1,z.current=!1,N.current=!1,_n.current=null,vn.current=!1;let e=I.current;I.current=null,L.current=``,e&&dt(e),hn.current&&window.clearTimeout(hn.current),Ut(null),Gt(!1),Vt({mic:`off`,processing:!1}),Qt(0),Kt(!1),Jt(!1),Xt(!1),k(!1),A(null),w()},[dt,w]),$n=u(()=>{O&&A(null),k(!O)},[O]),er=u(e=>{A(e),k(!0)},[]),tr=u(e=>{tn(e),k(!0)},[]),nr=u(()=>{let e=$t,t=en;A(null),tn(null),k(!1),window.requestAnimationFrame(()=>{(t?j.current?.querySelector(`[data-explanation-message="${t}"]`)?.querySelector(`[data-testid="analytics-explanation-expand"]`):Array.from(j.current?.querySelectorAll(`[data-visualization-message]`)??[]).find(t=>t.dataset.visualizationMessage===e))?.focus()})},[$t,en]),rr=u(()=>{A(null),tn(null),k(!1)},[]),ir=u((e,t,n=!1)=>{if(Yn(),t&&(S(t,{content:e,pending:!1,streaming:!1}),I.current===t&&(I.current=null)),L.current=``,n){w(),Cn.current(e,{forceVoicePlayback:!0,userMessageId:t});return}M.current&&(tt()?Cn.current(e,{forceVoicePlayback:!0,userMessageId:t}):Sn.current(e,{forceVoicePlayback:!0,userMessageId:t}))},[Yn,tt,S,w]),$=u(e=>{ct(e),At(e)},[ct,At]),ar=u(()=>{if(F.current=Date.now(),Ut(null),En.current){z.current=!0,rt(!0);return}R.current||(R.current=tt()),Qn(`Listening...`)},[rt,Qn,tt]),or=u(e=>{let t=I.current;!t||z.current||S(t,{content:`${[L.current,e].filter(Boolean).join(` `)} ...`,pending:!0})},[S]),sr=u(e=>{F.current=Date.now();let t=[L.current,e.text].map(e=>e.trim()).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();if((z.current||e.overlappedOutput)&&ce(e.text,Tn.current)){X(),Z();return}if(!t||xe(t)||ye(t)){let e=z.current||R.current;X(),Z(),e||Zn(`misunderstood`);return}z.current&&(z.current=!1,$e(),w());let n=_n.current;if(n){L.current=``,X();let e=ze(t);if(Be.test(e)||n===`end`&&He.test(e)){_n.current=null,yn.current(n);return}if(Ve.test(e)){_n.current=null,$(`Okay, never mind — what would you like to know?`);return}$(We(n));return}let r=Ue(t);if(r){if(L.current=``,X(),Z(),r.confident){yn.current(r.action);return}_n.current=r.action,$(`Just to confirm — you want me to ${Re[r.action]}? Please say yes or no.`);return}let i=Qn(t);S(i,{content:t,pending:!0});let a=R.current;R.current=!1,ir(t,i,a)},[Qn,S,Z,ir,X,Zn,$,$e,w]),cr=u(e=>{F.current=Date.now();let t=z.current||R.current;if(X(),Z(),!(t||e.overlappedOutput||e.reason===`too-short`)){if(e.reason===`transcribe-failed`){Zn(`misunderstood`,`I couldn't transcribe that. Please try again, or type your question.`);return}Zn(`noise`)}},[Z,X,Zn]),lr=f({speechStart:ar,partial:or,turn:sr,noise:cr});lr.current={speechStart:ar,partial:or,turn:sr,noise:cr};let ur=u(()=>{navigator.mediaDevices?.enumerateDevices().then(e=>{rn(e.filter(e=>e.kind===`audioinput`).map((e,t)=>({deviceId:e.deviceId,label:e.label||`Microphone ${t+1}`})))}).catch(()=>{})},[]),dr=u(()=>{if(M.current){Q();return}if(Xn(),!g?.allowVoiceInput||!g.talkbackMode||g.talkbackMode===`text`||xn.current||C||q)return;F.current=Date.now(),N.current=!1,M.current=!0,Xt(!1),Kt(!0),Jt(!1),Gt(!1);let e=!1,t=new a({deviceId:bn.current||void 0,transcribe:async({audio:e,mimeType:t,durationSeconds:n})=>{let r=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||void 0;return he(await wn.current(e,t,r,n))},listener:{state:t=>{Vt(t),t.mic!==`starting`&&t.mic!==`off`&&Jt(!0),!e&&t.mic===`listening`&&(e=!0,ur())},speechStart:()=>lr.current.speechStart(),partial:({text:e})=>lr.current.partial(e),turn:e=>lr.current.turn(e),noise:e=>lr.current.noise(e),level:e=>{let t=performance.now();t-gn.current<90||(gn.current=t,Qt(e))}}});P.current=t,t.setOutputActive(En.current),t.start()},[Q,C,Xn,g,ur,q]),fr=u(()=>{let e=!N.current;N.current=e,Xt(e),P.current?.setMuted(e),e?(L.current=``,X(),Z()):F.current=Date.now()},[Z,X]),pr=u(e=>{switch(F.current=Date.now(),e){case`end`:vn.current=!0,$(`Okay — ending our call now. Goodbye!`),window.setTimeout(()=>{vn.current&&(vn.current=!1,Q())},2e3);break;case`mute`:N.current||fr(),$(`Muted. Tap the mic button when you want me to listen again.`);break;case`minimize`:J(),$(`Minimized — I'm still listening. Tap the call pill to bring the chat back.`);break;case`expand`:k(!0),$(`Sure — expanding the view.`);break;case`shrink`:A(null),k(!1),$(`Okay — back to the smaller view.`);break}},[J,Q,$,fr]);d(()=>{yn.current=pr},[pr]);let mr=f(!1);d(()=>{mr.current&&!y&&vn.current&&(vn.current=!1,Q()),mr.current=y},[y,Q]);let hr=u(e=>{bn.current=e,on(e),P.current?.selectDevice(e||void 0)},[]),gr=u(()=>{!M.current||N.current||(z.current=!1,R.current=!1,$e(),w(),F.current=Date.now())},[$e,w]);d(()=>{P.current?.setOutputActive(y),F.current=Date.now()},[y]),d(()=>{if(B!==`denied`)return;let e=window.setTimeout(()=>Q(),3500);return()=>window.clearTimeout(e)},[Q,B]),d(()=>{if(!D)return;let e=window.setInterval(()=>{let e=P.current;!e||N.current||xn.current||En.current||e.snapshot.mic===`hearing`||e.snapshot.processing||Date.now()-F.current<6e4||(P.current?.log.add(`call-timeout`),Gt(!0),window.setTimeout(()=>Q(),2400))},5e3);return()=>window.clearInterval(e)},[Q,D]);let _r=D&&!Yt&&(v||y);d(()=>()=>Q(),[Q]);let[vr,yr]=p(``),br=f(!1);d(()=>{if(br.current&&!v){let e=[..._].reverse().find(e=>e.role===`assistant`&&!e.streaming&&!e.pending&&e.content);e&&yr(e.content)}br.current=v},[v,_]),ke(()=>{if(!l)return;let e=j.current,t=H||U?e?.querySelector(`.cf-confirm__card`):G?e?.querySelector(`.cf-history`):null;if(!t)return;let n=t.getRootNode(),r=`activeElement`in n?n.activeElement:document.activeElement;(!r||!t.contains(r))&&t.querySelector(`button, [href], textarea, input, [tabindex]:not([tabindex="-1"])`)?.focus()},[U,H,l,G]),d(()=>{if(!l)return;let e=j.current,t=H||U?e?.querySelector(`.cf-confirm__card`):G?e?.querySelector(`.cf-history`):null,n=e?.querySelectorAll(`:scope > .cf-header, :scope > .cf-panel__video, :scope > .cf-panel__chat`);n?.forEach(e=>{t?(e.setAttribute(`inert`,``),e.setAttribute(`aria-hidden`,`true`)):(e.removeAttribute(`inert`),e.removeAttribute(`aria-hidden`))}),t||requestAnimationFrame(()=>e?.querySelector(`.cf-textarea`)?.focus());let r=e=>{if(e.key===`Escape`){e.preventDefault();let t=Fn.current;if(t.confirmEnd){jn(!1);return}if(t.confirmClear){W(!1);return}if(t.showHistory){K(!1);return}J();return}if(e.key!==`Tab`||!t)return;let n=t.querySelectorAll(`button, [href], textarea, input, [tabindex]:not([tabindex="-1"])`),r=Array.from(n).filter(e=>!e.hasAttribute(`disabled`));if(r.length===0)return;let i=r[0],a=r[r.length-1],o=t.getRootNode()instanceof ShadowRoot?t.getRootNode().activeElement:document.activeElement;e.shiftKey&&o===i?(e.preventDefault(),a.focus()):!e.shiftKey&&o===a&&(e.preventDefault(),i.focus())};return e?.addEventListener(`keydown`,r),()=>{e?.removeEventListener(`keydown`,r),n?.forEach(e=>{e.removeAttribute(`inert`),e.removeAttribute(`aria-hidden`)})}},[l,J,H,U,G]),d(()=>{let e=j.current;e&&(l?e.removeAttribute(`inert`):e.setAttribute(`inert`,``))},[l]);let xr=s.accentColor??s.themeTokens?.accent??g?.accentColor,Sr=s.themeTokens?.accentText??Ie(xr,s.themeTokens?.background??(ln===`dark`?`#0f1c27`:`#ffffff`)),Cr={zIndex:s.zIndex,"--cf-h-pad":`${s.horizontalPadding}px`,"--cf-v-pad":`${s.verticalPadding}px`,...Sr?{"--cf-accent-ink":Sr}:{},...s.themeTokens?.accentStrong?{"--cf-accent-2":s.themeTokens.accentStrong}:{},...s.themeTokens?.background?{"--cf-bg":s.themeTokens.background}:{},...s.themeTokens?.surface?{"--cf-surface":s.themeTokens.surface}:{},...s.themeTokens?.surfaceMuted?{"--cf-surface-2":s.themeTokens.surfaceMuted}:{},...s.themeTokens?.text?{"--cf-text":s.themeTokens.text}:{},...s.themeTokens?.mutedText?{"--cf-muted":s.themeTokens.mutedText}:{},...s.themeTokens?.border?{"--cf-border":s.themeTokens.border}:{},...s.themeTokens?.shadow?{"--cf-shadow":s.themeTokens.shadow}:{},...s.themeTokens?.radius?{"--cf-radius":s.themeTokens.radius}:{},...s.themeTokens?.fontFamily?{"--cf-font":s.themeTokens.fontFamily}:{},...s.themeTokens?.success?{"--cf-success":s.themeTokens.success}:{},...s.themeTokens?.warning?{"--cf-warning":s.themeTokens.warning}:{},...s.themeTokens?.danger?{"--cf-danger":s.themeTokens.danger}:{},...xr?{"--cf-accent":xr,"--cf-accent-2":s.themeTokens?.accentStrong??`color-mix(in oklab, ${xr} 76%, #14141f)`}:{}},wr=e=>x(e),Tr=[..._].reverse().find(e=>e.role===`user`&&e.content.trim())?.content??``,Er=_.some(e=>e.role===`user`),Dr=!!(g?.allowVoiceInput&&g?.talkbackMode&&g.talkbackMode!==`text`),Or=Dr,kr=!q&&Or&&!Er?Rn.filter((e,t)=>!(t===0&&e.role===`assistant`)):Rn,Ar=b===`human`&&qe?qe:g?.agentName??c.chatName,jr=b===`human`?c.liveSupport:b===`queued`?c.waitingForTeam:g?.offline?c.statusOffline:c.statusOnline,Mr=!C&&!q?g?.availableActions:void 0,Nr=!C&&!q?g?.actions:void 0,Pr=D&&!qt&&B===`connecting`&&!q;return m(Oe,{value:c,children:m(ae,{value:s.locale,children:h(`div`,{class:`cf-root`,dir:s.dir,"data-theme":ln,"data-align":s.alignment,"data-display":`floating`,style:Cr,children:[O&&l&&m(`div`,{class:`cf-theater-backdrop`,onClick:rr}),h(`div`,{ref:j,class:`cf-panel ${l?`is-open`:``} ${D?`cf-panel--call`:``} ${Pr?`cf-panel--voice-connecting`:``} ${O&&l?`cf-panel--theater`:``} ${zn||Bn?`cf-panel--analytics-focus`:``}`,role:`dialog`,"aria-modal":`false`,"aria-label":`${c.chatName}: ${g?.agentName??c.assistantName}`,"aria-hidden":!l,children:[Mt&&l&&m(Ne,{state:Mt,onClose:Rt}),h(`div`,{class:`cf-header`,children:[m(we,{persona:g,hideWhenMissing:!0}),h(`div`,{class:`cf-header__meta`,children:[m(`div`,{class:`cf-header__name`,children:Ar}),m(`div`,{class:`cf-header__status ${b===`ai`&&g?.offline?`cf-header__status--offline`:``}`,children:m(`span`,{class:`cf-header__status-text`,children:jr})})]}),h(`div`,{class:`cf-header__actions`,children:[wt.length>0&&m(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":c.pastConversations,title:c.pastConversations,"aria-pressed":G,onClick:()=>K(e=>!e),children:m(te,{})}),Er&&!C&&!q&&m(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":c.endChat,title:c.endChat,onClick:Un,children:m(_e,{})}),s.sound&&un&&m(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":sn?c.unmuteSounds:c.muteSounds,"aria-pressed":sn,onClick:dn,children:m(sn?ne:ie,{})}),m(`button`,{type:`button`,class:`cf-header__btn cf-header__close`,"aria-label":c.closeChat,onClick:J,children:m(e,{})})]})]}),m(`div`,{class:`cf-panel__video`,children:zn?m(`div`,{class:`cf-analytics-focus`,role:`region`,"aria-label":c.expandedAnalyticsResult,children:m(r,{visualization:zn,expanded:!0,onFollowUp:e=>{nr(),x(e)},onClose:nr})}):Bn?.visualization?m(`div`,{class:`cf-analytics-focus`,role:`region`,"aria-label":c.expandedAnalyticsResult,children:m(se,{visualization:Bn.visualization,onClose:nr,onFollowUp:e=>{nr(),x(e)},onFeedback:q?void 0:ot,transport:q?void 0:st(`widget`),onOpenSource:s.onOpenAnalyticsSource})}):!q&&Or?m(De,{persona:g,starters:[],onPick:x,onFocusComposer:dr,speaking:y,voiceState:B,replyPending:D&&v&&!y,pinned:!0,muted:Yt,onToggleMute:fr,onEndCall:Q,onTalkNow:gr,showTalkNow:_r,micLevel:Zt,theaterMode:O,onToggleTheater:$n,onMinimize:J,audioDevices:nn,selectedAudioDeviceId:an,onSelectAudioDevice:hr,connectingOnly:Pr}):null}),!Pr&&h(`div`,{class:`cf-panel__chat`,children:[s.preview&&m(`div`,{class:`cf-preview-banner`,children:c.previewBanner}),q&&m(`div`,{class:`cf-viewing-banner`,children:c.viewingPast}),h(`div`,{class:`cf-body`,ref:pn,role:`log`,onScroll:Jn,children:[kr.map((e,t)=>m(n,{msg:e,persona:g,isLast:!q&&t===kr.length-1,visitor:Ge,hasEmail:Ke,lastQuestion:Tr,showActions:!q&&t===kr.length-1&&!!(e.handoffOffered||e.selectedAction),onPickReply:wr,onSubmitForm:pt,onDemoSlots:yt,onConfirmHostedBooking:mt,onRetry:it,ratable:!q&&kr.slice(0,t).some(e=>e.role===`user`),onRate:at,onExplanationFeedback:q?void 0:ot,explanationTransport:q?void 0:st(`widget`),onOpenAnalyticsSource:s.onOpenAnalyticsSource,onExpandVisualization:q?void 0:er,onExpandExplanation:q?void 0:tr,onOpenAttachment:It,onReconnect:!q&&!C&&zt&&e.id===jt?lt:void 0},e.id)),!Er&&!q&&h(Ae,{children:[kr.length===0&&m(Pe,{name:g?.agentName??c.assistantName,greeting:g?.greeting}),m(Te,{items:Ye,onPick:x}),m(Ee,{items:Xe})]}),kn&&h(`button`,{type:`button`,class:`cf-newmsg`,onClick:Y,children:[m(re,{}),c.newMessages]})]}),m(`div`,{class:`cf-sr-live`,"aria-live":`polite`,"aria-atomic":`true`,children:vr}),v&&!C&&!q&&m(`div`,{class:`cf-stopbar`,children:h(`button`,{type:`button`,class:`cf-stop`,onClick:$e,children:[m(i,{}),c.stop]})}),q?m(`div`,{class:`cf-ended`,children:m(`button`,{type:`button`,class:`cf-ended__btn`,onClick:Ot,children:c.backToChat})}):C?h(`div`,{class:`cf-ended`,children:[m(`p`,{class:`cf-ended__text`,children:c.conversationEnded}),s.csat&&Er?In?m(`p`,{class:`cf-ended__text`,children:c.feedbackThanks}):h(`div`,{class:`cf-csat`,children:[m(`span`,{class:`cf-csat__q`,children:c.csatPrompt}),m(`button`,{type:`button`,class:`cf-csat__btn`,"aria-label":c.feedbackHelpful,onClick:()=>{ft(`up`),Ln(!0)},children:m(ee,{})}),m(`button`,{type:`button`,class:`cf-csat__btn`,"aria-label":c.feedbackNotHelpful,onClick:()=>{ft(`down`),Ln(!0)},children:m(o,{})})]}):null,m(`button`,{type:`button`,class:`cf-ended__btn`,onClick:Gn,children:c.startNewChat})]}):h(Ae,{children:[Je?m(`div`,{class:`cf-live-typing`,"aria-live":`polite`,children:t(c.agentTyping,{name:Je})}):null,Mr&&Mr.length>0&&m(`div`,{class:`cf-footer-actions`,children:m(de,{actions:Mr,descriptors:Nr,visitor:Ge,onSubmitForm:pt,onDemoSlots:yt,onConfirmHostedBooking:mt,scheduler:g?.scheduler,translations:s.actionTranslations})},`footer-actions`),m(pe,{draftStore:Pn,onSend:x,onSendGif:Ze,onTyping:Qe,disabled:v,allowVoice:Dr,onTranscribe:ht,gifEnabled:bt,onSearchGifs:vt,allowAttach:s.attachments,analyzeAttachments:!0,onUpload:gt,onPreviewAttachment:Lt},`composer`)]}),!C&&g?.disclaimerText&&m(`div`,{class:`cf-disclaimer`,children:g.disclaimerText}),h(`div`,{class:`cf-footer`,children:[m(`button`,{type:`button`,class:`cf-footer__privacy`,"aria-label":c.clearDeviceData,onClick:()=>W(!0),children:c.privacyAndData}),m(`span`,{"aria-hidden":`true`,children:`·`}),c.poweredBy,` `,m(`a`,{href:`https://accurix.tech/centrinfo`,target:`_blank`,rel:`noopener noreferrer`,children:`Centrinfo`})]})]}),H&&m(`div`,{class:`cf-confirm`,onClick:()=>jn(!1),children:h(`div`,{class:`cf-confirm__card`,role:`alertdialog`,"aria-modal":`true`,"aria-label":c.endChatConfirm,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>Fe(e,e.currentTarget,()=>jn(!1)),children:[m(`div`,{class:`cf-confirm__title`,children:c.endChatConfirm}),m(`div`,{class:`cf-confirm__body`,children:c.endChatConfirmBody}),h(`div`,{class:`cf-confirm__actions`,children:[m(`button`,{ref:Mn,type:`button`,class:`cf-confirm__btn cf-confirm__btn--cancel`,onClick:()=>jn(!1),children:c.cancel}),m(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--danger`,onClick:Wn,children:c.endConfirmCta})]})]})},`confirm-end`),G&&m(`div`,{class:`cf-confirm`,onClick:()=>K(!1),children:h(`div`,{class:`cf-history`,role:`dialog`,"aria-modal":`true`,"aria-label":c.pastConversations,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>Fe(e,e.currentTarget,()=>K(!1)),children:[h(`div`,{class:`cf-history__head`,children:[m(`span`,{children:c.pastConversations}),m(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":c.closeHistory,onClick:()=>K(!1),children:m(e,{})})]}),m(`div`,{class:`cf-history__list`,children:wt.map(e=>h(`button`,{type:`button`,class:`cf-history__item ${e.sessionId===Tt?`is-active`:``}`,onClick:()=>{Dt(e.sessionId),K(!1)},children:[m(`span`,{class:`cf-history__title`,children:e.title}),h(`span`,{class:`cf-history__meta`,children:[new Date(e.ts).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),e.ended?` · ${c.historyEnded}`:``]})]},e.sessionId))}),m(`div`,{class:`cf-history__footer`,children:m(`button`,{type:`button`,class:`cf-history__clear`,onClick:()=>{K(!1),W(!0)},children:c.clearDeviceData})})]})},`history`),U&&m(`div`,{class:`cf-confirm`,onClick:()=>W(!1),children:h(`div`,{class:`cf-confirm__card`,role:`alertdialog`,"aria-modal":`true`,"aria-label":c.clearDeviceData,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>Fe(e,e.currentTarget,()=>W(!1)),children:[m(`div`,{class:`cf-confirm__title`,children:c.clearDeviceData}),m(`div`,{class:`cf-confirm__body`,children:c.clearDeviceDataBody}),h(`div`,{class:`cf-confirm__actions`,children:[m(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--cancel`,onClick:()=>W(!1),children:c.cancel}),m(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--danger`,onClick:()=>{W(!1),kt()},children:c.clearDeviceDataCta})]})]})},`confirm-clear`)]}),D&&!l?m(oe,{persona:g,voiceState:B,muted:Yt,onToggleMute:fr,onEndCall:Q,micLevel:Zt,onExpand:Vn}):O&&l?null:!s.hideDefaultLauncher&&h(`button`,{ref:fn,type:`button`,class:`cf-launcher`,"aria-label":l?c.closeChat:T>0?`${c.openChat}. ${T===1?c.unreadMessage:t(c.unreadMessages,{count:String(T)})}`:c.openChat,"aria-expanded":l,onClick:Hn,children:[s.launcherIcon?m(`img`,{class:`cf-launcher__img`,src:s.launcherIcon,alt:``}):m(ve,{}),!l&&T>0&&m(`span`,{class:`cf-launcher__badge`,"aria-hidden":`true`,children:T>99?`99+`:T})]})]})})})},Ge=`centrinfo-widget`;var Ke=class extends HTMLElement{constructor(...e){super(...e),ue(this,`controls`,null),ue(this,`composerDraftStore`,{value:``})}mountWith(e){let t=be(e),n=this.shadowRoot??this.attachShadow({mode:`open`});if(this.style.zIndex=String(t.zIndex),`adoptedStyleSheets`in Document.prototype&&typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`){let e=new CSSStyleSheet;e.replaceSync(c),n.adoptedStyleSheets=[e]}else{let e=document.createElement(`style`);t.styleNonce&&(e.nonce=t.styleNonce),e.textContent=c,n.appendChild(e)}l(m(y,{transport:s(t),config:t,bindControls:e=>this.controls=e,composerDraftStore:this.composerDraftStore}),n)}open(){this.controls?.open()}close(){this.controls?.close()}toggle(){this.controls?.toggle()}identify(e){this.controls?.identify(e)}clear(){this.controls?.startNew()}shutdown(){this.controls?.shutdown()}unmount(){this.shadowRoot&&l(null,this.shadowRoot)}};typeof customElements<`u`&&!customElements.get(Ge)&&customElements.define(Ge,Ke);const b=(e,t=document.body)=>{if(typeof document>`u`)throw Error(`[centrinfo-widget] createWidget must run in a browser.`);let n=document.createElement(Ge);return n.style.pointerEvents=`none`,n.style.position=`fixed`,n.style.inset=`0`,n.style.width=`0`,n.style.height=`0`,t.appendChild(n),n.mountWith(e),{open:()=>n.open(),close:()=>n.close(),toggle:()=>n.toggle(),show:()=>n.open(),hide:()=>n.close(),identify:e=>n.identify(e),update:e=>n.identify(e),clear:()=>n.clear(),shutdown:()=>n.shutdown(),logout:()=>n.shutdown(),destroy:()=>{n.unmount(),n.remove()}}},qe=e=>b(e);let Je=null;const Ye=e=>{Je?.destroy();let t=qe(e);return Je=t,t},Xe={init:Ye,createWidget:qe};export{Xe as Centrinfo,qe as createWidget,Ye as init};
1
+ import{A as e,B as t,C as n,E as r,F as i,H as a,I as o,L as s,M as ee,N as te,O as ne,P as re,R as ie,S as ae,T as oe,U as se,V as ce,X as c,Z as le,_ as ue,a as de,b as fe,d as pe,h as me,i as he,j as ge,k as _e,m as ve,n as ye,p as be,r as xe,t as l,u as Se,v as Ce,w as we,x as Te,y as Ee,z as De}from"./styles-yhqxR2ty.mjs";import{render as u}from"preact";import{useCallback as d,useEffect as f,useLayoutEffect as Oe,useRef as p,useState as m}from"preact/hooks";import{Fragment as ke,jsx as h,jsxs as g}from"preact/jsx-runtime";const Ae=(e,t)=>{if(typeof MutationObserver>`u`)return()=>void 0;let n=e.scrollHeight,r=0,i=()=>{r=0;let i=e.scrollHeight,a=i>n,o=t.isAtBottom();n=i,a&&(o?(e.scrollTop=e.scrollHeight,t.onFollow?.()):t.onUnseen?.())},a=new MutationObserver(()=>{r||(r=typeof requestAnimationFrame==`function`?requestAnimationFrame(i):setTimeout(i,0))});return a.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{a.disconnect(),r&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r)}},je=e=>e.startsWith(`image/`)?`image`:e===`application/pdf`?`pdf`:`other`,Me=({state:e,onClose:n})=>{let r=ce(),i=p(null);f(()=>{i.current?.focus();let e=e=>{e.key===`Escape`&&(e.stopPropagation(),n())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[n]);let a=e.status===`ready`?je(e.mimeType):`other`;return h(`div`,{class:`cf-preview`,role:`dialog`,"aria-modal":`true`,"aria-label":t(r.attachPreviewTitle,{name:e.name}),onClick:e=>{e.target===e.currentTarget&&n()},children:g(`div`,{class:`cf-preview__frame`,children:[g(`div`,{class:`cf-preview__bar`,children:[h(`span`,{class:`cf-preview__name`,title:e.name,children:e.name}),e.status===`ready`&&h(`a`,{class:`cf-preview__btn`,href:e.url,download:e.name,children:r.attachDownload}),h(`button`,{ref:i,type:`button`,class:`cf-preview__btn cf-preview__close`,"aria-label":r.attachPreviewClose,onClick:n,children:`✕`})]}),g(`div`,{class:`cf-preview__body`,children:[e.status===`loading`&&h(`p`,{class:`cf-preview__note`,children:r.attachPreviewLoading}),e.status===`error`&&h(`p`,{class:`cf-preview__note`,children:r.attachPreviewFailed}),e.status===`ready`&&a===`image`&&h(`img`,{class:`cf-preview__image`,src:e.url,alt:e.name}),e.status===`ready`&&a===`pdf`&&h(`iframe`,{class:`cf-preview__pdf`,src:e.url,title:e.name}),e.status===`ready`&&a===`other`&&h(`p`,{class:`cf-preview__note`,children:r.attachPreviewUnsupported})]})]})})},Ne=({name:e,greeting:n})=>{let r=ce();return g(`section`,{class:`cf-empty-welcome`,"aria-label":t(r.welcomeLabel,{name:e}),children:[h(`span`,{class:`cf-empty-welcome__eyebrow`,children:r.welcomeEyebrow}),h(`h2`,{children:e}),h(`p`,{children:n||r.welcomePrompt})]})},Pe=(e,t,n)=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n();return}if(e.key!==`Tab`)return;let r=Array.from(t.querySelectorAll(`button, [href], textarea, input, select, [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-hidden`)!==`true`&&e.tabIndex>=0);if(r.length===0)return;let i=t.getRootNode(),a=e.composedPath()[0],o=a instanceof HTMLElement?a:`activeElement`in i?i.activeElement:document.activeElement,s=r[0],ee=r[r.length-1];e.shiftKey&&(o===s||!t.contains(o))?(e.preventDefault(),e.stopPropagation(),ee.focus()):!e.shiftKey&&(o===ee||!t.contains(o))&&(e.preventDefault(),e.stopPropagation(),s.focus())},_=new Map,v=e=>{if(!e||typeof document>`u`||typeof CanvasRenderingContext2D>`u`)return;let t=document.createElement(`canvas`).getContext(`2d`);if(!t)return;t.fillStyle=`#010203`,t.fillStyle=e;let n=t.fillStyle;if(n===`#010203`&&e.trim().toLowerCase()!==`#010203`)return;let r=n.match(/^#([\da-f]{6})$/i)?.[1];if(r)return[Number.parseInt(r.slice(0,2),16),Number.parseInt(r.slice(2,4),16),Number.parseInt(r.slice(4,6),16),1];let i=n.match(/^rgba?\(([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)(?:[, /]+([\d.]+))?\)$/i);if(!i)return;let a=i.slice(1,5).map(Number);if(!a.some(e=>!Number.isFinite(e)))return[a[0],a[1],a[2],a[3]??1]},Fe=(e,t=`#ffffff`)=>{let n=`${e??``}|${t}`;if(_.has(n))return _.get(n);let r=v(e),i=v(t)??[255,255,255,1];if(!r){_.set(n,void 0);return}let a=r[3],o=r.slice(0,3).map((e,t)=>e*a+i[t]*(1-a)).map(e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}),s=o[0]*.2126+o[1]*.7152+o[2]*.0722,ee=1.05/(s+.05)>=(s+.05)/.059?`#ffffff`:`#0f1e2a`;return _.set(n,ee),ee},Ie=e=>{let[t,n]=m(`light`);return f(()=>{if(e!==`auto`||typeof matchMedia>`u`)return;let t=matchMedia(`(prefers-color-scheme: dark)`),r=()=>n(t.matches?`dark`:`light`);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),e===`auto`?t:e},Le={end:`end the call`,mute:`mute your microphone`,minimize:`minimize the chat`,expand:`expand the view`,shrink:`exit the expanded view`},Re=e=>e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s']/gu,` `).replace(/\s+/g,` `).trim(),y=[{action:`shrink`,re:/\b(?:exit|leave|quit|close)\b[\s\w]*\b(?:full ?screen|expanded|theat(?:er|re))\b|\bshrink\b|\bsmaller view\b/},{action:`end`,re:/\b(?:end|close|stop|finish|hang ?up|quit|exit)\b[\s\w]*\b(?:call|chat|conversation|convo|session|talking)\b|\bhang ?up\b|\bgood ?bye\b|^bye(?: bye)?$/},{action:`mute`,re:/\bmute\b|\bstop listening\b/},{action:`minimize`,re:/\bminimi[sz]e\b|\bhide\b[\s\w]*\b(?:chat|call|window|widget)\b/},{action:`expand`,re:/\bexpand\b|\bmaximi[sz]e\b|\bfull ?screen\b|\btheat(?:er|re) mode\b|\bbigger view\b/}],ze=/^(?:yes|yeah|yep|yup|sure|correct|confirm|affirmative|go ahead|do it|please do|ok(?:ay)?)\b/,Be=/^(?:no|nope|nah|cancel|never ?mind|don'?t|stop)\b/,Ve=/^(?:end|close|stop|finish|hang ?up|quit|exit|bye|good ?bye)\b/,He=e=>{let t=Re(e);if(!t)return null;for(let{action:e,re:n}of y)if(n.test(t)){let n=t.split(` `).length;return{action:e,confident:e===`end`?n<=10:n<=6}}return null},Ue=e=>`I didn't catch yes or no. Say yes to ${Le[e]}, or no to keep talking.`,b=({transport:ce,config:c,bindControls:le,composerDraftStore:ye})=>{let l=c.strings,[u,je]=m(c.openByDefault),{persona:_,messages:v,sending:y,assistantSpeaking:b,visitor:We,hasEmail:Ge,liveMode:Ke,assignedAgentName:qe,agentTypingName:Je,starters:Ye,featuredLinks:Xe,send:x,sendGif:Ze,notifyTyping:Qe,stop:$e,amend:et,hold:tt,resumeHeld:nt,duckSpeaking:rt,retry:it,rateMessage:at,rateExplanation:ot,explanationTransport:st,injectAssistant:ct,reconnectSupport:lt,appendUserDraft:ut,patchMessage:S,removeMessage:dt,submitCsat:ft,submitForm:pt,confirmHostedBooking:mt,transcribe:ht,uploadAttachment:gt,loadAttachment:_t,searchGifs:vt,demoSlots:yt,gifEnabled:bt,identify:xt,ended:C,endConversation:St,startNew:Ct,history:wt,viewingSessionId:Tt,viewMessages:Et,openConversation:Dt,closeHistoryView:Ot,shutdown:kt,stopSpeaking:w,speakAssistantText:At}=de(ce,c,u),jt=he(v,Ke),[Mt,Nt]=m(null),Pt=p(0),Ft=d((e,t,n)=>{n===Pt.current&&Nt({status:`ready`,name:t,url:URL.createObjectURL(e),mimeType:e.type||`application/octet-stream`})},[]),It=d((e,t,n)=>{let r=t.name,i=++Pt.current;Nt({status:`loading`,name:r}),_t(e,t,n).then(e=>Ft(e,r,i),()=>{i===Pt.current&&Nt({status:`error`,name:r})})},[_t,Ft]),Lt=d((e,t)=>Ft(e,t,++Pt.current),[Ft]),Rt=d(()=>{Pt.current+=1,Nt(null)},[]);f(()=>()=>{Mt?.status===`ready`&&URL.revokeObjectURL(Mt.url)},[Mt]);let zt=!!xe(_?.actions),[T,Bt]=m(0),[E,Vt]=m({mic:`off`,processing:!1}),[Ht,Ut]=m(null),[Wt,Gt]=m(!1),[D,Kt]=m(!1),[qt,Jt]=m(!1),[Yt,Xt]=m(!1),[Zt,Qt]=m(0),[O,k]=m(!1),[$t,A]=m(null),[en,tn]=m(null),[nn,rn]=m([]),[an,on]=m(``),[sn,cn]=m(()=>{try{return localStorage.getItem(`centrinfo:muted`)===`1`}catch{return!1}}),ln=Ie(c.theme),un=_?.soundEnabled??!0;f(()=>{pe(c.sound&&un&&!sn)},[c.sound,un,sn]);let dn=d(()=>{cn(e=>{let t=!e;try{localStorage.setItem(`centrinfo:muted`,t?`1`:`0`)}catch{}return t})},[]),j=p(null),fn=p(null),pn=p(null),mn=p(0),M=p(!1),N=p(!1),P=p(null),F=p(0),hn=p(void 0),gn=p(0),_n=p(null),vn=p(!1),I=p(null),L=p(``),yn=p(()=>{}),bn=p(``),xn=p(y),Sn=p(x);Sn.current=x;let Cn=p(et);Cn.current=et;let wn=p(ht);wn.current=ht;let R=p(!1),z=p(!1),Tn=p(``);Tn.current=[...v].reverse().find(e=>e.role===`assistant`)?.content??``;let En=p(b);xn.current=y,En.current=b;let B=D?Wt?`timeout`:Yt||E.mic===`muted`?`muted`:E.mic===`unavailable`?E.reason===`permission-denied`||E.reason===`unsupported`?`denied`:`unavailable`:E.mic===`off`||E.mic===`starting`?`connecting`:E.mic===`hearing`?`hearing`:b?`speaking`:Ht??(E.processing||y?`processing`:`listening`):`idle`,[Dn,On]=m(!0),[kn,V]=m(!1),An=p(0),[H,jn]=m(!1),[U,W]=m(!1),Mn=p(null),[G,K]=m(!1),Nn=p({value:``}),Pn=ye??Nn.current,Fn=p({confirmEnd:H,confirmClear:U,showHistory:G});Fn.current={confirmEnd:H,confirmClear:U,showHistory:G};let[In,Ln]=m(!1),q=!!Tt,Rn=q?Et:v,zn=Rn.find(e=>e.id===$t&&e.visualization)?.visualization,Bn=Rn.find(e=>e.id===en&&e.visualization);f(()=>{!en||Bn||(tn(null),k(!1))},[en,Bn]),f(()=>{!$t||zn||(A(null),k(!1))},[zn,$t]);let Vn=d(()=>{je(!0),Bt(0),Se(`open`),c.onOpen?.(),c.onShow?.()},[c]),J=d(()=>{je(!1),k(!1),A(null),c.onClose?.(),c.onHide?.(),fn.current?.focus()},[c]),Hn=d(()=>u?J():Vn(),[u,Vn,J]),Un=d(()=>jn(!0),[]),Wn=d(()=>{St(),jn(!1)},[St]),Gn=d(()=>{Ct(),V(!1),On(!0)},[Ct]);f(()=>{H&&Mn.current?.focus()},[H]),f(()=>{le({open:Vn,close:J,toggle:Hn,identify:xt,startNew:Ct,endConversation:St,shutdown:kt})},[le,Vn,J,Hn,xt,Ct,St,kt]),f(()=>{let e=v.filter(e=>e.role===`assistant`&&!e.pending).length;if(u){mn.current=e;return}e>mn.current&&Bt(e-mn.current)},[v,u]),f(()=>{c.onUnreadChange?.(T)},[T,c]),f(()=>{let e=c.sessionDurationMinutes;if(!e||e<=0)return;let t=setTimeout(()=>kt(),e*60*1e3);return()=>clearTimeout(t)},[c.sessionDurationMinutes,v,u,kt]),f(()=>{let e=c.customLauncherSelector;if(!e||typeof document>`u`)return;let t=[];try{t=Array.from(document.querySelectorAll(e))}catch{return}let n=e=>{e.preventDefault(),Hn()};return t.forEach(e=>e.addEventListener(`click`,n)),()=>t.forEach(e=>e.removeEventListener(`click`,n))},[c.customLauncherSelector,Hn]);let Kn=p(!1);f(()=>{let e=c.proactiveMessage?.trim();if(!e||Kn.current)return;let t=c.proactiveOnPaths??[],n=typeof location<`u`?location.pathname:``;if(t.length>0&&!t.some(e=>n.includes(e)))return;let r=`centrinfo:proactive:${c.token.slice(0,12)}`;try{if(sessionStorage.getItem(r)===`1`)return}catch{}let i=setTimeout(()=>{if(!(u||C||v.some(e=>e.role===`user`))){Kn.current=!0;try{sessionStorage.setItem(r,`1`)}catch{}ct(e),Vn()}},Math.max(0,c.proactiveDelaySeconds)*1e3);return()=>clearTimeout(i)},[c.proactiveMessage]),f(()=>{let e=pn.current;if(!u||!e)return;let t=v[v.length-1],n=Date.now()<An.current;t?.role===`user`||Dn||n?(requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight}),V(!1),n&&On(!0)):V(!0)},[v,u,y,Dn]);let qn=p(!0);qn.current=Dn,f(()=>{let e=pn.current;if(!(!u||!e))return Ae(e,{isAtBottom:()=>qn.current,onUnseen:()=>V(!0)})},[u,q]);let Jn=d(()=>{let e=pn.current;if(!e)return;if(M.current&&!q){On(!0),V(!1);return}let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;On(t),t&&V(!1)},[q]),Y=d(()=>{let e=pn.current;e&&(e.scrollTop=e.scrollHeight),V(!1),On(!0)},[]),Yn=d(()=>{An.current=Date.now()+3e3,requestAnimationFrame(Y)},[Y]);f(()=>{if(!u||q||!D||B===`connecting`)return;An.current=Date.now()+6e4,Y();let e=requestAnimationFrame(()=>{Y(),requestAnimationFrame(Y)}),t=[80,180,360].map(e=>window.setTimeout(Y,e));return()=>{cancelAnimationFrame(e),t.forEach(e=>window.clearTimeout(e))}},[b,v,u,Y,y,D,q,B]);let Xn=d(()=>{j.current?.querySelector(`.cf-textarea`)?.focus()},[]),Zn=d((e,t)=>{Ut(e),hn.current&&window.clearTimeout(hn.current),hn.current=window.setTimeout(()=>Ut(null),3e3),t&&!N.current&&At(t)},[At]),Qn=d(e=>{let t=I.current;if(t)return t;Yn();let n=ut(e);return I.current=n,S(n,{content:L.current||e,pending:!0,streaming:!1}),n},[ut,Yn,S]),X=d(()=>{let e=I.current;if(e){if(L.current){S(e,{content:L.current,pending:!0});return}I.current=null,dt(e)}},[S,dt]),Z=d(()=>{z.current&&(z.current=!1,rt(!1)),R.current&&(R.current=!1,nt())},[rt,nt]),Q=d(()=>{M.current=!1,P.current?.stop(`call-ended`),P.current=null,R.current=!1,z.current=!1,N.current=!1,_n.current=null,vn.current=!1;let e=I.current;I.current=null,L.current=``,e&&dt(e),hn.current&&window.clearTimeout(hn.current),Ut(null),Gt(!1),Vt({mic:`off`,processing:!1}),Qt(0),Kt(!1),Jt(!1),Xt(!1),k(!1),A(null),w()},[dt,w]),$n=d(()=>{O&&A(null),k(!O)},[O]),er=d(e=>{A(e),k(!0)},[]),tr=d(e=>{tn(e),k(!0)},[]),nr=d(()=>{let e=$t,t=en;A(null),tn(null),k(!1),window.requestAnimationFrame(()=>{(t?j.current?.querySelector(`[data-explanation-message="${t}"]`)?.querySelector(`[data-testid="analytics-explanation-expand"]`):Array.from(j.current?.querySelectorAll(`[data-visualization-message]`)??[]).find(t=>t.dataset.visualizationMessage===e))?.focus()})},[$t,en]),rr=d(()=>{A(null),tn(null),k(!1)},[]),ir=d((e,t,n=!1)=>{if(Yn(),t&&(S(t,{content:e,pending:!1,streaming:!1}),I.current===t&&(I.current=null)),L.current=``,n){w(),Cn.current(e,{forceVoicePlayback:!0,userMessageId:t});return}M.current&&(tt()?Cn.current(e,{forceVoicePlayback:!0,userMessageId:t}):Sn.current(e,{forceVoicePlayback:!0,userMessageId:t}))},[Yn,tt,S,w]),$=d(e=>{ct(e),At(e)},[ct,At]),ar=d(()=>{if(F.current=Date.now(),Ut(null),En.current){z.current=!0,rt(!0);return}R.current||(R.current=tt()),Qn(`Listening...`)},[rt,Qn,tt]),or=d(e=>{let t=I.current;!t||z.current||S(t,{content:`${[L.current,e].filter(Boolean).join(` `)} ...`,pending:!0})},[S]),sr=d(e=>{F.current=Date.now();let t=[L.current,e.text].map(e=>e.trim()).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();if((z.current||e.overlappedOutput)&&se(e.text,Tn.current)){X(),Z();return}if(!t||be(t)||ve(t)){let e=z.current||R.current;X(),Z(),e||Zn(`misunderstood`);return}z.current&&(z.current=!1,$e(),w());let n=_n.current;if(n){L.current=``,X();let e=Re(t);if(ze.test(e)||n===`end`&&Ve.test(e)){_n.current=null,yn.current(n);return}if(Be.test(e)){_n.current=null,$(`Okay, never mind — what would you like to know?`);return}$(Ue(n));return}let r=He(t);if(r){if(L.current=``,X(),Z(),r.confident){yn.current(r.action);return}_n.current=r.action,$(`Just to confirm — you want me to ${Le[r.action]}? Please say yes or no.`);return}let i=Qn(t);S(i,{content:t,pending:!0});let a=R.current;R.current=!1,ir(t,i,a)},[Qn,S,Z,ir,X,Zn,$,$e,w]),cr=d(e=>{F.current=Date.now();let t=z.current||R.current;if(X(),Z(),!(t||e.overlappedOutput||e.reason===`too-short`)){if(e.reason===`transcribe-failed`){Zn(`misunderstood`,`I couldn't transcribe that. Please try again, or type your question.`);return}Zn(`noise`)}},[Z,X,Zn]),lr=p({speechStart:ar,partial:or,turn:sr,noise:cr});lr.current={speechStart:ar,partial:or,turn:sr,noise:cr};let ur=d(()=>{navigator.mediaDevices?.enumerateDevices().then(e=>{rn(e.filter(e=>e.kind===`audioinput`).map((e,t)=>({deviceId:e.deviceId,label:e.label||`Microphone ${t+1}`})))}).catch(()=>{})},[]),dr=d(()=>{if(M.current){Q();return}if(Xn(),!_?.allowVoiceInput||!_.talkbackMode||_.talkbackMode===`text`||xn.current||C||q)return;F.current=Date.now(),N.current=!1,M.current=!0,Xt(!1),Kt(!0),Jt(!1),Gt(!1);let e=!1,t=new a({deviceId:bn.current||void 0,transcribe:async({audio:e,mimeType:t,durationSeconds:n})=>{let r=typeof navigator<`u`&&(navigator.languages?.[0]||navigator.language)||void 0;return me(await wn.current(e,t,r,n))},listener:{state:t=>{Vt(t),t.mic!==`starting`&&t.mic!==`off`&&Jt(!0),!e&&t.mic===`listening`&&(e=!0,ur())},speechStart:()=>lr.current.speechStart(),partial:({text:e})=>lr.current.partial(e),turn:e=>lr.current.turn(e),noise:e=>lr.current.noise(e),level:e=>{let t=performance.now();t-gn.current<90||(gn.current=t,Qt(e))}}});P.current=t,t.setOutputActive(En.current),t.start()},[Q,C,Xn,_,ur,q]),fr=d(()=>{let e=!N.current;N.current=e,Xt(e),P.current?.setMuted(e),e?(L.current=``,X(),Z()):F.current=Date.now()},[Z,X]),pr=d(e=>{switch(F.current=Date.now(),e){case`end`:vn.current=!0,$(`Okay — ending our call now. Goodbye!`),window.setTimeout(()=>{vn.current&&(vn.current=!1,Q())},2e3);break;case`mute`:N.current||fr(),$(`Muted. Tap the mic button when you want me to listen again.`);break;case`minimize`:J(),$(`Minimized — I'm still listening. Tap the call pill to bring the chat back.`);break;case`expand`:k(!0),$(`Sure — expanding the view.`);break;case`shrink`:A(null),k(!1),$(`Okay — back to the smaller view.`);break}},[J,Q,$,fr]);f(()=>{yn.current=pr},[pr]);let mr=p(!1);f(()=>{mr.current&&!b&&vn.current&&(vn.current=!1,Q()),mr.current=b},[b,Q]);let hr=d(e=>{bn.current=e,on(e),P.current?.selectDevice(e||void 0)},[]),gr=d(()=>{!M.current||N.current||(z.current=!1,R.current=!1,$e(),w(),F.current=Date.now())},[$e,w]);f(()=>{P.current?.setOutputActive(b),F.current=Date.now()},[b]),f(()=>{if(B!==`denied`)return;let e=window.setTimeout(()=>Q(),3500);return()=>window.clearTimeout(e)},[Q,B]),f(()=>{if(!D)return;let e=window.setInterval(()=>{let e=P.current;!e||N.current||xn.current||En.current||e.snapshot.mic===`hearing`||e.snapshot.processing||Date.now()-F.current<6e4||(P.current?.log.add(`call-timeout`),Gt(!0),window.setTimeout(()=>Q(),2400))},5e3);return()=>window.clearInterval(e)},[Q,D]);let _r=D&&!Yt&&(y||b);f(()=>()=>Q(),[Q]);let[vr,yr]=m(``),br=p(!1);f(()=>{if(br.current&&!y){let e=[...v].reverse().find(e=>e.role===`assistant`&&!e.streaming&&!e.pending&&e.content);e&&yr(e.content)}br.current=y},[y,v]),Oe(()=>{if(!u)return;let e=j.current,t=H||U?e?.querySelector(`.cf-confirm__card`):G?e?.querySelector(`.cf-history`):null;if(!t)return;let n=t.getRootNode(),r=`activeElement`in n?n.activeElement:document.activeElement;(!r||!t.contains(r))&&t.querySelector(`button, [href], textarea, input, [tabindex]:not([tabindex="-1"])`)?.focus()},[U,H,u,G]),f(()=>{if(!u)return;let e=j.current,t=H||U?e?.querySelector(`.cf-confirm__card`):G?e?.querySelector(`.cf-history`):null,n=e?.querySelectorAll(`:scope > .cf-header, :scope > .cf-panel__video, :scope > .cf-panel__chat`);n?.forEach(e=>{t?(e.setAttribute(`inert`,``),e.setAttribute(`aria-hidden`,`true`)):(e.removeAttribute(`inert`),e.removeAttribute(`aria-hidden`))}),t||requestAnimationFrame(()=>e?.querySelector(`.cf-textarea`)?.focus());let r=n=>{if(n.key===`Escape`){n.preventDefault();let t=Fn.current;if(t.confirmEnd){jn(!1);return}if(t.confirmClear){W(!1);return}if(t.showHistory){K(!1);return}if(e?.querySelector(`.cf-action-drawer`))return;J();return}if(n.key!==`Tab`||!t)return;let r=t.querySelectorAll(`button, [href], textarea, input, [tabindex]:not([tabindex="-1"])`),i=Array.from(r).filter(e=>!e.hasAttribute(`disabled`));if(i.length===0)return;let a=i[0],o=i[i.length-1],s=t.getRootNode()instanceof ShadowRoot?t.getRootNode().activeElement:document.activeElement;n.shiftKey&&s===a?(n.preventDefault(),o.focus()):!n.shiftKey&&s===o&&(n.preventDefault(),a.focus())};return e?.addEventListener(`keydown`,r),()=>{e?.removeEventListener(`keydown`,r),n?.forEach(e=>{e.removeAttribute(`inert`),e.removeAttribute(`aria-hidden`)})}},[u,J,H,U,G]),f(()=>{let e=j.current;e&&(u?e.removeAttribute(`inert`):e.setAttribute(`inert`,``))},[u]);let xr=c.accentColor??c.themeTokens?.accent??_?.accentColor,Sr=c.themeTokens?.accentText??Fe(xr,c.themeTokens?.background??(ln===`dark`?`#0f1c27`:`#ffffff`)),Cr={zIndex:c.zIndex,"--cf-h-pad":`${c.horizontalPadding}px`,"--cf-v-pad":`${c.verticalPadding}px`,...Sr?{"--cf-accent-ink":Sr}:{},...c.themeTokens?.accentStrong?{"--cf-accent-2":c.themeTokens.accentStrong}:{},...c.themeTokens?.background?{"--cf-bg":c.themeTokens.background}:{},...c.themeTokens?.surface?{"--cf-surface":c.themeTokens.surface}:{},...c.themeTokens?.surfaceMuted?{"--cf-surface-2":c.themeTokens.surfaceMuted}:{},...c.themeTokens?.text?{"--cf-text":c.themeTokens.text}:{},...c.themeTokens?.mutedText?{"--cf-muted":c.themeTokens.mutedText}:{},...c.themeTokens?.border?{"--cf-border":c.themeTokens.border}:{},...c.themeTokens?.shadow?{"--cf-shadow":c.themeTokens.shadow}:{},...c.themeTokens?.radius?{"--cf-radius":c.themeTokens.radius}:{},...c.themeTokens?.fontFamily?{"--cf-font":c.themeTokens.fontFamily}:{},...c.themeTokens?.success?{"--cf-success":c.themeTokens.success}:{},...c.themeTokens?.warning?{"--cf-warning":c.themeTokens.warning}:{},...c.themeTokens?.danger?{"--cf-danger":c.themeTokens.danger}:{},...xr?{"--cf-accent":xr,"--cf-accent-2":c.themeTokens?.accentStrong??`color-mix(in oklab, ${xr} 76%, #14141f)`}:{}},wr=e=>x(e),Tr=[...v].reverse().find(e=>e.role===`user`&&e.content.trim())?.content??``,Er=v.some(e=>e.role===`user`),Dr=!!(_?.allowVoiceInput&&_?.talkbackMode&&_.talkbackMode!==`text`),Or=Dr,kr=!q&&Or&&!Er?Rn.filter((e,t)=>!(t===0&&e.role===`assistant`)):Rn,Ar=Ke===`human`&&qe?qe:_?.agentName??l.chatName,jr=Ke===`human`?l.liveSupport:Ke===`queued`?l.waitingForTeam:_?.offline?l.statusOffline:l.statusOnline,Mr=!C&&!q?_?.availableActions:void 0,Nr=!C&&!q?_?.actions:void 0,Pr=D&&!qt&&B===`connecting`&&!q;return h(De,{value:l,children:h(ie,{value:c.locale,children:g(`div`,{class:`cf-root`,dir:c.dir,"data-theme":ln,"data-align":c.alignment,"data-display":`floating`,style:Cr,children:[O&&u&&h(`div`,{class:`cf-theater-backdrop`,onClick:rr}),g(`div`,{ref:j,class:`cf-panel ${u?`is-open`:``} ${D?`cf-panel--call`:``} ${Pr?`cf-panel--voice-connecting`:``} ${O&&u?`cf-panel--theater`:``} ${zn||Bn?`cf-panel--analytics-focus`:``}`,role:`dialog`,"aria-modal":`false`,"aria-label":`${l.chatName}: ${_?.agentName??l.assistantName}`,"aria-hidden":!u,children:[Mt&&u&&h(Me,{state:Mt,onClose:Rt}),g(`div`,{class:`cf-header`,children:[h(Ce,{persona:_,hideWhenMissing:!0}),g(`div`,{class:`cf-header__meta`,children:[h(`div`,{class:`cf-header__name`,children:Ar}),h(`div`,{class:`cf-header__status ${Ke===`ai`&&_?.offline?`cf-header__status--offline`:``}`,children:h(`span`,{class:`cf-header__status-text`,children:jr})})]}),g(`div`,{class:`cf-header__actions`,children:[wt.length>0&&h(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":l.pastConversations,title:l.pastConversations,"aria-pressed":G,onClick:()=>K(e=>!e),children:h(ee,{})}),Er&&!C&&!q&&h(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":l.endChat,title:l.endChat,onClick:Un,children:h(ge,{})}),c.sound&&un&&h(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":sn?l.unmuteSounds:l.muteSounds,"aria-pressed":sn,onClick:dn,children:h(sn?te:re,{})}),h(`button`,{type:`button`,class:`cf-header__btn cf-header__close`,"aria-label":l.closeChat,onClick:J,children:h(e,{})})]})]}),h(`div`,{class:`cf-panel__video`,children:zn?h(`div`,{class:`cf-analytics-focus`,role:`region`,"aria-label":l.expandedAnalyticsResult,children:h(r,{visualization:zn,expanded:!0,onFollowUp:e=>{nr(),x(e)},onClose:nr})}):Bn?.visualization?h(`div`,{class:`cf-analytics-focus`,role:`region`,"aria-label":l.expandedAnalyticsResult,children:h(oe,{visualization:Bn.visualization,onClose:nr,onFollowUp:e=>{nr(),x(e)},onFeedback:q?void 0:ot,transport:q?void 0:st(`widget`),onOpenSource:c.onOpenAnalyticsSource})}):!q&&Or?h(Ee,{persona:_,starters:[],onPick:x,onFocusComposer:dr,speaking:b,voiceState:B,replyPending:D&&y&&!b,pinned:!0,muted:Yt,onToggleMute:fr,onEndCall:Q,onTalkNow:gr,showTalkNow:_r,micLevel:Zt,theaterMode:O,onToggleTheater:$n,onMinimize:J,audioDevices:nn,selectedAudioDeviceId:an,onSelectAudioDevice:hr,connectingOnly:Pr}):null}),!Pr&&g(`div`,{class:`cf-panel__chat`,children:[c.preview&&h(`div`,{class:`cf-preview-banner`,children:l.previewBanner}),q&&h(`div`,{class:`cf-viewing-banner`,children:l.viewingPast}),g(`div`,{class:`cf-body`,ref:pn,role:`log`,onScroll:Jn,children:[kr.map((e,t)=>h(n,{msg:e,persona:_,isLast:!q&&t===kr.length-1,visitor:We,hasEmail:Ge,lastQuestion:Tr,showActions:!q&&t===kr.length-1&&!!(e.handoffOffered||e.selectedAction),onPickReply:wr,onSubmitForm:pt,onDemoSlots:yt,onConfirmHostedBooking:mt,onRetry:it,ratable:!q&&kr.slice(0,t).some(e=>e.role===`user`),onRate:at,onExplanationFeedback:q?void 0:ot,explanationTransport:q?void 0:st(`widget`),onOpenAnalyticsSource:c.onOpenAnalyticsSource,onExpandVisualization:q?void 0:er,onExpandExplanation:q?void 0:tr,onOpenAttachment:It,onReconnect:!q&&!C&&zt&&e.id===jt?lt:void 0},e.id)),!Er&&!q&&g(ke,{children:[kr.length===0&&h(Ne,{name:_?.agentName??l.assistantName,greeting:_?.greeting}),h(we,{items:Ye,onPick:x}),h(Te,{items:Xe})]}),kn&&g(`button`,{type:`button`,class:`cf-newmsg`,onClick:Y,children:[h(ne,{}),l.newMessages]})]}),h(`div`,{class:`cf-sr-live`,"aria-live":`polite`,"aria-atomic":`true`,children:vr}),y&&!C&&!q&&h(`div`,{class:`cf-stopbar`,children:g(`button`,{type:`button`,class:`cf-stop`,onClick:$e,children:[h(i,{}),l.stop]})}),q?h(`div`,{class:`cf-ended`,children:h(`button`,{type:`button`,class:`cf-ended__btn`,onClick:Ot,children:l.backToChat})}):C?g(`div`,{class:`cf-ended`,children:[h(`p`,{class:`cf-ended__text`,children:l.conversationEnded}),c.csat&&Er?In?h(`p`,{class:`cf-ended__text`,children:l.feedbackThanks}):g(`div`,{class:`cf-csat`,children:[h(`span`,{class:`cf-csat__q`,children:l.csatPrompt}),h(`button`,{type:`button`,class:`cf-csat__btn`,"aria-label":l.feedbackHelpful,onClick:()=>{ft(`up`),Ln(!0)},children:h(s,{})}),h(`button`,{type:`button`,class:`cf-csat__btn`,"aria-label":l.feedbackNotHelpful,onClick:()=>{ft(`down`),Ln(!0)},children:h(o,{})})]}):null,h(`button`,{type:`button`,class:`cf-ended__btn`,onClick:Gn,children:l.startNewChat})]}):g(ke,{children:[Je?h(`div`,{class:`cf-live-typing`,"aria-live":`polite`,children:t(l.agentTyping,{name:Je})}):null,Mr&&Mr.length>0&&h(`div`,{class:`cf-footer-actions`,children:h(ue,{actions:Mr,descriptors:Nr,visitor:We,onSubmitForm:pt,onDemoSlots:yt,onConfirmHostedBooking:mt,scheduler:_?.scheduler,translations:c.actionTranslations})},`footer-actions`),h(fe,{draftStore:Pn,onSend:x,onSendGif:Ze,onTyping:Qe,disabled:y,allowVoice:Dr,onTranscribe:ht,gifEnabled:bt,onSearchGifs:vt,allowAttach:c.attachments,analyzeAttachments:!0,onUpload:gt,onPreviewAttachment:Lt},`composer`)]}),!C&&_?.disclaimerText&&h(`div`,{class:`cf-disclaimer`,children:_.disclaimerText}),g(`div`,{class:`cf-footer`,children:[h(`button`,{type:`button`,class:`cf-footer__privacy`,"aria-label":l.clearDeviceData,onClick:()=>W(!0),children:l.privacyAndData}),h(`span`,{"aria-hidden":`true`,children:`·`}),l.poweredBy,` `,h(`a`,{href:`https://accurix.tech/centrinfo`,target:`_blank`,rel:`noopener noreferrer`,children:`Centrinfo`})]})]}),H&&h(`div`,{class:`cf-confirm`,onClick:()=>jn(!1),children:g(`div`,{class:`cf-confirm__card`,role:`alertdialog`,"aria-modal":`true`,"aria-label":l.endChatConfirm,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>Pe(e,e.currentTarget,()=>jn(!1)),children:[h(`div`,{class:`cf-confirm__title`,children:l.endChatConfirm}),h(`div`,{class:`cf-confirm__body`,children:l.endChatConfirmBody}),g(`div`,{class:`cf-confirm__actions`,children:[h(`button`,{ref:Mn,type:`button`,class:`cf-confirm__btn cf-confirm__btn--cancel`,onClick:()=>jn(!1),children:l.cancel}),h(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--danger`,onClick:Wn,children:l.endConfirmCta})]})]})},`confirm-end`),G&&h(`div`,{class:`cf-confirm`,onClick:()=>K(!1),children:g(`div`,{class:`cf-history`,role:`dialog`,"aria-modal":`true`,"aria-label":l.pastConversations,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>Pe(e,e.currentTarget,()=>K(!1)),children:[g(`div`,{class:`cf-history__head`,children:[h(`span`,{children:l.pastConversations}),h(`button`,{type:`button`,class:`cf-header__btn`,"aria-label":l.closeHistory,onClick:()=>K(!1),children:h(e,{})})]}),h(`div`,{class:`cf-history__list`,children:wt.map(e=>g(`button`,{type:`button`,class:`cf-history__item ${e.sessionId===Tt?`is-active`:``}`,onClick:()=>{Dt(e.sessionId),K(!1)},children:[h(`span`,{class:`cf-history__title`,children:e.title}),g(`span`,{class:`cf-history__meta`,children:[new Date(e.ts).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),e.ended?` · ${l.historyEnded}`:``]})]},e.sessionId))}),h(`div`,{class:`cf-history__footer`,children:h(`button`,{type:`button`,class:`cf-history__clear`,onClick:()=>{K(!1),W(!0)},children:l.clearDeviceData})})]})},`history`),U&&h(`div`,{class:`cf-confirm`,onClick:()=>W(!1),children:g(`div`,{class:`cf-confirm__card`,role:`alertdialog`,"aria-modal":`true`,"aria-label":l.clearDeviceData,onClick:e=>e.stopPropagation(),onKeyDownCapture:e=>Pe(e,e.currentTarget,()=>W(!1)),children:[h(`div`,{class:`cf-confirm__title`,children:l.clearDeviceData}),h(`div`,{class:`cf-confirm__body`,children:l.clearDeviceDataBody}),g(`div`,{class:`cf-confirm__actions`,children:[h(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--cancel`,onClick:()=>W(!1),children:l.cancel}),h(`button`,{type:`button`,class:`cf-confirm__btn cf-confirm__btn--danger`,onClick:()=>{W(!1),kt()},children:l.clearDeviceDataCta})]})]})},`confirm-clear`)]}),D&&!u?h(ae,{persona:_,voiceState:B,muted:Yt,onToggleMute:fr,onEndCall:Q,micLevel:Zt,onExpand:Vn}):O&&u?null:!c.hideDefaultLauncher&&g(`button`,{ref:fn,type:`button`,class:`cf-launcher`,"aria-label":u?l.closeChat:T>0?`${l.openChat}. ${T===1?l.unreadMessage:t(l.unreadMessages,{count:String(T)})}`:l.openChat,"aria-expanded":u,onClick:Hn,children:[c.launcherIcon?h(`img`,{class:`cf-launcher__img`,src:c.launcherIcon,alt:``}):h(_e,{}),!u&&T>0&&h(`span`,{class:`cf-launcher__badge`,"aria-hidden":`true`,children:T>99?`99+`:T})]})]})})})},We=`centrinfo-widget`;var Ge=class extends HTMLElement{constructor(...e){super(...e),le(this,`controls`,null),le(this,`composerDraftStore`,{value:``})}mountWith(e){let t=ye(e),n=this.shadowRoot??this.attachShadow({mode:`open`});if(this.style.zIndex=String(t.zIndex),`adoptedStyleSheets`in Document.prototype&&typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`){let e=new CSSStyleSheet;e.replaceSync(l),n.adoptedStyleSheets=[e]}else{let e=document.createElement(`style`);t.styleNonce&&(e.nonce=t.styleNonce),e.textContent=l,n.appendChild(e)}u(h(b,{transport:c(t),config:t,bindControls:e=>this.controls=e,composerDraftStore:this.composerDraftStore}),n)}open(){this.controls?.open()}close(){this.controls?.close()}toggle(){this.controls?.toggle()}identify(e){this.controls?.identify(e)}clear(){this.controls?.startNew()}shutdown(){this.controls?.shutdown()}unmount(){this.shadowRoot&&u(null,this.shadowRoot)}};typeof customElements<`u`&&!customElements.get(We)&&customElements.define(We,Ge);const Ke=(e,t=document.body)=>{if(typeof document>`u`)throw Error(`[centrinfo-widget] createWidget must run in a browser.`);let n=document.createElement(We);return n.style.pointerEvents=`none`,n.style.position=`fixed`,n.style.inset=`0`,n.style.width=`0`,n.style.height=`0`,t.appendChild(n),n.mountWith(e),{open:()=>n.open(),close:()=>n.close(),toggle:()=>n.toggle(),show:()=>n.open(),hide:()=>n.close(),identify:e=>n.identify(e),update:e=>n.identify(e),clear:()=>n.clear(),shutdown:()=>n.shutdown(),logout:()=>n.shutdown(),destroy:()=>{n.unmount(),n.remove()}}},qe=e=>Ke(e);let Je=null;const Ye=e=>{Je?.destroy();let t=qe(e);return Je=t,t},Xe={init:Ye,createWidget:qe};export{Xe as Centrinfo,qe as createWidget,Ye as init};
package/dist/runtime.cjs CHANGED
@@ -1,2 +1,2 @@
1
- const e=require(`./styles-BH7P8Q_3.cjs`),t=(e,n)=>{let r=e.replace(/\/\*[\s\S]*?\*\//g,``),i=e=>n.some(t=>e.includes(t)),a=[],o=0;for(;o<r.length;){let e=r.indexOf(`{`,o);if(e<0)break;let s=r.slice(o,e).trim(),c=1,l=e+1;for(;l<r.length&&c>0;)r[l]===`{`?c++:r[l]===`}`&&c--,l++;let u=r.slice(e+1,l-1);if(s.startsWith(`@`))if(/^@(media|supports|container)\b/.test(s)){let e=t(u,n);e&&a.push(`${s} {\n${e}\n}`)}else /^@keyframes\b/.test(s)&&i(s)&&a.push(`${s} {${u}}`);else i(s)&&a.push(`${s} {${u}}`);o=l}return a.join(`
1
+ const e=require(`./styles-CwxqspIz.cjs`),t=(e,n)=>{let r=e.replace(/\/\*[\s\S]*?\*\//g,``),i=e=>n.some(t=>e.includes(t)),a=[],o=0;for(;o<r.length;){let e=r.indexOf(`{`,o);if(e<0)break;let s=r.slice(o,e).trim(),c=1,l=e+1;for(;l<r.length&&c>0;)r[l]===`{`?c++:r[l]===`}`&&c--,l++;let u=r.slice(e+1,l-1);if(s.startsWith(`@`))if(/^@(media|supports|container)\b/.test(s)){let e=t(u,n);e&&a.push(`${s} {\n${e}\n}`)}else /^@keyframes\b/.test(s)&&i(s)&&a.push(`${s} {${u}}`);else i(s)&&a.push(`${s} {${u}}`);o=l}return a.join(`
2
2
  `)},n=(t,n,r)=>e.W(t,n,r),r=t(e.t,[`.cf-action`,`.cf-form`,`.cf-booking`]);exports.ActionsArea=e._,exports.ResultTable=e.G,exports.StringsProvider=e.z,exports.WIDGET_ACTION_STYLES=r,exports.WidgetAnalyticsChart=e.J,exports.analyticsResultDetails=n,exports.buildWidgetAnalyticsChartModel=e.Y,exports.createAdaptiveVoiceActivityDetector=e.o,exports.createChatTransport=e.X,exports.createPreferredAudioRecorder=e.s,exports.createVoiceAudioConstraints=e.c,exports.findLiveSupportAction=e.r,exports.formatResultCell=e.K,exports.looksLikeEcho=e.f,exports.reconnectableHandbackId=e.i,exports.renderRich=e.D,exports.resolveConfig=e.n,exports.selectStyleRules=t,exports.serializeResultCsv=e.q,exports.stopRecorderWithFlush=e.l,exports.usableTranscript=e.g,exports.useChat=e.a;
@@ -1,5 +1,5 @@
1
- import { C as StringsProvider, D as AnalyticsExplanationInput, E as AnalyticsAIExplanationTransport, O as AnalyticsGroupComparisonPoint, S as Transport, T as ResultLabels, _ as DemoSlotsResult, a as MessageAttachment, b as PublicChatAction, c as Visitor, f as WidgetThemeTokens, g as DemoBooking, h as AnalyticsVisualization, i as FeaturedLink, k as AnalyticsPeriodComparison, l as WidgetActionTranslation, m as ActionResult, n as ChatArtifact, o as SchedulerInfo, p as WidgetUser, r as ChatMessage, s as Source, t as BootstrapInfo, u as WidgetConfig, v as ExplanationFeedbackInput, w as WidgetStrings, x as PublicChatActionField, y as GifResult } from "./types-CYFMH8yg.cjs";
2
- import * as preact1 from "preact";
1
+ import { C as StringsProvider, D as AnalyticsExplanationInput, E as AnalyticsAIExplanationTransport, O as AnalyticsGroupComparisonPoint, S as Transport, T as ResultLabels, _ as DemoSlotsResult, a as MessageAttachment, b as PublicChatAction, c as Visitor, f as WidgetThemeTokens, g as DemoBooking, h as AnalyticsVisualization, i as FeaturedLink, k as AnalyticsPeriodComparison, l as WidgetActionTranslation, m as ActionResult, n as ChatArtifact, o as SchedulerInfo, p as WidgetUser, r as ChatMessage, s as Source, t as BootstrapInfo, u as WidgetConfig, v as ExplanationFeedbackInput, w as WidgetStrings, x as PublicChatActionField, y as GifResult } from "./types-BuoTcoZu.cjs";
2
+ import * as preact3 from "preact";
3
3
  import { JSX } from "preact";
4
4
 
5
5
  //#region ../centrinfo-results/src/analytics-chart-catalog.d.ts
@@ -125,6 +125,7 @@ interface ResultColumn {
125
125
  currencyCode?: string;
126
126
  formatPattern?: string;
127
127
  grain?: ResultGrain;
128
+ semanticRole?: AnalyticsVisualizationColumn['semanticRole'];
128
129
  }
129
130
  interface ResultTableClassNames {
130
131
  wrap?: string;
@@ -175,7 +176,7 @@ declare const WidgetAnalyticsChart: ({
175
176
  expanded?: boolean;
176
177
  /** Class prefix of the surface (`cf` widget, `ca` chat app). */
177
178
  classPrefix?: string;
178
- }) => preact1.JSX.Element;
179
+ }) => preact3.JSX.Element;
179
180
  //#endregion
180
181
  //#region ../centrinfo-results/src/result.d.ts
181
182
  declare const formatResultCell: (value: unknown, locale?: string, column?: ResultColumn, context?: ResultFormatContext) => string;
@@ -202,7 +203,7 @@ declare const ResultTable: ({
202
203
  expanded,
203
204
  classNames,
204
205
  emptyLabel
205
- }: ResultTableProps) => preact1.JSX.Element;
206
+ }: ResultTableProps) => preact3.JSX.Element;
206
207
  //#endregion
207
208
  //#region ../centrinfo-results/src/result-details.d.ts
208
209
  interface AnalyticsResultDetail {
@@ -434,6 +435,7 @@ declare const ActionsArea: ({
434
435
  scheduler,
435
436
  exclude,
436
437
  openAction,
438
+ showTrigger,
437
439
  translations,
438
440
  onClose
439
441
  }: {
@@ -449,6 +451,8 @@ declare const ActionsArea: ({
449
451
  exclude?: string[];
450
452
  /** Action id the backend resolved for this turn — opens its form directly. */
451
453
  openAction?: string;
454
+ /** Inline chat forms use the shared footer menu instead of a second trigger. */
455
+ showTrigger?: boolean;
452
456
  /** Locale-specific copy keyed by stable action ID. */
453
457
  translations?: Record<string, WidgetActionTranslation>;
454
458
  /** A host that shows the actions in its own panel: closing or cancelling
@@ -1,4 +1,4 @@
1
- import { A as buildWidgetAnalyticsChartModel, C as StringsProvider, D as formatResultCell, E as ResultTable, M as AnalyticsAIExplanationTransport, N as AnalyticsExplanationInput, O as serializeResultCsv, S as Transport, T as AnalyticsResultDetail, _ as DemoSlotsResult, a as MessageAttachment, b as PublicChatAction, c as Visitor, f as WidgetThemeTokens, g as DemoBooking, h as AnalyticsVisualization, i as FeaturedLink, j as ResultLabels, k as WidgetAnalyticsChart, l as WidgetActionTranslation, m as ActionResult, n as ChatArtifact, o as SchedulerInfo, p as WidgetUser, r as ChatMessage, s as Source, t as BootstrapInfo, u as WidgetConfig, v as ExplanationFeedbackInput, w as WidgetStrings, x as PublicChatActionField, y as GifResult } from "./types-D82dr33R.mjs";
1
+ import { A as buildWidgetAnalyticsChartModel, C as StringsProvider, D as formatResultCell, E as ResultTable, M as AnalyticsAIExplanationTransport, N as AnalyticsExplanationInput, O as serializeResultCsv, S as Transport, T as AnalyticsResultDetail, _ as DemoSlotsResult, a as MessageAttachment, b as PublicChatAction, c as Visitor, f as WidgetThemeTokens, g as DemoBooking, h as AnalyticsVisualization, i as FeaturedLink, j as ResultLabels, k as WidgetAnalyticsChart, l as WidgetActionTranslation, m as ActionResult, n as ChatArtifact, o as SchedulerInfo, p as WidgetUser, r as ChatMessage, s as Source, t as BootstrapInfo, u as WidgetConfig, v as ExplanationFeedbackInput, w as WidgetStrings, x as PublicChatActionField, y as GifResult } from "./types-3zpBBhPI.mjs";
2
2
  import { JSX } from "preact";
3
3
 
4
4
  //#region src/config.d.ts
@@ -225,6 +225,7 @@ declare const ActionsArea: ({
225
225
  scheduler,
226
226
  exclude,
227
227
  openAction,
228
+ showTrigger,
228
229
  translations,
229
230
  onClose
230
231
  }: {
@@ -240,6 +241,8 @@ declare const ActionsArea: ({
240
241
  exclude?: string[];
241
242
  /** Action id the backend resolved for this turn — opens its form directly. */
242
243
  openAction?: string;
244
+ /** Inline chat forms use the shared footer menu instead of a second trigger. */
245
+ showTrigger?: boolean;
243
246
  /** Locale-specific copy keyed by stable action ID. */
244
247
  translations?: Record<string, WidgetActionTranslation>;
245
248
  /** A host that shows the actions in its own panel: closing or cancelling