@helpai/elements 0.50.1 → 0.50.3

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.js CHANGED
@@ -1,18 +1,18 @@
1
- "use strict";var HelpAI=(()=>{var lr=Object.defineProperty;var id=Object.getOwnPropertyDescriptor;var ad=Object.getOwnPropertyNames;var sd=Object.prototype.hasOwnProperty;var ld=(e,t,n)=>t in e?lr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var cd=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ad(t))!sd.call(e,i)&&i!==n&&lr(e,i,{get:()=>t[i],enumerable:!(o=id(t,i))||o.enumerable});return e};var dd=e=>cd(lr({},"__esModule",{value:!0}),e);var q=(e,t,n)=>ld(e,typeof t!="symbol"?t+"":t,n);var fm={};var x={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 Fi={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This conversation is closed",conversationLoading:"Loading conversation\u2026",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 conversations yet",historyLoading:"Loading your conversations\u2026",historyContinue:"Continue the conversation",historyTitle:"Conversation history",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 conversation",panelTitle:"Chat",resizeHandle:"Drag to resize",scrollToBottom:"Scroll to latest",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new conversation",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",usedTool:"Used tool",toolResult:"Result",sources:"Sources",tabHome:"Home",tabConversations:"Conversations",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:"User Input Required",inputBadge:"User Input",inputAnswered:"Answered",inputSkipped:"Skipped",inputQuestion:"Question",inputResponse:"Response",inputYourAnswer:"Your answer",inputSubmit:"Submit answer",inputSubmitHint:"Enter to submit \xB7 Shift+Enter for new line",inputAnswerPlaceholder:"Type your answer\u2026",inputSkip:"Skip",confirmYes:"Yes",confirmNo:"No",inputConfirmHint:"Choose yes or no.",inputOptionalNote:"Optional note",inputOptionalNotePlaceholder:"Optional comment\u2026",inputSubmitted:"Answer submitted",respFreeText:"Free Text",respSingleChoice:"Single Choice",respMultiChoice:"Multiple Choice",respConfirmation:"Confirmation",approvalRequired:"Approval required",approve:"Approve",reject:"Reject",approved:"Approved",rejected:"Rejected",approvalReason:"Add a reason (optional)",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",stepNoLongerActive:"This request is no longer active.",toolParameters:"Parameters",statusAwaiting:"Awaiting Approval",statusResponded:"Responded",statusRunning:"Running",statusCompleted:"Completed",statusDenied:"Denied",statusError:"Error"},_d={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:"Cette conversation est ferm\xE9e",conversationLoading:"Chargement de la conversation\u2026",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:"Aucune conversation pour le moment",historyContinue:"Poursuivre la conversation",historyLoading:"Chargement de vos conversations\u2026",historyTitle:"Historique des 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:"Nouvelle conversation",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 une nouvelle conversation",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",usedTool:"Outil utilis\xE9",toolResult:"R\xE9sultat",sources:"Sources",tabHome:"Accueil",tabConversations:"Conversations",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:"Saisie requise",inputBadge:"Saisie",inputAnswered:"R\xE9pondu",inputSkipped:"Ignor\xE9",inputQuestion:"Question",inputResponse:"R\xE9ponse",inputYourAnswer:"Votre r\xE9ponse",inputSubmit:"Envoyer la r\xE9ponse",inputSubmitHint:"Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e pour un saut de ligne",inputAnswerPlaceholder:"Saisissez votre r\xE9ponse\u2026",inputSkip:"Ignorer",confirmYes:"Oui",confirmNo:"Non",inputConfirmHint:"Choisissez oui ou non.",inputOptionalNote:"Note facultative",inputOptionalNotePlaceholder:"Commentaire facultatif\u2026",inputSubmitted:"R\xE9ponse envoy\xE9e",respFreeText:"Texte libre",respSingleChoice:"Choix unique",respMultiChoice:"Choix multiple",respConfirmation:"Confirmation",approvalRequired:"Approbation requise",approve:"Approuver",reject:"Refuser",approved:"Approuv\xE9",rejected:"Refus\xE9",approvalReason:"Ajouter une raison (facultatif)",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",stepNoLongerActive:"Cette demande n'est plus active.",toolParameters:"Param\xE8tres",statusAwaiting:"En attente d'approbation",statusResponded:"R\xE9pondu",statusRunning:"En cours",statusCompleted:"Termin\xE9",statusDenied:"Refus\xE9",statusError:"Erreur"},ud={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\u0645\u062D\u0627\u062F\u062B\u0629",conversationLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629\u2026",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\u0645\u062D\u0627\u062F\u062B\u0629",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u062D\u0627\u062F\u062B\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F",historyContinue:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629",historyLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0645\u062D\u0627\u062F\u062B\u0627\u062A\u0643\u2026",historyTitle:"\u0633\u062C\u0644 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",language:"\u0627\u0644\u0644\u063A\u0629",launcherOpen:"\u0641\u062A\u062D \u0627\u0644\u0645\u062D\u0627\u062F\u062B\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:"\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629",panelTitle:"\u0627\u0644\u0645\u062D\u0627\u062F\u062B\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 \u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629",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",usedTool:"\u0623\u062F\u0627\u0629 \u0645\u064F\u0633\u062A\u062E\u062F\u064E\u0645\u0629",toolResult:"\u0627\u0644\u0646\u062A\u064A\u062C\u0629",sources:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631",tabHome:"\u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",tabConversations:"\u0627\u0644\u0645\u062D\u0627\u062F\u062B\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:"\u0645\u0637\u0644\u0648\u0628 \u0625\u062F\u062E\u0627\u0644 \u0645\u0646 \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645",inputBadge:"\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645",inputAnswered:"\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSkipped:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",inputQuestion:"\u0627\u0644\u0633\u0624\u0627\u0644",inputResponse:"\u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputYourAnswer:"\u0625\u062C\u0627\u0628\u062A\u0643",inputSubmit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSubmitHint:"\u0627\u0636\u063A\u0637 Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter \u0644\u0633\u0637\u0631 \u062C\u062F\u064A\u062F",inputAnswerPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",inputSkip:"\u062A\u062E\u0637\u064D\u0651",confirmYes:"\u0646\u0639\u0645",confirmNo:"\u0644\u0627",inputConfirmHint:"\u0627\u062E\u062A\u0631 \u0646\u0639\u0645 \u0623\u0648 \u0644\u0627.",inputOptionalNote:"\u0645\u0644\u0627\u062D\u0638\u0629 \u0627\u062E\u062A\u064A\u0627\u0631\u064A\u0629",inputOptionalNotePlaceholder:"\u062A\u0639\u0644\u064A\u0642 \u0627\u062E\u062A\u064A\u0627\u0631\u064A\u2026",inputSubmitted:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",respFreeText:"\u0646\u0635 \u062D\u0631",respSingleChoice:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0648\u0627\u062D\u062F",respMultiChoice:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0645\u062A\u0639\u062F\u062F",respConfirmation:"\u062A\u0623\u0643\u064A\u062F",approvalRequired:"\u0645\u0637\u0644\u0648\u0628 \u0645\u0648\u0627\u0641\u0642\u0629",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",approved:"\u062A\u0645\u062A \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629",rejected:"\u0645\u0631\u0641\u0648\u0636",approvalReason:"\u0623\u0636\u0641 \u0633\u0628\u0628\u064B\u0627 (\u0627\u062E\u062A\u064A\u0627\u0631\u064A)",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",stepNoLongerActive:"\u0644\u0645 \u064A\u0639\u062F \u0647\u0630\u0627 \u0627\u0644\u0637\u0644\u0628 \u0646\u0634\u0637\u064B\u0627.",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\u0631\u062F",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"},pd={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:"Esta conversaci\xF3n est\xE1 cerrada",conversationLoading:"Cargando conversaci\xF3n\u2026",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 conversaciones",historyContinue:"Continuar la conversaci\xF3n",historyLoading:"Cargando tus conversaciones\u2026",historyTitle:"Historial de 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:"Nueva conversaci\xF3n",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 una conversaci\xF3n nueva",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",usedTool:"Herramienta usada",toolResult:"Resultado",sources:"Fuentes",tabHome:"Inicio",tabConversations:"Conversaciones",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:"Entrada requerida",inputBadge:"Entrada",inputAnswered:"Respondido",inputSkipped:"Omitido",inputQuestion:"Pregunta",inputResponse:"Respuesta",inputYourAnswer:"Tu respuesta",inputSubmit:"Enviar respuesta",inputSubmitHint:"Enter para enviar \xB7 May\xFAs+Enter para una nueva l\xEDnea",inputAnswerPlaceholder:"Escribe tu respuesta\u2026",inputSkip:"Omitir",confirmYes:"S\xED",confirmNo:"No",inputConfirmHint:"Elige s\xED o no.",inputOptionalNote:"Nota opcional",inputOptionalNotePlaceholder:"Comentario opcional\u2026",inputSubmitted:"Respuesta enviada",respFreeText:"Texto libre",respSingleChoice:"Opci\xF3n \xFAnica",respMultiChoice:"Opci\xF3n m\xFAltiple",respConfirmation:"Confirmaci\xF3n",approvalRequired:"Aprobaci\xF3n requerida",approve:"Aprobar",reject:"Rechazar",approved:"Aprobado",rejected:"Rechazado",approvalReason:"A\xF1ade un motivo (opcional)",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",stepNoLongerActive:"Esta solicitud ya no est\xE1 activa.",toolParameters:"Par\xE1metros",statusAwaiting:"Esperando aprobaci\xF3n",statusResponded:"Respondido",statusRunning:"En curso",statusCompleted:"Completado",statusDenied:"Denegado",statusError:"Error"},md={en:Fi,fr:_d,ar:ud,es:pd};function Bn(e,t){let n=zi(e),o=Fn(t),i=n==="en"?{}:md[n]??{},a=o?t[n]??{}:t??{},l=o?t.en??{}:{};return{...Fi,...i,...l,...a}}function zi(e){return(e.split("-")[0]??"en").toLowerCase()}var fd=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function Ui(e){return fd.has(zi(e))}function we(e,t){return e[t]??t}function Fn(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function Wi(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function Vi(e,t){let{translations:n,defaultLocale:o,...i}=e,a=Wi(n,t);return a?{...i,title:a.title??i.title,description:a.description??i.description,content:a.content??i.content}:i}function qi(e,t){let{translations:n,defaultLocale:o,...i}=e,a=Wi(n,t);if(!a)return i;let l=new Map((a.fields??[]).map(c=>[c.name,c])),s=i.fields.map(c=>{let d=l.get(c.name);if(!d)return c;let u=new Map((d.options??[]).map(_=>[_.value,_]));return{...c,label:d.label??c.label,placeholder:d.placeholder??c.placeholder,validationHint:d.validationHint??c.validationHint,options:c.options?.map(_=>{let f=u.get(_.value);return f?{..._,label:f.label??_.label,description:f.description??_.description}:_})}});return{...i,title:a.title??i.title,description:a.description??i.description,submitLabel:a.submitLabel??i.submitLabel,fields:s}}var cr=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{}}},zn=new cr;var ur=["off","error","warn","info","debug","trace"],pr=x.cssPrefix,Gi=`${pr}.debug`,gd=`__${x.global}_DEBUG__`,hd=`${pr}-debug`,Un=2,dr=null;function vd(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(hd);if(e!==null){let t=_r(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(Gi);if(e){let t=_r(e);if(t>=0)return t}}catch{}return window[gd]?4:2}function _r(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=ur.indexOf(e);if(t>=0)return t}return-1}function Wn(e){let t=_r(e);if(!(t<0)){Un=t;try{window.localStorage?.setItem(Gi,ur[t])}catch{}}}function tn(){return ur[Un]}Un=vd();function Ki(e){let t=`[${pr}:${e}]`,n=(o,i,a)=>(l,s)=>{if(!(Un<o)&&(s===void 0?console[i](t,l):console[i](t,l,s),dr))try{dr({level:a,scope:e,message:l,payload:s})}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=>Ki(`${e}:${o}`)}}var B=Ki("core");function nn(e){dr=e}var lt=B.scope("context"),bd=new Set(["visitorId","conversationId","conversationId","jwt","token","authorization","password"]),ji=50,mr=1024,xd=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function fr(e){return Yi(e,"userContext",!0)}function gr(e){return Yi(e,"pageContext",!1)}function Yi(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){lt.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},i=0;for(let[a,l]of Object.entries(e)){if(bd.has(a)){lt.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(l==null)continue;if(i>=ji){lt.warn(`${t} truncated at ${ji} keys \u2014 dropped "${a}"`);continue}let s=Pd(t,a,l);s!==void 0&&(o[a]=s,i++)}return n&&typeof o.email=="string"&&!xd.test(o.email)&&(lt.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function Pd(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){lt.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>mr?(lt.warn(`truncated ${e}.${t} to ${mr} chars`),o.slice(0,mr)):o}lt.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var Vn={maxBytes:10485760,maxCount:10,accept:"*/*"},qn={files:!0,voice:"local",humanInLoop:!0},Xi={list:[],byTrigger:{}},hr={enabled:!0,sampleRate:1},Gn={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},kt={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},Ji={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"]},vr={enabled:!0,volume:.3,events:void 0},Qi={enabled:!0,events:void 0},Zi=[{label:"tabConversations",layout:"chat"}],ea={showSearchBar:!0};function Ze(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},i=t.i18n??{},a=t.feedback??{},l=t.footer??{},s=t.header??{},{themeMode:c,themeOverrides:d}=yd(t.theme),u=n.mode??"floating",_=Sd(i.defaultLocale),f=i.availableLocales??[i.locale??_],g=Ct(i.locale??_,f,_),m=(t.baseUrl??x.defaultBaseUrl).replace(/\/$/,""),y=(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:y,dataApiBaseUrl:h,userContext:fr(t.userContext),pageContext:gr(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:d,mode:u,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,showSources:o.showSources??!1,features:{files:t.features?.files??qn.files,voice:t.features?.voice??qn.voice,humanInLoop:t.features?.humanInLoop??qn.humanInLoop,tools:t.features?.tools},forms:on(t.forms,g),endpoints:{upload:t.endpoints?.upload??Gn.upload,transcribe:t.endpoints?.transcribe??Gn.transcribe,submitForm:t.endpoints?.submitForm??Gn.submitForm},attachments:{accept:t.composer?.attachments?.accept??Vn.accept,maxBytes:t.composer?.attachments?.maxBytes??Vn.maxBytes,maxCount:t.composer?.attachments?.maxCount??Vn.maxCount},locale:g,defaultLocale:_,availableLocales:f,startMinimized:o.startMinimized??!0,actions:wd(u,s.actions),size:n.size??{},launcher:Ld(t.launcher),sound:kd(a.sound),haptics:Cd(a.haptics),strings:Bn(g,i.strings),stringsOverride:i.strings,composerDisclaimer:l.composerDisclaimer??"",poweredBy:Td(l.poweredBy),composer:Rd(t.composer),modules:Id(t.modules),tracking:Ed(t.tracking,h),storage:t.storage??zn,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function yd(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function Sd(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function Ct(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function wd(e,t){return t??Ji[e]}function kd(e){return{enabled:e?.enabled??vr.enabled,volume:e?.volume??vr.volume,events:e?.events}}function Cd(e){return{enabled:e?.enabled??Qi.enabled,events:e?.events}}function Ed(e,t){let n=e?.sampleRate??hr.sampleRate;return{enabled:e?.enabled??hr.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 Td(e){let n={...{text:`Powered by ${x.displayName}`,href:x.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Rd(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function Id(e){let t=e===void 0?Zi:e,n=new Set,o=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let l=a.contentTags?.filter(Boolean),s=a.id??l?.[0]??a.layout;for(;n.has(s);)s=`${s}-${o.length}`;n.add(s);let c={id:s,label:a.label,layout:a.layout};l&&l.length>0&&(c.contentTags=l),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=a.showGreeting??!0,c.showSearchBar=a.showSearchBar??ea.showSearchBar,c.showRecentConversations=a.showRecentConversations??!0,a.userAvatars&&a.userAvatars.length>0&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let i=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:i}}function on(e,t){var a;if(!e?.length)return Xi;let n=[],o=new Set;for(let l of e){if(!l?.id||o.has(l.id))continue;let s=qi(l,t),c=(s.fields??[]).filter(u=>!!(u&&u.name&&u.label&&u.type)),d=(Array.isArray(s.on)?s.on:[s.on]).map(Ad).filter(u=>u!==null);c.length===0||d.length===0||(o.add(s.id),n.push({id:s.id,triggers:d,when:s.when,fields:c,title:s.title,description:s.description,submitLabel:s.submitLabel,skippable:s.skippable??!1,frequency:s.frequency??"once",mirrorToContext:s.mirrorToContext??!0,reopenable:s.reopenable??!0,reviewable:s.reviewable??!0}))}let i={};for(let l of n)for(let s of l.triggers)(i[a=s.kind]??(i[a]=[])).push(l);return{list:n,byTrigger:i}}function Ad(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 Ld(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??kt.variant,size:e?.size??kt.size,label:e?.label??kt.label,icon:e?.icon??kt.icon,hidden:e?.hidden??kt.hidden,callout:t}}function br(e,t,n,o){let i=Ct(t,e.availableLocales,e.defaultLocale);if(i===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return i!==e.locale&&(a.locale=i,a.strings=Bn(i,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var Md=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function xr(e,t){if(!t)return e;let n={...e};for(let a of Md){let l=t[a];if(l===void 0)continue;let s=e[a];if(a==="theme"){s===void 0&&(n[a]=l);continue}a!=="i18n"&&(n[a]=ta(l,s))}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,i=t.i18n;if(o||i){let a=ta(i??{},o);i?.availableLocales!==void 0&&(a.availableLocales=i.availableLocales),i?.defaultLocale!==void 0&&(a.defaultLocale=i.defaultLocale);let l=o?.strings,s=i?.strings;(l||s)&&(a.strings=Nd(s,l)),n.i18n=a}return n}function ta(e,t){if(!t)return e;let n={...e};for(let[o,i]of Object.entries(t))i!==void 0&&(n[o]=i);return n}function Nd(e,t){if(!e)return t;if(!t)return e;let n=Fn(e),o=Fn(t);if(!n&&!o)return{...e,...t};let i={},a=n?e:{en:e},l=o?t:{en:t};for(let[s,c]of Object.entries(a))i[s]={...c};for(let[s,c]of Object.entries(l))i[s]={...i[s],...c};return i}var Od=["clear","expand","fullscreen","sound","history","language","theme","textSize","close"],dt=e=>e!=="false",oa=e=>e.split(",").map(t=>t.trim()).filter(Boolean),ra=[["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]],ia=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",dt]],aa=[["width","width"],["height","height"]],sa=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",dt],["show-reasoning","showReasoning",dt],["show-tool-calls","showToolCalls",dt],["show-sources","showSources",dt]],la=[["locale","locale"]],Dd=new Set(Od),$d=e=>oa(e).filter(t=>Dd.has(t)),ca=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",dt]],da=[["features-files","files",dt],["features-voice","voice",e=>e],["features-tools","tools",oa]],_a=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],ua=[["user-id","id"],["user-email","email"],["user-name","name"]],pa=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Hd=["launcher-label","callout-text","callout-delay","actions-main","actions-overflow","user-context","page-context"],Bd=[ra,ia,aa,sa,la,ca,da,_a,ua,pa],Fd=new Set(["iframe","start-minimized"]),Pr=[...Bd.flatMap(e=>e.map(([t])=>t).filter(t=>!Fd.has(t))),...Hd];function Kn(e){let t={},n=g=>{let m=e(g);return m===null||m===""?void 0:m};for(let[g,m,y]of ra){let h=n(g);h!==void 0&&(t[m]=y?y(h):h)}let o=ct(n,ia),i=ct(n,aa);(o||i)&&(t.presentation={...o,...i?{size:i}:{}});let a=ct(n,sa);a&&(t.behavior=a);let l=ct(n,la);l&&(t.i18n=l);let s=Ud(e,n);s&&(t.launcher=s);let c=ct(n,da);c&&(t.features=c);let d=ct(n,_a);d&&(t.endpoints=d);let u=na(n,ua,"user-context");u&&(t.userContext=u);let _=na(n,pa,"page-context");_&&(t.pageContext=_);let f=n("actions");return f!==void 0&&(t.header={actions:$d(f)}),t}function yr(e){return e?Kn(t=>e[zd(t)]??null):{}}function zd(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ct(e,t){let n={};for(let[o,i,a]of t){let l=e(o);l!==void 0&&(n[i]=a?a(l):l)}return Object.keys(n).length>0?n:null}function na(e,t,n){let o={};for(let[s,c]of t){let d=e(s);d!==void 0&&(o[c]=d)}let i={},a=e(n);if(a)try{let s=JSON.parse(a);s&&typeof s=="object"&&!Array.isArray(s)&&(i=s)}catch{}let l={...i,...o};return Object.keys(l).length>0?l:null}function Ud(e,t){let n=ct(t,ca)??{},o=e("launcher-label");o!==null&&(n.label=o);let i=t("callout-text");if(i){let a=Number.parseInt(t("callout-delay")??"",10);n.callout={text:i,...Number.isFinite(a)?{delayMs:a}:{}}}return Object.keys(n).length>0?n:null}var eo,X,va,Er,et,ma,ba,xa,Sr,Yn,rn,Pa,Tr,wr,kr,Wd,Jn={},Qn=[],Vd=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,to=Array.isArray;function Ke(e,t){for(var n in t)e[n]=t[n];return e}function Rr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function no(e,t,n){var o,i,a,l={};for(a in t)a=="key"?o=t[a]:a=="ref"?i=t[a]:l[a]=t[a];if(arguments.length>2&&(l.children=arguments.length>3?eo.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)l[a]===void 0&&(l[a]=e.defaultProps[a]);return Xn(e,l,o,i,null)}function Xn(e,t,n,o,i){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++va,__i:-1,__u:0};return i==null&&X.vnode!=null&&X.vnode(a),a}function ne(e){return e.children}function tt(e,t){this.props=e,this.context=t}function Et(e,t){if(t==null)return e.__?Et(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"?Et(e):null}function qd(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],i=[],a=Ke({},t);a.__v=t.__v+1,X.vnode&&X.vnode(a),Ir(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??Et(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,ka(o,a,i),t.__e=t.__=null,a.__e!=n&&ya(a)}}function ya(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}),ya(e)}function fa(e){(!e.__d&&(e.__d=!0)&&et.push(e)&&!Zn.__r++||ma!=X.debounceRendering)&&((ma=X.debounceRendering)||ba)(Zn)}function Zn(){try{for(var e,t=1;et.length;)et.length>t&&et.sort(xa),e=et.shift(),t=et.length,qd(e)}finally{et.length=Zn.__r=0}}function Sa(e,t,n,o,i,a,l,s,c,d,u){var _,f,g,m,y,h,v,C=o&&o.__k||Qn,b=t.length;for(c=Gd(n,t,C,c,b),_=0;_<b;_++)(g=n.__k[_])!=null&&(f=g.__i!=-1&&C[g.__i]||Jn,g.__i=_,h=Ir(e,g,f,i,a,l,s,c,d,u),m=g.__e,g.ref&&f.ref!=g.ref&&(f.ref&&Ar(f.ref,null,g),u.push(g.ref,g.__c||m,g)),y==null&&m!=null&&(y=m),(v=!!(4&g.__u))||f.__k===g.__k?(c=wa(g,c,e,v),v&&f.__e&&(f.__e=null)):typeof g.type=="function"&&h!==void 0?c=h:m&&(c=m.nextSibling),g.__u&=-7);return n.__e=y,c}function Gd(e,t,n,o,i){var a,l,s,c,d,u=n.length,_=u,f=0;for(e.__k=new Array(i),a=0;a<i;a++)(l=t[a])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[a]=Xn(null,l,null,null,null):to(l)?l=e.__k[a]=Xn(ne,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[a]=Xn(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[a]=l,c=a+f,l.__=e,l.__b=e.__b+1,s=null,(d=l.__i=Kd(l,n,c,_))!=-1&&(_--,(s=n[d])&&(s.__u|=2)),s==null||s.__v==null?(d==-1&&(i>u?f--:i<u&&f++),typeof l.type!="function"&&(l.__u|=4)):d!=c&&(d==c-1?f--:d==c+1?f++:(d>c?f--:f++,l.__u|=4))):e.__k[a]=null;if(_)for(a=0;a<u;a++)(s=n[a])!=null&&(2&s.__u)==0&&(s.__e==o&&(o=Et(s)),Ea(s,s));return o}function wa(e,t,n,o){var i,a;if(typeof e.type=="function"){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=wa(i[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=Et(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Kd(e,t,n,o){var i,a,l,s=e.key,c=e.type,d=t[n],u=d!=null&&(2&d.__u)==0;if(d===null&&s==null||u&&s==d.key&&c==d.type)return n;if(o>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((d=t[l=i>=0?i--:a++])!=null&&(2&d.__u)==0&&s==d.key&&c==d.type)return l}return-1}function ga(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Vd.test(t)?n:n+"px"}function jn(e,t,n,o,i){var a,l;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||ga(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||ga(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Pa,"$1")),l=t.toLowerCase(),t=l in e||t=="onFocusOut"||t=="onFocusIn"?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[rn]=o[rn]:(n[rn]=Tr,e.addEventListener(t,a?kr:wr,a)):e.removeEventListener(t,a?kr:wr,a);else{if(i=="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 ha(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Yn]==null)t[Yn]=Tr++;else if(t[Yn]<n[rn])return;return n(X.event?X.event(t):t)}}}function Ir(e,t,n,o,i,a,l,s,c,d){var u,_,f,g,m,y,h,v,C,b,T,K,ae,N,W,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=X.__b)&&u(t);e:if(typeof F=="function")try{if(v=t.props,C=F.prototype&&F.prototype.render,b=(u=F.contextType)&&o[u.__c],T=u?b?b.props.value:u.__:o,n.__c?h=(_=t.__c=n.__c).__=_.__E:(C?t.__c=_=new F(v,T):(t.__c=_=new tt(v,T),_.constructor=F,_.render=Yd),b&&b.sub(_),_.state||(_.state={}),_.__n=o,f=_.__d=!0,_.__h=[],_._sb=[]),C&&_.__s==null&&(_.__s=_.state),C&&F.getDerivedStateFromProps!=null&&(_.__s==_.state&&(_.__s=Ke({},_.__s)),Ke(_.__s,F.getDerivedStateFromProps(v,_.__s))),g=_.props,m=_.state,_.__v=t,f)C&&F.getDerivedStateFromProps==null&&_.componentWillMount!=null&&_.componentWillMount(),C&&_.componentDidMount!=null&&_.__h.push(_.componentDidMount);else{if(C&&F.getDerivedStateFromProps==null&&v!==g&&_.componentWillReceiveProps!=null&&_.componentWillReceiveProps(v,T),t.__v==n.__v||!_.__e&&_.shouldComponentUpdate!=null&&_.shouldComponentUpdate(v,_.__s,T)===!1){t.__v!=n.__v&&(_.props=v,_.state=_.__s,_.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(V){V&&(V.__=t)}),Qn.push.apply(_.__h,_._sb),_._sb=[],_.__h.length&&l.push(_);break e}_.componentWillUpdate!=null&&_.componentWillUpdate(v,_.__s,T),C&&_.componentDidUpdate!=null&&_.__h.push(function(){_.componentDidUpdate(g,m,y)})}if(_.context=T,_.props=v,_.__P=e,_.__e=!1,K=X.__r,ae=0,C)_.state=_.__s,_.__d=!1,K&&K(t),u=_.render(_.props,_.state,_.context),Qn.push.apply(_.__h,_._sb),_._sb=[];else do _.__d=!1,K&&K(t),u=_.render(_.props,_.state,_.context),_.state=_.__s;while(_.__d&&++ae<25);_.state=_.__s,_.getChildContext!=null&&(o=Ke(Ke({},o),_.getChildContext())),C&&!f&&_.getSnapshotBeforeUpdate!=null&&(y=_.getSnapshotBeforeUpdate(g,m)),N=u!=null&&u.type===ne&&u.key==null?Ca(u.props.children):u,s=Sa(e,to(N)?N:[N],t,n,o,i,a,l,s,c,d),_.base=t.__e,t.__u&=-161,_.__h.length&&l.push(_),h&&(_.__E=_.__=null)}catch(V){if(t.__v=null,c||a!=null)if(V.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__e=s}else{for(W=a.length;W--;)Rr(a[W]);Cr(t)}else t.__e=n.__e,t.__k=n.__k,V.then||Cr(t);X.__e(V,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=jd(n.__e,t,n,o,i,a,l,c,d);return(u=X.diffed)&&u(t),128&t.__u?void 0:s}function Cr(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Cr))}function ka(e,t,n){for(var o=0;o<n.length;o++)Ar(n[o],n[++o],n[++o]);X.__c&&X.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){X.__e(a,i.__v)}})}function Ca(e){return typeof e!="object"||e==null||e.__b>0?e:to(e)?e.map(Ca):e.constructor!==void 0?null:Ke({},e)}function jd(e,t,n,o,i,a,l,s,c){var d,u,_,f,g,m,y,h=n.props||Jn,v=t.props,C=t.type;if(C=="svg"?i="http://www.w3.org/2000/svg":C=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((g=a[d])&&"setAttribute"in g==!!C&&(C?g.localName==C:g.nodeType==3)){e=g,a[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(v);e=document.createElementNS(i,C,v.is&&v),s&&(X.__m&&X.__m(t,a),s=!1),a=null}if(C==null)h===v||s&&e.data==v||(e.data=v);else{if(a=C=="textarea"&&v.defaultValue!=null?null:a&&eo.call(e.childNodes),!s&&a!=null)for(h={},d=0;d<e.attributes.length;d++)h[(g=e.attributes[d]).name]=g.value;for(d in h)g=h[d],d=="dangerouslySetInnerHTML"?_=g:d=="children"||d in v||d=="value"&&"defaultValue"in v||d=="checked"&&"defaultChecked"in v||jn(e,d,null,g,i);for(d in v)g=v[d],d=="children"?f=g:d=="dangerouslySetInnerHTML"?u=g:d=="value"?m=g:d=="checked"?y=g:s&&typeof g!="function"||h[d]===g||jn(e,d,g,h[d],i);if(u)s||_&&(u.__html==_.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(_&&(e.innerHTML=""),Sa(t.type=="template"?e.content:e,to(f)?f:[f],t,n,o,C=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,l,a?a[0]:n.__k&&Et(n,0),s,c),a!=null)for(d=a.length;d--;)Rr(a[d]);s&&C!="textarea"||(d="value",C=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[d]||C=="progress"&&!m||C=="option"&&m!=h[d])&&jn(e,d,m,h[d],i),d="checked",y!=null&&y!=e[d]&&jn(e,d,y,h[d],i))}return e}function Ar(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(i){X.__e(i,n)}}function Ea(e,t,n){var o,i;if(X.unmount&&X.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Ar(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){X.__e(a,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&Ea(o[i],t,n||typeof e.type!="function");n||Rr(e.__e),e.__c=e.__=e.__e=void 0}function Yd(e,t,n){return this.constructor(e,n)}function Tt(e,t,n){var o,i,a,l;t==document&&(t=document.documentElement),X.__&&X.__(e,t),i=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],l=[],Ir(t,e=(!o&&n||t).__k=no(ne,null,[e]),i||Jn,Jn,t.namespaceURI,!o&&n?[n]:i?null:t.firstChild?eo.call(t.childNodes):null,a,!o&&n?n:i?i.__e:t.firstChild,o,l),ka(a,e,l)}eo=Qn.slice,X={__e:function(e,t,n,o){for(var i,a,l;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,o||{}),l=i.__d),l)return i.__E=i}catch(s){e=s}throw e}},va=0,Er=function(e){return e!=null&&e.constructor===void 0},tt.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ke({},this.state),typeof e=="function"&&(e=e(Ke({},n),this.props)),e&&Ke(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),fa(this))},tt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),fa(this))},tt.prototype.render=ne,et=[],ba=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xa=function(e,t){return e.__v.__b-t.__v.__b},Zn.__r=0,Sr=Math.random().toString(8),Yn="__d"+Sr,rn="__a"+Sr,Pa=/(PointerCapture)$|Capture$/i,Tr=0,wr=ha(!1),kr=ha(!0),Wd=0;var Rt="0.50.1";function Ta(e){return`${x.cssPrefix}:${e}`}function an(e,t,n){e.dispatchEvent(new CustomEvent(Ta(t),{detail:n}))}function Ra(e,t){let o=Object.entries(t).map(([i,a])=>{let l=Ta(i),s=c=>a(c.detail);return e.addEventListener(l,s),[l,s]});return()=>{for(let[i,a]of o)e.removeEventListener(i,a)}}function Ne(){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,Xd(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 Xd(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 _t=B.scope("persistence");function nt(e,t=zn,n){let o=n?`${e}.${n}`:e,i=`${x.cssPrefix}.storageVersion`,a=t.get(i)??void 0,l=a?`.v${a}`:"",s=`${x.cssPrefix}.${o}${l}`,c=`${x.cssPrefix}${l}.visitorId`,d=`${s}.conversationId`,u=`${s}.userPrefs`,_=`${s}.panelOpen`,f=`${s}.panelSize`,g=`${s}.calloutDismissed`,m=`${s}.sidebarCollapsed`,y=`${s}.activeModule`,h=`${s}.historyCount`,v=`${s}.formsDone`,C={getVisitorId(){let b=t.get(c);if(b)return b;let T=Ne();return t.set(c,T),T},setVisitorId(b){_t.debug("setVisitorId (rebind)",{id:b,scope:o}),t.set(c,b)},loadConversationId(){return t.get(d)??void 0},saveConversationId(b){_t.trace("saveConversationId",{id:b,scope:o}),b?t.set(d,b):t.remove(d)},loadUserPrefs(){let b=t.get(u);if(!b)return{};try{let T=JSON.parse(b);return Ia(T)?T:{}}catch(T){return _t.warn("loadUserPrefs parse failed",{error:T}),{}}},saveUserPrefs(b){try{t.set(u,JSON.stringify(b))}catch(T){_t.warn("saveUserPrefs serialise failed",{error:T})}},patchUserPrefs(b){let T=C.loadUserPrefs();C.saveUserPrefs({...T,...b})},loadPanelOpen(){let b=t.get(_);return b==="1"?!0:b==="0"?!1:null},savePanelOpen(b){t.set(_,b?"1":"0")},loadPanelSize(){let b=t.get(f);return b==="normal"||b==="expanded"||b==="fullscreen"?b:null},savePanelSize(b){t.set(f,b)},loadCalloutDismissed(b){if(!b)return!1;let T=t.get(g);return!!T&&T===b},saveCalloutDismissed(b){b?t.set(g,b):t.remove(g)},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(y)||null},saveActiveModule(b){t.set(y,b)},loadHistoryCount(){let b=t.get(h);if(!b)return null;let T=Number.parseInt(b,10);return Number.isFinite(T)&&T>=0?T:null},saveHistoryCount(b){t.set(h,String(b))},loadFormsDone(){let b=t.get(v);if(!b)return{};try{let T=JSON.parse(b);return Ia(T)?T:{}}catch(T){return _t.warn("loadFormsDone parse failed",{error:T}),{}}},saveFormDone(b){try{let T=C.loadFormsDone();T[b]=Date.now(),t.set(v,JSON.stringify(T))}catch(T){_t.warn("saveFormDone serialise failed",{error:T})}},rememberStorageVersion(b){b&&b!==t.get(i)&&(_t.debug("rememberStorageVersion (force-reset on next load)",{version:b}),t.set(i,b))},clearConversation(){t.remove(d)}};return C}function Ia(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Aa=`: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__-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__-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-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);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__-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)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
2
- `;var La=`*,*: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);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
- `;var Ma=`.__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);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;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:0;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:100dvh;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:0;align-items:stretch;padding:0}:host([data-mode="open"]) .__P__-panel,:host([data-mode="expanded"]) .__P__-panel{width:100vw;height:100dvh;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);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);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>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-date-divider{position:sticky;top:var(--__P__-space-2);z-index:2;display:flex;justify-content:center;align-items:flex-start;height:0;margin:0;pointer-events:none}.__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);opacity:0;pointer-events:none;transition:opacity var(--__P__-dur-base) var(--__P__-ease)}.__P__-list[data-scrolling=true] .__P__-date-pill{opacity:1;pointer-events:auto}@media(prefers-reduced-motion:reduce){.__P__-date-pill{transition:none}}.__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%;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:anywhere;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-end-start-radius:5px}.__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-time{margin-top:3px;padding:0 4px;font-size:calc(11px * var(--__P__-text-scale));line-height:1;color:var(--__P__-fg-muted);user-select:none}.__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;height:40px;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),box-shadow var(--__P__-dur-quick) var(--__P__-ease)}.__P__-textarea:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:1px;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{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);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)}.__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);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 10px;border-radius:var(--__P__-radius-sm);background:var(--__P__-danger-bg);color:var(--__P__-danger-text);font-size:var(--__P__-text-sm);display:flex;align-items:center;gap:var(--__P__-space-2)}.__P__-error button{color:inherit;text-decoration:underline;font-size:var(--__P__-text-sm)}.__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)}.__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__-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)}.__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);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__-module-cta{padding:var(--__P__-space-3);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)}.__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:-4px;left:calc(50% + 6px);min-width:16px;height:16px;padding:0 4px;display:inline-flex;align-items:center;justify-content:center;border-radius:999px;background:var(--__P__-accent);color:var(--__P__-on-accent);font-size:calc(10px * var(--__P__-text-scale));font-weight:600;line-height:1}.__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)}.__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-at{color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);flex-shrink:0}.__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)}.__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);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__-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-label{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-field-req{color:var(--__P__-danger)}.__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;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-form-hint{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);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);cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-skip:hover:not(:disabled){background:var(--__P__-bg-elevated)}.__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)}.__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}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-wrench{display:inline-flex;color:var(--__P__-fg-muted)}.__P__-toolui-wrench svg{width:15px;height:15px}.__P__-toolui-title{font-weight:600;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui-chevron{display:inline-flex;margin-inline-start:auto;color:var(--__P__-fg-muted);transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-toolui-chevron svg{width:16px;height:16px}details.__P__-toolui-collapsible[open]>summary .__P__-toolui-chevron{transform:rotate(180deg)}.__P__-toolui-badge{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:999px;border:1px solid var(--__P__-border);background:var(--__P__-bg);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600;white-space:nowrap}.__P__-toolui-badge-accent{border-color:color-mix(in oklab,var(--__P__-warning, #f59e0b) 55%,transparent);background:color-mix(in oklab,var(--__P__-warning, #f59e0b) 12%,transparent);color:var(--__P__-warning, #f59e0b)}.__P__-toolui-status-icon{display:inline-flex}.__P__-toolui-status-icon svg{width:14px;height:14px}.__P__-toolui-status[data-status=awaiting] .__P__-toolui-status-icon{color:var(--__P__-warning, #f59e0b)}.__P__-toolui-status[data-status=responded] .__P__-toolui-status-icon{color:var(--__P__-accent)}.__P__-toolui-status[data-status=completed] .__P__-toolui-status-icon{color:var(--__P__-success, #16a34a)}.__P__-toolui-status[data-status=denied] .__P__-toolui-status-icon{color:#ea580c}.__P__-toolui-status[data-status=error] .__P__-toolui-status-icon{color:var(--__P__-danger, #dc2626)}.__P__-toolui-head{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2)}.__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-label{font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--__P__-fg-muted)}.__P__-toolui-text{margin:0;font-size:var(--__P__-text-base);font-weight:600;color:var(--__P__-fg);line-height:1.4;overflow-wrap:anywhere}.__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;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-toolui-note{margin:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}: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
- `;var Na=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
5
- `;var Oa=`: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
- `;var n_="helpai",o_="#5B5BD6",r_="#FFFFFF",i_="12px",a_="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Lr=[Aa,La,Ma,Na,Oa].join(`
7
- `).replace(/__P__/g,n_).replaceAll("__BRAND_ACCENT_TEXT__",r_).replaceAll("__BRAND_ACCENT__",o_).replaceAll("__BRAND_RADIUS__",i_).replaceAll("__BRAND_FONT__",a_);var s_=B.scope("mount"),Da=new WeakMap,$a={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 Ha(e,t){e.style.cssText=$a[t]}function ut(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function It(e={}){let t=e.position??"flow";s_.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${x.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",x.id),o.style.cssText=$a[t];let i=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!l_(i,a)){let s=a.createElement("style");s.textContent=Lr,i.appendChild(s)}let l=document.createElement("div");return l.className=`${x.cssPrefix}-app`,i.appendChild(l),{appRoot:l,destroy:()=>o.remove(),hostElement:o,shadowRoot:i}}function l_(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Da.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(Lr),Da.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function c_(e,t){let n=x.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)}function d_(e,t){e.dataset.theme=t}function __(e,t){let n=x.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 u_(e,t){e.dataset.position=t}function oo(e,t){e.dataset.mode=t}function Ba(e,t){d_(e,t.themeMode),c_(e,t.themeOverrides),u_(e,t.position),__(e,t.size)}var p_=B.scope("iframe"),m_='<!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 Ua(e,t,n="closed",o="floating",i=null){p_.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!i});let a=document.createElement("iframe");a.title=`${x.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),za(a,t,n,o),(o==="inline"&&i?i:document.body).appendChild(a);let s=a.contentDocument;if(!s)throw new Error("iframe contentDocument unavailable (cross-origin?)");s.open(),s.write(m_),s.close();let c=It({...e,target:s.body}),d=new MutationObserver(()=>{za(a,t,c.hostElement.dataset.mode??"closed",o)});return d.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){d.disconnect(),c.destroy(),a.remove()}}}var ro="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Fa={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 za(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${ro}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${ro}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=`${ro}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",l=t.endsWith("-left")?"left":"right",{w:s,h:c}=Fa[n]??Fa.open;e.style.cssText=`${ro}position:fixed;${a}:16px;${l}:16px;width:${s};height:${c};`}var At=class{constructor(){q(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 i of o)try{i(n)}catch{}}clear(){this.handlers.clear()}};var Lt,pe,Mr,Wa,sn=0,Ja=[],fe=X,Va=fe.__b,qa=fe.__r,Ga=fe.diffed,Ka=fe.__c,ja=fe.unmount,Ya=fe.__;function ao(e,t){fe.__h&&fe.__h(pe,e,sn||t),sn=0;var n=pe.__H||(pe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function R(e){return sn=1,f_(Qa,e)}function f_(e,t,n){var o=ao(Lt++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Qa(void 0,t),function(s){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,s);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=pe,!pe.__f)){var i=function(s,c,d){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(f){return f.__c});if(u.every(function(f){return!f.__N}))return!a||a.call(this,s,c,d);var _=o.__c.props!==s;return u.some(function(f){if(f.__N){var g=f.__[0];f.__=f.__N,f.__N=void 0,g!==f.__[0]&&(_=!0)}}),a&&a.call(this,s,c,d)||_};pe.__f=!0;var a=pe.shouldComponentUpdate,l=pe.componentWillUpdate;pe.componentWillUpdate=function(s,c,d){if(this.__e){var u=a;a=void 0,i(s,c,d),a=u}l&&l.call(this,s,c,d)},pe.shouldComponentUpdate=i}return o.__N||o.__}function E(e,t){var n=ao(Lt++,3);!fe.__s&&Or(n.__H,t)&&(n.__=e,n.u=t,pe.__H.__h.push(n))}function ln(e,t){var n=ao(Lt++,4);!fe.__s&&Or(n.__H,t)&&(n.__=e,n.u=t,pe.__h.push(n))}function O(e){return sn=5,ke(function(){return{current:e}},[])}function ke(e,t){var n=ao(Lt++,7);return Or(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function H(e,t){return sn=8,ke(function(){return e},t)}function g_(){for(var e;e=Ja.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(io),t.__h.some(Nr),t.__h=[]}catch(n){t.__h=[],fe.__e(n,e.__v)}}}fe.__b=function(e){pe=null,Va&&Va(e)},fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ya&&Ya(e,t)},fe.__r=function(e){qa&&qa(e),Lt=0;var t=(pe=e.__c).__H;t&&(Mr===pe?(t.__h=[],pe.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(io),t.__h.some(Nr),t.__h=[],Lt=0)),Mr=pe},fe.diffed=function(e){Ga&&Ga(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ja.push(t)!==1&&Wa===fe.requestAnimationFrame||((Wa=fe.requestAnimationFrame)||h_)(g_)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Mr=pe=null},fe.__c=function(e,t){t.some(function(n){try{n.__h.some(io),n.__h=n.__h.filter(function(o){return!o.__||Nr(o)})}catch(o){t.some(function(i){i.__h&&(i.__h=[])}),t=[],fe.__e(o,n.__v)}}),Ka&&Ka(e,t)},fe.unmount=function(e){ja&&ja(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{io(o)}catch(i){t=i}}),n.__H=void 0,t&&fe.__e(t,n.__v))};var Xa=typeof requestAnimationFrame=="function";function h_(e){var t,n=function(){clearTimeout(o),Xa&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Xa&&(t=requestAnimationFrame(n))}function io(e){var t=pe,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),pe=t}function Nr(e){var t=pe;e.__c=e.__(),pe=t}function Or(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Qa(e,t){return typeof t=="function"?t(e):t}var v_=Symbol.for("preact-signals");function _o(){if(je>1)je--;else{var e,t=!1;for((function(){var i=lo;for(lo=void 0;i!==void 0;)i.S.v===i.v&&(i.S.i=i.i),i=i.o})();cn!==void 0;){var n=cn;for(cn=void 0,so++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ts(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=o}}if(so=0,je--,t)throw e}}function Mt(e){if(je>0)return e();Dr=++b_,je++;try{return e()}finally{_o()}}var se=void 0;function dn(e){var t=se;se=void 0;try{return e()}finally{se=t}}var Za,cn=void 0,je=0,so=0,b_=0,Dr=0,lo=void 0,co=0;function es(e){if(se!==void 0){var t=e.n;if(t===void 0||t.t!==se)return t={i:0,S:e,p:se.s,n:void 0,t:se,e:void 0,x:void 0,r:t},se.s!==void 0&&(se.s.n=t),se.s=t,e.n=t,32&se.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=se.s,t.n=void 0,se.s.n=t,se.s=t),t}}function he(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}he.prototype.brand=v_;he.prototype.h=function(){return!0};he.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:dn(function(){var o;(o=t.W)==null||o.call(t)}))};he.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&&dn(function(){var i;(i=t.Z)==null||i.call(t)}))}};he.prototype.subscribe=function(e){var t=this;return Ye(function(){var n=t.value;dn(function(){return e(n)})},{name:"sub"})};he.prototype.valueOf=function(){return this.value};he.prototype.toString=function(){return this.value+""};he.prototype.toJSON=function(){return this.value};he.prototype.peek=function(){var e=this;return dn(function(){return e.value})};Object.defineProperty(he.prototype,"value",{get:function(){var e=es(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(so>100)throw new Error("Cycle detected");(function(n){je!==0&&so===0&&n.l!==Dr&&(n.l=Dr,lo={S:n,v:n.v,i:n.i,o:lo})})(this),this.v=e,this.i++,co++,je++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{_o()}}}});function $(e,t){return new he(e,t)}function ts(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 ns(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 os(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 pt(e,t){he.call(this,void 0,t),this.x=e,this.s=void 0,this.g=co-1,this.f=4}pt.prototype=new he;pt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===co))return!0;if(this.g=co,this.f|=1,this.i>0&&!ts(this))return this.f&=-2,!0;var e=se;try{ns(this),se=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 se=e,os(this),this.f&=-2,!0};pt.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)}he.prototype.S.call(this,e)};pt.prototype.U=function(e){if(this.t!==void 0&&(he.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)}};pt.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(pt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=es(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function _n(e,t){return new pt(e,t)}function rs(e){var t=e.m;if(e.m=void 0,typeof t=="function"){je++;var n=se;se=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,$r(e),o}finally{se=n,_o()}}}function $r(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,rs(e)}function x_(e){if(se!==this)throw new Error("Out-of-order effect");os(this),se=e,this.f&=-2,8&this.f&&$r(this),_o()}function Nt(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Za&&Za.push(this)}Nt.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()}};Nt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,rs(this),ns(this),je++;var e=se;return se=this,x_.bind(this,e)};Nt.prototype.N=function(){2&this.f||(this.f|=2,this.u=cn,cn=this)};Nt.prototype.d=function(){this.f|=8,1&this.f||$r(this)};Nt.prototype.dispose=function(){this.d()};function Ye(e,t){var n=new Nt(e,t);try{n.c()}catch(i){throw n.d(),i}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var is,mo,uo,P_=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var as=[];Ye(function(){is=this.N})();function Ot(e,t){X[e]=t.bind(null,X[e]||function(){})}function po(e){if(uo){var t=uo;uo=void 0,t()}uo=e&&e.S()}function ss(e){var t=this,n=e.data,o=un(n);o.value=n;var i=ke(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=_n(function(){var g=o.value.value;return g===0?0:g===!0?"":g||""}),u=_n(function(){return!Array.isArray(d.value)&&!Er(d.value)}),_=Ye(function(){if(this.N=ls,u.value){var g=d.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=g)}}),f=t.__$u.d;return t.__$u.d=function(){_(),f.call(this)},[u,d]},[]),a=i[0],l=i[1];return a.value?l.peek():l.value}ss.displayName="ReactiveTextNode";Object.defineProperties(he.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ss},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Ot("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var i in o)if(i!=="children"){var a=o[i];a instanceof he&&(n||(t.__np=n={}),n[i]=a,o[i]=a.peek())}}e(t)});Ot("__r",function(e,t){if(e(t),t.type!==ne){po();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(i,a){var l;return Ye(function(){l=this},{name:a}),l.c=i,l})(function(){var i;P_&&((i=n.y)==null||i.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),mo=o,po(n)}});Ot("__e",function(e,t,n,o){po(),mo=void 0,e(t,n,o)});Ot("diffed",function(e,t){po(),mo=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,i=t.props;if(o){var a=n.U;if(a)for(var l in a){var s=a[l];s!==void 0&&!(l in o)&&(s.d(),a[l]=void 0)}else a={},n.U=a;for(var c in o){var d=a[c],u=o[c];d===void 0?(d=y_(n,c,u,i),a[c]=d):d.o(u,i)}}}e(t)});function y_(e,t,n,o){var i=t in e&&e.ownerSVGElement===void 0,a=$(n);return{o:function(l,s){a.value=l,o=s},d:Ye(function(){this.N=ls;var l=a.value.value;o[t]!==l&&(o[t]=l,i?e[t]=l:l!=null&&(l!==!1||t[4]==="-")?e.setAttribute(t,l):e.removeAttribute(t))})}}Ot("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 i in o){var a=o[i];a&&a.d()}}}var l=t.__np;if(l){var s=t.props;for(var c in l)s[c]=l[c]}t.__np=void 0}else{var d=t.__c;if(d){var u=d.__$u;u&&(d.__$u=void 0,u.d())}}e(t)});Ot("__h",function(e,t,n,o){(o<3||o===9)&&(t.__$f|=2),e(t,n,o)});tt.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var i 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 l in e)if(l!=="__source"&&e[l]!==this.props[l])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function un(e,t){return ke(function(){return $(e,t)},[])}function J(e,t){var n=O(e);return n.current=e,mo.__$f|=4,ke(function(){return _n(function(){return n.current()},t)},[])}var S_=function(e){queueMicrotask(function(){queueMicrotask(e)})};function w_(){Mt(function(){for(var e;e=as.shift();)is.call(e)})}function ls(){as.push(this)===1&&(X.requestAnimationFrame||S_)(w_)}function cs(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ds(e){return cs(e)}function _s(e){return!(!cs(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function fo(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 k_=900;function Hr(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;if(o==="expanded"||o==="fullscreen"||o==="normal")return o;if(o==="auto"){let i=t.autoSizeBreakpoint??k_;return n>=i?"expanded":"normal"}return"normal"}function pn(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Hr(e.mode,e.size,t);return{panelOpen:a,panelSize:s}}function Dt(){return typeof window>"u"?0:window.innerWidth}var C_="x-public-key",E_="x-ai-agent-deployment-id";function us(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[E_]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??C_]=e.publicKey),t}}}var Oe=class extends Error{constructor(n,o,i,a){super(n);q(this,"code",o);q(this,"status",i);q(this,"cause",a);this.name="StreamError"}};var ps=B.scope("parser");async function*Br(e,t){if(!e.ok){let i=await e.text().catch(()=>"");throw new Oe(`server responded ${e.status}: ${i.slice(0,200)}`,"server",e.status)}if(!e.body)throw new Oe("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:i,value:a}=await n.read();if(i){let s=o.trim();if(s){let c=ms(s);c&&(yield c)}return}o+=a;let l;for(;(l=o.indexOf(`
1
+ "use strict";var HelpAI=(()=>{var cr=Object.defineProperty;var ad=Object.getOwnPropertyDescriptor;var sd=Object.getOwnPropertyNames;var ld=Object.prototype.hasOwnProperty;var cd=(e,t,n)=>t in e?cr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var dd=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sd(t))!ld.call(e,i)&&i!==n&&cr(e,i,{get:()=>t[i],enumerable:!(o=ad(t,i))||o.enumerable});return e};var _d=e=>dd(cr({},"__esModule",{value:!0}),e);var q=(e,t,n)=>cd(e,typeof t!="symbol"?t+"":t,n);var gm={};var x={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 zi={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This conversation is closed",conversationLoading:"Loading conversation\u2026",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 conversations yet",historyLoading:"Loading your conversations\u2026",historyContinue:"Continue the conversation",historyTitle:"Conversation history",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 conversation",panelTitle:"Chat",resizeHandle:"Drag to resize",scrollToBottom:"Scroll to latest",send:"Send",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new conversation",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",usedTool:"Used tool",toolResult:"Result",sources:"Sources",tabHome:"Home",tabConversations:"Conversations",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:"User Input Required",inputBadge:"User Input",inputAnswered:"Answered",inputSkipped:"Skipped",inputQuestion:"Question",inputResponse:"Response",inputYourAnswer:"Your answer",inputSubmit:"Submit answer",inputSubmitHint:"Enter to submit \xB7 Shift+Enter for new line",inputAnswerPlaceholder:"Type your answer\u2026",inputSkip:"Skip",confirmYes:"Yes",confirmNo:"No",inputConfirmHint:"Choose yes or no.",inputOptionalNote:"Optional note",inputOptionalNotePlaceholder:"Optional comment\u2026",inputSubmitted:"Answer submitted",respFreeText:"Free Text",respSingleChoice:"Single Choice",respMultiChoice:"Multiple Choice",respConfirmation:"Confirmation",approvalRequired:"Approval required",approve:"Approve",reject:"Reject",approved:"Approved",rejected:"Rejected",approvalReason:"Add a reason (optional)",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",stepNoLongerActive:"This request is no longer active.",toolParameters:"Parameters",statusAwaiting:"Awaiting Approval",statusResponded:"Responded",statusRunning:"Running",statusCompleted:"Completed",statusDenied:"Denied",statusError:"Error"},ud={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:"Cette conversation est ferm\xE9e",conversationLoading:"Chargement de la conversation\u2026",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:"Aucune conversation pour le moment",historyContinue:"Poursuivre la conversation",historyLoading:"Chargement de vos conversations\u2026",historyTitle:"Historique des 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:"Nouvelle conversation",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 une nouvelle conversation",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",usedTool:"Outil utilis\xE9",toolResult:"R\xE9sultat",sources:"Sources",tabHome:"Accueil",tabConversations:"Conversations",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:"Saisie requise",inputBadge:"Saisie",inputAnswered:"R\xE9pondu",inputSkipped:"Ignor\xE9",inputQuestion:"Question",inputResponse:"R\xE9ponse",inputYourAnswer:"Votre r\xE9ponse",inputSubmit:"Envoyer la r\xE9ponse",inputSubmitHint:"Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e pour un saut de ligne",inputAnswerPlaceholder:"Saisissez votre r\xE9ponse\u2026",inputSkip:"Ignorer",confirmYes:"Oui",confirmNo:"Non",inputConfirmHint:"Choisissez oui ou non.",inputOptionalNote:"Note facultative",inputOptionalNotePlaceholder:"Commentaire facultatif\u2026",inputSubmitted:"R\xE9ponse envoy\xE9e",respFreeText:"Texte libre",respSingleChoice:"Choix unique",respMultiChoice:"Choix multiple",respConfirmation:"Confirmation",approvalRequired:"Approbation requise",approve:"Approuver",reject:"Refuser",approved:"Approuv\xE9",rejected:"Refus\xE9",approvalReason:"Ajouter une raison (facultatif)",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",stepNoLongerActive:"Cette demande n'est plus active.",toolParameters:"Param\xE8tres",statusAwaiting:"En attente d'approbation",statusResponded:"R\xE9pondu",statusRunning:"En cours",statusCompleted:"Termin\xE9",statusDenied:"Refus\xE9",statusError:"Erreur"},pd={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\u0645\u062D\u0627\u062F\u062B\u0629",conversationLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629\u2026",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\u0645\u062D\u0627\u062F\u062B\u0629",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u062D\u0627\u062F\u062B\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F",historyContinue:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629",historyLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0645\u062D\u0627\u062F\u062B\u0627\u062A\u0643\u2026",historyTitle:"\u0633\u062C\u0644 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",language:"\u0627\u0644\u0644\u063A\u0629",launcherOpen:"\u0641\u062A\u062D \u0627\u0644\u0645\u062D\u0627\u062F\u062B\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:"\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629",panelTitle:"\u0627\u0644\u0645\u062D\u0627\u062F\u062B\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 \u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629",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",usedTool:"\u0623\u062F\u0627\u0629 \u0645\u064F\u0633\u062A\u062E\u062F\u064E\u0645\u0629",toolResult:"\u0627\u0644\u0646\u062A\u064A\u062C\u0629",sources:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631",tabHome:"\u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",tabConversations:"\u0627\u0644\u0645\u062D\u0627\u062F\u062B\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:"\u0645\u0637\u0644\u0648\u0628 \u0625\u062F\u062E\u0627\u0644 \u0645\u0646 \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645",inputBadge:"\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645",inputAnswered:"\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSkipped:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",inputQuestion:"\u0627\u0644\u0633\u0624\u0627\u0644",inputResponse:"\u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputYourAnswer:"\u0625\u062C\u0627\u0628\u062A\u0643",inputSubmit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSubmitHint:"\u0627\u0636\u063A\u0637 Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter \u0644\u0633\u0637\u0631 \u062C\u062F\u064A\u062F",inputAnswerPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",inputSkip:"\u062A\u062E\u0637\u064D\u0651",confirmYes:"\u0646\u0639\u0645",confirmNo:"\u0644\u0627",inputConfirmHint:"\u0627\u062E\u062A\u0631 \u0646\u0639\u0645 \u0623\u0648 \u0644\u0627.",inputOptionalNote:"\u0645\u0644\u0627\u062D\u0638\u0629 \u0627\u062E\u062A\u064A\u0627\u0631\u064A\u0629",inputOptionalNotePlaceholder:"\u062A\u0639\u0644\u064A\u0642 \u0627\u062E\u062A\u064A\u0627\u0631\u064A\u2026",inputSubmitted:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",respFreeText:"\u0646\u0635 \u062D\u0631",respSingleChoice:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0648\u0627\u062D\u062F",respMultiChoice:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0645\u062A\u0639\u062F\u062F",respConfirmation:"\u062A\u0623\u0643\u064A\u062F",approvalRequired:"\u0645\u0637\u0644\u0648\u0628 \u0645\u0648\u0627\u0641\u0642\u0629",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",approved:"\u062A\u0645\u062A \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629",rejected:"\u0645\u0631\u0641\u0648\u0636",approvalReason:"\u0623\u0636\u0641 \u0633\u0628\u0628\u064B\u0627 (\u0627\u062E\u062A\u064A\u0627\u0631\u064A)",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",stepNoLongerActive:"\u0644\u0645 \u064A\u0639\u062F \u0647\u0630\u0627 \u0627\u0644\u0637\u0644\u0628 \u0646\u0634\u0637\u064B\u0627.",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\u0631\u062F",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"},md={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:"Esta conversaci\xF3n est\xE1 cerrada",conversationLoading:"Cargando conversaci\xF3n\u2026",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 conversaciones",historyContinue:"Continuar la conversaci\xF3n",historyLoading:"Cargando tus conversaciones\u2026",historyTitle:"Historial de 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:"Nueva conversaci\xF3n",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 una conversaci\xF3n nueva",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",usedTool:"Herramienta usada",toolResult:"Resultado",sources:"Fuentes",tabHome:"Inicio",tabConversations:"Conversaciones",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:"Entrada requerida",inputBadge:"Entrada",inputAnswered:"Respondido",inputSkipped:"Omitido",inputQuestion:"Pregunta",inputResponse:"Respuesta",inputYourAnswer:"Tu respuesta",inputSubmit:"Enviar respuesta",inputSubmitHint:"Enter para enviar \xB7 May\xFAs+Enter para una nueva l\xEDnea",inputAnswerPlaceholder:"Escribe tu respuesta\u2026",inputSkip:"Omitir",confirmYes:"S\xED",confirmNo:"No",inputConfirmHint:"Elige s\xED o no.",inputOptionalNote:"Nota opcional",inputOptionalNotePlaceholder:"Comentario opcional\u2026",inputSubmitted:"Respuesta enviada",respFreeText:"Texto libre",respSingleChoice:"Opci\xF3n \xFAnica",respMultiChoice:"Opci\xF3n m\xFAltiple",respConfirmation:"Confirmaci\xF3n",approvalRequired:"Aprobaci\xF3n requerida",approve:"Aprobar",reject:"Rechazar",approved:"Aprobado",rejected:"Rechazado",approvalReason:"A\xF1ade un motivo (opcional)",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",stepNoLongerActive:"Esta solicitud ya no est\xE1 activa.",toolParameters:"Par\xE1metros",statusAwaiting:"Esperando aprobaci\xF3n",statusResponded:"Respondido",statusRunning:"En curso",statusCompleted:"Completado",statusDenied:"Denegado",statusError:"Error"},fd={en:zi,fr:ud,ar:pd,es:md};function Bn(e,t){let n=Ui(e),o=Fn(t),i=n==="en"?{}:fd[n]??{},a=o?t[n]??{}:t??{},l=o?t.en??{}:{};return{...zi,...i,...l,...a}}function Ui(e){return(e.split("-")[0]??"en").toLowerCase()}var gd=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function Wi(e){return gd.has(Ui(e))}function we(e,t){return e[t]??t}function Fn(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function Vi(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function qi(e,t){let{translations:n,defaultLocale:o,...i}=e,a=Vi(n,t);return a?{...i,title:a.title??i.title,description:a.description??i.description,content:a.content??i.content}:i}function Gi(e,t){let{translations:n,defaultLocale:o,...i}=e,a=Vi(n,t);if(!a)return i;let l=new Map((a.fields??[]).map(c=>[c.name,c])),s=i.fields.map(c=>{let d=l.get(c.name);if(!d)return c;let u=new Map((d.options??[]).map(_=>[_.value,_]));return{...c,label:d.label??c.label,placeholder:d.placeholder??c.placeholder,validationHint:d.validationHint??c.validationHint,options:c.options?.map(_=>{let g=u.get(_.value);return g?{..._,label:g.label??_.label,description:g.description??_.description}:_})}});return{...i,title:a.title??i.title,description:a.description??i.description,submitLabel:a.submitLabel??i.submitLabel,fields:s}}var dr=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{}}},zn=new dr;var pr=["off","error","warn","info","debug","trace"],mr=x.cssPrefix,Ki=`${mr}.debug`,hd=`__${x.global}_DEBUG__`,vd=`${mr}-debug`,Un=2,_r=null;function bd(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(vd);if(e!==null){let t=ur(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(Ki);if(e){let t=ur(e);if(t>=0)return t}}catch{}return window[hd]?4:2}function ur(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=pr.indexOf(e);if(t>=0)return t}return-1}function Wn(e){let t=ur(e);if(!(t<0)){Un=t;try{window.localStorage?.setItem(Ki,pr[t])}catch{}}}function tn(){return pr[Un]}Un=bd();function ji(e){let t=`[${mr}:${e}]`,n=(o,i,a)=>(l,s)=>{if(!(Un<o)&&(s===void 0?console[i](t,l):console[i](t,l,s),_r))try{_r({level:a,scope:e,message:l,payload:s})}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=>ji(`${e}:${o}`)}}var B=ji("core");function nn(e){_r=e}var lt=B.scope("context"),xd=new Set(["visitorId","conversationId","conversationId","jwt","token","authorization","password"]),Yi=50,fr=1024,Pd=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function gr(e){return Xi(e,"userContext",!0)}function hr(e){return Xi(e,"pageContext",!1)}function Xi(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){lt.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},i=0;for(let[a,l]of Object.entries(e)){if(xd.has(a)){lt.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(l==null)continue;if(i>=Yi){lt.warn(`${t} truncated at ${Yi} keys \u2014 dropped "${a}"`);continue}let s=yd(t,a,l);s!==void 0&&(o[a]=s,i++)}return n&&typeof o.email=="string"&&!Pd.test(o.email)&&(lt.warn(`dropped malformed ${t}.email "${o.email}"`),delete o.email),Object.keys(o).length>0?o:void 0}function yd(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){lt.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>fr?(lt.warn(`truncated ${e}.${t} to ${fr} chars`),o.slice(0,fr)):o}lt.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var Vn={maxBytes:10485760,maxCount:10,accept:"*/*"},qn={files:!0,voice:"local",humanInLoop:!0},Ji={list:[],byTrigger:{}},vr={enabled:!0,sampleRate:1},Gn={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},kt={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},Qi={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"]},br={enabled:!0,volume:.3,events:void 0},Zi={enabled:!0,events:void 0},ea=[{label:"tabConversations",layout:"chat"}],ta={showSearchBar:!0};function Ze(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},i=t.i18n??{},a=t.feedback??{},l=t.footer??{},s=t.header??{},{themeMode:c,themeOverrides:d}=Sd(t.theme),u=n.mode??"floating",_=wd(i.defaultLocale),g=i.availableLocales??[i.locale??_],f=Ct(i.locale??_,g,_),m=(t.baseUrl??x.defaultBaseUrl).replace(/\/$/,""),y=(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:y,dataApiBaseUrl:h,userContext:gr(t.userContext),pageContext:hr(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:d,mode:u,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,showSources:o.showSources??!1,features:{files:t.features?.files??qn.files,voice:t.features?.voice??qn.voice,humanInLoop:t.features?.humanInLoop??qn.humanInLoop,tools:t.features?.tools},forms:on(t.forms,f),endpoints:{upload:t.endpoints?.upload??Gn.upload,transcribe:t.endpoints?.transcribe??Gn.transcribe,submitForm:t.endpoints?.submitForm??Gn.submitForm},attachments:{accept:t.composer?.attachments?.accept??Vn.accept,maxBytes:t.composer?.attachments?.maxBytes??Vn.maxBytes,maxCount:t.composer?.attachments?.maxCount??Vn.maxCount},locale:f,defaultLocale:_,availableLocales:g,startMinimized:o.startMinimized??!0,actions:kd(u,s.actions),size:n.size??{},launcher:Md(t.launcher),sound:Cd(a.sound),haptics:Ed(a.haptics),strings:Bn(f,i.strings),stringsOverride:i.strings,composerDisclaimer:l.composerDisclaimer??"",poweredBy:Rd(l.poweredBy),composer:Id(t.composer),modules:Ad(t.modules),tracking:Td(t.tracking,h),storage:t.storage??zn,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function Sd(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function wd(e){return e&&e!=="auto"?e:typeof navigator<"u"&&navigator.language?navigator.language:"en"}function Ct(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function kd(e,t){return t??Qi[e]}function Cd(e){return{enabled:e?.enabled??br.enabled,volume:e?.volume??br.volume,events:e?.events}}function Ed(e){return{enabled:e?.enabled??Zi.enabled,events:e?.events}}function Td(e,t){let n=e?.sampleRate??vr.sampleRate;return{enabled:e?.enabled??vr.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 Rd(e){let n={...{text:`Powered by ${x.displayName}`,href:x.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Id(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function Ad(e){let t=e===void 0?ea:e,n=new Set,o=[];for(let a of t.slice(0,4)){if(!a?.label||!a?.layout)continue;let l=a.contentTags?.filter(Boolean),s=a.id??l?.[0]??a.layout;for(;n.has(s);)s=`${s}-${o.length}`;n.add(s);let c={id:s,label:a.label,layout:a.layout};l&&l.length>0&&(c.contentTags=l),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=a.showGreeting??!0,c.showSearchBar=a.showSearchBar??ta.showSearchBar,c.showRecentConversations=a.showRecentConversations??!0,a.userAvatars&&a.userAvatars.length>0&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let i=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:i}}function on(e,t){var a;if(!e?.length)return Ji;let n=[],o=new Set;for(let l of e){if(!l?.id||o.has(l.id))continue;let s=Gi(l,t),c=(s.fields??[]).filter(u=>!!(u&&u.name&&u.label&&u.type)),d=(Array.isArray(s.on)?s.on:[s.on]).map(Ld).filter(u=>u!==null);c.length===0||d.length===0||(o.add(s.id),n.push({id:s.id,triggers:d,when:s.when,fields:c,title:s.title,description:s.description,submitLabel:s.submitLabel,skippable:s.skippable??!1,frequency:s.frequency??"once",mirrorToContext:s.mirrorToContext??!0,reopenable:s.reopenable??!0,reviewable:s.reviewable??!0}))}let i={};for(let l of n)for(let s of l.triggers)(i[a=s.kind]??(i[a]=[])).push(l);return{list:n,byTrigger:i}}function Ld(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 Md(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??kt.variant,size:e?.size??kt.size,label:e?.label??kt.label,icon:e?.icon??kt.icon,hidden:e?.hidden??kt.hidden,callout:t}}function xr(e,t,n,o){let i=Ct(t,e.availableLocales,e.defaultLocale);if(i===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return i!==e.locale&&(a.locale=i,a.strings=Bn(i,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var Nd=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function Pr(e,t){if(!t)return e;let n={...e};for(let a of Nd){let l=t[a];if(l===void 0)continue;let s=e[a];if(a==="theme"){s===void 0&&(n[a]=l);continue}a!=="i18n"&&(n[a]=na(l,s))}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,i=t.i18n;if(o||i){let a=na(i??{},o);i?.availableLocales!==void 0&&(a.availableLocales=i.availableLocales),i?.defaultLocale!==void 0&&(a.defaultLocale=i.defaultLocale);let l=o?.strings,s=i?.strings;(l||s)&&(a.strings=Od(s,l)),n.i18n=a}return n}function na(e,t){if(!t)return e;let n={...e};for(let[o,i]of Object.entries(t))i!==void 0&&(n[o]=i);return n}function Od(e,t){if(!e)return t;if(!t)return e;let n=Fn(e),o=Fn(t);if(!n&&!o)return{...e,...t};let i={},a=n?e:{en:e},l=o?t:{en:t};for(let[s,c]of Object.entries(a))i[s]={...c};for(let[s,c]of Object.entries(l))i[s]={...i[s],...c};return i}var Dd=["clear","expand","fullscreen","sound","history","language","theme","textSize","close"],dt=e=>e!=="false",ra=e=>e.split(",").map(t=>t.trim()).filter(Boolean),ia=[["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]],aa=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",dt]],sa=[["width","width"],["height","height"]],la=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",dt],["show-reasoning","showReasoning",dt],["show-tool-calls","showToolCalls",dt],["show-sources","showSources",dt]],ca=[["locale","locale"]],$d=new Set(Dd),Hd=e=>ra(e).filter(t=>$d.has(t)),da=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",dt]],_a=[["features-files","files",dt],["features-voice","voice",e=>e],["features-tools","tools",ra]],ua=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],pa=[["user-id","id"],["user-email","email"],["user-name","name"]],ma=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Bd=["launcher-label","callout-text","callout-delay","actions-main","actions-overflow","user-context","page-context"],Fd=[ia,aa,sa,la,ca,da,_a,ua,pa,ma],zd=new Set(["iframe","start-minimized"]),yr=[...Fd.flatMap(e=>e.map(([t])=>t).filter(t=>!zd.has(t))),...Bd];function Kn(e){let t={},n=f=>{let m=e(f);return m===null||m===""?void 0:m};for(let[f,m,y]of ia){let h=n(f);h!==void 0&&(t[m]=y?y(h):h)}let o=ct(n,aa),i=ct(n,sa);(o||i)&&(t.presentation={...o,...i?{size:i}:{}});let a=ct(n,la);a&&(t.behavior=a);let l=ct(n,ca);l&&(t.i18n=l);let s=Wd(e,n);s&&(t.launcher=s);let c=ct(n,_a);c&&(t.features=c);let d=ct(n,ua);d&&(t.endpoints=d);let u=oa(n,pa,"user-context");u&&(t.userContext=u);let _=oa(n,ma,"page-context");_&&(t.pageContext=_);let g=n("actions");return g!==void 0&&(t.header={actions:Hd(g)}),t}function Sr(e){return e?Kn(t=>e[Ud(t)]??null):{}}function Ud(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ct(e,t){let n={};for(let[o,i,a]of t){let l=e(o);l!==void 0&&(n[i]=a?a(l):l)}return Object.keys(n).length>0?n:null}function oa(e,t,n){let o={};for(let[s,c]of t){let d=e(s);d!==void 0&&(o[c]=d)}let i={},a=e(n);if(a)try{let s=JSON.parse(a);s&&typeof s=="object"&&!Array.isArray(s)&&(i=s)}catch{}let l={...i,...o};return Object.keys(l).length>0?l:null}function Wd(e,t){let n=ct(t,da)??{},o=e("launcher-label");o!==null&&(n.label=o);let i=t("callout-text");if(i){let a=Number.parseInt(t("callout-delay")??"",10);n.callout={text:i,...Number.isFinite(a)?{delayMs:a}:{}}}return Object.keys(n).length>0?n:null}var eo,X,ba,Tr,et,fa,xa,Pa,wr,Yn,rn,ya,Rr,kr,Cr,Vd,Jn={},Qn=[],qd=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,to=Array.isArray;function Ke(e,t){for(var n in t)e[n]=t[n];return e}function Ir(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function no(e,t,n){var o,i,a,l={};for(a in t)a=="key"?o=t[a]:a=="ref"?i=t[a]:l[a]=t[a];if(arguments.length>2&&(l.children=arguments.length>3?eo.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)l[a]===void 0&&(l[a]=e.defaultProps[a]);return Xn(e,l,o,i,null)}function Xn(e,t,n,o,i){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++ba,__i:-1,__u:0};return i==null&&X.vnode!=null&&X.vnode(a),a}function ne(e){return e.children}function tt(e,t){this.props=e,this.context=t}function Et(e,t){if(t==null)return e.__?Et(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"?Et(e):null}function Gd(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],i=[],a=Ke({},t);a.__v=t.__v+1,X.vnode&&X.vnode(a),Ar(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??Et(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,Ca(o,a,i),t.__e=t.__=null,a.__e!=n&&Sa(a)}}function Sa(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}),Sa(e)}function ga(e){(!e.__d&&(e.__d=!0)&&et.push(e)&&!Zn.__r++||fa!=X.debounceRendering)&&((fa=X.debounceRendering)||xa)(Zn)}function Zn(){try{for(var e,t=1;et.length;)et.length>t&&et.sort(Pa),e=et.shift(),t=et.length,Gd(e)}finally{et.length=Zn.__r=0}}function wa(e,t,n,o,i,a,l,s,c,d,u){var _,g,f,m,y,h,v,C=o&&o.__k||Qn,b=t.length;for(c=Kd(n,t,C,c,b),_=0;_<b;_++)(f=n.__k[_])!=null&&(g=f.__i!=-1&&C[f.__i]||Jn,f.__i=_,h=Ar(e,f,g,i,a,l,s,c,d,u),m=f.__e,f.ref&&g.ref!=f.ref&&(g.ref&&Lr(g.ref,null,f),u.push(f.ref,f.__c||m,f)),y==null&&m!=null&&(y=m),(v=!!(4&f.__u))||g.__k===f.__k?(c=ka(f,c,e,v),v&&g.__e&&(g.__e=null)):typeof f.type=="function"&&h!==void 0?c=h:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=y,c}function Kd(e,t,n,o,i){var a,l,s,c,d,u=n.length,_=u,g=0;for(e.__k=new Array(i),a=0;a<i;a++)(l=t[a])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[a]=Xn(null,l,null,null,null):to(l)?l=e.__k[a]=Xn(ne,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[a]=Xn(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[a]=l,c=a+g,l.__=e,l.__b=e.__b+1,s=null,(d=l.__i=jd(l,n,c,_))!=-1&&(_--,(s=n[d])&&(s.__u|=2)),s==null||s.__v==null?(d==-1&&(i>u?g--:i<u&&g++),typeof l.type!="function"&&(l.__u|=4)):d!=c&&(d==c-1?g--:d==c+1?g++:(d>c?g--:g++,l.__u|=4))):e.__k[a]=null;if(_)for(a=0;a<u;a++)(s=n[a])!=null&&(2&s.__u)==0&&(s.__e==o&&(o=Et(s)),Ta(s,s));return o}function ka(e,t,n,o){var i,a;if(typeof e.type=="function"){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=ka(i[a],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=Et(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function jd(e,t,n,o){var i,a,l,s=e.key,c=e.type,d=t[n],u=d!=null&&(2&d.__u)==0;if(d===null&&s==null||u&&s==d.key&&c==d.type)return n;if(o>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((d=t[l=i>=0?i--:a++])!=null&&(2&d.__u)==0&&s==d.key&&c==d.type)return l}return-1}function ha(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||qd.test(t)?n:n+"px"}function jn(e,t,n,o,i){var a,l;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||ha(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||ha(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(ya,"$1")),l=t.toLowerCase(),t=l in e||t=="onFocusOut"||t=="onFocusIn"?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[rn]=o[rn]:(n[rn]=Rr,e.addEventListener(t,a?Cr:kr,a)):e.removeEventListener(t,a?Cr:kr,a);else{if(i=="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 va(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Yn]==null)t[Yn]=Rr++;else if(t[Yn]<n[rn])return;return n(X.event?X.event(t):t)}}}function Ar(e,t,n,o,i,a,l,s,c,d){var u,_,g,f,m,y,h,v,C,b,T,K,ae,N,W,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=X.__b)&&u(t);e:if(typeof F=="function")try{if(v=t.props,C=F.prototype&&F.prototype.render,b=(u=F.contextType)&&o[u.__c],T=u?b?b.props.value:u.__:o,n.__c?h=(_=t.__c=n.__c).__=_.__E:(C?t.__c=_=new F(v,T):(t.__c=_=new tt(v,T),_.constructor=F,_.render=Xd),b&&b.sub(_),_.state||(_.state={}),_.__n=o,g=_.__d=!0,_.__h=[],_._sb=[]),C&&_.__s==null&&(_.__s=_.state),C&&F.getDerivedStateFromProps!=null&&(_.__s==_.state&&(_.__s=Ke({},_.__s)),Ke(_.__s,F.getDerivedStateFromProps(v,_.__s))),f=_.props,m=_.state,_.__v=t,g)C&&F.getDerivedStateFromProps==null&&_.componentWillMount!=null&&_.componentWillMount(),C&&_.componentDidMount!=null&&_.__h.push(_.componentDidMount);else{if(C&&F.getDerivedStateFromProps==null&&v!==f&&_.componentWillReceiveProps!=null&&_.componentWillReceiveProps(v,T),t.__v==n.__v||!_.__e&&_.shouldComponentUpdate!=null&&_.shouldComponentUpdate(v,_.__s,T)===!1){t.__v!=n.__v&&(_.props=v,_.state=_.__s,_.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(V){V&&(V.__=t)}),Qn.push.apply(_.__h,_._sb),_._sb=[],_.__h.length&&l.push(_);break e}_.componentWillUpdate!=null&&_.componentWillUpdate(v,_.__s,T),C&&_.componentDidUpdate!=null&&_.__h.push(function(){_.componentDidUpdate(f,m,y)})}if(_.context=T,_.props=v,_.__P=e,_.__e=!1,K=X.__r,ae=0,C)_.state=_.__s,_.__d=!1,K&&K(t),u=_.render(_.props,_.state,_.context),Qn.push.apply(_.__h,_._sb),_._sb=[];else do _.__d=!1,K&&K(t),u=_.render(_.props,_.state,_.context),_.state=_.__s;while(_.__d&&++ae<25);_.state=_.__s,_.getChildContext!=null&&(o=Ke(Ke({},o),_.getChildContext())),C&&!g&&_.getSnapshotBeforeUpdate!=null&&(y=_.getSnapshotBeforeUpdate(f,m)),N=u!=null&&u.type===ne&&u.key==null?Ea(u.props.children):u,s=wa(e,to(N)?N:[N],t,n,o,i,a,l,s,c,d),_.base=t.__e,t.__u&=-161,_.__h.length&&l.push(_),h&&(_.__E=_.__=null)}catch(V){if(t.__v=null,c||a!=null)if(V.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__e=s}else{for(W=a.length;W--;)Ir(a[W]);Er(t)}else t.__e=n.__e,t.__k=n.__k,V.then||Er(t);X.__e(V,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Yd(n.__e,t,n,o,i,a,l,c,d);return(u=X.diffed)&&u(t),128&t.__u?void 0:s}function Er(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Er))}function Ca(e,t,n){for(var o=0;o<n.length;o++)Lr(n[o],n[++o],n[++o]);X.__c&&X.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){X.__e(a,i.__v)}})}function Ea(e){return typeof e!="object"||e==null||e.__b>0?e:to(e)?e.map(Ea):e.constructor!==void 0?null:Ke({},e)}function Yd(e,t,n,o,i,a,l,s,c){var d,u,_,g,f,m,y,h=n.props||Jn,v=t.props,C=t.type;if(C=="svg"?i="http://www.w3.org/2000/svg":C=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((f=a[d])&&"setAttribute"in f==!!C&&(C?f.localName==C:f.nodeType==3)){e=f,a[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(v);e=document.createElementNS(i,C,v.is&&v),s&&(X.__m&&X.__m(t,a),s=!1),a=null}if(C==null)h===v||s&&e.data==v||(e.data=v);else{if(a=C=="textarea"&&v.defaultValue!=null?null:a&&eo.call(e.childNodes),!s&&a!=null)for(h={},d=0;d<e.attributes.length;d++)h[(f=e.attributes[d]).name]=f.value;for(d in h)f=h[d],d=="dangerouslySetInnerHTML"?_=f:d=="children"||d in v||d=="value"&&"defaultValue"in v||d=="checked"&&"defaultChecked"in v||jn(e,d,null,f,i);for(d in v)f=v[d],d=="children"?g=f:d=="dangerouslySetInnerHTML"?u=f:d=="value"?m=f:d=="checked"?y=f:s&&typeof f!="function"||h[d]===f||jn(e,d,f,h[d],i);if(u)s||_&&(u.__html==_.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(_&&(e.innerHTML=""),wa(t.type=="template"?e.content:e,to(g)?g:[g],t,n,o,C=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,l,a?a[0]:n.__k&&Et(n,0),s,c),a!=null)for(d=a.length;d--;)Ir(a[d]);s&&C!="textarea"||(d="value",C=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[d]||C=="progress"&&!m||C=="option"&&m!=h[d])&&jn(e,d,m,h[d],i),d="checked",y!=null&&y!=e[d]&&jn(e,d,y,h[d],i))}return e}function Lr(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(i){X.__e(i,n)}}function Ta(e,t,n){var o,i;if(X.unmount&&X.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Lr(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){X.__e(a,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&Ta(o[i],t,n||typeof e.type!="function");n||Ir(e.__e),e.__c=e.__=e.__e=void 0}function Xd(e,t,n){return this.constructor(e,n)}function Tt(e,t,n){var o,i,a,l;t==document&&(t=document.documentElement),X.__&&X.__(e,t),i=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],l=[],Ar(t,e=(!o&&n||t).__k=no(ne,null,[e]),i||Jn,Jn,t.namespaceURI,!o&&n?[n]:i?null:t.firstChild?eo.call(t.childNodes):null,a,!o&&n?n:i?i.__e:t.firstChild,o,l),Ca(a,e,l)}eo=Qn.slice,X={__e:function(e,t,n,o){for(var i,a,l;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,o||{}),l=i.__d),l)return i.__E=i}catch(s){e=s}throw e}},ba=0,Tr=function(e){return e!=null&&e.constructor===void 0},tt.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ke({},this.state),typeof e=="function"&&(e=e(Ke({},n),this.props)),e&&Ke(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ga(this))},tt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ga(this))},tt.prototype.render=ne,et=[],xa=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Pa=function(e,t){return e.__v.__b-t.__v.__b},Zn.__r=0,wr=Math.random().toString(8),Yn="__d"+wr,rn="__a"+wr,ya=/(PointerCapture)$|Capture$/i,Rr=0,kr=va(!1),Cr=va(!0),Vd=0;var Rt="0.50.3";function Ra(e){return`${x.cssPrefix}:${e}`}function an(e,t,n){e.dispatchEvent(new CustomEvent(Ra(t),{detail:n}))}function Ia(e,t){let o=Object.entries(t).map(([i,a])=>{let l=Ra(i),s=c=>a(c.detail);return e.addEventListener(l,s),[l,s]});return()=>{for(let[i,a]of o)e.removeEventListener(i,a)}}function Ne(){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,Jd(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 Jd(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 _t=B.scope("persistence");function nt(e,t=zn,n){let o=n?`${e}.${n}`:e,i=`${x.cssPrefix}.storageVersion`,a=t.get(i)??void 0,l=a?`.v${a}`:"",s=`${x.cssPrefix}.${o}${l}`,c=`${x.cssPrefix}${l}.visitorId`,d=`${s}.conversationId`,u=`${s}.userPrefs`,_=`${s}.panelOpen`,g=`${s}.panelSize`,f=`${s}.calloutDismissed`,m=`${s}.sidebarCollapsed`,y=`${s}.activeModule`,h=`${s}.historyCount`,v=`${s}.formsDone`,C={getVisitorId(){let b=t.get(c);if(b)return b;let T=Ne();return t.set(c,T),T},setVisitorId(b){_t.debug("setVisitorId (rebind)",{id:b,scope:o}),t.set(c,b)},loadConversationId(){return t.get(d)??void 0},saveConversationId(b){_t.trace("saveConversationId",{id:b,scope:o}),b?t.set(d,b):t.remove(d)},loadUserPrefs(){let b=t.get(u);if(!b)return{};try{let T=JSON.parse(b);return Aa(T)?T:{}}catch(T){return _t.warn("loadUserPrefs parse failed",{error:T}),{}}},saveUserPrefs(b){try{t.set(u,JSON.stringify(b))}catch(T){_t.warn("saveUserPrefs serialise failed",{error:T})}},patchUserPrefs(b){let T=C.loadUserPrefs();C.saveUserPrefs({...T,...b})},loadPanelOpen(){let b=t.get(_);return b==="1"?!0:b==="0"?!1:null},savePanelOpen(b){t.set(_,b?"1":"0")},loadPanelSize(){let b=t.get(g);return b==="normal"||b==="expanded"||b==="fullscreen"?b:null},savePanelSize(b){t.set(g,b)},loadCalloutDismissed(b){if(!b)return!1;let T=t.get(f);return!!T&&T===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(y)||null},saveActiveModule(b){t.set(y,b)},loadHistoryCount(){let b=t.get(h);if(!b)return null;let T=Number.parseInt(b,10);return Number.isFinite(T)&&T>=0?T:null},saveHistoryCount(b){t.set(h,String(b))},loadFormsDone(){let b=t.get(v);if(!b)return{};try{let T=JSON.parse(b);return Aa(T)?T:{}}catch(T){return _t.warn("loadFormsDone parse failed",{error:T}),{}}},saveFormDone(b){try{let T=C.loadFormsDone();T[b]=Date.now(),t.set(v,JSON.stringify(T))}catch(T){_t.warn("saveFormDone serialise failed",{error:T})}},rememberStorageVersion(b){b&&b!==t.get(i)&&(_t.debug("rememberStorageVersion (force-reset on next load)",{version:b}),t.set(i,b))},clearConversation(){t.remove(d)}};return C}function Aa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var La=`: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__-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__-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-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);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__-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)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
2
+ `;var Ma=`*,*: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);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
+ `;var Na=`.__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);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;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:0;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:100dvh;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:0;align-items:stretch;padding:0}:host([data-mode="open"]) .__P__-panel,:host([data-mode="expanded"]) .__P__-panel{width:100vw;height:100dvh;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);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);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>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-date-divider{position:sticky;top:var(--__P__-space-2);z-index:2;display:flex;justify-content:center;align-items:flex-start;height:0;margin:0;pointer-events:none}.__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);opacity:0;pointer-events:none;transition:opacity var(--__P__-dur-base) var(--__P__-ease)}.__P__-list[data-scrolling=true] .__P__-date-pill{opacity:1;pointer-events:auto}@media(prefers-reduced-motion:reduce){.__P__-date-pill{transition:none}}.__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%;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:anywhere;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-end-start-radius:5px}.__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-time{margin-top:3px;padding:0 4px;font-size:calc(11px * var(--__P__-text-scale));line-height:1;color:var(--__P__-fg-muted);user-select:none}.__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;height:40px;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),box-shadow var(--__P__-dur-quick) var(--__P__-ease)}.__P__-textarea:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:1px;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{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);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)}.__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);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 10px;border-radius:var(--__P__-radius-sm);background:var(--__P__-danger-bg);color:var(--__P__-danger-text);font-size:var(--__P__-text-sm);display:flex;align-items:center;gap:var(--__P__-space-2)}.__P__-error button{color:inherit;text-decoration:underline;font-size:var(--__P__-text-sm)}.__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)}.__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__-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)}.__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);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__-module-cta{padding:var(--__P__-space-3);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)}.__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:-4px;left:calc(50% + 6px);min-width:16px;height:16px;padding:0 4px;display:inline-flex;align-items:center;justify-content:center;border-radius:999px;background:var(--__P__-accent);color:var(--__P__-on-accent);font-size:calc(10px * var(--__P__-text-scale));font-weight:600;line-height:1}.__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)}.__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-at{color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);flex-shrink:0}.__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)}.__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);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__-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-label{font-size:var(--__P__-text-sm);font-weight:600;color:var(--__P__-fg)}.__P__-field-req{color:var(--__P__-danger)}.__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;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-form-hint{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);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);cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-skip:hover:not(:disabled){background:var(--__P__-bg-elevated)}.__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)}.__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}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-wrench{display:inline-flex;color:var(--__P__-fg-muted)}.__P__-toolui-wrench svg{width:15px;height:15px}.__P__-toolui-title{font-weight:600;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui-chevron{display:inline-flex;margin-inline-start:auto;color:var(--__P__-fg-muted);transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-toolui-chevron svg{width:16px;height:16px}details.__P__-toolui-collapsible[open]>summary .__P__-toolui-chevron{transform:rotate(180deg)}.__P__-toolui-badge{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:999px;border:1px solid var(--__P__-border);background:var(--__P__-bg);color:var(--__P__-fg-muted);font-size:var(--__P__-text-xs);font-weight:600;white-space:nowrap}.__P__-toolui-badge-accent{border-color:color-mix(in oklab,var(--__P__-warning, #f59e0b) 55%,transparent);background:color-mix(in oklab,var(--__P__-warning, #f59e0b) 12%,transparent);color:var(--__P__-warning, #f59e0b)}.__P__-toolui-status-icon{display:inline-flex}.__P__-toolui-status-icon svg{width:14px;height:14px}.__P__-toolui-status[data-status=awaiting] .__P__-toolui-status-icon{color:var(--__P__-warning, #f59e0b)}.__P__-toolui-status[data-status=responded] .__P__-toolui-status-icon{color:var(--__P__-accent)}.__P__-toolui-status[data-status=completed] .__P__-toolui-status-icon{color:var(--__P__-success, #16a34a)}.__P__-toolui-status[data-status=denied] .__P__-toolui-status-icon{color:#ea580c}.__P__-toolui-status[data-status=error] .__P__-toolui-status-icon{color:var(--__P__-danger, #dc2626)}.__P__-toolui-head{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2)}.__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-label{font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--__P__-fg-muted)}.__P__-toolui-text{margin:0;font-size:var(--__P__-text-base);font-weight:600;color:var(--__P__-fg);line-height:1.4;overflow-wrap:anywhere}.__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;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-toolui-note{margin:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}: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
+ `;var Oa=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
5
+ `;var Da=`: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
+ `;var o_="helpai",r_="#5B5BD6",i_="#FFFFFF",a_="12px",s_="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",Mr=[La,Ma,Na,Oa,Da].join(`
7
+ `).replace(/__P__/g,o_).replaceAll("__BRAND_ACCENT_TEXT__",i_).replaceAll("__BRAND_ACCENT__",r_).replaceAll("__BRAND_RADIUS__",a_).replaceAll("__BRAND_FONT__",s_);var l_=B.scope("mount"),$a=new WeakMap,Ha={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 Ba(e,t){e.style.cssText=Ha[t]}function ut(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function It(e={}){let t=e.position??"flow";l_.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${x.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",x.id),o.style.cssText=Ha[t];let i=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!c_(i,a)){let s=a.createElement("style");s.textContent=Mr,i.appendChild(s)}let l=document.createElement("div");return l.className=`${x.cssPrefix}-app`,i.appendChild(l),{appRoot:l,destroy:()=>o.remove(),hostElement:o,shadowRoot:i}}function c_(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=$a.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(Mr),$a.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function d_(e,t){let n=x.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)}function __(e,t){e.dataset.theme=t}function u_(e,t){let n=x.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 p_(e,t){e.dataset.position=t}function oo(e,t){e.dataset.mode=t}function Fa(e,t){__(e,t.themeMode),d_(e,t.themeOverrides),p_(e,t.position),u_(e,t.size)}var m_=B.scope("iframe"),f_='<!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 Wa(e,t,n="closed",o="floating",i=null){m_.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!i});let a=document.createElement("iframe");a.title=`${x.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Ua(a,t,n,o),(o==="inline"&&i?i:document.body).appendChild(a);let s=a.contentDocument;if(!s)throw new Error("iframe contentDocument unavailable (cross-origin?)");s.open(),s.write(f_),s.close();let c=It({...e,target:s.body}),d=new MutationObserver(()=>{Ua(a,t,c.hostElement.dataset.mode??"closed",o)});return d.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){d.disconnect(),c.destroy(),a.remove()}}}var ro="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",za={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 Ua(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${ro}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${ro}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=`${ro}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",l=t.endsWith("-left")?"left":"right",{w:s,h:c}=za[n]??za.open;e.style.cssText=`${ro}position:fixed;${a}:16px;${l}:16px;width:${s};height:${c};`}var At=class{constructor(){q(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 i of o)try{i(n)}catch{}}clear(){this.handlers.clear()}};var Lt,pe,Nr,Va,sn=0,Qa=[],fe=X,qa=fe.__b,Ga=fe.__r,Ka=fe.diffed,ja=fe.__c,Ya=fe.unmount,Xa=fe.__;function ao(e,t){fe.__h&&fe.__h(pe,e,sn||t),sn=0;var n=pe.__H||(pe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function R(e){return sn=1,g_(Za,e)}function g_(e,t,n){var o=ao(Lt++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Za(void 0,t),function(s){var c=o.__N?o.__N[0]:o.__[0],d=o.t(c,s);c!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=pe,!pe.__f)){var i=function(s,c,d){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(g){return g.__c});if(u.every(function(g){return!g.__N}))return!a||a.call(this,s,c,d);var _=o.__c.props!==s;return u.some(function(g){if(g.__N){var f=g.__[0];g.__=g.__N,g.__N=void 0,f!==g.__[0]&&(_=!0)}}),a&&a.call(this,s,c,d)||_};pe.__f=!0;var a=pe.shouldComponentUpdate,l=pe.componentWillUpdate;pe.componentWillUpdate=function(s,c,d){if(this.__e){var u=a;a=void 0,i(s,c,d),a=u}l&&l.call(this,s,c,d)},pe.shouldComponentUpdate=i}return o.__N||o.__}function E(e,t){var n=ao(Lt++,3);!fe.__s&&Dr(n.__H,t)&&(n.__=e,n.u=t,pe.__H.__h.push(n))}function ln(e,t){var n=ao(Lt++,4);!fe.__s&&Dr(n.__H,t)&&(n.__=e,n.u=t,pe.__h.push(n))}function O(e){return sn=5,ke(function(){return{current:e}},[])}function ke(e,t){var n=ao(Lt++,7);return Dr(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function H(e,t){return sn=8,ke(function(){return e},t)}function h_(){for(var e;e=Qa.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(io),t.__h.some(Or),t.__h=[]}catch(n){t.__h=[],fe.__e(n,e.__v)}}}fe.__b=function(e){pe=null,qa&&qa(e)},fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Xa&&Xa(e,t)},fe.__r=function(e){Ga&&Ga(e),Lt=0;var t=(pe=e.__c).__H;t&&(Nr===pe?(t.__h=[],pe.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(io),t.__h.some(Or),t.__h=[],Lt=0)),Nr=pe},fe.diffed=function(e){Ka&&Ka(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Qa.push(t)!==1&&Va===fe.requestAnimationFrame||((Va=fe.requestAnimationFrame)||v_)(h_)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Nr=pe=null},fe.__c=function(e,t){t.some(function(n){try{n.__h.some(io),n.__h=n.__h.filter(function(o){return!o.__||Or(o)})}catch(o){t.some(function(i){i.__h&&(i.__h=[])}),t=[],fe.__e(o,n.__v)}}),ja&&ja(e,t)},fe.unmount=function(e){Ya&&Ya(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{io(o)}catch(i){t=i}}),n.__H=void 0,t&&fe.__e(t,n.__v))};var Ja=typeof requestAnimationFrame=="function";function v_(e){var t,n=function(){clearTimeout(o),Ja&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Ja&&(t=requestAnimationFrame(n))}function io(e){var t=pe,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),pe=t}function Or(e){var t=pe;e.__c=e.__(),pe=t}function Dr(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Za(e,t){return typeof t=="function"?t(e):t}var b_=Symbol.for("preact-signals");function _o(){if(je>1)je--;else{var e,t=!1;for((function(){var i=lo;for(lo=void 0;i!==void 0;)i.S.v===i.v&&(i.S.i=i.i),i=i.o})();cn!==void 0;){var n=cn;for(cn=void 0,so++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ns(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=o}}if(so=0,je--,t)throw e}}function Mt(e){if(je>0)return e();$r=++x_,je++;try{return e()}finally{_o()}}var se=void 0;function dn(e){var t=se;se=void 0;try{return e()}finally{se=t}}var es,cn=void 0,je=0,so=0,x_=0,$r=0,lo=void 0,co=0;function ts(e){if(se!==void 0){var t=e.n;if(t===void 0||t.t!==se)return t={i:0,S:e,p:se.s,n:void 0,t:se,e:void 0,x:void 0,r:t},se.s!==void 0&&(se.s.n=t),se.s=t,e.n=t,32&se.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=se.s,t.n=void 0,se.s.n=t,se.s=t),t}}function he(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}he.prototype.brand=b_;he.prototype.h=function(){return!0};he.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:dn(function(){var o;(o=t.W)==null||o.call(t)}))};he.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&&dn(function(){var i;(i=t.Z)==null||i.call(t)}))}};he.prototype.subscribe=function(e){var t=this;return Ye(function(){var n=t.value;dn(function(){return e(n)})},{name:"sub"})};he.prototype.valueOf=function(){return this.value};he.prototype.toString=function(){return this.value+""};he.prototype.toJSON=function(){return this.value};he.prototype.peek=function(){var e=this;return dn(function(){return e.value})};Object.defineProperty(he.prototype,"value",{get:function(){var e=ts(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(so>100)throw new Error("Cycle detected");(function(n){je!==0&&so===0&&n.l!==$r&&(n.l=$r,lo={S:n,v:n.v,i:n.i,o:lo})})(this),this.v=e,this.i++,co++,je++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{_o()}}}});function $(e,t){return new he(e,t)}function ns(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 os(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 rs(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 pt(e,t){he.call(this,void 0,t),this.x=e,this.s=void 0,this.g=co-1,this.f=4}pt.prototype=new he;pt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===co))return!0;if(this.g=co,this.f|=1,this.i>0&&!ns(this))return this.f&=-2,!0;var e=se;try{os(this),se=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 se=e,rs(this),this.f&=-2,!0};pt.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)}he.prototype.S.call(this,e)};pt.prototype.U=function(e){if(this.t!==void 0&&(he.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)}};pt.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(pt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ts(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function _n(e,t){return new pt(e,t)}function is(e){var t=e.m;if(e.m=void 0,typeof t=="function"){je++;var n=se;se=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Hr(e),o}finally{se=n,_o()}}}function Hr(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,is(e)}function P_(e){if(se!==this)throw new Error("Out-of-order effect");rs(this),se=e,this.f&=-2,8&this.f&&Hr(this),_o()}function Nt(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,es&&es.push(this)}Nt.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()}};Nt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,is(this),os(this),je++;var e=se;return se=this,P_.bind(this,e)};Nt.prototype.N=function(){2&this.f||(this.f|=2,this.u=cn,cn=this)};Nt.prototype.d=function(){this.f|=8,1&this.f||Hr(this)};Nt.prototype.dispose=function(){this.d()};function Ye(e,t){var n=new Nt(e,t);try{n.c()}catch(i){throw n.d(),i}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var as,mo,uo,y_=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var ss=[];Ye(function(){as=this.N})();function Ot(e,t){X[e]=t.bind(null,X[e]||function(){})}function po(e){if(uo){var t=uo;uo=void 0,t()}uo=e&&e.S()}function ls(e){var t=this,n=e.data,o=un(n);o.value=n;var i=ke(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=_n(function(){var f=o.value.value;return f===0?0:f===!0?"":f||""}),u=_n(function(){return!Array.isArray(d.value)&&!Tr(d.value)}),_=Ye(function(){if(this.N=cs,u.value){var f=d.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),g=t.__$u.d;return t.__$u.d=function(){_(),g.call(this)},[u,d]},[]),a=i[0],l=i[1];return a.value?l.peek():l.value}ls.displayName="ReactiveTextNode";Object.defineProperties(he.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ls},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Ot("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var i in o)if(i!=="children"){var a=o[i];a instanceof he&&(n||(t.__np=n={}),n[i]=a,o[i]=a.peek())}}e(t)});Ot("__r",function(e,t){if(e(t),t.type!==ne){po();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(i,a){var l;return Ye(function(){l=this},{name:a}),l.c=i,l})(function(){var i;y_&&((i=n.y)==null||i.call(n)),o.__$f|=1,o.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),mo=o,po(n)}});Ot("__e",function(e,t,n,o){po(),mo=void 0,e(t,n,o)});Ot("diffed",function(e,t){po(),mo=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,i=t.props;if(o){var a=n.U;if(a)for(var l in a){var s=a[l];s!==void 0&&!(l in o)&&(s.d(),a[l]=void 0)}else a={},n.U=a;for(var c in o){var d=a[c],u=o[c];d===void 0?(d=S_(n,c,u,i),a[c]=d):d.o(u,i)}}}e(t)});function S_(e,t,n,o){var i=t in e&&e.ownerSVGElement===void 0,a=$(n);return{o:function(l,s){a.value=l,o=s},d:Ye(function(){this.N=cs;var l=a.value.value;o[t]!==l&&(o[t]=l,i?e[t]=l:l!=null&&(l!==!1||t[4]==="-")?e.setAttribute(t,l):e.removeAttribute(t))})}}Ot("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 i in o){var a=o[i];a&&a.d()}}}var l=t.__np;if(l){var s=t.props;for(var c in l)s[c]=l[c]}t.__np=void 0}else{var d=t.__c;if(d){var u=d.__$u;u&&(d.__$u=void 0,u.d())}}e(t)});Ot("__h",function(e,t,n,o){(o<3||o===9)&&(t.__$f|=2),e(t,n,o)});tt.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var i 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 l in e)if(l!=="__source"&&e[l]!==this.props[l])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function un(e,t){return ke(function(){return $(e,t)},[])}function J(e,t){var n=O(e);return n.current=e,mo.__$f|=4,ke(function(){return _n(function(){return n.current()},t)},[])}var w_=function(e){queueMicrotask(function(){queueMicrotask(e)})};function k_(){Mt(function(){for(var e;e=ss.shift();)as.call(e)})}function cs(){ss.push(this)===1&&(X.requestAnimationFrame||w_)(k_)}function ds(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function _s(e){return ds(e)}function us(e){return!(!ds(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function fo(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 C_=900;function Br(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;if(o==="expanded"||o==="fullscreen"||o==="normal")return o;if(o==="auto"){let i=t.autoSizeBreakpoint??C_;return n>=i?"expanded":"normal"}return"normal"}function pn(e,t,n,o=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&o?o:Br(e.mode,e.size,t);return{panelOpen:a,panelSize:s}}function Dt(){return typeof window>"u"?0:window.innerWidth}var E_="x-public-key",T_="x-ai-agent-deployment-id";function ps(e){return{headers(){let t={};return e.aiAgentDeploymentId&&(t[T_]=e.aiAgentDeploymentId),e.publicKey&&(t[e.publicKeyHeader??E_]=e.publicKey),t}}}var Oe=class extends Error{constructor(n,o,i,a){super(n);q(this,"code",o);q(this,"status",i);q(this,"cause",a);this.name="StreamError"}};var ms=B.scope("parser");async function*Fr(e,t){if(!e.ok){let i=await e.text().catch(()=>"");throw new Oe(`server responded ${e.status}: ${i.slice(0,200)}`,"server",e.status)}if(!e.body)throw new Oe("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:i,value:a}=await n.read();if(i){let s=o.trim();if(s){let c=fs(s);c&&(yield c)}return}o+=a;let l;for(;(l=o.indexOf(`
8
8
 
9
- `))!==-1;){let s=o.slice(0,l);o=o.slice(l+2);let c=ms(s);c&&(yield c)}}}finally{n.releaseLock()}}function ms(e){let t="",n;for(let o of e.split(`
9
+ `))!==-1;){let s=o.slice(0,l);o=o.slice(l+2);let c=fs(s);c&&(yield c)}}}finally{n.releaseLock()}}function fs(e){let t="",n;for(let o of e.split(`
10
10
  `))if(!(o===""||o.startsWith(":"))){if(o.startsWith("data:")){let i=o.slice(5).replace(/^ /,"");t=t?`${t}
11
- ${i}`:i;continue}o.startsWith("id:")&&(n=o.slice(3).trim())}if(!t||t==="[DONE]")return null;try{let o=JSON.parse(t);return ps.trace("chunk",{type:o.type,eventId:n}),{chunk:o,eventId:n}}catch(o){return ps.trace("frame parse failed",{err:o,payload:t.slice(0,200)}),null}}function T_(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 fs=e=>e&&Object.keys(e).length>0?e:void 0;function gs(e,t){let n=fs(e),o=fs(t);if(!n&&!o)return;let i={};return n&&(i.user=n),o&&(i.page=o),T_(JSON.stringify(i))}function go(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function R_(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function hs(e){return e.startsWith("tool-")?e.slice(5):e}var De={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",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},vs="context";function bs(e){let n={messages:e.messages.map(i=>({id:i.serverMessageId??i.id,parts:L_(i),role:i.role,createdAt:i.createdAt!==void 0?new Date(i.createdAt).toISOString():void 0})),conversationId:e.conversationId,trigger:e.trigger??"submit-message"};e.messageId&&(n.messageId=e.messageId),e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs);let o=e.tools?.map(A_).filter(i=>i!==null);return o?.length&&(n.data={tools:o}),n}function I_(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function A_(e){return typeof e=="string"?e?{code:e}:null:e?.code?e:null}function L_(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"&&I_(n)){let o={type:R_(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 Q=B.scope("transport"),M_=3,Ss=400,N_=6e4,xs=1e4,Ps=3,O_=new Set([408,425,429,500,502,503,504]);function ys(e){return Ss*2**e+Math.floor(Math.random()*250)}function D_(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}function Fr(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),i=()=>a();t?.addEventListener("abort",i,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",i),n()}})}var ho=class{constructor(t){q(this,"opts",t);q(this,"visitorId");q(this,"conversationId");q(this,"userContext");q(this,"pageContext");q(this,"locale");q(this,"conversationsCache",new Map);q(this,"contentCache",new Map)}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:Rt};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=gs(this.userContext,this.pageContext);return n&&(t[vs]=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,i]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,i);return n.toString()}async handshake(t){Q.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(De.handshake,t,"handshake");return Q.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),H_(n)||Q.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){Q.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let n=new FormData;n.append("file",t,t.name);let o=await this.postForm(this.uploadPath,n,"upload");return Q.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){Q.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${$_(n)}`),o.append("mimeType",n);let i=await this.postForm(this.transcribePath,o,"transcribe");return Q.debug("transcribe \u2190",{textLen:i.text.length}),i}conversationsKey(t){return`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`}peekConversations(t={}){let n=this.conversationsCache.get(this.conversationsKey(t));if(n?.value&&Date.now()-n.at<xs)return n.value}listConversations(t={}){let n=this.conversationsKey(t),o=this.conversationsCache.get(n);if(o&&Date.now()-o.at<xs)return Q.debug("listConversations \u2192 cache",t),o.result;let i={at:Date.now(),result:this.fetchConversations(t).then(a=>(i.value=a,a)).catch(a=>{throw this.conversationsCache.delete(n),a})};return this.conversationsCache.set(n,i),i.result}async fetchConversations(t){let n=new URL(this.url(De.listConversations));t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.limit&&n.searchParams.set("limit",String(t.limit)),t.cursor&&n.searchParams.set("cursor",t.cursor),Q.debug("listConversations \u2192",{visitorId:t.visitorId??this.visitorId,limit:t.limit,cursor:t.cursor});let o=await this.getJson(n.toString(),"listConversations"),i=o.conversations??[];return Q.debug("listConversations \u2190",{count:i.length,nextCursor:o.nextCursor}),{conversations:i.map(a=>({conversationId:a.conversationId,title:a.title,lastMessageAt:a.lastMessageAt,preview:a.preview,canContinue:a.canContinue,unreadCount:a.unreadCount})),nextCursor:o.nextCursor}}async loadConversation(t){let n=new URL(this.url(De.listMessages));n.searchParams.set("conversationId",t),Q.debug("loadConversation \u2192",{conversationId:t,visitorId:this.visitorId});let o=await this.getJson(n.toString(),"loadConversation"),i=o.messages??[];return Q.debug("loadConversation \u2190",{conversationId:o.conversationId,canContinue:o.canContinue,messageCount:i.length,hasSuggestions:!!o.suggestions}),{conversationId:o.conversationId,canContinue:o.canContinue??!0,messages:i,agent:o.agent,suggestions:o.suggestions}}async markRead(t){if(!(!this.visitorId||!t)){this.conversationsCache.clear(),Q.debug("markRead \u2192",{conversationId:t,visitorId:this.visitorId});try{await this.postJson(De.markRead,{conversationId:t},"markRead")}catch(n){Q.debug("markRead failed (non-fatal)",{err:n})}}}listContent(t={}){let n=`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`,o=this.contentCache.get(n);if(o&&Date.now()-o.at<N_)return Q.debug("listContent \u2192 cache",t),o.result;let i=this.fetchContent(t).catch(a=>{throw this.contentCache.delete(n),a});return this.contentCache.set(n,{at:Date.now(),result:i}),i}async fetchContent(t){let n=new URL(this.dataUrl(De.content));for(let[a,l]of Object.entries(t))l!==void 0&&n.searchParams.set(a,Array.isArray(l)?l.join(","):String(l));Q.debug("listContent \u2192",t);let o=await this.getJson(n.toString(),"listContent"),i=(o.items??[]).map(a=>Vi(a,this.locale));return Q.debug("listContent \u2190",{count:i.length,total:o.pagination?.total}),{...o,items:i}}async bootstrap(t){let n=new URL(this.dataUrl(De.bootstrap));t&&n.searchParams.set("conversationId",t),Q.debug("bootstrap \u2192",{conversationId:t??this.conversationId});let o=await this.getJson(n.toString(),"bootstrap"),i=o.forms??[],a=o.formSubmissions??[];return Q.debug("bootstrap \u2190",{forms:i.length,formSubmissions:a.length}),{forms:i,formSubmissions:a}}async saveUserPrefs(t){Q.debug("saveUserPrefs \u2192",{visitorId:this.visitorId,conversationId:this.conversationId,settingsKeys:Object.keys(t)});let n=await this.postJson(De.updateSettings,{userPrefs:t},"saveUserPrefs");return Q.debug("saveUserPrefs \u2190",{ok:n.ok}),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??De.submitForm}async submitForm(t){Q.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){Q.debug("submitForm failed (non-fatal)",{err:n})}}sendMessage(t){this.conversationsCache.clear(),Q.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageId:t.messageId,messageCount:t.messages.length,trigger:t.trigger,tools:t.data?.tools?.map(l=>l.code)});let n=new AbortController,o=new Set;return{iter:this.runStream(t,n,o),cancel:()=>this.cancelStream(n,t.conversationId)}}resumeStream(){let t=new AbortController,n=new Set;return{iter:this.resumeStreamGen(t,n,!0),cancel:()=>t.abort()}}async*runStream(t,n,o){(yield*this.drain(this.openMessageStream(t,n.signal),o,n))||(yield*this.resumeStreamGen(n,o,!1))}async*resumeStreamGen(t,n,o){for(let i=1;i<=M_&&!t.signal.aborted;i++){if((!o||i>1)&&(await Fr(Ss*i,t.signal),t.signal.aborted))return;let a;try{a=await this.fetchImpl(this.resumeUrl(n.size),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:t.signal})}catch(s){if(t.signal.aborted)return;Q.debug("resume fetch failed \u2014 retrying",{attempt:i,err:s});continue}if(a.status===204||!a.ok){Q.debug("resume \u2192 no in-flight stream",{status:a.status});return}let l=n.size;if(yield*this.drain(Br(a,t.signal),n,t))return;if(n.size===l){Q.debug("resume \u2192 stream closed with no new events; nothing to resume");return}}if(!t.signal.aborted)throw new Oe("stream incomplete after resume attempts","server")}async*drain(t,n,o){try{for await(let i of t){if(o.signal.aborted)return!0;if(i.eventId){if(n.has(i.eventId))continue;n.add(i.eventId)}if(yield i,i.chunk.type==="finish"||i.chunk.type==="error")return!0}}catch(i){if(o.signal.aborted)return!0;if(i instanceof Oe&&i.status!==void 0)throw i;Q.debug("stream segment dropped",{err:i})}return!1}cancelStream(t,n){t.signal.aborted||(Q.debug("cancel stream",{conversationId:n,visitorId:this.visitorId}),t.abort(),!(!this.visitorId||!n)&&this.fetchImpl(this.url(De.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({})),keepalive:!0}).catch(o=>Q.debug("cancel POST failed (non-fatal)",{err:o})))}async*openMessageStream(t,n){let o=await this.fetchImpl(this.url(De.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"text/event-stream","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});yield*Br(o,n)}resumeUrl(t){let n=new URL(this.withEnvelopeQuery(De.streamResume));return n.searchParams.set("resumeAt",String(t)),n.toString()}async postJson(t,n,o){let i=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(i,o)}async postForm(t,n,o){let i=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n)});return this.assertOk(i,o)}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[i,a]=t(),l;try{l=await this.fetchImpl(i,a)}catch(c){if(o>=Ps)throw new Oe(`${n} failed: network error`,"network",void 0,c);Q.debug("request network error \u2014 retrying",{label:n,attempt:o}),await Fr(ys(o));continue}if(l.ok||!O_.has(l.status)||o>=Ps)return l;let s=D_(l.headers)??ys(o);Q.debug("request retryable status \u2014 retrying",{label:n,status:l.status,attempt:o,wait:s}),await Fr(s)}}async assertOk(t,n){if(!t.ok)throw new Oe(`${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 $_(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 H_(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.conversationId=="string"}function ws(e,t){let n=e?[{kind:"text",id:"t0",textSig:$(e),doneSig:$(!0)}]:[];return{id:Ne(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:$(n)}}function Ur(){return{id:Ne(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:$([])}}function ks(e){let t=Ne();return B_({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function B_(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,partsSig:$(e.parts.map(F_))}}function Wr(e){let t=e.parts.map((n,o)=>n.type==="text"?{kind:"text",id:`${e.id}-t${o}`,textSig:$(n.text),doneSig:$(!0)}:n.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${o}`,textSig:$(n.text),doneSig:$(n.state!=="streaming")}:n.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${o}`}:n.type==="file"?{kind:"file",url:n.url,mediaType:n.mediaType}:n.type==="source-url"?{kind:"source",sourceId:n.sourceId,url:n.url,title:n.title}:n.type==="source-document"?{kind:"source",sourceId:n.sourceId,title:n.title,filename:n.filename,mediaType:n.mediaType}:n.type.startsWith("tool-")?{kind:"tool",toolCallId:n.toolCallId,toolName:hs(n.type),inputPartialSig:$(""),inputSig:$(n.input),outputSig:$(n.output),errorSig:$(n.errorText),stateSig:$(n.state),approvalSig:$(n.approval)}:null).filter(n=>n!==null);return{id:e.id,role:e.role,serverMessageId:e.id,createdAt:go(e.createdAt)??Date.now(),status:"complete",partsSig:$(t)}}function Cs(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,parts:e.partsSig.value.map(z_)}}function Vr(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function F_(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:$(e.text),doneSig:$(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,inputPartialSig:$(e.inputPartial),inputSig:$(e.input),outputSig:$(e.output),errorSig:$(e.error),stateSig:$(e.state),approvalSig:$(e.approval)}:e}function z_(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,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 Es=B.scope("reducer"),vo=class{constructor(t){q(this,"messagesSig",t);q(this,"active",null)}attach(t){this.active=t}detach(){this.active=null}apply(t){let n=this.active;if(n)switch(t.type){case"start":t.messageId&&(n.serverMessageId=t.messageId);return;case"finish-step":return;case"start-step":mn(n,{kind:"step-start",id:`ss${n.partsSig.value.length}`});return;case"finish":Es.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":Es.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"text-start":$t(n,"text",t.id);return;case"text-delta":{let o=$t(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":$t(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":$t(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=$t(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":$t(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-output-available":case"tool-output-error":case"tool-output-denied":case"tool-approval-request":U_(n,t);return;case"file":mn(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":Ts(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":Ts(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-notification":return;default:{let o=t}}}bumpDone(t){t.partsSig.value=[...t.partsSig.value],this.messagesSig.value=[...this.messagesSig.value]}};function $t(e,t,n){let o=e.partsSig.value.find(a=>a.kind===t&&a.id===n);if(o)return o;let i={kind:t,id:n,textSig:$(""),doneSig:$(!1)};return mn(e,i),i}function mt(e,t,n){let o=e.partsSig.value.find(a=>a.kind==="tool"&&a.toolCallId===t);if(o)return o;let i={kind:"tool",toolCallId:t,toolName:n??"tool",inputPartialSig:$(""),inputSig:$(void 0),outputSig:$(void 0),errorSig:$(void 0),stateSig:$("input-streaming"),approvalSig:$(void 0)};return mn(e,i),i}function mn(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Ts(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||mn(e,t)}function U_(e,t){switch(t.type){case"tool-input-start":mt(e,t.toolCallId,t.toolName);return;case"tool-input-delta":{let n=mt(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=mt(e,t.toolCallId,t.toolName);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-approval-request":{let n=mt(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=mt(e,t.toolCallId);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=mt(e,t.toolCallId);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=mt(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}var Rs=B.scope("feedback:audio"),bo=class{constructor(){q(this,"ctx",null);q(this,"master",null);q(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){Rs.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 i=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((l,s)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=l;let d=n.createGain(),u=i+s*a;d.gain.setValueAtTime(1e-4,u),d.gain.exponentialRampToValueAtTime(t.peakGain,u+.005),d.gain.exponentialRampToValueAtTime(1e-4,u+a),c.connect(d).connect(o),c.start(u),c.stop(u+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let i=await this.getBuffer(t);if(!i)return;let a=n.createBufferSource();a.buffer=i,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,i=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=>(Rs.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,i),i}};var Is={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},As={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 ot=null,xo=0;function W_(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function V_(){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=`__${x.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 Ls(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(W_())try{navigator.vibrate(e);return}catch{}if(ot||(ot=V_()),!!ot)try{ot.label.click()}catch{}}}function Ms(){xo++;let e=!1;return()=>{e||(e=!0,xo=Math.max(0,xo-1),xo===0&&ot&&(ot.input.remove(),ot.label.remove(),ot=null))}}var q_=B.scope("feedback"),G_=100,Po=class{constructor(t,n){q(this,"mutedSig",$(!1));q(this,"audio",new bo);q(this,"releaseHaptics");q(this,"sound");q(this,"haptics");q(this,"lastPlayed",new Map);q(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=Ms(),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<G_}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(i=>q_.warn("audio play failed",{err:i,url:n}));return}let o=As[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?Is[t]:n;Ls(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}};function ft(e,t){return e instanceof Oe&&e.status===429?t.errorRateLimited:t.errorGeneric}var K_=0;function r(e,t,n,o,i,a){t||(t={});var l,s,c=t;if("ref"in c)for(s in c={},t)s=="ref"?l=t[s]:c[s]=t[s];var d={type:e,props:c,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--K_,__i:-1,__u:0,__source:i,__self:a};if(typeof e=="function"&&(l=e.defaultProps))for(s in l)c[s]===void 0&&(c[s]=l[s]);return X.vnode&&X.vnode(d),d}var D={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},fn=`${x.cssPrefix}-icon-dir`,j_=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),Ue=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M18 6 6 18M6 6l12 12"})}),Ns=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M12 5v14M5 12h14"})}),Os=()=>r("svg",{...D,class:fn,"aria-hidden":"true",children:[r("path",{d:"m22 2-7 20-4-9-9-4Z"}),r("path",{d:"M22 2 11 13"})]}),Ds=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M12 19V5M5 12l7-7 7 7"})}),$s=()=>r("svg",{...D,class:fn,"aria-hidden":"true",children:r("path",{d:"M3 20V4l18 8-18 8Z"})}),Ht=()=>r("svg",{...D,class:fn,"aria-hidden":"true",children:r("path",{d:"m9 18 6-6-6-6"})}),Hs=()=>r("svg",{...D,"aria-hidden":"true",children:r("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Bs=()=>r("svg",{...D,"aria-hidden":"true",children:r("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"})}),Fs=()=>r("svg",{...D,"aria-hidden":"true",children:[r("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),r("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),zs=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),Us=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Ws=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),Vs=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),qs=()=>r("svg",{...D,"aria-hidden":"true",viewBox:"0 0 10 10",children:r("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),Gs=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),r("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),r("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),Ks=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),js=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),Ys=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),r("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),Xs=()=>r("svg",{...D,class:fn,"aria-hidden":"true",children:r("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),gn=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M20 6 9 17l-5-5"})}),Js=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M3 3v6h6"}),r("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),r("path",{d:"M12 7v5l3 2"})]}),Qs=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("path",{d:"M2 12h20"}),r("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"})]}),hn=()=>r("svg",{...D,class:fn,"aria-hidden":"true",children:r("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),Zs=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M12 20h9"}),r("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),yo=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"m6 9 6 6 6-6"})}),el=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),r("path",{d:"M14 2v6h6"})]}),Y_=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),r("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),qr=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),Gr=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),r("path",{d:"M12 17h.01"})]}),X_=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"m15 4 3 3-9 9-3-3z"}),r("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),J_=()=>r("svg",{...D,"aria-hidden":"true",children:[r("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),r("path",{d:"M12 8V4"}),r("circle",{cx:"12",cy:"3",r:"1"}),r("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),Q_=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),r("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),r("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),r("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),Z_=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("circle",{cx:"12",cy:"12",r:"4"}),r("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"})]}),Kr=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3"})]}),tl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),nl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M3 9.5 12 3l9 6.5"}),r("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),ol=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"m3 11 15-5v12L3 13z"}),r("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),r("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),r("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),vn=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),r("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),rl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"4"}),r("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"})]}),il=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),al=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 3v18"}),r("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),eu=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),r("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),r("path",{d:"m20 20-4.4-4.4"})]}),tu=()=>r("svg",{...D,"aria-hidden":"true",children:[r("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"}),r("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),nu=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M4 18h16"}),r("path",{d:"M5 18a7 7 0 0 1 14 0"}),r("path",{d:"M12 8V6"}),r("path",{d:"M10 6h4"})]}),ou=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),r("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),r("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),r("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"})]}),sl=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M14.7 6.3a4 4 0 0 0-5.4 5.3L3 18l3 3 6.4-6.3a4 4 0 0 0 5.3-5.4l-2.7 2.7-2.6-.7-.7-2.6z"})}),ll=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 7v5l3 2"})]}),cl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),dl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"m15 9-6 6M9 9l6 6"})]}),_l={chat:j_,message:qr,bubbles:vn,spark:Y_,wand:X_,bot:J_,help:Gr,lifebuoy:Z_,headset:Q_,search:eu,sparkles:tu,concierge:nu,wave:ou};var L=x.cssPrefix,w={launcher:`${L}-launcher`,callout:`${L}-callout`,calloutDismiss:`${L}-callout-dismiss`,panel:`${L}-panel`,panelHeader:`${L}-panel-header`,resizeGrip:`${L}-resize-grip`,scrollToBottom:`${L}-scroll-to-bottom`,actionHistory:`${L}-action-history`,actionClose:`${L}-action-close`,langSegment:`${L}-lang-segment`,composer:`${L}-composer`,composerInput:`${L}-composer-input`,composerSend:`${L}-composer-send`,composerStop:`${L}-composer-stop`,composerAttach:`${L}-composer-attach`,composerFileInput:`${L}-composer-file-input`,composerVoice:`${L}-composer-voice`,attachmentChip:`${L}-attachment-chip`,attachmentRemove:`${L}-attachment-remove`,suggestion:`${L}-suggestion`,messageBubble:`${L}-message`,messageRetry:`${L}-message-retry`,historyPane:`${L}-history-pane`,historyBack:`${L}-history-back`,historyItem:`${L}-history-item`,sidebar:`${L}-sidebar`,sidebarToggle:`${L}-sidebar-toggle`,sidebarNewConversation:`${L}-sidebar-new-conversation`,sidebarItem:`${L}-sidebar-item`,messengerHome:`${L}-messenger-home`,modulesEmpty:`${L}-modules-empty`,tab:`${L}-tab`,tabBadge:`${L}-tab-badge`,homeView:`${L}-home-view`,homeGreeting:`${L}-home-greeting`,homeBrand:`${L}-home-brand`,backHeader:`${L}-back-header`,contentView:`${L}-content-view`,contentScroll:`${L}-content-scroll`,homeSearch:`${L}-home-search`,helpSearch:`${L}-help-search`,homeRecent:`${L}-home-recent`,homeContentRow:`${L}-home-content-row`,helpArticle:`${L}-help-article`,newsItem:`${L}-news-item`,formGate:`${L}-form-gate`,formDone:`${L}-form-done`,formDoneToggle:`${L}-form-done-toggle`,formAnswers:`${L}-form-answers`,formFill:`${L}-form-fill`,formSubmit:`${L}-form-submit`,formSkip:`${L}-form-skip`,formField:`${L}-form-field`,toolAskInput:`${L}-tool-ask-input`,toolInputSubmit:`${L}-tool-input-submit`,toolInputSkip:`${L}-tool-input-skip`,toolApproval:`${L}-tool-approval`,toolApprove:`${L}-tool-approve`,toolReject:`${L}-tool-reject`,toolEdit:`${L}-tool-edit`,toolDecision:`${L}-tool-decision`,toolCall:`${L}-tool-call`,source:`${L}-source`};function ve(e,t){return`${e}-${t}`}var So=x.cssPrefix;function ul({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:i}){let a=t.variant!=="circle"&&!!t.label;return r("button",{type:"button",class:`${So}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":i?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":w.launcher,onClick:e,"aria-label":n.launcherOpen,children:[ru(t.icon),a?r("span",{class:`${So}-fab-label`,children:we(n,t.label??"")}):null]})}function ru(e){let t=_l[e];return t?r(t,{}):r(iu,{source:e})}function iu({source:e}){return r("span",{ref:t=>{t&&au(t,e)},"aria-hidden":"true"})}function au(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 pl({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:i}){let[a,l]=R(!1);return E(()=>{let s=setTimeout(()=>l(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),E(()=>{if(!a||e.autoDismissMs<=0)return;let s=setTimeout(i,e.autoDismissMs);return()=>clearTimeout(s)},[a,e.autoDismissMs,i]),a?r("div",{class:`${So}-callout`,role:"status","data-shape":e.shape,"data-position":su(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":w.callout,children:[r("span",{children:we(n,e.text)}),r("button",{type:"button",class:`${So}-callout-close`,onClick:i,"aria-label":o,title:o,"data-testid":w.calloutDismiss,children:r(Ue,{})})]}):null}function su(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function wo({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:i,strings:a}){let l=x.cssPrefix,s=O(null);if(E(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${l}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${l}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${l}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${l}-resize-max-h`,t.maxHeight),o&&(m.setProperty(`--${l}-widget-w`,`${o.width}px`),m.setProperty(`--${l}-widget-h`,`${o.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,l,o]),!e)return null;let c=n.startsWith("top-"),d=n.endsWith("-right"),u=`${l}-resize-grip ${l}-resize-grip--${c?"bottom":"top"}-${d?"left":"right"}`,_=m=>{if(!e)return;let y=m.currentTarget,h=e.getBoundingClientRect();s.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:h.width,startH:h.height,dirX:d?-1:1,dirY:c?1:-1},y.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()},f=m=>{let y=s.current;if(!y||m.pointerId!==y.pointerId||!e)return;let h=(m.clientX-y.startX)*y.dirX,v=(m.clientY-y.startY)*y.dirY;e.style.setProperty(`--${l}-widget-w`,`${y.startW+h}px`),e.style.setProperty(`--${l}-widget-h`,`${y.startH+v}px`)},g=m=>{let y=s.current;if(!y||m.pointerId!==y.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let h=e.getBoundingClientRect();i({width:Math.round(h.width),height:Math.round(h.height)}),s.current=null};return r("div",{class:u,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:_,onPointerMove:f,onPointerUp:g,onPointerCancel:g,"data-testid":w.resizeGrip,children:r(qs,{})})}var gt=x.cssPrefix,lu=`.${gt}-header, .${gt}-back-header, .${gt}-home-hero`,cu='button, a, input, textarea, select, [role="tab"], [contenteditable]',ml=56;function ko(e,t){E(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,d)=>Math.min(d,Math.max(-d,c)),i=null,a=c=>{let d=c.target;if(!(d instanceof Element)||!d.closest(lu)||d.closest(cu))return;let u=e.getBoundingClientRect();i={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${gt}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${gt}-modal-dy`)),maxX:(window.innerWidth+u.width)/2-ml,maxY:(window.innerHeight+u.height)/2-ml},e.dataset.dragging="true",c.preventDefault()},l=c=>{if(!i||c.pointerId!==i.id)return;let d=o(i.dx+c.clientX-i.x,i.maxX),u=o(i.dy+c.clientY-i.y,i.maxY);e.style.setProperty(`--${gt}-modal-dx`,`${d}px`),e.style.setProperty(`--${gt}-modal-dy`,`${u}px`)},s=c=>{!i||c.pointerId!==i.id||(i=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",l),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[e,t])}function bn(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 Co(e,t,n){return bn("close",e,t)?n.includes("close"):!1}function fl(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var du='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function Eo(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(du)].filter(s=>s.offsetParent!==null||s===document.activeElement);if(o.length===0){n.preventDefault();return}let i=o[0],a=o[o.length-1];if(!i||!a)return;let l=e.getRootNode().activeElement;n.shiftKey&&l===i?(n.preventDefault(),a.focus()):!n.shiftKey&&l===a&&(n.preventDefault(),i.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function To(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var jr=x.cssPrefix;function gl({agent:e,strings:t}){let n=e.status??"online",o=we(t,e.name),i=e.title?we(t,e.title):null;return r("div",{class:`${jr}-agent`,children:[r("div",{class:`${jr}-agent-avatar`,"data-status":n,children:e.avatar?r("img",{src:e.avatar,alt:""}):r("span",{children:To(o)})}),r("div",{class:`${jr}-agent-meta`,children:[r("strong",{children:o}),i?r("span",{children:i}):null]})]})}var hl=B.scope("attachments");function Ro(e,t,n){let o=uu(e),i=[],a=[],l=fu(n.accept),s=t.reduce((d,u)=>d+u.size,0),c=t.length;for(let d of o){let u=_u(d,c,s,n,l);if(u){a.push({file:d,reason:u});continue}i.push(mu(d)),s+=d.size,c+=1}return(i.length||a.length)&&hl.debug("ingest",{accepted:i.length,rejected:a.map(d=>({name:d.file.name,reason:d.reason}))}),{accepted:i,rejected:a}}function Yr(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){hl.debug("revokeObjectURL failed",{error:t})}}function _u(e,t,n,o,i){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":gu(e,i)?null:"mime"}function uu(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:pu(t)).filter(t=>t!==null):[]}function pu(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function mu(e){return{file:e,id:Ne(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function fu(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 gu(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),i=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?i.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var xn=x.cssPrefix;function vl({attachment:e,onRemove:t}){let n=e.mediaType.startsWith("image/");return r("span",{class:`${xn}-attachment-chip`,title:e.name,"data-testid":ve(w.attachmentChip,e.id),children:[n?r("img",{class:`${xn}-attachment-thumb`,src:e.previewUrl,alt:""}):r("span",{class:`${xn}-attachment-thumb`,"aria-hidden":"true",children:r(el,{})}),r("span",{class:`${xn}-attachment-name`,children:e.name}),r("button",{type:"button",class:`${xn}-attachment-remove`,onClick:t,"aria-label":`Remove ${e.name}`,"data-testid":ve(w.attachmentRemove,e.id),children:r(Ue,{})})]})}var Xr={isSupported:!1,start:()=>{},stop:()=>{}};function Jr(e,t,n){return e==="disabled"?Xr:e==="server"?xu(n):hu(t)}function hu(e){let t=vu();if(!t)return Xr;let n=null;return{isSupported:!0,start(o,i){n=new t,n.continuous=!0,n.interimResults=!0,n.lang=e,n.addEventListener("result",l=>{let s=l,c="",d=!1;for(let u=s.resultIndex;u<s.results.length;u++){let _=s.results[u];_&&(c+=_[0].transcript,_.isFinal&&(d=!0))}o(c,d)});let a=()=>{n=null,i()};n.addEventListener("end",a),n.addEventListener("error",a),n.start()},stop(){n?.stop()}}}function vu(){let e=globalThis;return e.SpeechRecognition??e.webkitSpeechRecognition}var bu=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function xu(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Xr;let t=null,n=null,o=[],i=()=>{for(let a of n?.getTracks()??[])a.stop();n=null};return{isSupported:!0,async start(a,l){try{n=await navigator.mediaDevices.getUserMedia({audio:!0});let s=Pu();t=new MediaRecorder(n,s?{mimeType:s}:void 0),o=[],t.addEventListener("dataavailable",c=>{c.data.size>0&&o.push(c.data)}),t.addEventListener("stop",async()=>{let c=t?.mimeType??"audio/webm";i();let d=new Blob(o,{type:c});o=[];try{let{text:u}=await e(d,c);u&&a(u,!0)}catch{}finally{l()}}),t.start()}catch{i(),l()}},stop(){t?.stop()}}}function Pu(){for(let e of bu)if(MediaRecorder.isTypeSupported(e))return e}var Ae=x.cssPrefix,ht=B.scope("composer");function Bt(e){return e.reduce((t,n)=>t+n.size,0)}var yu={arrowUp:Ds,paperPlane:Os,send:$s,chevron:Ht};function bl({options:e,transport:t,feedback:n,bus:o,isStreaming:i,onSend:a,onStop:l,attachApiRef:s}){let c=e.strings,[d,u]=R(""),[_,f]=R([]),[g,m]=R(!1),y=O(null),h=O(null),v=e.features.files,C=e.features.voice,[b,T]=R(()=>Jr(C,e.locale,(k,j)=>t.transcribe(k,j)));E(()=>{g||C==="disabled"||T(Jr(C,e.locale,(k,j)=>t.transcribe(k,j)))},[e.locale,C,t,g]),E(()=>{let k=y.current;if(!k)return;let j=k.getRootNode(),oe="activeElement"in j?j.activeElement:null;oe&&k.closest(`.${Ae}-panel`)?.contains(oe)||k.focus({preventScroll:!0})},[]),E(()=>{let k=y.current;if(k){if(d.length===0){k.style.height="";return}k.style.height="auto",k.style.height=`${Math.min(k.scrollHeight,160)}px`}},[d]);let K=O(_);K.current=_,E(()=>()=>K.current.forEach(Yr),[]),E(()=>{if(s)return s.current={attachFromDrop:k=>{let j=Ro(k,K.current,e.attachments);j.accepted.length!==0&&(ht.info("attach (drop)",{count:j.accepted.length,totalBytes:Bt(j.accepted)}),o.emit("attach",{count:j.accepted.length,totalBytes:Bt(j.accepted)}),f(oe=>[...oe,...j.accepted]))}},()=>{s.current&&(s.current=null)}},[s,e.attachments]),E(()=>{let k=y.current;if(!k)return;let j=k.closest(`.${Ae}-panel`);if(!j)return;let oe=de=>{let _e=de.clipboardData;if(!_e)return;if(v){let S=Ro(_e.items,K.current,e.attachments);if(S.accepted.length>0){de.preventDefault(),ht.info("attach (paste)",{count:S.accepted.length,totalBytes:Bt(S.accepted)}),o.emit("attach",{count:S.accepted.length,totalBytes:Bt(S.accepted)}),f(U=>[...U,...S.accepted]);return}}if(de.target===k)return;let Me=_e.getData("text/plain");Me&&(de.preventDefault(),u(S=>S+Me),k.focus())};return j.addEventListener("paste",oe),()=>j.removeEventListener("paste",oe)},[v,e.attachments,Ae]);let ae=()=>{let k=d.trim();!k&&_.length===0||i||(a(k,_),u(""),f([]))},N=k=>{k.key!=="Enter"||k.shiftKey||k.isComposing||(k.preventDefault(),i?l():ae())},W=k=>{let j=k.target,oe=Ro(j.files,_,e.attachments);oe.accepted.length>0&&(ht.info("attach (file picker)",{count:oe.accepted.length,totalBytes:Bt(oe.accepted)}),o.emit("attach",{count:oe.accepted.length,totalBytes:Bt(oe.accepted)}),f(de=>[...de,...oe.accepted])),j.value=""},F=k=>{ht.info("removeAttachment",{id:k}),o.emit("removeAttachment",{id:k}),f(j=>{let oe=j.find(de=>de.id===k);return oe&&Yr(oe),j.filter(de=>de.id!==k)})},V=O(null),Y=()=>{if(b.isSupported){if(g){let k=V.current?Date.now()-V.current:0;ht.info("voiceStop",{durationMs:k}),o.emit("voiceStop",{durationMs:k}),b.stop(),m(!1),n.play("voiceStop"),V.current=null;return}V.current=Date.now(),ht.info("voiceStart"),o.emit("voiceStart",void 0),m(!0),n.play("voiceStart"),b.start((k,j)=>u(oe=>j?`${oe}${k} `:oe),()=>{if(m(!1),V.current){let k=Date.now()-V.current;ht.debug("voiceStop (auto)",{durationMs:k}),o.emit("voiceStop",{durationMs:k}),V.current=null}})}},be=yu[e.composer.sendButton.icon];return r("div",{class:`${Ae}-composer`,"data-testid":w.composer,children:[_.length>0?r("div",{class:`${Ae}-attachments`,children:_.map(k=>r(vl,{attachment:k,onRemove:()=>F(k.id)},k.id))}):null,r("div",{class:`${Ae}-composer-row`,children:[r("div",{class:`${Ae}-composer-actions`,children:[v?r("button",{type:"button",class:`${Ae}-icon-btn`,onClick:()=>h.current?.click(),"aria-label":c.attach,"data-testid":w.composerAttach,children:r(Bs,{})}):null,b.isSupported?r("button",{type:"button",class:`${Ae}-icon-btn`,onClick:Y,"aria-label":g?c.micStop:c.micStart,"aria-pressed":g,"data-recording":g?"true":void 0,"data-testid":w.composerVoice,children:r(Fs,{})}):null]}),r("textarea",{ref:y,class:`${Ae}-textarea`,rows:1,value:d,placeholder:c.composerPlaceholder,onInput:k=>u(k.target.value),onKeyDown:N,"aria-label":c.composerPlaceholder,"data-testid":w.composerInput}),i?r("button",{type:"button",class:`${Ae}-send`,onClick:l,"aria-label":c.stop,"data-testid":w.composerStop,children:r(Hs,{})}):r("button",{type:"button",class:`${Ae}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:ae,disabled:!d.trim()&&_.length===0,"aria-label":c.send,"data-testid":w.composerSend,children:r(be,{})})]}),r("input",{ref:h,type:"file",multiple:!0,accept:e.attachments.accept,onChange:W,class:`${Ae}-sr-only`,"data-testid":w.composerFileInput})]})}var Su=x.cssPrefix;function xl({visible:e,strings:t}){return e?r("div",{class:`${Su}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function Io({containerRef:e,onDrop:t}){let[n,o]=R(!1);return E(()=>{let i=e.current;if(!i)return;let a=0,l=u=>{a+=1,u.dataTransfer?.types.includes("Files")&&(u.preventDefault(),o(!0))},s=()=>{a-=1,!(a>0)&&(a=0,o(!1))},c=u=>{u.dataTransfer?.types.includes("Files")&&u.preventDefault()},d=u=>{a=0,o(!1),u.dataTransfer&&(u.preventDefault(),t(u.dataTransfer.items))};return i.addEventListener("dragenter",l),i.addEventListener("dragleave",s),i.addEventListener("dragover",c),i.addEventListener("drop",d),()=>{i.removeEventListener("dragenter",l),i.removeEventListener("dragleave",s),i.removeEventListener("dragover",c),i.removeEventListener("drop",d)}},[e,t]),{visible:n}}function Pl({itemCount:e,initialFocusIndex:t}){let[n,o]=R(!1),i=O(null),a=O(null),[l,s]=R(-1),c=H(()=>{o(!1),s(-1),i.current?.focus()},[]),d=H(()=>o(f=>!f),[]);E(()=>{if(!n)return;let f=g=>{let m=a.current,y=i.current;if(!m||!y)return;let h=g.composedPath();h.includes(m)||h.includes(y)||(o(!1),s(-1))};return document.addEventListener("click",f,!0),()=>document.removeEventListener("click",f,!0)},[n]),E(()=>{if(!n||e===0)return;let f=t?.()??0,g=f<0||f>=e?0:f;s(g)},[n,e,t]),E(()=>{if(!n||l<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[l]?.focus()},[n,l]);let u=H(f=>{(f.key==="ArrowDown"||f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o(!0))},[]),_=H(f=>{if(e!==0)switch(f.key){case"Escape":f.preventDefault(),c();return;case"ArrowDown":f.preventDefault(),s(g=>(g+1)%e);return;case"ArrowUp":f.preventDefault(),s(g=>(g-1+e)%e);return;case"Home":f.preventDefault(),s(0);return;case"End":f.preventDefault(),s(e-1)}},[e,c]);return{open:n,focusIndex:l,triggerRef:i,menuRef:a,toggle:d,close:c,onTriggerKey:u,onMenuKey:_}}function yl({items:e,triggerLabel:t}){let n=x.cssPrefix,o=Pl({itemCount:e.length}),i=s=>{s.disabled||(s.onSelect?.(),s.keepOpen||o.close())},a=(s,c)=>s.onSelectValue?.(c),l=(s,c)=>{let d=c.segments;if(!d?.length)return;let u=Math.max(0,d.findIndex(f=>f.value===c.value)),_=-1;if(s.key==="ArrowRight"||s.key==="Enter"||s.key===" ")_=(u+1)%d.length;else if(s.key==="ArrowLeft")_=(u-1+d.length)%d.length;else return;s.preventDefault(),s.stopPropagation(),a(c,d[_].value)};return r("div",{class:`${n}-menu-wrap`,children:[r("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:r(Gs,{})}),o.open?r("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(s=>s.segments?r("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":s.label,tabIndex:-1,onKeyDown:c=>l(c,s),children:[s.icon?r("span",{class:`${n}-menu-icon`,children:s.icon}):null,r("span",{class:`${n}-menu-label`,children:s.label}),r("span",{class:`${n}-segmented`,role:"group","aria-label":s.label,children:s.segments.map(c=>{let d=c.value===s.value;return r("button",{type:"button",role:"menuitemradio","aria-checked":d,class:`${n}-segment`,"data-on":d?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${w.langSegment}-${c.value}`,onClick:()=>a(s,c.value),children:c.label},c.value)})})]},s.id):r("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":s.type==="switch"?s.on:void 0,disabled:s.disabled,onClick:()=>i(s),children:[s.icon?r("span",{class:`${n}-menu-icon`,children:s.icon}):null,r("span",{class:`${n}-menu-label`,children:s.label}),s.type==="switch"&&s.on?r("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:r(gn,{})}):null]},s.id))}):null]})}var Qr=x.cssPrefix;function wu(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 ku={normal:"large",large:"small",small:"normal"};function Cu(e){return e==="light"?r(rl,{}):e==="dark"?r(il,{}):r(al,{})}function Eu(e){return(e.split("-")[0]??e).toUpperCase()}function We({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:i,onClose:a,onClear:l,onExpand:s,onFullscreen:c,onSoundToggle:d}=e,{onToggleHistory:u,onLocaleChange:_,onThemeChange:f,onTextSizeChange:g}=e,m=n.strings,y=n.mode,h=t==="chat",v=J(()=>i.mutedSig.value).value,C=new Set(n.actions),b=k=>C.has(k),T=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,K=k=>T?!1:bn(k,y,o),ae=n.themeMode,N={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark},W=n.textSize,F={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},V=[];if(h&&b("clear")&&V.push({id:"clear",icon:r(Zs,{}),label:m.newConversation,onSelect:l}),b("expand")&&K("expand")){let k=o==="expanded";V.push({id:"expand",icon:k?r(Us,{}):r(zs,{}),label:k?m.collapse:m.expand,type:"switch",on:k,onSelect:s})}if(b("fullscreen")&&K("fullscreen")){let k=o==="fullscreen";V.push({id:"fullscreen",icon:k?r(Vs,{}):r(Ws,{}),label:k?m.exitFullscreen:m.fullscreen,type:"switch",on:k,onSelect:c})}h&&b("sound")&&V.push({id:"sound",icon:v?r(js,{}):r(Ks,{}),label:v?m.soundOff:m.soundOn,type:"switch",on:!v,onSelect:d}),b("theme")&&V.push({id:"theme",icon:Cu(ae),label:`${m.theme}: ${N[ae]}`,onSelect:()=>f(wu(ae)),keepOpen:!0}),b("textSize")&&V.push({id:"textSize",icon:r(Ys,{}),label:`${m.textSize}: ${F[W]}`,onSelect:()=>g(ku[W]),keepOpen:!0}),b("language")&&n.availableLocales.length>1&&V.push({id:"language",icon:r(Qs,{}),label:m.language,segments:n.availableLocales.map(k=>({value:k,label:Eu(k),lang:k})),value:n.locale,onSelectValue:_});let Y=!!a&&Co(y,o,n.actions),be=h&&b("history");return r("div",{class:`${Qr}-header-actions`,children:[be?r("button",{type:"button",class:`${Qr}-icon-btn`,onClick:u,"aria-label":m.history,title:m.history,"data-testid":w.actionHistory,children:r(Js,{})}):null,V.length>0?r(yl,{items:V,triggerLabel:m.moreActions}):null,Y?r("button",{type:"button",class:`${Qr}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":w.actionClose,children:r(Ue,{})}):null]})}var Tu=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ru=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Iu=/^[+]?[\d\s().-]{6,}$/;function Ft(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function Au(e){return Array.isArray(e)?e.length:e&&e.trim()?1:0}function Lu(e,t,n){let o=e.required??!0,i=e.validation;if(e.type==="multiselect"){let l=Au(t);return o&&l===0?n.formRequired:l===0?void 0:i?.minSelections!=null&&l<i.minSelections?Ft(n.formChooseAtLeast,{min:i.minSelections}):i?.maxSelections!=null&&l>i.maxSelections?Ft(n.formChooseAtMost,{max:i.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!Tu.test(a))return n.formInvalidEmail;break;case"url":if(!Ru.test(a))return n.formInvalidUrl;break;case"tel":if(!Iu.test(a))return n.formInvalidTel;break;case"number":{let l=Number(a);if(!Number.isFinite(l))return n.formInvalidNumber;if(i?.min!=null&&l<i.min)return Ft(n.formNumberTooSmall,{min:i.min});if(i?.max!=null&&l>i.max)return Ft(n.formNumberTooLarge,{max:i.max});break}default:break}if(i?.minLength!=null&&a.length<i.minLength)return Ft(n.formTooShort,{min:i.minLength});if(i?.maxLength!=null&&a.length>i.maxLength)return Ft(n.formTooLong,{max:i.maxLength});if(i?.pattern)try{if(!new RegExp(i.pattern).test(a))return n.formPatternMismatch}catch{}}function Sl(e,t,n){let o={};for(let i of e){let a=Lu(i,t[i.name],n);a&&(o[i.name]=a)}return o}function wl(e){let t={};for(let[n,o]of Object.entries(e)){let i=Array.isArray(o)?o.join(", "):o;i&&i.trim()&&(t[n]=i.trim())}return t}var ce=x.cssPrefix,Ao="__other__";function Lo({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:i,onSkip:a,footerHint:l,submitOnEnter:s,disabled:c,rootTestId:d,submitTestId:u,skipTestId:_}){let[f,g]=R(()=>Du(e)),[m,y]=R({}),[h,v]=R({}),C=N=>{h[N]&&v(W=>({...W,[N]:""}))},b=(N,W)=>{g(F=>({...F,[N]:W})),C(N)},T=(N,W)=>{y(F=>({...F,[N]:W})),C(N)},K=N=>{if(N.preventDefault(),c)return;let W=$u(e,f,m),F=Sl(e,W,t);if(Object.keys(F).length>0){v(F);return}o(wl(W))},ae=N=>{!s||N.key!=="Enter"||N.shiftKey||N.isComposing||N.target?.tagName==="TEXTAREA"&&K(N)};return r("form",{class:`${ce}-form`,onSubmit:K,onKeyDown:ae,"data-testid":d,noValidate:!0,children:[e.map(N=>r(Mu,{field:N,value:f[N.name],otherText:m[N.name]??"",error:h[N.name],disabled:c,strings:t,onChange:W=>b(N.name,W),onOtherChange:W=>T(N.name,W)},N.name)),r("div",{class:`${ce}-form-actions`,children:[l?r("span",{class:`${ce}-form-hint`,children:l}):null,i&&a?r("button",{type:"button",class:`${ce}-form-skip`,onClick:a,disabled:c,"data-testid":_,children:i}):null,r("button",{type:"submit",class:`${ce}-form-submit`,disabled:c,"data-testid":u,children:n})]})]})}function Mu({field:e,value:t,otherText:n,error:o,disabled:i,strings:a,onChange:l,onOtherChange:s}){let c=ve(w.formField,e.name),d=Nu({field:e,value:t,otherText:n,disabled:i,strings:a,onChange:l,onOtherChange:s,fieldTid:c});return r("label",{class:`${ce}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[r("span",{class:`${ce}-field-label`,children:[e.label,e.required??!0?r("span",{class:`${ce}-field-req`,"aria-hidden":"true",children:" *"}):null]}),d,e.validationHint&&!o?r("span",{class:`${ce}-field-hint`,children:e.validationHint}):null,o?r("span",{class:`${ce}-field-error`,role:"alert",children:o}):null]})}function Nu(e){let{field:t,value:n,otherText:o,disabled:i,strings:a,onChange:l,onOtherChange:s,fieldTid:c}=e,d=typeof n=="string"?n:"";switch(t.type){case"textarea":return r("textarea",{class:`${ce}-field-input`,rows:3,value:d,placeholder:t.placeholder,disabled:i,onInput:u=>l(u.target.value),"data-testid":c});case"select":return r("select",{class:`${ce}-field-input`,value:d,disabled:i,onChange:u=>l(u.target.value),"data-testid":c,children:[r("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(u=>r("option",{value:u.value,children:u.label??u.value},u.value))]});case"radio":{let u=t.allowOther&&d===Ao;return r("div",{class:`${ce}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(_=>r("label",{class:`${ce}-choice`,children:[r("input",{type:"radio",name:`${ce}-${t.name}`,checked:d===_.value,disabled:i,onChange:()=>l(_.value)}),r("span",{children:_.label??_.value})]},_.value)),t.allowOther?r("label",{class:`${ce}-choice`,children:[r("input",{type:"radio",name:`${ce}-${t.name}`,checked:d===Ao,disabled:i,onChange:()=>l(Ao)}),r("span",{children:a.formOther})]}):null,u?r("input",{class:`${ce}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:i,onInput:_=>s(_.target.value)}):null]})}case"checkbox":return r("label",{class:`${ce}-choice`,children:[r("input",{type:"checkbox",checked:d==="true",disabled:i,onChange:u=>l(u.target.checked?"true":""),"data-testid":c}),r("span",{children:t.placeholder??t.label})]});case"multiselect":{let u=Array.isArray(n)?n:[],_=(f,g)=>l(g?[...u,f]:u.filter(m=>m!==f));return r("div",{class:`${ce}-field-choices`,"data-testid":c,children:[(t.options??[]).map(f=>r("label",{class:`${ce}-choice`,children:[r("input",{type:"checkbox",checked:u.includes(f.value),disabled:i,onChange:g=>_(f.value,g.target.checked)}),r("span",{children:f.label??f.value})]},f.value)),t.allowOther||(t.options??[]).length===0?r("textarea",{class:`${ce}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:i,onInput:f=>s(f.target.value)}):null]})}default:return r("input",{class:`${ce}-field-input`,type:Ou(t.type),value:d,placeholder:t.placeholder,disabled:i,onInput:u=>l(u.target.value),"data-testid":c})}}function Ou(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function Du(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 $u(e,t,n){let o={...t};for(let i of e){let a=n[i.name]?.trim();if(i.type==="radio"&&i.allowOther&&t[i.name]===Ao)o[i.name]=a??"";else if(i.type==="multiselect"&&a){let l=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),s=Array.isArray(t[i.name])?t[i.name]:[];o[i.name]=[...s,...l]}}return o}var Ve=x.cssPrefix;function kl({form:e,strings:t,onSubmit:n,onSkip:o}){return r("div",{class:`${Ve}-form-gate`,"data-testid":w.formGate,children:[e.title?r("h3",{class:`${Ve}-form-gate-title`,children:e.title}):null,e.description?r("p",{class:`${Ve}-form-gate-desc`,children:e.description}):null,r(Lo,{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:w.formSubmit,skipTestId:w.formSkip})]})}function Cl({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",i=o?t.formSkipped:t.formSubmitted,a=e.title?r(ne,{children:[r("span",{children:e.title}),r("span",{class:`${Ve}-sr-only`,children:i})]}):r("span",{children:i}),l=e.form?.reviewable??!1,s=!o&&l&&e.values&&Object.keys(e.values).length>0?e.values:null;if(s){let c=d=>e.form?.fields.find(u=>u.name===d)?.label??d;return r("details",{class:`${Ve}-form-done`,"data-outcome":e.outcome,"data-testid":w.formDone,children:[r("summary",{class:`${Ve}-form-done-summary`,"data-testid":w.formDoneToggle,children:[r(gn,{}),a,r(Ht,{})]}),r("dl",{class:`${Ve}-form-answers`,"data-testid":w.formAnswers,children:Object.entries(s).map(([d,u])=>r("div",{class:`${Ve}-form-answer`,children:[r("dt",{children:c(d)}),r("dd",{children:u})]},d))})]})}return r("div",{class:`${Ve}-form-done`,"data-outcome":e.outcome,"data-testid":w.formDone,role:"status",children:[o?r(Xs,{}):r(gn,{}),a,o&&e.form?.reopenable&&n?r("button",{type:"button",class:`${Ve}-form-done-fill`,"data-testid":w.formFill,onClick:n,children:t.formFillOut}):null]})}function El(e){if(!e)return!1;let t=e.startsWith("tool:")?e.slice(5):e;return t==="ask-user-input"||t==="ask_user_input"||t==="request-user-input"||t==="request_user_input"}var ti=1,Rl=2,Il=4,Al=8,Ll=16;function Hu(e){switch(e){case ti:return"href";case Rl:return"src";case Il:return"class";case Al:return"checked";case Ll:return"start"}}var Bu=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}},Fu=Bu;var Tl=24;function oi(e){let t=new Uint32Array(Tl);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(Tl),indent:"",indent_len:0,table_state:0}}function Ml(e){e.pending.length>0&&Pe(e,`
12
- `)}function ee(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 me(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 te(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&me(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function zu(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function vt(e,t){for(e.fence_start=0;e.len>t;)me(e)}function Mo(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;)me(e);return t}function Zr(e,t){let n=-1,o=-1;for(let i=e.blockquote_idx+1;i<=e.len;i+=1)if(e.tokens[i]===25){if(e.indent_len<e.spaces[i]){o=-1;break}o=i}else e.tokens[i]===t&&(n=i);return o===-1?n===-1?(vt(e,e.blockquote_idx),te(e,t),!0):(vt(e,n),!1):(vt(e,o),te(e,t),!0)}function ei(e,t){te(e,25),e.spaces[e.len]=e.indent_len+t,Xe(e),e.token=103}function Xe(e){e.indent="",e.indent_len=0,e.pending=""}function ni(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 Uu(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 Wu(e){return ni(e)||Uu(e)}function Pe(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 i=Mo(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],i>0&&Pe(e," ".repeat(i))}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
- `:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){me(e),Xe(e),e.pending=n;continue}vt(e,e.blockquote_idx),Xe(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" ":Mo(e,e.indent_len),te(e,Fu(e.pending.length)),Xe(e);continue}break;case">":{let a=zu(e,20,e.blockquote_idx+1);a===-1?(vt(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,te(e,20)):e.blockquote_idx=a,Xe(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
- `:if(e.hr_chars<3)break;Mo(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),Xe(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){Zr(e,23),ei(e,2),Pe(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):(te(e,2),Xe(e),e.fence_start=0,Pe(e,o));continue;case`
15
- `:{Mo(e,e.indent_len),te(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Il,e.pending.slice(e.fence_start)),Xe(e),e.token=101;continue}default:e.pending=o;continue}case"+":if(n!==" ")break;Zr(e,23),ei(e,2);continue;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":if(e.pending[e.pending.length-1]==="."){if(n!==" ")break;Zr(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,Ll,e.pending.slice(0,-1)),ei(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||ni(a)){e.pending=o;continue}}break;case"|":vt(e,e.blockquote_idx),te(e,27),te(e,28),e.pending="",Pe(e,n);continue}let i=o;if(e.token===21)e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data);else if(e.indent_len>=4){let a=0;for(;a<4;a+=1)if(e.indent[a]===" "){a=a+1;break}i=e.indent.slice(a)+o,te(e,9)}else te(e,2);Xe(e),Pe(e,i);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=o;continue;case`
11
+ ${i}`:i;continue}o.startsWith("id:")&&(n=o.slice(3).trim())}if(!t||t==="[DONE]")return null;try{let o=JSON.parse(t);return ms.trace("chunk",{type:o.type,eventId:n}),{chunk:o,eventId:n}}catch(o){return ms.trace("frame parse failed",{err:o,payload:t.slice(0,200)}),null}}function R_(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 gs=e=>e&&Object.keys(e).length>0?e:void 0;function hs(e,t){let n=gs(e),o=gs(t);if(!n&&!o)return;let i={};return n&&(i.user=n),o&&(i.page=o),R_(JSON.stringify(i))}function go(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function I_(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function vs(e){return e.startsWith("tool-")?e.slice(5):e}var De={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",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},bs="context";function xs(e){let t=e.messages.map(a=>({id:a.serverMessageId??a.id,parts:M_(a),role:a.role,createdAt:a.createdAt!==void 0?new Date(a.createdAt).toISOString():void 0})),n={messages:t,conversationId:e.conversationId,trigger:e.trigger??"submit-message"},o=t.at(-1)?.id;o&&(n.messageId=o),e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs);let i=e.tools?.map(L_).filter(a=>a!==null);return i?.length&&(n.data={tools:i}),n}function A_(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function L_(e){return typeof e=="string"?e?{code:e}:null:e?.code?e:null}function M_(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"&&A_(n)){let o={type:I_(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 Q=B.scope("transport"),N_=3,ws=400,O_=6e4,Ps=1e4,ys=3,D_=new Set([408,425,429,500,502,503,504]);function Ss(e){return ws*2**e+Math.floor(Math.random()*250)}function $_(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}function zr(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),i=()=>a();t?.addEventListener("abort",i,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",i),n()}})}var ho=class{constructor(t){q(this,"opts",t);q(this,"visitorId");q(this,"conversationId");q(this,"userContext");q(this,"pageContext");q(this,"locale");q(this,"conversationsCache",new Map);q(this,"contentCache",new Map)}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:Rt};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=hs(this.userContext,this.pageContext);return n&&(t[bs]=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,i]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,i);return n.toString()}async handshake(t){Q.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(De.handshake,t,"handshake");return Q.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),B_(n)||Q.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){Q.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let n=new FormData;n.append("file",t,t.name);let o=await this.postForm(this.uploadPath,n,"upload");return Q.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){Q.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${H_(n)}`),o.append("mimeType",n);let i=await this.postForm(this.transcribePath,o,"transcribe");return Q.debug("transcribe \u2190",{textLen:i.text.length}),i}conversationsKey(t){return`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`}peekConversations(t={}){let n=this.conversationsCache.get(this.conversationsKey(t));if(n?.value&&Date.now()-n.at<Ps)return n.value}listConversations(t={}){let n=this.conversationsKey(t),o=this.conversationsCache.get(n);if(o&&Date.now()-o.at<Ps)return Q.debug("listConversations \u2192 cache",t),o.result;let i={at:Date.now(),result:this.fetchConversations(t).then(a=>(i.value=a,a)).catch(a=>{throw this.conversationsCache.delete(n),a})};return this.conversationsCache.set(n,i),i.result}async fetchConversations(t){let n=new URL(this.url(De.listConversations));t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.limit&&n.searchParams.set("limit",String(t.limit)),t.cursor&&n.searchParams.set("cursor",t.cursor),Q.debug("listConversations \u2192",{visitorId:t.visitorId??this.visitorId,limit:t.limit,cursor:t.cursor});let o=await this.getJson(n.toString(),"listConversations"),i=o.conversations??[];return Q.debug("listConversations \u2190",{count:i.length,nextCursor:o.nextCursor}),{conversations:i.map(a=>({conversationId:a.conversationId,title:a.title,lastMessageAt:a.lastMessageAt,preview:a.preview,canContinue:a.canContinue,unreadCount:a.unreadCount})),nextCursor:o.nextCursor}}async loadConversation(t){let n=new URL(this.url(De.listMessages));n.searchParams.set("conversationId",t),Q.debug("loadConversation \u2192",{conversationId:t,visitorId:this.visitorId});let o=await this.getJson(n.toString(),"loadConversation"),i=o.messages??[];return Q.debug("loadConversation \u2190",{conversationId:o.conversationId,canContinue:o.canContinue,messageCount:i.length,hasSuggestions:!!o.suggestions}),{conversationId:o.conversationId,canContinue:o.canContinue??!0,messages:i,agent:o.agent,suggestions:o.suggestions}}async markRead(t){if(!(!this.visitorId||!t)){this.conversationsCache.clear(),Q.debug("markRead \u2192",{conversationId:t,visitorId:this.visitorId});try{await this.postJson(De.markRead,{conversationId:t},"markRead")}catch(n){Q.debug("markRead failed (non-fatal)",{err:n})}}}listContent(t={}){let n=`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`,o=this.contentCache.get(n);if(o&&Date.now()-o.at<O_)return Q.debug("listContent \u2192 cache",t),o.result;let i=this.fetchContent(t).catch(a=>{throw this.contentCache.delete(n),a});return this.contentCache.set(n,{at:Date.now(),result:i}),i}async fetchContent(t){let n=new URL(this.dataUrl(De.content));for(let[a,l]of Object.entries(t))l!==void 0&&n.searchParams.set(a,Array.isArray(l)?l.join(","):String(l));Q.debug("listContent \u2192",t);let o=await this.getJson(n.toString(),"listContent"),i=(o.items??[]).map(a=>qi(a,this.locale));return Q.debug("listContent \u2190",{count:i.length,total:o.pagination?.total}),{...o,items:i}}async bootstrap(t){let n=new URL(this.dataUrl(De.bootstrap));t&&n.searchParams.set("conversationId",t),Q.debug("bootstrap \u2192",{conversationId:t??this.conversationId});let o=await this.getJson(n.toString(),"bootstrap"),i=o.forms??[],a=o.formSubmissions??[];return Q.debug("bootstrap \u2190",{forms:i.length,formSubmissions:a.length}),{forms:i,formSubmissions:a}}async saveUserPrefs(t){Q.debug("saveUserPrefs \u2192",{visitorId:this.visitorId,conversationId:this.conversationId,settingsKeys:Object.keys(t)});let n=await this.postJson(De.updateSettings,{userPrefs:t},"saveUserPrefs");return Q.debug("saveUserPrefs \u2190",{ok:n.ok}),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??De.submitForm}async submitForm(t){Q.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){Q.debug("submitForm failed (non-fatal)",{err:n})}}sendMessage(t){this.conversationsCache.clear(),Q.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageId:t.messageId,messageCount:t.messages.length,trigger:t.trigger,tools:t.data?.tools?.map(l=>l.code)});let n=new AbortController,o=new Set;return{iter:this.runStream(t,n,o),cancel:()=>this.cancelStream(n,t.conversationId)}}resumeStream(){let t=new AbortController,n=new Set;return{iter:this.resumeStreamGen(t,n,!0),cancel:()=>t.abort()}}async*runStream(t,n,o){(yield*this.drain(this.openMessageStream(t,n.signal),o,n))||(yield*this.resumeStreamGen(n,o,!1))}async*resumeStreamGen(t,n,o){for(let i=1;i<=N_&&!t.signal.aborted;i++){if((!o||i>1)&&(await zr(ws*i,t.signal),t.signal.aborted))return;let a;try{a=await this.fetchImpl(this.resumeUrl(n.size),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:t.signal})}catch(s){if(t.signal.aborted)return;Q.debug("resume fetch failed \u2014 retrying",{attempt:i,err:s});continue}if(a.status===204||!a.ok){Q.debug("resume \u2192 no in-flight stream",{status:a.status});return}let l=n.size;if(yield*this.drain(Fr(a,t.signal),n,t))return;if(n.size===l){Q.debug("resume \u2192 stream closed with no new events; nothing to resume");return}}if(!t.signal.aborted)throw new Oe("stream incomplete after resume attempts","server")}async*drain(t,n,o){try{for await(let i of t){if(o.signal.aborted)return!0;if(i.eventId){if(n.has(i.eventId))continue;n.add(i.eventId)}if(yield i,i.chunk.type==="finish"||i.chunk.type==="error")return!0}}catch(i){if(o.signal.aborted)return!0;if(i instanceof Oe&&i.status!==void 0)throw i;Q.debug("stream segment dropped",{err:i})}return!1}cancelStream(t,n){t.signal.aborted||(Q.debug("cancel stream",{conversationId:n,visitorId:this.visitorId}),t.abort(),!(!this.visitorId||!n)&&this.fetchImpl(this.url(De.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({})),keepalive:!0}).catch(o=>Q.debug("cancel POST failed (non-fatal)",{err:o})))}async*openMessageStream(t,n){let o=await this.fetchImpl(this.url(De.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"text/event-stream","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});yield*Fr(o,n)}resumeUrl(t){let n=new URL(this.withEnvelopeQuery(De.streamResume));return n.searchParams.set("resumeAt",String(t)),n.toString()}async postJson(t,n,o){let i=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(i,o)}async postForm(t,n,o){let i=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n)});return this.assertOk(i,o)}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[i,a]=t(),l;try{l=await this.fetchImpl(i,a)}catch(c){if(o>=ys)throw new Oe(`${n} failed: network error`,"network",void 0,c);Q.debug("request network error \u2014 retrying",{label:n,attempt:o}),await zr(Ss(o));continue}if(l.ok||!D_.has(l.status)||o>=ys)return l;let s=$_(l.headers)??Ss(o);Q.debug("request retryable status \u2014 retrying",{label:n,status:l.status,attempt:o,wait:s}),await zr(s)}}async assertOk(t,n){if(!t.ok)throw new Oe(`${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 H_(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 B_(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.visitorId=="string"&&typeof t.conversationId=="string"}function ks(e,t){let n=e?[{kind:"text",id:"t0",textSig:$(e),doneSig:$(!0)}]:[];return{id:Ne(),role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:$(n)}}function Wr(){return{id:Ne(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:$([])}}function Cs(e){let t=Ne();return F_({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function F_(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,partsSig:$(e.parts.map(z_))}}function Vr(e){let t=e.parts.map((n,o)=>n.type==="text"?{kind:"text",id:`${e.id}-t${o}`,textSig:$(n.text),doneSig:$(!0)}:n.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${o}`,textSig:$(n.text),doneSig:$(n.state!=="streaming")}:n.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${o}`}:n.type==="file"?{kind:"file",url:n.url,mediaType:n.mediaType}:n.type==="source-url"?{kind:"source",sourceId:n.sourceId,url:n.url,title:n.title}:n.type==="source-document"?{kind:"source",sourceId:n.sourceId,title:n.title,filename:n.filename,mediaType:n.mediaType}:n.type.startsWith("tool-")?{kind:"tool",toolCallId:n.toolCallId,toolName:vs(n.type),inputPartialSig:$(""),inputSig:$(n.input),outputSig:$(n.output),errorSig:$(n.errorText),stateSig:$(n.state),approvalSig:$(n.approval)}:null).filter(n=>n!==null);return{id:e.id,role:e.role,serverMessageId:e.id,createdAt:go(e.createdAt)??Date.now(),status:"complete",partsSig:$(t)}}function Es(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,parts:e.partsSig.value.map(U_)}}function qr(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function z_(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:$(e.text),doneSig:$(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,inputPartialSig:$(e.inputPartial),inputSig:$(e.input),outputSig:$(e.output),errorSig:$(e.error),stateSig:$(e.state),approvalSig:$(e.approval)}:e}function U_(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,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 Ts=B.scope("reducer"),vo=class{constructor(t){q(this,"messagesSig",t);q(this,"active",null)}attach(t){this.active=t}detach(){this.active=null}apply(t){let n=this.active;if(n)switch(t.type){case"start":t.messageId&&(n.serverMessageId=t.messageId);return;case"finish-step":return;case"start-step":mn(n,{kind:"step-start",id:`ss${n.partsSig.value.length}`});return;case"finish":Ts.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":Ts.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"text-start":$t(n,"text",t.id);return;case"text-delta":{let o=$t(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":$t(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":$t(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=$t(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":$t(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-output-available":case"tool-output-error":case"tool-output-denied":case"tool-approval-request":W_(n,t);return;case"file":mn(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":Rs(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":Rs(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-notification":return;default:{let o=t}}}bumpDone(t){t.partsSig.value=[...t.partsSig.value],this.messagesSig.value=[...this.messagesSig.value]}};function $t(e,t,n){let o=e.partsSig.value.find(a=>a.kind===t&&a.id===n);if(o)return o;let i={kind:t,id:n,textSig:$(""),doneSig:$(!1)};return mn(e,i),i}function mt(e,t,n){let o=e.partsSig.value.find(a=>a.kind==="tool"&&a.toolCallId===t);if(o)return o;let i={kind:"tool",toolCallId:t,toolName:n??"tool",inputPartialSig:$(""),inputSig:$(void 0),outputSig:$(void 0),errorSig:$(void 0),stateSig:$("input-streaming"),approvalSig:$(void 0)};return mn(e,i),i}function mn(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Rs(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||mn(e,t)}function W_(e,t){switch(t.type){case"tool-input-start":mt(e,t.toolCallId,t.toolName);return;case"tool-input-delta":{let n=mt(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=mt(e,t.toolCallId,t.toolName);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-approval-request":{let n=mt(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=mt(e,t.toolCallId);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=mt(e,t.toolCallId);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=mt(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}var Is=B.scope("feedback:audio"),bo=class{constructor(){q(this,"ctx",null);q(this,"master",null);q(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){Is.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 i=n.currentTime,a=t.noteMs/1e3;t.notes.forEach((l,s)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=l;let d=n.createGain(),u=i+s*a;d.gain.setValueAtTime(1e-4,u),d.gain.exponentialRampToValueAtTime(t.peakGain,u+.005),d.gain.exponentialRampToValueAtTime(1e-4,u+a),c.connect(d).connect(o),c.start(u),c.stop(u+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let i=await this.getBuffer(t);if(!i)return;let a=n.createBufferSource();a.buffer=i,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,i=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=>(Is.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,i),i}};var As={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Ls={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 ot=null,xo=0;function V_(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function q_(){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=`__${x.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 Ms(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(V_())try{navigator.vibrate(e);return}catch{}if(ot||(ot=q_()),!!ot)try{ot.label.click()}catch{}}}function Ns(){xo++;let e=!1;return()=>{e||(e=!0,xo=Math.max(0,xo-1),xo===0&&ot&&(ot.input.remove(),ot.label.remove(),ot=null))}}var G_=B.scope("feedback"),K_=100,Po=class{constructor(t,n){q(this,"mutedSig",$(!1));q(this,"audio",new bo);q(this,"releaseHaptics");q(this,"sound");q(this,"haptics");q(this,"lastPlayed",new Map);q(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=Ns(),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<K_}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(i=>G_.warn("audio play failed",{err:i,url:n}));return}let o=Ls[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?As[t]:n;Ms(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}};function ft(e,t){return e instanceof Oe&&e.status===429?t.errorRateLimited:t.errorGeneric}var j_=0;function r(e,t,n,o,i,a){t||(t={});var l,s,c=t;if("ref"in c)for(s in c={},t)s=="ref"?l=t[s]:c[s]=t[s];var d={type:e,props:c,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--j_,__i:-1,__u:0,__source:i,__self:a};if(typeof e=="function"&&(l=e.defaultProps))for(s in l)c[s]===void 0&&(c[s]=l[s]);return X.vnode&&X.vnode(d),d}var D={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},fn=`${x.cssPrefix}-icon-dir`,Y_=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),Ue=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M18 6 6 18M6 6l12 12"})}),Os=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M12 5v14M5 12h14"})}),Ds=()=>r("svg",{...D,class:fn,"aria-hidden":"true",children:[r("path",{d:"m22 2-7 20-4-9-9-4Z"}),r("path",{d:"M22 2 11 13"})]}),$s=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Hs=()=>r("svg",{...D,class:fn,"aria-hidden":"true",children:r("path",{d:"M3 20V4l18 8-18 8Z"})}),Ht=()=>r("svg",{...D,class:fn,"aria-hidden":"true",children:r("path",{d:"m9 18 6-6-6-6"})}),Bs=()=>r("svg",{...D,"aria-hidden":"true",children:r("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Fs=()=>r("svg",{...D,"aria-hidden":"true",children:r("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"})}),zs=()=>r("svg",{...D,"aria-hidden":"true",children:[r("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),r("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),Us=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),Ws=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Vs=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),qs=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),Gs=()=>r("svg",{...D,"aria-hidden":"true",viewBox:"0 0 10 10",children:r("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),Ks=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),r("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),r("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),js=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),Ys=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),Xs=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),r("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),Js=()=>r("svg",{...D,class:fn,"aria-hidden":"true",children:r("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),gn=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M20 6 9 17l-5-5"})}),Qs=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M3 3v6h6"}),r("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),r("path",{d:"M12 7v5l3 2"})]}),Zs=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("path",{d:"M2 12h20"}),r("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"})]}),hn=()=>r("svg",{...D,class:fn,"aria-hidden":"true",children:r("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),el=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M12 20h9"}),r("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),yo=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"m6 9 6 6 6-6"})}),tl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),r("path",{d:"M14 2v6h6"})]}),X_=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),r("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),Gr=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),Kr=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),r("path",{d:"M12 17h.01"})]}),J_=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"m15 4 3 3-9 9-3-3z"}),r("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),Q_=()=>r("svg",{...D,"aria-hidden":"true",children:[r("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),r("path",{d:"M12 8V4"}),r("circle",{cx:"12",cy:"3",r:"1"}),r("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),Z_=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),r("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),r("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),r("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),eu=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"10"}),r("circle",{cx:"12",cy:"12",r:"4"}),r("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"})]}),jr=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3"})]}),nl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),ol=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M3 9.5 12 3l9 6.5"}),r("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),rl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"m3 11 15-5v12L3 13z"}),r("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),r("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),r("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),vn=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),r("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),il=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"4"}),r("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"})]}),al=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),sl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 3v18"}),r("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),tu=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),r("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),r("path",{d:"m20 20-4.4-4.4"})]}),nu=()=>r("svg",{...D,"aria-hidden":"true",children:[r("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"}),r("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),ou=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M4 18h16"}),r("path",{d:"M5 18a7 7 0 0 1 14 0"}),r("path",{d:"M12 8V6"}),r("path",{d:"M10 6h4"})]}),ru=()=>r("svg",{...D,"aria-hidden":"true",children:[r("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),r("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),r("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),r("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"})]}),ll=()=>r("svg",{...D,"aria-hidden":"true",children:r("path",{d:"M14.7 6.3a4 4 0 0 0-5.4 5.3L3 18l3 3 6.4-6.3a4 4 0 0 0 5.3-5.4l-2.7 2.7-2.6-.7-.7-2.6z"})}),cl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 7v5l3 2"})]}),dl=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),_l=()=>r("svg",{...D,"aria-hidden":"true",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"m15 9-6 6M9 9l6 6"})]}),ul={chat:Y_,message:Gr,bubbles:vn,spark:X_,wand:J_,bot:Q_,help:Kr,lifebuoy:eu,headset:Z_,search:tu,sparkles:nu,concierge:ou,wave:ru};var L=x.cssPrefix,w={launcher:`${L}-launcher`,callout:`${L}-callout`,calloutDismiss:`${L}-callout-dismiss`,panel:`${L}-panel`,panelHeader:`${L}-panel-header`,resizeGrip:`${L}-resize-grip`,scrollToBottom:`${L}-scroll-to-bottom`,actionHistory:`${L}-action-history`,actionClose:`${L}-action-close`,langSegment:`${L}-lang-segment`,composer:`${L}-composer`,composerInput:`${L}-composer-input`,composerSend:`${L}-composer-send`,composerStop:`${L}-composer-stop`,composerAttach:`${L}-composer-attach`,composerFileInput:`${L}-composer-file-input`,composerVoice:`${L}-composer-voice`,attachmentChip:`${L}-attachment-chip`,attachmentRemove:`${L}-attachment-remove`,suggestion:`${L}-suggestion`,messageBubble:`${L}-message`,messageRetry:`${L}-message-retry`,historyPane:`${L}-history-pane`,historyBack:`${L}-history-back`,historyItem:`${L}-history-item`,sidebar:`${L}-sidebar`,sidebarToggle:`${L}-sidebar-toggle`,sidebarNewConversation:`${L}-sidebar-new-conversation`,sidebarItem:`${L}-sidebar-item`,messengerHome:`${L}-messenger-home`,modulesEmpty:`${L}-modules-empty`,tab:`${L}-tab`,tabBadge:`${L}-tab-badge`,homeView:`${L}-home-view`,homeGreeting:`${L}-home-greeting`,homeBrand:`${L}-home-brand`,backHeader:`${L}-back-header`,contentView:`${L}-content-view`,contentScroll:`${L}-content-scroll`,homeSearch:`${L}-home-search`,helpSearch:`${L}-help-search`,homeRecent:`${L}-home-recent`,homeContentRow:`${L}-home-content-row`,helpArticle:`${L}-help-article`,newsItem:`${L}-news-item`,formGate:`${L}-form-gate`,formDone:`${L}-form-done`,formDoneToggle:`${L}-form-done-toggle`,formAnswers:`${L}-form-answers`,formFill:`${L}-form-fill`,formSubmit:`${L}-form-submit`,formSkip:`${L}-form-skip`,formField:`${L}-form-field`,toolAskInput:`${L}-tool-ask-input`,toolInputSubmit:`${L}-tool-input-submit`,toolInputSkip:`${L}-tool-input-skip`,toolApproval:`${L}-tool-approval`,toolApprove:`${L}-tool-approve`,toolReject:`${L}-tool-reject`,toolEdit:`${L}-tool-edit`,toolDecision:`${L}-tool-decision`,toolCall:`${L}-tool-call`,source:`${L}-source`};function ve(e,t){return`${e}-${t}`}var So=x.cssPrefix;function pl({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:i}){let a=t.variant!=="circle"&&!!t.label;return r("button",{type:"button",class:`${So}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":i?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":w.launcher,onClick:e,"aria-label":n.launcherOpen,children:[iu(t.icon),a?r("span",{class:`${So}-fab-label`,children:we(n,t.label??"")}):null]})}function iu(e){let t=ul[e];return t?r(t,{}):r(au,{source:e})}function au({source:e}){return r("span",{ref:t=>{t&&su(t,e)},"aria-hidden":"true"})}function su(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 ml({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:i}){let[a,l]=R(!1);return E(()=>{let s=setTimeout(()=>l(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),E(()=>{if(!a||e.autoDismissMs<=0)return;let s=setTimeout(i,e.autoDismissMs);return()=>clearTimeout(s)},[a,e.autoDismissMs,i]),a?r("div",{class:`${So}-callout`,role:"status","data-shape":e.shape,"data-position":lu(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":w.callout,children:[r("span",{children:we(n,e.text)}),r("button",{type:"button",class:`${So}-callout-close`,onClick:i,"aria-label":o,title:o,"data-testid":w.calloutDismiss,children:r(Ue,{})})]}):null}function lu(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function wo({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:i,strings:a}){let l=x.cssPrefix,s=O(null);if(E(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${l}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${l}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${l}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${l}-resize-max-h`,t.maxHeight),o&&(m.setProperty(`--${l}-widget-w`,`${o.width}px`),m.setProperty(`--${l}-widget-h`,`${o.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,l,o]),!e)return null;let c=n.startsWith("top-"),d=n.endsWith("-right"),u=`${l}-resize-grip ${l}-resize-grip--${c?"bottom":"top"}-${d?"left":"right"}`,_=m=>{if(!e)return;let y=m.currentTarget,h=e.getBoundingClientRect();s.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:h.width,startH:h.height,dirX:d?-1:1,dirY:c?1:-1},y.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()},g=m=>{let y=s.current;if(!y||m.pointerId!==y.pointerId||!e)return;let h=(m.clientX-y.startX)*y.dirX,v=(m.clientY-y.startY)*y.dirY;e.style.setProperty(`--${l}-widget-w`,`${y.startW+h}px`),e.style.setProperty(`--${l}-widget-h`,`${y.startH+v}px`)},f=m=>{let y=s.current;if(!y||m.pointerId!==y.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let h=e.getBoundingClientRect();i({width:Math.round(h.width),height:Math.round(h.height)}),s.current=null};return r("div",{class:u,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:_,onPointerMove:g,onPointerUp:f,onPointerCancel:f,"data-testid":w.resizeGrip,children:r(Gs,{})})}var gt=x.cssPrefix,cu=`.${gt}-header, .${gt}-back-header, .${gt}-home-hero`,du='button, a, input, textarea, select, [role="tab"], [contenteditable]',fl=56;function ko(e,t){E(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,d)=>Math.min(d,Math.max(-d,c)),i=null,a=c=>{let d=c.target;if(!(d instanceof Element)||!d.closest(cu)||d.closest(du))return;let u=e.getBoundingClientRect();i={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${gt}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${gt}-modal-dy`)),maxX:(window.innerWidth+u.width)/2-fl,maxY:(window.innerHeight+u.height)/2-fl},e.dataset.dragging="true",c.preventDefault()},l=c=>{if(!i||c.pointerId!==i.id)return;let d=o(i.dx+c.clientX-i.x,i.maxX),u=o(i.dy+c.clientY-i.y,i.maxY);e.style.setProperty(`--${gt}-modal-dx`,`${d}px`),e.style.setProperty(`--${gt}-modal-dy`,`${u}px`)},s=c=>{!i||c.pointerId!==i.id||(i=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",l),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[e,t])}function bn(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 Co(e,t,n){return bn("close",e,t)?n.includes("close"):!1}function gl(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var _u='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function Eo(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(_u)].filter(s=>s.offsetParent!==null||s===document.activeElement);if(o.length===0){n.preventDefault();return}let i=o[0],a=o[o.length-1];if(!i||!a)return;let l=e.getRootNode().activeElement;n.shiftKey&&l===i?(n.preventDefault(),a.focus()):!n.shiftKey&&l===a&&(n.preventDefault(),i.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function To(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Yr=x.cssPrefix;function hl({agent:e,strings:t}){let n=e.status??"online",o=we(t,e.name),i=e.title?we(t,e.title):null;return r("div",{class:`${Yr}-agent`,children:[r("div",{class:`${Yr}-agent-avatar`,"data-status":n,children:e.avatar?r("img",{src:e.avatar,alt:""}):r("span",{children:To(o)})}),r("div",{class:`${Yr}-agent-meta`,children:[r("strong",{children:o}),i?r("span",{children:i}):null]})]})}var vl=B.scope("attachments");function Ro(e,t,n){let o=pu(e),i=[],a=[],l=gu(n.accept),s=t.reduce((d,u)=>d+u.size,0),c=t.length;for(let d of o){let u=uu(d,c,s,n,l);if(u){a.push({file:d,reason:u});continue}i.push(fu(d)),s+=d.size,c+=1}return(i.length||a.length)&&vl.debug("ingest",{accepted:i.length,rejected:a.map(d=>({name:d.file.name,reason:d.reason}))}),{accepted:i,rejected:a}}function Xr(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){vl.debug("revokeObjectURL failed",{error:t})}}function uu(e,t,n,o,i){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":hu(e,i)?null:"mime"}function pu(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:mu(t)).filter(t=>t!==null):[]}function mu(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function fu(e){return{file:e,id:Ne(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function gu(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 hu(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),i=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?i.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var xn=x.cssPrefix;function bl({attachment:e,onRemove:t}){let n=e.mediaType.startsWith("image/");return r("span",{class:`${xn}-attachment-chip`,title:e.name,"data-testid":ve(w.attachmentChip,e.id),children:[n?r("img",{class:`${xn}-attachment-thumb`,src:e.previewUrl,alt:""}):r("span",{class:`${xn}-attachment-thumb`,"aria-hidden":"true",children:r(tl,{})}),r("span",{class:`${xn}-attachment-name`,children:e.name}),r("button",{type:"button",class:`${xn}-attachment-remove`,onClick:t,"aria-label":`Remove ${e.name}`,"data-testid":ve(w.attachmentRemove,e.id),children:r(Ue,{})})]})}var Jr={isSupported:!1,start:()=>{},stop:()=>{}};function Qr(e,t,n){return e==="disabled"?Jr:e==="server"?Pu(n):vu(t)}function vu(e){let t=bu();if(!t)return Jr;let n=null;return{isSupported:!0,start(o,i){n=new t,n.continuous=!0,n.interimResults=!0,n.lang=e,n.addEventListener("result",l=>{let s=l,c="",d=!1;for(let u=s.resultIndex;u<s.results.length;u++){let _=s.results[u];_&&(c+=_[0].transcript,_.isFinal&&(d=!0))}o(c,d)});let a=()=>{n=null,i()};n.addEventListener("end",a),n.addEventListener("error",a),n.start()},stop(){n?.stop()}}}function bu(){let e=globalThis;return e.SpeechRecognition??e.webkitSpeechRecognition}var xu=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Pu(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Jr;let t=null,n=null,o=[],i=()=>{for(let a of n?.getTracks()??[])a.stop();n=null};return{isSupported:!0,async start(a,l){try{n=await navigator.mediaDevices.getUserMedia({audio:!0});let s=yu();t=new MediaRecorder(n,s?{mimeType:s}:void 0),o=[],t.addEventListener("dataavailable",c=>{c.data.size>0&&o.push(c.data)}),t.addEventListener("stop",async()=>{let c=t?.mimeType??"audio/webm";i();let d=new Blob(o,{type:c});o=[];try{let{text:u}=await e(d,c);u&&a(u,!0)}catch{}finally{l()}}),t.start()}catch{i(),l()}},stop(){t?.stop()}}}function yu(){for(let e of xu)if(MediaRecorder.isTypeSupported(e))return e}var Ae=x.cssPrefix,ht=B.scope("composer");function Bt(e){return e.reduce((t,n)=>t+n.size,0)}var Su={arrowUp:$s,paperPlane:Ds,send:Hs,chevron:Ht};function xl({options:e,transport:t,feedback:n,bus:o,isStreaming:i,onSend:a,onStop:l,attachApiRef:s}){let c=e.strings,[d,u]=R(""),[_,g]=R([]),[f,m]=R(!1),y=O(null),h=O(null),v=e.features.files,C=e.features.voice,[b,T]=R(()=>Qr(C,e.locale,(k,j)=>t.transcribe(k,j)));E(()=>{f||C==="disabled"||T(Qr(C,e.locale,(k,j)=>t.transcribe(k,j)))},[e.locale,C,t,f]),E(()=>{let k=y.current;if(!k)return;let j=k.getRootNode(),oe="activeElement"in j?j.activeElement:null;oe&&k.closest(`.${Ae}-panel`)?.contains(oe)||k.focus({preventScroll:!0})},[]),E(()=>{let k=y.current;if(k){if(d.length===0){k.style.height="";return}k.style.height="auto",k.style.height=`${Math.min(k.scrollHeight,160)}px`}},[d]);let K=O(_);K.current=_,E(()=>()=>K.current.forEach(Xr),[]),E(()=>{if(s)return s.current={attachFromDrop:k=>{let j=Ro(k,K.current,e.attachments);j.accepted.length!==0&&(ht.info("attach (drop)",{count:j.accepted.length,totalBytes:Bt(j.accepted)}),o.emit("attach",{count:j.accepted.length,totalBytes:Bt(j.accepted)}),g(oe=>[...oe,...j.accepted]))}},()=>{s.current&&(s.current=null)}},[s,e.attachments]),E(()=>{let k=y.current;if(!k)return;let j=k.closest(`.${Ae}-panel`);if(!j)return;let oe=de=>{let _e=de.clipboardData;if(!_e)return;if(v){let S=Ro(_e.items,K.current,e.attachments);if(S.accepted.length>0){de.preventDefault(),ht.info("attach (paste)",{count:S.accepted.length,totalBytes:Bt(S.accepted)}),o.emit("attach",{count:S.accepted.length,totalBytes:Bt(S.accepted)}),g(U=>[...U,...S.accepted]);return}}if(de.target===k)return;let Me=_e.getData("text/plain");Me&&(de.preventDefault(),u(S=>S+Me),k.focus())};return j.addEventListener("paste",oe),()=>j.removeEventListener("paste",oe)},[v,e.attachments,Ae]);let ae=()=>{let k=d.trim();!k&&_.length===0||i||(a(k,_),u(""),g([]))},N=k=>{k.key!=="Enter"||k.shiftKey||k.isComposing||(k.preventDefault(),i?l():ae())},W=k=>{let j=k.target,oe=Ro(j.files,_,e.attachments);oe.accepted.length>0&&(ht.info("attach (file picker)",{count:oe.accepted.length,totalBytes:Bt(oe.accepted)}),o.emit("attach",{count:oe.accepted.length,totalBytes:Bt(oe.accepted)}),g(de=>[...de,...oe.accepted])),j.value=""},F=k=>{ht.info("removeAttachment",{id:k}),o.emit("removeAttachment",{id:k}),g(j=>{let oe=j.find(de=>de.id===k);return oe&&Xr(oe),j.filter(de=>de.id!==k)})},V=O(null),Y=()=>{if(b.isSupported){if(f){let k=V.current?Date.now()-V.current:0;ht.info("voiceStop",{durationMs:k}),o.emit("voiceStop",{durationMs:k}),b.stop(),m(!1),n.play("voiceStop"),V.current=null;return}V.current=Date.now(),ht.info("voiceStart"),o.emit("voiceStart",void 0),m(!0),n.play("voiceStart"),b.start((k,j)=>u(oe=>j?`${oe}${k} `:oe),()=>{if(m(!1),V.current){let k=Date.now()-V.current;ht.debug("voiceStop (auto)",{durationMs:k}),o.emit("voiceStop",{durationMs:k}),V.current=null}})}},be=Su[e.composer.sendButton.icon];return r("div",{class:`${Ae}-composer`,"data-testid":w.composer,children:[_.length>0?r("div",{class:`${Ae}-attachments`,children:_.map(k=>r(bl,{attachment:k,onRemove:()=>F(k.id)},k.id))}):null,r("div",{class:`${Ae}-composer-row`,children:[r("div",{class:`${Ae}-composer-actions`,children:[v?r("button",{type:"button",class:`${Ae}-icon-btn`,onClick:()=>h.current?.click(),"aria-label":c.attach,"data-testid":w.composerAttach,children:r(Fs,{})}):null,b.isSupported?r("button",{type:"button",class:`${Ae}-icon-btn`,onClick:Y,"aria-label":f?c.micStop:c.micStart,"aria-pressed":f,"data-recording":f?"true":void 0,"data-testid":w.composerVoice,children:r(zs,{})}):null]}),r("textarea",{ref:y,class:`${Ae}-textarea`,rows:1,value:d,placeholder:c.composerPlaceholder,onInput:k=>u(k.target.value),onKeyDown:N,"aria-label":c.composerPlaceholder,"data-testid":w.composerInput}),i?r("button",{type:"button",class:`${Ae}-send`,onClick:l,"aria-label":c.stop,"data-testid":w.composerStop,children:r(Bs,{})}):r("button",{type:"button",class:`${Ae}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:ae,disabled:!d.trim()&&_.length===0,"aria-label":c.send,"data-testid":w.composerSend,children:r(be,{})})]}),r("input",{ref:h,type:"file",multiple:!0,accept:e.attachments.accept,onChange:W,class:`${Ae}-sr-only`,"data-testid":w.composerFileInput})]})}var wu=x.cssPrefix;function Pl({visible:e,strings:t}){return e?r("div",{class:`${wu}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function Io({containerRef:e,onDrop:t}){let[n,o]=R(!1);return E(()=>{let i=e.current;if(!i)return;let a=0,l=u=>{a+=1,u.dataTransfer?.types.includes("Files")&&(u.preventDefault(),o(!0))},s=()=>{a-=1,!(a>0)&&(a=0,o(!1))},c=u=>{u.dataTransfer?.types.includes("Files")&&u.preventDefault()},d=u=>{a=0,o(!1),u.dataTransfer&&(u.preventDefault(),t(u.dataTransfer.items))};return i.addEventListener("dragenter",l),i.addEventListener("dragleave",s),i.addEventListener("dragover",c),i.addEventListener("drop",d),()=>{i.removeEventListener("dragenter",l),i.removeEventListener("dragleave",s),i.removeEventListener("dragover",c),i.removeEventListener("drop",d)}},[e,t]),{visible:n}}function yl({itemCount:e,initialFocusIndex:t}){let[n,o]=R(!1),i=O(null),a=O(null),[l,s]=R(-1),c=H(()=>{o(!1),s(-1),i.current?.focus()},[]),d=H(()=>o(g=>!g),[]);E(()=>{if(!n)return;let g=f=>{let m=a.current,y=i.current;if(!m||!y)return;let h=f.composedPath();h.includes(m)||h.includes(y)||(o(!1),s(-1))};return document.addEventListener("click",g,!0),()=>document.removeEventListener("click",g,!0)},[n]),E(()=>{if(!n||e===0)return;let g=t?.()??0,f=g<0||g>=e?0:g;s(f)},[n,e,t]),E(()=>{if(!n||l<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[l]?.focus()},[n,l]);let u=H(g=>{(g.key==="ArrowDown"||g.key==="Enter"||g.key===" ")&&(g.preventDefault(),o(!0))},[]),_=H(g=>{if(e!==0)switch(g.key){case"Escape":g.preventDefault(),c();return;case"ArrowDown":g.preventDefault(),s(f=>(f+1)%e);return;case"ArrowUp":g.preventDefault(),s(f=>(f-1+e)%e);return;case"Home":g.preventDefault(),s(0);return;case"End":g.preventDefault(),s(e-1)}},[e,c]);return{open:n,focusIndex:l,triggerRef:i,menuRef:a,toggle:d,close:c,onTriggerKey:u,onMenuKey:_}}function Sl({items:e,triggerLabel:t}){let n=x.cssPrefix,o=yl({itemCount:e.length}),i=s=>{s.disabled||(s.onSelect?.(),s.keepOpen||o.close())},a=(s,c)=>s.onSelectValue?.(c),l=(s,c)=>{let d=c.segments;if(!d?.length)return;let u=Math.max(0,d.findIndex(g=>g.value===c.value)),_=-1;if(s.key==="ArrowRight"||s.key==="Enter"||s.key===" ")_=(u+1)%d.length;else if(s.key==="ArrowLeft")_=(u-1+d.length)%d.length;else return;s.preventDefault(),s.stopPropagation(),a(c,d[_].value)};return r("div",{class:`${n}-menu-wrap`,children:[r("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:r(Ks,{})}),o.open?r("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(s=>s.segments?r("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":s.label,tabIndex:-1,onKeyDown:c=>l(c,s),children:[s.icon?r("span",{class:`${n}-menu-icon`,children:s.icon}):null,r("span",{class:`${n}-menu-label`,children:s.label}),r("span",{class:`${n}-segmented`,role:"group","aria-label":s.label,children:s.segments.map(c=>{let d=c.value===s.value;return r("button",{type:"button",role:"menuitemradio","aria-checked":d,class:`${n}-segment`,"data-on":d?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${w.langSegment}-${c.value}`,onClick:()=>a(s,c.value),children:c.label},c.value)})})]},s.id):r("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":s.type==="switch"?s.on:void 0,disabled:s.disabled,onClick:()=>i(s),children:[s.icon?r("span",{class:`${n}-menu-icon`,children:s.icon}):null,r("span",{class:`${n}-menu-label`,children:s.label}),s.type==="switch"&&s.on?r("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:r(gn,{})}):null]},s.id))}):null]})}var Zr=x.cssPrefix;function ku(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 Cu={normal:"large",large:"small",small:"normal"};function Eu(e){return e==="light"?r(il,{}):e==="dark"?r(al,{}):r(sl,{})}function Tu(e){return(e.split("-")[0]??e).toUpperCase()}function We({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:i,onClose:a,onClear:l,onExpand:s,onFullscreen:c,onSoundToggle:d}=e,{onToggleHistory:u,onLocaleChange:_,onThemeChange:g,onTextSizeChange:f}=e,m=n.strings,y=n.mode,h=t==="chat",v=J(()=>i.mutedSig.value).value,C=new Set(n.actions),b=k=>C.has(k),T=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,K=k=>T?!1:bn(k,y,o),ae=n.themeMode,N={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark},W=n.textSize,F={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},V=[];if(h&&b("clear")&&V.push({id:"clear",icon:r(el,{}),label:m.newConversation,onSelect:l}),b("expand")&&K("expand")){let k=o==="expanded";V.push({id:"expand",icon:k?r(Ws,{}):r(Us,{}),label:k?m.collapse:m.expand,type:"switch",on:k,onSelect:s})}if(b("fullscreen")&&K("fullscreen")){let k=o==="fullscreen";V.push({id:"fullscreen",icon:k?r(qs,{}):r(Vs,{}),label:k?m.exitFullscreen:m.fullscreen,type:"switch",on:k,onSelect:c})}h&&b("sound")&&V.push({id:"sound",icon:v?r(Ys,{}):r(js,{}),label:v?m.soundOff:m.soundOn,type:"switch",on:!v,onSelect:d}),b("theme")&&V.push({id:"theme",icon:Eu(ae),label:`${m.theme}: ${N[ae]}`,onSelect:()=>g(ku(ae)),keepOpen:!0}),b("textSize")&&V.push({id:"textSize",icon:r(Xs,{}),label:`${m.textSize}: ${F[W]}`,onSelect:()=>f(Cu[W]),keepOpen:!0}),b("language")&&n.availableLocales.length>1&&V.push({id:"language",icon:r(Zs,{}),label:m.language,segments:n.availableLocales.map(k=>({value:k,label:Tu(k),lang:k})),value:n.locale,onSelectValue:_});let Y=!!a&&Co(y,o,n.actions),be=h&&b("history");return r("div",{class:`${Zr}-header-actions`,children:[be?r("button",{type:"button",class:`${Zr}-icon-btn`,onClick:u,"aria-label":m.history,title:m.history,"data-testid":w.actionHistory,children:r(Qs,{})}):null,V.length>0?r(Sl,{items:V,triggerLabel:m.moreActions}):null,Y?r("button",{type:"button",class:`${Zr}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":w.actionClose,children:r(Ue,{})}):null]})}var Ru=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Iu=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Au=/^[+]?[\d\s().-]{6,}$/;function Ft(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function Lu(e){return Array.isArray(e)?e.length:e&&e.trim()?1:0}function Mu(e,t,n){let o=e.required??!0,i=e.validation;if(e.type==="multiselect"){let l=Lu(t);return o&&l===0?n.formRequired:l===0?void 0:i?.minSelections!=null&&l<i.minSelections?Ft(n.formChooseAtLeast,{min:i.minSelections}):i?.maxSelections!=null&&l>i.maxSelections?Ft(n.formChooseAtMost,{max:i.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!Ru.test(a))return n.formInvalidEmail;break;case"url":if(!Iu.test(a))return n.formInvalidUrl;break;case"tel":if(!Au.test(a))return n.formInvalidTel;break;case"number":{let l=Number(a);if(!Number.isFinite(l))return n.formInvalidNumber;if(i?.min!=null&&l<i.min)return Ft(n.formNumberTooSmall,{min:i.min});if(i?.max!=null&&l>i.max)return Ft(n.formNumberTooLarge,{max:i.max});break}default:break}if(i?.minLength!=null&&a.length<i.minLength)return Ft(n.formTooShort,{min:i.minLength});if(i?.maxLength!=null&&a.length>i.maxLength)return Ft(n.formTooLong,{max:i.maxLength});if(i?.pattern)try{if(!new RegExp(i.pattern).test(a))return n.formPatternMismatch}catch{}}function wl(e,t,n){let o={};for(let i of e){let a=Mu(i,t[i.name],n);a&&(o[i.name]=a)}return o}function kl(e){let t={};for(let[n,o]of Object.entries(e)){let i=Array.isArray(o)?o.join(", "):o;i&&i.trim()&&(t[n]=i.trim())}return t}var ce=x.cssPrefix,Ao="__other__";function Lo({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:i,onSkip:a,footerHint:l,submitOnEnter:s,disabled:c,rootTestId:d,submitTestId:u,skipTestId:_}){let[g,f]=R(()=>$u(e)),[m,y]=R({}),[h,v]=R({}),C=N=>{h[N]&&v(W=>({...W,[N]:""}))},b=(N,W)=>{f(F=>({...F,[N]:W})),C(N)},T=(N,W)=>{y(F=>({...F,[N]:W})),C(N)},K=N=>{if(N.preventDefault(),c)return;let W=Hu(e,g,m),F=wl(e,W,t);if(Object.keys(F).length>0){v(F);return}o(kl(W))},ae=N=>{!s||N.key!=="Enter"||N.shiftKey||N.isComposing||N.target?.tagName==="TEXTAREA"&&K(N)};return r("form",{class:`${ce}-form`,onSubmit:K,onKeyDown:ae,"data-testid":d,noValidate:!0,children:[e.map(N=>r(Nu,{field:N,value:g[N.name],otherText:m[N.name]??"",error:h[N.name],disabled:c,strings:t,onChange:W=>b(N.name,W),onOtherChange:W=>T(N.name,W)},N.name)),r("div",{class:`${ce}-form-actions`,children:[l?r("span",{class:`${ce}-form-hint`,children:l}):null,i&&a?r("button",{type:"button",class:`${ce}-form-skip`,onClick:a,disabled:c,"data-testid":_,children:i}):null,r("button",{type:"submit",class:`${ce}-form-submit`,disabled:c,"data-testid":u,children:n})]})]})}function Nu({field:e,value:t,otherText:n,error:o,disabled:i,strings:a,onChange:l,onOtherChange:s}){let c=ve(w.formField,e.name),d=Ou({field:e,value:t,otherText:n,disabled:i,strings:a,onChange:l,onOtherChange:s,fieldTid:c});return r("label",{class:`${ce}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[r("span",{class:`${ce}-field-label`,children:[e.label,e.required??!0?r("span",{class:`${ce}-field-req`,"aria-hidden":"true",children:" *"}):null]}),d,e.validationHint&&!o?r("span",{class:`${ce}-field-hint`,children:e.validationHint}):null,o?r("span",{class:`${ce}-field-error`,role:"alert",children:o}):null]})}function Ou(e){let{field:t,value:n,otherText:o,disabled:i,strings:a,onChange:l,onOtherChange:s,fieldTid:c}=e,d=typeof n=="string"?n:"";switch(t.type){case"textarea":return r("textarea",{class:`${ce}-field-input`,rows:3,value:d,placeholder:t.placeholder,disabled:i,onInput:u=>l(u.target.value),"data-testid":c});case"select":return r("select",{class:`${ce}-field-input`,value:d,disabled:i,onChange:u=>l(u.target.value),"data-testid":c,children:[r("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(u=>r("option",{value:u.value,children:u.label??u.value},u.value))]});case"radio":{let u=t.allowOther&&d===Ao;return r("div",{class:`${ce}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(_=>r("label",{class:`${ce}-choice`,children:[r("input",{type:"radio",name:`${ce}-${t.name}`,checked:d===_.value,disabled:i,onChange:()=>l(_.value)}),r("span",{children:_.label??_.value})]},_.value)),t.allowOther?r("label",{class:`${ce}-choice`,children:[r("input",{type:"radio",name:`${ce}-${t.name}`,checked:d===Ao,disabled:i,onChange:()=>l(Ao)}),r("span",{children:a.formOther})]}):null,u?r("input",{class:`${ce}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:i,onInput:_=>s(_.target.value)}):null]})}case"checkbox":return r("label",{class:`${ce}-choice`,children:[r("input",{type:"checkbox",checked:d==="true",disabled:i,onChange:u=>l(u.target.checked?"true":""),"data-testid":c}),r("span",{children:t.placeholder??t.label})]});case"multiselect":{let u=Array.isArray(n)?n:[],_=(g,f)=>l(f?[...u,g]:u.filter(m=>m!==g));return r("div",{class:`${ce}-field-choices`,"data-testid":c,children:[(t.options??[]).map(g=>r("label",{class:`${ce}-choice`,children:[r("input",{type:"checkbox",checked:u.includes(g.value),disabled:i,onChange:f=>_(g.value,f.target.checked)}),r("span",{children:g.label??g.value})]},g.value)),t.allowOther||(t.options??[]).length===0?r("textarea",{class:`${ce}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:i,onInput:g=>s(g.target.value)}):null]})}default:return r("input",{class:`${ce}-field-input`,type:Du(t.type),value:d,placeholder:t.placeholder,disabled:i,onInput:u=>l(u.target.value),"data-testid":c})}}function Du(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function $u(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 Hu(e,t,n){let o={...t};for(let i of e){let a=n[i.name]?.trim();if(i.type==="radio"&&i.allowOther&&t[i.name]===Ao)o[i.name]=a??"";else if(i.type==="multiselect"&&a){let l=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),s=Array.isArray(t[i.name])?t[i.name]:[];o[i.name]=[...s,...l]}}return o}var Ve=x.cssPrefix;function Cl({form:e,strings:t,onSubmit:n,onSkip:o}){return r("div",{class:`${Ve}-form-gate`,"data-testid":w.formGate,children:[e.title?r("h3",{class:`${Ve}-form-gate-title`,children:e.title}):null,e.description?r("p",{class:`${Ve}-form-gate-desc`,children:e.description}):null,r(Lo,{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:w.formSubmit,skipTestId:w.formSkip})]})}function El({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",i=o?t.formSkipped:t.formSubmitted,a=e.title?r(ne,{children:[r("span",{children:e.title}),r("span",{class:`${Ve}-sr-only`,children:i})]}):r("span",{children:i}),l=e.form?.reviewable??!1,s=!o&&l&&e.values&&Object.keys(e.values).length>0?e.values:null;if(s){let c=d=>e.form?.fields.find(u=>u.name===d)?.label??d;return r("details",{class:`${Ve}-form-done`,"data-outcome":e.outcome,"data-testid":w.formDone,children:[r("summary",{class:`${Ve}-form-done-summary`,"data-testid":w.formDoneToggle,children:[r(gn,{}),a,r(Ht,{})]}),r("dl",{class:`${Ve}-form-answers`,"data-testid":w.formAnswers,children:Object.entries(s).map(([d,u])=>r("div",{class:`${Ve}-form-answer`,children:[r("dt",{children:c(d)}),r("dd",{children:u})]},d))})]})}return r("div",{class:`${Ve}-form-done`,"data-outcome":e.outcome,"data-testid":w.formDone,role:"status",children:[o?r(Js,{}):r(gn,{}),a,o&&e.form?.reopenable&&n?r("button",{type:"button",class:`${Ve}-form-done-fill`,"data-testid":w.formFill,onClick:n,children:t.formFillOut}):null]})}function Tl(e){if(!e)return!1;let t=e.startsWith("tool:")?e.slice(5):e;return t==="ask-user-input"||t==="ask_user_input"||t==="request-user-input"||t==="request_user_input"}var ni=1,Il=2,Al=4,Ll=8,Ml=16;function Bu(e){switch(e){case ni:return"href";case Il:return"src";case Al:return"class";case Ll:return"checked";case Ml:return"start"}}var Fu=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}},zu=Fu;var Rl=24;function ri(e){let t=new Uint32Array(Rl);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(Rl),indent:"",indent_len:0,table_state:0}}function Nl(e){e.pending.length>0&&Pe(e,`
12
+ `)}function ee(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 me(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 te(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&me(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function Uu(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function vt(e,t){for(e.fence_start=0;e.len>t;)me(e)}function Mo(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;)me(e);return t}function ei(e,t){let n=-1,o=-1;for(let i=e.blockquote_idx+1;i<=e.len;i+=1)if(e.tokens[i]===25){if(e.indent_len<e.spaces[i]){o=-1;break}o=i}else e.tokens[i]===t&&(n=i);return o===-1?n===-1?(vt(e,e.blockquote_idx),te(e,t),!0):(vt(e,n),!1):(vt(e,o),te(e,t),!0)}function ti(e,t){te(e,25),e.spaces[e.len]=e.indent_len+t,Xe(e),e.token=103}function Xe(e){e.indent="",e.indent_len=0,e.pending=""}function oi(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 Wu(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 Vu(e){return oi(e)||Wu(e)}function Pe(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 i=Mo(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],i>0&&Pe(e," ".repeat(i))}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
+ `:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){me(e),Xe(e),e.pending=n;continue}vt(e,e.blockquote_idx),Xe(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" ":Mo(e,e.indent_len),te(e,zu(e.pending.length)),Xe(e);continue}break;case">":{let a=Uu(e,20,e.blockquote_idx+1);a===-1?(vt(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,te(e,20)):e.blockquote_idx=a,Xe(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
+ `:if(e.hr_chars<3)break;Mo(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),Xe(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){ei(e,23),ti(e,2),Pe(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):(te(e,2),Xe(e),e.fence_start=0,Pe(e,o));continue;case`
15
+ `:{Mo(e,e.indent_len),te(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Al,e.pending.slice(e.fence_start)),Xe(e),e.token=101;continue}default:e.pending=o;continue}case"+":if(n!==" ")break;ei(e,23),ti(e,2);continue;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":if(e.pending[e.pending.length-1]==="."){if(n!==" ")break;ei(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,Ml,e.pending.slice(0,-1)),ti(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||oi(a)){e.pending=o;continue}}break;case"|":vt(e,e.blockquote_idx),te(e,27),te(e,28),e.pending="",Pe(e,n);continue}let i=o;if(e.token===21)e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data);else if(e.indent_len>=4){let a=0;for(;a<4;a+=1)if(e.indent[a]===" "){a=a+1;break}i=e.indent.slice(a)+o,te(e,9)}else te(e,2);Xe(e),Pe(e,i);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=o;continue;case`
16
16
  `:e.table_state=2,e.pending="";continue;default:me(e),e.table_state=0;break}else switch(e.pending){case"|":te(e,28),e.pending="",Pe(e,n);continue;case`
17
17
  `:me(e),e.pending="",e.table_state=0,Pe(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":te(e,29),me(e),e.pending="",Pe(e,n);continue;case`
18
18
  `:me(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",Pe(e,n);continue;default:te(e,29),Pe(e,n);continue}break;case 29:if(e.pending==="|"){ee(e),me(e),e.pending="",Pe(e,n);continue}break;case 9:switch(o){case`
@@ -28,13 +28,13 @@ ${i}`:i;continue}o.startsWith("id:")&&(n=o.slice(3).trim())}if(!t||t==="[DONE]")
28
28
  `:e.pending=o;continue;default:e.pending.length!==0?(ee(e),me(e),e.pending=n):e.text+=n;continue}case 10:switch(n){case"`":e.pending=o;continue;case`
29
29
  `:if(o.length===e.fence_start+e.fence_end+1){ee(e),me(e),e.pending="",e.fence_start=0,e.fence_end=0,e.token=101;continue}e.token=101;break;case" ":if(e.pending[0]===`
30
30
  `){e.pending=o,e.fence_end+=1;continue}break}e.text+=e.pending,e.pending=n,e.fence_end=1;continue;case 11:switch(n){case"`":o.length===e.fence_start+ +(e.pending[0]===" ")?(ee(e),me(e),e.pending="",e.fence_start=0):e.pending=o;continue;case`
31
- `:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,ee(e);continue;case" ":e.text+=e.pending,e.pending=n;continue;default:e.text+=o,e.pending="";continue}case 103:switch(e.pending.length){case 0:if(n!=="[")break;e.pending=o;continue;case 1:if(n!==" "&&n!=="x")break;e.pending=o;continue;case 2:if(n!=="]")break;e.pending=o;continue;case 3:if(n!==" ")break;e.renderer.add_token(e.renderer.data,26),e.pending[1]==="x"&&e.renderer.set_attr(e.renderer.data,Al,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",Pe(e,o);continue;case 14:case 15:{let a="*",l=12;if(e.token===15&&(a="_",l=13),a===e.pending){if(ee(e),a===n){me(e),e.pending="";continue}te(e,l),e.pending=n;continue}break}case 12:case 13:{let a="*",l=14;switch(e.token===13&&(a="_",l=15),e.pending){case a:a===n?e.tokens[e.len-1]===l?e.pending=o:(ee(e),te(e,l),e.pending=""):(ee(e),me(e),e.pending=n);continue;case a+a:let s=e.token;ee(e),me(e),me(e),a!==n?(te(e,s),e.pending=n):e.pending="";continue}break}case 16:if(o==="~~"){ee(e),me(e),e.pending="";continue}break;case 105:n===`
32
- `?(ee(e),te(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",Pe(e,n));continue;case 30:if(o==="\\]"||o==="$$"){ee(e),me(e),e.pending="";continue}break;case 31:if(o==="\\)"||e.pending[0]==="$"){ee(e),me(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:o==="http://"||o==="https://"?(ee(e),te(e,18),e.pending=o,e.text=o):"http:/"[e.pending.length]===n||"https:/"[e.pending.length]===n?e.pending=o:(e.token=e.tokens[e.len],Pe(e,n));continue;case 17:case 19:if(e.pending==="]"){ee(e),n==="("?e.pending=o:(me(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?ti:Rl,l=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,l),me(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
33
- `||n==="\\"?(e.renderer.set_attr(e.renderer.data,ti,e.pending),ee(e),me(e),e.pending=n):(e.text+=n,e.pending=o);continue;case 104:if(o.startsWith("<br")){if(o.length===3||n===" "||n==="/"&&(o.length===4||e.pending[e.pending.length-1]===" ")){e.pending=o;continue}if(n===">"){ee(e),e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data),e.pending="";continue}}e.token=e.tokens[e.len],e.text+="<",e.pending=e.pending.slice(1),Pe(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":ee(e),te(e,31),e.pending="";continue;case"[":e.token=105,e.pending=o;continue;case`
34
- `:e.pending=n;continue;default:let i=n.charCodeAt(0);e.pending="",e.text+=ni(i)||i>=65&&i<=90||i>=97&&i<=122?o:n;continue}case`
31
+ `:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,ee(e);continue;case" ":e.text+=e.pending,e.pending=n;continue;default:e.text+=o,e.pending="";continue}case 103:switch(e.pending.length){case 0:if(n!=="[")break;e.pending=o;continue;case 1:if(n!==" "&&n!=="x")break;e.pending=o;continue;case 2:if(n!=="]")break;e.pending=o;continue;case 3:if(n!==" ")break;e.renderer.add_token(e.renderer.data,26),e.pending[1]==="x"&&e.renderer.set_attr(e.renderer.data,Ll,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",Pe(e,o);continue;case 14:case 15:{let a="*",l=12;if(e.token===15&&(a="_",l=13),a===e.pending){if(ee(e),a===n){me(e),e.pending="";continue}te(e,l),e.pending=n;continue}break}case 12:case 13:{let a="*",l=14;switch(e.token===13&&(a="_",l=15),e.pending){case a:a===n?e.tokens[e.len-1]===l?e.pending=o:(ee(e),te(e,l),e.pending=""):(ee(e),me(e),e.pending=n);continue;case a+a:let s=e.token;ee(e),me(e),me(e),a!==n?(te(e,s),e.pending=n):e.pending="";continue}break}case 16:if(o==="~~"){ee(e),me(e),e.pending="";continue}break;case 105:n===`
32
+ `?(ee(e),te(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",Pe(e,n));continue;case 30:if(o==="\\]"||o==="$$"){ee(e),me(e),e.pending="";continue}break;case 31:if(o==="\\)"||e.pending[0]==="$"){ee(e),me(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:o==="http://"||o==="https://"?(ee(e),te(e,18),e.pending=o,e.text=o):"http:/"[e.pending.length]===n||"https:/"[e.pending.length]===n?e.pending=o:(e.token=e.tokens[e.len],Pe(e,n));continue;case 17:case 19:if(e.pending==="]"){ee(e),n==="("?e.pending=o:(me(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?ni:Il,l=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,l),me(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
33
+ `||n==="\\"?(e.renderer.set_attr(e.renderer.data,ni,e.pending),ee(e),me(e),e.pending=n):(e.text+=n,e.pending=o);continue;case 104:if(o.startsWith("<br")){if(o.length===3||n===" "||n==="/"&&(o.length===4||e.pending[e.pending.length-1]===" ")){e.pending=o;continue}if(n===">"){ee(e),e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data),e.pending="";continue}}e.token=e.tokens[e.len],e.text+="<",e.pending=e.pending.slice(1),Pe(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":ee(e),te(e,31),e.pending="";continue;case"[":e.token=105,e.pending=o;continue;case`
34
+ `:e.pending=n;continue;default:let i=n.charCodeAt(0);e.pending="",e.text+=oi(i)||i>=65&&i<=90||i>=97&&i<=122?o:n;continue}case`
35
35
  `:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:ee(e),vt(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:ee(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){ee(e),e.pending=o,e.token=104;continue}break;case"`":if(e.token===19)break;n==="`"?(e.fence_start+=1,e.pending=o):(e.fence_start+=1,ee(e),te(e,11),e.text=n===" "||n===`
36
36
  `?"":n,e.pending="");continue;case"_":case"*":{if(e.token===19||e.token===30||e.token===31||e.token===14)break;let i=12,a=14,l=e.pending[0];if(l==="_"&&(i=13,a=15),e.pending.length===1){if(l===n){e.pending=o;continue}if(n!==" "&&n!==`
37
37
  `){ee(e),te(e,i),e.pending=n;continue}}else{if(l===n){ee(e),te(e,a),te(e,i),e.pending="";continue}if(n!==" "&&n!==`
38
38
  `){ee(e),te(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
- `){ee(e),te(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(Wu(n.charCodeAt(0)))break;ee(e),te(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){ee(e),te(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){ee(e),te(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}ee(e)}function ri(e){return{add_token:Vu,end_token:qu,add_text:Gu,set_attr:Ku,data:{nodes:[e,,,,,],index:0}}}function Vu(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 i=o=document.createElement("input");i.type="checkbox",i.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 qu(e){e.index-=1}function Gu(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Ku(e,t,n){e.nodes[e.index].setAttribute(Hu(t),n)}function No({textSig:e,doneSig:t}){let n=O(null);return ln(()=>{let o=n.current;if(!o)return;o.classList.add(`${x.cssPrefix}-md`);let i=ri(o),a=oi(i),l=0,s=Ye(()=>{let u=e.value,_=t.value;u.length<l&&(o.replaceChildren(),i=ri(o),a=oi(i),l=0);let f=u.slice(l);f&&Pe(a,f),l=u.length,_&&Ml(a)}),c=new MutationObserver(u=>{for(let _ of u)for(let f of _.addedNodes){if(!(f instanceof HTMLElement))continue;let g=f.matches?.("a")?[f]:[...f.querySelectorAll?.("a")??[]];for(let m of g)Nl(m)}});c.observe(o,{childList:!0,subtree:!0});for(let u of o.querySelectorAll("a"))Nl(u);let d=u=>{let _=u.target?.closest?.("a");if(!_||!(_ instanceof HTMLAnchorElement))return;let f=_.getAttribute("href")??"";!f||f.startsWith("#")||(u.preventDefault(),window.open(f,"_blank","noopener,noreferrer"))};return o.addEventListener("click",d),()=>{s(),c.disconnect(),o.removeEventListener("click",d)}},[e,t]),r("div",{ref:n})}function Ol({text:e}){let t=ke(()=>$(e),[e]),n=ke(()=>$(!0),[]);return r(No,{textSig:t,doneSig:n})}function Nl(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 zt=x.cssPrefix;function Dl({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?r("a",{class:`${zt}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":w.source,children:[r("span",{class:`${zt}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),r("span",{class:`${zt}-source-label`,children:n})]}):r("span",{class:`${zt}-source`,"data-testid":w.source,children:[r("span",{class:`${zt}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),r("span",{class:`${zt}-source-label`,children:n})]})}var Je=x.cssPrefix;function Oo(e){return e.startsWith("tool:")||e.startsWith("tool-")?e.slice(5):e}function Yu(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 Xu({status:e}){return e==="denied"||e==="error"?r(dl,{}):e==="completed"||e==="responded"?r(cl,{}):r(ll,{})}function Ju(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;default:return t.statusRunning}}function Qu({state:e,approval:t,strings:n}){let o=Yu(e,t);return r("span",{class:`${Je}-toolui-badge ${Je}-toolui-status`,"data-status":o,children:[r("span",{class:`${Je}-toolui-status-icon`,children:r(Xu,{status:o})}),Ju(o,n)]})}function Do({name:e,state:t,approval:n,strings:o}){return r(ne,{children:[r("span",{class:`${Je}-toolui-wrench`,children:r(sl,{})}),r("strong",{class:`${Je}-toolui-title`,children:e}),r(Qu,{state:t,approval:n,strings:o}),r("span",{class:`${Je}-toolui-chevron`,children:r(yo,{})})]})}function rt({label:e,value:t,error:n}){let o=n?String(t??""):$o(ii(t));return o?r("div",{class:`${Je}-toolui-section`,children:[r("span",{class:`${Je}-toolui-label`,children:e}),r("pre",{class:`${Je}-toolui-code`,"data-error":n?"true":void 0,children:o})]}):null}function ii(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function $o(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""}}var Se=x.cssPrefix;function $l({part:e,strings:t,active:n,onDecision:o,onEdit:i}){let a=J(()=>e.approvalSig.value),l=J(()=>e.stateSig.value),s=J(()=>e.inputSig.value),c=J(()=>e.outputSig.value),d=J(()=>e.errorSig.value),u=Oo(e.toolName),_=a.value?.approved,f=_!==void 0,g=l.value==="output-available"||l.value==="output-error"||l.value==="output-denied",m=f||g,y=f&&n&&!g,h=e.toolCallId;return r("div",{class:`${Se}-toolui-group`,"data-testid":m?w.toolDecision:w.toolApproval,children:[r("details",{class:`${Se}-toolui ${Se}-toolui-collapsible`,children:[r("summary",{class:`${Se}-toolui-head`,children:r(Do,{name:u,state:l.value,approval:a.value,strings:t})}),r(rt,{label:t.toolParameters,value:s.value}),c.value!==void 0?r(rt,{label:t.toolResult,value:c.value}):null,d.value?r(rt,{label:t.statusError,value:d.value,error:!0}):null]}),r("div",{class:`${Se}-toolui ${Se}-toolui-body`,children:[r("p",{class:`${Se}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",u)}),r("p",{class:`${Se}-toolui-subtle`,children:t.approvalBody}),f?r("p",{class:`${Se}-toolui-subtle`,children:[t.approvalYourResponse.replace("{decision}",_?t.approve:t.reject),a.value?.reason?` \u2014 ${a.value.reason}`:""]}):null,y?r("p",{class:`${Se}-toolui-subtle`,children:t.approvalEditHint}):null,f&&!y&&!g?r("p",{class:`${Se}-toolui-subtle`,children:t.approvalSubmitting}):null,!m&&!n?r("p",{class:`${Se}-toolui-subtle`,children:t.stepNoLongerActive}):null,!m&&n?r("div",{class:`${Se}-toolui-actions`,children:[r("button",{type:"button",class:`${Se}-form-skip`,onClick:()=>o(h,!1),"data-testid":w.toolReject,children:t.reject}),r("button",{type:"button",class:`${Se}-form-submit`,onClick:()=>o(h,!0),"data-testid":w.toolApprove,children:t.approve})]}):y?r("div",{class:`${Se}-toolui-actions`,children:r("button",{type:"button",class:`${Se}-form-skip`,onClick:()=>i(h),"data-testid":w.toolEdit,children:t.edit})}):null]})]})}function Bl(e){let t=e&&typeof e=="object"?e:{},n=t.responseType;return{title:Pn(t.title),question:Pn(t.question)??"Please provide the missing information.",description:Pn(t.description),placeholder:Pn(t.placeholder),responseType:n==="single-choice"||n==="multi-choice"||n==="confirmation"||n==="free-text"?n:"free-text",choices:Array.isArray(t.choices)?t.choices:void 0,allowOther:typeof t.allowOther=="boolean"?t.allowOther:void 0,required:typeof t.required=="boolean"?t.required:!0,defaultValues:Array.isArray(t.defaultValues)?t.defaultValues.filter(o=>typeof o=="string"):void 0,minSelections:Hl(t.minSelections),maxSelections:Hl(t.maxSelections),validationHint:Pn(t.validationHint)}}function Fl(e){if(e.responseType==="confirmation")return[];let t=(e.choices??[]).map(Zu).filter(i=>i!==null),n="textarea";e.responseType==="single-choice"&&t.length>0?n="radio":e.responseType==="multi-choice"&&(n="multiselect");let o=n==="multiselect"?e.defaultValues?.join(", "):e.defaultValues?.[0];return[{name:"answer",label:e.question,type:n,placeholder:e.placeholder,required:e.required??!0,defaultValue:o,options:t.length>0?t:void 0,allowOther:e.allowOther,validationHint:e.validationHint,validation:n==="multiselect"?{minSelections:e.minSelections,maxSelections:e.maxSelections}:void 0}]}function Zu(e){return typeof e=="string"?e?{value:e,label:e}:null:e&&typeof e.value=="string"&&e.value?{value:e.value,label:e.label??e.value,description:e.description}:null}function Pn(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function Hl(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}var re=x.cssPrefix;function ep(e,t){switch(e.responseType){case"single-choice":return t.respSingleChoice;case"multi-choice":return t.respMultiChoice;case"confirmation":return t.respConfirmation;default:return t.respFreeText}}function zl({part:e,strings:t,active:n,onSubmit:o,onDecision:i,onEdit:a}){let l=J(()=>e.stateSig.value),s=J(()=>e.approvalSig.value),c=J(()=>Bl(e.inputSig.value)),d=l.value==="output-available"||l.value==="output-error"||l.value==="output-denied",u=l.value==="approval-responded"||s.value?.approved!==void 0,_=d||u,f=s.value!==void 0,g=(h,v)=>{f?i(e.toolCallId,v,h):c.value.responseType==="confirmation"?o(e.toolCallId,{confirmed:v}):o(e.toolCallId,v?{answer:h}:{})},m=c.value;if(_)return r(op,{part:e,strings:t,req:m,editable:u&&n&&!d,onEdit:()=>a(e.toolCallId)});let y=!n;return r("div",{class:`${re}-toolui${y?` ${re}-toolui-stale`:""}`,"data-testid":w.toolAskInput,children:[r("div",{class:`${re}-toolui-head`,children:[r("span",{class:`${re}-toolui-badge ${re}-toolui-badge-accent`,children:t.inputRequired}),r("span",{class:`${re}-toolui-badge`,children:ep(m,t)})]}),m.description?r("div",{class:`${re}-toolui-desc`,children:m.description}):null,r(ai,{label:t.inputQuestion,text:m.question}),y?r("p",{class:`${re}-toolui-note`,children:t.stepNoLongerActive}):r(tp,{req:m,strings:t,resolve:g})]})}function tp({req:e,strings:t,resolve:n}){if(e.responseType==="confirmation")return r(np,{req:e,strings:t,resolve:n});let o=Fl(e).map(i=>(i.label=t.inputYourAnswer,i.placeholder=i.placeholder??t.inputAnswerPlaceholder,i));return r(Lo,{fields:o,strings:t,submitLabel:t.inputSubmit,footerHint:t.inputSubmitHint,onSubmit:i=>n(i.answer??Object.values(i).join(", "),!0),skipLabel:t.inputSkip,onSkip:()=>n(void 0,!1),submitOnEnter:!0,submitTestId:w.toolInputSubmit,skipTestId:w.toolInputSkip})}function np({req:e,strings:t,resolve:n}){let[o,i]=R(""),a=e.allowOther??!0,l=()=>n(o.trim()||void 0,!0),s=()=>n(void 0,!1),c=d=>{d.key!=="Enter"||d.shiftKey||d.isComposing||(d.preventDefault(),l())};return r(ne,{children:[a?r("label",{class:`${re}-field`,children:[r("span",{class:`${re}-field-label`,children:t.inputOptionalNote}),r("textarea",{class:`${re}-field-input`,rows:2,value:o,placeholder:e.placeholder??t.inputOptionalNotePlaceholder,onInput:d=>i(d.target.value),onKeyDown:c,"data-testid":`${w.formField}-note`})]}):null,r("div",{class:`${re}-form-actions`,children:[r("span",{class:`${re}-form-hint`,children:t.inputConfirmHint}),r("button",{type:"button",class:`${re}-form-skip`,onClick:s,"data-testid":w.toolInputSkip,children:t.confirmNo}),r("button",{type:"button",class:`${re}-form-submit`,onClick:l,"data-testid":w.toolInputSubmit,children:t.confirmYes})]})]})}function ai({label:e,text:t}){return r("div",{class:`${re}-toolui-section`,children:[r("span",{class:`${re}-toolui-label`,children:e}),r("p",{class:`${re}-toolui-text`,children:t})]})}function op({part:e,strings:t,req:n,editable:o,onEdit:i}){let a=J(()=>e.outputSig.value),l=J(()=>e.approvalSig.value),s=l.value?.approved===!1,c=l.value?.approved!==void 0?l.value.reason??"":rp(a.value);return r("div",{class:`${re}-toolui`,"data-testid":w.toolDecision,children:[r("div",{class:`${re}-toolui-head`,children:[r("span",{class:`${re}-toolui-badge ${re}-toolui-badge-accent`,children:t.inputBadge}),r("span",{class:`${re}-toolui-badge`,children:s?t.inputSkipped:t.inputAnswered})]}),n.description?r("div",{class:`${re}-toolui-desc`,children:n.description}):null,r(ai,{label:t.inputQuestion,text:n.question}),!s&&c?r(ai,{label:t.inputResponse,text:c}):null,o?r("div",{class:`${re}-toolui-actions`,children:r("button",{type:"button",class:`${re}-form-skip`,onClick:i,"data-testid":w.toolEdit,children:t.edit})}):null]})}function rp(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"){let t=e;return"confirmed"in t?t.confirmed?"Yes":"No":typeof t.responseText=="string"&&t.responseText?t.responseText:Object.values(t).filter(n=>typeof n=="string"||typeof n=="number").join(", ")}return String(e)}var si=x.cssPrefix;function Ul({part:e,strings:t}){let n=J(()=>e.inputSig.value),o=J(()=>e.outputSig.value),i=J(()=>e.errorSig.value),a=J(()=>e.stateSig.value),l=J(()=>e.approvalSig.value);return J(()=>!!$o(n.value)||!!i.value||!!$o(ii(o.value))).value?r("details",{class:`${si}-toolui ${si}-toolui-collapsible`,"data-testid":w.toolCall,children:[r("summary",{class:`${si}-toolui-head`,children:r(Do,{name:Oo(e.toolName),state:a.value,approval:l.value,strings:t})}),r(rt,{label:t.toolParameters,value:n.value}),o.value!==void 0?r(rt,{label:t.toolResult,value:o.value}):null,i.value?r(rt,{label:t.statusError,value:i.value,error:!0}):null]}):null}var Le=x.cssPrefix;function Wl({message:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,showSources:a,interactive:l=!1,tool:s}){let d=J(()=>e.partsSig.value).value,u=J(()=>e.partsSig.value.some(v=>v.kind==="text"&&v.textSig.value.length>0)),_=J(()=>o&&e.partsSig.value.some(v=>v.kind==="reasoning")),f=e.role==="assistant"&&e.status==="streaming",g=n==="buffered"&&f,m=f&&!u.value,y=f&&!g&&!(_.value&&m),h=ip(e.createdAt);return r("div",{class:`${Le}-bubble-row`,"data-role":e.role,"data-testid":ve(w.messageBubble,e.id),children:r("div",{class:`${Le}-bubble-col`,children:[r("div",{class:`${Le}-bubble`,children:[g?r(_p,{label:t.loading}):d.map(v=>r(ap,{part:v,active:m,strings:t,showReasoning:o,showToolCalls:i,showSources:a,interactive:l,tool:s},cp(v))),y&&r(dp,{}),e.status==="error"&&e.errorText?r("div",{class:`${Le}-error`,role:"alert",children:r("span",{children:e.errorText})}):null]}),h?r("time",{class:`${Le}-bubble-time`,dateTime:h.iso,title:h.full,children:h.short}):null]})})}function ip(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 ap({part:e,active:t,strings:n,showReasoning:o,showToolCalls:i,showSources:a,interactive:l,tool:s}){switch(e.kind){case"step-start":return null;case"text":return r(No,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return o?r(lp,{part:e,active:t,strings:n}):null;case"tool":return r(sp,{part:e,strings:n,showToolCalls:i,interactive:l,tool:s});case"file":return e.mediaType.startsWith("image/")?r("img",{src:e.url,alt:"",loading:"lazy"}):r("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return a?r(Dl,{part:e,strings:n}):null}}function sp({part:e,strings:t,showToolCalls:n,interactive:o,tool:i}){let a=J(()=>e.approvalSig.value!==void 0);if(i?.humanInLoop){if(El(e.toolName))return r(zl,{part:e,strings:t,active:o,onSubmit:i.onResult,onDecision:i.onDecision,onEdit:i.onEdit});if(a.value)return r($l,{part:e,strings:t,active:o,onDecision:i.onDecision,onEdit:i.onEdit})}return n?r(Ul,{part:e,strings:t}):null}function lp({part:e,active:t,strings:n}){return r("details",{class:`${Le}-reasoning`,open:t,"data-active":t?"true":void 0,children:[r("summary",{class:`${Le}-reasoning-summary`,children:r("span",{class:`${Le}-reasoning-label`,children:t?n.thinking:n.thoughts})}),r("div",{class:`${Le}-reasoning-body`,children:r(No,{textSig:e.textSig,doneSig:e.doneSig})})]})}function cp(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 dp(){return r("span",{class:`${Le}-typing`,"aria-hidden":"true",children:[r("span",{}),r("span",{}),r("span",{})]})}function _p({label:e}){return r("span",{class:`${Le}-loading`,role:"status",children:[r("span",{class:`${Le}-loading-spinner`,"aria-hidden":"true"}),r("span",{class:`${Le}-loading-label`,children:e})]})}var Ut=x.cssPrefix,li=120,up=350,pp=1200;function Vl({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,showSources:a,loading:l,idle:s,tool:c,form:d,formMarkers:u,onFillForm:_}){let f=O(null),g=J(()=>e.value),[m,y]=R(!1),[h,v]=R(!1),C=O(!1),b=O(!1),T=O(!1),K=O(0),ae=()=>T.current||performance.now()-K.current<up,N=O(0),W=S=>{N.current=performance.now(),S.scrollTop=S.scrollHeight},F=g.value[0]?.id;ln(()=>{let S=f.current;if(!S||g.value.length===0||(C.current=!0,!g.value.some(st=>st.role==="user")))return;let U=()=>W(S);U();let xe=new ResizeObserver(U);xe.observe(S);let Ee=new MutationObserver(U);Ee.observe(S,{childList:!0,subtree:!0,characterData:!0});let ye=setTimeout(()=>{xe.disconnect(),Ee.disconnect()},300);return()=>{xe.disconnect(),Ee.disconnect(),clearTimeout(ye)}},[F]);let V=O(0);E(()=>{let S=f.current,U=g.value,xe=V.current;if(V.current=U.length,!S||!C.current)return;if(U.slice(xe).some(ye=>ye.role==="user")){b.current=!1,W(S);return}if(!U.some(ye=>ye.role==="user")||b.current||ae())return;S.scrollHeight-S.scrollTop-S.clientHeight<li&&W(S)},[g.value.length]),E(()=>{let S=f.current;if(!S)return;let U=g.value.at(-1);if(!U||U.status!=="streaming"&&!g.value.some(ye=>ye.role==="user"))return;let xe=()=>{if(b.current||ae())return;S.scrollHeight-S.scrollTop-S.clientHeight<li*2&&W(S)};if(U.status!=="streaming"){let ye=requestAnimationFrame(xe);return()=>cancelAnimationFrame(ye)}xe();let Ee=new MutationObserver(xe);return Ee.observe(S,{childList:!0,subtree:!0,characterData:!0}),()=>Ee.disconnect()},[g.value]);let Y=d?.form.id;ln(()=>{let S=f.current;!S||!Y||b.current||g.value.some(U=>U.role==="user")&&W(S)},[Y]),E(()=>{let S=f.current;if(!S)return;let U=()=>y(S.scrollHeight-S.scrollTop-S.clientHeight>li*2),xe,Ee=()=>{U(),performance.now()-N.current>150&&(b.current=S.scrollHeight-S.scrollTop-S.clientHeight>8),v(!0),clearTimeout(xe),xe=setTimeout(()=>v(!1),pp)},ye=()=>{b.current=!0},st=Ge=>{Ge.deltaY<0&&ye()},xt=0,Vt=Ge=>{xt=Ge.touches[0]?.clientY??0,T.current=!0},Pt=Ge=>{(Ge.touches[0]?.clientY??0)>xt+4&&ye()},He=()=>{T.current=!1,K.current=performance.now()},qt=()=>{T.current=!0};return S.addEventListener("scroll",Ee,{passive:!0}),S.addEventListener("wheel",st,{passive:!0}),S.addEventListener("touchstart",Vt,{passive:!0}),S.addEventListener("touchmove",Pt,{passive:!0}),S.addEventListener("touchend",He,{passive:!0}),S.addEventListener("touchcancel",He,{passive:!0}),S.addEventListener("pointerdown",qt,{passive:!0}),window.addEventListener("pointerup",He,{passive:!0}),window.addEventListener("pointercancel",He,{passive:!0}),U(),()=>{S.removeEventListener("scroll",Ee),S.removeEventListener("wheel",st),S.removeEventListener("touchstart",Vt),S.removeEventListener("touchmove",Pt),S.removeEventListener("touchend",He),S.removeEventListener("touchcancel",He),S.removeEventListener("pointerdown",qt),window.removeEventListener("pointerup",He),window.removeEventListener("pointercancel",He),clearTimeout(xe)}},[]);let be=()=>{let S=f.current;S&&(b.current=!1,W(S))},k=[],j="",oe=g.value.at(-1)?.id,de=[...u??[]].toSorted((S,U)=>(S.createdAt??1/0)-(U.createdAt??1/0)),_e=S=>r(Cl,{marker:S,strings:t,onFill:!d&&_?()=>_(S.formId):void 0},S.key),Me=S=>{for(let U=de[0];U?.createdAt!==void 0&&!(S!==void 0&&U.createdAt>S);U=de[0])de.shift(),k.push(_e(U))};for(let S of g.value){Me(S.createdAt);let U=mp(S.createdAt);U&&U!==j&&(k.push(r("div",{class:`${Ut}-date-divider`,children:r("span",{class:`${Ut}-date-pill`,title:fp(S.createdAt),children:gp(S.createdAt,t)})},`day:${U}`)),j=U),k.push(r(Wl,{message:S,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,showSources:a,interactive:!!s&&S.id===oe,tool:c},S.id))}for(let S of de)k.push(_e(S));return r("div",{class:`${Ut}-list-wrap`,children:[r("div",{ref:f,class:`${Ut}-list`,role:"log","aria-live":"polite","aria-relevant":"additions text","data-scrolling":h?"true":void 0,children:[l&&g.value.length===0?r("div",{class:`${Ut}-list-loading`,role:"status",children:t.conversationLoading}):null,k,d?r(kl,{form:d.form,strings:t,onSubmit:d.onSubmit,onSkip:d.onSkip}):null]}),m?r("button",{type:"button",class:`${Ut}-jump`,onClick:be,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":w.scrollToBottom,children:r(yo,{})}):null]})}function mp(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function fp(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function gp(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),i=Math.round((o(new Date)-o(n))/864e5);return i<=0?t.dateToday:i===1?t.dateYesterday:i<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var hp=["today","yesterday","lastWeek","older"];function vp(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((ql(e)-ql(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function Gl(e,t){let n=new Map;for(let o of t){let i=vp(e,o.lastMessageAt),a=n.get(i);a?a.push(o):n.set(i,[o])}return hp.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function ql(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var bp=B.scope("history"),xp=3,Pp=6,yp={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function Sp(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 Ho({transport:e,strings:t,locale:n,persistence:o,visitorId:i,onSelect:a,onNewConversation:l}){let s=x.cssPrefix,c=e.peekConversations({visitorId:i}),[d,u]=R(c?"loaded":"loading"),[_,f]=R(c?.conversations??[]);E(()=>{let h=!1;return e.listConversations({visitorId:i}).then(v=>{if(h)return;let C=v.conversations??[];f(C),u("loaded"),o.saveHistoryCount(C.length)}).catch(v=>{h||(bp.warn("listConversations failed",{err:v}),u("error"))}),()=>{h=!0}},[e,i,o]);let g=l?r("div",{class:`${s}-history-footer`,children:r("button",{type:"button",class:`${s}-history-new`,onClick:l,"data-testid":w.sidebarNewConversation,children:[r(Ns,{}),t.newConversation]})}):null;if(d==="loading"){let h=Math.min(o.loadHistoryCount()??xp,Pp);return r(ne,{children:[r("div",{class:`${s}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:r("div",{class:`${s}-history-group`,"aria-hidden":"true",children:[r("div",{class:`${s}-history-heading`,children:r("span",{class:`${s}-skeleton ${s}-skeleton-heading`})}),r("div",{class:`${s}-history-card`,children:Array.from({length:Math.max(1,h)},(v,C)=>r("div",{class:`${s}-history-item ${s}-history-item-skeleton`,children:[r("span",{class:`${s}-history-avatar ${s}-skeleton`}),r("span",{class:`${s}-history-body`,children:[r("span",{class:`${s}-history-row`,children:[r("span",{class:`${s}-history-title`,children:r("span",{class:`${s}-skeleton ${s}-skeleton-title`})}),r("span",{class:`${s}-history-time`,children:r("span",{class:`${s}-skeleton ${s}-skeleton-time`})})]}),r("span",{class:`${s}-history-row`,children:r("span",{class:`${s}-history-preview`,children:r("span",{class:`${s}-skeleton ${s}-skeleton-preview`})})})]})]},C))})]})}),g]})}if(d==="error"||_.length===0)return r(ne,{children:[r("div",{class:`${s}-history-empty`,children:t.historyEmpty}),g]});let m=Date.now(),y=Gl(m,_);return r(ne,{children:[r("div",{class:`${s}-history`,role:"list",children:y.map(h=>r("div",{class:`${s}-history-group`,children:[r("div",{class:`${s}-history-heading`,children:t[yp[h.bucket]]}),r("div",{class:`${s}-history-card`,children:h.conversations.map(v=>r("button",{type:"button",role:"listitem",class:`${s}-history-item`,onClick:()=>a(v),"data-closed":v.canContinue?void 0:"true","data-unread":(v.unreadCount??0)>0?"true":void 0,"data-testid":ve(w.historyItem,v.conversationId),children:[r("span",{class:`${s}-history-avatar`,"aria-hidden":"true",children:r(qr,{})}),r("span",{class:`${s}-history-body`,children:[r("span",{class:`${s}-history-row`,children:[r("span",{class:`${s}-history-title`,children:v.title}),r("span",{class:`${s}-history-time`,children:Sp(v.lastMessageAt,m,n)})]}),r("span",{class:`${s}-history-row`,children:[r("span",{class:`${s}-history-preview`,children:v.preview??(v.canContinue?t.historyContinue:t.conversationClosed)}),(v.unreadCount??0)>0?r("span",{class:`${s}-history-dot`}):null]})]})]},v.conversationId))})]},h.bucket))}),g]})}var Kl=x.cssPrefix;function jl({suggestions:e,onPick:t}){return e.length===0?null:r("div",{class:`${Kl}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((n,o)=>r("button",{type:"button",class:`${Kl}-suggestion`,onClick:()=>t(n),"data-testid":ve(w.suggestion,o),children:n.label},n.id))})}var Ce=x.cssPrefix;function Yl(e){let{options:t,onClose:n}=e,o=t.strings,i=O(null);E(()=>{let c=i.current;if(!c)return;let d=Eo(c),u=_=>{_.key==="Escape"&&n?.()};return c.addEventListener("keydown",u),()=>{d(),c.removeEventListener("keydown",u)}},[n]);let a=O(null),l=H(c=>{a.current?.attachFromDrop(c)},[]),{visible:s}=Io({containerRef:i,onDrop:l});return ko(i.current,t.mode==="modal"),r("div",{ref:i,class:`${Ce}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":w.panel,children:[r(ci,{...e,containerEl:i.current,dragOver:s,composerAttachApiRef:a}),r(di,{poweredBy:e.options.poweredBy})]})}function ci(e){let{options:t,transport:n,feedback:o,bus:i,persistence:a,panelSize:l,view:s,canSend:c,isStreaming:d,loadingMessages:u,messagesSig:_,agent:f,suggestions:g,initialWidgetSize:m,visitorId:y,onClose:h,onBack:v,onClear:C,onToggleHistory:b,onSelectHistoryConversation:T,onNewConversation:K,onWidgetSizeChange:ae,onSend:N,onStop:W,onSuggestion:F,activeForm:V,formMarkers:Y,onFormSubmit:be,onFormSkip:k,onFormFill:j,tool:oe,containerEl:de,dragOver:_e,composerAttachApiRef:Me}=e,S=t.strings,U;return V?U=null:c?U=r(ne,{children:[r(jl,{suggestions:g,onPick:F}),r(bl,{options:t,transport:n,feedback:o,bus:i,isStreaming:d,onSend:N,onStop:W,attachApiRef:Me})]}):U=r(kp,{label:S.conversationClosed,ctaLabel:S.startNewConversation,onNewConversation:C}),r(ne,{children:[s==="history"?r(wp,{strings:S,onBack:b,onClose:h,showClose:Co(t.mode,l,t.actions)}):r("header",{class:`${Ce}-header`,"data-testid":w.panelHeader,children:[v?r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:v,"aria-label":S.moduleBack,title:S.moduleBack,children:r(hn,{})}):null,f?r(gl,{agent:f,strings:S}):r("h1",{children:S.panelTitle}),r(We,{panelProps:e,variant:"chat"})]}),s==="history"?r(Ho,{transport:n,strings:S,locale:t.locale,persistence:a,visitorId:y,onSelect:xe=>T(xe.conversationId),onNewConversation:K}):r(ne,{children:[r(xl,{visible:_e,strings:S}),r(Vl,{messagesSig:_,strings:S,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,loading:u,idle:!d,tool:oe,form:V?{form:V,onSubmit:be,onSkip:k}:null,formMarkers:Y,onFillForm:j}),U,r(Cp,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?r(wo,{panelEl:de,resize:t.size.resize,position:t.position,initialSize:m,onSizeChange:ae,strings:S}):null]})}function wp({strings:e,onBack:t,onClose:n,showClose:o}){return r("header",{class:`${Ce}-header`,children:[r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:r(hn,{})}),r("h1",{children:e.historyTitle}),o?r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:r(Ue,{})}):null]})}function kp({label:e,ctaLabel:t,onNewConversation:n}){return r("div",{class:`${Ce}-readonly-banner`,role:"note",children:[r("span",{class:`${Ce}-readonly-label`,children:e}),r("button",{type:"button",class:`${Ce}-readonly-cta`,onClick:n,children:t})]})}function Cp({disclaimer:e}){return e?r("div",{class:`${Ce}-composer-footer`,children:r("div",{class:`${Ce}-disclaimer`,children:e})}):null}function di({poweredBy:e}){return e?r("div",{class:`${Ce}-poweredby-bar`,children:r(Ep,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Ep({logoUrl:e,text:t,href:n}){let o=r(ne,{children:[e?r("img",{class:`${Ce}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?r("span",{children:t}):null]});return n?r("a",{class:`${Ce}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):r("span",{class:`${Ce}-poweredby`,children:o})}function Xl(e){let t=O(e);t.current=e;let n=O(null);return n.current??(n.current=Tp(t)),n.current}function Tp(e){let t=$(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,i=c=>c.frequency==="always"?!1:c.frequency==="conversation"?n.has(o(c.id)):c.id in e.current.persistence.loadFormsDone(),a=(c,d)=>{if(t.value)return;let u=e.current;if(c==="manual"){let _=u.forms.list.find(f=>f.id===d);_&&(t.value={form:_,trigger:"manual"});return}for(let _ of u.forms.byTrigger[c]??[]){let f=_.triggers.find(g=>g.kind===c);if(!(!f||!Rp(f,u)||i(_)||!Ip(_,u))){t.value={form:_,trigger:c};return}}},l=(c,d)=>{let u=t.value;if(!u)return;t.value=null;let{form:_,trigger:f}=u;_.frequency==="conversation"?n.add(o(_.id)):_.frequency!=="always"&&e.current.persistence.saveFormDone(_.id),e.current.onComplete(_,f,c,d)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let d=e.current.forms.list.find(u=>u.id===c.form.id);d&&d!==c.form&&(t.value={form:d,trigger:c.trigger})},complete:c=>l(c,!1),skip:()=>l({},!0)}}function Rp(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Ip(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let i=t.userContext()??{};if(n.missingContext.some(a=>i[a]!==void 0&&i[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 Jl(e){let t=x.cssPrefix,{site:n,blocks:o,strings:i,collapsed:a}=e,l=o?.navigation??[],s=o?.linkCards??[],c=a?i.expandSidebar:i.collapseSidebar;return r("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":w.sidebar,children:[r("div",{class:`${t}-sidebar-header`,children:[r(Ap,{site:n}),r("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":w.sidebarToggle,children:r(Lp,{collapsed:a})})]}),a?null:r(ne,{children:[l.length>0?r("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:r(Mp,{items:l})}):null,s.length>0?r("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:r(Np,{items:s})}):null,e.showConversations?r("div",{class:`${t}-sidebar-conversations`,children:r(Ho,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,visitorId:e.visitorId,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Ap({site:e}){let t=x.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return r("picture",{children:[e.logoDark?.url?r("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,r("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return r("div",{class:`${t}-sidebar-title`,children:e?.title??x.name})}function Lp({collapsed:e}){return r("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?r("polyline",{points:"9 6 15 12 9 18"}):r("polyline",{points:"15 6 9 12 15 18"})})}function Mp({items:e}){let t=x.cssPrefix;return r("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>r("li",{children:r("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?r("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,r("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function Np({items:e}){let t=x.cssPrefix;return r("div",{class:`${t}-sidebar-cards`,children:e.map(n=>r("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[r("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?r("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var Ql=x.cssPrefix;function Zl(e){return r("main",{class:`${Ql}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[r(Jl,{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}),r("section",{class:`${Ql}-page-chat`,"aria-label":"Chat",children:e.children})]})}var ec=e=>Object.fromEntries(e.map(t=>[t,[]]));function tc(e,t,n){let o=$({activeTab:e,stacks:ec(t)});return{sig:o,switchTab(i){o.value.activeTab!==i&&(o.value={...o.value,activeTab:i},n?.(i))},push(i){let a=o.value,l=a.stacks[a.activeTab]??[];o.value={...a,stacks:{...a.stacks,[a.activeTab]:[...l,i]}}},pop(){let i=o.value,a=i.stacks[i.activeTab]??[];a.length!==0&&(o.value={...i,stacks:{...i.stacks,[i.activeTab]:a.slice(0,-1)}})},reset(i){o.value={activeTab:i,stacks:ec(t)}}}}var nc=e=>e.stacks[e.activeTab]??[],oc=e=>nc(e).at(-1),rc=e=>nc(e).length===0;var ic={Icon:vn};var it=x.cssPrefix;function Bo({title:e,actions:t}){return r("header",{class:`${it}-back-header`,"data-variant":"title",children:[r("span",{class:`${it}-back-spacer`,"aria-hidden":"true"}),r("h1",{class:`${it}-back-title`,children:e}),t??r("span",{class:`${it}-back-spacer`,"aria-hidden":"true"})]})}function Fo({title:e,backLabel:t,onBack:n,actions:o,testid:i}){return r("header",{class:`${it}-back-header`,"data-testid":i,children:[r("button",{type:"button",class:`${it}-icon-btn`,onClick:n,"aria-label":t,title:t,children:r(hn,{})}),r("h1",{class:`${it}-back-title`,children:e}),o??r("span",{class:`${it}-back-spacer`,"aria-hidden":"true"})]})}var Wt=x.cssPrefix;function ac({placeholder:e,onActivate:t}){return r("button",{type:"button",class:`${Wt}-home-search`,onClick:t,"data-testid":w.homeSearch,children:[r("span",{class:`${Wt}-home-search-text`,children:e}),r("span",{class:`${Wt}-home-search-icon`,"aria-hidden":"true",children:r(Kr,{})})]})}function sc({placeholder:e,value:t,onInput:n}){return r("div",{class:`${Wt}-home-search`,"data-input":"true",children:[r("input",{type:"search",class:`${Wt}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":w.helpSearch}),r("span",{class:`${Wt}-home-search-icon`,"aria-hidden":"true",children:r(Kr,{})})]})}var yn=x.cssPrefix;function zo({title:e,subtitle:t,onClick:n,testid:o}){return r("button",{type:"button",class:`${yn}-list-row`,onClick:n,"data-testid":o,children:[r("span",{class:`${yn}-list-row-body`,children:[r("span",{class:`${yn}-list-row-title`,children:e}),t?r("span",{class:`${yn}-list-row-sub`,children:t}):null]}),r("span",{class:`${yn}-list-row-chevron`,"aria-hidden":"true",children:r(Ht,{})})]})}var lc=x.cssPrefix;function $e({tone:e="info",message:t,onRetry:n,strings:o}){return r("div",{class:`${lc}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[r("span",{children:t}),n?r("button",{type:"button",class:`${lc}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var bt=x.cssPrefix,Op=B.scope("help"),Dp=(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 $p(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 cc(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let i=0;for(let a of e){if(i=n.indexOf(a,i),i===-1)return 0;i+=1}return 1}function Hp(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(cc(n,o.title)*2,cc(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,i)=>i.score-o.score).map(o=>o.item):[]}function dc({article:e,nav:t}){return r(zo,{title:e.title,subtitle:e.description,onClick:()=>Dp(t,e),testid:ve(w.helpArticle,e.id)})}function Bp({transport:e,strings:t,config:n,nav:o,bus:i,panelProps:a}){let l=n.contentTags,[s,c]=R("loading"),[d,u]=R(t.errorGeneric),[_,f]=R([]),[g,m]=R(""),[y,h]=R(0);E(()=>{let b=!1;return c("loading"),e.listContent({tags:l,sortBy:"order",limit:100}).then(T=>{if(b)return;let K=T.items??[];f(K),c("loaded"),i.emit("contentView",{section:"help",tags:l?.join(","),count:K.length})}).catch(T=>{b||(Op.warn("listContent (help) failed",{err:T}),u(ft(T,t)),c("error"))}),()=>{b=!0}},[e,l,y,i]);let v=ke(()=>Hp(_,g),[_,g]);E(()=>{let b=g.trim();if(!b)return;let T=setTimeout(()=>i.emit("contentSearch",{queryLength:b.length,hitCount:v.length}),600);return()=>clearTimeout(T)},[g,v,i]);function C(){return g.trim().length>0?v.length===0?r($e,{message:t.helpSearchEmpty,strings:t}):r("div",{class:`${bt}-help-card`,children:v.map(b=>r(dc,{article:b,nav:o},b.id))}):s==="loading"?r($e,{message:t.helpLoading,strings:t}):s==="error"?r($e,{tone:"error",message:d,onRetry:()=>h(b=>b+1),strings:t}):_.length===0?r($e,{message:t.helpEmpty,strings:t}):$p(_).map(([b,T])=>r("section",{class:`${bt}-help-group`,children:[b?r("h2",{class:`${bt}-help-section-title`,children:b}):null,r("div",{class:`${bt}-help-card`,children:T.map(K=>r(dc,{article:K,nav:o},K.id))})]},b))}return r("div",{class:`${bt}-module`,children:[r(Bo,{title:t.helpTitle,actions:r(We,{panelProps:a,variant:"plain"})}),r("div",{class:`${bt}-module-pad`,children:r(sc,{placeholder:t.helpSearchPlaceholder,value:g,onInput:m})}),r("div",{class:`${bt}-help-list`,children:C()})]})}var _c={Icon:Gr,Root:e=>r(Bp,{...e})};var uc=x.cssPrefix;function _i({onClick:e,children:t,testid:n}){return e?r("button",{type:"button",class:`${uc}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):r("div",{class:`${uc}-home-card`,"data-testid":n,children:t})}var ie=x.cssPrefix,pc=B.scope("home");function Fp(e){let t=e.options.userContext?.name,n=e.config.greetingText?we(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 zp=(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 Up(e){let{transport:t,strings:n,config:o,nav:i,bus:a,panelProps:l}=e,[s,c]=R(null),[d,u]=R([]),_=o.contentTags?.join(",");E(()=>{if(!o.showRecentConversations)return;let v=!1;return t.listConversations({limit:1}).then(C=>!v&&c(C.conversations?.[0]??null)).catch(C=>!v&&pc.warn("listConversations (home) failed",{err:C})),()=>{v=!0}},[t,o.showRecentConversations]),E(()=>{if(!o.contentTags?.length)return;let v=!1;return t.listContent({tags:o.contentTags,limit:6}).then(C=>{if(v)return;let b=C.items??[];u(b),a.emit("contentView",{section:"home",tags:_,count:b.length})}).catch(C=>!v&&pc.warn("listContent (home) failed",{err:C})),()=>{v=!0}},[t,_,a]);let f=Fp(e),g=o.userAvatars??[],m=o.status,y=m?.text?we(n,m.text):n.homeStatus,h=o.contentBlockTitle?we(n,o.contentBlockTitle):n.homeContentTitle;return r("div",{class:`${ie}-module ${ie}-home`,"data-testid":w.homeView,children:r("div",{class:`${ie}-home-scroll`,children:[r("div",{class:`${ie}-home-hero`,children:[r("div",{class:`${ie}-home-hero-top`,children:[o.brandName?r("span",{class:`${ie}-home-brand`,"data-testid":w.homeBrand,children:o.brandName}):r("span",{class:`${ie}-home-brand-spacer`,"aria-hidden":"true"}),r("div",{class:`${ie}-home-hero-actions`,children:[g.length>0?r("div",{class:`${ie}-home-avatars`,children:g.map(v=>r("span",{class:`${ie}-home-avatar`,title:v.role?`${v.name} \xB7 ${v.role}`:v.name,children:v.avatar?r("img",{src:v.avatar,alt:"",loading:"lazy"}):r("span",{children:To(v.name)})},v.name))}):null,r(We,{panelProps:l,variant:"plain"})]})]}),o.showGreeting!==!1?r(ne,{children:[r("h1",{class:`${ie}-home-greeting`,"data-testid":w.homeGreeting,children:f.title}),f.subtitle?r("p",{class:`${ie}-home-lead`,children:f.subtitle}):null]}):null]}),r("div",{class:`${ie}-home-cards`,children:[o.showSearchBar!==!1?r(ac,{placeholder:n.homeSearchPlaceholder,onActivate:()=>i.switchToLayout("help")}):null,s?r(_i,{onClick:()=>i.selectConversation(s.conversationId),testid:w.homeRecent,children:r("div",{class:`${ie}-home-recent-row`,"data-unread":(s.unreadCount??0)>0?"true":void 0,children:[r("span",{class:`${ie}-home-recent-avatar`,"aria-hidden":"true",children:r(vn,{})}),r("span",{class:`${ie}-home-recent-body`,children:[r("span",{class:`${ie}-home-recent-title`,children:s.title}),s.preview?r("span",{class:`${ie}-home-recent-preview`,children:s.preview}):null]}),(s.unreadCount??0)>0?r("span",{class:`${ie}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,m?r(_i,{onClick:m.url?()=>i.push({kind:"iframe",url:m.url,title:y}):void 0,children:r("div",{class:`${ie}-home-status`,"data-level":m.level??"operational",children:[r("span",{class:`${ie}-home-status-icon`,"aria-hidden":"true",children:r(tl,{})}),r("span",{class:`${ie}-home-status-text`,children:y})]})}):null,d.length>0?r("section",{class:`${ie}-home-content`,children:[r("div",{class:`${ie}-home-content-title`,children:h}),r("div",{class:`${ie}-home-content-list`,children:d.map(v=>r(zo,{title:v.title,subtitle:v.description,onClick:()=>zp(i,v),testid:ve(w.homeContentRow,v.id)},v.id))})]}):null]})]})})}var mc={Icon:nl,Root:e=>r(Up,{...e})};var at=x.cssPrefix,Wp=B.scope("news");function Vp({transport:e,strings:t,config:n,nav:o,bus:i,panelProps:a}){let l=n.contentTags,[s,c]=R("loading"),[d,u]=R(t.errorGeneric),[_,f]=R([]),[g,m]=R(0);E(()=>{let h=!1;return c("loading"),e.listContent({tags:l,sortBy:"publishedAt",sortOrder:"desc"}).then(v=>{if(h)return;let C=v.items??[];f(C),c("loaded"),i.emit("contentView",{section:"news",tags:l?.join(","),count:C.length})}).catch(v=>{h||(Wp.warn("listContent (news) failed",{err:v}),u(ft(v,t)),c("error"))}),()=>{h=!0}},[e,l,g,i]);function y(){return s==="loading"?r($e,{message:t.newsLoading,strings:t}):s==="error"?r($e,{tone:"error",message:d,onRetry:()=>m(h=>h+1),strings:t}):_.length===0?r($e,{message:t.newsEmpty,strings:t}):r("div",{class:`${at}-news-list`,children:_.map(h=>r("button",{type:"button",class:`${at}-news-card`,onClick:()=>o.push({kind:"content",id:h.id,title:h.title}),"data-testid":ve(w.newsItem,h.id),children:[h.image?r("img",{class:`${at}-news-hero`,src:h.image,alt:"",loading:"lazy"}):null,r("span",{class:`${at}-news-body`,children:[r("span",{class:`${at}-news-title`,children:h.title}),h.description?r("span",{class:`${at}-news-summary`,children:h.description}):null]})]},h.id))})}return r("div",{class:`${at}-module`,children:[r(Bo,{title:t.newsTitle,actions:r(We,{panelProps:a,variant:"plain"})}),r("div",{class:`${at}-module-scroll`,children:y()})]})}var fc={Icon:ol,Root:e=>r(Vp,{...e})};var Uo={chat:ic,home:mc,help:_c,news:fc};var Sn=x.cssPrefix;function gc({modules:e,activeTab:t,strings:n,unreadCount:o,onSelect:i}){return r("nav",{class:`${Sn}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let l=Uo[a.layout].Icon,s=a.id===t,c=a.layout==="chat"&&o>0?o>9?"9+":String(o):null;return r("button",{type:"button",role:"tab","aria-selected":s,class:`${Sn}-tab`,onClick:()=>i(a.id),"data-testid":ve(w.tab,a.id),children:[r("span",{class:`${Sn}-tab-icon`,"aria-hidden":"true",children:[r(l,{}),c?r("span",{class:`${Sn}-tab-badge`,"data-testid":w.tabBadge,children:c}):null]}),r("span",{class:`${Sn}-tab-label`,children:we(n,a.label)})]},a.id)})})}var hc=x.cssPrefix,qp="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function vc({url:e,title:t,strings:n,onBack:o,actions:i}){return r("div",{class:`${hc}-module`,children:[r(Fo,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:i}),r("iframe",{class:`${hc}-content-frame`,src:e,title:t||"content",sandbox:qp,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var wn=x.cssPrefix,Gp=B.scope("content"),Kp=5e3;function bc({id:e,title:t,transport:n,strings:o,bus:i,onBack:a,actions:l}){let[s,c]=R(null),[d,u]=R(!1),[_,f]=R(0),g=H(()=>{u(!1),c(null),f(h=>h+1)},[]);E(()=>{let h=!1;return n.listContent({ids:[e],limit:1}).then(v=>{if(h)return;let C=v.items[0];C?(c(C),i.emit("contentOpen",{contentId:e,tags:C.tags?.length?C.tags.join(","):void 0})):u(!0)}).catch(v=>{h||(Gp.warn("listContent (reader) failed",{err:v}),u(!0))}),()=>{h=!0}},[n,e,_,i]),E(()=>{if(!s)return;let h=setTimeout(()=>i.emit("contentRead",{contentId:e}),Kp);return()=>clearTimeout(h)},[s,e,i]);let m=H(h=>{let C=h.target?.closest?.("a")?.getAttribute("href")??"";C&&!C.startsWith("#")&&i.emit("contentLinkClick",{contentId:e})},[i,e]);function y(){return d?r($e,{tone:"error",message:o.errorGeneric,onRetry:g,strings:o}):s===null?r($e,{message:o.contentLoading,strings:o}):r("article",{class:`${wn}-content`,"data-testid":w.contentView,onClick:m,children:[s.image?r("img",{class:`${wn}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?r("p",{class:`${wn}-content-subtitle`,children:s.description}):null,r(Ol,{text:s.content??""})]})}return r("div",{class:`${wn}-module`,children:[r(Fo,{title:s?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:a,actions:l,testid:w.backHeader}),r("div",{class:`${wn}-module-scroll`,"data-testid":w.contentScroll,children:y()})]})}var Wo=x.cssPrefix;function xc({panelProps:e,enabledModules:t,nav:n,bus:o,unreadCount:i,onSelectConversation:a,onStartNewConversation:l,onSetPanelSize:s}){let c=e.options,d=c.strings,u=O(null),_=O(new Set);E(()=>{let Y=u.current;if(!Y)return;let be=Eo(Y),k=j=>{j.key==="Escape"&&e.onClose?.()};return Y.addEventListener("keydown",k),()=>{be(),Y.removeEventListener("keydown",k)}},[e.onClose]);let f=O(null),g=H(Y=>{f.current?.attachFromDrop(Y)},[]),{visible:m}=Io({containerRef:u,onDrop:g});ko(u.current,c.mode==="modal");let y=J(()=>n.sig.value).value,h=oc(y),v=c.modules.byId[y.activeTab],C=h?.kind==="iframe"||h?.kind==="content",b=t.length>1&&(rc(y)||!C),T=O(null);E(()=>{if(C&&T.current===null)T.current=e.panelSize,e.panelSize==="normal"&&s("expanded");else if(!C&&T.current!==null){let Y=T.current;T.current=null,s(Y)}},[C]);let K={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:Y=>{let be=t.find(k=>k.layout===Y);be&&n.switchTab(be.id)},selectConversation:a,startNewConversation:l},ae=Y=>({options:c,transport:e.transport,strings:d,config:Y,visitorId:e.visitorId,nav:K,bus:o,panelProps:e}),N=r(We,{panelProps:e,variant:"plain"});v&&_.current.add(v.id);let W=t.filter(Y=>_.current.has(Y.id)),F=Y=>{if(Y.layout==="chat")return r(ci,{...e,containerEl:u.current,dragOver:m,composerAttachApiRef:f});let be=Uo[Y.layout].Root;return be?r(be,{...ae(Y)}):null},V=()=>h?.kind==="iframe"?r(vc,{url:h.url,title:h.title,strings:d,onBack:n.pop,actions:N}):h?.kind==="content"?r(bc,{id:h.id,title:h.title,transport:e.transport,strings:d,bus:o,onBack:n.pop,actions:N}):null;return r("div",{ref:u,class:`${Wo}-panel ${Wo}-messenger`,role:"dialog","aria-modal":"false","aria-label":d.panelTitle,style:{position:"relative"},"data-testid":w.messengerHome,children:[r("div",{class:`${Wo}-messenger-body`,children:[W.map(Y=>r("div",{class:`${Wo}-messenger-pane`,hidden:C||Y.id!==v?.id,children:F(Y)},Y.id)),V()]}),b?r(gc,{modules:t,activeTab:y.activeTab,strings:d,unreadCount:i,onSelect:n.switchTab}):null,r(di,{poweredBy:c.poweredBy}),c.size.resize?.enabled&&!(v?.layout==="chat"&&!h)?r(wo,{panelEl:u.current,resize:c.size.resize,position:c.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:d}):null]})}var kn=x.cssPrefix;function Pc({strings:e,onClose:t}){return r("div",{class:`${kn}-panel ${kn}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":w.modulesEmpty,children:[t?r("button",{type:"button",class:`${kn}-icon-btn ${kn}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:r(Ue,{})}):null,r("p",{class:`${kn}-modules-empty-text`,children:e.modulesEmpty})]})}function yc({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[i,a]=R(()=>o?!1:t.loadCalloutDismissed(n));E(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let l=H(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:i,dismissCallout:l}}var G=B.scope("app"),Vo=x.cssPrefix;function Sc(e,t){return ks({...e,text:we(t,e.text)})}function jp(e){let t=e.partsSig.value.filter(n=>n.kind==="tool");return t.length>0&&t.every(n=>{let o=n.stateSig.value;return o==="output-available"||o==="output-error"||o==="output-denied"||o==="approval-responded"})}function wc({options:e,hostElement:t,bus:n}){let[o]=R(()=>nt(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i,a]=R(()=>o.getVisitorId()),l=o.loadUserPrefs(),[s,c]=R(()=>l.locale??e.locale),[d,u]=R(()=>l.themeMode??e.themeMode),[_,f]=R(()=>l.textSize??e.textSize),g=un(o.loadConversationId()),m=un([]),y=un(0),[h,v]=R(!1),[C,b]=R([]);function T(){let p=e.modules.list,P=new Set(p.map(M=>M.id)),A=o.loadActiveModule();return A&&P.has(A)?A:p[0]?.id??""}function K(){return e.modules.list.find(p=>p.layout==="chat")?.id}let ae=O();if(!ae.current){let p=e.modules.list.map(P=>P.id);ae.current=tc(T(),p,P=>o.saveActiveModule(P))}let N=ae.current,W=O(void 0);W.current=K();let[F,V]=R(!1),[Y,be]=R(null),[k,j]=R(!1),oe=e.mode==="standalone"||e.mode==="inline",de=O(pn(e,Dt(),o.loadPanelOpen(),o.loadPanelSize())),[_e,Me]=R(de.current.panelOpen),[S,U]=R(de.current.panelOpen),xe=O(S);xe.current=S;let Ee=O(!1),ye=O(void 0);E(()=>{_e&&U(!0)},[_e]);let st=O(!1),[xt,Vt]=R(!1),{dismissed:Pt,dismissCallout:He}=yc({callout:e.launcher.callout,persistence:o}),qt=e.launcher.callout?.persistent??!0,Ge=H(()=>{G.info("calloutDismiss"),n.emit("calloutDismiss",void 0),He()},[n,He]),[Re,yt]=R(de.current.panelSize),Si=O(!1),[Mc,Yo]=R("chat"),[Gt,Kt]=R(!0),[Be,Cn]=R(!1),[Nc,wi]=R(null),[Xo,En]=R([]),[Tn,Rn]=R(null),In=O(e.strings),[Oc,Dc]=R(void 0),[$c,Hc]=R(void 0),[Bc,Fc]=R(()=>o.loadSidebarCollapsed()??!1),[Jo,zc]=R({}),[Z]=R(()=>new ho({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:us({publicKey:e.publicKey,aiAgentDeploymentId:e.aiAgentDeploymentId,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[Fe]=R(()=>new vo(m)),[le]=R(()=>new Po(e.sound,e.haptics)),ze=H(p=>{o.patchUserPrefs(p),Z.saveUserPrefs(o.loadUserPrefs()).catch(P=>{G.warn("saveUserPrefs failed",{err:P})})},[o,Z]);E(()=>{l.soundMuted!==void 0&&le.setMuted(l.soundMuted)},[]),E(()=>{t.dataset.theme=d},[t,d,e]),E(()=>{t.dataset.textSize=_},[t,_,e]),E(()=>{le.update(e.sound,e.haptics)},[le,e.sound,e.haptics]),E(()=>()=>le.destroy(),[le]),E(()=>{let p=!0;return le.mutedSig.subscribe(P=>{if(p){p=!1;return}ze({soundMuted:P})})},[le,ze]),E(()=>{Si.current||!e.size.initialSize||(Si.current=!0,!o.loadPanelSize()&&yt(Hr(e.mode,e.size,Dt())))},[e.mode,e.size,o]),E(()=>{if(!F||st.current)return;st.current=!0;let p=pn(e,Dt(),o.loadPanelOpen(),o.loadPanelSize());Me(p.panelOpen),yt(p.panelSize)},[F,e,o]);let ki=O(!1),Ci=O(!1),An=O(null);E(()=>{if(!(!F||ki.current)){if(ki.current=!0,Ci.current){let p=W.current;p&&N.switchTab(p);return}N.reset(T())}},[F]);let Ln=H(p=>{!p||p.length===0||(m.value=p.map(P=>Sc(P,In.current)))},[m]),Qo=O(null),Mn=H(async p=>{try{let{formSubmissions:P}=await(p?Z.bootstrap(p):Qo.current??Z.bootstrap()),A=new Map;return P.forEach((M,z)=>A.set(M.formId,z)),P.filter((M,z)=>!M.skipped||A.get(M.formId)===z).map((M,z)=>({key:`wire:${M.formId}:${M.createdAt??z}`,formId:M.formId,outcome:M.skipped?"skipped":"submitted",createdAt:go(M.createdAt),values:M.values}))}catch(P){return G.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:P}),[]}},[Z]),jt=O(0),Yt=H((p,P)=>{let A=[...p.map(I=>I.createdAt),...P.map(I=>I.createdAt)].filter(I=>I!==void 0),M=(A.length?Math.min(...A):Date.now())-1;return[...(ye.current?.messages??[]).map(I=>{let ge=Sc(I,In.current);return ge.createdAt=M,ge}),...p]},[]),Zo=H(async p=>{let P=jt.current,A=()=>P!==jt.current;v(!0);try{let[M,z]=await Promise.all([Z.loadConversation(p),Mn()]);if(A())return;let I=(M.messages??[]).map(Wr);b(z);let ge=An.current?[An.current]:[];I.length||ge.length?(m.value=[...Yt(I,z),...ge],Kt(M.canContinue??!0),En(M.suggestions??[])):m.value=Yt([],z)}catch(M){if(A())return;G.warn("loadThread failed; resetting conversationId",{err:M,conversationId:p}),g.value=void 0,o.saveConversationId(void 0)}finally{A()||v(!1)}},[Z,Mn,m,g,o,Yt]),Xt=H(async({newConversation:p})=>{let P=++jt.current,A=()=>P!==jt.current,M=g.value,z=p||!M?Ne():M;z!==M&&(g.value=z,o.saveConversationId(z));let I;try{I=await Z.handshake({visitorId:i,conversationId:z,userPrefs:o.loadUserPrefs(),locale:s})}catch(en){if(A())return;n.emit("error",en),e.onError?.(en),p||V(!0);return}if(A())return;if(I.visitorId&&I.visitorId!==i&&(G.info("visitor rebound",{previous:i,current:I.visitorId,reason:I.rebind?.visitorId}),o.setVisitorId(I.visitorId),a(I.visitorId),n.emit("visitorRebound",{previous:i,current:I.visitorId,reason:I.rebind?.visitorId})),I.conversationId&&I.conversationId!==z&&(G.info("conversation rebound",{previous:z,current:I.conversationId,reason:I.rebind?.conversationId}),n.emit("conversationRebound",{previous:z,current:I.conversationId,reason:I.rebind?.conversationId})),I.agent&&wi(I.agent),e.mode==="page"&&(I.site&&ds(I.site)?Dc(I.site):I.site&&G.warn("invalid site config, using fallback",{site:I.site}),I.blocks&&_s(I.blocks)?Hc(I.blocks):I.blocks&&G.warn("invalid blocks config, using fallback",{blocks:I.blocks})),I.userPrefs&&!p&&(o.saveUserPrefs(I.userPrefs),I.userPrefs.locale&&c(I.userPrefs.locale),I.userPrefs.soundMuted!==void 0&&le.setMuted(I.userPrefs.soundMuted),I.userPrefs.themeMode&&u(I.userPrefs.themeMode),I.userPrefs.textSize&&f(I.userPrefs.textSize)),ye.current=I.welcome,p||n.emit("handshake",I),I.welcome?.suggestions){let en=In.current;En(I.welcome.suggestions.map(Hn=>({...Hn,label:we(en,Hn.label),...Hn.text===void 0?{}:{text:we(en,Hn.text)}})))}!p&&M&&I.conversationId===M?xe.current?Zo(M):Ee.current=!0:(g.value=I.conversationId,o.saveConversationId(I.conversationId),Ln(I.welcome?.messages)),p||V(!0)},[Z,i,o,e,n,g,le,Ln,Zo,s]),Jt=JSON.stringify(e.userContext??null),Uc=JSON.stringify(e.pageContext??null),Wc=JSON.stringify(Jo);E(()=>{let p=Object.keys(Jo).length?{...Jo,...e.userContext}:e.userContext;Z.setContext(p,Yp(e.pageContext))},[Z,Jt,Uc,Wc]);let Ie=Ct(s,e.availableLocales,e.defaultLocale);E(()=>{Z.setLocale(Ie)},[Z,Ie]),E(()=>{t.dir=Ui(Ie)?"rtl":"ltr"},[t,Ie]),E(()=>{Ie!==s&&c(Ie)},[Ie,s]);let Vc=H(async p=>{let P=null;try{for await(let A of p.iter){if(!P){P=Ur(),An.current=P,Fe.attach(P),m.value=[...m.value,P],Cn(!0),Rn(()=>p.cancel),Ci.current=!0;let M=W.current;M&&N.switchTab(M),G.info("resumed in-flight reply on mount")}Fe.apply(A.chunk),A.chunk.type==="finish"&&A.chunk.canContinue===!1&&Kt(!1)}P&&(P.status="complete",le.play("messageReceived"),ui(n,e,"assistant",Vr(P)))}catch(A){P&&(P.status="error",P.errorText=ft(A,e.strings),le.play("error")),G.debug("mount resume ended without completing",{err:A})}finally{An.current=null,P&&(Fe.detach(),Cn(!1),Rn(null),m.value=[...m.value])}},[Fe,m,le,n,e,N]),Ei=O(null);E(()=>{let p=g.value;return p&&Z.primeIdentity(i,p),Xt({newConversation:!1}),()=>{jt.current++,Ei.current?.cancel()}},[]),E(()=>{if(S){if(Qo.current=Z.bootstrap(),(async()=>{try{let p=await Qo.current;be(on((p??{forms:[]}).forms,Ie))}catch(p){G.debug("bootstrap failed \u2014 treating as no forms",{err:p})}finally{j(!0)}})(),Ee.current){Ee.current=!1;let p=g.value;p&&Zo(p)}if(g.value){let p=Z.resumeStream();Ei.current=p,Vc(p)}}},[S]);let Nn=O(null);E(()=>{if(!S)return;if(Nn.current===null){Nn.current=Ie;return}if(Nn.current===Ie)return;Nn.current=Ie;let p=!1;return Z.bootstrap().then(P=>{p||be(on((P??{forms:[]}).forms,Ie))}).catch(P=>G.debug("forms re-localize failed \u2014 keeping current copy",{err:P})),()=>{p=!0}},[S,Ie,Z]);let Ti=O(Jt);E(()=>{!F||Ti.current===Jt||(Ti.current=Jt,Xt({newConversation:!1}))},[Jt,F,Xt]),E(()=>{oo(t,fo(e.mode,Re,_e))},[t,_e,Re,e.mode]),E(()=>{if(e.mode!=="modal"||!_e)return;let p=P=>{P.composedPath().some(z=>z instanceof HTMLElement&&z.classList.contains(`${x.cssPrefix}-panel`))||Me(!1)};return t.addEventListener("click",p),()=>t.removeEventListener("click",p)},[t,_e,e.mode]),E(()=>{if(e.mode!=="drawer"||!_e)return;let p=P=>{P.key==="Escape"&&Me(!1)};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[_e,e.mode]);let On=H(async(p,{continueExisting:P})=>{let A=g.value??Ne();g.value||(g.value=A,o.saveConversationId(A));let M=(P?m.value:m.value.slice(0,-1)).filter(ge=>!ge.ephemeral),z=bs({messages:M.map(Cs),conversationId:A,messageId:p.serverMessageId??p.id,tools:e.features.tools,visitorId:i,userPrefs:o.loadUserPrefs()});Cn(!0);let I=Z.sendMessage(z);Rn(()=>I.cancel);try{for await(let ge of I.iter)Fe.apply(ge.chunk),ge.chunk.type==="finish"&&ge.chunk.canContinue===!1&&Kt(!1);p.status="complete",le.play("messageReceived"),ui(n,e,"assistant",Vr(p))}catch(ge){p.status="error",p.errorText=ft(ge,e.strings),le.play("error"),n.emit("error",ge),e.onError?.(ge)}finally{Fe.detach(),Cn(!1),Rn(null),m.value=[...m.value]}},[Z,Fe,m,g,e,n,le,o,i]),Dn=H((p,P)=>{if(Be)return;let A=m.value.at(-1),M=A?.partsSig.value.find(z=>z.kind==="tool"&&z.toolCallId===p);if(!A||!M){G.warn("decideTool: tool part not found",{toolCallId:p});return}P(M),A.partsSig.value=[...A.partsSig.value],jp(A)&&(A.status="streaming",Fe.attach(A),On(A,{continueExisting:!0}))},[Be,m,Fe,On]),Ri=H((p,P)=>{G.info("toolResult",{toolCallId:p}),n.emit("toolResult",{toolCallId:p}),Dn(p,A=>{A.outputSig.value=P,A.stateSig.value="output-available"})},[n,Dn]),Ii=H((p,P,A)=>{G.info("toolDecision",{toolCallId:p,approved:P}),n.emit("toolDecision",{toolCallId:p,approved:P}),Dn(p,M=>{let z=M.approvalSig.value?.id??p;M.approvalSig.value={id:z,approved:P,reason:A},M.stateSig.value="approval-responded"})},[n,Dn]),Ai=H(p=>{if(Be)return;let P=m.value.at(-1),A=P?.partsSig.value.find(z=>z.kind==="tool"&&z.toolCallId===p);if(!P||!A)return;let M=A.approvalSig.value?.id??p;A.approvalSig.value={id:M},A.stateSig.value="approval-requested",P.partsSig.value=[...P.partsSig.value]},[Be,m]),qc=ke(()=>({humanInLoop:e.features.humanInLoop,onResult:Ri,onDecision:Ii,onEdit:Ai}),[e.features.humanInLoop,Ri,Ii,Ai]),Gc=()=>m.value.reduce((p,P)=>p+(P.role==="user"?1:0),0),St=e.forms.list.length>0?e.forms:Y??e.forms,ue=Xl({forms:St,persistence:o,userContext:()=>e.userContext,messageCount:Gc,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>g.value,onComplete:(p,P,A,M)=>{G.info("formSubmit",{formId:p.id,trigger:P,skipped:M}),n.emit("formSubmit",{formId:p.id,values:A,skipped:M}),b(I=>[...I.filter(ge=>!(ge.formId===p.id&&ge.outcome==="skipped")),{key:`local:${p.id}:${Date.now()}`,formId:p.id,outcome:M?"skipped":"submitted",createdAt:Date.now(),...M?{}:{values:A}}]);let z=g.value??Ne();g.value||(g.value=z,o.saveConversationId(z),Z.primeIdentity(void 0,z)),!M&&p.mirrorToContext&&zc(I=>({...I,...A})),Z.submitForm({formId:p.id,conversationId:z,trigger:P,values:A,skipped:M})}}),Kc=J(()=>ue.activeForm.value);E(()=>{ue.refresh()},[St,ue]);let Li=e.pageContext?.area?String(e.pageContext.area):void 0,jc=J(()=>m.value.length);E(()=>{F&&k&&ue.fire("pre-chat")},[F,k,ue]),E(()=>{k&&!Gt&&ue.fire("conversation-closed")},[k,Gt,ue]),E(()=>{F&&k&&Li&&ue.fire("page-area")},[F,k,Li,ue]);let er=ke(()=>{let p=St.list.flatMap(P=>P.triggers).filter(P=>P.kind==="idle").map(P=>Number(P.param));return p.length?Math.min(...p)*1e3:0},[St]);E(()=>{if(!er||!_e)return;let p=setTimeout(()=>ue.fire("idle"),er);return()=>clearTimeout(p)},[er,_e,ue,jc.value]);let Mi=H(async(p,P)=>{if(G.info("send",{textLen:p.length,attachments:P.length,streaming:Be}),Be)return;n.emit("send",{text:p,attachmentCount:P.length}),Xo.length>0&&En([]);let A=await Jp(Z,P,I=>{G.warn("upload failed",{err:I}),n.emit("error",I),e.onError?.(I)});le.unlock(),le.play("messageSent");let M=ws(p,A),z=Ur();m.value=[...m.value,M,z],Fe.attach(z),ui(n,e,"user",p),await On(z,{continueExisting:!1}),ue.fire("after-messages")},[Be,Z,n,e,Xo.length,m,Fe,On,ue]),Yc=H(()=>{G.info("stop"),n.emit("stop",void 0),Tn?.()},[Tn,n]),Xc=H(()=>{le.toggleMuted();let p=le.mutedSig.value;G.info("soundToggle",{muted:p}),n.emit("soundToggle",{muted:p})},[le,n]),Qt=H(()=>{if(fl(e.mode,Re)==="exit-fullscreen"){G.info("close \u2192 exit-fullscreen",{mode:e.mode}),yt("normal"),n.emit("fullscreen",!1);return}G.info("close \u2192 panel closed",{mode:e.mode}),ue.fire("panel-close"),Me(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,Re,ue]),wt=H(()=>{e.modules.list.some(p=>p.layout==="chat")&&Z.listConversations({limit:50}).then(p=>{y.value=p.conversations.reduce((P,A)=>P+(A.unreadCount??0),0)}).catch(p=>G.debug("refreshUnread failed (non-fatal)",{err:p}))},[Z,e.modules,y]),Ni=O(!1);E(()=>{!S||!F||Ni.current||(Ni.current=!0,wt())},[S,F,wt]);let tr=H(()=>{G.info("open",{mode:e.mode}),le.unlock(),Vt(!0),Me(!0),o.savePanelOpen(!0),!Pt&&!qt&&Ge(),setTimeout(()=>Vt(!1),Xp),wt(),n.emit("open",void 0),e.onOpen?.()},[n,e,le,o,Pt,qt,Ge,wt]),nr=H(()=>{if(!m.value.some(P=>P.role==="user")&&Gt&&g.value){G.info("clear \u2192 reusing empty conversation",{conversationId:g.value}),m.value.length===0&&Ln(ye.current?.messages);return}G.info("clear \u2192 new conversation",{wasStreaming:Be}),n.emit("clear",void 0),Be&&Tn?.(),Mt(()=>{m.value=[],g.value=void 0}),o.clearConversation(),Kt(!0),b([]),Xt({newConversation:!0})},[Be,Tn,m,g,o,Xt,n,Gt,Ln]),or=H(()=>{nr(),Yo("chat");let p=e.modules.list.find(P=>P.layout==="chat")?.id;p&&N.switchTab(p)},[nr,N,e]),rr=H(()=>{let p=Re==="expanded"?"normal":"expanded";G.info("expand",{from:Re,expanded:p==="expanded"}),yt(p),o.savePanelSize(p),n.emit("expand",p==="expanded")},[n,Re,o]),ir=H(()=>{let p=Re==="fullscreen"?"normal":"fullscreen";G.info("fullscreen",{from:Re,fullscreen:p==="fullscreen"}),yt(p),o.savePanelSize(p),n.emit("fullscreen",p==="fullscreen")},[n,Re,o]),Jc=H(()=>{Yo(p=>{let P=p==="history"?"chat":"history";return G.info("toggleHistory",{view:P}),n.emit("toggleHistory",{view:P}),P})},[n]),Qc=H(p=>{G.info("localeChange",{locale:p}),c(p),ze({locale:p}),n.emit("localeChange",p)},[ze,n]),Zc=H(p=>{G.info("themeChange",{mode:p}),u(p),t.dataset.theme=p,ze({themeMode:p}),n.emit("themeChange",p)},[t,ze,n]),ed=H(p=>{G.info("textSizeChange",{size:p}),f(p),t.dataset.textSize=p,ze({textSize:p}),n.emit("textSizeChange",p)},[t,ze,n]),td=H(()=>{Fc(p=>{let P=!p;return G.info("sidebarToggle",{collapsed:P}),o.saveSidebarCollapsed(P),n.emit("sidebarToggle",{collapsed:P}),P})},[o,n]),nd=H(p=>{G.info("resize",p),ze({widgetSize:p}),n.emit("resize",p)},[ze,n]),ar=H(async p=>{G.info("selectConversation",{conversationId:p}),n.emit("selectConversation",{conversationId:p});try{let[P,A]=await Promise.all([Z.loadConversation(p),Mn(p)]),M=P.messages.map(Wr);Mt(()=>{m.value=Yt(M,A),g.value=P.conversationId}),b(A),o.saveConversationId(P.conversationId),P.agent&&wi(P.agent),Kt(P.canContinue),En(P.suggestions??[]),Yo("chat"),await Z.markRead(p),wt()}catch(P){n.emit("error",P),e.onError?.(P)}},[Z,m,g,n,e,o,wt,Mn,Yt]),$n=O(null),Oi=H(p=>{typeof p=="string"&&(k?ue.fire("manual",p):$n.current=p)},[k,ue]);E(()=>{!k||!$n.current||(ue.fire("manual",$n.current),$n.current=null)},[k,ue]),E(()=>Ra(t,{open:tr,close:Qt,expand:rr,fullscreen:ir,openForm:Oi}),[t,tr,Qt,rr,ir,Oi]);let Te=ke(()=>br(e,s,d,_),[e,s,d,_]);In.current=Te.strings;let od=ke(()=>C.map(p=>{let P=St.list.find(A=>A.id===p.formId);return{...p,title:P?.title,form:P}}),[C,St]),Di={options:Te,transport:Z,feedback:le,bus:n,persistence:o,view:Mc,canSend:Gt,isStreaming:Be,loadingMessages:h,messagesSig:m,agent:Nc,suggestions:Xo,initialWidgetSize:l.widgetSize??null,visitorId:i,onClose:Qt,onClear:nr,onExpand:rr,onFullscreen:ir,onSoundToggle:Xc,onToggleHistory:Jc,onSelectHistoryConversation:ar,onNewConversation:or,onLocaleChange:Qc,onThemeChange:Zc,onTextSizeChange:ed,onWidgetSizeChange:nd,onSend:Mi,onStop:Yc,onSuggestion:p=>{let P=p.text??p.label;G.info("suggestion",{text:P}),n.emit("suggestion",{text:P}),Mi(P,[])},activeForm:Kc.value?.form??null,formMarkers:od,onFormSubmit:ue.complete,onFormSkip:ue.skip,onFormFill:p=>ue.fire("manual",p),tool:qc},rd=p=>{ar(p);let P=K();P&&N.switchTab(P)};if(!F)return null;let Zt=Te.modules.list,sr=p=>{let P=bn("close",Te.mode,p);return Zt.length===0?r(Pc,{strings:Te.strings,onClose:P?Qt:void 0}):Zt.length===1&&Zt[0]?.layout==="chat"?r(Yl,{...Di,panelSize:p}):r(xc,{panelProps:{...Di,panelSize:p,onClose:P?Qt:void 0},enabledModules:Zt,nav:N,bus:n,unreadCount:y.value,onSelectConversation:rd,onStartNewConversation:or,onSetPanelSize:yt})};if(e.mode==="page"){let p=A=>{ar(A.conversationId)},P=Zt.some(A=>A.layout==="chat");return r("div",{class:`${Vo}-anchor`,children:r(Zl,{site:Oc,blocks:$c,transport:Z,strings:Te.strings,locale:Te.locale,persistence:o,visitorId:i,showConversations:P,onSelectConversation:p,onNewConversation:or,sidebarCollapsed:Bc,onToggleSidebarCollapsed:td,children:sr("fullscreen")})})}if(oe){let p=e.mode==="standalone"?"fullscreen":Re;return r("div",{class:`${Vo}-anchor`,children:sr(p)})}let $i=e.mode==="drawer",Hi=!(e.mode==="modal")&&!e.launcher.hidden&&(!_e||xt),Bi=Hi&&!xt&&!Pt&&!$i?Te.launcher.callout:null;return r("div",{class:`${Vo}-anchor`,"data-launcher-size":Te.launcher.size,children:[_e||S?r("div",{class:`${Vo}-surface`,hidden:!_e,children:sr(Re)}):null,Hi?r(ul,{onToggle:tr,launcher:Te.launcher,strings:Te.strings,leaving:xt,edgeTab:$i}):null,Bi?r(pl,{callout:Bi,launcherPosition:Te.position,strings:Te.strings,closeLabel:Te.strings.close,onDismiss:Ge}):null]})}function Yp(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var Xp=120;async function Jp(e,t,n){let o=[];for(let i of t)try{let{id:a,url:l}=await e.uploadFile(i.file);o.push({id:a,name:i.name,mediaType:i.mediaType,size:i.size,url:l})}catch(a){n(a)}return o}function ui(e,t,n,o){let i={role:n,text:o};e.emit("message",i),t.onMessage?.(i)}var Qp=B.scope("error-boundary"),qo=class extends tt{constructor(){super(...arguments);q(this,"state",{crashed:!1})}componentDidCatch(n,o){Qp.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 Zp="1",em=60,tm=2e3,kc={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}),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 nm(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function om(){return location.origin+location.pathname}function rm(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function Cc(e,t){let n=Math.random(),o=0,i=0,a=new Set,l=(c,d)=>{let{tracking:u,publicKey:_,aiAgentDeploymentId:f,mode:g,themeMode:m}=t.getOptions();if(!u.enabled||nm()||n>=u.sampleRate)return;let y=performance.now();if(y-o>6e4&&(o=y,i=0),++i>em)return;let h=new URLSearchParams;h.set("v",Zp),h.set("_ev",Rt),h.set("e",c),u.token&&h.set("tk",u.token),_&&h.set("pk",_),f&&h.set("dep",f),h.set("vid",t.getVisitorId());let v=t.getConversationId();v&&h.set("cid",v),h.set("url",om());let C=rm();C&&h.set("ref",C),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",g),h.set("th",m),d)for(let[ae,N]of Object.entries(d))N!==void 0&&h.set(ae,String(N));h.set("ts",String(Date.now()));let b=`${u.endpoint}?${h}`;if(b.length>tm)return;let T=new Image(1,1);a.add(T);let K=()=>a.delete(T);T.addEventListener("load",K,{once:!0}),T.addEventListener("error",K,{once:!0}),T.src=b},s=Object.keys(kc).map(c=>e.on(c,d=>l(c,kc[c]?.(d))));return()=>{for(let c of s)c();a.clear()}}function Go(e){let{bus:t,host:n,appRoot:o,persistence:i,reportError:a}=e,l=e.initialRaw,s,c=Ze(l),d=!0,u=()=>{c=Ze(s?xr(l,s):l)},_=()=>{Ha(n,ut(c.mode));let m=i.loadUserPrefs().themeMode;Ba(n,m?{...c,themeMode:m}:c),d&&(oo(n,pi(c)),d=!1)},f=()=>{_(),Tt(no(qo,{onError:a},no(wc,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",m=>{m.config&&(m.config.storageVersion&&i.rememberStorageVersion(m.config.storageVersion),s=m.config,u(),f())});let g=Cc(t,{getOptions:()=>c,getVisitorId:()=>i.getVisitorId(),getConversationId:()=>i.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>l,render:f,setUserOptions:m=>{l=m,u(),f()},patchUserOptions:m=>{l={...l,...m},u(),f()},destroy:()=>g()}}function pi(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=nt(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:o}=pn(e,Dt(),t.loadPanelOpen(),t.loadPanelSize());return fo(e.mode,o,n)}var im=B.scope("hooks"),fi="*",mi=new Set;function gi(e,t,n){let o={widgetId:e,event:t,listener:n};return mi.add(o),()=>{mi.delete(o)}}function am(e,t,n){let o=[...mi];for(let i of o)if(sm(i.widgetId,e.widgetId)&&!(i.event!==fi&&i.event!==t))try{i.listener(e,t,n)}catch(a){im.warn("hook listener threw",{event:t,error:a})}}function Ec(e,t){let n=[];for(let o of lm)n.push(t.on(o,i=>{am(e,o,i)}));return()=>{for(let o of n)o()}}function hi(e){if(Array.isArray(e))for(let t of e){let n=cm(t);n&&gi(n.widgetId,n.event,n.listener)}}function sm(e,t){return e===fi||e===t}var lm=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","visitorRebound","conversationRebound"];function cm(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 Qe=new Map;function Ko(e){e.debug!==void 0&&Wn(e.debug);let t=B.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=Ze(e),o=n.widgetId,i=Qe.get(o);i&&(t.debug("destroy existing instance at slot",{widgetId:o}),i.destroy());let a=pi(n),l=n.iframe?Ua({position:ut(n.mode)},n.position,a,n.mode,e.target??null):It({position:ut(n.mode),target:e.target??null});l.hostElement.dataset.widgetId=o;let s=new At,c=nt(o,n.storage,n.aiAgentDeploymentId),d=y=>{s.emit("error",y),u.getOptions().onError?.(y)},u=Go({bus:s,host:l.hostElement,appRoot:l.appRoot,persistence:c,initialRaw:e,reportError:d});u.render();let _=l.hostElement,f=null,g=y=>{y.debug!==void 0&&Wn(y.debug),u.patchUserOptions(y)},m={widgetId:o,open:()=>an(_,"open"),close:()=>an(_,"close"),expand:()=>an(_,"expand"),openForm:y=>an(_,"openForm",y),on:(y,h)=>s.on(y,h),update:y=>{t.debug("update",{patch:y}),g(y)},setUserContext:y=>{t.debug("setUserContext",{keys:Object.keys(y)}),g({userContext:{...u.getUserOptions().userContext,...y}})},clearUserContext:()=>{t.debug("clearUserContext"),g({userContext:void 0})},setPageContext:y=>{t.debug("setPageContext",{keys:Object.keys(y)}),g({pageContext:{...u.getUserOptions().pageContext,...y}})},clearPageContext:()=>{t.debug("clearPageContext"),g({pageContext:void 0})},setDebug:y=>{Wn(y),t.info("debug level set",{level:tn()})},debugLevel:()=>tn(),onLog:y=>nn(y),destroy:()=>{t.info("destroy",{widgetId:o}),f?.(),u.destroy(),s.clear(),Tt(null,l.appRoot),l.destroy(),Qe.get(o)===m&&Qe.delete(o)}};return f=Ec(m,s),Qe.set(o,m),m}function jo(e){let t=e.widgetId??"default",n=Qe.get(t);return n?(n.update(e),n):Ko(e)}function vi(e){if(e!==void 0){Qe.get(e)?.destroy();return}let t=[...Qe.values()];for(let n of t)n.destroy()}function qe(e="default"){return Qe.get(e)??null}function Tc(){return[...Qe.values()]}function bi(e,t,n){return gi(e,t,n)}var Rc=Rt;var xi=class extends HTMLElement{constructor(){super(...arguments);q(this,"bus",new At);q(this,"mountResult",null);q(this,"runtime",null)}static get observedAttributes(){return Pr}connectedCallback(){this.boot()}disconnectedCallback(){this.mountResult&&(this.runtime?.destroy(),this.runtime=null,Tt(null,this.mountResult.appRoot),this.bus.clear())}attributeChangedCallback(){this.isConnected&&this.boot()}boot(){let n=Kn(a=>this.getAttribute(a));if(this.runtime){this.runtime.setUserOptions(n);return}let o=Ze(n);this.mountResult||(this.mountResult=It({existingHost:this,position:ut(o.mode)}));let i=nt(o.widgetId,o.storage,o.aiAgentDeploymentId);this.runtime=Go({bus:this.bus,host:this.mountResult.hostElement,appRoot:this.mountResult.appRoot,persistence:i,initialRaw:n,reportError:a=>this.bus.emit("error",a)}),this.runtime.render()}},Ic=!1;function Pi(){if(Ic||typeof customElements>"u")return;let e=x.tagName;customElements.get(e)||customElements.define(e,xi),Ic=!0}typeof customElements<"u"&&Pi();var Ac=B.scope("iife"),yi={close:()=>qe()?.close(),destroy:()=>vi(),expand:()=>qe()?.expand(),hook:(e,t,n)=>typeof e=="string"&&typeof t=="string"&&typeof n=="function"?bi(e,t,n):void 0,init:e=>jo(e),mount:e=>Ko(e),on:(e,t)=>qe()?.on(e,t),onLog:e=>nn(e),open:()=>qe()?.open(),setDebug:e=>qe()?.setDebug(e),update:e=>qe()?.update(e)};function Lc(e,...t){let n=yi[e];if(!n){Ac.warn("unknown command",{command:e});return}return n(...t)}function dm(){let e=((n,...o)=>Lc(n,...o));e.init=jo,e.mount=Ko,e.destroy=vi,e.getInstance=qe,e.getAllInstances=Tc,e.version=Rc,e.hook=bi,e.debugLevel=()=>tn(),e.onLog=nn;let t=new Set(["init","mount","hook","onLog"]);for(let n of Object.keys(yi))t.has(n)||(e[n]=(...o)=>yi[n](...o));return e}function _m(e){let t=e?.q;if(t)for(let n of t){let o=[...n],[i,...a]=o;if(typeof i=="string")try{Lc(i,...a)}catch(l){Ac.warn("queued command failed",{command:i,error:l})}}}function um(){let e=[],t=e.push.bind(e);return e.push=(...n)=>{for(let o of n)hi([o]);return t(...n)},e}function pm(){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 mm(){if(typeof window>"u"||typeof document>"u")return;let e=globalThis[x.global],t=dm();globalThis[x.global]=t,Pi();let n=`${x.global}Hooks`,o=globalThis[n];if(hi(o),globalThis[n]=um(),_m(e),qe())return;let i=document.currentScript??pm(),a=yr(i?.dataset);if(!a.publicKey)return;let l=()=>{qe()||jo(a)};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",l,{once:!0});return}l()}mm();return dd(fm);})();
39
+ `){ee(e),te(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(Vu(n.charCodeAt(0)))break;ee(e),te(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){ee(e),te(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){ee(e),te(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}ee(e)}function ii(e){return{add_token:qu,end_token:Gu,add_text:Ku,set_attr:ju,data:{nodes:[e,,,,,],index:0}}}function qu(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 i=o=document.createElement("input");i.type="checkbox",i.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 Gu(e){e.index-=1}function Ku(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function ju(e,t,n){e.nodes[e.index].setAttribute(Bu(t),n)}function No({textSig:e,doneSig:t}){let n=O(null);return ln(()=>{let o=n.current;if(!o)return;o.classList.add(`${x.cssPrefix}-md`);let i=ii(o),a=ri(i),l=0,s=Ye(()=>{let u=e.value,_=t.value;u.length<l&&(o.replaceChildren(),i=ii(o),a=ri(i),l=0);let g=u.slice(l);g&&Pe(a,g),l=u.length,_&&Nl(a)}),c=new MutationObserver(u=>{for(let _ of u)for(let g of _.addedNodes){if(!(g instanceof HTMLElement))continue;let f=g.matches?.("a")?[g]:[...g.querySelectorAll?.("a")??[]];for(let m of f)Ol(m)}});c.observe(o,{childList:!0,subtree:!0});for(let u of o.querySelectorAll("a"))Ol(u);let d=u=>{let _=u.target?.closest?.("a");if(!_||!(_ instanceof HTMLAnchorElement))return;let g=_.getAttribute("href")??"";!g||g.startsWith("#")||(u.preventDefault(),window.open(g,"_blank","noopener,noreferrer"))};return o.addEventListener("click",d),()=>{s(),c.disconnect(),o.removeEventListener("click",d)}},[e,t]),r("div",{ref:n})}function Dl({text:e}){let t=ke(()=>$(e),[e]),n=ke(()=>$(!0),[]);return r(No,{textSig:t,doneSig:n})}function Ol(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 zt=x.cssPrefix;function $l({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?r("a",{class:`${zt}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":w.source,children:[r("span",{class:`${zt}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),r("span",{class:`${zt}-source-label`,children:n})]}):r("span",{class:`${zt}-source`,"data-testid":w.source,children:[r("span",{class:`${zt}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),r("span",{class:`${zt}-source-label`,children:n})]})}var Je=x.cssPrefix;function Oo(e){return e.startsWith("tool:")||e.startsWith("tool-")?e.slice(5):e}function Do(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 Xu(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 Ju({status:e}){return e==="denied"||e==="error"?r(_l,{}):e==="completed"||e==="responded"?r(dl,{}):r(cl,{})}function Qu(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;default:return t.statusRunning}}function Zu({state:e,approval:t,strings:n}){let o=Xu(e,t);return r("span",{class:`${Je}-toolui-badge ${Je}-toolui-status`,"data-status":o,children:[r("span",{class:`${Je}-toolui-status-icon`,children:r(Ju,{status:o})}),Qu(o,n)]})}function $o({name:e,state:t,approval:n,strings:o}){return r(ne,{children:[r("span",{class:`${Je}-toolui-wrench`,children:r(ll,{})}),r("strong",{class:`${Je}-toolui-title`,children:e}),r(Zu,{state:t,approval:n,strings:o}),r("span",{class:`${Je}-toolui-chevron`,children:r(yo,{})})]})}function rt({label:e,value:t,error:n}){let o=n?String(t??""):Ho(ai(t));return o?r("div",{class:`${Je}-toolui-section`,children:[r("span",{class:`${Je}-toolui-label`,children:e}),r("pre",{class:`${Je}-toolui-code`,"data-error":n?"true":void 0,children:o})]}):null}function ai(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function Ho(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""}}var Se=x.cssPrefix;function Hl({part:e,strings:t,active:n,onDecision:o,onEdit:i}){let a=J(()=>e.approvalSig.value),l=J(()=>e.stateSig.value),s=J(()=>e.inputSig.value),c=J(()=>e.outputSig.value),d=J(()=>e.errorSig.value),u=Oo(e.toolName),_=a.value?.approved,{terminal:g,responded:f,decided:m}=Do(l.value,a.value),y=f&&n&&!g,h=e.toolCallId;return r("div",{class:`${Se}-toolui-group`,"data-testid":m?w.toolDecision:w.toolApproval,children:[r("details",{class:`${Se}-toolui ${Se}-toolui-collapsible`,children:[r("summary",{class:`${Se}-toolui-head`,children:r($o,{name:u,state:l.value,approval:a.value,strings:t})}),r(rt,{label:t.toolParameters,value:s.value}),c.value!==void 0?r(rt,{label:t.toolResult,value:c.value}):null,d.value?r(rt,{label:t.statusError,value:d.value,error:!0}):null]}),r("div",{class:`${Se}-toolui ${Se}-toolui-body`,children:[r("p",{class:`${Se}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",u)}),r("p",{class:`${Se}-toolui-subtle`,children:t.approvalBody}),f?r("p",{class:`${Se}-toolui-subtle`,children:[t.approvalYourResponse.replace("{decision}",_?t.approve:t.reject),a.value?.reason?` \u2014 ${a.value.reason}`:""]}):null,y?r("p",{class:`${Se}-toolui-subtle`,children:t.approvalEditHint}):null,f&&!y&&!g?r("p",{class:`${Se}-toolui-subtle`,children:t.approvalSubmitting}):null,!m&&!n?r("p",{class:`${Se}-toolui-subtle`,children:t.stepNoLongerActive}):null,!m&&n?r("div",{class:`${Se}-toolui-actions`,children:[r("button",{type:"button",class:`${Se}-form-skip`,onClick:()=>o(h,!1),"data-testid":w.toolReject,children:t.reject}),r("button",{type:"button",class:`${Se}-form-submit`,onClick:()=>o(h,!0),"data-testid":w.toolApprove,children:t.approve})]}):y?r("div",{class:`${Se}-toolui-actions`,children:r("button",{type:"button",class:`${Se}-form-skip`,onClick:()=>i(h),"data-testid":w.toolEdit,children:t.edit})}):null]})]})}function Fl(e){let t=e&&typeof e=="object"?e:{},n=t.responseType;return{title:Pn(t.title),question:Pn(t.question)??"Please provide the missing information.",description:Pn(t.description),placeholder:Pn(t.placeholder),responseType:n==="single-choice"||n==="multi-choice"||n==="confirmation"||n==="free-text"?n:"free-text",choices:Array.isArray(t.choices)?t.choices:void 0,allowOther:typeof t.allowOther=="boolean"?t.allowOther:void 0,required:typeof t.required=="boolean"?t.required:!0,defaultValues:Array.isArray(t.defaultValues)?t.defaultValues.filter(o=>typeof o=="string"):void 0,minSelections:Bl(t.minSelections),maxSelections:Bl(t.maxSelections),validationHint:Pn(t.validationHint)}}function zl(e){if(e.responseType==="confirmation")return[];let t=(e.choices??[]).map(ep).filter(i=>i!==null),n="textarea";e.responseType==="single-choice"&&t.length>0?n="radio":e.responseType==="multi-choice"&&(n="multiselect");let o=n==="multiselect"?e.defaultValues?.join(", "):e.defaultValues?.[0];return[{name:"answer",label:e.question,type:n,placeholder:e.placeholder,required:e.required??!0,defaultValue:o,options:t.length>0?t:void 0,allowOther:e.allowOther,validationHint:e.validationHint,validation:n==="multiselect"?{minSelections:e.minSelections,maxSelections:e.maxSelections}:void 0}]}function ep(e){return typeof e=="string"?e?{value:e,label:e}:null:e&&typeof e.value=="string"&&e.value?{value:e.value,label:e.label??e.value,description:e.description}:null}function Pn(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function Bl(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}var re=x.cssPrefix;function tp(e,t){switch(e.responseType){case"single-choice":return t.respSingleChoice;case"multi-choice":return t.respMultiChoice;case"confirmation":return t.respConfirmation;default:return t.respFreeText}}function Ul({part:e,strings:t,active:n,onSubmit:o,onDecision:i,onEdit:a}){let l=J(()=>e.stateSig.value),s=J(()=>e.approvalSig.value),c=J(()=>Fl(e.inputSig.value)),{terminal:d,responded:u,decided:_}=Do(l.value,s.value),g=s.value!==void 0,f=(h,v)=>{g?i(e.toolCallId,v,h):c.value.responseType==="confirmation"?o(e.toolCallId,{confirmed:v}):o(e.toolCallId,v?{answer:h}:{})},m=c.value;if(_)return r(rp,{part:e,strings:t,req:m,editable:u&&n&&!d,onEdit:()=>a(e.toolCallId)});let y=!n;return r("div",{class:`${re}-toolui${y?` ${re}-toolui-stale`:""}`,"data-testid":w.toolAskInput,children:[r("div",{class:`${re}-toolui-head`,children:[r("span",{class:`${re}-toolui-badge ${re}-toolui-badge-accent`,children:t.inputRequired}),r("span",{class:`${re}-toolui-badge`,children:tp(m,t)})]}),m.description?r("div",{class:`${re}-toolui-desc`,children:m.description}):null,r(si,{label:t.inputQuestion,text:m.question}),y?r("p",{class:`${re}-toolui-note`,children:t.stepNoLongerActive}):r(np,{req:m,strings:t,resolve:f})]})}function np({req:e,strings:t,resolve:n}){if(e.responseType==="confirmation")return r(op,{req:e,strings:t,resolve:n});let o=zl(e).map(i=>(i.label=t.inputYourAnswer,i.placeholder=i.placeholder??t.inputAnswerPlaceholder,i));return r(Lo,{fields:o,strings:t,submitLabel:t.inputSubmit,footerHint:t.inputSubmitHint,onSubmit:i=>n(i.answer??Object.values(i).join(", "),!0),skipLabel:t.inputSkip,onSkip:()=>n(void 0,!1),submitOnEnter:!0,submitTestId:w.toolInputSubmit,skipTestId:w.toolInputSkip})}function op({req:e,strings:t,resolve:n}){let[o,i]=R(""),a=e.allowOther??!0,l=()=>n(o.trim()||void 0,!0),s=()=>n(void 0,!1),c=d=>{d.key!=="Enter"||d.shiftKey||d.isComposing||(d.preventDefault(),l())};return r(ne,{children:[a?r("label",{class:`${re}-field`,children:[r("span",{class:`${re}-field-label`,children:t.inputOptionalNote}),r("textarea",{class:`${re}-field-input`,rows:2,value:o,placeholder:e.placeholder??t.inputOptionalNotePlaceholder,onInput:d=>i(d.target.value),onKeyDown:c,"data-testid":`${w.formField}-note`})]}):null,r("div",{class:`${re}-form-actions`,children:[r("span",{class:`${re}-form-hint`,children:t.inputConfirmHint}),r("button",{type:"button",class:`${re}-form-skip`,onClick:s,"data-testid":w.toolInputSkip,children:t.confirmNo}),r("button",{type:"button",class:`${re}-form-submit`,onClick:l,"data-testid":w.toolInputSubmit,children:t.confirmYes})]})]})}function si({label:e,text:t}){return r("div",{class:`${re}-toolui-section`,children:[r("span",{class:`${re}-toolui-label`,children:e}),r("p",{class:`${re}-toolui-text`,children:t})]})}function rp({part:e,strings:t,req:n,editable:o,onEdit:i}){let a=J(()=>e.outputSig.value),l=J(()=>e.approvalSig.value),s=l.value?.approved===!1,c=l.value?.approved!==void 0?l.value.reason??"":ip(a.value,t);return r("div",{class:`${re}-toolui`,"data-testid":w.toolDecision,children:[r("div",{class:`${re}-toolui-head`,children:[r("span",{class:`${re}-toolui-badge ${re}-toolui-badge-accent`,children:t.inputBadge}),r("span",{class:`${re}-toolui-badge`,children:s?t.inputSkipped:t.inputAnswered})]}),n.description?r("div",{class:`${re}-toolui-desc`,children:n.description}):null,r(si,{label:t.inputQuestion,text:n.question}),!s&&c?r(si,{label:t.inputResponse,text:c}):null,o?r("div",{class:`${re}-toolui-actions`,children:r("button",{type:"button",class:`${re}-form-skip`,onClick:i,"data-testid":w.toolEdit,children:t.edit})}):null]})}function ip(e,t){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"){let n=e;return"confirmed"in n?n.confirmed?t.confirmYes:t.confirmNo:typeof n.responseText=="string"&&n.responseText?n.responseText:Object.values(n).filter(o=>typeof o=="string"||typeof o=="number").join(", ")}return String(e)}var li=x.cssPrefix;function Wl({part:e,strings:t}){let n=J(()=>e.inputSig.value),o=J(()=>e.outputSig.value),i=J(()=>e.errorSig.value),a=J(()=>e.stateSig.value),l=J(()=>e.approvalSig.value);return J(()=>!!Ho(n.value)||!!i.value||!!Ho(ai(o.value))).value?r("details",{class:`${li}-toolui ${li}-toolui-collapsible`,"data-testid":w.toolCall,children:[r("summary",{class:`${li}-toolui-head`,children:r($o,{name:Oo(e.toolName),state:a.value,approval:l.value,strings:t})}),r(rt,{label:t.toolParameters,value:n.value}),o.value!==void 0?r(rt,{label:t.toolResult,value:o.value}):null,i.value?r(rt,{label:t.statusError,value:i.value,error:!0}):null]}):null}var Le=x.cssPrefix;function Vl({message:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,showSources:a,interactive:l=!1,tool:s}){let d=J(()=>e.partsSig.value).value,u=J(()=>e.partsSig.value.some(v=>v.kind==="text"&&v.textSig.value.length>0)),_=J(()=>o&&e.partsSig.value.some(v=>v.kind==="reasoning")),g=e.role==="assistant"&&e.status==="streaming",f=n==="buffered"&&g,m=g&&!u.value,y=g&&!f&&!(_.value&&m),h=ap(e.createdAt);return r("div",{class:`${Le}-bubble-row`,"data-role":e.role,"data-testid":ve(w.messageBubble,e.id),children:r("div",{class:`${Le}-bubble-col`,children:[r("div",{class:`${Le}-bubble`,children:[f?r(up,{label:t.loading}):d.map(v=>r(sp,{part:v,active:m,strings:t,showReasoning:o,showToolCalls:i,showSources:a,interactive:l,tool:s},dp(v))),y&&r(_p,{}),e.status==="error"&&e.errorText?r("div",{class:`${Le}-error`,role:"alert",children:r("span",{children:e.errorText})}):null]}),h?r("time",{class:`${Le}-bubble-time`,dateTime:h.iso,title:h.full,children:h.short}):null]})})}function ap(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 sp({part:e,active:t,strings:n,showReasoning:o,showToolCalls:i,showSources:a,interactive:l,tool:s}){switch(e.kind){case"step-start":return null;case"text":return r(No,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return o?r(cp,{part:e,active:t,strings:n}):null;case"tool":return r(lp,{part:e,strings:n,showToolCalls:i,interactive:l,tool:s});case"file":return e.mediaType.startsWith("image/")?r("img",{src:e.url,alt:"",loading:"lazy"}):r("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return a?r($l,{part:e,strings:n}):null}}function lp({part:e,strings:t,showToolCalls:n,interactive:o,tool:i}){let a=J(()=>e.approvalSig.value!==void 0);if(i?.humanInLoop){if(Tl(e.toolName))return r(Ul,{part:e,strings:t,active:o,onSubmit:i.onResult,onDecision:i.onDecision,onEdit:i.onEdit});if(a.value)return r(Hl,{part:e,strings:t,active:o,onDecision:i.onDecision,onEdit:i.onEdit})}return n?r(Wl,{part:e,strings:t}):null}function cp({part:e,active:t,strings:n}){return r("details",{class:`${Le}-reasoning`,open:t,"data-active":t?"true":void 0,children:[r("summary",{class:`${Le}-reasoning-summary`,children:r("span",{class:`${Le}-reasoning-label`,children:t?n.thinking:n.thoughts})}),r("div",{class:`${Le}-reasoning-body`,children:r(No,{textSig:e.textSig,doneSig:e.doneSig})})]})}function dp(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 _p(){return r("span",{class:`${Le}-typing`,"aria-hidden":"true",children:[r("span",{}),r("span",{}),r("span",{})]})}function up({label:e}){return r("span",{class:`${Le}-loading`,role:"status",children:[r("span",{class:`${Le}-loading-spinner`,"aria-hidden":"true"}),r("span",{class:`${Le}-loading-label`,children:e})]})}var Ut=x.cssPrefix,ci=120,pp=350,mp=1200;function ql({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,showSources:a,loading:l,idle:s,tool:c,form:d,formMarkers:u,onFillForm:_}){let g=O(null),f=J(()=>e.value),[m,y]=R(!1),[h,v]=R(!1),C=O(!1),b=O(!1),T=O(!1),K=O(0),ae=()=>T.current||performance.now()-K.current<pp,N=O(0),W=S=>{N.current=performance.now(),S.scrollTop=S.scrollHeight},F=f.value[0]?.id;ln(()=>{let S=g.current;if(!S||f.value.length===0||(C.current=!0,!f.value.some(st=>st.role==="user")))return;let U=()=>W(S);U();let xe=new ResizeObserver(U);xe.observe(S);let Ee=new MutationObserver(U);Ee.observe(S,{childList:!0,subtree:!0,characterData:!0});let ye=setTimeout(()=>{xe.disconnect(),Ee.disconnect()},300);return()=>{xe.disconnect(),Ee.disconnect(),clearTimeout(ye)}},[F]);let V=O(0);E(()=>{let S=g.current,U=f.value,xe=V.current;if(V.current=U.length,!S||!C.current)return;if(U.slice(xe).some(ye=>ye.role==="user")){b.current=!1,W(S);return}if(!U.some(ye=>ye.role==="user")||b.current||ae())return;S.scrollHeight-S.scrollTop-S.clientHeight<ci&&W(S)},[f.value.length]),E(()=>{let S=g.current;if(!S)return;let U=f.value.at(-1);if(!U||U.status!=="streaming"&&!f.value.some(ye=>ye.role==="user"))return;let xe=()=>{if(b.current||ae())return;S.scrollHeight-S.scrollTop-S.clientHeight<ci*2&&W(S)};if(U.status!=="streaming"){let ye=requestAnimationFrame(xe);return()=>cancelAnimationFrame(ye)}xe();let Ee=new MutationObserver(xe);return Ee.observe(S,{childList:!0,subtree:!0,characterData:!0}),()=>Ee.disconnect()},[f.value]);let Y=d?.form.id;ln(()=>{let S=g.current;!S||!Y||b.current||f.value.some(U=>U.role==="user")&&W(S)},[Y]),E(()=>{let S=g.current;if(!S)return;let U=()=>y(S.scrollHeight-S.scrollTop-S.clientHeight>ci*2),xe,Ee=()=>{U(),performance.now()-N.current>150&&(b.current=S.scrollHeight-S.scrollTop-S.clientHeight>8),v(!0),clearTimeout(xe),xe=setTimeout(()=>v(!1),mp)},ye=()=>{b.current=!0},st=Ge=>{Ge.deltaY<0&&ye()},xt=0,Vt=Ge=>{xt=Ge.touches[0]?.clientY??0,T.current=!0},Pt=Ge=>{(Ge.touches[0]?.clientY??0)>xt+4&&ye()},He=()=>{T.current=!1,K.current=performance.now()},qt=()=>{T.current=!0};return S.addEventListener("scroll",Ee,{passive:!0}),S.addEventListener("wheel",st,{passive:!0}),S.addEventListener("touchstart",Vt,{passive:!0}),S.addEventListener("touchmove",Pt,{passive:!0}),S.addEventListener("touchend",He,{passive:!0}),S.addEventListener("touchcancel",He,{passive:!0}),S.addEventListener("pointerdown",qt,{passive:!0}),window.addEventListener("pointerup",He,{passive:!0}),window.addEventListener("pointercancel",He,{passive:!0}),U(),()=>{S.removeEventListener("scroll",Ee),S.removeEventListener("wheel",st),S.removeEventListener("touchstart",Vt),S.removeEventListener("touchmove",Pt),S.removeEventListener("touchend",He),S.removeEventListener("touchcancel",He),S.removeEventListener("pointerdown",qt),window.removeEventListener("pointerup",He),window.removeEventListener("pointercancel",He),clearTimeout(xe)}},[]);let be=()=>{let S=g.current;S&&(b.current=!1,W(S))},k=[],j="",oe=f.value.at(-1)?.id,de=[...u??[]].toSorted((S,U)=>(S.createdAt??1/0)-(U.createdAt??1/0)),_e=S=>r(El,{marker:S,strings:t,onFill:!d&&_?()=>_(S.formId):void 0},S.key),Me=S=>{for(let U=de[0];U?.createdAt!==void 0&&!(S!==void 0&&U.createdAt>S);U=de[0])de.shift(),k.push(_e(U))};for(let S of f.value){Me(S.createdAt);let U=fp(S.createdAt);U&&U!==j&&(k.push(r("div",{class:`${Ut}-date-divider`,children:r("span",{class:`${Ut}-date-pill`,title:gp(S.createdAt),children:hp(S.createdAt,t)})},`day:${U}`)),j=U),k.push(r(Vl,{message:S,strings:t,responseMode:n,showReasoning:o,showToolCalls:i,showSources:a,interactive:!!s&&S.id===oe,tool:c},S.id))}for(let S of de)k.push(_e(S));return r("div",{class:`${Ut}-list-wrap`,children:[r("div",{ref:g,class:`${Ut}-list`,role:"log","aria-live":"polite","aria-relevant":"additions text","data-scrolling":h?"true":void 0,children:[l&&f.value.length===0?r("div",{class:`${Ut}-list-loading`,role:"status",children:t.conversationLoading}):null,k,d?r(Cl,{form:d.form,strings:t,onSubmit:d.onSubmit,onSkip:d.onSkip}):null]}),m?r("button",{type:"button",class:`${Ut}-jump`,onClick:be,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":w.scrollToBottom,children:r(yo,{})}):null]})}function fp(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function gp(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function hp(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),i=Math.round((o(new Date)-o(n))/864e5);return i<=0?t.dateToday:i===1?t.dateYesterday:i<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var vp=["today","yesterday","lastWeek","older"];function bp(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((Gl(e)-Gl(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function Kl(e,t){let n=new Map;for(let o of t){let i=bp(e,o.lastMessageAt),a=n.get(i);a?a.push(o):n.set(i,[o])}return vp.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function Gl(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var xp=B.scope("history"),Pp=3,yp=6,Sp={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function wp(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 Bo({transport:e,strings:t,locale:n,persistence:o,visitorId:i,onSelect:a,onNewConversation:l}){let s=x.cssPrefix,c=e.peekConversations({visitorId:i}),[d,u]=R(c?"loaded":"loading"),[_,g]=R(c?.conversations??[]);E(()=>{let h=!1;return e.listConversations({visitorId:i}).then(v=>{if(h)return;let C=v.conversations??[];g(C),u("loaded"),o.saveHistoryCount(C.length)}).catch(v=>{h||(xp.warn("listConversations failed",{err:v}),u("error"))}),()=>{h=!0}},[e,i,o]);let f=l?r("div",{class:`${s}-history-footer`,children:r("button",{type:"button",class:`${s}-history-new`,onClick:l,"data-testid":w.sidebarNewConversation,children:[r(Os,{}),t.newConversation]})}):null;if(d==="loading"){let h=Math.min(o.loadHistoryCount()??Pp,yp);return r(ne,{children:[r("div",{class:`${s}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:r("div",{class:`${s}-history-group`,"aria-hidden":"true",children:[r("div",{class:`${s}-history-heading`,children:r("span",{class:`${s}-skeleton ${s}-skeleton-heading`})}),r("div",{class:`${s}-history-card`,children:Array.from({length:Math.max(1,h)},(v,C)=>r("div",{class:`${s}-history-item ${s}-history-item-skeleton`,children:[r("span",{class:`${s}-history-avatar ${s}-skeleton`}),r("span",{class:`${s}-history-body`,children:[r("span",{class:`${s}-history-row`,children:[r("span",{class:`${s}-history-title`,children:r("span",{class:`${s}-skeleton ${s}-skeleton-title`})}),r("span",{class:`${s}-history-time`,children:r("span",{class:`${s}-skeleton ${s}-skeleton-time`})})]}),r("span",{class:`${s}-history-row`,children:r("span",{class:`${s}-history-preview`,children:r("span",{class:`${s}-skeleton ${s}-skeleton-preview`})})})]})]},C))})]})}),f]})}if(d==="error"||_.length===0)return r(ne,{children:[r("div",{class:`${s}-history-empty`,children:t.historyEmpty}),f]});let m=Date.now(),y=Kl(m,_);return r(ne,{children:[r("div",{class:`${s}-history`,role:"list",children:y.map(h=>r("div",{class:`${s}-history-group`,children:[r("div",{class:`${s}-history-heading`,children:t[Sp[h.bucket]]}),r("div",{class:`${s}-history-card`,children:h.conversations.map(v=>r("button",{type:"button",role:"listitem",class:`${s}-history-item`,onClick:()=>a(v),"data-closed":v.canContinue?void 0:"true","data-unread":(v.unreadCount??0)>0?"true":void 0,"data-testid":ve(w.historyItem,v.conversationId),children:[r("span",{class:`${s}-history-avatar`,"aria-hidden":"true",children:r(Gr,{})}),r("span",{class:`${s}-history-body`,children:[r("span",{class:`${s}-history-row`,children:[r("span",{class:`${s}-history-title`,children:v.title}),r("span",{class:`${s}-history-time`,children:wp(v.lastMessageAt,m,n)})]}),r("span",{class:`${s}-history-row`,children:[r("span",{class:`${s}-history-preview`,children:v.preview??(v.canContinue?t.historyContinue:t.conversationClosed)}),(v.unreadCount??0)>0?r("span",{class:`${s}-history-dot`}):null]})]})]},v.conversationId))})]},h.bucket))}),f]})}var jl=x.cssPrefix;function Yl({suggestions:e,onPick:t}){return e.length===0?null:r("div",{class:`${jl}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((n,o)=>r("button",{type:"button",class:`${jl}-suggestion`,onClick:()=>t(n),"data-testid":ve(w.suggestion,o),children:n.label},n.id))})}var Ce=x.cssPrefix;function Xl(e){let{options:t,onClose:n}=e,o=t.strings,i=O(null);E(()=>{let c=i.current;if(!c)return;let d=Eo(c),u=_=>{_.key==="Escape"&&n?.()};return c.addEventListener("keydown",u),()=>{d(),c.removeEventListener("keydown",u)}},[n]);let a=O(null),l=H(c=>{a.current?.attachFromDrop(c)},[]),{visible:s}=Io({containerRef:i,onDrop:l});return ko(i.current,t.mode==="modal"),r("div",{ref:i,class:`${Ce}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":w.panel,children:[r(di,{...e,containerEl:i.current,dragOver:s,composerAttachApiRef:a}),r(_i,{poweredBy:e.options.poweredBy})]})}function di(e){let{options:t,transport:n,feedback:o,bus:i,persistence:a,panelSize:l,view:s,canSend:c,isStreaming:d,loadingMessages:u,messagesSig:_,agent:g,suggestions:f,initialWidgetSize:m,visitorId:y,onClose:h,onBack:v,onClear:C,onToggleHistory:b,onSelectHistoryConversation:T,onNewConversation:K,onWidgetSizeChange:ae,onSend:N,onStop:W,onSuggestion:F,activeForm:V,formMarkers:Y,onFormSubmit:be,onFormSkip:k,onFormFill:j,tool:oe,containerEl:de,dragOver:_e,composerAttachApiRef:Me}=e,S=t.strings,U;return V?U=null:c?U=r(ne,{children:[r(Yl,{suggestions:f,onPick:F}),r(xl,{options:t,transport:n,feedback:o,bus:i,isStreaming:d,onSend:N,onStop:W,attachApiRef:Me})]}):U=r(Cp,{label:S.conversationClosed,ctaLabel:S.startNewConversation,onNewConversation:C}),r(ne,{children:[s==="history"?r(kp,{strings:S,onBack:b,onClose:h,showClose:Co(t.mode,l,t.actions)}):r("header",{class:`${Ce}-header`,"data-testid":w.panelHeader,children:[v?r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:v,"aria-label":S.moduleBack,title:S.moduleBack,children:r(hn,{})}):null,g?r(hl,{agent:g,strings:S}):r("h1",{children:S.panelTitle}),r(We,{panelProps:e,variant:"chat"})]}),s==="history"?r(Bo,{transport:n,strings:S,locale:t.locale,persistence:a,visitorId:y,onSelect:xe=>T(xe.conversationId),onNewConversation:K}):r(ne,{children:[r(Pl,{visible:_e,strings:S}),r(ql,{messagesSig:_,strings:S,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,loading:u,idle:!d,tool:oe,form:V?{form:V,onSubmit:be,onSkip:k}:null,formMarkers:Y,onFillForm:j}),U,r(Ep,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?r(wo,{panelEl:de,resize:t.size.resize,position:t.position,initialSize:m,onSizeChange:ae,strings:S}):null]})}function kp({strings:e,onBack:t,onClose:n,showClose:o}){return r("header",{class:`${Ce}-header`,children:[r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:r(hn,{})}),r("h1",{children:e.historyTitle}),o?r("button",{type:"button",class:`${Ce}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:r(Ue,{})}):null]})}function Cp({label:e,ctaLabel:t,onNewConversation:n}){return r("div",{class:`${Ce}-readonly-banner`,role:"note",children:[r("span",{class:`${Ce}-readonly-label`,children:e}),r("button",{type:"button",class:`${Ce}-readonly-cta`,onClick:n,children:t})]})}function Ep({disclaimer:e}){return e?r("div",{class:`${Ce}-composer-footer`,children:r("div",{class:`${Ce}-disclaimer`,children:e})}):null}function _i({poweredBy:e}){return e?r("div",{class:`${Ce}-poweredby-bar`,children:r(Tp,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Tp({logoUrl:e,text:t,href:n}){let o=r(ne,{children:[e?r("img",{class:`${Ce}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?r("span",{children:t}):null]});return n?r("a",{class:`${Ce}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):r("span",{class:`${Ce}-poweredby`,children:o})}function Jl(e){let t=O(e);t.current=e;let n=O(null);return n.current??(n.current=Rp(t)),n.current}function Rp(e){let t=$(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,i=c=>c.frequency==="always"?!1:c.frequency==="conversation"?n.has(o(c.id)):c.id in e.current.persistence.loadFormsDone(),a=(c,d)=>{if(t.value)return;let u=e.current;if(c==="manual"){let _=u.forms.list.find(g=>g.id===d);_&&(t.value={form:_,trigger:"manual"});return}for(let _ of u.forms.byTrigger[c]??[]){let g=_.triggers.find(f=>f.kind===c);if(!(!g||!Ip(g,u)||i(_)||!Ap(_,u))){t.value={form:_,trigger:c};return}}},l=(c,d)=>{let u=t.value;if(!u)return;t.value=null;let{form:_,trigger:g}=u;_.frequency==="conversation"?n.add(o(_.id)):_.frequency!=="always"&&e.current.persistence.saveFormDone(_.id),e.current.onComplete(_,g,c,d)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let d=e.current.forms.list.find(u=>u.id===c.form.id);d&&d!==c.form&&(t.value={form:d,trigger:c.trigger})},complete:c=>l(c,!1),skip:()=>l({},!0)}}function Ip(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function Ap(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let i=t.userContext()??{};if(n.missingContext.some(a=>i[a]!==void 0&&i[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 Ql(e){let t=x.cssPrefix,{site:n,blocks:o,strings:i,collapsed:a}=e,l=o?.navigation??[],s=o?.linkCards??[],c=a?i.expandSidebar:i.collapseSidebar;return r("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":w.sidebar,children:[r("div",{class:`${t}-sidebar-header`,children:[r(Lp,{site:n}),r("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":w.sidebarToggle,children:r(Mp,{collapsed:a})})]}),a?null:r(ne,{children:[l.length>0?r("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:r(Np,{items:l})}):null,s.length>0?r("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:r(Op,{items:s})}):null,e.showConversations?r("div",{class:`${t}-sidebar-conversations`,children:r(Bo,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,visitorId:e.visitorId,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Lp({site:e}){let t=x.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return r("picture",{children:[e.logoDark?.url?r("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,r("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return r("div",{class:`${t}-sidebar-title`,children:e?.title??x.name})}function Mp({collapsed:e}){return r("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?r("polyline",{points:"9 6 15 12 9 18"}):r("polyline",{points:"15 6 9 12 15 18"})})}function Np({items:e}){let t=x.cssPrefix;return r("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>r("li",{children:r("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?r("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,r("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function Op({items:e}){let t=x.cssPrefix;return r("div",{class:`${t}-sidebar-cards`,children:e.map(n=>r("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[r("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?r("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var Zl=x.cssPrefix;function ec(e){return r("main",{class:`${Zl}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[r(Ql,{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}),r("section",{class:`${Zl}-page-chat`,"aria-label":"Chat",children:e.children})]})}var tc=e=>Object.fromEntries(e.map(t=>[t,[]]));function nc(e,t,n){let o=$({activeTab:e,stacks:tc(t)});return{sig:o,switchTab(i){o.value.activeTab!==i&&(o.value={...o.value,activeTab:i},n?.(i))},push(i){let a=o.value,l=a.stacks[a.activeTab]??[];o.value={...a,stacks:{...a.stacks,[a.activeTab]:[...l,i]}}},pop(){let i=o.value,a=i.stacks[i.activeTab]??[];a.length!==0&&(o.value={...i,stacks:{...i.stacks,[i.activeTab]:a.slice(0,-1)}})},reset(i){o.value={activeTab:i,stacks:tc(t)}}}}var oc=e=>e.stacks[e.activeTab]??[],rc=e=>oc(e).at(-1),ic=e=>oc(e).length===0;var ac={Icon:vn};var it=x.cssPrefix;function Fo({title:e,actions:t}){return r("header",{class:`${it}-back-header`,"data-variant":"title",children:[r("span",{class:`${it}-back-spacer`,"aria-hidden":"true"}),r("h1",{class:`${it}-back-title`,children:e}),t??r("span",{class:`${it}-back-spacer`,"aria-hidden":"true"})]})}function zo({title:e,backLabel:t,onBack:n,actions:o,testid:i}){return r("header",{class:`${it}-back-header`,"data-testid":i,children:[r("button",{type:"button",class:`${it}-icon-btn`,onClick:n,"aria-label":t,title:t,children:r(hn,{})}),r("h1",{class:`${it}-back-title`,children:e}),o??r("span",{class:`${it}-back-spacer`,"aria-hidden":"true"})]})}var Wt=x.cssPrefix;function sc({placeholder:e,onActivate:t}){return r("button",{type:"button",class:`${Wt}-home-search`,onClick:t,"data-testid":w.homeSearch,children:[r("span",{class:`${Wt}-home-search-text`,children:e}),r("span",{class:`${Wt}-home-search-icon`,"aria-hidden":"true",children:r(jr,{})})]})}function lc({placeholder:e,value:t,onInput:n}){return r("div",{class:`${Wt}-home-search`,"data-input":"true",children:[r("input",{type:"search",class:`${Wt}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":w.helpSearch}),r("span",{class:`${Wt}-home-search-icon`,"aria-hidden":"true",children:r(jr,{})})]})}var yn=x.cssPrefix;function Uo({title:e,subtitle:t,onClick:n,testid:o}){return r("button",{type:"button",class:`${yn}-list-row`,onClick:n,"data-testid":o,children:[r("span",{class:`${yn}-list-row-body`,children:[r("span",{class:`${yn}-list-row-title`,children:e}),t?r("span",{class:`${yn}-list-row-sub`,children:t}):null]}),r("span",{class:`${yn}-list-row-chevron`,"aria-hidden":"true",children:r(Ht,{})})]})}var cc=x.cssPrefix;function $e({tone:e="info",message:t,onRetry:n,strings:o}){return r("div",{class:`${cc}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[r("span",{children:t}),n?r("button",{type:"button",class:`${cc}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var bt=x.cssPrefix,Dp=B.scope("help"),$p=(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 Hp(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 dc(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let i=0;for(let a of e){if(i=n.indexOf(a,i),i===-1)return 0;i+=1}return 1}function Bp(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(dc(n,o.title)*2,dc(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,i)=>i.score-o.score).map(o=>o.item):[]}function _c({article:e,nav:t}){return r(Uo,{title:e.title,subtitle:e.description,onClick:()=>$p(t,e),testid:ve(w.helpArticle,e.id)})}function Fp({transport:e,strings:t,config:n,nav:o,bus:i,panelProps:a}){let l=n.contentTags,[s,c]=R("loading"),[d,u]=R(t.errorGeneric),[_,g]=R([]),[f,m]=R(""),[y,h]=R(0);E(()=>{let b=!1;return c("loading"),e.listContent({tags:l,sortBy:"order",limit:100}).then(T=>{if(b)return;let K=T.items??[];g(K),c("loaded"),i.emit("contentView",{section:"help",tags:l?.join(","),count:K.length})}).catch(T=>{b||(Dp.warn("listContent (help) failed",{err:T}),u(ft(T,t)),c("error"))}),()=>{b=!0}},[e,l,y,i]);let v=ke(()=>Bp(_,f),[_,f]);E(()=>{let b=f.trim();if(!b)return;let T=setTimeout(()=>i.emit("contentSearch",{queryLength:b.length,hitCount:v.length}),600);return()=>clearTimeout(T)},[f,v,i]);function C(){return f.trim().length>0?v.length===0?r($e,{message:t.helpSearchEmpty,strings:t}):r("div",{class:`${bt}-help-card`,children:v.map(b=>r(_c,{article:b,nav:o},b.id))}):s==="loading"?r($e,{message:t.helpLoading,strings:t}):s==="error"?r($e,{tone:"error",message:d,onRetry:()=>h(b=>b+1),strings:t}):_.length===0?r($e,{message:t.helpEmpty,strings:t}):Hp(_).map(([b,T])=>r("section",{class:`${bt}-help-group`,children:[b?r("h2",{class:`${bt}-help-section-title`,children:b}):null,r("div",{class:`${bt}-help-card`,children:T.map(K=>r(_c,{article:K,nav:o},K.id))})]},b))}return r("div",{class:`${bt}-module`,children:[r(Fo,{title:t.helpTitle,actions:r(We,{panelProps:a,variant:"plain"})}),r("div",{class:`${bt}-module-pad`,children:r(lc,{placeholder:t.helpSearchPlaceholder,value:f,onInput:m})}),r("div",{class:`${bt}-help-list`,children:C()})]})}var uc={Icon:Kr,Root:e=>r(Fp,{...e})};var pc=x.cssPrefix;function ui({onClick:e,children:t,testid:n}){return e?r("button",{type:"button",class:`${pc}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):r("div",{class:`${pc}-home-card`,"data-testid":n,children:t})}var ie=x.cssPrefix,mc=B.scope("home");function zp(e){let t=e.options.userContext?.name,n=e.config.greetingText?we(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 Up=(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 Wp(e){let{transport:t,strings:n,config:o,nav:i,bus:a,panelProps:l}=e,[s,c]=R(null),[d,u]=R([]),_=o.contentTags?.join(",");E(()=>{if(!o.showRecentConversations)return;let v=!1;return t.listConversations({limit:1}).then(C=>!v&&c(C.conversations?.[0]??null)).catch(C=>!v&&mc.warn("listConversations (home) failed",{err:C})),()=>{v=!0}},[t,o.showRecentConversations]),E(()=>{if(!o.contentTags?.length)return;let v=!1;return t.listContent({tags:o.contentTags,limit:6}).then(C=>{if(v)return;let b=C.items??[];u(b),a.emit("contentView",{section:"home",tags:_,count:b.length})}).catch(C=>!v&&mc.warn("listContent (home) failed",{err:C})),()=>{v=!0}},[t,_,a]);let g=zp(e),f=o.userAvatars??[],m=o.status,y=m?.text?we(n,m.text):n.homeStatus,h=o.contentBlockTitle?we(n,o.contentBlockTitle):n.homeContentTitle;return r("div",{class:`${ie}-module ${ie}-home`,"data-testid":w.homeView,children:r("div",{class:`${ie}-home-scroll`,children:[r("div",{class:`${ie}-home-hero`,children:[r("div",{class:`${ie}-home-hero-top`,children:[o.brandName?r("span",{class:`${ie}-home-brand`,"data-testid":w.homeBrand,children:o.brandName}):r("span",{class:`${ie}-home-brand-spacer`,"aria-hidden":"true"}),r("div",{class:`${ie}-home-hero-actions`,children:[f.length>0?r("div",{class:`${ie}-home-avatars`,children:f.map(v=>r("span",{class:`${ie}-home-avatar`,title:v.role?`${v.name} \xB7 ${v.role}`:v.name,children:v.avatar?r("img",{src:v.avatar,alt:"",loading:"lazy"}):r("span",{children:To(v.name)})},v.name))}):null,r(We,{panelProps:l,variant:"plain"})]})]}),o.showGreeting!==!1?r(ne,{children:[r("h1",{class:`${ie}-home-greeting`,"data-testid":w.homeGreeting,children:g.title}),g.subtitle?r("p",{class:`${ie}-home-lead`,children:g.subtitle}):null]}):null]}),r("div",{class:`${ie}-home-cards`,children:[o.showSearchBar!==!1?r(sc,{placeholder:n.homeSearchPlaceholder,onActivate:()=>i.switchToLayout("help")}):null,s?r(ui,{onClick:()=>i.selectConversation(s.conversationId),testid:w.homeRecent,children:r("div",{class:`${ie}-home-recent-row`,"data-unread":(s.unreadCount??0)>0?"true":void 0,children:[r("span",{class:`${ie}-home-recent-avatar`,"aria-hidden":"true",children:r(vn,{})}),r("span",{class:`${ie}-home-recent-body`,children:[r("span",{class:`${ie}-home-recent-title`,children:s.title}),s.preview?r("span",{class:`${ie}-home-recent-preview`,children:s.preview}):null]}),(s.unreadCount??0)>0?r("span",{class:`${ie}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,m?r(ui,{onClick:m.url?()=>i.push({kind:"iframe",url:m.url,title:y}):void 0,children:r("div",{class:`${ie}-home-status`,"data-level":m.level??"operational",children:[r("span",{class:`${ie}-home-status-icon`,"aria-hidden":"true",children:r(nl,{})}),r("span",{class:`${ie}-home-status-text`,children:y})]})}):null,d.length>0?r("section",{class:`${ie}-home-content`,children:[r("div",{class:`${ie}-home-content-title`,children:h}),r("div",{class:`${ie}-home-content-list`,children:d.map(v=>r(Uo,{title:v.title,subtitle:v.description,onClick:()=>Up(i,v),testid:ve(w.homeContentRow,v.id)},v.id))})]}):null]})]})})}var fc={Icon:ol,Root:e=>r(Wp,{...e})};var at=x.cssPrefix,Vp=B.scope("news");function qp({transport:e,strings:t,config:n,nav:o,bus:i,panelProps:a}){let l=n.contentTags,[s,c]=R("loading"),[d,u]=R(t.errorGeneric),[_,g]=R([]),[f,m]=R(0);E(()=>{let h=!1;return c("loading"),e.listContent({tags:l,sortBy:"publishedAt",sortOrder:"desc"}).then(v=>{if(h)return;let C=v.items??[];g(C),c("loaded"),i.emit("contentView",{section:"news",tags:l?.join(","),count:C.length})}).catch(v=>{h||(Vp.warn("listContent (news) failed",{err:v}),u(ft(v,t)),c("error"))}),()=>{h=!0}},[e,l,f,i]);function y(){return s==="loading"?r($e,{message:t.newsLoading,strings:t}):s==="error"?r($e,{tone:"error",message:d,onRetry:()=>m(h=>h+1),strings:t}):_.length===0?r($e,{message:t.newsEmpty,strings:t}):r("div",{class:`${at}-news-list`,children:_.map(h=>r("button",{type:"button",class:`${at}-news-card`,onClick:()=>o.push({kind:"content",id:h.id,title:h.title}),"data-testid":ve(w.newsItem,h.id),children:[h.image?r("img",{class:`${at}-news-hero`,src:h.image,alt:"",loading:"lazy"}):null,r("span",{class:`${at}-news-body`,children:[r("span",{class:`${at}-news-title`,children:h.title}),h.description?r("span",{class:`${at}-news-summary`,children:h.description}):null]})]},h.id))})}return r("div",{class:`${at}-module`,children:[r(Fo,{title:t.newsTitle,actions:r(We,{panelProps:a,variant:"plain"})}),r("div",{class:`${at}-module-scroll`,children:y()})]})}var gc={Icon:rl,Root:e=>r(qp,{...e})};var Wo={chat:ac,home:fc,help:uc,news:gc};var Sn=x.cssPrefix;function hc({modules:e,activeTab:t,strings:n,unreadCount:o,onSelect:i}){return r("nav",{class:`${Sn}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let l=Wo[a.layout].Icon,s=a.id===t,c=a.layout==="chat"&&o>0?o>9?"9+":String(o):null;return r("button",{type:"button",role:"tab","aria-selected":s,class:`${Sn}-tab`,onClick:()=>i(a.id),"data-testid":ve(w.tab,a.id),children:[r("span",{class:`${Sn}-tab-icon`,"aria-hidden":"true",children:[r(l,{}),c?r("span",{class:`${Sn}-tab-badge`,"data-testid":w.tabBadge,children:c}):null]}),r("span",{class:`${Sn}-tab-label`,children:we(n,a.label)})]},a.id)})})}var vc=x.cssPrefix,Gp="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function bc({url:e,title:t,strings:n,onBack:o,actions:i}){return r("div",{class:`${vc}-module`,children:[r(zo,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:i}),r("iframe",{class:`${vc}-content-frame`,src:e,title:t||"content",sandbox:Gp,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var wn=x.cssPrefix,Kp=B.scope("content"),jp=5e3;function xc({id:e,title:t,transport:n,strings:o,bus:i,onBack:a,actions:l}){let[s,c]=R(null),[d,u]=R(!1),[_,g]=R(0),f=H(()=>{u(!1),c(null),g(h=>h+1)},[]);E(()=>{let h=!1;return n.listContent({ids:[e],limit:1}).then(v=>{if(h)return;let C=v.items[0];C?(c(C),i.emit("contentOpen",{contentId:e,tags:C.tags?.length?C.tags.join(","):void 0})):u(!0)}).catch(v=>{h||(Kp.warn("listContent (reader) failed",{err:v}),u(!0))}),()=>{h=!0}},[n,e,_,i]),E(()=>{if(!s)return;let h=setTimeout(()=>i.emit("contentRead",{contentId:e}),jp);return()=>clearTimeout(h)},[s,e,i]);let m=H(h=>{let C=h.target?.closest?.("a")?.getAttribute("href")??"";C&&!C.startsWith("#")&&i.emit("contentLinkClick",{contentId:e})},[i,e]);function y(){return d?r($e,{tone:"error",message:o.errorGeneric,onRetry:f,strings:o}):s===null?r($e,{message:o.contentLoading,strings:o}):r("article",{class:`${wn}-content`,"data-testid":w.contentView,onClick:m,children:[s.image?r("img",{class:`${wn}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?r("p",{class:`${wn}-content-subtitle`,children:s.description}):null,r(Dl,{text:s.content??""})]})}return r("div",{class:`${wn}-module`,children:[r(zo,{title:s?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:a,actions:l,testid:w.backHeader}),r("div",{class:`${wn}-module-scroll`,"data-testid":w.contentScroll,children:y()})]})}var Vo=x.cssPrefix;function Pc({panelProps:e,enabledModules:t,nav:n,bus:o,unreadCount:i,onSelectConversation:a,onStartNewConversation:l,onSetPanelSize:s}){let c=e.options,d=c.strings,u=O(null),_=O(new Set);E(()=>{let Y=u.current;if(!Y)return;let be=Eo(Y),k=j=>{j.key==="Escape"&&e.onClose?.()};return Y.addEventListener("keydown",k),()=>{be(),Y.removeEventListener("keydown",k)}},[e.onClose]);let g=O(null),f=H(Y=>{g.current?.attachFromDrop(Y)},[]),{visible:m}=Io({containerRef:u,onDrop:f});ko(u.current,c.mode==="modal");let y=J(()=>n.sig.value).value,h=rc(y),v=c.modules.byId[y.activeTab],C=h?.kind==="iframe"||h?.kind==="content",b=t.length>1&&(ic(y)||!C),T=O(null);E(()=>{if(C&&T.current===null)T.current=e.panelSize,e.panelSize==="normal"&&s("expanded");else if(!C&&T.current!==null){let Y=T.current;T.current=null,s(Y)}},[C]);let K={push:n.push,pop:n.pop,switchTab:n.switchTab,switchToLayout:Y=>{let be=t.find(k=>k.layout===Y);be&&n.switchTab(be.id)},selectConversation:a,startNewConversation:l},ae=Y=>({options:c,transport:e.transport,strings:d,config:Y,visitorId:e.visitorId,nav:K,bus:o,panelProps:e}),N=r(We,{panelProps:e,variant:"plain"});v&&_.current.add(v.id);let W=t.filter(Y=>_.current.has(Y.id)),F=Y=>{if(Y.layout==="chat")return r(di,{...e,containerEl:u.current,dragOver:m,composerAttachApiRef:g});let be=Wo[Y.layout].Root;return be?r(be,{...ae(Y)}):null},V=()=>h?.kind==="iframe"?r(bc,{url:h.url,title:h.title,strings:d,onBack:n.pop,actions:N}):h?.kind==="content"?r(xc,{id:h.id,title:h.title,transport:e.transport,strings:d,bus:o,onBack:n.pop,actions:N}):null;return r("div",{ref:u,class:`${Vo}-panel ${Vo}-messenger`,role:"dialog","aria-modal":"false","aria-label":d.panelTitle,style:{position:"relative"},"data-testid":w.messengerHome,children:[r("div",{class:`${Vo}-messenger-body`,children:[W.map(Y=>r("div",{class:`${Vo}-messenger-pane`,hidden:C||Y.id!==v?.id,children:F(Y)},Y.id)),V()]}),b?r(hc,{modules:t,activeTab:y.activeTab,strings:d,unreadCount:i,onSelect:n.switchTab}):null,r(_i,{poweredBy:c.poweredBy}),c.size.resize?.enabled&&!(v?.layout==="chat"&&!h)?r(wo,{panelEl:u.current,resize:c.size.resize,position:c.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:d}):null]})}var kn=x.cssPrefix;function yc({strings:e,onClose:t}){return r("div",{class:`${kn}-panel ${kn}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":w.modulesEmpty,children:[t?r("button",{type:"button",class:`${kn}-icon-btn ${kn}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:r(Ue,{})}):null,r("p",{class:`${kn}-modules-empty-text`,children:e.modulesEmpty})]})}function Sc({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[i,a]=R(()=>o?!1:t.loadCalloutDismissed(n));E(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let l=H(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:i,dismissCallout:l}}var G=B.scope("app"),qo=x.cssPrefix;function wc(e,t){return Cs({...e,text:we(t,e.text)})}function Yp(e){let t=e.partsSig.value.filter(n=>n.kind==="tool");return t.length>0&&t.every(n=>{let o=n.stateSig.value;return o==="output-available"||o==="output-error"||o==="output-denied"||o==="approval-responded"})}function kc({options:e,hostElement:t,bus:n}){let[o]=R(()=>nt(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i,a]=R(()=>o.getVisitorId()),l=o.loadUserPrefs(),[s,c]=R(()=>l.locale??e.locale),[d,u]=R(()=>l.themeMode??e.themeMode),[_,g]=R(()=>l.textSize??e.textSize),f=un(o.loadConversationId()),m=un([]),y=un(0),[h,v]=R(!1),[C,b]=R([]);function T(){let p=e.modules.list,P=new Set(p.map(M=>M.id)),A=o.loadActiveModule();return A&&P.has(A)?A:p[0]?.id??""}function K(){return e.modules.list.find(p=>p.layout==="chat")?.id}let ae=O();if(!ae.current){let p=e.modules.list.map(P=>P.id);ae.current=nc(T(),p,P=>o.saveActiveModule(P))}let N=ae.current,W=O(void 0);W.current=K();let[F,V]=R(!1),[Y,be]=R(null),[k,j]=R(!1),oe=e.mode==="standalone"||e.mode==="inline",de=O(pn(e,Dt(),o.loadPanelOpen(),o.loadPanelSize())),[_e,Me]=R(de.current.panelOpen),[S,U]=R(de.current.panelOpen),xe=O(S);xe.current=S;let Ee=O(!1),ye=O(void 0);E(()=>{_e&&U(!0)},[_e]);let st=O(!1),[xt,Vt]=R(!1),{dismissed:Pt,dismissCallout:He}=Sc({callout:e.launcher.callout,persistence:o}),qt=e.launcher.callout?.persistent??!0,Ge=H(()=>{G.info("calloutDismiss"),n.emit("calloutDismiss",void 0),He()},[n,He]),[Re,yt]=R(de.current.panelSize),wi=O(!1),[Nc,Xo]=R("chat"),[Gt,Kt]=R(!0),[Be,Cn]=R(!1),[Oc,ki]=R(null),[Jo,En]=R([]),[Tn,Rn]=R(null),In=O(e.strings),[Dc,$c]=R(void 0),[Hc,Bc]=R(void 0),[Fc,zc]=R(()=>o.loadSidebarCollapsed()??!1),[Qo,Uc]=R({}),[Z]=R(()=>new ho({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:ps({publicKey:e.publicKey,aiAgentDeploymentId:e.aiAgentDeploymentId,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[Fe]=R(()=>new vo(m)),[le]=R(()=>new Po(e.sound,e.haptics)),ze=H(p=>{o.patchUserPrefs(p),Z.saveUserPrefs(o.loadUserPrefs()).catch(P=>{G.warn("saveUserPrefs failed",{err:P})})},[o,Z]);E(()=>{l.soundMuted!==void 0&&le.setMuted(l.soundMuted)},[]),E(()=>{t.dataset.theme=d},[t,d,e]),E(()=>{t.dataset.textSize=_},[t,_,e]),E(()=>{le.update(e.sound,e.haptics)},[le,e.sound,e.haptics]),E(()=>()=>le.destroy(),[le]),E(()=>{let p=!0;return le.mutedSig.subscribe(P=>{if(p){p=!1;return}ze({soundMuted:P})})},[le,ze]),E(()=>{wi.current||!e.size.initialSize||(wi.current=!0,!o.loadPanelSize()&&yt(Br(e.mode,e.size,Dt())))},[e.mode,e.size,o]),E(()=>{if(!F||st.current)return;st.current=!0;let p=pn(e,Dt(),o.loadPanelOpen(),o.loadPanelSize());Me(p.panelOpen),yt(p.panelSize)},[F,e,o]);let Ci=O(!1),Ei=O(!1),An=O(null);E(()=>{if(!(!F||Ci.current)){if(Ci.current=!0,Ei.current){let p=W.current;p&&N.switchTab(p);return}N.reset(T())}},[F]);let Ln=H(p=>{!p||p.length===0||(m.value=p.map(P=>wc(P,In.current)))},[m]),Zo=O(null),Mn=H(async p=>{try{let{formSubmissions:P}=await(p?Z.bootstrap(p):Zo.current??Z.bootstrap()),A=new Map;return P.forEach((M,z)=>A.set(M.formId,z)),P.filter((M,z)=>!M.skipped||A.get(M.formId)===z).map((M,z)=>({key:`wire:${M.formId}:${M.createdAt??z}`,formId:M.formId,outcome:M.skipped?"skipped":"submitted",createdAt:go(M.createdAt),values:M.values}))}catch(P){return G.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:P}),[]}},[Z]),jt=O(0),Yt=H((p,P)=>{let A=[...p.map(I=>I.createdAt),...P.map(I=>I.createdAt)].filter(I=>I!==void 0),M=(A.length?Math.min(...A):Date.now())-1;return[...(ye.current?.messages??[]).map(I=>{let ge=wc(I,In.current);return ge.createdAt=M,ge}),...p]},[]),er=H(async p=>{let P=jt.current,A=()=>P!==jt.current;v(!0);try{let[M,z]=await Promise.all([Z.loadConversation(p),Mn()]);if(A())return;let I=(M.messages??[]).map(Vr);b(z);let ge=An.current?[An.current]:[];I.length||ge.length?(m.value=[...Yt(I,z),...ge],Kt(M.canContinue??!0),En(M.suggestions??[])):m.value=Yt([],z)}catch(M){if(A())return;G.warn("loadThread failed; resetting conversationId",{err:M,conversationId:p}),f.value=void 0,o.saveConversationId(void 0)}finally{A()||v(!1)}},[Z,Mn,m,f,o,Yt]),Xt=H(async({newConversation:p})=>{let P=++jt.current,A=()=>P!==jt.current,M=f.value,z=p||!M?Ne():M;z!==M&&(f.value=z,o.saveConversationId(z));let I;try{I=await Z.handshake({visitorId:i,conversationId:z,userPrefs:o.loadUserPrefs(),locale:s})}catch(en){if(A())return;n.emit("error",en),e.onError?.(en),p||V(!0);return}if(A())return;if(I.visitorId&&I.visitorId!==i&&(G.info("visitor rebound",{previous:i,current:I.visitorId,reason:I.rebind?.visitorId}),o.setVisitorId(I.visitorId),a(I.visitorId),n.emit("visitorRebound",{previous:i,current:I.visitorId,reason:I.rebind?.visitorId})),I.conversationId&&I.conversationId!==z&&(G.info("conversation rebound",{previous:z,current:I.conversationId,reason:I.rebind?.conversationId}),n.emit("conversationRebound",{previous:z,current:I.conversationId,reason:I.rebind?.conversationId})),I.agent&&ki(I.agent),e.mode==="page"&&(I.site&&_s(I.site)?$c(I.site):I.site&&G.warn("invalid site config, using fallback",{site:I.site}),I.blocks&&us(I.blocks)?Bc(I.blocks):I.blocks&&G.warn("invalid blocks config, using fallback",{blocks:I.blocks})),I.userPrefs&&!p&&(o.saveUserPrefs(I.userPrefs),I.userPrefs.locale&&c(I.userPrefs.locale),I.userPrefs.soundMuted!==void 0&&le.setMuted(I.userPrefs.soundMuted),I.userPrefs.themeMode&&u(I.userPrefs.themeMode),I.userPrefs.textSize&&g(I.userPrefs.textSize)),ye.current=I.welcome,p||n.emit("handshake",I),I.welcome?.suggestions){let en=In.current;En(I.welcome.suggestions.map(Hn=>({...Hn,label:we(en,Hn.label),...Hn.text===void 0?{}:{text:we(en,Hn.text)}})))}!p&&M&&I.conversationId===M?xe.current?er(M):Ee.current=!0:(f.value=I.conversationId,o.saveConversationId(I.conversationId),Ln(I.welcome?.messages)),p||V(!0)},[Z,i,o,e,n,f,le,Ln,er,s]),Jt=JSON.stringify(e.userContext??null),Wc=JSON.stringify(e.pageContext??null),Vc=JSON.stringify(Qo);E(()=>{let p=Object.keys(Qo).length?{...Qo,...e.userContext}:e.userContext;Z.setContext(p,Xp(e.pageContext))},[Z,Jt,Wc,Vc]);let Ie=Ct(s,e.availableLocales,e.defaultLocale);E(()=>{Z.setLocale(Ie)},[Z,Ie]),E(()=>{t.dir=Wi(Ie)?"rtl":"ltr"},[t,Ie]),E(()=>{Ie!==s&&c(Ie)},[Ie,s]);let qc=H(async p=>{let P=null;try{for await(let A of p.iter){if(!P){P=Wr(),An.current=P,Fe.attach(P),m.value=[...m.value,P],Cn(!0),Rn(()=>p.cancel),Ei.current=!0;let M=W.current;M&&N.switchTab(M),G.info("resumed in-flight reply on mount")}Fe.apply(A.chunk),A.chunk.type==="finish"&&A.chunk.canContinue===!1&&Kt(!1)}P&&(P.status="complete",le.play("messageReceived"),pi(n,e,"assistant",qr(P)))}catch(A){P&&(P.status="error",P.errorText=ft(A,e.strings),le.play("error")),G.debug("mount resume ended without completing",{err:A})}finally{An.current=null,P&&(Fe.detach(),Cn(!1),Rn(null),m.value=[...m.value])}},[Fe,m,le,n,e,N]),Ti=O(null);E(()=>{let p=f.value;return p&&Z.primeIdentity(i,p),Xt({newConversation:!1}),()=>{jt.current++,Ti.current?.cancel()}},[]),E(()=>{if(S){if(Zo.current=Z.bootstrap(),(async()=>{try{let p=await Zo.current;be(on((p??{forms:[]}).forms,Ie))}catch(p){G.debug("bootstrap failed \u2014 treating as no forms",{err:p})}finally{j(!0)}})(),Ee.current){Ee.current=!1;let p=f.value;p&&er(p)}if(f.value){let p=Z.resumeStream();Ti.current=p,qc(p)}}},[S]);let Nn=O(null);E(()=>{if(!S)return;if(Nn.current===null){Nn.current=Ie;return}if(Nn.current===Ie)return;Nn.current=Ie;let p=!1;return Z.bootstrap().then(P=>{p||be(on((P??{forms:[]}).forms,Ie))}).catch(P=>G.debug("forms re-localize failed \u2014 keeping current copy",{err:P})),()=>{p=!0}},[S,Ie,Z]);let Ri=O(Jt);E(()=>{!F||Ri.current===Jt||(Ri.current=Jt,Xt({newConversation:!1}))},[Jt,F,Xt]),E(()=>{oo(t,fo(e.mode,Re,_e))},[t,_e,Re,e.mode]),E(()=>{if(e.mode!=="modal"||!_e)return;let p=P=>{P.composedPath().some(z=>z instanceof HTMLElement&&z.classList.contains(`${x.cssPrefix}-panel`))||Me(!1)};return t.addEventListener("click",p),()=>t.removeEventListener("click",p)},[t,_e,e.mode]),E(()=>{if(e.mode!=="drawer"||!_e)return;let p=P=>{P.key==="Escape"&&Me(!1)};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[_e,e.mode]);let On=H(async(p,{continueExisting:P})=>{let A=f.value??Ne();f.value||(f.value=A,o.saveConversationId(A));let M=(P?m.value:m.value.slice(0,-1)).filter(ge=>!ge.ephemeral),z=xs({messages:M.map(Es),conversationId:A,tools:e.features.tools,visitorId:i,userPrefs:o.loadUserPrefs()});Cn(!0);let I=Z.sendMessage(z);Rn(()=>I.cancel);try{for await(let ge of I.iter)Fe.apply(ge.chunk),ge.chunk.type==="finish"&&ge.chunk.canContinue===!1&&Kt(!1);p.status="complete",le.play("messageReceived"),pi(n,e,"assistant",qr(p))}catch(ge){p.status="error",p.errorText=ft(ge,e.strings),le.play("error"),n.emit("error",ge),e.onError?.(ge)}finally{Fe.detach(),Cn(!1),Rn(null),m.value=[...m.value]}},[Z,Fe,m,f,e,n,le,o,i]),Dn=H((p,P)=>{if(Be)return;let A=m.value.at(-1),M=A?.partsSig.value.find(z=>z.kind==="tool"&&z.toolCallId===p);if(!A||!M){G.warn("decideTool: tool part not found",{toolCallId:p});return}P(M),A.partsSig.value=[...A.partsSig.value],Yp(A)&&(A.status="streaming",Fe.attach(A),On(A,{continueExisting:!0}))},[Be,m,Fe,On]),Ii=H((p,P)=>{G.info("toolResult",{toolCallId:p}),n.emit("toolResult",{toolCallId:p}),Dn(p,A=>{A.outputSig.value=P,A.stateSig.value="output-available"})},[n,Dn]),Ai=H((p,P,A)=>{G.info("toolDecision",{toolCallId:p,approved:P}),n.emit("toolDecision",{toolCallId:p,approved:P}),Dn(p,M=>{let z=M.approvalSig.value?.id??p;M.approvalSig.value={id:z,approved:P,reason:A},M.stateSig.value="approval-responded"})},[n,Dn]),Li=H(p=>{if(Be)return;let P=m.value.at(-1),A=P?.partsSig.value.find(z=>z.kind==="tool"&&z.toolCallId===p);if(!P||!A)return;let M=A.approvalSig.value?.id??p;A.approvalSig.value={id:M},A.stateSig.value="approval-requested",P.partsSig.value=[...P.partsSig.value]},[Be,m]),Gc=ke(()=>({humanInLoop:e.features.humanInLoop,onResult:Ii,onDecision:Ai,onEdit:Li}),[e.features.humanInLoop,Ii,Ai,Li]),Kc=()=>m.value.reduce((p,P)=>p+(P.role==="user"?1:0),0),St=e.forms.list.length>0?e.forms:Y??e.forms,ue=Jl({forms:St,persistence:o,userContext:()=>e.userContext,messageCount:Kc,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>f.value,onComplete:(p,P,A,M)=>{G.info("formSubmit",{formId:p.id,trigger:P,skipped:M}),n.emit("formSubmit",{formId:p.id,values:A,skipped:M}),b(I=>[...I.filter(ge=>!(ge.formId===p.id&&ge.outcome==="skipped")),{key:`local:${p.id}:${Date.now()}`,formId:p.id,outcome:M?"skipped":"submitted",createdAt:Date.now(),...M?{}:{values:A}}]);let z=f.value??Ne();f.value||(f.value=z,o.saveConversationId(z),Z.primeIdentity(void 0,z)),!M&&p.mirrorToContext&&Uc(I=>({...I,...A})),Z.submitForm({formId:p.id,conversationId:z,trigger:P,values:A,skipped:M})}}),jc=J(()=>ue.activeForm.value);E(()=>{ue.refresh()},[St,ue]);let Mi=e.pageContext?.area?String(e.pageContext.area):void 0,Yc=J(()=>m.value.length);E(()=>{F&&k&&ue.fire("pre-chat")},[F,k,ue]),E(()=>{k&&!Gt&&ue.fire("conversation-closed")},[k,Gt,ue]),E(()=>{F&&k&&Mi&&ue.fire("page-area")},[F,k,Mi,ue]);let tr=ke(()=>{let p=St.list.flatMap(P=>P.triggers).filter(P=>P.kind==="idle").map(P=>Number(P.param));return p.length?Math.min(...p)*1e3:0},[St]);E(()=>{if(!tr||!_e)return;let p=setTimeout(()=>ue.fire("idle"),tr);return()=>clearTimeout(p)},[tr,_e,ue,Yc.value]);let Ni=H(async(p,P)=>{if(G.info("send",{textLen:p.length,attachments:P.length,streaming:Be}),Be)return;n.emit("send",{text:p,attachmentCount:P.length}),Jo.length>0&&En([]);let A=await Qp(Z,P,I=>{G.warn("upload failed",{err:I}),n.emit("error",I),e.onError?.(I)});le.unlock(),le.play("messageSent");let M=ks(p,A),z=Wr();m.value=[...m.value,M,z],Fe.attach(z),pi(n,e,"user",p),await On(z,{continueExisting:!1}),ue.fire("after-messages")},[Be,Z,n,e,Jo.length,m,Fe,On,ue]),Xc=H(()=>{G.info("stop"),n.emit("stop",void 0),Tn?.()},[Tn,n]),Jc=H(()=>{le.toggleMuted();let p=le.mutedSig.value;G.info("soundToggle",{muted:p}),n.emit("soundToggle",{muted:p})},[le,n]),Qt=H(()=>{if(gl(e.mode,Re)==="exit-fullscreen"){G.info("close \u2192 exit-fullscreen",{mode:e.mode}),yt("normal"),n.emit("fullscreen",!1);return}G.info("close \u2192 panel closed",{mode:e.mode}),ue.fire("panel-close"),Me(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,Re,ue]),wt=H(()=>{e.modules.list.some(p=>p.layout==="chat")&&Z.listConversations({limit:50}).then(p=>{y.value=p.conversations.reduce((P,A)=>P+(A.unreadCount??0),0)}).catch(p=>G.debug("refreshUnread failed (non-fatal)",{err:p}))},[Z,e.modules,y]),Oi=O(!1);E(()=>{!S||!F||Oi.current||(Oi.current=!0,wt())},[S,F,wt]);let nr=H(()=>{G.info("open",{mode:e.mode}),le.unlock(),Vt(!0),Me(!0),o.savePanelOpen(!0),!Pt&&!qt&&Ge(),setTimeout(()=>Vt(!1),Jp),wt(),n.emit("open",void 0),e.onOpen?.()},[n,e,le,o,Pt,qt,Ge,wt]),or=H(()=>{if(!m.value.some(P=>P.role==="user")&&Gt&&f.value){G.info("clear \u2192 reusing empty conversation",{conversationId:f.value}),m.value.length===0&&Ln(ye.current?.messages);return}G.info("clear \u2192 new conversation",{wasStreaming:Be}),n.emit("clear",void 0),Be&&Tn?.(),Mt(()=>{m.value=[],f.value=void 0}),o.clearConversation(),Kt(!0),b([]),Xt({newConversation:!0})},[Be,Tn,m,f,o,Xt,n,Gt,Ln]),rr=H(()=>{or(),Xo("chat");let p=e.modules.list.find(P=>P.layout==="chat")?.id;p&&N.switchTab(p)},[or,N,e]),ir=H(()=>{let p=Re==="expanded"?"normal":"expanded";G.info("expand",{from:Re,expanded:p==="expanded"}),yt(p),o.savePanelSize(p),n.emit("expand",p==="expanded")},[n,Re,o]),ar=H(()=>{let p=Re==="fullscreen"?"normal":"fullscreen";G.info("fullscreen",{from:Re,fullscreen:p==="fullscreen"}),yt(p),o.savePanelSize(p),n.emit("fullscreen",p==="fullscreen")},[n,Re,o]),Qc=H(()=>{Xo(p=>{let P=p==="history"?"chat":"history";return G.info("toggleHistory",{view:P}),n.emit("toggleHistory",{view:P}),P})},[n]),Zc=H(p=>{G.info("localeChange",{locale:p}),c(p),ze({locale:p}),n.emit("localeChange",p)},[ze,n]),ed=H(p=>{G.info("themeChange",{mode:p}),u(p),t.dataset.theme=p,ze({themeMode:p}),n.emit("themeChange",p)},[t,ze,n]),td=H(p=>{G.info("textSizeChange",{size:p}),g(p),t.dataset.textSize=p,ze({textSize:p}),n.emit("textSizeChange",p)},[t,ze,n]),nd=H(()=>{zc(p=>{let P=!p;return G.info("sidebarToggle",{collapsed:P}),o.saveSidebarCollapsed(P),n.emit("sidebarToggle",{collapsed:P}),P})},[o,n]),od=H(p=>{G.info("resize",p),ze({widgetSize:p}),n.emit("resize",p)},[ze,n]),sr=H(async p=>{G.info("selectConversation",{conversationId:p}),n.emit("selectConversation",{conversationId:p});try{let[P,A]=await Promise.all([Z.loadConversation(p),Mn(p)]),M=P.messages.map(Vr);Mt(()=>{m.value=Yt(M,A),f.value=P.conversationId}),b(A),o.saveConversationId(P.conversationId),P.agent&&ki(P.agent),Kt(P.canContinue),En(P.suggestions??[]),Xo("chat"),await Z.markRead(p),wt()}catch(P){n.emit("error",P),e.onError?.(P)}},[Z,m,f,n,e,o,wt,Mn,Yt]),$n=O(null),Di=H(p=>{typeof p=="string"&&(k?ue.fire("manual",p):$n.current=p)},[k,ue]);E(()=>{!k||!$n.current||(ue.fire("manual",$n.current),$n.current=null)},[k,ue]),E(()=>Ia(t,{open:nr,close:Qt,expand:ir,fullscreen:ar,openForm:Di}),[t,nr,Qt,ir,ar,Di]);let Te=ke(()=>xr(e,s,d,_),[e,s,d,_]);In.current=Te.strings;let rd=ke(()=>C.map(p=>{let P=St.list.find(A=>A.id===p.formId);return{...p,title:P?.title,form:P}}),[C,St]),$i={options:Te,transport:Z,feedback:le,bus:n,persistence:o,view:Nc,canSend:Gt,isStreaming:Be,loadingMessages:h,messagesSig:m,agent:Oc,suggestions:Jo,initialWidgetSize:l.widgetSize??null,visitorId:i,onClose:Qt,onClear:or,onExpand:ir,onFullscreen:ar,onSoundToggle:Jc,onToggleHistory:Qc,onSelectHistoryConversation:sr,onNewConversation:rr,onLocaleChange:Zc,onThemeChange:ed,onTextSizeChange:td,onWidgetSizeChange:od,onSend:Ni,onStop:Xc,onSuggestion:p=>{let P=p.text??p.label;G.info("suggestion",{text:P}),n.emit("suggestion",{text:P}),Ni(P,[])},activeForm:jc.value?.form??null,formMarkers:rd,onFormSubmit:ue.complete,onFormSkip:ue.skip,onFormFill:p=>ue.fire("manual",p),tool:Gc},id=p=>{sr(p);let P=K();P&&N.switchTab(P)};if(!F)return null;let Zt=Te.modules.list,lr=p=>{let P=bn("close",Te.mode,p);return Zt.length===0?r(yc,{strings:Te.strings,onClose:P?Qt:void 0}):Zt.length===1&&Zt[0]?.layout==="chat"?r(Xl,{...$i,panelSize:p}):r(Pc,{panelProps:{...$i,panelSize:p,onClose:P?Qt:void 0},enabledModules:Zt,nav:N,bus:n,unreadCount:y.value,onSelectConversation:id,onStartNewConversation:rr,onSetPanelSize:yt})};if(e.mode==="page"){let p=A=>{sr(A.conversationId)},P=Zt.some(A=>A.layout==="chat");return r("div",{class:`${qo}-anchor`,children:r(ec,{site:Dc,blocks:Hc,transport:Z,strings:Te.strings,locale:Te.locale,persistence:o,visitorId:i,showConversations:P,onSelectConversation:p,onNewConversation:rr,sidebarCollapsed:Fc,onToggleSidebarCollapsed:nd,children:lr("fullscreen")})})}if(oe){let p=e.mode==="standalone"?"fullscreen":Re;return r("div",{class:`${qo}-anchor`,children:lr(p)})}let Hi=e.mode==="drawer",Bi=!(e.mode==="modal")&&!e.launcher.hidden&&(!_e||xt),Fi=Bi&&!xt&&!Pt&&!Hi?Te.launcher.callout:null;return r("div",{class:`${qo}-anchor`,"data-launcher-size":Te.launcher.size,children:[_e||S?r("div",{class:`${qo}-surface`,hidden:!_e,children:lr(Re)}):null,Bi?r(pl,{onToggle:nr,launcher:Te.launcher,strings:Te.strings,leaving:xt,edgeTab:Hi}):null,Fi?r(ml,{callout:Fi,launcherPosition:Te.position,strings:Te.strings,closeLabel:Te.strings.close,onDismiss:Ge}):null]})}function Xp(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var Jp=120;async function Qp(e,t,n){let o=[];for(let i of t)try{let{id:a,url:l}=await e.uploadFile(i.file);o.push({id:a,name:i.name,mediaType:i.mediaType,size:i.size,url:l})}catch(a){n(a)}return o}function pi(e,t,n,o){let i={role:n,text:o};e.emit("message",i),t.onMessage?.(i)}var Zp=B.scope("error-boundary"),Go=class extends tt{constructor(){super(...arguments);q(this,"state",{crashed:!1})}componentDidCatch(n,o){Zp.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 em="1",tm=60,nm=2e3,Cc={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}),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 om(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function rm(){return location.origin+location.pathname}function im(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function Ec(e,t){let n=Math.random(),o=0,i=0,a=new Set,l=(c,d)=>{let{tracking:u,publicKey:_,aiAgentDeploymentId:g,mode:f,themeMode:m}=t.getOptions();if(!u.enabled||om()||n>=u.sampleRate)return;let y=performance.now();if(y-o>6e4&&(o=y,i=0),++i>tm)return;let h=new URLSearchParams;h.set("v",em),h.set("_ev",Rt),h.set("e",c),u.token&&h.set("tk",u.token),_&&h.set("pk",_),g&&h.set("dep",g),h.set("vid",t.getVisitorId());let v=t.getConversationId();v&&h.set("cid",v),h.set("url",rm());let C=im();C&&h.set("ref",C),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),d)for(let[ae,N]of Object.entries(d))N!==void 0&&h.set(ae,String(N));h.set("ts",String(Date.now()));let b=`${u.endpoint}?${h}`;if(b.length>nm)return;let T=new Image(1,1);a.add(T);let K=()=>a.delete(T);T.addEventListener("load",K,{once:!0}),T.addEventListener("error",K,{once:!0}),T.src=b},s=Object.keys(Cc).map(c=>e.on(c,d=>l(c,Cc[c]?.(d))));return()=>{for(let c of s)c();a.clear()}}function Ko(e){let{bus:t,host:n,appRoot:o,persistence:i,reportError:a}=e,l=e.initialRaw,s,c=Ze(l),d=!0,u=()=>{c=Ze(s?Pr(l,s):l)},_=()=>{Ba(n,ut(c.mode));let m=i.loadUserPrefs().themeMode;Fa(n,m?{...c,themeMode:m}:c),d&&(oo(n,mi(c)),d=!1)},g=()=>{_(),Tt(no(Go,{onError:a},no(kc,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",m=>{m.config&&(m.config.storageVersion&&i.rememberStorageVersion(m.config.storageVersion),s=m.config,u(),g())});let f=Ec(t,{getOptions:()=>c,getVisitorId:()=>i.getVisitorId(),getConversationId:()=>i.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>l,render:g,setUserOptions:m=>{l=m,u(),g()},patchUserOptions:m=>{l={...l,...m},u(),g()},destroy:()=>f()}}function mi(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=nt(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:o}=pn(e,Dt(),t.loadPanelOpen(),t.loadPanelSize());return fo(e.mode,o,n)}var am=B.scope("hooks"),gi="*",fi=new Set;function hi(e,t,n){let o={widgetId:e,event:t,listener:n};return fi.add(o),()=>{fi.delete(o)}}function sm(e,t,n){let o=[...fi];for(let i of o)if(lm(i.widgetId,e.widgetId)&&!(i.event!==gi&&i.event!==t))try{i.listener(e,t,n)}catch(a){am.warn("hook listener threw",{event:t,error:a})}}function Tc(e,t){let n=[];for(let o of cm)n.push(t.on(o,i=>{sm(e,o,i)}));return()=>{for(let o of n)o()}}function vi(e){if(Array.isArray(e))for(let t of e){let n=dm(t);n&&hi(n.widgetId,n.event,n.listener)}}function lm(e,t){return e===gi||e===t}var cm=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","visitorRebound","conversationRebound"];function dm(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 Qe=new Map;function jo(e){e.debug!==void 0&&Wn(e.debug);let t=B.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=Ze(e),o=n.widgetId,i=Qe.get(o);i&&(t.debug("destroy existing instance at slot",{widgetId:o}),i.destroy());let a=mi(n),l=n.iframe?Wa({position:ut(n.mode)},n.position,a,n.mode,e.target??null):It({position:ut(n.mode),target:e.target??null});l.hostElement.dataset.widgetId=o;let s=new At,c=nt(o,n.storage,n.aiAgentDeploymentId),d=y=>{s.emit("error",y),u.getOptions().onError?.(y)},u=Ko({bus:s,host:l.hostElement,appRoot:l.appRoot,persistence:c,initialRaw:e,reportError:d});u.render();let _=l.hostElement,g=null,f=y=>{y.debug!==void 0&&Wn(y.debug),u.patchUserOptions(y)},m={widgetId:o,open:()=>an(_,"open"),close:()=>an(_,"close"),expand:()=>an(_,"expand"),openForm:y=>an(_,"openForm",y),on:(y,h)=>s.on(y,h),update:y=>{t.debug("update",{patch:y}),f(y)},setUserContext:y=>{t.debug("setUserContext",{keys:Object.keys(y)}),f({userContext:{...u.getUserOptions().userContext,...y}})},clearUserContext:()=>{t.debug("clearUserContext"),f({userContext:void 0})},setPageContext:y=>{t.debug("setPageContext",{keys:Object.keys(y)}),f({pageContext:{...u.getUserOptions().pageContext,...y}})},clearPageContext:()=>{t.debug("clearPageContext"),f({pageContext:void 0})},setDebug:y=>{Wn(y),t.info("debug level set",{level:tn()})},debugLevel:()=>tn(),onLog:y=>nn(y),destroy:()=>{t.info("destroy",{widgetId:o}),g?.(),u.destroy(),s.clear(),Tt(null,l.appRoot),l.destroy(),Qe.get(o)===m&&Qe.delete(o)}};return g=Tc(m,s),Qe.set(o,m),m}function Yo(e){let t=e.widgetId??"default",n=Qe.get(t);return n?(n.update(e),n):jo(e)}function bi(e){if(e!==void 0){Qe.get(e)?.destroy();return}let t=[...Qe.values()];for(let n of t)n.destroy()}function qe(e="default"){return Qe.get(e)??null}function Rc(){return[...Qe.values()]}function xi(e,t,n){return hi(e,t,n)}var Ic=Rt;var Pi=class extends HTMLElement{constructor(){super(...arguments);q(this,"bus",new At);q(this,"mountResult",null);q(this,"runtime",null)}static get observedAttributes(){return yr}connectedCallback(){this.boot()}disconnectedCallback(){this.mountResult&&(this.runtime?.destroy(),this.runtime=null,Tt(null,this.mountResult.appRoot),this.bus.clear())}attributeChangedCallback(){this.isConnected&&this.boot()}boot(){let n=Kn(a=>this.getAttribute(a));if(this.runtime){this.runtime.setUserOptions(n);return}let o=Ze(n);this.mountResult||(this.mountResult=It({existingHost:this,position:ut(o.mode)}));let i=nt(o.widgetId,o.storage,o.aiAgentDeploymentId);this.runtime=Ko({bus:this.bus,host:this.mountResult.hostElement,appRoot:this.mountResult.appRoot,persistence:i,initialRaw:n,reportError:a=>this.bus.emit("error",a)}),this.runtime.render()}},Ac=!1;function yi(){if(Ac||typeof customElements>"u")return;let e=x.tagName;customElements.get(e)||customElements.define(e,Pi),Ac=!0}typeof customElements<"u"&&yi();var Lc=B.scope("iife"),Si={close:()=>qe()?.close(),destroy:()=>bi(),expand:()=>qe()?.expand(),hook:(e,t,n)=>typeof e=="string"&&typeof t=="string"&&typeof n=="function"?xi(e,t,n):void 0,init:e=>Yo(e),mount:e=>jo(e),on:(e,t)=>qe()?.on(e,t),onLog:e=>nn(e),open:()=>qe()?.open(),setDebug:e=>qe()?.setDebug(e),update:e=>qe()?.update(e)};function Mc(e,...t){let n=Si[e];if(!n){Lc.warn("unknown command",{command:e});return}return n(...t)}function _m(){let e=((n,...o)=>Mc(n,...o));e.init=Yo,e.mount=jo,e.destroy=bi,e.getInstance=qe,e.getAllInstances=Rc,e.version=Ic,e.hook=xi,e.debugLevel=()=>tn(),e.onLog=nn;let t=new Set(["init","mount","hook","onLog"]);for(let n of Object.keys(Si))t.has(n)||(e[n]=(...o)=>Si[n](...o));return e}function um(e){let t=e?.q;if(t)for(let n of t){let o=[...n],[i,...a]=o;if(typeof i=="string")try{Mc(i,...a)}catch(l){Lc.warn("queued command failed",{command:i,error:l})}}}function pm(){let e=[],t=e.push.bind(e);return e.push=(...n)=>{for(let o of n)vi([o]);return t(...n)},e}function mm(){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 fm(){if(typeof window>"u"||typeof document>"u")return;let e=globalThis[x.global],t=_m();globalThis[x.global]=t,yi();let n=`${x.global}Hooks`,o=globalThis[n];if(vi(o),globalThis[n]=pm(),um(e),qe())return;let i=document.currentScript??mm(),a=Sr(i?.dataset);if(!a.publicKey)return;let l=()=>{qe()||Yo(a)};if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",l,{once:!0});return}l()}fm();return _d(gm);})();
40
40
  //# sourceMappingURL=elements.js.map