@helpai/elements 1.1.9 → 1.1.10
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.
- package/elements-web-component.esm.js +4 -4
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +5 -5
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +5 -5
- package/elements.esm.js.map +3 -3
- package/elements.js +5 -5
- package/elements.js.map +3 -3
- package/index.mjs +2 -2
- package/package.json +1 -1
- package/web-component.mjs +2 -2
package/elements.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";var HelpAI=(()=>{var jr=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var Zu=Object.getOwnPropertyNames;var e_=Object.prototype.hasOwnProperty;var t_=(e,t,n)=>t in e?jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var n_=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Zu(t))!e_.call(e,r)&&r!==n&&jr(e,r,{get:()=>t[r],enumerable:!(o=Qu(t,r))||o.enumerable});return e};var o_=e=>n_(jr({},"__esModule",{value:!0}),e);var te=(e,t,n)=>t_(e,typeof t!="symbol"?t+"":t,n);var ev={};var w={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var $i={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This chat is closed",conversationLoading:"Loading chat\u2026",loadPreviousMessages:"Load previous messages",close:"Close",collapse:"Collapse",collapseSidebar:"Collapse sidebar",composerPlaceholder:"Type a message\u2026",dateLastWeek:"Last 7 days",dateOlder:"Older",dateToday:"Today",dateYesterday:"Yesterday",dropZone:"Drop files to attach",errorGeneric:"Something went wrong",errorRateLimited:"Too many requests \u2014 please try again in a moment.",errorRetry:"Retry",expand:"Expand",expandSidebar:"Expand sidebar",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",history:"History",historyBack:"Back to chat",historyEmpty:"No previous chats yet",historyLoading:"Loading your chats\u2026",historyContinue:"Continue the chat",historyTitle:"Chat history",loadMoreConversations:"Load more conversations",language:"Language",launcherOpen:"Open chat",launcherLabel:"Chat with us",micStart:"Start voice input",micStop:"Stop voice input",micUnsupported:"Voice input is not supported in this browser",moreActions:"More actions",newConversation:"New chat",panelTitle:"Chat",resizeHandle:"Drag to resize",scrollToBottom:"Scroll to latest",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new chat",talkToOperator:"Talk to an operator",connectingOperator:"Connecting you to an operator\u2026",noOperatorAvailable:"No one's available right now \u2014 leave your details and we'll follow up.",chattingWithOperator:"You're chatting with {operator}",cancelOperatorRequest:"Keep chatting with the AI",stop:"Stop",theme:"Theme",themeAuto:"Auto",themeDark:"Dark",themeLight:"Light",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",loading:"Loading\u2026",thinking:"Thinking\u2026",thoughts:"Thoughts",toolResult:"Result",sources:"Sources",feedbackUp:"Good response",feedbackDown:"Bad response",feedbackThanks:"Thanks for your feedback",copy:"Copy",copied:"Copied",tabHome:"Home",tabConversations:"Chats",tabHelp:"Help",tabNews:"News",modulesEmpty:"Nothing here yet",moduleBack:"Back",contentLoading:"Loading\u2026",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results found",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",formSubmit:"Submit",formSkip:"Maybe later",formSubmitted:"Completed",formSkipped:"Maybe later",formFillOut:"Fill out",formRequired:"This field is required",formInvalidEmail:"Enter a valid email address",formInvalidTel:"Enter a valid phone number",formInvalidUrl:"Enter a valid URL",formInvalidNumber:"Enter a valid number",formTooShort:"Too short (min {min} characters)",formTooLong:"Too long (max {max} characters)",formNumberTooSmall:"Must be at least {min}",formNumberTooLarge:"Must be at most {max}",formPatternMismatch:"Please match the requested format",formChooseAtLeast:"Choose at least {min}",formChooseAtMost:"Choose at most {max}",formOther:"Other",formOtherPlaceholder:"Type your answer\u2026",inputRequired:"Questions for you",inputBadge:"Questions",inputAnswered:"Answered",inputSkipped:"Skipped",showOptions:"Show options",hideOptions:"Hide options",qtypeText:"Your answer",qtypeEmail:"Email address",qtypePhone:"Phone number",qtypeNumber:"Number",qtypeDate:"Date",qtypeChooseOne:"Pick one",qtypeChooseAny:"Pick any",qtypeBoolean:"Yes / No",inputSubmit:"Submit answers",inputSubmitHint:"Enter to send \xB7 Shift+Enter = new line",inputSkip:"Skip",confirmYes:"Yes",confirmNo:"No",approve:"Approve",reject:"Reject",approvalPrompt:"{tool} requires your approval to execute.",approvalBody:"Review the tool input above and decide whether to allow this action.",approvalYourResponse:"Your response: {decision}",approvalEditHint:"You can edit this response until this step continues.",approvalSubmitting:"Response submitted. Request in progress\u2026",edit:"Edit",toolParameters:"Parameters",statusAwaiting:"Awaiting Approval",statusResponded:"Submitted",statusRunning:"Running",statusCompleted:"Completed",statusDenied:"Denied",statusError:"Error",statusSuperseded:"Skipped"},r_={attach:"Joindre des fichiers",attachmentMimeRejected:"Type de fichier non pris en charge",attachmentTooLarge:"Le fichier est trop volumineux",attachmentTooMany:"Limite de pi\xE8ces jointes atteinte",conversationClosed:"Ce chat est ferm\xE9",conversationLoading:"Chargement du chat\u2026",loadPreviousMessages:"Charger les messages pr\xE9c\xE9dents",close:"Fermer",collapse:"R\xE9duire",collapseSidebar:"R\xE9duire la barre lat\xE9rale",composerPlaceholder:"\xC9crivez un message\u2026",dateLastWeek:"7 derniers jours",dateOlder:"Plus ancien",dateToday:"Aujourd'hui",dateYesterday:"Hier",dropZone:"D\xE9posez les fichiers \xE0 joindre",errorGeneric:"Une erreur s'est produite",errorRateLimited:"Trop de requ\xEAtes \u2014 veuillez r\xE9essayer dans un instant.",errorRetry:"R\xE9essayer",expand:"Agrandir",expandSidebar:"D\xE9velopper la barre lat\xE9rale",exitFullscreen:"Quitter le plein \xE9cran",fullscreen:"Plein \xE9cran",history:"Historique",historyBack:"Retour au chat",historyEmpty:"Aucun chat pour le moment",historyContinue:"Poursuivre le chat",historyLoading:"Chargement de vos chats\u2026",historyTitle:"Historique des chats",loadMoreConversations:"Charger plus de conversations",language:"Langue",launcherOpen:"Ouvrir le chat",launcherLabel:"Discuter avec nous",micStart:"D\xE9marrer la saisie vocale",micStop:"Arr\xEAter la saisie vocale",micUnsupported:"La saisie vocale n'est pas prise en charge par ce navigateur",moreActions:"Plus d'actions",newConversation:"Nouveau chat",panelTitle:"Chat",resizeHandle:"Glisser pour redimensionner",scrollToBottom:"Aller au plus r\xE9cent",send:"Envoyer",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer un nouveau chat",talkToOperator:"Parler \xE0 un op\xE9rateur",connectingOperator:"Mise en relation avec un op\xE9rateur\u2026",noOperatorAvailable:"Personne n'est disponible pour le moment \u2014 laissez vos coordonn\xE9es et nous reviendrons vers vous.",chattingWithOperator:"Vous discutez avec {operator}",cancelOperatorRequest:"Continuer avec l'IA",stop:"Arr\xEAter",theme:"Th\xE8me",themeAuto:"Auto",themeDark:"Sombre",themeLight:"Clair",textSize:"Taille du texte",textSizeSmall:"Petite",textSizeNormal:"Normale",textSizeLarge:"Grande",loading:"Chargement\u2026",thinking:"R\xE9flexion\u2026",thoughts:"R\xE9flexions",toolResult:"R\xE9sultat",sources:"Sources",feedbackUp:"Bonne r\xE9ponse",feedbackDown:"Mauvaise r\xE9ponse",feedbackThanks:"Merci pour votre retour",copy:"Copier",copied:"Copi\xE9",tabHome:"Accueil",tabConversations:"Chats",tabHelp:"Aide",tabNews:"Actualit\xE9s",modulesEmpty:"Rien pour le moment",moduleBack:"Retour",contentLoading:"Chargement\u2026",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeContentTitle:"Articles populaires",homeStatus:"Statut",helpTitle:"Aide",helpSearchPlaceholder:"Rechercher de l'aide",helpEmpty:"Aucun article d'aide pour le moment",helpLoading:"Chargement de l'aide\u2026",helpSearchEmpty:"Aucun r\xE9sultat trouv\xE9",newsTitle:"Actualit\xE9s",newsEmpty:"Aucune actualit\xE9 pour le moment",newsLoading:"Chargement des actualit\xE9s\u2026",newsBack:"Retour aux actualit\xE9s",newsPublishedAt:"Publi\xE9 le {date}",formSubmit:"Envoyer",formSkip:"Plus tard",formSubmitted:"Termin\xE9",formSkipped:"Plus tard",formFillOut:"Remplir",formRequired:"Ce champ est obligatoire",formInvalidEmail:"Saisissez une adresse e-mail valide",formInvalidTel:"Saisissez un num\xE9ro de t\xE9l\xE9phone valide",formInvalidUrl:"Saisissez une URL valide",formInvalidNumber:"Saisissez un nombre valide",formTooShort:"Trop court (min. {min} caract\xE8res)",formTooLong:"Trop long (max. {max} caract\xE8res)",formNumberTooSmall:"Doit \xEAtre au moins {min}",formNumberTooLarge:"Doit \xEAtre au plus {max}",formPatternMismatch:"Veuillez respecter le format demand\xE9",formChooseAtLeast:"Choisissez au moins {min}",formChooseAtMost:"Choisissez au plus {max}",formOther:"Autre",formOtherPlaceholder:"Saisissez votre r\xE9ponse\u2026",inputRequired:"Questions pour vous",inputBadge:"Questions",inputAnswered:"R\xE9pondu",inputSkipped:"Ignor\xE9",showOptions:"Afficher les options",hideOptions:"Masquer les options",qtypeText:"Votre r\xE9ponse",qtypeEmail:"Adresse e-mail",qtypePhone:"Num\xE9ro de t\xE9l\xE9phone",qtypeNumber:"Nombre",qtypeDate:"Date",qtypeChooseOne:"Choisir une",qtypeChooseAny:"Choisir plusieurs",qtypeBoolean:"Oui / Non",inputSubmit:"Envoyer les r\xE9ponses",inputSubmitHint:"Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e = saut de ligne",inputSkip:"Ignorer",confirmYes:"Oui",confirmNo:"Non",approve:"Approuver",reject:"Refuser",approvalPrompt:"{tool} n\xE9cessite votre approbation pour s'ex\xE9cuter.",approvalBody:"V\xE9rifiez les param\xE8tres ci-dessus et d\xE9cidez d'autoriser ou non cette action.",approvalYourResponse:"Votre r\xE9ponse : {decision}",approvalEditHint:"Vous pouvez modifier votre r\xE9ponse jusqu'\xE0 la reprise de cette \xE9tape.",approvalSubmitting:"R\xE9ponse envoy\xE9e. Traitement en cours\u2026",edit:"Modifier",toolParameters:"Param\xE8tres",statusAwaiting:"En attente d'approbation",statusResponded:"Envoy\xE9",statusRunning:"En cours",statusCompleted:"Termin\xE9",statusDenied:"Refus\xE9",statusError:"Erreur",statusSuperseded:"Ignor\xE9"},a_={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",attachmentMimeRejected:"\u0646\u0648\u0639 \u0627\u0644\u0645\u0644\u0641 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645",attachmentTooLarge:"\u062D\u062C\u0645 \u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627",attachmentTooMany:"\u062A\u0645 \u0628\u0644\u0648\u063A \u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 \u0644\u0644\u0645\u0631\u0641\u0642\u0627\u062A",conversationClosed:"\u062A\u0645 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",conversationLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0629\u2026",loadPreviousMessages:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0633\u0627\u0628\u0642\u0629",close:"\u0625\u063A\u0644\u0627\u0642",collapse:"\u0637\u064A\u0651",collapseSidebar:"\u0637\u064A\u0651 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",composerPlaceholder:"\u0627\u0643\u062A\u0628 \u0631\u0633\u0627\u0644\u0629\u2026",dateLastWeek:"\u0622\u062E\u0631 \u0667 \u0623\u064A\u0627\u0645",dateOlder:"\u0623\u0642\u062F\u0645",dateToday:"\u0627\u0644\u064A\u0648\u0645",dateYesterday:"\u0623\u0645\u0633",dropZone:"\u0623\u0641\u0644\u062A \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0644\u0625\u0631\u0641\u0627\u0642\u0647\u0627",errorGeneric:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627",errorRateLimited:"\u0637\u0644\u0628\u0627\u062A \u0643\u062B\u064A\u0631\u0629 \u062C\u062F\u064B\u0627 \u2014 \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0628\u0639\u062F \u0644\u062D\u0638\u0629.",errorRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",expand:"\u062A\u0648\u0633\u064A\u0639",expandSidebar:"\u062A\u0648\u0633\u064A\u0639 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",exitFullscreen:"\u0625\u0646\u0647\u0627\u0621 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",fullscreen:"\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",history:"\u0627\u0644\u0633\u062C\u0644",historyBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u062F\u0631\u062F\u0634\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F",historyContinue:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u062F\u0631\u062F\u0634\u0627\u062A\u0643\u2026",historyTitle:"\u0633\u062C\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",loadMoreConversations:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0632\u064A\u062F \u0645\u0646 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",language:"\u0627\u0644\u0644\u063A\u0629",launcherOpen:"\u0641\u062A\u062D \u0627\u0644\u062F\u0631\u062F\u0634\u0629",launcherLabel:"\u062A\u062D\u062F\u062B \u0645\u0639\u0646\u0627",micStart:"\u0628\u062F\u0621 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micStop:"\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micUnsupported:"\u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D",moreActions:"\u0625\u062C\u0631\u0627\u0621\u0627\u062A \u0625\u0636\u0627\u0641\u064A\u0629",newConversation:"\u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",panelTitle:"\u0627\u0644\u062F\u0631\u062F\u0634\u0629",resizeHandle:"\u0627\u0633\u062D\u0628 \u0644\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u062D\u062C\u0645",scrollToBottom:"\u0627\u0644\u0627\u0646\u062A\u0642\u0627\u0644 \u0625\u0644\u0649 \u0627\u0644\u0623\u062D\u062F\u062B",send:"\u0625\u0631\u0633\u0627\u0644",soundOff:"\u0643\u062A\u0645 \u0627\u0644\u0635\u0648\u062A",soundOn:"\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u0635\u0648\u062A",startNewConversation:"\u0628\u062F\u0621 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",talkToOperator:"\u0627\u0644\u062A\u062D\u062F\u062B \u0625\u0644\u0649 \u0645\u0648\u0638\u0641",connectingOperator:"\u062C\u0627\u0631\u064A \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0623\u062D\u062F \u0627\u0644\u0645\u0648\u0638\u0641\u064A\u0646\u2026",noOperatorAvailable:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u0648\u0638\u0641\u0648\u0646 \u0645\u062A\u0627\u062D\u0648\u0646 \u0627\u0644\u0622\u0646 \u2014 \u0627\u062A\u0631\u0643 \u0628\u064A\u0627\u0646\u0627\u062A\u0643 \u0648\u0633\u0646\u062A\u0648\u0627\u0635\u0644 \u0645\u0639\u0643.",chattingWithOperator:"\u0623\u0646\u062A \u062A\u062A\u062D\u062F\u062B \u0645\u0639 {operator}",cancelOperatorRequest:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0645\u0639 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",stop:"\u0625\u064A\u0642\u0627\u0641",theme:"\u0627\u0644\u0645\u0638\u0647\u0631",themeAuto:"\u062A\u0644\u0642\u0627\u0626\u064A",themeDark:"\u062F\u0627\u0643\u0646",themeLight:"\u0641\u0627\u062A\u062D",textSize:"\u062D\u062C\u0645 \u0627\u0644\u0646\u0635",textSizeSmall:"\u0635\u063A\u064A\u0631",textSizeNormal:"\u0639\u0627\u062F\u064A",textSizeLarge:"\u0643\u0628\u064A\u0631",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",thinking:"\u064A\u0641\u0643\u0651\u0631\u2026",thoughts:"\u0627\u0644\u0623\u0641\u0643\u0627\u0631",toolResult:"\u0627\u0644\u0646\u062A\u064A\u062C\u0629",sources:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631",feedbackUp:"\u0631\u062F \u062C\u064A\u062F",feedbackDown:"\u0631\u062F \u0633\u064A\u0626",feedbackThanks:"\u0634\u0643\u0631\u064B\u0627 \u0639\u0644\u0649 \u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0643",copy:"\u0646\u0633\u062E",copied:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",tabHome:"\u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",tabConversations:"\u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",tabHelp:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",tabNews:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",modulesEmpty:"\u0644\u0627 \u0634\u064A\u0621 \u0647\u0646\u0627 \u0628\u0639\u062F",moduleBack:"\u0631\u062C\u0648\u0639",contentLoading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",homeGreeting:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeGreetingNamed:"\u0645\u0631\u062D\u0628\u064B\u0627 {name} \u{1F44B}",homeGreetingLead:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",homeContentTitle:"\u0645\u0642\u0627\u0644\u0627\u062A \u0634\u0627\u0626\u0639\u0629",homeStatus:"\u0627\u0644\u062D\u0627\u0644\u0629",helpTitle:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",helpSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",helpEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u0642\u0627\u0644\u0627\u062A \u0645\u0633\u0627\u0639\u062F\u0629 \u0628\u0639\u062F",helpLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629\u2026",helpSearchEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",newsTitle:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0623\u062E\u0628\u0627\u0631 \u0628\u0639\u062F",newsLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0623\u062E\u0628\u0627\u0631\u2026",newsBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsPublishedAt:"\u0646\u064F\u0634\u0631 \u0641\u064A {date}",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSkip:"\u0644\u0627\u062D\u0642\u064B\u0627",formSubmitted:"\u062A\u0645",formSkipped:"\u0644\u0627\u062D\u0642\u064B\u0627",formFillOut:"\u062A\u0639\u0628\u0626\u0629",formRequired:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628",formInvalidEmail:"\u0623\u062F\u062E\u0644 \u0628\u0631\u064A\u062F\u064B\u0627 \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidTel:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidUrl:"\u0623\u062F\u062E\u0644 \u0631\u0627\u0628\u0637\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidNumber:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formTooShort:"\u0642\u0635\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649 {min} \u062D\u0631\u0641\u064B\u0627)",formTooLong:"\u0637\u0648\u064A\u0644 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627)",formNumberTooSmall:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 \u0639\u0646 {min}",formNumberTooLarge:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F \u0639\u0646 {max}",formPatternMismatch:"\u064A\u0631\u062C\u0649 \u0645\u0637\u0627\u0628\u0642\u0629 \u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629",formChooseAtLeast:"\u0627\u062E\u062A\u0631 {min} \u0639\u0644\u0649 \u0627\u0644\u0623\u0642\u0644",formChooseAtMost:"\u0627\u062E\u062A\u0631 {max} \u0639\u0644\u0649 \u0627\u0644\u0623\u0643\u062B\u0631",formOther:"\u0623\u062E\u0631\u0649",formOtherPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",inputRequired:"\u0623\u0633\u0626\u0644\u0629 \u0644\u0643",inputBadge:"\u0623\u0633\u0626\u0644\u0629",inputAnswered:"\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSkipped:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",showOptions:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",hideOptions:"\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",qtypeText:"\u0625\u062C\u0627\u0628\u062A\u0643",qtypeEmail:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",qtypePhone:"\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641",qtypeNumber:"\u0631\u0642\u0645",qtypeDate:"\u062A\u0627\u0631\u064A\u062E",qtypeChooseOne:"\u0627\u062E\u062A\u0631 \u0648\u0627\u062D\u062F\u064B\u0627",qtypeChooseAny:"\u0627\u062E\u062A\u0631 \u0623\u064A\u064B\u0627",qtypeBoolean:"\u0646\u0639\u0645 / \u0644\u0627",inputSubmit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",inputSubmitHint:"Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter = \u0633\u0637\u0631 \u062C\u062F\u064A\u062F",inputSkip:"\u062A\u062E\u0637\u064D\u0651",confirmYes:"\u0646\u0639\u0645",confirmNo:"\u0644\u0627",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",approvalPrompt:"\u062A\u062A\u0637\u0644\u0628 {tool} \u0645\u0648\u0627\u0641\u0642\u062A\u0643 \u0644\u0644\u062A\u0646\u0641\u064A\u0630.",approvalBody:"\u0631\u0627\u062C\u0639 \u0645\u064F\u0639\u0637\u064A\u0627\u062A \u0627\u0644\u0623\u062F\u0627\u0629 \u0623\u0639\u0644\u0627\u0647 \u0648\u0642\u0631\u0651\u0631 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0647\u0630\u0627 \u0627\u0644\u0625\u062C\u0631\u0627\u0621 \u0623\u0648 \u0631\u0641\u0636\u0647.",approvalYourResponse:"\u0631\u062F\u0651\u0643: {decision}",approvalEditHint:"\u064A\u0645\u0643\u0646\u0643 \u062A\u0639\u062F\u064A\u0644 \u0631\u062F\u0651\u0643 \u062D\u062A\u0649 \u062A\u0633\u062A\u0623\u0646\u0641 \u0647\u0630\u0647 \u0627\u0644\u062E\u0637\u0648\u0629.",approvalSubmitting:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u062F. \u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0646\u0641\u064A\u0630\u2026",edit:"\u062A\u0639\u062F\u064A\u0644",toolParameters:"\u0627\u0644\u0645\u0639\u0637\u064A\u0627\u062A",statusAwaiting:"\u0628\u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629",statusResponded:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644",statusRunning:"\u0642\u064A\u062F \u0627\u0644\u062A\u0646\u0641\u064A\u0630",statusCompleted:"\u0645\u0643\u062A\u0645\u0644",statusDenied:"\u0645\u0631\u0641\u0648\u0636",statusError:"\u062E\u0637\u0623",statusSuperseded:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A"},i_={attach:"Adjuntar archivos",attachmentMimeRejected:"Tipo de archivo no admitido",attachmentTooLarge:"El archivo es demasiado grande",attachmentTooMany:"Se alcanz\xF3 el l\xEDmite de adjuntos",conversationClosed:"Este chat est\xE1 cerrado",conversationLoading:"Cargando chat\u2026",loadPreviousMessages:"Cargar mensajes anteriores",close:"Cerrar",collapse:"Contraer",collapseSidebar:"Contraer la barra lateral",composerPlaceholder:"Escribe un mensaje\u2026",dateLastWeek:"\xDAltimos 7 d\xEDas",dateOlder:"Anteriores",dateToday:"Hoy",dateYesterday:"Ayer",dropZone:"Suelta los archivos para adjuntarlos",errorGeneric:"Algo sali\xF3 mal",errorRateLimited:"Demasiadas solicitudes: int\xE9ntalo de nuevo en un momento.",errorRetry:"Reintentar",expand:"Ampliar",expandSidebar:"Expandir la barra lateral",exitFullscreen:"Salir de pantalla completa",fullscreen:"Pantalla completa",history:"Historial",historyBack:"Volver al chat",historyEmpty:"A\xFAn no tienes chats",historyContinue:"Continuar el chat",historyLoading:"Cargando tus chats\u2026",historyTitle:"Historial de chats",loadMoreConversations:"Cargar m\xE1s conversaciones",language:"Idioma",launcherOpen:"Abrir el chat",launcherLabel:"Chatea con nosotros",micStart:"Iniciar entrada de voz",micStop:"Detener entrada de voz",micUnsupported:"Este navegador no admite la entrada de voz",moreActions:"M\xE1s acciones",newConversation:"Nuevo chat",panelTitle:"Chat",resizeHandle:"Arrastra para cambiar el tama\xF1o",scrollToBottom:"Ir a lo m\xE1s reciente",send:"Enviar",soundOff:"Sonido desactivado",soundOn:"Sonido activado",startNewConversation:"Iniciar un chat nuevo",talkToOperator:"Hablar con un operador",connectingOperator:"Conect\xE1ndote con un operador\u2026",noOperatorAvailable:"Nadie est\xE1 disponible ahora \u2014 deja tus datos y te contactaremos.",chattingWithOperator:"Est\xE1s chateando con {operator}",cancelOperatorRequest:"Seguir con la IA",stop:"Detener",theme:"Tema",themeAuto:"Autom\xE1tico",themeDark:"Oscuro",themeLight:"Claro",textSize:"Tama\xF1o del texto",textSizeSmall:"Peque\xF1o",textSizeNormal:"Normal",textSizeLarge:"Grande",loading:"Cargando\u2026",thinking:"Pensando\u2026",thoughts:"Razonamiento",toolResult:"Resultado",sources:"Fuentes",feedbackUp:"Buena respuesta",feedbackDown:"Mala respuesta",feedbackThanks:"Gracias por tu opini\xF3n",copy:"Copiar",copied:"Copiado",tabHome:"Inicio",tabConversations:"Chats",tabHelp:"Ayuda",tabNews:"Novedades",modulesEmpty:"A\xFAn no hay nada aqu\xED",moduleBack:"Atr\xE1s",contentLoading:"Cargando\u2026",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeContentTitle:"Art\xEDculos populares",homeStatus:"Estado",helpTitle:"Ayuda",helpSearchPlaceholder:"Buscar ayuda",helpEmpty:"A\xFAn no hay art\xEDculos de ayuda",helpLoading:"Cargando la ayuda\u2026",helpSearchEmpty:"No se encontraron resultados",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",formSubmit:"Enviar",formSkip:"Quiz\xE1 m\xE1s tarde",formSubmitted:"Completado",formSkipped:"Quiz\xE1 m\xE1s tarde",formFillOut:"Completar",formRequired:"Este campo es obligatorio",formInvalidEmail:"Introduce un correo electr\xF3nico v\xE1lido",formInvalidTel:"Introduce un n\xFAmero de tel\xE9fono v\xE1lido",formInvalidUrl:"Introduce una URL v\xE1lida",formInvalidNumber:"Introduce un n\xFAmero v\xE1lido",formTooShort:"Demasiado corto (m\xEDn. {min} caracteres)",formTooLong:"Demasiado largo (m\xE1x. {max} caracteres)",formNumberTooSmall:"Debe ser al menos {min}",formNumberTooLarge:"Debe ser como m\xE1ximo {max}",formPatternMismatch:"Respeta el formato solicitado",formChooseAtLeast:"Elige al menos {min}",formChooseAtMost:"Elige como m\xE1ximo {max}",formOther:"Otro",formOtherPlaceholder:"Escribe tu respuesta\u2026",inputRequired:"Preguntas para ti",inputBadge:"Preguntas",inputAnswered:"Respondido",inputSkipped:"Omitido",showOptions:"Mostrar opciones",hideOptions:"Ocultar opciones",qtypeText:"Tu respuesta",qtypeEmail:"Correo electr\xF3nico",qtypePhone:"N\xFAmero de tel\xE9fono",qtypeNumber:"N\xFAmero",qtypeDate:"Fecha",qtypeChooseOne:"Elige una",qtypeChooseAny:"Elige varias",qtypeBoolean:"S\xED / No",inputSubmit:"Enviar respuestas",inputSubmitHint:"Enter para enviar \xB7 May\xFAs+Enter = nueva l\xEDnea",inputSkip:"Omitir",confirmYes:"S\xED",confirmNo:"No",approve:"Aprobar",reject:"Rechazar",approvalPrompt:"{tool} requiere tu aprobaci\xF3n para ejecutarse.",approvalBody:"Revisa los par\xE1metros de arriba y decide si permites esta acci\xF3n.",approvalYourResponse:"Tu respuesta: {decision}",approvalEditHint:"Puedes cambiar tu respuesta hasta que este paso contin\xFAe.",approvalSubmitting:"Respuesta enviada. Procesando\u2026",edit:"Editar",toolParameters:"Par\xE1metros",statusAwaiting:"Esperando aprobaci\xF3n",statusResponded:"Enviado",statusRunning:"En curso",statusCompleted:"Completado",statusDenied:"Denegado",statusError:"Error",statusSuperseded:"Omitido"},s_={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",attachmentMimeRejected:"\u05E1\u05D5\u05D2 \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA",attachmentTooLarge:"\u05D4\u05E7\u05D5\u05D1\u05E5 \u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9",attachmentTooMany:"\u05D4\u05D2\u05E2\u05EA \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D4\u05DE\u05E8\u05D1\u05D9 \u05E9\u05DC \u05E7\u05D1\u05E6\u05D9\u05DD \u05DE\u05E6\u05D5\u05E8\u05E4\u05D9\u05DD",conversationClosed:"\u05D4\u05E6\u05F3\u05D0\u05D8 \u05D4\u05D6\u05D4 \u05E0\u05E1\u05D2\u05E8",conversationLoading:"\u05D8\u05D5\u05E2\u05DF \u05E6\u05F3\u05D0\u05D8\u2026",loadPreviousMessages:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05E7\u05D5\u05D3\u05DE\u05D5\u05EA",close:"\u05E1\u05D2\u05D9\u05E8\u05D4",collapse:"\u05DB\u05D9\u05D5\u05D5\u05E5",collapseSidebar:"\u05DB\u05D9\u05D5\u05D5\u05E5 \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",composerPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D4\u05D5\u05D3\u05E2\u05D4\u2026",dateLastWeek:"7 \u05D4\u05D9\u05DE\u05D9\u05DD \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D9\u05DD",dateOlder:"\u05D9\u05E9\u05DF \u05D9\u05D5\u05EA\u05E8",dateToday:"\u05D4\u05D9\u05D5\u05DD",dateYesterday:"\u05D0\u05EA\u05DE\u05D5\u05DC",dropZone:"\u05E9\u05D7\u05E8\u05E8 \u05E7\u05D1\u05E6\u05D9\u05DD \u05DB\u05D3\u05D9 \u05DC\u05E6\u05E8\u05E3",errorGeneric:"\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9",errorRateLimited:"\u05D9\u05D5\u05EA\u05E8 \u05DE\u05D3\u05D9 \u05D1\u05E7\u05E9\u05D5\u05EA \u2014 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 \u05E8\u05D2\u05E2.",errorRetry:"\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1",expand:"\u05D4\u05E8\u05D7\u05D1\u05D4",expandSidebar:"\u05D4\u05E8\u05D7\u05D1\u05EA \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",exitFullscreen:"\u05D9\u05E6\u05D9\u05D0\u05D4 \u05DE\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",fullscreen:"\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",history:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D4",historyBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05E6\u05F3\u05D0\u05D8",historyEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E7\u05D5\u05D3\u05DE\u05D9\u05DD",historyContinue:"\u05D4\u05DE\u05E9\u05DA \u05E6\u05F3\u05D0\u05D8",historyLoading:"\u05D8\u05D5\u05E2\u05DF \u05D0\u05EA \u05D4\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA\u2026",historyTitle:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",loadMoreConversations:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05E9\u05D9\u05D7\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",language:"\u05E9\u05E4\u05D4",launcherOpen:"\u05E4\u05EA\u05D9\u05D7\u05EA \u05E6\u05F3\u05D0\u05D8",launcherLabel:"\u05D3\u05D1\u05E8\u05D5 \u05D0\u05D9\u05EA\u05E0\u05D5",micStart:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micStop:"\u05E2\u05E6\u05D9\u05E8\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micUnsupported:"\u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF \u05D6\u05D4",moreActions:"\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",newConversation:"\u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",panelTitle:"\u05E6\u05F3\u05D0\u05D8",resizeHandle:"\u05D2\u05E8\u05D5\u05E8 \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9 \u05D4\u05D2\u05D5\u05D3\u05DC",scrollToBottom:"\u05DE\u05E2\u05D1\u05E8 \u05DC\u05D7\u05D3\u05E9 \u05D1\u05D9\u05D5\u05EA\u05E8",send:"\u05E9\u05DC\u05D9\u05D7\u05D4",soundOff:"\u05D4\u05E9\u05EA\u05E7\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",soundOn:"\u05D4\u05E4\u05E2\u05DC\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",startNewConversation:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",talkToOperator:"\u05D3\u05D1\u05E8 \u05E2\u05DD \u05E0\u05E6\u05D9\u05D2",connectingOperator:"\u05DE\u05D7\u05D1\u05E8 \u05D0\u05D5\u05EA\u05DA \u05DC\u05E0\u05E6\u05D9\u05D2\u2026",noOperatorAvailable:"\u05D0\u05D9\u05DF \u05E0\u05E6\u05D9\u05D2\u05D9\u05DD \u05D6\u05DE\u05D9\u05E0\u05D9\u05DD \u05DB\u05E2\u05EA \u2014 \u05D4\u05E9\u05D0\u05E8 \u05D0\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA \u05D5\u05E0\u05D7\u05D6\u05D5\u05E8 \u05D0\u05DC\u05D9\u05DA.",chattingWithOperator:"\u05D0\u05EA\u05D4 \u05DE\u05E6\u05F3\u05D5\u05D8\u05D8 \u05E2\u05DD {operator}",cancelOperatorRequest:"\u05D4\u05DE\u05E9\u05DA \u05DC\u05E9\u05D5\u05D7\u05D7 \u05E2\u05DD \u05D4-AI",stop:"\u05E2\u05E6\u05D9\u05E8\u05D4",theme:"\u05E2\u05E8\u05DB\u05EA \u05E0\u05D5\u05E9\u05D0",themeAuto:"\u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9",themeDark:"\u05DB\u05D4\u05D4",themeLight:"\u05D1\u05D4\u05D9\u05E8",textSize:"\u05D2\u05D5\u05D3\u05DC \u05D8\u05E7\u05E1\u05D8",textSizeSmall:"\u05E7\u05D8\u05DF",textSizeNormal:"\u05E8\u05D2\u05D9\u05DC",textSizeLarge:"\u05D2\u05D3\u05D5\u05DC",loading:"\u05D8\u05D5\u05E2\u05DF\u2026",thinking:"\u05D7\u05D5\u05E9\u05D1\u2026",thoughts:"\u05DE\u05D7\u05E9\u05D1\u05D5\u05EA",toolResult:"\u05EA\u05D5\u05E6\u05D0\u05D4",sources:"\u05DE\u05E7\u05D5\u05E8\u05D5\u05EA",feedbackUp:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D8\u05D5\u05D1\u05D4",feedbackDown:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D2\u05E8\u05D5\u05E2\u05D4",feedbackThanks:"\u05EA\u05D5\u05D3\u05D4 \u05E2\u05DC \u05D4\u05DE\u05E9\u05D5\u05D1",copy:"\u05D4\u05E2\u05EA\u05E7",copied:"\u05D4\u05D5\u05E2\u05EA\u05E7",tabHome:"\u05D1\u05D9\u05EA",tabConversations:"\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",tabHelp:"\u05E2\u05D6\u05E8\u05D4",tabNews:"\u05D7\u05D3\u05E9\u05D5\u05EA",modulesEmpty:"\u05D0\u05D9\u05DF \u05DB\u05D0\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DB\u05DC\u05D5\u05DD",moduleBack:"\u05D7\u05D6\u05E8\u05D4",contentLoading:"\u05D8\u05D5\u05E2\u05DF\u2026",homeGreeting:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeGreetingNamed:"\u05E9\u05DC\u05D5\u05DD {name} \u{1F44B}",homeGreetingLead:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",homeContentTitle:"\u05DE\u05D0\u05DE\u05E8\u05D9\u05DD \u05E4\u05D5\u05E4\u05D5\u05DC\u05E8\u05D9\u05D9\u05DD",homeStatus:"\u05E1\u05D8\u05D8\u05D5\u05E1",helpTitle:"\u05E2\u05D6\u05E8\u05D4",helpSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",helpEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DE\u05D0\u05DE\u05E8\u05D9 \u05E2\u05D6\u05E8\u05D4",helpLoading:"\u05D8\u05D5\u05E2\u05DF \u05E2\u05D6\u05E8\u05D4\u2026",helpSearchEmpty:"\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA",newsTitle:"\u05D7\u05D3\u05E9\u05D5\u05EA",newsEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA",newsLoading:"\u05D8\u05D5\u05E2\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA\u2026",newsBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05D7\u05D3\u05E9\u05D5\u05EA",newsPublishedAt:"\u05E4\u05D5\u05E8\u05E1\u05DD \u05D1-{date}",formSubmit:"\u05E9\u05DC\u05D9\u05D7\u05D4",formSkip:"\u05D0\u05D7\u05E8 \u05DB\u05DA",formSubmitted:"\u05E0\u05E9\u05DC\u05D7",formSkipped:"\u05D3\u05D5\u05DC\u05D2",formFillOut:"\u05DE\u05D9\u05DC\u05D5\u05D9",formRequired:"\u05E9\u05D3\u05D4 \u05D7\u05D5\u05D1\u05D4",formInvalidEmail:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidTel:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05EA\u05E7\u05D9\u05DF",formInvalidUrl:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA URL \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidNumber:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05EA\u05E7\u05D9\u05DF",formTooShort:"\u05E7\u05E6\u05E8 \u05DE\u05D3\u05D9 (\u05DC\u05E4\u05D7\u05D5\u05EA {min} \u05EA\u05D5\u05D5\u05D9\u05DD)",formTooLong:"\u05D0\u05E8\u05D5\u05DA \u05DE\u05D3\u05D9 (\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max} \u05EA\u05D5\u05D5\u05D9\u05DD)",formNumberTooSmall:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formNumberTooLarge:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formPatternMismatch:"\u05D4\u05EA\u05D0\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D4\u05E0\u05D3\u05E8\u05E9\u05EA",formChooseAtLeast:"\u05D1\u05D7\u05E8 \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formChooseAtMost:"\u05D1\u05D7\u05E8 \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formOther:"\u05D0\u05D7\u05E8",formOtherPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D0\u05EA \u05EA\u05E9\u05D5\u05D1\u05EA\u05DA\u2026",inputRequired:"\u05E9\u05D0\u05DC\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8\u05DA",inputBadge:"\u05E9\u05D0\u05DC\u05D5\u05EA",inputAnswered:"\u05E0\u05E2\u05E0\u05D4",inputSkipped:"\u05D3\u05D5\u05DC\u05D2",showOptions:"\u05D4\u05E6\u05D2 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",hideOptions:"\u05D4\u05E1\u05EA\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",qtypeText:"\u05D4\u05EA\u05E9\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA",qtypeEmail:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",qtypePhone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",qtypeNumber:"\u05DE\u05E1\u05E4\u05E8",qtypeDate:"\u05EA\u05D0\u05E8\u05D9\u05DA",qtypeChooseOne:"\u05D1\u05D7\u05E8 \u05D0\u05D7\u05EA",qtypeChooseAny:"\u05D1\u05D7\u05E8 \u05DB\u05DE\u05D4",qtypeBoolean:"\u05DB\u05DF / \u05DC\u05D0",inputSubmit:"\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05E9\u05D5\u05D1\u05D5\u05EA",inputSubmitHint:"Enter \u05DC\u05E9\u05DC\u05D9\u05D7\u05D4 \xB7 Shift+Enter = \u05E9\u05D5\u05E8\u05D4 \u05D7\u05D3\u05E9\u05D4",inputSkip:"\u05D3\u05D9\u05DC\u05D5\u05D2",confirmYes:"\u05DB\u05DF",confirmNo:"\u05DC\u05D0",approve:"\u05D0\u05D9\u05E9\u05D5\u05E8",reject:"\u05D3\u05D7\u05D9\u05D9\u05D4",approvalPrompt:"\u05D4\u05DB\u05DC\u05D9 {tool} \u05D3\u05D5\u05E8\u05E9 \u05D0\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8\u05DA \u05DB\u05D3\u05D9 \u05DC\u05E4\u05E2\u05D5\u05DC.",approvalBody:"\u05D1\u05D3\u05D5\u05E7 \u05D0\u05EA \u05E4\u05E8\u05DE\u05D8\u05E8\u05D9 \u05D4\u05DB\u05DC\u05D9 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4 \u05D5\u05D4\u05D7\u05DC\u05D8 \u05D0\u05DD \u05DC\u05D0\u05E9\u05E8 \u05E4\u05E2\u05D5\u05DC\u05D4 \u05D6\u05D5.",approvalYourResponse:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA: {decision}",approvalEditHint:"\u05E0\u05D9\u05EA\u05DF \u05DC\u05E2\u05E8\u05D5\u05DA \u05D0\u05EA \u05EA\u05D2\u05D5\u05D1\u05EA\u05DA \u05E2\u05D3 \u05E9\u05D4\u05E9\u05DC\u05D1 \u05D4\u05D6\u05D4 \u05D9\u05EA\u05D7\u05D3\u05E9.",approvalSubmitting:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4. \u05DE\u05D1\u05E6\u05E2\u2026",edit:"\u05E2\u05E8\u05D9\u05DB\u05D4",toolParameters:"\u05E4\u05E8\u05DE\u05D8\u05E8\u05D9\u05DD",statusAwaiting:"\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8",statusResponded:"\u05E0\u05E9\u05DC\u05D7",statusRunning:"\u05E4\u05D5\u05E2\u05DC",statusCompleted:"\u05D4\u05D5\u05E9\u05DC\u05DD",statusDenied:"\u05E0\u05D3\u05D7\u05D4",statusError:"\u05E9\u05D2\u05D9\u05D0\u05D4",statusSuperseded:"\u05D3\u05D5\u05DC\u05D2"},l_={en:$i,fr:r_,ar:a_,es:i_,he:s_};function ho(e,t){let n=Fi(e),o=bo(t),r=n==="en"?{}:l_[n]??{},a=o?t[n]??{}:t??{},s=o?t.en??{}:{};return{...$i,...r,...s,...a}}function Fi(e){return(e.split("-")[0]??"en").toLowerCase()}var c_=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function Bi(e){return c_.has(Fi(e))}function Ze(e,t){return e[t]??t}function bo(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function Hi(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function Ui(e,t){let{translations:n,defaultLocale:o,...r}=e,a=Hi(n,t);return a?{...r,title:a.title??r.title,description:a.description??r.description,content:a.content??r.content}:r}function zi(e,t){let{translations:n,defaultLocale:o,...r}=e,a=Hi(n,t);if(!a)return r;let s=new Map((a.fields??[]).map(c=>[c.name,c])),l=r.fields.map(c=>{let u=s.get(c.name);if(!u)return c;let _=new Map((u.options??[]).map(p=>[p.value,p]));return{...c,label:u.label??c.label,placeholder:u.placeholder??c.placeholder,validationHint:u.validationHint??c.validationHint,options:c.options?.map(p=>{let d=_.get(p.value);return d?{...p,label:d.label??p.label,description:d.description??p.description}:p})}});return{...r,title:a.title??r.title,description:a.description??r.description,submitLabel:a.submitLabel??r.submitLabel,fields:l}}var Xr=class{get(t){try{return localStorage.getItem(t)}catch{return null}}set(t,n){try{localStorage.setItem(t,n)}catch{}}remove(t){try{localStorage.removeItem(t)}catch{}}},yo=new Xr;var Qr=["off","error","warn","info","debug","trace"],Zr=w.cssPrefix,qi=`${Zr}.debug`,d_=`__${w.global}_DEBUG__`,u_=`${Zr}-debug`,Po=2,Yr=null;function __(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(u_);if(e!==null){let t=Jr(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(qi);if(e){let t=Jr(e);if(t>=0)return t}}catch{}return Reflect.get(window,d_)?4:2}function Jr(e){if(e===!0||e==="1"||e==="true")return 4;if(e===!1||e==="0"||e==="false"||e==="off")return 0;if(typeof e=="number")return Math.max(0,Math.min(5,Math.floor(e)));if(typeof e=="string"){let t=Qr.indexOf(e);if(t>=0)return t}return-1}function xo(e){let t=Jr(e);if(!(t<0)){Po=t;try{window.localStorage?.setItem(qi,Qr[t])}catch{}}}function $n(){return Qr[Po]}Po=__();function Wi(e){let t=`[${Zr}:${e}]`,n=(o,r,a)=>(s,l)=>{if(!(Po<o)&&(l===void 0?console[r](t,s):console[r](t,s,l),Yr))try{Yr({level:a,scope:e,message:s,payload:l})}catch{}};return{error:n(1,"error","error"),warn:n(2,"warn","warn"),info:n(3,"info","info"),debug:n(4,"debug","debug"),trace:n(5,"debug","trace"),scope:o=>Wi(`${e}:${o}`)}}var X=Wi("core");function Fn(e){Yr=e}var Vt=X.scope("context"),p_=new Set(["visitorId","conversationId","conversationId","jwt","token","authorization","password"]),Vi=50,ea=1024,f_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ta(e){return Gi(e,"userContext",!0)}function na(e){return Gi(e,"pageContext",!1)}function Gi(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Vt.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},r=0;for(let[a,s]of Object.entries(e)){if(p_.has(a)){Vt.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(r>=Vi){Vt.warn(`${t} truncated at ${Vi} keys \u2014 dropped "${a}"`);continue}let l=m_(t,a,s);l!==void 0&&(o[a]=l,r++)}return n&&typeof o.email=="string"&&!f_.test(o.email)&&(Vt.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function m_(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Vt.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>ea?(Vt.warn(`truncated ${e}.${t} to ${ea} chars`),o.slice(0,ea)):o}Vt.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var So={maxBytes:10485760,maxCount:10,accept:"*/*"},Ki={voice:"local"},ji={list:[],byTrigger:{}},oa={enabled:!0,sampleRate:1},ko={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},pn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},Xi={floating:["theme","textSize","history","close","clear","expand","fullscreen","sound","language"],inline:["theme","textSize","history","close","clear","fullscreen","sound","language"],standalone:["theme","textSize","history","clear","sound","language"],page:["theme","textSize","history","clear","sound","language"],modal:["theme","textSize","history","close","clear","fullscreen","sound","language"],drawer:["theme","textSize","history","close","clear","fullscreen","sound","language"]},ra={enabled:!0,volume:.3,events:void 0},Yi={enabled:!0,events:void 0},Ji=[{label:"tabConversations",layout:"chat"}];function At(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},r=t.i18n??{},a=t.feedback??{},s=t.footer??{},l=t.header??{},{themeMode:c,themeOverrides:u}=g_(t.theme),_=n.mode??"floating",p=v_(r.defaultLocale),d=r.availableLocales??[r.locale??p],f=fn(r.locale??p,d,p),m=(t.baseUrl??w.defaultBaseUrl).replace(/\/$/,""),g=(t.agentApiBaseUrl??`${m}/api/agent`).replace(/\/$/,""),h=(t.dataApiBaseUrl??`${m}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:m,agentApiBaseUrl:g,dataApiBaseUrl:h,userContext:ta(t.userContext),pageContext:na(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:u,mode:_,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,showSources:o.showSources??!1,enableMessageFeedback:!(o.disableMessageFeedback??!1),autoSendSuggestions:o.autoSendSuggestions??!1,features:{voice:t.features?.voice??Ki.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Bn(t.forms,f),endpoints:{upload:t.endpoints?.upload??ko.upload,transcribe:t.endpoints?.transcribe??ko.transcribe,submitForm:t.endpoints?.submitForm??ko.submitForm},attachments:{accept:t.composer?.attachments?.accept??So.accept,maxBytes:t.composer?.attachments?.maxBytes??So.maxBytes,maxCount:t.composer?.attachments?.maxCount??So.maxCount},locale:f,defaultLocale:p,availableLocales:d,startMinimized:o.startMinimized??!0,actions:h_(_,l.actions),size:n.size??{},launcher:C_(t.launcher),sound:b_(a.sound),haptics:y_(a.haptics),strings:ho(f,r.strings),stringsOverride:r.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:x_(s.poweredBy),composer:S_(t.composer),modules:k_(t.modules),tracking:P_(t.tracking,h),storage:t.storage??yo,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function g_(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function v_(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function fn(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function h_(e,t){return t??Xi[e]}function b_(e){return{enabled:e?.enabled??ra.enabled,volume:e?.volume??ra.volume,events:e?.events}}function y_(e){return{enabled:e?.enabled??Yi.enabled,events:e?.events}}function P_(e,t){let n=e?.sampleRate??oa.sampleRate;return{enabled:e?.enabled??oa.enabled,endpoint:e?.endpoint??`${t}/pai/elements-px.gif`,sampleRate:Math.min(1,Math.max(0,Number.isFinite(n)?n:1)),token:e?.token}}function x_(e){let n={...{text:`Powered by ${w.displayName}`,href:w.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function S_(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function k_(e){let t=e===void 0?Ji:e,n=new Set,o=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let s=a.contentTags?.filter(Boolean),l=a.id??s?.[0]??a.layout;for(;n.has(l);)l=`${l}-${o.length}`;n.add(l);let c={id:l,label:a.label,layout:a.layout};s&&s.length>0&&(c.contentTags=s),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=!(a.hideGreeting??!1),c.showSearchBar=!(a.hideSearchBar??!1),c.showRecentConversations=!(a.hideRecentConversations??!1),a.userAvatars&&a.userAvatars.length>0&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let r=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:r}}function Bn(e,t){var a;if(!e?.length)return ji;let n=[],o=new Set;for(let s of e){if(!s?.id||o.has(s.id))continue;let l=zi(s,t),c=(l.fields??[]).filter(_=>!!(_&&_.name&&_.label&&_.type)),u=(Array.isArray(l.on)?l.on:[l.on]).map(w_).filter(_=>_!==null);c.length===0||u.length===0||(o.add(l.id),n.push({id:l.id,triggers:u,when:l.when,fields:c,title:l.title,description:l.description,submitLabel:l.submitLabel,skippable:l.skippable??!1,frequency:l.frequency??"once",mirrorToContext:l.mirrorToContext??!0,reopenable:l.reopenable??!0,reviewable:l.reviewable??!0}))}let r={};for(let s of n)for(let l of s.triggers)(r[a=l.kind]??(r[a]=[])).push(s);return{list:n,byTrigger:r}}function w_(e){if(typeof e!="string")return null;if(e==="pre-chat"||e==="conversation-closed"||e==="panel-close"||e==="manual")return{kind:e};let[t,n]=e.split(":",2);if(t==="after-messages"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"after-messages",param:o}:null}if(t==="idle"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"idle",param:o}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function C_(e){let t=e?.callout?.text?{shape:"pill",position:"auto",delayMs:1200,autoDismissMs:0,animated:!0,persistent:!0,...e.callout}:null;return{variant:e?.variant??pn.variant,size:e?.size??pn.size,label:e?.label??pn.label,icon:e?.icon??pn.icon,hidden:e?.hidden??pn.hidden,callout:t}}function aa(e,t,n,o){let r=fn(t,e.availableLocales,e.defaultLocale);if(r===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return r!==e.locale&&(a.locale=r,a.strings=ho(r,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var R_=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function ia(e,t){if(!t)return e;let n={...e};for(let a of R_){let s=t[a];if(s===void 0)continue;let l=e[a];if(a==="theme"){l===void 0&&(n[a]=s);continue}a!=="i18n"&&(n[a]=Qi(s,l))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules),t.dataApiBaseUrl!==void 0&&e.dataApiBaseUrl===void 0&&(n.dataApiBaseUrl=t.dataApiBaseUrl);let o=e.i18n,r=t.i18n;if(o||r){let a=Qi(r??{},o);r?.availableLocales!==void 0&&(a.availableLocales=r.availableLocales),r?.defaultLocale!==void 0&&(a.defaultLocale=r.defaultLocale);let s=o?.strings,l=r?.strings;(s||l)&&(a.strings=T_(l,s)),n.i18n=a}return n}function Qi(e,t){if(!t)return e;let n={...e};for(let[o,r]of Object.entries(t))r!==void 0&&(n[o]=r);return n}function T_(e,t){if(!e)return t;if(!t)return e;let n=bo(e),o=bo(t);if(!n&&!o)return{...e,...t};let r={},a=n?e:{en:e},s=o?t:{en:t};for(let[l,c]of Object.entries(a))r[l]={...c};for(let[l,c]of Object.entries(s))r[l]={...r[l],...c};return r}var I_=["clear","expand","fullscreen","sound","history","language","theme","textSize","close"],xt=e=>e!=="false",E_=e=>e.split(",").map(t=>t.trim()).filter(Boolean),es=[["public-key","publicKey"],["ai-agent-deployment-id","aiAgentDeploymentId"],["base-url","baseUrl"],["agent-api-base-url","agentApiBaseUrl"],["data-api-base-url","dataApiBaseUrl"],["theme","theme",e=>e]],ts=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",xt]],ns=[["width","width"],["height","height"]],os=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",xt],["show-reasoning","showReasoning",xt],["show-tool-calls","showToolCalls",xt],["show-sources","showSources",xt],["disable-message-feedback","disableMessageFeedback",xt],["auto-send-suggestions","autoSendSuggestions",xt]],rs=[["locale","locale"]],A_=new Set(I_),M_=e=>E_(e).filter(t=>A_.has(t)),as=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",xt]],is=[["features-disable-file-upload","disableFileUpload",xt],["features-voice","voice",e=>e]],ss=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],ls=[["user-id","id"],["user-email","email"],["user-name","name"]],cs=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],L_=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],O_=[es,ts,ns,os,rs,as,is,ss,ls,cs],N_=new Set(["iframe","start-minimized"]),sa=[...O_.flatMap(e=>e.map(([t])=>t).filter(t=>!N_.has(t))),...L_];function wo(e){let t={},n=f=>{let m=e(f);return m===null||m===""?void 0:m};for(let[f,m,g]of es){let h=n(f);h!==void 0&&(t[m]=g?g(h):h)}let o=Gt(n,ts),r=Gt(n,ns);(o||r)&&(t.presentation={...o,...r?{size:r}:{}});let a=Gt(n,os);a&&(t.behavior=a);let s=Gt(n,rs);s&&(t.i18n=s);let l=$_(e,n);l&&(t.launcher=l);let c=Gt(n,is);c&&(t.features=c);let u=Gt(n,ss);u&&(t.endpoints=u);let _=Zi(n,ls,"user-context");_&&(t.userContext=_);let p=Zi(n,cs,"page-context");p&&(t.pageContext=p);let d=n("actions");return d!==void 0&&(t.header={actions:M_(d)}),t}function la(e){return e?wo(t=>e[D_(t==="data-api-base-url"?"api-base-url":t)]??null):{}}function D_(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Gt(e,t){let n={};for(let[o,r,a]of t){let s=e(o);s!==void 0&&(n[r]=a?a(s):s)}return Object.keys(n).length>0?n:null}function Zi(e,t,n){let o={};for(let[l,c]of t){let u=e(l);u!==void 0&&(o[c]=u)}let r={},a=e(n);if(a)try{let l=JSON.parse(a);l&&typeof l=="object"&&!Array.isArray(l)&&(r=l)}catch{}let s={...r,...o};return Object.keys(s).length>0?s:null}function $_(e,t){let n=Gt(t,as)??{},o=e("launcher-label");o!==null&&(n.label=o);let r=t("callout-text");if(r){let a=Number.parseInt(t("callout-delay")??"",10);n.callout={text:r,...Number.isFinite(a)?{delayMs:a}:{}}}return Object.keys(n).length>0?n:null}var Mo,J,fs,_a,Mt,ds,ms,gs,ca,Ro,Hn,vs,pa,da,ua,F_,Io={},Eo=[],B_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Un=Array.isArray;function St(e,t){for(var n in t)e[n]=t[n];return e}function fa(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function kt(e,t,n){var o,r,a,s={};for(a in t)a=="key"?o=t[a]:a=="ref"?r=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?Mo.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return To(e,s,o,r,null)}function To(e,t,n,o,r){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++fs,__i:-1,__u:0};return r==null&&J.vnode!=null&&J.vnode(a),a}function ce(e){return e.children}function et(e,t){this.props=e,this.context=t}function mn(e,t){if(t==null)return e.__?mn(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?mn(e):null}function H_(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],a=St({},t);a.__v=t.__v+1,J.vnode&&J.vnode(a),ma(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??mn(t),!!(32&t.__u),r),a.__v=t.__v,a.__.__k[a.__i]=a,xs(o,a,r),t.__e=t.__=null,a.__e!=n&&hs(a)}}function hs(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),hs(e)}function us(e){(!e.__d&&(e.__d=!0)&&Mt.push(e)&&!Ao.__r++||ds!=J.debounceRendering)&&((ds=J.debounceRendering)||ms)(Ao)}function Ao(){try{for(var e,t=1;Mt.length;)Mt.length>t&&Mt.sort(gs),e=Mt.shift(),t=Mt.length,H_(e)}finally{Mt.length=Ao.__r=0}}function bs(e,t,n,o,r,a,s,l,c,u,_){var p,d,f,m,g,h,P,x=o&&o.__k||Eo,b=t.length;for(c=U_(n,t,x,c,b),p=0;p<b;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&x[f.__i]||Io,f.__i=p,h=ma(e,f,d,r,a,s,l,c,u,_),m=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&ga(d.ref,null,f),_.push(f.ref,f.__c||m,f)),g==null&&m!=null&&(g=m),(P=!!(4&f.__u))||d.__k===f.__k?(c=ys(f,c,e,P),P&&d.__e&&(d.__e=null)):typeof f.type=="function"&&h!==void 0?c=h:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=g,c}function U_(e,t,n,o,r){var a,s,l,c,u,_=n.length,p=_,d=0;for(e.__k=new Array(r),a=0;a<r;a++)(s=t[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=To(null,s,null,null,null):Un(s)?s=e.__k[a]=To(ce,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=To(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+d,s.__=e,s.__b=e.__b+1,l=null,(u=s.__i=z_(s,n,c,p))!=-1&&(p--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(r>_?d--:r<_&&d++),typeof s.type!="function"&&(s.__u|=4)):u!=c&&(u==c-1?d--:u==c+1?d++:(u>c?d--:d++,s.__u|=4))):e.__k[a]=null;if(p)for(a=0;a<_;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=mn(l)),ks(l,l));return o}function ys(e,t,n,o){var r,a;if(typeof e.type=="function"){for(r=e.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=e,t=ys(r[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=mn(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function zn(e,t){return t=t||[],e==null||typeof e=="boolean"||(Un(e)?e.some(function(n){zn(n,t)}):t.push(e)),t}function z_(e,t,n,o){var r,a,s,l=e.key,c=e.type,u=t[n],_=u!=null&&(2&u.__u)==0;if(u===null&&l==null||_&&l==u.key&&c==u.type)return n;if(o>(_?1:0)){for(r=n-1,a=n+1;r>=0||a<t.length;)if((u=t[s=r>=0?r--:a++])!=null&&(2&u.__u)==0&&l==u.key&&c==u.type)return s}return-1}function _s(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||B_.test(t)?n:n+"px"}function Co(e,t,n,o,r){var a,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||_s(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||_s(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(vs,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[Hn]=o[Hn]:(n[Hn]=pa,e.addEventListener(t,a?ua:da,a)):e.removeEventListener(t,a?ua:da,a);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ps(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ro]==null)t[Ro]=pa++;else if(t[Ro]<n[Hn])return;return n(J.event?J.event(t):t)}}}function ma(e,t,n,o,r,a,s,l,c,u){var _,p,d,f,m,g,h,P,x,b,y,k,C,B,G,U,I=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(_=J.__b)&&_(t);e:if(typeof I=="function"){p=s.length;try{if(x=t.props,b=I.prototype&&I.prototype.render,y=(_=I.contextType)&&o[_.__c],k=_?y?y.props.value:_.__:o,n.__c?P=(d=t.__c=n.__c).__=d.__E:(b?t.__c=d=new I(x,k):(t.__c=d=new et(x,k),d.constructor=I,d.render=W_),y&&y.sub(d),d.state||(d.state={}),d.__n=o,f=d.__d=!0,d.__h=[],d._sb=[]),b&&d.__s==null&&(d.__s=d.state),b&&I.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=St({},d.__s)),St(d.__s,I.getDerivedStateFromProps(x,d.__s))),m=d.props,g=d.state,d.__v=t,f)b&&I.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),b&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(b&&I.getDerivedStateFromProps==null&&x!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(x,k),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(x,d.__s,k)===!1){t.__v!=n.__v&&(d.props=x,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(z){z&&(z.__=t)}),Eo.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(x,d.__s,k),b&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,g,h)})}if(d.context=k,d.props=x,d.__P=e,d.__e=!1,C=J.__r,B=0,b)d.state=d.__s,d.__d=!1,C&&C(t),_=d.render(d.props,d.state,d.context),Eo.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,C&&C(t),_=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++B<25);d.state=d.__s,d.getChildContext!=null&&(o=St(St({},o),d.getChildContext())),b&&!f&&d.getSnapshotBeforeUpdate!=null&&(h=d.getSnapshotBeforeUpdate(m,g)),G=_!=null&&_.type===ce&&_.key==null?Ss(_.props.children):_,l=bs(e,Un(G)?G:[G],t,n,o,r,a,s,l,c,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),P&&(d.__E=d.__=null)}catch(z){if(s.length=p,t.__v=null,c||a!=null){if(z.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),t.__e=l}else if(a!=null)for(U=a.length;U--;)fa(a[U])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),z.then||Ps(t),J.__e(z,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=q_(n.__e,t,n,o,r,a,s,c,u);return(_=J.diffed)&&_(t),128&t.__u?void 0:l}function Ps(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ps))}function xs(e,t,n){for(var o=0;o<n.length;o++)ga(n[o],n[++o],n[++o]);J.__c&&J.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(a){a.call(r)})}catch(a){J.__e(a,r.__v)}})}function Ss(e){return typeof e!="object"||e==null||e.__b>0?e:Un(e)?e.map(Ss):e.constructor!==void 0?null:St({},e)}function q_(e,t,n,o,r,a,s,l,c){var u,_,p,d,f,m,g,h=n.props||Io,P=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),a!=null){for(u=0;u<a.length;u++)if((f=a[u])&&"setAttribute"in f==!!x&&(x?f.localName==x:f.nodeType==3)){e=f,a[u]=null;break}}if(e==null){if(x==null)return document.createTextNode(P);e=document.createElementNS(r,x,P.is&&P),l&&(J.__m&&J.__m(t,a),l=!1),a=null}if(x==null)h===P||l&&e.data==P||(e.data=P);else{if(a=x=="textarea"&&P.defaultValue!=null?null:a&&Mo.call(e.childNodes),!l&&a!=null)for(h={},u=0;u<e.attributes.length;u++)h[(f=e.attributes[u]).name]=f.value;for(u in h)f=h[u],u=="dangerouslySetInnerHTML"?p=f:u=="children"||u in P||u=="value"&&"defaultValue"in P||u=="checked"&&"defaultChecked"in P||Co(e,u,null,f,r);for(u in P)f=P[u],u=="children"?d=f:u=="dangerouslySetInnerHTML"?_=f:u=="value"?m=f:u=="checked"?g=f:l&&typeof f!="function"||h[u]===f||Co(e,u,f,h[u],r);if(_)l||p&&(_.__html==p.__html||_.__html==e.innerHTML)||(e.innerHTML=_.__html),t.__k=[];else if(p&&(e.innerHTML=""),bs(t.type=="template"?e.content:e,Un(d)?d:[d],t,n,o,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,a,s,a?a[0]:n.__k&&mn(n,0),l,c),a!=null)for(u=a.length;u--;)fa(a[u]);l&&x!="textarea"||(u="value",x=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[u]||x=="progress"&&!m||x=="option"&&m!=h[u])&&Co(e,u,m,h[u],r),u="checked",g!=null&&g!=e[u]&&Co(e,u,g,h[u],r))}return e}function ga(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){J.__e(r,n)}}function ks(e,t,n){var o,r;if(J.unmount&&J.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ga(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){J.__e(a,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&ks(o[r],t,n||typeof e.type!="function");n||fa(e.__e),e.__c=e.__=e.__e=void 0}function W_(e,t,n){return this.constructor(e,n)}function Kt(e,t,n){var o,r,a,s;t==document&&(t=document.documentElement),J.__&&J.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],ma(t,e=(!o&&n||t).__k=kt(ce,null,[e]),r||Io,Io,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?Mo.call(t.childNodes):null,a,!o&&n?n:r?r.__e:t.firstChild,o,s),xs(a,e,s),e.props.children=null}Mo=Eo.slice,J={__e:function(e,t,n,o){for(var r,a,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((a=r.constructor)&&a.getDerivedStateFromError!=null&&(r.setState(a.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(l){e=l}throw e}},fs=0,_a=function(e){return e!=null&&e.constructor===void 0},et.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=St({},this.state),typeof e=="function"&&(e=e(St({},n),this.props)),e&&St(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),us(this))},et.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),us(this))},et.prototype.render=ce,Mt=[],ms=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,gs=function(e,t){return e.__v.__b-t.__v.__b},Ao.__r=0,ca=Math.random().toString(8),Ro="__d"+ca,Hn="__a"+ca,vs=/(PointerCapture)$|Capture$/i,pa=0,da=ps(!1),ua=ps(!0),F_=0;var gn="1.1.9";function ws(e){return`${w.cssPrefix}:${e}`}function qn(e,t,n){e.dispatchEvent(new CustomEvent(ws(t),{detail:n}))}function Cs(e,t){let o=Object.entries(t).map(([r,a])=>{let s=ws(r),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[r,a]of o)e.removeEventListener(r,a)}}function at(){let e=Date.now(),t=new Uint8Array(16);t[0]=Math.floor(e/2**40)&255,t[1]=Math.floor(e/2**32)&255,t[2]=e>>>24&255,t[3]=e>>>16&255,t[4]=e>>>8&255,t[5]=e&255,V_(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function V_(e){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){crypto.getRandomValues(e);return}for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}var jt=X.scope("persistence");function Lt(e,t=yo,n){let o=n?`${e}.${n}`:e,r=`${w.cssPrefix}.storageVersion`,a=t.get(r)??void 0,s=a?`.v${a}`:"",l=`${w.cssPrefix}.${o}${s}`,c=`${w.cssPrefix}${s}.visitorId`,u=`${l}.conversationId`,_=`${l}.userPrefs`,p=`${l}.panelOpen`,d=`${l}.panelSize`,f=`${l}.calloutDismissed`,m=`${l}.sidebarCollapsed`,g=`${l}.activeModule`,h=`${l}.historyCount`,P=`${l}.formsDone`,x={getVisitorId(){let b=t.get(c);if(b)return b;let y=at();return t.set(c,y),y},setVisitorId(b){jt.debug("setVisitorId (rebind)",{id:b,scope:o}),t.set(c,b)},loadConversationId(){return t.get(u)??void 0},saveConversationId(b){jt.trace("saveConversationId",{id:b,scope:o}),b?t.set(u,b):t.remove(u)},loadDraft(b){return t.get(`${l}.draft.${b}`)??""},saveDraft(b,y){let k=`${l}.draft.${b}`;y?t.set(k,y):t.remove(k)},loadUserPrefs(){let b=t.get(_);if(!b)return{};try{let y=JSON.parse(b);return Rs(y)?y:{}}catch(y){return jt.warn("loadUserPrefs parse failed",{error:y}),{}}},saveUserPrefs(b){try{t.set(_,JSON.stringify(b))}catch(y){jt.warn("saveUserPrefs serialise failed",{error:y})}},patchUserPrefs(b){let y=x.loadUserPrefs();x.saveUserPrefs({...y,...b})},loadPanelOpen(){let b=t.get(p);return b==="1"?!0:b==="0"?!1:null},savePanelOpen(b){t.set(p,b?"1":"0")},loadPanelSize(){let b=t.get(d);return b==="normal"||b==="expanded"||b==="fullscreen"?b:null},savePanelSize(b){t.set(d,b)},loadCalloutDismissed(b){if(!b)return!1;let y=t.get(f);return!!y&&y===b},saveCalloutDismissed(b){b?t.set(f,b):t.remove(f)},loadSidebarCollapsed(){let b=t.get(m);return b==="1"?!0:b==="0"?!1:null},saveSidebarCollapsed(b){t.set(m,b?"1":"0")},loadActiveModule(){return t.get(g)||null},saveActiveModule(b){t.set(g,b)},loadHistoryCount(){let b=t.get(h);if(!b)return null;let y=Number.parseInt(b,10);return Number.isFinite(y)&&y>=0?y:null},saveHistoryCount(b){t.set(h,String(b))},loadFormsDone(){let b=t.get(P);if(!b)return{};try{let y=JSON.parse(b);return Rs(y)?y:{}}catch(y){return jt.warn("loadFormsDone parse failed",{error:y}),{}}},saveFormDone(b){try{let y=x.loadFormsDone();y[b]=Date.now(),t.set(P,JSON.stringify(y))}catch(y){jt.warn("saveFormDone serialise failed",{error:y})}},rememberStorageVersion(b){b&&b!==t.get(r)&&(jt.debug("rememberStorageVersion (force-reset on next load)",{version:b}),t.set(r,b))},clearConversation(){t.remove(u)}};return x}function Rs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ts=`:host{--__P__-accent-user: __BRAND_ACCENT__;--__P__-accent: var(--__P__-accent-user);--__P__-accent-text-user: __BRAND_ACCENT_TEXT__;--__P__-accent-text: var(--__P__-accent-text-user);--__P__-accent-fg: var(--__P__-accent);--__P__-radius: __BRAND_RADIUS__;--__P__-radius-sm: 8px;--__P__-radius-md: 10px;--__P__-radius-lg: 16px;--__P__-font: __BRAND_FONT__;--__P__-font-display: var(--__P__-font);--__P__-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--__P__-bg: oklch(1 0 0);--__P__-bg-elevated: oklch(.9789 .0029 278.3);--__P__-surface: var(--__P__-bg-elevated);--__P__-muted: var(--__P__-fg-muted);--__P__-hover: oklch(.1686 .011 278.3 / .06);--__P__-fg: oklch(.1686 .011 278.3);--__P__-fg-muted: oklch(.4932 .0301 278.3);--__P__-border: oklch(.9312 .0084 278.3);--__P__-border-strong: oklch(.8757 .0131 278.3);--__P__-bubble-user: var(--__P__-accent);--__P__-bubble-user-text: var(--__P__-accent-text);--__P__-bubble-assistant: oklch(.9638 .0058 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-on-accent: var(--__P__-accent-text);--__P__-success: oklch(.6456 .1654 151.53);--__P__-warning: oklch(.7135 .1494 74.05);--__P__-danger: oklch(.5966 .1818 24.51);--__P__-danger-text: oklch(.5054 .1905 27.52);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .1);--__P__-neutral: oklch(.7137 .0192 278.3);--__P__-pill-l-min: .3;--__P__-pill-l-max: .46;--__P__-focus: var(--__P__-accent);--__P__-shadow-panel: 0 8px 24px -8px rgba(13, 15, 20, .18), 0 24px 64px -24px rgba(13, 15, 20, .24);--__P__-shadow-card: 0 1px 2px rgba(13, 15, 20, .06), 0 4px 12px -6px rgba(13, 15, 20, .12);--__P__-backdrop: oklch(.1686 .011 278.3 / .55);--__P__-shadow-fab: 0 6px 16px -4px color-mix(in oklch, var(--__P__-accent) 45%, transparent), 0 12px 32px -12px rgba(13, 15, 20, .25);--__P__-z-fab: 2147483600;--__P__-z-panel: 2147483601;--__P__-panel-w: 380px;--__P__-panel-h: 600px;--__P__-fab-size: 56px;--__P__-conversation-max: 768px;--__P__-space-1: 4px;--__P__-space-2: 8px;--__P__-space-3: 12px;--__P__-space-4: 16px;--__P__-space-5: 20px;--__P__-space-6: 24px;--__P__-space-8: 32px;--__P__-text-scale: 1;--__P__-text-xs: calc(12px * var(--__P__-text-scale));--__P__-text-sm: calc(13px * var(--__P__-text-scale));--__P__-text-base: calc(15px * var(--__P__-text-scale));--__P__-text-md: calc(16px * var(--__P__-text-scale));--__P__-text-lg: calc(18px * var(--__P__-text-scale));--__P__-text-xl: calc(22px * var(--__P__-text-scale));--__P__-text-2xl: calc(30px * var(--__P__-text-scale))}:host([data-mode="modal"]),:host([data-mode="drawer"]){--__P__-conversation-max: 100%}:host([data-text-size="small"]){--__P__-text-scale: .9}:host([data-text-size="large"]){--__P__-text-scale: 1.15}:host{--__P__-ease: cubic-bezier(.2, .7, .2, 1);--__P__-ease-out: cubic-bezier(.2, .7, .2, 1);--__P__-ease-in: cubic-bezier(.4, 0, 1, 1);--__P__-ease-in-out: cubic-bezier(.65, 0, .35, 1);--__P__-dur-quick: .12s;--__P__-dur-base: .22s;--__P__-dur-slow: .32s;font-family:var(--__P__-font);color:var(--__P__-fg);color-scheme:light;--__P__-color-scheme: light}:host([data-theme="dark"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-danger-text: oklch(.8077 .1035 19.57);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .18);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);--__P__-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -6px rgba(0, 0, 0, .5);--__P__-backdrop: rgba(0, 0, 0, .65);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;color-scheme:dark;--__P__-color-scheme: dark}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);color-scheme:dark;--__P__-color-scheme: dark}}@supports (color: oklch(from red l c h)){:host{--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.3, l, .62) c h);--__P__-accent-text: oklch(from var(--__P__-accent) clamp(0, (l / .623 - 1) * -infinity, 1) 0 h);--__P__-accent-fg: oklch(from var(--__P__-accent-user) clamp(.3, l, .46) c h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
|
|
1
|
+
"use strict";var HelpAI=(()=>{var jr=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var Zu=Object.getOwnPropertyNames;var e_=Object.prototype.hasOwnProperty;var t_=(e,t,n)=>t in e?jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var n_=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Zu(t))!e_.call(e,r)&&r!==n&&jr(e,r,{get:()=>t[r],enumerable:!(o=Qu(t,r))||o.enumerable});return e};var o_=e=>n_(jr({},"__esModule",{value:!0}),e);var te=(e,t,n)=>t_(e,typeof t!="symbol"?t+"":t,n);var ev={};var w={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var $i={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This chat is closed",conversationLoading:"Loading chat\u2026",loadPreviousMessages:"Load previous messages",close:"Close",collapse:"Collapse",collapseSidebar:"Collapse sidebar",composerPlaceholder:"Type a message\u2026",dateLastWeek:"Last 7 days",dateOlder:"Older",dateToday:"Today",dateYesterday:"Yesterday",dropZone:"Drop files to attach",errorGeneric:"Something went wrong",errorRateLimited:"Too many requests \u2014 please try again in a moment.",errorRetry:"Retry",expand:"Expand",expandSidebar:"Expand sidebar",exitFullscreen:"Exit fullscreen",fullscreen:"Fullscreen",history:"History",historyBack:"Back to chat",historyEmpty:"No previous chats yet",historyLoading:"Loading your chats\u2026",historyContinue:"Continue the chat",historyTitle:"Chat history",loadMoreConversations:"Load more conversations",language:"Language",launcherOpen:"Open chat",launcherLabel:"Chat with us",micStart:"Start voice input",micStop:"Stop voice input",micUnsupported:"Voice input is not supported in this browser",moreActions:"More actions",newConversation:"New chat",panelTitle:"Chat",resizeHandle:"Drag to resize",scrollToBottom:"Scroll to latest",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new chat",talkToOperator:"Talk to an operator",connectingOperator:"Connecting you to an operator\u2026",noOperatorAvailable:"No one's available right now \u2014 leave your details and we'll follow up.",chattingWithOperator:"You're chatting with {operator}",cancelOperatorRequest:"Keep chatting with the AI",stop:"Stop",theme:"Theme",themeAuto:"Auto",themeDark:"Dark",themeLight:"Light",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",loading:"Loading\u2026",thinking:"Thinking\u2026",thoughts:"Thoughts",toolResult:"Result",sources:"Sources",feedbackUp:"Good response",feedbackDown:"Bad response",feedbackThanks:"Thanks for your feedback",copy:"Copy",copied:"Copied",tabHome:"Home",tabConversations:"Chats",tabHelp:"Help",tabNews:"News",modulesEmpty:"Nothing here yet",moduleBack:"Back",contentLoading:"Loading\u2026",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results found",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",formSubmit:"Submit",formSkip:"Maybe later",formSubmitted:"Completed",formSkipped:"Maybe later",formFillOut:"Fill out",formRequired:"This field is required",formInvalidEmail:"Enter a valid email address",formInvalidTel:"Enter a valid phone number",formInvalidUrl:"Enter a valid URL",formInvalidNumber:"Enter a valid number",formTooShort:"Too short (min {min} characters)",formTooLong:"Too long (max {max} characters)",formNumberTooSmall:"Must be at least {min}",formNumberTooLarge:"Must be at most {max}",formPatternMismatch:"Please match the requested format",formChooseAtLeast:"Choose at least {min}",formChooseAtMost:"Choose at most {max}",formOther:"Other",formOtherPlaceholder:"Type your answer\u2026",inputRequired:"Questions for you",inputBadge:"Questions",inputAnswered:"Answered",inputSkipped:"Skipped",showOptions:"Show options",hideOptions:"Hide options",qtypeText:"Your answer",qtypeEmail:"Email address",qtypePhone:"Phone number",qtypeNumber:"Number",qtypeDate:"Date",qtypeChooseOne:"Pick one",qtypeChooseAny:"Pick any",qtypeBoolean:"Yes / No",inputSubmit:"Submit answers",inputSubmitHint:"Enter to send \xB7 Shift+Enter = new line",inputSkip:"Skip",confirmYes:"Yes",confirmNo:"No",approve:"Approve",reject:"Reject",approvalPrompt:"{tool} requires your approval to execute.",approvalBody:"Review the tool input above and decide whether to allow this action.",approvalYourResponse:"Your response: {decision}",approvalEditHint:"You can edit this response until this step continues.",approvalSubmitting:"Response submitted. Request in progress\u2026",edit:"Edit",toolParameters:"Parameters",statusAwaiting:"Awaiting Approval",statusResponded:"Submitted",statusRunning:"Running",statusCompleted:"Completed",statusDenied:"Denied",statusError:"Error",statusSuperseded:"Skipped"},r_={attach:"Joindre des fichiers",attachmentMimeRejected:"Type de fichier non pris en charge",attachmentTooLarge:"Le fichier est trop volumineux",attachmentTooMany:"Limite de pi\xE8ces jointes atteinte",conversationClosed:"Ce chat est ferm\xE9",conversationLoading:"Chargement du chat\u2026",loadPreviousMessages:"Charger les messages pr\xE9c\xE9dents",close:"Fermer",collapse:"R\xE9duire",collapseSidebar:"R\xE9duire la barre lat\xE9rale",composerPlaceholder:"\xC9crivez un message\u2026",dateLastWeek:"7 derniers jours",dateOlder:"Plus ancien",dateToday:"Aujourd'hui",dateYesterday:"Hier",dropZone:"D\xE9posez les fichiers \xE0 joindre",errorGeneric:"Une erreur s'est produite",errorRateLimited:"Trop de requ\xEAtes \u2014 veuillez r\xE9essayer dans un instant.",errorRetry:"R\xE9essayer",expand:"Agrandir",expandSidebar:"D\xE9velopper la barre lat\xE9rale",exitFullscreen:"Quitter le plein \xE9cran",fullscreen:"Plein \xE9cran",history:"Historique",historyBack:"Retour au chat",historyEmpty:"Aucun chat pour le moment",historyContinue:"Poursuivre le chat",historyLoading:"Chargement de vos chats\u2026",historyTitle:"Historique des chats",loadMoreConversations:"Charger plus de conversations",language:"Langue",launcherOpen:"Ouvrir le chat",launcherLabel:"Discuter avec nous",micStart:"D\xE9marrer la saisie vocale",micStop:"Arr\xEAter la saisie vocale",micUnsupported:"La saisie vocale n'est pas prise en charge par ce navigateur",moreActions:"Plus d'actions",newConversation:"Nouveau chat",panelTitle:"Chat",resizeHandle:"Glisser pour redimensionner",scrollToBottom:"Aller au plus r\xE9cent",send:"Envoyer",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer un nouveau chat",talkToOperator:"Parler \xE0 un op\xE9rateur",connectingOperator:"Mise en relation avec un op\xE9rateur\u2026",noOperatorAvailable:"Personne n'est disponible pour le moment \u2014 laissez vos coordonn\xE9es et nous reviendrons vers vous.",chattingWithOperator:"Vous discutez avec {operator}",cancelOperatorRequest:"Continuer avec l'IA",stop:"Arr\xEAter",theme:"Th\xE8me",themeAuto:"Auto",themeDark:"Sombre",themeLight:"Clair",textSize:"Taille du texte",textSizeSmall:"Petite",textSizeNormal:"Normale",textSizeLarge:"Grande",loading:"Chargement\u2026",thinking:"R\xE9flexion\u2026",thoughts:"R\xE9flexions",toolResult:"R\xE9sultat",sources:"Sources",feedbackUp:"Bonne r\xE9ponse",feedbackDown:"Mauvaise r\xE9ponse",feedbackThanks:"Merci pour votre retour",copy:"Copier",copied:"Copi\xE9",tabHome:"Accueil",tabConversations:"Chats",tabHelp:"Aide",tabNews:"Actualit\xE9s",modulesEmpty:"Rien pour le moment",moduleBack:"Retour",contentLoading:"Chargement\u2026",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeContentTitle:"Articles populaires",homeStatus:"Statut",helpTitle:"Aide",helpSearchPlaceholder:"Rechercher de l'aide",helpEmpty:"Aucun article d'aide pour le moment",helpLoading:"Chargement de l'aide\u2026",helpSearchEmpty:"Aucun r\xE9sultat trouv\xE9",newsTitle:"Actualit\xE9s",newsEmpty:"Aucune actualit\xE9 pour le moment",newsLoading:"Chargement des actualit\xE9s\u2026",newsBack:"Retour aux actualit\xE9s",newsPublishedAt:"Publi\xE9 le {date}",formSubmit:"Envoyer",formSkip:"Plus tard",formSubmitted:"Termin\xE9",formSkipped:"Plus tard",formFillOut:"Remplir",formRequired:"Ce champ est obligatoire",formInvalidEmail:"Saisissez une adresse e-mail valide",formInvalidTel:"Saisissez un num\xE9ro de t\xE9l\xE9phone valide",formInvalidUrl:"Saisissez une URL valide",formInvalidNumber:"Saisissez un nombre valide",formTooShort:"Trop court (min. {min} caract\xE8res)",formTooLong:"Trop long (max. {max} caract\xE8res)",formNumberTooSmall:"Doit \xEAtre au moins {min}",formNumberTooLarge:"Doit \xEAtre au plus {max}",formPatternMismatch:"Veuillez respecter le format demand\xE9",formChooseAtLeast:"Choisissez au moins {min}",formChooseAtMost:"Choisissez au plus {max}",formOther:"Autre",formOtherPlaceholder:"Saisissez votre r\xE9ponse\u2026",inputRequired:"Questions pour vous",inputBadge:"Questions",inputAnswered:"R\xE9pondu",inputSkipped:"Ignor\xE9",showOptions:"Afficher les options",hideOptions:"Masquer les options",qtypeText:"Votre r\xE9ponse",qtypeEmail:"Adresse e-mail",qtypePhone:"Num\xE9ro de t\xE9l\xE9phone",qtypeNumber:"Nombre",qtypeDate:"Date",qtypeChooseOne:"Choisir une",qtypeChooseAny:"Choisir plusieurs",qtypeBoolean:"Oui / Non",inputSubmit:"Envoyer les r\xE9ponses",inputSubmitHint:"Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e = saut de ligne",inputSkip:"Ignorer",confirmYes:"Oui",confirmNo:"Non",approve:"Approuver",reject:"Refuser",approvalPrompt:"{tool} n\xE9cessite votre approbation pour s'ex\xE9cuter.",approvalBody:"V\xE9rifiez les param\xE8tres ci-dessus et d\xE9cidez d'autoriser ou non cette action.",approvalYourResponse:"Votre r\xE9ponse : {decision}",approvalEditHint:"Vous pouvez modifier votre r\xE9ponse jusqu'\xE0 la reprise de cette \xE9tape.",approvalSubmitting:"R\xE9ponse envoy\xE9e. Traitement en cours\u2026",edit:"Modifier",toolParameters:"Param\xE8tres",statusAwaiting:"En attente d'approbation",statusResponded:"Envoy\xE9",statusRunning:"En cours",statusCompleted:"Termin\xE9",statusDenied:"Refus\xE9",statusError:"Erreur",statusSuperseded:"Ignor\xE9"},a_={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",attachmentMimeRejected:"\u0646\u0648\u0639 \u0627\u0644\u0645\u0644\u0641 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645",attachmentTooLarge:"\u062D\u062C\u0645 \u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627",attachmentTooMany:"\u062A\u0645 \u0628\u0644\u0648\u063A \u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 \u0644\u0644\u0645\u0631\u0641\u0642\u0627\u062A",conversationClosed:"\u062A\u0645 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",conversationLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0629\u2026",loadPreviousMessages:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0633\u0627\u0628\u0642\u0629",close:"\u0625\u063A\u0644\u0627\u0642",collapse:"\u0637\u064A\u0651",collapseSidebar:"\u0637\u064A\u0651 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",composerPlaceholder:"\u0627\u0643\u062A\u0628 \u0631\u0633\u0627\u0644\u0629\u2026",dateLastWeek:"\u0622\u062E\u0631 \u0667 \u0623\u064A\u0627\u0645",dateOlder:"\u0623\u0642\u062F\u0645",dateToday:"\u0627\u0644\u064A\u0648\u0645",dateYesterday:"\u0623\u0645\u0633",dropZone:"\u0623\u0641\u0644\u062A \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0644\u0625\u0631\u0641\u0627\u0642\u0647\u0627",errorGeneric:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627",errorRateLimited:"\u0637\u0644\u0628\u0627\u062A \u0643\u062B\u064A\u0631\u0629 \u062C\u062F\u064B\u0627 \u2014 \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0628\u0639\u062F \u0644\u062D\u0638\u0629.",errorRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",expand:"\u062A\u0648\u0633\u064A\u0639",expandSidebar:"\u062A\u0648\u0633\u064A\u0639 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",exitFullscreen:"\u0625\u0646\u0647\u0627\u0621 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",fullscreen:"\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",history:"\u0627\u0644\u0633\u062C\u0644",historyBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u062F\u0631\u062F\u0634\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F",historyContinue:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u062F\u0631\u062F\u0634\u0627\u062A\u0643\u2026",historyTitle:"\u0633\u062C\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",loadMoreConversations:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0632\u064A\u062F \u0645\u0646 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",language:"\u0627\u0644\u0644\u063A\u0629",launcherOpen:"\u0641\u062A\u062D \u0627\u0644\u062F\u0631\u062F\u0634\u0629",launcherLabel:"\u062A\u062D\u062F\u062B \u0645\u0639\u0646\u0627",micStart:"\u0628\u062F\u0621 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micStop:"\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micUnsupported:"\u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D",moreActions:"\u0625\u062C\u0631\u0627\u0621\u0627\u062A \u0625\u0636\u0627\u0641\u064A\u0629",newConversation:"\u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",panelTitle:"\u0627\u0644\u062F\u0631\u062F\u0634\u0629",resizeHandle:"\u0627\u0633\u062D\u0628 \u0644\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u062D\u062C\u0645",scrollToBottom:"\u0627\u0644\u0627\u0646\u062A\u0642\u0627\u0644 \u0625\u0644\u0649 \u0627\u0644\u0623\u062D\u062F\u062B",send:"\u0625\u0631\u0633\u0627\u0644",soundOff:"\u0643\u062A\u0645 \u0627\u0644\u0635\u0648\u062A",soundOn:"\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u0635\u0648\u062A",startNewConversation:"\u0628\u062F\u0621 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",talkToOperator:"\u0627\u0644\u062A\u062D\u062F\u062B \u0625\u0644\u0649 \u0645\u0648\u0638\u0641",connectingOperator:"\u062C\u0627\u0631\u064A \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0623\u062D\u062F \u0627\u0644\u0645\u0648\u0638\u0641\u064A\u0646\u2026",noOperatorAvailable:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u0648\u0638\u0641\u0648\u0646 \u0645\u062A\u0627\u062D\u0648\u0646 \u0627\u0644\u0622\u0646 \u2014 \u0627\u062A\u0631\u0643 \u0628\u064A\u0627\u0646\u0627\u062A\u0643 \u0648\u0633\u0646\u062A\u0648\u0627\u0635\u0644 \u0645\u0639\u0643.",chattingWithOperator:"\u0623\u0646\u062A \u062A\u062A\u062D\u062F\u062B \u0645\u0639 {operator}",cancelOperatorRequest:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0645\u0639 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",stop:"\u0625\u064A\u0642\u0627\u0641",theme:"\u0627\u0644\u0645\u0638\u0647\u0631",themeAuto:"\u062A\u0644\u0642\u0627\u0626\u064A",themeDark:"\u062F\u0627\u0643\u0646",themeLight:"\u0641\u0627\u062A\u062D",textSize:"\u062D\u062C\u0645 \u0627\u0644\u0646\u0635",textSizeSmall:"\u0635\u063A\u064A\u0631",textSizeNormal:"\u0639\u0627\u062F\u064A",textSizeLarge:"\u0643\u0628\u064A\u0631",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",thinking:"\u064A\u0641\u0643\u0651\u0631\u2026",thoughts:"\u0627\u0644\u0623\u0641\u0643\u0627\u0631",toolResult:"\u0627\u0644\u0646\u062A\u064A\u062C\u0629",sources:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631",feedbackUp:"\u0631\u062F \u062C\u064A\u062F",feedbackDown:"\u0631\u062F \u0633\u064A\u0626",feedbackThanks:"\u0634\u0643\u0631\u064B\u0627 \u0639\u0644\u0649 \u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0643",copy:"\u0646\u0633\u062E",copied:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",tabHome:"\u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",tabConversations:"\u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",tabHelp:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",tabNews:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",modulesEmpty:"\u0644\u0627 \u0634\u064A\u0621 \u0647\u0646\u0627 \u0628\u0639\u062F",moduleBack:"\u0631\u062C\u0648\u0639",contentLoading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",homeGreeting:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeGreetingNamed:"\u0645\u0631\u062D\u0628\u064B\u0627 {name} \u{1F44B}",homeGreetingLead:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",homeContentTitle:"\u0645\u0642\u0627\u0644\u0627\u062A \u0634\u0627\u0626\u0639\u0629",homeStatus:"\u0627\u0644\u062D\u0627\u0644\u0629",helpTitle:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",helpSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",helpEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u0642\u0627\u0644\u0627\u062A \u0645\u0633\u0627\u0639\u062F\u0629 \u0628\u0639\u062F",helpLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629\u2026",helpSearchEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",newsTitle:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0623\u062E\u0628\u0627\u0631 \u0628\u0639\u062F",newsLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0623\u062E\u0628\u0627\u0631\u2026",newsBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsPublishedAt:"\u0646\u064F\u0634\u0631 \u0641\u064A {date}",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSkip:"\u0644\u0627\u062D\u0642\u064B\u0627",formSubmitted:"\u062A\u0645",formSkipped:"\u0644\u0627\u062D\u0642\u064B\u0627",formFillOut:"\u062A\u0639\u0628\u0626\u0629",formRequired:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628",formInvalidEmail:"\u0623\u062F\u062E\u0644 \u0628\u0631\u064A\u062F\u064B\u0627 \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidTel:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidUrl:"\u0623\u062F\u062E\u0644 \u0631\u0627\u0628\u0637\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidNumber:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formTooShort:"\u0642\u0635\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649 {min} \u062D\u0631\u0641\u064B\u0627)",formTooLong:"\u0637\u0648\u064A\u0644 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627)",formNumberTooSmall:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 \u0639\u0646 {min}",formNumberTooLarge:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F \u0639\u0646 {max}",formPatternMismatch:"\u064A\u0631\u062C\u0649 \u0645\u0637\u0627\u0628\u0642\u0629 \u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629",formChooseAtLeast:"\u0627\u062E\u062A\u0631 {min} \u0639\u0644\u0649 \u0627\u0644\u0623\u0642\u0644",formChooseAtMost:"\u0627\u062E\u062A\u0631 {max} \u0639\u0644\u0649 \u0627\u0644\u0623\u0643\u062B\u0631",formOther:"\u0623\u062E\u0631\u0649",formOtherPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",inputRequired:"\u0623\u0633\u0626\u0644\u0629 \u0644\u0643",inputBadge:"\u0623\u0633\u0626\u0644\u0629",inputAnswered:"\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSkipped:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",showOptions:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",hideOptions:"\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",qtypeText:"\u0625\u062C\u0627\u0628\u062A\u0643",qtypeEmail:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",qtypePhone:"\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641",qtypeNumber:"\u0631\u0642\u0645",qtypeDate:"\u062A\u0627\u0631\u064A\u062E",qtypeChooseOne:"\u0627\u062E\u062A\u0631 \u0648\u0627\u062D\u062F\u064B\u0627",qtypeChooseAny:"\u0627\u062E\u062A\u0631 \u0623\u064A\u064B\u0627",qtypeBoolean:"\u0646\u0639\u0645 / \u0644\u0627",inputSubmit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",inputSubmitHint:"Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter = \u0633\u0637\u0631 \u062C\u062F\u064A\u062F",inputSkip:"\u062A\u062E\u0637\u064D\u0651",confirmYes:"\u0646\u0639\u0645",confirmNo:"\u0644\u0627",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",approvalPrompt:"\u062A\u062A\u0637\u0644\u0628 {tool} \u0645\u0648\u0627\u0641\u0642\u062A\u0643 \u0644\u0644\u062A\u0646\u0641\u064A\u0630.",approvalBody:"\u0631\u0627\u062C\u0639 \u0645\u064F\u0639\u0637\u064A\u0627\u062A \u0627\u0644\u0623\u062F\u0627\u0629 \u0623\u0639\u0644\u0627\u0647 \u0648\u0642\u0631\u0651\u0631 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0647\u0630\u0627 \u0627\u0644\u0625\u062C\u0631\u0627\u0621 \u0623\u0648 \u0631\u0641\u0636\u0647.",approvalYourResponse:"\u0631\u062F\u0651\u0643: {decision}",approvalEditHint:"\u064A\u0645\u0643\u0646\u0643 \u062A\u0639\u062F\u064A\u0644 \u0631\u062F\u0651\u0643 \u062D\u062A\u0649 \u062A\u0633\u062A\u0623\u0646\u0641 \u0647\u0630\u0647 \u0627\u0644\u062E\u0637\u0648\u0629.",approvalSubmitting:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u062F. \u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0646\u0641\u064A\u0630\u2026",edit:"\u062A\u0639\u062F\u064A\u0644",toolParameters:"\u0627\u0644\u0645\u0639\u0637\u064A\u0627\u062A",statusAwaiting:"\u0628\u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629",statusResponded:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644",statusRunning:"\u0642\u064A\u062F \u0627\u0644\u062A\u0646\u0641\u064A\u0630",statusCompleted:"\u0645\u0643\u062A\u0645\u0644",statusDenied:"\u0645\u0631\u0641\u0648\u0636",statusError:"\u062E\u0637\u0623",statusSuperseded:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A"},i_={attach:"Adjuntar archivos",attachmentMimeRejected:"Tipo de archivo no admitido",attachmentTooLarge:"El archivo es demasiado grande",attachmentTooMany:"Se alcanz\xF3 el l\xEDmite de adjuntos",conversationClosed:"Este chat est\xE1 cerrado",conversationLoading:"Cargando chat\u2026",loadPreviousMessages:"Cargar mensajes anteriores",close:"Cerrar",collapse:"Contraer",collapseSidebar:"Contraer la barra lateral",composerPlaceholder:"Escribe un mensaje\u2026",dateLastWeek:"\xDAltimos 7 d\xEDas",dateOlder:"Anteriores",dateToday:"Hoy",dateYesterday:"Ayer",dropZone:"Suelta los archivos para adjuntarlos",errorGeneric:"Algo sali\xF3 mal",errorRateLimited:"Demasiadas solicitudes: int\xE9ntalo de nuevo en un momento.",errorRetry:"Reintentar",expand:"Ampliar",expandSidebar:"Expandir la barra lateral",exitFullscreen:"Salir de pantalla completa",fullscreen:"Pantalla completa",history:"Historial",historyBack:"Volver al chat",historyEmpty:"A\xFAn no tienes chats",historyContinue:"Continuar el chat",historyLoading:"Cargando tus chats\u2026",historyTitle:"Historial de chats",loadMoreConversations:"Cargar m\xE1s conversaciones",language:"Idioma",launcherOpen:"Abrir el chat",launcherLabel:"Chatea con nosotros",micStart:"Iniciar entrada de voz",micStop:"Detener entrada de voz",micUnsupported:"Este navegador no admite la entrada de voz",moreActions:"M\xE1s acciones",newConversation:"Nuevo chat",panelTitle:"Chat",resizeHandle:"Arrastra para cambiar el tama\xF1o",scrollToBottom:"Ir a lo m\xE1s reciente",send:"Enviar",soundOff:"Sonido desactivado",soundOn:"Sonido activado",startNewConversation:"Iniciar un chat nuevo",talkToOperator:"Hablar con un operador",connectingOperator:"Conect\xE1ndote con un operador\u2026",noOperatorAvailable:"Nadie est\xE1 disponible ahora \u2014 deja tus datos y te contactaremos.",chattingWithOperator:"Est\xE1s chateando con {operator}",cancelOperatorRequest:"Seguir con la IA",stop:"Detener",theme:"Tema",themeAuto:"Autom\xE1tico",themeDark:"Oscuro",themeLight:"Claro",textSize:"Tama\xF1o del texto",textSizeSmall:"Peque\xF1o",textSizeNormal:"Normal",textSizeLarge:"Grande",loading:"Cargando\u2026",thinking:"Pensando\u2026",thoughts:"Razonamiento",toolResult:"Resultado",sources:"Fuentes",feedbackUp:"Buena respuesta",feedbackDown:"Mala respuesta",feedbackThanks:"Gracias por tu opini\xF3n",copy:"Copiar",copied:"Copiado",tabHome:"Inicio",tabConversations:"Chats",tabHelp:"Ayuda",tabNews:"Novedades",modulesEmpty:"A\xFAn no hay nada aqu\xED",moduleBack:"Atr\xE1s",contentLoading:"Cargando\u2026",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeContentTitle:"Art\xEDculos populares",homeStatus:"Estado",helpTitle:"Ayuda",helpSearchPlaceholder:"Buscar ayuda",helpEmpty:"A\xFAn no hay art\xEDculos de ayuda",helpLoading:"Cargando la ayuda\u2026",helpSearchEmpty:"No se encontraron resultados",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",formSubmit:"Enviar",formSkip:"Quiz\xE1 m\xE1s tarde",formSubmitted:"Completado",formSkipped:"Quiz\xE1 m\xE1s tarde",formFillOut:"Completar",formRequired:"Este campo es obligatorio",formInvalidEmail:"Introduce un correo electr\xF3nico v\xE1lido",formInvalidTel:"Introduce un n\xFAmero de tel\xE9fono v\xE1lido",formInvalidUrl:"Introduce una URL v\xE1lida",formInvalidNumber:"Introduce un n\xFAmero v\xE1lido",formTooShort:"Demasiado corto (m\xEDn. {min} caracteres)",formTooLong:"Demasiado largo (m\xE1x. {max} caracteres)",formNumberTooSmall:"Debe ser al menos {min}",formNumberTooLarge:"Debe ser como m\xE1ximo {max}",formPatternMismatch:"Respeta el formato solicitado",formChooseAtLeast:"Elige al menos {min}",formChooseAtMost:"Elige como m\xE1ximo {max}",formOther:"Otro",formOtherPlaceholder:"Escribe tu respuesta\u2026",inputRequired:"Preguntas para ti",inputBadge:"Preguntas",inputAnswered:"Respondido",inputSkipped:"Omitido",showOptions:"Mostrar opciones",hideOptions:"Ocultar opciones",qtypeText:"Tu respuesta",qtypeEmail:"Correo electr\xF3nico",qtypePhone:"N\xFAmero de tel\xE9fono",qtypeNumber:"N\xFAmero",qtypeDate:"Fecha",qtypeChooseOne:"Elige una",qtypeChooseAny:"Elige varias",qtypeBoolean:"S\xED / No",inputSubmit:"Enviar respuestas",inputSubmitHint:"Enter para enviar \xB7 May\xFAs+Enter = nueva l\xEDnea",inputSkip:"Omitir",confirmYes:"S\xED",confirmNo:"No",approve:"Aprobar",reject:"Rechazar",approvalPrompt:"{tool} requiere tu aprobaci\xF3n para ejecutarse.",approvalBody:"Revisa los par\xE1metros de arriba y decide si permites esta acci\xF3n.",approvalYourResponse:"Tu respuesta: {decision}",approvalEditHint:"Puedes cambiar tu respuesta hasta que este paso contin\xFAe.",approvalSubmitting:"Respuesta enviada. Procesando\u2026",edit:"Editar",toolParameters:"Par\xE1metros",statusAwaiting:"Esperando aprobaci\xF3n",statusResponded:"Enviado",statusRunning:"En curso",statusCompleted:"Completado",statusDenied:"Denegado",statusError:"Error",statusSuperseded:"Omitido"},s_={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",attachmentMimeRejected:"\u05E1\u05D5\u05D2 \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA",attachmentTooLarge:"\u05D4\u05E7\u05D5\u05D1\u05E5 \u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9",attachmentTooMany:"\u05D4\u05D2\u05E2\u05EA \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D4\u05DE\u05E8\u05D1\u05D9 \u05E9\u05DC \u05E7\u05D1\u05E6\u05D9\u05DD \u05DE\u05E6\u05D5\u05E8\u05E4\u05D9\u05DD",conversationClosed:"\u05D4\u05E6\u05F3\u05D0\u05D8 \u05D4\u05D6\u05D4 \u05E0\u05E1\u05D2\u05E8",conversationLoading:"\u05D8\u05D5\u05E2\u05DF \u05E6\u05F3\u05D0\u05D8\u2026",loadPreviousMessages:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05E7\u05D5\u05D3\u05DE\u05D5\u05EA",close:"\u05E1\u05D2\u05D9\u05E8\u05D4",collapse:"\u05DB\u05D9\u05D5\u05D5\u05E5",collapseSidebar:"\u05DB\u05D9\u05D5\u05D5\u05E5 \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",composerPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D4\u05D5\u05D3\u05E2\u05D4\u2026",dateLastWeek:"7 \u05D4\u05D9\u05DE\u05D9\u05DD \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D9\u05DD",dateOlder:"\u05D9\u05E9\u05DF \u05D9\u05D5\u05EA\u05E8",dateToday:"\u05D4\u05D9\u05D5\u05DD",dateYesterday:"\u05D0\u05EA\u05DE\u05D5\u05DC",dropZone:"\u05E9\u05D7\u05E8\u05E8 \u05E7\u05D1\u05E6\u05D9\u05DD \u05DB\u05D3\u05D9 \u05DC\u05E6\u05E8\u05E3",errorGeneric:"\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9",errorRateLimited:"\u05D9\u05D5\u05EA\u05E8 \u05DE\u05D3\u05D9 \u05D1\u05E7\u05E9\u05D5\u05EA \u2014 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 \u05E8\u05D2\u05E2.",errorRetry:"\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1",expand:"\u05D4\u05E8\u05D7\u05D1\u05D4",expandSidebar:"\u05D4\u05E8\u05D7\u05D1\u05EA \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",exitFullscreen:"\u05D9\u05E6\u05D9\u05D0\u05D4 \u05DE\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",fullscreen:"\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",history:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D4",historyBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05E6\u05F3\u05D0\u05D8",historyEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E7\u05D5\u05D3\u05DE\u05D9\u05DD",historyContinue:"\u05D4\u05DE\u05E9\u05DA \u05E6\u05F3\u05D0\u05D8",historyLoading:"\u05D8\u05D5\u05E2\u05DF \u05D0\u05EA \u05D4\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA\u2026",historyTitle:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",loadMoreConversations:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05E9\u05D9\u05D7\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",language:"\u05E9\u05E4\u05D4",launcherOpen:"\u05E4\u05EA\u05D9\u05D7\u05EA \u05E6\u05F3\u05D0\u05D8",launcherLabel:"\u05D3\u05D1\u05E8\u05D5 \u05D0\u05D9\u05EA\u05E0\u05D5",micStart:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micStop:"\u05E2\u05E6\u05D9\u05E8\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micUnsupported:"\u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF \u05D6\u05D4",moreActions:"\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",newConversation:"\u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",panelTitle:"\u05E6\u05F3\u05D0\u05D8",resizeHandle:"\u05D2\u05E8\u05D5\u05E8 \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9 \u05D4\u05D2\u05D5\u05D3\u05DC",scrollToBottom:"\u05DE\u05E2\u05D1\u05E8 \u05DC\u05D7\u05D3\u05E9 \u05D1\u05D9\u05D5\u05EA\u05E8",send:"\u05E9\u05DC\u05D9\u05D7\u05D4",soundOff:"\u05D4\u05E9\u05EA\u05E7\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",soundOn:"\u05D4\u05E4\u05E2\u05DC\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",startNewConversation:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",talkToOperator:"\u05D3\u05D1\u05E8 \u05E2\u05DD \u05E0\u05E6\u05D9\u05D2",connectingOperator:"\u05DE\u05D7\u05D1\u05E8 \u05D0\u05D5\u05EA\u05DA \u05DC\u05E0\u05E6\u05D9\u05D2\u2026",noOperatorAvailable:"\u05D0\u05D9\u05DF \u05E0\u05E6\u05D9\u05D2\u05D9\u05DD \u05D6\u05DE\u05D9\u05E0\u05D9\u05DD \u05DB\u05E2\u05EA \u2014 \u05D4\u05E9\u05D0\u05E8 \u05D0\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA \u05D5\u05E0\u05D7\u05D6\u05D5\u05E8 \u05D0\u05DC\u05D9\u05DA.",chattingWithOperator:"\u05D0\u05EA\u05D4 \u05DE\u05E6\u05F3\u05D5\u05D8\u05D8 \u05E2\u05DD {operator}",cancelOperatorRequest:"\u05D4\u05DE\u05E9\u05DA \u05DC\u05E9\u05D5\u05D7\u05D7 \u05E2\u05DD \u05D4-AI",stop:"\u05E2\u05E6\u05D9\u05E8\u05D4",theme:"\u05E2\u05E8\u05DB\u05EA \u05E0\u05D5\u05E9\u05D0",themeAuto:"\u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9",themeDark:"\u05DB\u05D4\u05D4",themeLight:"\u05D1\u05D4\u05D9\u05E8",textSize:"\u05D2\u05D5\u05D3\u05DC \u05D8\u05E7\u05E1\u05D8",textSizeSmall:"\u05E7\u05D8\u05DF",textSizeNormal:"\u05E8\u05D2\u05D9\u05DC",textSizeLarge:"\u05D2\u05D3\u05D5\u05DC",loading:"\u05D8\u05D5\u05E2\u05DF\u2026",thinking:"\u05D7\u05D5\u05E9\u05D1\u2026",thoughts:"\u05DE\u05D7\u05E9\u05D1\u05D5\u05EA",toolResult:"\u05EA\u05D5\u05E6\u05D0\u05D4",sources:"\u05DE\u05E7\u05D5\u05E8\u05D5\u05EA",feedbackUp:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D8\u05D5\u05D1\u05D4",feedbackDown:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D2\u05E8\u05D5\u05E2\u05D4",feedbackThanks:"\u05EA\u05D5\u05D3\u05D4 \u05E2\u05DC \u05D4\u05DE\u05E9\u05D5\u05D1",copy:"\u05D4\u05E2\u05EA\u05E7",copied:"\u05D4\u05D5\u05E2\u05EA\u05E7",tabHome:"\u05D1\u05D9\u05EA",tabConversations:"\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",tabHelp:"\u05E2\u05D6\u05E8\u05D4",tabNews:"\u05D7\u05D3\u05E9\u05D5\u05EA",modulesEmpty:"\u05D0\u05D9\u05DF \u05DB\u05D0\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DB\u05DC\u05D5\u05DD",moduleBack:"\u05D7\u05D6\u05E8\u05D4",contentLoading:"\u05D8\u05D5\u05E2\u05DF\u2026",homeGreeting:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeGreetingNamed:"\u05E9\u05DC\u05D5\u05DD {name} \u{1F44B}",homeGreetingLead:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",homeContentTitle:"\u05DE\u05D0\u05DE\u05E8\u05D9\u05DD \u05E4\u05D5\u05E4\u05D5\u05DC\u05E8\u05D9\u05D9\u05DD",homeStatus:"\u05E1\u05D8\u05D8\u05D5\u05E1",helpTitle:"\u05E2\u05D6\u05E8\u05D4",helpSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",helpEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DE\u05D0\u05DE\u05E8\u05D9 \u05E2\u05D6\u05E8\u05D4",helpLoading:"\u05D8\u05D5\u05E2\u05DF \u05E2\u05D6\u05E8\u05D4\u2026",helpSearchEmpty:"\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA",newsTitle:"\u05D7\u05D3\u05E9\u05D5\u05EA",newsEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA",newsLoading:"\u05D8\u05D5\u05E2\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA\u2026",newsBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05D7\u05D3\u05E9\u05D5\u05EA",newsPublishedAt:"\u05E4\u05D5\u05E8\u05E1\u05DD \u05D1-{date}",formSubmit:"\u05E9\u05DC\u05D9\u05D7\u05D4",formSkip:"\u05D0\u05D7\u05E8 \u05DB\u05DA",formSubmitted:"\u05E0\u05E9\u05DC\u05D7",formSkipped:"\u05D3\u05D5\u05DC\u05D2",formFillOut:"\u05DE\u05D9\u05DC\u05D5\u05D9",formRequired:"\u05E9\u05D3\u05D4 \u05D7\u05D5\u05D1\u05D4",formInvalidEmail:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidTel:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05EA\u05E7\u05D9\u05DF",formInvalidUrl:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA URL \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidNumber:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05EA\u05E7\u05D9\u05DF",formTooShort:"\u05E7\u05E6\u05E8 \u05DE\u05D3\u05D9 (\u05DC\u05E4\u05D7\u05D5\u05EA {min} \u05EA\u05D5\u05D5\u05D9\u05DD)",formTooLong:"\u05D0\u05E8\u05D5\u05DA \u05DE\u05D3\u05D9 (\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max} \u05EA\u05D5\u05D5\u05D9\u05DD)",formNumberTooSmall:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formNumberTooLarge:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formPatternMismatch:"\u05D4\u05EA\u05D0\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D4\u05E0\u05D3\u05E8\u05E9\u05EA",formChooseAtLeast:"\u05D1\u05D7\u05E8 \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formChooseAtMost:"\u05D1\u05D7\u05E8 \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formOther:"\u05D0\u05D7\u05E8",formOtherPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D0\u05EA \u05EA\u05E9\u05D5\u05D1\u05EA\u05DA\u2026",inputRequired:"\u05E9\u05D0\u05DC\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8\u05DA",inputBadge:"\u05E9\u05D0\u05DC\u05D5\u05EA",inputAnswered:"\u05E0\u05E2\u05E0\u05D4",inputSkipped:"\u05D3\u05D5\u05DC\u05D2",showOptions:"\u05D4\u05E6\u05D2 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",hideOptions:"\u05D4\u05E1\u05EA\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",qtypeText:"\u05D4\u05EA\u05E9\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA",qtypeEmail:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",qtypePhone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",qtypeNumber:"\u05DE\u05E1\u05E4\u05E8",qtypeDate:"\u05EA\u05D0\u05E8\u05D9\u05DA",qtypeChooseOne:"\u05D1\u05D7\u05E8 \u05D0\u05D7\u05EA",qtypeChooseAny:"\u05D1\u05D7\u05E8 \u05DB\u05DE\u05D4",qtypeBoolean:"\u05DB\u05DF / \u05DC\u05D0",inputSubmit:"\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05E9\u05D5\u05D1\u05D5\u05EA",inputSubmitHint:"Enter \u05DC\u05E9\u05DC\u05D9\u05D7\u05D4 \xB7 Shift+Enter = \u05E9\u05D5\u05E8\u05D4 \u05D7\u05D3\u05E9\u05D4",inputSkip:"\u05D3\u05D9\u05DC\u05D5\u05D2",confirmYes:"\u05DB\u05DF",confirmNo:"\u05DC\u05D0",approve:"\u05D0\u05D9\u05E9\u05D5\u05E8",reject:"\u05D3\u05D7\u05D9\u05D9\u05D4",approvalPrompt:"\u05D4\u05DB\u05DC\u05D9 {tool} \u05D3\u05D5\u05E8\u05E9 \u05D0\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8\u05DA \u05DB\u05D3\u05D9 \u05DC\u05E4\u05E2\u05D5\u05DC.",approvalBody:"\u05D1\u05D3\u05D5\u05E7 \u05D0\u05EA \u05E4\u05E8\u05DE\u05D8\u05E8\u05D9 \u05D4\u05DB\u05DC\u05D9 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4 \u05D5\u05D4\u05D7\u05DC\u05D8 \u05D0\u05DD \u05DC\u05D0\u05E9\u05E8 \u05E4\u05E2\u05D5\u05DC\u05D4 \u05D6\u05D5.",approvalYourResponse:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA: {decision}",approvalEditHint:"\u05E0\u05D9\u05EA\u05DF \u05DC\u05E2\u05E8\u05D5\u05DA \u05D0\u05EA \u05EA\u05D2\u05D5\u05D1\u05EA\u05DA \u05E2\u05D3 \u05E9\u05D4\u05E9\u05DC\u05D1 \u05D4\u05D6\u05D4 \u05D9\u05EA\u05D7\u05D3\u05E9.",approvalSubmitting:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4. \u05DE\u05D1\u05E6\u05E2\u2026",edit:"\u05E2\u05E8\u05D9\u05DB\u05D4",toolParameters:"\u05E4\u05E8\u05DE\u05D8\u05E8\u05D9\u05DD",statusAwaiting:"\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8",statusResponded:"\u05E0\u05E9\u05DC\u05D7",statusRunning:"\u05E4\u05D5\u05E2\u05DC",statusCompleted:"\u05D4\u05D5\u05E9\u05DC\u05DD",statusDenied:"\u05E0\u05D3\u05D7\u05D4",statusError:"\u05E9\u05D2\u05D9\u05D0\u05D4",statusSuperseded:"\u05D3\u05D5\u05DC\u05D2"},l_={en:$i,fr:r_,ar:a_,es:i_,he:s_};function ho(e,t){let n=Fi(e),o=bo(t),r=n==="en"?{}:l_[n]??{},a=o?t[n]??{}:t??{},s=o?t.en??{}:{};return{...$i,...r,...s,...a}}function Fi(e){return(e.split("-")[0]??"en").toLowerCase()}var c_=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function Bi(e){return c_.has(Fi(e))}function Ze(e,t){return e[t]??t}function bo(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function Hi(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function Ui(e,t){let{translations:n,defaultLocale:o,...r}=e,a=Hi(n,t);return a?{...r,title:a.title??r.title,description:a.description??r.description,content:a.content??r.content}:r}function zi(e,t){let{translations:n,defaultLocale:o,...r}=e,a=Hi(n,t);if(!a)return r;let s=new Map((a.fields??[]).map(c=>[c.name,c])),l=r.fields.map(c=>{let u=s.get(c.name);if(!u)return c;let _=new Map((u.options??[]).map(p=>[p.value,p]));return{...c,label:u.label??c.label,placeholder:u.placeholder??c.placeholder,validationHint:u.validationHint??c.validationHint,options:c.options?.map(p=>{let d=_.get(p.value);return d?{...p,label:d.label??p.label,description:d.description??p.description}:p})}});return{...r,title:a.title??r.title,description:a.description??r.description,submitLabel:a.submitLabel??r.submitLabel,fields:l}}var Xr=class{get(t){try{return localStorage.getItem(t)}catch{return null}}set(t,n){try{localStorage.setItem(t,n)}catch{}}remove(t){try{localStorage.removeItem(t)}catch{}}},yo=new Xr;var Qr=["off","error","warn","info","debug","trace"],Zr=w.cssPrefix,qi=`${Zr}.debug`,d_=`__${w.global}_DEBUG__`,u_=`${Zr}-debug`,Po=2,Yr=null;function __(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(u_);if(e!==null){let t=Jr(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(qi);if(e){let t=Jr(e);if(t>=0)return t}}catch{}return Reflect.get(window,d_)?4:2}function Jr(e){if(e===!0||e==="1"||e==="true")return 4;if(e===!1||e==="0"||e==="false"||e==="off")return 0;if(typeof e=="number")return Math.max(0,Math.min(5,Math.floor(e)));if(typeof e=="string"){let t=Qr.indexOf(e);if(t>=0)return t}return-1}function xo(e){let t=Jr(e);if(!(t<0)){Po=t;try{window.localStorage?.setItem(qi,Qr[t])}catch{}}}function $n(){return Qr[Po]}Po=__();function Wi(e){let t=`[${Zr}:${e}]`,n=(o,r,a)=>(s,l)=>{if(!(Po<o)&&(l===void 0?console[r](t,s):console[r](t,s,l),Yr))try{Yr({level:a,scope:e,message:s,payload:l})}catch{}};return{error:n(1,"error","error"),warn:n(2,"warn","warn"),info:n(3,"info","info"),debug:n(4,"debug","debug"),trace:n(5,"debug","trace"),scope:o=>Wi(`${e}:${o}`)}}var X=Wi("core");function Fn(e){Yr=e}var Vt=X.scope("context"),p_=new Set(["visitorId","conversationId","conversationId","jwt","token","authorization","password"]),Vi=50,ea=1024,f_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ta(e){return Gi(e,"userContext",!0)}function na(e){return Gi(e,"pageContext",!1)}function Gi(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Vt.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},r=0;for(let[a,s]of Object.entries(e)){if(p_.has(a)){Vt.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(r>=Vi){Vt.warn(`${t} truncated at ${Vi} keys \u2014 dropped "${a}"`);continue}let l=m_(t,a,s);l!==void 0&&(o[a]=l,r++)}return n&&typeof o.email=="string"&&!f_.test(o.email)&&(Vt.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function m_(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Vt.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>ea?(Vt.warn(`truncated ${e}.${t} to ${ea} chars`),o.slice(0,ea)):o}Vt.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var So={maxBytes:10485760,maxCount:10,accept:"*/*"},Ki={voice:"local"},ji={list:[],byTrigger:{}},oa={enabled:!0,sampleRate:1},ko={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},pn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},Xi={floating:["theme","textSize","history","close","clear","expand","fullscreen","sound","language"],inline:["theme","textSize","history","close","clear","fullscreen","sound","language"],standalone:["theme","textSize","history","clear","sound","language"],page:["theme","textSize","history","clear","sound","language"],modal:["theme","textSize","history","close","clear","fullscreen","sound","language"],drawer:["theme","textSize","history","close","clear","fullscreen","sound","language"]},ra={enabled:!0,volume:.3,events:void 0},Yi={enabled:!0,events:void 0},Ji=[{label:"tabConversations",layout:"chat"}];function At(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},r=t.i18n??{},a=t.feedback??{},s=t.footer??{},l=t.header??{},{themeMode:c,themeOverrides:u}=g_(t.theme),_=n.mode??"floating",p=v_(r.defaultLocale),d=r.availableLocales??[r.locale??p],f=fn(r.locale??p,d,p),m=(t.baseUrl??w.defaultBaseUrl).replace(/\/$/,""),g=(t.agentApiBaseUrl??`${m}/api/agent`).replace(/\/$/,""),h=(t.dataApiBaseUrl??`${m}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:m,agentApiBaseUrl:g,dataApiBaseUrl:h,userContext:ta(t.userContext),pageContext:na(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:u,mode:_,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,showSources:o.showSources??!1,enableMessageFeedback:!(o.disableMessageFeedback??!1),autoSendSuggestions:o.autoSendSuggestions??!1,features:{voice:t.features?.voice??Ki.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Bn(t.forms,f),endpoints:{upload:t.endpoints?.upload??ko.upload,transcribe:t.endpoints?.transcribe??ko.transcribe,submitForm:t.endpoints?.submitForm??ko.submitForm},attachments:{accept:t.composer?.attachments?.accept??So.accept,maxBytes:t.composer?.attachments?.maxBytes??So.maxBytes,maxCount:t.composer?.attachments?.maxCount??So.maxCount},locale:f,defaultLocale:p,availableLocales:d,startMinimized:o.startMinimized??!0,actions:h_(_,l.actions),size:n.size??{},launcher:C_(t.launcher),sound:b_(a.sound),haptics:y_(a.haptics),strings:ho(f,r.strings),stringsOverride:r.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:x_(s.poweredBy),composer:S_(t.composer),modules:k_(t.modules),tracking:P_(t.tracking,h),storage:t.storage??yo,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function g_(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function v_(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function fn(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function h_(e,t){return t??Xi[e]}function b_(e){return{enabled:e?.enabled??ra.enabled,volume:e?.volume??ra.volume,events:e?.events}}function y_(e){return{enabled:e?.enabled??Yi.enabled,events:e?.events}}function P_(e,t){let n=e?.sampleRate??oa.sampleRate;return{enabled:e?.enabled??oa.enabled,endpoint:e?.endpoint??`${t}/pai/elements-px.gif`,sampleRate:Math.min(1,Math.max(0,Number.isFinite(n)?n:1)),token:e?.token}}function x_(e){let n={...{text:`Powered by ${w.displayName}`,href:w.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function S_(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function k_(e){let t=e===void 0?Ji:e,n=new Set,o=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let s=a.contentTags?.filter(Boolean),l=a.id??s?.[0]??a.layout;for(;n.has(l);)l=`${l}-${o.length}`;n.add(l);let c={id:l,label:a.label,layout:a.layout};s&&s.length>0&&(c.contentTags=s),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=!(a.hideGreeting??!1),c.showSearchBar=!(a.hideSearchBar??!1),c.showRecentConversations=!(a.hideRecentConversations??!1),a.userAvatars&&a.userAvatars.length>0&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let r=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:r}}function Bn(e,t){var a;if(!e?.length)return ji;let n=[],o=new Set;for(let s of e){if(!s?.id||o.has(s.id))continue;let l=zi(s,t),c=(l.fields??[]).filter(_=>!!(_&&_.name&&_.label&&_.type)),u=(Array.isArray(l.on)?l.on:[l.on]).map(w_).filter(_=>_!==null);c.length===0||u.length===0||(o.add(l.id),n.push({id:l.id,triggers:u,when:l.when,fields:c,title:l.title,description:l.description,submitLabel:l.submitLabel,skippable:l.skippable??!1,frequency:l.frequency??"once",mirrorToContext:l.mirrorToContext??!0,reopenable:l.reopenable??!0,reviewable:l.reviewable??!0}))}let r={};for(let s of n)for(let l of s.triggers)(r[a=l.kind]??(r[a]=[])).push(s);return{list:n,byTrigger:r}}function w_(e){if(typeof e!="string")return null;if(e==="pre-chat"||e==="conversation-closed"||e==="panel-close"||e==="manual")return{kind:e};let[t,n]=e.split(":",2);if(t==="after-messages"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"after-messages",param:o}:null}if(t==="idle"){let o=Number(n);return Number.isFinite(o)&&o>0?{kind:"idle",param:o}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function C_(e){let t=e?.callout?.text?{shape:"pill",position:"auto",delayMs:1200,autoDismissMs:0,animated:!0,persistent:!0,...e.callout}:null;return{variant:e?.variant??pn.variant,size:e?.size??pn.size,label:e?.label??pn.label,icon:e?.icon??pn.icon,hidden:e?.hidden??pn.hidden,callout:t}}function aa(e,t,n,o){let r=fn(t,e.availableLocales,e.defaultLocale);if(r===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return r!==e.locale&&(a.locale=r,a.strings=ho(r,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var R_=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function ia(e,t){if(!t)return e;let n={...e};for(let a of R_){let s=t[a];if(s===void 0)continue;let l=e[a];if(a==="theme"){l===void 0&&(n[a]=s);continue}a!=="i18n"&&(n[a]=Qi(s,l))}t.modules!==void 0&&e.modules===void 0&&(n.modules=t.modules),t.dataApiBaseUrl!==void 0&&e.dataApiBaseUrl===void 0&&(n.dataApiBaseUrl=t.dataApiBaseUrl);let o=e.i18n,r=t.i18n;if(o||r){let a=Qi(r??{},o);r?.availableLocales!==void 0&&(a.availableLocales=r.availableLocales),r?.defaultLocale!==void 0&&(a.defaultLocale=r.defaultLocale);let s=o?.strings,l=r?.strings;(s||l)&&(a.strings=T_(l,s)),n.i18n=a}return n}function Qi(e,t){if(!t)return e;let n={...e};for(let[o,r]of Object.entries(t))r!==void 0&&(n[o]=r);return n}function T_(e,t){if(!e)return t;if(!t)return e;let n=bo(e),o=bo(t);if(!n&&!o)return{...e,...t};let r={},a=n?e:{en:e},s=o?t:{en:t};for(let[l,c]of Object.entries(a))r[l]={...c};for(let[l,c]of Object.entries(s))r[l]={...r[l],...c};return r}var I_=["clear","expand","fullscreen","sound","history","language","theme","textSize","close"],xt=e=>e!=="false",E_=e=>e.split(",").map(t=>t.trim()).filter(Boolean),es=[["public-key","publicKey"],["ai-agent-deployment-id","aiAgentDeploymentId"],["base-url","baseUrl"],["agent-api-base-url","agentApiBaseUrl"],["data-api-base-url","dataApiBaseUrl"],["theme","theme",e=>e]],ts=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",xt]],ns=[["width","width"],["height","height"]],os=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",xt],["show-reasoning","showReasoning",xt],["show-tool-calls","showToolCalls",xt],["show-sources","showSources",xt],["disable-message-feedback","disableMessageFeedback",xt],["auto-send-suggestions","autoSendSuggestions",xt]],rs=[["locale","locale"]],A_=new Set(I_),M_=e=>E_(e).filter(t=>A_.has(t)),as=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",xt]],is=[["features-disable-file-upload","disableFileUpload",xt],["features-voice","voice",e=>e]],ss=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],ls=[["user-id","id"],["user-email","email"],["user-name","name"]],cs=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],L_=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],O_=[es,ts,ns,os,rs,as,is,ss,ls,cs],N_=new Set(["iframe","start-minimized"]),sa=[...O_.flatMap(e=>e.map(([t])=>t).filter(t=>!N_.has(t))),...L_];function wo(e){let t={},n=f=>{let m=e(f);return m===null||m===""?void 0:m};for(let[f,m,g]of es){let h=n(f);h!==void 0&&(t[m]=g?g(h):h)}let o=Gt(n,ts),r=Gt(n,ns);(o||r)&&(t.presentation={...o,...r?{size:r}:{}});let a=Gt(n,os);a&&(t.behavior=a);let s=Gt(n,rs);s&&(t.i18n=s);let l=$_(e,n);l&&(t.launcher=l);let c=Gt(n,is);c&&(t.features=c);let u=Gt(n,ss);u&&(t.endpoints=u);let _=Zi(n,ls,"user-context");_&&(t.userContext=_);let p=Zi(n,cs,"page-context");p&&(t.pageContext=p);let d=n("actions");return d!==void 0&&(t.header={actions:M_(d)}),t}function la(e){return e?wo(t=>e[D_(t==="data-api-base-url"?"api-base-url":t)]??null):{}}function D_(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Gt(e,t){let n={};for(let[o,r,a]of t){let s=e(o);s!==void 0&&(n[r]=a?a(s):s)}return Object.keys(n).length>0?n:null}function Zi(e,t,n){let o={};for(let[l,c]of t){let u=e(l);u!==void 0&&(o[c]=u)}let r={},a=e(n);if(a)try{let l=JSON.parse(a);l&&typeof l=="object"&&!Array.isArray(l)&&(r=l)}catch{}let s={...r,...o};return Object.keys(s).length>0?s:null}function $_(e,t){let n=Gt(t,as)??{},o=e("launcher-label");o!==null&&(n.label=o);let r=t("callout-text");if(r){let a=Number.parseInt(t("callout-delay")??"",10);n.callout={text:r,...Number.isFinite(a)?{delayMs:a}:{}}}return Object.keys(n).length>0?n:null}var Mo,J,fs,_a,Mt,ds,ms,gs,ca,Ro,Hn,vs,pa,da,ua,F_,Io={},Eo=[],B_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Un=Array.isArray;function St(e,t){for(var n in t)e[n]=t[n];return e}function fa(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function kt(e,t,n){var o,r,a,s={};for(a in t)a=="key"?o=t[a]:a=="ref"?r=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?Mo.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return To(e,s,o,r,null)}function To(e,t,n,o,r){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++fs,__i:-1,__u:0};return r==null&&J.vnode!=null&&J.vnode(a),a}function ce(e){return e.children}function et(e,t){this.props=e,this.context=t}function mn(e,t){if(t==null)return e.__?mn(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?mn(e):null}function H_(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],a=St({},t);a.__v=t.__v+1,J.vnode&&J.vnode(a),ma(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??mn(t),!!(32&t.__u),r),a.__v=t.__v,a.__.__k[a.__i]=a,xs(o,a,r),t.__e=t.__=null,a.__e!=n&&hs(a)}}function hs(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),hs(e)}function us(e){(!e.__d&&(e.__d=!0)&&Mt.push(e)&&!Ao.__r++||ds!=J.debounceRendering)&&((ds=J.debounceRendering)||ms)(Ao)}function Ao(){try{for(var e,t=1;Mt.length;)Mt.length>t&&Mt.sort(gs),e=Mt.shift(),t=Mt.length,H_(e)}finally{Mt.length=Ao.__r=0}}function bs(e,t,n,o,r,a,s,l,c,u,_){var p,d,f,m,g,h,P,x=o&&o.__k||Eo,b=t.length;for(c=U_(n,t,x,c,b),p=0;p<b;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&x[f.__i]||Io,f.__i=p,h=ma(e,f,d,r,a,s,l,c,u,_),m=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&ga(d.ref,null,f),_.push(f.ref,f.__c||m,f)),g==null&&m!=null&&(g=m),(P=!!(4&f.__u))||d.__k===f.__k?(c=ys(f,c,e,P),P&&d.__e&&(d.__e=null)):typeof f.type=="function"&&h!==void 0?c=h:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=g,c}function U_(e,t,n,o,r){var a,s,l,c,u,_=n.length,p=_,d=0;for(e.__k=new Array(r),a=0;a<r;a++)(s=t[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=To(null,s,null,null,null):Un(s)?s=e.__k[a]=To(ce,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=To(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+d,s.__=e,s.__b=e.__b+1,l=null,(u=s.__i=z_(s,n,c,p))!=-1&&(p--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(r>_?d--:r<_&&d++),typeof s.type!="function"&&(s.__u|=4)):u!=c&&(u==c-1?d--:u==c+1?d++:(u>c?d--:d++,s.__u|=4))):e.__k[a]=null;if(p)for(a=0;a<_;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=mn(l)),ks(l,l));return o}function ys(e,t,n,o){var r,a;if(typeof e.type=="function"){for(r=e.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=e,t=ys(r[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=mn(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function zn(e,t){return t=t||[],e==null||typeof e=="boolean"||(Un(e)?e.some(function(n){zn(n,t)}):t.push(e)),t}function z_(e,t,n,o){var r,a,s,l=e.key,c=e.type,u=t[n],_=u!=null&&(2&u.__u)==0;if(u===null&&l==null||_&&l==u.key&&c==u.type)return n;if(o>(_?1:0)){for(r=n-1,a=n+1;r>=0||a<t.length;)if((u=t[s=r>=0?r--:a++])!=null&&(2&u.__u)==0&&l==u.key&&c==u.type)return s}return-1}function _s(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||B_.test(t)?n:n+"px"}function Co(e,t,n,o,r){var a,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||_s(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||_s(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(vs,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[Hn]=o[Hn]:(n[Hn]=pa,e.addEventListener(t,a?ua:da,a)):e.removeEventListener(t,a?ua:da,a);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ps(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ro]==null)t[Ro]=pa++;else if(t[Ro]<n[Hn])return;return n(J.event?J.event(t):t)}}}function ma(e,t,n,o,r,a,s,l,c,u){var _,p,d,f,m,g,h,P,x,b,y,k,C,B,G,U,I=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(_=J.__b)&&_(t);e:if(typeof I=="function"){p=s.length;try{if(x=t.props,b=I.prototype&&I.prototype.render,y=(_=I.contextType)&&o[_.__c],k=_?y?y.props.value:_.__:o,n.__c?P=(d=t.__c=n.__c).__=d.__E:(b?t.__c=d=new I(x,k):(t.__c=d=new et(x,k),d.constructor=I,d.render=W_),y&&y.sub(d),d.state||(d.state={}),d.__n=o,f=d.__d=!0,d.__h=[],d._sb=[]),b&&d.__s==null&&(d.__s=d.state),b&&I.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=St({},d.__s)),St(d.__s,I.getDerivedStateFromProps(x,d.__s))),m=d.props,g=d.state,d.__v=t,f)b&&I.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),b&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(b&&I.getDerivedStateFromProps==null&&x!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(x,k),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(x,d.__s,k)===!1){t.__v!=n.__v&&(d.props=x,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(z){z&&(z.__=t)}),Eo.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(x,d.__s,k),b&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,g,h)})}if(d.context=k,d.props=x,d.__P=e,d.__e=!1,C=J.__r,B=0,b)d.state=d.__s,d.__d=!1,C&&C(t),_=d.render(d.props,d.state,d.context),Eo.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,C&&C(t),_=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++B<25);d.state=d.__s,d.getChildContext!=null&&(o=St(St({},o),d.getChildContext())),b&&!f&&d.getSnapshotBeforeUpdate!=null&&(h=d.getSnapshotBeforeUpdate(m,g)),G=_!=null&&_.type===ce&&_.key==null?Ss(_.props.children):_,l=bs(e,Un(G)?G:[G],t,n,o,r,a,s,l,c,u),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),P&&(d.__E=d.__=null)}catch(z){if(s.length=p,t.__v=null,c||a!=null){if(z.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),t.__e=l}else if(a!=null)for(U=a.length;U--;)fa(a[U])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),z.then||Ps(t),J.__e(z,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=q_(n.__e,t,n,o,r,a,s,c,u);return(_=J.diffed)&&_(t),128&t.__u?void 0:l}function Ps(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ps))}function xs(e,t,n){for(var o=0;o<n.length;o++)ga(n[o],n[++o],n[++o]);J.__c&&J.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(a){a.call(r)})}catch(a){J.__e(a,r.__v)}})}function Ss(e){return typeof e!="object"||e==null||e.__b>0?e:Un(e)?e.map(Ss):e.constructor!==void 0?null:St({},e)}function q_(e,t,n,o,r,a,s,l,c){var u,_,p,d,f,m,g,h=n.props||Io,P=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),a!=null){for(u=0;u<a.length;u++)if((f=a[u])&&"setAttribute"in f==!!x&&(x?f.localName==x:f.nodeType==3)){e=f,a[u]=null;break}}if(e==null){if(x==null)return document.createTextNode(P);e=document.createElementNS(r,x,P.is&&P),l&&(J.__m&&J.__m(t,a),l=!1),a=null}if(x==null)h===P||l&&e.data==P||(e.data=P);else{if(a=x=="textarea"&&P.defaultValue!=null?null:a&&Mo.call(e.childNodes),!l&&a!=null)for(h={},u=0;u<e.attributes.length;u++)h[(f=e.attributes[u]).name]=f.value;for(u in h)f=h[u],u=="dangerouslySetInnerHTML"?p=f:u=="children"||u in P||u=="value"&&"defaultValue"in P||u=="checked"&&"defaultChecked"in P||Co(e,u,null,f,r);for(u in P)f=P[u],u=="children"?d=f:u=="dangerouslySetInnerHTML"?_=f:u=="value"?m=f:u=="checked"?g=f:l&&typeof f!="function"||h[u]===f||Co(e,u,f,h[u],r);if(_)l||p&&(_.__html==p.__html||_.__html==e.innerHTML)||(e.innerHTML=_.__html),t.__k=[];else if(p&&(e.innerHTML=""),bs(t.type=="template"?e.content:e,Un(d)?d:[d],t,n,o,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,a,s,a?a[0]:n.__k&&mn(n,0),l,c),a!=null)for(u=a.length;u--;)fa(a[u]);l&&x!="textarea"||(u="value",x=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[u]||x=="progress"&&!m||x=="option"&&m!=h[u])&&Co(e,u,m,h[u],r),u="checked",g!=null&&g!=e[u]&&Co(e,u,g,h[u],r))}return e}function ga(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){J.__e(r,n)}}function ks(e,t,n){var o,r;if(J.unmount&&J.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ga(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){J.__e(a,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&ks(o[r],t,n||typeof e.type!="function");n||fa(e.__e),e.__c=e.__=e.__e=void 0}function W_(e,t,n){return this.constructor(e,n)}function Kt(e,t,n){var o,r,a,s;t==document&&(t=document.documentElement),J.__&&J.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],ma(t,e=(!o&&n||t).__k=kt(ce,null,[e]),r||Io,Io,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?Mo.call(t.childNodes):null,a,!o&&n?n:r?r.__e:t.firstChild,o,s),xs(a,e,s),e.props.children=null}Mo=Eo.slice,J={__e:function(e,t,n,o){for(var r,a,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((a=r.constructor)&&a.getDerivedStateFromError!=null&&(r.setState(a.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(l){e=l}throw e}},fs=0,_a=function(e){return e!=null&&e.constructor===void 0},et.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=St({},this.state),typeof e=="function"&&(e=e(St({},n),this.props)),e&&St(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),us(this))},et.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),us(this))},et.prototype.render=ce,Mt=[],ms=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,gs=function(e,t){return e.__v.__b-t.__v.__b},Ao.__r=0,ca=Math.random().toString(8),Ro="__d"+ca,Hn="__a"+ca,vs=/(PointerCapture)$|Capture$/i,pa=0,da=ps(!1),ua=ps(!0),F_=0;var gn="1.1.10";function ws(e){return`${w.cssPrefix}:${e}`}function qn(e,t,n){e.dispatchEvent(new CustomEvent(ws(t),{detail:n}))}function Cs(e,t){let o=Object.entries(t).map(([r,a])=>{let s=ws(r),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[r,a]of o)e.removeEventListener(r,a)}}function at(){let e=Date.now(),t=new Uint8Array(16);t[0]=Math.floor(e/2**40)&255,t[1]=Math.floor(e/2**32)&255,t[2]=e>>>24&255,t[3]=e>>>16&255,t[4]=e>>>8&255,t[5]=e&255,V_(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,o=>o.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function V_(e){if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){crypto.getRandomValues(e);return}for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}var jt=X.scope("persistence");function Lt(e,t=yo,n){let o=n?`${e}.${n}`:e,r=`${w.cssPrefix}.storageVersion`,a=t.get(r)??void 0,s=a?`.v${a}`:"",l=`${w.cssPrefix}.${o}${s}`,c=`${w.cssPrefix}${s}.visitorId`,u=`${l}.conversationId`,_=`${l}.userPrefs`,p=`${l}.panelOpen`,d=`${l}.panelSize`,f=`${l}.calloutDismissed`,m=`${l}.sidebarCollapsed`,g=`${l}.activeModule`,h=`${l}.historyCount`,P=`${l}.formsDone`,x={getVisitorId(){let b=t.get(c);if(b)return b;let y=at();return t.set(c,y),y},setVisitorId(b){jt.debug("setVisitorId (rebind)",{id:b,scope:o}),t.set(c,b)},loadConversationId(){return t.get(u)??void 0},saveConversationId(b){jt.trace("saveConversationId",{id:b,scope:o}),b?t.set(u,b):t.remove(u)},loadDraft(b){return t.get(`${l}.draft.${b}`)??""},saveDraft(b,y){let k=`${l}.draft.${b}`;y?t.set(k,y):t.remove(k)},loadUserPrefs(){let b=t.get(_);if(!b)return{};try{let y=JSON.parse(b);return Rs(y)?y:{}}catch(y){return jt.warn("loadUserPrefs parse failed",{error:y}),{}}},saveUserPrefs(b){try{t.set(_,JSON.stringify(b))}catch(y){jt.warn("saveUserPrefs serialise failed",{error:y})}},patchUserPrefs(b){let y=x.loadUserPrefs();x.saveUserPrefs({...y,...b})},loadPanelOpen(){let b=t.get(p);return b==="1"?!0:b==="0"?!1:null},savePanelOpen(b){t.set(p,b?"1":"0")},loadPanelSize(){let b=t.get(d);return b==="normal"||b==="expanded"||b==="fullscreen"?b:null},savePanelSize(b){t.set(d,b)},loadCalloutDismissed(b){if(!b)return!1;let y=t.get(f);return!!y&&y===b},saveCalloutDismissed(b){b?t.set(f,b):t.remove(f)},loadSidebarCollapsed(){let b=t.get(m);return b==="1"?!0:b==="0"?!1:null},saveSidebarCollapsed(b){t.set(m,b?"1":"0")},loadActiveModule(){return t.get(g)||null},saveActiveModule(b){t.set(g,b)},loadHistoryCount(){let b=t.get(h);if(!b)return null;let y=Number.parseInt(b,10);return Number.isFinite(y)&&y>=0?y:null},saveHistoryCount(b){t.set(h,String(b))},loadFormsDone(){let b=t.get(P);if(!b)return{};try{let y=JSON.parse(b);return Rs(y)?y:{}}catch(y){return jt.warn("loadFormsDone parse failed",{error:y}),{}}},saveFormDone(b){try{let y=x.loadFormsDone();y[b]=Date.now(),t.set(P,JSON.stringify(y))}catch(y){jt.warn("saveFormDone serialise failed",{error:y})}},rememberStorageVersion(b){b&&b!==t.get(r)&&(jt.debug("rememberStorageVersion (force-reset on next load)",{version:b}),t.set(r,b))},clearConversation(){t.remove(u)}};return x}function Rs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ts=`:host{--__P__-accent-user: __BRAND_ACCENT__;--__P__-accent: var(--__P__-accent-user);--__P__-accent-text-user: __BRAND_ACCENT_TEXT__;--__P__-accent-text: var(--__P__-accent-text-user);--__P__-accent-fg: var(--__P__-accent);--__P__-radius: __BRAND_RADIUS__;--__P__-radius-sm: 8px;--__P__-radius-md: 10px;--__P__-radius-lg: 16px;--__P__-font: __BRAND_FONT__;--__P__-font-display: var(--__P__-font);--__P__-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--__P__-bg: oklch(1 0 0);--__P__-bg-elevated: oklch(.9789 .0029 278.3);--__P__-surface: var(--__P__-bg-elevated);--__P__-muted: var(--__P__-fg-muted);--__P__-hover: oklch(.1686 .011 278.3 / .06);--__P__-fg: oklch(.1686 .011 278.3);--__P__-fg-muted: oklch(.4932 .0301 278.3);--__P__-border: oklch(.9312 .0084 278.3);--__P__-border-strong: oklch(.8757 .0131 278.3);--__P__-bubble-user: var(--__P__-accent);--__P__-bubble-user-text: var(--__P__-accent-text);--__P__-bubble-assistant: oklch(.9638 .0058 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-on-accent: var(--__P__-accent-text);--__P__-success: oklch(.6456 .1654 151.53);--__P__-warning: oklch(.7135 .1494 74.05);--__P__-danger: oklch(.5966 .1818 24.51);--__P__-danger-text: oklch(.5054 .1905 27.52);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .1);--__P__-neutral: oklch(.7137 .0192 278.3);--__P__-pill-l-min: .3;--__P__-pill-l-max: .46;--__P__-focus: var(--__P__-accent);--__P__-shadow-panel: 0 8px 24px -8px rgba(13, 15, 20, .18), 0 24px 64px -24px rgba(13, 15, 20, .24);--__P__-shadow-card: 0 1px 2px rgba(13, 15, 20, .06), 0 4px 12px -6px rgba(13, 15, 20, .12);--__P__-backdrop: oklch(.1686 .011 278.3 / .55);--__P__-shadow-fab: 0 6px 16px -4px color-mix(in oklch, var(--__P__-accent) 45%, transparent), 0 12px 32px -12px rgba(13, 15, 20, .25);--__P__-z-fab: 2147483600;--__P__-z-panel: 2147483601;--__P__-panel-w: 380px;--__P__-panel-h: 600px;--__P__-fab-size: 56px;--__P__-conversation-max: 768px;--__P__-space-1: 4px;--__P__-space-2: 8px;--__P__-space-3: 12px;--__P__-space-4: 16px;--__P__-space-5: 20px;--__P__-space-6: 24px;--__P__-space-8: 32px;--__P__-text-scale: 1;--__P__-text-xs: calc(12px * var(--__P__-text-scale));--__P__-text-sm: calc(13px * var(--__P__-text-scale));--__P__-text-base: calc(15px * var(--__P__-text-scale));--__P__-text-md: calc(16px * var(--__P__-text-scale));--__P__-text-lg: calc(18px * var(--__P__-text-scale));--__P__-text-xl: calc(22px * var(--__P__-text-scale));--__P__-text-2xl: calc(30px * var(--__P__-text-scale))}:host([data-mode="modal"]),:host([data-mode="drawer"]){--__P__-conversation-max: 100%}:host([data-text-size="small"]){--__P__-text-scale: .9}:host([data-text-size="large"]){--__P__-text-scale: 1.15}:host{--__P__-ease: cubic-bezier(.2, .7, .2, 1);--__P__-ease-out: cubic-bezier(.2, .7, .2, 1);--__P__-ease-in: cubic-bezier(.4, 0, 1, 1);--__P__-ease-in-out: cubic-bezier(.65, 0, .35, 1);--__P__-dur-quick: .12s;--__P__-dur-base: .22s;--__P__-dur-slow: .32s;font-family:var(--__P__-font);color:var(--__P__-fg);color-scheme:light;--__P__-color-scheme: light}:host([data-theme="dark"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-danger-text: oklch(.8077 .1035 19.57);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .18);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);--__P__-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -6px rgba(0, 0, 0, .5);--__P__-backdrop: rgba(0, 0, 0, .65);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;color-scheme:dark;--__P__-color-scheme: dark}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);color-scheme:dark;--__P__-color-scheme: dark}}@supports (color: oklch(from red l c h)){:host{--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.3, l, .62) c h);--__P__-accent-text: oklch(from var(--__P__-accent) clamp(0, (l / .623 - 1) * -infinity, 1) 0 h);--__P__-accent-fg: oklch(from var(--__P__-accent-user) clamp(.3, l, .46) c h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
|
|
2
2
|
`;var Is=`*,*:before,*:after{box-sizing:border-box;margin:0;padding:0;border:0}button{font:inherit;color:inherit;background:none;cursor:pointer;-webkit-appearance:none;appearance:none;line-height:1}button:focus-visible,[tabindex]:focus-visible,textarea:focus-visible,input:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}textarea,input{font:inherit;color:inherit;background:none;border:0;outline:0;resize:none}a{color:var(--__P__-accent-fg);text-decoration:underline;text-underline-offset:2px}img,svg{display:block;max-width:100%}ul,ol{list-style:none}.__P__-app{display:block;width:100%;height:100%;font-family:var(--__P__-font);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-feature-settings:"cv11","ss01","ss03"}.__P__-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
|
|
3
3
|
`;var Es=`.__P__-anchor{color-scheme:var(--__P__-color-scheme, light);right:16px;bottom:16px}.__P__-surface{display:contents}.__P__-surface[hidden]{display:none}:host([data-position="bottom-left"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{right:auto;left:16px}:host([data-position="top-right"]) .__P__-anchor,:host([data-position="top-left"]) .__P__-anchor{bottom:auto;top:16px}.__P__-anchor{position:fixed;display:flex;flex-direction:column;align-items:flex-end;gap:var(--__P__-space-3);pointer-events:none}.__P__-anchor{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=sm]{--__P__-fab-size: 44px}.__P__-anchor[data-launcher-size=md]{--__P__-fab-size: 56px}.__P__-anchor[data-launcher-size=lg]{--__P__-fab-size: 68px}.__P__-anchor>*{pointer-events:auto}.__P__-fab[data-size=sm]{--__P__-fab-size: 44px;font-size:var(--__P__-text-sm)}.__P__-fab[data-size=md]{--__P__-fab-size: 56px;font-size:calc(14px * var(--__P__-text-scale))}.__P__-fab[data-size=lg]{--__P__-fab-size: 68px;font-size:var(--__P__-text-base)}.__P__-fab{display:inline-flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);color:var(--__P__-accent-text);background:var(--__P__-accent);box-shadow:var(--__P__-shadow-fab);font-weight:600;line-height:1;transform-origin:bottom right;animation:__P__-fab-in var(--__P__-dur-base) var(--__P__-ease) both;transition:transform var(--__P__-dur-base) var(--__P__-ease),opacity var(--__P__-dur-base) var(--__P__-ease),box-shadow var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab:hover{transform:translateY(-2px)}.__P__-fab:active{transform:translateY(0)}.__P__-fab:focus-visible{outline:2px solid var(--__P__-on-accent);outline-offset:3px}.__P__-fab svg{width:24px;height:24px;flex-shrink:0}@keyframes __P__-fab-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:none}}.__P__-fab[data-leaving]{position:absolute;right:0;bottom:0;animation:__P__-fab-out var(--__P__-dur-quick) var(--__P__-ease) forwards;pointer-events:none}:host([data-position^="top-"]) .__P__-fab[data-leaving]{bottom:auto;top:0}:host([data-position$="-left"]) .__P__-fab[data-leaving]{right:auto;left:0}@keyframes __P__-fab-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.85)}}.__P__-fab[data-variant=circle]{width:var(--__P__-fab-size);height:var(--__P__-fab-size);border-radius:999px}.__P__-fab[data-variant=circle] .__P__-fab-label{display:none}.__P__-fab[data-variant=pill]{height:var(--__P__-fab-size);padding:0 18px 0 16px;border-radius:999px}.__P__-fab[data-variant=bar]{height:var(--__P__-fab-size);padding:0 22px;border-radius:var(--__P__-radius)}.__P__-fab[data-variant=minimal]{height:var(--__P__-fab-size);padding:0 var(--__P__-space-4);border-radius:999px;background:transparent;color:var(--__P__-accent-fg);box-shadow:none;border:1px solid currentColor}.__P__-fab[data-variant=minimal]:hover{background:color-mix(in srgb,var(--__P__-accent) 12%,transparent)}.__P__-callout{--__P__-callout-fab-h: var(--__P__-fab-size, 56px);--__P__-callout-gap: clamp(12px, calc(var(--__P__-callout-fab-h) * .25), 22px);--__P__-callout-nudge-direction: -1;position:absolute;display:inline-flex;align-items:center;gap:var(--__P__-space-2);padding:10px 14px;background:var(--__P__-fg);color:var(--__P__-bg);border-radius:999px;font-size:var(--__P__-text-sm);font-weight:600;line-height:1.2;box-shadow:0 10px 30px -8px #00000059;pointer-events:auto;animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease);z-index:1;max-width:240px;white-space:nowrap}.__P__-callout[data-position=left]{right:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%)}.__P__-callout[data-position=right]{left:calc(100% + var(--__P__-callout-gap));bottom:calc(var(--__P__-callout-fab-h) / 2);transform:translateY(50%);--__P__-callout-nudge-direction: 1}.__P__-callout[data-position=top]{bottom:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-position=bottom]{top:calc(100% + var(--__P__-callout-gap));right:0;max-width:min(280px,calc(100vw - 32px))}:host([data-position$="-left"]) .__P__-callout[data-position=top],:host([data-position$="-left"]) .__P__-callout[data-position=bottom]{right:auto;left:0}.__P__-callout[data-shape=bubble]{border-radius:var(--__P__-radius-md);white-space:normal;width:max-content;max-width:min(280px,calc(100vw - 32px))}.__P__-callout[data-shape=callout]{padding:12px 18px;font-size:calc(14px * var(--__P__-text-scale));background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-callout:after{content:"";position:absolute;width:12px;height:12px;background:inherit;border-radius:2px;transform:rotate(45deg)}.__P__-callout[data-position=left]:after{right:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=right]:after{left:-5px;top:50%;margin-top:-6px}.__P__-callout[data-position=top]:after{bottom:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-position=bottom]:after{top:-5px;right:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}:host([data-position$="-left"]) .__P__-callout[data-position=top]:after,:host([data-position$="-left"]) .__P__-callout[data-position=bottom]:after{right:auto;left:calc(var(--__P__-fab-size, 56px) / 2 - 6px)}.__P__-callout[data-animated]{animation:__P__-callout-in var(--__P__-dur-slow) var(--__P__-ease),__P__-callout-nudge 1.6s var(--__P__-ease-in-out) var(--__P__-dur-slow) infinite}@keyframes __P__-callout-in{0%{opacity:0}to{opacity:1}}@keyframes __P__-callout-nudge{0%,to{margin-left:0;margin-right:0}50%{margin-left:calc(6px * var(--__P__-callout-nudge-direction));margin-right:calc(-6px * var(--__P__-callout-nudge-direction))}}@media(prefers-reduced-motion:reduce){.__P__-callout[data-animated]{animation:__P__-callout-in 1ms var(--__P__-ease)}.__P__-icon-btn[data-recording=true],.__P__-typing span{animation:none}}.__P__-callout-close{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:999px;color:inherit;opacity:.7;cursor:pointer}.__P__-callout-close:hover{opacity:1;background:color-mix(in srgb,currentColor 15%,transparent)}.__P__-callout-close:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-callout-close svg{width:12px;height:12px}.__P__-panel{width:var(--__P__-panel-w);height:var(--__P__-panel-h);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);background:var(--__P__-bg);color:var(--__P__-fg);border-radius:var(--__P__-radius-lg);box-shadow:var(--__P__-shadow-panel);display:flex;flex-direction:column;overflow:hidden;overscroll-behavior:none;transform-origin:bottom right;animation:__P__-panel-in var(--__P__-dur-slow) var(--__P__-ease);border:1px solid var(--__P__-border)}@media(prefers-reduced-motion:no-preference){.__P__-panel{transition:width var(--__P__-dur-base) var(--__P__-ease),height var(--__P__-dur-base) var(--__P__-ease),max-width var(--__P__-dur-base) var(--__P__-ease),max-height var(--__P__-dur-base) var(--__P__-ease)}.__P__-panel[data-resizing]{transition:none}}:host([data-mode="open"]) .__P__-panel{width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));min-width:var(--__P__-resize-min-w, auto);min-height:var(--__P__-resize-min-h, auto);max-width:var(--__P__-resize-max-w, calc(100vw - 32px) );max-height:var(--__P__-resize-max-h, calc(100dvh - 32px) )}@keyframes __P__-panel-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}:host([data-mode="expanded"]) .__P__-panel{width:var(--__P__-expanded-w, 640px);height:var(--__P__-expanded-h, 820px);max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px)}:host([data-mode="fullscreen"]){z-index:var(--__P__-z-panel)!important}:host([data-mode="fullscreen"]) .__P__-anchor{inset:var(--__P__-visual-viewport-top, 0px) 0 auto;height:var(--__P__-visual-viewport-height, 100dvh);padding:0;justify-content:flex-end;align-items:flex-end}:host([data-mode="fullscreen"][data-position*="top"]) .__P__-anchor{justify-content:flex-start}:host([data-mode="fullscreen"][data-position*="left"]) .__P__-anchor{align-items:flex-start}:host([data-mode="fullscreen"]) .__P__-panel{width:100vw;height:100%;max-width:none;max-height:none;border-radius:0;border:0}:host([data-mode="fullscreen"]) .__P__-fab{display:none}@media(max-width:640px){:host([data-mode="open"]) .__P__-anchor,:host([data-mode="expanded"]) .__P__-anchor{inset:var(--__P__-visual-viewport-top, 0px) 0 auto;align-items:stretch;height:var(--__P__-visual-viewport-height, 100dvh);padding:0}:host([data-mode="open"]) .__P__-panel,:host([data-mode="expanded"]) .__P__-panel{width:100vw;height:100%;max-width:none;max-height:none;border-radius:0;border:0}}:host([data-mode="inline"]) .__P__-anchor,:host([data-mode="standalone"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-height:0}:host([data-mode="inline"]) .__P__-panel,:host([data-mode="standalone"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;animation:none}:host([data-mode="inline"]) .__P__-fab,:host([data-mode="standalone"]) .__P__-fab{display:none}:host([data-mode="inline"]){min-height:320px}:host([data-mode="inline"]) .__P__-panel{border-radius:var(--__P__-radius)}:host([data-mode="standalone"]) .__P__-panel{border-radius:0;border:0;box-shadow:none}:host([data-mode="modal"]){position:fixed!important;inset:0!important;z-index:var(--__P__-z-panel)!important;display:block!important;width:100vw;height:100dvh;background:var(--__P__-modal-backdrop, var(--__P__-backdrop));animation:__P__-backdrop-in var(--__P__-dur-base) var(--__P__-ease) both;--__P__-panel-w: min(960px, 92vw);--__P__-panel-h: min(720px, 88dvh)}:host([data-mode="modal"]) .__P__-anchor{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:var(--__P__-space-6);pointer-events:none}:host([data-mode="modal"]) .__P__-panel{pointer-events:auto;width:var(--__P__-widget-w, var(--__P__-panel-w));height:var(--__P__-widget-h, var(--__P__-panel-h));max-width:calc(100vw - 48px);max-height:calc(100dvh - 48px);min-width:0;min-height:0;border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-panel);animation:__P__-modal-in var(--__P__-dur-base) var(--__P__-ease);translate:var(--__P__-modal-dx, 0px) var(--__P__-modal-dy, 0px)}:host([data-mode="modal"]) .__P__-header,:host([data-mode="modal"]) .__P__-back-header,:host([data-mode="modal"]) .__P__-home-hero{cursor:grab;touch-action:none}:host([data-mode="modal"]) .__P__-panel[data-dragging]{cursor:grabbing;user-select:none}:host([data-mode="modal"]) .__P__-panel[data-dragging] *{cursor:grabbing}:host([data-mode="modal"]) .__P__-fab{display:none}@keyframes __P__-backdrop-in{0%{background:#0000}to{background:var(--__P__-modal-backdrop, var(--__P__-backdrop))}}@keyframes __P__-modal-in{0%{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}:host([data-mode="drawer"]){--__P__-panel-w: min(440px, calc(100vw - 32px) );--__P__-panel-h: 100dvh}:host([data-mode="drawer"]) .__P__-anchor{position:fixed;--__P__-inset-x: var(--__P__-panel-inset, 12px);--__P__-inset-y: var(--__P__-panel-inset, 3dvh);top:var(--__P__-inset-y);bottom:auto;right:var(--__P__-inset-x);left:auto;width:min(var(--__P__-widget-w, var(--__P__-panel-w)),calc(100vw - var(--__P__-inset-x) * 2));height:min(var(--__P__-widget-h, var(--__P__-panel-h)),calc(100dvh - var(--__P__-inset-y) * 2));padding:0;display:block;pointer-events:auto}:host([data-mode="drawer"][data-position$="-left"]) .__P__-anchor{right:auto;left:var(--__P__-inset-x)}:host([data-mode="drawer"][data-position^="bottom-"]) .__P__-anchor{top:auto;bottom:var(--__P__-inset-y)}:host([data-mode="drawer"]) .__P__-panel{width:100%;height:100%;max-width:none;max-height:none;min-width:0;min-height:0;border-radius:var(--__P__-radius, 12px);border:1px solid var(--__P__-border);box-shadow:-8px 16px 32px -12px #00000038;animation:__P__-drawer-in var(--__P__-dur-base) var(--__P__-ease)}:host([data-mode="drawer"][data-position$="-left"]) .__P__-panel{box-shadow:8px 16px 32px -12px #00000038;animation:__P__-drawer-in-left var(--__P__-dur-base) var(--__P__-ease)}.__P__-fab[data-edge-tab]{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-2);position:fixed;top:50%;height:140px;width:auto;min-width:0;padding:10px 8px;writing-mode:vertical-rl;text-orientation:mixed;transform:translateY(-50%);transform-origin:center;animation:__P__-edge-tab-in var(--__P__-dur-base) var(--__P__-ease) both}.__P__-fab[data-edge-tab] svg{writing-mode:horizontal-tb}.__P__-fab[data-edge-tab]:hover{transform:translateY(-50%) scale(1.03)}.__P__-fab[data-edge-tab]:active{transform:translateY(-50%) scale(.97)}:host([data-position$="-right"]) .__P__-fab[data-edge-tab]{right:0;left:auto;border-radius:12px 0 0 12px;box-shadow:-6px 0 18px -8px #0000004d}:host([data-position$="-left"]) .__P__-fab[data-edge-tab]{left:0;right:auto;border-radius:0 12px 12px 0;box-shadow:6px 0 18px -8px #0000004d}.__P__-fab[data-edge-tab][data-leaving]{position:fixed;top:50%;bottom:auto;animation:__P__-edge-tab-out var(--__P__-dur-quick) var(--__P__-ease) forwards}@keyframes __P__-edge-tab-in{0%{opacity:0;transform:translateY(-50%) scale(.9)}to{opacity:1;transform:translateY(-50%) scale(1)}}@keyframes __P__-edge-tab-out{0%{opacity:1;transform:translateY(-50%) scale(1)}to{opacity:0;transform:translateY(-50%) scale(.85)}}@keyframes __P__-drawer-in{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes __P__-drawer-in-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@media(prefers-reduced-motion:reduce){:host([data-mode="drawer"]) .__P__-panel,.__P__-fab[data-edge-tab]{animation:none}}.__P__-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);background:var(--__P__-bg)}.__P__-header h1{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;flex:1;letter-spacing:-.01em}.__P__-header-actions{margin-inline-start:auto;display:flex;align-items:center;gap:var(--__P__-space-1);flex-shrink:0}.__P__-agent{flex:1;display:inline-flex;align-items:center;gap:10px;min-width:0}.__P__-agent-avatar{position:relative;width:32px;height:32px;border-radius:999px;background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:var(--__P__-text-xs);overflow:hidden;flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;object-fit:cover}.__P__-agent-avatar:after{content:"";position:absolute;right:-1px;bottom:-1px;width:10px;height:10px;border-radius:999px;border:2px solid var(--__P__-bg);background:var(--__P__-neutral)}.__P__-agent-avatar[data-status=online]:after{background:var(--__P__-success)}.__P__-agent-avatar[data-status=away]:after{background:var(--__P__-warning)}.__P__-agent-avatar[data-status=offline]:after{background:var(--__P__-neutral)}.__P__-agent-meta{display:flex;flex-direction:column;line-height:1.15;min-width:0}.__P__-agent-meta strong{font-size:calc(14px * var(--__P__-text-scale));font-weight:600;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-agent-meta span{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-suggestions{display:flex;flex-wrap:nowrap;gap:var(--__P__-space-2);padding:6px 14px 10px;overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;scroll-snap-type:x proximity;scrollbar-width:none;-ms-overflow-style:none;min-width:0}.__P__-suggestions::-webkit-scrollbar{display:none}.__P__-suggestions:before,.__P__-suggestions:after{content:"";flex:1 1 0;min-width:0}.__P__-suggestion{flex:0 0 auto;scroll-snap-align:center;padding:7px 14px;border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg);font-size:var(--__P__-text-sm);font-weight:500;white-space:nowrap;transition:background var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-suggestion:hover{border-color:var(--__P__-accent);color:var(--__P__-accent-fg);transform:translateY(-1px)}.__P__-suggestion:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-color:var(--__P__-accent)}.__P__-suggestion:active{transform:translateY(0)}.__P__-icon-btn{width:32px;height:32px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);transition:background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-icon-btn:hover{background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-icon-btn:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-icon-btn:active{background:var(--__P__-border)}.__P__-icon-btn:disabled{opacity:.45;cursor:not-allowed}.__P__-icon-btn:before{content:"";position:absolute;inset:-6px}.__P__-icon-btn{position:relative}.__P__-icon-btn svg{width:18px;height:18px}.__P__-icon-btn[data-recording=true]{color:var(--__P__-accent-fg);background:color-mix(in srgb,var(--__P__-accent) 12%,transparent);animation:__P__-pulse 1.2s var(--__P__-ease) infinite}@keyframes __P__-pulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--__P__-accent) 40%,transparent)}50%{box-shadow:0 0 0 6px color-mix(in srgb,var(--__P__-accent) 0%,transparent)}}.__P__-list,.__P__-history,.__P__-module-scroll,.__P__-home-scroll,.__P__-help-list,.__P__-toolui-code,.__P__-sidebar-conversations{scrollbar-width:thin;scrollbar-color:var(--__P__-border-strong) transparent;overscroll-behavior:contain;scrollbar-gutter:stable}.__P__-list::-webkit-scrollbar,.__P__-history::-webkit-scrollbar,.__P__-module-scroll::-webkit-scrollbar,.__P__-home-scroll::-webkit-scrollbar,.__P__-help-list::-webkit-scrollbar,.__P__-toolui-code::-webkit-scrollbar,.__P__-sidebar-conversations::-webkit-scrollbar{width:8px}.__P__-list::-webkit-scrollbar-thumb,.__P__-history::-webkit-scrollbar-thumb,.__P__-module-scroll::-webkit-scrollbar-thumb,.__P__-home-scroll::-webkit-scrollbar-thumb,.__P__-help-list::-webkit-scrollbar-thumb,.__P__-toolui-code::-webkit-scrollbar-thumb,.__P__-sidebar-conversations::-webkit-scrollbar-thumb{background:var(--__P__-border-strong);border-radius:8px}.__P__-list-wrap{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}.__P__-jump{position:absolute;inset-inline-end:14px;bottom:14px;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:999px;border:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);color:var(--__P__-fg);box-shadow:var(--__P__-shadow-panel);cursor:pointer;opacity:.85;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease);animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-jump:hover{opacity:1}.__P__-jump:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-jump:active{transform:translateY(1px)}.__P__-jump svg{width:18px;height:18px}.__P__-list{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-4);padding-bottom:var(--__P__-space-8);display:flex;flex-direction:column;gap:14px}.__P__-list--fade{--__P__-fade-size: 20px;--__P__-fade-top: 0px;--__P__-fade-bottom: 0px;-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%)}.__P__-list--fade[data-fade-top=true]{--__P__-fade-top: var(--__P__-fade-size)}.__P__-list--fade[data-fade-bottom=true]{--__P__-fade-bottom: var(--__P__-fade-size)}.__P__-list>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-load-previous,.__P__-history-more{display:flex;justify-content:center}.__P__-load-previous button,.__P__-history-more button{border:0;padding:4px 8px;background:transparent;color:var(--__P__-accent);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;cursor:pointer}.__P__-load-previous button:hover,.__P__-history-more button:hover{text-decoration:underline}.__P__-load-previous button:focus-visible,.__P__-history-more button:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-load-previous button:disabled,.__P__-history-more button:disabled{cursor:wait;opacity:.6}.__P__-date-divider{display:flex;justify-content:center;margin-block:var(--__P__-space-3)}.__P__-date-pill{padding:3px 10px;border-radius:999px;font-size:calc(11px * var(--__P__-text-scale));font-weight:600;color:var(--__P__-fg-muted);background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);box-shadow:var(--__P__-shadow-card)}.__P__-bubble-row{display:flex}.__P__-bubble-row[data-role=user]{justify-content:flex-end}.__P__-bubble-row[data-role=assistant]{justify-content:flex-start}.__P__-bubble{max-width:100%;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);line-height:1.6;font-size:calc(14px * var(--__P__-text-scale));word-wrap:break-word;overflow-wrap:break-word;box-shadow:0 1px 2px #0000000a,0 1px 8px -4px #0000000f;animation:__P__-bubble-in var(--__P__-dur-base) var(--__P__-ease)}.__P__-bubble ::selection{background:color-mix(in srgb,var(--__P__-accent) 30%,transparent)}.__P__-bubble-row[data-role=user] .__P__-bubble ::selection{background:#fff6;color:var(--__P__-bubble-user-text)}@keyframes __P__-bubble-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-bubble-row[data-role=user] .__P__-bubble{background:var(--__P__-bubble-user);color:var(--__P__-bubble-user-text);border-end-end-radius:5px}.__P__-bubble-row[data-role=assistant] .__P__-bubble{background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border:1px solid var(--__P__-border);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble{display:flex;align-items:stretch;padding:0;overflow:hidden;background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-author{display:flex;flex:0 0 auto;align-items:center;padding:0 .875rem;border-inline-end:1px solid color-mix(in oklab,var(--__P__-accent),transparent 60%);color:var(--__P__-accent);font-size:calc(13px * var(--__P__-text-scale));font-weight:600;letter-spacing:.025em;user-select:none}.__P__-bubble-row[data-role=operator] .__P__-bubble-body{flex:1 1 auto;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4)}.__P__-bubble-col{display:flex;flex-direction:column;max-width:85%;min-width:0}.__P__-bubble-row[data-role=user] .__P__-bubble-col{align-items:flex-end}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui){width:100%}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui) .__P__-bubble{width:100%}@media(max-width:640px){.__P__-bubble-col{max-width:92%}.__P__-toolui:not(.__P__-toolui-collapsible){padding:var(--__P__-space-3);gap:var(--__P__-space-2)}details.__P__-toolui-collapsible>summary{padding:var(--__P__-space-2) var(--__P__-space-3)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-3)}.__P__-toolui-section,.__P__-toolui-desc{padding:var(--__P__-space-2) var(--__P__-space-3)}}.__P__-bubble-meta{display:flex;align-items:center;gap:8px;margin-top:2px;padding:0 2px;min-height:24px}.__P__-bubble-actions{display:flex;align-items:center;gap:2px}.__P__-bubble-time{font-size:calc(11px * var(--__P__-text-scale));line-height:1;color:var(--__P__-fg-muted);user-select:none}.__P__-feedback{display:flex;align-items:center;gap:2px}.__P__-msg-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:0;border-radius:var(--__P__-radius-sm);background:transparent;color:var(--__P__-fg-muted);cursor:pointer;opacity:.65;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-msg-action:hover{opacity:1;background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-msg-action:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-msg-action[data-active=true]{opacity:1;color:var(--__P__-accent-fg)}.__P__-msg-action svg{width:15px;height:15px}.__P__-md>*:first-child{margin-top:0}.__P__-md>*:last-child{margin-bottom:0}.__P__-md p{margin:10px 0}.__P__-md h1,.__P__-md h2,.__P__-md h3,.__P__-md h4,.__P__-md h5,.__P__-md h6{margin:18px 0 8px;line-height:1.3;letter-spacing:-.01em;font-weight:700}.__P__-md h1{font-size:1.4em}.__P__-md h2{font-size:1.22em}.__P__-md h3{font-size:1.08em}.__P__-md h4,.__P__-md h5,.__P__-md h6{font-size:1em}.__P__-md>h1:first-child,.__P__-md>h2:first-child,.__P__-md>h3:first-child,.__P__-md>h4:first-child,.__P__-md>h5:first-child,.__P__-md>h6:first-child{margin-top:0}.__P__-md ul,.__P__-md ol{padding-inline-start:1.5em;margin:10px 0}.__P__-md ul{list-style:disc}.__P__-md ol{list-style:decimal}.__P__-md li{margin:6px 0;padding-inline-start:2px}.__P__-md li::marker{color:var(--__P__-fg-muted)}.__P__-md li>p{margin:6px 0}.__P__-md li>ul,.__P__-md li>ol{margin:6px 0}.__P__-md strong,.__P__-md b{font-weight:650;letter-spacing:-.005em}.__P__-md em,.__P__-md i{font-style:italic}.__P__-md code{font-family:var(--__P__-font-mono);font-size:.86em;padding:1px 6px;border-radius:5px;background:color-mix(in srgb,var(--__P__-accent) 10%,transparent);color:var(--__P__-fg);border:1px solid color-mix(in srgb,var(--__P__-accent) 16%,transparent)}.__P__-md pre{font-family:var(--__P__-font-mono);font-size:calc(12.5px * var(--__P__-text-scale));padding:12px 14px;border-radius:var(--__P__-radius-sm);background:#7f7f7f1f;overflow-x:auto;margin:var(--__P__-space-3) 0;line-height:1.5}.__P__-md pre code{padding:0;background:none}.__P__-md a{color:inherit;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.__P__-md a:hover{text-decoration-thickness:2px}.__P__-md blockquote{margin:14px 0;padding:6px 14px;border-inline-start:3px solid color-mix(in srgb,var(--__P__-accent) 50%,transparent);background:color-mix(in srgb,var(--__P__-accent) 5%,transparent);border-start-end-radius:var(--__P__-radius-sm);border-end-end-radius:var(--__P__-radius-sm);color:var(--__P__-fg-muted)}.__P__-md blockquote>:first-child{margin-top:0}.__P__-md blockquote>:last-child{margin-bottom:0}.__P__-md hr{border:0;height:1px;background:color-mix(in srgb,currentColor 18%,transparent);margin:var(--__P__-space-4) 0}.__P__-md table{border-collapse:collapse;margin:var(--__P__-space-3) 0;font-size:.95em;display:block;overflow-x:auto;max-width:100%;font-variant-numeric:tabular-nums}.__P__-md th,.__P__-md td{padding:6px 10px;border-bottom:1px solid color-mix(in srgb,currentColor 12%,transparent);text-align:start}.__P__-md th{font-weight:700;background:color-mix(in srgb,currentColor 6%,transparent)}.__P__-md h1+ul,.__P__-md h1+ol,.__P__-md h2+ul,.__P__-md h2+ol,.__P__-md h3+ul,.__P__-md h3+ol,.__P__-md h4+ul,.__P__-md h4+ol{margin-top:var(--__P__-space-1)}.__P__-loading{display:inline-flex;align-items:center;gap:var(--__P__-space-2);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-loading-spinner{width:14px;height:14px;border-radius:999px;border:2px solid currentColor;border-top-color:transparent;animation:__P__-spin .8s linear infinite}@keyframes __P__-spin{to{transform:rotate(1turn)}}.__P__-typing{display:inline-flex;gap:var(--__P__-space-1);padding:var(--__P__-space-1) 0}.__P__-typing span{width:5px;height:5px;border-radius:999px;background:currentColor;opacity:.4;animation:__P__-blink 1.2s var(--__P__-ease) infinite}.__P__-typing span:nth-child(2){animation-delay:.2s}.__P__-typing span:nth-child(3){animation-delay:.4s}@keyframes __P__-blink{0%,80%,to{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-2px)}}.__P__-reasoning{margin:var(--__P__-space-1) 0 var(--__P__-space-2);padding-inline-start:var(--__P__-space-3);border-inline-start:2px solid var(--__P__-border-strong)}.__P__-reasoning-summary{display:inline-flex;align-items:center;gap:var(--__P__-space-1);cursor:pointer;list-style:none;user-select:none;color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600}.__P__-reasoning-summary:hover{color:var(--__P__-fg)}.__P__-reasoning-summary:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-reasoning-summary::-webkit-details-marker{display:none}.__P__-reasoning-summary:before{content:"";width:5px;height:5px;border-inline-end:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);opacity:.7;transition:transform var(--__P__-dur-quick) var(--__P__-ease)}.__P__-reasoning[open] .__P__-reasoning-summary:before{transform:rotate(45deg)}.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:__P__-reasoning-pulse 1.4s var(--__P__-ease) infinite}@keyframes __P__-reasoning-pulse{0%,to{opacity:.5}50%{opacity:1}}@media(prefers-reduced-motion:reduce){.__P__-reasoning[data-active=true] .__P__-reasoning-label{animation:none}}.__P__-reasoning-body{margin-top:var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-reasoning-body>:first-child{margin-top:0}.__P__-reasoning-body>:last-child{margin-bottom:0}.__P__-source{display:inline-flex;align-items:center;gap:6px;max-width:100%;margin-top:6px;margin-inline-end:6px;padding:var(--__P__-space-1) var(--__P__-space-2);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);text-decoration:none}a.__P__-source:hover{color:var(--__P__-fg);border-color:var(--__P__-accent)}.__P__-source-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-composer{border-top:1px solid var(--__P__-border);padding:10px 12px;background:var(--__P__-bg);display:flex;flex-direction:column;gap:var(--__P__-space-2)}.__P__-composer>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-composer-row{display:flex;align-items:flex-end;gap:6px}.__P__-textarea{flex:1;--__P__-textarea-base-height: 40px;height:var(--__P__-textarea-base-height);max-height:160px;padding:10px 12px;border-radius:var(--__P__-radius);background:var(--__P__-bg-elevated);border:1px solid transparent;font-size:calc(14px * var(--__P__-text-scale));line-height:1.4;transition:height var(--__P__-dur-quick) var(--__P__-ease),border-color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-textarea:focus-visible{outline:none;border-color:var(--__P__-focus)}@media(pointer:coarse){.__P__-textarea,.__P__-home-search-input{font-size:max(16px,calc(16px * var(--__P__-text-scale)))}.__P__-textarea{--__P__-textarea-base-height: 44px}}.__P__-send{width:40px;height:40px;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),transform var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease)}.__P__-send[data-shape=circle]{border-radius:999px}.__P__-send[data-shape=square]{border-radius:var(--__P__-radius-sm)}.__P__-send[data-shape=pill]{width:auto;padding:0 18px;border-radius:999px}.__P__-send[data-variant=filled]{background:var(--__P__-accent);color:var(--__P__-accent-text)}.__P__-send[data-variant=outline]{background:transparent;color:var(--__P__-accent-fg);border-color:var(--__P__-accent)}.__P__-send[data-variant=outline]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 10%,transparent)}.__P__-send[data-variant=ghost]{background:transparent;color:var(--__P__-accent-fg)}.__P__-send[data-variant=ghost]:not(:disabled):hover{background:color-mix(in srgb,var(--__P__-accent) 8%,transparent)}.__P__-send:disabled{opacity:.4;cursor:not-allowed}.__P__-send:not(:disabled):hover{transform:translateY(-1px)}.__P__-send:not(:disabled):active{transform:translateY(0)}.__P__-send:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-send svg{width:18px;height:18px}.__P__-composer-actions{display:flex;gap:var(--__P__-space-1);flex-wrap:wrap}.__P__-attachments{display:flex;flex-wrap:wrap;gap:6px}.__P__-attachment-chip{display:inline-flex;align-items:center;gap:6px;padding:var(--__P__-space-1) var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-1);border-radius:999px;background:var(--__P__-bg-elevated);border:1px solid var(--__P__-border);font-size:var(--__P__-text-xs);max-width:200px}.__P__-attachment-thumb{width:24px;height:24px;border-radius:999px;object-fit:cover;background:var(--__P__-border)}.__P__-attachment-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-attachment-remove{width:18px;height:18px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted)}.__P__-attachment-remove:hover{background:var(--__P__-border);color:var(--__P__-fg)}.__P__-dropzone{position:absolute;inset:8px;border:2px dashed var(--__P__-accent);border-radius:var(--__P__-radius);background:color-mix(in srgb,var(--__P__-accent) 8%,transparent);display:flex;align-items:center;justify-content:center;font-weight:600;color:var(--__P__-accent-fg);pointer-events:none;z-index:10;animation:__P__-fade-in var(--__P__-dur-quick) var(--__P__-ease)}@keyframes __P__-fade-in{0%{opacity:0}to{opacity:1}}.__P__-error{margin-top:var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-sm);background:color-mix(in oklab,var(--__P__-danger) 8%,var(--__P__-bg-elevated));border:1px solid color-mix(in oklab,var(--__P__-danger) 20%,transparent);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);display:flex;align-items:center;gap:var(--__P__-space-2)}.__P__-error span{min-width:0}.__P__-error button{margin-inline-start:auto;flex-shrink:0;border:0;background:none;padding:0;color:var(--__P__-accent-fg);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;text-decoration:underline;white-space:nowrap;cursor:pointer}.__P__-history{flex:1;overflow-y:auto;padding:var(--__P__-space-2) var(--__P__-space-1) var(--__P__-space-3)}.__P__-history-footer{flex:none;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);border-top:1px solid var(--__P__-border);background:var(--__P__-surface)}.__P__-history-new{width:100%;display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);padding:var(--__P__-space-2) var(--__P__-space-3);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-on-accent);cursor:pointer;font-size:var(--__P__-text-sm);font-weight:600;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-history-new svg{width:16px;height:16px}.__P__-history-new:hover{filter:brightness(1.08)}.__P__-history-new:active{transform:translateY(1px)}.__P__-history-new:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-history-empty{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 16px;color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));text-align:center}.__P__-history-group{display:flex;flex-direction:column;padding:0 var(--__P__-space-3)}.__P__-history-heading{font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);padding:14px 4px 8px;text-transform:uppercase;letter-spacing:.04em}.__P__-history-card{display:flex;flex-direction:column;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);overflow:hidden}.__P__-history-item{all:unset;display:flex;align-items:center;gap:var(--__P__-space-3);padding:12px var(--__P__-space-3);cursor:pointer;transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-history-item+.__P__-history-item{border-top:1px solid var(--__P__-border)}.__P__-history-item:hover{background:var(--__P__-bg-elevated)}.__P__-history-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-history-avatar{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:color-mix(in oklab,var(--__P__-accent) 12%,transparent);color:var(--__P__-accent-fg)}.__P__-history-avatar svg{width:18px;height:18px}.__P__-history-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.__P__-history-row{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2)}.__P__-history-title{flex:1;min-width:0;font-size:calc(14px * var(--__P__-text-scale));font-weight:500;color:var(--__P__-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-time{flex:none;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-history-preview{flex:1;min-width:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-history-dot{flex:none;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-history-item[data-unread=true] .__P__-history-title{font-weight:600}.__P__-history-item[data-closed=true] .__P__-history-title{color:var(--__P__-fg-muted)}.__P__-history-item-skeleton{cursor:default;pointer-events:none}.__P__-skeleton{display:block;border-radius:4px;background:linear-gradient(90deg,color-mix(in oklab,var(--__P__-fg) 9%,transparent) 30%,color-mix(in oklab,var(--__P__-fg) 17%,transparent),color-mix(in oklab,var(--__P__-fg) 9%,transparent) 70%);background-size:200% 100%;animation:__P__-skeleton-shimmer 1.8s ease-in-out infinite}.__P__-history-avatar.__P__-skeleton{border-radius:50%}.__P__-skeleton-heading{width:52px;height:8px}.__P__-skeleton-title{width:55%;height:12px}.__P__-skeleton-time{width:34px;height:10px}.__P__-skeleton-preview{width:80%;height:10px}@keyframes __P__-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.__P__-skeleton{animation:none}}.__P__-list-loading{margin:auto;padding:var(--__P__-space-6) var(--__P__-space-4);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);text-align:center}.__P__-readonly-banner{display:flex;flex-direction:column;align-items:center;gap:10px;padding:14px 12px;margin:0 var(--__P__-space-3) var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated);color:var(--__P__-fg-muted);text-align:center;font-size:var(--__P__-text-sm)}.__P__-readonly-label{line-height:1.4}.__P__-readonly-cta{appearance:none;border:0;cursor:pointer;padding:var(--__P__-space-2) var(--__P__-space-4);border-radius:999px;background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-readonly-cta:hover,.__P__-readonly-cta:focus-visible{filter:brightness(1.1)}.__P__-operator-banner{display:flex;align-items:center;justify-content:center;gap:8px;margin:0 var(--__P__-space-3) var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg-elevated),var(--__P__-accent) 6%);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);line-height:1.3;text-align:center}.__P__-operator-pulse{flex:0 0 auto;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-operator-banner[data-mode=awaiting_operator] .__P__-operator-pulse{animation:__P__-operator-pulse 1.4s var(--__P__-ease-out) infinite}.__P__-cancel-operator-request{flex:0 0 auto;padding:0;border:0;background:none;color:var(--__P__-accent);font:inherit;font-weight:600;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.__P__-cancel-operator-request:hover{opacity:.8}.__P__-cancel-operator-request:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-radius:var(--__P__-radius-sm)}@keyframes __P__-operator-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}.__P__-readonly-cta:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}.__P__-composer-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 16px;margin:0 var(--__P__-space-3);border-top:1px solid var(--__P__-border);text-align:center;font-size:calc(11px * var(--__P__-text-scale));line-height:1.4;color:var(--__P__-fg-muted)}.__P__-disclaimer{max-width:320px;margin:0 auto;opacity:.9;letter-spacing:.01em}.__P__-poweredby{display:inline-flex;align-items:center;justify-content:center;gap:6px;color:inherit;text-decoration:none;opacity:.7;transition:opacity var(--__P__-dur-base) var(--__P__-ease);font-size:calc(11px * var(--__P__-text-scale));letter-spacing:.02em}.__P__-poweredby:hover{opacity:1}.__P__-poweredby-logo{height:12px;width:auto;display:inline-block;vertical-align:middle}.__P__-poweredby-bar{flex:none;display:flex;align-items:center;justify-content:center;padding:6px 16px;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated)}.__P__-menu-wrap{position:relative;display:inline-flex}.__P__-menu{position:absolute;top:100%;inset-inline-end:0;margin-top:6px;min-width:200px;padding:6px;background:var(--__P__-bg);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);box-shadow:var(--__P__-shadow-panel);z-index:10;display:flex;flex-direction:column;gap:2px;animation:__P__-menu-in var(--__P__-dur-base) var(--__P__-ease)}@media(prefers-reduced-motion:reduce){.__P__-menu{animation:none}}@keyframes __P__-menu-in{0%{opacity:0;transform:translateY(-4px) scale(.98);transform-origin:top right}to{opacity:1;transform:none}}.__P__-menu-item{all:unset;display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);border-radius:var(--__P__-radius-sm);cursor:pointer;user-select:none}.__P__-menu-item:hover{background:var(--__P__-bg-elevated)}.__P__-menu-item:focus-visible{background:var(--__P__-bg-elevated);outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-menu-item[disabled]{opacity:.45;cursor:not-allowed}.__P__-menu-icon{display:inline-flex;width:16px;height:16px;color:var(--__P__-fg-muted)}.__P__-menu-icon svg{width:16px;height:16px}.__P__-menu-label{flex:1}.__P__-menu-check{display:inline-flex;color:var(--__P__-accent-fg)}.__P__-menu-check svg{width:14px;height:14px}.__P__-menu-item-segmented{cursor:default}.__P__-menu-item-segmented:hover{background:transparent}.__P__-segmented{display:inline-flex;gap:2px;padding:2px;background:var(--__P__-bg-elevated);border-radius:var(--__P__-radius-sm)}.__P__-segment{all:unset;min-width:26px;padding:3px 8px;font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.02em;text-align:center;color:var(--__P__-fg-muted);border-radius:calc(var(--__P__-radius-sm) - 2px);cursor:pointer;transition:color .12s ease,background .12s ease}.__P__-segment:hover{color:var(--__P__-fg)}.__P__-segment[data-on=true]{background:var(--__P__-bg);color:var(--__P__-accent-fg);box-shadow:var(--__P__-shadow-card)}.__P__-segment:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-resize-grip{position:absolute;width:18px;height:18px;display:flex;align-items:center;justify-content:center;color:var(--__P__-fg-muted);opacity:.45;transition:opacity var(--__P__-dur-base) var(--__P__-ease);z-index:2;touch-action:none;user-select:none}.__P__-resize-grip:hover,.__P__-resize-grip:focus-visible{opacity:1}.__P__-resize-grip svg{width:10px;height:10px}.__P__-resize-grip--bottom-left{bottom:2px;left:2px;cursor:nesw-resize;transform:scaleX(-1)}.__P__-resize-grip--bottom-right{bottom:2px;right:2px;cursor:nwse-resize}.__P__-resize-grip--top-left{top:2px;left:2px;cursor:nwse-resize;transform:rotate(180deg)}.__P__-resize-grip--top-right{top:2px;right:2px;cursor:nesw-resize;transform:scaleY(-1)}:host(:not([data-mode="open"])) .__P__-resize-grip{display:none}.__P__-messenger{display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-body,.__P__-messenger-pane{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-pane[hidden]{display:none}@keyframes __P__-view-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.__P__-module{display:flex;flex-direction:column;height:100%;min-height:0}@media(prefers-reduced-motion:no-preference){.__P__-module,.__P__-history{animation:__P__-view-in .18s var(--__P__-ease-out)}}.__P__-module-scroll{flex:1;min-height:0;overflow-y:auto;padding:var(--__P__-space-3);display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-home{container-type:inline-size;background:radial-gradient(125% 65% at 88% 0%,color-mix(in srgb,#fff 16%,transparent),transparent 55%),linear-gradient(180deg,var(--__P__-accent) 0%,var(--__P__-accent) 22%,color-mix(in srgb,var(--__P__-accent) 28%,var(--__P__-surface)) 44%,var(--__P__-surface) 70%);border-radius:var(--__P__-radius-lg) var(--__P__-radius-lg) 0 0}.__P__-home-scroll{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;background:transparent}.__P__-home-cards{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:4px 14px 16px}.__P__-module-pad{padding:var(--__P__-space-3) var(--__P__-space-3) 0}.__P__-module-empty{display:flex;flex-direction:column;align-items:center;gap:var(--__P__-space-3);padding:var(--__P__-space-8) var(--__P__-space-4);text-align:center;color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-module-retry{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border-strong);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);font-weight:600;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-module-retry:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}.__P__-module-retry:active{background:var(--__P__-border)}.__P__-module-retry:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-help-list{flex:1;min-height:0;overflow-y:auto;padding-bottom:var(--__P__-space-3)}.__P__-help-group{display:flex;flex-direction:column}.__P__-help-section-title{position:sticky;top:0;z-index:1;margin:0;padding:var(--__P__-space-3) var(--__P__-space-5) var(--__P__-space-2);font-size:var(--__P__-text-xs);font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--__P__-fg-muted);background:var(--__P__-bg)}.__P__-help-card{margin:0 var(--__P__-space-3) var(--__P__-space-3);background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden}.__P__-help-card .__P__-list-row{border-bottom:0;border-radius:0}.__P__-help-card .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-tabbar{display:flex;border-top:1px solid var(--__P__-border);background:var(--__P__-bg-elevated);flex-shrink:0}.__P__-tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--__P__-space-1);min-height:48px;padding:var(--__P__-space-2) var(--__P__-space-1);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600;transition:color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-tab:hover{color:var(--__P__-fg)}.__P__-tab[aria-selected=true]{color:var(--__P__-accent-fg)}.__P__-tab:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-tab:active{background:var(--__P__-hover)}.__P__-tab-icon{position:relative;display:inline-flex}.__P__-tab-icon svg{width:22px;height:22px}.__P__-tab-badge{position:absolute;top:-2px;left:calc(50% + 6px);width:8px;height:8px;border-radius:50%;background:var(--__P__-accent);box-shadow:0 0 0 2px var(--__P__-bg-elevated)}.__P__-home-hero{flex-shrink:0;padding:var(--__P__-space-5) var(--__P__-space-5) var(--__P__-space-3);color:var(--__P__-on-accent);--__P__-focus: var(--__P__-on-accent)}.__P__-home-hero-top{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);min-height:32px}.__P__-home-brand{font-size:clamp(calc(12px * var(--__P__-text-scale)),calc(3.2cqi * var(--__P__-text-scale)),calc(14px * var(--__P__-text-scale)));font-weight:600;letter-spacing:.01em;color:color-mix(in srgb,#fff 82%,transparent);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.__P__-home-brand-spacer{flex:1}.__P__-home-hero-actions{display:flex;align-items:center;gap:var(--__P__-space-2);flex-shrink:0}.__P__-home-hero-actions .__P__-icon-btn{color:#fff}.__P__-home-hero-actions .__P__-icon-btn:hover{background:color-mix(in srgb,#fff 18%,transparent);color:#fff}.__P__-home-hero-actions .__P__-icon-btn:active{background:color-mix(in srgb,#fff 26%,transparent)}.__P__-home-greeting{margin:28px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(19px * var(--__P__-text-scale)),calc(5.5cqi * var(--__P__-text-scale)),var(--__P__-text-2xl));font-weight:800;line-height:1.18;letter-spacing:-.01em;overflow-wrap:anywhere}.__P__-home-lead{margin:10px 0 0;font-family:var(--__P__-font-display);font-size:clamp(calc(15px * var(--__P__-text-scale)),calc(4.2cqi * var(--__P__-text-scale)),var(--__P__-text-xl));font-weight:600;line-height:1.25;letter-spacing:-.005em;color:color-mix(in srgb,var(--__P__-on-accent) 78%,transparent);overflow-wrap:anywhere}.__P__-home-avatars{display:flex}.__P__-home-avatar{width:30px;height:30px;border-radius:999px;overflow:hidden;margin-inline-start:-10px;border:2px solid color-mix(in srgb,#fff 92%,transparent);box-shadow:0 1px 3px #0000002e;background:var(--__P__-surface);display:inline-flex;align-items:center;justify-content:center;font-size:var(--__P__-text-xs);font-weight:700;color:var(--__P__-fg)}.__P__-home-avatar:first-child{margin-inline-start:0}.__P__-home-avatar img{width:100%;height:100%;object-fit:cover}.__P__-home-content{background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);box-shadow:var(--__P__-shadow-card);overflow:hidden}.__P__-home-content-title{padding:var(--__P__-space-4) var(--__P__-space-4) var(--__P__-space-3);font-size:var(--__P__-text-sm);font-weight:700}.__P__-home-content-list{display:flex;flex-direction:column;padding:0 var(--__P__-space-2) var(--__P__-space-2)}.__P__-home-content-list .__P__-list-row+.__P__-list-row{border-top:1px solid var(--__P__-border)}.__P__-home-card{display:block;width:100%;text-align:start;background:var(--__P__-surface);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);padding:var(--__P__-space-4);box-shadow:var(--__P__-shadow-card)}.__P__-home-card[data-interactive=true]{cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-home-card[data-interactive=true]:hover{background:var(--__P__-bg-elevated)}.__P__-home-card[data-interactive=true]:active{transform:translateY(1px)}.__P__-home-card[data-interactive=true]:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-recent-row{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-recent-avatar{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;flex-shrink:0;border-radius:999px;background:color-mix(in oklch,var(--__P__-accent) 14%,transparent);color:var(--__P__-accent-fg)}.__P__-home-recent-avatar svg{width:20px;height:20px}.__P__-home-recent-body{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}.__P__-home-recent-title{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-recent-preview{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-home-recent-dot{width:8px;height:8px;border-radius:999px;background:var(--__P__-accent);flex-shrink:0}.__P__-home-recent-row[data-unread=true] .__P__-home-recent-title{font-weight:700}.__P__-home-status{display:flex;align-items:center;gap:var(--__P__-space-3)}.__P__-home-status-icon svg{width:22px;height:22px;color:var(--__P__-success)}.__P__-home-status[data-level=degraded] .__P__-home-status-icon svg{color:var(--__P__-warning)}.__P__-home-status[data-level=down] .__P__-home-status-icon svg{color:var(--__P__-danger)}.__P__-home-status-text{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-search{display:flex;align-items:center;gap:var(--__P__-space-2);width:100%;padding:var(--__P__-space-3) var(--__P__-space-4);border-radius:var(--__P__-radius);border:1px solid var(--__P__-border);background:var(--__P__-surface);text-align:start}.__P__-home-search[data-input=true]{background:var(--__P__-bg-elevated)}.__P__-home-search:hover{border-color:var(--__P__-border-strong)}.__P__-home-search:focus-visible,.__P__-home-search:focus-within{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-search-text{flex:1;color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale))}.__P__-home-search-input{flex:1;border:0;background:transparent;font-size:calc(14px * var(--__P__-text-scale));color:var(--__P__-fg);outline:none}.__P__-home-search-icon svg{width:18px;height:18px;color:var(--__P__-accent-fg)}.__P__-list-row{display:flex;align-items:center;gap:var(--__P__-space-3);width:100%;min-height:44px;text-align:start;padding:var(--__P__-space-3) var(--__P__-space-2);border-radius:var(--__P__-radius-sm)}.__P__-list-row:hover{background:var(--__P__-hover)}.__P__-list-row:active{background:var(--__P__-border)}.__P__-list-row:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}.__P__-list-row-body{display:flex;flex-direction:column;min-width:0;flex:1}.__P__-list-row-title{font-weight:600;font-size:var(--__P__-text-md);line-height:1.35}.__P__-list-row-sub{color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);margin-top:var(--__P__-space-1);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-list-row-chevron svg{width:18px;height:18px;color:var(--__P__-accent-fg);flex-shrink:0}.__P__-back-header{display:flex;align-items:center;gap:var(--__P__-space-2);padding:10px 12px;border-bottom:1px solid var(--__P__-border);flex-shrink:0}.__P__-back-title{flex:1;text-align:center;font-size:var(--__P__-text-md);font-weight:700;margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-back-spacer{width:32px;height:1px}.__P__-history>*,.__P__-home-scroll>*,.__P__-module-scroll>*,.__P__-help-list>*,.__P__-history-footer>*,.__P__-module-pad{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-header,.__P__-back-header{padding-inline:max(12px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-tabbar{padding-inline:max(0px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-content{display:flex;flex-direction:column;gap:14px;width:100%;max-width:68ch;margin:0 auto}.__P__-content-hero{width:100%;border-radius:var(--__P__-radius)}.__P__-content-subtitle{color:var(--__P__-fg-muted);margin:0}.__P__-content-frame{flex:1;min-height:0;width:100%;border:0;background:#fff}.__P__-news-list{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-news-card{display:block;width:100%;text-align:start;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface)}.__P__-news-card{transition:background var(--__P__-dur-quick) var(--__P__-ease-out),transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-news-card:hover{background:var(--__P__-bg-elevated)}.__P__-news-card:active{transform:translateY(1px)}.__P__-news-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-news-hero{width:100%;display:block}.__P__-news-body{display:flex;flex-direction:column;gap:6px;padding:14px 16px}.__P__-news-title{font-weight:700;font-size:var(--__P__-text-md)}.__P__-news-summary{color:var(--__P__-fg-muted);font-size:calc(14px * var(--__P__-text-scale));display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.__P__-modules-empty{display:flex;align-items:center;justify-content:center;position:relative}.__P__-modules-empty-close{position:absolute;top:12px;inset-inline-end:12px}.__P__-modules-empty-text{color:var(--__P__-fg-muted);font-size:var(--__P__-text-base)}.__P__-form{display:flex;flex-direction:column;gap:var(--__P__-space-4)}.__P__-field{display:flex;flex-direction:column;gap:6px}.__P__-field-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--__P__-space-2)}.__P__-field-label{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-field-req{color:var(--__P__-danger)}.__P__-field-type{flex-shrink:0;align-self:center;margin-inline-start:auto;border:1px solid var(--__P__-border);border-radius:5px;background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);padding:1px 7px;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);white-space:nowrap}.__P__-field-input{width:100%;min-width:0;max-width:100%;box-sizing:border-box;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);color:var(--__P__-fg);font:inherit;font-size:var(--__P__-text-sm);resize:vertical;transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-field-input:focus-visible{outline:none;border-color:var(--__P__-accent)}.__P__-field[data-invalid=true] .__P__-field-input{border-color:var(--__P__-danger)}.__P__-field-input[type=date],.__P__-field-input[type=time]{appearance:none;-webkit-appearance:none}@media(pointer:coarse){.__P__-field-input{font-size:max(16px,calc(16px * var(--__P__-text-scale)))}}.__P__-field-hint{font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-field-error{font-size:var(--__P__-text-xs);color:var(--__P__-danger)}.__P__-field-choices{display:flex;flex-direction:column;gap:10px;padding-top:2px}.__P__-choice{display:flex;align-items:flex-start;gap:10px;font-size:var(--__P__-text-sm);color:var(--__P__-fg);cursor:pointer}.__P__-choice input{margin-top:2px;accent-color:var(--__P__-accent)}.__P__-form-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-form-hint{flex:1 1 auto;min-width:6rem;margin-inline-end:auto;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-form-submit{padding:var(--__P__-space-2) var(--__P__-space-4);border:none;border-radius:var(--__P__-radius-md);background:var(--__P__-accent);color:var(--__P__-accent-text, #fff);font:inherit;font-weight:600;font-size:var(--__P__-text-sm);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-submit:hover:not(:disabled){filter:brightness(1.06)}.__P__-form-submit:disabled{opacity:.6;cursor:default}.__P__-form-skip{padding:var(--__P__-space-2) var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:transparent;color:var(--__P__-fg-muted);font:inherit;font-size:var(--__P__-text-sm);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-skip:hover:not(:disabled){background:var(--__P__-bg-elevated)}@media(max-width:640px){.__P__-form-hint{flex-basis:100%;margin-inline-end:0;font-size:var(--__P__-text-xs)}.__P__-form-submit,.__P__-form-skip{flex:1 1 0;text-align:center}}.__P__-form-gate{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg-elevated)}.__P__-form-gate-title{margin:0;font-size:var(--__P__-text-base);font-weight:700;color:var(--__P__-fg)}.__P__-form-gate-desc{margin:0 0 var(--__P__-space-1);font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted)}.__P__-form-done{display:flex;align-items:center;justify-content:center;gap:6px;padding:6px 12px;border:1px dashed var(--__P__-border);border-radius:999px;align-self:center;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted)}.__P__-form-done svg{width:14px;height:14px;color:var(--__P__-success, #22c55e)}.__P__-form-done[data-outcome=skipped] svg{color:var(--__P__-fg-muted)}.__P__-form-done-fill{border:0;background:none;padding:0 2px;cursor:pointer;font:inherit;font-weight:600;color:var(--__P__-accent-fg)}.__P__-form-done-fill:hover{text-decoration:underline}details.__P__-form-done{display:block;padding:0;border-radius:var(--__P__-radius-md)}details[open].__P__-form-done{width:min(100%,420px);background:var(--__P__-surface)}.__P__-form-done-summary{display:flex;align-items:center;justify-content:center;gap:6px;padding:8px 12px;cursor:pointer;list-style:none}.__P__-form-done-summary::-webkit-details-marker{display:none}.__P__-form-done-summary>svg:last-child{color:var(--__P__-fg-muted);transition:transform .15s var(--__P__-ease)}details[open]>.__P__-form-done-summary>svg:last-child{transform:rotate(90deg)}.__P__-form-answers{margin:0;padding:var(--__P__-space-2) var(--__P__-space-3) var(--__P__-space-3);display:grid;gap:var(--__P__-space-3);text-align:start}.__P__-form-answer{display:grid;gap:6px}.__P__-form-answer dt{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-form-answer dd{margin:0;padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);font-size:var(--__P__-text-sm);font-weight:400;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui{margin-block:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);background:var(--__P__-bg-elevated);font-size:var(--__P__-text-sm)}.__P__-toolui:not(.__P__-toolui-collapsible){display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-group{display:flex;flex-direction:column;gap:var(--__P__-space-3);margin-block:var(--__P__-space-3)}.__P__-toolui-group>.__P__-toolui{margin-block:0}.__P__-toolui-stale{opacity:.7}details.__P__-toolui-collapsible>summary{display:flex;align-items:center;gap:var(--__P__-space-2);padding:var(--__P__-space-3) var(--__P__-space-4);cursor:pointer;list-style:none;-webkit-tap-highlight-color:transparent;user-select:none}details.__P__-toolui-collapsible>summary::-webkit-details-marker{display:none}details.__P__-toolui-collapsible[open]>summary{border-bottom:1px solid var(--__P__-border)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-4)}details.__P__-toolui-collapsible>.__P__-toolui-section~.__P__-toolui-section{margin-top:calc(-1 * var(--__P__-space-2))}.__P__-toolui-name-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-toolui-chevron{display:inline-flex;color:var(--__P__-fg-muted);transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}details.__P__-toolui-collapsible>summary .__P__-toolui-status{margin-inline-start:auto}.__P__-toolui-chevron svg{width:16px;height:16px}details.__P__-toolui-collapsible[open]>summary .__P__-toolui-chevron{transform:rotate(180deg)}.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{--__P__-pill: var(--__P__-fg-muted);display:inline-flex;min-width:0;align-items:center;gap:5px;padding:3px 7px;border-radius:5px;border:1px solid var(--__P__-border);background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);color:var(--__P__-pill);font-size:var(--__P__-text-xs);font-weight:600;white-space:nowrap}.__P__-toolui-badge svg,.__P__-toolui-name-pill svg,.__P__-toolui-q-pill svg{flex-shrink:0;width:14px;height:14px}.__P__-toolui-status-icon{display:inline-flex}.__P__-toolui-name-pill{--__P__-pill: oklch(.68 .13 233)}.__P__-toolui-q-pill{--__P__-pill: oklch(.66 .12 195)}.__P__-toolui-status[data-status=completed]{--__P__-pill: var(--__P__-success, #16a34a)}.__P__-toolui-status[data-status=responded]{--__P__-pill: oklch(.62 .15 255)}.__P__-toolui-status[data-status=awaiting]{--__P__-pill: var(--__P__-warning, #f59e0b)}.__P__-toolui-status[data-status=denied]{--__P__-pill: oklch(.66 .16 45)}.__P__-toolui-status[data-status=error]{--__P__-pill: var(--__P__-danger, #dc2626)}.__P__-toolui-status[data-status=superseded]{--__P__-pill: var(--__P__-fg-muted)}@supports (color: oklch(from red l c h)){.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{color:oklch(from var(--__P__-pill) clamp(var(--__P__-pill-l-min),l,var(--__P__-pill-l-max)) c h)}}.__P__-toolui-head{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2)}.__P__-toolui-head-end{display:inline-flex;align-items:center;gap:var(--__P__-space-2);margin-inline-start:auto}.__P__-toolui-collapse-body{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-summary{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form{gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form>.__P__-field,.__P__-toolui-summary>.__P__-field{padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg) 80%,transparent);line-height:1.5}.__P__-toolui-collapse-body>.__P__-form>.__P__-field{gap:var(--__P__-space-2)}.__P__-toolui-summary>.__P__-field{gap:var(--__P__-space-1)}.__P__-toolui-summary .__P__-field-label{color:var(--__P__-fg-muted)}.__P__-toolui-answer{margin:0;font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-toolui-footer{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);margin-inline:calc(-1 * var(--__P__-space-4));padding:var(--__P__-space-3) var(--__P__-space-4) 0;border-top:1px solid var(--__P__-border)}.__P__-toolui-options-toggle{display:inline-flex;align-items:center;gap:4px;border:0;background:transparent;padding:0;cursor:pointer;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);transition:color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-toolui-options-toggle:hover{color:var(--__P__-fg)}.__P__-toolui-options-chevron{display:inline-flex;transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-toolui-options-chevron svg{width:14px;height:14px}.__P__-toolui-options-chevron.__P__-open{transform:rotate(180deg)}.__P__-toolui-desc{margin:0;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-section{display:flex;flex-direction:column;gap:8px;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border)}.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-section,.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-desc{padding:0;background:none;border:0;border-radius:0}.__P__-toolui-label{font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--__P__-fg-muted)}.__P__-toolui-code{margin:0;max-height:240px;overflow:auto;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);font-size:var(--__P__-text-xs);line-height:1.5;white-space:pre-wrap;word-break:break-word}.__P__-toolui-code[data-error=true]{color:var(--__P__-danger, #dc2626)}.__P__-toolui-body{gap:6px}.__P__-toolui-prompt{margin:0;font-weight:600;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui-subtle{margin:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}:host([dir="rtl"]) .__P__-icon-dir{transform:scaleX(-1)}:host([dir="rtl"]) .__P__-field-input[type=date],:host([dir="rtl"]) .__P__-field-input[type=time]{position:relative;text-align:right;padding-left:34px}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-datetime-edit,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-datetime-edit{text-align:right}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-calendar-picker-indicator,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-calendar-picker-indicator{position:absolute;left:var(--__P__-space-3);margin:0}
|
|
4
4
|
`;var As=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
|
|
5
5
|
`;var Ms=`:host([data-mode="page"]){min-height:0}:host([data-mode="page"]) .__P__-page-shell{display:grid;grid-template-columns:280px 1fr;width:100%;height:100%;min-height:0;background:var(--__P__-bg);color:var(--__P__-fg);transition:grid-template-columns var(--__P__-dur-base) var(--__P__-ease-in-out)}:host([data-mode="page"]) .__P__-page-shell[data-sidebar-collapsed=true]{grid-template-columns:48px 1fr}:host([data-mode="page"]) .__P__-page-chat{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}:host([data-mode="page"]) .__P__-anchor{position:static;inset:auto;padding:0;align-items:stretch;width:100%;height:100%;min-width:0;min-height:0;flex:1 1 0}:host([data-mode="page"]) .__P__-panel{width:100%;height:100%;min-width:0;min-height:0;max-width:none;max-height:none;border-radius:0;border:0;box-shadow:none;animation:none}:host([data-mode="page"]) .__P__-sidebar{border-inline-end:1px solid var(--__P__-border);display:flex;flex-direction:column;overflow:hidden;background:var(--__P__-surface)}:host([data-mode="page"]) .__P__-sidebar-header{padding:var(--__P__-space-4) var(--__P__-space-5);border-bottom:1px solid var(--__P__-border);display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-2);min-height:56px;box-sizing:border-box}:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-header{padding:var(--__P__-space-4) var(--__P__-space-2);justify-content:center}:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-logo,:host([data-mode="page"]) .__P__-sidebar[data-collapsed=true] .__P__-sidebar-title{display:none}:host([data-mode="page"]) .__P__-sidebar-toggle{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:1px solid var(--__P__-border);border-radius:6px;background:transparent;color:var(--__P__-fg);cursor:pointer;transition:background .12s,border-color .12s}:host([data-mode="page"]) .__P__-sidebar-toggle:hover{background:var(--__P__-hover);border-color:var(--__P__-accent)}:host([data-mode="page"]) .__P__-sidebar-toggle:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}:host([data-mode="page"]) .__P__-sidebar-logo{height:32px;display:block}:host([data-mode="page"]) .__P__-sidebar-title{font-size:var(--__P__-text-md);font-weight:600}:host([data-mode="page"]) .__P__-sidebar-section{padding:var(--__P__-space-3) var(--__P__-space-4);border-bottom:1px solid var(--__P__-border)}:host([data-mode="page"]) .__P__-sidebar-nav{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}:host([data-mode="page"]) .__P__-sidebar-nav-item{display:flex;align-items:center;gap:10px;padding:var(--__P__-space-2) var(--__P__-space-3);border-radius:var(--__P__-radius-sm);color:var(--__P__-fg);text-decoration:none;font-size:calc(14px * var(--__P__-text-scale));transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}:host([data-mode="page"]) .__P__-sidebar-nav-item:hover{background:var(--__P__-hover)}:host([data-mode="page"]) .__P__-sidebar-nav-item:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:-2px}:host([data-mode="page"]) .__P__-sidebar-cards{display:grid;grid-template-columns:1fr;gap:var(--__P__-space-2)}:host([data-mode="page"]) .__P__-sidebar-card{display:block;padding:10px 12px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-sm);text-decoration:none;color:var(--__P__-fg);transition:border-color var(--__P__-dur-quick) var(--__P__-ease-out)}:host([data-mode="page"]) .__P__-sidebar-card:hover{border-color:var(--__P__-accent)}:host([data-mode="page"]) .__P__-sidebar-card:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}:host([data-mode="page"]) .__P__-sidebar-card-label{font-weight:600;font-size:calc(14px * var(--__P__-text-scale))}:host([data-mode="page"]) .__P__-sidebar-card-desc{font-size:var(--__P__-text-xs);color:var(--__P__-muted);margin-top:2px}:host([data-mode="page"]) .__P__-sidebar-conversations{flex:1 1 auto;overflow-y:auto;padding:var(--__P__-space-3) var(--__P__-space-4)}:host([data-mode="page"]) .__P__-page-chat{display:flex;flex-direction:column;overflow:hidden}@media(max-width:768px){:host([data-mode="page"]) .__P__-page-shell{grid-template-columns:1fr}:host([data-mode="page"]) .__P__-sidebar{display:none}}
|
|
6
6
|
`;var J_="helpai",Q_="#5B5BD6",Z_="#FFFFFF",ep="12px",tp="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",va=[Ts,Is,Es,As,Ms].join(`
|
|
7
|
-
`).replace(/__P__/g,J_).replaceAll("__BRAND_ACCENT_TEXT__",Z_).replaceAll("__BRAND_ACCENT__",Q_).replaceAll("__BRAND_RADIUS__",ep).replaceAll("__BRAND_FONT__",tp);var np=X.scope("mount"),Ls=new WeakMap,Os={floating:"all: initial; position: fixed; z-index: 2147483600;",flow:"all: initial; display: block; position: relative; width: 100%; height: 100%; z-index: 1; contain: size;",viewport:"all: initial; display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;"};function Ns(e,t){e.style.cssText=Os[t]}function Xt(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function vn(e={}){let t=e.position??"flow";np.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${w.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let o;e.existingHost?o=e.existingHost:(o=document.createElement(n),(e.target??document.body).appendChild(o)),o.setAttribute("data-brand",w.id),o.style.cssText=Os[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!op(r,a)){let l=a.createElement("style");l.textContent=va,r.appendChild(l)}let s=document.createElement("div");return s.className=`${w.cssPrefix}-app`,r.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function op(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Ls.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(va),Ls.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function rp(e,t){let n=w.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function ap(e,t){e.dataset.theme=t}function ip(e,t){let n=w.cssPrefix;t.width!==void 0&&e.style.setProperty(`--${n}-panel-w`,t.width),t.height!==void 0&&e.style.setProperty(`--${n}-panel-h`,t.height),t.expanded?.width!==void 0&&e.style.setProperty(`--${n}-expanded-w`,t.expanded.width),t.expanded?.height!==void 0&&e.style.setProperty(`--${n}-expanded-h`,t.expanded.height),t.inset!==void 0&&e.style.setProperty(`--${n}-panel-inset`,t.inset)}function sp(e,t){e.dataset.position=t}function Lo(e,t){e.dataset.mode=t}function Ds(e,t){ap(e,t.themeMode),rp(e,t.themeOverrides),sp(e,t.position),ip(e,t.size)}var lp=X.scope("iframe"),cp='<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:transparent;overflow:hidden}</style></head><body></body></html>';function Bs(e,t,n="closed",o="floating",r=null){lp.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!r});let a=document.createElement("iframe");a.title=`${w.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Fs(a,t,n,o),(o==="inline"&&r?r:document.body).appendChild(a);let l=a.contentDocument;if(!l)throw new Error("iframe contentDocument unavailable (cross-origin?)");l.open(),l.write(cp),l.close();let c=vn({...e,target:l.body}),u=new MutationObserver(()=>{Fs(a,t,c.hostElement.dataset.mode??"closed",o)});return u.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){u.disconnect(),c.destroy(),a.remove()}}}var Oo="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",$s={closed:{w:"88px",h:"88px"},expanded:{w:"min(calc(100vw - 32px), 680px)",h:"min(calc(100vh - 32px), 860px)"},open:{w:"min(calc(100vw - 32px), 440px)",h:"min(calc(100vh - 32px), 700px)"}};function Fs(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${Oo}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${Oo}position:static;display:block;width:100%;height:100%;`;return}if(typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches&&(n==="open"||n==="expanded")){e.style.cssText=`${Oo}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",s=t.endsWith("-left")?"left":"right",{w:l,h:c}=$s[n]??$s.open;e.style.cssText=`${Oo}position:fixed;${a}:16px;${s}:16px;width:${l};height:${c};`}var hn=class{constructor(){te(this,"handlers",new Map)}on(t,n){let o=this.handlers.get(t);return o||(o=new Set,this.handlers.set(t,o)),o.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let o=this.handlers.get(t);if(o)for(let r of o)try{r(n)}catch{}}clear(){this.handlers.clear()}};var bn,Oe,ha,Hs,Wn=0,js=[],Fe=J,Us=Fe.__b,zs=Fe.__r,qs=Fe.diffed,Ws=Fe.__c,Vs=Fe.unmount,Gs=Fe.__;function Do(e,t){Fe.__h&&Fe.__h(Oe,e,Wn||t),Wn=0;var n=Oe.__H||(Oe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function D(e){return Wn=1,Xs(Ys,e)}function Xs(e,t,n){var o=Do(bn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Ys(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],u=o.t(c,l);c!==u&&(o.__N=[u,o.__[1]],o.__c.setState({}))}],o.__c=Oe,!Oe.__f)){var r=function(l,c,u){if(!o.__c.__H)return!0;var _=!1,p=o.__c.props!==l;if(o.__c.__H.__.some(function(f){if(f.__N){_=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),a){var d=a.call(this,l,c,u);return _?d||p:d}return!_||p};Oe.__f=!0;var a=Oe.shouldComponentUpdate,s=Oe.componentWillUpdate;Oe.componentWillUpdate=function(l,c,u){if(this.__e){var _=a;a=void 0,r(l,c,u),a=_}s&&s.call(this,l,c,u)},Oe.shouldComponentUpdate=r}return o.__N||o.__}function E(e,t){var n=Do(bn++,3);!Fe.__s&&ya(n.__H,t)&&(n.__=e,n.u=t,Oe.__H.__h.push(n))}function pt(e,t){var n=Do(bn++,4);!Fe.__s&&ya(n.__H,t)&&(n.__=e,n.u=t,Oe.__h.push(n))}function M(e){return Wn=5,ee(function(){return{current:e}},[])}function ee(e,t){var n=Do(bn++,7);return ya(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function O(e,t){return Wn=8,ee(function(){return e},t)}function dp(){for(var e;e=js.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(No),t.__h.some(ba),t.__h=[]}catch(n){t.__h=[],Fe.__e(n,e.__v)}}}Fe.__b=function(e){Oe=null,Us&&Us(e)},Fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Gs&&Gs(e,t)},Fe.__r=function(e){zs&&zs(e),bn=0;var t=(Oe=e.__c).__H;t&&(ha===Oe?(t.__h=[],Oe.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(No),t.__h.some(ba),t.__h=[],bn=0)),ha=Oe},Fe.diffed=function(e){qs&&qs(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(js.push(t)!==1&&Hs===Fe.requestAnimationFrame||((Hs=Fe.requestAnimationFrame)||up)(dp)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),ha=Oe=null},Fe.__c=function(e,t){t.some(function(n){try{n.__h.some(No),n.__h=n.__h.filter(function(o){return!o.__||ba(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Fe.__e(o,n.__v)}}),Ws&&Ws(e,t)},Fe.unmount=function(e){Vs&&Vs(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{No(o)}catch(r){t=r}}),n.__H=void 0,t&&Fe.__e(t,n.__v))};var Ks=typeof requestAnimationFrame=="function";function up(e){var t,n=function(){clearTimeout(o),Ks&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Ks&&(t=requestAnimationFrame(n))}function No(e){var t=Oe,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Oe=t}function ba(e){var t=Oe;e.__c=e.__(),Oe=t}function ya(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Ys(e,t){return typeof t=="function"?t(e):t}var _p=Symbol.for("preact-signals");function Ho(){if(wt>1)wt--;else{var e,t=!1;for((function(){var r=Fo;for(Fo=void 0;r!==void 0;){var a=r.S;if(a.v===r.v)for(var s=a.t;s!==void 0;s=s.x)s.i===r.i&&(s.i=a.i);r=r.o}})();Gn!==void 0;){var n=Gn;for(Gn=void 0,$o++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Qs(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if($o=0,wt--,t)throw e}}function it(e){if(wt>0)return e();Pa=++pp,wt++;try{return e()}finally{Ho()}}var Vn,Re=void 0;function Kn(e){var t=Re,n=Vn;Re=void 0,Vn=void 0;try{return e()}finally{Re=t,Vn=n}}var Gn=void 0,wt=0,$o=0,pp=0,Pa=0,Fo=void 0,Bo=0;function Js(e){if(Re!==void 0){var t=e.n;if(t===void 0||t.t!==Re)return t={i:0,S:e,p:Re.s,n:void 0,t:Re,e:void 0,x:void 0,r:t},Re.s!==void 0&&(Re.s.n=t),Re.s=t,e.n=t,32&Re.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Re.s,t.n=void 0,Re.s.n=t,Re.s=t),t}}function We(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}We.prototype.brand=_p;We.prototype.h=function(){return!0};We.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:Kn(function(){var o;(o=t.W)==null||o.call(t)}))};We.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,o=e.x;n!==void 0&&(n.x=o,e.e=void 0),o!==void 0&&(o.e=n,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&Kn(function(){var r;(r=t.Z)==null||r.call(t)}))}};We.prototype.subscribe=function(e){var t=this;return Ct(function(){var n=t.value;Kn(function(){return e(n)})},{name:"sub"})};We.prototype.valueOf=function(){return this.value};We.prototype.toString=function(){return this.value+""};We.prototype.toJSON=function(){return this.value};We.prototype.peek=function(){var e=this;return Kn(function(){return e.value})};Object.defineProperty(We.prototype,"value",{get:function(){var e=Js(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if($o>100)throw new Error("Cycle detected");(function(n){wt!==0&&$o===0&&n.l!==Pa&&(n.l=Pa,Fo={S:n,v:n.v,i:n.i,o:Fo})})(this),this.v=e,this.i++,Bo++,wt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Ho()}}}});function Q(e,t){return new We(e,t)}function Qs(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Zs(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function el(e){for(var t=e.s,n=void 0;t!==void 0;){var o=t.p;t.i===-1?(t.S.U(t),o!==void 0&&(o.n=t.n),t.n!==void 0&&(t.n.p=o)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=o}e.s=n}function Yt(e,t){We.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Bo-1,this.f=4}Yt.prototype=new We;Yt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Bo))return!0;if(this.g=Bo,this.f|=1,this.i>0&&!Qs(this))return this.f&=-2,!0;var e=Re;try{Zs(this),Re=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return Re=e,el(this),this.f&=-2,!0};Yt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}We.prototype.S.call(this,e)};Yt.prototype.U=function(e){if(this.t!==void 0&&(We.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Yt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Yt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Js(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function fe(e,t){return new Yt(e,t)}function tl(e){var t=e.m;if(e.m=void 0,typeof t=="function"){wt++;var n=Re;Re=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,xa(e),o}finally{Re=n,Ho()}}}function xa(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,tl(e)}function fp(e){if(Re!==this)throw new Error("Out-of-order effect");el(this),Re=e,this.f&=-2,8&this.f&&xa(this),Ho()}function yn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Vn&&Vn.push(this)}yn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};yn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,tl(this),Zs(this),wt++;var e=Re;return Re=this,fp.bind(this,e)};yn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Gn,Gn=this)};yn.prototype.d=function(){this.f|=8,1&this.f||xa(this)};yn.prototype.dispose=function(){this.d()};function Ct(e,t){var n=new yn(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var nl,qo,Uo,mp=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var ol=[];Ct(function(){nl=this.N})();function Pn(e,t){J[e]=t.bind(null,J[e]||function(){})}function zo(e){if(Uo){var t=Uo;Uo=void 0,t()}Uo=e&&e.S()}function rl(e){var t=this,n=e.data,o=dt(n);o.value=n;var r=ee(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=fe(function(){var f=o.value.value;return f===0?0:f===!0?"":f||""}),_=fe(function(){return!Array.isArray(u.value)&&!_a(u.value)}),p=Ct(function(){if(this.N=al,_.value){var f=u.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=f)}}),d=t.__$u.d;return t.__$u.d=function(){p(),d.call(this)},[_,u]},[]),a=r[0],s=r[1];return a.value?s.peek():s.value}rl.displayName="ReactiveTextNode";Object.defineProperties(We.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:rl},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Pn("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var a=o[r];a instanceof We&&(n||(t.__np=n={}),n[r]=a,o[r]=a.peek())}}e(t)});Pn("__r",function(e,t){if(e(t),t.type!==ce){zo();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,a){var s;return Ct(function(){s=this},{name:a}),s.c=r,s})(function(){var r;mp&&((r=n.y)==null||r.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),qo=o,zo(n)}});Pn("__e",function(e,t,n,o){zo(),qo=void 0,e(t,n,o)});Pn("diffed",function(e,t){zo(),qo=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,a=n.U;if(a)for(var s in a){var l=a[s];l===void 0||o&&s in o||(l.d(),a[s]=void 0)}if(o){a||(a={},n.U=a);for(var c in o){var u=a[c],_=o[c];u===void 0?(u=gp(n,c,_,r),a[c]=u):u.o(_,r)}}}e(t)});function gp(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,a=Q(n);return{o:function(s,l){a.value=s,o=l},d:Ct(function(){this.N=al;var s=a.value.value;o[t]!==s&&(o[t]=s,r?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}Pn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var o=n.U;if(o){n.U=void 0;for(var r in o){var a=o[r];a&&a.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var u=t.__c;if(u){var _=u.__$u;_&&(u.__$u=void 0,_.d())}}e(t)});Pn("__h",function(e,t,n,o){o<3&&(t.__$f|=2),e(t,n,o)});et.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function dt(e,t){return ee(function(){return Q(e,t)},[])}function ut(e,t){var n=M(e);return n.current=e,qo.__$f|=4,ee(function(){return fe(function(){return n.current()},t)},[])}var vp=function(e){queueMicrotask(function(){queueMicrotask(e)})};function hp(){it(function(){for(var e;e=ol.shift();)nl.call(e)})}function al(){ol.push(this)===1&&(J.requestAnimationFrame||vp)(hp)}function il(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function sl(e){return il(e)}function ll(e){return!(!il(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function Wo(e,t,n){return e==="page"?"page":e==="standalone"?"standalone":e==="inline"?t==="fullscreen"?"fullscreen":"inline":e==="modal"||e==="drawer"?n?t==="fullscreen"?"fullscreen":e:"closed":n?t==="fullscreen"?"fullscreen":t==="expanded"?"expanded":"open":"closed"}var bp=900,yp=640;function Sa(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;return o==="expanded"||o==="fullscreen"||o==="normal"?o:n>0&&n<yp?"fullscreen":n>=(t.autoSizeBreakpoint??bp)?"expanded":"normal"}function jn(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Sa(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function xn(){return typeof window>"u"?0:window.innerWidth}var Pp="x-public-key",xp="x-ai-agent-deployment-id";function cl(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[xp]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??Pp]=e.publicKey),t}}}function Xn(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),r=()=>a();t?.addEventListener("abort",r,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var Ve=class extends Error{constructor(n,o,r,a){super(n);te(this,"code",o);te(this,"status",r);te(this,"cause",a);this.name="StreamError"}};var dl=X.scope("parser");async function*ul(e,t){if(!e.ok){let n=await e.text().catch(()=>"");throw new Ve(`server responded ${e.status}: ${n.slice(0,200)}`,"server",e.status)}for await(let n of Sp(e,t)){let o=kp(n);if(o==="done")return;o&&(yield o)}}async function*Sp(e,t){if(!e.body)throw new Ve("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),o="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:r,value:a}=await n.read();if(r){let l=o.trim();l&&(yield l);return}o+=a;let s;for(;(s=o.indexOf(`
|
|
7
|
+
`).replace(/__P__/g,J_).replaceAll("__BRAND_ACCENT_TEXT__",Z_).replaceAll("__BRAND_ACCENT__",Q_).replaceAll("__BRAND_RADIUS__",ep).replaceAll("__BRAND_FONT__",tp);var np=X.scope("mount"),Ls=new WeakMap,Os={floating:"all: initial; position: fixed; z-index: 2147483600;",flow:"all: initial; display: block; position: relative; width: 100%; height: 100%; z-index: 1; contain: size;",viewport:"all: initial; display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;"};function Ns(e,t){e.style.cssText=Os[t]}function Xt(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function vn(e={}){let t=e.position??"flow";np.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${w.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let o;e.existingHost?o=e.existingHost:(o=document.createElement(n),(e.target??document.body).appendChild(o)),o.setAttribute("data-brand",w.id),o.style.cssText=Os[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!op(r,a)){let l=a.createElement("style");l.textContent=va,r.appendChild(l)}let s=document.createElement("div");return s.className=`${w.cssPrefix}-app`,r.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function op(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Ls.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(va),Ls.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function rp(e,t){let n=w.cssPrefix;t.accent&&e.style.setProperty(`--${n}-accent-user`,t.accent),t.accentText&&e.style.setProperty(`--${n}-accent-text-user`,t.accentText),t.radius&&e.style.setProperty(`--${n}-radius`,t.radius),t.fontFamily&&e.style.setProperty(`--${n}-font`,t.fontFamily),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function ap(e,t){e.dataset.theme=t}function ip(e,t){let n=w.cssPrefix;t.width!==void 0&&e.style.setProperty(`--${n}-panel-w`,t.width),t.height!==void 0&&e.style.setProperty(`--${n}-panel-h`,t.height),t.expanded?.width!==void 0&&e.style.setProperty(`--${n}-expanded-w`,t.expanded.width),t.expanded?.height!==void 0&&e.style.setProperty(`--${n}-expanded-h`,t.expanded.height),t.inset!==void 0&&e.style.setProperty(`--${n}-panel-inset`,t.inset)}function sp(e,t){e.dataset.position=t}function Lo(e,t){e.dataset.mode=t}function Ds(e,t){ap(e,t.themeMode),rp(e,t.themeOverrides),sp(e,t.position),ip(e,t.size)}var lp=X.scope("iframe"),cp='<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:transparent;overflow:hidden}</style></head><body></body></html>';function Bs(e,t,n="closed",o="floating",r=null){lp.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!r});let a=document.createElement("iframe");a.title=`${w.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Fs(a,t,n,o),(o==="inline"&&r?r:document.body).appendChild(a);let l=a.contentDocument;if(!l)throw new Error("iframe contentDocument unavailable (cross-origin?)");l.open(),l.write(cp),l.close();let c=vn({...e,target:l.body}),u=new MutationObserver(()=>{Fs(a,t,c.hostElement.dataset.mode??"closed",o)});return u.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){u.disconnect(),c.destroy(),a.remove()}}}var Oo="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",$s={closed:{w:"88px",h:"88px"},expanded:{w:"min(calc(100vw - 32px), 680px)",h:"min(calc(100vh - 32px), 860px)"},open:{w:"min(calc(100vw - 32px), 440px)",h:"min(calc(100vh - 32px), 700px)"}};function Fs(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${Oo}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${Oo}position:static;display:block;width:100%;height:100%;`;return}if(typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches&&(n==="open"||n==="expanded")){e.style.cssText=`${Oo}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",s=t.endsWith("-left")?"left":"right",{w:l,h:c}=$s[n]??$s.open;e.style.cssText=`${Oo}position:fixed;${a}:16px;${s}:16px;width:${l};height:${c};`}var hn=class{constructor(){te(this,"handlers",new Map)}on(t,n){let o=this.handlers.get(t);return o||(o=new Set,this.handlers.set(t,o)),o.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let o=this.handlers.get(t);if(o)for(let r of o)try{r(n)}catch{}}clear(){this.handlers.clear()}};var bn,Oe,ha,Hs,Wn=0,js=[],Fe=J,Us=Fe.__b,zs=Fe.__r,qs=Fe.diffed,Ws=Fe.__c,Vs=Fe.unmount,Gs=Fe.__;function Do(e,t){Fe.__h&&Fe.__h(Oe,e,Wn||t),Wn=0;var n=Oe.__H||(Oe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function D(e){return Wn=1,Xs(Ys,e)}function Xs(e,t,n){var o=Do(bn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Ys(void 0,t),function(l){var c=o.__N?o.__N[0]:o.__[0],u=o.t(c,l);c!==u&&(o.__N=[u,o.__[1]],o.__c.setState({}))}],o.__c=Oe,!Oe.__f)){var r=function(l,c,u){if(!o.__c.__H)return!0;var _=!1,p=o.__c.props!==l;if(o.__c.__H.__.some(function(f){if(f.__N){_=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),a){var d=a.call(this,l,c,u);return _?d||p:d}return!_||p};Oe.__f=!0;var a=Oe.shouldComponentUpdate,s=Oe.componentWillUpdate;Oe.componentWillUpdate=function(l,c,u){if(this.__e){var _=a;a=void 0,r(l,c,u),a=_}s&&s.call(this,l,c,u)},Oe.shouldComponentUpdate=r}return o.__N||o.__}function E(e,t){var n=Do(bn++,3);!Fe.__s&&ya(n.__H,t)&&(n.__=e,n.u=t,Oe.__H.__h.push(n))}function dt(e,t){var n=Do(bn++,4);!Fe.__s&&ya(n.__H,t)&&(n.__=e,n.u=t,Oe.__h.push(n))}function M(e){return Wn=5,ee(function(){return{current:e}},[])}function ee(e,t){var n=Do(bn++,7);return ya(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function O(e,t){return Wn=8,ee(function(){return e},t)}function dp(){for(var e;e=js.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(No),t.__h.some(ba),t.__h=[]}catch(n){t.__h=[],Fe.__e(n,e.__v)}}}Fe.__b=function(e){Oe=null,Us&&Us(e)},Fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Gs&&Gs(e,t)},Fe.__r=function(e){zs&&zs(e),bn=0;var t=(Oe=e.__c).__H;t&&(ha===Oe?(t.__h=[],Oe.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(No),t.__h.some(ba),t.__h=[],bn=0)),ha=Oe},Fe.diffed=function(e){qs&&qs(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(js.push(t)!==1&&Hs===Fe.requestAnimationFrame||((Hs=Fe.requestAnimationFrame)||up)(dp)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),ha=Oe=null},Fe.__c=function(e,t){t.some(function(n){try{n.__h.some(No),n.__h=n.__h.filter(function(o){return!o.__||ba(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Fe.__e(o,n.__v)}}),Ws&&Ws(e,t)},Fe.unmount=function(e){Vs&&Vs(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{No(o)}catch(r){t=r}}),n.__H=void 0,t&&Fe.__e(t,n.__v))};var Ks=typeof requestAnimationFrame=="function";function up(e){var t,n=function(){clearTimeout(o),Ks&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Ks&&(t=requestAnimationFrame(n))}function No(e){var t=Oe,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Oe=t}function ba(e){var t=Oe;e.__c=e.__(),Oe=t}function ya(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Ys(e,t){return typeof t=="function"?t(e):t}var _p=Symbol.for("preact-signals");function Ho(){if(wt>1)wt--;else{var e,t=!1;for((function(){var r=Fo;for(Fo=void 0;r!==void 0;){var a=r.S;if(a.v===r.v)for(var s=a.t;s!==void 0;s=s.x)s.i===r.i&&(s.i=a.i);r=r.o}})();Gn!==void 0;){var n=Gn;for(Gn=void 0,$o++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Qs(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if($o=0,wt--,t)throw e}}function it(e){if(wt>0)return e();Pa=++pp,wt++;try{return e()}finally{Ho()}}var Vn,Re=void 0;function Kn(e){var t=Re,n=Vn;Re=void 0,Vn=void 0;try{return e()}finally{Re=t,Vn=n}}var Gn=void 0,wt=0,$o=0,pp=0,Pa=0,Fo=void 0,Bo=0;function Js(e){if(Re!==void 0){var t=e.n;if(t===void 0||t.t!==Re)return t={i:0,S:e,p:Re.s,n:void 0,t:Re,e:void 0,x:void 0,r:t},Re.s!==void 0&&(Re.s.n=t),Re.s=t,e.n=t,32&Re.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Re.s,t.n=void 0,Re.s.n=t,Re.s=t),t}}function We(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}We.prototype.brand=_p;We.prototype.h=function(){return!0};We.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:Kn(function(){var o;(o=t.W)==null||o.call(t)}))};We.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,o=e.x;n!==void 0&&(n.x=o,e.e=void 0),o!==void 0&&(o.e=n,e.x=void 0),e===this.t&&(this.t=o,o===void 0&&Kn(function(){var r;(r=t.Z)==null||r.call(t)}))}};We.prototype.subscribe=function(e){var t=this;return Ct(function(){var n=t.value;Kn(function(){return e(n)})},{name:"sub"})};We.prototype.valueOf=function(){return this.value};We.prototype.toString=function(){return this.value+""};We.prototype.toJSON=function(){return this.value};We.prototype.peek=function(){var e=this;return Kn(function(){return e.value})};Object.defineProperty(We.prototype,"value",{get:function(){var e=Js(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if($o>100)throw new Error("Cycle detected");(function(n){wt!==0&&$o===0&&n.l!==Pa&&(n.l=Pa,Fo={S:n,v:n.v,i:n.i,o:Fo})})(this),this.v=e,this.i++,Bo++,wt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Ho()}}}});function Q(e,t){return new We(e,t)}function Qs(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Zs(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function el(e){for(var t=e.s,n=void 0;t!==void 0;){var o=t.p;t.i===-1?(t.S.U(t),o!==void 0&&(o.n=t.n),t.n!==void 0&&(t.n.p=o)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=o}e.s=n}function Yt(e,t){We.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Bo-1,this.f=4}Yt.prototype=new We;Yt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Bo))return!0;if(this.g=Bo,this.f|=1,this.i>0&&!Qs(this))return this.f&=-2,!0;var e=Re;try{Zs(this),Re=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return Re=e,el(this),this.f&=-2,!0};Yt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}We.prototype.S.call(this,e)};Yt.prototype.U=function(e){if(this.t!==void 0&&(We.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Yt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Yt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Js(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function fe(e,t){return new Yt(e,t)}function tl(e){var t=e.m;if(e.m=void 0,typeof t=="function"){wt++;var n=Re;Re=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,xa(e),o}finally{Re=n,Ho()}}}function xa(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,tl(e)}function fp(e){if(Re!==this)throw new Error("Out-of-order effect");el(this),Re=e,this.f&=-2,8&this.f&&xa(this),Ho()}function yn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Vn&&Vn.push(this)}yn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};yn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,tl(this),Zs(this),wt++;var e=Re;return Re=this,fp.bind(this,e)};yn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Gn,Gn=this)};yn.prototype.d=function(){this.f|=8,1&this.f||xa(this)};yn.prototype.dispose=function(){this.d()};function Ct(e,t){var n=new yn(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var nl,qo,Uo,mp=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var ol=[];Ct(function(){nl=this.N})();function Pn(e,t){J[e]=t.bind(null,J[e]||function(){})}function zo(e){if(Uo){var t=Uo;Uo=void 0,t()}Uo=e&&e.S()}function rl(e){var t=this,n=e.data,o=ut(n);o.value=n;var r=ee(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=fe(function(){var f=o.value.value;return f===0?0:f===!0?"":f||""}),_=fe(function(){return!Array.isArray(u.value)&&!_a(u.value)}),p=Ct(function(){if(this.N=al,_.value){var f=u.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=f)}}),d=t.__$u.d;return t.__$u.d=function(){p(),d.call(this)},[_,u]},[]),a=r[0],s=r[1];return a.value?s.peek():s.value}rl.displayName="ReactiveTextNode";Object.defineProperties(We.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:rl},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Pn("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var a=o[r];a instanceof We&&(n||(t.__np=n={}),n[r]=a,o[r]=a.peek())}}e(t)});Pn("__r",function(e,t){if(e(t),t.type!==ce){zo();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,a){var s;return Ct(function(){s=this},{name:a}),s.c=r,s})(function(){var r;mp&&((r=n.y)==null||r.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),qo=o,zo(n)}});Pn("__e",function(e,t,n,o){zo(),qo=void 0,e(t,n,o)});Pn("diffed",function(e,t){zo(),qo=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,a=n.U;if(a)for(var s in a){var l=a[s];l===void 0||o&&s in o||(l.d(),a[s]=void 0)}if(o){a||(a={},n.U=a);for(var c in o){var u=a[c],_=o[c];u===void 0?(u=gp(n,c,_,r),a[c]=u):u.o(_,r)}}}e(t)});function gp(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,a=Q(n);return{o:function(s,l){a.value=s,o=l},d:Ct(function(){this.N=al;var s=a.value.value;o[t]!==s&&(o[t]=s,r?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}Pn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var o=n.U;if(o){n.U=void 0;for(var r in o){var a=o[r];a&&a.d()}}}var s=t.__np;if(s){var l=t.props;for(var c in s)l[c]=s[c]}t.__np=void 0}else{var u=t.__c;if(u){var _=u.__$u;_&&(u.__$u=void 0,_.d())}}e(t)});Pn("__h",function(e,t,n,o){o<3&&(t.__$f|=2),e(t,n,o)});et.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(o||a||4&this.__$f)||1&this.__$f)return!0}else if(!(o||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var l in this.props)if(!(l in e))return!0;return!1};function ut(e,t){return ee(function(){return Q(e,t)},[])}function _t(e,t){var n=M(e);return n.current=e,qo.__$f|=4,ee(function(){return fe(function(){return n.current()},t)},[])}var vp=function(e){queueMicrotask(function(){queueMicrotask(e)})};function hp(){it(function(){for(var e;e=ol.shift();)nl.call(e)})}function al(){ol.push(this)===1&&(J.requestAnimationFrame||vp)(hp)}function il(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function sl(e){return il(e)}function ll(e){return!(!il(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function Wo(e,t,n){return e==="page"?"page":e==="standalone"?"standalone":e==="inline"?t==="fullscreen"?"fullscreen":"inline":e==="modal"||e==="drawer"?n?t==="fullscreen"?"fullscreen":e:"closed":n?t==="fullscreen"?"fullscreen":t==="expanded"?"expanded":"open":"closed"}var bp=900,yp=640;function Sa(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;return o==="expanded"||o==="fullscreen"||o==="normal"?o:n>0&&n<yp?"fullscreen":n>=(t.autoSizeBreakpoint??bp)?"expanded":"normal"}function jn(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),l=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Sa(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function xn(){return typeof window>"u"?0:window.innerWidth}var Pp="x-public-key",xp="x-ai-agent-deployment-id";function cl(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[xp]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??Pp]=e.publicKey),t}}}function Xn(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),r=()=>a();t?.addEventListener("abort",r,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var Ve=class extends Error{constructor(n,o,r,a){super(n);te(this,"code",o);te(this,"status",r);te(this,"cause",a);this.name="StreamError"}};var dl=X.scope("parser");async function*ul(e,t){if(!e.ok){let n=await e.text().catch(()=>"");throw new Ve(`server responded ${e.status}: ${n.slice(0,200)}`,"server",e.status)}for await(let n of Sp(e,t)){let o=kp(n);if(o==="done")return;o&&(yield o)}}async function*Sp(e,t){if(!e.body)throw new Ve("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),o="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:r,value:a}=await n.read();if(r){let l=o.trim();l&&(yield l);return}o+=a;let s;for(;(s=o.indexOf(`
|
|
8
8
|
|
|
9
9
|
`))!==-1;){let l=o.slice(0,s);o=o.slice(s+2),yield l}}}finally{n.releaseLock()}}function kp(e){let t="",n;for(let o of e.split(`
|
|
10
10
|
`))if(!(o===""||o.startsWith(":"))){if(o.startsWith("data:")){let r=o.slice(5).replace(/^ /,"");t=t?`${t}
|
|
11
|
-
${r}`:r;continue}o.startsWith("id:")&&(n=o.slice(3).trim())}if(t==="[DONE]")return"done";if(!t)return null;try{let o=JSON.parse(t);return dl.trace("chunk",{type:o.type,eventId:n}),{chunk:o,eventId:n}}catch(o){throw dl.trace("frame parse failed",{err:o,payload:t.slice(0,200)}),new Ve("invalid SSE frame","network",void 0,o)}}function wp(e){let t=new TextEncoder().encode(e),n="";for(let o of t)n+=String.fromCharCode(o);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var _l=e=>e&&Object.keys(e).length>0?e:void 0;function pl(e,t){let n=_l(e),o=_l(t);if(!n&&!o)return;let r={};return n&&(r.user=n),o&&(r.page=o),wp(JSON.stringify(r))}function Vo(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Cp(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function fl(e){return e.startsWith("tool-")?e.slice(5):e}var tt={handshake:"/pai/handshake",streamMessage:"/pai/stream-message",streamResume:"/pai/stream-resume",cancelStream:"/pai/cancel-stream",listConversations:"/pai/list-conversations",listMessages:"/pai/list-messages",updateSettings:"/pai/update-settings",markRead:"/pai/mark-read",messageFeedback:"/pai/message-feedback",requestOperator:"/pai/request-operator",cancelOperatorRequest:"/pai/cancel-request-operator",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},ml="context";function Ot(e){let t=e??{},n=t.controlMode;return{controlMode:n==="awaiting_operator"||n==="operator"?n:"ai-agent",controlRevision:typeof t.controlRevision=="number"&&Number.isSafeInteger(t.controlRevision)&&t.controlRevision>=0?t.controlRevision:void 0,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function Go(e){let t=e?.suggestions;if(!Array.isArray(t))return[];let n=[];for(let o of t){if(!o||typeof o!="object")continue;let{id:r,label:a,text:s}=o;typeof a!="string"||!a||n.push({id:typeof r=="string"&&r?r:`s${n.length}`,label:a,text:typeof s=="string"&&s?s:a})}return n}function ka(e){let n={messages:e.messages.map(o=>({id:o.serverMessageId??o.id,parts:Tp(o),role:o.role,createdAt:o.createdAt!==void 0?new Date(o.createdAt).toISOString():void 0})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),n}function Rp(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function Tp(e){let t=[];for(let n of e.parts)if(n.kind==="step-start"&&t.push({type:"step-start"}),n.kind==="reasoning"&&n.text&&t.push({type:"reasoning",text:n.text,state:n.done?"done":"streaming"}),n.kind==="text"&&n.text&&t.push({text:n.text,type:"text"}),n.kind==="file"&&n.url&&t.push({mediaType:n.mediaType,type:"file",url:n.url}),n.kind==="tool"&&Rp(n)){let o=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:Cp(n.toolName),toolCallId:n.toolCallId,state:n.state};n.input!==void 0&&(o.input=n.input),n.output!==void 0&&(o.output=n.output),n.error!==void 0&&(o.errorText=n.error),n.approval&&n.approval.approved!==void 0&&(o.approval=n.approval),t.push(o)}for(let n of e.attachments??[])n.url&&t.push({type:"file",url:n.url,mediaType:n.mediaType,filename:n.name,fileId:n.id,fileSize:n.size});return t}var oe=X.scope("transport"),Ip=6e4,Ep=1e4,Ca=50,gl=3,Ap=400,Mp=3e4,Lp=1e4,Op=6e4,Np=15e3,Dp=1024*1024,vl=new Set([408,425,429,500,502,503,504]);function hl(e){return Ap*2**e+Math.floor(Math.random()*250)}function $p(e){return Op+Math.ceil(e/Dp)*Np}function Fp(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),o=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(o)&&o>=0?Math.min(o,3e4):null}var Ko=class{constructor(t){te(this,"ttlMs",t);te(this,"map",new Map)}getOrFetch(t,n){let o=this.map.get(t);if(o&&Date.now()-o.at<this.ttlMs)return o.result;let r={at:Date.now(),result:n().then(a=>(r.value=a,a)).catch(a=>{throw this.map.delete(t),a})};return this.map.set(t,r),r.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&Date.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values())n.value!==void 0&&(n.value=t(n.value)),n.result=n.result.then(o=>{let r=t(o);return n.value=r,r})}clear(){this.map.clear()}},jo=class{constructor(t){te(this,"opts",t);te(this,"visitorId");te(this,"conversationId");te(this,"userContext");te(this,"pageContext");te(this,"locale");te(this,"conversationsCache",new Ko(Ep));te(this,"contentCache",new Ko(Ip))}setContext(t,n){this.userContext=t,this.pageContext=n}setLocale(t){this.locale=t}primeIdentity(t,n){t&&(this.visitorId=t),n&&(this.conversationId=n)}envelope(){let t={_ev:gn};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=pl(this.userContext,this.pageContext);return n&&(t[ml]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,o]of Object.entries(this.envelope()))t.append(n,o);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[o,r]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,r);return n.toString()}async handshake(t){oe.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(tt.handshake,t,"handshake");return oe.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),Up(n)||oe.warn("handshake response did not match expected shape; using raw response",{response:n}),this.visitorId=n.visitorId??t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t,n){oe.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let o=new FormData;o.append("file",t,t.name);let r=await this.postForm(this.uploadPath,o,"upload",n,$p(t.size));return oe.debug("uploadFile \u2190",{id:r.id,url:r.url}),r}async transcribe(t,n="audio/webm"){oe.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${Bp(n)}`),o.append("mimeType",n);let r=await this.postForm(this.transcribePath,o,"transcribe");return oe.debug("transcribe \u2190",{textLen:r.text.length}),r}localeCacheKey(t){return`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`}peekConversations(t={}){return this.conversationsCache.peek(this.localeCacheKey(t))}listConversations(t={}){return this.conversationsCache.getOrFetch(this.localeCacheKey(t),()=>this.fetchConversations(t))}async fetchConversations(t){let n=new URL(this.url(tt.listConversations));t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.page&&n.searchParams.set("page",String(t.page)),t.limit&&n.searchParams.set("limit",String(t.limit)),t.ids?.length&&n.searchParams.set("ids",t.ids.join(",")),oe.debug("listConversations \u2192",{visitorId:t.visitorId??this.visitorId,page:t.page,limit:t.limit,ids:t.ids});let o=await this.getJson(n.toString(),"listConversations");return oe.debug("listConversations \u2190",{count:o.conversations.length,page:o.pagination.page,hasNext:o.pagination.hasNext}),o}async loadConversation(t,{ids:n=[],beforeId:o}={}){let r=new URL(this.url(tt.listMessages));r.searchParams.set("conversationId",t),r.searchParams.set("limit",String(Ca)),r.searchParams.set("sortBy","_id"),r.searchParams.set("sortOrder","desc"),n.length>0&&r.searchParams.set("ids",n.join(",")),o&&r.searchParams.set("beforeId",o),oe.debug("loadConversation \u2192",{conversationId:t,visitorId:this.visitorId,ids:n.length>0?n:void 0,beforeId:o});let a=await this.getJson(r.toString(),"loadConversation"),s=(a.messages??[]).toReversed();return oe.debug("loadConversation \u2190",{conversationId:a.conversationId,canContinue:a.canContinue,messageCount:s.length,hasSuggestions:!!a.suggestions}),{...a,messages:s,canContinue:a.canContinue??!0}}async markRead(t){if(!(!this.visitorId||!t)){this.conversationsCache.update(n=>({...n,conversations:n.conversations.map(o=>o.conversationId===t&&o.hasUnread?{...o,hasUnread:!1}:o)})),oe.debug("markRead \u2192",{conversationId:t,visitorId:this.visitorId});try{await this.postJson(tt.markRead,{conversationId:t},"markRead")}catch(n){oe.debug("markRead failed (non-fatal)",{err:n})}}}async requestOperator(){if(!(!this.visitorId||!this.conversationId)){oe.debug("requestOperator \u2192",{conversationId:this.conversationId,visitorId:this.visitorId});try{return(await this.postJson(tt.requestOperator,{},"requestOperator")).controlState}catch(t){oe.debug("requestOperator failed (non-fatal)",{err:t});return}}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId)){oe.debug("cancelOperatorRequest \u2192",{conversationId:this.conversationId,visitorId:this.visitorId});try{return(await this.postJson(tt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){oe.debug("cancelOperatorRequest failed (non-fatal)",{err:t});return}}}listContent(t={}){return this.contentCache.getOrFetch(this.localeCacheKey(t),()=>this.fetchContent(t))}async fetchContent(t){let n=new URL(this.dataUrl(tt.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));oe.debug("listContent \u2192",t);let o=await this.getJson(n.toString(),"listContent"),r=(o.items??[]).map(a=>Ui(a,this.locale));return oe.debug("listContent \u2190",{count:r.length,total:o.pagination?.total}),{...o,items:r}}async bootstrap(t){let n=new URL(this.dataUrl(tt.bootstrap));t&&n.searchParams.set("conversationId",t),oe.debug("bootstrap \u2192",{conversationId:t??this.conversationId});let o=await this.getJson(n.toString(),"bootstrap"),r=o.forms??[],a=o.formSubmissions??[];return oe.debug("bootstrap \u2190",{forms:r.length,formSubmissions:a.length}),{forms:r,formSubmissions:a}}async saveUserPrefs(t){oe.debug("saveUserPrefs \u2192",{visitorId:this.visitorId,conversationId:this.conversationId,settingsKeys:Object.keys(t)});let n=await this.postJson(tt.updateSettings,{userPrefs:t},"saveUserPrefs");return oe.debug("saveUserPrefs \u2190",{success:n.success}),n}get uploadPath(){return this.opts.endpoints?.upload??"/pai/upload-file"}get transcribePath(){return this.opts.endpoints?.transcribe??"/pai/transcribe-audio"}get submitFormPath(){return this.opts.endpoints?.submitForm??tt.submitForm}async submitForm(t){oe.debug("submitForm \u2192",{formId:t.formId,trigger:t.trigger,fields:Object.keys(t.values).length});try{await this.postJson(this.dataUrl(this.submitFormPath),t,"submitForm")}catch(n){oe.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){oe.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(tt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){oe.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t){this.conversationsCache.clear(),oe.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});try{return await this.runWithAbort(async n=>{let o=await this.fetchImpl(this.url(tt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});if(o.status!==202)throw new Ve(`sendTurn failed: expected 202, received ${o.status}`,"server",o.status);let r;try{r=await o.json()}catch(a){throw n?.aborted?a:new Ve("sendTurn failed: invalid acknowledgement","server",o.status,a)}if(!Hp(r))throw new Ve("sendTurn failed: invalid acknowledgement","server",o.status);return r},void 0,Mp)}catch(n){throw n instanceof Ve?n:new Ve("sendTurn failed: network error","network",void 0,n)}}cancelTurn(t,n){!this.visitorId||!t||!n||(oe.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(tt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(o=>oe.debug("cancel POST failed (non-fatal)",{err:o})))}async connectResumeStream(t){let n=new AbortController,o=()=>n.abort(t.signal.reason);t.signal.aborted?o():t.signal.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>n.abort(),Lp),a=()=>{clearTimeout(r),t.signal.removeEventListener("abort",o)},s;try{s=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:n.signal})}catch(l){return a(),t.signal.aborted||oe.debug("resume-stream fetch failed \u2014 reconnecting",{err:l}),"held"}if(clearTimeout(r),!s.ok)return a(),s.status===409||vl.has(s.status)?(oe.debug("resume-stream \u2192 transient response; reconnecting",{status:s.status}),"held"):(oe.debug("resume-stream \u2192 endpoint unavailable",{status:s.status}),"unavailable");if(!s.body)return a(),oe.debug("resume-stream \u2192 bodyless response; stopping",{status:s.status}),"unavailable";if(!(s.headers.get("content-type")??"").includes("text/event-stream"))return a(),oe.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";try{t.onConnected();for await(let{chunk:l}of ul(s,n.signal)){if(t.signal.aborted)return"held";t.onChunk(l)}}catch(l){if(t.signal.aborted)return"held";oe.debug("resume-stream segment dropped \u2014 reconnecting",{err:l})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(tt.streamResume)}async postJson(t,n,o){let r=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(n))}],o);return this.assertOk(r,o)}async postForm(t,n,o,r,a){return this.runWithAbort(async s=>{let l=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n),signal:s});return this.assertOk(l,o)},r,a)}async runWithAbort(t,n,o){if(!n&&o===void 0)return t();let r=new AbortController,a=()=>r.abort(n?.reason);n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let s=o===void 0?void 0:setTimeout(()=>r.abort(),o);try{return await t(r.signal)}finally{s!==void 0&&clearTimeout(s),n?.removeEventListener("abort",a)}}async getJson(t,n){let o=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.opts.auth.headers()}}],n);return this.assertOk(o,n)}async fetchWithRetry(t,n){for(let o=0;;o++){let[r,a]=t(),s;try{s=await this.fetchImpl(r,a)}catch(c){if(o>=gl)throw new Ve(`${n} failed: network error`,"network",void 0,c);oe.debug("request network error \u2014 retrying",{label:n,attempt:o}),await Xn(hl(o));continue}if(s.ok||!vl.has(s.status)||o>=gl)return s;let l=Fp(s.headers)??hl(o);oe.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await Xn(l)}}async assertOk(t,n){if(!t.ok)throw new Ve(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}url(t){return/^https?:\/\//i.test(t)?t:`${this.opts.agentApiBaseUrl}${t}`}dataUrl(t){return/^https?:\/\//i.test(t)?t:`${this.opts.dataApiBaseUrl}${t}`}get fetchImpl(){return this.opts.fetchImpl??globalThis.fetch.bind(globalThis)}};function Bp(e){return e.includes("webm")?"webm":e.includes("ogg")?"ogg":e.includes("mp4")||e.includes("m4a")?"m4a":e.includes("mpeg")?"mp3":e.includes("wav")?"wav":"bin"}function Hp(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),o=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(o===void 0||typeof o=="string"&&o.length>0)}function Up(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.conversationId=="string"}function Ta(e,t){let n=e?[{kind:"text",id:"t0",textSig:Q(e),doneSig:Q(!0)}]:[];return{id:at(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:Q(n)}}function Rt(){return{id:at(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:Q([])}}function yl(e){let t=at();return zp({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function zp(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,feedback:e.feedback,partsSig:Q(e.parts.map(Xp))}}var Pl=new Set(["completed","failed","canceled"]);function qp(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status!=null&&!Pl.has(e.status)?"streaming":"complete"}function Ia(e){let t=new Set,n=e.parts.map((r,a)=>r.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:Q(r.text),doneSig:Q(!0)}:r.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:Q(r.text),doneSig:Q(r.state!=="streaming")}:r.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:r.type==="file"?{kind:"file",url:r.url,mediaType:r.mediaType}:r.type==="source-url"?{kind:"source",sourceId:r.sourceId,url:r.url,title:r.title}:r.type==="source-document"?{kind:"source",sourceId:r.sourceId,title:r.title,filename:r.filename,mediaType:r.mediaType}:r.type==="data-suggestions"?null:r.type==="dynamic-tool"||r.type.startsWith("tool-")?{kind:"tool",toolCallId:r.toolCallId,toolName:r.type==="dynamic-tool"?r.toolName:fl(r.type),dynamic:r.type==="dynamic-tool"?!0:void 0,inputPartialSig:Q(""),inputSig:Q(r.input),outputSig:Q(r.output),errorSig:Q(r.errorText),stateSig:Q(r.state),approvalSig:Q(r.approval)}:null).filter(r=>r!==null).filter(r=>r.kind!=="source"?!0:t.has(r.sourceId)?!1:(t.add(r.sourceId),!0)),o=e.parts.find(r=>r.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:o?.type==="data-suggestions"?Go(o.data):void 0,serverMessageId:e.id,createdAt:Vo(e.createdAt)??Date.now(),status:qp(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:Q(n)}}function Wp(e){return!e.parts.some(t=>t.type==="text"&&t.text.trim()!==""||t.type==="dynamic-tool"||t.type.startsWith("tool-")||t.type==="file"||t.type==="source-url"||t.type==="source-document")}function Vp(e){return e.role==="assistant"&&e.status!=null&&!Pl.has(e.status)&&Wp(e)}function Nt(e){let t=e.length-1;return e.filter((n,o)=>o===t||!Vp(n)).map(Ia)}function xl(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,o=e.at(n);return!o||o.ephemeral?[]:[o]}function Ea(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,parts:e.partsSig.value.map(Yp)}}function Ue(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Dt(e){return Ue(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function Gp(e){return Ue(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function Aa(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}var Sn=e=>e.kind==="tool",Sl=e=>e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file";function Yn(e){let t=e.partsSig.value,n=t.findLastIndex(o=>o.kind==="tool");return t.slice(n+1).some(Sl)}function Zt(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(Sn);return t.length>0&&t.every(n=>Aa(n.stateSig.value))}function en(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!Yn(e)}function Xo(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||Sl(n))}function Yo(e){return e.partsSig.value.some(t=>Sn(t)&&!Aa(t.stateSig.value))}function kl(e,t){if(t.length===0)return e;let n=new Set;for(let s of e)n.add(s.id),s.serverMessageId&&n.add(s.serverMessageId);let o=t.filter(s=>{let l=[s.id,s.serverMessageId].filter(c=>c!==void 0);return l.some(c=>n.has(c))?!1:(l.forEach(c=>n.add(c)),!0)});if(o.length===0)return e;let r=e.findIndex(s=>!s.ephemeral),a=r<0?e.length:r;return[...e.slice(0,a),...o,...e.slice(a)]}function Jt(e,t){return t.id=e.id,e.canceled&&(t.canceled=!0),e.feedback!==void 0&&(t.feedback=e.feedback),t.suggestions??(t.suggestions=e.suggestions),t}function wl(e,t,n,o){if(!Ma(e))return;if(t.length===0){let s=Math.max(...o.values());return n.find(l=>l.role==="assistant"&&o.get(l.serverMessageId??l.id)===s&&Ue(l).length>=Ue(e).length)}let r=t.at(-1);if(r?.role!=="user")return;let a=o.get(r.serverMessageId??r.id);if(a!==void 0)return n.find(s=>s.role==="assistant"&&o.get(s.serverMessageId??s.id)===a+1&&Ue(s).length>=Ue(e).length)}function Ma(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function Kp(e,t){let n=new Map(t.partsSig.value.filter(Sn).filter(a=>Aa(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let o=!1,r=e.partsSig.value.map(a=>{if(!Sn(a))return a;let s=n.get(a.toolCallId);if(!s)return a;let l=a.approvalSig.value,c=s.approvalSig.value,u=l===void 0||l.approved===void 0&&c?.approved!==void 0?s.approvalSig:a.approvalSig,_=a.inputSig.value===void 0?s.inputSig:a.inputSig,p=a.toolName==="tool"?s.toolName:a.toolName,d=a.dynamic??s.dynamic;return u===a.approvalSig&&_===a.inputSig&&p===a.toolName&&d===a.dynamic?a:(o=!0,{...a,toolName:p,dynamic:d,inputSig:_,approvalSig:u})});o&&(e.partsSig.value=r)}function Cl(e,t){let n=t.filter(p=>!p.ephemeral&&(p.status==="streaming"||p.status==="pending"||p.status==="error"||p.retryAction!==void 0||(p.attachments?.length??0)>0||Dt(p))),o=new Map;for(let p of n)o.set(p.id,p),p.serverMessageId!==void 0&&o.set(p.serverMessageId,p);let r=new Set,a=[],s=e.map(p=>{let d=(p.serverMessageId!==void 0?o.get(p.serverMessageId):void 0)??o.get(p.id);return d===void 0?(a.push(p),p):(r.add(d),d.role!==p.role?p:d.role==="user"&&d.serverMessageId===void 0&&(d.status==="pending"||d.status==="error")?Jt(d,p):d.status==="streaming"||Ue(d).length>=Ue(p).length?(Kp(d,p),d.suggestions??(d.suggestions=p.suggestions),d.feedback===void 0&&(d.feedback=p.feedback),p.canceled&&(d.canceled=!0),d):Jt(d,p))}),l=n.filter(p=>!r.has(p)),c=l.findLast(Ma),u=new Map;e.forEach((p,d)=>{u.set(p.id,d),p.serverMessageId!==void 0&&u.set(p.serverMessageId,d)});let _=wl(c,c?n.slice(0,n.indexOf(c)):[],a,u);if(c&&_){let p=s.indexOf(_);p>=0&&(s[p]=Jt(c,_)),l=l.filter(d=>d!==c)}return[...s,...l]}function Jn(e,t){let n=new Map(t.filter(p=>p.serverMessageId!==void 0).map(p=>[p.serverMessageId,p])),o=new Map;t.forEach((p,d)=>{o.set(p.id,d),p.serverMessageId!==void 0&&o.set(p.serverMessageId,d)});let r=new Set(e.flatMap(p=>[p.serverMessageId,p.id].filter(d=>d!==void 0))),a=!1,s=e.map(p=>{let d=n.get(p.serverMessageId??p.id);if(d===void 0||d.role!==p.role)return p;if(p.role==="user"&&p.serverMessageId===void 0)return a=!0,Jt(p,d);if(p.serverMessageId===void 0)return p;let f=Ue(d),m=Ue(p),g=d.status!=="streaming"&&f.length>=m.length&&Ra(p,d);if(f.length>m.length||f===m&&d.partsSig.value.length>p.partsSig.value.length||g)return a=!0,Jt(p,d);if(p.status==="streaming"&&d.status!=="streaming"&&jp(p,d)){if(p.continuationStreaming&&Yo(d))return p;if(!Ra(d,p))return a=!0,Jt(p,d)}return p}),l=[...n.values()].filter(p=>!r.has(p.serverMessageId)),c=s.findLastIndex(Ma),u=s[c],_=wl(u,s.slice(0,c),l,o);if(u!==void 0&&_!==void 0&&Ue(_).length>=Ue(u).length&&(Jt(u,_),s[c]=_,l.splice(l.indexOf(_),1),a=!0),l.length===0)return{messages:a?s:e,changed:a};for(let p of l){let d=o.get(p.serverMessageId??p.id),f=!1,m=s.findIndex(g=>{let h=o.get(g.serverMessageId??g.id);return d===void 0?!1:h===void 0?f:h>d?!0:(f=!0,!1)});m===-1?s.push(p):s.splice(m,0,p)}return{messages:s,changed:!0}}function Rl(e,t){if(e.role!==t.role)return!1;let n=Ue(t),o=Ue(e);return n.length>o.length||t.partsSig.value.length>e.partsSig.value.length||Ra(e,t)}function jp(e,t){let n=e.partsSig.value,o=t.partsSig.value;return n.length!==o.length?!1:n.every((r,a)=>{let s=o[a];switch(r.kind){case"text":return s?.kind==="text"&&s.textSig.value===r.textSig.value;case"reasoning":return s?.kind==="reasoning"&&s.textSig.value===r.textSig.value;case"step-start":return s?.kind==="step-start";case"tool":return s?.kind==="tool"&&s.toolCallId===r.toolCallId&&Jo(s.toolName,r.toolName);case"file":return s?.kind==="file"&&s.url===r.url&&s.mediaType===r.mediaType;case"source":return s?.kind==="source"&&s.sourceId===r.sourceId&&s.url===r.url&&s.title===r.title&&s.filename===r.filename&&s.mediaType===r.mediaType;default:return r}})}function Jo(e,t){let n=e.startsWith("tool:")?e.slice(5):e,o=t.startsWith("tool:")?t.slice(5):t;return n===o}var bl={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Ra(e,t){let n=new Map(e.partsSig.value.filter(Sn).map(o=>[o.toolCallId,o]));return t.partsSig.value.filter(Sn).some(o=>{let r=n.get(o.toolCallId);if(!r||bl[o.stateSig.value]>bl[r.stateSig.value])return!0;let a=o.approvalSig.value?.approved;return a!==void 0&&a!==r.approvalSig.value?.approved})}function Qt(e){return e.role==="assistant"&&e.status!=="streaming"&&!Dt(e)}function Qo(e,t){if(!e.includes(t)||t.retryAction===null)return;if(t.retryAction)return t.retryAction;if(t!==e.at(-1)||t.role!=="assistant"||t.serverMessageId===void 0||t.status!=="error"&&!Qt(t))return;let n=e.indexOf(t);for(let o=n-1;o>=0;o--){let r=e[o];if(r?.role==="user"&&!r.ephemeral)return{kind:"repeat-user",messageId:r.id}}}function Tl(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!Gp(e)}function Il(e,t){return e.operatorRoutedTurn?Qt(e)?"drop":"complete-operator-routed":t||Qt(e)?"error":"complete"}function Xp(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:Q(e.text),doneSig:Q(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartialSig:Q(e.inputPartial),inputSig:Q(e.input),outputSig:Q(e.output),errorSig:Q(e.error),stateSig:Q(e.state),approvalSig:Q(e.approval)}:e}function Yp(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,text:e.textSig.value,done:e.doneSig.value}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartial:e.inputPartialSig.value,input:e.inputSig.value,output:e.outputSig.value,error:e.errorSig.value,state:e.stateSig.value,approval:e.approvalSig.value}:e}var El=X.scope("feedback:audio"),Zo=class{constructor(){te(this,"ctx",null);te(this,"master",null);te(this,"buffers",new Map)}unlock(){if(this.ctx){this.ctx.state==="suspended"&&this.ctx.resume();return}let t=globalThis.AudioContext??globalThis.webkitAudioContext;if(t)try{this.ctx=new t,this.master=this.ctx.createGain(),this.master.gain.value=1,this.master.connect(this.ctx.destination)}catch(n){El.warn("AudioContext init failed",{err:n})}}setVolume(t){if(!this.master||!this.ctx)return;let n=Math.max(0,Math.min(1,t));this.master.gain.setTargetAtTime(n,this.ctx.currentTime,.01)}playTone(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((s,l)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=s;let u=n.createGain(),_=r+l*a;u.gain.setValueAtTime(1e-4,_),u.gain.exponentialRampToValueAtTime(t.peakGain,_+.005),u.gain.exponentialRampToValueAtTime(1e-4,_+a),c.connect(u).connect(o),c.start(_),c.stop(_+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=await this.getBuffer(t);if(!r)return;let a=n.createBufferSource();a.buffer=r,a.connect(o),a.start()}destroy(){this.ctx&&this.ctx.close().catch(()=>{}),this.ctx=null,this.master=null,this.buffers.clear()}async getBuffer(t){if(!this.ctx)return null;let n=this.buffers.get(t);if(n)return n instanceof Promise,n;let o=this.ctx,r=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>o.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(El.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,r),r}};var Al={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Ml={messageReceived:{notes:[880,1318.51],noteMs:90,type:"sine",peakGain:.45},messageSent:{notes:[1568],noteMs:60,type:"sine",peakGain:.25},error:{notes:[523.25,392],noteMs:120,type:"triangle",peakGain:.55},voiceStart:{notes:[1318.51],noteMs:50,type:"sine",peakGain:.3},voiceStop:{notes:[880],noteMs:50,type:"sine",peakGain:.3}};var $t=null,er=0;function Jp(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function Qp(){if(typeof document>"u")return null;let e=document.createElement("input");e.type="checkbox",e.setAttribute("switch",""),e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e.id=`__${w.cssPrefix}_haptic_${Math.random().toString(36).slice(2)}`;let t=document.createElement("label");t.htmlFor=e.id,t.setAttribute("aria-hidden","true");let n="position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;opacity:0!important;pointer-events:none!important;";return e.style.cssText=n,t.style.cssText=n,document.body.append(e,t),{input:e,label:t}}function Ll(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Jp())try{navigator.vibrate(e);return}catch{}if($t||($t=Qp()),!!$t)try{$t.label.click()}catch{}}}function Ol(){er++;let e=!1;return()=>{e||(e=!0,er=Math.max(0,er-1),er===0&&$t&&($t.input.remove(),$t.label.remove(),$t=null))}}var Zp=X.scope("feedback"),ef=100,tr=class{constructor(t,n){te(this,"mutedSig",Q(!1));te(this,"audio",new Zo);te(this,"releaseHaptics");te(this,"sound");te(this,"haptics");te(this,"lastPlayed",new Map);te(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=Ol(),this.audio.setVolume(this.effectiveVolume()),typeof matchMedia<"u"&&(this.reducedMotionMq=matchMedia("(prefers-reduced-motion: reduce)"))}unlock(){this.audio.unlock(),this.audio.setVolume(this.effectiveVolume())}update(t,n){this.sound=t,this.haptics=n,this.audio.setVolume(this.effectiveVolume())}setMuted(t){this.mutedSig.value!==t&&(this.mutedSig.value=t)}toggleMuted(){this.mutedSig.value=!this.mutedSig.value}play(t){this.mutedSig.value||this.isDeduped(t)||(this.lastPlayed.set(t,performance.now()),this.sound.enabled&&this.playSound(t),this.haptics.enabled&&this.isTouchDevice()&&this.playHaptic(t))}destroy(){this.audio.destroy(),this.releaseHaptics()}isDeduped(t){let n=this.lastPlayed.get(t);return n===void 0?!1:performance.now()-n<ef}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(r=>Zp.warn("audio play failed",{err:r,url:n}));return}let o=Ml[t];o&&this.audio.playTone(o)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let o=n===!0||n===void 0?Al[t]:n;Ll(o)}effectiveVolume(){let t=this.sound.volume??.3;return this.reducedMotionMq?.matches?t*.5:t}isTouchDevice(){return typeof window>"u"?!1:matchMedia("(hover: none) and (pointer: coarse)").matches}};var tf=0;function i(e,t,n,o,r,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?s=t[l]:c[l]=t[l];var u={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--tf,__i:-1,__u:0,__source:r,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return J.vnode&&J.vnode(u),u}var j={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},Qn=`${w.cssPrefix}-icon-dir`,La=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),ft=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M18 6 6 18M6 6l12 12"})}),Nl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M12 5v14M5 12h14"})}),Dl=()=>i("svg",{...j,class:Qn,"aria-hidden":"true",children:[i("path",{d:"m22 2-7 20-4-9-9-4Z"}),i("path",{d:"M22 2 11 13"})]}),$l=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Fl=()=>i("svg",{...j,class:Qn,"aria-hidden":"true",children:i("path",{d:"M3 20V4l18 8-18 8Z"})}),kn=()=>i("svg",{...j,class:Qn,"aria-hidden":"true",children:i("path",{d:"m9 18 6-6-6-6"})}),Bl=()=>i("svg",{...j,"aria-hidden":"true",children:i("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Hl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"m21 11-9 9a5.5 5.5 0 0 1-7.78-7.78l8.49-8.49a3.67 3.67 0 0 1 5.19 5.19l-8.49 8.49a1.83 1.83 0 0 1-2.6-2.6l7.78-7.78"})}),Ul=()=>i("svg",{...j,"aria-hidden":"true",children:[i("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),i("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),zl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),ql=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Wl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),Vl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),Gl=()=>i("svg",{...j,"aria-hidden":"true",viewBox:"0 0 10 10",children:i("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),Kl=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),jl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),Xl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),Yl=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),i("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),Jl=()=>i("svg",{...j,class:Qn,"aria-hidden":"true",children:i("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),tn=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M20 6 9 17l-5-5"})}),Ql=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M3 3v6h6"}),i("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),i("path",{d:"M12 7v5l3 2"})]}),Zl=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M2 12h20"}),i("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),Zn=()=>i("svg",{...j,class:Qn,"aria-hidden":"true",children:i("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),ec=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M12 20h9"}),i("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),nn=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"m6 9 6 6 6-6"})}),tc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),i("path",{d:"M14 2v6h6"})]}),nf=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),i("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),Oa=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),eo=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i("path",{d:"M12 17h.01"})]}),of=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"m15 4 3 3-9 9-3-3z"}),i("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),rf=()=>i("svg",{...j,"aria-hidden":"true",children:[i("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),i("path",{d:"M12 8V4"}),i("circle",{cx:"12",cy:"3",r:"1"}),i("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),Na=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),i("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),i("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),i("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),af=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"m4.93 4.93 4.24 4.24M14.83 14.83l4.24 4.24M14.83 9.17l4.24-4.24M4.93 19.07l4.24-4.24"})]}),Da=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"11",cy:"11",r:"7"}),i("path",{d:"m21 21-4.3-4.3"})]}),nc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),oc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M3 9.5 12 3l9 6.5"}),i("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),rc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"m3 11 15-5v12L3 13z"}),i("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),i("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),i("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),to=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),i("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),ac=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),ic=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),sc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 3v18"}),i("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),sf=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),i("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),i("path",{d:"m20 20-4.4-4.4"})]}),lf=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M12 3.5 13.6 9 19 10.5 13.6 12 12 17.5 10.4 12 5 10.5 10.4 9z"}),i("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),cf=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M4 18h16"}),i("path",{d:"M5 18a7 7 0 0 1 14 0"}),i("path",{d:"M12 8V6"}),i("path",{d:"M10 6h4"})]}),df=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),i("path",{d:"M16 9.5a1.5 1.5 0 0 1 3 0v2.5a7 7 0 0 1-7 7 7 7 0 0 1-6.4-4.2L4 12.5a1.5 1.5 0 0 1 2.6-1.5L7 11"})]}),lc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),i("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]}),cc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),i("path",{d:"M7 10l4-7a2.5 2.5 0 0 1 2.5 2.5V8h5a2 2 0 0 1 2 2.3l-1.2 8A2 2 0 0 1 17.3 20H7"})]}),dc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),i("path",{d:"M17 14l-4 7a2.5 2.5 0 0 1-2.5-2.5V16h-5a2 2 0 0 1-2-2.3l1.2-8A2 2 0 0 1 6.7 4H17"})]}),uc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"3.5"}),i("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M19.1 4.9l-2.1 2.1M7 17l-2.1 2.1"})]}),_c=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 7v5l3 2"})]}),nr=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),or=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m15 9-6 6M9 9l6 6"})]}),pc={chat:La,message:Oa,bubbles:to,spark:nf,wand:of,bot:rf,help:eo,lifebuoy:af,headset:Na,search:sf,sparkles:lf,concierge:cf,wave:df};var $=w.cssPrefix,R={launcher:`${$}-launcher`,callout:`${$}-callout`,calloutDismiss:`${$}-callout-dismiss`,panel:`${$}-panel`,panelHeader:`${$}-panel-header`,resizeGrip:`${$}-resize-grip`,scrollToBottom:`${$}-scroll-to-bottom`,loadPreviousMessages:`${$}-load-previous-messages`,actionHistory:`${$}-action-history`,actionClose:`${$}-action-close`,langSegment:`${$}-lang-segment`,composer:`${$}-composer`,composerInput:`${$}-composer-input`,composerSend:`${$}-composer-send`,composerStop:`${$}-composer-stop`,composerAttach:`${$}-composer-attach`,composerFileInput:`${$}-composer-file-input`,composerVoice:`${$}-composer-voice`,attachmentChip:`${$}-attachment-chip`,attachmentRemove:`${$}-attachment-remove`,suggestion:`${$}-suggestion`,messageBubble:`${$}-message`,messageRetry:`${$}-message-retry`,messageFeedback:`${$}-message-feedback`,feedbackUp:`${$}-feedback-up`,feedbackDown:`${$}-feedback-down`,messageCopy:`${$}-message-copy`,historyPane:`${$}-history-pane`,historyBack:`${$}-history-back`,historyItem:`${$}-history-item`,historyLoadMore:`${$}-history-load-more`,sidebar:`${$}-sidebar`,sidebarToggle:`${$}-sidebar-toggle`,sidebarNewConversation:`${$}-sidebar-new-conversation`,sidebarItem:`${$}-sidebar-item`,messengerHome:`${$}-messenger-home`,modulesEmpty:`${$}-modules-empty`,tab:`${$}-tab`,tabBadge:`${$}-tab-badge`,homeView:`${$}-home-view`,homeGreeting:`${$}-home-greeting`,homeBrand:`${$}-home-brand`,backHeader:`${$}-back-header`,contentView:`${$}-content-view`,contentScroll:`${$}-content-scroll`,homeSearch:`${$}-home-search`,helpSearch:`${$}-help-search`,homeRecent:`${$}-home-recent`,homeContentRow:`${$}-home-content-row`,helpArticle:`${$}-help-article`,newsItem:`${$}-news-item`,formGate:`${$}-form-gate`,formDone:`${$}-form-done`,formDoneToggle:`${$}-form-done-toggle`,formAnswers:`${$}-form-answers`,formFill:`${$}-form-fill`,formSubmit:`${$}-form-submit`,formSkip:`${$}-form-skip`,formField:`${$}-form-field`,toolAskQuestions:`${$}-tool-ask-questions`,toolInputSubmit:`${$}-tool-input-submit`,toolInputSkip:`${$}-tool-input-skip`,toolApproval:`${$}-tool-approval`,toolApprove:`${$}-tool-approve`,toolReject:`${$}-tool-reject`,toolEdit:`${$}-tool-edit`,toolDecision:`${$}-tool-decision`,typingDots:`${$}-typing-dots`,reasoning:`${$}-reasoning`,toolAskSummary:`${$}-ask-questions-summary`,toolAskOptions:`${$}-ask-questions-options-toggle`,toolCall:`${$}-tool-call`,source:`${$}-source`,operatorRequest:`${$}-operator-request`,operatorBanner:`${$}-operator-banner`,cancelOperatorRequest:`${$}-cancel-operator-request`};function Ge(e,t){return`${e}-${t}`}var rr=w.cssPrefix;function fc({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:r}){let a=t.variant!=="circle"&&!!t.label;return i("button",{type:"button",class:`${rr}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":r?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":R.launcher,onClick:e,"aria-label":n.launcherOpen,children:[uf(t.icon),a?i("span",{class:`${rr}-fab-label`,children:Ze(n,t.label??"")}):null]})}function uf(e){let t=pc[e];return t?i(t,{}):i(_f,{source:e})}function _f({source:e}){return i("span",{ref:t=>{t&&pf(t,e)},"aria-hidden":"true"})}function pf(e,t){if(e.dataset.svgMounted!==t)try{let o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;o&&o.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(o,!0)),e.dataset.svgMounted=t)}catch{}}function mc({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:r}){let[a,s]=D(!1);return E(()=>{let l=setTimeout(()=>s(!0),e.delayMs);return()=>clearTimeout(l)},[e.delayMs]),E(()=>{if(!a||e.autoDismissMs<=0)return;let l=setTimeout(r,e.autoDismissMs);return()=>clearTimeout(l)},[a,e.autoDismissMs,r]),a?i("div",{class:`${rr}-callout`,role:"status","data-shape":e.shape,"data-position":ff(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":R.callout,children:[i("span",{children:Ze(n,e.text)}),i("button",{type:"button",class:`${rr}-callout-close`,onClick:r,"aria-label":o,title:o,"data-testid":R.calloutDismiss,children:i(ft,{})})]}):null}function ff(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function ar({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:r,strings:a}){let s=w.cssPrefix,l=M(null);if(E(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${s}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${s}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${s}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${s}-resize-max-h`,t.maxHeight),o&&(m.setProperty(`--${s}-widget-w`,`${o.width}px`),m.setProperty(`--${s}-widget-h`,`${o.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,s,o]),!e)return null;let c=n.startsWith("top-"),u=n.endsWith("-right"),_=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${u?"left":"right"}`,p=m=>{if(!e)return;let g=m.currentTarget,h=e.getBoundingClientRect();l.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:h.width,startH:h.height,dirX:u?-1:1,dirY:c?1:-1},g.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()},d=m=>{let g=l.current;if(!g||m.pointerId!==g.pointerId||!e)return;let h=(m.clientX-g.startX)*g.dirX,P=(m.clientY-g.startY)*g.dirY;e.style.setProperty(`--${s}-widget-w`,`${g.startW+h}px`),e.style.setProperty(`--${s}-widget-h`,`${g.startH+P}px`)},f=m=>{let g=l.current;if(!g||m.pointerId!==g.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let h=e.getBoundingClientRect();r({width:Math.round(h.width),height:Math.round(h.height)}),l.current=null};return i("div",{class:_,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:p,onPointerMove:d,onPointerUp:f,onPointerCancel:f,"data-testid":R.resizeGrip,children:i(Gl,{})})}var on=w.cssPrefix,mf=`.${on}-header, .${on}-back-header, .${on}-home-hero`,gf='button, a, input, textarea, select, [role="tab"], [contenteditable]',gc=56;function ir(e,t){E(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,u)=>Math.min(u,Math.max(-u,c)),r=null,a=c=>{let u=c.target;if(!(u instanceof Element)||!u.closest(mf)||u.closest(gf))return;let _=e.getBoundingClientRect();r={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${on}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${on}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-gc,maxY:(window.innerHeight+_.height)/2-gc},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!r||c.pointerId!==r.id)return;let u=o(r.dx+c.clientX-r.x,r.maxX),_=o(r.dy+c.clientY-r.y,r.maxY);e.style.setProperty(`--${on}-modal-dx`,`${u}px`),e.style.setProperty(`--${on}-modal-dy`,`${_}px`)},l=c=>{!r||c.pointerId!==r.id||(r=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)}},[e,t])}function no(e,t,n){switch(e){case"clear":case"sound":case"history":case"language":case"theme":case"textSize":return!0;case"expand":return t==="floating";case"fullscreen":return t!=="standalone";case"close":return t==="standalone"||t==="page"?!1:t==="inline"?n==="fullscreen":!0}}function sr(e,t,n){return no("close",e,t)?n.includes("close"):!1}function vc(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var vf='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function lr(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(vf)].filter(l=>l.offsetParent!==null||l===document.activeElement);if(o.length===0){n.preventDefault();return}let r=o[0],a=o[o.length-1];if(!r||!a)return;let s=e.getRootNode().activeElement;n.shiftKey&&s===r?(n.preventDefault(),a.focus()):!n.shiftKey&&s===a&&(n.preventDefault(),r.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function cr(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var $a=w.cssPrefix;function hc({agent:e,strings:t}){let n=e.status??"online",o=Ze(t,e.name),r=e.title?Ze(t,e.title):null;return i("div",{class:`${$a}-agent`,children:[i("div",{class:`${$a}-agent-avatar`,"data-status":n,children:e.avatar?i("img",{src:e.avatar,alt:""}):i("span",{children:cr(o)})}),i("div",{class:`${$a}-agent-meta`,children:[i("strong",{children:o}),r?i("span",{children:r}):null]})]})}var bc=X.scope("attachments");function dr(e,t,n){let o=bf(e),r=[],a=[],s=xf(n.accept),l=t.reduce((u,_)=>u+_.size,0),c=t.length;for(let u of o){let _=hf(u,c,l,n,s);if(_){a.push({file:u,reason:_});continue}r.push(Pf(u)),l+=u.size,c+=1}return(r.length||a.length)&&bc.debug("ingest",{accepted:r.length,rejected:a.map(u=>({name:u.file.name,reason:u.reason}))}),{accepted:r,rejected:a}}function ur(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){bc.debug("revokeObjectURL failed",{error:t})}}function hf(e,t,n,o,r){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":Sf(e,r)?null:"mime"}function bf(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:yf(t)).filter(t=>t!==null):[]}function yf(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function Pf(e){return{file:e,id:at(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function xf(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",o="*"]=t.split("/");return{kind:"mime",type:n,subtype:o}})}function Sf(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),r=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?r.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var oo=w.cssPrefix;function yc({attachment:e,onRemove:t,disabled:n=!1}){let o=e.mediaType.startsWith("image/");return i("span",{class:`${oo}-attachment-chip`,title:e.name,"data-testid":Ge(R.attachmentChip,e.id),children:[o?i("img",{class:`${oo}-attachment-thumb`,src:e.previewUrl,alt:""}):i("span",{class:`${oo}-attachment-thumb`,"aria-hidden":"true",children:i(tc,{})}),i("span",{class:`${oo}-attachment-name`,children:e.name}),i("button",{type:"button",class:`${oo}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":Ge(R.attachmentRemove,e.id),children:i(ft,{})})]})}var Fa={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function Ba(e,t,n){return e==="disabled"?Fa:e==="server"?Rf(n):kf(t)}function kf(e){let t=wf();if(!t)return Fa;let n=null,o=0;return{isSupported:!0,start(r,a){let s=n,l=++o;n=null,s?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let u=!1;c.addEventListener("result",p=>{if(o!==l||n!==c)return;let d=p,f="",m=!1;for(let g=d.resultIndex;g<d.results.length;g++){let h=d.results[g];h&&(f+=h[0].transcript,h.isFinal&&(m=!0))}r(f,m)});let _=()=>{u||o!==l||n!==c||(u=!0,n=null,a())};c.addEventListener("end",_),c.addEventListener("error",_);try{c.start()}catch{_()}},stop(){n?.stop()},cancel(){o++;let r=n;n=null,r?.abort()}}}function wf(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Cf=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Rf(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Fa;let t=0,n=null,o=s=>{for(let l of s.stream?.getTracks()??[])l.stop();s.stream=null},r=()=>{t++;let s=n;n=null,s&&(o(s),s.recorder?.state!=="inactive"&&s.recorder?.stop())},a=async s=>{if(s.finishing)return;s.finishing=!0;let l=s.recorder?.mimeType??"audio/webm";o(s);let c=new Blob(s.chunks,{type:l});s.chunks=[];try{let{text:u}=await e(c,l);n===s&&t===s.generation&&u&&s.onText(u,!0)}catch{}finally{n===s&&t===s.generation&&(n=null,s.onEnd())}};return{isSupported:!0,async start(s,l){r();let c={generation:t,recorder:null,stream:null,chunks:[],onText:s,onEnd:l,finishing:!1};n=c;try{let u=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let d of u.getTracks())d.stop();return}c.stream=u;let _=Tf(),p=new MediaRecorder(u,_?{mimeType:_}:void 0);c.recorder=p,p.addEventListener("dataavailable",d=>{n===c&&t===c.generation&&d.data.size>0&&c.chunks.push(d.data)}),p.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),p.start()}catch{o(c),n===c&&t===c.generation&&(n=null,l())}},stop(){let s=n;if(s){if(!s.recorder){r();return}s.recorder.state!=="inactive"&&s.recorder.stop()}},cancel(){r()}}}function Tf(){for(let e of Cf)if(MediaRecorder.isTypeSupported(e))return e}var ot=w.cssPrefix,wn=X.scope("composer");function Cn(e){return e.reduce((t,n)=>t+n.size,0)}var If={arrowUp:$l,paperPlane:Dl,send:Fl,chevron:kn};function Pc(e){return"activeElement"in e}function Ef(e){return"host"in e&&"activeElement"in e}function xc({options:e,transport:t,feedback:n,bus:o,persistence:r,conversationId:a,isStreaming:s,active:l=!0,isPreparing:c=!1,operatorRequestEnabled:u,canRequestOperator:_=!1,controlMode:p,onRequestOperator:d,onSend:f,onStop:m,attachApiRef:g}){let h=e.strings,[P,x]=D(()=>r.loadDraft(a)),[b,y]=D([]),[k,C]=D(!1),[B,G]=D(!1),U=M(!1),I=M(null),z=M(null),W=M(null),L=M(0),ne=M(a);ne.current=a;let re=M(l);re.current=l;let le=M(c);le.current=c;let Ae=B||c||!l,de=O(H=>{x(K=>{let Y=typeof H=="function"?H(K):H;return Y===K?K:(r.saveDraft(ne.current,Y),Y)})},[r]),_e=e.features.fileUpload,Me=e.features.voice,[N,ve]=D(()=>Ba(Me,e.locale,(H,K)=>t.transcribe(H,K))),ae=M(N);ae.current=N;let De=M({mode:Me,locale:e.locale,transport:t});E(()=>{let H=De.current;H.mode===Me&&H.locale===e.locale&&H.transport===t||(De.current={mode:Me,locale:e.locale,transport:t},L.current++,ae.current.cancel(),W.current=null,C(!1),ve(Ba(Me,e.locale,(K,Y)=>t.transcribe(K,Y))))},[e.locale,Me,t]),E(()=>()=>{L.current++,N.cancel()},[N]);let xe=O(H=>{let K=W.current;if(K===null)return!1;let Y=Date.now()-K;return wn[H]("voiceStop",{durationMs:Y}),o.emit("voiceStop",{durationMs:Y}),W.current=null,!0},[o]),Te=O(()=>{W.current!==null&&(N.stop(),C(!1),xe("info")&&n.play("voiceStop"))},[xe,n,N]),Ce=O(()=>{L.current++,N.cancel(),C(!1),xe("info")&&n.play("voiceStop")},[xe,n,N]);E(()=>{(c||!l)&&Ce()},[l,Ce,c]),E(()=>{let H=I.current;if(!H)return;let K=H.getRootNode(),Y=Pc(K)?K.activeElement:null;Y&&H.closest(`.${ot}-panel`)?.contains(Y)||H.focus({preventScroll:!0})},[]),E(()=>{let H=I.current;if(!H)return;if(P.length===0){H.style.height="";return}H.style.height="auto";let K=getComputedStyle(H),Y=Number.parseFloat(K.getPropertyValue(`--${ot}-textarea-base-height`)),pe=Number.parseFloat(K.borderTopWidth)+Number.parseFloat(K.borderBottomWidth),S=Math.min(H.scrollHeight+pe,Number.parseFloat(K.maxHeight)),q=Number.parseFloat(K.fontSize)*.7;H.style.height=`${S<Y+q?Y:S}px`},[P]);let Le=M(b);Le.current=b,E(()=>()=>Le.current.forEach(ur),[]),E(()=>{if(g)return g.current={attachFromDrop:H=>{if(!_e||!re.current||U.current||le.current)return;let K=dr(H,Le.current,e.attachments);K.accepted.length!==0&&(wn.info("attach (drop)",{count:K.accepted.length,totalBytes:Cn(K.accepted)}),o.emit("attach",{count:K.accepted.length,totalBytes:Cn(K.accepted)}),y(Y=>[...Y,...K.accepted]))},fill:H=>{if(!re.current||U.current||le.current)return;de(H);let K=I.current;K&&(K.focus({preventScroll:!0}),requestAnimationFrame(()=>K.setSelectionRange(K.value.length,K.value.length)))}},()=>{g.current&&(g.current=null)}},[g,_e,c,e.attachments,de]),E(()=>{let H=I.current;if(!H)return;let K=H.closest(`.${ot}-panel`);if(!K)return;let Y=pe=>{if(!re.current||U.current||le.current)return;let S=pe.clipboardData;if(!S)return;let q=pe.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(q&&q!==H)return;if(_e){let ie=dr(S.items,Le.current,e.attachments);if(ie.accepted.length>0){pe.preventDefault(),wn.info("attach (paste)",{count:ie.accepted.length,totalBytes:Cn(ie.accepted)}),o.emit("attach",{count:ie.accepted.length,totalBytes:Cn(ie.accepted)}),y(Pe=>[...Pe,...ie.accepted]);return}}if(q===H)return;let ye=S.getData("text/plain");ye&&(pe.preventDefault(),de(ie=>ie+ye),H.focus())};return K.addEventListener("paste",Y),()=>K.removeEventListener("paste",Y)},[_e,e.attachments,de]);let he=async()=>{let H=P.trim();if(!H&&b.length===0||!l||s||U.current||c)return;Ce(),U.current=!0,G(!0);let K=P,Y=b;try{await f(H,Y)&&(de(pe=>pe===K?"":pe),y(pe=>pe!==Y?pe:(Y.forEach(ur),Le.current=[],[])))}finally{U.current=!1,G(!1),requestAnimationFrame(()=>{let pe=I.current;if(!pe||pe.disabled||!re.current)return;let S=pe.getRootNode(),q=Pc(S)?S.activeElement:null,ye=q?.getAttribute("data-testid");if(!(q&&q!==pe&&ye!==R.composerSend&&ye!==R.composerStop)){if(Ef(S)){let ie=S.host.ownerDocument;if(!ie.hasFocus())return;let Pe=ie.activeElement;if(Pe&&Pe!==S.host&&Pe!==ie.body)return}pe.focus({preventScroll:!0})}})}},Se=H=>{H.key!=="Enter"||H.shiftKey||H.isComposing||(H.preventDefault(),s?m():he())},Ie=H=>{let K=H.target;if(!l||U.current||c){K.value="";return}let Y=dr(K.files,b,e.attachments);Y.accepted.length>0&&(wn.info("attach (file picker)",{count:Y.accepted.length,totalBytes:Cn(Y.accepted)}),o.emit("attach",{count:Y.accepted.length,totalBytes:Cn(Y.accepted)}),y(pe=>[...pe,...Y.accepted])),K.value=""},Je=H=>{!l||U.current||c||(wn.info("removeAttachment",{id:H}),o.emit("removeAttachment",{id:H}),y(K=>{let Y=K.find(pe=>pe.id===H);return Y&&ur(Y),K.filter(pe=>pe.id!==H)}))},Qe=()=>{if(k){Te();return}if(!l||!N.isSupported||U.current||c)return;let H=++L.current;W.current=Date.now(),wn.info("voiceStart"),o.emit("voiceStart",void 0),C(!0),n.play("voiceStart"),N.start((K,Y)=>{L.current!==H||!re.current||le.current||U.current||!Y||de(pe=>`${pe}${K} `)},()=>{L.current!==H||!re.current||(C(!1),xe("debug"))})},ze=If[e.composer.sendButton.icon];return i("div",{class:`${ot}-composer`,"data-testid":R.composer,children:[b.length>0?i("div",{class:`${ot}-attachments`,children:b.map(H=>i(yc,{attachment:H,onRemove:()=>Je(H.id),disabled:Ae},H.id))}):null,i("div",{class:`${ot}-composer-row`,children:[i("div",{class:`${ot}-composer-actions`,children:[_e?i("button",{type:"button",class:`${ot}-icon-btn`,onClick:()=>z.current?.click(),disabled:Ae,"aria-label":h.attach,"data-testid":R.composerAttach,children:i(Hl,{})}):null,N.isSupported?i("button",{type:"button",class:`${ot}-icon-btn`,onClick:Qe,disabled:Ae,"aria-label":k?h.micStop:h.micStart,"aria-pressed":k,"data-recording":k?"true":void 0,"data-testid":R.composerVoice,children:i(Ul,{})}):null]}),i("textarea",{ref:I,name:"message",class:`${ot}-textarea`,rows:1,value:P,placeholder:h.composerPlaceholder,onInput:H=>de(H.currentTarget.value),onKeyDown:Se,disabled:Ae,"aria-label":h.composerPlaceholder,"data-testid":R.composerInput}),s?i("button",{type:"button",class:`${ot}-send`,onClick:m,disabled:Ae,"aria-label":h.stop,"data-testid":R.composerStop,children:i(Bl,{})}):i("button",{type:"button",class:`${ot}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{he()},disabled:Ae||!P.trim()&&b.length===0,"aria-label":h.send,"data-testid":R.composerSend,children:i(ze,{})}),u&&p==="ai-agent"&&d?i("button",{type:"button",class:`${ot}-icon-btn`,onClick:d,disabled:Ae||!_,"aria-label":h.talkToOperator,title:h.talkToOperator,"data-testid":R.operatorRequest,children:i(Na,{})}):null]}),i("input",{ref:z,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:Ie,disabled:Ae,class:`${ot}-sr-only`,"data-testid":R.composerFileInput})]})}var Af=w.cssPrefix;function Sc({visible:e,strings:t}){return e?i("div",{class:`${Af}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function _r({containerRef:e,onDrop:t,disabled:n=!1}){let[o,r]=D(!1);return E(()=>{if(n){r(!1);return}let a=e.current;if(!a)return;let s=0,l=p=>{s+=1,p.dataTransfer?.types.includes("Files")&&(p.preventDefault(),r(!0))},c=()=>{s-=1,!(s>0)&&(s=0,r(!1))},u=p=>{p.dataTransfer?.types.includes("Files")&&p.preventDefault()},_=p=>{s=0,r(!1),p.dataTransfer&&(p.preventDefault(),t(p.dataTransfer.items))};return a.addEventListener("dragenter",l),a.addEventListener("dragleave",c),a.addEventListener("dragover",u),a.addEventListener("drop",_),()=>{a.removeEventListener("dragenter",l),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",u),a.removeEventListener("drop",_)}},[e,n,t]),{visible:n?!1:o}}function kc({itemCount:e,initialFocusIndex:t}){let[n,o]=D(!1),r=M(null),a=M(null),[s,l]=D(-1),c=O(()=>{o(!1),l(-1),r.current?.focus()},[]),u=O(()=>o(d=>!d),[]);E(()=>{if(!n)return;let d=f=>{let m=a.current,g=r.current;if(!m||!g)return;let h=f.composedPath();h.includes(m)||h.includes(g)||(o(!1),l(-1))};return document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[n]),E(()=>{if(!n||e===0)return;let d=t?.()??0,f=d<0||d>=e?0:d;l(f)},[n,e,t]),E(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let _=O(d=>{(d.key==="ArrowDown"||d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o(!0))},[]),p=O(d=>{if(e!==0)switch(d.key){case"Escape":d.preventDefault(),c();return;case"ArrowDown":d.preventDefault(),l(f=>(f+1)%e);return;case"ArrowUp":d.preventDefault(),l(f=>(f-1+e)%e);return;case"Home":d.preventDefault(),l(0);return;case"End":d.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:r,menuRef:a,toggle:u,close:c,onTriggerKey:_,onMenuKey:p}}function wc({items:e,triggerLabel:t}){let n=w.cssPrefix,o=kc({itemCount:e.length}),r=l=>{l.disabled||(l.onSelect?.(),l.keepOpen||o.close())},a=(l,c)=>l.onSelectValue?.(c),s=(l,c)=>{let u=c.segments;if(!u?.length)return;let _=Math.max(0,u.findIndex(d=>d.value===c.value)),p=-1;if(l.key==="ArrowRight"||l.key==="Enter"||l.key===" ")p=(_+1)%u.length;else if(l.key==="ArrowLeft")p=(_-1+u.length)%u.length;else return;l.preventDefault(),l.stopPropagation(),a(c,u[p].value)};return i("div",{class:`${n}-menu-wrap`,children:[i("button",{ref:o.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":o.open,title:t,onClick:o.toggle,onKeyDown:o.onTriggerKey,children:i(Kl,{})}),o.open?i("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(l=>l.segments?i("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":l.label,tabIndex:-1,onKeyDown:c=>s(c,l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),i("span",{class:`${n}-segmented`,role:"group","aria-label":l.label,children:l.segments.map(c=>{let u=c.value===l.value;return i("button",{type:"button",role:"menuitemradio","aria-checked":u,class:`${n}-segment`,"data-on":u?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${R.langSegment}-${c.value}`,onClick:()=>a(l,c.value),children:c.label},c.value)})})]},l.id):i("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":l.type==="switch"?l.on:void 0,disabled:l.disabled,onClick:()=>r(l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),l.type==="switch"&&l.on?i("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:i(tn,{})}):null]},l.id))}):null]})}var Ha=w.cssPrefix;function Mf(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var Lf={normal:"large",large:"small",small:"normal"};function Of(e){return e==="light"?i(ac,{}):e==="dark"?i(ic,{}):i(sc,{})}function Nf(e){return(e.split("-")[0]??e).toUpperCase()}function mt({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:r,onClose:a,onClear:s,onExpand:l,onFullscreen:c,onSoundToggle:u}=e,{onToggleHistory:_,onLocaleChange:p,onThemeChange:d,onTextSizeChange:f}=e,m=n.strings,g=n.mode,h=t==="chat",P=ut(()=>r.mutedSig.value).value,x=new Set(n.actions),b=L=>x.has(L),y=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,k=L=>y?!1:no(L,g,o),C=n.themeMode,B={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark},G=n.textSize,U={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},I=[];if(h&&b("clear")&&I.push({id:"clear",icon:i(ec,{}),label:m.newConversation,onSelect:s}),b("expand")&&k("expand")){let L=o==="expanded";I.push({id:"expand",icon:L?i(ql,{}):i(zl,{}),label:L?m.collapse:m.expand,type:"switch",on:L,onSelect:l})}if(b("fullscreen")&&k("fullscreen")){let L=o==="fullscreen";I.push({id:"fullscreen",icon:L?i(Vl,{}):i(Wl,{}),label:L?m.exitFullscreen:m.fullscreen,type:"switch",on:L,onSelect:c})}h&&b("sound")&&I.push({id:"sound",icon:P?i(Xl,{}):i(jl,{}),label:P?m.soundOff:m.soundOn,type:"switch",on:!P,onSelect:u}),b("theme")&&I.push({id:"theme",icon:Of(C),label:`${m.theme}: ${B[C]}`,onSelect:()=>d(Mf(C)),keepOpen:!0}),b("textSize")&&I.push({id:"textSize",icon:i(Yl,{}),label:`${m.textSize}: ${U[G]}`,onSelect:()=>f(Lf[G]),keepOpen:!0}),b("language")&&n.availableLocales.length>1&&I.push({id:"language",icon:i(Zl,{}),label:m.language,segments:n.availableLocales.map(L=>({value:L,label:Nf(L),lang:L})),value:n.locale,onSelectValue:p});let z=!!a&&sr(g,o,n.actions),W=h&&b("history");return i("div",{class:`${Ha}-header-actions`,children:[W?i("button",{type:"button",class:`${Ha}-icon-btn`,onClick:_,"aria-label":m.history,title:m.history,"data-testid":R.actionHistory,children:i(Ql,{})}):null,I.length>0?i(wc,{items:I,triggerLabel:m.moreActions}):null,z?i("button",{type:"button",class:`${Ha}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":R.actionClose,children:i(ft,{})}):null]})}var Df=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,$f=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Ff=/^[+]?[\d\s().-]{6,}$/;function Rn(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function Bf(e){return Array.isArray(e)?e.length:e&&e.trim()?1:0}function Hf(e,t,n){let o=e.required??!0,r=e.validation;if(e.type==="multiselect"){let s=Bf(t);return o&&s===0?n.formRequired:s===0?void 0:r?.minSelections!=null&&s<r.minSelections?Rn(n.formChooseAtLeast,{min:r.minSelections}):r?.maxSelections!=null&&s>r.maxSelections?Rn(n.formChooseAtMost,{max:r.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!Df.test(a))return n.formInvalidEmail;break;case"url":if(!$f.test(a))return n.formInvalidUrl;break;case"tel":if(!Ff.test(a))return n.formInvalidTel;break;case"number":{let s=Number(a);if(!Number.isFinite(s))return n.formInvalidNumber;if(r?.min!=null&&s<r.min)return Rn(n.formNumberTooSmall,{min:r.min});if(r?.max!=null&&s>r.max)return Rn(n.formNumberTooLarge,{max:r.max});break}default:break}if(r?.minLength!=null&&a.length<r.minLength)return Rn(n.formTooShort,{min:r.minLength});if(r?.maxLength!=null&&a.length>r.maxLength)return Rn(n.formTooLong,{max:r.maxLength});if(r?.pattern)try{if(!new RegExp(r.pattern).test(a))return n.formPatternMismatch}catch{}}function Cc(e,t,n){let o={};for(let r of e){let a=Hf(r,t[r.name],n);a&&(o[r.name]=a)}return o}function Rc(e){let t={};for(let[n,o]of Object.entries(e)){let r=Array.isArray(o)?o.join(", "):o;r&&r.trim()&&(t[n]=r.trim())}return t}var ke=w.cssPrefix,pr="__other__";function ro({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:r,onSkip:a,footerHint:s,submitOnEnter:l,disabled:c,initialValues:u,hideActions:_,fieldTypeLabels:p,rootTestId:d,submitTestId:f,skipTestId:m}){let[g,h]=D(()=>({...Wf(e),...u})),[P,x]=D({}),[b,y]=D({}),k=I=>{b[I]&&y(z=>({...z,[I]:""}))},C=(I,z)=>{h(W=>({...W,[I]:z})),k(I)},B=(I,z)=>{x(W=>({...W,[I]:z})),k(I)},G=I=>{if(I.preventDefault(),c)return;let z=Vf(e,g,P),W=Cc(e,z,t);if(Object.keys(W).length>0){y(W);return}o(Rc(z))},U=I=>{!l||I.key!=="Enter"||I.shiftKey||I.isComposing||I.target?.tagName==="TEXTAREA"&&G(I)};return i("form",{class:`${ke}-form`,onSubmit:G,onKeyDown:U,"data-testid":d,noValidate:!0,children:[e.map(I=>i(Uf,{field:I,value:g[I.name],otherText:P[I.name]??"",error:b[I.name],disabled:c,typeLabel:p?.[I.name],strings:t,onChange:z=>C(I.name,z),onOtherChange:z=>B(I.name,z)},I.name)),_?null:i("div",{class:`${ke}-form-actions`,children:[s?i("span",{class:`${ke}-form-hint`,children:s}):null,r&&a?i("button",{type:"button",class:`${ke}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:r}):null,i("button",{type:"submit",class:`${ke}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function Uf({field:e,value:t,otherText:n,error:o,disabled:r,typeLabel:a,strings:s,onChange:l,onOtherChange:c}){let u=Ge(R.formField,e.name),_=zf({field:e,value:t,otherText:n,disabled:r,strings:s,onChange:l,onOtherChange:c,fieldTid:u});return i("label",{class:`${ke}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[i("span",{class:`${ke}-field-head`,children:[i("span",{class:`${ke}-field-label`,children:[e.label,e.required??!0?i("span",{class:`${ke}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?i("span",{class:`${ke}-field-type`,children:a}):null]}),_,e.validationHint&&!o?i("span",{class:`${ke}-field-hint`,children:e.validationHint}):null,o?i("span",{class:`${ke}-field-error`,role:"alert",children:o}):null]})}function zf(e){let{field:t,value:n,otherText:o,disabled:r,strings:a,onChange:s,onOtherChange:l,fieldTid:c}=e,u=typeof n=="string"?n:"";switch(t.type){case"textarea":return i("textarea",{class:`${ke}-field-input`,rows:3,value:u,placeholder:t.placeholder,disabled:r,onInput:_=>s(_.target.value),"data-testid":c});case"select":return i("select",{class:`${ke}-field-input`,value:u,disabled:r,onChange:_=>s(_.target.value),"data-testid":c,children:[i("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(_=>i("option",{value:_.value,children:_.label??_.value},_.value))]});case"radio":{let _=t.allowOther&&u===pr;return i("div",{class:`${ke}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(p=>i("label",{class:`${ke}-choice`,children:[i("input",{type:"radio",name:`${ke}-${t.name}`,checked:u===p.value,disabled:r,onChange:()=>s(p.value)}),i("span",{children:p.label??p.value})]},p.value)),t.allowOther?i("label",{class:`${ke}-choice`,children:[i("input",{type:"radio",name:`${ke}-${t.name}`,checked:u===pr,disabled:r,onChange:()=>s(pr)}),i("span",{children:a.formOther})]}):null,_?i("input",{class:`${ke}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:p=>l(p.target.value)}):null]})}case"checkbox":return i("label",{class:`${ke}-choice`,children:[i("input",{type:"checkbox",checked:u==="true",disabled:r,onChange:_=>s(_.target.checked?"true":""),"data-testid":c}),i("span",{children:t.placeholder??t.label})]});case"multiselect":{let _=Array.isArray(n)?n:[],p=(d,f)=>s(f?[..._,d]:_.filter(m=>m!==d));return i("div",{class:`${ke}-field-choices`,"data-testid":c,children:[(t.options??[]).map(d=>i("label",{class:`${ke}-choice`,children:[i("input",{type:"checkbox",checked:_.includes(d.value),disabled:r,onChange:f=>p(d.value,f.target.checked)}),i("span",{children:d.label??d.value})]},d.value)),t.allowOther||(t.options??[]).length===0?i("textarea",{class:`${ke}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:d=>l(d.target.value)}):null]})}default:return i("input",{class:`${ke}-field-input`,type:qf(t.type),value:u,placeholder:t.placeholder,disabled:r,onInput:_=>s(_.target.value),"data-testid":c})}}function qf(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function Wf(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(o=>o.trim()).filter(Boolean):n.defaultValue);return t}function Vf(e,t,n){let o={...t};for(let r of e){let a=n[r.name]?.trim();if(r.type==="radio"&&r.allowOther&&t[r.name]===pr)o[r.name]=a??"";else if(r.type==="multiselect"&&a){let s=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),l=Array.isArray(t[r.name])?t[r.name]:[];o[r.name]=[...l,...s]}}return o}var gt=w.cssPrefix;function Ua({form:e,strings:t,onSubmit:n,onSkip:o}){return i("div",{class:`${gt}-form-gate`,"data-testid":R.formGate,children:[e.title?i("h3",{class:`${gt}-form-gate-title`,children:e.title}):null,e.description?i("p",{class:`${gt}-form-gate-desc`,children:e.description}):null,i(ro,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?o:void 0,submitTestId:R.formSubmit,skipTestId:R.formSkip})]})}function Tc({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",r=o?t.formSkipped:t.formSubmitted,a=e.title?i(ce,{children:[i("span",{children:e.title}),i("span",{class:`${gt}-sr-only`,children:r})]}):i("span",{children:r}),s=e.form?.reviewable??!1,l=!o&&s&&e.values&&Object.keys(e.values).length>0?e.values:null;if(l){let c=u=>e.form?.fields.find(_=>_.name===u)?.label??u;return i("details",{class:`${gt}-form-done`,"data-outcome":e.outcome,"data-testid":R.formDone,children:[i("summary",{class:`${gt}-form-done-summary`,"data-testid":R.formDoneToggle,children:[i(tn,{}),a,i(kn,{})]}),i("dl",{class:`${gt}-form-answers`,"data-testid":R.formAnswers,children:Object.entries(l).map(([u,_])=>i("div",{class:`${gt}-form-answer`,children:[i("dt",{children:c(u)}),i("dd",{children:_})]},u))})]})}return i("div",{class:`${gt}-form-done`,"data-outcome":e.outcome,"data-testid":R.formDone,role:"status",children:[o?i(Jl,{}):i(tn,{}),a,o&&e.form?.reopenable&&n?i("button",{type:"button",class:`${gt}-form-done-fill`,"data-testid":R.formFill,onClick:n,children:t.formFillOut}):null]})}function jf(e,t){for(var n in t)e[n]=t[n];return e}function qa(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Ic(e,t){this.props=e,this.context=t}function $c(e,t){function n(r){var a=this.props.ref;return a!=r.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,r)||a!=r.ref:qa(this.props,r)}function o(r){return this.shouldComponentUpdate=n,kt(e,r)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o}(Ic.prototype=new et).isPureReactComponent=!0,Ic.prototype.shouldComponentUpdate=function(e,t){return qa(this.props,e)||qa(this.state,t)};var Ec=J.__b;J.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ec&&Ec(e)};var zy=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Xf=J.__e;J.__e=function(e,t,n,o){if(e.then){for(var r,a=t;a=a.__;)if((r=a.__c)&&r.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t)}Xf(e,t,n,o)};var Ac=J.unmount;function Fc(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=jf({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return Fc(o,t,n)})),e}function Bc(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return Bc(o,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function za(){this.__u=0,this.o=null,this.__b=null}function Hc(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function fr(){this.i=null,this.l=null}J.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ac&&Ac(e)},(za.prototype=new et).__c=function(e,t){var n=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(n);var r=Hc(o.__v),a=!1,s=function(){a||o.__z||(a=!0,n.__R=null,r?r(c):c())};n.__R=s;var l=n.__P;n.__P=null;var c=function(){if(!--o.__u){if(o.state.__a){var u=o.state.__a;o.__v.__k[0]=Bc(u,u.__c.__P,u.__c.__O)}var _;for(o.setState({__a:o.__b=null});_=o.o.pop();)_.__P=l,_.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},za.prototype.componentWillUnmount=function(){this.o=[]},za.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Fc(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&kt(ce,null,e.fallback);return r&&(r.__u&=-33),[kt(ce,null,t.__a?null:e.children),r]};var Mc=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(fr.prototype=new et).__a=function(e){var t=this,n=Hc(t.__v),o=t.l.get(e);return o[0]++,function(r){var a=function(){t.props.revealOrder?(o.push(r),Mc(t,e,o)):r()};n?n(a):a()}},fr.prototype.render=function(e){this.i=null,this.l=new Map;var t=zn(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},fr.prototype.componentDidUpdate=fr.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Mc(e,n,t)})};var Yf=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Jf=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Qf=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Zf=/[A-Z0-9]/g,em=typeof document<"u",tm=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};et.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(et.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Lc=J.event;J.event=function(e){return Lc&&(e=Lc(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Uc,nm={configurable:!0,get:function(){return this.class}},Oc=J.vnode;J.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,o=t.type,r={},a=o.indexOf("-")==-1;for(var s in n){var l=n[s];if(!(s==="value"&&"defaultValue"in n&&l==null||em&&s==="children"&&o==="noscript"||s==="class"||s==="className")){var c=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?s="ondblclick":c!=="onchange"||o!=="input"&&o!=="textarea"||tm(n.type)?c==="onfocus"?s="onfocusin":c==="onblur"?s="onfocusout":Qf.test(s)&&(s=c):c=s="oninput":a&&Jf.test(s)?s=s.replace(Zf,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&r[s=c]&&(s="oninputCapture"),r[s]=l}}o=="select"&&(r.multiple&&Array.isArray(r.value)&&(r.value=zn(n.children).forEach(function(u){u.props.selected=r.value.indexOf(u.props.value)!=-1})),r.defaultValue!=null&&(r.value=zn(n.children).forEach(function(u){u.props.selected=r.multiple?r.defaultValue.indexOf(u.props.value)!=-1:r.defaultValue==u.props.value}))),n.class&&!n.className?(r.class=n.class,Object.defineProperty(r,"className",nm)):n.className&&(r.class=r.className=n.className),t.props=r})(e),e.$$typeof=Yf,Oc&&Oc(e)};var Nc=J.__r;J.__r=function(e){Nc&&Nc(e),Uc=e.__c};var Dc=J.diffed;J.diffed=function(e){Dc&&Dc(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Uc=null};function mr(e){if(!e)return!1;let t=e.startsWith("tool:")?e.slice(5):e;return t==="ask-user-questions"||t==="ask_user_questions"}var st=w.cssPrefix;function Va(e){return e.startsWith("tool:")||e.startsWith("tool-")?e.slice(5):e}function gr(e,t){let n=e==="output-available"||e==="output-error"||e==="output-denied",o=e==="approval-responded"||t?.approved!==void 0;return{terminal:n,responded:o,decided:n||o}}function Ga({status:e,icon:t,label:n}){return i("span",{class:`${st}-toolui-badge ${st}-toolui-status`,"data-status":e,children:[i("span",{class:`${st}-toolui-status-icon`,children:t}),n]})}function om(e,t){return e==="output-error"?"error":e==="output-denied"||t?.approved===!1?"denied":e==="output-available"?"completed":e==="approval-responded"||t?.approved===!0?"responded":e==="approval-requested"?"awaiting":"running"}function Ka(e,t,n={}){return n.submitted?"responded":im(om(e,t),n.superseded,n.live??!0)}function rm({status:e}){return e==="denied"||e==="error"||e==="superseded"?i(or,{}):e==="completed"||e==="responded"?i(nr,{}):i(_c,{})}function am(e,t){switch(e){case"awaiting":return t.statusAwaiting;case"responded":return t.statusResponded;case"completed":return t.statusCompleted;case"denied":return t.statusDenied;case"error":return t.statusError;case"superseded":return t.statusSuperseded;default:return t.statusRunning}}function im(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function sm({state:e,approval:t,strings:n,superseded:o,live:r=!0,submitted:a=!1}){let s=Ka(e,t,{superseded:o,live:r,submitted:a});return i(Ga,{status:s,icon:i(rm,{status:s}),label:am(s,n)})}function lm({name:e,state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}){return i(ce,{children:[i("span",{class:`${st}-toolui-name-pill`,children:[i(uc,{}),i("span",{class:`${st}-toolui-name-text`,children:e})]}),i(sm,{state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}),i("span",{class:`${st}-toolui-chevron`,children:i(nn,{})})]})}function vr({part:e,strings:t,testid:n,superseded:o,live:r,submitted:a}){let s=ee(()=>fe(()=>e.inputSig.value),[e]),l=ee(()=>fe(()=>e.outputSig.value),[e]),c=ee(()=>fe(()=>e.errorSig.value),[e]),u=ee(()=>fe(()=>e.stateSig.value),[e]),_=ee(()=>fe(()=>e.approvalSig.value),[e]);return i("details",{class:`${st}-toolui ${st}-toolui-collapsible`,"data-testid":n,children:[i("summary",{class:`${st}-toolui-head`,children:i(lm,{name:Va(e.toolName),state:u.value,approval:_.value,strings:t,superseded:o,live:r,submitted:a})}),i(Wa,{label:t.toolParameters,value:s.value}),l.value!==void 0?i(Wa,{label:t.toolResult,value:l.value}):null,c.value?i(Wa,{label:t.statusError,value:c.value,error:!0}):null]})}function Wa({label:e,value:t,error:n}){let o=n?String(t??""):hr(ja(t));return o?i("div",{class:`${st}-toolui-section`,children:[i("span",{class:`${st}-toolui-label`,children:e}),i("pre",{class:`${st}-toolui-code`,"data-error":n?"true":void 0,children:o})]}):null}function ja(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function hr(e){if(e==null)return"";try{let t=typeof e=="string"?e:JSON.stringify(e,null,2);return!t||t==="{}"||t==="[]"||t==='""'?"":t.length>800?`${t.slice(0,800)}\u2026`:t}catch{return""}}function zc(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function qc(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function cm(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function Wc(e){let{streaming:t,reasoningVisible:n,emptyReply:o,hidden:r}=e,a=e.responseMode==="buffered"&&t,s=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:s,showStreamDots:cm({streaming:t,bufferedHold:a,reasoningVisible:n,working:s}),emptyReply:o,hidden:r}}function Vc(e,t){let n=e.stateSig.value,o=e.approvalSig.value,{terminal:r,responded:a,decided:s}=gr(n,o),l=t.continuationStreaming===!0&&!s,c=t.superseded&&!s&&!l;return{pill:Ka(n,o,{superseded:c,live:t.live,submitted:l}),state:n,terminal:r,decided:s||l,showApproveReject:!s&&!t.superseded&&!l,showAnswered:a&&!r&&!c,showSubmitted:l,showEdit:a&&t.active&&!r,skipped:c,answeredApproved:o?.approved}}var Ja=1,Kc=2,jc=4,Xc=8,Yc=16;function dm(e){switch(e){case Ja:return"href";case Kc:return"src";case jc:return"class";case Xc:return"checked";case Yc:return"start"}}var um=e=>{switch(e){case 1:return 3;case 2:return 4;case 3:return 5;case 4:return 6;case 5:return 7;default:return 8}},_m=um;var Gc=24;function Za(e){let t=new Uint32Array(Gc);return t[0]=1,{renderer:e,text:"",pending:"",tokens:t,len:0,token:1,fence_end:0,blockquote_idx:0,hr_char:"",hr_chars:0,fence_start:0,spaces:new Uint8Array(Gc),indent:"",indent_len:0,table_state:0}}function Jc(e){e.pending.length>0&&Xe(e,`
|
|
11
|
+
${r}`:r;continue}o.startsWith("id:")&&(n=o.slice(3).trim())}if(t==="[DONE]")return"done";if(!t)return null;try{let o=JSON.parse(t);return dl.trace("chunk",{type:o.type,eventId:n}),{chunk:o,eventId:n}}catch(o){throw dl.trace("frame parse failed",{err:o,payload:t.slice(0,200)}),new Ve("invalid SSE frame","network",void 0,o)}}function wp(e){let t=new TextEncoder().encode(e),n="";for(let o of t)n+=String.fromCharCode(o);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var _l=e=>e&&Object.keys(e).length>0?e:void 0;function pl(e,t){let n=_l(e),o=_l(t);if(!n&&!o)return;let r={};return n&&(r.user=n),o&&(r.page=o),wp(JSON.stringify(r))}function Vo(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Cp(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function fl(e){return e.startsWith("tool-")?e.slice(5):e}var tt={handshake:"/pai/handshake",streamMessage:"/pai/stream-message",streamResume:"/pai/stream-resume",cancelStream:"/pai/cancel-stream",listConversations:"/pai/list-conversations",listMessages:"/pai/list-messages",updateSettings:"/pai/update-settings",markRead:"/pai/mark-read",messageFeedback:"/pai/message-feedback",requestOperator:"/pai/request-operator",cancelOperatorRequest:"/pai/cancel-request-operator",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},ml="context";function Ot(e){let t=e??{},n=t.controlMode;return{controlMode:n==="awaiting_operator"||n==="operator"?n:"ai-agent",controlRevision:typeof t.controlRevision=="number"&&Number.isSafeInteger(t.controlRevision)&&t.controlRevision>=0?t.controlRevision:void 0,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function Go(e){let t=e?.suggestions;if(!Array.isArray(t))return[];let n=[];for(let o of t){if(!o||typeof o!="object")continue;let{id:r,label:a,text:s}=o;typeof a!="string"||!a||n.push({id:typeof r=="string"&&r?r:`s${n.length}`,label:a,text:typeof s=="string"&&s?s:a})}return n}function ka(e){let n={messages:e.messages.map(o=>({id:o.serverMessageId??o.id,parts:Tp(o),role:o.role,createdAt:o.createdAt!==void 0?new Date(o.createdAt).toISOString():void 0})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),n}function Rp(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function Tp(e){let t=[];for(let n of e.parts)if(n.kind==="step-start"&&t.push({type:"step-start"}),n.kind==="reasoning"&&n.text&&t.push({type:"reasoning",text:n.text,state:n.done?"done":"streaming"}),n.kind==="text"&&n.text&&t.push({text:n.text,type:"text"}),n.kind==="file"&&n.url&&t.push({mediaType:n.mediaType,type:"file",url:n.url}),n.kind==="tool"&&Rp(n)){let o=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:Cp(n.toolName),toolCallId:n.toolCallId,state:n.state};n.input!==void 0&&(o.input=n.input),n.output!==void 0&&(o.output=n.output),n.error!==void 0&&(o.errorText=n.error),n.approval&&n.approval.approved!==void 0&&(o.approval=n.approval),t.push(o)}for(let n of e.attachments??[])n.url&&t.push({type:"file",url:n.url,mediaType:n.mediaType,filename:n.name,fileId:n.id,fileSize:n.size});return t}var oe=X.scope("transport"),Ip=6e4,Ep=1e4,Ca=50,gl=3,Ap=400,Mp=3e4,Lp=1e4,Op=6e4,Np=15e3,Dp=1024*1024,vl=new Set([408,425,429,500,502,503,504]);function hl(e){return Ap*2**e+Math.floor(Math.random()*250)}function $p(e){return Op+Math.ceil(e/Dp)*Np}function Fp(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),o=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(o)&&o>=0?Math.min(o,3e4):null}var Ko=class{constructor(t){te(this,"ttlMs",t);te(this,"map",new Map)}getOrFetch(t,n){let o=this.map.get(t);if(o&&Date.now()-o.at<this.ttlMs)return o.result;let r={at:Date.now(),result:n().then(a=>(r.value=a,a)).catch(a=>{throw this.map.delete(t),a})};return this.map.set(t,r),r.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&Date.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values())n.value!==void 0&&(n.value=t(n.value)),n.result=n.result.then(o=>{let r=t(o);return n.value=r,r})}clear(){this.map.clear()}},jo=class{constructor(t){te(this,"opts",t);te(this,"visitorId");te(this,"conversationId");te(this,"userContext");te(this,"pageContext");te(this,"locale");te(this,"conversationsCache",new Ko(Ep));te(this,"contentCache",new Ko(Ip))}setContext(t,n){this.userContext=t,this.pageContext=n}setLocale(t){this.locale=t}primeIdentity(t,n){t&&(this.visitorId=t),n&&(this.conversationId=n)}envelope(){let t={_ev:gn};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=pl(this.userContext,this.pageContext);return n&&(t[ml]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,o]of Object.entries(this.envelope()))t.append(n,o);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[o,r]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,r);return n.toString()}async handshake(t){oe.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(tt.handshake,t,"handshake");return oe.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),Up(n)||oe.warn("handshake response did not match expected shape; using raw response",{response:n}),this.visitorId=n.visitorId??t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t,n){oe.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let o=new FormData;o.append("file",t,t.name);let r=await this.postForm(this.uploadPath,o,"upload",n,$p(t.size));return oe.debug("uploadFile \u2190",{id:r.id,url:r.url}),r}async transcribe(t,n="audio/webm"){oe.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${Bp(n)}`),o.append("mimeType",n);let r=await this.postForm(this.transcribePath,o,"transcribe");return oe.debug("transcribe \u2190",{textLen:r.text.length}),r}localeCacheKey(t){return`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`}peekConversations(t={}){return this.conversationsCache.peek(this.localeCacheKey(t))}listConversations(t={}){return this.conversationsCache.getOrFetch(this.localeCacheKey(t),()=>this.fetchConversations(t))}async fetchConversations(t){let n=new URL(this.url(tt.listConversations));t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.page&&n.searchParams.set("page",String(t.page)),t.limit&&n.searchParams.set("limit",String(t.limit)),t.ids?.length&&n.searchParams.set("ids",t.ids.join(",")),oe.debug("listConversations \u2192",{visitorId:t.visitorId??this.visitorId,page:t.page,limit:t.limit,ids:t.ids});let o=await this.getJson(n.toString(),"listConversations");return oe.debug("listConversations \u2190",{count:o.conversations.length,page:o.pagination.page,hasNext:o.pagination.hasNext}),o}async loadConversation(t,{ids:n=[],beforeId:o}={}){let r=new URL(this.url(tt.listMessages));r.searchParams.set("conversationId",t),r.searchParams.set("limit",String(Ca)),r.searchParams.set("sortBy","_id"),r.searchParams.set("sortOrder","desc"),n.length>0&&r.searchParams.set("ids",n.join(",")),o&&r.searchParams.set("beforeId",o),oe.debug("loadConversation \u2192",{conversationId:t,visitorId:this.visitorId,ids:n.length>0?n:void 0,beforeId:o});let a=await this.getJson(r.toString(),"loadConversation"),s=(a.messages??[]).toReversed();return oe.debug("loadConversation \u2190",{conversationId:a.conversationId,canContinue:a.canContinue,messageCount:s.length,hasSuggestions:!!a.suggestions}),{...a,messages:s,canContinue:a.canContinue??!0}}async markRead(t){if(!(!this.visitorId||!t)){this.conversationsCache.update(n=>({...n,conversations:n.conversations.map(o=>o.conversationId===t&&o.hasUnread?{...o,hasUnread:!1}:o)})),oe.debug("markRead \u2192",{conversationId:t,visitorId:this.visitorId});try{await this.postJson(tt.markRead,{conversationId:t},"markRead")}catch(n){oe.debug("markRead failed (non-fatal)",{err:n})}}}async requestOperator(){if(!(!this.visitorId||!this.conversationId)){oe.debug("requestOperator \u2192",{conversationId:this.conversationId,visitorId:this.visitorId});try{return(await this.postJson(tt.requestOperator,{},"requestOperator")).controlState}catch(t){oe.debug("requestOperator failed (non-fatal)",{err:t});return}}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId)){oe.debug("cancelOperatorRequest \u2192",{conversationId:this.conversationId,visitorId:this.visitorId});try{return(await this.postJson(tt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){oe.debug("cancelOperatorRequest failed (non-fatal)",{err:t});return}}}listContent(t={}){return this.contentCache.getOrFetch(this.localeCacheKey(t),()=>this.fetchContent(t))}async fetchContent(t){let n=new URL(this.dataUrl(tt.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));oe.debug("listContent \u2192",t);let o=await this.getJson(n.toString(),"listContent"),r=(o.items??[]).map(a=>Ui(a,this.locale));return oe.debug("listContent \u2190",{count:r.length,total:o.pagination?.total}),{...o,items:r}}async bootstrap(t){let n=new URL(this.dataUrl(tt.bootstrap));t&&n.searchParams.set("conversationId",t),oe.debug("bootstrap \u2192",{conversationId:t??this.conversationId});let o=await this.getJson(n.toString(),"bootstrap"),r=o.forms??[],a=o.formSubmissions??[];return oe.debug("bootstrap \u2190",{forms:r.length,formSubmissions:a.length}),{forms:r,formSubmissions:a}}async saveUserPrefs(t){oe.debug("saveUserPrefs \u2192",{visitorId:this.visitorId,conversationId:this.conversationId,settingsKeys:Object.keys(t)});let n=await this.postJson(tt.updateSettings,{userPrefs:t},"saveUserPrefs");return oe.debug("saveUserPrefs \u2190",{success:n.success}),n}get uploadPath(){return this.opts.endpoints?.upload??"/pai/upload-file"}get transcribePath(){return this.opts.endpoints?.transcribe??"/pai/transcribe-audio"}get submitFormPath(){return this.opts.endpoints?.submitForm??tt.submitForm}async submitForm(t){oe.debug("submitForm \u2192",{formId:t.formId,trigger:t.trigger,fields:Object.keys(t.values).length});try{await this.postJson(this.dataUrl(this.submitFormPath),t,"submitForm")}catch(n){oe.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){oe.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(tt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){oe.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t){this.conversationsCache.clear(),oe.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});try{return await this.runWithAbort(async n=>{let o=await this.fetchImpl(this.url(tt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});if(o.status!==202)throw new Ve(`sendTurn failed: expected 202, received ${o.status}`,"server",o.status);let r;try{r=await o.json()}catch(a){throw n?.aborted?a:new Ve("sendTurn failed: invalid acknowledgement","server",o.status,a)}if(!Hp(r))throw new Ve("sendTurn failed: invalid acknowledgement","server",o.status);return r},void 0,Mp)}catch(n){throw n instanceof Ve?n:new Ve("sendTurn failed: network error","network",void 0,n)}}cancelTurn(t,n){!this.visitorId||!t||!n||(oe.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(tt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(o=>oe.debug("cancel POST failed (non-fatal)",{err:o})))}async connectResumeStream(t){let n=new AbortController,o=()=>n.abort(t.signal.reason);t.signal.aborted?o():t.signal.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>n.abort(),Lp),a=()=>{clearTimeout(r),t.signal.removeEventListener("abort",o)},s;try{s=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:n.signal})}catch(l){return a(),t.signal.aborted||oe.debug("resume-stream fetch failed \u2014 reconnecting",{err:l}),"held"}if(clearTimeout(r),!s.ok)return a(),s.status===409||vl.has(s.status)?(oe.debug("resume-stream \u2192 transient response; reconnecting",{status:s.status}),"held"):(oe.debug("resume-stream \u2192 endpoint unavailable",{status:s.status}),"unavailable");if(!s.body)return a(),oe.debug("resume-stream \u2192 bodyless response; stopping",{status:s.status}),"unavailable";if(!(s.headers.get("content-type")??"").includes("text/event-stream"))return a(),oe.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";try{t.onConnected();for await(let{chunk:l}of ul(s,n.signal)){if(t.signal.aborted)return"held";t.onChunk(l)}}catch(l){if(t.signal.aborted)return"held";oe.debug("resume-stream segment dropped \u2014 reconnecting",{err:l})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(tt.streamResume)}async postJson(t,n,o){let r=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(n))}],o);return this.assertOk(r,o)}async postForm(t,n,o,r,a){return this.runWithAbort(async s=>{let l=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n),signal:s});return this.assertOk(l,o)},r,a)}async runWithAbort(t,n,o){if(!n&&o===void 0)return t();let r=new AbortController,a=()=>r.abort(n?.reason);n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let s=o===void 0?void 0:setTimeout(()=>r.abort(),o);try{return await t(r.signal)}finally{s!==void 0&&clearTimeout(s),n?.removeEventListener("abort",a)}}async getJson(t,n){let o=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.opts.auth.headers()}}],n);return this.assertOk(o,n)}async fetchWithRetry(t,n){for(let o=0;;o++){let[r,a]=t(),s;try{s=await this.fetchImpl(r,a)}catch(c){if(o>=gl)throw new Ve(`${n} failed: network error`,"network",void 0,c);oe.debug("request network error \u2014 retrying",{label:n,attempt:o}),await Xn(hl(o));continue}if(s.ok||!vl.has(s.status)||o>=gl)return s;let l=Fp(s.headers)??hl(o);oe.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await Xn(l)}}async assertOk(t,n){if(!t.ok)throw new Ve(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}url(t){return/^https?:\/\//i.test(t)?t:`${this.opts.agentApiBaseUrl}${t}`}dataUrl(t){return/^https?:\/\//i.test(t)?t:`${this.opts.dataApiBaseUrl}${t}`}get fetchImpl(){return this.opts.fetchImpl??globalThis.fetch.bind(globalThis)}};function Bp(e){return e.includes("webm")?"webm":e.includes("ogg")?"ogg":e.includes("mp4")||e.includes("m4a")?"m4a":e.includes("mpeg")?"mp3":e.includes("wav")?"wav":"bin"}function Hp(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),o=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(o===void 0||typeof o=="string"&&o.length>0)}function Up(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.conversationId=="string"}function Ta(e,t){let n=e?[{kind:"text",id:"t0",textSig:Q(e),doneSig:Q(!0)}]:[];return{id:at(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:Q(n)}}function Rt(){return{id:at(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:Q([])}}function yl(e){let t=at();return zp({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function zp(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,feedback:e.feedback,partsSig:Q(e.parts.map(Xp))}}var Pl=new Set(["completed","failed","canceled"]);function qp(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status!=null&&!Pl.has(e.status)?"streaming":"complete"}function Ia(e){let t=new Set,n=e.parts.map((r,a)=>r.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:Q(r.text),doneSig:Q(!0)}:r.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:Q(r.text),doneSig:Q(r.state!=="streaming")}:r.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:r.type==="file"?{kind:"file",url:r.url,mediaType:r.mediaType}:r.type==="source-url"?{kind:"source",sourceId:r.sourceId,url:r.url,title:r.title}:r.type==="source-document"?{kind:"source",sourceId:r.sourceId,title:r.title,filename:r.filename,mediaType:r.mediaType}:r.type==="data-suggestions"?null:r.type==="dynamic-tool"||r.type.startsWith("tool-")?{kind:"tool",toolCallId:r.toolCallId,toolName:r.type==="dynamic-tool"?r.toolName:fl(r.type),dynamic:r.type==="dynamic-tool"?!0:void 0,inputPartialSig:Q(""),inputSig:Q(r.input),outputSig:Q(r.output),errorSig:Q(r.errorText),stateSig:Q(r.state),approvalSig:Q(r.approval)}:null).filter(r=>r!==null).filter(r=>r.kind!=="source"?!0:t.has(r.sourceId)?!1:(t.add(r.sourceId),!0)),o=e.parts.find(r=>r.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:o?.type==="data-suggestions"?Go(o.data):void 0,serverMessageId:e.id,createdAt:Vo(e.createdAt)??Date.now(),status:qp(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:Q(n)}}function Wp(e){return!e.parts.some(t=>t.type==="text"&&t.text.trim()!==""||t.type==="dynamic-tool"||t.type.startsWith("tool-")||t.type==="file"||t.type==="source-url"||t.type==="source-document")}function Vp(e){return e.role==="assistant"&&e.status!=null&&!Pl.has(e.status)&&Wp(e)}function Nt(e){let t=e.length-1;return e.filter((n,o)=>o===t||!Vp(n)).map(Ia)}function xl(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,o=e.at(n);return!o||o.ephemeral?[]:[o]}function Ea(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,parts:e.partsSig.value.map(Yp)}}function Ue(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Dt(e){return Ue(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function Gp(e){return Ue(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function Aa(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}var Sn=e=>e.kind==="tool",Sl=e=>e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file";function Yn(e){let t=e.partsSig.value,n=t.findLastIndex(o=>o.kind==="tool");return t.slice(n+1).some(Sl)}function Zt(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(Sn);return t.length>0&&t.every(n=>Aa(n.stateSig.value))}function en(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!Yn(e)}function Xo(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||Sl(n))}function Yo(e){return e.partsSig.value.some(t=>Sn(t)&&!Aa(t.stateSig.value))}function kl(e,t){if(t.length===0)return e;let n=new Set;for(let s of e)n.add(s.id),s.serverMessageId&&n.add(s.serverMessageId);let o=t.filter(s=>{let l=[s.id,s.serverMessageId].filter(c=>c!==void 0);return l.some(c=>n.has(c))?!1:(l.forEach(c=>n.add(c)),!0)});if(o.length===0)return e;let r=e.findIndex(s=>!s.ephemeral),a=r<0?e.length:r;return[...e.slice(0,a),...o,...e.slice(a)]}function Jt(e,t){return t.id=e.id,e.canceled&&(t.canceled=!0),e.feedback!==void 0&&(t.feedback=e.feedback),t.suggestions??(t.suggestions=e.suggestions),t}function wl(e,t,n,o){if(!Ma(e))return;if(t.length===0){let s=Math.max(...o.values());return n.find(l=>l.role==="assistant"&&o.get(l.serverMessageId??l.id)===s&&Ue(l).length>=Ue(e).length)}let r=t.at(-1);if(r?.role!=="user")return;let a=o.get(r.serverMessageId??r.id);if(a!==void 0)return n.find(s=>s.role==="assistant"&&o.get(s.serverMessageId??s.id)===a+1&&Ue(s).length>=Ue(e).length)}function Ma(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function Kp(e,t){let n=new Map(t.partsSig.value.filter(Sn).filter(a=>Aa(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let o=!1,r=e.partsSig.value.map(a=>{if(!Sn(a))return a;let s=n.get(a.toolCallId);if(!s)return a;let l=a.approvalSig.value,c=s.approvalSig.value,u=l===void 0||l.approved===void 0&&c?.approved!==void 0?s.approvalSig:a.approvalSig,_=a.inputSig.value===void 0?s.inputSig:a.inputSig,p=a.toolName==="tool"?s.toolName:a.toolName,d=a.dynamic??s.dynamic;return u===a.approvalSig&&_===a.inputSig&&p===a.toolName&&d===a.dynamic?a:(o=!0,{...a,toolName:p,dynamic:d,inputSig:_,approvalSig:u})});o&&(e.partsSig.value=r)}function Cl(e,t){let n=t.filter(p=>!p.ephemeral&&(p.status==="streaming"||p.status==="pending"||p.status==="error"||p.retryAction!==void 0||(p.attachments?.length??0)>0||Dt(p))),o=new Map;for(let p of n)o.set(p.id,p),p.serverMessageId!==void 0&&o.set(p.serverMessageId,p);let r=new Set,a=[],s=e.map(p=>{let d=(p.serverMessageId!==void 0?o.get(p.serverMessageId):void 0)??o.get(p.id);return d===void 0?(a.push(p),p):(r.add(d),d.role!==p.role?p:d.role==="user"&&d.serverMessageId===void 0&&(d.status==="pending"||d.status==="error")?Jt(d,p):d.status==="streaming"||Ue(d).length>=Ue(p).length?(Kp(d,p),d.suggestions??(d.suggestions=p.suggestions),d.feedback===void 0&&(d.feedback=p.feedback),p.canceled&&(d.canceled=!0),d):Jt(d,p))}),l=n.filter(p=>!r.has(p)),c=l.findLast(Ma),u=new Map;e.forEach((p,d)=>{u.set(p.id,d),p.serverMessageId!==void 0&&u.set(p.serverMessageId,d)});let _=wl(c,c?n.slice(0,n.indexOf(c)):[],a,u);if(c&&_){let p=s.indexOf(_);p>=0&&(s[p]=Jt(c,_)),l=l.filter(d=>d!==c)}return[...s,...l]}function Jn(e,t){let n=new Map(t.filter(p=>p.serverMessageId!==void 0).map(p=>[p.serverMessageId,p])),o=new Map;t.forEach((p,d)=>{o.set(p.id,d),p.serverMessageId!==void 0&&o.set(p.serverMessageId,d)});let r=new Set(e.flatMap(p=>[p.serverMessageId,p.id].filter(d=>d!==void 0))),a=!1,s=e.map(p=>{let d=n.get(p.serverMessageId??p.id);if(d===void 0||d.role!==p.role)return p;if(p.role==="user"&&p.serverMessageId===void 0)return a=!0,Jt(p,d);if(p.serverMessageId===void 0)return p;let f=Ue(d),m=Ue(p),g=d.status!=="streaming"&&f.length>=m.length&&Ra(p,d);if(f.length>m.length||f===m&&d.partsSig.value.length>p.partsSig.value.length||g)return a=!0,Jt(p,d);if(p.status==="streaming"&&d.status!=="streaming"&&jp(p,d)){if(p.continuationStreaming&&Yo(d))return p;if(!Ra(d,p))return a=!0,Jt(p,d)}return p}),l=[...n.values()].filter(p=>!r.has(p.serverMessageId)),c=s.findLastIndex(Ma),u=s[c],_=wl(u,s.slice(0,c),l,o);if(u!==void 0&&_!==void 0&&Ue(_).length>=Ue(u).length&&(Jt(u,_),s[c]=_,l.splice(l.indexOf(_),1),a=!0),l.length===0)return{messages:a?s:e,changed:a};for(let p of l){let d=o.get(p.serverMessageId??p.id),f=!1,m=s.findIndex(g=>{let h=o.get(g.serverMessageId??g.id);return d===void 0?!1:h===void 0?f:h>d?!0:(f=!0,!1)});m===-1?s.push(p):s.splice(m,0,p)}return{messages:s,changed:!0}}function Rl(e,t){if(e.role!==t.role)return!1;let n=Ue(t),o=Ue(e);return n.length>o.length||t.partsSig.value.length>e.partsSig.value.length||Ra(e,t)}function jp(e,t){let n=e.partsSig.value,o=t.partsSig.value;return n.length!==o.length?!1:n.every((r,a)=>{let s=o[a];switch(r.kind){case"text":return s?.kind==="text"&&s.textSig.value===r.textSig.value;case"reasoning":return s?.kind==="reasoning"&&s.textSig.value===r.textSig.value;case"step-start":return s?.kind==="step-start";case"tool":return s?.kind==="tool"&&s.toolCallId===r.toolCallId&&Jo(s.toolName,r.toolName);case"file":return s?.kind==="file"&&s.url===r.url&&s.mediaType===r.mediaType;case"source":return s?.kind==="source"&&s.sourceId===r.sourceId&&s.url===r.url&&s.title===r.title&&s.filename===r.filename&&s.mediaType===r.mediaType;default:return r}})}function Jo(e,t){let n=e.startsWith("tool:")?e.slice(5):e,o=t.startsWith("tool:")?t.slice(5):t;return n===o}var bl={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Ra(e,t){let n=new Map(e.partsSig.value.filter(Sn).map(o=>[o.toolCallId,o]));return t.partsSig.value.filter(Sn).some(o=>{let r=n.get(o.toolCallId);if(!r||bl[o.stateSig.value]>bl[r.stateSig.value])return!0;let a=o.approvalSig.value?.approved;return a!==void 0&&a!==r.approvalSig.value?.approved})}function Qt(e){return e.role==="assistant"&&e.status!=="streaming"&&!Dt(e)}function Qo(e,t){if(!e.includes(t)||t.retryAction===null)return;if(t.retryAction)return t.retryAction;if(t!==e.at(-1)||t.role!=="assistant"||t.serverMessageId===void 0||t.status!=="error"&&!Qt(t))return;let n=e.indexOf(t);for(let o=n-1;o>=0;o--){let r=e[o];if(r?.role==="user"&&!r.ephemeral)return{kind:"repeat-user",messageId:r.id}}}function Tl(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!Gp(e)}function Il(e,t){return e.operatorRoutedTurn?Qt(e)?"drop":"complete-operator-routed":t||Qt(e)?"error":"complete"}function Xp(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:Q(e.text),doneSig:Q(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartialSig:Q(e.inputPartial),inputSig:Q(e.input),outputSig:Q(e.output),errorSig:Q(e.error),stateSig:Q(e.state),approvalSig:Q(e.approval)}:e}function Yp(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,text:e.textSig.value,done:e.doneSig.value}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartial:e.inputPartialSig.value,input:e.inputSig.value,output:e.outputSig.value,error:e.errorSig.value,state:e.stateSig.value,approval:e.approvalSig.value}:e}var El=X.scope("feedback:audio"),Zo=class{constructor(){te(this,"ctx",null);te(this,"master",null);te(this,"buffers",new Map)}unlock(){if(this.ctx){this.ctx.state==="suspended"&&this.ctx.resume();return}let t=globalThis.AudioContext??globalThis.webkitAudioContext;if(t)try{this.ctx=new t,this.master=this.ctx.createGain(),this.master.gain.value=1,this.master.connect(this.ctx.destination)}catch(n){El.warn("AudioContext init failed",{err:n})}}setVolume(t){if(!this.master||!this.ctx)return;let n=Math.max(0,Math.min(1,t));this.master.gain.setTargetAtTime(n,this.ctx.currentTime,.01)}playTone(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((s,l)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=s;let u=n.createGain(),_=r+l*a;u.gain.setValueAtTime(1e-4,_),u.gain.exponentialRampToValueAtTime(t.peakGain,_+.005),u.gain.exponentialRampToValueAtTime(1e-4,_+a),c.connect(u).connect(o),c.start(_),c.stop(_+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=await this.getBuffer(t);if(!r)return;let a=n.createBufferSource();a.buffer=r,a.connect(o),a.start()}destroy(){this.ctx&&this.ctx.close().catch(()=>{}),this.ctx=null,this.master=null,this.buffers.clear()}async getBuffer(t){if(!this.ctx)return null;let n=this.buffers.get(t);if(n)return n instanceof Promise,n;let o=this.ctx,r=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>o.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(El.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,r),r}};var Al={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Ml={messageReceived:{notes:[880,1318.51],noteMs:90,type:"sine",peakGain:.45},messageSent:{notes:[1568],noteMs:60,type:"sine",peakGain:.25},error:{notes:[523.25,392],noteMs:120,type:"triangle",peakGain:.55},voiceStart:{notes:[1318.51],noteMs:50,type:"sine",peakGain:.3},voiceStop:{notes:[880],noteMs:50,type:"sine",peakGain:.3}};var $t=null,er=0;function Jp(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function Qp(){if(typeof document>"u")return null;let e=document.createElement("input");e.type="checkbox",e.setAttribute("switch",""),e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e.id=`__${w.cssPrefix}_haptic_${Math.random().toString(36).slice(2)}`;let t=document.createElement("label");t.htmlFor=e.id,t.setAttribute("aria-hidden","true");let n="position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;opacity:0!important;pointer-events:none!important;";return e.style.cssText=n,t.style.cssText=n,document.body.append(e,t),{input:e,label:t}}function Ll(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Jp())try{navigator.vibrate(e);return}catch{}if($t||($t=Qp()),!!$t)try{$t.label.click()}catch{}}}function Ol(){er++;let e=!1;return()=>{e||(e=!0,er=Math.max(0,er-1),er===0&&$t&&($t.input.remove(),$t.label.remove(),$t=null))}}var Zp=X.scope("feedback"),ef=100,tr=class{constructor(t,n){te(this,"mutedSig",Q(!1));te(this,"audio",new Zo);te(this,"releaseHaptics");te(this,"sound");te(this,"haptics");te(this,"lastPlayed",new Map);te(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=Ol(),this.audio.setVolume(this.effectiveVolume()),typeof matchMedia<"u"&&(this.reducedMotionMq=matchMedia("(prefers-reduced-motion: reduce)"))}unlock(){this.audio.unlock(),this.audio.setVolume(this.effectiveVolume())}update(t,n){this.sound=t,this.haptics=n,this.audio.setVolume(this.effectiveVolume())}setMuted(t){this.mutedSig.value!==t&&(this.mutedSig.value=t)}toggleMuted(){this.mutedSig.value=!this.mutedSig.value}play(t){this.mutedSig.value||this.isDeduped(t)||(this.lastPlayed.set(t,performance.now()),this.sound.enabled&&this.playSound(t),this.haptics.enabled&&this.isTouchDevice()&&this.playHaptic(t))}destroy(){this.audio.destroy(),this.releaseHaptics()}isDeduped(t){let n=this.lastPlayed.get(t);return n===void 0?!1:performance.now()-n<ef}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(r=>Zp.warn("audio play failed",{err:r,url:n}));return}let o=Ml[t];o&&this.audio.playTone(o)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let o=n===!0||n===void 0?Al[t]:n;Ll(o)}effectiveVolume(){let t=this.sound.volume??.3;return this.reducedMotionMq?.matches?t*.5:t}isTouchDevice(){return typeof window>"u"?!1:matchMedia("(hover: none) and (pointer: coarse)").matches}};var tf=0;function i(e,t,n,o,r,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?s=t[l]:c[l]=t[l];var u={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--tf,__i:-1,__u:0,__source:r,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return J.vnode&&J.vnode(u),u}var j={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},Qn=`${w.cssPrefix}-icon-dir`,La=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),ft=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M18 6 6 18M6 6l12 12"})}),Nl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M12 5v14M5 12h14"})}),Dl=()=>i("svg",{...j,class:Qn,"aria-hidden":"true",children:[i("path",{d:"m22 2-7 20-4-9-9-4Z"}),i("path",{d:"M22 2 11 13"})]}),$l=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Fl=()=>i("svg",{...j,class:Qn,"aria-hidden":"true",children:i("path",{d:"M3 20V4l18 8-18 8Z"})}),kn=()=>i("svg",{...j,class:Qn,"aria-hidden":"true",children:i("path",{d:"m9 18 6-6-6-6"})}),Bl=()=>i("svg",{...j,"aria-hidden":"true",children:i("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Hl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"m21 11-9 9a5.5 5.5 0 0 1-7.78-7.78l8.49-8.49a3.67 3.67 0 0 1 5.19 5.19l-8.49 8.49a1.83 1.83 0 0 1-2.6-2.6l7.78-7.78"})}),Ul=()=>i("svg",{...j,"aria-hidden":"true",children:[i("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),i("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),zl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),ql=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Wl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),Vl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),Gl=()=>i("svg",{...j,"aria-hidden":"true",viewBox:"0 0 10 10",children:i("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),Kl=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),jl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),Xl=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),Yl=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),i("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),Jl=()=>i("svg",{...j,class:Qn,"aria-hidden":"true",children:i("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),tn=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M20 6 9 17l-5-5"})}),Ql=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M3 3v6h6"}),i("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),i("path",{d:"M12 7v5l3 2"})]}),Zl=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M2 12h20"}),i("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),Zn=()=>i("svg",{...j,class:Qn,"aria-hidden":"true",children:i("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),ec=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M12 20h9"}),i("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),nn=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"m6 9 6 6 6-6"})}),tc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),i("path",{d:"M14 2v6h6"})]}),nf=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),i("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),Oa=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),eo=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i("path",{d:"M12 17h.01"})]}),of=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"m15 4 3 3-9 9-3-3z"}),i("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),rf=()=>i("svg",{...j,"aria-hidden":"true",children:[i("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),i("path",{d:"M12 8V4"}),i("circle",{cx:"12",cy:"3",r:"1"}),i("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),Na=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),i("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),i("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),i("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),af=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"m4.93 4.93 4.24 4.24M14.83 14.83l4.24 4.24M14.83 9.17l4.24-4.24M4.93 19.07l4.24-4.24"})]}),Da=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"11",cy:"11",r:"7"}),i("path",{d:"m21 21-4.3-4.3"})]}),nc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),oc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M3 9.5 12 3l9 6.5"}),i("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),rc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"m3 11 15-5v12L3 13z"}),i("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),i("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),i("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),to=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),i("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),ac=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"4"}),i("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),ic=()=>i("svg",{...j,"aria-hidden":"true",children:i("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),sc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 3v18"}),i("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),sf=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),i("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),i("path",{d:"m20 20-4.4-4.4"})]}),lf=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M12 3.5 13.6 9 19 10.5 13.6 12 12 17.5 10.4 12 5 10.5 10.4 9z"}),i("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),cf=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M4 18h16"}),i("path",{d:"M5 18a7 7 0 0 1 14 0"}),i("path",{d:"M12 8V6"}),i("path",{d:"M10 6h4"})]}),df=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),i("path",{d:"M16 9.5a1.5 1.5 0 0 1 3 0v2.5a7 7 0 0 1-7 7 7 7 0 0 1-6.4-4.2L4 12.5a1.5 1.5 0 0 1 2.6-1.5L7 11"})]}),lc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),i("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]}),cc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),i("path",{d:"M7 10l4-7a2.5 2.5 0 0 1 2.5 2.5V8h5a2 2 0 0 1 2 2.3l-1.2 8A2 2 0 0 1 17.3 20H7"})]}),dc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),i("path",{d:"M17 14l-4 7a2.5 2.5 0 0 1-2.5-2.5V16h-5a2 2 0 0 1-2-2.3l1.2-8A2 2 0 0 1 6.7 4H17"})]}),uc=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"3.5"}),i("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M19.1 4.9l-2.1 2.1M7 17l-2.1 2.1"})]}),_c=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 7v5l3 2"})]}),nr=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),or=()=>i("svg",{...j,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m15 9-6 6M9 9l6 6"})]}),pc={chat:La,message:Oa,bubbles:to,spark:nf,wand:of,bot:rf,help:eo,lifebuoy:af,headset:Na,search:sf,sparkles:lf,concierge:cf,wave:df};var $=w.cssPrefix,R={launcher:`${$}-launcher`,callout:`${$}-callout`,calloutDismiss:`${$}-callout-dismiss`,panel:`${$}-panel`,panelHeader:`${$}-panel-header`,resizeGrip:`${$}-resize-grip`,scrollToBottom:`${$}-scroll-to-bottom`,loadPreviousMessages:`${$}-load-previous-messages`,actionHistory:`${$}-action-history`,actionClose:`${$}-action-close`,langSegment:`${$}-lang-segment`,composer:`${$}-composer`,composerInput:`${$}-composer-input`,composerSend:`${$}-composer-send`,composerStop:`${$}-composer-stop`,composerAttach:`${$}-composer-attach`,composerFileInput:`${$}-composer-file-input`,composerVoice:`${$}-composer-voice`,attachmentChip:`${$}-attachment-chip`,attachmentRemove:`${$}-attachment-remove`,suggestion:`${$}-suggestion`,messageBubble:`${$}-message`,messageRetry:`${$}-message-retry`,messageFeedback:`${$}-message-feedback`,feedbackUp:`${$}-feedback-up`,feedbackDown:`${$}-feedback-down`,messageCopy:`${$}-message-copy`,historyPane:`${$}-history-pane`,historyBack:`${$}-history-back`,historyItem:`${$}-history-item`,historyLoadMore:`${$}-history-load-more`,sidebar:`${$}-sidebar`,sidebarToggle:`${$}-sidebar-toggle`,sidebarNewConversation:`${$}-sidebar-new-conversation`,sidebarItem:`${$}-sidebar-item`,messengerHome:`${$}-messenger-home`,modulesEmpty:`${$}-modules-empty`,tab:`${$}-tab`,tabBadge:`${$}-tab-badge`,homeView:`${$}-home-view`,homeGreeting:`${$}-home-greeting`,homeBrand:`${$}-home-brand`,backHeader:`${$}-back-header`,contentView:`${$}-content-view`,contentScroll:`${$}-content-scroll`,homeSearch:`${$}-home-search`,helpSearch:`${$}-help-search`,homeRecent:`${$}-home-recent`,homeContentRow:`${$}-home-content-row`,helpArticle:`${$}-help-article`,newsItem:`${$}-news-item`,formGate:`${$}-form-gate`,formDone:`${$}-form-done`,formDoneToggle:`${$}-form-done-toggle`,formAnswers:`${$}-form-answers`,formFill:`${$}-form-fill`,formSubmit:`${$}-form-submit`,formSkip:`${$}-form-skip`,formField:`${$}-form-field`,toolAskQuestions:`${$}-tool-ask-questions`,toolInputSubmit:`${$}-tool-input-submit`,toolInputSkip:`${$}-tool-input-skip`,toolApproval:`${$}-tool-approval`,toolApprove:`${$}-tool-approve`,toolReject:`${$}-tool-reject`,toolEdit:`${$}-tool-edit`,toolDecision:`${$}-tool-decision`,typingDots:`${$}-typing-dots`,reasoning:`${$}-reasoning`,toolAskSummary:`${$}-ask-questions-summary`,toolAskOptions:`${$}-ask-questions-options-toggle`,toolCall:`${$}-tool-call`,source:`${$}-source`,operatorRequest:`${$}-operator-request`,operatorBanner:`${$}-operator-banner`,cancelOperatorRequest:`${$}-cancel-operator-request`};function Ge(e,t){return`${e}-${t}`}var rr=w.cssPrefix;function fc({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:r}){let a=t.variant!=="circle"&&!!t.label;return i("button",{type:"button",class:`${rr}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":r?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":R.launcher,onClick:e,"aria-label":n.launcherOpen,children:[uf(t.icon),a?i("span",{class:`${rr}-fab-label`,children:Ze(n,t.label??"")}):null]})}function uf(e){let t=pc[e];return t?i(t,{}):i(_f,{source:e})}function _f({source:e}){return i("span",{ref:t=>{t&&pf(t,e)},"aria-hidden":"true"})}function pf(e,t){if(e.dataset.svgMounted!==t)try{let o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;o&&o.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(o,!0)),e.dataset.svgMounted=t)}catch{}}function mc({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:r}){let[a,s]=D(!1);return E(()=>{let l=setTimeout(()=>s(!0),e.delayMs);return()=>clearTimeout(l)},[e.delayMs]),E(()=>{if(!a||e.autoDismissMs<=0)return;let l=setTimeout(r,e.autoDismissMs);return()=>clearTimeout(l)},[a,e.autoDismissMs,r]),a?i("div",{class:`${rr}-callout`,role:"status","data-shape":e.shape,"data-position":ff(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":R.callout,children:[i("span",{children:Ze(n,e.text)}),i("button",{type:"button",class:`${rr}-callout-close`,onClick:r,"aria-label":o,title:o,"data-testid":R.calloutDismiss,children:i(ft,{})})]}):null}function ff(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function ar({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:r,strings:a}){let s=w.cssPrefix,l=M(null);if(E(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${s}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${s}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${s}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${s}-resize-max-h`,t.maxHeight),o&&(m.setProperty(`--${s}-widget-w`,`${o.width}px`),m.setProperty(`--${s}-widget-h`,`${o.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,s,o]),!e)return null;let c=n.startsWith("top-"),u=n.endsWith("-right"),_=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${u?"left":"right"}`,p=m=>{if(!e)return;let g=m.currentTarget,h=e.getBoundingClientRect();l.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:h.width,startH:h.height,dirX:u?-1:1,dirY:c?1:-1},g.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()},d=m=>{let g=l.current;if(!g||m.pointerId!==g.pointerId||!e)return;let h=(m.clientX-g.startX)*g.dirX,P=(m.clientY-g.startY)*g.dirY;e.style.setProperty(`--${s}-widget-w`,`${g.startW+h}px`),e.style.setProperty(`--${s}-widget-h`,`${g.startH+P}px`)},f=m=>{let g=l.current;if(!g||m.pointerId!==g.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let h=e.getBoundingClientRect();r({width:Math.round(h.width),height:Math.round(h.height)}),l.current=null};return i("div",{class:_,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:p,onPointerMove:d,onPointerUp:f,onPointerCancel:f,"data-testid":R.resizeGrip,children:i(Gl,{})})}var on=w.cssPrefix,mf=`.${on}-header, .${on}-back-header, .${on}-home-hero`,gf='button, a, input, textarea, select, [role="tab"], [contenteditable]',gc=56;function ir(e,t){E(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,u)=>Math.min(u,Math.max(-u,c)),r=null,a=c=>{let u=c.target;if(!(u instanceof Element)||!u.closest(mf)||u.closest(gf))return;let _=e.getBoundingClientRect();r={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${on}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${on}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-gc,maxY:(window.innerHeight+_.height)/2-gc},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!r||c.pointerId!==r.id)return;let u=o(r.dx+c.clientX-r.x,r.maxX),_=o(r.dy+c.clientY-r.y,r.maxY);e.style.setProperty(`--${on}-modal-dx`,`${u}px`),e.style.setProperty(`--${on}-modal-dy`,`${_}px`)},l=c=>{!r||c.pointerId!==r.id||(r=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",s),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)}},[e,t])}function no(e,t,n){switch(e){case"clear":case"sound":case"history":case"language":case"theme":case"textSize":return!0;case"expand":return t==="floating";case"fullscreen":return t!=="standalone";case"close":return t==="standalone"||t==="page"?!1:t==="inline"?n==="fullscreen":!0}}function sr(e,t,n){return no("close",e,t)?n.includes("close"):!1}function vc(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var vf='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function lr(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(vf)].filter(l=>l.offsetParent!==null||l===document.activeElement);if(o.length===0){n.preventDefault();return}let r=o[0],a=o[o.length-1];if(!r||!a)return;let s=e.getRootNode().activeElement;n.shiftKey&&s===r?(n.preventDefault(),a.focus()):!n.shiftKey&&s===a&&(n.preventDefault(),r.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function cr(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var $a=w.cssPrefix;function hc({agent:e,strings:t}){let n=e.status??"online",o=Ze(t,e.name),r=e.title?Ze(t,e.title):null;return i("div",{class:`${$a}-agent`,children:[i("div",{class:`${$a}-agent-avatar`,"data-status":n,children:e.avatar?i("img",{src:e.avatar,alt:""}):i("span",{children:cr(o)})}),i("div",{class:`${$a}-agent-meta`,children:[i("strong",{children:o}),r?i("span",{children:r}):null]})]})}var bc=X.scope("attachments");function dr(e,t,n){let o=bf(e),r=[],a=[],s=xf(n.accept),l=t.reduce((u,_)=>u+_.size,0),c=t.length;for(let u of o){let _=hf(u,c,l,n,s);if(_){a.push({file:u,reason:_});continue}r.push(Pf(u)),l+=u.size,c+=1}return(r.length||a.length)&&bc.debug("ingest",{accepted:r.length,rejected:a.map(u=>({name:u.file.name,reason:u.reason}))}),{accepted:r,rejected:a}}function ur(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){bc.debug("revokeObjectURL failed",{error:t})}}function hf(e,t,n,o,r){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":Sf(e,r)?null:"mime"}function bf(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:yf(t)).filter(t=>t!==null):[]}function yf(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function Pf(e){return{file:e,id:at(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function xf(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",o="*"]=t.split("/");return{kind:"mime",type:n,subtype:o}})}function Sf(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),r=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?r.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var oo=w.cssPrefix;function yc({attachment:e,onRemove:t,disabled:n=!1}){let o=e.mediaType.startsWith("image/");return i("span",{class:`${oo}-attachment-chip`,title:e.name,"data-testid":Ge(R.attachmentChip,e.id),children:[o?i("img",{class:`${oo}-attachment-thumb`,src:e.previewUrl,alt:""}):i("span",{class:`${oo}-attachment-thumb`,"aria-hidden":"true",children:i(tc,{})}),i("span",{class:`${oo}-attachment-name`,children:e.name}),i("button",{type:"button",class:`${oo}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":Ge(R.attachmentRemove,e.id),children:i(ft,{})})]})}var Fa={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function Ba(e,t,n){return e==="disabled"?Fa:e==="server"?Rf(n):kf(t)}function kf(e){let t=wf();if(!t)return Fa;let n=null,o=0;return{isSupported:!0,start(r,a){let s=n,l=++o;n=null,s?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let u=!1;c.addEventListener("result",p=>{if(o!==l||n!==c)return;let d=p,f="",m=!1;for(let g=d.resultIndex;g<d.results.length;g++){let h=d.results[g];h&&(f+=h[0].transcript,h.isFinal&&(m=!0))}r(f,m)});let _=()=>{u||o!==l||n!==c||(u=!0,n=null,a())};c.addEventListener("end",_),c.addEventListener("error",_);try{c.start()}catch{_()}},stop(){n?.stop()},cancel(){o++;let r=n;n=null,r?.abort()}}}function wf(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Cf=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Rf(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Fa;let t=0,n=null,o=s=>{for(let l of s.stream?.getTracks()??[])l.stop();s.stream=null},r=()=>{t++;let s=n;n=null,s&&(o(s),s.recorder?.state!=="inactive"&&s.recorder?.stop())},a=async s=>{if(s.finishing)return;s.finishing=!0;let l=s.recorder?.mimeType??"audio/webm";o(s);let c=new Blob(s.chunks,{type:l});s.chunks=[];try{let{text:u}=await e(c,l);n===s&&t===s.generation&&u&&s.onText(u,!0)}catch{}finally{n===s&&t===s.generation&&(n=null,s.onEnd())}};return{isSupported:!0,async start(s,l){r();let c={generation:t,recorder:null,stream:null,chunks:[],onText:s,onEnd:l,finishing:!1};n=c;try{let u=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let d of u.getTracks())d.stop();return}c.stream=u;let _=Tf(),p=new MediaRecorder(u,_?{mimeType:_}:void 0);c.recorder=p,p.addEventListener("dataavailable",d=>{n===c&&t===c.generation&&d.data.size>0&&c.chunks.push(d.data)}),p.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),p.start()}catch{o(c),n===c&&t===c.generation&&(n=null,l())}},stop(){let s=n;if(s){if(!s.recorder){r();return}s.recorder.state!=="inactive"&&s.recorder.stop()}},cancel(){r()}}}function Tf(){for(let e of Cf)if(MediaRecorder.isTypeSupported(e))return e}var ot=w.cssPrefix,wn=X.scope("composer");function Cn(e){return e.reduce((t,n)=>t+n.size,0)}var If={arrowUp:$l,paperPlane:Dl,send:Fl,chevron:kn};function Pc(e){return"activeElement"in e}function Ef(e){return"host"in e&&"activeElement"in e}function xc({options:e,transport:t,feedback:n,bus:o,persistence:r,conversationId:a,isStreaming:s,active:l=!0,isPreparing:c=!1,operatorRequestEnabled:u,canRequestOperator:_=!1,controlMode:p,onRequestOperator:d,onSend:f,onStop:m,attachApiRef:g}){let h=e.strings,[P,x]=D(()=>r.loadDraft(a)),[b,y]=D([]),[k,C]=D(!1),[B,G]=D(!1),U=M(!1),I=M(null),z=M(null),W=M(null),L=M(0),ne=M(a);ne.current=a;let re=M(l);re.current=l;let le=M(c);le.current=c;let Ae=B||c||!l,de=O(H=>{x(K=>{let Y=typeof H=="function"?H(K):H;return Y===K?K:(r.saveDraft(ne.current,Y),Y)})},[r]),_e=e.features.fileUpload,Me=e.features.voice,[N,ve]=D(()=>Ba(Me,e.locale,(H,K)=>t.transcribe(H,K))),ae=M(N);ae.current=N;let De=M({mode:Me,locale:e.locale,transport:t});E(()=>{let H=De.current;H.mode===Me&&H.locale===e.locale&&H.transport===t||(De.current={mode:Me,locale:e.locale,transport:t},L.current++,ae.current.cancel(),W.current=null,C(!1),ve(Ba(Me,e.locale,(K,Y)=>t.transcribe(K,Y))))},[e.locale,Me,t]),E(()=>()=>{L.current++,N.cancel()},[N]);let xe=O(H=>{let K=W.current;if(K===null)return!1;let Y=Date.now()-K;return wn[H]("voiceStop",{durationMs:Y}),o.emit("voiceStop",{durationMs:Y}),W.current=null,!0},[o]),Te=O(()=>{W.current!==null&&(N.stop(),C(!1),xe("info")&&n.play("voiceStop"))},[xe,n,N]),Ce=O(()=>{L.current++,N.cancel(),C(!1),xe("info")&&n.play("voiceStop")},[xe,n,N]);E(()=>{(c||!l)&&Ce()},[l,Ce,c]),E(()=>{let H=I.current;if(!H)return;let K=H.getRootNode(),Y=Pc(K)?K.activeElement:null;Y&&H.closest(`.${ot}-panel`)?.contains(Y)||H.focus({preventScroll:!0})},[]),E(()=>{let H=I.current;if(!H)return;if(P.length===0){H.style.height="";return}H.style.height="auto";let K=getComputedStyle(H),Y=Number.parseFloat(K.getPropertyValue(`--${ot}-textarea-base-height`)),pe=Number.parseFloat(K.borderTopWidth)+Number.parseFloat(K.borderBottomWidth),S=Math.min(H.scrollHeight+pe,Number.parseFloat(K.maxHeight)),q=Number.parseFloat(K.fontSize)*.7;H.style.height=`${S<Y+q?Y:S}px`},[P]);let Le=M(b);Le.current=b,E(()=>()=>Le.current.forEach(ur),[]),E(()=>{if(g)return g.current={attachFromDrop:H=>{if(!_e||!re.current||U.current||le.current)return;let K=dr(H,Le.current,e.attachments);K.accepted.length!==0&&(wn.info("attach (drop)",{count:K.accepted.length,totalBytes:Cn(K.accepted)}),o.emit("attach",{count:K.accepted.length,totalBytes:Cn(K.accepted)}),y(Y=>[...Y,...K.accepted]))},fill:H=>{if(!re.current||U.current||le.current)return;de(H);let K=I.current;K&&(K.focus({preventScroll:!0}),requestAnimationFrame(()=>K.setSelectionRange(K.value.length,K.value.length)))}},()=>{g.current&&(g.current=null)}},[g,_e,c,e.attachments,de]),E(()=>{let H=I.current;if(!H)return;let K=H.closest(`.${ot}-panel`);if(!K)return;let Y=pe=>{if(!re.current||U.current||le.current)return;let S=pe.clipboardData;if(!S)return;let q=pe.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(q&&q!==H)return;if(_e){let ie=dr(S.items,Le.current,e.attachments);if(ie.accepted.length>0){pe.preventDefault(),wn.info("attach (paste)",{count:ie.accepted.length,totalBytes:Cn(ie.accepted)}),o.emit("attach",{count:ie.accepted.length,totalBytes:Cn(ie.accepted)}),y(Pe=>[...Pe,...ie.accepted]);return}}if(q===H)return;let ye=S.getData("text/plain");ye&&(pe.preventDefault(),de(ie=>ie+ye),H.focus())};return K.addEventListener("paste",Y),()=>K.removeEventListener("paste",Y)},[_e,e.attachments,de]);let he=async()=>{let H=P.trim();if(!H&&b.length===0||!l||s||U.current||c)return;Ce(),U.current=!0,G(!0);let K=P,Y=b;try{await f(H,Y)&&(de(pe=>pe===K?"":pe),y(pe=>pe!==Y?pe:(Y.forEach(ur),Le.current=[],[])))}finally{U.current=!1,G(!1),requestAnimationFrame(()=>{let pe=I.current;if(!pe||pe.disabled||!re.current)return;let S=pe.getRootNode(),q=Pc(S)?S.activeElement:null,ye=q?.getAttribute("data-testid");if(!(q&&q!==pe&&ye!==R.composerSend&&ye!==R.composerStop)){if(Ef(S)){let ie=S.host.ownerDocument;if(!ie.hasFocus())return;let Pe=ie.activeElement;if(Pe&&Pe!==S.host&&Pe!==ie.body)return}pe.focus({preventScroll:!0})}})}},Se=H=>{H.key!=="Enter"||H.shiftKey||H.isComposing||(H.preventDefault(),s?m():he())},Ie=H=>{let K=H.target;if(!l||U.current||c){K.value="";return}let Y=dr(K.files,b,e.attachments);Y.accepted.length>0&&(wn.info("attach (file picker)",{count:Y.accepted.length,totalBytes:Cn(Y.accepted)}),o.emit("attach",{count:Y.accepted.length,totalBytes:Cn(Y.accepted)}),y(pe=>[...pe,...Y.accepted])),K.value=""},Je=H=>{!l||U.current||c||(wn.info("removeAttachment",{id:H}),o.emit("removeAttachment",{id:H}),y(K=>{let Y=K.find(pe=>pe.id===H);return Y&&ur(Y),K.filter(pe=>pe.id!==H)}))},Qe=()=>{if(k){Te();return}if(!l||!N.isSupported||U.current||c)return;let H=++L.current;W.current=Date.now(),wn.info("voiceStart"),o.emit("voiceStart",void 0),C(!0),n.play("voiceStart"),N.start((K,Y)=>{L.current!==H||!re.current||le.current||U.current||!Y||de(pe=>`${pe}${K} `)},()=>{L.current!==H||!re.current||(C(!1),xe("debug"))})},ze=If[e.composer.sendButton.icon];return i("div",{class:`${ot}-composer`,"data-testid":R.composer,children:[b.length>0?i("div",{class:`${ot}-attachments`,children:b.map(H=>i(yc,{attachment:H,onRemove:()=>Je(H.id),disabled:Ae},H.id))}):null,i("div",{class:`${ot}-composer-row`,children:[i("div",{class:`${ot}-composer-actions`,children:[_e?i("button",{type:"button",class:`${ot}-icon-btn`,onClick:()=>z.current?.click(),disabled:Ae,"aria-label":h.attach,"data-testid":R.composerAttach,children:i(Hl,{})}):null,N.isSupported?i("button",{type:"button",class:`${ot}-icon-btn`,onClick:Qe,disabled:Ae,"aria-label":k?h.micStop:h.micStart,"aria-pressed":k,"data-recording":k?"true":void 0,"data-testid":R.composerVoice,children:i(Ul,{})}):null]}),i("textarea",{ref:I,name:"message",class:`${ot}-textarea`,rows:1,value:P,placeholder:h.composerPlaceholder,onInput:H=>de(H.currentTarget.value),onKeyDown:Se,disabled:Ae,"aria-label":h.composerPlaceholder,"data-testid":R.composerInput}),s?i("button",{type:"button",class:`${ot}-send`,onClick:m,disabled:Ae,"aria-label":h.stop,"data-testid":R.composerStop,children:i(Bl,{})}):i("button",{type:"button",class:`${ot}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{he()},disabled:Ae||!P.trim()&&b.length===0,"aria-label":h.send,"data-testid":R.composerSend,children:i(ze,{})}),u&&p==="ai-agent"&&d?i("button",{type:"button",class:`${ot}-icon-btn`,onClick:d,disabled:Ae||!_,"aria-label":h.talkToOperator,title:h.talkToOperator,"data-testid":R.operatorRequest,children:i(Na,{})}):null]}),i("input",{ref:z,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:Ie,disabled:Ae,class:`${ot}-sr-only`,"data-testid":R.composerFileInput})]})}var Af=w.cssPrefix;function Sc({visible:e,strings:t}){return e?i("div",{class:`${Af}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function _r({containerRef:e,onDrop:t,disabled:n=!1}){let[o,r]=D(!1);return E(()=>{if(n){r(!1);return}let a=e.current;if(!a)return;let s=0,l=p=>{s+=1,p.dataTransfer?.types.includes("Files")&&(p.preventDefault(),r(!0))},c=()=>{s-=1,!(s>0)&&(s=0,r(!1))},u=p=>{p.dataTransfer?.types.includes("Files")&&p.preventDefault()},_=p=>{s=0,r(!1),p.dataTransfer&&(p.preventDefault(),t(p.dataTransfer.items))};return a.addEventListener("dragenter",l),a.addEventListener("dragleave",c),a.addEventListener("dragover",u),a.addEventListener("drop",_),()=>{a.removeEventListener("dragenter",l),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",u),a.removeEventListener("drop",_)}},[e,n,t]),{visible:n?!1:o}}function kc({itemCount:e,initialFocusIndex:t}){let[n,o]=D(!1),r=M(null),a=M(null),[s,l]=D(-1),c=O(()=>{o(!1),l(-1),r.current?.focus()},[]),u=O(()=>o(d=>!d),[]);E(()=>{if(!n)return;let d=f=>{let m=a.current,g=r.current;if(!m||!g)return;let h=f.composedPath();h.includes(m)||h.includes(g)||(o(!1),l(-1))};return document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[n]),E(()=>{if(!n||e===0)return;let d=t?.()??0,f=d<0||d>=e?0:d;l(f)},[n,e,t]),E(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let _=O(d=>{(d.key==="ArrowDown"||d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o(!0))},[]),p=O(d=>{if(e!==0)switch(d.key){case"Escape":d.preventDefault(),c();return;case"ArrowDown":d.preventDefault(),l(f=>(f+1)%e);return;case"ArrowUp":d.preventDefault(),l(f=>(f-1+e)%e);return;case"Home":d.preventDefault(),l(0);return;case"End":d.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:r,menuRef:a,toggle:u,close:c,onTriggerKey:_,onMenuKey:p}}function wc({items:e,triggerLabel:t}){let n=w.cssPrefix,o=kc({itemCount:e.length}),r=l=>{l.disabled||(l.onSelect?.(),l.keepOpen||o.close())},a=(l,c)=>l.onSelectValue?.(c),s=(l,c)=>{let u=c.segments;if(!u?.length)return;let _=Math.max(0,u.findIndex(d=>d.value===c.value)),p=-1;if(l.key==="ArrowRight"||l.key==="Enter"||l.key===" ")p=(_+1)%u.length;else if(l.key==="ArrowLeft")p=(_-1+u.length)%u.length;else return;l.preventDefault(),l.stopPropagation(),a(c,u[p].value)};return i("div",{class:`${n}-menu-wrap`,children:[i("button",{ref:o.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":o.open,title:t,onClick:o.toggle,onKeyDown:o.onTriggerKey,children:i(Kl,{})}),o.open?i("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(l=>l.segments?i("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":l.label,tabIndex:-1,onKeyDown:c=>s(c,l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),i("span",{class:`${n}-segmented`,role:"group","aria-label":l.label,children:l.segments.map(c=>{let u=c.value===l.value;return i("button",{type:"button",role:"menuitemradio","aria-checked":u,class:`${n}-segment`,"data-on":u?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${R.langSegment}-${c.value}`,onClick:()=>a(l,c.value),children:c.label},c.value)})})]},l.id):i("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":l.type==="switch"?l.on:void 0,disabled:l.disabled,onClick:()=>r(l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),l.type==="switch"&&l.on?i("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:i(tn,{})}):null]},l.id))}):null]})}var Ha=w.cssPrefix;function Mf(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var Lf={normal:"large",large:"small",small:"normal"};function Of(e){return e==="light"?i(ac,{}):e==="dark"?i(ic,{}):i(sc,{})}function Nf(e){return(e.split("-")[0]??e).toUpperCase()}function mt({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:r,onClose:a,onClear:s,onExpand:l,onFullscreen:c,onSoundToggle:u}=e,{onToggleHistory:_,onLocaleChange:p,onThemeChange:d,onTextSizeChange:f}=e,m=n.strings,g=n.mode,h=t==="chat",P=_t(()=>r.mutedSig.value).value,x=new Set(n.actions),b=L=>x.has(L),y=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,k=L=>y?!1:no(L,g,o),C=n.themeMode,B={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark},G=n.textSize,U={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},I=[];if(h&&b("clear")&&I.push({id:"clear",icon:i(ec,{}),label:m.newConversation,onSelect:s}),b("expand")&&k("expand")){let L=o==="expanded";I.push({id:"expand",icon:L?i(ql,{}):i(zl,{}),label:L?m.collapse:m.expand,type:"switch",on:L,onSelect:l})}if(b("fullscreen")&&k("fullscreen")){let L=o==="fullscreen";I.push({id:"fullscreen",icon:L?i(Vl,{}):i(Wl,{}),label:L?m.exitFullscreen:m.fullscreen,type:"switch",on:L,onSelect:c})}h&&b("sound")&&I.push({id:"sound",icon:P?i(Xl,{}):i(jl,{}),label:P?m.soundOff:m.soundOn,type:"switch",on:!P,onSelect:u}),b("theme")&&I.push({id:"theme",icon:Of(C),label:`${m.theme}: ${B[C]}`,onSelect:()=>d(Mf(C)),keepOpen:!0}),b("textSize")&&I.push({id:"textSize",icon:i(Yl,{}),label:`${m.textSize}: ${U[G]}`,onSelect:()=>f(Lf[G]),keepOpen:!0}),b("language")&&n.availableLocales.length>1&&I.push({id:"language",icon:i(Zl,{}),label:m.language,segments:n.availableLocales.map(L=>({value:L,label:Nf(L),lang:L})),value:n.locale,onSelectValue:p});let z=!!a&&sr(g,o,n.actions),W=h&&b("history");return i("div",{class:`${Ha}-header-actions`,children:[W?i("button",{type:"button",class:`${Ha}-icon-btn`,onClick:_,"aria-label":m.history,title:m.history,"data-testid":R.actionHistory,children:i(Ql,{})}):null,I.length>0?i(wc,{items:I,triggerLabel:m.moreActions}):null,z?i("button",{type:"button",class:`${Ha}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":R.actionClose,children:i(ft,{})}):null]})}var Df=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,$f=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Ff=/^[+]?[\d\s().-]{6,}$/;function Rn(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function Bf(e){return Array.isArray(e)?e.length:e&&e.trim()?1:0}function Hf(e,t,n){let o=e.required??!0,r=e.validation;if(e.type==="multiselect"){let s=Bf(t);return o&&s===0?n.formRequired:s===0?void 0:r?.minSelections!=null&&s<r.minSelections?Rn(n.formChooseAtLeast,{min:r.minSelections}):r?.maxSelections!=null&&s>r.maxSelections?Rn(n.formChooseAtMost,{max:r.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!Df.test(a))return n.formInvalidEmail;break;case"url":if(!$f.test(a))return n.formInvalidUrl;break;case"tel":if(!Ff.test(a))return n.formInvalidTel;break;case"number":{let s=Number(a);if(!Number.isFinite(s))return n.formInvalidNumber;if(r?.min!=null&&s<r.min)return Rn(n.formNumberTooSmall,{min:r.min});if(r?.max!=null&&s>r.max)return Rn(n.formNumberTooLarge,{max:r.max});break}default:break}if(r?.minLength!=null&&a.length<r.minLength)return Rn(n.formTooShort,{min:r.minLength});if(r?.maxLength!=null&&a.length>r.maxLength)return Rn(n.formTooLong,{max:r.maxLength});if(r?.pattern)try{if(!new RegExp(r.pattern).test(a))return n.formPatternMismatch}catch{}}function Cc(e,t,n){let o={};for(let r of e){let a=Hf(r,t[r.name],n);a&&(o[r.name]=a)}return o}function Rc(e){let t={};for(let[n,o]of Object.entries(e)){let r=Array.isArray(o)?o.join(", "):o;r&&r.trim()&&(t[n]=r.trim())}return t}var ke=w.cssPrefix,pr="__other__";function ro({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:r,onSkip:a,footerHint:s,submitOnEnter:l,disabled:c,initialValues:u,hideActions:_,fieldTypeLabels:p,rootTestId:d,submitTestId:f,skipTestId:m}){let[g,h]=D(()=>({...Wf(e),...u})),[P,x]=D({}),[b,y]=D({}),k=I=>{b[I]&&y(z=>({...z,[I]:""}))},C=(I,z)=>{h(W=>({...W,[I]:z})),k(I)},B=(I,z)=>{x(W=>({...W,[I]:z})),k(I)},G=I=>{if(I.preventDefault(),c)return;let z=Vf(e,g,P),W=Cc(e,z,t);if(Object.keys(W).length>0){y(W);return}o(Rc(z))},U=I=>{!l||I.key!=="Enter"||I.shiftKey||I.isComposing||I.target?.tagName==="TEXTAREA"&&G(I)};return i("form",{class:`${ke}-form`,onSubmit:G,onKeyDown:U,"data-testid":d,noValidate:!0,children:[e.map(I=>i(Uf,{field:I,value:g[I.name],otherText:P[I.name]??"",error:b[I.name],disabled:c,typeLabel:p?.[I.name],strings:t,onChange:z=>C(I.name,z),onOtherChange:z=>B(I.name,z)},I.name)),_?null:i("div",{class:`${ke}-form-actions`,children:[s?i("span",{class:`${ke}-form-hint`,children:s}):null,r&&a?i("button",{type:"button",class:`${ke}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:r}):null,i("button",{type:"submit",class:`${ke}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function Uf({field:e,value:t,otherText:n,error:o,disabled:r,typeLabel:a,strings:s,onChange:l,onOtherChange:c}){let u=Ge(R.formField,e.name),_=zf({field:e,value:t,otherText:n,disabled:r,strings:s,onChange:l,onOtherChange:c,fieldTid:u});return i("label",{class:`${ke}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[i("span",{class:`${ke}-field-head`,children:[i("span",{class:`${ke}-field-label`,children:[e.label,e.required??!0?i("span",{class:`${ke}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?i("span",{class:`${ke}-field-type`,children:a}):null]}),_,e.validationHint&&!o?i("span",{class:`${ke}-field-hint`,children:e.validationHint}):null,o?i("span",{class:`${ke}-field-error`,role:"alert",children:o}):null]})}function zf(e){let{field:t,value:n,otherText:o,disabled:r,strings:a,onChange:s,onOtherChange:l,fieldTid:c}=e,u=typeof n=="string"?n:"";switch(t.type){case"textarea":return i("textarea",{class:`${ke}-field-input`,rows:3,value:u,placeholder:t.placeholder,disabled:r,onInput:_=>s(_.target.value),"data-testid":c});case"select":return i("select",{class:`${ke}-field-input`,value:u,disabled:r,onChange:_=>s(_.target.value),"data-testid":c,children:[i("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(_=>i("option",{value:_.value,children:_.label??_.value},_.value))]});case"radio":{let _=t.allowOther&&u===pr;return i("div",{class:`${ke}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(p=>i("label",{class:`${ke}-choice`,children:[i("input",{type:"radio",name:`${ke}-${t.name}`,checked:u===p.value,disabled:r,onChange:()=>s(p.value)}),i("span",{children:p.label??p.value})]},p.value)),t.allowOther?i("label",{class:`${ke}-choice`,children:[i("input",{type:"radio",name:`${ke}-${t.name}`,checked:u===pr,disabled:r,onChange:()=>s(pr)}),i("span",{children:a.formOther})]}):null,_?i("input",{class:`${ke}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:p=>l(p.target.value)}):null]})}case"checkbox":return i("label",{class:`${ke}-choice`,children:[i("input",{type:"checkbox",checked:u==="true",disabled:r,onChange:_=>s(_.target.checked?"true":""),"data-testid":c}),i("span",{children:t.placeholder??t.label})]});case"multiselect":{let _=Array.isArray(n)?n:[],p=(d,f)=>s(f?[..._,d]:_.filter(m=>m!==d));return i("div",{class:`${ke}-field-choices`,"data-testid":c,children:[(t.options??[]).map(d=>i("label",{class:`${ke}-choice`,children:[i("input",{type:"checkbox",checked:_.includes(d.value),disabled:r,onChange:f=>p(d.value,f.target.checked)}),i("span",{children:d.label??d.value})]},d.value)),t.allowOther||(t.options??[]).length===0?i("textarea",{class:`${ke}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:d=>l(d.target.value)}):null]})}default:return i("input",{class:`${ke}-field-input`,type:qf(t.type),value:u,placeholder:t.placeholder,disabled:r,onInput:_=>s(_.target.value),"data-testid":c})}}function qf(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function Wf(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(o=>o.trim()).filter(Boolean):n.defaultValue);return t}function Vf(e,t,n){let o={...t};for(let r of e){let a=n[r.name]?.trim();if(r.type==="radio"&&r.allowOther&&t[r.name]===pr)o[r.name]=a??"";else if(r.type==="multiselect"&&a){let s=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),l=Array.isArray(t[r.name])?t[r.name]:[];o[r.name]=[...l,...s]}}return o}var gt=w.cssPrefix;function Ua({form:e,strings:t,onSubmit:n,onSkip:o}){return i("div",{class:`${gt}-form-gate`,"data-testid":R.formGate,children:[e.title?i("h3",{class:`${gt}-form-gate-title`,children:e.title}):null,e.description?i("p",{class:`${gt}-form-gate-desc`,children:e.description}):null,i(ro,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?o:void 0,submitTestId:R.formSubmit,skipTestId:R.formSkip})]})}function Tc({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",r=o?t.formSkipped:t.formSubmitted,a=e.title?i(ce,{children:[i("span",{children:e.title}),i("span",{class:`${gt}-sr-only`,children:r})]}):i("span",{children:r}),s=e.form?.reviewable??!1,l=!o&&s&&e.values&&Object.keys(e.values).length>0?e.values:null;if(l){let c=u=>e.form?.fields.find(_=>_.name===u)?.label??u;return i("details",{class:`${gt}-form-done`,"data-outcome":e.outcome,"data-testid":R.formDone,children:[i("summary",{class:`${gt}-form-done-summary`,"data-testid":R.formDoneToggle,children:[i(tn,{}),a,i(kn,{})]}),i("dl",{class:`${gt}-form-answers`,"data-testid":R.formAnswers,children:Object.entries(l).map(([u,_])=>i("div",{class:`${gt}-form-answer`,children:[i("dt",{children:c(u)}),i("dd",{children:_})]},u))})]})}return i("div",{class:`${gt}-form-done`,"data-outcome":e.outcome,"data-testid":R.formDone,role:"status",children:[o?i(Jl,{}):i(tn,{}),a,o&&e.form?.reopenable&&n?i("button",{type:"button",class:`${gt}-form-done-fill`,"data-testid":R.formFill,onClick:n,children:t.formFillOut}):null]})}function jf(e,t){for(var n in t)e[n]=t[n];return e}function qa(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Ic(e,t){this.props=e,this.context=t}function $c(e,t){function n(r){var a=this.props.ref;return a!=r.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,r)||a!=r.ref:qa(this.props,r)}function o(r){return this.shouldComponentUpdate=n,kt(e,r)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o}(Ic.prototype=new et).isPureReactComponent=!0,Ic.prototype.shouldComponentUpdate=function(e,t){return qa(this.props,e)||qa(this.state,t)};var Ec=J.__b;J.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ec&&Ec(e)};var zy=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Xf=J.__e;J.__e=function(e,t,n,o){if(e.then){for(var r,a=t;a=a.__;)if((r=a.__c)&&r.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t)}Xf(e,t,n,o)};var Ac=J.unmount;function Fc(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=jf({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return Fc(o,t,n)})),e}function Bc(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return Bc(o,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function za(){this.__u=0,this.o=null,this.__b=null}function Hc(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function fr(){this.i=null,this.l=null}J.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ac&&Ac(e)},(za.prototype=new et).__c=function(e,t){var n=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(n);var r=Hc(o.__v),a=!1,s=function(){a||o.__z||(a=!0,n.__R=null,r?r(c):c())};n.__R=s;var l=n.__P;n.__P=null;var c=function(){if(!--o.__u){if(o.state.__a){var u=o.state.__a;o.__v.__k[0]=Bc(u,u.__c.__P,u.__c.__O)}var _;for(o.setState({__a:o.__b=null});_=o.o.pop();)_.__P=l,_.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},za.prototype.componentWillUnmount=function(){this.o=[]},za.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Fc(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&kt(ce,null,e.fallback);return r&&(r.__u&=-33),[kt(ce,null,t.__a?null:e.children),r]};var Mc=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(fr.prototype=new et).__a=function(e){var t=this,n=Hc(t.__v),o=t.l.get(e);return o[0]++,function(r){var a=function(){t.props.revealOrder?(o.push(r),Mc(t,e,o)):r()};n?n(a):a()}},fr.prototype.render=function(e){this.i=null,this.l=new Map;var t=zn(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},fr.prototype.componentDidUpdate=fr.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Mc(e,n,t)})};var Yf=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Jf=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Qf=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Zf=/[A-Z0-9]/g,em=typeof document<"u",tm=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};et.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(et.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Lc=J.event;J.event=function(e){return Lc&&(e=Lc(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Uc,nm={configurable:!0,get:function(){return this.class}},Oc=J.vnode;J.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,o=t.type,r={},a=o.indexOf("-")==-1;for(var s in n){var l=n[s];if(!(s==="value"&&"defaultValue"in n&&l==null||em&&s==="children"&&o==="noscript"||s==="class"||s==="className")){var c=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?s="ondblclick":c!=="onchange"||o!=="input"&&o!=="textarea"||tm(n.type)?c==="onfocus"?s="onfocusin":c==="onblur"?s="onfocusout":Qf.test(s)&&(s=c):c=s="oninput":a&&Jf.test(s)?s=s.replace(Zf,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&r[s=c]&&(s="oninputCapture"),r[s]=l}}o=="select"&&(r.multiple&&Array.isArray(r.value)&&(r.value=zn(n.children).forEach(function(u){u.props.selected=r.value.indexOf(u.props.value)!=-1})),r.defaultValue!=null&&(r.value=zn(n.children).forEach(function(u){u.props.selected=r.multiple?r.defaultValue.indexOf(u.props.value)!=-1:r.defaultValue==u.props.value}))),n.class&&!n.className?(r.class=n.class,Object.defineProperty(r,"className",nm)):n.className&&(r.class=r.className=n.className),t.props=r})(e),e.$$typeof=Yf,Oc&&Oc(e)};var Nc=J.__r;J.__r=function(e){Nc&&Nc(e),Uc=e.__c};var Dc=J.diffed;J.diffed=function(e){Dc&&Dc(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Uc=null};function mr(e){if(!e)return!1;let t=e.startsWith("tool:")?e.slice(5):e;return t==="ask-user-questions"||t==="ask_user_questions"}var st=w.cssPrefix;function Va(e){return e.startsWith("tool:")||e.startsWith("tool-")?e.slice(5):e}function gr(e,t){let n=e==="output-available"||e==="output-error"||e==="output-denied",o=e==="approval-responded"||t?.approved!==void 0;return{terminal:n,responded:o,decided:n||o}}function Ga({status:e,icon:t,label:n}){return i("span",{class:`${st}-toolui-badge ${st}-toolui-status`,"data-status":e,children:[i("span",{class:`${st}-toolui-status-icon`,children:t}),n]})}function om(e,t){return e==="output-error"?"error":e==="output-denied"||t?.approved===!1?"denied":e==="output-available"?"completed":e==="approval-responded"||t?.approved===!0?"responded":e==="approval-requested"?"awaiting":"running"}function Ka(e,t,n={}){return n.submitted?"responded":im(om(e,t),n.superseded,n.live??!0)}function rm({status:e}){return e==="denied"||e==="error"||e==="superseded"?i(or,{}):e==="completed"||e==="responded"?i(nr,{}):i(_c,{})}function am(e,t){switch(e){case"awaiting":return t.statusAwaiting;case"responded":return t.statusResponded;case"completed":return t.statusCompleted;case"denied":return t.statusDenied;case"error":return t.statusError;case"superseded":return t.statusSuperseded;default:return t.statusRunning}}function im(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function sm({state:e,approval:t,strings:n,superseded:o,live:r=!0,submitted:a=!1}){let s=Ka(e,t,{superseded:o,live:r,submitted:a});return i(Ga,{status:s,icon:i(rm,{status:s}),label:am(s,n)})}function lm({name:e,state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}){return i(ce,{children:[i("span",{class:`${st}-toolui-name-pill`,children:[i(uc,{}),i("span",{class:`${st}-toolui-name-text`,children:e})]}),i(sm,{state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}),i("span",{class:`${st}-toolui-chevron`,children:i(nn,{})})]})}function vr({part:e,strings:t,testid:n,superseded:o,live:r,submitted:a}){let s=ee(()=>fe(()=>e.inputSig.value),[e]),l=ee(()=>fe(()=>e.outputSig.value),[e]),c=ee(()=>fe(()=>e.errorSig.value),[e]),u=ee(()=>fe(()=>e.stateSig.value),[e]),_=ee(()=>fe(()=>e.approvalSig.value),[e]);return i("details",{class:`${st}-toolui ${st}-toolui-collapsible`,"data-testid":n,children:[i("summary",{class:`${st}-toolui-head`,children:i(lm,{name:Va(e.toolName),state:u.value,approval:_.value,strings:t,superseded:o,live:r,submitted:a})}),i(Wa,{label:t.toolParameters,value:s.value}),l.value!==void 0?i(Wa,{label:t.toolResult,value:l.value}):null,c.value?i(Wa,{label:t.statusError,value:c.value,error:!0}):null]})}function Wa({label:e,value:t,error:n}){let o=n?String(t??""):hr(ja(t));return o?i("div",{class:`${st}-toolui-section`,children:[i("span",{class:`${st}-toolui-label`,children:e}),i("pre",{class:`${st}-toolui-code`,"data-error":n?"true":void 0,children:o})]}):null}function ja(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function hr(e){if(e==null)return"";try{let t=typeof e=="string"?e:JSON.stringify(e,null,2);return!t||t==="{}"||t==="[]"||t==='""'?"":t.length>800?`${t.slice(0,800)}\u2026`:t}catch{return""}}function zc(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function qc(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function cm(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function Wc(e){let{streaming:t,reasoningVisible:n,emptyReply:o,hidden:r}=e,a=e.responseMode==="buffered"&&t,s=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:s,showStreamDots:cm({streaming:t,bufferedHold:a,reasoningVisible:n,working:s}),emptyReply:o,hidden:r}}function Vc(e,t){let n=e.stateSig.value,o=e.approvalSig.value,{terminal:r,responded:a,decided:s}=gr(n,o),l=t.continuationStreaming===!0&&!s,c=t.superseded&&!s&&!l;return{pill:Ka(n,o,{superseded:c,live:t.live,submitted:l}),state:n,terminal:r,decided:s||l,showApproveReject:!s&&!t.superseded&&!l,showAnswered:a&&!r&&!c,showSubmitted:l,showEdit:a&&t.active&&!r,skipped:c,answeredApproved:o?.approved}}var Ja=1,Kc=2,jc=4,Xc=8,Yc=16;function dm(e){switch(e){case Ja:return"href";case Kc:return"src";case jc:return"class";case Xc:return"checked";case Yc:return"start"}}var um=e=>{switch(e){case 1:return 3;case 2:return 4;case 3:return 5;case 4:return 6;case 5:return 7;default:return 8}},_m=um;var Gc=24;function Za(e){let t=new Uint32Array(Gc);return t[0]=1,{renderer:e,text:"",pending:"",tokens:t,len:0,token:1,fence_end:0,blockquote_idx:0,hr_char:"",hr_chars:0,fence_start:0,spaces:new Uint8Array(Gc),indent:"",indent_len:0,table_state:0}}function Jc(e){e.pending.length>0&&Xe(e,`
|
|
12
12
|
`)}function me(e){e.text.length!==0&&(console.assert(e.len>0,"Never adding text to root"),e.renderer.add_text(e.renderer.data,e.text),e.text="")}function Ne(e){console.assert(e.len>0,"No nodes to end"),e.len-=1,e.token=e.tokens[e.len],e.renderer.end_token(e.renderer.data)}function ge(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&Ne(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function pm(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function rn(e,t){for(e.fence_start=0;e.len>t;)Ne(e)}function br(e,t){let n=0;for(let o=0;o<=e.len&&(t-=e.spaces[o],!(t<0));o+=1)switch(e.tokens[o]){case 9:case 10:case 20:case 25:n=o;break}for(;e.len>n;)Ne(e);return t}function Xa(e,t){let n=-1,o=-1;for(let r=e.blockquote_idx+1;r<=e.len;r+=1)if(e.tokens[r]===25){if(e.indent_len<e.spaces[r]){o=-1;break}o=r}else e.tokens[r]===t&&(n=r);return o===-1?n===-1?(rn(e,e.blockquote_idx),ge(e,t),!0):(rn(e,n),!1):(rn(e,o),ge(e,t),!0)}function Ya(e,t){ge(e,25),e.spaces[e.len]=e.indent_len+t,Tt(e),e.token=103}function Tt(e){e.indent="",e.indent_len=0,e.pending=""}function Qa(e){switch(e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return!0;default:return!1}}function fm(e){switch(e){case 32:case 58:case 59:case 41:case 44:case 33:case 46:case 63:case 93:case 10:return!0;default:return!1}}function mm(e){return Qa(e)||fm(e)}function Xe(e,t){for(let n of t){if(e.token===101){switch(n){case" ":e.indent_len+=1;continue;case" ":e.indent_len+=4;continue}let r=br(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],r>0&&Xe(e," ".repeat(r))}let o=e.pending+n;switch(e.token){case 21:case 1:case 20:case 24:case 23:switch(console.assert(e.text.length===0,"Root should not have any text"),e.pending[0]){case void 0:e.pending=n;continue;case" ":console.assert(e.pending.length===1),e.pending=n,e.indent+=" ",e.indent_len+=1;continue;case" ":console.assert(e.pending.length===1),e.pending=n,e.indent+=" ",e.indent_len+=4;continue;case`
|
|
13
13
|
`:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){Ne(e),Tt(e),e.pending=n;continue}rn(e,e.blockquote_idx),Tt(e),e.blockquote_idx=0,e.fence_start=0,e.pending=n;continue;case"#":switch(n){case"#":if(e.pending.length<6){e.pending=o;continue}break;case" ":br(e,e.indent_len),ge(e,_m(e.pending.length)),Tt(e);continue}break;case">":{let a=pm(e,20,e.blockquote_idx+1);a===-1?(rn(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,ge(e,20)):e.blockquote_idx=a,Tt(e),e.pending=n;continue}case"-":case"*":case"_":if(e.hr_chars===0&&(console.assert(e.pending.length===1,"Pending should be one character"),e.hr_chars=1,e.hr_char=e.pending),e.hr_chars>0){switch(n){case e.hr_char:e.hr_chars+=1,e.pending=o;continue;case" ":e.pending=o;continue;case`
|
|
14
14
|
`:if(e.hr_chars<3)break;br(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),Tt(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){Xa(e,23),Ya(e,2),Xe(e,o.slice(2));continue}break;case"`":if(e.pending.length<3){if(n==="`"){e.pending=o,e.fence_start=o.length;continue}e.fence_start=0;break}switch(n){case"`":e.pending.length===e.fence_start?(e.pending=o,e.fence_start=o.length):(ge(e,2),Tt(e),e.fence_start=0,Xe(e,o));continue;case`
|
|
@@ -36,7 +36,7 @@ ${r}`:r;continue}o.startsWith("id:")&&(n=o.slice(3).trim())}if(t==="[DONE]")retu
|
|
|
36
36
|
`?"":n,e.pending="");continue;case"_":case"*":{if(e.token===19||e.token===30||e.token===31||e.token===14)break;let r=12,a=14,s=e.pending[0];if(s==="_"&&(r=13,a=15),e.pending.length===1){if(s===n){e.pending=o;continue}if(n!==" "&&n!==`
|
|
37
37
|
`){me(e),ge(e,r),e.pending=n;continue}}else{if(s===n){me(e),ge(e,a),ge(e,r),e.pending="";continue}if(n!==" "&&n!==`
|
|
38
38
|
`){me(e),ge(e,a),e.pending=n;continue}}break}case"~":if(e.token!==19&&e.token!==16){if(e.pending==="~"){if(n==="~"){e.pending=o;continue}}else if(n!==" "&&n!==`
|
|
39
|
-
`){me(e),ge(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=o;continue}else{if(mm(n.charCodeAt(0)))break;me(e),ge(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){me(e),ge(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){me(e),ge(e,19),e.pending="";continue}break;case" ":if(e.pending.length===1&&n===" ")continue;break}if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n==="h"&&(e.pending===" "||e.pending==="")){e.text+=e.pending,e.pending=n,e.token=102;continue}e.text+=e.pending,e.pending=n}me(e)}function ei(e){return{add_token:gm,end_token:vm,add_text:hm,set_attr:bm,data:{nodes:[e,,,,,],index:0}}}function gm(e,t){let n=e.nodes[e.index],o;switch(t){case 1:return;case 20:o=document.createElement("blockquote");break;case 2:o=document.createElement("p");break;case 21:o=document.createElement("br");break;case 22:o=document.createElement("hr");break;case 3:o=document.createElement("h1");break;case 4:o=document.createElement("h2");break;case 5:o=document.createElement("h3");break;case 6:o=document.createElement("h4");break;case 7:o=document.createElement("h5");break;case 8:o=document.createElement("h6");break;case 12:case 13:o=document.createElement("em");break;case 14:case 15:o=document.createElement("strong");break;case 16:o=document.createElement("s");break;case 11:o=document.createElement("code");break;case 18:case 17:o=document.createElement("a");break;case 19:o=document.createElement("img");break;case 23:o=document.createElement("ul");break;case 24:o=document.createElement("ol");break;case 25:o=document.createElement("li");break;case 26:let r=o=document.createElement("input");r.type="checkbox",r.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),o=document.createElement("code");break;case 27:o=document.createElement("table");break;case 28:switch(n.children.length){case 0:n=n.appendChild(document.createElement("thead"));break;case 1:n=n.appendChild(document.createElement("tbody"));break;default:n=n.children[1]}o=document.createElement("tr");break;case 29:o=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:o=document.createElement("equation-block");break;case 31:o=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(o)}function vm(e){e.index-=1}function hm(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function bm(e,t,n){e.nodes[e.index].setAttribute(dm(t),n)}function yr({textSig:e,doneSig:t}){let n=M(null);return pt(()=>{let o=n.current;if(!o)return;o.classList.add(`${w.cssPrefix}-md`),o.replaceChildren();let r=ei(o),a=Za(r),s=0,l=Ct(()=>{let _=e.value,p=t.value;_.length<s&&(o.replaceChildren(),r=ei(o),a=Za(r),s=0);let d=_.slice(s);d&&Xe(a,d),s=_.length,p&&Jc(a)}),c=new MutationObserver(_=>{for(let p of _)for(let d of p.addedNodes){if(!(d instanceof HTMLElement))continue;let f=d.matches?.("a")?[d]:[...d.querySelectorAll?.("a")??[]];for(let m of f)Qc(m)}});c.observe(o,{childList:!0,subtree:!0});for(let _ of o.querySelectorAll("a"))Qc(_);let u=_=>{let p=_.target?.closest?.("a");if(!p||!(p instanceof HTMLAnchorElement))return;let d=p.getAttribute("href")??"";!d||d.startsWith("#")||(_.preventDefault(),window.open(d,"_blank","noopener,noreferrer"))};return o.addEventListener("click",u),()=>{l(),c.disconnect(),o.removeEventListener("click",u)}},[e,t]),i("div",{ref:n})}function Zc({text:e}){let t=ee(()=>Q(e),[e]),n=ee(()=>Q(!0),[]);return i(yr,{textSig:t,doneSig:n})}function Qc(e){let t=e.getAttribute("href")??"";if(!t||t.startsWith("#"))return;e.target!=="_blank"&&(e.target="_blank");let n=new Set((e.rel||"").split(/\s+/).filter(Boolean));n.add("noopener"),n.add("noreferrer"),e.rel=[...n].join(" ")}var Pr=w.cssPrefix;function ed({messageId:e,initial:t,strings:n,onFeedback:o}){let[r,a]=D(t);E(()=>a(t),[e,t]);let s=l=>{let c=r===l?null:l;a(c),o(e,c)};return i("div",{class:`${Pr}-feedback`,role:"group","data-testid":R.messageFeedback,children:[i("button",{type:"button",class:`${Pr}-msg-action`,"data-active":r==="up"?"true":void 0,"aria-pressed":r==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>s("up"),"data-testid":R.feedbackUp,children:i(cc,{})}),i("button",{type:"button",class:`${Pr}-msg-action`,"data-active":r==="down"?"true":void 0,"aria-pressed":r==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>s("down"),"data-testid":R.feedbackDown,children:i(dc,{})}),i("span",{class:`${Pr}-sr-only`,role:"status","aria-live":"polite",children:r?n.feedbackThanks:""})]})}var Tn=w.cssPrefix;function td({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?i("a",{class:`${Tn}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":R.source,children:[i("span",{class:`${Tn}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),i("span",{class:`${Tn}-source-label`,children:n})]}):i("span",{class:`${Tn}-source`,"data-testid":R.source,children:[i("span",{class:`${Tn}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),i("span",{class:`${Tn}-source-label`,children:n})]})}var rt=w.cssPrefix;function nd({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=ee(()=>fe(()=>e.approvalSig.value),[e]),c=ee(()=>fe(()=>Vc(e,{active:n,superseded:o,continuationStreaming:r})),[e,n,o,r]).value,{terminal:u,showApproveReject:_,showAnswered:p,showSubmitted:d,showEdit:f,skipped:m}=c,g=Va(e.toolName),h=c.answeredApproved,P=e.toolCallId,x=i(ce,{children:[i("p",{class:`${rt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",g)}),i("p",{class:`${rt}-toolui-subtle`,children:t.approvalBody})]});d?x=i("p",{class:`${rt}-toolui-subtle`,children:t.approvalSubmitting}):p&&h!==!1?x=i(ce,{children:[i("p",{class:`${rt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",h?t.approve:t.reject),l.value?.reason?` \u2014 ${l.value.reason}`:""]}),f?i("p",{class:`${rt}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:i("p",{class:`${rt}-toolui-subtle`,children:t.approvalSubmitting})]}):p&&(x=i(ce,{}));let b=_||d||f||p&&h!==!1;return i("div",{class:`${rt}-toolui-group`,"data-testid":c.decided?R.toolDecision:R.toolApproval,children:[i(vr,{part:e,strings:t,superseded:m,submitted:d}),m||u||!b?null:i("div",{class:`${rt}-toolui ${rt}-toolui-body`,children:[x,_?i("div",{class:`${rt}-toolui-actions`,children:[i("button",{type:"button",class:`${rt}-form-skip`,disabled:!n,onClick:()=>a(P,!1),"data-testid":R.toolReject,children:t.reject}),i("button",{type:"button",class:`${rt}-form-submit`,disabled:!n,onClick:()=>a(P,!0),"data-testid":R.toolApprove,children:t.approve})]}):null,f?i("div",{class:`${rt}-toolui-actions`,children:i("button",{type:"button",class:`${rt}-form-skip`,onClick:()=>s(P),"data-testid":R.toolEdit,children:t.edit})}):null]})]})}var Pm=new Set(["text","email","phone","number","date","single-select","multi-select","boolean"]);function od(e){let t=e&&typeof e=="object"?e:{},o=(Array.isArray(t.questions)?t.questions:[]).map(xm).filter(r=>r!==null);return{intro:xr(t.intro),questions:o}}function xm(e,t){if(!e||typeof e!="object")return null;let n=e,o=Pm.has(n.type)?n.type:"text";return{key:xr(n.key)??`q${t+1}`,question:xr(n.question)??"Please provide the missing information.",type:o,options:Array.isArray(n.options)?n.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof n.required=="boolean"?n.required:void 0,helpText:xr(n.helpText)}}function Sm(e){switch(e){case"text":return"textarea";case"phone":return"tel";case"single-select":case"boolean":return"radio";case"multi-select":return"multiselect";default:return e}}function ti(e,t,n){return e.questions.map(o=>{let r=Sm(o.type),a=o.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(o.options??[]).map(s=>({value:s,label:s}));return{name:o.key,label:o.question,type:r,required:o.required??!1,options:a.length>0?a:void 0,validationHint:o.helpText}})}function xr(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var Be=w.cssPrefix,km={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function rd(e,t){let n={};for(let o of e)n[o.key]=t[km[o.type]];return n}function ad({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=ee(()=>fe(()=>e.stateSig.value),[e]).value,c=ee(()=>fe(()=>e.approvalSig.value),[e]).value,u=ee(()=>fe(()=>od(e.inputSig.value)),[e]).value,{terminal:_,decided:p}=gr(l,c),d=p&&c?.approved===!0,f=r&&!p,m=!p&&!o&&!f,g=!m&&!d&&!f,h=d&&n&&!_,P=u.questions,[x,b]=D(null),k=x??(m||d||f),[C,B]=D(!1),G=P.length>1?La:eo,U=m?t.inputRequired:t.inputBadge,I=f?i("p",{class:`${Be}-toolui-subtle`,children:t.approvalSubmitting}):m?i(wm,{req:u,strings:t,active:n,resolve:(L,ne)=>a(e.toolCallId,ne,L)}):C?i(ro,{fields:ti(u,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:rd(P,t),initialValues:d?Em(P,c?.reason):void 0}):i(Cm,{questions:P,answers:d?Im(c?.reason):{},strings:t}),z="completed",W=t.inputAnswered;return g?(z="superseded",W=t.inputSkipped):f&&(z="responded",W=t.statusResponded),i("details",{class:`${Be}-toolui ${Be}-toolui-collapsible${o?` ${Be}-toolui-stale`:""}`,open:k,onToggle:L=>{let ne=L.currentTarget.open;ne!==k&&b(ne)},"data-testid":m?R.toolAskQuestions:R.toolDecision,children:[i("summary",{class:`${Be}-toolui-head`,children:[i("span",{class:`${Be}-toolui-q-pill`,children:[i(G,{}),U]}),i("span",{class:`${Be}-toolui-head-end`,children:[m?null:i(Ga,{status:z,icon:g?i(or,{}):i(nr,{}),label:W}),i("span",{class:`${Be}-toolui-chevron`,children:i(nn,{})})]})]}),i("div",{class:`${Be}-toolui-collapse-body`,children:[u.intro?i("div",{class:`${Be}-toolui-desc`,children:u.intro}):null,I,m||f?null:i("div",{class:`${Be}-toolui-footer`,children:[i("button",{type:"button",class:`${Be}-toolui-options-toggle`,onClick:()=>B(L=>!L),"data-testid":R.toolAskOptions,children:[i("span",{class:`${Be}-toolui-options-chevron${C?` ${Be}-open`:""}`,children:i(nn,{})}),C?t.hideOptions:t.showOptions]}),h?i("button",{type:"button",class:`${Be}-form-skip`,onClick:()=>s(e.toolCallId),"data-testid":R.toolEdit,children:t.edit}):null]})]})]})}function wm({req:e,strings:t,active:n,resolve:o}){let r=ti(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return i(ro,{fields:r,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:s=>o(Tm(e.questions,s),!0),skipLabel:t.inputSkip,onSkip:()=>o(void 0,!1),submitOnEnter:a,fieldTypeLabels:rd(e.questions,t),submitTestId:R.toolInputSubmit,skipTestId:R.toolInputSkip})}function Cm({questions:e,answers:t,strings:n}){return i("div",{class:`${Be}-toolui-summary`,"data-testid":R.toolAskSummary,children:e.map(o=>i("div",{class:`${Be}-field`,children:[i("span",{class:`${Be}-field-head`,children:i("span",{class:`${Be}-field-label`,children:[o.question,o.required?i("span",{class:`${Be}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),i("p",{class:`${Be}-toolui-answer`,children:Rm(o,t[o.key],n)||"\u2014"})]},o.key))})}function Rm(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Tm(e,t){let n=e.flatMap(o=>{let r=t[o.key];if(r==null||r.trim()==="")return[];let a=o.type==="multi-select"?r.split(",").map(s=>s.trim()).filter(Boolean):r;return[{key:o.key,value:a}]});return JSON.stringify({answers:n})}function id(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let o={};for(let r of n)if(r&&typeof r=="object"&&"key"in r){let{key:a,value:s}=r;if(typeof a!="string")continue;typeof s=="string"?o[a]=s:Array.isArray(s)&&(o[a]=s.filter(l=>typeof l=="string"))}return o}function Im(e){let t=id(e),n={};for(let[o,r]of Object.entries(t))n[o]=Array.isArray(r)?r.join(", "):r;return n}function Em(e,t){let n=id(t),o={};for(let r of e){let a=n[r.key];a!==void 0&&(r.type==="multi-select"?o[r.key]=Array.isArray(a)?a:[a]:o[r.key]=Array.isArray(a)?a[0]??"":a)}return o}function sd({part:e,strings:t,live:n}){let o=ee(()=>fe(()=>e.inputSig.value),[e]),r=ee(()=>fe(()=>e.outputSig.value),[e]),a=ee(()=>fe(()=>e.errorSig.value),[e]);return ee(()=>fe(()=>!!hr(o.value)||!!a.value||!!hr(ja(r.value))),[o,r,a]).value?i(vr,{part:e,strings:t,testid:R.toolCall,live:n}):null}var Ke=w.cssPrefix,ld=$c(Am);function Am({message:e,status:t,strings:n,responseMode:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l=!1,superseded:c=!1,tool:u,onRetry:_,enableMessageFeedback:p=!1,onFeedback:d}){let m=ee(()=>fe(()=>e.partsSig.value),[e]).value,g=ee(()=>fe(()=>Qt(e)),[e]),h=ee(()=>fe(()=>Tl(e)),[e]),P=ee(()=>fe(()=>zc(e)),[e]),x=ee(()=>fe(()=>r&&qc(e)),[e,r]),b=t==="streaming",y=e.role==="assistant"&&b,k=Wc({streaming:y,responseMode:o,reasoningVisible:x.value,hasAnswerText:P.value,emptyReply:g.value,hidden:h.value}),{bufferedHold:C,working:B,showStreamDots:G}=k;if(k.hidden)return null;let U=Lm(e.createdAt),I=e.role==="assistant"||e.role==="operator",z=p&&!!d&&!!e.serverMessageId&&I&&!b&&t!=="error"&&!g.value,W=b?"":m.filter(re=>re.kind==="text").map(re=>re.textSig.peek()).join(`
|
|
39
|
+
`){me(e),ge(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=o;continue}else{if(mm(n.charCodeAt(0)))break;me(e),ge(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){me(e),ge(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){me(e),ge(e,19),e.pending="";continue}break;case" ":if(e.pending.length===1&&n===" ")continue;break}if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n==="h"&&(e.pending===" "||e.pending==="")){e.text+=e.pending,e.pending=n,e.token=102;continue}e.text+=e.pending,e.pending=n}me(e)}function ei(e){return{add_token:gm,end_token:vm,add_text:hm,set_attr:bm,data:{nodes:[e,,,,,],index:0}}}function gm(e,t){let n=e.nodes[e.index],o;switch(t){case 1:return;case 20:o=document.createElement("blockquote");break;case 2:o=document.createElement("p");break;case 21:o=document.createElement("br");break;case 22:o=document.createElement("hr");break;case 3:o=document.createElement("h1");break;case 4:o=document.createElement("h2");break;case 5:o=document.createElement("h3");break;case 6:o=document.createElement("h4");break;case 7:o=document.createElement("h5");break;case 8:o=document.createElement("h6");break;case 12:case 13:o=document.createElement("em");break;case 14:case 15:o=document.createElement("strong");break;case 16:o=document.createElement("s");break;case 11:o=document.createElement("code");break;case 18:case 17:o=document.createElement("a");break;case 19:o=document.createElement("img");break;case 23:o=document.createElement("ul");break;case 24:o=document.createElement("ol");break;case 25:o=document.createElement("li");break;case 26:let r=o=document.createElement("input");r.type="checkbox",r.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),o=document.createElement("code");break;case 27:o=document.createElement("table");break;case 28:switch(n.children.length){case 0:n=n.appendChild(document.createElement("thead"));break;case 1:n=n.appendChild(document.createElement("tbody"));break;default:n=n.children[1]}o=document.createElement("tr");break;case 29:o=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:o=document.createElement("equation-block");break;case 31:o=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(o)}function vm(e){e.index-=1}function hm(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function bm(e,t,n){e.nodes[e.index].setAttribute(dm(t),n)}function yr({textSig:e,doneSig:t}){let n=M(null);return dt(()=>{let o=n.current;if(!o)return;o.classList.add(`${w.cssPrefix}-md`),o.replaceChildren();let r=ei(o),a=Za(r),s=0,l=Ct(()=>{let _=e.value,p=t.value;_.length<s&&(o.replaceChildren(),r=ei(o),a=Za(r),s=0);let d=_.slice(s);d&&Xe(a,d),s=_.length,p&&Jc(a)}),c=new MutationObserver(_=>{for(let p of _)for(let d of p.addedNodes){if(!(d instanceof HTMLElement))continue;let f=d.matches?.("a")?[d]:[...d.querySelectorAll?.("a")??[]];for(let m of f)Qc(m)}});c.observe(o,{childList:!0,subtree:!0});for(let _ of o.querySelectorAll("a"))Qc(_);let u=_=>{let p=_.target?.closest?.("a");if(!p||!(p instanceof HTMLAnchorElement))return;let d=p.getAttribute("href")??"";!d||d.startsWith("#")||(_.preventDefault(),window.open(d,"_blank","noopener,noreferrer"))};return o.addEventListener("click",u),()=>{l(),c.disconnect(),o.removeEventListener("click",u)}},[e,t]),i("div",{ref:n})}function Zc({text:e}){let t=ee(()=>Q(e),[e]),n=ee(()=>Q(!0),[]);return i(yr,{textSig:t,doneSig:n})}function Qc(e){let t=e.getAttribute("href")??"";if(!t||t.startsWith("#"))return;e.target!=="_blank"&&(e.target="_blank");let n=new Set((e.rel||"").split(/\s+/).filter(Boolean));n.add("noopener"),n.add("noreferrer"),e.rel=[...n].join(" ")}var Pr=w.cssPrefix;function ed({messageId:e,initial:t,strings:n,onFeedback:o}){let[r,a]=D(t);E(()=>a(t),[e,t]);let s=l=>{let c=r===l?null:l;a(c),o(e,c)};return i("div",{class:`${Pr}-feedback`,role:"group","data-testid":R.messageFeedback,children:[i("button",{type:"button",class:`${Pr}-msg-action`,"data-active":r==="up"?"true":void 0,"aria-pressed":r==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>s("up"),"data-testid":R.feedbackUp,children:i(cc,{})}),i("button",{type:"button",class:`${Pr}-msg-action`,"data-active":r==="down"?"true":void 0,"aria-pressed":r==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>s("down"),"data-testid":R.feedbackDown,children:i(dc,{})}),i("span",{class:`${Pr}-sr-only`,role:"status","aria-live":"polite",children:r?n.feedbackThanks:""})]})}var Tn=w.cssPrefix;function td({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?i("a",{class:`${Tn}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":R.source,children:[i("span",{class:`${Tn}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),i("span",{class:`${Tn}-source-label`,children:n})]}):i("span",{class:`${Tn}-source`,"data-testid":R.source,children:[i("span",{class:`${Tn}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),i("span",{class:`${Tn}-source-label`,children:n})]})}var rt=w.cssPrefix;function nd({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=ee(()=>fe(()=>e.approvalSig.value),[e]),c=ee(()=>fe(()=>Vc(e,{active:n,superseded:o,continuationStreaming:r})),[e,n,o,r]).value,{terminal:u,showApproveReject:_,showAnswered:p,showSubmitted:d,showEdit:f,skipped:m}=c,g=Va(e.toolName),h=c.answeredApproved,P=e.toolCallId,x=i(ce,{children:[i("p",{class:`${rt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",g)}),i("p",{class:`${rt}-toolui-subtle`,children:t.approvalBody})]});d?x=i("p",{class:`${rt}-toolui-subtle`,children:t.approvalSubmitting}):p&&h!==!1?x=i(ce,{children:[i("p",{class:`${rt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",h?t.approve:t.reject),l.value?.reason?` \u2014 ${l.value.reason}`:""]}),f?i("p",{class:`${rt}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:i("p",{class:`${rt}-toolui-subtle`,children:t.approvalSubmitting})]}):p&&(x=i(ce,{}));let b=_||d||f||p&&h!==!1;return i("div",{class:`${rt}-toolui-group`,"data-testid":c.decided?R.toolDecision:R.toolApproval,children:[i(vr,{part:e,strings:t,superseded:m,submitted:d}),m||u||!b?null:i("div",{class:`${rt}-toolui ${rt}-toolui-body`,children:[x,_?i("div",{class:`${rt}-toolui-actions`,children:[i("button",{type:"button",class:`${rt}-form-skip`,disabled:!n,onClick:()=>a(P,!1),"data-testid":R.toolReject,children:t.reject}),i("button",{type:"button",class:`${rt}-form-submit`,disabled:!n,onClick:()=>a(P,!0),"data-testid":R.toolApprove,children:t.approve})]}):null,f?i("div",{class:`${rt}-toolui-actions`,children:i("button",{type:"button",class:`${rt}-form-skip`,onClick:()=>s(P),"data-testid":R.toolEdit,children:t.edit})}):null]})]})}var Pm=new Set(["text","email","phone","number","date","single-select","multi-select","boolean"]);function od(e){let t=e&&typeof e=="object"?e:{},o=(Array.isArray(t.questions)?t.questions:[]).map(xm).filter(r=>r!==null);return{intro:xr(t.intro),questions:o}}function xm(e,t){if(!e||typeof e!="object")return null;let n=e,o=Pm.has(n.type)?n.type:"text";return{key:xr(n.key)??`q${t+1}`,question:xr(n.question)??"Please provide the missing information.",type:o,options:Array.isArray(n.options)?n.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof n.required=="boolean"?n.required:void 0,helpText:xr(n.helpText)}}function Sm(e){switch(e){case"text":return"textarea";case"phone":return"tel";case"single-select":case"boolean":return"radio";case"multi-select":return"multiselect";default:return e}}function ti(e,t,n){return e.questions.map(o=>{let r=Sm(o.type),a=o.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(o.options??[]).map(s=>({value:s,label:s}));return{name:o.key,label:o.question,type:r,required:o.required??!1,options:a.length>0?a:void 0,validationHint:o.helpText}})}function xr(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var Be=w.cssPrefix,km={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function rd(e,t){let n={};for(let o of e)n[o.key]=t[km[o.type]];return n}function ad({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=ee(()=>fe(()=>e.stateSig.value),[e]).value,c=ee(()=>fe(()=>e.approvalSig.value),[e]).value,u=ee(()=>fe(()=>od(e.inputSig.value)),[e]).value,{terminal:_,decided:p}=gr(l,c),d=p&&c?.approved===!0,f=r&&!p,m=!p&&!o&&!f,g=!m&&!d&&!f,h=d&&n&&!_,P=u.questions,[x,b]=D(null),k=x??(m||d||f),[C,B]=D(!1),G=P.length>1?La:eo,U=m?t.inputRequired:t.inputBadge,I=f?i("p",{class:`${Be}-toolui-subtle`,children:t.approvalSubmitting}):m?i(wm,{req:u,strings:t,active:n,resolve:(L,ne)=>a(e.toolCallId,ne,L)}):C?i(ro,{fields:ti(u,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:rd(P,t),initialValues:d?Em(P,c?.reason):void 0}):i(Cm,{questions:P,answers:d?Im(c?.reason):{},strings:t}),z="completed",W=t.inputAnswered;return g?(z="superseded",W=t.inputSkipped):f&&(z="responded",W=t.statusResponded),i("details",{class:`${Be}-toolui ${Be}-toolui-collapsible${o?` ${Be}-toolui-stale`:""}`,open:k,onToggle:L=>{let ne=L.currentTarget.open;ne!==k&&b(ne)},"data-testid":m?R.toolAskQuestions:R.toolDecision,children:[i("summary",{class:`${Be}-toolui-head`,children:[i("span",{class:`${Be}-toolui-q-pill`,children:[i(G,{}),U]}),i("span",{class:`${Be}-toolui-head-end`,children:[m?null:i(Ga,{status:z,icon:g?i(or,{}):i(nr,{}),label:W}),i("span",{class:`${Be}-toolui-chevron`,children:i(nn,{})})]})]}),i("div",{class:`${Be}-toolui-collapse-body`,children:[u.intro?i("div",{class:`${Be}-toolui-desc`,children:u.intro}):null,I,m||f?null:i("div",{class:`${Be}-toolui-footer`,children:[i("button",{type:"button",class:`${Be}-toolui-options-toggle`,onClick:()=>B(L=>!L),"data-testid":R.toolAskOptions,children:[i("span",{class:`${Be}-toolui-options-chevron${C?` ${Be}-open`:""}`,children:i(nn,{})}),C?t.hideOptions:t.showOptions]}),h?i("button",{type:"button",class:`${Be}-form-skip`,onClick:()=>s(e.toolCallId),"data-testid":R.toolEdit,children:t.edit}):null]})]})]})}function wm({req:e,strings:t,active:n,resolve:o}){let r=ti(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return i(ro,{fields:r,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:s=>o(Tm(e.questions,s),!0),skipLabel:t.inputSkip,onSkip:()=>o(void 0,!1),submitOnEnter:a,fieldTypeLabels:rd(e.questions,t),submitTestId:R.toolInputSubmit,skipTestId:R.toolInputSkip})}function Cm({questions:e,answers:t,strings:n}){return i("div",{class:`${Be}-toolui-summary`,"data-testid":R.toolAskSummary,children:e.map(o=>i("div",{class:`${Be}-field`,children:[i("span",{class:`${Be}-field-head`,children:i("span",{class:`${Be}-field-label`,children:[o.question,o.required?i("span",{class:`${Be}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),i("p",{class:`${Be}-toolui-answer`,children:Rm(o,t[o.key],n)||"\u2014"})]},o.key))})}function Rm(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Tm(e,t){let n=e.flatMap(o=>{let r=t[o.key];if(r==null||r.trim()==="")return[];let a=o.type==="multi-select"?r.split(",").map(s=>s.trim()).filter(Boolean):r;return[{key:o.key,value:a}]});return JSON.stringify({answers:n})}function id(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let o={};for(let r of n)if(r&&typeof r=="object"&&"key"in r){let{key:a,value:s}=r;if(typeof a!="string")continue;typeof s=="string"?o[a]=s:Array.isArray(s)&&(o[a]=s.filter(l=>typeof l=="string"))}return o}function Im(e){let t=id(e),n={};for(let[o,r]of Object.entries(t))n[o]=Array.isArray(r)?r.join(", "):r;return n}function Em(e,t){let n=id(t),o={};for(let r of e){let a=n[r.key];a!==void 0&&(r.type==="multi-select"?o[r.key]=Array.isArray(a)?a:[a]:o[r.key]=Array.isArray(a)?a[0]??"":a)}return o}function sd({part:e,strings:t,live:n}){let o=ee(()=>fe(()=>e.inputSig.value),[e]),r=ee(()=>fe(()=>e.outputSig.value),[e]),a=ee(()=>fe(()=>e.errorSig.value),[e]);return ee(()=>fe(()=>!!hr(o.value)||!!a.value||!!hr(ja(r.value))),[o,r,a]).value?i(vr,{part:e,strings:t,testid:R.toolCall,live:n}):null}var Ke=w.cssPrefix,ld=$c(Am);function Am({message:e,status:t,strings:n,responseMode:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l=!1,superseded:c=!1,tool:u,onRetry:_,enableMessageFeedback:p=!1,onFeedback:d}){let m=ee(()=>fe(()=>e.partsSig.value),[e]).value,g=ee(()=>fe(()=>Qt(e)),[e]),h=ee(()=>fe(()=>Tl(e)),[e]),P=ee(()=>fe(()=>zc(e)),[e]),x=ee(()=>fe(()=>r&&qc(e)),[e,r]),b=t==="streaming",y=e.role==="assistant"&&b,k=Wc({streaming:y,responseMode:o,reasoningVisible:x.value,hasAnswerText:P.value,emptyReply:g.value,hidden:h.value}),{bufferedHold:C,working:B,showStreamDots:G}=k;if(k.hidden)return null;let U=Lm(e.createdAt),I=e.role==="assistant"||e.role==="operator",z=p&&!!d&&!!e.serverMessageId&&I&&!b&&t!=="error"&&!g.value,W=b?"":m.filter(re=>re.kind==="text").map(re=>re.textSig.peek()).join(`
|
|
40
40
|
|
|
41
|
-
`).trim(),L=!b&&t!=="error"&&!g.value&&W.length>0,ne=z||L;return i("div",{class:`${Ke}-bubble-row`,"data-role":e.role,"data-testid":Ge(R.messageBubble,e.serverMessageId??e.id),children:i("div",{class:`${Ke}-bubble-col`,children:[i("div",{class:`${Ke}-bubble`,children:[e.role==="operator"&&e.operatorInitials?i("span",{class:`${Ke}-bubble-author`,children:e.operatorInitials}):null,i("div",{class:`${Ke}-bubble-body`,children:[C?i(Bm,{label:n.loading}):m.map((re,le)=>i(Om,{part:re,active:B,live:y,strings:n,showReasoning:r,showToolCalls:a,showSources:s,interactive:l&&t==="complete"&&(re.kind!=="tool"||Xo(e,le)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:u},`${$m(re)}#${le}`)),G&&i(Fm,{}),t==="error"||g.value?i("div",{class:`${Ke}-error`,role:"alert",children:[i("span",{children:e.errorText??n.errorGeneric}),_?i("button",{type:"button",class:`${Ke}-error-retry`,onClick:()=>_(e),"data-testid":R.messageRetry,children:n.errorRetry}):null]}):null]})]}),U||ne?i("div",{class:`${Ke}-bubble-meta`,children:[U?i("time",{class:`${Ke}-bubble-time`,dateTime:U.iso,title:U.full,children:U.short}):null,ne?i("div",{class:`${Ke}-bubble-actions`,children:[z&&e.serverMessageId?i(ed,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:d}):null,L?i(Mm,{text:W,strings:n}):null]}):null]}):null]})})}function Mm({text:e,strings:t}){let[n,o]=D(!1),r=()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),1500)}).catch(()=>{})},a=n?t.copied:t.copy;return i("button",{type:"button",class:`${Ke}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:r,"data-testid":R.messageCopy,children:n?i(tn,{}):i(lc,{})})}function Lm(e){if(typeof e!="number"||!Number.isFinite(e))return null;try{let t=new Date(e);return{short:t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),full:t.toLocaleString(void 0,{dateStyle:"full",timeStyle:"short"}),iso:t.toISOString()}}catch{return null}}function Om({part:e,active:t,live:n,strings:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l,superseded:c,continuationStreaming:u,tool:_}){switch(e.kind){case"step-start":return null;case"text":return i(yr,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return r?i(Dm,{part:e,active:t,strings:o}):null;case"tool":return i(Nm,{part:e,strings:o,showToolCalls:a,interactive:l,superseded:c,continuationStreaming:u,live:n,tool:_});case"file":return e.mediaType.startsWith("image/")?i("img",{src:e.url,alt:"",loading:"lazy"}):i("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return s?i(td,{part:e,strings:o}):null}}function Nm({part:e,strings:t,showToolCalls:n,interactive:o,superseded:r,continuationStreaming:a,live:s,tool:l}){let c=ee(()=>fe(()=>e.approvalSig.value!==void 0),[e]);return l?.humanInLoop&&c.value?mr(e.toolName)?i(ad,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):i(nd,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):n?i(sd,{part:e,strings:t,live:s}):null}function Dm({part:e,active:t,strings:n}){return i("details",{class:`${Ke}-reasoning`,"data-testid":R.reasoning,open:t,"data-active":t?"true":void 0,children:[i("summary",{class:`${Ke}-reasoning-summary`,children:i("span",{class:`${Ke}-reasoning-label`,children:t?n.thinking:n.thoughts})}),i("div",{class:`${Ke}-reasoning-body`,children:i(yr,{textSig:e.textSig,doneSig:e.doneSig})})]})}function $m(e){switch(e.kind){case"text":case"reasoning":case"step-start":return`${e.kind}:${e.id}`;case"tool":return`tool:${e.toolCallId}`;case"file":return`file:${e.url}`;case"source":return`source:${e.sourceId}`}}function Fm(){return i("span",{class:`${Ke}-typing`,"data-testid":R.typingDots,"aria-hidden":"true",children:[i("span",{}),i("span",{}),i("span",{})]})}function Bm({label:e}){return i("span",{class:`${Ke}-loading`,role:"status",children:[i("span",{class:`${Ke}-loading-spinner`,"aria-hidden":"true"}),i("span",{class:`${Ke}-loading-label`,children:e})]})}var Ft=w.cssPrefix,ni=120,Hm=350;function cd({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,enableMessageFeedback:s,onFeedback:l,loading:c,onLoadPreviousMessages:u,idle:_,controlMode:p="ai-agent",tool:d,onRetry:f,form:m,formMarkers:g,onFillForm:h}){let P=M(null),x=ut(()=>e.value),[b,y]=D(!1),[k,C]=D(!1),B=M(!1),G=M(!1),[U,I]=D(),z=M(!1),W=M(!1),L=M(!1),ne=M(0),re=()=>L.current||performance.now()-ne.current<Hm,le=M(0),Ae=S=>{let q=S.scrollHeight-S.clientHeight>1;S.dataset.fadeTop=q&&S.scrollTop>1?"true":"false",S.dataset.fadeBottom=q&&S.scrollHeight-S.scrollTop-S.clientHeight>1?"true":"false"},de=S=>y(S.scrollHeight-S.scrollTop-S.clientHeight>ni*2),_e=S=>{le.current=performance.now(),S.scrollTop=S.scrollHeight,Ae(S)},Me=(S,q)=>{_e(S);let ye=q,ie=0,Pe=()=>{W.current||re()||(_e(S),--ye>0&&(ie=requestAnimationFrame(Pe)))};return q>0&&(ie=requestAnimationFrame(Pe)),()=>cancelAnimationFrame(ie)},N=(S,q)=>{let ye,ie,Pe,ht=-1,ct=()=>{ye.disconnect(),ie.disconnect(),clearTimeout(Pe)},qe=()=>{if(W.current||re()||ht>=0&&S.scrollTop<ht-4)return ct();_e(S),ht=S.scrollTop};return ye=new ResizeObserver(qe),ie=new MutationObserver(qe),qe(),ye.observe(S),ie.observe(S,{childList:!0,subtree:!0,characterData:!0}),Pe=setTimeout(ct,q),ct},ve=x.value[0]?.id;pt(()=>{let S=P.current;if(S&&x.value.length!==0&&!G.current&&(z.current=!0,!!x.value.some(q=>q.role==="user")))return N(S,300)},[ve]);let ae=M(0);E(()=>{let S=P.current,q=x.value,ye=ae.current;if(ae.current=q.length,!S||!z.current||G.current)return;if(q.slice(ye).some(Pe=>Pe.role==="user"))return W.current=!1,Me(S,3);if(!q.some(Pe=>Pe.role==="user")||W.current||re())return;S.scrollHeight-S.scrollTop-S.clientHeight<ni&&_e(S)},[x.value.length]);let De=M(null);E(()=>{let S=P.current,q=x.value.at(-1),ye=De.current;if(De.current=q?{id:q.id,streaming:q.status==="streaming"}:null,!!S&&z.current&&!(!q||q.id!==ye?.id||ye.streaming||q.status!=="streaming"))return W.current=!1,Me(S,3)},[x.value]),E(()=>{let S=P.current;if(!S)return;let q=x.value.at(-1);if(!q||q.status!=="streaming"&&!x.value.some(Pe=>Pe.role==="user"))return;let ye=()=>{if(W.current||re())return;S.scrollHeight-S.scrollTop-S.clientHeight<ni*2&&_e(S)};if(q.status!=="streaming")return N(S,300);ye();let ie=new MutationObserver(ye);return ie.observe(S,{childList:!0,subtree:!0,characterData:!0}),()=>ie.disconnect()},[x.value]);let xe=m?.form.id,Te=!!m&&(g??[]).some(S=>S.formId===m.form.id);pt(()=>{let S=P.current;!S||!xe||W.current||x.value.some(q=>q.role==="user")&&(Te?S.querySelector(`[data-testid="${R.formGate}"]`)?.scrollIntoView({block:"nearest"}):_e(S))},[xe,Te]),E(()=>{let S=P.current;if(!S)return;let q=()=>{de(S),Ae(S),performance.now()-le.current>150&&(W.current=S.scrollHeight-S.scrollTop-S.clientHeight>8)},ye=()=>{W.current=!0},ie=bt=>{bt.deltaY<0&&ye()},Pe=0,ht=bt=>{Pe=bt.touches[0]?.clientY??0,L.current=!0},ct=bt=>{(bt.touches[0]?.clientY??0)>Pe+4&&ye()},qe=()=>{L.current=!1,ne.current=performance.now()},zt=()=>{L.current=!0};return S.addEventListener("scroll",q,{passive:!0}),S.addEventListener("wheel",ie,{passive:!0}),S.addEventListener("touchstart",ht,{passive:!0}),S.addEventListener("touchmove",ct,{passive:!0}),S.addEventListener("touchend",qe,{passive:!0}),S.addEventListener("touchcancel",qe,{passive:!0}),S.addEventListener("pointerdown",zt,{passive:!0}),window.addEventListener("pointerup",qe,{passive:!0}),window.addEventListener("pointercancel",qe,{passive:!0}),de(S),()=>{S.removeEventListener("scroll",q),S.removeEventListener("wheel",ie),S.removeEventListener("touchstart",ht),S.removeEventListener("touchmove",ct),S.removeEventListener("touchend",qe),S.removeEventListener("touchcancel",qe),S.removeEventListener("pointerdown",zt),window.removeEventListener("pointerup",qe),window.removeEventListener("pointercancel",qe)}},[]);let Ce=()=>{let S=P.current;S&&(W.current=!1,_e(S))},Le=x.value.filter(S=>!S.ephemeral),he=Le[0],Se=he?.serverMessageId??he?.id,Ie=!!(u&&Le.length>=Ca&&Se!==U),Je=async()=>{if(!u||B.current)return;let S=P.current,q=S?.scrollHeight??0,ye=S?.scrollTop??0;B.current=!0,G.current=!0,C(!0);try{let ie=await u();ie===!1&&Se&&I(Se),ie&&S&&(await new Promise(Pe=>requestAnimationFrame(()=>requestAnimationFrame(()=>Pe()))),S.scrollTop=ye+S.scrollHeight-q,Ae(S),de(S))}finally{G.current=!1,B.current=!1,C(!1)}},Qe=[],ze="",H=x.value.at(-1)?.id,K=[...g??[]].toSorted((S,q)=>(S.createdAt??1/0)-(q.createdAt??1/0)),Y=S=>m&&S.formId===m.form.id?i(Ua,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${S.formId}`):i(Tc,{marker:S,strings:t,onFill:!m&&h?()=>h(S.formId):void 0},S.key),pe=S=>{for(let q=K[0];q?.createdAt!==void 0&&!(S!==void 0&&q.createdAt>S);q=K[0])K.shift(),Qe.push(Y(q))};for(let S of x.value){if(S.role==="assistant"&&S.id!==H&&Qt(S))continue;pe(S.createdAt);let q=Um(S.createdAt);q&&q!==ze&&(Qe.push(i("div",{class:`${Ft}-date-divider`,children:i("span",{class:`${Ft}-date-pill`,title:zm(S.createdAt),children:qm(S.createdAt,t)})},`day:${q}`)),ze=q);let ie=S.retryAction!==void 0||S.role==="assistant"&&S.id===H?Qo(x.value,S):void 0,Pe=ie!==void 0&&(ie.kind!=="continue-assistant"||p==="ai-agent");Qe.push(i(ld,{message:S,status:S.status,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,interactive:!!_&&p==="ai-agent"&&S.id===H,superseded:S.id!==H,tool:d,onRetry:_&&Pe&&(S.role==="user"||S.id===H)?f:void 0,enableMessageFeedback:s,onFeedback:l},S.id))}for(let S of K)Qe.push(Y(S));return i("div",{class:`${Ft}-list-wrap`,children:[i("div",{ref:P,class:`${Ft}-list ${Ft}-list--fade`,role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&x.value.length===0?i("div",{class:`${Ft}-list-loading`,role:"status",children:t.conversationLoading}):null,Ie?i("div",{class:`${Ft}-load-previous`,children:i("button",{type:"button",onClick:Je,disabled:k,"aria-busy":k,"data-testid":R.loadPreviousMessages,children:t.loadPreviousMessages})}):null,Qe,m&&!Te?i(Ua,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),b?i("button",{type:"button",class:`${Ft}-jump`,onClick:Ce,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":R.scrollToBottom,children:i(nn,{})}):null]})}function Um(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function zm(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function qm(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),r=Math.round((o(new Date)-o(n))/864e5);return r<=0?t.dateToday:r===1?t.dateYesterday:r<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var Wm=["today","yesterday","lastWeek","older"];function Vm(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((dd(e)-dd(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function ud(e,t){let n=new Map;for(let o of t){let r=Vm(e,o.lastMessageAt),a=n.get(r);a?a.push(o):n.set(r,[o])}return Wm.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function dd(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var _d=X.scope("history"),Gm=3,Km=6,jm={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function Xm(e,t,n){let o=Date.parse(e);return Number.isFinite(o)?new Date(o).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(o):t-o<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(o):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(o):""}function Sr({transport:e,strings:t,locale:n,persistence:o,visitorId:r,onSelect:a,onNewConversation:s}){let l=w.cssPrefix,c=e.peekConversations({visitorId:r}),[u,_]=D(c?"loaded":"loading"),[p,d]=D(c),[f,m]=D(!1),g=M(),h=p?.conversations??[],P=p?.pagination;E(()=>{let C=!1;g.current=void 0,m(!1);let B=e.peekConversations({visitorId:r});return d(B),_(B?"loaded":"loading"),e.listConversations({visitorId:r}).then(G=>{C||(d(G),_("loaded"),o.saveHistoryCount(G.conversations.length))}).catch(G=>{C||(_d.warn("listConversations failed",{err:G}),_("error"))}),()=>{C=!0,g.current=void 0}},[e,r,o,n]);let x=async()=>{if(g.current||!P?.hasNext)return;let C={};g.current=C,m(!0);try{let B=await e.listConversations({visitorId:r,page:P.page+1,limit:P.limit});if(g.current!==C)return;let G=new Set(h.map(I=>I.conversationId)),U=[...h,...B.conversations.filter(I=>!G.has(I.conversationId))];d({conversations:U,pagination:B.pagination}),o.saveHistoryCount(U.length)}catch(B){if(g.current!==C)return;_d.warn("listConversations page failed",{err:B,page:P.page+1})}finally{g.current===C&&(g.current=void 0,m(!1))}},b=s?i("div",{class:`${l}-history-footer`,children:i("button",{type:"button",class:`${l}-history-new`,onClick:s,"data-testid":R.sidebarNewConversation,children:[i(Nl,{}),t.newConversation]})}):null;if(u==="loading"){let C=Math.min(o.loadHistoryCount()??Gm,Km);return i(ce,{children:[i("div",{class:`${l}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:i("div",{class:`${l}-history-group`,"aria-hidden":"true",children:[i("div",{class:`${l}-history-heading`,children:i("span",{class:`${l}-skeleton ${l}-skeleton-heading`})}),i("div",{class:`${l}-history-card`,children:Array.from({length:Math.max(1,C)},(B,G)=>i("div",{class:`${l}-history-item ${l}-history-item-skeleton`,children:[i("span",{class:`${l}-history-avatar ${l}-skeleton`}),i("span",{class:`${l}-history-body`,children:[i("span",{class:`${l}-history-row`,children:[i("span",{class:`${l}-history-title`,children:i("span",{class:`${l}-skeleton ${l}-skeleton-title`})}),i("span",{class:`${l}-history-time`,children:i("span",{class:`${l}-skeleton ${l}-skeleton-time`})})]}),i("span",{class:`${l}-history-row`,children:i("span",{class:`${l}-history-preview`,children:i("span",{class:`${l}-skeleton ${l}-skeleton-preview`})})})]})]},G))})]})}),b]})}if(u==="error"||h.length===0)return i(ce,{children:[i("div",{class:`${l}-history-empty`,children:t.historyEmpty}),b]});let y=Date.now(),k=ud(y,h);return i(ce,{children:[i("div",{class:`${l}-history`,role:"list",children:[k.map(C=>i("div",{class:`${l}-history-group`,children:[i("div",{class:`${l}-history-heading`,children:t[jm[C.bucket]]}),i("div",{class:`${l}-history-card`,children:C.conversations.map(B=>i("button",{type:"button",role:"listitem",class:`${l}-history-item`,onClick:()=>a(B),"data-closed":B.canContinue?void 0:"true","data-unread":B.hasUnread?"true":void 0,"data-testid":Ge(R.historyItem,B.conversationId),children:[i("span",{class:`${l}-history-avatar`,"aria-hidden":"true",children:i(Oa,{})}),i("span",{class:`${l}-history-body`,children:[i("span",{class:`${l}-history-row`,children:[i("span",{class:`${l}-history-title`,children:B.title}),i("span",{class:`${l}-history-time`,children:Xm(B.lastMessageAt,y,n)})]}),i("span",{class:`${l}-history-row`,children:[i("span",{class:`${l}-history-preview`,children:B.preview??(B.canContinue?t.historyContinue:t.conversationClosed)}),B.hasUnread?i("span",{class:`${l}-history-dot`}):null]})]})]},B.conversationId))})]},C.bucket)),P?.hasNext?i("div",{class:`${l}-history-more`,children:i("button",{type:"button",onClick:x,disabled:f,"aria-busy":f,"data-testid":R.historyLoadMore,children:t.loadMoreConversations})}):null]}),b]})}var pd=w.cssPrefix;function fd({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:i("div",{class:`${pd}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((o,r)=>i("button",{type:"button",class:`${pd}-suggestion`,onClick:()=>t(o),disabled:n,"data-testid":Ge(R.suggestion,r),children:o.label},o.id))})}var je=w.cssPrefix;function md(e){let{options:t,onClose:n}=e,o=t.strings,r=M(null);E(()=>{let u=r.current;if(!u)return;let _=lr(u),p=d=>{d.key==="Escape"&&n?.()};return u.addEventListener("keydown",p),()=>{_(),u.removeEventListener("keydown",p)}},[n]);let a=e.composerApiRef,s=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,l=O(u=>{s&&a.current?.attachFromDrop(u)},[a,s]),{visible:c}=_r({containerRef:r,onDrop:l,disabled:!s});return ir(r.current,t.mode==="modal"),i("div",{ref:r,class:`${je}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":R.panel,children:[i(oi,{...e,containerEl:r.current,dragOver:c,composerAttachApiRef:a}),i(ri,{poweredBy:e.options.poweredBy})]})}function oi(e){let{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,composerKey:l,panelSize:c,view:u,canSend:_,isStreaming:p,sendPreparing:d,controlMode:f,assignedOperatorInitials:m,operatorAvailable:g,operatorRequestEnabled:h,onRequestOperator:P,onCancelOperatorRequest:x,loadingMessages:b,onLoadPreviousMessages:y,messagesSig:k,agent:C,suggestions:B,initialWidgetSize:G,visitorId:U,onClose:I,onBack:z,onClear:W,onToggleHistory:L,onSelectHistoryConversation:ne,onNewConversation:re,onWidgetSizeChange:le,onSend:Ae,onStop:de,onSuggestion:_e,activeForm:Me,formMarkers:N,onFormSubmit:ve,onFormSkip:ae,onFormFill:De,tool:xe,onRetry:Te,onMessageFeedback:Ce,containerEl:Le,dragOver:he,composerAttachApiRef:Se}=e,Ie=t.strings,Je=ut(()=>k.value.some(ze=>!ze.ephemeral&&ze.role!=="system")).value,Qe;return Me?Qe=null:_?Qe=i(ce,{children:[f&&f!=="ai-agent"?i(Qm,{controlMode:f,operatorInitials:m,operatorAvailable:g,onCancelOperatorRequest:x,strings:Ie}):null,!p&&f==="ai-agent"&&i(fd,{suggestions:B,onPick:_e,disabled:d}),i(xc,{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,isStreaming:p,active:e.composerActive&&u==="chat",isPreparing:d,operatorRequestEnabled:h,canRequestOperator:Je,controlMode:f,onRequestOperator:P,onSend:Ae,onStop:de,attachApiRef:Se},l)]}):Qe=i(Jm,{label:Ie.conversationClosed,ctaLabel:Ie.startNewConversation,onNewConversation:W}),i(ce,{children:[u==="history"?i(Ym,{strings:Ie,onBack:L,onClose:I,showClose:sr(t.mode,c,t.actions)}):i("header",{class:`${je}-header`,"data-testid":R.panelHeader,children:[z?i("button",{type:"button",class:`${je}-icon-btn`,onClick:z,"aria-label":Ie.moduleBack,title:Ie.moduleBack,children:i(Zn,{})}):null,C?i(hc,{agent:C,strings:Ie}):i("h1",{children:Ie.panelTitle}),i(mt,{panelProps:e,variant:"chat"})]}),u==="history"?i(Sr,{transport:n,strings:Ie,locale:t.locale,persistence:a,visitorId:U,onSelect:ze=>ne(ze.conversationId),onNewConversation:re}):i(ce,{children:[i(Sc,{visible:he,strings:Ie}),i(cd,{messagesSig:k,strings:Ie,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:Ce,loading:b,onLoadPreviousMessages:y,idle:!p&&!d&&_&&!Me,controlMode:f,tool:xe,onRetry:Te,form:Me?{form:Me,onSubmit:ve,onSkip:ae}:null,formMarkers:N,onFillForm:De}),Qe,i(eg,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?i(ar,{panelEl:Le,resize:t.size.resize,position:t.position,initialSize:G,onSizeChange:le,strings:Ie}):null]})}function Ym({strings:e,onBack:t,onClose:n,showClose:o}){return i("header",{class:`${je}-header`,children:[i("button",{type:"button",class:`${je}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:i(Zn,{})}),i("h1",{children:e.historyTitle}),o?i("button",{type:"button",class:`${je}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:i(ft,{})}):null]})}function Jm({label:e,ctaLabel:t,onNewConversation:n}){return i("div",{class:`${je}-readonly-banner`,role:"note",children:[i("span",{class:`${je}-readonly-label`,children:e}),i("button",{type:"button",class:`${je}-readonly-cta`,onClick:n,children:t})]})}function Qm({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:o,strings:r}){let a=Zm(e,t,n,r);return i("div",{class:`${je}-operator-banner`,role:"status","data-mode":e,"data-testid":R.operatorBanner,children:[i("span",{class:`${je}-operator-pulse`,"aria-hidden":"true"}),i("span",{class:`${je}-operator-label`,children:a}),e==="awaiting_operator"&&o?i("button",{type:"button",class:`${je}-cancel-operator-request`,"data-testid":R.cancelOperatorRequest,onClick:o,children:r.cancelOperatorRequest}):null]})}function Zm(e,t,n,o){return e==="operator"?o.chattingWithOperator.replace("{operator}",t??""):n===!1?o.noOperatorAvailable:o.connectingOperator}function eg({disclaimer:e}){return e?i("div",{class:`${je}-composer-footer`,children:i("div",{class:`${je}-disclaimer`,children:e})}):null}function ri({poweredBy:e}){return e?i("div",{class:`${je}-poweredby-bar`,children:i(tg,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function tg({logoUrl:e,text:t,href:n}){let o=i(ce,{children:[e?i("img",{class:`${je}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?i("span",{children:t}):null]});return n?i("a",{class:`${je}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):i("span",{class:`${je}-poweredby`,children:o})}function gd(e){let t=M(e);t.current=e;let n=M(null);return n.current??(n.current=ng(t)),n.current}function ng(e){let t=Q(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,r=c=>c.frequency==="always"?!1:c.frequency==="conversation"?n.has(o(c.id)):c.id in e.current.persistence.loadFormsDone(),a=(c,u)=>{if(t.value)return;let _=e.current;if(c==="manual"){let p=_.forms.list.find(d=>d.id===u);p&&(t.value={form:p,trigger:"manual"});return}for(let p of _.forms.byTrigger[c]??[]){let d=p.triggers.find(f=>f.kind===c);if(!(!d||!og(d,_)||r(p)||!rg(p,_))){t.value={form:p,trigger:c};return}}},s=(c,u)=>{let _=t.value;if(!_)return;t.value=null;let{form:p,trigger:d}=_;p.frequency==="conversation"?n.add(o(p.id)):p.frequency!=="always"&&e.current.persistence.saveFormDone(p.id),e.current.onComplete(p,d,c,u)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let u=e.current.forms.list.find(_=>_.id===c.form.id);u&&u!==c.form&&(t.value={form:u,trigger:c.trigger})},complete:c=>s(c,!1),skip:()=>s({},!0)}}function og(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function rg(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let r=t.userContext()??{};if(n.missingContext.some(a=>r[a]!==void 0&&r[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let o=t.messageCount();return!(n.minMessages!=null&&o<n.minMessages||n.maxMessages!=null&&o>n.maxMessages)}function vd(e){let t=w.cssPrefix,{site:n,blocks:o,strings:r,collapsed:a}=e,s=o?.navigation??[],l=o?.linkCards??[],c=a?r.expandSidebar:r.collapseSidebar;return i("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":R.sidebar,children:[i("div",{class:`${t}-sidebar-header`,children:[i(ag,{site:n}),i("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":R.sidebarToggle,children:i(ig,{collapsed:a})})]}),a?null:i(ce,{children:[s.length>0?i("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:i(sg,{items:s})}):null,l.length>0?i("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:i(lg,{items:l})}):null,e.showConversations?i("div",{class:`${t}-sidebar-conversations`,children:i(Sr,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,visitorId:e.visitorId,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function ag({site:e}){let t=w.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return i("picture",{children:[e.logoDark?.url?i("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,i("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return i("div",{class:`${t}-sidebar-title`,children:e?.title??w.name})}function ig({collapsed:e}){return i("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?i("polyline",{points:"9 6 15 12 9 18"}):i("polyline",{points:"15 6 9 12 15 18"})})}function sg({items:e}){let t=w.cssPrefix;return i("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>i("li",{children:i("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?i("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,i("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function lg({items:e}){let t=w.cssPrefix;return i("div",{class:`${t}-sidebar-cards`,children:e.map(n=>i("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[i("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?i("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var hd=w.cssPrefix;function bd(e){return i("main",{class:`${hd}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[i(vd,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,visitorId:e.visitorId,showConversations:e.showConversations,onSelectConversation:e.onSelectConversation,onNewConversation:e.onNewConversation,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),i("section",{class:`${hd}-page-chat`,"aria-label":"Chat",children:e.children})]})}var yd=e=>Object.fromEntries(e.map(t=>[t,[]]));function ai(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function Pd(e,t,n){let o=[...new Set(t)],r=ai(o,e,""),a=Q({activeTab:r,stacks:yd(o)});return{sig:a,reconcile(s,l){let c=[...new Set(s)],u=a.value,_=ai(c,u.activeTab,l),p=Object.fromEntries(c.map(f=>[f,u.stacks[f]??[]])),d=_===u.activeTab&&c.length===Object.keys(u.stacks).length&&c.every(f=>u.stacks[f]===p[f]);o=c,!d&&(a.value={activeTab:_,stacks:p},_!==u.activeTab&&_&&n?.(_))},switchTab(s){!(s in a.value.stacks)||a.value.activeTab===s||(a.value={...a.value,activeTab:s},n?.(s))},push(s){let l=a.value,c=l.stacks[l.activeTab]??[];a.value={...l,stacks:{...l.stacks,[l.activeTab]:[...c,s]}}},pop(){let s=a.value,l=s.stacks[s.activeTab]??[];l.length!==0&&(a.value={...s,stacks:{...s.stacks,[s.activeTab]:l.slice(0,-1)}})},reset(s){a.value={activeTab:ai(o,s,""),stacks:yd(o)}}}}var xd=e=>e.stacks[e.activeTab]??[],Sd=e=>xd(e).at(-1),kd=e=>xd(e).length===0;var wd={Icon:to};var Bt=w.cssPrefix;function kr({title:e,actions:t}){return i("header",{class:`${Bt}-back-header`,"data-variant":"title",children:[i("span",{class:`${Bt}-back-spacer`,"aria-hidden":"true"}),i("h1",{class:`${Bt}-back-title`,children:e}),t??i("span",{class:`${Bt}-back-spacer`,"aria-hidden":"true"})]})}function wr({title:e,backLabel:t,onBack:n,actions:o,testid:r}){return i("header",{class:`${Bt}-back-header`,"data-testid":r,children:[i("button",{type:"button",class:`${Bt}-icon-btn`,onClick:n,"aria-label":t,title:t,children:i(Zn,{})}),i("h1",{class:`${Bt}-back-title`,children:e}),o??i("span",{class:`${Bt}-back-spacer`,"aria-hidden":"true"})]})}function an(e,t){return e instanceof Ve&&e.status===429?t.errorRateLimited:t.errorGeneric}var In=w.cssPrefix;function Cd({placeholder:e,onActivate:t}){return i("button",{type:"button",class:`${In}-home-search`,onClick:t,"data-testid":R.homeSearch,children:[i("span",{class:`${In}-home-search-text`,children:e}),i("span",{class:`${In}-home-search-icon`,"aria-hidden":"true",children:i(Da,{})})]})}function Rd({placeholder:e,value:t,onInput:n}){return i("div",{class:`${In}-home-search`,"data-input":"true",children:[i("input",{type:"search",class:`${In}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":R.helpSearch}),i("span",{class:`${In}-home-search-icon`,"aria-hidden":"true",children:i(Da,{})})]})}var ao=w.cssPrefix;function Cr({title:e,subtitle:t,onClick:n,testid:o}){return i("button",{type:"button",class:`${ao}-list-row`,onClick:n,"data-testid":o,children:[i("span",{class:`${ao}-list-row-body`,children:[i("span",{class:`${ao}-list-row-title`,children:e}),t?i("span",{class:`${ao}-list-row-sub`,children:t}):null]}),i("span",{class:`${ao}-list-row-chevron`,"aria-hidden":"true",children:i(kn,{})})]})}var Td=w.cssPrefix;function lt({tone:e="info",message:t,onRetry:n,strings:o}){return i("div",{class:`${Td}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[i("span",{children:t}),n?i("button",{type:"button",class:`${Td}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var sn=w.cssPrefix,cg=X.scope("help"),dg=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function ug(e){let t=new Map;for(let n of e){let o=n.categories?.[0]??"";(t.get(o)??t.set(o,[]).get(o)).push(n)}return[...t.entries()]}function Id(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let r=0;for(let a of e){if(r=n.indexOf(a,r),r===-1)return 0;r+=1}return 1}function _g(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(Id(n,o.title)*2,Id(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,r)=>r.score-o.score).map(o=>o.item):[]}function Ed({article:e,nav:t}){return i(Cr,{title:e.title,subtitle:e.description,onClick:()=>dg(t,e),testid:Ge(R.helpArticle,e.id)})}function pg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=D("loading"),[u,_]=D(t.errorGeneric),[p,d]=D([]),[f,m]=D(""),[g,h]=D(0);E(()=>{let b=!1;return c("loading"),e.listContent({tags:s,sortBy:"order",limit:100}).then(y=>{if(b)return;let k=y.items??[];d(k),c("loaded"),r.emit("contentView",{section:"help",tags:s?.join(","),count:k.length})}).catch(y=>{b||(cg.warn("listContent (help) failed",{err:y}),_(an(y,t)),c("error"))}),()=>{b=!0}},[e,s,g,r]);let P=ee(()=>_g(p,f),[p,f]);E(()=>{let b=f.trim();if(!b)return;let y=setTimeout(()=>r.emit("contentSearch",{queryLength:b.length,hitCount:P.length}),600);return()=>clearTimeout(y)},[f,P,r]);function x(){return f.trim().length>0?P.length===0?i(lt,{message:t.helpSearchEmpty,strings:t}):i("div",{class:`${sn}-help-card`,children:P.map(b=>i(Ed,{article:b,nav:o},b.id))}):l==="loading"?i(lt,{message:t.helpLoading,strings:t}):l==="error"?i(lt,{tone:"error",message:u,onRetry:()=>h(b=>b+1),strings:t}):p.length===0?i(lt,{message:t.helpEmpty,strings:t}):ug(p).map(([b,y])=>i("section",{class:`${sn}-help-group`,children:[b?i("h2",{class:`${sn}-help-section-title`,children:b}):null,i("div",{class:`${sn}-help-card`,children:y.map(k=>i(Ed,{article:k,nav:o},k.id))})]},b))}return i("div",{class:`${sn}-module`,children:[i(kr,{title:t.helpTitle,actions:i(mt,{panelProps:a,variant:"plain"})}),i("div",{class:`${sn}-module-pad`,children:i(Rd,{placeholder:t.helpSearchPlaceholder,value:f,onInput:m})}),i("div",{class:`${sn}-help-list`,children:x()})]})}var Ad={Icon:eo,Root:e=>i(pg,{...e})};var Md=w.cssPrefix;function ii({onClick:e,children:t,testid:n}){return e?i("button",{type:"button",class:`${Md}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):i("div",{class:`${Md}-home-card`,"data-testid":n,children:t})}var we=w.cssPrefix,Ld=X.scope("home");function fg(e){let t=e.options.userContext?.name,n=e.config.greetingText?Ze(e.strings,e.config.greetingText):void 0;return n?{title:t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),subtitle:e.strings.homeGreetingLead}:t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}var mg=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function gg(e){let{transport:t,strings:n,config:o,nav:r,bus:a,panelProps:s}=e,[l,c]=D(null),[u,_]=D([]),p=o.contentTags?.join(","),d=e.options.modules.list.some(x=>x.layout==="chat");E(()=>{if(o.showRecentConversations===!1)return;let x=!1;return t.listConversations({limit:d?50:1}).then(b=>!x&&c(b.conversations?.[0]??null)).catch(b=>!x&&Ld.warn("listConversations (home) failed",{err:b})),()=>{x=!0}},[t,o.showRecentConversations,d]),E(()=>{if(!o.contentTags?.length)return;let x=!1;return t.listContent({tags:o.contentTags,limit:6}).then(b=>{if(x)return;let y=b.items??[];_(y),a.emit("contentView",{section:"home",tags:p,count:y.length})}).catch(b=>!x&&Ld.warn("listContent (home) failed",{err:b})),()=>{x=!0}},[t,p,a]);let f=fg(e),m=o.userAvatars??[],g=o.status,h=g?.text?Ze(n,g.text):n.homeStatus,P=o.contentBlockTitle?Ze(n,o.contentBlockTitle):n.homeContentTitle;return i("div",{class:`${we}-module ${we}-home`,"data-testid":R.homeView,children:i("div",{class:`${we}-home-scroll`,children:[i("div",{class:`${we}-home-hero`,children:[i("div",{class:`${we}-home-hero-top`,children:[o.brandName?i("span",{class:`${we}-home-brand`,"data-testid":R.homeBrand,children:o.brandName}):i("span",{class:`${we}-home-brand-spacer`,"aria-hidden":"true"}),i("div",{class:`${we}-home-hero-actions`,children:[m.length>0?i("div",{class:`${we}-home-avatars`,children:m.map(x=>i("span",{class:`${we}-home-avatar`,title:x.role?`${x.name} \xB7 ${x.role}`:x.name,children:x.avatar?i("img",{src:x.avatar,alt:"",loading:"lazy"}):i("span",{children:cr(x.name)})},x.name))}):null,i(mt,{panelProps:s,variant:"plain"})]})]}),o.showGreeting!==!1?i(ce,{children:[i("h1",{class:`${we}-home-greeting`,"data-testid":R.homeGreeting,children:f.title}),f.subtitle?i("p",{class:`${we}-home-lead`,children:f.subtitle}):null]}):null]}),i("div",{class:`${we}-home-cards`,children:[o.showSearchBar!==!1?i(Cd,{placeholder:n.homeSearchPlaceholder,onActivate:()=>r.switchToLayout("help")}):null,l?i(ii,{onClick:()=>r.selectConversation(l.conversationId),testid:R.homeRecent,children:i("div",{class:`${we}-home-recent-row`,"data-unread":l.hasUnread?"true":void 0,children:[i("span",{class:`${we}-home-recent-avatar`,"aria-hidden":"true",children:i(to,{})}),i("span",{class:`${we}-home-recent-body`,children:[i("span",{class:`${we}-home-recent-title`,children:l.title}),l.preview?i("span",{class:`${we}-home-recent-preview`,children:l.preview}):null]}),l.hasUnread?i("span",{class:`${we}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,g?i(ii,{onClick:g.url?()=>r.push({kind:"iframe",url:g.url,title:h}):void 0,children:i("div",{class:`${we}-home-status`,"data-level":g.level??"operational",children:[i("span",{class:`${we}-home-status-icon`,"aria-hidden":"true",children:i(nc,{})}),i("span",{class:`${we}-home-status-text`,children:h})]})}):null,u.length>0?i("section",{class:`${we}-home-content`,children:[i("div",{class:`${we}-home-content-title`,children:P}),i("div",{class:`${we}-home-content-list`,children:u.map(x=>i(Cr,{title:x.title,subtitle:x.description,onClick:()=>mg(r,x),testid:Ge(R.homeContentRow,x.id)},x.id))})]}):null]})]})})}var Od={Icon:oc,Root:e=>i(gg,{...e})};var Ht=w.cssPrefix,vg=X.scope("news");function hg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=D("loading"),[u,_]=D(t.errorGeneric),[p,d]=D([]),[f,m]=D(0);E(()=>{let h=!1;return c("loading"),e.listContent({tags:s,sortBy:"publishedAt",sortOrder:"desc"}).then(P=>{if(h)return;let x=P.items??[];d(x),c("loaded"),r.emit("contentView",{section:"news",tags:s?.join(","),count:x.length})}).catch(P=>{h||(vg.warn("listContent (news) failed",{err:P}),_(an(P,t)),c("error"))}),()=>{h=!0}},[e,s,f,r]);function g(){return l==="loading"?i(lt,{message:t.newsLoading,strings:t}):l==="error"?i(lt,{tone:"error",message:u,onRetry:()=>m(h=>h+1),strings:t}):p.length===0?i(lt,{message:t.newsEmpty,strings:t}):i("div",{class:`${Ht}-news-list`,children:p.map(h=>i("button",{type:"button",class:`${Ht}-news-card`,onClick:()=>o.push({kind:"content",id:h.id,title:h.title}),"data-testid":Ge(R.newsItem,h.id),children:[h.image?i("img",{class:`${Ht}-news-hero`,src:h.image,alt:"",loading:"lazy"}):null,i("span",{class:`${Ht}-news-body`,children:[i("span",{class:`${Ht}-news-title`,children:h.title}),h.description?i("span",{class:`${Ht}-news-summary`,children:h.description}):null]})]},h.id))})}return i("div",{class:`${Ht}-module`,children:[i(kr,{title:t.newsTitle,actions:i(mt,{panelProps:a,variant:"plain"})}),i("div",{class:`${Ht}-module-scroll`,children:g()})]})}var Nd={Icon:rc,Root:e=>i(hg,{...e})};var Rr={chat:wd,home:Od,help:Ad,news:Nd};var io=w.cssPrefix;function Dd({modules:e,activeTab:t,strings:n,hasUnread:o,onSelect:r}){return i("nav",{class:`${io}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=Rr[a.layout].Icon,l=a.id===t,c=a.layout==="chat"&&o;return i("button",{type:"button",role:"tab","aria-selected":l,class:`${io}-tab`,onClick:()=>r(a.id),"data-testid":Ge(R.tab,a.id),children:[i("span",{class:`${io}-tab-icon`,"aria-hidden":"true",children:[i(s,{}),c?i("span",{class:`${io}-tab-badge`,"data-testid":R.tabBadge,"aria-label":"Unread"}):null]}),i("span",{class:`${io}-tab-label`,children:Ze(n,a.label)})]},a.id)})})}var $d=w.cssPrefix,bg="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function Fd({url:e,title:t,strings:n,onBack:o,actions:r}){return i("div",{class:`${$d}-module`,children:[i(wr,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:r}),i("iframe",{class:`${$d}-content-frame`,src:e,title:t||"content",sandbox:bg,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var so=w.cssPrefix,yg=X.scope("content"),Pg=5e3;function Bd({id:e,title:t,transport:n,strings:o,bus:r,onBack:a,actions:s}){let[l,c]=D(null),[u,_]=D(!1),[p,d]=D(0),f=O(()=>{_(!1),c(null),d(h=>h+1)},[]);E(()=>{let h=!1;return n.listContent({ids:[e],limit:1}).then(P=>{if(h)return;let x=P.items[0];x?(c(x),r.emit("contentOpen",{contentId:e,tags:x.tags?.length?x.tags.join(","):void 0})):_(!0)}).catch(P=>{h||(yg.warn("listContent (reader) failed",{err:P}),_(!0))}),()=>{h=!0}},[n,e,p,r]),E(()=>{if(!l)return;let h=setTimeout(()=>r.emit("contentRead",{contentId:e}),Pg);return()=>clearTimeout(h)},[l,e,r]);let m=O(h=>{let x=h.target?.closest?.("a")?.getAttribute("href")??"";x&&!x.startsWith("#")&&r.emit("contentLinkClick",{contentId:e})},[r,e]);function g(){return u?i(lt,{tone:"error",message:o.errorGeneric,onRetry:f,strings:o}):l===null?i(lt,{message:o.contentLoading,strings:o}):i("article",{class:`${so}-content`,"data-testid":R.contentView,onClick:m,children:[l.image?i("img",{class:`${so}-content-hero`,src:l.image,alt:"",loading:"lazy"}):null,l.description?i("p",{class:`${so}-content-subtitle`,children:l.description}):null,i(Zc,{text:l.content??""})]})}return i("div",{class:`${so}-module`,children:[i(wr,{title:l?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:a,actions:s,testid:R.backHeader}),i("div",{class:`${so}-module-scroll`,"data-testid":R.contentScroll,children:g()})]})}var Tr=w.cssPrefix;function Hd({panelProps:e,enabledModules:t,nav:n,bus:o,hasUnread:r,onSelectConversation:a,onStartNewConversation:s,onSetPanelSize:l}){let c=e.options,u=c.strings,_=M(null),p=M(new Set);E(()=>{let L=_.current;if(!L)return;let ne=lr(L),re=le=>{le.key==="Escape"&&e.onClose?.()};return L.addEventListener("keydown",re),()=>{ne(),L.removeEventListener("keydown",re)}},[e.onClose]);let d=ut(()=>n.sig.value).value,f=Sd(d),m=c.modules.byId[d.activeTab],g=e.composerActive&&m?.layout==="chat"&&f===void 0,h=e.composerApiRef,P=g&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,x=O(L=>{P&&h.current?.attachFromDrop(L)},[h,P]),{visible:b}=_r({containerRef:_,onDrop:x,disabled:!P});ir(_.current,c.mode==="modal");let y=f?.kind==="iframe"||f?.kind==="content",k=t.length>1&&(kd(d)||!y),C=M(null);E(()=>{if(y&&C.current===null)C.current=e.panelSize,e.panelSize==="normal"&&l("expanded");else if(!y&&C.current!==null){let L=C.current;C.current=null,l(L)}},[y]);let B={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:L=>{let ne=t.find(re=>re.layout===L);ne&&n.switchTab(ne.id)},selectConversation:a,startNewConversation:s},G=L=>({options:c,transport:e.transport,strings:u,config:L,visitorId:e.visitorId,nav:B,bus:o,panelProps:e}),U=i(mt,{panelProps:e,variant:"plain"});m&&p.current.add(m.id);let I=t.filter(L=>p.current.has(L.id)),z=L=>{if(L.layout==="chat")return i(oi,{...e,composerActive:g,containerEl:_.current,dragOver:b,composerAttachApiRef:h});let ne=Rr[L.layout].Root;return ne?i(ne,{...G(L)}):null},W=()=>f?.kind==="iframe"?i(Fd,{url:f.url,title:f.title,strings:u,onBack:n.pop,actions:U}):f?.kind==="content"?i(Bd,{id:f.id,title:f.title,transport:e.transport,strings:u,bus:o,onBack:n.pop,actions:U}):null;return i("div",{ref:_,class:`${Tr}-panel ${Tr}-messenger`,role:"dialog","aria-modal":"false","aria-label":u.panelTitle,style:{position:"relative"},"data-testid":R.messengerHome,children:[i("div",{class:`${Tr}-messenger-body`,children:[I.map(L=>i("div",{class:`${Tr}-messenger-pane`,hidden:y||L.id!==m?.id,children:z(L)},L.id)),W()]}),k?i(Dd,{modules:t,activeTab:d.activeTab,strings:u,hasUnread:r,onSelect:n.switchTab}):null,i(ri,{poweredBy:c.poweredBy}),c.size.resize?.enabled&&!(m?.layout==="chat"&&!f)?i(ar,{panelEl:_.current,resize:c.size.resize,position:c.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:u}):null]})}var lo=w.cssPrefix;function Ud({strings:e,onClose:t}){return i("div",{class:`${lo}-panel ${lo}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":R.modulesEmpty,children:[t?i("button",{type:"button",class:`${lo}-icon-btn ${lo}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:i(ft,{})}):null,i("p",{class:`${lo}-modules-empty-text`,children:e.modulesEmpty})]})}function En(e,t,n,o){let r={role:n,text:o};e.emit("message",r),t.onMessage?.(r)}var si=X.scope("hitl");function zd(e){let{streaming:t,controlModeSig:n,messagesSig:o,sendAiTurn:r,bus:a,humanInLoop:s}=e,l=M(t);l.current=t;let c=O((d,f,m)=>{if(l.current||n.value!=="ai-agent")return!1;let g=o.value.at(-1),h=g?.partsSig.value.findIndex(x=>x.kind==="tool"&&x.toolCallId===d)??-1,P=g?.partsSig.value[h];return!g||P?.kind!=="tool"?(si.warn("decideTool: tool part not found",{toolCallId:d}),!1):g.status!=="complete"||!Xo(g,h)||!f(P)?!1:(m(P),g.partsSig.value=[...g.partsSig.value],Zt(g)&&(g.status="streaming",g.retryAction={kind:"continue-assistant",messageId:g.serverMessageId??g.id},g.awaitingContinuation=!0,o.value=[...o.value],r({continueExisting:!0})),!0)},[n,o,r]),u=O((d,f,m)=>{let g=!1;if(c(d,P=>P.stateSig.value==="approval-requested",P=>{g=mr(P.toolName);let x=P.approvalSig.value?.id??d;P.approvalSig.value={id:x,approved:f,reason:m},P.stateSig.value="approval-responded"})){if(g){si.info("toolResult",{toolCallId:d}),a.emit("toolResult",{toolCallId:d});return}si.info("toolDecision",{toolCallId:d,approved:f}),a.emit("toolDecision",{toolCallId:d,approved:f})}},[a,c]),_=O(d=>{c(d,f=>f.stateSig.value==="approval-responded"&&f.approvalSig.value?.approved!==void 0,f=>{let m=f.approvalSig.value?.id??d;f.approvalSig.value={id:m},f.stateSig.value="approval-requested"})},[c]);return{toolInteraction:ee(()=>({humanInLoop:s,onDecision:u,onEdit:_}),[s,u,_])}}function qd({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[r,a]=D(()=>o?!1:t.loadCalloutDismissed(n));E(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let s=O(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:r,dismissCallout:s}}function Wd(e){let{transport:t,conversationIdSig:n}=e,o=dt("ai-agent"),r=dt(void 0),a=dt(void 0),s=M(),l=O(p=>{let d=p.controlRevision??0,f=s.current;f&&f.conversationId===n.value&&d<f.revision||(s.current={conversationId:n.value,revision:d},o.value=p.controlMode,r.value=p.assignedOperatorInitials,p.controlMode!=="awaiting_operator"?a.value=void 0:p.operatorAvailable!==void 0&&(a.value=p.operatorAvailable))},[n,o,r,a]),c=O(p=>{p.type==="data-control-state"&&l(Ot(p.data))},[l]),u=O(async()=>{let p=n.value,d=await t.requestOperator();d&&n.value===p&&l(Ot(d))},[t,n,l]),_=O(async()=>{let p=n.value,d=await t.cancelOperatorRequest();d&&n.value===p&&l(Ot(d))},[t,n,l]);return{controlModeSig:o,assignedOperatorInitialsSig:r,operatorAvailableSig:a,applyControlState:l,adoptControlStateChunk:c,requestOperator:u,cancelOperatorRequest:_}}var Ir=w.cssPrefix,Vd=`--${Ir}-visual-viewport-height`,Gd=`--${Ir}-visual-viewport-top`;function Kd(e){let{hostElement:t,mode:n,panelSize:o,isOpen:r,setIsOpen:a}=e;pt(()=>{Lo(t,Wo(n,o,r))},[t,r,o,n]),E(()=>{if(!r)return;let s=t.ownerDocument.defaultView?.visualViewport,l=t.shadowRoot?.querySelector(`.${Ir}-anchor`);if(!s||!l)return;let c=()=>{l.style.setProperty(Vd,`${s.height}px`),l.style.setProperty(Gd,`${s.offsetTop}px`)};return c(),s.addEventListener("resize",c),s.addEventListener("scroll",c),()=>{s.removeEventListener("resize",c),s.removeEventListener("scroll",c),l.style.removeProperty(Vd),l.style.removeProperty(Gd)}},[t,r]),E(()=>{if(n!=="modal"||!r)return;let s=l=>{l.composedPath().some(u=>u instanceof HTMLElement&&u.classList.contains(`${Ir}-panel`))||a(!1)};return t.addEventListener("click",s),()=>t.removeEventListener("click",s)},[t,r,n,a]),E(()=>{if(n!=="drawer"||!r)return;let s=l=>{l.key==="Escape"&&a(!1)};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[r,n,a])}var li=X.scope("reducer"),Er=class{constructor(t,n){te(this,"messagesSig",t);te(this,"onReconcileNeeded",n);te(this,"active",null);te(this,"openTextParts",new Map);te(this,"partSeq",0);te(this,"replay",null)}attach(t){this.active=t,this.openTextParts.clear()}detach(){this.active=null,this.replay=null,this.openTextParts.clear()}beginReplay(t,n){let o=Rt();o.id=t.id;let r=ln(t)||en(t)&&(t.status!=="streaming"||Zt(t)),a=t.status==="streaming"&&Zt(t)&&Yn(t);this.replay={baseline:t,shadow:o,chunks:[n],probeContinuation:r,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!r},this.attach(o),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t.baseline||r?.id===t.baseline.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t.baseline)??o.find(l=>l.id===t.baseline.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let s=t.baseline;return t.baseline=a,jd(s,a),t.liveCatchUp&&ln(t.shadow)&&(a.status==="streaming"||en(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=ln(a)||en(a)&&(a.status!=="streaming"||Zt(a)),t.continuationTailReplay=a.status==="streaming"&&Zt(a)&&Yn(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t||r?.id===t.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t)??o.find(l=>l.id===t.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;jd(t,a);let s=ln(t)&&en(a);return a.status!=="streaming"&&!s?(this.detach(),null):(this.replay={baseline:a,shadow:t,chunks:[],probeContinuation:!1,continuationTailReplay:!1,liveCatchUp:!0},t)}promoteReplay(){let{baseline:t,shadow:n}=this.replay;return it(()=>{t.role=n.role,t.serverMessageId=n.serverMessageId,t.operatorInitials=n.operatorInitials,t.status=n.status,n.canceled&&(t.canceled=!0),t.finishReason=n.finishReason,t.errorText=n.errorText,t.suggestions=n.suggestions??t.suggestions,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(t=!1){let{baseline:n,chunks:o}=this.replay,r=Yo(n);return this.replay=null,it(()=>{if(t){let a=n.partsSig.value.findLastIndex(s=>s.kind==="tool");n.partsSig.value=n.partsSig.value.slice(0,a+1)}n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n);for(let a of o)this.apply(a);n.continuationStreaming=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,o=Yo(n);return this.replay=null,it(()=>{n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n),this.apply(t),n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let r=(this.replay?.baseline??this.active)?.serverMessageId;r!==void 0&&t.messageId!==void 0&&r!==t.messageId&&this.onReconcileNeeded?.({messageId:r}),this.detach();let a=t.messageId,s=a!==void 0?this.messagesSig.value.find(_=>_.serverMessageId===a||_.id===a):void 0;if(s!==void 0)return t.messageMetadata?.senderRole==="visitor"&&s.role==="user"&&(s.status==="pending"||s.status==="error")&&(s.serverMessageId=a,s.status="complete",s.errorText=void 0,s.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(s,t),null;let l=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(l===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!Dt(c))return this.attach(c),this.apply(t),null;let u=Rt();return this.attach(u),this.messagesSig.value=[...this.messagesSig.value,u],this.apply(t),null}if(this.replay){let o=this.refreshReplayBaseline();if(!o)return null;o.chunks.push(t),t.type==="data-control-state"&&(o.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:r,shadow:a,probeContinuation:s,continuationTailReplay:l,liveCatchUp:c}=o,u=t.type==="finish"||t.type==="error"||t.type==="abort";if(s){if(!kg(r,a,t))return u&&(Tg(r,a)&&(r.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id})),this.detach()),null;let p=ln(r)&&u?this.settleOwnedContinuation(t):this.promoteContinuation();return u?(p.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:p.serverMessageId??p.id}):p.continuationStreaming=!1),this.detach(),p):null}if(l&&Sg(r,a)){let p=this.promoteContinuation(!0);return u?(this.detach(),p):null}if(!c)return u&&this.detach(),null;if(u&&!Dt(r)&&Dt(a)){let p=this.promoteReplay();return this.detach(),p}if(!xg(r,a))return u&&(this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}),this.detach()),null;let _=this.promoteReplay();return u?(this.detach(),_):null}let n=this.refreshActive();if(!n)return null;if(this.replay)return this.applyResume(t);if(this.apply(t),t.type==="finish"||t.type==="error"||t.type==="abort"){let o=n;return o.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}):o.continuationStreaming=!1),this.detach(),o}return null}ensureTextPart(t,n,o){let r=`${n}:${o}`,a=this.openTextParts.get(r);if(a)return a;let s={kind:n,id:`${o}#${this.partSeq++}`,textSig:Q(""),doneSig:Q(!1)};return this.openTextParts.set(r,s),co(t,s),s}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let o=t.messageMetadata;o?.senderRole==="operator"?(n.role="operator",o.operatorInitials&&(n.operatorInitials=o.operatorInitials)):o?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":co(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":li.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",n.retryAction=void 0,t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":li.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":li.debug("stream abort chunk (canceled)"),n.status="complete",n.canceled=!0,n.retryAction=void 0,this.bumpDone(n);return;case"text-start":this.ensureTextPart(n,"text",t.id);return;case"text-delta":{let o=this.ensureTextPart(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":this.ensureTextPart(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=this.ensureTextPart(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-input-error":case"tool-output-available":case"tool-output-error":case"tool-output-denied":case"tool-approval-request":Ig(n,t);return;case"file":co(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":Xd(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":Xd(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=Go(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;default:{let o=t}}}bumpDone(t){it(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},ci={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function ln(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function jd(e,t){e.canceled&&(t.canceled=!0),!(!ln(e)||t.status!=="streaming"&&!en(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function xg(e,t){let n=e.partsSig.value,o=t.partsSig.value;return e.role!==t.role||o.length<n.length?!1:n.every((r,a)=>Yd(r,o[a]))}function Sg(e,t){let n=e.partsSig.value,o=n.findLastIndex(l=>l.kind==="tool"),r=new Set(n.slice(0,o+1).flatMap(l=>l.kind==="tool"?[l.toolCallId]:[])),a=t.partsSig.value.filter(l=>l.kind!=="tool"||!r.has(l.toolCallId)),s=n.slice(o+1);return a.length<s.length?!1:s.every((l,c)=>Yd(l,a[c]))}function Yd(e,t){switch(e.kind){case"text":case"reasoning":return t?.kind===e.kind&&t.textSig.value.startsWith(e.textSig.value);case"step-start":return t?.kind==="step-start";case"tool":{if(t?.kind!=="tool"||t.toolCallId!==e.toolCallId||!Jo(t.toolName,e.toolName)||ci[t.stateSig.value]<ci[e.stateSig.value])return!1;let n=e.approvalSig.value?.approved;return n===void 0||t.approvalSig.value?.approved===n}case"file":return t?.kind==="file"&&t.url===e.url&&t.mediaType===e.mediaType;case"source":return t?.kind==="source"&&t.sourceId===e.sourceId&&t.url===e.url&&t.title===e.title&&t.filename===e.filename&&t.mediaType===e.mediaType;default:return e}}function kg(e,t,n){return wg(e,n)||!Cg(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:Yn(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(o=>o.kind==="step-start")}function wg(e,t){if(t.type!=="tool-output-available"&&t.type!=="tool-output-error"&&t.type!=="tool-output-denied")return!1;let n=e.partsSig.value.find(o=>o.kind==="tool"&&o.toolCallId===t.toolCallId);return n!==void 0&&ci[n.stateSig.value]<4}function Cg(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let o=e.partsSig.value;return o.some((r,a)=>n.every((s,l)=>Rg(o[a+l],s)))}function Rg(e,t){switch(t.kind){case"text":case"reasoning":return e?.kind===t.kind&&e.textSig.value.startsWith(t.textSig.value);case"step-start":return e?.kind==="step-start";case"tool":return e?.kind==="tool"&&e.toolCallId===t.toolCallId&&(t.toolName==="tool"||Jo(e.toolName,t.toolName));case"file":return e?.kind==="file"&&e.url===t.url&&e.mediaType===t.mediaType;case"source":return e?.kind==="source"&&e.sourceId===t.sourceId&&e.url===t.url&&e.title===t.title&&e.filename===t.filename&&e.mediaType===t.mediaType;default:return t}}function Tg(e,t){if(ln(e)||!en(e))return!1;let n=new Set(e.partsSig.value.filter(r=>r.kind==="tool").map(r=>r.toolCallId));return!t.partsSig.value.some(r=>r.kind==="tool"&&n.has(r.toolCallId))}function Ut(e,t,n,o){let r=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(r)return o&&(r.dynamic=!0),r;let a={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:o?!0:void 0,inputPartialSig:Q(""),inputSig:Q(void 0),outputSig:Q(void 0),errorSig:Q(void 0),stateSig:Q("input-streaming"),approvalSig:Q(void 0)};return co(e,a),a}function co(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Xd(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||co(e,t)}function Ig(e,t){switch(t.type){case"tool-input-start":Ut(e,t.toolCallId,t.toolName,t.dynamic);return;case"tool-input-delta":{let n=Ut(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=Ut(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=Ut(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-approval-request":{let n=Ut(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=Ut(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=Ut(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=Ut(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function Jd(e){let t=1e3,n=!1,o=!1,r=!1,a=()=>{r||e.signal.aborted||(r=!0,e.onInitialBoundaryReady())};for(;!e.signal.aborted;){let s,l="held";try{l=await e.connect(()=>{if(e.signal.aborted)return;s=e.now();let c=n||o;n=!0,o=!1,r?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&s===void 0&&(o=!0,a()),l==="unavailable"))return;s!==void 0&&e.now()-s>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var Qd=X.scope("resume-stream");function Zd(e){let{activated:t,conversationReady:n,conversationIdSig:o,messagesSig:r,optionsRef:a,isChatActiveRef:s,transport:l,visitorId:c,adoptControlStateChunk:u,settleSuggestions:_,markActiveConversationRead:p,onReplyLanded:d,runCancellation:f,setCanSend:m,feedback:g,bus:h,homeNav:P,loadInitialThread:x,shouldReconcileOnConnect:b}=e;E(()=>{if(!t||!n||!o.value)return;let y=o.value,k=new AbortController,C=N=>{},B=new Er(r,N=>C(N));l.primeIdentity(c,y),Qd.debug("resume stream opened",{conversationId:y});let G=!1,U=!1,I,z,W=0,L=(N,ve)=>{(N||!f.localSendRef.current)&&f.settle(ve),N&&(p(),d())},ne=(N,ve=[],ae=!1,De)=>{let xe=a.current;if(N.canceled){L(ae,De);return}let Te=N.status==="error";switch(Il(N,Te)){case"drop":r.value=r.value.filter(Ce=>Ce!==N);break;case"complete-operator-routed":N.status="complete",ae&&(g.play("messageReceived"),En(h,xe,"assistant",Ue(N)));break;case"error":{if(N.status="error",N.errorText=xe.strings.errorGeneric,ae){g.play("error");let Ce=new Error(Te?"stream error chunk":"empty reply");h.emit("error",Ce),xe.onError?.(Ce)}break}case"complete":N.status="complete",ae&&(g.play("messageReceived"),En(h,xe,"assistant",Ue(N))),_(N,ve);break}L(ae,De)},re=N=>{if(k.signal.aborted||o.value!==y)return;if(u(N),N.type==="start"){let Ce=z?.senderRole==="visitor"?z.messageId:void 0;if(z={messageId:N.messageId,senderRole:N.messageMetadata?.senderRole},W+=1,G=N.messageMetadata?.senderRole===void 0,U=!1,I=G?N.messageMetadata?.runId:void 0,G){let Le=N.messageId!==void 0&&r.value.some(Je=>Je.serverMessageId===N.messageId||Je.id===N.messageId),he=r.value.at(-1),Se=N.messageId!==void 0&&(he?.serverMessageId===N.messageId||he?.id===N.messageId),Ie=f.localSendRef.current&&(!Le||Se)&&he?.role==="assistant"&&he.status==="streaming"&&(Se||he.serverMessageId===void 0&&he.partsSig.value.length===0);U=f.captureStart(y,N,Ie,Ce)}}let ve=G&&(N.type==="finish"||N.type==="error"||N.type==="abort"),ae=ve?I:void 0,De=ve&&(U||f.ownsLocalRun(ae));ve&&(G=!1,U=!1,I=void 0);let xe=r.value.length,Te=B.applyResume(N);if(N.type==="finish"&&N.canContinue===!1&&m(!1),r.value.length>xe){let Ce=a.current.modules.list.find(Le=>Le.layout==="chat")?.id;Ce&&P?.switchTab(Ce)}if(!Te){ve&&(De||!f.localSendRef.current)&&f.settle(ae);return}if(Te.role==="operator"){g.play("messageReceived"),En(h,a.current,"operator",Ue(Te)),!document.hidden&&s.current()&&l.markRead(y).catch(()=>{}),ve&&(De||!f.localSendRef.current)&&f.settle(ae);return}Te.role==="assistant"&&ne(Te,[],De,ae)},le=async N=>{let ve=W,ae=await l.loadConversation(y,N?{ids:[N]}:void 0).catch(()=>null);if(k.signal.aborted||o.value!==y||!ae)return!1;ae.controlState&&u({type:"data-control-state",data:ae.controlState});let De=r.value.at(-1),xe=ve===W&&(N===void 0||De!==void 0&&(De.serverMessageId===N||De.id===N));if(!ae.messages?.length)return!1;xe&&m(ae.canContinue??!0);let Te=r.value,Ce=N===void 0?Te.at(-1):Te.find(Je=>Je.serverMessageId===N||Je.id===N),{messages:Le,changed:he}=Jn(Te,Nt(ae.messages));if(!he)return!1;r.value=Le;let Se=N===void 0?Le.at(-1):Le.find(Je=>Je.serverMessageId===N||Je.id===N),Ie=Ce?.role==="assistant"&&Ce.status==="streaming"&&Se?.role==="assistant"&&Se.status!=="streaming"&&Se.id===Ce.id;return xe&&Ie?ne(Se,ae.suggestions??[],f.localSendRef.current):xe&&Se?.role==="assistant"&&Se.status!=="streaming"&&_(Se,ae.suggestions??[]),!0},Ae=new Set;C=({messageId:N})=>{if(Ae.has(N)||!r.value.some(ae=>ae.serverMessageId===N||ae.id===N))return;Ae.add(N);let ve=()=>Ae.delete(N);le(N).then(ve,ve)};let de,_e=!1,Me=(N=!1)=>{if(k.signal.aborted||o.value!==y){_e=!1;return}if(de){_e=!0;return}let ve=N?x(y)??(b()?le():void 0):le();if(!ve)return;de=ve;let ae=()=>{de===ve&&(de=void 0,_e&&(_e=!1,Me()))};ve.then(ae,ae)};return Jd({signal:k.signal,now:()=>performance.now(),sleep:N=>Xn(N,k.signal),connect:N=>l.connectResumeStream({signal:k.signal,onChunk:re,onConnected:N}),onInitialBoundaryReady:()=>Me(!0),backfill:()=>Me()}),()=>{k.abort(),B.detach(),Qd.debug("resume stream closed",{conversationId:y})}},[t,n,o,o.value,c,l,u,_,p,d,f,m,r,h,g,P,x,b])}var Eg=32;function eu(e){let{transport:t,setStreaming:n}=e,o=M(),r=M(),a=M(!1),s=M(),l=M(!1),c=M(new Map),u=M(new Set),_=O((k,C)=>{let B=`${k}:${C}`;s.current!==B&&(s.current=B,t.cancelTurn(k,C))},[t]),p=O(k=>{o.current=void 0,r.current=k,a.current=!1,s.current=void 0,l.current=!0,n(!0)},[n]),d=O((k,C)=>{c.current.set(k,{messageId:C})},[]),f=O(k=>{k!==void 0&&(u.current.add(k),u.current.size>Eg&&u.current.delete(u.current.values().next().value)),!(k!==void 0&&o.current?.runId!==k)&&(o.current=void 0,r.current=void 0,a.current=!1,l.current=!1,n(!1))},[n]),m=O((k,C)=>r.current!==k?C.runId&&o.current?.runId===C.runId?(o.current={conversationId:C.conversationId,runId:C.runId},a.current&&_(C.conversationId,C.runId),!0):!1:(r.current=void 0,C.runId?(o.current={conversationId:C.conversationId,runId:C.runId},n(!0),a.current&&_(C.conversationId,C.runId),!0):(f(),!0)),[_,n,f]),g=O((k,C)=>{let B=c.current.get(k);return B?(c.current.delete(k),!C.runId||u.current.has(C.runId)?!0:B.runId!==void 0?(B.runId!==C.runId||o.current?.runId===C.runId&&(o.current={conversationId:C.conversationId,runId:C.runId},a.current&&_(C.conversationId,C.runId)),!0):(l.current||r.current||(o.current={conversationId:C.conversationId,runId:C.runId},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0)),!0)):!1},[_,n]),h=O(k=>r.current!==k?!1:(f(),!0),[f]),P=O(k=>{let C=c.current.get(k);return C?(c.current.delete(k),C.runId===void 0):!1},[]),x=O((k,C,B,G)=>{let U=C.messageMetadata?.runId;if(C.messageMetadata?.senderRole!==void 0||typeof U!="string"||!U||u.current.has(U))return!1;if(o.current?.runId===U)return l.current;if(l.current)return o.current||!B?!1:(r.current=void 0,o.current={conversationId:k,runId:U},n(!0),a.current&&_(k,U),!0);let z=[...c.current.values()].filter(W=>W.runId===void 0).find(W=>W.messageId===G);return z?(z.runId=U,o.current={conversationId:k,runId:U},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0),!0):(r.current=void 0,o.current={conversationId:k,runId:U},n(!0),a.current&&_(k,U),l.current)},[_,n]),b=O(k=>typeof k=="string"&&o.current?.runId===k&&l.current,[]),y=O(()=>{let k=o.current;if(k)return a.current=!0,_(k.conversationId,k.runId),!0;let C=r.current;return C?(a.current=!0,C.then(B=>{B.runId&&_(B.conversationId,B.runId)}).catch(()=>{}),!0):!1},[_]);return ee(()=>({localSendRef:l,begin:p,beginRouted:d,acceptAck:m,acceptRoutedAck:g,reject:h,rejectRouted:P,captureStart:x,ownsLocalRun:b,settle:f,stop:y}),[m,g,p,d,x,b,h,P,f,y])}var Ag=X.scope("send");function tu(e){return!(e instanceof Ve)||e.code==="network"||e.status===void 0||e.status===202?!0:e.status===408||e.status===425||e.status===429||e.status>=500&&e.status<600}function nu(e){let{transport:t,messagesSig:n,conversationIdSig:o,options:r,bus:a,feedback:s,persistence:l,visitorId:c,adoptConversationId:u,applyControlState:_,setCanSend:p,settleSuggestions:d,runCancellation:f}=e,m=O(()=>{let P=o.value??at();return o.value||(o.value=P,l.saveConversationId(P)),P},[o,l]),g=O(async({continueExisting:P,turn:x})=>{let b=m(),y=n.value.at(-1),k=x?[x]:xl(n.value,P),C=ka({messages:k.map(Ea),conversationId:b,visitorId:c,userPrefs:l.loadUserPrefs()}),B=t.sendTurn(C);f.begin(B);try{let G=await B;if(o.value!==b||!f.acceptAck(B,G))return;if(u(G.conversationId),!G.runId){let U=await t.loadConversation(G.conversationId).catch(()=>null);if(o.value!==G.conversationId)return;if(U){U.controlState&&_(U.controlState),p(U.canContinue??!0);let{messages:I,changed:z}=Jn(n.value,Nt(U.messages??[]));z&&(n.value=I);let W=y?n.value.find(L=>L.id===y.id&&L.role==="assistant"&&L.status!=="streaming"):void 0;W&&d(W,U.suggestions??[]),!P&&y?.role==="assistant"&&n.value.includes(y)&&y.serverMessageId===void 0&&!Dt(y)&&(n.value=n.value.filter(L=>L!==y))}else if(y?.role==="assistant"&&n.value.includes(y)){y.status="error",y.errorText=r.strings.errorGeneric;let I=k[0];P?y.retryAction={kind:"continue-assistant",messageId:y.serverMessageId??y.id}:y.retryAction=I?.role==="user"?{kind:"resend-user",messageId:I.id}:null,n.value=[...n.value]}}}catch(G){if(o.value!==b||!f.reject(B))return;let U=an(G,r.strings),I=tu(G),z=x?.role==="assistant"?x:n.value.at(-1);if(P&&z?.role==="assistant"&&G instanceof Ve&&G.status===409){let W=z.serverMessageId??z.id,L=await t.loadConversation(b,{ids:[W]}).catch(()=>null);if(o.value!==b)return;if(L){L.controlState&&_(L.controlState),p(L.canContinue??!0);let ne=Nt(L.messages??[]),re=ne.find(le=>(le.serverMessageId??le.id)===W);if(re&&Rl(z,re)){let{messages:le,changed:Ae}=Jn(n.value,ne),de=le.find(_e=>(_e.serverMessageId??_e.id)===W);if(Ae&&de&&de!==z){de.awaitingContinuation=!1,de.continuationStreaming=void 0,de.retryAction=null,n.value=le,de.status!=="streaming"&&d(de,L.suggestions??[]);return}}}if(!n.value.includes(z)||z.status!=="streaming")return;z.continuationStreaming=!0}if(P&&z?.role==="assistant")z.status="error",z.errorText=U,z.retryAction=I?{kind:"continue-assistant",messageId:z.serverMessageId??z.id}:null,n.value=[...n.value];else if(y?.role==="assistant"&&n.value.includes(y)){y.status="error",y.errorText=U;let W=k[0];y.retryAction=I&&W?.role==="user"?{kind:"resend-user",messageId:W.id}:null,n.value=[...n.value]}else{let W=Rt();W.status="error",W.errorText=U;let L=k[0];W.retryAction=I&&L?.role==="user"?{kind:"resend-user",messageId:L.id}:null,n.value=[...n.value,W]}s.play("error"),a.emit("error",G),r.onError?.(G)}},[t,n,r,a,s,l,c,u,_,p,d,m,f]),h=O(async P=>{let x=m();P.status="pending",P.errorText=void 0,P.retryAction=void 0,n.value.includes(P)&&(n.value=[...n.value]);let b=ka({messages:[Ea(P)],conversationId:x,visitorId:c,userPrefs:l.loadUserPrefs()}),y=t.sendTurn(b);f.beginRouted(y,P.id);try{let k=await y;if(o.value!==x){f.rejectRouted(y);return}if(!f.acceptRoutedAck(y,k))return;u(k.conversationId),P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value]))}catch(k){let C=f.rejectRouted(y);if(o.value!==x)return;if(!C){P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value]));return}if(P.status!=="pending")return;Ag.debug("operator-routed send failed",{error:k});let B=k instanceof Error?k:new Error(String(k));P.status="error",P.errorText=an(k,r.strings),P.retryAction=tu(k)?{kind:"resend-user",messageId:P.id}:null,n.value.includes(P)&&(n.value=[...n.value]),s.play("error"),a.emit("error",B),r.onError?.(B)}},[t,n,r,a,s,l,c,u,m,f]);return{sendAiTurn:g,sendRoutedTurn:h}}var Mg=X.scope("unread"),Lg=300;function ou(e){let{transport:t,options:n,conversationIdSig:o,isChatActiveRef:r,activated:a,conversationReady:s}=e,l=dt(!1),c=M(new Set),u=M();E(()=>()=>clearTimeout(u.current),[]);let _=O(()=>{let g=r.current()?o.value:void 0;l.value=[...c.current].some(h=>h!==g)},[l,o,r]),p=O(()=>{n.modules.list.some(g=>g.layout==="chat")&&t.listConversations({limit:50}).then(g=>{c.current=new Set(g.conversations.filter(h=>h.hasUnread).map(h=>h.conversationId)),_()}).catch(g=>Mg.debug("refreshUnread failed (non-fatal)",{err:g}))},[t,n.modules,_]),d=O(g=>{c.current.delete(g),_()},[_]),f=O(()=>{if(!r.current())return;let g=o.value;g&&(clearTimeout(u.current),u.current=setTimeout(()=>{d(g),t.markRead(g)},Lg))},[t,o,d,r]),m=M(!1);return E(()=>{!a||!s||m.current||(m.current=!0,p())},[a,s,p]),E(()=>{if(!a)return;let g=()=>{document.visibilityState==="visible"&&p()};return document.addEventListener("visibilitychange",g),()=>document.removeEventListener("visibilitychange",g)},[a,p]),{hasUnreadSig:l,refreshUnread:p,clearUnread:d,markActiveConversationRead:f}}var uo=X.scope("settings");function ru(e){let{options:t,persistence:n,transport:o,feedback:r,hostElement:a,bus:s}=e,l=n.loadUserPrefs(),[c,u]=D(()=>l.locale??t.locale),[_,p]=D(()=>l.themeMode??t.themeMode),[d,f]=D(()=>l.textSize??t.textSize),m=O(y=>{n.patchUserPrefs(y),o.saveUserPrefs(n.loadUserPrefs()).catch(k=>uo.warn("saveUserPrefs failed",{err:k}))},[n,o]);E(()=>{l.soundMuted!==void 0&&r.setMuted(l.soundMuted)},[]),E(()=>{a.dataset.theme=_},[a,_,t]),E(()=>{a.dataset.textSize=d},[a,d,t]),E(()=>{let y=!0;return r.mutedSig.subscribe(k=>{if(y){y=!1;return}m({soundMuted:k})})},[r,m]);let g=fn(c,t.availableLocales,t.defaultLocale);E(()=>{o.setLocale(g)},[o,g]),E(()=>{a.dir=Bi(g)?"rtl":"ltr"},[a,g]),E(()=>{g!==c&&u(g)},[g,c]);let h=O(y=>{uo.info("localeChange",{locale:y}),u(y),m({locale:y}),s.emit("localeChange",y)},[m,s]),P=O(y=>{uo.info("themeChange",{mode:y}),p(y),a.dataset.theme=y,m({themeMode:y}),s.emit("themeChange",y)},[a,m,s]),x=O(y=>{uo.info("textSizeChange",{size:y}),f(y),a.dataset.textSize=y,m({textSize:y}),s.emit("textSizeChange",y)},[a,m,s]),b=O(()=>{r.toggleMuted();let y=r.mutedSig.value;uo.info("soundToggle",{muted:y}),s.emit("soundToggle",{muted:y})},[r,s]);return{activeLocale:c,activeThemeMode:_,activeTextSize:d,effectiveLocale:g,setActiveLocale:u,setActiveThemeMode:p,setActiveTextSize:f,patchAndSync:m,handleLocaleChange:h,handleThemeChange:P,handleTextSizeChange:x,handleSoundToggle:b}}var be=X.scope("app"),Ar=w.cssPrefix;function au(e,t){return yl({...e,text:Ze(t,e.text)})}function iu({options:e,hostElement:t,bus:n}){let[o]=D(()=>Lt(e.widgetId,e.storage,e.aiAgentDeploymentId)),[r,a]=D(()=>o.getVisitorId()),s=o.loadUserPrefs(),l=dt(o.loadConversationId()),c=M(l.value!==void 0),u=dt(l.value??""),_=dt([]),[p,d]=D(!1),f=M(),[m,g]=D([]);function h(){let v=e.modules.list,T=new Set(v.map(F=>F.id)),V=o.loadActiveModule();return V&&T.has(V)?V:v[0]?.id??""}function P(){return e.modules.list.find(v=>v.layout==="chat")?.id}function x(){let v=P();return v?e.modules.list.length===1?!0:k.sig.value.activeTab===v:!1}let b=M(x);b.current=x;let y=M();if(!y.current){let v=e.modules.list.map(V=>V.id),T=o.loadActiveModule()??v[0]??"";y.current=Pd(T,T?[...v,T]:v,V=>o.saveActiveModule(V))}let k=y.current,[C,B]=D(!1),[G,U]=D(null),[I,z]=D(!1),W=e.mode==="standalone"||e.mode==="inline",L=M(jn(e,xn(),o.loadPanelOpen(),o.loadPanelSize())),[ne,re]=D(L.current.panelOpen),[le,Ae]=D(L.current.panelOpen),de=M(),_e=M(),Me=M(!1),N=M(void 0);E(()=>{ne&&Ae(!0)},[ne]);let ve=M(!1),[ae,De]=D(!1),{dismissed:xe,dismissCallout:Te}=qd({callout:e.launcher.callout,persistence:o}),Ce=e.launcher.callout?.persistent??!0,Le=O(()=>{be.info("calloutDismiss"),n.emit("calloutDismiss",void 0),Te()},[n,Te]),[he,Se]=D(L.current.panelSize),Ie=M(!1),[Je,Qe]=D("chat"),[ze,H]=D(!0),K=M(ze);K.current=ze;let[Y,pe]=D(!1),S=M(Y);S.current=Y;let q=M(null),[ye,ie]=D(!1),[Pe,ht]=D(null),[ct,qe]=D([]),zt=M(e.strings),bt=M(e);bt.current=e;let[yi,mu]=D(void 0),[gu,vu]=D(void 0),[hu,bu]=D(()=>o.loadSidebarCollapsed()??!1),[Dr,yu]=D({}),[se]=D(()=>new jo({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:cl({publicKey:e.publicKey,aiAgentDeploymentId:e.aiAgentDeploymentId,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[nt]=D(()=>new tr(e.sound,e.haptics)),Et=eu({transport:se,setStreaming:pe}),{activeLocale:_o,activeThemeMode:Pi,activeTextSize:xi,effectiveLocale:cn,setActiveLocale:Pu,setActiveThemeMode:xu,setActiveTextSize:Su,patchAndSync:Si,handleLocaleChange:ku,handleThemeChange:wu,handleTextSizeChange:Cu,handleSoundToggle:Ru}=ru({options:e,persistence:o,transport:se,feedback:nt,hostElement:t,bus:n}),{controlModeSig:yt,assignedOperatorInitialsSig:Tu,operatorAvailableSig:Iu,applyControlState:dn,adoptControlStateChunk:Eu,requestOperator:Au,cancelOperatorRequest:Mu}=Wd({transport:se,conversationIdSig:l}),{hasUnreadSig:Lu,refreshUnread:ki,clearUnread:wi,markActiveConversationRead:Ou}=ou({transport:se,options:e,conversationIdSig:l,isChatActiveRef:b,activated:le,conversationReady:C});E(()=>{nt.update(e.sound,e.haptics)},[nt,e.sound,e.haptics]),E(()=>()=>nt.destroy(),[nt]),E(()=>{Ie.current||!e.size.initialSize||(Ie.current=!0,!o.loadPanelSize()&&Se(Sa(e.mode,e.size,xn())))},[e.mode,e.size,o]),E(()=>{if(!C||ve.current)return;ve.current=!0;let v=jn(e,xn(),o.loadPanelOpen(),o.loadPanelSize());re(v.panelOpen),Se(v.panelSize)},[C,e,o]);let Ci=M(null);E(()=>{C&&k.reconcile(e.modules.list.map(v=>v.id),h())},[C,e.modules.list,k]);let po=O(v=>{!v||v.length===0||(_.value=v.map(T=>au(T,zt.current)))},[_]),$r=M(null),fo=O(async v=>{try{let{formSubmissions:T}=await(v?se.bootstrap(v):$r.current??se.bootstrap()),V=new Map;return T.forEach((F,Z)=>V.set(F.formId,Z)),T.filter((F,Z)=>!F.skipped||V.get(F.formId)===Z).map((F,Z)=>({key:`wire:${F.formId}:${F.createdAt??Z}`,formId:F.formId,outcome:F.skipped?"skipped":"submitted",createdAt:Vo(F.createdAt),values:F.values}))}catch(T){return be.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:T}),[]}},[se]),An=M(0),Pt=M(0),Fr=O((v,T)=>{if(v===l.value)return;let V=l.value;Pt.current++,d(!1),V&&(o.saveDraft(v,o.loadDraft(V)),o.saveDraft(V,"")),l.value=v,o.saveConversationId(v),se.primeIdentity(void 0,v),be.info("conversation rebound",{previous:V,current:v,reason:T}),V&&n.emit("conversationRebound",{previous:V,current:v,...T?{reason:T}:{}})},[n,l,o,se]),mo=O((v,T)=>{let V=[...v.map(A=>A.createdAt),...T.map(A=>A.createdAt)].filter(A=>A!==void 0),F=(V.length?Math.min(...V):Date.now())-1;return[...(N.current?.messages??[]).map(A=>{let He=au(A,zt.current);return He.createdAt=F,He}),...v]},[]),Ri=O(async v=>{let T=Pt.current,V=()=>T!==Pt.current||l.value!==v;_e.current===v&&(_e.current=void 0),d(!0);try{let[F,Z]=await Promise.all([se.loadConversation(v),fo()]);if(V())return;let A=Nt(F.messages??[]);g(Z);let He=mo(Cl(A,_.value),Z);if(_.value=He,_e.current=He.some($e=>$e.role==="user")?void 0:v,A.length>0||F.controlState!==void 0){H(F.canContinue??!0),dn(Ot(F.controlState));let $e=A.findLast(_t=>_t.role==="assistant"&&!_t.ephemeral);qe($e?.suggestions??F.suggestions??[])}}catch(F){if(V())return;be.warn("loadThread failed; keeping conversation active",{err:F,conversationId:v}),n.emit("error",F),bt.current.onError?.(F)}finally{V()||d(!1)}},[se,fo,_,l,mo,n]),Nu=O(v=>{if(de.current===v)return de.current=void 0,Ri(v)},[Ri]),Du=O(()=>{if(f.current)return Promise.resolve(void 0);let v=l.value,T=_.value.find(A=>!A.ephemeral),V=T?.serverMessageId??T?.id;if(!v||!V)return Promise.resolve(void 0);let F=Pt.current,Z={};return f.current=Z,(async()=>{try{let A=await se.loadConversation(v,{beforeId:V});if(f.current!==Z||Pt.current!==F||l.value!==v)return;if(A.messages.length===0)return!1;let He=A.messages.map(Ia),ue=_.value,$e=kl(ue,He);if($e!==ue){let _t=Math.min(...He.map(Wt=>Wt.createdAt??1/0),...m.map(Wt=>Wt.createdAt??1/0));if(Number.isFinite(_t))for(let Wt of ue){if(!Wt.ephemeral)break;(Wt.createdAt??1/0)>=_t&&(Wt.createdAt=_t-1)}_.value=$e}return!0}catch(A){if(f.current!==Z||Pt.current!==F||l.value!==v)return;be.warn("load previous messages failed",{err:A,conversationId:v,beforeId:V}),n.emit("error",A),e.onError?.(A);return}finally{f.current===Z&&(f.current=void 0)}})()},[n,l,m,_,e,se]),Mn=O(async({newConversation:v})=>{let T=++An.current,V=()=>T!==An.current,F=l.value,Z=v||!F?at():F;Z!==F&&(Pt.current++,d(!1),it(()=>{l.value=Z,u.value=Z}),o.saveConversationId(Z)),se.primeIdentity(r,Z);let A;try{A=await se.handshake({visitorId:r,conversationId:Z,userPrefs:o.loadUserPrefs(),locale:_o})}catch(ue){if(V())return;n.emit("error",ue),e.onError?.(ue),v||B(!0);return}if(V())return;if(A.visitorId&&A.visitorId!==r&&(be.info("visitor rebound",{previous:r,current:A.visitorId,reason:A.rebind?.visitorId}),o.setVisitorId(A.visitorId),a(A.visitorId),n.emit("visitorRebound",{previous:r,current:A.visitorId,reason:A.rebind?.visitorId})),A.conversationId!==Z&&Fr(A.conversationId,A.rebind?.conversationId),A.agent&&ht(A.agent),dn(Ot(A.controlState)),e.mode==="page"&&(A.site&&sl(A.site)?mu(A.site):A.site&&be.warn("invalid site config, using fallback",{site:A.site}),A.blocks&&ll(A.blocks)?vu(A.blocks):A.blocks&&be.warn("invalid blocks config, using fallback",{blocks:A.blocks})),A.userPrefs&&!v&&(o.saveUserPrefs(A.userPrefs),A.userPrefs.locale&&Pu(A.userPrefs.locale),A.userPrefs.soundMuted!==void 0&&nt.setMuted(A.userPrefs.soundMuted),A.userPrefs.themeMode&&xu(A.userPrefs.themeMode),A.userPrefs.textSize&&Su(A.userPrefs.textSize)),N.current=A.welcome,v||n.emit("handshake",A),A.welcome?.suggestions){let ue=zt.current;qe(A.welcome.suggestions.map($e=>({...$e,label:Ze(ue,$e.label),...$e.text===void 0?{}:{text:Ze(ue,$e.text)}})))}let He=!v&&F&&A.conversationId===F;c.current=!!He,He?Me.current||(de.current=A.conversationId):(_e.current=A.conversationId,po(A.welcome?.messages)),v||B(!0)},[se,r,o,e,n,l,u,nt,po,_o,Fr]),Ln=JSON.stringify(e.userContext??null),$u=JSON.stringify(e.pageContext??null),Fu=JSON.stringify(Dr);E(()=>{let v=Object.keys(Dr).length?{...Dr,...e.userContext}:e.userContext;se.setContext(v,Og(e.pageContext))},[se,Ln,$u,Fu]);let Ti=O((v,T=[])=>qe(v.suggestions??T),[]);E(()=>(se.primeIdentity(r,l.value),Mn({newConversation:!1}),()=>{An.current++,Pt.current++}),[]),E(()=>{!le||!C||Me.current||(Me.current=!0,$r.current=se.bootstrap(),(async()=>{try{let v=await $r.current;U(Bn((v??{forms:[]}).forms,cn))}catch(v){be.debug("bootstrap failed \u2014 treating as no forms",{err:v})}finally{z(!0)}})(),de.current===l.value&&d(!0))},[le,C]);let go=M(null);E(()=>{if(!le||!C)return;if(go.current===null){go.current=cn;return}if(go.current===cn)return;go.current=cn;let v=!1;return se.bootstrap().then(T=>{v||U(Bn((T??{forms:[]}).forms,cn))}).catch(T=>be.debug("forms re-localize failed \u2014 keeping current copy",{err:T})),()=>{v=!0}},[le,C,cn,se]);let Ii=M(Ln);E(()=>{!C||Ii.current===Ln||(Ii.current=Ln,Mn({newConversation:!1}))},[Ln,C,Mn]),Kd({hostElement:t,mode:e.mode,panelSize:he,isOpen:ne,setIsOpen:re});let{sendAiTurn:qt,sendRoutedTurn:On}=nu({transport:se,messagesSig:_,conversationIdSig:l,options:e,bus:n,feedback:nt,persistence:o,visitorId:r,adoptConversationId:Fr,applyControlState:dn,setCanSend:H,settleSuggestions:Ti,runCancellation:Et}),{toolInteraction:Bu}=zd({streaming:Y,controlModeSig:yt,messagesSig:_,sendAiTurn:qt,bus:n,humanInLoop:e.features.humanInLoop}),Hu=O((v,T)=>{let V=_.value.find(F=>F.serverMessageId===v);V&&(V.feedback=T),be.info("messageFeedback",{messageId:v,value:T}),n.emit("messageFeedback",{messageId:v,value:T}),se.submitFeedback({messageId:v,value:T})},[n,_,se]),Uu=()=>_.value.reduce((v,T)=>v+(T.role==="user"?1:0),0),un=e.forms.list.length>0?e.forms:G??e.forms,Ee=gd({forms:un,persistence:o,userContext:()=>e.userContext,messageCount:Uu,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>l.value,onComplete:(v,T,V,F)=>{be.info("formSubmit",{formId:v.id,trigger:T,skipped:F}),n.emit("formSubmit",{formId:v.id,values:V,skipped:F}),g(A=>{let ue=A.find($e=>$e.formId===v.id&&$e.outcome==="skipped")?.createdAt??Date.now();return[...A.filter($e=>!($e.formId===v.id&&$e.outcome==="skipped")),{key:`local:${v.id}:${ue}`,formId:v.id,outcome:F?"skipped":"submitted",createdAt:ue,...F?{}:{values:V}}]});let Z=l.value??at();l.value||(l.value=Z,o.saveConversationId(Z),se.primeIdentity(void 0,Z)),!F&&v.mirrorToContext&&yu(A=>({...A,...V})),se.submitForm({formId:v.id,conversationId:Z,trigger:T,values:V,skipped:F})}}),Br=ut(()=>Ee.activeForm.value),zu=O(()=>Ee.fire("after-messages"),[Ee]),qu=O(()=>c.current||_.value.some(v=>!v.ephemeral&&v.role==="user"),[_]);Zd({activated:le,conversationReady:C,conversationIdSig:l,messagesSig:_,optionsRef:bt,isChatActiveRef:b,transport:se,visitorId:r,adoptControlStateChunk:Eu,settleSuggestions:Ti,markActiveConversationRead:Ou,onReplyLanded:zu,runCancellation:Et,setCanSend:H,feedback:nt,bus:n,homeNav:k,loadInitialThread:Nu,shouldReconcileOnConnect:qu}),E(()=>{Ee.refresh()},[un,Ee]);let Ei=e.pageContext?.area?String(e.pageContext.area):void 0,Wu=ut(()=>_.value.length);E(()=>{C&&I&&Ee.fire("pre-chat")},[C,I,Ee]),E(()=>{I&&!ze&&Ee.fire("conversation-closed")},[I,ze,Ee]),E(()=>{C&&I&&Ei&&Ee.fire("page-area")},[C,I,Ei,Ee]);let Hr=ee(()=>{let v=un.list.flatMap(T=>T.triggers).filter(T=>T.kind==="idle").map(T=>Number(T.param));return v.length?Math.min(...v)*1e3:0},[un]);E(()=>{if(!Hr||!ne)return;let v=setTimeout(()=>Ee.fire("idle"),Hr);return()=>clearTimeout(v)},[Hr,ne,Ee,Wu.value]);let Ai=O(async(v,T)=>{if(q.current)return!1;let V=l.value,F=yt.value!=="ai-agent";if(be.info("send",{textLen:v.length,attachments:T.length,streaming:S.current,routedToOperator:F}),S.current&&!F)return!1;let Z=new AbortController,A={conversationId:V,controller:Z};q.current=A,ie(!0);try{nt.unlock();let He=await Dg(se,T,Z.signal,_t=>{Z.signal.aborted||(be.warn("upload failed",{err:_t}),n.emit("error",_t),e.onError?.(_t))});if(Z.signal.aborted||l.value!==V||!K.current||Ee.activeForm.value)return!1;let ue=yt.value!=="ai-agent";if(S.current&&!ue||!v&&He.length===0)return!1;n.emit("send",{text:v,attachmentCount:T.length}),ct.length>0&&qe([]),nt.play("messageSent");let $e=Ta(v,He);return En(n,e,"user",v),ue?(_.value=[..._.value,$e],On($e),!0):(_.value=[..._.value,$e,Rt()],qt({continueExisting:!1}),!0)}finally{q.current===A&&(q.current=null,ie(!1))}},[se,n,e,ct.length,_,l,qt,On,yt]);E(()=>{let v=l.value;return()=>{let T=q.current;!T||T.conversationId!==v||(q.current=null,ie(!1),T.controller.abort())}},[l.value]),E(()=>{ze&&!Br.value||q.current?.controller.abort()},[Br.value,ze]);let Vu=O(()=>{if(!Et.stop())return;be.info("stop"),n.emit("stop",void 0);let v=_.value.at(-1);v&&v.role!=="user"&&v.status==="streaming"&&(v.canceled=!0,_.value=[..._.value])},[Et,n,_]),Gu=O(v=>{if(Y)return;let T=_.value,V=Qo(T,v);if(V)switch(be.info("retry",{kind:V.kind,messageId:V.messageId}),V.kind){case"continue-assistant":{if(yt.value!=="ai-agent"||v.role!=="assistant"||(v.serverMessageId??v.id)!==V.messageId)return;v.status="streaming",v.errorText=void 0,v.retryAction=void 0,v.awaitingContinuation=!0,_.value=[...T],qt({continueExisting:!0,turn:v});return}case"resend-user":{let F=T.find(A=>A.role==="user"&&A.id===V.messageId);if(!F)return;if(F.status="complete",F.errorText=void 0,F.retryAction=void 0,yt.value!=="ai-agent"){_.value=v.role==="assistant"?T.filter(A=>A!==v):[...T],On(F);return}let Z=Rt();_.value=v.role==="assistant"?T.map(A=>A===v?Z:A):[...T,Z],qt({continueExisting:!1,turn:F});return}case"repeat-user":{let F=T.find(ue=>ue.role==="user"&&ue.id===V.messageId);if(!F)return;let Z=Ta(Ue(F),F.attachments?.map(ue=>({...ue}))??[]),A=new Set(Z.attachments?.flatMap(ue=>ue.url?[ue.url]:[])??[]),He=F.partsSig.value.flatMap(ue=>ue.kind==="file"&&!A.has(ue.url)?[{...ue}]:[]);if(He.length>0&&(Z.partsSig.value=[...Z.partsSig.value,...He]),yt.value!=="ai-agent"){_.value=[...T,Z],On(Z);return}_.value=[...T,Z,Rt()],qt({continueExisting:!1,turn:Z});return}default:return V}},[Y,_,yt,qt,On]),Nn=O(()=>{if(vc(e.mode,he)==="exit-fullscreen"){be.info("close \u2192 exit-fullscreen",{mode:e.mode}),Se("normal"),n.emit("fullscreen",!1);return}be.info("close \u2192 panel closed",{mode:e.mode}),Ee.fire("panel-close"),re(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,he,Ee]),Ur=O(()=>{be.info("open",{mode:e.mode}),nt.unlock(),De(!0),re(!0),o.savePanelOpen(!0),!xe&&!Ce&&Le(),setTimeout(()=>De(!1),Ng),le&&ki(),n.emit("open",void 0),e.onOpen?.()},[n,e,nt,o,xe,Ce,Le,le,ki]),zr=O(()=>{let v=_.value.some(T=>T.role==="user");if(_e.current===l.value&&!v&&ze&&l.value){be.info("clear \u2192 reusing empty conversation",{conversationId:l.value}),_.value.length===0&&po(N.current?.messages);return}be.info("clear \u2192 new conversation",{wasStreaming:Y}),n.emit("clear",void 0),Et.settle(),c.current=!1,de.current=void 0,_e.current=void 0,it(()=>{_.value=[],l.value=void 0,dn({controlMode:"ai-agent",controlRevision:0})}),o.clearConversation(),H(!0),g([]),qe([]),Mn({newConversation:!0})},[Y,_,l,o,Mn,n,ze,po,Et,dn]),qr=O(()=>{zr(),Qe("chat");let v=e.modules.list.find(T=>T.layout==="chat")?.id;v&&k.switchTab(v)},[zr,k,e]),Wr=O(()=>{let v=he==="expanded"?"normal":"expanded";be.info("expand",{from:he,expanded:v==="expanded"}),Se(v),o.savePanelSize(v),n.emit("expand",v==="expanded")},[n,he,o]),Vr=O(()=>{let v=he==="fullscreen"?"normal":"fullscreen";be.info("fullscreen",{from:he,fullscreen:v==="fullscreen"}),Se(v),o.savePanelSize(v),n.emit("fullscreen",v==="fullscreen")},[n,he,o]),Ku=O(()=>{Qe(v=>{let T=v==="history"?"chat":"history";return be.info("toggleHistory",{view:T}),n.emit("toggleHistory",{view:T}),T})},[n]),ju=O(()=>{bu(v=>{let T=!v;return be.info("sidebarToggle",{collapsed:T}),o.saveSidebarCollapsed(T),n.emit("sidebarToggle",{collapsed:T}),T})},[o,n]),Xu=O(v=>{be.info("resize",v),Si({widgetSize:v}),n.emit("resize",v)},[Si,n]),Gr=O(async v=>{let T=++An.current;Pt.current++,d(!1);let V=()=>T!==An.current;be.info("selectConversation",{conversationId:v,wasStreaming:Y}),n.emit("selectConversation",{conversationId:v});try{let[F,Z]=await Promise.all([se.loadConversation(v),fo(v)]);if(V())return;Et.settle(),c.current=!0,de.current=void 0;let A=Nt(F.messages);_e.current=A.some(ue=>ue.role==="user")?void 0:F.conversationId,it(()=>{_.value=mo(A,Z),F.conversationId!==l.value&&(u.value=F.conversationId),l.value=F.conversationId}),g(Z),o.saveConversationId(F.conversationId),se.primeIdentity(r,F.conversationId),F.agent&&ht(F.agent),H(F.canContinue),dn(Ot(F.controlState));let He=A.findLast(ue=>ue.role==="assistant"&&!ue.ephemeral);if(qe(He?.suggestions??F.suggestions??[]),Qe("chat"),await se.markRead(v),V())return;wi(v)}catch(F){if(V())return;n.emit("error",F),e.onError?.(F)}},[se,_,l,u,n,e,o,wi,fo,mo,Y,r,Et]),vo=M(null),Mi=O(v=>{typeof v=="string"&&(I?Ee.fire("manual",v):vo.current=v)},[I,Ee]);E(()=>{!I||!vo.current||(Ee.fire("manual",vo.current),vo.current=null)},[I,Ee]);let _n=M({handleOpen:Ur,handleClose:Nn,handleExpand:Wr,handleFullscreen:Vr,openForm:Mi});_n.current={handleOpen:Ur,handleClose:Nn,handleExpand:Wr,handleFullscreen:Vr,openForm:Mi},pt(()=>Cs(t,{open:()=>_n.current.handleOpen(),close:()=>_n.current.handleClose(),expand:()=>_n.current.handleExpand(),fullscreen:()=>_n.current.handleFullscreen(),openForm:v=>_n.current.openForm(v)}),[t]);let Ye=ee(()=>aa(e,_o,Pi,xi),[e,_o,Pi,xi]);zt.current=Ye.strings;let Yu=ee(()=>m.map(v=>{let T=un.list.find(V=>V.id===v.formId);return{...v,title:T?.title,form:T}}),[m,un]),Li={options:Ye,transport:se,feedback:nt,bus:n,persistence:o,conversationId:l.value??"",composerKey:u.value,composerApiRef:Ci,view:Je,canSend:ze,isStreaming:Y,sendPreparing:ye,composerActive:Ye.mode==="page"||Ye.mode==="inline"||Ye.mode==="standalone"||ne,controlMode:yt.value,assignedOperatorInitials:Tu.value,operatorAvailable:Iu.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:Au,onCancelOperatorRequest:Mu,loadingMessages:p,onLoadPreviousMessages:Du,messagesSig:_,agent:Pe,suggestions:ct,initialWidgetSize:s.widgetSize??null,visitorId:r,onClose:Nn,onClear:zr,onExpand:Wr,onFullscreen:Vr,onSoundToggle:Ru,onToggleHistory:Ku,onSelectHistoryConversation:Gr,onNewConversation:qr,onLocaleChange:ku,onThemeChange:wu,onTextSizeChange:Cu,onWidgetSizeChange:Xu,onSend:Ai,onStop:Vu,onSuggestion:v=>{if(q.current)return;let T=v.text??v.label;be.info("suggestion",{text:T,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:T}),e.autoSendSuggestions?Ai(T,[]):Ci.current?.fill(T)},activeForm:Br.value?.form??null,formMarkers:Yu,onFormSubmit:Ee.complete,onFormSkip:Ee.skip,onFormFill:v=>Ee.fire("manual",v),tool:Bu,onRetry:Gu,onMessageFeedback:Hu},Ju=v=>{Gr(v);let T=P();T&&k.switchTab(T)};if(!C)return null;let Dn=Ye.modules.list,Kr=v=>{let T=no("close",Ye.mode,v);return Dn.length===0?i(Ud,{strings:Ye.strings,onClose:T?Nn:void 0}):Dn.length===1&&Dn[0]?.layout==="chat"?i(md,{...Li,panelSize:v}):i(Hd,{panelProps:{...Li,panelSize:v,onClose:T?Nn:void 0},enabledModules:Dn,nav:k,bus:n,hasUnread:Lu.value,onSelectConversation:Ju,onStartNewConversation:qr,onSetPanelSize:Se})};if(e.mode==="page"){let v=V=>{Gr(V.conversationId)},T=Dn.some(V=>V.layout==="chat");return i("div",{class:`${Ar}-anchor`,children:i(bd,{site:yi,blocks:gu,transport:se,strings:Ye.strings,locale:Ye.locale,persistence:o,visitorId:r,showConversations:T,onSelectConversation:v,onNewConversation:qr,sidebarCollapsed:hu,onToggleSidebarCollapsed:ju,children:Kr("fullscreen")})})}if(W){let v=e.mode==="standalone"?"fullscreen":he;return i("div",{class:`${Ar}-anchor`,children:Kr(v)})}let Oi=e.mode==="drawer",Ni=!(e.mode==="modal")&&!e.launcher.hidden&&(!ne||ae),Di=Ni&&!ae&&!xe&&!Oi?Ye.launcher.callout:null;return i("div",{class:`${Ar}-anchor`,"data-launcher-size":Ye.launcher.size,children:[ne||le?i("div",{class:`${Ar}-surface`,hidden:!ne,children:Kr(he)}):null,Ni?i(fc,{onToggle:Ur,launcher:Ye.launcher,strings:Ye.strings,leaving:ae,edgeTab:Oi}):null,Di?i(mc,{callout:Di,launcherPosition:Ye.position,strings:Ye.strings,closeLabel:Ye.strings.close,onDismiss:Le}):null]})}function Og(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var Ng=120;async function Dg(e,t,n,o){return(await Promise.all(t.map(async a=>{try{let{id:s,url:l}=await e.uploadFile(a.file,n);return{id:s,name:a.name,mediaType:a.mediaType,size:a.size,url:l}}catch(s){o(s);return}}))).filter(a=>a!==void 0)}var $g=X.scope("error-boundary"),Mr=class extends et{constructor(){super(...arguments);te(this,"state",{crashed:!1})}componentDidCatch(n,o){$g.error("widget render crashed",{error:n,componentStack:o?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,o?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};var Fg="1",Bg=60,Hg=2e3,su={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),send:e=>({attachments:e.attachmentCount}),message:e=>({role:e.role}),stop:()=>{},clear:()=>{},suggestion:()=>{},toggleHistory:e=>({view:e.view}),handshake:()=>{},formSubmit:e=>({formId:e.formId,skipped:e.skipped}),toolResult:()=>{},toolDecision:e=>({approved:e.approved}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,tags:e.tags,count:e.count}),contentOpen:e=>({contentId:e.contentId,tags:e.tags}),contentSearch:e=>({qlen:e.queryLength,hits:e.hitCount}),contentRead:e=>({contentId:e.contentId}),contentLinkClick:e=>({contentId:e.contentId}),attach:e=>({count:e.count,bytes:e.totalBytes}),voiceStart:()=>{},voiceStop:e=>({ms:e.durationMs}),voiceCancel:()=>{},localeChange:e=>({locale:e}),themeChange:e=>({theme:e}),textSizeChange:e=>({size:e}),soundToggle:e=>({muted:e.muted}),sidebarToggle:e=>({collapsed:e.collapsed}),calloutDismiss:()=>{},error:()=>{}};function Ug(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function zg(){return location.origin+location.pathname}function qg(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function lu(e,t){let n=Math.random(),o=0,r=0,a=new Set,s=(c,u)=>{let{tracking:_,publicKey:p,aiAgentDeploymentId:d,mode:f,themeMode:m}=t.getOptions();if(!_.enabled||Ug()||n>=_.sampleRate)return;let g=performance.now();if(g-o>6e4&&(o=g,r=0),++r>Bg)return;let h=new URLSearchParams;h.set("v",Fg),h.set("_ev",gn),h.set("e",c),_.token&&h.set("tk",_.token),p&&h.set("pk",p),d&&h.set("dep",d),h.set("vid",t.getVisitorId());let P=t.getConversationId();P&&h.set("cid",P),h.set("url",zg());let x=qg();x&&h.set("ref",x),h.set("sw",String(screen.width)),h.set("sh",String(screen.height)),h.set("vw",String(innerWidth)),h.set("vh",String(innerHeight)),h.set("dpr",String(devicePixelRatio)),h.set("lang",navigator.language);try{h.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(h.set("m",f),h.set("th",m),u)for(let[C,B]of Object.entries(u))B!==void 0&&h.set(C,String(B));h.set("ts",String(Date.now()));let b=`${_.endpoint}?${h}`;if(b.length>Hg)return;let y=new Image(1,1);a.add(y);let k=()=>a.delete(y);y.addEventListener("load",k,{once:!0}),y.addEventListener("error",k,{once:!0}),y.src=b},l=Object.keys(su).map(c=>e.on(c,u=>s(c,su[c]?.(u))));return()=>{for(let c of l)c();a.clear()}}function Lr(e){let{bus:t,host:n,appRoot:o,persistence:r,reportError:a}=e,s=e.initialRaw,l,c=At(s),u=!0,_=()=>{c=At(l?ia(s,l):s)},p=()=>{Ns(n,Xt(c.mode));let m=r.loadUserPrefs().themeMode;Ds(n,m?{...c,themeMode:m}:c),u&&(Lo(n,di(c)),u=!1)},d=()=>{p(),Kt(kt(Mr,{onError:a},kt(iu,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",m=>{m.config&&(m.config.storageVersion&&r.rememberStorageVersion(m.config.storageVersion),l=m.config,_(),d())});let f=lu(t,{getOptions:()=>c,getVisitorId:()=>r.getVisitorId(),getConversationId:()=>r.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>s,render:d,setUserOptions:m=>{s=m,_(),d()},patchUserOptions:m=>{s={...s,...m},_(),d()},destroy:()=>f()}}function di(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=Lt(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:o}=jn(e,xn(),t.loadPanelOpen(),t.loadPanelSize());return Wo(e.mode,o,n)}var Wg=X.scope("hooks"),_i="*",ui=new Set;function pi(e,t,n){let o={widgetId:e,event:t,listener:n};return ui.add(o),()=>{ui.delete(o)}}function Vg(e,t,n){let o=[...ui];for(let r of o)if(Gg(r.widgetId,e.widgetId)&&!(r.event!==_i&&r.event!==t))try{r.listener(e,t,n)}catch(a){Wg.warn("hook listener threw",{event:t,error:a})}}function cu(e,t){let n=[];for(let o of Kg)n.push(t.on(o,r=>{Vg(e,o,r)}));return()=>{for(let o of n)o()}}function fi(e){if(Array.isArray(e))for(let t of e){let n=jg(t);n&&pi(n.widgetId,n.event,n.listener)}}function Gg(e,t){return e===_i||e===t}var Kg=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","visitorRebound","conversationRebound"];function jg(e){let t,n,o;if(Array.isArray(e))[t,n,o]=e;else if(e&&typeof e=="object")({widgetId:t,event:n,listener:o}=e);else return null;return typeof t!="string"||typeof n!="string"||typeof o!="function"?null:{widgetId:t,event:n,listener:o}}var It=new Map;function Or(e){e.debug!==void 0&&xo(e.debug);let t=X.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=At(e),o=n.widgetId,r=It.get(o);r&&(t.debug("destroy existing instance at slot",{widgetId:o}),r.destroy());let a=di(n),s=n.iframe?Bs({position:Xt(n.mode)},n.position,a,n.mode,e.target??null):vn({position:Xt(n.mode),target:e.target??null});s.hostElement.dataset.widgetId=o;let l=new hn,c=Lt(o,n.storage,n.aiAgentDeploymentId),u=g=>{l.emit("error",g),_.getOptions().onError?.(g)},_=Lr({bus:l,host:s.hostElement,appRoot:s.appRoot,persistence:c,initialRaw:e,reportError:u});_.render();let p=s.hostElement,d=null,f=g=>{g.debug!==void 0&&xo(g.debug),_.patchUserOptions(g)},m={widgetId:o,open:()=>qn(p,"open"),close:()=>qn(p,"close"),expand:()=>qn(p,"expand"),openForm:g=>qn(p,"openForm",g),on:(g,h)=>l.on(g,h),update:g=>{t.debug("update",{patch:g}),f(g)},setUserContext:g=>{t.debug("setUserContext",{keys:Object.keys(g)}),f({userContext:{..._.getUserOptions().userContext,...g}})},clearUserContext:()=>{t.debug("clearUserContext"),f({userContext:void 0})},setPageContext:g=>{t.debug("setPageContext",{keys:Object.keys(g)}),f({pageContext:{..._.getUserOptions().pageContext,...g}})},clearPageContext:()=>{t.debug("clearPageContext"),f({pageContext:void 0})},setDebug:g=>{xo(g),t.info("debug level set",{level:$n()})},debugLevel:()=>$n(),onLog:g=>Fn(g),destroy:()=>{t.info("destroy",{widgetId:o}),d?.(),_.destroy(),l.clear(),Kt(null,s.appRoot),s.destroy(),It.get(o)===m&&It.delete(o)}};return d=cu(m,l),It.set(o,m),m}function Nr(e){let t=e.widgetId??"default",n=It.get(t);return n?(n.update(e),n):Or(e)}function mi(e){if(e!==void 0){It.get(e)?.destroy();return}let t=[...It.values()];for(let n of t)n.destroy()}function vt(e="default"){return It.get(e)??null}function du(){return[...It.values()]}function gi(e,t,n){return pi(e,t,n)}var uu=gn;var vi=class extends HTMLElement{constructor(){super(...arguments);te(this,"bus",new hn);te(this,"mountResult",null);te(this,"runtime",null)}static get observedAttributes(){return sa}connectedCallback(){this.boot()}disconnectedCallback(){this.mountResult&&(this.runtime?.destroy(),this.runtime=null,Kt(null,this.mountResult.appRoot),this.bus.clear())}attributeChangedCallback(){this.isConnected&&this.boot()}boot(){let n=wo(a=>this.getAttribute(a));if(this.runtime){this.runtime.setUserOptions(n);return}let o=At(n);this.mountResult||(this.mountResult=vn({existingHost:this,position:Xt(o.mode)}));let r=Lt(o.widgetId,o.storage,o.aiAgentDeploymentId);this.runtime=Lr({bus:this.bus,host:this.mountResult.hostElement,appRoot:this.mountResult.appRoot,persistence:r,initialRaw:n,reportError:a=>this.bus.emit("error",a)}),this.runtime.render()}},_u=!1;function hi(){if(_u||typeof customElements>"u")return;let e=w.tagName;customElements.get(e)||customElements.define(e,vi),_u=!0}typeof customElements<"u"&&hi();var pu=X.scope("iife"),bi={close:()=>vt()?.close(),destroy:()=>mi(),expand:()=>vt()?.expand(),hook:(e,t,n)=>typeof e=="string"&&typeof t=="string"&&typeof n=="function"?gi(e,t,n):void 0,init:e=>Nr(e),mount:e=>Or(e),on:(e,t)=>vt()?.on(e,t),onLog:e=>Fn(e),open:()=>vt()?.open(),setDebug:e=>vt()?.setDebug(e),update:e=>vt()?.update(e)};function fu(e,...t){let n=bi[e];if(!n){pu.warn("unknown command",{command:e});return}return n(...t)}function Xg(){let e=((n,...o)=>fu(n,...o));e.init=Nr,e.mount=Or,e.destroy=mi,e.getInstance=vt,e.getAllInstances=du,e.version=uu,e.hook=gi,e.debugLevel=()=>$n(),e.onLog=Fn;let t=new Set(["init","mount","hook","onLog"]);for(let n of Object.keys(bi)){if(t.has(n))continue;let o=bi[n];Reflect.set(e,n,(...r)=>o(...r))}return e}function Yg(e){let t=e?.q;if(t)for(let n of t){let o=[...n],[r,...a]=o;if(typeof r=="string")try{fu(r,...a)}catch(s){pu.warn("queued command failed",{command:r,error:s})}}}function Jg(){let e=[],t=e.push.bind(e);return e.push=(...n)=>{for(let o of n)fi([o]);return t(...n)},e}function Qg(){let e=document.scripts;for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.src.includes("elements"))return n}return null}function Zg(){if(typeof window>"u"||typeof document>"u")return;let e=globalThis[w.global],t=Xg();globalThis[w.global]=t,hi();let n=`${w.global}Hooks`,o=globalThis[n];if(fi(o),globalThis[n]=Jg(),Yg(e),vt())return;let r=document.currentScript??Qg(),a=la(r?.dataset);if(!a.publicKey)return;let s=()=>{vt()||Nr(a)};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",s,{once:!0});return}s()}Zg();return o_(ev);})();
|
|
41
|
+
`).trim(),L=!b&&t!=="error"&&!g.value&&W.length>0,ne=z||L;return i("div",{class:`${Ke}-bubble-row`,"data-role":e.role,"data-testid":Ge(R.messageBubble,e.serverMessageId??e.id),children:i("div",{class:`${Ke}-bubble-col`,children:[i("div",{class:`${Ke}-bubble`,children:[e.role==="operator"&&e.operatorInitials?i("span",{class:`${Ke}-bubble-author`,children:e.operatorInitials}):null,i("div",{class:`${Ke}-bubble-body`,children:[C?i(Bm,{label:n.loading}):m.map((re,le)=>i(Om,{part:re,active:B,live:y,strings:n,showReasoning:r,showToolCalls:a,showSources:s,interactive:l&&t==="complete"&&(re.kind!=="tool"||Xo(e,le)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:u},`${$m(re)}#${le}`)),G&&i(Fm,{}),t==="error"||g.value?i("div",{class:`${Ke}-error`,role:"alert",children:[i("span",{children:e.errorText??n.errorGeneric}),_?i("button",{type:"button",class:`${Ke}-error-retry`,onClick:()=>_(e),"data-testid":R.messageRetry,children:n.errorRetry}):null]}):null]})]}),U||ne?i("div",{class:`${Ke}-bubble-meta`,children:[U?i("time",{class:`${Ke}-bubble-time`,dateTime:U.iso,title:U.full,children:U.short}):null,ne?i("div",{class:`${Ke}-bubble-actions`,children:[z&&e.serverMessageId?i(ed,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:d}):null,L?i(Mm,{text:W,strings:n}):null]}):null]}):null]})})}function Mm({text:e,strings:t}){let[n,o]=D(!1),r=()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),1500)}).catch(()=>{})},a=n?t.copied:t.copy;return i("button",{type:"button",class:`${Ke}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:r,"data-testid":R.messageCopy,children:n?i(tn,{}):i(lc,{})})}function Lm(e){if(typeof e!="number"||!Number.isFinite(e))return null;try{let t=new Date(e);return{short:t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),full:t.toLocaleString(void 0,{dateStyle:"full",timeStyle:"short"}),iso:t.toISOString()}}catch{return null}}function Om({part:e,active:t,live:n,strings:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l,superseded:c,continuationStreaming:u,tool:_}){switch(e.kind){case"step-start":return null;case"text":return i(yr,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return r?i(Dm,{part:e,active:t,strings:o}):null;case"tool":return i(Nm,{part:e,strings:o,showToolCalls:a,interactive:l,superseded:c,continuationStreaming:u,live:n,tool:_});case"file":return e.mediaType.startsWith("image/")?i("img",{src:e.url,alt:"",loading:"lazy"}):i("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return s?i(td,{part:e,strings:o}):null}}function Nm({part:e,strings:t,showToolCalls:n,interactive:o,superseded:r,continuationStreaming:a,live:s,tool:l}){let c=ee(()=>fe(()=>e.approvalSig.value!==void 0),[e]);return l?.humanInLoop&&c.value?mr(e.toolName)?i(ad,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):i(nd,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):n?i(sd,{part:e,strings:t,live:s}):null}function Dm({part:e,active:t,strings:n}){return i("details",{class:`${Ke}-reasoning`,"data-testid":R.reasoning,open:t,"data-active":t?"true":void 0,children:[i("summary",{class:`${Ke}-reasoning-summary`,children:i("span",{class:`${Ke}-reasoning-label`,children:t?n.thinking:n.thoughts})}),i("div",{class:`${Ke}-reasoning-body`,children:i(yr,{textSig:e.textSig,doneSig:e.doneSig})})]})}function $m(e){switch(e.kind){case"text":case"reasoning":case"step-start":return`${e.kind}:${e.id}`;case"tool":return`tool:${e.toolCallId}`;case"file":return`file:${e.url}`;case"source":return`source:${e.sourceId}`}}function Fm(){return i("span",{class:`${Ke}-typing`,"data-testid":R.typingDots,"aria-hidden":"true",children:[i("span",{}),i("span",{}),i("span",{})]})}function Bm({label:e}){return i("span",{class:`${Ke}-loading`,role:"status",children:[i("span",{class:`${Ke}-loading-spinner`,"aria-hidden":"true"}),i("span",{class:`${Ke}-loading-label`,children:e})]})}var Ft=w.cssPrefix,ni=120,Hm=350;function cd({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,enableMessageFeedback:s,onFeedback:l,loading:c,onLoadPreviousMessages:u,idle:_,controlMode:p="ai-agent",tool:d,onRetry:f,form:m,formMarkers:g,onFillForm:h}){let P=M(null),x=_t(()=>e.value),[b,y]=D(!1),[k,C]=D(!1),B=M(!1),G=M(!1),[U,I]=D(),z=M(!1),W=M(!1),L=M(!1),ne=M(0),re=()=>L.current||performance.now()-ne.current<Hm,le=M(0),Ae=S=>{let q=S.scrollHeight-S.clientHeight>1;S.dataset.fadeTop=q&&S.scrollTop>1?"true":"false",S.dataset.fadeBottom=q&&S.scrollHeight-S.scrollTop-S.clientHeight>1?"true":"false"},de=S=>y(S.scrollHeight-S.scrollTop-S.clientHeight>ni*2),_e=S=>{le.current=performance.now(),S.scrollTop=S.scrollHeight,Ae(S)},Me=(S,q)=>{_e(S);let ye=q,ie=0,Pe=()=>{W.current||re()||(_e(S),--ye>0&&(ie=requestAnimationFrame(Pe)))};return q>0&&(ie=requestAnimationFrame(Pe)),()=>cancelAnimationFrame(ie)},N=(S,q)=>{let ye,ie,Pe,ht=-1,ct=()=>{ye.disconnect(),ie.disconnect(),clearTimeout(Pe)},qe=()=>{if(W.current||re()||ht>=0&&S.scrollTop<ht-4)return ct();_e(S),ht=S.scrollTop};return ye=new ResizeObserver(qe),ie=new MutationObserver(qe),qe(),ye.observe(S),ie.observe(S,{childList:!0,subtree:!0,characterData:!0}),Pe=setTimeout(ct,q),ct},ve=x.value[0]?.id;dt(()=>{let S=P.current;if(S&&x.value.length!==0&&!G.current&&(z.current=!0,!!x.value.some(q=>q.role==="user")))return N(S,300)},[ve]);let ae=M(0);E(()=>{let S=P.current,q=x.value,ye=ae.current;if(ae.current=q.length,!S||!z.current||G.current)return;if(q.slice(ye).some(Pe=>Pe.role==="user"))return W.current=!1,Me(S,3);if(!q.some(Pe=>Pe.role==="user")||W.current||re())return;S.scrollHeight-S.scrollTop-S.clientHeight<ni&&_e(S)},[x.value.length]);let De=M(null);E(()=>{let S=P.current,q=x.value.at(-1),ye=De.current;if(De.current=q?{id:q.id,streaming:q.status==="streaming"}:null,!!S&&z.current&&!(!q||q.id!==ye?.id||ye.streaming||q.status!=="streaming"))return W.current=!1,Me(S,3)},[x.value]),E(()=>{let S=P.current;if(!S)return;let q=x.value.at(-1);if(!q||q.status!=="streaming"&&!x.value.some(Pe=>Pe.role==="user"))return;let ye=()=>{if(W.current||re())return;S.scrollHeight-S.scrollTop-S.clientHeight<ni*2&&_e(S)};if(q.status!=="streaming")return N(S,300);ye();let ie=new MutationObserver(ye);return ie.observe(S,{childList:!0,subtree:!0,characterData:!0}),()=>ie.disconnect()},[x.value]);let xe=m?.form.id,Te=!!m&&(g??[]).some(S=>S.formId===m.form.id);dt(()=>{let S=P.current;!S||!xe||W.current||x.value.some(q=>q.role==="user")&&(Te?S.querySelector(`[data-testid="${R.formGate}"]`)?.scrollIntoView({block:"nearest"}):_e(S))},[xe,Te]),E(()=>{let S=P.current;if(!S)return;let q=()=>{de(S),Ae(S),performance.now()-le.current>150&&(W.current=S.scrollHeight-S.scrollTop-S.clientHeight>8)},ye=()=>{W.current=!0},ie=bt=>{bt.deltaY<0&&ye()},Pe=0,ht=bt=>{Pe=bt.touches[0]?.clientY??0,L.current=!0},ct=bt=>{(bt.touches[0]?.clientY??0)>Pe+4&&ye()},qe=()=>{L.current=!1,ne.current=performance.now()},zt=()=>{L.current=!0};return S.addEventListener("scroll",q,{passive:!0}),S.addEventListener("wheel",ie,{passive:!0}),S.addEventListener("touchstart",ht,{passive:!0}),S.addEventListener("touchmove",ct,{passive:!0}),S.addEventListener("touchend",qe,{passive:!0}),S.addEventListener("touchcancel",qe,{passive:!0}),S.addEventListener("pointerdown",zt,{passive:!0}),window.addEventListener("pointerup",qe,{passive:!0}),window.addEventListener("pointercancel",qe,{passive:!0}),de(S),()=>{S.removeEventListener("scroll",q),S.removeEventListener("wheel",ie),S.removeEventListener("touchstart",ht),S.removeEventListener("touchmove",ct),S.removeEventListener("touchend",qe),S.removeEventListener("touchcancel",qe),S.removeEventListener("pointerdown",zt),window.removeEventListener("pointerup",qe),window.removeEventListener("pointercancel",qe)}},[]);let Ce=()=>{let S=P.current;S&&(W.current=!1,_e(S))},Le=x.value.filter(S=>!S.ephemeral),he=Le[0],Se=he?.serverMessageId??he?.id,Ie=!!(u&&Le.length>=Ca&&Se!==U),Je=async()=>{if(!u||B.current)return;let S=P.current,q=S?.scrollHeight??0,ye=S?.scrollTop??0;B.current=!0,G.current=!0,C(!0);try{let ie=await u();ie===!1&&Se&&I(Se),ie&&S&&(await new Promise(Pe=>requestAnimationFrame(()=>requestAnimationFrame(()=>Pe()))),S.scrollTop=ye+S.scrollHeight-q,Ae(S),de(S))}finally{G.current=!1,B.current=!1,C(!1)}},Qe=[],ze="",H=x.value.at(-1)?.id,K=[...g??[]].toSorted((S,q)=>(S.createdAt??1/0)-(q.createdAt??1/0)),Y=S=>m&&S.formId===m.form.id?i(Ua,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${S.formId}`):i(Tc,{marker:S,strings:t,onFill:!m&&h?()=>h(S.formId):void 0},S.key),pe=S=>{for(let q=K[0];q?.createdAt!==void 0&&!(S!==void 0&&q.createdAt>S);q=K[0])K.shift(),Qe.push(Y(q))};for(let S of x.value){if(S.role==="assistant"&&S.id!==H&&Qt(S))continue;pe(S.createdAt);let q=Um(S.createdAt);q&&q!==ze&&(Qe.push(i("div",{class:`${Ft}-date-divider`,children:i("span",{class:`${Ft}-date-pill`,title:zm(S.createdAt),children:qm(S.createdAt,t)})},`day:${q}`)),ze=q);let ie=S.retryAction!==void 0||S.role==="assistant"&&S.id===H?Qo(x.value,S):void 0,Pe=ie!==void 0&&(ie.kind!=="continue-assistant"||p==="ai-agent");Qe.push(i(ld,{message:S,status:S.status,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,interactive:!!_&&p==="ai-agent"&&S.id===H,superseded:S.id!==H,tool:d,onRetry:_&&Pe&&(S.role==="user"||S.id===H)?f:void 0,enableMessageFeedback:s,onFeedback:l},S.id))}for(let S of K)Qe.push(Y(S));return i("div",{class:`${Ft}-list-wrap`,children:[i("div",{ref:P,class:`${Ft}-list ${Ft}-list--fade`,role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&x.value.length===0?i("div",{class:`${Ft}-list-loading`,role:"status",children:t.conversationLoading}):null,Ie?i("div",{class:`${Ft}-load-previous`,children:i("button",{type:"button",onClick:Je,disabled:k,"aria-busy":k,"data-testid":R.loadPreviousMessages,children:t.loadPreviousMessages})}):null,Qe,m&&!Te?i(Ua,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),b?i("button",{type:"button",class:`${Ft}-jump`,onClick:Ce,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":R.scrollToBottom,children:i(nn,{})}):null]})}function Um(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function zm(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function qm(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),r=Math.round((o(new Date)-o(n))/864e5);return r<=0?t.dateToday:r===1?t.dateYesterday:r<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var Wm=["today","yesterday","lastWeek","older"];function Vm(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((dd(e)-dd(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function ud(e,t){let n=new Map;for(let o of t){let r=Vm(e,o.lastMessageAt),a=n.get(r);a?a.push(o):n.set(r,[o])}return Wm.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function dd(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var _d=X.scope("history"),Gm=3,Km=6,jm={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function Xm(e,t,n){let o=Date.parse(e);return Number.isFinite(o)?new Date(o).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(o):t-o<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(o):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(o):""}function Sr({transport:e,strings:t,locale:n,persistence:o,visitorId:r,onSelect:a,onNewConversation:s}){let l=w.cssPrefix,c=e.peekConversations({visitorId:r}),[u,_]=D(c?"loaded":"loading"),[p,d]=D(c),[f,m]=D(!1),g=M(),h=p?.conversations??[],P=p?.pagination;E(()=>{let C=!1;g.current=void 0,m(!1);let B=e.peekConversations({visitorId:r});return d(B),_(B?"loaded":"loading"),e.listConversations({visitorId:r}).then(G=>{C||(d(G),_("loaded"),o.saveHistoryCount(G.conversations.length))}).catch(G=>{C||(_d.warn("listConversations failed",{err:G}),_("error"))}),()=>{C=!0,g.current=void 0}},[e,r,o,n]);let x=async()=>{if(g.current||!P?.hasNext)return;let C={};g.current=C,m(!0);try{let B=await e.listConversations({visitorId:r,page:P.page+1,limit:P.limit});if(g.current!==C)return;let G=new Set(h.map(I=>I.conversationId)),U=[...h,...B.conversations.filter(I=>!G.has(I.conversationId))];d({conversations:U,pagination:B.pagination}),o.saveHistoryCount(U.length)}catch(B){if(g.current!==C)return;_d.warn("listConversations page failed",{err:B,page:P.page+1})}finally{g.current===C&&(g.current=void 0,m(!1))}},b=s?i("div",{class:`${l}-history-footer`,children:i("button",{type:"button",class:`${l}-history-new`,onClick:s,"data-testid":R.sidebarNewConversation,children:[i(Nl,{}),t.newConversation]})}):null;if(u==="loading"){let C=Math.min(o.loadHistoryCount()??Gm,Km);return i(ce,{children:[i("div",{class:`${l}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:i("div",{class:`${l}-history-group`,"aria-hidden":"true",children:[i("div",{class:`${l}-history-heading`,children:i("span",{class:`${l}-skeleton ${l}-skeleton-heading`})}),i("div",{class:`${l}-history-card`,children:Array.from({length:Math.max(1,C)},(B,G)=>i("div",{class:`${l}-history-item ${l}-history-item-skeleton`,children:[i("span",{class:`${l}-history-avatar ${l}-skeleton`}),i("span",{class:`${l}-history-body`,children:[i("span",{class:`${l}-history-row`,children:[i("span",{class:`${l}-history-title`,children:i("span",{class:`${l}-skeleton ${l}-skeleton-title`})}),i("span",{class:`${l}-history-time`,children:i("span",{class:`${l}-skeleton ${l}-skeleton-time`})})]}),i("span",{class:`${l}-history-row`,children:i("span",{class:`${l}-history-preview`,children:i("span",{class:`${l}-skeleton ${l}-skeleton-preview`})})})]})]},G))})]})}),b]})}if(u==="error"||h.length===0)return i(ce,{children:[i("div",{class:`${l}-history-empty`,children:t.historyEmpty}),b]});let y=Date.now(),k=ud(y,h);return i(ce,{children:[i("div",{class:`${l}-history`,role:"list",children:[k.map(C=>i("div",{class:`${l}-history-group`,children:[i("div",{class:`${l}-history-heading`,children:t[jm[C.bucket]]}),i("div",{class:`${l}-history-card`,children:C.conversations.map(B=>i("button",{type:"button",role:"listitem",class:`${l}-history-item`,onClick:()=>a(B),"data-closed":B.canContinue?void 0:"true","data-unread":B.hasUnread?"true":void 0,"data-testid":Ge(R.historyItem,B.conversationId),children:[i("span",{class:`${l}-history-avatar`,"aria-hidden":"true",children:i(Oa,{})}),i("span",{class:`${l}-history-body`,children:[i("span",{class:`${l}-history-row`,children:[i("span",{class:`${l}-history-title`,children:B.title}),i("span",{class:`${l}-history-time`,children:Xm(B.lastMessageAt,y,n)})]}),i("span",{class:`${l}-history-row`,children:[i("span",{class:`${l}-history-preview`,children:B.preview??(B.canContinue?t.historyContinue:t.conversationClosed)}),B.hasUnread?i("span",{class:`${l}-history-dot`}):null]})]})]},B.conversationId))})]},C.bucket)),P?.hasNext?i("div",{class:`${l}-history-more`,children:i("button",{type:"button",onClick:x,disabled:f,"aria-busy":f,"data-testid":R.historyLoadMore,children:t.loadMoreConversations})}):null]}),b]})}var pd=w.cssPrefix;function fd({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:i("div",{class:`${pd}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((o,r)=>i("button",{type:"button",class:`${pd}-suggestion`,onClick:()=>t(o),disabled:n,"data-testid":Ge(R.suggestion,r),children:o.label},o.id))})}var je=w.cssPrefix;function md(e){let{options:t,onClose:n}=e,o=t.strings,r=M(null);E(()=>{let u=r.current;if(!u)return;let _=lr(u),p=d=>{d.key==="Escape"&&n?.()};return u.addEventListener("keydown",p),()=>{_(),u.removeEventListener("keydown",p)}},[n]);let a=e.composerApiRef,s=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,l=O(u=>{s&&a.current?.attachFromDrop(u)},[a,s]),{visible:c}=_r({containerRef:r,onDrop:l,disabled:!s});return ir(r.current,t.mode==="modal"),i("div",{ref:r,class:`${je}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":R.panel,children:[i(oi,{...e,containerEl:r.current,dragOver:c,composerAttachApiRef:a}),i(ri,{poweredBy:e.options.poweredBy})]})}function oi(e){let{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,composerKey:l,panelSize:c,view:u,canSend:_,isStreaming:p,sendPreparing:d,controlMode:f,assignedOperatorInitials:m,operatorAvailable:g,operatorRequestEnabled:h,onRequestOperator:P,onCancelOperatorRequest:x,loadingMessages:b,onLoadPreviousMessages:y,messagesSig:k,agent:C,suggestions:B,initialWidgetSize:G,visitorId:U,onClose:I,onBack:z,onClear:W,onToggleHistory:L,onSelectHistoryConversation:ne,onNewConversation:re,onWidgetSizeChange:le,onSend:Ae,onStop:de,onSuggestion:_e,activeForm:Me,formMarkers:N,onFormSubmit:ve,onFormSkip:ae,onFormFill:De,tool:xe,onRetry:Te,onMessageFeedback:Ce,containerEl:Le,dragOver:he,composerAttachApiRef:Se}=e,Ie=t.strings,Je=_t(()=>k.value.some(ze=>!ze.ephemeral&&ze.role!=="system")).value,Qe;return Me?Qe=null:_?Qe=i(ce,{children:[f&&f!=="ai-agent"?i(Qm,{controlMode:f,operatorInitials:m,operatorAvailable:g,onCancelOperatorRequest:x,strings:Ie}):null,!p&&f==="ai-agent"&&i(fd,{suggestions:B,onPick:_e,disabled:d}),i(xc,{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,isStreaming:p,active:e.composerActive&&u==="chat",isPreparing:d,operatorRequestEnabled:h,canRequestOperator:Je,controlMode:f,onRequestOperator:P,onSend:Ae,onStop:de,attachApiRef:Se},l)]}):Qe=i(Jm,{label:Ie.conversationClosed,ctaLabel:Ie.startNewConversation,onNewConversation:W}),i(ce,{children:[u==="history"?i(Ym,{strings:Ie,onBack:L,onClose:I,showClose:sr(t.mode,c,t.actions)}):i("header",{class:`${je}-header`,"data-testid":R.panelHeader,children:[z?i("button",{type:"button",class:`${je}-icon-btn`,onClick:z,"aria-label":Ie.moduleBack,title:Ie.moduleBack,children:i(Zn,{})}):null,C?i(hc,{agent:C,strings:Ie}):i("h1",{children:Ie.panelTitle}),i(mt,{panelProps:e,variant:"chat"})]}),u==="history"?i(Sr,{transport:n,strings:Ie,locale:t.locale,persistence:a,visitorId:U,onSelect:ze=>ne(ze.conversationId),onNewConversation:re}):i(ce,{children:[i(Sc,{visible:he,strings:Ie}),i(cd,{messagesSig:k,strings:Ie,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:Ce,loading:b,onLoadPreviousMessages:y,idle:!p&&!d&&_&&!Me,controlMode:f,tool:xe,onRetry:Te,form:Me?{form:Me,onSubmit:ve,onSkip:ae}:null,formMarkers:N,onFillForm:De}),Qe,i(eg,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?i(ar,{panelEl:Le,resize:t.size.resize,position:t.position,initialSize:G,onSizeChange:le,strings:Ie}):null]})}function Ym({strings:e,onBack:t,onClose:n,showClose:o}){return i("header",{class:`${je}-header`,children:[i("button",{type:"button",class:`${je}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:i(Zn,{})}),i("h1",{children:e.historyTitle}),o?i("button",{type:"button",class:`${je}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:i(ft,{})}):null]})}function Jm({label:e,ctaLabel:t,onNewConversation:n}){return i("div",{class:`${je}-readonly-banner`,role:"note",children:[i("span",{class:`${je}-readonly-label`,children:e}),i("button",{type:"button",class:`${je}-readonly-cta`,onClick:n,children:t})]})}function Qm({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:o,strings:r}){let a=Zm(e,t,n,r);return i("div",{class:`${je}-operator-banner`,role:"status","data-mode":e,"data-testid":R.operatorBanner,children:[i("span",{class:`${je}-operator-pulse`,"aria-hidden":"true"}),i("span",{class:`${je}-operator-label`,children:a}),e==="awaiting_operator"&&o?i("button",{type:"button",class:`${je}-cancel-operator-request`,"data-testid":R.cancelOperatorRequest,onClick:o,children:r.cancelOperatorRequest}):null]})}function Zm(e,t,n,o){return e==="operator"?o.chattingWithOperator.replace("{operator}",t??""):n===!1?o.noOperatorAvailable:o.connectingOperator}function eg({disclaimer:e}){return e?i("div",{class:`${je}-composer-footer`,children:i("div",{class:`${je}-disclaimer`,children:e})}):null}function ri({poweredBy:e}){return e?i("div",{class:`${je}-poweredby-bar`,children:i(tg,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function tg({logoUrl:e,text:t,href:n}){let o=i(ce,{children:[e?i("img",{class:`${je}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?i("span",{children:t}):null]});return n?i("a",{class:`${je}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):i("span",{class:`${je}-poweredby`,children:o})}function gd(e){let t=M(e);t.current=e;let n=M(null);return n.current??(n.current=ng(t)),n.current}function ng(e){let t=Q(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,r=c=>c.frequency==="always"?!1:c.frequency==="conversation"?n.has(o(c.id)):c.id in e.current.persistence.loadFormsDone(),a=(c,u)=>{if(t.value)return;let _=e.current;if(c==="manual"){let p=_.forms.list.find(d=>d.id===u);p&&(t.value={form:p,trigger:"manual"});return}for(let p of _.forms.byTrigger[c]??[]){let d=p.triggers.find(f=>f.kind===c);if(!(!d||!og(d,_)||r(p)||!rg(p,_))){t.value={form:p,trigger:c};return}}},s=(c,u)=>{let _=t.value;if(!_)return;t.value=null;let{form:p,trigger:d}=_;p.frequency==="conversation"?n.add(o(p.id)):p.frequency!=="always"&&e.current.persistence.saveFormDone(p.id),e.current.onComplete(p,d,c,u)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let u=e.current.forms.list.find(_=>_.id===c.form.id);u&&u!==c.form&&(t.value={form:u,trigger:c.trigger})},complete:c=>s(c,!1),skip:()=>s({},!0)}}function og(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function rg(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let r=t.userContext()??{};if(n.missingContext.some(a=>r[a]!==void 0&&r[a]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let o=t.messageCount();return!(n.minMessages!=null&&o<n.minMessages||n.maxMessages!=null&&o>n.maxMessages)}function vd(e){let t=w.cssPrefix,{site:n,blocks:o,strings:r,collapsed:a}=e,s=o?.navigation??[],l=o?.linkCards??[],c=a?r.expandSidebar:r.collapseSidebar;return i("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":R.sidebar,children:[i("div",{class:`${t}-sidebar-header`,children:[i(ag,{site:n}),i("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":R.sidebarToggle,children:i(ig,{collapsed:a})})]}),a?null:i(ce,{children:[s.length>0?i("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:i(sg,{items:s})}):null,l.length>0?i("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:i(lg,{items:l})}):null,e.showConversations?i("div",{class:`${t}-sidebar-conversations`,children:i(Sr,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,visitorId:e.visitorId,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function ag({site:e}){let t=w.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return i("picture",{children:[e.logoDark?.url?i("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,i("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return i("div",{class:`${t}-sidebar-title`,children:e?.title??w.name})}function ig({collapsed:e}){return i("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?i("polyline",{points:"9 6 15 12 9 18"}):i("polyline",{points:"15 6 9 12 15 18"})})}function sg({items:e}){let t=w.cssPrefix;return i("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>i("li",{children:i("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?i("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,i("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function lg({items:e}){let t=w.cssPrefix;return i("div",{class:`${t}-sidebar-cards`,children:e.map(n=>i("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[i("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?i("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var hd=w.cssPrefix;function bd(e){return i("main",{class:`${hd}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[i(vd,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,visitorId:e.visitorId,showConversations:e.showConversations,onSelectConversation:e.onSelectConversation,onNewConversation:e.onNewConversation,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),i("section",{class:`${hd}-page-chat`,"aria-label":"Chat",children:e.children})]})}var yd=e=>Object.fromEntries(e.map(t=>[t,[]]));function ai(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function Pd(e,t,n){let o=[...new Set(t)],r=ai(o,e,""),a=Q({activeTab:r,stacks:yd(o)});return{sig:a,reconcile(s,l){let c=[...new Set(s)],u=a.value,_=ai(c,u.activeTab,l),p=Object.fromEntries(c.map(f=>[f,u.stacks[f]??[]])),d=_===u.activeTab&&c.length===Object.keys(u.stacks).length&&c.every(f=>u.stacks[f]===p[f]);o=c,!d&&(a.value={activeTab:_,stacks:p},_!==u.activeTab&&_&&n?.(_))},switchTab(s){!(s in a.value.stacks)||a.value.activeTab===s||(a.value={...a.value,activeTab:s},n?.(s))},push(s){let l=a.value,c=l.stacks[l.activeTab]??[];a.value={...l,stacks:{...l.stacks,[l.activeTab]:[...c,s]}}},pop(){let s=a.value,l=s.stacks[s.activeTab]??[];l.length!==0&&(a.value={...s,stacks:{...s.stacks,[s.activeTab]:l.slice(0,-1)}})},reset(s){a.value={activeTab:ai(o,s,""),stacks:yd(o)}}}}var xd=e=>e.stacks[e.activeTab]??[],Sd=e=>xd(e).at(-1),kd=e=>xd(e).length===0;var wd={Icon:to};var Bt=w.cssPrefix;function kr({title:e,actions:t}){return i("header",{class:`${Bt}-back-header`,"data-variant":"title",children:[i("span",{class:`${Bt}-back-spacer`,"aria-hidden":"true"}),i("h1",{class:`${Bt}-back-title`,children:e}),t??i("span",{class:`${Bt}-back-spacer`,"aria-hidden":"true"})]})}function wr({title:e,backLabel:t,onBack:n,actions:o,testid:r}){return i("header",{class:`${Bt}-back-header`,"data-testid":r,children:[i("button",{type:"button",class:`${Bt}-icon-btn`,onClick:n,"aria-label":t,title:t,children:i(Zn,{})}),i("h1",{class:`${Bt}-back-title`,children:e}),o??i("span",{class:`${Bt}-back-spacer`,"aria-hidden":"true"})]})}function an(e,t){return e instanceof Ve&&e.status===429?t.errorRateLimited:t.errorGeneric}var In=w.cssPrefix;function Cd({placeholder:e,onActivate:t}){return i("button",{type:"button",class:`${In}-home-search`,onClick:t,"data-testid":R.homeSearch,children:[i("span",{class:`${In}-home-search-text`,children:e}),i("span",{class:`${In}-home-search-icon`,"aria-hidden":"true",children:i(Da,{})})]})}function Rd({placeholder:e,value:t,onInput:n}){return i("div",{class:`${In}-home-search`,"data-input":"true",children:[i("input",{type:"search",class:`${In}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":R.helpSearch}),i("span",{class:`${In}-home-search-icon`,"aria-hidden":"true",children:i(Da,{})})]})}var ao=w.cssPrefix;function Cr({title:e,subtitle:t,onClick:n,testid:o}){return i("button",{type:"button",class:`${ao}-list-row`,onClick:n,"data-testid":o,children:[i("span",{class:`${ao}-list-row-body`,children:[i("span",{class:`${ao}-list-row-title`,children:e}),t?i("span",{class:`${ao}-list-row-sub`,children:t}):null]}),i("span",{class:`${ao}-list-row-chevron`,"aria-hidden":"true",children:i(kn,{})})]})}var Td=w.cssPrefix;function lt({tone:e="info",message:t,onRetry:n,strings:o}){return i("div",{class:`${Td}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[i("span",{children:t}),n?i("button",{type:"button",class:`${Td}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var sn=w.cssPrefix,cg=X.scope("help"),dg=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function ug(e){let t=new Map;for(let n of e){let o=n.categories?.[0]??"";(t.get(o)??t.set(o,[]).get(o)).push(n)}return[...t.entries()]}function Id(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let r=0;for(let a of e){if(r=n.indexOf(a,r),r===-1)return 0;r+=1}return 1}function _g(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(Id(n,o.title)*2,Id(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,r)=>r.score-o.score).map(o=>o.item):[]}function Ed({article:e,nav:t}){return i(Cr,{title:e.title,subtitle:e.description,onClick:()=>dg(t,e),testid:Ge(R.helpArticle,e.id)})}function pg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=D("loading"),[u,_]=D(t.errorGeneric),[p,d]=D([]),[f,m]=D(""),[g,h]=D(0);E(()=>{let b=!1;return c("loading"),e.listContent({tags:s,sortBy:"order",limit:100}).then(y=>{if(b)return;let k=y.items??[];d(k),c("loaded"),r.emit("contentView",{section:"help",tags:s?.join(","),count:k.length})}).catch(y=>{b||(cg.warn("listContent (help) failed",{err:y}),_(an(y,t)),c("error"))}),()=>{b=!0}},[e,s,g,r]);let P=ee(()=>_g(p,f),[p,f]);E(()=>{let b=f.trim();if(!b)return;let y=setTimeout(()=>r.emit("contentSearch",{queryLength:b.length,hitCount:P.length}),600);return()=>clearTimeout(y)},[f,P,r]);function x(){return f.trim().length>0?P.length===0?i(lt,{message:t.helpSearchEmpty,strings:t}):i("div",{class:`${sn}-help-card`,children:P.map(b=>i(Ed,{article:b,nav:o},b.id))}):l==="loading"?i(lt,{message:t.helpLoading,strings:t}):l==="error"?i(lt,{tone:"error",message:u,onRetry:()=>h(b=>b+1),strings:t}):p.length===0?i(lt,{message:t.helpEmpty,strings:t}):ug(p).map(([b,y])=>i("section",{class:`${sn}-help-group`,children:[b?i("h2",{class:`${sn}-help-section-title`,children:b}):null,i("div",{class:`${sn}-help-card`,children:y.map(k=>i(Ed,{article:k,nav:o},k.id))})]},b))}return i("div",{class:`${sn}-module`,children:[i(kr,{title:t.helpTitle,actions:i(mt,{panelProps:a,variant:"plain"})}),i("div",{class:`${sn}-module-pad`,children:i(Rd,{placeholder:t.helpSearchPlaceholder,value:f,onInput:m})}),i("div",{class:`${sn}-help-list`,children:x()})]})}var Ad={Icon:eo,Root:e=>i(pg,{...e})};var Md=w.cssPrefix;function ii({onClick:e,children:t,testid:n}){return e?i("button",{type:"button",class:`${Md}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):i("div",{class:`${Md}-home-card`,"data-testid":n,children:t})}var we=w.cssPrefix,Ld=X.scope("home");function fg(e){let t=e.options.userContext?.name,n=e.config.greetingText?Ze(e.strings,e.config.greetingText):void 0;return n?{title:t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),subtitle:e.strings.homeGreetingLead}:t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}var mg=(e,t)=>t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title});function gg(e){let{transport:t,strings:n,config:o,nav:r,bus:a,panelProps:s}=e,[l,c]=D(null),[u,_]=D([]),p=o.contentTags?.join(","),d=e.options.modules.list.some(x=>x.layout==="chat");E(()=>{if(o.showRecentConversations===!1)return;let x=!1;return t.listConversations({limit:d?50:1}).then(b=>!x&&c(b.conversations?.[0]??null)).catch(b=>!x&&Ld.warn("listConversations (home) failed",{err:b})),()=>{x=!0}},[t,o.showRecentConversations,d]),E(()=>{if(!o.contentTags?.length)return;let x=!1;return t.listContent({tags:o.contentTags,limit:6}).then(b=>{if(x)return;let y=b.items??[];_(y),a.emit("contentView",{section:"home",tags:p,count:y.length})}).catch(b=>!x&&Ld.warn("listContent (home) failed",{err:b})),()=>{x=!0}},[t,p,a]);let f=fg(e),m=o.userAvatars??[],g=o.status,h=g?.text?Ze(n,g.text):n.homeStatus,P=o.contentBlockTitle?Ze(n,o.contentBlockTitle):n.homeContentTitle;return i("div",{class:`${we}-module ${we}-home`,"data-testid":R.homeView,children:i("div",{class:`${we}-home-scroll`,children:[i("div",{class:`${we}-home-hero`,children:[i("div",{class:`${we}-home-hero-top`,children:[o.brandName?i("span",{class:`${we}-home-brand`,"data-testid":R.homeBrand,children:o.brandName}):i("span",{class:`${we}-home-brand-spacer`,"aria-hidden":"true"}),i("div",{class:`${we}-home-hero-actions`,children:[m.length>0?i("div",{class:`${we}-home-avatars`,children:m.map(x=>i("span",{class:`${we}-home-avatar`,title:x.role?`${x.name} \xB7 ${x.role}`:x.name,children:x.avatar?i("img",{src:x.avatar,alt:"",loading:"lazy"}):i("span",{children:cr(x.name)})},x.name))}):null,i(mt,{panelProps:s,variant:"plain"})]})]}),o.showGreeting!==!1?i(ce,{children:[i("h1",{class:`${we}-home-greeting`,"data-testid":R.homeGreeting,children:f.title}),f.subtitle?i("p",{class:`${we}-home-lead`,children:f.subtitle}):null]}):null]}),i("div",{class:`${we}-home-cards`,children:[o.showSearchBar!==!1?i(Cd,{placeholder:n.homeSearchPlaceholder,onActivate:()=>r.switchToLayout("help")}):null,l?i(ii,{onClick:()=>r.selectConversation(l.conversationId),testid:R.homeRecent,children:i("div",{class:`${we}-home-recent-row`,"data-unread":l.hasUnread?"true":void 0,children:[i("span",{class:`${we}-home-recent-avatar`,"aria-hidden":"true",children:i(to,{})}),i("span",{class:`${we}-home-recent-body`,children:[i("span",{class:`${we}-home-recent-title`,children:l.title}),l.preview?i("span",{class:`${we}-home-recent-preview`,children:l.preview}):null]}),l.hasUnread?i("span",{class:`${we}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,g?i(ii,{onClick:g.url?()=>r.push({kind:"iframe",url:g.url,title:h}):void 0,children:i("div",{class:`${we}-home-status`,"data-level":g.level??"operational",children:[i("span",{class:`${we}-home-status-icon`,"aria-hidden":"true",children:i(nc,{})}),i("span",{class:`${we}-home-status-text`,children:h})]})}):null,u.length>0?i("section",{class:`${we}-home-content`,children:[i("div",{class:`${we}-home-content-title`,children:P}),i("div",{class:`${we}-home-content-list`,children:u.map(x=>i(Cr,{title:x.title,subtitle:x.description,onClick:()=>mg(r,x),testid:Ge(R.homeContentRow,x.id)},x.id))})]}):null]})]})})}var Od={Icon:oc,Root:e=>i(gg,{...e})};var Ht=w.cssPrefix,vg=X.scope("news");function hg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=D("loading"),[u,_]=D(t.errorGeneric),[p,d]=D([]),[f,m]=D(0);E(()=>{let h=!1;return c("loading"),e.listContent({tags:s,sortBy:"publishedAt",sortOrder:"desc"}).then(P=>{if(h)return;let x=P.items??[];d(x),c("loaded"),r.emit("contentView",{section:"news",tags:s?.join(","),count:x.length})}).catch(P=>{h||(vg.warn("listContent (news) failed",{err:P}),_(an(P,t)),c("error"))}),()=>{h=!0}},[e,s,f,r]);function g(){return l==="loading"?i(lt,{message:t.newsLoading,strings:t}):l==="error"?i(lt,{tone:"error",message:u,onRetry:()=>m(h=>h+1),strings:t}):p.length===0?i(lt,{message:t.newsEmpty,strings:t}):i("div",{class:`${Ht}-news-list`,children:p.map(h=>i("button",{type:"button",class:`${Ht}-news-card`,onClick:()=>o.push({kind:"content",id:h.id,title:h.title}),"data-testid":Ge(R.newsItem,h.id),children:[h.image?i("img",{class:`${Ht}-news-hero`,src:h.image,alt:"",loading:"lazy"}):null,i("span",{class:`${Ht}-news-body`,children:[i("span",{class:`${Ht}-news-title`,children:h.title}),h.description?i("span",{class:`${Ht}-news-summary`,children:h.description}):null]})]},h.id))})}return i("div",{class:`${Ht}-module`,children:[i(kr,{title:t.newsTitle,actions:i(mt,{panelProps:a,variant:"plain"})}),i("div",{class:`${Ht}-module-scroll`,children:g()})]})}var Nd={Icon:rc,Root:e=>i(hg,{...e})};var Rr={chat:wd,home:Od,help:Ad,news:Nd};var io=w.cssPrefix;function Dd({modules:e,activeTab:t,strings:n,hasUnread:o,onSelect:r}){return i("nav",{class:`${io}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=Rr[a.layout].Icon,l=a.id===t,c=a.layout==="chat"&&o;return i("button",{type:"button",role:"tab","aria-selected":l,class:`${io}-tab`,onClick:()=>r(a.id),"data-testid":Ge(R.tab,a.id),children:[i("span",{class:`${io}-tab-icon`,"aria-hidden":"true",children:[i(s,{}),c?i("span",{class:`${io}-tab-badge`,"data-testid":R.tabBadge,"aria-label":"Unread"}):null]}),i("span",{class:`${io}-tab-label`,children:Ze(n,a.label)})]},a.id)})})}var $d=w.cssPrefix,bg="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function Fd({url:e,title:t,strings:n,onBack:o,actions:r}){return i("div",{class:`${$d}-module`,children:[i(wr,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:r}),i("iframe",{class:`${$d}-content-frame`,src:e,title:t||"content",sandbox:bg,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var so=w.cssPrefix,yg=X.scope("content"),Pg=5e3;function Bd({id:e,title:t,transport:n,strings:o,bus:r,onBack:a,actions:s}){let[l,c]=D(null),[u,_]=D(!1),[p,d]=D(0),f=O(()=>{_(!1),c(null),d(h=>h+1)},[]);E(()=>{let h=!1;return n.listContent({ids:[e],limit:1}).then(P=>{if(h)return;let x=P.items[0];x?(c(x),r.emit("contentOpen",{contentId:e,tags:x.tags?.length?x.tags.join(","):void 0})):_(!0)}).catch(P=>{h||(yg.warn("listContent (reader) failed",{err:P}),_(!0))}),()=>{h=!0}},[n,e,p,r]),E(()=>{if(!l)return;let h=setTimeout(()=>r.emit("contentRead",{contentId:e}),Pg);return()=>clearTimeout(h)},[l,e,r]);let m=O(h=>{let x=h.target?.closest?.("a")?.getAttribute("href")??"";x&&!x.startsWith("#")&&r.emit("contentLinkClick",{contentId:e})},[r,e]);function g(){return u?i(lt,{tone:"error",message:o.errorGeneric,onRetry:f,strings:o}):l===null?i(lt,{message:o.contentLoading,strings:o}):i("article",{class:`${so}-content`,"data-testid":R.contentView,onClick:m,children:[l.image?i("img",{class:`${so}-content-hero`,src:l.image,alt:"",loading:"lazy"}):null,l.description?i("p",{class:`${so}-content-subtitle`,children:l.description}):null,i(Zc,{text:l.content??""})]})}return i("div",{class:`${so}-module`,children:[i(wr,{title:l?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:a,actions:s,testid:R.backHeader}),i("div",{class:`${so}-module-scroll`,"data-testid":R.contentScroll,children:g()})]})}var Tr=w.cssPrefix;function Hd({panelProps:e,enabledModules:t,nav:n,bus:o,hasUnread:r,onSelectConversation:a,onStartNewConversation:s,onSetPanelSize:l}){let c=e.options,u=c.strings,_=M(null),p=M(new Set);E(()=>{let L=_.current;if(!L)return;let ne=lr(L),re=le=>{le.key==="Escape"&&e.onClose?.()};return L.addEventListener("keydown",re),()=>{ne(),L.removeEventListener("keydown",re)}},[e.onClose]);let d=_t(()=>n.sig.value).value,f=Sd(d),m=c.modules.byId[d.activeTab],g=e.composerActive&&m?.layout==="chat"&&f===void 0,h=e.composerApiRef,P=g&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,x=O(L=>{P&&h.current?.attachFromDrop(L)},[h,P]),{visible:b}=_r({containerRef:_,onDrop:x,disabled:!P});ir(_.current,c.mode==="modal");let y=f?.kind==="iframe"||f?.kind==="content",k=t.length>1&&(kd(d)||!y),C=M(null);E(()=>{if(y&&C.current===null)C.current=e.panelSize,e.panelSize==="normal"&&l("expanded");else if(!y&&C.current!==null){let L=C.current;C.current=null,l(L)}},[y]);let B={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:L=>{let ne=t.find(re=>re.layout===L);ne&&n.switchTab(ne.id)},selectConversation:a,startNewConversation:s},G=L=>({options:c,transport:e.transport,strings:u,config:L,visitorId:e.visitorId,nav:B,bus:o,panelProps:e}),U=i(mt,{panelProps:e,variant:"plain"});m&&p.current.add(m.id);let I=t.filter(L=>p.current.has(L.id)),z=L=>{if(L.layout==="chat")return i(oi,{...e,composerActive:g,containerEl:_.current,dragOver:b,composerAttachApiRef:h});let ne=Rr[L.layout].Root;return ne?i(ne,{...G(L)}):null},W=()=>f?.kind==="iframe"?i(Fd,{url:f.url,title:f.title,strings:u,onBack:n.pop,actions:U}):f?.kind==="content"?i(Bd,{id:f.id,title:f.title,transport:e.transport,strings:u,bus:o,onBack:n.pop,actions:U}):null;return i("div",{ref:_,class:`${Tr}-panel ${Tr}-messenger`,role:"dialog","aria-modal":"false","aria-label":u.panelTitle,style:{position:"relative"},"data-testid":R.messengerHome,children:[i("div",{class:`${Tr}-messenger-body`,children:[I.map(L=>i("div",{class:`${Tr}-messenger-pane`,hidden:y||L.id!==m?.id,children:z(L)},L.id)),W()]}),k?i(Dd,{modules:t,activeTab:d.activeTab,strings:u,hasUnread:r,onSelect:n.switchTab}):null,i(ri,{poweredBy:c.poweredBy}),c.size.resize?.enabled&&!(m?.layout==="chat"&&!f)?i(ar,{panelEl:_.current,resize:c.size.resize,position:c.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:u}):null]})}var lo=w.cssPrefix;function Ud({strings:e,onClose:t}){return i("div",{class:`${lo}-panel ${lo}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":R.modulesEmpty,children:[t?i("button",{type:"button",class:`${lo}-icon-btn ${lo}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:i(ft,{})}):null,i("p",{class:`${lo}-modules-empty-text`,children:e.modulesEmpty})]})}function En(e,t,n,o){let r={role:n,text:o};e.emit("message",r),t.onMessage?.(r)}var si=X.scope("hitl");function zd(e){let{streaming:t,controlModeSig:n,messagesSig:o,sendAiTurn:r,bus:a,humanInLoop:s}=e,l=M(t);l.current=t;let c=O((d,f,m)=>{if(l.current||n.value!=="ai-agent")return!1;let g=o.value.at(-1),h=g?.partsSig.value.findIndex(x=>x.kind==="tool"&&x.toolCallId===d)??-1,P=g?.partsSig.value[h];return!g||P?.kind!=="tool"?(si.warn("decideTool: tool part not found",{toolCallId:d}),!1):g.status!=="complete"||!Xo(g,h)||!f(P)?!1:(m(P),g.partsSig.value=[...g.partsSig.value],Zt(g)&&(g.status="streaming",g.retryAction={kind:"continue-assistant",messageId:g.serverMessageId??g.id},g.awaitingContinuation=!0,o.value=[...o.value],r({continueExisting:!0})),!0)},[n,o,r]),u=O((d,f,m)=>{let g=!1;if(c(d,P=>P.stateSig.value==="approval-requested",P=>{g=mr(P.toolName);let x=P.approvalSig.value?.id??d;P.approvalSig.value={id:x,approved:f,reason:m},P.stateSig.value="approval-responded"})){if(g){si.info("toolResult",{toolCallId:d}),a.emit("toolResult",{toolCallId:d});return}si.info("toolDecision",{toolCallId:d,approved:f}),a.emit("toolDecision",{toolCallId:d,approved:f})}},[a,c]),_=O(d=>{c(d,f=>f.stateSig.value==="approval-responded"&&f.approvalSig.value?.approved!==void 0,f=>{let m=f.approvalSig.value?.id??d;f.approvalSig.value={id:m},f.stateSig.value="approval-requested"})},[c]);return{toolInteraction:ee(()=>({humanInLoop:s,onDecision:u,onEdit:_}),[s,u,_])}}function qd({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[r,a]=D(()=>o?!1:t.loadCalloutDismissed(n));E(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let s=O(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:r,dismissCallout:s}}function Wd(e){let{transport:t,conversationIdSig:n}=e,o=ut("ai-agent"),r=ut(void 0),a=ut(void 0),s=M(),l=O(p=>{let d=p.controlRevision??0,f=s.current;f&&f.conversationId===n.value&&d<f.revision||(s.current={conversationId:n.value,revision:d},o.value=p.controlMode,r.value=p.assignedOperatorInitials,p.controlMode!=="awaiting_operator"?a.value=void 0:p.operatorAvailable!==void 0&&(a.value=p.operatorAvailable))},[n,o,r,a]),c=O(p=>{p.type==="data-control-state"&&l(Ot(p.data))},[l]),u=O(async()=>{let p=n.value,d=await t.requestOperator();d&&n.value===p&&l(Ot(d))},[t,n,l]),_=O(async()=>{let p=n.value,d=await t.cancelOperatorRequest();d&&n.value===p&&l(Ot(d))},[t,n,l]);return{controlModeSig:o,assignedOperatorInitialsSig:r,operatorAvailableSig:a,applyControlState:l,adoptControlStateChunk:c,requestOperator:u,cancelOperatorRequest:_}}var Ir=w.cssPrefix,Vd=`--${Ir}-visual-viewport-height`,Gd=`--${Ir}-visual-viewport-top`;function Kd(e){let{hostElement:t,mode:n,panelSize:o,isOpen:r,surfaceReady:a,setIsOpen:s}=e;dt(()=>{Lo(t,Wo(n,o,r))},[t,r,o,n]),dt(()=>{if(!r||!a)return;let l=t.ownerDocument.defaultView,c=l?.visualViewport,u=t.shadowRoot?.querySelector(`.${Ir}-anchor`);if(!l||!c||!u)return;let _=()=>{u.style.setProperty(Vd,`${c.height}px`),u.style.setProperty(Gd,`${c.offsetTop}px`)},p=0,d=()=>{l.cancelAnimationFrame(p),p=l.requestAnimationFrame(()=>{p=l.requestAnimationFrame(_)})};return _(),c.addEventListener("resize",d),c.addEventListener("scroll",d),()=>{l.cancelAnimationFrame(p),c.removeEventListener("resize",d),c.removeEventListener("scroll",d),u.style.removeProperty(Vd),u.style.removeProperty(Gd)}},[t,r,a]),E(()=>{if(n!=="modal"||!r)return;let l=c=>{c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${Ir}-panel`))||s(!1)};return t.addEventListener("click",l),()=>t.removeEventListener("click",l)},[t,r,n,s]),E(()=>{if(n!=="drawer"||!r)return;let l=c=>{c.key==="Escape"&&s(!1)};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r,n,s])}var li=X.scope("reducer"),Er=class{constructor(t,n){te(this,"messagesSig",t);te(this,"onReconcileNeeded",n);te(this,"active",null);te(this,"openTextParts",new Map);te(this,"partSeq",0);te(this,"replay",null)}attach(t){this.active=t,this.openTextParts.clear()}detach(){this.active=null,this.replay=null,this.openTextParts.clear()}beginReplay(t,n){let o=Rt();o.id=t.id;let r=ln(t)||en(t)&&(t.status!=="streaming"||Zt(t)),a=t.status==="streaming"&&Zt(t)&&Yn(t);this.replay={baseline:t,shadow:o,chunks:[n],probeContinuation:r,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!r},this.attach(o),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t.baseline||r?.id===t.baseline.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t.baseline)??o.find(l=>l.id===t.baseline.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let s=t.baseline;return t.baseline=a,jd(s,a),t.liveCatchUp&&ln(t.shadow)&&(a.status==="streaming"||en(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=ln(a)||en(a)&&(a.status!=="streaming"||Zt(a)),t.continuationTailReplay=a.status==="streaming"&&Zt(a)&&Yn(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t||r?.id===t.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t)??o.find(l=>l.id===t.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;jd(t,a);let s=ln(t)&&en(a);return a.status!=="streaming"&&!s?(this.detach(),null):(this.replay={baseline:a,shadow:t,chunks:[],probeContinuation:!1,continuationTailReplay:!1,liveCatchUp:!0},t)}promoteReplay(){let{baseline:t,shadow:n}=this.replay;return it(()=>{t.role=n.role,t.serverMessageId=n.serverMessageId,t.operatorInitials=n.operatorInitials,t.status=n.status,n.canceled&&(t.canceled=!0),t.finishReason=n.finishReason,t.errorText=n.errorText,t.suggestions=n.suggestions??t.suggestions,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(t=!1){let{baseline:n,chunks:o}=this.replay,r=Yo(n);return this.replay=null,it(()=>{if(t){let a=n.partsSig.value.findLastIndex(s=>s.kind==="tool");n.partsSig.value=n.partsSig.value.slice(0,a+1)}n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n);for(let a of o)this.apply(a);n.continuationStreaming=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,o=Yo(n);return this.replay=null,it(()=>{n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n),this.apply(t),n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let r=(this.replay?.baseline??this.active)?.serverMessageId;r!==void 0&&t.messageId!==void 0&&r!==t.messageId&&this.onReconcileNeeded?.({messageId:r}),this.detach();let a=t.messageId,s=a!==void 0?this.messagesSig.value.find(_=>_.serverMessageId===a||_.id===a):void 0;if(s!==void 0)return t.messageMetadata?.senderRole==="visitor"&&s.role==="user"&&(s.status==="pending"||s.status==="error")&&(s.serverMessageId=a,s.status="complete",s.errorText=void 0,s.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(s,t),null;let l=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(l===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!Dt(c))return this.attach(c),this.apply(t),null;let u=Rt();return this.attach(u),this.messagesSig.value=[...this.messagesSig.value,u],this.apply(t),null}if(this.replay){let o=this.refreshReplayBaseline();if(!o)return null;o.chunks.push(t),t.type==="data-control-state"&&(o.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:r,shadow:a,probeContinuation:s,continuationTailReplay:l,liveCatchUp:c}=o,u=t.type==="finish"||t.type==="error"||t.type==="abort";if(s){if(!kg(r,a,t))return u&&(Tg(r,a)&&(r.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id})),this.detach()),null;let p=ln(r)&&u?this.settleOwnedContinuation(t):this.promoteContinuation();return u?(p.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:p.serverMessageId??p.id}):p.continuationStreaming=!1),this.detach(),p):null}if(l&&Sg(r,a)){let p=this.promoteContinuation(!0);return u?(this.detach(),p):null}if(!c)return u&&this.detach(),null;if(u&&!Dt(r)&&Dt(a)){let p=this.promoteReplay();return this.detach(),p}if(!xg(r,a))return u&&(this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}),this.detach()),null;let _=this.promoteReplay();return u?(this.detach(),_):null}let n=this.refreshActive();if(!n)return null;if(this.replay)return this.applyResume(t);if(this.apply(t),t.type==="finish"||t.type==="error"||t.type==="abort"){let o=n;return o.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}):o.continuationStreaming=!1),this.detach(),o}return null}ensureTextPart(t,n,o){let r=`${n}:${o}`,a=this.openTextParts.get(r);if(a)return a;let s={kind:n,id:`${o}#${this.partSeq++}`,textSig:Q(""),doneSig:Q(!1)};return this.openTextParts.set(r,s),co(t,s),s}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let o=t.messageMetadata;o?.senderRole==="operator"?(n.role="operator",o.operatorInitials&&(n.operatorInitials=o.operatorInitials)):o?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":co(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":li.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",n.retryAction=void 0,t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":li.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":li.debug("stream abort chunk (canceled)"),n.status="complete",n.canceled=!0,n.retryAction=void 0,this.bumpDone(n);return;case"text-start":this.ensureTextPart(n,"text",t.id);return;case"text-delta":{let o=this.ensureTextPart(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":this.ensureTextPart(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=this.ensureTextPart(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-input-error":case"tool-output-available":case"tool-output-error":case"tool-output-denied":case"tool-approval-request":Ig(n,t);return;case"file":co(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":Xd(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":Xd(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=Go(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;default:{let o=t}}}bumpDone(t){it(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},ci={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function ln(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function jd(e,t){e.canceled&&(t.canceled=!0),!(!ln(e)||t.status!=="streaming"&&!en(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function xg(e,t){let n=e.partsSig.value,o=t.partsSig.value;return e.role!==t.role||o.length<n.length?!1:n.every((r,a)=>Yd(r,o[a]))}function Sg(e,t){let n=e.partsSig.value,o=n.findLastIndex(l=>l.kind==="tool"),r=new Set(n.slice(0,o+1).flatMap(l=>l.kind==="tool"?[l.toolCallId]:[])),a=t.partsSig.value.filter(l=>l.kind!=="tool"||!r.has(l.toolCallId)),s=n.slice(o+1);return a.length<s.length?!1:s.every((l,c)=>Yd(l,a[c]))}function Yd(e,t){switch(e.kind){case"text":case"reasoning":return t?.kind===e.kind&&t.textSig.value.startsWith(e.textSig.value);case"step-start":return t?.kind==="step-start";case"tool":{if(t?.kind!=="tool"||t.toolCallId!==e.toolCallId||!Jo(t.toolName,e.toolName)||ci[t.stateSig.value]<ci[e.stateSig.value])return!1;let n=e.approvalSig.value?.approved;return n===void 0||t.approvalSig.value?.approved===n}case"file":return t?.kind==="file"&&t.url===e.url&&t.mediaType===e.mediaType;case"source":return t?.kind==="source"&&t.sourceId===e.sourceId&&t.url===e.url&&t.title===e.title&&t.filename===e.filename&&t.mediaType===e.mediaType;default:return e}}function kg(e,t,n){return wg(e,n)||!Cg(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:Yn(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(o=>o.kind==="step-start")}function wg(e,t){if(t.type!=="tool-output-available"&&t.type!=="tool-output-error"&&t.type!=="tool-output-denied")return!1;let n=e.partsSig.value.find(o=>o.kind==="tool"&&o.toolCallId===t.toolCallId);return n!==void 0&&ci[n.stateSig.value]<4}function Cg(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let o=e.partsSig.value;return o.some((r,a)=>n.every((s,l)=>Rg(o[a+l],s)))}function Rg(e,t){switch(t.kind){case"text":case"reasoning":return e?.kind===t.kind&&e.textSig.value.startsWith(t.textSig.value);case"step-start":return e?.kind==="step-start";case"tool":return e?.kind==="tool"&&e.toolCallId===t.toolCallId&&(t.toolName==="tool"||Jo(e.toolName,t.toolName));case"file":return e?.kind==="file"&&e.url===t.url&&e.mediaType===t.mediaType;case"source":return e?.kind==="source"&&e.sourceId===t.sourceId&&e.url===t.url&&e.title===t.title&&e.filename===t.filename&&e.mediaType===t.mediaType;default:return t}}function Tg(e,t){if(ln(e)||!en(e))return!1;let n=new Set(e.partsSig.value.filter(r=>r.kind==="tool").map(r=>r.toolCallId));return!t.partsSig.value.some(r=>r.kind==="tool"&&n.has(r.toolCallId))}function Ut(e,t,n,o){let r=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(r)return o&&(r.dynamic=!0),r;let a={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:o?!0:void 0,inputPartialSig:Q(""),inputSig:Q(void 0),outputSig:Q(void 0),errorSig:Q(void 0),stateSig:Q("input-streaming"),approvalSig:Q(void 0)};return co(e,a),a}function co(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Xd(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||co(e,t)}function Ig(e,t){switch(t.type){case"tool-input-start":Ut(e,t.toolCallId,t.toolName,t.dynamic);return;case"tool-input-delta":{let n=Ut(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=Ut(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=Ut(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-approval-request":{let n=Ut(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=Ut(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=Ut(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=Ut(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function Jd(e){let t=1e3,n=!1,o=!1,r=!1,a=()=>{r||e.signal.aborted||(r=!0,e.onInitialBoundaryReady())};for(;!e.signal.aborted;){let s,l="held";try{l=await e.connect(()=>{if(e.signal.aborted)return;s=e.now();let c=n||o;n=!0,o=!1,r?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&s===void 0&&(o=!0,a()),l==="unavailable"))return;s!==void 0&&e.now()-s>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var Qd=X.scope("resume-stream");function Zd(e){let{activated:t,conversationReady:n,conversationIdSig:o,messagesSig:r,optionsRef:a,isChatActiveRef:s,transport:l,visitorId:c,adoptControlStateChunk:u,settleSuggestions:_,markActiveConversationRead:p,onReplyLanded:d,runCancellation:f,setCanSend:m,feedback:g,bus:h,homeNav:P,loadInitialThread:x,shouldReconcileOnConnect:b}=e;E(()=>{if(!t||!n||!o.value)return;let y=o.value,k=new AbortController,C=N=>{},B=new Er(r,N=>C(N));l.primeIdentity(c,y),Qd.debug("resume stream opened",{conversationId:y});let G=!1,U=!1,I,z,W=0,L=(N,ve)=>{(N||!f.localSendRef.current)&&f.settle(ve),N&&(p(),d())},ne=(N,ve=[],ae=!1,De)=>{let xe=a.current;if(N.canceled){L(ae,De);return}let Te=N.status==="error";switch(Il(N,Te)){case"drop":r.value=r.value.filter(Ce=>Ce!==N);break;case"complete-operator-routed":N.status="complete",ae&&(g.play("messageReceived"),En(h,xe,"assistant",Ue(N)));break;case"error":{if(N.status="error",N.errorText=xe.strings.errorGeneric,ae){g.play("error");let Ce=new Error(Te?"stream error chunk":"empty reply");h.emit("error",Ce),xe.onError?.(Ce)}break}case"complete":N.status="complete",ae&&(g.play("messageReceived"),En(h,xe,"assistant",Ue(N))),_(N,ve);break}L(ae,De)},re=N=>{if(k.signal.aborted||o.value!==y)return;if(u(N),N.type==="start"){let Ce=z?.senderRole==="visitor"?z.messageId:void 0;if(z={messageId:N.messageId,senderRole:N.messageMetadata?.senderRole},W+=1,G=N.messageMetadata?.senderRole===void 0,U=!1,I=G?N.messageMetadata?.runId:void 0,G){let Le=N.messageId!==void 0&&r.value.some(Je=>Je.serverMessageId===N.messageId||Je.id===N.messageId),he=r.value.at(-1),Se=N.messageId!==void 0&&(he?.serverMessageId===N.messageId||he?.id===N.messageId),Ie=f.localSendRef.current&&(!Le||Se)&&he?.role==="assistant"&&he.status==="streaming"&&(Se||he.serverMessageId===void 0&&he.partsSig.value.length===0);U=f.captureStart(y,N,Ie,Ce)}}let ve=G&&(N.type==="finish"||N.type==="error"||N.type==="abort"),ae=ve?I:void 0,De=ve&&(U||f.ownsLocalRun(ae));ve&&(G=!1,U=!1,I=void 0);let xe=r.value.length,Te=B.applyResume(N);if(N.type==="finish"&&N.canContinue===!1&&m(!1),r.value.length>xe){let Ce=a.current.modules.list.find(Le=>Le.layout==="chat")?.id;Ce&&P?.switchTab(Ce)}if(!Te){ve&&(De||!f.localSendRef.current)&&f.settle(ae);return}if(Te.role==="operator"){g.play("messageReceived"),En(h,a.current,"operator",Ue(Te)),!document.hidden&&s.current()&&l.markRead(y).catch(()=>{}),ve&&(De||!f.localSendRef.current)&&f.settle(ae);return}Te.role==="assistant"&&ne(Te,[],De,ae)},le=async N=>{let ve=W,ae=await l.loadConversation(y,N?{ids:[N]}:void 0).catch(()=>null);if(k.signal.aborted||o.value!==y||!ae)return!1;ae.controlState&&u({type:"data-control-state",data:ae.controlState});let De=r.value.at(-1),xe=ve===W&&(N===void 0||De!==void 0&&(De.serverMessageId===N||De.id===N));if(!ae.messages?.length)return!1;xe&&m(ae.canContinue??!0);let Te=r.value,Ce=N===void 0?Te.at(-1):Te.find(Je=>Je.serverMessageId===N||Je.id===N),{messages:Le,changed:he}=Jn(Te,Nt(ae.messages));if(!he)return!1;r.value=Le;let Se=N===void 0?Le.at(-1):Le.find(Je=>Je.serverMessageId===N||Je.id===N),Ie=Ce?.role==="assistant"&&Ce.status==="streaming"&&Se?.role==="assistant"&&Se.status!=="streaming"&&Se.id===Ce.id;return xe&&Ie?ne(Se,ae.suggestions??[],f.localSendRef.current):xe&&Se?.role==="assistant"&&Se.status!=="streaming"&&_(Se,ae.suggestions??[]),!0},Ae=new Set;C=({messageId:N})=>{if(Ae.has(N)||!r.value.some(ae=>ae.serverMessageId===N||ae.id===N))return;Ae.add(N);let ve=()=>Ae.delete(N);le(N).then(ve,ve)};let de,_e=!1,Me=(N=!1)=>{if(k.signal.aborted||o.value!==y){_e=!1;return}if(de){_e=!0;return}let ve=N?x(y)??(b()?le():void 0):le();if(!ve)return;de=ve;let ae=()=>{de===ve&&(de=void 0,_e&&(_e=!1,Me()))};ve.then(ae,ae)};return Jd({signal:k.signal,now:()=>performance.now(),sleep:N=>Xn(N,k.signal),connect:N=>l.connectResumeStream({signal:k.signal,onChunk:re,onConnected:N}),onInitialBoundaryReady:()=>Me(!0),backfill:()=>Me()}),()=>{k.abort(),B.detach(),Qd.debug("resume stream closed",{conversationId:y})}},[t,n,o,o.value,c,l,u,_,p,d,f,m,r,h,g,P,x,b])}var Eg=32;function eu(e){let{transport:t,setStreaming:n}=e,o=M(),r=M(),a=M(!1),s=M(),l=M(!1),c=M(new Map),u=M(new Set),_=O((k,C)=>{let B=`${k}:${C}`;s.current!==B&&(s.current=B,t.cancelTurn(k,C))},[t]),p=O(k=>{o.current=void 0,r.current=k,a.current=!1,s.current=void 0,l.current=!0,n(!0)},[n]),d=O((k,C)=>{c.current.set(k,{messageId:C})},[]),f=O(k=>{k!==void 0&&(u.current.add(k),u.current.size>Eg&&u.current.delete(u.current.values().next().value)),!(k!==void 0&&o.current?.runId!==k)&&(o.current=void 0,r.current=void 0,a.current=!1,l.current=!1,n(!1))},[n]),m=O((k,C)=>r.current!==k?C.runId&&o.current?.runId===C.runId?(o.current={conversationId:C.conversationId,runId:C.runId},a.current&&_(C.conversationId,C.runId),!0):!1:(r.current=void 0,C.runId?(o.current={conversationId:C.conversationId,runId:C.runId},n(!0),a.current&&_(C.conversationId,C.runId),!0):(f(),!0)),[_,n,f]),g=O((k,C)=>{let B=c.current.get(k);return B?(c.current.delete(k),!C.runId||u.current.has(C.runId)?!0:B.runId!==void 0?(B.runId!==C.runId||o.current?.runId===C.runId&&(o.current={conversationId:C.conversationId,runId:C.runId},a.current&&_(C.conversationId,C.runId)),!0):(l.current||r.current||(o.current={conversationId:C.conversationId,runId:C.runId},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0)),!0)):!1},[_,n]),h=O(k=>r.current!==k?!1:(f(),!0),[f]),P=O(k=>{let C=c.current.get(k);return C?(c.current.delete(k),C.runId===void 0):!1},[]),x=O((k,C,B,G)=>{let U=C.messageMetadata?.runId;if(C.messageMetadata?.senderRole!==void 0||typeof U!="string"||!U||u.current.has(U))return!1;if(o.current?.runId===U)return l.current;if(l.current)return o.current||!B?!1:(r.current=void 0,o.current={conversationId:k,runId:U},n(!0),a.current&&_(k,U),!0);let z=[...c.current.values()].filter(W=>W.runId===void 0).find(W=>W.messageId===G);return z?(z.runId=U,o.current={conversationId:k,runId:U},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0),!0):(r.current=void 0,o.current={conversationId:k,runId:U},n(!0),a.current&&_(k,U),l.current)},[_,n]),b=O(k=>typeof k=="string"&&o.current?.runId===k&&l.current,[]),y=O(()=>{let k=o.current;if(k)return a.current=!0,_(k.conversationId,k.runId),!0;let C=r.current;return C?(a.current=!0,C.then(B=>{B.runId&&_(B.conversationId,B.runId)}).catch(()=>{}),!0):!1},[_]);return ee(()=>({localSendRef:l,begin:p,beginRouted:d,acceptAck:m,acceptRoutedAck:g,reject:h,rejectRouted:P,captureStart:x,ownsLocalRun:b,settle:f,stop:y}),[m,g,p,d,x,b,h,P,f,y])}var Ag=X.scope("send");function tu(e){return!(e instanceof Ve)||e.code==="network"||e.status===void 0||e.status===202?!0:e.status===408||e.status===425||e.status===429||e.status>=500&&e.status<600}function nu(e){let{transport:t,messagesSig:n,conversationIdSig:o,options:r,bus:a,feedback:s,persistence:l,visitorId:c,adoptConversationId:u,applyControlState:_,setCanSend:p,settleSuggestions:d,runCancellation:f}=e,m=O(()=>{let P=o.value??at();return o.value||(o.value=P,l.saveConversationId(P)),P},[o,l]),g=O(async({continueExisting:P,turn:x})=>{let b=m(),y=n.value.at(-1),k=x?[x]:xl(n.value,P),C=ka({messages:k.map(Ea),conversationId:b,visitorId:c,userPrefs:l.loadUserPrefs()}),B=t.sendTurn(C);f.begin(B);try{let G=await B;if(o.value!==b||!f.acceptAck(B,G))return;if(u(G.conversationId),!G.runId){let U=await t.loadConversation(G.conversationId).catch(()=>null);if(o.value!==G.conversationId)return;if(U){U.controlState&&_(U.controlState),p(U.canContinue??!0);let{messages:I,changed:z}=Jn(n.value,Nt(U.messages??[]));z&&(n.value=I);let W=y?n.value.find(L=>L.id===y.id&&L.role==="assistant"&&L.status!=="streaming"):void 0;W&&d(W,U.suggestions??[]),!P&&y?.role==="assistant"&&n.value.includes(y)&&y.serverMessageId===void 0&&!Dt(y)&&(n.value=n.value.filter(L=>L!==y))}else if(y?.role==="assistant"&&n.value.includes(y)){y.status="error",y.errorText=r.strings.errorGeneric;let I=k[0];P?y.retryAction={kind:"continue-assistant",messageId:y.serverMessageId??y.id}:y.retryAction=I?.role==="user"?{kind:"resend-user",messageId:I.id}:null,n.value=[...n.value]}}}catch(G){if(o.value!==b||!f.reject(B))return;let U=an(G,r.strings),I=tu(G),z=x?.role==="assistant"?x:n.value.at(-1);if(P&&z?.role==="assistant"&&G instanceof Ve&&G.status===409){let W=z.serverMessageId??z.id,L=await t.loadConversation(b,{ids:[W]}).catch(()=>null);if(o.value!==b)return;if(L){L.controlState&&_(L.controlState),p(L.canContinue??!0);let ne=Nt(L.messages??[]),re=ne.find(le=>(le.serverMessageId??le.id)===W);if(re&&Rl(z,re)){let{messages:le,changed:Ae}=Jn(n.value,ne),de=le.find(_e=>(_e.serverMessageId??_e.id)===W);if(Ae&&de&&de!==z){de.awaitingContinuation=!1,de.continuationStreaming=void 0,de.retryAction=null,n.value=le,de.status!=="streaming"&&d(de,L.suggestions??[]);return}}}if(!n.value.includes(z)||z.status!=="streaming")return;z.continuationStreaming=!0}if(P&&z?.role==="assistant")z.status="error",z.errorText=U,z.retryAction=I?{kind:"continue-assistant",messageId:z.serverMessageId??z.id}:null,n.value=[...n.value];else if(y?.role==="assistant"&&n.value.includes(y)){y.status="error",y.errorText=U;let W=k[0];y.retryAction=I&&W?.role==="user"?{kind:"resend-user",messageId:W.id}:null,n.value=[...n.value]}else{let W=Rt();W.status="error",W.errorText=U;let L=k[0];W.retryAction=I&&L?.role==="user"?{kind:"resend-user",messageId:L.id}:null,n.value=[...n.value,W]}s.play("error"),a.emit("error",G),r.onError?.(G)}},[t,n,r,a,s,l,c,u,_,p,d,m,f]),h=O(async P=>{let x=m();P.status="pending",P.errorText=void 0,P.retryAction=void 0,n.value.includes(P)&&(n.value=[...n.value]);let b=ka({messages:[Ea(P)],conversationId:x,visitorId:c,userPrefs:l.loadUserPrefs()}),y=t.sendTurn(b);f.beginRouted(y,P.id);try{let k=await y;if(o.value!==x){f.rejectRouted(y);return}if(!f.acceptRoutedAck(y,k))return;u(k.conversationId),P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value]))}catch(k){let C=f.rejectRouted(y);if(o.value!==x)return;if(!C){P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value]));return}if(P.status!=="pending")return;Ag.debug("operator-routed send failed",{error:k});let B=k instanceof Error?k:new Error(String(k));P.status="error",P.errorText=an(k,r.strings),P.retryAction=tu(k)?{kind:"resend-user",messageId:P.id}:null,n.value.includes(P)&&(n.value=[...n.value]),s.play("error"),a.emit("error",B),r.onError?.(B)}},[t,n,r,a,s,l,c,u,m,f]);return{sendAiTurn:g,sendRoutedTurn:h}}var Mg=X.scope("unread"),Lg=300;function ou(e){let{transport:t,options:n,conversationIdSig:o,isChatActiveRef:r,activated:a,conversationReady:s}=e,l=ut(!1),c=M(new Set),u=M();E(()=>()=>clearTimeout(u.current),[]);let _=O(()=>{let g=r.current()?o.value:void 0;l.value=[...c.current].some(h=>h!==g)},[l,o,r]),p=O(()=>{n.modules.list.some(g=>g.layout==="chat")&&t.listConversations({limit:50}).then(g=>{c.current=new Set(g.conversations.filter(h=>h.hasUnread).map(h=>h.conversationId)),_()}).catch(g=>Mg.debug("refreshUnread failed (non-fatal)",{err:g}))},[t,n.modules,_]),d=O(g=>{c.current.delete(g),_()},[_]),f=O(()=>{if(!r.current())return;let g=o.value;g&&(clearTimeout(u.current),u.current=setTimeout(()=>{d(g),t.markRead(g)},Lg))},[t,o,d,r]),m=M(!1);return E(()=>{!a||!s||m.current||(m.current=!0,p())},[a,s,p]),E(()=>{if(!a)return;let g=()=>{document.visibilityState==="visible"&&p()};return document.addEventListener("visibilitychange",g),()=>document.removeEventListener("visibilitychange",g)},[a,p]),{hasUnreadSig:l,refreshUnread:p,clearUnread:d,markActiveConversationRead:f}}var uo=X.scope("settings");function ru(e){let{options:t,persistence:n,transport:o,feedback:r,hostElement:a,bus:s}=e,l=n.loadUserPrefs(),[c,u]=D(()=>l.locale??t.locale),[_,p]=D(()=>l.themeMode??t.themeMode),[d,f]=D(()=>l.textSize??t.textSize),m=O(y=>{n.patchUserPrefs(y),o.saveUserPrefs(n.loadUserPrefs()).catch(k=>uo.warn("saveUserPrefs failed",{err:k}))},[n,o]);E(()=>{l.soundMuted!==void 0&&r.setMuted(l.soundMuted)},[]),E(()=>{a.dataset.theme=_},[a,_,t]),E(()=>{a.dataset.textSize=d},[a,d,t]),E(()=>{let y=!0;return r.mutedSig.subscribe(k=>{if(y){y=!1;return}m({soundMuted:k})})},[r,m]);let g=fn(c,t.availableLocales,t.defaultLocale);E(()=>{o.setLocale(g)},[o,g]),E(()=>{a.dir=Bi(g)?"rtl":"ltr"},[a,g]),E(()=>{g!==c&&u(g)},[g,c]);let h=O(y=>{uo.info("localeChange",{locale:y}),u(y),m({locale:y}),s.emit("localeChange",y)},[m,s]),P=O(y=>{uo.info("themeChange",{mode:y}),p(y),a.dataset.theme=y,m({themeMode:y}),s.emit("themeChange",y)},[a,m,s]),x=O(y=>{uo.info("textSizeChange",{size:y}),f(y),a.dataset.textSize=y,m({textSize:y}),s.emit("textSizeChange",y)},[a,m,s]),b=O(()=>{r.toggleMuted();let y=r.mutedSig.value;uo.info("soundToggle",{muted:y}),s.emit("soundToggle",{muted:y})},[r,s]);return{activeLocale:c,activeThemeMode:_,activeTextSize:d,effectiveLocale:g,setActiveLocale:u,setActiveThemeMode:p,setActiveTextSize:f,patchAndSync:m,handleLocaleChange:h,handleThemeChange:P,handleTextSizeChange:x,handleSoundToggle:b}}var be=X.scope("app"),Ar=w.cssPrefix;function au(e,t){return yl({...e,text:Ze(t,e.text)})}function iu({options:e,hostElement:t,bus:n}){let[o]=D(()=>Lt(e.widgetId,e.storage,e.aiAgentDeploymentId)),[r,a]=D(()=>o.getVisitorId()),s=o.loadUserPrefs(),l=ut(o.loadConversationId()),c=M(l.value!==void 0),u=ut(l.value??""),_=ut([]),[p,d]=D(!1),f=M(),[m,g]=D([]);function h(){let v=e.modules.list,T=new Set(v.map(F=>F.id)),V=o.loadActiveModule();return V&&T.has(V)?V:v[0]?.id??""}function P(){return e.modules.list.find(v=>v.layout==="chat")?.id}function x(){let v=P();return v?e.modules.list.length===1?!0:k.sig.value.activeTab===v:!1}let b=M(x);b.current=x;let y=M();if(!y.current){let v=e.modules.list.map(V=>V.id),T=o.loadActiveModule()??v[0]??"";y.current=Pd(T,T?[...v,T]:v,V=>o.saveActiveModule(V))}let k=y.current,[C,B]=D(!1),[G,U]=D(null),[I,z]=D(!1),W=e.mode==="standalone"||e.mode==="inline",L=M(jn(e,xn(),o.loadPanelOpen(),o.loadPanelSize())),[ne,re]=D(L.current.panelOpen),[le,Ae]=D(L.current.panelOpen),de=M(),_e=M(),Me=M(!1),N=M(void 0);E(()=>{ne&&Ae(!0)},[ne]);let ve=M(!1),[ae,De]=D(!1),{dismissed:xe,dismissCallout:Te}=qd({callout:e.launcher.callout,persistence:o}),Ce=e.launcher.callout?.persistent??!0,Le=O(()=>{be.info("calloutDismiss"),n.emit("calloutDismiss",void 0),Te()},[n,Te]),[he,Se]=D(L.current.panelSize),Ie=M(!1),[Je,Qe]=D("chat"),[ze,H]=D(!0),K=M(ze);K.current=ze;let[Y,pe]=D(!1),S=M(Y);S.current=Y;let q=M(null),[ye,ie]=D(!1),[Pe,ht]=D(null),[ct,qe]=D([]),zt=M(e.strings),bt=M(e);bt.current=e;let[yi,mu]=D(void 0),[gu,vu]=D(void 0),[hu,bu]=D(()=>o.loadSidebarCollapsed()??!1),[Dr,yu]=D({}),[se]=D(()=>new jo({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:cl({publicKey:e.publicKey,aiAgentDeploymentId:e.aiAgentDeploymentId,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[nt]=D(()=>new tr(e.sound,e.haptics)),Et=eu({transport:se,setStreaming:pe}),{activeLocale:_o,activeThemeMode:Pi,activeTextSize:xi,effectiveLocale:cn,setActiveLocale:Pu,setActiveThemeMode:xu,setActiveTextSize:Su,patchAndSync:Si,handleLocaleChange:ku,handleThemeChange:wu,handleTextSizeChange:Cu,handleSoundToggle:Ru}=ru({options:e,persistence:o,transport:se,feedback:nt,hostElement:t,bus:n}),{controlModeSig:yt,assignedOperatorInitialsSig:Tu,operatorAvailableSig:Iu,applyControlState:dn,adoptControlStateChunk:Eu,requestOperator:Au,cancelOperatorRequest:Mu}=Wd({transport:se,conversationIdSig:l}),{hasUnreadSig:Lu,refreshUnread:ki,clearUnread:wi,markActiveConversationRead:Ou}=ou({transport:se,options:e,conversationIdSig:l,isChatActiveRef:b,activated:le,conversationReady:C});E(()=>{nt.update(e.sound,e.haptics)},[nt,e.sound,e.haptics]),E(()=>()=>nt.destroy(),[nt]),E(()=>{Ie.current||!e.size.initialSize||(Ie.current=!0,!o.loadPanelSize()&&Se(Sa(e.mode,e.size,xn())))},[e.mode,e.size,o]),E(()=>{if(!C||ve.current)return;ve.current=!0;let v=jn(e,xn(),o.loadPanelOpen(),o.loadPanelSize());re(v.panelOpen),Se(v.panelSize)},[C,e,o]);let Ci=M(null);E(()=>{C&&k.reconcile(e.modules.list.map(v=>v.id),h())},[C,e.modules.list,k]);let po=O(v=>{!v||v.length===0||(_.value=v.map(T=>au(T,zt.current)))},[_]),$r=M(null),fo=O(async v=>{try{let{formSubmissions:T}=await(v?se.bootstrap(v):$r.current??se.bootstrap()),V=new Map;return T.forEach((F,Z)=>V.set(F.formId,Z)),T.filter((F,Z)=>!F.skipped||V.get(F.formId)===Z).map((F,Z)=>({key:`wire:${F.formId}:${F.createdAt??Z}`,formId:F.formId,outcome:F.skipped?"skipped":"submitted",createdAt:Vo(F.createdAt),values:F.values}))}catch(T){return be.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:T}),[]}},[se]),An=M(0),Pt=M(0),Fr=O((v,T)=>{if(v===l.value)return;let V=l.value;Pt.current++,d(!1),V&&(o.saveDraft(v,o.loadDraft(V)),o.saveDraft(V,"")),l.value=v,o.saveConversationId(v),se.primeIdentity(void 0,v),be.info("conversation rebound",{previous:V,current:v,reason:T}),V&&n.emit("conversationRebound",{previous:V,current:v,...T?{reason:T}:{}})},[n,l,o,se]),mo=O((v,T)=>{let V=[...v.map(A=>A.createdAt),...T.map(A=>A.createdAt)].filter(A=>A!==void 0),F=(V.length?Math.min(...V):Date.now())-1;return[...(N.current?.messages??[]).map(A=>{let He=au(A,zt.current);return He.createdAt=F,He}),...v]},[]),Ri=O(async v=>{let T=Pt.current,V=()=>T!==Pt.current||l.value!==v;_e.current===v&&(_e.current=void 0),d(!0);try{let[F,Z]=await Promise.all([se.loadConversation(v),fo()]);if(V())return;let A=Nt(F.messages??[]);g(Z);let He=mo(Cl(A,_.value),Z);if(_.value=He,_e.current=He.some($e=>$e.role==="user")?void 0:v,A.length>0||F.controlState!==void 0){H(F.canContinue??!0),dn(Ot(F.controlState));let $e=A.findLast(pt=>pt.role==="assistant"&&!pt.ephemeral);qe($e?.suggestions??F.suggestions??[])}}catch(F){if(V())return;be.warn("loadThread failed; keeping conversation active",{err:F,conversationId:v}),n.emit("error",F),bt.current.onError?.(F)}finally{V()||d(!1)}},[se,fo,_,l,mo,n]),Nu=O(v=>{if(de.current===v)return de.current=void 0,Ri(v)},[Ri]),Du=O(()=>{if(f.current)return Promise.resolve(void 0);let v=l.value,T=_.value.find(A=>!A.ephemeral),V=T?.serverMessageId??T?.id;if(!v||!V)return Promise.resolve(void 0);let F=Pt.current,Z={};return f.current=Z,(async()=>{try{let A=await se.loadConversation(v,{beforeId:V});if(f.current!==Z||Pt.current!==F||l.value!==v)return;if(A.messages.length===0)return!1;let He=A.messages.map(Ia),ue=_.value,$e=kl(ue,He);if($e!==ue){let pt=Math.min(...He.map(Wt=>Wt.createdAt??1/0),...m.map(Wt=>Wt.createdAt??1/0));if(Number.isFinite(pt))for(let Wt of ue){if(!Wt.ephemeral)break;(Wt.createdAt??1/0)>=pt&&(Wt.createdAt=pt-1)}_.value=$e}return!0}catch(A){if(f.current!==Z||Pt.current!==F||l.value!==v)return;be.warn("load previous messages failed",{err:A,conversationId:v,beforeId:V}),n.emit("error",A),e.onError?.(A);return}finally{f.current===Z&&(f.current=void 0)}})()},[n,l,m,_,e,se]),Mn=O(async({newConversation:v})=>{let T=++An.current,V=()=>T!==An.current,F=l.value,Z=v||!F?at():F;Z!==F&&(Pt.current++,d(!1),it(()=>{l.value=Z,u.value=Z}),o.saveConversationId(Z)),se.primeIdentity(r,Z);let A;try{A=await se.handshake({visitorId:r,conversationId:Z,userPrefs:o.loadUserPrefs(),locale:_o})}catch(ue){if(V())return;n.emit("error",ue),e.onError?.(ue),v||B(!0);return}if(V())return;if(A.visitorId&&A.visitorId!==r&&(be.info("visitor rebound",{previous:r,current:A.visitorId,reason:A.rebind?.visitorId}),o.setVisitorId(A.visitorId),a(A.visitorId),n.emit("visitorRebound",{previous:r,current:A.visitorId,reason:A.rebind?.visitorId})),A.conversationId!==Z&&Fr(A.conversationId,A.rebind?.conversationId),A.agent&&ht(A.agent),dn(Ot(A.controlState)),e.mode==="page"&&(A.site&&sl(A.site)?mu(A.site):A.site&&be.warn("invalid site config, using fallback",{site:A.site}),A.blocks&&ll(A.blocks)?vu(A.blocks):A.blocks&&be.warn("invalid blocks config, using fallback",{blocks:A.blocks})),A.userPrefs&&!v&&(o.saveUserPrefs(A.userPrefs),A.userPrefs.locale&&Pu(A.userPrefs.locale),A.userPrefs.soundMuted!==void 0&&nt.setMuted(A.userPrefs.soundMuted),A.userPrefs.themeMode&&xu(A.userPrefs.themeMode),A.userPrefs.textSize&&Su(A.userPrefs.textSize)),N.current=A.welcome,v||n.emit("handshake",A),A.welcome?.suggestions){let ue=zt.current;qe(A.welcome.suggestions.map($e=>({...$e,label:Ze(ue,$e.label),...$e.text===void 0?{}:{text:Ze(ue,$e.text)}})))}let He=!v&&F&&A.conversationId===F;c.current=!!He,He?Me.current||(de.current=A.conversationId):(_e.current=A.conversationId,po(A.welcome?.messages)),v||B(!0)},[se,r,o,e,n,l,u,nt,po,_o,Fr]),Ln=JSON.stringify(e.userContext??null),$u=JSON.stringify(e.pageContext??null),Fu=JSON.stringify(Dr);E(()=>{let v=Object.keys(Dr).length?{...Dr,...e.userContext}:e.userContext;se.setContext(v,Og(e.pageContext))},[se,Ln,$u,Fu]);let Ti=O((v,T=[])=>qe(v.suggestions??T),[]);E(()=>(se.primeIdentity(r,l.value),Mn({newConversation:!1}),()=>{An.current++,Pt.current++}),[]),E(()=>{!le||!C||Me.current||(Me.current=!0,$r.current=se.bootstrap(),(async()=>{try{let v=await $r.current;U(Bn((v??{forms:[]}).forms,cn))}catch(v){be.debug("bootstrap failed \u2014 treating as no forms",{err:v})}finally{z(!0)}})(),de.current===l.value&&d(!0))},[le,C]);let go=M(null);E(()=>{if(!le||!C)return;if(go.current===null){go.current=cn;return}if(go.current===cn)return;go.current=cn;let v=!1;return se.bootstrap().then(T=>{v||U(Bn((T??{forms:[]}).forms,cn))}).catch(T=>be.debug("forms re-localize failed \u2014 keeping current copy",{err:T})),()=>{v=!0}},[le,C,cn,se]);let Ii=M(Ln);E(()=>{!C||Ii.current===Ln||(Ii.current=Ln,Mn({newConversation:!1}))},[Ln,C,Mn]),Kd({hostElement:t,mode:e.mode,panelSize:he,isOpen:ne,surfaceReady:C,setIsOpen:re});let{sendAiTurn:qt,sendRoutedTurn:On}=nu({transport:se,messagesSig:_,conversationIdSig:l,options:e,bus:n,feedback:nt,persistence:o,visitorId:r,adoptConversationId:Fr,applyControlState:dn,setCanSend:H,settleSuggestions:Ti,runCancellation:Et}),{toolInteraction:Bu}=zd({streaming:Y,controlModeSig:yt,messagesSig:_,sendAiTurn:qt,bus:n,humanInLoop:e.features.humanInLoop}),Hu=O((v,T)=>{let V=_.value.find(F=>F.serverMessageId===v);V&&(V.feedback=T),be.info("messageFeedback",{messageId:v,value:T}),n.emit("messageFeedback",{messageId:v,value:T}),se.submitFeedback({messageId:v,value:T})},[n,_,se]),Uu=()=>_.value.reduce((v,T)=>v+(T.role==="user"?1:0),0),un=e.forms.list.length>0?e.forms:G??e.forms,Ee=gd({forms:un,persistence:o,userContext:()=>e.userContext,messageCount:Uu,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>l.value,onComplete:(v,T,V,F)=>{be.info("formSubmit",{formId:v.id,trigger:T,skipped:F}),n.emit("formSubmit",{formId:v.id,values:V,skipped:F}),g(A=>{let ue=A.find($e=>$e.formId===v.id&&$e.outcome==="skipped")?.createdAt??Date.now();return[...A.filter($e=>!($e.formId===v.id&&$e.outcome==="skipped")),{key:`local:${v.id}:${ue}`,formId:v.id,outcome:F?"skipped":"submitted",createdAt:ue,...F?{}:{values:V}}]});let Z=l.value??at();l.value||(l.value=Z,o.saveConversationId(Z),se.primeIdentity(void 0,Z)),!F&&v.mirrorToContext&&yu(A=>({...A,...V})),se.submitForm({formId:v.id,conversationId:Z,trigger:T,values:V,skipped:F})}}),Br=_t(()=>Ee.activeForm.value),zu=O(()=>Ee.fire("after-messages"),[Ee]),qu=O(()=>c.current||_.value.some(v=>!v.ephemeral&&v.role==="user"),[_]);Zd({activated:le,conversationReady:C,conversationIdSig:l,messagesSig:_,optionsRef:bt,isChatActiveRef:b,transport:se,visitorId:r,adoptControlStateChunk:Eu,settleSuggestions:Ti,markActiveConversationRead:Ou,onReplyLanded:zu,runCancellation:Et,setCanSend:H,feedback:nt,bus:n,homeNav:k,loadInitialThread:Nu,shouldReconcileOnConnect:qu}),E(()=>{Ee.refresh()},[un,Ee]);let Ei=e.pageContext?.area?String(e.pageContext.area):void 0,Wu=_t(()=>_.value.length);E(()=>{C&&I&&Ee.fire("pre-chat")},[C,I,Ee]),E(()=>{I&&!ze&&Ee.fire("conversation-closed")},[I,ze,Ee]),E(()=>{C&&I&&Ei&&Ee.fire("page-area")},[C,I,Ei,Ee]);let Hr=ee(()=>{let v=un.list.flatMap(T=>T.triggers).filter(T=>T.kind==="idle").map(T=>Number(T.param));return v.length?Math.min(...v)*1e3:0},[un]);E(()=>{if(!Hr||!ne)return;let v=setTimeout(()=>Ee.fire("idle"),Hr);return()=>clearTimeout(v)},[Hr,ne,Ee,Wu.value]);let Ai=O(async(v,T)=>{if(q.current)return!1;let V=l.value,F=yt.value!=="ai-agent";if(be.info("send",{textLen:v.length,attachments:T.length,streaming:S.current,routedToOperator:F}),S.current&&!F)return!1;let Z=new AbortController,A={conversationId:V,controller:Z};q.current=A,ie(!0);try{nt.unlock();let He=await Dg(se,T,Z.signal,pt=>{Z.signal.aborted||(be.warn("upload failed",{err:pt}),n.emit("error",pt),e.onError?.(pt))});if(Z.signal.aborted||l.value!==V||!K.current||Ee.activeForm.value)return!1;let ue=yt.value!=="ai-agent";if(S.current&&!ue||!v&&He.length===0)return!1;n.emit("send",{text:v,attachmentCount:T.length}),ct.length>0&&qe([]),nt.play("messageSent");let $e=Ta(v,He);return En(n,e,"user",v),ue?(_.value=[..._.value,$e],On($e),!0):(_.value=[..._.value,$e,Rt()],qt({continueExisting:!1}),!0)}finally{q.current===A&&(q.current=null,ie(!1))}},[se,n,e,ct.length,_,l,qt,On,yt]);E(()=>{let v=l.value;return()=>{let T=q.current;!T||T.conversationId!==v||(q.current=null,ie(!1),T.controller.abort())}},[l.value]),E(()=>{ze&&!Br.value||q.current?.controller.abort()},[Br.value,ze]);let Vu=O(()=>{if(!Et.stop())return;be.info("stop"),n.emit("stop",void 0);let v=_.value.at(-1);v&&v.role!=="user"&&v.status==="streaming"&&(v.canceled=!0,_.value=[..._.value])},[Et,n,_]),Gu=O(v=>{if(Y)return;let T=_.value,V=Qo(T,v);if(V)switch(be.info("retry",{kind:V.kind,messageId:V.messageId}),V.kind){case"continue-assistant":{if(yt.value!=="ai-agent"||v.role!=="assistant"||(v.serverMessageId??v.id)!==V.messageId)return;v.status="streaming",v.errorText=void 0,v.retryAction=void 0,v.awaitingContinuation=!0,_.value=[...T],qt({continueExisting:!0,turn:v});return}case"resend-user":{let F=T.find(A=>A.role==="user"&&A.id===V.messageId);if(!F)return;if(F.status="complete",F.errorText=void 0,F.retryAction=void 0,yt.value!=="ai-agent"){_.value=v.role==="assistant"?T.filter(A=>A!==v):[...T],On(F);return}let Z=Rt();_.value=v.role==="assistant"?T.map(A=>A===v?Z:A):[...T,Z],qt({continueExisting:!1,turn:F});return}case"repeat-user":{let F=T.find(ue=>ue.role==="user"&&ue.id===V.messageId);if(!F)return;let Z=Ta(Ue(F),F.attachments?.map(ue=>({...ue}))??[]),A=new Set(Z.attachments?.flatMap(ue=>ue.url?[ue.url]:[])??[]),He=F.partsSig.value.flatMap(ue=>ue.kind==="file"&&!A.has(ue.url)?[{...ue}]:[]);if(He.length>0&&(Z.partsSig.value=[...Z.partsSig.value,...He]),yt.value!=="ai-agent"){_.value=[...T,Z],On(Z);return}_.value=[...T,Z,Rt()],qt({continueExisting:!1,turn:Z});return}default:return V}},[Y,_,yt,qt,On]),Nn=O(()=>{if(vc(e.mode,he)==="exit-fullscreen"){be.info("close \u2192 exit-fullscreen",{mode:e.mode}),Se("normal"),n.emit("fullscreen",!1);return}be.info("close \u2192 panel closed",{mode:e.mode}),Ee.fire("panel-close"),re(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,he,Ee]),Ur=O(()=>{be.info("open",{mode:e.mode}),nt.unlock(),De(!0),re(!0),o.savePanelOpen(!0),!xe&&!Ce&&Le(),setTimeout(()=>De(!1),Ng),le&&ki(),n.emit("open",void 0),e.onOpen?.()},[n,e,nt,o,xe,Ce,Le,le,ki]),zr=O(()=>{let v=_.value.some(T=>T.role==="user");if(_e.current===l.value&&!v&&ze&&l.value){be.info("clear \u2192 reusing empty conversation",{conversationId:l.value}),_.value.length===0&&po(N.current?.messages);return}be.info("clear \u2192 new conversation",{wasStreaming:Y}),n.emit("clear",void 0),Et.settle(),c.current=!1,de.current=void 0,_e.current=void 0,it(()=>{_.value=[],l.value=void 0,dn({controlMode:"ai-agent",controlRevision:0})}),o.clearConversation(),H(!0),g([]),qe([]),Mn({newConversation:!0})},[Y,_,l,o,Mn,n,ze,po,Et,dn]),qr=O(()=>{zr(),Qe("chat");let v=e.modules.list.find(T=>T.layout==="chat")?.id;v&&k.switchTab(v)},[zr,k,e]),Wr=O(()=>{let v=he==="expanded"?"normal":"expanded";be.info("expand",{from:he,expanded:v==="expanded"}),Se(v),o.savePanelSize(v),n.emit("expand",v==="expanded")},[n,he,o]),Vr=O(()=>{let v=he==="fullscreen"?"normal":"fullscreen";be.info("fullscreen",{from:he,fullscreen:v==="fullscreen"}),Se(v),o.savePanelSize(v),n.emit("fullscreen",v==="fullscreen")},[n,he,o]),Ku=O(()=>{Qe(v=>{let T=v==="history"?"chat":"history";return be.info("toggleHistory",{view:T}),n.emit("toggleHistory",{view:T}),T})},[n]),ju=O(()=>{bu(v=>{let T=!v;return be.info("sidebarToggle",{collapsed:T}),o.saveSidebarCollapsed(T),n.emit("sidebarToggle",{collapsed:T}),T})},[o,n]),Xu=O(v=>{be.info("resize",v),Si({widgetSize:v}),n.emit("resize",v)},[Si,n]),Gr=O(async v=>{let T=++An.current;Pt.current++,d(!1);let V=()=>T!==An.current;be.info("selectConversation",{conversationId:v,wasStreaming:Y}),n.emit("selectConversation",{conversationId:v});try{let[F,Z]=await Promise.all([se.loadConversation(v),fo(v)]);if(V())return;Et.settle(),c.current=!0,de.current=void 0;let A=Nt(F.messages);_e.current=A.some(ue=>ue.role==="user")?void 0:F.conversationId,it(()=>{_.value=mo(A,Z),F.conversationId!==l.value&&(u.value=F.conversationId),l.value=F.conversationId}),g(Z),o.saveConversationId(F.conversationId),se.primeIdentity(r,F.conversationId),F.agent&&ht(F.agent),H(F.canContinue),dn(Ot(F.controlState));let He=A.findLast(ue=>ue.role==="assistant"&&!ue.ephemeral);if(qe(He?.suggestions??F.suggestions??[]),Qe("chat"),await se.markRead(v),V())return;wi(v)}catch(F){if(V())return;n.emit("error",F),e.onError?.(F)}},[se,_,l,u,n,e,o,wi,fo,mo,Y,r,Et]),vo=M(null),Mi=O(v=>{typeof v=="string"&&(I?Ee.fire("manual",v):vo.current=v)},[I,Ee]);E(()=>{!I||!vo.current||(Ee.fire("manual",vo.current),vo.current=null)},[I,Ee]);let _n=M({handleOpen:Ur,handleClose:Nn,handleExpand:Wr,handleFullscreen:Vr,openForm:Mi});_n.current={handleOpen:Ur,handleClose:Nn,handleExpand:Wr,handleFullscreen:Vr,openForm:Mi},dt(()=>Cs(t,{open:()=>_n.current.handleOpen(),close:()=>_n.current.handleClose(),expand:()=>_n.current.handleExpand(),fullscreen:()=>_n.current.handleFullscreen(),openForm:v=>_n.current.openForm(v)}),[t]);let Ye=ee(()=>aa(e,_o,Pi,xi),[e,_o,Pi,xi]);zt.current=Ye.strings;let Yu=ee(()=>m.map(v=>{let T=un.list.find(V=>V.id===v.formId);return{...v,title:T?.title,form:T}}),[m,un]),Li={options:Ye,transport:se,feedback:nt,bus:n,persistence:o,conversationId:l.value??"",composerKey:u.value,composerApiRef:Ci,view:Je,canSend:ze,isStreaming:Y,sendPreparing:ye,composerActive:Ye.mode==="page"||Ye.mode==="inline"||Ye.mode==="standalone"||ne,controlMode:yt.value,assignedOperatorInitials:Tu.value,operatorAvailable:Iu.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:Au,onCancelOperatorRequest:Mu,loadingMessages:p,onLoadPreviousMessages:Du,messagesSig:_,agent:Pe,suggestions:ct,initialWidgetSize:s.widgetSize??null,visitorId:r,onClose:Nn,onClear:zr,onExpand:Wr,onFullscreen:Vr,onSoundToggle:Ru,onToggleHistory:Ku,onSelectHistoryConversation:Gr,onNewConversation:qr,onLocaleChange:ku,onThemeChange:wu,onTextSizeChange:Cu,onWidgetSizeChange:Xu,onSend:Ai,onStop:Vu,onSuggestion:v=>{if(q.current)return;let T=v.text??v.label;be.info("suggestion",{text:T,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:T}),e.autoSendSuggestions?Ai(T,[]):Ci.current?.fill(T)},activeForm:Br.value?.form??null,formMarkers:Yu,onFormSubmit:Ee.complete,onFormSkip:Ee.skip,onFormFill:v=>Ee.fire("manual",v),tool:Bu,onRetry:Gu,onMessageFeedback:Hu},Ju=v=>{Gr(v);let T=P();T&&k.switchTab(T)};if(!C)return null;let Dn=Ye.modules.list,Kr=v=>{let T=no("close",Ye.mode,v);return Dn.length===0?i(Ud,{strings:Ye.strings,onClose:T?Nn:void 0}):Dn.length===1&&Dn[0]?.layout==="chat"?i(md,{...Li,panelSize:v}):i(Hd,{panelProps:{...Li,panelSize:v,onClose:T?Nn:void 0},enabledModules:Dn,nav:k,bus:n,hasUnread:Lu.value,onSelectConversation:Ju,onStartNewConversation:qr,onSetPanelSize:Se})};if(e.mode==="page"){let v=V=>{Gr(V.conversationId)},T=Dn.some(V=>V.layout==="chat");return i("div",{class:`${Ar}-anchor`,children:i(bd,{site:yi,blocks:gu,transport:se,strings:Ye.strings,locale:Ye.locale,persistence:o,visitorId:r,showConversations:T,onSelectConversation:v,onNewConversation:qr,sidebarCollapsed:hu,onToggleSidebarCollapsed:ju,children:Kr("fullscreen")})})}if(W){let v=e.mode==="standalone"?"fullscreen":he;return i("div",{class:`${Ar}-anchor`,children:Kr(v)})}let Oi=e.mode==="drawer",Ni=!(e.mode==="modal")&&!e.launcher.hidden&&(!ne||ae),Di=Ni&&!ae&&!xe&&!Oi?Ye.launcher.callout:null;return i("div",{class:`${Ar}-anchor`,"data-launcher-size":Ye.launcher.size,children:[ne||le?i("div",{class:`${Ar}-surface`,hidden:!ne,children:Kr(he)}):null,Ni?i(fc,{onToggle:Ur,launcher:Ye.launcher,strings:Ye.strings,leaving:ae,edgeTab:Oi}):null,Di?i(mc,{callout:Di,launcherPosition:Ye.position,strings:Ye.strings,closeLabel:Ye.strings.close,onDismiss:Le}):null]})}function Og(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var Ng=120;async function Dg(e,t,n,o){return(await Promise.all(t.map(async a=>{try{let{id:s,url:l}=await e.uploadFile(a.file,n);return{id:s,name:a.name,mediaType:a.mediaType,size:a.size,url:l}}catch(s){o(s);return}}))).filter(a=>a!==void 0)}var $g=X.scope("error-boundary"),Mr=class extends et{constructor(){super(...arguments);te(this,"state",{crashed:!1})}componentDidCatch(n,o){$g.error("widget render crashed",{error:n,componentStack:o?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,o?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};var Fg="1",Bg=60,Hg=2e3,su={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),send:e=>({attachments:e.attachmentCount}),message:e=>({role:e.role}),stop:()=>{},clear:()=>{},suggestion:()=>{},toggleHistory:e=>({view:e.view}),handshake:()=>{},formSubmit:e=>({formId:e.formId,skipped:e.skipped}),toolResult:()=>{},toolDecision:e=>({approved:e.approved}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,tags:e.tags,count:e.count}),contentOpen:e=>({contentId:e.contentId,tags:e.tags}),contentSearch:e=>({qlen:e.queryLength,hits:e.hitCount}),contentRead:e=>({contentId:e.contentId}),contentLinkClick:e=>({contentId:e.contentId}),attach:e=>({count:e.count,bytes:e.totalBytes}),voiceStart:()=>{},voiceStop:e=>({ms:e.durationMs}),voiceCancel:()=>{},localeChange:e=>({locale:e}),themeChange:e=>({theme:e}),textSizeChange:e=>({size:e}),soundToggle:e=>({muted:e.muted}),sidebarToggle:e=>({collapsed:e.collapsed}),calloutDismiss:()=>{},error:()=>{}};function Ug(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function zg(){return location.origin+location.pathname}function qg(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function lu(e,t){let n=Math.random(),o=0,r=0,a=new Set,s=(c,u)=>{let{tracking:_,publicKey:p,aiAgentDeploymentId:d,mode:f,themeMode:m}=t.getOptions();if(!_.enabled||Ug()||n>=_.sampleRate)return;let g=performance.now();if(g-o>6e4&&(o=g,r=0),++r>Bg)return;let h=new URLSearchParams;h.set("v",Fg),h.set("_ev",gn),h.set("e",c),_.token&&h.set("tk",_.token),p&&h.set("pk",p),d&&h.set("dep",d),h.set("vid",t.getVisitorId());let P=t.getConversationId();P&&h.set("cid",P),h.set("url",zg());let x=qg();x&&h.set("ref",x),h.set("sw",String(screen.width)),h.set("sh",String(screen.height)),h.set("vw",String(innerWidth)),h.set("vh",String(innerHeight)),h.set("dpr",String(devicePixelRatio)),h.set("lang",navigator.language);try{h.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(h.set("m",f),h.set("th",m),u)for(let[C,B]of Object.entries(u))B!==void 0&&h.set(C,String(B));h.set("ts",String(Date.now()));let b=`${_.endpoint}?${h}`;if(b.length>Hg)return;let y=new Image(1,1);a.add(y);let k=()=>a.delete(y);y.addEventListener("load",k,{once:!0}),y.addEventListener("error",k,{once:!0}),y.src=b},l=Object.keys(su).map(c=>e.on(c,u=>s(c,su[c]?.(u))));return()=>{for(let c of l)c();a.clear()}}function Lr(e){let{bus:t,host:n,appRoot:o,persistence:r,reportError:a}=e,s=e.initialRaw,l,c=At(s),u=!0,_=()=>{c=At(l?ia(s,l):s)},p=()=>{Ns(n,Xt(c.mode));let m=r.loadUserPrefs().themeMode;Ds(n,m?{...c,themeMode:m}:c),u&&(Lo(n,di(c)),u=!1)},d=()=>{p(),Kt(kt(Mr,{onError:a},kt(iu,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",m=>{m.config&&(m.config.storageVersion&&r.rememberStorageVersion(m.config.storageVersion),l=m.config,_(),d())});let f=lu(t,{getOptions:()=>c,getVisitorId:()=>r.getVisitorId(),getConversationId:()=>r.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>s,render:d,setUserOptions:m=>{s=m,_(),d()},patchUserOptions:m=>{s={...s,...m},_(),d()},destroy:()=>f()}}function di(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=Lt(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:o}=jn(e,xn(),t.loadPanelOpen(),t.loadPanelSize());return Wo(e.mode,o,n)}var Wg=X.scope("hooks"),_i="*",ui=new Set;function pi(e,t,n){let o={widgetId:e,event:t,listener:n};return ui.add(o),()=>{ui.delete(o)}}function Vg(e,t,n){let o=[...ui];for(let r of o)if(Gg(r.widgetId,e.widgetId)&&!(r.event!==_i&&r.event!==t))try{r.listener(e,t,n)}catch(a){Wg.warn("hook listener threw",{event:t,error:a})}}function cu(e,t){let n=[];for(let o of Kg)n.push(t.on(o,r=>{Vg(e,o,r)}));return()=>{for(let o of n)o()}}function fi(e){if(Array.isArray(e))for(let t of e){let n=jg(t);n&&pi(n.widgetId,n.event,n.listener)}}function Gg(e,t){return e===_i||e===t}var Kg=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","visitorRebound","conversationRebound"];function jg(e){let t,n,o;if(Array.isArray(e))[t,n,o]=e;else if(e&&typeof e=="object")({widgetId:t,event:n,listener:o}=e);else return null;return typeof t!="string"||typeof n!="string"||typeof o!="function"?null:{widgetId:t,event:n,listener:o}}var It=new Map;function Or(e){e.debug!==void 0&&xo(e.debug);let t=X.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=At(e),o=n.widgetId,r=It.get(o);r&&(t.debug("destroy existing instance at slot",{widgetId:o}),r.destroy());let a=di(n),s=n.iframe?Bs({position:Xt(n.mode)},n.position,a,n.mode,e.target??null):vn({position:Xt(n.mode),target:e.target??null});s.hostElement.dataset.widgetId=o;let l=new hn,c=Lt(o,n.storage,n.aiAgentDeploymentId),u=g=>{l.emit("error",g),_.getOptions().onError?.(g)},_=Lr({bus:l,host:s.hostElement,appRoot:s.appRoot,persistence:c,initialRaw:e,reportError:u});_.render();let p=s.hostElement,d=null,f=g=>{g.debug!==void 0&&xo(g.debug),_.patchUserOptions(g)},m={widgetId:o,open:()=>qn(p,"open"),close:()=>qn(p,"close"),expand:()=>qn(p,"expand"),openForm:g=>qn(p,"openForm",g),on:(g,h)=>l.on(g,h),update:g=>{t.debug("update",{patch:g}),f(g)},setUserContext:g=>{t.debug("setUserContext",{keys:Object.keys(g)}),f({userContext:{..._.getUserOptions().userContext,...g}})},clearUserContext:()=>{t.debug("clearUserContext"),f({userContext:void 0})},setPageContext:g=>{t.debug("setPageContext",{keys:Object.keys(g)}),f({pageContext:{..._.getUserOptions().pageContext,...g}})},clearPageContext:()=>{t.debug("clearPageContext"),f({pageContext:void 0})},setDebug:g=>{xo(g),t.info("debug level set",{level:$n()})},debugLevel:()=>$n(),onLog:g=>Fn(g),destroy:()=>{t.info("destroy",{widgetId:o}),d?.(),_.destroy(),l.clear(),Kt(null,s.appRoot),s.destroy(),It.get(o)===m&&It.delete(o)}};return d=cu(m,l),It.set(o,m),m}function Nr(e){let t=e.widgetId??"default",n=It.get(t);return n?(n.update(e),n):Or(e)}function mi(e){if(e!==void 0){It.get(e)?.destroy();return}let t=[...It.values()];for(let n of t)n.destroy()}function vt(e="default"){return It.get(e)??null}function du(){return[...It.values()]}function gi(e,t,n){return pi(e,t,n)}var uu=gn;var vi=class extends HTMLElement{constructor(){super(...arguments);te(this,"bus",new hn);te(this,"mountResult",null);te(this,"runtime",null)}static get observedAttributes(){return sa}connectedCallback(){this.boot()}disconnectedCallback(){this.mountResult&&(this.runtime?.destroy(),this.runtime=null,Kt(null,this.mountResult.appRoot),this.bus.clear())}attributeChangedCallback(){this.isConnected&&this.boot()}boot(){let n=wo(a=>this.getAttribute(a));if(this.runtime){this.runtime.setUserOptions(n);return}let o=At(n);this.mountResult||(this.mountResult=vn({existingHost:this,position:Xt(o.mode)}));let r=Lt(o.widgetId,o.storage,o.aiAgentDeploymentId);this.runtime=Lr({bus:this.bus,host:this.mountResult.hostElement,appRoot:this.mountResult.appRoot,persistence:r,initialRaw:n,reportError:a=>this.bus.emit("error",a)}),this.runtime.render()}},_u=!1;function hi(){if(_u||typeof customElements>"u")return;let e=w.tagName;customElements.get(e)||customElements.define(e,vi),_u=!0}typeof customElements<"u"&&hi();var pu=X.scope("iife"),bi={close:()=>vt()?.close(),destroy:()=>mi(),expand:()=>vt()?.expand(),hook:(e,t,n)=>typeof e=="string"&&typeof t=="string"&&typeof n=="function"?gi(e,t,n):void 0,init:e=>Nr(e),mount:e=>Or(e),on:(e,t)=>vt()?.on(e,t),onLog:e=>Fn(e),open:()=>vt()?.open(),setDebug:e=>vt()?.setDebug(e),update:e=>vt()?.update(e)};function fu(e,...t){let n=bi[e];if(!n){pu.warn("unknown command",{command:e});return}return n(...t)}function Xg(){let e=((n,...o)=>fu(n,...o));e.init=Nr,e.mount=Or,e.destroy=mi,e.getInstance=vt,e.getAllInstances=du,e.version=uu,e.hook=gi,e.debugLevel=()=>$n(),e.onLog=Fn;let t=new Set(["init","mount","hook","onLog"]);for(let n of Object.keys(bi)){if(t.has(n))continue;let o=bi[n];Reflect.set(e,n,(...r)=>o(...r))}return e}function Yg(e){let t=e?.q;if(t)for(let n of t){let o=[...n],[r,...a]=o;if(typeof r=="string")try{fu(r,...a)}catch(s){pu.warn("queued command failed",{command:r,error:s})}}}function Jg(){let e=[],t=e.push.bind(e);return e.push=(...n)=>{for(let o of n)fi([o]);return t(...n)},e}function Qg(){let e=document.scripts;for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.src.includes("elements"))return n}return null}function Zg(){if(typeof window>"u"||typeof document>"u")return;let e=globalThis[w.global],t=Xg();globalThis[w.global]=t,hi();let n=`${w.global}Hooks`,o=globalThis[n];if(fi(o),globalThis[n]=Jg(),Yg(e),vt())return;let r=document.currentScript??Qg(),a=la(r?.dataset);if(!a.publicKey)return;let s=()=>{vt()||Nr(a)};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",s,{once:!0});return}s()}Zg();return o_(ev);})();
|
|
42
42
|
//# sourceMappingURL=elements.js.map
|